@inappstory/js-sdk 3.4.3 → 3.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.mjs +2 -601
- package/dist/index.umd.js +2 -601
- package/dist/types/appearance-manager/goodsWidget.d.ts +13 -5
- package/package.json +1 -1
package/dist/index.esm.mjs
CHANGED
|
@@ -1,325 +1,4 @@
|
|
|
1
|
-
import*as e from"react";import*as t from"events";import*as r from"lodash/isFunction.js";import*as i from"uuid";import*as a from"lodash/isObject.js";import*as s from"lodash/isNil.js";import*as n from"mobx";import*as o from"lodash/isString.js";import*as l from"lodash/isEqual.js";import*as d from"lodash/head.js";import*as c from"deepmerge";import*as u from"lodash/isNumber.js";import*as h from"@inappstory/video-player";import*as p from"@inappstory/slide-api";import*as g from"async-mutex";import*as f from"lodash/debounce.js";import*as m from"lodash/isEmpty.js";import*as v from"react-dom/client";import*as b from"classnames";import*as y from"mobx-react-lite";import*as w from"react-dom";import*as S from"react-input-mask";import*as _ from"lit";import*as O from"lit/decorators.js";import*as C from"lit/static-html.js";import*as x from"lit/directives/style-map.js";import*as k from"lit/directives/class-map.js";import*as P from"lit/directives/unsafe-html.js";import*as j from"bowser";import*as M from"css-font-parser";import*as E from"parse-css-sides";var I={432:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.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-bottom:25px}.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}}",""]),a.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 s=a},669:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".aspect-ratio-box--u2SLt{overflow:hidden;position:relative}.aspect-ratio-box--u2SLt.aspect-ratio-box--centered--ZWs8d{width:auto;height:100%;left:50%;transform:translateX(-50%)}.aspect-ratio-box-inside--U\\+o3F{position:absolute;top:0;left:0;width:100%;height:100%}",""]),a.locals={"aspect-ratio-box":"aspect-ratio-box--u2SLt","aspect-ratio-box--centered":"aspect-ratio-box--centered--ZWs8d","aspect-ratio-box-inside":"aspect-ratio-box-inside--U+o3F"};const s=a},843:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".close-btn--KhMED{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:20px;z-index:1140;pointer-events:all;cursor:pointer;outline:none;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.close-btn--KhMED:focus{outline:none}.close-btn--KhMED svg{overflow:visible}.close-btn--KhMED[data-position=start],.close-btn--KhMED[data-position=left]{left:10px}.close-btn--KhMED[data-position=start][dir=rtl],.close-btn--KhMED[data-position=left][dir=rtl]{left:auto;right:10px}.close-btn--KhMED[data-position=end],.close-btn--KhMED[data-position=right]{right:10px}.close-btn--KhMED[data-position=end][dir=rtl],.close-btn--KhMED[data-position=right][dir=rtl]{left:10px;right:auto}",""]),a.locals={"close-btn":"close-btn--KhMED"};const s=a},495:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'@keyframes spin--JuRkn{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.splash-container--4toz\\+{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;z-index:-1}.splash-container--4toz\\+ .splash-container__image--\\+1PkF{position:absolute;inset:0px;z-index:0}.splash-container--4toz\\+ .splash-container__image--\\+1PkF img{width:100%;height:100%;object-fit:cover}.splash-container--4toz\\+ .splash-container__lottie--f24Xy{position:absolute;inset:0px;z-index:1}.splash-container--4toz\\+ .splash-container__lottie--f24Xy canvas{width:100%;height:100%}.splash-container--4toz\\+.splash-container--isLoading--d8pYm:after{display:inline-block;position:absolute;top:calc(50% - 1rem);left:calc(50% - 1rem);content:"";width:2rem;height:2rem;border:solid 2px var(--GRLoaderBackgroundColor, white);border-color:var(--GRLoaderBackgroundAccentColor, transparent) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white);border-radius:50%;animation:spin--JuRkn .6s infinite linear;z-index:10}.splash-container--4toz\\+.splash-container--fadeIn--TD58C{opacity:1;transition:opacity ease-in .2s}.splash-container--4toz\\+.splash-container--fadeOut--GW15o{opacity:0;transition:opacity ease-out .3s}',""]),a.locals={"splash-container":"splash-container--4toz+","splash-container__image":"splash-container__image--+1PkF","splash-container__lottie":"splash-container__lottie--f24Xy","splash-container--isLoading":"splash-container--isLoading--d8pYm",spin:"spin--JuRkn","splash-container--fadeIn":"splash-container--fadeIn--TD58C","splash-container--fadeOut":"splash-container--fadeOut--GW15o"};const s=a},289:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.game-reader-container--qAxmf{background-color:rgba(0,0,0,0);position:fixed;left:0px;top:0px;padding:0px;border:0px;z-index:2147483645;width:100%;height:100%;overflow:hidden;color-scheme:auto}.game-reader--vz8\\+v{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0);z-index:1;user-select:none;pointer-events:all;color:#fff}.game-reader--vz8\\+v.game-reader--desktop-mode--hEnbE{padding:50px 0}.game-reader--vz8\\+v.game-reader--desktop-mode--hEnbE .game-reader__game-box--tDgOl{border-radius:var(--game-box-border-radius)}.game-reader--vz8\\+v.game-reader--widescreen--4rob-{padding:0 0}.game-reader--vz8\\+v.game-reader--widescreen--4rob- .game-reader__game-box--tDgOl{border-radius:0px}.game-reader--vz8\\+v .game-reader__refresh-btn--gKfAr{cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%, -50%, 0);z-index:2}.game-reader--vz8\\+v .game-reader__game-box--tDgOl.game-reader__game-box--widescreen--DD\\+rV{border-radius:0px}.game-reader--vz8\\+v .game-reader__iframe--e3dlS{width:100%;height:100%;transition:opacity ease-in .3s}.game-reader--vz8\\+v .game-reader__backdrop--g2Ozw{position:fixed;inset:0;z-index:-1}',""]),a.locals={"game-reader-container":"game-reader-container--qAxmf","game-reader":"game-reader--vz8+v","game-reader--desktop-mode":"game-reader--desktop-mode--hEnbE","game-reader__game-box":"game-reader__game-box--tDgOl","game-reader--widescreen":"game-reader--widescreen--4rob-","game-reader__refresh-btn":"game-reader__refresh-btn--gKfAr","game-reader__game-box--widescreen":"game-reader__game-box--widescreen--DD+rV","game-reader__iframe":"game-reader__iframe--e3dlS","game-reader__backdrop":"game-reader__backdrop--g2Ozw"};const s=a},314:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,":root{--ias-sat: env(safe-area-inset-top);--ias-sar: env(safe-area-inset-right);--ias-sab: env(safe-area-inset-bottom);--ias-sal: env(safe-area-inset-left)}",""]),a.locals={};const s=a},938:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,"h3{margin:0}.stories-list-wrapper--\\+MxOM{background-color:var(--background-color, transparent);height:auto;padding:0;position:relative}.stories-list-wrapper--\\+MxOM.mode-desktop--Blm52.with-list-controls--CGYBY{position:relative}.stories-list--deukx{position:relative;overflow:visible}@media(min-width: 767.99px){.stories-list--deukx{overflow:hidden}}.stories-list__actions--p-QOR{position:absolute;right:0;top:0}.stories-list__viewport--m27BY{overflow:hidden;height:auto}.stories-list__viewport--m27BY:not(.mode-desktop--Blm52){display:flex}.stories-list__viewport-inner--oy\\+N4{display:flex;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding-top:var(--storiesListTopPadding, 0);padding-bottom:var(--storiesListBottomPadding, 0);box-sizing:content-box}.stories-list__viewport-inner--oy\\+N4::-webkit-scrollbar{display:none}.stories-list__viewport-inner--oy\\+N4.mode-desktop--Blm52{scroll-behavior:unset;cursor:grab}.stories-list__viewport-inner--oy\\+N4.isVerticalDirection--P3UBw{flex-flow:row wrap}.stories-list__viewport-inner--oy\\+N4.align-center--9y43R{margin-left:auto;margin-right:auto}.stories-list__viewport-inner--oy\\+N4.align-left--Dm8Do{margin-right:auto}.stories-list__viewport-inner--oy\\+N4.align-right--bQ1a2{margin-left:auto}.stories-list__viewport-inner--oy\\+N4.isTitleCardOutsideTop--AeG\\+D{align-items:flex-end}.stories-list__viewport-inner--oy\\+N4.isTitleCardOutsideBottom--1P95a{align-items:flex-start}",""]),a.locals={"stories-list-wrapper":"stories-list-wrapper--+MxOM","mode-desktop":"mode-desktop--Blm52","with-list-controls":"with-list-controls--CGYBY","stories-list":"stories-list--deukx","stories-list__actions":"stories-list__actions--p-QOR","stories-list__viewport":"stories-list__viewport--m27BY","stories-list__viewport-inner":"stories-list__viewport-inner--oy+N4",isVerticalDirection:"isVerticalDirection--P3UBw","align-center":"align-center--9y43R","align-left":"align-left--Dm8Do","align-right":"align-right--bQ1a2",isTitleCardOutsideTop:"isTitleCardOutsideTop--AeG+D",isTitleCardOutsideBottom:"isTitleCardOutsideBottom--1P95a"};const s=a},533:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".favorite-images-wrapper--ypxcM{display:flex;flex-direction:row;flex-wrap:wrap;padding:var(--storiesListCardFavoriteTitle, --storiesListItemTitlePadding, 0px);gap:var(--storiesListCardFavoriteGap, 3px);box-sizing:border-box}.favorite-image-wrapper--iFI60{flex:0 1 calc(50% - var(--storiesListCardFavoriteGap, 3px));position:relative}.favorite-image--H\\+mP1{position:relative}.favorite-image-item--ylNcQ{position:absolute;inset:0px;border-radius:calc(var(--storiesListInnerBorderRadiusRead, 0)/4);background-position:50% 50%;background-size:cover}.circle_style--umugM .favorite-image-item--ylNcQ{border-radius:50%}",""]),a.locals={"favorite-images-wrapper":"favorite-images-wrapper--ypxcM","favorite-image-wrapper":"favorite-image-wrapper--iFI60","favorite-image":"favorite-image--H+mP1","favorite-image-item":"favorite-image-item--ylNcQ",circle_style:"circle_style--umugM"};const s=a},811:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.stories-slide-wrapper--\\+5j4I:not(:last-child){margin-right:var(--storiesGap, 20px)}.stories-slide-wrapper--\\+5j4I{display:flex;flex-direction:column;flex:0 0 auto;box-sizing:content-box;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.stories-slide-wrapper--\\+5j4I:hover{text-decoration:none}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO{display:block;box-sizing:border-box;text-align:left;position:relative;overflow:visible;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);border:var(--storiesListBorderNotReadWidth, 2px) solid var(--storiesBorderNotReadColor, #00b956);padding:var(--storiesListBorderGapNotRead, 2px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU{border-radius:var(--storiesListBorderRadius, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide-image--cxCFY,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide-image--cxCFY{border-radius:var(--storiesListInnerBorderRadiusNotRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide-image__image--mNEIE,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide-image__image--mNEIE video,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide-image__image--mNEIE,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide-image__image--mNEIE video{border-radius:var(--storiesListInnerBorderRadiusNotRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide__mask--p6utN,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide__mask--p6utN{border-radius:var(--storiesListInnerBorderRadiusNotRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide__content--QrUVw,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide__content--QrUVw{border-radius:var(--storiesListInnerBorderRadiusNotRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe{border-radius:var(--storiesListBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide-image--cxCFY,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide-image--cxCFY{border-radius:var(--storiesListInnerBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide-image__image--mNEIE,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide-image__image--mNEIE video,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide-image__image--mNEIE,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide-image__image--mNEIE video{border-radius:var(--storiesListInnerBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide__mask--p6utN,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide__mask--p6utN{border-radius:var(--storiesListInnerBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide__content--QrUVw,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide__content--QrUVw{border-radius:var(--storiesListInnerBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._is-read--xEVZe{border:var(--storiesListBorderReadWidth, 1px) solid var(--storiesBorderReadColor, #ededed)}.stories-slide-wrapper--\\+5j4I.isTitleCardOutsideTop--EmWjs{justify-content:flex-end}.stories-slide-wrapper--\\+5j4I.isTitleCardOutsideBottom--W1JSg{justify-content:flex-start}.stories-slide-wrapper--\\+5j4I .stories-slide__inner--doJqj{display:block;position:relative;width:100%;height:100%}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-black--M47zI{background:#000}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-white--0Coab{background:#fff}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-red--UU5V7{background:#ff1a36}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-yellow--0cCZc{background:#fff000}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-green--10A4n{background:#0be361}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-violet--bnIBG{background:#b300bc}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-blue--lpzRG{background:#0761db}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-grey--nbEfc{background:#a8a8a8}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-black-gradient--q\\+aHV{background:#fff;background:linear-gradient(0deg, #c1c1c1, #000)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-white-gradient--YqOjh{background:#fff;background:linear-gradient(180deg, #fff, #ffc800)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-red-gradient---eK73{background:#ff1a36;background:linear-gradient(180deg, #c90174, #eb5c57)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-yellow-gradient--xg23E{background:#fff000;background:linear-gradient(0deg, #fbda61, #f76b1c)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-green-gradient--LfrRF{background:#0be361;background:linear-gradient(0deg, #b4ed50, #429321)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-violet-gradient--EQOBs{background:#b300bc;background:linear-gradient(180deg, #c90174, #0164fd)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-blue-gradient--TJV7z{background:#0761db;background:linear-gradient(180deg, #3023ae, #53a0fe 48%, #b4ed50)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-grey-gradient--4zJ9u{background:#a8a8a8;background:linear-gradient(0deg, #e2e2e2, #959595)}.stories-slide-wrapper--\\+5j4I .stories-slide-image--cxCFY{position:relative;width:100%;height:100%}.stories-slide-wrapper--\\+5j4I .stories-slide-image__wrap--kAiGt{position:absolute;top:0;bottom:0;left:0;right:0}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE{position:relative;opacity:1;transition:opacity .3s ease-in-out;overflow:hidden}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE._mode_list--K7WdU{width:100%;height:100%}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE.ugc-card-cell--Hmi8u img{object-fit:contain}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE img{width:100%;height:100%;object-fit:cover}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE video{min-height:100%;min-width:100%;width:100%;background-position:center center;background-repeat:no-repeat;object-fit:cover;opacity:0}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE.video-loaded--380fQ img{display:none}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE.video-loaded--380fQ video{opacity:1}.stories-slide-wrapper--\\+5j4I .stories-slide__mask--p6utN{position:absolute;top:0;bottom:0;left:0;right:0;z-index:2;background-color:var(--storiesListItemMaskColor, rgba(0, 0, 0, 0));background-image:var(--storiesListItemMaskLinearGradient, none);opacity:1}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._is-read--xEVZe .stories-slide__mask--p6utN{background-color:var(--storiesListItemOpenedMaskColor, rgba(0, 0, 0, 0));background-image:var(--storiesListItemOpenedMaskLinearGradient, none)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._ugc-cell--yAsON .stories-slide__mask--p6utN{background-color:var(--storiesListCardUgcMaskColor, rgba(0, 0, 0, 0));background-image:var(--storiesListCardUgcMaskLinearGradient, none)}.stories-slide-wrapper--\\+5j4I .stories-slide__content--QrUVw{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;height:100%;max-height:100%;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;font-family:var(--storiesListItemTitleFontFamily);font-weight:normal;font-size:1rem;line-height:normal;font:var(--storiesListItemTitleFont, normal);text-decoration:none;padding:var(--storiesListItemTitlePadding, 0px)}.stories-slide-wrapper--\\+5j4I .stories-slide__content--QrUVw.__position_outside_top--5TlyN,.stories-slide-wrapper--\\+5j4I .stories-slide__content--QrUVw.__position_outside_bottom--pXuxb{position:relative;top:unset;right:unset;bottom:unset;left:unset;height:auto}.stories-slide-wrapper--\\+5j4I .clamp--X7TaH{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}.stories-slide-wrapper--\\+5j4I .stories-slide__title--XeSlz{white-space:pre-wrap;overflow-wrap:anywhere;-webkit-user-select:none;user-select:none}.stories-slide-wrapper--\\+5j4I .stories-slide__title--XeSlz.align-left--PkXxY{text-align:left}.stories-slide-wrapper--\\+5j4I .stories-slide__title--XeSlz.align-center--9Flsz{text-align:center}.stories-slide-wrapper--\\+5j4I .stories-slide__title--XeSlz.align-right--wSGXZ{text-align:right}.stories-slide--KQzLO._format-circle--yaqgh,.stories-slide--KQzLO._format-circle--yaqgh .stories-slide-image__image--mNEIE,.stories-slide--KQzLO._format-circle--yaqgh .stories-slide-image__image--mNEIE video,.stories-slide--KQzLO._format-circle--yaqgh .stories-slide__mask--p6utN,.stories-slide--KQzLO._format-circle--yaqgh .stories-slide-image--cxCFY{border-radius:50%}.stories-slide--KQzLO._favorite-cell--CbxlS .stories-slide__mask--p6utN{background-image:linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.5) 100%)}.stories-slide--KQzLO._favorite-cell--CbxlS._format-circle--yaqgh .stories-slide-image__wrap--kAiGt{display:flex}.stories-slide--KQzLO._favorite-cell--CbxlS._format-circle--yaqgh .stories-slide-image__image--mNEIE{width:85%;height:85%;overflow:visible;margin:auto}.stories-slide--KQzLO._favorite-cell--CbxlS._format-circle--yaqgh .favorite-images-wrapper--zfyVz{margin:0;padding:0}.stories-slide--KQzLO._has-drop-shadow--GdCOv{filter:drop-shadow(var(--storiesListCardDropShadow, none))}.stories-slide--KQzLO._has-drop-shadow--GdCOv._is-read--xEVZe{filter:drop-shadow(var(--storiesListCardOpenedDropShadow, none))}.stories-slide--KQzLO._has-drop-shadow--GdCOv._favorite-cell--CbxlS{filter:drop-shadow(var(--storiesListCardFavoriteDropShadow, none))}.stories-slide--KQzLO._has-drop-shadow--GdCOv._ugc-cell--yAsON{filter:drop-shadow(var(--storiesListCardUgcDropShadow, none))}.stories-slide--KQzLO._has-card-svg-mask--0vIiG .stories-slide__inner--doJqj{-webkit-mask-image:var(--storiesListCardMask);mask-image:var(--storiesListCardMask)}.stories-slide--KQzLO._has-card-svg-mask--0vIiG._is-read--xEVZe .stories-slide__inner--doJqj{-webkit-mask-image:var(--storiesListCardOpenedMask);mask-image:var(--storiesListCardOpenedMask)}.stories-slide--KQzLO._has-card-svg-mask--0vIiG._favorite-cell--CbxlS .stories-slide__inner--doJqj{-webkit-mask-image:var(--storiesListCardFavoriteMask);mask-image:var(--storiesListCardFavoriteMask)}.stories-slide--KQzLO._has-card-svg-mask--0vIiG._ugc-cell--yAsON .stories-slide__inner--doJqj{-webkit-mask-image:var(--storiesListCardUgcMask);mask-image:var(--storiesListCardUgcMask)}.stories-slide--KQzLO .card-overlay-svg-mask--NPptq{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;z-index:3}@supports(((mask-image: linear-gradient(0deg, #fff, #fff), linear-gradient(0deg, #fff, #fff)) and (mask-clip: content-box, border-box)) or ((-webkit-mask-image: linear-gradient(0deg, #fff, #fff), linear-gradient(0deg, #fff, #fff)) and (-webkit-mask-clip: content-box, border-box))) and ((mask-composite: exclude) or (-webkit-mask-composite: xor)){.stories-slide--KQzLO._has-border-gradient-color--JRjv-{border-color:rgba(0,0,0,0)}.stories-slide--KQzLO._has-border-gradient-color--JRjv-:before{content:"";position:absolute;border-radius:inherit;box-sizing:border-box;-webkit-mask-composite:xor;mask-composite:exclude;padding:var(--storiesListBorderNotReadWidth, 2px);top:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);right:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);bottom:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);left:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);background:var(--storiesBorderNotReadGradientColor, transparent);-webkit-mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);-webkit-mask-clip:content-box,border-box;mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);mask-clip:content-box,border-box}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._is-read--xEVZe{border-color:rgba(0,0,0,0)}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._is-read--xEVZe:before{padding:var(--storiesListBorderReadWidth, 2px);top:calc(var(--storiesListBorderReadWidth, 2px)*-1);right:calc(var(--storiesListBorderReadWidth, 2px)*-1);bottom:calc(var(--storiesListBorderReadWidth, 2px)*-1);left:calc(var(--storiesListBorderReadWidth, 2px)*-1);background:var(--storiesBorderReadGradientColor, transparent);-webkit-mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);-webkit-mask-clip:content-box,border-box;mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);mask-clip:content-box,border-box}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._favorite-cell--CbxlS{border-color:rgba(0,0,0,0)}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._favorite-cell--CbxlS:before{padding:var(--storiesListBorderNotReadWidth, 2px);top:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);right:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);bottom:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);left:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);background:var(--storiesListCardFavoriteGradientColor, transparent);-webkit-mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);-webkit-mask-clip:content-box,border-box;mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);mask-clip:content-box,border-box}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._ugc-cell--yAsON{border-color:rgba(0,0,0,0)}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._ugc-cell--yAsON:before{padding:var(--storiesListBorderNotReadWidth, 2px);top:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);right:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);bottom:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);left:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);background:var(--storiesListCardUgcGradientColor, transparent);-webkit-mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);-webkit-mask-clip:content-box,border-box;mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);mask-clip:content-box,border-box}}',""]),a.locals={"stories-slide-wrapper":"stories-slide-wrapper--+5j4I","stories-slide":"stories-slide--KQzLO","_format-quad":"_format-quad--InfBL","_format-rectangle":"_format-rectangle--koqBU","stories-slide-image":"stories-slide-image--cxCFY","stories-slide-image__image":"stories-slide-image__image--mNEIE","stories-slide__mask":"stories-slide__mask--p6utN","stories-slide__content":"stories-slide__content--QrUVw","_is-read":"_is-read--xEVZe",isTitleCardOutsideTop:"isTitleCardOutsideTop--EmWjs",isTitleCardOutsideBottom:"isTitleCardOutsideBottom--W1JSg","stories-slide__inner":"stories-slide__inner--doJqj","_background-color-black":"_background-color-black--M47zI","_background-color-white":"_background-color-white--0Coab","_background-color-red":"_background-color-red--UU5V7","_background-color-yellow":"_background-color-yellow--0cCZc","_background-color-green":"_background-color-green--10A4n","_background-color-violet":"_background-color-violet--bnIBG","_background-color-blue":"_background-color-blue--lpzRG","_background-color-grey":"_background-color-grey--nbEfc","_background-color-black-gradient":"_background-color-black-gradient--q+aHV","_background-color-white-gradient":"_background-color-white-gradient--YqOjh","_background-color-red-gradient":"_background-color-red-gradient---eK73","_background-color-yellow-gradient":"_background-color-yellow-gradient--xg23E","_background-color-green-gradient":"_background-color-green-gradient--LfrRF","_background-color-violet-gradient":"_background-color-violet-gradient--EQOBs","_background-color-blue-gradient":"_background-color-blue-gradient--TJV7z","_background-color-grey-gradient":"_background-color-grey-gradient--4zJ9u","stories-slide-image__wrap":"stories-slide-image__wrap--kAiGt",_mode_list:"_mode_list--K7WdU","ugc-card-cell":"ugc-card-cell--Hmi8u","video-loaded":"video-loaded--380fQ","_ugc-cell":"_ugc-cell--yAsON",__position_outside_top:"__position_outside_top--5TlyN",__position_outside_bottom:"__position_outside_bottom--pXuxb",clamp:"clamp--X7TaH","stories-slide__title":"stories-slide__title--XeSlz","align-left":"align-left--PkXxY","align-center":"align-center--9Flsz","align-right":"align-right--wSGXZ","_format-circle":"_format-circle--yaqgh","_favorite-cell":"_favorite-cell--CbxlS","favorite-images-wrapper":"favorite-images-wrapper--zfyVz","_has-drop-shadow":"_has-drop-shadow--GdCOv","_has-card-svg-mask":"_has-card-svg-mask--0vIiG","card-overlay-svg-mask":"card-overlay-svg-mask--NPptq","_has-border-gradient-color":"_has-border-gradient-color--JRjv-"};const s=a},731:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-list-controls--sC1DN{pointer-events:none}.stories-list-controls--sC1DN .control-start--NWniL,.stories-list-controls--sC1DN .control-end--Ezk33{cursor:pointer;position:absolute;background-color:var(--storiesListControlsBackgroundColor, white);border-radius:50%;z-index:10;height:var(--storiesListControlsSize);width:var(--storiesListControlsSize);top:50%;display:flex;justify-content:center;align-items:center;pointer-events:all}.stories-list-controls--sC1DN .control-icon--D3DFc{width:7px;height:12px;background-color:var(--storiesListControlsColor, black)}.stories-list-controls--sC1DN.horizontal--g63LL .control-start--NWniL{left:0;transform:translateY(-50%)}.stories-list-controls--sC1DN.horizontal--g63LL .control-start--NWniL.control-start_dir_rtl--7Opm5{left:auto;right:0}.stories-list-controls--sC1DN.horizontal--g63LL .control-end--Ezk33{right:0;transform:translateY(-50%)}.stories-list-controls--sC1DN.horizontal--g63LL .control-end--Ezk33.control-end_dir_rtl--twvGk{left:0;right:auto}.stories-list-controls--sC1DN.vertical--1a8qJ .control-start--NWniL{top:var(--storiesListTopPadding, 0);left:50%;transform:translate3d(-50%, 0, 0) rotate(90deg)}.stories-list-controls--sC1DN.vertical--1a8qJ .control-end--Ezk33{top:auto;bottom:var(--storiesListBottomPadding, 0);right:50%;transform:translate3d(50%, 0, 0) rotate(90deg)}.stories-list-controls--sC1DN .control-start--NWniL{display:flex}.stories-list-controls--sC1DN .control-start--NWniL .control-icon--D3DFc{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 11L1 6L6 1' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 11L1 6L6 1' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\")}.stories-list-controls--sC1DN .control-start--NWniL.control-start_reach-start--sBg3n{display:none}.stories-list-controls--sC1DN .control-end--Ezk33{display:flex}.stories-list-controls--sC1DN .control-end--Ezk33 .control-icon--D3DFc{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 11L6 6L1 1' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 11L6 6L1 1' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\")}.stories-list-controls--sC1DN .control-end--Ezk33.control-end_reach-end--\\+gjXw{display:none}",""]),a.locals={"stories-list-controls":"stories-list-controls--sC1DN","control-start":"control-start--NWniL","control-end":"control-end--Ezk33","control-icon":"control-icon--D3DFc",horizontal:"horizontal--g63LL","control-start_dir_rtl":"control-start_dir_rtl--7Opm5","control-end_dir_rtl":"control-end_dir_rtl--twvGk",vertical:"vertical--1a8qJ","control-start_reach-start":"control-start_reach-start--sBg3n","control-end_reach-end":"control-end_reach-end--+gjXw"};const s=a},130:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-viewer--U\\+VEJ{position:fixed;z-index:1100;top:0;left:0;width:100%;height:100%;display:block;transition:opacity .3s ease;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.stories-viewer--U\\+VEJ:-webkit-full-screen,.stories-viewer--U\\+VEJ:-moz-full-screen,.stories-viewer--U\\+VEJ:-ms-fullscreen,.stories-viewer--U\\+VEJ :fullscreen{width:100% !important;height:100% !important}.stories-viewer-background--rxrSL{position:fixed;top:-60px;left:-60px;width:calc(100% + 120px);height:calc(100% + 120px);background-position:center;background-repeat:no-repeat;background-size:cover}.stories-viewer-backdrop--GqsGY{position:fixed;top:0;right:0;bottom:0;left:0;z-index:11;background-color:rgba(255,255,255,.5)}.stories-viewer-backdrop--GqsGY._desktopMode--5f5bI{display:none}.slider3d--fgseF{position:fixed !important}.slider3d--fgseF.no-select--qQk5D{user-select:none}",""]),a.locals={"stories-viewer":"stories-viewer--U+VEJ","stories-viewer-background":"stories-viewer-background--rxrSL","stories-viewer-backdrop":"stories-viewer-backdrop--GqsGY",_desktopMode:"_desktopMode--5f5bI",slider3d:"slider3d--fgseF","no-select":"no-select--qQk5D"};const s=a},187:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-button-panel--tzCuh{position:absolute;z-index:10001;bottom:0;left:0;width:100%;background-color:#000;border-bottom-left-radius:var(--slideBorderRadius, 0);border-bottom-right-radius:var(--slideBorderRadius, 0)}.stories-button-panel--tzCuh[dir=rtl] .stories-button-panel-actions--I0rFL .right-container--Ax9TH{margin-left:0;margin-right:auto}.stories-button-panel-actions--I0rFL{position:absolute;top:0;left:0;width:100%;height:50px;padding:0 4px;display:flex;flex-direction:row;color:#fff;align-items:center}.stories-button-panel-actions--I0rFL>span{display:flex}.stories-button-panel-actions--I0rFL .right-container--Ax9TH{margin-left:auto}.button-panel-action--rHoQs{cursor:pointer;pointer-events:all;display:flex;align-items:center;justify-content:center;height:50px;width:38px}.button-panel-action--rHoQs>*{pointer-events:none}",""]),a.locals={"stories-button-panel":"stories-button-panel--tzCuh","stories-button-panel-actions":"stories-button-panel-actions--I0rFL","right-container":"right-container--Ax9TH","button-panel-action":"button-panel-action--rHoQs"};const s=a},108:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".goods-card--BAL7e{width:100px}.goods-card--BAL7e:first-of-type{margin-left:.5rem}.goods-card--BAL7e:not(:last-child){margin-right:.5rem}.prices--u3Ojw{display:flex}.prices--u3Ojw>div:not(:last-child){margin-right:.5rem}.typography--qlRjl{text-decoration:none}.typography--old-price--SnUxk{text-decoration:line-through}.figure--UwMfT{margin:0;margin-bottom:.5rem;width:100px;height:100px}.figure--UwMfT>img{width:inherit;height:inherit;max-width:100%;border-radius:var(--figure-border-radius, 0px);background-color:var(--figure-background-color, #ffffff)}",""]),a.locals={"goods-card":"goods-card--BAL7e",prices:"prices--u3Ojw",typography:"typography--qlRjl","typography--old-price":"typography--old-price--SnUxk",figure:"figure--UwMfT"};const s=a},212:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".scrolling-carousel--lZnvG{position:relative}.scrolling-carousel__wrapper--Doobh{position:relative;overflow:hidden}.scrolling-carousel__item--A9ial{display:flex;flex-wrap:nowrap;cursor:pointer}.scrolling-carousel__arrow-button--HrmVa{width:36px;height:36px;color:#757575;margin-top:auto;margin-bottom:auto;box-shadow:0 0 0 1px rgba(0,0,0,.04),0 4px 8px 0 rgba(0,0,0,.2);background:#fff;border-radius:50%;cursor:pointer;position:absolute;top:0;bottom:0;opacity:0;transition:opacity .5s}.scrolling-carousel__arrow-button--HrmVa>svg{position:absolute;left:0;right:0;bottom:0;top:0;margin:auto;width:24px;height:24px;fill:#757575}.scrolling-carousel__arrow-button--HrmVa:hover svg{fill:#000}.scrolling-carousel__arrow-button--show--do24\\+{opacity:.9}.scrolling-carousel__arrow-button--show--do24\\+:hover{opacity:1}.scrolling-carousel__arrow-button--right--Werat{right:-18px}.scrolling-carousel__arrow-button--left--M-xt3{left:-18px}@media(pointer: coarse){.scrolling-carousel__arrow-button--HrmVa{display:none !important}}",""]),a.locals={"scrolling-carousel":"scrolling-carousel--lZnvG","scrolling-carousel__wrapper":"scrolling-carousel__wrapper--Doobh","scrolling-carousel__item":"scrolling-carousel__item--A9ial","scrolling-carousel__arrow-button":"scrolling-carousel__arrow-button--HrmVa","scrolling-carousel__arrow-button--show":"scrolling-carousel__arrow-button--show--do24+","scrolling-carousel__arrow-button--right":"scrolling-carousel__arrow-button--right--Werat","scrolling-carousel__arrow-button--left":"scrolling-carousel__arrow-button--left--M-xt3"};const s=a},161:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".btn--dxsSR{margin:auto auto 10px;padding:10px;cursor:pointer}",""]),a.locals={btn:"btn--dxsSR"};const s=a},277:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,"@keyframes spin--Mv6zz{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.spinner--xVBKd{position:absolute;top:calc(50% - 1rem);left:calc(50% - 1rem);width:2rem;height:2rem;border-radius:50%;animation:spin--Mv6zz .6s infinite linear;border:var(--border, 2px solid transparent);border-color:var(--border-color, black)}",""]),a.locals={spinner:"spinner--xVBKd",spin:"spin--Mv6zz"};const s=a},940:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,"@keyframes fadeInFrames--bEyJg{from{opacity:0}to{opacity:1}}@keyframes fadeOutFrames--oBX-p{from{opacity:1}to{opacity:0}}.goods-container--tR-eJ{position:relative;margin-left:auto;margin-right:auto;display:flex;flex-direction:column;width:100%;height:100%;margin-top:0px}.goods-container--visible--dd40k{animation:300ms fadeInFrames--bEyJg}.goods-container--hidden--QAS9\\+{animation:300ms normal forwards fadeOutFrames--oBX-p}.goods-container__backdrop--CyeDo{flex:1}.goods-list--Wax8Q{position:relative;display:flex;flex-direction:column}",""]),a.locals={"goods-container":"goods-container--tR-eJ","goods-container--visible":"goods-container--visible--dd40k",fadeInFrames:"fadeInFrames--bEyJg","goods-container--hidden":"goods-container--hidden--QAS9+",fadeOutFrames:"fadeOutFrames--oBX-p","goods-container__backdrop":"goods-container__backdrop--CyeDo","goods-list":"goods-list--Wax8Q"};const s=a},942:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".goods-widget-viewer--ryMdV{position:absolute;inset:0;z-index:3000;text-align:left}",""]),a.locals={"goods-widget-viewer":"goods-widget-viewer--ryMdV"};const s=a},349:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-viewer__close--zjUnU{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:calc(15px + var(--timelineBlockTopOffset, 5px));pointer-events:all;cursor:pointer;outline:none;transition:opacity .3s ease-in;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.stories-viewer__close--zjUnU:focus{outline:none}.stories-viewer__close--zjUnU svg{overflow:visible}.stories-viewer__close--zjUnU._paused-ui--wbADu{opacity:0}.stories-viewer__close--zjUnU[data-position=start],.stories-viewer__close--zjUnU[data-position=left]{left:10px}.stories-viewer__close--zjUnU[data-position=start][dir=rtl],.stories-viewer__close--zjUnU[data-position=left][dir=rtl]{left:auto;right:10px}.stories-viewer__close--zjUnU[data-position=end],.stories-viewer__close--zjUnU[data-position=right]{right:10px}.stories-viewer__close--zjUnU[data-position=end][dir=rtl],.stories-viewer__close--zjUnU[data-position=right][dir=rtl]{left:10px;right:auto}.story-header--iD7hE{position:relative;z-index:1140}",""]),a.locals={"stories-viewer__close":"stories-viewer__close--zjUnU","_paused-ui":"_paused-ui--wbADu","story-header":"story-header--iD7hE"};const s=a},137:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-pager--JtIm1{position:absolute;top:0;left:0;right:0;bottom:0;height:100%;width:100%;z-index:1131;background-image:linear-gradient(180deg, rgba(0, 0, 0, 0.104) 0%, rgba(0, 0, 0, 0) 20%);pointer-events:none;transition:opacity .3s ease-in}.stories-pager--JtIm1._desktop-mode--MFqdz{border-top-left-radius:5px;border-top-right-radius:5px}.stories-pager--JtIm1._paused-ui--YKpOe{opacity:0}.stories-pager__ticks--IooJa{height:3px;display:flex;margin:8px 8px;margin-top:var(--timelineBlockTopOffset, 8px);opacity:1}.stories-pager__ticks--IooJa.hiddenTimeline--uwXIm{opacity:0}.stories-pager__tick--L96Px{background-color:var(--stories-pager-background, rgba(255, 255, 255, 0.6));width:100%;margin:0 2px;overflow:hidden;position:relative;border-radius:10px}.stories-pager__tick--L96Px:first-child{margin-left:0}.stories-pager__tick--L96Px:last-child{margin-right:0}.stories-pager__tick-progress--lwEYc{width:100%;height:3px}.stories-pager__tick-progress--lwEYc._active---U7hY{background-color:var(--stories-pager-tick-foreground, rgb(255, 255, 255))}.stories-pager__tick-progress-loader--DJvQ6{width:100%;height:3px;position:absolute;top:0;left:0;background:linear-gradient(to right, var(--stories-pager-tick-foreground, rgb(255, 255, 255)) var(--tick), transparent 0)}.stories-pager--JtIm1[dir=rtl] .stories-pager__tick-progress-loader--DJvQ6{background:linear-gradient(to left, var(--stories-pager-tick-foreground, rgb(255, 255, 255)) var(--tick), transparent 0)}",""]),a.locals={"stories-pager":"stories-pager--JtIm1","_desktop-mode":"_desktop-mode--MFqdz","_paused-ui":"_paused-ui--YKpOe","stories-pager__ticks":"stories-pager__ticks--IooJa",hiddenTimeline:"hiddenTimeline--uwXIm","stories-pager__tick":"stories-pager__tick--L96Px","stories-pager__tick-progress":"stories-pager__tick-progress--lwEYc",_active:"_active---U7hY","stories-pager__tick-progress-loader":"stories-pager__tick-progress-loader--DJvQ6"};const s=a},278:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.stories-slide--8v5Pf{top:0;left:0;right:0;bottom:0;position:absolute;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:var(--slideBorderRadius, 0)}.stories-slide--8v5Pf._dummy--Llble{background-color:#fff}.stories-slide--8v5Pf .load-mask--5XCq2{position:absolute;background-color:#000;z-index:2000;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center}.stories-slide--8v5Pf._with-bottom-panel--2p7Pi._desktop-mode--CJL90,.stories-slide--8v5Pf._with-bottom-panel--2p7Pi._desktop-mode--CJL90 .narrative-slide-background--hMuFX,.stories-slide--8v5Pf._with-bottom-panel--2p7Pi._desktop-mode--CJL90 .narrative-slide-elements--i0a24{border-bottom-right-radius:0;border-bottom-left-radius:0}.stories-slide--8v5Pf .stories-slide__refresh-btn--MEBPq{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}.loading-spinner-default--ltiyb{-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--T3-dY .6s infinite linear;animation:loading-spinner--T3-dY .6s infinite linear}@keyframes loading-spinner--T3-dY{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.stories-slide--8v5Pf{z-index:1120;visibility:hidden}.stories-slide--8v5Pf.active-slide--ncZf1{z-index:1130;visibility:visible}.stories-slide-offset--R5f2H{pointer-events:none;position:relative;height:100%}.stories-slide-box--Br9iz{position:relative;padding:154.838709677% 0 0 0}.stories-slide-content--CKfk0{position:absolute;top:0;left:0;right:0;bottom:0;-webkit-backface-visibility:hidden;backface-visibility:hidden;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}',""]),a.locals={"stories-slide":"stories-slide--8v5Pf",_dummy:"_dummy--Llble","load-mask":"load-mask--5XCq2","_with-bottom-panel":"_with-bottom-panel--2p7Pi","_desktop-mode":"_desktop-mode--CJL90","narrative-slide-background":"narrative-slide-background--hMuFX","narrative-slide-elements":"narrative-slide-elements--i0a24","stories-slide__refresh-btn":"stories-slide__refresh-btn--MEBPq","loading-spinner-default":"loading-spinner-default--ltiyb","loading-spinner":"loading-spinner--T3-dY","active-slide":"active-slide--ncZf1","stories-slide-offset":"stories-slide-offset--R5f2H","stories-slide-box":"stories-slide-box--Br9iz","stories-slide-content":"stories-slide-content--CKfk0"};const s=a},594:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-item--s9hOL{visibility:visible;position:absolute;width:100%;height:auto;bottom:0;border-radius:inherit;backface-visibility:hidden}.slider3d__item--7j2AS{position:absolute;left:0;top:0;width:100%;backface-visibility:hidden;transform-style:preserve-3d}",""]),a.locals={"stories-item":"stories-item--s9hOL",slider3d__item:"slider3d__item--7j2AS"};const s=a},50:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".story-reader-controls--8N5W7 .slider3d__btn_next--2GDPW,.story-reader-controls--8N5W7 .slider3d__btn_prev--P6gvY{display:none}.story-reader-controls--8N5W7._desktop_mode--mSlGA .slider3d__btn_next--2GDPW,.story-reader-controls--8N5W7._desktop_mode--mSlGA .slider3d__btn_prev--P6gvY{display:block;position:absolute;top:50%;transform:translateY(-50%);left:50%}.story-reader-controls--8N5W7 .btn-icon--NRFjq{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background-color:rgba(0,0,0,0);border:none;color:#fff;cursor:pointer}.story-reader-controls--8N5W7 .btn-icon--NRFjq:focus{outline:0}.story-reader-controls--8N5W7 .btn-icon--NRFjq:disabled{color:#464646;cursor:not-allowed}",""]),a.locals={"story-reader-controls":"story-reader-controls--8N5W7",slider3d__btn_next:"slider3d__btn_next--2GDPW",slider3d__btn_prev:"slider3d__btn_prev--P6gvY",_desktop_mode:"_desktop_mode--mSlGA","btn-icon":"btn-icon--NRFjq"};const s=a},390:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".slider3d__wrapper--49G6v{left:50%;transform:translateX(-50%);overflow:hidden;box-sizing:border-box}.slider3d__wrapper--49G6v.slider3d__wrapper_swipe-up--r1InL.slider3d__wrapper_swipe-up--r1InL{background-color:rgba(0,0,0,0)}.slider3d__wrapper--49G6v .game-reader-wrapper--vHugs,.slider3d__wrapper--49G6v .share-panel-wrapper--zNSqw{overflow:hidden}.slider3d__wrapper--49G6v._desktop_mode--m7fGP{padding:50px 0}.slider3d__wrapper--49G6v._desktop_mode--m7fGP>.share-panel-wrapper--zNSqw{top:50px;bottom:50px;border-radius:5px}.slider3d__wrapper--49G6v._desktop_mode--m7fGP>.share-panel-wrapper--zNSqw.share-panel-wrapper--zNSqw{border-bottom-left-radius:0;border-bottom-right-radius:0}.slider3d__wrapper--49G6v *,.slider3d__wrapper--49G6v ::after,.slider3d__wrapper--49G6v ::before{box-sizing:border-box}.slider3d__wrapper--49G6v .stories-item--i1n9b,.slider3d__wrapper--49G6v .stories-slide--KXt9a,.slider3d__wrapper--49G6v .narrative-slide-background--LO2L6,.slider3d__wrapper--49G6v .narrative-slide-elements--bUq5g{border-radius:var(--slideBorderRadius, 0)}.slider3d--pT6gr{position:fixed !important}.slider3d--pT6gr.no-select--zMya8{user-select:none}.slider3d__wrapper--49G6v{z-index:1;position:relative;height:100%}.stories-face--tqFop{position:absolute !important;top:0;left:0;right:0;width:100%;width:calc(100% + .01px);height:100%}.slider3d__rotater--eYXIw{--tick: 0%;--tickOpacity: 0}.slider3d__inner--EFsin,.slider3d__rotater--eYXIw{position:relative;height:100%;transform-style:preserve-3d}",""]),a.locals={slider3d__wrapper:"slider3d__wrapper--49G6v","slider3d__wrapper_swipe-up":"slider3d__wrapper_swipe-up--r1InL","game-reader-wrapper":"game-reader-wrapper--vHugs","share-panel-wrapper":"share-panel-wrapper--zNSqw",_desktop_mode:"_desktop_mode--m7fGP","stories-item":"stories-item--i1n9b","stories-slide":"stories-slide--KXt9a","narrative-slide-background":"narrative-slide-background--LO2L6","narrative-slide-elements":"narrative-slide-elements--bUq5g",slider3d:"slider3d--pT6gr","no-select":"no-select--zMya8","stories-face":"stories-face--tqFop",slider3d__rotater:"slider3d__rotater--eYXIw",slider3d__inner:"slider3d__inner--EFsin"};const s=a},169:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.wrapper--A3xCJ{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";position:absolute;inset:0;z-index:3000;border-radius:inherit}.wrapper--A3xCJ .backdrop--CPTm4{display:block;position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:rgba(0,0,0,.5);border-radius:inherit}.main--2Iqns{position:absolute;z-index:2;user-select:none;display:flex;flex-direction:column;text-rendering:geometricprecision;overflow:hidden}.main--2Iqns .question--mn519{width:100%;height:auto}.main--2Iqns .question--mn519:empty{display:none}.main--2Iqns .input-group--jE\\+PN{display:flex}.main--2Iqns .input-group--jE\\+PN .input--Z388z{width:100%}.main--2Iqns .input-group--jE\\+PN .input-group__prepend--KtZUG{display:flex;flex:.35}.main--2Iqns .input-group--jE\\+PN .input-group__separator--44goC{border-right:1px solid #fff;margin-right:.5rem}.main--2Iqns .input-group--jE\\+PN .input--Z388z{flex:1}.main--2Iqns .input-wrapper--yYgPA{overflow:hidden;box-sizing:content-box;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.main--2Iqns .input-wrapper--yYgPA .input--Z388z{background:none;-webkit-tap-highlight-color:rgba(0,0,0,0);text-rendering:inherit;outline:none;border:none}.main--2Iqns .input-wrapper--yYgPA .input--Z388z::placeholder{color:inherit}.main--2Iqns .input-wrapper--yYgPA .input--Z388z.input_centered--0yBvl{text-align:center}.main--2Iqns .input-wrapper--yYgPA.is-invalid--PDNfg{border-color:#dc3545 !important;box-shadow:0 0 0 .25rem rgba(220,53,69,.25)}.textarea-grow-wrap----9bt{display:grid;max-width:100%;word-break:break-all}.textarea-grow-wrap----9bt::after{content:attr(data-replicated-value) " ";white-space:pre-wrap;visibility:hidden}.textarea-grow-wrap----9bt>.input--Z388z{resize:none;overflow:hidden}.textarea-grow-wrap----9bt>.input--Z388z,.textarea-grow-wrap----9bt::after{border:inherit;padding:inherit;font:inherit;text-rendering:inherit;text-align:inherit;line-height:normal;color:inherit;grid-area:1/1/2/2}.button-wrapper--u94hX{width:100%}.button-wrapper--u94hX .button--bQRP7{width:100%;cursor:pointer}.button-wrapper--u94hX .button--bQRP7:disabled,.button-wrapper--u94hX .button--bQRP7[disabled=true]{cursor:not-allowed;pointer-events:none;background-color:#272727 !important}@keyframes fadeIn--b16pe{from{opacity:0}to{opacity:1}}@keyframes fadeOut--DquTc{from{opacity:1}to{opacity:0}}.fadeIn--b16pe{animation:fadeIn--b16pe 300ms forwards}.fadeOut--DquTc{animation:fadeOut--DquTc 0ms forwards}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}',""]),a.locals={wrapper:"wrapper--A3xCJ",backdrop:"backdrop--CPTm4",main:"main--2Iqns",question:"question--mn519","input-group":"input-group--jE+PN",input:"input--Z388z","input-group__prepend":"input-group__prepend--KtZUG","input-group__separator":"input-group__separator--44goC","input-wrapper":"input-wrapper--yYgPA",input_centered:"input_centered--0yBvl","is-invalid":"is-invalid--PDNfg","textarea-grow-wrap":"textarea-grow-wrap----9bt","button-wrapper":"button-wrapper--u94hX",button:"button--bQRP7",fadeIn:"fadeIn--b16pe",fadeOut:"fadeOut--DquTc"};const s=a},138:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.screen-orientation-lock--lAOKa{pointer-events:all;position:absolute;top:0;left:0;right:0;bottom:0;background-color:#fff;z-index:1;user-select:none;background-position:center center;background-size:cover;background-repeat:no-repeat;background-image:url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTc2MiIgaGVpZ2h0PSI4MjkiIHZpZXdCb3g9IjAgMCAxNzYyIDgyOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxyZWN0IHdpZHRoPSIxNzYyIiBoZWlnaHQ9IjgyOSIgZmlsbD0iIzIxMjEyMSIvPg0KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02NjYgNTQ5QzY2MS41ODIgNTQ5IDY1OCA1NDUuNDE4IDY1OCA1NDFMNjU4IDM0OUM2NTggMzQ0LjU4MiA2NjEuNTgyIDM0MSA2NjYgMzQxTDk5NCAzNDFDOTk4LjQxOCAzNDEgMTAwMiAzNDQuNTgyIDEwMDIgMzQ5TDEwMDIgNTQxQzEwMDIgNTQ1LjQxOCA5OTguNDE4IDU0OSA5OTQgNTQ5TDY2NiA1NDlaTTY2OCA1NDFMOTYyIDU0MUw5NjIgMzQ5TDY2OCAzNDlMNjY4IDU0MVoiIGZpbGw9IiMzRjNGM0YiLz4NCjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTAwIDIxNEM5MDAgMjA5LjU4MiA5MDMuNTgyIDIwNiA5MDggMjA2SDExMDBDMTEwNC40MiAyMDYgMTEwOCAyMDkuNTgyIDExMDggMjE0VjU0MkMxMTA4IDU0Ni40MTggMTEwNC40MiA1NTAgMTEwMCA1NTBIOTA4QzkwMy41ODIgNTUwIDkwMCA1NDYuNDE4IDkwMCA1NDJWMjE0Wk05MDggMjE2VjUxMEgxMTAwVjIxNkg5MDhaIiBmaWxsPSJ3aGl0ZSIvPg0KPHBhdGggZD0iTTgwMy41IDIxNkM3NTggMjIwLjUgNzEzLjUgMjU3IDcxNyAzMTcuNUM3MjEgMjc4IDc1OCAyMzcuNSA4MDMuNSAyNDIuNVYyNjRMODQ1LjUgMjI5TDgwMy41IDE5NS41VjIxNloiIGZpbGw9IndoaXRlIi8+DQo8L3N2Zz4=")}',""]),a.locals={"screen-orientation-lock":"screen-orientation-lock--lAOKa"};const s=a},196:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".share-panel__body_screenshot--uZCkX{display:flex;flex-direction:column}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1{cursor:pointer;background:rgba(0,0,0,0);border:none;width:100%;height:100%;display:flex;text-align:left;justify-content:center;align-items:center;color:#fff}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__icon--w7FbM{margin-right:5px;position:relative;width:30px;height:30px;flex-shrink:0}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__icon--w7FbM .btn-copy__icon-state--aOFwh{position:absolute;inset:0px;opacity:0;transition:opacity 300ms ease-in-out}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__icon--w7FbM .btn-copy__icon-state--aOFwh.btn-copy__icon-state_default--n6LWH{opacity:1;visibility:visible}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__icon--w7FbM .btn-copy__icon-state--aOFwh.btn-copy__icon-state_done--r-uzJ{opacity:1;visibility:visible}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__text--IQD4A{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:5px}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1:active{transform:scale(0.96)}.share-panel__body_screenshot--uZCkX .share-panel-row--LzAa0{justify-content:center;height:auto;padding:16px}.share-panel__body_screenshot--uZCkX .share-panel-row--LzAa0:first-child{height:450px;box-sizing:border-box}.share-panel__body_screenshot--uZCkX .share-panel-row__image-link--RXIki{width:100%;height:100%;display:flex;justify-content:center}.share-panel__body_screenshot--uZCkX .share-panel-row__image--HyVwP{max-width:100%;height:100%;object-fit:cover;border-radius:20px}.share-panel__body_screenshot--uZCkX .share-item__download-button--ypCUc{align-self:center;cursor:pointer;height:100%;width:100%;text-decoration:none;color:#fff;display:flex;align-items:center;justify-content:center}.share-panel__body_screenshot--uZCkX .share-item__download-button--ypCUc:active{transform:scale(0.96)}",""]),a.locals={"share-panel__body_screenshot":"share-panel__body_screenshot--uZCkX",btn:"btn--VzRxf","btn-copy":"btn-copy--dhlh1","btn-copy__icon":"btn-copy__icon--w7FbM","btn-copy__icon-state":"btn-copy__icon-state--aOFwh","btn-copy__icon-state_default":"btn-copy__icon-state_default--n6LWH","btn-copy__icon-state_done":"btn-copy__icon-state_done--r-uzJ","btn-copy__text":"btn-copy__text--IQD4A","share-panel-row":"share-panel-row--LzAa0","share-panel-row__image-link":"share-panel-row__image-link--RXIki","share-panel-row__image":"share-panel-row__image--HyVwP","share-item__download-button":"share-item__download-button--ypCUc"};const s=a},610:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".share-item--OHeZZ{color:#fff}a.share-item--OHeZZ{color:#fff;transition:none}a.share-item--OHeZZ:hover{color:#fff}.social-list--5d274{flex-wrap:wrap;height:auto;padding-bottom:1rem}.social-list--5d274 .social-list__item--PmqO7{margin-top:1rem}",""]),a.locals={"share-item":"share-item--OHeZZ","social-list":"social-list--5d274","social-list__item":"social-list__item--PmqO7"};const s=a},778:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.share-panel-wrapper--x2oi3{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";position:absolute;top:0;left:0;right:0;bottom:0;z-index:2}.share-panel-wrapper--x2oi3 .share-panel-backdrop--wh9uo{display:block;position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:rgba(0,0,0,.5)}.share-panel--Qm-mD{position:absolute;top:auto;left:0;right:0;bottom:0;z-index:2;user-select:none}.share-panel-row--LPdKG{width:100%;height:150px;display:flex;flex-direction:row;align-items:center}.share-panel-row--LPdKG .share-item--ZalUh{cursor:pointer;flex:0 0 auto;width:69px;height:90px;margin:0 10px;display:flex;flex-direction:column;align-items:center;text-align:center}.share-panel-row--LPdKG .share-item--ZalUh:first-child{margin-left:20px}.share-panel-row--LPdKG .share-item--ZalUh:last-child{margin-right:20px}.share-panel-row--LPdKG .share-item--ZalUh,.share-panel-row--LPdKG .share-item--ZalUh:visited,.share-panel-row--LPdKG .share-item--ZalUh:active,.share-panel-row--LPdKG .share-item--ZalUh:focus{text-decoration:none}.share-panel-row--LPdKG .share-item--ZalUh .share-item-title--RxVKy{margin-top:20px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;padding:.2rem}.share-panel-row--LPdKG.title-row--Vfan2{height:120px;padding-top:30px;padding-bottom:30px;padding-left:20px;padding-right:20px}.share-panel-row--LPdKG.title-row--Vfan2 .share-url-favicon--cGryk{width:60px;height:60px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}.share-panel-row--LPdKG.title-row--Vfan2 .share-url-favicon--cGryk img{width:30px;height:30px}.share-panel-row--LPdKG.title-row--Vfan2 .title--ZQZ6c{font-size:16px;line-height:1.4rem;margin-left:15px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.share-panel-separator--NXYXt{width:100%;height:1px}.share-panel--Qm-mD{will-change:transform;transition:transform 300ms}.share-panel__body--7Ljnv{width:100%;height:100%}@keyframes slideIn--CzJft{from{transform:translateY(100%)}to{transform:translateY(0%)}}@keyframes slideOut--lNjIY{from{transform:translateY(0%)}to{transform:translateY(100%)}}@keyframes fadeIn--qopSX{from{opacity:0}to{opacity:1}}@keyframes fadeOut--bA6JG{from{opacity:1}to{opacity:0}}.fadeIn--qopSX{animation:fadeIn--qopSX 300ms forwards}.fadeOut--bA6JG{animation:fadeOut--bA6JG 300ms forwards}.slideIn--CzJft{animation:slideIn--CzJft 300ms forwards}.slideOut--lNjIY{animation:slideOut--lNjIY 300ms forwards}',""]),a.locals={"share-panel-wrapper":"share-panel-wrapper--x2oi3","share-panel-backdrop":"share-panel-backdrop--wh9uo","share-panel":"share-panel--Qm-mD","share-panel-row":"share-panel-row--LPdKG","share-item":"share-item--ZalUh","share-item-title":"share-item-title--RxVKy","title-row":"title-row--Vfan2","share-url-favicon":"share-url-favicon--cGryk",title:"title--ZQZ6c","share-panel-separator":"share-panel-separator--NXYXt","share-panel__body":"share-panel__body--7Ljnv",fadeIn:"fadeIn--qopSX",fadeOut:"fadeOut--bA6JG",slideIn:"slideIn--CzJft",slideOut:"slideOut--lNjIY"};const s=a},81:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".icon--5RBkn{width:2rem;height:2rem}",""]),a.locals={icon:"icon--5RBkn"};const s=a},323:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-link,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-answer,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-data-input,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-poll-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-answer,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-rate-input,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-answer,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-copy,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-share,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-story-repeat,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-game,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target],.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type=closeStory],.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up-items,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-barcode{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-link *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-answer *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-data-input *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-poll-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-answer *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-rate-input *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-answer *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-copy *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-share *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-story-repeat *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-game *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target] *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type=closeStory] *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up-items *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-barcode *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-input-container .rangeslider{pointer-events:all;cursor:pointer}",""]);const s=a},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,i){"string"==typeof e&&(e=[[null,e,""]]);var a={};if(i)for(var s=0;s<this.length;s++){var n=this[s][0];null!=n&&(a[n]=!0)}for(var o=0;o<e.length;o++){var l=[].concat(e[o]);i&&a[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),t.push(l))}},t}},335:(e,t,r)=>{var i=r(649),a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,r){var i,s={},d=null,c=null;for(i in void 0!==r&&(d=""+r),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)n.call(t,i)&&!l.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===s[i]&&(s[i]=t[i]);return{$$typeof:a,type:e,key:d,ref:c,props:s,_owner:o.current}}t.Fragment=s,t.jsx=d,t.jsxs=d},85:(e,t,r)=>{e.exports=r(335)},591:(e,t,r)=>{var i,a=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},s=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]}}(),n=[];function o(e){for(var t=-1,r=0;r<n.length;r++)if(n[r].identifier===e){t=r;break}return t}function l(e,t){for(var r={},i=[],a=0;a<e.length;a++){var s=e[a],l=t.base?s[0]+t.base:s[0],d=r[l]||0,c="".concat(l," ").concat(d);r[l]=d+1;var u=o(c),h={css:s[1],media:s[2],sourceMap:s[3]};-1!==u?(n[u].references++,n[u].updater(h)):n.push({identifier:c,updater:m(h,t),references:1}),i.push(c)}return i}function d(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var a=r.nc;a&&(i.nonce=a)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var n=s(e.insert||"head");if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(t)}return t}var c,u=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function h(e,t,r,i){var a=r?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=u(t,a);else{var s=document.createTextNode(a),n=e.childNodes;n[t]&&e.removeChild(n[t]),n.length?e.insertBefore(s,n[t]):e.appendChild(s)}}function p(e,t,r){var i=r.css,a=r.media,s=r.sourceMap;if(a?e.setAttribute("media",a):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var g=null,f=0;function m(e,t){var r,i,a;if(t.singleton){var s=f++;r=g||(g=d(t)),i=h.bind(null,r,s,!1),a=h.bind(null,r,s,!0)}else r=d(t),i=p.bind(null,r,t),a=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else a()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=a());var r=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<r.length;i++){var a=o(r[i]);n[a].references--}for(var s=l(e,t),d=0;d<r.length;d++){var c=o(r[d]);0===n[c].references&&(n[c].updater(),n.splice(c,1))}r=s}}}},704:(e,t,r)=>{const i=document.querySelector("[nonce]");i&&(r.nc=i.nonce||i.getAttribute("nonce")),window.litNonce=r.nc},649:t=>{t.exports=e}},L={};function T(e){var t=L[e];if(void 0!==t)return t.exports;var r=L[e]={id:e,exports:{}};return I[e](r,r.exports,T),r.exports}T.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return T.d(t,{a:t}),t},T.d=(e,t)=>{for(var r in t)T.o(t,r)&&!T.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},T.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),T.nc=void 0;var A={};(()=>{T.d(A,{hS:()=>L,KL:()=>Ql,A7:()=>Q,Yb:()=>I,Tg:()=>R,WH:()=>B,lV:()=>D,IV:()=>Jr,tP:()=>Yr,h8:()=>Zr,Xz:()=>fo,wS:()=>il,VS:()=>it,oC:()=>at,L8:()=>Qr,NL:()=>Kr,Ez:()=>fe,of:()=>ee,Hp:()=>Np,MD:()=>ae,_U:()=>ie,zC:()=>re,ws:()=>F,Jf:()=>Y,Jd:()=>se,SK:()=>V,tI:()=>z,Uy:()=>W,SP:()=>U,Jj:()=>G,pt:()=>$,nN:()=>H,mk:()=>N,Vq:()=>te,ex:()=>q,yx:()=>Z,qz:()=>J,h0:()=>ne,KO:()=>X});const e=(e=>{var t={};return T.d(t,e),t})({EventEmitter:()=>t.EventEmitter,default:()=>t.default});var I;!function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(I||(I={}));const L={hasFavorite:!1,hasLike:!1,hasShare:!1,closeButtonPosition:I.END,loader:{default:{color:"white",accentColor:"transparent"},custom:null},closeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M30 15.2115C30 23.4958 23.2843 30.2115 15 30.2115C6.71573 30.2115 0 23.4958 0 15.2115C0 6.92728 6.71573 0.211548 15 0.211548C23.2843 0.211548 30 6.92728 30 15.2115Z" fill="white"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.8309 10.0424C10.0969 9.77646 10.5281 9.77646 10.7941 10.0424L15 14.2483L19.2059 10.0424C19.4719 9.77646 19.9031 9.77646 20.1691 10.0424C20.4351 10.3084 20.4351 10.7397 20.1691 11.0057L15.9632 15.2115L20.1691 19.4174C20.4351 19.6834 20.4351 20.1147 20.1691 20.3807C19.9031 20.6466 19.4719 20.6466 19.2059 20.3807L15 16.1748L10.7941 20.3807C10.5281 20.6466 10.0969 20.6466 9.8309 20.3807C9.56492 20.1147 9.56492 19.6834 9.8309 19.4174L14.0368 15.2115L9.8309 11.0057C9.56492 10.7397 9.56492 10.3084 9.8309 10.0424Z" fill="#C2C2C4"/>\n</svg>'}},forceDesktopMode:void 0},R={borderRadius:5,loader:{default:{color:"white",accentColor:"transparent"},custom:null},backdropColor:"#1a1a1a",backdrop:{opacity:1,background:"#1a1a1a"},game:{backdropColor:"rgb(51, 51, 51)"},forceDesktopMode:L.forceDesktopMode,forceCheckOrientation:!0};var D;!function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(D||(D={}));const B={goodsWidgetRenderingType:D.DEFAULT,goodsList:{renderingType:D.DEFAULT,closeBackgroundColor:"#000000",substrateHeight:200,substrateColor:"#FFFFFF",dimColor:"rgba(0, 0, 0, 0.5)"},goodsCard:{mainTextColor:"#000000",oldPriceTextColor:"#CCCCCC",imageBackgroundColor:"transparent",imageCornerRadius:8},openGoodsWidgetHandler:e=>Promise.resolve(e),loader:{default:{color:"gray",accentColor:"transparent"}}};var F,N,U,W,z,V,G,$;!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(F||(F={})),function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(N||(N={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(U||(U={})),function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end",e.CENTER="center"}(W||(W={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(z||(z={})),function(e){e.Medium="medium",e.High="high"}(V||(V={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}(G||(G={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}($||($={}));const H={direction:G.ROW,card:{title:{font:'16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',padding:10.6,textAlign:W.START,position:z.CARD_INSIDE_BOTTOM,display:!0,lineClamp:4},gap:10,height:178,aspectRatio:null,coverQuality:V.High,variant:U.RECTANGLE,border:{radius:21,color:"black",width:2,gap:5},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,opened:{border:{radius:null,color:null,width:null,gap:null,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null},coverLazyLoading:!1},favoriteCard:{title:{content:"Favorite",font:"normal",color:"white",padding:15,textAlign:W.START,position:z.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:V.High,coverLazyLoading:!1,variant:U.CIRCLE,border:{radius:0,color:"black",width:2,gap:3,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,opened:{border:{radius:null,color:null,width:null,gap:null,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null}},sidePadding:20,topPadding:20,bottomPadding:20,bottomMargin:17,layout:{height:0,backgroundColor:"transparent",sliderAlign:N.START},navigation:{speed:300,showControls:!1,controlsSize:48,controlsBackgroundColor:"white",controlsColor:"black"},autoScrollOnStoryClose:!0,ugcCard:{title:{content:null,font:'16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',color:"#000",padding:15,textAlign:W.START,position:z.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:V.High,coverLazyLoading:!1,variant:U.CIRCLE,border:{radius:0,color:"transparent",width:0,gap:0,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,image:{svgSrc:{baseState:'<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M50 85.5C69.6061 85.5 85.5 69.6061 85.5 50C85.5 30.3939 69.6061 14.5 50 14.5C30.3939 14.5 14.5 30.3939 14.5 50C14.5 69.6061 30.3939 85.5 50 85.5Z" stroke="white" stroke-width="2"/>\n<path d="M50.5 34.5V65.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M34.5 49.5H65.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>\n'}},backgroundColor:"#0c62f3"}},q={title:{content:"Favorite",font:"1.4rem/1.2 InternalPrimaryFont",color:"white",backgroundColor:"#333333"},headerTopOffset:0,bottomOffset:0,backgroundColor:"#333333"};var Q;!function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader",e.STACK_STORY_LIST="stackStoryList",e.IAM_READER="iamReader"}(Q||(Q={}));const K={label:"X",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 195 195" xmlns="http://www.w3.org/2000/svg">\n<g transform="matrix(.20227 0 0 .20302 -71 -26.7)">\n<circle cx="834.3" cy="610.6" r="481.3" stroke="#fff" strokeMiterlimit="10"/>\n<path d="m537.8 331.8 230 307.6-231.4 250.1h52.2l202.6-219 163.8 219h177.3l-243-324.9 215.5-232.8h-52l-187 201.7-150.7-201.7zm76.6 38.4h81.5l359.7 481h-81.5z" fill="#fff"/>\n</g>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://twitter.com/share?url=${e}&text=${t}`},Y={targets:["vk","ok","facebook","x","linkedin","telegram"],targetParams:{vk:{label:"VK",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">\n<circle cx="24" cy="24" r="21.3" fill="#fff"/>\n<path d="M22.3.7a23.3 23.3 0 0 0-5 45.6A23.4 23.4 0 0 0 30.7 1.7C28 .8 25.2.6 22.3.7Zm1.8 14.5c1.2.1 1.8.3 2 .6l.3.6c.2.4.2.8 0 4.3 0 2.2 0 2.9.2 3.4s.7.8 1.1.6a8 8 0 0 0 1.8-2 29 29 0 0 0 3-5.8c.3-.4.5-.7.8-.8h7.1a.7.7 0 0 1 .5.8c0 .7-.8 2.2-2 4a92.7 92.7 0 0 1-3.5 4.8c-.3.5-.2 1 .2 1.6l1.4 1.4c1.8 1.7 2.6 2.6 3.3 3.6.4.7.6 1.2.5 1.7 0 .2-.2.5-.5.6-.4.2-.9.2-3.7.3H34l-.5-.1c-1-.4-1.8-1-3.5-3-.9-1-1.6-1.5-2-1.5-.5 0-1 .6-1.3 1.3-.1.5-.2.8-.2 1.7-.1 1-.2 1.2-.8 1.5H22a9.5 9.5 0 0 1-4.2-1.4c-1.9-1.1-3-2.2-4.4-3.8a48.7 48.7 0 0 1-7.2-12.5c-.1-.5 0-.9.5-1l3-.1h3c.5.3.7.5 1 1.4L16 22c.5.9 1 1.6 1.5 2 .6.6.9.7 1.3.7.3 0 .4-.1.6-.6.5-1 .6-4.8.1-6.3-.2-.8-.6-1.1-1.7-1.3-.2 0-.2-.2 0-.4.4-.6 1.1-.9 2.6-1H24Z" fill="#45668E"/>\n</svg>'}},getUrl:({url:e,text:t})=>`https://vk.com/share.php?url=${e}&title=${t}`},facebook:{label:"Facebook",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="126.4 2.3 589 589" xmlns="http://www.w3.org/2000/svg">\n<circle cx="420.9" cy="296.8" r="294.5" fill="#3c5a9a"/>\n<path d="M516.7 92.7h-65.2c-38.8 0-81.8 16.3-81.8 72.4.2 19.5 0 38.3 0 59.3h-44.8v71.3h46.2V501h84.8V294.4h56l5-70.2h-62.4V184c0-22.2 23-21 24.4-21h37.8V92.8z" fill="#fff"/>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://www.facebook.com/sharer.php?u=${e}&t=${t}`},x:K,twitter:K,linkedin:{label:"LinkedIn",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" enableBackground="new 0 0 550 550" version="1.1" viewBox="0 0 550 550" xmlSpace="preserve" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">\n<circle cx="275" cy="275" r="256" fill="#04689B"/>\n<path d="m219.2 366.5h-38.8v-124.3h38.8v124.3zm-20.4-139.9h-0.3c-14.1 0-23.2-9.5-23.2-21.6 0-12.3 9.4-21.6 23.7-21.6s23.1 9.3 23.4 21.5c0.1 12.2-9 21.7-23.6 21.7zm175.8 139.9h-44v-64.3c0-16.8-6.9-28.3-22-28.3-11.6 0-18 7.7-21 15.2-1.1 2.7-0.9 6.4-0.9 10.2v67.3h-43.7s0.6-113.9 0-124.3h43.6v19.5c2.6-8.5 16.5-20.7 38.8-20.7 27.6 0 49.3 17.9 49.3 56.4v69z" fill="#fff"/>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://www.linkedin.com/sharing/share-offsite/?url=${e}&title=${t}`},telegram:{label:"Telegram",icon:{svgSrc:{baseState:'<svg data-v-05f1b0f5="" data-v-b5b60290="" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50px" height="50px"><defs data-v-05f1b0f5=""><linearGradient data-v-05f1b0f5="" id="a" x1="120" y1="240" x2="120" gradientUnits="userSpaceOnUse"><stop data-v-05f1b0f5="" offset="0" stop-color="#1d93d2"></stop><stop data-v-05f1b0f5="" offset="1" stop-color="#38b0e3"></stop></linearGradient></defs><circle data-v-05f1b0f5="" cx="120" cy="120" r="120" fill="url(#a)"></circle><path data-v-05f1b0f5="" d="m81.2 128.8 14.3 39.4s1.7 3.7 3.7 3.7 30.2-29.5 30.2-29.5l31.5-61-79.2 37.2Z" fill="#c8daea"></path><path data-v-05f1b0f5="" d="m100.1 138.9-2.7 29s-1.2 9 7.7 0 17.4-15.7 17.4-15.7" fill="#a9c6d8"></path><path data-v-05f1b0f5="" d="m81.5 130.2-29.3-9.6s-3.5-1.4-2.4-4.6c.3-.7.7-1.2 2.1-2.2C58.4 109.3 172 68.4 172 68.4s3.2-1 5.1-.3a2.8 2.8 0 0 1 2 2 9.4 9.4 0 0 1 .2 2.6l-.2 2.6c-.7 11.1-21.4 94.4-21.4 94.4s-1.2 5-5.7 5a8.1 8.1 0 0 1-5.9-2.2 797.1 797.1 0 0 0-45.5-32.2 1.3 1.3 0 0 1-.5-.9c-.1-.4.4-1 .4-1s52.4-46.6 53.8-51.5c.1-.4-.3-.6-.8-.4C150 87.8 89.6 125.9 83 130a3.2 3.2 0 0 1-1.5 0Z" fill="#fff"></path></svg>\n'}},getUrl:({url:e,text:t})=>`https://t.me/share/url?url=${e}&text=${t}`},ok:{label:"OK",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 388.4 387.1" xmlSpace="preserve" xmlns="http://www.w3.org/2000/svg">\n<path d="M331.7 330.2a194.2 193.5 0 0 1-273.9 1.1 194.2 193.5 0 0 1-2.6-272.9A194.2 193.5 0 0 1 329 54.2a194.2 193.5 0 0 1 5.7 273" fill="#faab62" style="mixBlendMode:normal"/>\n<path d="m328.7 327.1a189.2 188.5 0 0 1-266.9 1.2 189.2 188.5 0 0 1-2.5-266 189.2 188.5 0 0 1 266.7-4 189.2 188.5 0 0 1 5.6 265.9" fill="#f7931e" style="mixBlendMode:normal"/>\n<g fill="#fff" style="mixBlendMode:normal">\n<path d="m217.4 253.5c28-5.7 44.7-19 45.6-19.7a19 19 0 0 0-23.8-29.6c-0.2 0.1-18 13.8-47.5 13.8a84.5 84.5 0 0 1-47.8-13.8 19 19 0 0 0-23.8 29.6c1 0.7 18.4 14.3 47.1 19.9l-40 41.9a19 19 0 1 0 27.3 26.3l37.2-39.6 41 39.9a19 19 0 1 0 26.9-26.9z"/>\n<path transform="translate(-1.8 .2)" d="m194.5 57.9a69.9 69.9 0 1 0 0 139.8 69.9 69.9 0 0 0 0-139.8zm0 98.8a28.9 28.9 0 1 1 0-57.8 28.9 28.9 0 0 1 0 57.8z" style="mixBlendMode:normal"/>\n</g>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://connect.ok.ru/offer?url=${e}&title=${t}`}},copyButton:{label:"Copy link",svgSrc:{baseState:'<svg width="30px" height="30px" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 20"><path d="M6.6 0a2 2 0 0 0-2 2v12c0 1.2.9 2 2 2h9a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2h-9Zm0 2h9v12h-9V2Z" fill="currentColor"/><path d="M2.6 20a2 2 0 0 1-2-2V5h2v13h10v2h-10Z" fill="currentColor"/></svg>',doneState:'<svg width="30px" height="30px" fill="none" viewBox="0 0 386 264" xmlns="http://www.w3.org/2000/svg">\n<path d="m379.05 7.3156c8.855 8.8533 8.855 23.207 0 32.06l-210.67 210.67c-17.707 17.707-46.414 17.707-64.121 0l-97.319-97.319c-8.8531-8.855-8.8531-23.208 0-32.061 8.853-8.853 23.207-8.853 32.06 0l97.319 97.319 210.67-210.67c8.852-8.8531 23.206-8.8531 32.058 0z" clip-rule="evenodd" fill="currentColor" fill-rule="evenodd"/>\n</svg>'}},downloadButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 32 32" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M31 22a1 1 0 0 0-1 1v7H2v-7a1 1 0 0 0-2 0v8c0 .6.4 1 1 1h30c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z"/><path d="M15.3 23.7c.4.4 1 .4 1.4 0l7-6.9c.4-.4.4-1 0-1.4a1 1 0 0 0-1.4 0L17 20.6V1a1 1 0 0 0-2 0v19.6l-5.3-5.2a1 1 0 0 0-1.4 0 1 1 0 0 0 0 1.4l7 7z"/></g></svg>'}},title:{favicon:{background:"white",display:!0},getValue:({url:e})=>e},background:"#202125",borderRadius:20,divider:{background:"#36373b"},text:{color:"white",font:"inherit"}};var J;!function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(J||(J={}));const Z={gameReaderOptions:{loader:{default:{color:"white",accentColor:"transparent"},custom:null}},scrollStyle:J.FLAT,timelineBlockTopOffset:8,actionPanelBottomOffset:0,borderRadius:12,loader:{default:{color:"white",accentColor:"transparent"},custom:null},recycleStoriesList:!1,closeOnLastSlideByTimer:!0,sharePanel:Y,commonBackdrop:{color:"rgba(51, 51, 51, 1)",backdropFilter:null},slideBackdrop:{opacity:.56,blur:30,linearGradientOverlay:["rgba(0, 0, 0, 0.1) 0%","rgba(0, 0, 0, 0.9) 100%"]},faviconApiUrl:"",navigation:{prevButton:{svgSrc:{baseState:'<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M19.8076 6.80761L9.20101 17.4142L7.7868 16L18.3934 5.3934L19.8076 6.80761Z" fill="currentColor" />\n <path d="M18.3934 26.6066L7.7868 16L9.20101 14.5858L19.8076 25.1924L18.3934 26.6066Z" fill="currentColor" />\n </svg>'}},nextButton:{svgSrc:{baseState:'<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.1924 25.1924L22.799 14.5858L24.2132 16L13.6066 26.6066L12.1924 25.1924Z" fill="currentColor" />\n <path d="M13.6066 5.3934L24.2132 16L22.799 17.4142L12.1924 6.80761L13.6066 5.3934Z" fill="currentColor" />\n </svg>'}}},likeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.96277 15.177L8.11552 15.1837C8.75334 15.1873 9.26846 15.7054 9.26846 16.3433V22.7329C9.26846 23.376 8.74519 23.8962 8.10215 23.8925L6.94939 23.8859C6.31157 23.8822 5.79645 23.3641 5.79645 22.7263V16.3366C5.79645 15.6936 6.31972 15.1733 6.96277 15.177Z" stroke="white" stroke-width="1.21546"/>\n<path d="M11.2546 15.0917L11.3801 23.0645C11.3867 23.4802 11.6013 23.8648 11.9516 24.0886C12.119 24.1955 12.4834 24.2735 12.4834 24.2735L13.1084 24.3569L13.9973 24.4541L15.9789 24.5912L17.4834 24.6365H18.9642L19.282 24.6229C19.7715 24.6018 20.258 24.5358 20.7354 24.4256L21.1038 24.3406C21.3122 24.2925 21.516 24.2263 21.7128 24.1428L21.7439 24.1295C22.0493 23.9999 22.3342 23.8269 22.59 23.6157L22.717 23.5108C22.873 23.382 23.0108 23.2326 23.1265 23.0666L23.1451 23.04C23.2426 22.9003 23.3217 22.7485 23.3804 22.5886L23.428 22.4586C23.5278 22.1867 23.5473 21.8918 23.4842 21.6092L23.4296 21.3645C23.4285 21.3594 23.4265 21.3544 23.4237 21.3499C23.4102 21.3285 23.4163 21.3002 23.4374 21.2862L23.7911 21.0504V21.0504C23.8452 21.0143 23.8957 20.9723 23.9416 20.9263V20.9263C23.99 20.8728 24.0444 20.8083 24.0805 20.7458L24.1361 20.6625C24.2924 20.3945 24.3931 20.0167 24.4083 19.7069L24.4118 19.6352C24.4205 19.458 24.4079 19.2804 24.3744 19.1062L24.3305 18.8986C24.325 18.8696 24.2749 18.7163 24.2611 18.6902L24.1718 18.5154C24.1644 18.5014 24.1898 18.473 24.1898 18.473L24.3653 18.2658C24.4983 18.1109 24.6033 17.9305 24.673 17.7386C24.7222 17.6035 24.7532 17.4657 24.775 17.3153L24.7889 17.1764L24.7957 17.0468C24.8164 16.8366 24.7978 16.6244 24.7409 16.421C24.6929 16.2496 24.6183 16.0868 24.5198 15.9385L24.1983 15.4542C24.1843 15.4367 24.1808 15.413 24.1891 15.3922L24.3081 15.1055C24.3652 14.9628 24.4224 14.6641 24.4391 14.4717L24.4307 14.2984C24.4026 14.0113 24.2405 13.6815 24.0757 13.4238L23.9912 13.3055C23.7236 12.9608 23.3474 12.7334 22.9388 12.5804L22.706 12.4932C22.3923 12.3758 22.0667 12.3327 21.7279 12.2916L21.3444 12.2597C20.89 12.2378 20.2444 12.2651 19.7945 12.3327L18.1092 12.5861C18.1014 12.5873 18.0935 12.5879 18.0857 12.5879H18.0692C17.991 12.5879 17.9276 12.5245 17.9276 12.4462C17.9276 12.4387 17.9282 12.4312 17.9293 12.4238L18.1222 11.3847L18.5408 9.72426C18.6303 9.39087 18.6888 9.04995 18.7158 8.70582L18.7581 8.1657C18.7857 7.81269 18.746 7.45764 18.6411 7.11944L18.6144 7.03332C18.52 6.72899 18.3649 6.44697 18.1583 6.20434L18.1116 6.14941C17.819 5.80563 17.4249 5.56351 16.9859 5.45788L16.7169 5.39313C16.4437 5.32739 16.1567 5.3518 15.8986 5.46269C15.6593 5.56548 15.4564 5.73766 15.316 5.95699L15.2994 5.98302C15.155 6.20866 15.0783 6.47094 15.0783 6.73882V7.10777C15.0783 7.45352 15.0109 7.79596 14.88 8.11598L14.1668 9.85969C13.9176 10.4691 13.6196 11.0573 13.2758 11.6188L12.5778 12.7586C12.4514 12.9651 12.3013 13.1561 12.1306 13.3278L12.0855 13.3731C11.6243 13.837 11.3317 14.442 11.2546 15.0917Z" stroke="white" stroke-width="1.21546"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.96277 15.1771L8.11552 15.1838C8.75334 15.1875 9.26846 15.7056 9.26846 16.3434V22.733C9.26846 23.3761 8.74519 23.8964 8.10215 23.8926L6.94939 23.886C6.31157 23.8823 5.79645 23.3642 5.79645 22.7264V16.3368C5.79645 15.6937 6.31972 15.1734 6.96277 15.1771Z" fill="white" stroke="white" stroke-width="1.21546"/>\n<path d="M11.2546 15.0918L11.3801 23.0646C11.3867 23.4803 11.6013 23.8649 11.9516 24.0888C12.119 24.1957 12.4834 24.2737 12.4834 24.2737L13.1084 24.357L13.9973 24.4542L15.9789 24.5913L17.4834 24.6367H18.9642L19.282 24.623C19.7715 24.6019 20.258 24.5359 20.7354 24.4257L21.1038 24.3407C21.3122 24.2926 21.516 24.2264 21.7128 24.1429L21.7439 24.1297C22.0493 24.0001 22.3342 23.827 22.59 23.6158L22.717 23.5109C22.873 23.3821 23.0108 23.2327 23.1265 23.0668L23.1451 23.0401C23.2426 22.9004 23.3217 22.7487 23.3804 22.5887L23.428 22.4588C23.5278 22.1868 23.5473 21.892 23.4842 21.6093L23.4296 21.3647C23.4285 21.3595 23.4265 21.3545 23.4237 21.3501C23.4102 21.3286 23.4163 21.3004 23.4374 21.2863L23.7911 21.0505V21.0505C23.8452 21.0144 23.8957 20.9724 23.9416 20.9265V20.9265C23.99 20.8729 24.0444 20.8084 24.0805 20.7459L24.1361 20.6626C24.2924 20.3946 24.3931 20.0168 24.4083 19.707L24.4118 19.6353C24.4205 19.4581 24.4079 19.2805 24.3744 19.1063L24.3305 18.8987C24.325 18.8697 24.2749 18.7165 24.2611 18.6904L24.1718 18.5155C24.1644 18.5015 24.1898 18.4732 24.1898 18.4732L24.3653 18.2659C24.4983 18.1111 24.6033 17.9306 24.673 17.7387C24.7222 17.6036 24.7532 17.4658 24.775 17.3154L24.7889 17.1765L24.7957 17.0469C24.8164 16.8367 24.7978 16.6245 24.7409 16.4211C24.6929 16.2497 24.6183 16.0869 24.5198 15.9386L24.1983 15.4543C24.1843 15.4368 24.1808 15.4131 24.1891 15.3923L24.3081 15.1056C24.3652 14.9629 24.4224 14.6642 24.4391 14.4718L24.4307 14.2985C24.4026 14.0114 24.2405 13.6817 24.0757 13.4239L23.9912 13.3056C23.7236 12.9609 23.3474 12.7336 22.9388 12.5805L22.706 12.4934C22.3923 12.3759 22.0667 12.3329 21.7279 12.2918L21.3444 12.2598C20.89 12.2379 20.2444 12.2652 19.7945 12.3329L18.1092 12.5863C18.1014 12.5874 18.0935 12.588 18.0857 12.588H18.0692C17.991 12.588 17.9276 12.5246 17.9276 12.4464C17.9276 12.4389 17.9282 12.4313 17.9293 12.4239L18.1222 11.3849L18.5408 9.72438C18.6303 9.391 18.6888 9.05007 18.7158 8.70594L18.7581 8.16582C18.7857 7.81281 18.746 7.45776 18.6411 7.11956L18.6144 7.03344C18.52 6.72911 18.3649 6.4471 18.1583 6.20446L18.1116 6.14953C17.819 5.80575 17.4249 5.56363 16.9859 5.458L16.7169 5.39325C16.4437 5.32751 16.1567 5.35192 15.8986 5.46281C15.6593 5.5656 15.4564 5.73778 15.316 5.95711L15.2994 5.98314C15.155 6.20878 15.0783 6.47106 15.0783 6.73895V7.10789C15.0783 7.45364 15.0109 7.79608 14.88 8.1161L14.1668 9.85982C13.9176 10.4692 13.6196 11.0574 13.2758 11.6189L12.5778 12.7588C12.4514 12.9652 12.3013 13.1562 12.1306 13.3279L12.0855 13.3732C11.6243 13.8371 11.3317 14.4421 11.2546 15.0918Z" fill="white" stroke="white" stroke-width="1.21546"/>\n</svg>'}},dislikeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.2033 13.6632C24.2033 14.3062 23.68 14.8265 23.037 14.8228L21.8842 14.8161C21.2464 14.8125 20.7313 14.2944 20.7313 13.6565V7.2669C20.7313 6.62385 21.2546 6.10359 21.8976 6.1073L23.0504 6.11395C23.6882 6.11762 24.2033 6.63572 24.2033 7.27355V13.6632Z" stroke="white" stroke-width="1.21547"/>\n<path d="M18.7451 14.9082L18.6196 6.93531C18.6131 6.51965 18.3984 6.13499 18.0481 5.91118C17.8808 5.80428 17.5164 5.72628 17.5164 5.72628L16.8914 5.64295L16.0025 5.54572L14.0208 5.4086L12.5164 5.36328H11.0356L10.7178 5.37695C10.2283 5.398 9.74173 5.46403 9.26432 5.57421L8.89596 5.65921C8.68758 5.7073 8.4838 5.7735 8.28695 5.85706L8.25581 5.87027C7.95049 5.99987 7.66551 6.17296 7.40975 6.38416L7.28278 6.48901C7.12677 6.61783 6.989 6.76725 6.87323 6.93318L6.85466 6.95981C6.75716 7.09955 6.67809 7.25128 6.6194 7.41124L6.57172 7.54119C6.47196 7.81311 6.45245 8.10797 6.51553 8.39066L6.57011 8.63528C6.57127 8.64045 6.57329 8.64539 6.5761 8.64989C6.58951 8.67134 6.58343 8.69958 6.56238 8.71361L6.20864 8.94944V8.94944C6.15453 8.98551 6.10408 9.0275 6.05811 9.07348V9.07348C6.00973 9.12703 5.95532 9.19155 5.91922 9.25403L5.86366 9.33737C5.70735 9.60533 5.60662 9.98309 5.59145 10.2929L5.58794 10.3646C5.57927 10.5418 5.59182 10.7194 5.62532 10.8937L5.66922 11.1012C5.6748 11.1302 5.72484 11.2835 5.73866 11.3096L5.82792 11.4845C5.83532 11.4984 5.80994 11.5268 5.80994 11.5268L5.63444 11.734C5.50143 11.8889 5.3965 12.0693 5.32674 12.2612C5.27758 12.3964 5.24658 12.5341 5.22478 12.6846L5.21089 12.8235L5.20405 12.953C5.18333 13.1632 5.20192 13.3755 5.25887 13.5788C5.30686 13.7503 5.38145 13.9131 5.47991 14.0614L5.80147 14.5456C5.81547 14.5631 5.81898 14.5868 5.81066 14.6076L5.69163 14.8944C5.63456 15.037 5.57739 15.3357 5.56065 15.5282L5.5691 15.7014C5.5972 15.9885 5.75924 16.3183 5.92402 16.576L6.00853 16.6943C6.2762 17.039 6.65231 17.2664 7.06099 17.4194L7.2938 17.5066C7.60742 17.624 7.93309 17.6671 8.27189 17.7082L8.65531 17.7401C9.10973 17.762 9.75538 17.7347 10.2053 17.6671L11.8906 17.4137C11.8984 17.4125 11.9062 17.4119 11.9141 17.4119H11.9305C12.0088 17.4119 12.0722 17.4753 12.0722 17.5536C12.0722 17.5611 12.0716 17.5686 12.0704 17.576L11.8775 18.6151L11.459 20.2756C11.3695 20.6089 11.3109 20.9499 11.284 21.294L11.2417 21.8341C11.214 22.1871 11.2537 22.5422 11.3586 22.8804L11.3853 22.9665C11.4797 23.2708 11.6349 23.5528 11.8414 23.7955L11.8882 23.8504C12.1808 24.1942 12.5749 24.4363 13.0138 24.5419L13.2829 24.6067C13.556 24.6724 13.8431 24.648 14.1012 24.5371C14.3404 24.4343 14.5434 24.2622 14.6837 24.0428L14.7004 24.0168C14.8448 23.7912 14.9215 23.5289 14.9215 23.261V22.892C14.9215 22.5463 14.9888 22.2039 15.1197 21.8838L15.8329 20.1401C16.0821 19.5308 16.3801 18.9425 16.7239 18.381L17.4219 17.2412C17.5483 17.0347 17.6984 16.8437 17.8691 16.6721L17.9142 16.6267C18.3755 16.1629 18.668 15.5578 18.7451 14.9082Z" stroke="white" stroke-width="1.21547"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.2035 13.6629C24.2035 14.3059 23.6803 14.8262 23.0372 14.8225L21.8845 14.8158C21.2466 14.8122 20.7315 14.2941 20.7315 13.6562V7.26655C20.7315 6.62348 21.2548 6.10322 21.8978 6.10693L23.0506 6.11358C23.6884 6.11725 24.2035 6.63535 24.2035 7.27319V13.6629Z" fill="white" stroke="white" stroke-width="1.21547"/>\n<path d="M18.7454 14.9079L18.6199 6.93496C18.6133 6.51929 18.3987 6.13463 18.0484 5.91082C17.881 5.80392 17.5166 5.72592 17.5166 5.72592L16.8916 5.64258L16.0027 5.54536L14.021 5.40824L12.5166 5.36292H11.0358L10.718 5.37659C10.2285 5.39764 9.74192 5.46367 9.26451 5.57384L8.89614 5.65885C8.68776 5.70694 8.48398 5.77314 8.28713 5.8567L8.25599 5.86991C7.95066 5.99951 7.66569 6.1726 7.40992 6.3838L7.28295 6.48865C7.12694 6.61747 6.98917 6.7669 6.8734 6.93283L6.85483 6.95946C6.75733 7.0992 6.67826 7.25093 6.61957 7.41088L6.57189 7.54084C6.47212 7.81276 6.45262 8.10762 6.5157 8.39032L6.57028 8.63494C6.57143 8.64011 6.57346 8.64505 6.57627 8.64954C6.58968 8.671 6.5836 8.69923 6.56255 8.71327L6.2088 8.9491C6.1547 8.98517 6.10425 9.02716 6.05827 9.07314C6.0099 9.12669 5.95549 9.19121 5.91938 9.25369L5.86383 9.33703C5.70751 9.60499 5.60678 9.98276 5.59161 10.2926L5.58811 10.3643C5.57943 10.5415 5.59198 10.7191 5.62549 10.8933L5.66938 11.1009C5.67496 11.1299 5.72501 11.2831 5.73883 11.3092L5.82808 11.4841C5.83549 11.4981 5.8101 11.5264 5.8101 11.5264L5.63461 11.7337C5.50159 11.8886 5.39666 12.069 5.3269 12.2609C5.27775 12.396 5.24674 12.5338 5.22494 12.6842L5.21105 12.8231L5.20421 12.9527C5.18349 13.1629 5.20208 13.3751 5.25903 13.5785C5.30702 13.7499 5.38161 13.9128 5.48007 14.061L5.80163 14.5453C5.81564 14.5628 5.81915 14.5865 5.81082 14.6073L5.69179 14.894C5.63472 15.0367 5.57755 15.3354 5.56081 15.5279L5.56926 15.7011C5.59737 15.9882 5.7594 16.318 5.92419 16.5757L6.0087 16.694C6.27636 17.0387 6.65248 17.2661 7.06116 17.4191L7.29397 17.5063C7.6076 17.6237 7.93327 17.6668 8.27207 17.7079L8.65549 17.7398C9.10991 17.7617 9.75557 17.7344 10.2055 17.6668L11.8908 17.4134C11.8986 17.4122 11.9064 17.4116 11.9143 17.4116H11.9307C12.009 17.4116 12.0724 17.4751 12.0724 17.5533C12.0724 17.5608 12.0718 17.5683 12.0706 17.5757L11.8777 18.6148L11.4592 20.2753C11.3697 20.6087 11.3111 20.9496 11.2842 21.2937L11.2419 21.8339C11.2142 22.1869 11.2539 22.5419 11.3588 22.8801L11.3855 22.9662C11.4799 23.2706 11.6351 23.5526 11.8416 23.7952L11.8884 23.8502C12.181 24.1939 12.5751 24.4361 13.014 24.5417L13.2831 24.6064C13.5562 24.6722 13.8433 24.6478 14.1014 24.5369C14.3407 24.4341 14.5436 24.2619 14.6839 24.0426L14.7006 24.0166C14.845 23.7909 14.9217 23.5286 14.9217 23.2607V22.8918C14.9217 22.546 14.989 22.2036 15.1199 21.8836L15.8331 20.1399C16.0824 19.5305 16.3803 18.9422 16.7241 18.3808L17.4221 17.2409C17.5486 17.0344 17.6987 16.8434 17.8694 16.6718L17.9144 16.6264C18.3757 16.1626 18.6683 15.5575 18.7454 14.9079Z" fill="white" stroke="white" stroke-width="1.21547"/>\n</svg>'}},favoriteButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49976 7.25225V23.2366C7.49976 24.6882 9.33429 25.321 10.2292 24.1782L13.7974 19.6218C14.4088 18.8411 15.5907 18.8411 16.2021 19.6218L19.7703 24.1782C20.6652 25.321 22.4998 24.6882 22.4998 23.2366V7.25225C22.4998 5.98711 21.4742 4.96152 20.209 4.96152H9.79048C8.52535 4.96152 7.49976 5.98712 7.49976 7.25225Z" stroke="white" stroke-width="1.29808"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49976 7.04073V23.0251C7.49976 24.4767 9.33429 25.1095 10.2292 23.9667L13.7974 19.4103C14.4088 18.6296 15.5907 18.6296 16.2021 19.4103L19.7703 23.9667C20.6652 25.1095 22.4998 24.4766 22.4998 23.0251V7.04072C22.4998 5.77559 21.4742 4.75 20.209 4.75H9.79048C8.52535 4.75 7.49976 5.77559 7.49976 7.04073Z" fill="white" stroke="white" stroke-width="1.29808"/>\n</svg>'}},muteButton:{svgSrc:{baseState:'<svg width="30" height="31" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.40625 13.5734V18.7664C3.40625 19.7239 4.18245 20.5001 5.13993 20.5001H8.04633C8.6342 20.5001 9.17511 20.8213 9.45654 21.3374L11.903 25.8242C12.271 26.4992 12.9783 26.9192 13.7471 26.9192C14.9072 26.9192 15.8477 25.9788 15.8477 24.8187V7.52486C15.8477 6.36469 14.9072 5.42416 13.747 5.42412C12.9783 5.42409 12.2709 5.84393 11.9028 6.51875L9.45651 11.0026C9.17509 11.5184 8.63442 11.8394 8.04683 11.8394H5.14027C4.1826 11.8394 3.40625 12.6157 3.40625 13.5734Z" fill="white"/>\n<path d="M19.8477 13.0466L26.0976 19.2966M26.0976 13.0466L19.8477 19.2966" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.40625 12.5733V17.7663C3.40625 18.7238 4.18245 19.5 5.13993 19.5H8.04633C8.6342 19.5 9.17511 19.8212 9.45654 20.3373L11.903 24.8241C12.271 25.4991 12.9783 25.919 13.7471 25.9191C14.9072 25.9191 15.8477 24.9787 15.8477 23.8186V6.52474C15.8477 5.36457 14.9072 4.42404 13.747 4.424C12.9783 4.42397 12.2709 4.84381 11.9028 5.51863L9.45651 10.0025C9.17509 10.5183 8.63442 10.8392 8.04683 10.8392H5.14027C4.1826 10.8392 3.40625 11.6156 3.40625 12.5733Z" fill="white"/>\n<path d="M19.8477 11.4215C20.6323 12.4661 21.0972 13.7645 21.0972 15.1715C21.0972 16.5785 20.6323 17.8769 19.8477 18.9215M22.3472 6.78613C24.6487 8.84608 26.0972 11.8396 26.0972 15.1715C26.0972 18.5034 24.6487 21.4969 22.3472 23.5569" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'}},shareButton:{svgSrc:{baseState:'<svg width="30" height="31" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M19.5 10.9038C20.8488 10.9038 21.9423 9.81036 21.9423 8.46151C21.9423 7.11266 20.8488 6.01921 19.5 6.01921C18.1512 6.01921 17.0577 7.11266 17.0577 8.46151C17.0577 9.81036 18.1512 10.9038 19.5 10.9038ZM19.5 12.2115C21.5711 12.2115 23.25 10.5326 23.25 8.46151C23.25 6.39045 21.5711 4.71151 19.5 4.71151C17.4289 4.71151 15.75 6.39045 15.75 8.46151C15.75 8.98692 15.8581 9.48709 16.0531 9.94101L12.288 12.4511C11.6202 11.8367 10.7288 11.4615 9.74976 11.4615C7.67869 11.4615 5.99976 13.1404 5.99976 15.2115C5.99976 17.2826 7.67869 18.9615 9.74976 18.9615C10.7325 18.9615 11.6269 18.5835 12.2956 17.9649L16.018 20.5665C15.8451 20.9977 15.75 21.4685 15.75 21.9615C15.75 24.0326 17.4289 25.7115 19.5 25.7115C21.5711 25.7115 23.25 24.0326 23.25 21.9615C23.25 19.8904 21.5711 18.2115 19.5 18.2115C18.3369 18.2115 17.2974 18.7411 16.6096 19.5722L13.0138 17.0591C13.3231 16.5138 13.4998 15.8833 13.4998 15.2115C13.4998 14.5368 13.3216 13.9037 13.0097 13.3567L16.667 10.9185C17.3545 11.7106 18.3688 12.2115 19.5 12.2115ZM12.1921 15.2115C12.1921 16.5604 11.0986 17.6538 9.74976 17.6538C8.40091 17.6538 7.30745 16.5604 7.30745 15.2115C7.30745 13.8627 8.40091 12.7692 9.74976 12.7692C11.0986 12.7692 12.1921 13.8627 12.1921 15.2115ZM21.9423 21.9615C21.9423 23.3104 20.8488 24.4038 19.5 24.4038C18.1512 24.4038 17.0577 23.3104 17.0577 21.9615C17.0577 20.6127 18.1512 19.5192 19.5 19.5192C20.8488 19.5192 21.9423 20.6127 21.9423 21.9615Z" fill="white"/>\n</svg>'}}};var X;!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"}(X||(X={}));const ee={};var te,re,ie,ae,se,ne;!function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(te||(te={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite",e[e.stacked=2]="stacked"}(re||(re={})),function(e){e[e.default=0]="default",e[e.onboarding=1]="onboarding",e[e.favorite=2]="favorite",e[e.direct=3]="direct"}(ie||(ie={})),function(e){e.list="list",e.favorite="favorite"}(ae||(ae={})),function(e){e.CLICK_ON_STORY="clickOnStoryLink"}(se||(se={})),function(e){e.LTR="ltr",e.RTL="rtl"}(ne||(ne={}));const oe=(e=>{var t={};return T.d(t,e),t})({default:()=>r.default});class le extends e.EventEmitter{}class de extends Error{constructor(e){super(`[IAS]: Timeout waiting for ViewModel with ID "${e}". You must mount <IASContainer>.`),this.name="IasViewModelTimeoutError"}}class ce extends Error{constructor(e){super(`[IAS]: ViewModel with ID "${e}" was deleted before resolving.`),this.name="IasViewModelRejectError"}}class ue{constructor(){Object.defineProperty(this,"viewModels",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"viewModelWaiters",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}set(e,t){this.viewModels.set(e,t),this.resolveWaiters(e,t)}get(e){return this.viewModels.get(e)}async wait(e,t=5e3){const r=this.viewModels.get(e);if(r)return r;if(this.viewModelWaiters.has(e))return this.viewModelWaiters.get(e).promise;let i,a;const s=new Promise(((e,t)=>{i=e,a=t})),n=setTimeout((()=>{this.viewModelWaiters.delete(e),a(new de(e))}),t);return this.viewModelWaiters.set(e,{resolve:i,reject:a,timerId:n,promise:s}),s}getAll(){return Array.from(this.viewModels.values())}getAllOfType(e){return Array.from(this.viewModels.values()).filter(e)}has(e){return this.viewModels.has(e)}delete(e){this.viewModels.has(e)&&(this.rejectWaiters(e),this.viewModels.delete(e))}resolveWaiters(e,t){const r=this.viewModelWaiters.get(e);r&&(clearTimeout(r.timerId),r.resolve(t),this.viewModelWaiters.delete(e))}rejectWaiters(e){const t=this.viewModelWaiters.get(e);t&&(clearTimeout(t.timerId),t.reject(new ce(e)),this.viewModelWaiters.delete(e))}}const he=(e=>{var t={};return T.d(t,e),t})({v4:()=>i.v4});function pe(e){return e.replace(/^\//,"")}function ge(e,t,r){t instanceof Object&&Object.keys(t).forEach((i=>{const a=t[i];if(a instanceof Object&&!Array.isArray(a))return ge(e,a,i);r&&(i=`${r}[${i}]`),Array.isArray(a)?a.forEach((t=>{e.append(`${i}[]`,t)})):e.append(i,a)}))}class fe extends Error{constructor(e,t,r){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"networkStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"networkMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="IasNetworkError",this.networkStatus=e,this.networkMessage=t,this.response=null!=r?r:null,console.error({name:this.name,networkStatus:e,networkMessage:t,response:r})}static createByRequestError(e){return new fe(null,JSON.stringify(e.data),e)}static createByFetchError(e){const t=window.navigator&&window.navigator.onLine;return new fe(null,t?e.message:"net::ERR_INTERNET_DISCONNECTED")}}const me={baseUrl:"https://cdn.inappstory.ru",apiUrl:"https://api.inappstory.ru",faviconApiUrl:"https://favicon.inappstory.ru"};function ve(e){if(e.length>32)try{const t=function(e){const t=(e=e.replace(new RegExp("-","g"),"+").replace(new RegExp("_","g"),"/")).length;return e=function(e,t,r){return void 0===t?e:t.length>=e.length?t:r?(e+t).slice(-e.length):(t+e).substring(0,e.length)}(new Array(t%4).fill("=").join(""),e,!1),window.atob(e)}(e),r=t.charCodeAt(13);if(r>0){let e=t.substr(14,r);e=e.replace(/\0+$/,"");const i="{QQN{xuV?1Dv16j3";let a=i,s=0;for(;a.length<r;)a+=i[s],s++,s===i.length&&(s=0);let n="";for(let t=0;t<r;t++)n+=String.fromCharCode(e.charCodeAt(t)^a.charCodeAt(t));return new URL(`https://${n}`).host}}catch(e){console.error(e)}return null}const be=(e=>{var t={};return T.d(t,e),t})({default:()=>a.default});const ye=(e=>{var t={};return T.d(t,e),t})({default:()=>s.default});const we=`InAppStoryWebSDK/${parseInt(30403)} ${(e=>{let t="";for(let r=0;r<e.length;r++){t+=e.charCodeAt(r)<=255?e[r]:"?"}return t})(navigator.userAgent)}`;function Se(e,t){return Object.assign(Object.assign({},e),t)}const _e=new class{constructor(){Object.defineProperty(this,"_deviceInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_baseHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"requestInterceptors",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"interceptors",{enumerable:!0,configurable:!0,writable:!0,value:{request:{use:e=>{this.requestInterceptors.push(e)}}}})}set deviceInfoPromise(e){this._deviceInfoPromise=e}set baseHeaders(e){this._baseHeaders=e}get baseURL(){return`${me.apiUrl}/v2/`}async request(e){return new Promise(((t,r)=>{const i=async()=>{try{if((0,be.default)(e.headers)&&null!=e.headers||(e.headers={}),e.headers=Se(this._baseHeaders,e.headers),this.requestInterceptors.length)for(const t of this.requestInterceptors)t(e);let i="";!(0,ye.default)(e.params)&&(0,be.default)(e.params)&&(i=new URLSearchParams(Object.entries(e.params).filter((([e,t])=>null!=t&&""!=t))).toString());let a=new URL(`${pe(e.url)}${i?"?"+i:""}`,this.baseURL),s="get";(0,ye.default)(e.method)||(s=e.method);let n={};!(0,ye.default)(e.headers)&&(0,be.default)(e.headers)&&(n=e.headers);let o=null;!(0,ye.default)(e.data)&&(0,be.default)(e.data)&&(o=JSON.stringify(e.data),n["Content-Type"]="application/json");const l=await fetch(a.toString(),{method:s,body:o,headers:n,credentials:"omit"});let d={};204!==l.status&&(d=await l.json());const c={data:d,headersRaw:l.headers,headers:Object.fromEntries([...l.headers]),status:l.status,statusText:l.statusText,ok:l.ok};if(!l.ok)return void r(fe.createByRequestError(c));t(c)}catch(e){r(fe.createByFetchError(e))}};this._deviceInfoPromise?this._deviceInfoPromise.finally(i):i()}))}async post(e,t,r={}){return this.request({method:"post",url:e,data:t,params:r})}async get(e,t={}){return this.request({method:"get",url:e,params:t})}};function Oe(e,t,r){if("sendBeacon"in navigator){const a=Hl.rootStore.sessionStore.session,s=new URLSearchParams({access_token:Hl.getConfig().apiKey,session_id:(null==a?void 0:a.id)||"",x_user_agent:we}),n=Hl.getConfig();null!=n.appPackageId&&s.append("x_app_package_id",n.appPackageId);const o=`${i=_e.baseURL,i.replace(/\/$/,"")}/${pe(e)}?${s.toString()}`,l=new FormData;Object.keys(t).forEach((e=>{ge(l,t[e],e)}));let d=!1;null!=Array.from&&null!=l.keys&&(d=0===Array.from(l.keys()).length),d||navigator.sendBeacon(o,l),r()}else _e.post(e,t).then((()=>r()),(()=>r()));var i}_e.interceptors.request.use((e=>{var t;const r=Hl.getConfig(),i=Hl.rootStore.sessionStore.session;return e.headers=Se(null!==(t=e.headers)&&void 0!==t?t:{},{Authorization:`Bearer ${r.apiKey}`,"Accept-Language":r.lang.toString(),"Auth-Session-Id":null==i?void 0:i.id,"X-User-Id":r.userId||"","X-Request-Id":(0,he.v4)(),"X-User-Agent":we}),null!=r.appPackageId&&(e.headers["X-App-Package-Id"]=r.appPackageId),r.disableDeviceId||(e.headers["X-Device-Id"]=null==i?void 0:i.deviceId),e}));const Ce=_e;function xe(e){return"string"==typeof e&&(!isNaN(Number(e))&&!isNaN(parseFloat(e)))}let ke;ke=function(){};const Pe=(e=>{var t={};return T.d(t,e),t})({Reaction:()=>n.Reaction,action:()=>n.action,computed:()=>n.computed,observable:()=>n.observable,reaction:()=>n.reaction,remove:()=>n.remove});function je(e){return class extends e{constructor(...e){super(...e),Object.defineProperty(this,"_mobxReaction",{enumerable:!0,configurable:!0,writable:!0,value:null})}update(e){this._mobxReaction?this._mobxReaction.track((()=>{super.update(e)})):super.update(e)}connectedCallback(){super.connectedCallback(),this._mobxReaction||(this._mobxReaction=new Pe.Reaction(`${this.constructor.name||this.nodeName}.update()`,(()=>this.requestUpdate()))),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._mobxReaction)||void 0===e||e.dispose(),this._mobxReaction=null}}}function Me(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)}}function Ee(e,t){let r=null,i=null;return async function(...t){const a=JSON.stringify(t);if(r===a)return i;try{return i=await e.apply(this,t),r=a,i}catch(e){throw i=null,r=null,e}}}const Ie=/[\r\n%#()<>?[\\\]^`{|}]/g;function Le(e,t="double"){return(e=(e=(e="double"===t?e.replace(/"/g,"'"):e.replace(/'/g,'"')).replace(/>\s{1,}</g,"><")).replace(/\s{2,}/g," ")).replace(Ie,encodeURIComponent)}const Te=e=>{const t=/^[\p{L}_\d][\p{L}_\d\-]{0,49}$/u;return e.filter((e=>{const r=t.test(e);return r||console.error(`[IAS]: The tag <${e}> does not match the regular expression <${t.toString()}>`),r}))},Ae=e=>{const t=document.createElement("input");t.setAttribute("type","text"),t.style.position="absolute",t.style.opacity="0.1001",t.style.height="0",t.style.fontSize="16px",t.readOnly=!0,document.body.prepend(t),t.focus();return setTimeout((()=>{e.focus(),t.remove()}),300)},Re=()=>null!==T.nc&&void 0!==T.nc?T.nc:"",De=!!(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}}),r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch(e){}return e})()&&{passive:!0};const Be=(e=>{var t={};return T.d(t,e),t})({default:()=>o.default});const Fe=function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}();function Ne(e){let t=null;if(Fe){let r=window.localStorage.getItem(e);null!==r&&(0,Be.default)(r)&&r.trim().length>0&&(t=JSON.parse(r))}return t}function Ue(e,t){Fe&&window.localStorage.setItem(e,JSON.stringify(t))}function We(e){let t=window.isSecureContext;return void 0===t&&"https:"===window.location.protocol&&(t=!0),t?e:e.replace(/^https:\/\//,"http://")}function ze(e){return e.map((e=>function(e){var t,r,i;if(!e.url)return null;let a={"font-family":null!==(t=e.family)&&void 0!==t?t:"normal",src:`url('${We(String(e.url))}')`,"font-style":null!==(r=e.style)&&void 0!==r?r:"normal","font-weight":null!==(i=e.weight)&&void 0!==i?i:"normal"};e.title&&(a.src+=`, local('${e.title}')`);return`@font-face {${s=a,Object.keys(s).reduce(((e,t)=>e+t.split(/(?=[A-Z])/).join("-").toLowerCase()+":"+s[t]+";"),"")}}\n`;var s}(e))).filter(Boolean).join("")}function Ve(e){"fonts"in document?e.forEach((e=>{const t=new FontFace(e.family,`url(${e.url})`,{style:e.style,weight:e.weight,display:"block"});document.fonts.add&&document.fonts.add(t),t.load()})):function(e){const t=ze(e);if(null!=t){const e="stories-font-style";let r=document.getElementById(e);null===r?(r=document.createElement("style"),r.type="text/css",r.id=e,r.attributes.setNamedItem(document.createAttribute("scoped")),r.setAttribute("nonce",Re()),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t)),document.body.appendChild(r)):r.styleSheet?r.styleSheet.cssText=t:(r.textContent="",r.appendChild(document.createTextNode(t)))}}(e)}let Ge=null;async function $e(){return null!=Ge?Ge:new Promise((e=>{!function(e,t){const r=new Image;r.onload=function(){var i=r.width>0&&r.height>0;t(e,i)},r.onerror=function(){t(e,!1)},r.src="data:image/webp;base64,"+{lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}("lossy",((t,r)=>{Ge=r,e(r)}))}))}function He(){if(window){var e,t=window.screen;return e="function"==typeof window.ScreenOrientation&&t.orientation instanceof ScreenOrientation&&"function"==typeof t.orientation.addEventListener&&null===t.orientation.onchange&&"string"==typeof t.orientation.type?t.orientation:function(){var e={90:qe.LANDSCAPE_PRIMARY,"-90":qe.LANDSCAPE_SECONDARY,0:qe.PORTRAIT_PRIMARY,180:qe.PORTRAIT_SECONDARY};function t(){}var r=new t,i=function(e){for(var t=["orientationchange","mozorientationchange","msorientationchange"],r=window.screen,i=0;i<t.length;i++)if(null===r["on"+t[i]])return{delegate:r,event:t[i]};if(void 0!==window.onorientationchange)return{delegate:window,event:"orientationchange"};return{delegate:Xe(e),event:"change"}}(r);return t.prototype.addEventListener=Qe("addEventListener",i.delegate,i.event),t.prototype.dispatchEvent=Qe("dispatchEvent",i.delegate,i.event),t.prototype.removeEventListener=Qe("removeEventListener",i.delegate,i.event),t.prototype.lock=function(){var e,t="lockOrientation() is not available on this device.",r=window.screen;e=void 0===r?function(){return!1}:"function"==typeof r.msLockOrientation?r.msLockOrientation.bind(r):"function"==typeof r.mozLockOrientation?r.mozLockOrientation.bind(r):function(){return!1};return function(r){const i=window.Promise;return e(r)?i.resolve(r):i.reject(new Error(t))}}(),t.prototype.unlock=function(){var e=window.screen;return e&&e.orientation&&e.orientation.unlock.bind(e.orientation)||e.msUnlockOrientation&&e.msUnlockOrientation.bind(e)||e.mozUnlockOrientation&&e.mozUnlockOrientation.bind(e)||function(){}}(),Object.defineProperties(r,{onchange:{get:function(){return i.delegate["on"+i.event]||null},set:function(e){i.delegate["on"+i.event]=Je(e,r)}},type:{get:function(){var t=window.screen;return t.msOrientation||t.mozOrientation||e[window.orientation+""]||(et().matches?"landscape-primary":"portrait-primary")}},angle:{value:0}}),r}(),e}}var qe;function Qe(e,t,r){var i=this;return function(){var a=Array.prototype.slice.call(arguments);if("change"===(a[0].type?a[0].type:a[0])){a[0].type?a[0]=Ze(r,a[0]):a[0]=r;var s,n,o=Je(a[1],i);return"addEventListener"===e&&function(e,t){var r=Ye.indexOf(e);r>-1?Ke[r]=t:(Ye.push(e),Ke.push(t))}(a[1],o),"removeEventListener"===e&&(s=a[1],(n=Ye.indexOf(s))>-1&&(Ye.splice(n,1),Ke.splice(n,1))),a[1]=o,t[e].apply(t,a)}}}!function(e){e.LANDSCAPE_PRIMARY="landscape-primary",e.LANDSCAPE_SECONDARY="landscape-secondary",e.PORTRAIT_PRIMARY="portrait-primary",e.PORTRAIT_SECONDARY="portrait-secondary"}(qe||(qe={}));var Ke=[],Ye=[];function Je(e,t){var r=Ye.indexOf(e);return r>-1?Ke[r]:function(r){r.target!==t&&tt(r,"target",t),r.currentTarget!==t&&tt(r,"currentTarget",t),"change"!==r.type&&tt(r,"type","change"),e(r)}}function Ze(e,t){var r;try{r=new Event(e,t)}catch(e){r={type:"change"}}return r}function Xe(e){var t=Object.create({addEventListener:function(e,t){this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)},dispatchEvent:function(t){this.listeners[t.type]&&(this.listeners[t.type].forEach((function(e){e(t)})),"function"==typeof e.onchange&&e.onchange(t))},removeEventListener:function(e,t){if(this.listeners[e]){var r=this.listeners[e].indexOf(t);r>-1&&this.listeners[e].splice(r,1)}}});t.listeners={};var r=et();return r&&"boolean"==typeof r.matches&&r.addListener((function(){t.dispatchEvent(Ze("change"))})),t}function et(){return"function"!=typeof window.matchMedia?{}:window.matchMedia("(orientation: landscape)")}function tt(e,t,r){Object.defineProperty(e,t,{value:r})}function rt(e,t,r){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>r))}class it extends Error{constructor(e){super(`[IAM]: not found IAM for ID <${e}>`),this.name="IamNotFoundByIdError"}}class at extends Error{constructor(e){super(`[IAM]: not found IAM limit for ID <${e}>`),this.name="IamNotFoundLimitError"}}var st=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},nt=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};const ot="campaign_name,id,events,appearance,slides_html,type,frequency_limit,display_to,display_from,need_placeholders,has_limit",lt=ot.split(",").map((e=>`messages.${e}`)).join(",");let dt=(()=>{var e;let t,r,i,a=[];return e=class{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(st(this,a),e)})}async fetchAll({tags:e}){return(await Ce.get("inappmessaging",{fields:lt,tag:e.join(",")})).data.messages}async fetchContext(){return(await Ce.get("inappmessaging/message-context",{fields:"style,widgetsData"})).data}async fetchById(e){const t=(await Ce.get(`inappmessaging/message/${e}`,{expand:"slides_html",fields:ot})).data;if(!t)throw new it(e);return t}async emitMessageEvent(e,t){try{if(this.storyManager.isStatisticsDisabled)return void console.log(`[IAM]: message <${t.type.toUpperCase()}> event`,{messageId:e,messageEvent:t,type:t.type});await Ce.post(`/inappmessaging/message/${e}/event/${t.type}`,t.toQueryParams())}catch(e){console.error(e)}}async fetchUserData(e){try{return(await Ce.get(`/inappmessaging/message/${e}/data`)).data.data}catch(e){console.error(e)}}async updateUserData(e,t){try{if(this.storyManager.isStatisticsDisabled)return void console.log("[IAM]: update user data",{messageId:e,payload:t});await Ce.request({url:`/inappmessaging/message/${e}/data`,method:"put",data:{data:t}})}catch(e){console.error(e)}}async checkMesageLimit(e){if(this.storyManager.isStatisticsDisabled)return{canOpen:!0};const t=(await Ce.post("inappmessaging/message-limit",{id:[e]})).data.find((t=>t.messageId.toString()===e.toString()));if(!t)throw new at(e);return t}},(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Me],r=[Me],i=[Me],nt(e,null,t,{kind:"method",name:"fetchAll",static:!1,private:!1,access:{has:e=>"fetchAll"in e,get:e=>e.fetchAll},metadata:s},null,a),nt(e,null,r,{kind:"method",name:"fetchContext",static:!1,private:!1,access:{has:e=>"fetchContext"in e,get:e=>e.fetchContext},metadata:s},null,a),nt(e,null,i,{kind:"method",name:"fetchById",static:!1,private:!1,access:{has:e=>"fetchById"in e,get:e=>e.fetchById},metadata:s},null,a),s&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})})(),e})();class ct{constructor(){Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:""})}}class ut extends ct{constructor(e){var t,r,i,a,s,n,o,l,d,c,u;super(),Object.defineProperty(this,"contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"borderRadius",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backdrop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.backgroundColor=null!==(t=e.background_color)&&void 0!==t?t:"#FFFFFFFF",this.borderRadius=null!==(r=e.corner_radius)&&void 0!==r?r:16,this.contentRatio=e.content_ratio||.64,this.backdrop={opacity:null!==(i=e.backdrop_alpha)&&void 0!==i?i:.3},this.closeButton={marginTop:null!==(s=null===(a=e.close_button)||void 0===a?void 0:a.top_margin)&&void 0!==s?s:8,width:null!==(o=null===(n=e.close_button)||void 0===n?void 0:n.width)&&void 0!==o?o:32,height:null!==(d=null===(l=e.close_button)||void 0===l?void 0:l.height)&&void 0!==d?d:4,backgroundColor:null!==(u=null===(c=e.close_button)||void 0===c?void 0:c.color)&&void 0!==u?u:"#00000080"}}}var ht,pt;!function(e){e[e.None=0]="None",e[e.SlideInUp=1]="SlideInUp",e[e.FadeIn=2]="FadeIn"}(ht||(ht={})),function(e){e[e.None=0]="None",e[e.Start=1]="Start",e[e.End=2]="End"}(pt||(pt={}));class gt extends ct{constructor(e){var t,r,i,a,s,n;super(),Object.defineProperty(this,"contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"borderRadius",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"animationType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backdrop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeBtnPosition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"horizontalPadding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.borderRadius=null!==(t=e.corner_radius)&&void 0!==t?t:16,this.contentRatio=e.content_ratio||.64,this.animationType=null!==(r=e.animation_type)&&void 0!==r?r:ht.None,this.backdrop={opacity:null!==(i=e.backdrop_alpha)&&void 0!==i?i:.3},this.backgroundColor=null!==(a=e.background_color)&&void 0!==a?a:"#FFFFFFFF",this.closeBtnPosition=null!==(s=e.close_button_position)&&void 0!==s?s:pt.End,this.horizontalPadding=null!==(n=e.horizontal_padding)&&void 0!==n?n:16}}class ft extends ct{constructor(e){var t,r,i;super(),Object.defineProperty(this,"animationType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeBtnPosition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.animationType=null!==(t=e.animation_type)&&void 0!==t?t:ht.None,this.backgroundColor=null!==(r=e.background_color)&&void 0!==r?r:"#FFFFFFFF",this.closeBtnPosition=null!==(i=e.close_button_position)&&void 0!==i?i:pt.End}}class mt{create(e,t){switch(e){case ti.BottomSheet:return new ut(t);case ti.Modal:return new gt(t);case ti.Fullscreen:return new ft(t)}}}var vt=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},bt=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},yt=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},wt=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let St=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _html(){return yt(this,t,"f")}set _html(e){wt(this,t,e,"f")}constructor(e){Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:(vt(this,a),e)}),t.set(this,vt(this,s,"")),vt(this,n),this.message=e}get html(){return this._html}updateByDto(e){this._html=this.getSlideHtml(e)}getSlideHtml(e){var t;let r=e;return r=rt(r,"{{nonce}}",null!==(t=Re())&&void 0!==t?t:""),r}updatePlaceholders(e){let t=this._html;for(const r of e)t=rt(t,`%${r.key}%`,r.value);this._html=t}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],i=[Pe.computed],bt(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},s,n),bt(e,null,i,{kind:"getter",name:"html",static:!1,private:!1,access:{has:e=>"html"in e,get:e=>e.html},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class _t{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async open(){const[e,t]=await Promise.all([this.getDeviceData(),$e()]),r=this.completeDeviceData(e,t),i=await Ce.post("session/open",null!=r?r:{},{expand:"cache,storyWidgetsResources",fields:"session,server_timestamp,user_key,share,preview_aspect_ratio,placeholders,image_placeholders,is_allow_ugc"});return i.data.deviceId=e.device_id,i.data}async sendStatisticData(e){return new Promise((t=>{Oe("session/update",e,t)}))}completeDeviceData(e,t){"iOS"===e.os_name?window.isIos=!0:"Android"===e.os_name&&(window.Android=!0);const r=this.storyManager.getConfig();return r&&r.userId&&(e.user_id=r.userId,e.user_sign=r.userIdSign),e.features="animation,data,deeplink,placeholder,resetTimers,gameReader,sendApi,swipeUpItems,imgPlaceholder,vod,closeStoryApi",t&&(e.features+=",webp"),e}async getDeviceData(){return new Promise(((e,t)=>{let r=Ne("device_data"),i=null;if(null!==r&&(i=r.device_id),null!==r&&i&&(0,Be.default)(i)&&36===i.trim().length)e(r);else{const t={platform:"web",device_id:(0,he.v4)()};Ue("device_data",t),e(t)}}))}}var Ot;!function(e){e.TEXT="text",e.IMAGE="image"}(Ot||(Ot={}));class Ct{constructor(e,t,r,i){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"priority",{enumerable:!0,configurable:!0,writable:!0,value:i})}}class xt extends Ct{constructor(e,t){super(Ot.IMAGE,e,t,0)}}class kt extends Ct{constructor(e,t){super(Ot.TEXT,e,t,2)}}class Pt extends Ct{constructor(e,t){super(Ot.IMAGE,e,t,1)}}class jt extends Ct{constructor(e,t){super(Ot.TEXT,e,t,3)}}const Mt="default";class Et{get textPlaceholders(){return this._textPlaceholders}get imagePlaceholders(){return this._imagePlaceholders}get fontsResources(){return this.resources.filter((e=>"font-face"===e.type))}constructor(e,t){Object.defineProperty(this,"sessionStore",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_textPlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_imagePlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expireIn",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"share",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"previewAspectRatio",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"resources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=t.session.id,this.expireIn=t.session.expire_in,this.userKey=t.user_key||Mt,this.previewAspectRatio=t.preview_aspect_ratio,this.share=t.share,this.resources=this.getResources(t),this._textPlaceholders=this.mapTextPlaceholders(t.placeholders),this._imagePlaceholders=this.mapImagePlaceholders(t.image_placeholders),this.deviceId=t.deviceId}loadResources(){Ve(this.fontsResources)}getResources(e){return e.cache&&Array.isArray(e.cache)?e.cache:[]}mapTextPlaceholders(e){return e.map((e=>new kt(e.name,e.default_value)))}mapImagePlaceholders(e){return e.map((e=>new xt(e.name,e.default_value)))}}class It extends Error{constructor(e){super(`Story with ID ${e} has already been shown to the user`),this.name="IasStoryAlreadyShownError"}}class Lt extends Error{constructor(e){super(`Like undefined on story with ID ${e}`),this.name="IasLikeUndefinedError"}}class Tt extends Error{constructor(e){super(`Share url undefined on story with ID ${e}`),this.name="IasShareUrlUndefinedError"}}var At,Rt=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Dt=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Bt=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ft=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.UGC=1]="UGC",e[e.FAVORITE=2]="FAVORITE",e[e.ONBOARDING=3]="ONBOARDING"}(At||(At={}));let Nt=(()=>{var e,t;let r,i,a,s=[],n=[],o=[];return e=class{get _stories(){return Bt(this,t,"f")}set _stories(e){Ft(this,t,e,"f")}constructor(e,r,i){var a;Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:(Rt(this,s),r)}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasFavorite",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_cover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_type",{enumerable:!0,configurable:!0,writable:!0,value:At.DEFAULT}),t.set(this,Rt(this,n,Pe.observable.array())),Rt(this,o),this.rootStore=r,this.params=i,this.id=e.id,this.slug=e.feedSlug,this.hasFavorite=Boolean(e.hasFavorite),this._cover=Yt.createByRawData(null!==(a=e.cover)&&void 0!==a?a:{}),this._stories=r.storyStore.addStoriesByDtos(e.stories)}get stories(){return this._stories}get type(){return this._type}get cover(){return this._cover}get coverSrc(){var e;const t=null===(e=this._cover)||void 0===e?void 0:e.findOneByType("h");return null==t?void 0:t.url}removeById(e){const t=this._stories.findIndex((t=>t.id===e));-1!==t&&(0,Pe.remove)(this._stories,t.toString())}unshiftStory(e){-1===this._stories.indexOf(e)&&this._stories.unshift(e)}getStoryById(e){return this.stories.find((t=>t.id===e))}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],i=[Pe.action],a=[Pe.action],Dt(e,null,r,{kind:"accessor",name:"_stories",static:!1,private:!1,access:{has:e=>"_stories"in e,get:e=>e._stories,set:(e,t)=>{e._stories=t}},metadata:t},n,o),Dt(e,null,i,{kind:"method",name:"removeById",static:!1,private:!1,access:{has:e=>"removeById"in e,get:e=>e.removeById},metadata:t},null,s),Dt(e,null,a,{kind:"method",name:"unshiftStory",static:!1,private:!1,access:{has:e=>"unshiftStory"in e,get:e=>e.unshiftStory},metadata:t},null,s),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const Ut="{{__favorite__}}";class Wt extends Nt{constructor(e,t){super(e,t),this._type=At.FAVORITE}static createByStoryDtos(e,t){return new Wt({feedSlug:Ut,stories:e},t)}}const zt=(e=>{var t={};return T.d(t,e),t})({default:()=>l.default});class Vt extends Nt{constructor(e,t,r){super(e,t),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"limit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._type=At.ONBOARDING,this.tags=r.tags,this.limit=r.limit,this.filterOpenedStories()}static getDefaultSlug(){return"onboarding"}isEqualParams(e){return(0,zt.default)(this.tags,e.tags)&&this.limit===e.limit}filterOpenedStories(){this._stories=this._stories.filter((e=>!e.isOpened))}}const Gt="{{__ugc__}}";class $t extends Nt{constructor(e,t){super(e,t),this._type=At.UGC}static createByStoryDtos(e,t){return new $t({feedSlug:Gt,stories:e},t)}}class Ht{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async fetchStorySlides({id:e,feedSlug:t}){const{url:r,params:i}=this.getStoryRequestConfig(e,t);return(await Ce.get(r,null!=i?i:{})).data}async fetchStory({id:e,feedSlug:t,fetchShareUrl:r,once:i}){const{url:a,params:s}=this.getStoryRequestConfig(e,t,!0,r,i),n=await Ce.get(a,null!=s?s:{});if(204===n.status&&i)throw new It(e.toString());return n.data}async fetchStoryContext({ids:e}){const{url:t,params:r}=this.getStoryContextRequestConfig(e);return(await Ce.get(t,null!=r?r:{})).data}async fetchStoryCSS(){var e;const{url:t,params:r}=this.getStoryCSSRequestConfig();return null!==(e=(await Ce.get(t,null!=r?r:{})).data.style)&&void 0!==e?e:""}async setStoryLike(e,t){if(this.storyManager.isStatisticsDisabled)return t;const r=await Ce.post(`story-like/${e}`,{value:t});if(null==r.data.like)throw new Lt(e);return r.data.like}async setStoryBookmark(e,t){if(this.storyManager.isStatisticsDisabled)return t;return(await Ce.post(`story-favorite/${e}`,{value:t})).data.favorite}async markStoryAsOpened(e,t){const r=`u/${e}/s_opened`;let i=Ne(r);Array.isArray(i)||(i=[]);const a=new Set(i);a.add(t),i=Array.from(a),Ue(r,i)}async fetchStorySharePath(e){const t=await Ce.get(`story-share/${e}`,{});if(!t.data.url)throw new Tt(e);return t.data.url}async updateNarrativeData(e,t){if(!this.storyManager.getConfig().isStatisticsDisabled)return Ce.request({url:"story-data/"+e,method:"put",data:{data:t}})}getStoryRequestConfig(e,t,r=!1,i,a){const s=["slides"];i&&s.push("share_url");const n={url:`${t===Gt?"ugc/":""}story/${e}`,method:"GET",params:{expand:s.join(",")}};return n.params.once=Number(Boolean(a)),r||null!=n.params&&(n.params.fields=["id","slides"].join(",")),n}getStoryCSSRequestConfig(){return{url:"story-context",method:"GET",params:{fields:"style"}}}getStoryContextRequestConfig(e){return{url:"story-context",method:"GET",params:{id:e.join(","),fields:"widgetsData"}}}}class qt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async fetchUgcFeed({filter:e,tags:t,testKey:r}){const i={tags:t.join(","),test:r,f:e&&JSON.stringify(e)};return(await Ce.get("ugc/feed",null!=i?i:{})).data}async fetchDefaultFeed({feedSlug:e,tags:t,testKey:r}){const i=`feed/${e}`,a={tags:t.join(","),test:r},s=await Ce.get(i,null!=a?a:{});return s.data.feedSlug=e,s.data}async fetchFavoriteFeed({tags:e}){const t={tags:e.join(","),favorite:1};return(await Ce.get("story",null!=t?t:{})).data}async fetchOnboardingFeed(e){const t=`feed/${e.feedSlug}/onboarding`,r={tags:e.tags.join(","),limit:e.limit},i=await Ce.get(t,null!=r?r:{});return i.data.feedSlug=e.feedSlug,i.data}}const Qt=(e=>{var t={};return T.d(t,e),t})({default:()=>d.default});class Kt{constructor(e){Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:""}),this.width=e.width,this.height=e.height,this.type=e.type,this.url=this.changeUrlProtocol(e.url)}changeUrlProtocol(e){let t=window.isSecureContext;return void 0===t&&"https:"===window.location.protocol&&(t=!0),t?e:e.replace(/^https:\/\//,"http://")}}class Yt{constructor(){Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"gradient",{enumerable:!0,configurable:!0,writable:!0,value:!1})}static createByRawData(e){const t=new Yt;for(let r in e)e.hasOwnProperty(r)&&t.images.push(new Kt(e[r]));return t}findOneByType(e){var t;return null!==(t=this.images.find((t=>t.type===e)))&&void 0!==t?t:null}findOneByCoverQuality(e){return this.findOneByType(this.mapCoverQualityToImageType(e))}findOneByWidth(e,t=!1){var r;let i=null;return this.images.forEach((t=>{t.width===e&&(i=t)})),null!==i?i:(i=null!==(r=(0,Qt.default)(this.images))&&void 0!==r?r:null,t&&null!=i?i:null)}mapCoverQualityToImageType(e){switch(e){case V.Medium:return"m";case V.High:return"h"}}}var Jt=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Zt=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Xt=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},er=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let tr=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _html(){return Xt(this,t,"f")}set _html(e){er(this,t,e,"f")}get html(){return this._html}constructor(e){t.set(this,(Jt(this,a),Jt(this,s,""))),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:Jt(this,n)}),Object.defineProperty(this,"timeline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"screenshotShare",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"eventPayload",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.index=e.index,this.timeline={foreground:e.timeline.foreground,background:e.timeline.background},this.duration=e.duration,this.screenshotShare=e.screenshot_share,this.eventPayload=e.event_payload,this._html=this.replaceSlideNonce(e.html)}static createEmpty(){return new e({index:0,timeline:{foreground:"",background:""},duration:0,screenshot_share:!1,html:""})}replaceSlideNonce(e){var t;return rt(e,"{{nonce}}",null!==(t=Re())&&void 0!==t?t:"")}updatePlaceholders(e){let t=this._html;for(const r of e)t=rt(t,`%${r.key}%`,r.value);this._html=t}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],i=[Pe.computed],Zt(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},s,n),Zt(e,null,i,{kind:"getter",name:"html",static:!1,private:!1,access:{has:e=>"html"in e,get:e=>e.html},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var rr=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},ir=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},ar=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},sr=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let nr=(()=>{var e,t,r,i,a,s,n,o,l,d;let c,u,h,p,g,f,m,v,b,y=[],w=[],S=[],_=[],O=[],C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[],T=[],A=[],R=[],D=[];return e=class{get _slidesLoaded(){return ar(this,t,"f")}set _slidesLoaded(e){sr(this,t,e,"f")}get _error(){return ar(this,r,"f")}set _error(e){sr(this,r,e,"f")}get _context(){return ar(this,i,"f")}set _context(e){sr(this,i,e,"f")}get _like(){return ar(this,a,"f")}set _like(e){sr(this,a,e,"f")}get _favorite(){return ar(this,s,"f")}set _favorite(e){sr(this,s,e,"f")}get _shareUrl(){return ar(this,n,"f")}set _shareUrl(e){sr(this,n,e,"f")}get _slides(){return ar(this,o,"f")}set _slides(e){sr(this,o,e,"f")}get _isOpened(){return ar(this,l,"f")}set _isOpened(e){sr(this,l,e,"f")}get _canBeShown(){return ar(this,d,"f")}set _canBeShown(e){sr(this,d,e,"f")}constructor(e,c,u){var h,p,g,f,m,v,b,B,F,N,U,W,z,V,G,$,H,q,Q,K,Y,J,Z;Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"storiesApi",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stringId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"statTitle",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:{color:"",gradient:!1}}),Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slidesCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"disableClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"likeFunctional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"favoriteFunctional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shareFunctional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"needPlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"gameInstance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideTimeline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasPlaceholder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSwipeUp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ugcPayload",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_title",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parsedSlideImage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_videoCoverSrc",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_videoCover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,ir(this,y,!1)),r.set(this,(ir(this,w),ir(this,S,null))),i.set(this,(ir(this,_),ir(this,O,null))),a.set(this,(ir(this,C),ir(this,x,0))),s.set(this,(ir(this,k),ir(this,P,!1))),n.set(this,(ir(this,j),ir(this,M,null))),o.set(this,(ir(this,E),ir(this,I,[]))),l.set(this,(ir(this,L),ir(this,T,!1))),d.set(this,(ir(this,A),ir(this,R,!1))),ir(this,D),this.rootStore=c,this.storiesApi=u,this.id=e.id,this._title=null!==(h=e.title)&&void 0!==h?h:"",this._isOpened=null!==(p=e.is_opened)&&void 0!==p&&p,this.statTitle=null!==(g=e.stat_title)&&void 0!==g?g:"",this.titleColor=null!==(f=e.title_color)&&void 0!==f?f:"",this.background=null!==(m=e.background)&&void 0!==m?m:{},this.backgroundColor=null!==(v=e.background_color)&&void 0!==v?v:"",this.slidesCount=null!==(b=e.slides_count)&&void 0!==b?b:0,this.disableClose=null!==(B=e.disable_close)&&void 0!==B&&B,this.hideInReader=null!==(F=e.hide_in_reader)&&void 0!==F&&F,this.likeFunctional=null!==(N=e.like_functional)&&void 0!==N&&N,this.favoriteFunctional=null!==(U=e.favorite_functional)&&void 0!==U&&U,this.shareFunctional=null!==(W=e.share_functional)&&void 0!==W&&W,this.needPlaceholders=null!==(z=e.need_placeholders)&&void 0!==z&&z,this.gameInstance=e.game_instance,this.hasAudio=null!==(V=e.has_audio)&&void 0!==V&&V,this.hasSwipeUp=null!==(G=e.has_swipe_up)&&void 0!==G&&G,this.stringId=null!==($=e.string_id)&&void 0!==$?$:"",this.tags=null!==(H=e.tags)&&void 0!==H?H:[],this._like=null!==(q=e.like)&&void 0!==q?q:0,this._favorite=null!==(Q=e.favorite)&&void 0!==Q&&Q,this.deeplink=null!==(K=e.deeplink)&&void 0!==K?K:"",this.hideTimeline=null!==(Y=e.hide_timeline)&&void 0!==Y&&Y,this.ugcPayload=null!==(J=e.payload)&&void 0!==J?J:{},this._image=Yt.createByRawData(e.image),this._videoCover=Yt.createByRawData(e.video_cover);const X=null!==(Z=e.slides)&&void 0!==Z?Z:[];this.setSlides(X),this.updateTitlePlaceholders(this.rootStore.placeholderStore.placeholders)}get like(){return this._like}get favorite(){return this._favorite}get isOpened(){return this._isOpened}get shareUrl(){return this._shareUrl}get title(){return this._title}get slidesLoaded(){return this._slidesLoaded}get canBeShown(){return this._canBeShown}get error(){return this._error}get slides(){return this._slides}get context(){return this._context}get image(){return this._image}getImagesPerSlide(e){var t,r;return this.parseHtmlSlidesForMainImage(),null!==(r=null===(t=this._parsedSlideImage)||void 0===t?void 0:t[e])&&void 0!==r?r:null}parseHtmlSlidesForMainImage(){!this._parsedSlideImage&&this.slidesLoaded&&(this._parsedSlideImage=this._slides.map((e=>this.parseSlideNarrativeImageSrc(e.html)||this.parseSlideNarrativeVideoPosterSrc(e.html)||null)))}parseSlideNarrativeImageSrc(e){const t=e.match(/<[^<]*narrative-element-image.*<img[^<]*src="([^"]*)"[^<]*>/i);return null==t?void 0:t[1]}parseSlideNarrativeVideoPosterSrc(e){const t=e.match(/<[^<]*narrative-element-video.*<video[^<]*poster\-remote\-src="([^"]*)"[^<]*>/i);return null==t?void 0:t[1]}get videoCover(){return this._videoCover}get videoCoverSrc(){if(!1===this._videoCoverSrc)return null;if(null===this._videoCoverSrc){const e=this.videoCover;if(null===e)return this._videoCoverSrc=!1,null;const t=e.findOneByType("h");if(null!==t)return t.url}return"string"==typeof this._videoCoverSrc?this._videoCoverSrc:null}setSlides(e){!this._slidesLoaded&&e.length&&(this._slides=this.mapSlidesByDto(e),this.updateSlidesPlaceholders(this.rootStore.placeholderStore.placeholders),this._slidesLoaded=!0)}setCanBeShown(e){this._canBeShown=e}setError(e){this._error=e}setContext(e){this._context=e}async setLike(e){if(this._like===e)return;const t=this._like;this._like=e;try{await this.storiesApi.setStoryLike(this.id,e)}catch(e){this._like=t,console.error(e)}}async setFavorite(e){if(this._favorite===e)return;const t=this._favorite;try{this._favorite=e,await this.storiesApi.setStoryBookmark(this.id,e);const t=this.rootStore.storyFeedStore.getFavoriteFeed();e?t.unshiftStory(this):t.removeById(this.id)}catch(e){throw console.error(e),this._favorite=t,e}}markIsOpened(){const e=this.rootStore.sessionStore.session;!this.isOpened&&(null==e?void 0:e.userKey)&&(this.storiesApi.markStoryAsOpened(e.userKey,this.id),this._isOpened=!0,this.rootStore.onboardingFeedStore.removeStoryFromOnboardingFeedsById(this.id))}async fetchStorySharePath(){if(null!==this._shareUrl)return this._shareUrl;const e=await this.storiesApi.fetchStorySharePath(this.id);return this._shareUrl=e,e}async updateNarrativeData(e){return this.storiesApi.updateNarrativeData(this.id,e)}updatePlaceholders(e){this.needPlaceholders&&(this.updateSlidesPlaceholders(e),this.updateTitlePlaceholders(e))}updateSlidesPlaceholders(e){for(const t of this.slides)t.updatePlaceholders(e)}updateTitlePlaceholders(e){let t=this._title;for(const r of e)t=rt(t,`%${r.key}%`,r.value);this._title=t}mapSlidesByDto(e){return e.map((e=>new tr(e)))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;c=[Pe.observable],u=[Pe.observable],h=[Pe.observable],p=[Pe.observable],g=[Pe.observable],f=[Pe.observable],m=[Pe.observable],v=[Pe.observable],b=[Pe.observable],rr(e,null,c,{kind:"accessor",name:"_slidesLoaded",static:!1,private:!1,access:{has:e=>"_slidesLoaded"in e,get:e=>e._slidesLoaded,set:(e,t)=>{e._slidesLoaded=t}},metadata:t},y,w),rr(e,null,u,{kind:"accessor",name:"_error",static:!1,private:!1,access:{has:e=>"_error"in e,get:e=>e._error,set:(e,t)=>{e._error=t}},metadata:t},S,_),rr(e,null,h,{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},O,C),rr(e,null,p,{kind:"accessor",name:"_like",static:!1,private:!1,access:{has:e=>"_like"in e,get:e=>e._like,set:(e,t)=>{e._like=t}},metadata:t},x,k),rr(e,null,g,{kind:"accessor",name:"_favorite",static:!1,private:!1,access:{has:e=>"_favorite"in e,get:e=>e._favorite,set:(e,t)=>{e._favorite=t}},metadata:t},P,j),rr(e,null,f,{kind:"accessor",name:"_shareUrl",static:!1,private:!1,access:{has:e=>"_shareUrl"in e,get:e=>e._shareUrl,set:(e,t)=>{e._shareUrl=t}},metadata:t},M,E),rr(e,null,m,{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},I,L),rr(e,null,v,{kind:"accessor",name:"_isOpened",static:!1,private:!1,access:{has:e=>"_isOpened"in e,get:e=>e._isOpened,set:(e,t)=>{e._isOpened=t}},metadata:t},T,A),rr(e,null,b,{kind:"accessor",name:"_canBeShown",static:!1,private:!1,access:{has:e=>"_canBeShown"in e,get:e=>e._canBeShown,set:(e,t)=>{e._canBeShown=t}},metadata:t},R,D),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class or{constructor(e,t){Object.defineProperty(this,"widgetsData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.widgetsData=this.mapStoryContextDto(e,t)}mapStoryContextDto(e,t){var r;const i={},a=null!==(r=t.widgetsData)&&void 0!==r?r:{};for(const t in a)Array.isArray(a[t])||(i[t]=a[t][e]);return i}updateNarrativeSavedData(e){this.widgetsData._narrative_saved_data=e}}class lr{async openGame({gameInstanceId:e,gameOptions:t}){const r={};t&&(0,be.default)(t)&&null!=t.demoMode&&(r.demoMode=Boolean(t.demoMode));return(await Ce.post(`game/${e}/launch?expand=config`,r)).data}}var dr;!function(e){e.TEXT="text",e.IMAGE="image"}(dr||(dr={}));class cr{constructor(e){var t;Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"sessionId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lang",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appPackageId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sdkVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userAgent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"placeholders",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const r=this.storyManager.getConfig(),i=this.storyManager.rootStore.placeholderStore.placeholders,a=this.storyManager.rootStore.sessionStore.session;this.sessionId=a.id,this.userKey=a.userKey,this.apiKey=r.apiKey,this.sdkVersion="3.4.3",this.apiBaseUrl=me.apiUrl,this.userAgent=we,this.appPackageId=r.appPackageId,this.deviceId=a.deviceId,this.userId=null!==(t=r.userId)&&void 0!==t?t:"",this.lang=r.lang.toString(),this.placeholders=i.map((e=>this.mapPlaceholder(e)))}mapPlaceholder(e){return{type:this.mapPlaceholderType(e.type),name:e.key,value:e.value}}mapPlaceholderType(e){switch(e){case Ot.TEXT:return dr.TEXT;case Ot.IMAGE:return dr.IMAGE}}toJSON(){return{sessionId:this.sessionId,lang:this.lang,apiKey:this.apiKey,userKey:this.userKey,appPackageId:this.appPackageId,deviceId:this.deviceId,userId:this.userId,sdkVersion:this.sdkVersion,apiBaseUrl:this.apiBaseUrl,userAgent:this.userAgent,placeholders:this.placeholders}}}class ur{constructor(e){Object.defineProperty(this,"gameResources",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"elementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"projectSlug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"demoMode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"projectEnv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameDomain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameSlug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"verbose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.gameInstanceId=e.gameInstanceId,this.gameResources=e.gameResources,this.storyId=e.storyId,this.elementId=e.elementId,this.projectSlug=e.projectSlug,this.demoMode=e.demoMode,this.projectEnv=e.projectEnv,this.gameDomain=e.gameDomain,this.gameSlug=e.gameSlug,this.gameVersion=e.gameVersion,this.verbose=e.verbose}toJSON(){return{gameResources:this.gameResources,gameInstanceId:this.gameInstanceId,storyId:this.storyId,elementId:this.elementId,projectSlug:this.projectSlug,demoMode:this.demoMode,projectEnv:this.projectEnv,gameDomain:this.gameDomain,gameSlug:this.gameSlug,gameVersion:this.gameVersion,verbose:this.verbose}}}class hr{constructor(e){Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sha1",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e.url,this.size=e.size,this.key=e.key,this.sha1=e.sha1}}class pr{constructor(e){Object.defineProperty(this,"fullScreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"widescreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"orientation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.fullScreen=e.fullScreen,this.widescreen=e.widescreen,this.orientation=e.orientation}}class gr{constructor(e){Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sha1",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e.url,this.size=e.size,this.sha1=e.sha1}}class fr{constructor(e){Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sha1",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"durationMinimalMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e.url,this.size=e.size,this.sha1=e.sha1,this.durationMinimalMs=e.durationMinimalMs}}class mr{constructor(e){Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sha1",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e.url,this.size=e.size,this.sha1=e.sha1}}const vr=(e=>{var t={};return T.d(t,e),t})({default:()=>c.default});class br{constructor(e,t){var r,i;Object.defineProperty(this,"splashScreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"splashLandscapeScreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"splashLottieScreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"screenOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resources",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"downloadUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"instanceUserData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"canTryReloadCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"loggerLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lottie",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.splashScreen=t.splashScreen?new mr(t.splashScreen):void 0,this.splashLandscapeScreen=t.splashLandscapeScreen?new gr(t.splashLandscapeScreen):void 0,this.splashLottieScreen=t.splashLottieScreen?new fr(t.splashLottieScreen):void 0,this.screenOptions=new pr(t.screenOptions),this.config=new ur(t.config),this.resources=null!==(i=null===(r=t.resources)||void 0===r?void 0:r.map((e=>new hr(e))))&&void 0!==i?i:[],this.url=t.url,this.downloadUrl=t.downloadUrl,this.initCode=t.initCode,this.instanceUserData=t.instanceUserData,this.clientConfig=new cr(e),this.canTryReloadCount=t.canTryReloadCount,this.loggerLevel=t.loggerLevel,this.lottie=t.lottie?{src:t.lottie.src}:void 0}toInitDto(e){return(0,vr.default)(this.config.toJSON(),{clientConfig:Object.assign({fullScreen:!1,screenOrientation:this.screenOptions.orientation,safeAreaInsets:e.safeAreaInsets,widescreen:e.isWidescreen,dir:e.dir,nonce:Re(),sdkFeatures:{gameShouldForegroundCallback:!0}},this.clientConfig.toJSON())})}}class yr extends Error{constructor(e){super(`Invalid language tag: ${e}. The "lang" value must be comply with the RFC 5646 (also known as BCP 47). Examples of valid language tags include "en-US", "fr-FR", "es-ES", etc.`),this.name="IasInvalidLanguageTagError"}}const wr="en-US";class Sr{constructor(e=wr){Object.defineProperty(this,"languageCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"countryCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tag",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rawData",{enumerable:!0,configurable:!0,writable:!0,value:""}),this.rawData=e;const t=this.normalizeAndEnsureCompatibility(e),r=this.validateTag(t);this.parseTag(r)}isValidTag(e){return/^[a-z]+-[a-zA-Z]+$/.test(e)}toRawData(){return this.rawData}toString(){return this.tag}normalizeAndEnsureCompatibility(e){const t=e.toLowerCase();return this.ensureBackwardCompatibility(t)}ensureBackwardCompatibility(e){var t;return null!==(t={ru:"ru-RU",en:"en-US"}[e])&&void 0!==t?t:e}validateTag(e){return this.isValidTag(e)?e:(console.error(new yr(e).message),this.getNavigatorTag())}getNavigatorTag(){const e=navigator.language.toLowerCase();return this.isValidTag(e)?e:(console.error(`Invalid navigator language tag: ${e}`),wr)}parseTag(e){const[t,r]=e.split("-");this.languageCode=t,this.countryCode=r.toUpperCase(),this.tag=`${this.languageCode}-${this.countryCode}`}}const _r=(e=>{var t={};return T.d(t,e),t})({default:()=>u.default});class Or extends Error{constructor(){super("[IAS]: you must pass the <userId> value"),this.name="IasEmptyUserIdError"}}class Cr extends Error{constructor(e,t){super(`[IAS]: tags (joined by ',') "${e.join(",")}" is bigger then ${t} bytes`),this.name="IasTagsLengthError"}}class xr extends Error{constructor(e,t){super(`[IAS]: userId "${e}" is bigger then ${t} bytes`),this.name="IasUserIdLengthError"}}var kr=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Pr=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},jr=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Mr=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Er=(()=>{var e,t,r,i,a;let s,n,o,l,d,c=[],u=[],h=[],p=[],g=[],f=[],m=[],v=[],b=[];return e=class{get _apiKey(){return jr(this,t,"f")}set _apiKey(e){Mr(this,t,e,"f")}get _tags(){return jr(this,r,"f")}set _tags(e){Mr(this,r,e,"f")}get _lang(){return jr(this,i,"f")}set _lang(e){Mr(this,i,e,"f")}get _userId(){return jr(this,a,"f")}set _userId(e){Mr(this,a,e,"f")}constructor(e,s){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(kr(this,c),e)}),t.set(this,kr(this,u,"")),r.set(this,(kr(this,h),kr(this,p,[]))),i.set(this,(kr(this,g),kr(this,f,new Sr))),Object.defineProperty(this,"_disableDeviceId",{enumerable:!0,configurable:!0,writable:!0,value:(kr(this,m),!1)}),Object.defineProperty(this,"_appPackageId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_textPlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_imagePlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_isStatisticsDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),a.set(this,kr(this,v,"")),Object.defineProperty(this,"_userIdSign",{enumerable:!0,configurable:!0,writable:!0,value:kr(this,b)}),Object.defineProperty(this,"_isInited",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.updateByDto(s),this._isInited=!0}get userId(){return this._userId}get userIdSign(){return this._userIdSign}get isStatisticsDisabled(){return this._isStatisticsDisabled||"com.inappstory.webpreview"===this._appPackageId}get appPackageId(){return this._appPackageId}get apiKey(){return this._apiKey}get tags(){return this._tags}get lang(){return this._lang}get disableDeviceId(){return this._disableDeviceId}get textPlaceholders(){return this._textPlaceholders}get imagePlaceholders(){return this._imagePlaceholders}disableStatistic(){this._isStatisticsDisabled=!0}enableStatistic(){this._isStatisticsDisabled=!1}setApiKey(e){this._apiKey!==e&&(!function(e){const t=ve(e);if(null!=t){const e=t.split(".").slice(1);me.baseUrl=`https://${["cdn",...e].join(".")}`,me.faviconApiUrl=`https://${["favicon",...e].join(".")}`,me.apiUrl=`https://${t}`}}(e),this._apiKey=e,this.storyManager.rootStore.sessionStore.close())}async setUserId(e,t){if(((0,Be.default)(e)||(0,_r.default)(e))&&this._userId!==e){if(this._disableDeviceId&&!this._userId)throw new Or;(new Ir).checkUserIdLength(e.toString()).validate(),this._userId=e,this._userIdSign=t,this._isInited&&await this.reloadSdk()}}async setLang(e){e&&(0,Be.default)(e)&&this._lang.toRawData()!==e&&(this._lang=new Sr(e),this._isInited&&await this.reloadSdk())}setTextPlaceholders(e={}){if(!(0,be.default)(e))return;const t=this.mapTextPlaceholders(e);(0,zt.default)(this._textPlaceholders,t)||(this._textPlaceholders=t,this.storyManager.rootStore.placeholderStore.addPlaceholders(this._textPlaceholders))}setImagePlaceholders(e={}){if(!(0,be.default)(e))return;const t=this.mapImagePlaceholders(e);(0,zt.default)(this._imagePlaceholders,t)||(this._imagePlaceholders=t,this.storyManager.rootStore.placeholderStore.addPlaceholders(this._imagePlaceholders))}setTags(e){(0,zt.default)(this._tags,e)||((new Ir).checkTagsLength(e).validate(),this._tags=Te(e))}updateByDto(e){var t,r,i,a,s;this._appPackageId=null!==(t=e.appPackageId)&&void 0!==t?t:"",this._disableDeviceId=Boolean(e.disableDeviceId),this.setApiKey(e.apiKey),this.setUserId(null!==(r=e.userId)&&void 0!==r?r:"",e.userIdSign),this.setLang(e.lang),this.setTextPlaceholders(null!==(i=e.placeholders)&&void 0!==i?i:{}),this.setImagePlaceholders(null!==(a=e.imagePlaceholders)&&void 0!==a?a:{}),this.setTags(null!==(s=e.tags)&&void 0!==s?s:[])}mapTextPlaceholders(e){const t=[];for(const[r,i]of Object.entries(e))t.push(new jt(r,i));return t}mapImagePlaceholders(e){const t=[];for(const[r,i]of Object.entries(e))t.push(new Pt(r,i));return t}async reloadSdk(){try{this.storyManager.rootStore.sessionStore.close(),this.storyManager.closeAllReaders(),await this.storyManager.reloadAllStoryLists(),await this.storyManager.reloadAllStackedStoryLists()}catch(e){console.error(e)}}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;s=[Pe.observable],n=[Pe.observable],o=[Pe.observable],l=[Pe.observable],d=[Me],Pr(e,null,s,{kind:"accessor",name:"_apiKey",static:!1,private:!1,access:{has:e=>"_apiKey"in e,get:e=>e._apiKey,set:(e,t)=>{e._apiKey=t}},metadata:t},u,h),Pr(e,null,n,{kind:"accessor",name:"_tags",static:!1,private:!1,access:{has:e=>"_tags"in e,get:e=>e._tags,set:(e,t)=>{e._tags=t}},metadata:t},p,g),Pr(e,null,o,{kind:"accessor",name:"_lang",static:!1,private:!1,access:{has:e=>"_lang"in e,get:e=>e._lang,set:(e,t)=>{e._lang=t}},metadata:t},f,m),Pr(e,null,l,{kind:"accessor",name:"_userId",static:!1,private:!1,access:{has:e=>"_userId"in e,get:e=>e._userId,set:(e,t)=>{e._userId=t}},metadata:t},v,b),Pr(e,null,d,{kind:"method",name:"reloadSdk",static:!1,private:!1,access:{has:e=>"reloadSdk"in e,get:e=>e.reloadSdk},metadata:t},null,c),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Ir{constructor(){Object.defineProperty(this,"errors",{enumerable:!0,configurable:!0,writable:!0,value:[]})}checkUserIdLength(e){return e.length>0&&this.getByteLength(e.toString())>255&&this.errors.push(new xr(e,255)),this}checkTagsLength(e){return e.length>0&&this.getByteLength(e.join(","))>4e3&&this.errors.push(new Cr(e,4e3)),this}validate(){if(this.errors.length>0)throw this.errors.shift()}getByteLength(e){let t=e.length;for(let r=e.length-1;r>=0;r--){const i=e.charCodeAt(r);i>127&&i<=2047?t++:i>2047&&i<=65535&&(t+=2),i>=56320&&i<=57343&&r--}return t}}var Lr=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Tr=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Ar=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Rr=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Dr=(()=>{var e,t,r,i,a,s,n,o,l;let d,c,u,h,p,g,f,m,v,b,y,w,S,_,O,C,x,k,P=[],j=[],M=[],E=[],I=[],L=[],T=[],A=[],R=[],D=[],B=[],F=[],N=[],U=[],W=[],z=[],V=[];return e=class{get _id(){return Ar(this,t,"f")}set _id(e){Rr(this,t,e,"f")}get _events(){return Ar(this,r,"f")}set _events(e){Rr(this,r,e,"f")}get _type(){return Ar(this,i,"f")}set _type(e){Rr(this,i,e,"f")}get _slides(){return Ar(this,a,"f")}set _slides(e){Rr(this,a,e,"f")}get _appearanceOptions(){return Ar(this,s,"f")}set _appearanceOptions(e){Rr(this,s,e,"f")}get _needPlaceholders(){return Ar(this,n,"f")}set _needPlaceholders(e){Rr(this,n,e,"f")}get _hasLimit(){return Ar(this,o,"f")}set _hasLimit(e){Rr(this,o,e,"f")}get _isOnceOpened(){return Ar(this,l,"f")}set _isOnceOpened(e){Rr(this,l,e,"f")}constructor(e,d,c){Object.defineProperty(this,"iamStatisticsService",{enumerable:!0,configurable:!0,writable:!0,value:(Lr(this,P),d)}),Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,Lr(this,j,void 0)),r.set(this,(Lr(this,M),Lr(this,E,{}))),i.set(this,(Lr(this,I),Lr(this,L,void 0))),a.set(this,(Lr(this,T),Lr(this,A,[]))),s.set(this,(Lr(this,R),Lr(this,D,new ct))),n.set(this,(Lr(this,B),Lr(this,F,!1))),o.set(this,(Lr(this,N),Lr(this,U,!1))),l.set(this,(Lr(this,W),Lr(this,z,!1))),Object.defineProperty(this,"_frequencyLimit",{enumerable:!0,configurable:!0,writable:!0,value:(Lr(this,V),null)}),Object.defineProperty(this,"_displayFrom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_displayTo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_campaignName",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._id=e}get id(){return this._id}get needPlaceholders(){return this._needPlaceholders}get openTime(){return this.iamStatisticsService.openTime}get timeSinceLastShow(){return this.iamStatisticsService.timeSinceLastShow}get frequencyLimitTimeExceeded(){return null===this._frequencyLimit?this._isOnceOpened:0!==this._frequencyLimit&&Math.trunc(this.timeSinceLastShow/1e3)<=this._frequencyLimit}get withinDisplayTimeRange(){return(!this._displayFrom||Date.now()>=this._displayFrom)&&(!this._displayTo||Date.now()<=this._displayTo)}get isOnceOpened(){return this._isOnceOpened}get hasLimit(){return this._hasLimit}get events(){return this._events}get slides(){return this._slides}get activeSlideIndex(){return 0}get context(){return this.iamStore.messageContext}get appearanceOptions(){return this._appearanceOptions}get type(){return this._type}destroy(){}updateByDto(e){var t,r,i;this._events=this.mapMessageEventsByDto(null!==(t=e.events)&&void 0!==t?t:[]),this._type=e.type,this._campaignName=e.campaign_name,this._frequencyLimit=e.frequency_limit,this._displayFrom=null!==(r=e.display_from)&&void 0!==r?r:null,this._displayTo=null!==(i=e.display_to)&&void 0!==i?i:null,this._hasLimit=Boolean(e.has_limit),this._appearanceOptions=(new mt).create(this._type,e.appearance),this._needPlaceholders=e.need_placeholders,this.updateMessageSlides(e.slides_html)}hasEvent(e){return Boolean(this._events[e])}getEventByName(e){return this._events[e]}toPublicDto(){return{id:this._id,campaignName:this._campaignName,type:this._type}}async trackOpen(){this._isOnceOpened=!0,await this.iamStatisticsService.trackOpen(this)}async trackClose(){await this.iamStatisticsService.trackClose(this)}async trackWidgetEvent(e){await this.iamStatisticsService.trackWidgetEvent(this,e)}async updateUserData(e){return this.iamStore.updateMessageUserData(this.id,e)}updateMessageSlides(e){const t=[];for(const r of e){const e=new St(this);e.updateByDto(r),t.push(e)}this._slides=t}mapMessageEventsByDto(e){const t={};for(const r of e)t[r.name]=r;return t}static createByDto(t,r,i){const a=new e(t.id,i,r);return a.updateByDto(t),a}updatePlaceholders(e){for(const t of this._slides)t.updatePlaceholders(e)}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;d=[Pe.observable],c=[Pe.observable],u=[Pe.observable],h=[Pe.observable],p=[Pe.observable],g=[Pe.observable],f=[Pe.observable],m=[Pe.observable],v=[Pe.computed],b=[Pe.computed],y=[Pe.computed],w=[Pe.computed],S=[Pe.computed],_=[Pe.computed],O=[Pe.computed],C=[Pe.computed],x=[Pe.computed],k=[Pe.action],Tr(e,null,d,{kind:"accessor",name:"_id",static:!1,private:!1,access:{has:e=>"_id"in e,get:e=>e._id,set:(e,t)=>{e._id=t}},metadata:t},j,M),Tr(e,null,c,{kind:"accessor",name:"_events",static:!1,private:!1,access:{has:e=>"_events"in e,get:e=>e._events,set:(e,t)=>{e._events=t}},metadata:t},E,I),Tr(e,null,u,{kind:"accessor",name:"_type",static:!1,private:!1,access:{has:e=>"_type"in e,get:e=>e._type,set:(e,t)=>{e._type=t}},metadata:t},L,T),Tr(e,null,h,{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},A,R),Tr(e,null,p,{kind:"accessor",name:"_appearanceOptions",static:!1,private:!1,access:{has:e=>"_appearanceOptions"in e,get:e=>e._appearanceOptions,set:(e,t)=>{e._appearanceOptions=t}},metadata:t},D,B),Tr(e,null,g,{kind:"accessor",name:"_needPlaceholders",static:!1,private:!1,access:{has:e=>"_needPlaceholders"in e,get:e=>e._needPlaceholders,set:(e,t)=>{e._needPlaceholders=t}},metadata:t},F,N),Tr(e,null,f,{kind:"accessor",name:"_hasLimit",static:!1,private:!1,access:{has:e=>"_hasLimit"in e,get:e=>e._hasLimit,set:(e,t)=>{e._hasLimit=t}},metadata:t},U,W),Tr(e,null,m,{kind:"accessor",name:"_isOnceOpened",static:!1,private:!1,access:{has:e=>"_isOnceOpened"in e,get:e=>e._isOnceOpened,set:(e,t)=>{e._isOnceOpened=t}},metadata:t},z,V),Tr(e,null,v,{kind:"getter",name:"id",static:!1,private:!1,access:{has:e=>"id"in e,get:e=>e.id},metadata:t},null,P),Tr(e,null,b,{kind:"getter",name:"needPlaceholders",static:!1,private:!1,access:{has:e=>"needPlaceholders"in e,get:e=>e.needPlaceholders},metadata:t},null,P),Tr(e,null,y,{kind:"getter",name:"isOnceOpened",static:!1,private:!1,access:{has:e=>"isOnceOpened"in e,get:e=>e.isOnceOpened},metadata:t},null,P),Tr(e,null,w,{kind:"getter",name:"hasLimit",static:!1,private:!1,access:{has:e=>"hasLimit"in e,get:e=>e.hasLimit},metadata:t},null,P),Tr(e,null,S,{kind:"getter",name:"events",static:!1,private:!1,access:{has:e=>"events"in e,get:e=>e.events},metadata:t},null,P),Tr(e,null,_,{kind:"getter",name:"slides",static:!1,private:!1,access:{has:e=>"slides"in e,get:e=>e.slides},metadata:t},null,P),Tr(e,null,O,{kind:"getter",name:"context",static:!1,private:!1,access:{has:e=>"context"in e,get:e=>e.context},metadata:t},null,P),Tr(e,null,C,{kind:"getter",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions},metadata:t},null,P),Tr(e,null,x,{kind:"getter",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type},metadata:t},null,P),Tr(e,null,k,{kind:"method",name:"updateByDto",static:!1,private:!1,access:{has:e=>"updateByDto"in e,get:e=>e.updateByDto},metadata:t},null,P),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Br{}class Fr extends Br{constructor(e,t,r){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r})}get type(){return"w-copy"}toQueryParams(){return{wi:this.widgetId,wv:this.value,wl:this.label}}toJSON(){return{widgetId:this.widgetId,value:this.value}}}class Nr extends Br{constructor(e,t,r){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r})}get type(){return"w-link"}toQueryParams(){return{wi:this.widgetId,wv:this.value,wl:this.label}}toJSON(){return{widgetId:this.widgetId,value:this.value}}}class Ur extends Br{constructor(e,t,r){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"answer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r})}get type(){return"w-range-slider"}toQueryParams(){return{wi:this.widgetId,wa:this.answer,wl:this.label}}toJSON(){return{widgetId:this.widgetId,answer:this.answer,label:this.label}}}class Wr extends Br{constructor(e,t,r,i){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"answer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:i})}get type(){return"w-rate"}toQueryParams(){return{wi:this.widgetId,wa:this.answer,wl:this.label,wv:this.value}}toJSON(){return{widgetId:this.widgetId,value:this.value,answer:this.answer,label:this.label}}}class zr extends Br{constructor(e,t,r,i,a){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"answer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"answerLabel",{enumerable:!0,configurable:!0,writable:!0,value:a})}get type(){return"w-share"}toQueryParams(){return{wi:this.widgetId,wa:this.answer,wl:this.label,wv:this.value,wal:this.answerLabel}}toJSON(){return{widgetId:this.widgetId,value:this.value,answer:this.answer,label:this.label,answerLabel:this.answerLabel}}}class Vr{constructor(e,t,r){Object.defineProperty(this,"iterationId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideIndex",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideTotal",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,he.v4)()})}toQueryParams(){return{ei:this.eventId,ii:this.iterationId,si:this.slideIndex,st:this.slideTotal}}}class Gr extends Vr{constructor(e,t,r,i){super(e,t,r),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:i})}get type(){return"close"}toQueryParams(){return Object.assign(Object.assign({},super.toQueryParams()),{d:this.duration})}}class $r extends Vr{constructor(e,t,r){super(e,t,r)}get type(){return"open"}toQueryParams(){return super.toQueryParams()}}class Hr extends Vr{constructor(e,t,r,i,a){super(e,t,r),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"widgetEvent",{enumerable:!0,configurable:!0,writable:!0,value:a})}get type(){return this.widgetEvent.type}toQueryParams(){return Object.assign(Object.assign(Object.assign({},super.toQueryParams()),this.widgetEvent.toQueryParams()),{d:this.duration})}}class qr{constructor(e){Object.defineProperty(this,"iamApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iterationId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_openTime",{enumerable:!0,configurable:!0,writable:!0,value:0})}get openTime(){return this._openTime}get timeSinceLastShow(){return Date.now()-this.openTime}async trackOpen(e){this.iterationId=this.generateId(),this._openTime=Date.now();const t=new $r(this.iterationId,e.activeSlideIndex,e.slides.length);await this.iamApi.emitMessageEvent(e.id,t)}async trackClose(e){const t=this.timeSinceLastShow,r=new Gr(this.iterationId,e.activeSlideIndex,e.slides.length,t);await this.iamApi.emitMessageEvent(e.id,r)}async trackWidgetEvent(e,t){const r=this.timeSinceLastShow,i=new Hr(this.iterationId,e.activeSlideIndex,e.slides.length,r,t);return this.iamApi.emitMessageEvent(e.id,i)}generateId(){return(0,he.v4)()}}class Qr extends Error{constructor(){super("[IAM]: you must close other opened readers"),this.name="IamOtherReaderIsOpenError"}}class Kr extends Error{constructor(){super("[IAM]: you need preload in app messages"),this.name="IamShowOnlyIfLoadedError"}}class Yr extends Error{constructor(){super("[IAM]: show message frequency limit exceeded"),this.name="IamFrequencyLimitError"}}class Jr extends Error{constructor(){super("[IAM]: not in display time range"),this.name="IamCheckDisplayTimeRangeError"}}class Zr extends Error{constructor(e){super(`[IAM]: the limit for displaying IAM with ID ${e} has been reached`),this.name="IamMessageLimitExceededError"}}class Xr{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"errors",{enumerable:!0,configurable:!0,writable:!0,value:[]})}checkOtherReadersAreClosed(){var e,t;return((null===(e=this.storyManager.storyReaderViewModel)||void 0===e?void 0:e.isOpened)||(null===(t=this.storyManager.gameReaderViewModel)||void 0===t?void 0:t.isOpened))&&this.errors.push(new Qr),this}checkShowOnlyIfLoaded(e){return!this.iamStore.isLoaded&&e&&this.errors.push(new Kr),this}checkFrequencyLimit(e){return e.frequencyLimitTimeExceeded&&this.errors.push(new Yr),this}checkDisplayTimeRange(e){return e.withinDisplayTimeRange||this.errors.push(new Jr),this}validate(){if(this.errors.length>0)throw this.errors.shift()}}class ei{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"iamApi",{enumerable:!0,configurable:!0,writable:!0,value:r})}async getMessageById(e,t){new Xr(this.storyManager,this.iamStore).checkOtherReadersAreClosed().checkShowOnlyIfLoaded(t.showOnlyIfLoaded).validate();const r=await this.iamStore.findById(e);return r.hasLimit&&await this.checkMesageLimit(e),r}async getMessageByEvent(e,t){new Xr(this.storyManager,this.iamStore).checkOtherReadersAreClosed().checkShowOnlyIfLoaded(t.showOnlyIfLoaded).validate(),await this.iamStore.preload({tags:t.tags});const r=this.iamStore.findAllByEvent(e),i=this.getMessagesSortedByEventPriority(e,r);return this.getFirstValidMessageByEvent(i)}async getFirstValidMessageByEvent(e){let t=new Error;for(const r of e)try{return await this.validateMessageByEvent(r)}catch(e){t=e}throw t}async validateMessageByEvent(e){return new Xr(this.storyManager,this.iamStore).checkFrequencyLimit(e).checkDisplayTimeRange(e).validate(),e.hasLimit&&await this.checkMesageLimit(e.id),e}async checkMesageLimit(e){const{canOpen:t}=await this.iamApi.checkMesageLimit(e);if(!t)throw new Zr(e)}getMessagesSortedByEventPriority(e,t){return t.slice().sort(((t,r)=>{const i=t.events[e].priority;return r.events[e].priority-i}))}}var ti,ri,ii;!function(e){e[e.BottomSheet=1]="BottomSheet",e[e.Modal=2]="Modal",e[e.Fullscreen=3]="Fullscreen"}(ti||(ti={})),function(e){e[e.None=0]="None",e[e.SlideInUp=1]="SlideInUp",e[e.FadeIn=2]="FadeIn"}(ri||(ri={})),function(e){e[e.None=0]="None",e[e.Left=1]="Left",e[e.Right=2]="Right"}(ii||(ii={}));class ai{constructor(e){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handleDocumentVisibilityChange=this.handleDocumentVisibilityChange.bind(this)}subscribe(){document.addEventListener("visibilitychange",this.handleDocumentVisibilityChange)}unsubscribe(){document.removeEventListener("visibilitychange",this.handleDocumentVisibilityChange)}handleDocumentVisibilityChange(){const e=this.iamReader.activeMessage;document.hidden?e.trackClose():e.trackOpen()}}class si{constructor(e,t){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t})}get contentRatio(){return 9/16}getWidth(){return this._vw}getHeight(){return this._vh}}class ni{constructor(e,t,r,i){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:i}),this.desktopMode&&this.initViewportWidthForDesktopMode()}get contentRatio(){return this._contentRatio}getWidth(){return this._vw}getHeight(){return Math.ceil(this._vw/this._contentRatio)}initViewportWidthForDesktopMode(){this._vw>557&&(this._vw=557)}}class oi{constructor(e,t,r,i){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:i}),this.desktopMode&&this.initViewportWidthForDesktopMode()}get contentRatio(){return this._contentRatio}getWidth(){return this._vw}getHeight(){return Math.ceil(this._vw/this._contentRatio)}initViewportWidthForDesktopMode(){this._vw>557&&(this._vw=557)}}class li{create(e,t){switch(e){case ti.BottomSheet:return new ni(t.vw,t.vh,t.appearanceOptions.contentRatio,t.desktopMode);case ti.Modal:return new oi(t.vw,t.vh,t.appearanceOptions.contentRatio,t.desktopMode);case ti.Fullscreen:return new si(t.vw,t.vh)}}}class di{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r})}get contentRatio(){return this._contentRatio}getOffset(){const e=this.calculateHeight();return-(Math.ceil(e-this._vh)/2)+"px 0px"}getOffsetX(){return"0px"}getOffsetY(){const e=this.calculateHeight();return`${Math.ceil(e-this._vh)/2}px`}getWidth(){return`${this.calculateWidth()}px`}getHeight(){return`${this.calculateHeight()}px`}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return this._vw}calculateHeight(){return Math.ceil(this._vw/this._contentRatio)}}class ci{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r})}get contentRatio(){return this._contentRatio}get vw(){return this._vw}get vh(){return this._vh}getOffset(){const e=this.calculateWidth();return`0px ${-(Math.ceil(e-this._vw)/2)}px`}getOffsetX(){const e=this.calculateWidth();return`${Math.ceil(e-this._vw)/2}px`}getOffsetY(){return"0px"}getWidth(){return`${this.calculateWidth()}px`}getHeight(){return`${this.calculateHeight()}px`}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return Math.ceil(this._vh*this._contentRatio)}calculateHeight(){return this._vh}}class ui{}class hi extends ui{constructor(e,t,r){super(),Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r})}get contentRatio(){return this._contentRatio}getOffset(){const e=this.calculateHeight();return-(Math.ceil(e-this._vh)/2)+"px 0px"}getOffsetX(){return"0px"}getOffsetY(){const e=this.calculateHeight();return`${Math.ceil(e-this._vh)/2}px`}getWidth(){return`${this.calculateWidth()}px`}getHeight(){return`${this.calculateHeight()}px`}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return this._vw}calculateHeight(){return Math.ceil(this._vw/this._contentRatio)}}class pi extends ui{constructor(e,t,r){super(),Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r})}get contentRatio(){return this._contentRatio}getOffset(){const e=this.calculateWidth();return`0px ${Math.ceil(this._vw-e)/2}px`}getOffsetX(){const e=this.calculateWidth();return`${Math.ceil(this._vw-e)/2}px`}getOffsetY(){return"0px"}getWidth(){return`${this.calculateWidth()}px`}getHeight(){return`${this.calculateHeight()}px`}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return Math.ceil(this.calculateHeight()*this._contentRatio)}calculateHeight(){return this._vh}}class gi{constructor(){}create(e){const t=this.getViewportParams(e);return this.isFullscreen(e,t)?this.createFullscreenSlideGeometry(t):this.createWideOrSquareGeometry(t)}isFullscreen(e,t){return e instanceof si}createWideOrSquareGeometry(e){return e.viewportRatio>e.contentRatio?new di(e.vw,e.vh,e.contentRatio):new ci(e.vw,e.vh,e.contentRatio)}getViewportParams(e){return{vw:e.getWidth(),vh:e.getHeight(),viewportRatio:e.getWidth()/e.getHeight(),contentRatio:e.contentRatio}}createFullscreenSlideGeometry(e){return e.viewportRatio>e.contentRatio?new pi(e.vw,e.vh,e.contentRatio):new hi(e.vw,e.vh,e.contentRatio)}}const fi=new e.EventEmitter;fi.setMaxListeners(50);class mi{constructor(e,t={}){var r,i,a,s,n;Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slidesCount",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"feedSlug",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"filter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"actionSource",{enumerable:!0,configurable:!0,writable:!0,value:te.list}),Object.defineProperty(this,"ugcPayload",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slideEventPayload",{enumerable:!0,configurable:!0,writable:!0,value:null});const o=this.story.sourceInfo,l=o.listType,d=null!==(r=o.feedSlug)&&void 0!==r?r:null,c=null!==(i=o.filter)&&void 0!==i?i:null;this.title=this.story.statTitle,this.tags=this.story.tags,this.slidesCount=this.story.slidesCount,this.ugcPayload=l===At.UGC?this.story.ugcPayload:null,this.feedSlug=l===At.DEFAULT?d:null,this.filter=l===At.UGC?c:null,this.actionSource=null!=l?this.getStorySourceByFeedType(l):te.direct,this.slideEventPayload=null!==(n=null===(s=null===(a=e.activeSlide)||void 0===a?void 0:a.eventPayload)||void 0===s?void 0:s.payload)&&void 0!==n?n:null}toJSON(){return Object.assign({id:this.story.id,index:this.story.activeSlideIndex,title:this.title,tags:this.tags,slidesCount:this.slidesCount,feed:this.feedSlug,filter:this.filter,source:this.actionSource,ugcPayload:this.ugcPayload,payload:this.slideEventPayload},this.payload)}getStorySourceByFeedType(e){switch(e){case At.DEFAULT:case At.UGC:return te.list;case At.FAVORITE:return te.favorite;case At.ONBOARDING:return te.onboarding;default:return te.list}}}class vi extends mi{get name(){return"closeStory"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{action:this.payload.action})}}class bi extends mi{get name(){return"dislikeStory"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{value:this.payload.value})}}class yi extends mi{get name(){return"favoriteStory"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{value:this.payload.value})}}class wi extends mi{get name(){return"likeStory"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{value:this.payload.value})}}class Si extends mi{get name(){return"shareStory"}}class _i extends mi{get name(){return"shareStoryWithPath"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{value:this.payload.url})}}class Oi extends mi{get name(){return"showSlide"}}class Ci extends mi{get name(){return"showStory"}toJSON(){const e=super.toJSON();return e.payload=null,e}}class xi{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timerId",{enumerable:!0,configurable:!0,writable:!0,value:null})}start(){this.schedule(1e4)}stop(){null!=this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}async flush(){ke(`[${Ii.name}]: flush statistics by timer`);this.statisticsService.getData().length>0?this.schedule(1e4):this.schedule(3e4),await this.statisticsService.sendData()}schedule(e){ke(`[${Ii.name}]: schedule flush statistics on ${e}ms`),this.timerId=setTimeout((()=>this.flush()),e)}}class ki{constructor(){Object.defineProperty(this,"slideStartedAt",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}calculate(){const e=Date.now(),t=e-this.slideStartedAt;return this.slideStartedAt=e,t}init(){this.slideStartedAt=Date.now()}}class Pi{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),fi.on(Ei.CloseStoryReader,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:1,storyId:e.storyId,slideIndex:e.slideIndex})}destroy(){fi.off(Ei.CloseStoryReader,this.handle)}}class ji{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),fi.on(Ei.NextSlide,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:1,storyId:e.fromStoryId,slideIndex:e.fromSlideIndex})}destroy(){fi.off(Ei.NextSlide,this.handle)}}class Mi{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),fi.on(Ei.TransitionFromSlide,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:2,storyId:e.storyId,slideIndex:e.slideIndex})}destroy(){fi.off(Ei.TransitionFromSlide,this.handle)}}var Ei;!function(e){e.CloseStoryReader="statistics.closeStoryReader",e.NextSlide="statistics.nextSlide",e.TransitionFromSlide="statistics.transitionFromSlide"}(Ei||(Ei={}));class Ii extends e.default{constructor(e,t){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"beaconService",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"lastIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sourceInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"flushSheduler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideDurationCalculator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.flushSheduler=new xi(this),this.slideDurationCalculator=new ki}init(e){this.data=[],this.sourceInfo=e,this.lastIndex=0,this.slideDurationCalculator.init(),this.flushSheduler.start(),this.events=[new Pi(this),new ji(this),new Mi(this)]}getData(){return this.data.slice()}getLastIndex(){return this.lastIndex}cleanupData(){this.data=[]}addSlideEvent(e){if(this.storyManager.getConfig().isStatisticsDisabled)return;const t=this.slideDurationCalculator.calculate();this.data.push([e.action,this.lastIndex,e.storyId,e.slideIndex,t]),this.lastIndex++}async sendData(){const e=this.getData();if(e.length)try{if(!this.sourceInfo)throw new Error(`[${Ii.name}]: You need pass source info!`);this.cleanupData(),await this.beaconService.updateStatistics({updateDto:{data:e},listType:this.sourceInfo.feedSlug===Gt?At.UGC:At.DEFAULT})}catch(t){this.data.push(...e),console.error(t)}}async destroy(){this.events.forEach((e=>e.destroy())),this.flushSheduler.stop(),await this.sendData()}}class Li{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async updateStatistics({listType:e,updateDto:t}){if(0===t.data.length)return t;let r=!1,i="";if(e===At.UGC||this.storyManager.getConfig().isStatisticsDisabled)r=!0;else try{Oe("session/update",t,(()=>{})),r=!0}catch(e){i=e.toString()}if(r)return t;throw i}}class Ti{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"prevStoryId",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"prevSlideIndex",{enumerable:!0,configurable:!0,writable:!0,value:-1})}update(e){this.prevStoryId!==e.id&&(fi.emit("publicEvents.showStory",{id:e.id}),this.storyManager.emitEvent(new Ci(e))),-1!==this.prevStoryId&&fi.emit(Ei.NextSlide,{fromStoryId:this.prevStoryId,fromSlideIndex:this.prevSlideIndex}),this.storyManager.emitEvent(new Oi(e)),this.prevStoryId=e.id,this.prevSlideIndex=e.activeSlideIndex}reset(){this.prevStoryId=-1,this.prevSlideIndex=-1}}var Ai=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ri=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};let Di=(()=>{var e;let t,r=[];return e=class{constructor(e,t){Object.defineProperty(this,"showMultipleStoriesStrategy",{enumerable:!0,configurable:!0,writable:!0,value:(Ai(this,r),e)}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t})}async show(e){var t,r;const i=this.storyManager.rootStore.onboardingFeedStore,a=await i.fetchOnboardingFeed({feedSlug:e.feedSlug,tags:null!==(t=e.customTags)&&void 0!==t?t:[],limit:null!==(r=e.limit)&&void 0!==r?r:void 0}),s=this.getFeedLoadEvent(a.slug,a.stories);return this.emitFeedLoad(s),a.stories.length?(await this.showMultipleStoriesStrategy.show({windowReferer:re.default,storyFeed:a,storyId:a.stories[0].id}),s):s}async handleNextStoryByIndex(e){this.showMultipleStoriesStrategy.handleNextStoryByIndex(e)}emitFeedLoad(e){this.storyManager.emit("feedLoad",e)}getFeedLoadEvent(e,t){const r={stories:t.map((e=>{const t={title:null,tags:[],slidesCount:null};return e&&(t.title=e.statTitle,t.tags=e.tags,t.slidesCount=e.slidesCount),Object.assign({id:e.id},t)})),feed:null,filter:null};return r.feed=e,r}async reload(e){this.showMultipleStoriesStrategy.reload(e)}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Me],Ri(e,null,t,{kind:"method",name:"show",static:!1,private:!1,access:{has:e=>"show"in e,get:e=>e.show},metadata:i},null,r),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),e})();class Bi{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stories",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"storyIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"storyFeed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storyStore=this.storyManager.rootStore.storyStore}async show(e){const{storyId:t,windowReferer:r,filter:i}=e;this.storyFeed=e.storyFeed,this.stories=this.getVisibleStoriesByStoryFeed(this.storyFeed),this.storyIndex=this.findStoryIndex(this.stories,t),this.storyReaderViewModel.open({windowReferer:r,id:t,stories:this.stories},{listType:this.storyFeed.type,feedSlug:this.storyFeed.slug,filter:i}),await this.storyStore.fetchStoriesSlides({stories:this.getStoriesByRange(this.storyIndex),feedSlug:this.storyFeed.slug})}async reload(e){const t=this.findStoryIndex(this.stories,e.storyId);await this.storyStore.fetchStoriesSlides({stories:this.getStoriesByRange(t),feedSlug:this.storyFeed.slug})}async handleNextStoryByIndex(e){await this.storyStore.fetchStoriesSlides({stories:this.getStoriesByRange(e),feedSlug:this.storyFeed.slug})}getVisibleStoriesByStoryFeed(e){var t;return null!==(t=e.stories.filter((e=>!e.hideInReader)))&&void 0!==t?t:[]}findStoryIndex(e,t){return e.findIndex((e=>e.id===t))}getStoriesByRange(e){const t=e-2,r=e+2;return this.stories.slice(Math.max(t,0),r+1)}}class Fi{constructor(e){Object.defineProperty(this,"showStoryStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e})}async show(e){await this.showStoryStrategy.show({storyId:e.storyId,fetchShareUrl:e.fetchShareUrl})}async reload(e){return this.showStoryStrategy.reload(e)}async handleNextStoryByIndex(e){}}var Ni=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ui=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};let Wi=(()=>{var e;let t,r=[];return e=class{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Ni(this,r),e)}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}async show(e){try{const t=this.storyManager.rootStore.storyStore,r=await t.fetchStoryById({storyId:e.storyId,feedSlug:"",once:!0});if(r.error)throw r.error;if(r.isOpened)throw new It(e.storyId.toString());this.openStoryReader(r)}catch(e){throw this.storyReaderViewModel.close(),e}}openStoryReader(e){this.storyReaderViewModel.open({windowReferer:re.default,id:e.id,stories:[e]},{feedSlug:"",once:!0})}async handleNextStoryByIndex(e){}async reload(e){}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Me],Ui(e,null,t,{kind:"method",name:"show",static:!1,private:!1,access:{has:e=>"show"in e,get:e=>e.show},metadata:i},null,r),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),e})();var zi=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Vi=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};let Gi=(()=>{var e;let t,r=[];return e=class{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(zi(this,r),e)}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}async show(e){const t=this.storyManager.rootStore.storyStore,r=await t.fetchStoryById({storyId:e.storyId,feedSlug:"",fetchShareUrl:e.fetchShareUrl});this.openStoryReader(r,e)}openStoryReader(e,t){this.storyReaderViewModel.open({windowReferer:re.default,id:e.id,stories:[e]},{feedSlug:"",fetchShareUrl:t.fetchShareUrl})}async handleNextStoryByIndex(e){}async reload(e){}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Me],Vi(e,null,t,{kind:"method",name:"show",static:!1,private:!1,access:{has:e=>"show"in e,get:e=>e.show},metadata:i},null,r),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),e})();class $i{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}createShowStory(){return new Gi(this.storyManager,this.storyReaderViewModel)}createShowStoryOnce(){return new Wi(this.storyManager,this.storyReaderViewModel)}createShowStoryFromSharePage(){return new Fi(new Gi(this.storyManager,this.storyReaderViewModel))}createShowOnboardingStories(){return new Di(new Bi(this.storyManager,this.storyReaderViewModel),this.storyManager)}createShowMultipleStories(){return new Bi(this.storyManager,this.storyReaderViewModel)}}class Hi extends e.default{constructor(){super(),Object.defineProperty(this,"layersContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_activeLayer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initialLayer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}init(e,t){this.layersContainer=e,this.animationApi=t,this.layers=Array.from(this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide")),this._activeLayer=this.layers.find((e=>!e.classList.value.includes("hidden"))),this.initialLayer=this._activeLayer}reset(){var e;this.hideAllLayers(),null===(e=this.initialLayer)||void 0===e||e.classList.remove("hidden")}get activeLayer(){return this._activeLayer}getLayers(){return this.layers}hideLayer(e){e.classList.contains("hidden")||(this.animationApi.stop(e,!0),e.classList.add("hidden"))}showLayer(e){return e.classList.remove("hidden"),this.animationApi.start(e,!0),this._activeLayer=e,e}hideAllLayers(){this.getLayers().forEach((e=>this.hideLayer(e)))}showLayerByIndex(e){const t=this.getLayers();t.forEach((e=>this.hideLayer(e)));const r=t[e];if(r)return this.showLayer(r)}hasValidMultiSlides(){let e=!0,t=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide");const r=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide:not(.hidden)");return t.length>0&&0===r.length&&(e=!1),e}}class qi{constructor(e){Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideElement",{enumerable:!0,configurable:!0,writable:!0,value:null})}init(e){this.slideElement=e.querySelector(".narrative-slide")}start(){try{if(!this.slideElement)return;this.animationApi.start(this.slideElement,!0)}catch(e){console.error(e)}}stop(){try{if(!this.slideElement)return;this.animationApi.stop(this.slideElement,!0)}catch(e){console.error(e)}}resume(){this.slideElement&&this.animationApi.resume(this.slideElement)}pause(){this.slideElement&&this.animationApi.pause(this.slideElement)}}const Qi=(e=>{var t={};return T.d(t,e),t})({Player:()=>h.Player});var Ki;!function(e){e.Playing="playing",e.Waiting="waiting",e.Error="error"}(Ki||(Ki={}));class Yi{constructor(e,t){Object.defineProperty(this,"videoContext",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"videoEl",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.parseDefaultMuted()}get $video(){return this.videoEl}get muted(){return this.videoEl.muted}get paused(){return this.videoEl.paused}async start(){this.videoEl.pause(),this.videoEl.currentTime=0,await this.play()}async play(){try{const e=this.videoEl.play();e?await e:await new Promise((e=>{setTimeout(e,0)}))}catch(e){throw e}}pause(){this.videoEl.pause()}async resume(){this.videoEl.paused&&await this.videoEl.play()}stop(){this.videoEl.pause(),this.videoEl.currentTime=0}mute(){"1"!==this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted=!0)}unmute(){"1"!==this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted=!1)}async load(e=!0){return new Promise((t=>{const r=this.videoEl.oncanplaythrough?"canplaythrough":"canplay";this.videoEl.addEventListener(r,(()=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{setTimeout((()=>t()),0)}))}))}),{once:!0}),e&&this.videoEl.load()}))}on(e,t){return this.videoEl.addEventListener(e,t),this}once(e,t){return this.videoEl.addEventListener(e,t,{once:!0}),this}off(e,t){return this.videoEl.removeEventListener(e,t),this}async destroy(){this.stop()}parseDefaultMuted(){null===this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted?this.videoEl.setAttribute("data-default-muted","1"):this.videoEl.setAttribute("data-default-muted","0"))}onPlaying(){}onWaiting(){}}class Ji{constructor(e){Object.defineProperty(this,"video",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timeupdate",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"playingCheckerTimerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.handleTimeUpdate=this.handleTimeUpdate.bind(this),this.video.$video.addEventListener("timeupdate",this.handleTimeUpdate)}destroy(){null!=this.playingCheckerTimerId&&window.clearTimeout(this.playingCheckerTimerId),this.video.$video.removeEventListener("timeupdate",this.handleTimeUpdate)}handleTimeUpdate(){this.timeupdate=Date.now(),null!=this.playingCheckerTimerId&&window.clearTimeout(this.playingCheckerTimerId),1!==this.state&&(this.state=1,this.triggerUpdate()),this.scheduleUpdate()}scheduleUpdate(){this.playingCheckerTimerId=window.setTimeout((()=>{Date.now()-this.timeupdate>=150&&(this.state=2,this.triggerUpdate())}),300)}triggerUpdate(){1===this.state?this.video.onPlaying():2===this.state&&this.video.onWaiting()}}class Zi extends Yi{constructor(e,t){super(e,t),Object.defineProperty(this,"videoContext",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"player",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_vodData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isPlaying",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isDataWaiting",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"attached",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"videoStateAdapter",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.handlePlayerError=this.handlePlayerError.bind(this),this._vodData=Zi.parseData(t)}get vodData(){return this._vodData}static get isBrowserSupported(){return Qi.Player.isBrowserSupported()}async load(){try{Zi.isBrowserSupported?(this.disableVideoPreload(),await this.initPlayer()):(this.updateVideoSources(),await super.load(),console.error("[VOD]: Browser not supported!"))}catch(e){throw this.stop(),this.detachVideoElement().catch(console.error),e}}async destroy(){this.player.removeEventListener("error",this.handlePlayerError),this.stop(),await this.detachVideoElement(),await this.player.destroy()}static parseData(e){const t=e.getAttribute("data-vod");try{return t&&JSON.parse(t)}catch(e){return null}}async stop(){var e;this.isPlaying=!1,null===(e=this.videoStateAdapter)||void 0===e||e.destroy(),super.stop()}async start(){this.isPlaying||(this.isPlaying=!0,this.videoStateAdapter=new Ji(this),await super.start())}async initPlayer(){this.player=new Qi.Player,this.player.addEventListener("error",this.handlePlayerError),await this.attachVideoElement(),await this.loadVideo()}disableVideoPreload(){this.videoEl.preload="none"}updateVideoSources(){this.videoEl.innerHTML="";for(const e of this.vodData.formats){const t=document.createElement("source");t.src=e.url,t.type=e.mimeType,t.width=e.width,t.height=e.height,this.videoEl.appendChild(t)}}handlePlayerError(e){const t=e.detail,r=`[VOD]: error code ${t.code}; object ${t}`;console.error(r),this.stop(),this.detachVideoElement().catch(console.error).finally((()=>{this.videoContext.emit(Ki.Error,t)}))}async attachVideoElement(){this.attached||(await this.player.attach(this.videoEl),this.attached=!0,ke("[VOD]: video element attached",this.videoEl))}async loadVideo(){const e=Qi.Player.convertJsonToUri(this.vodData);await this.player.load(e,0,"application/json"),ke(`[VOD]: video ${e} successful loaded`)}async detachVideoElement(){this.attached&&(await this.player.detach(this.videoEl),this.attached=!1,ke("[VOD]: video element detached",this.videoEl))}onPlaying(){this.isDataWaiting&&(this.isDataWaiting=!1,this.videoContext.emit(Ki.Playing))}onWaiting(){this.isDataWaiting=!0,this.videoContext.emit(Ki.Waiting)}}class Xi extends e.default{constructor(e,t){super(),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"videos",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.fillVideos(t)}async load(){for(const e of this.videos)await e.load()}async start(){for(const e of this.videos)await e.start()}pause(){for(const e of this.videos)e.pause()}async resume(){for(const e of this.videos)await e.play()}stop(){for(const e of this.videos)e.stop()}static hasVideo(e){return Boolean(e.querySelector(".narrative-slide__with-video"))}mute(){for(const e of this.videos)e.mute()}unmute(){for(const e of this.videos)e.unmute()}async destroy(){for(const e of this.videos)await e.destroy(),this.videos.splice(this.videos.indexOf(e),1);this.videos=[]}fillVideos(e){for(const t of Array.from(this.container.querySelectorAll("video"))){const r=this.createVideoByElement(t);e?r.mute():r.unmute(),this.videos.push(r)}}createVideoByElement(e){return Zi.parseData(e)?new Zi(this,e):new Yi(this,e)}}const ea=(e=>{var t={};return T.d(t,e),t})({getSlideApi:()=>p.getSlideApi});const ta=(e=>{var t={};return T.d(t,e),t})({Mutex:()=>g.Mutex}),ra=new ta.Mutex;class ia{constructor(e){Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_widgetFactories",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"_widgets",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.refreshUserData=this.refreshUserData.bind(this)}get widgets(){return this._widgets}async init(e){const t=await this.acquireSlideApi();try{this._widgets=[];for(const t of this._widgetFactories.values()){const r=t.create(e);r.length?this._widgets.push(...r):this._widgetFactories.delete(t)}await Promise.all(this._widgets.map((e=>e.init())))}catch(e){throw e}finally{t()}}registerFactory(e){this._widgetFactories.add(e)}registerManyFactories(e){this._widgetFactories.clear();for(const t of e)this._widgetFactories.add(t)}pause(){for(const e of this._widgets)e.pause()}resume(){for(const e of this._widgets)e.resume()}findAllOfType(e){return this.widgets.filter(e)}stop(){for(const e of this._widgets)e.destroy();this._widgets=[]}async handleWidgetClick(e,t){const r=await this.acquireSlideApi();for(const r of this.widgets)if(r.click({target:e,navigationController:t}),t.defaultPrevented)break;r()}refreshUserData(){for(const e of this._widgets)e.refreshUserData()}async acquireSlideApi(){const e=await ra.acquire();return(0,ea.getSlideApi)(this.slideApiHandlers),e}}class aa{pause(){}resume(){}destroy(){}refreshUserData(){}setUserData(e,t){}}class sa extends aa{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetCopy.init(this.element)}refreshUserData(){this.slideApi.WidgetCopy.onRefreshUserData(this.element)}click(e){this.element==e.target&&(this.slideApi.WidgetCopy.click(e.target),e.navigationController.preventDefault())}}class na{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-copy")).map((e=>new sa(e,this.slideApi)))}}class oa extends aa{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetDataInput.init(this.element)}refreshUserData(){this.slideApi.WidgetDataInput.onRefreshUserData(this.element)}click(e){this.element==e.target&&(this.slideApi.WidgetDataInput.click(e.target),e.navigationController.preventDefault())}setUserData(e,t=""){this.slideApi.WidgetDataInput.setUserData(e,t)}}class la{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-data-input")).map((e=>new oa(e,this.slideApi)))}}class da extends aa{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetDateCountdown.init(this.element,this.layers)}pause(){this.slideApi.WidgetDateCountdown.onPause(this.element)}resume(){this.slideApi.WidgetDateCountdown.onResume(this.element)}refreshUserData(){this.slideApi.WidgetDateCountdown.onRefreshUserData(this.element)}click(){}}class ca{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=Array.from(e.querySelectorAll(".narrative-element-date-countdown")),r=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));return t.map((e=>new da(e,r,this.slideApi)))}}class ua extends aa{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetPoll.init(this.element)}refreshUserData(){this.slideApi.WidgetPoll.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetPoll.select(e)}setUserData(e,t=""){this.slideApi.WidgetPoll.setUserData(e,t)}click(e){e.target.classList.contains("narrative-element-poll-button")&&(this.select(e.target),e.navigationController.preventDefault())}}class ha{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-poll")).map((e=>new ua(e,this.slideApi)))}}class pa extends aa{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetPollLayers.init(this.element,this.layers)}refreshUserData(){this.slideApi.WidgetPollLayers.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetPollLayers.select(e)}click(e){e.target.classList.contains("narrative-element-poll-button")&&(this.select(e.target),e.navigationController.preventDefault())}}class ga{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=Array.from(e.querySelectorAll(".narrative-element-poll-layers")),r=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));return t.map((e=>new pa(e,r,this.slideApi)))}}class fa extends aa{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){return this.slideApi.WidgetQuest.init(this.element)}refreshUserData(){this.slideApi.WidgetQuest.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetQuest.select(e)}click(e){e.target.classList.contains("narrative-element-test-answer")?this.handleTestAnswer(e):this.handleRouteClick(e)}handleTestAnswer(e){this.select(e.target),e.navigationController.preventDefault()}handleRouteClick(e){e.navigationController.navigationDisabled||(e.navigationController.preventDefault(),this.slideApi.WidgetQuest.handleRouteClick(this.element,{direction:e.navigationController.direction>0?"forward":"backward",slideIndex:this.story.activeSlideIndex,slideCount:this.story.slidesCount,click:()=>{e.navigationController.navigate()}}))}}class ma{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-quest");return t?[new fa(t,this.slideApi,this.story)]:[]}}class va extends aa{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetQuiz.init(this.element)}refreshUserData(){this.slideApi.WidgetQuiz.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetQuiz.select(e)}slideQuizIsDone(e){return this.slideApi.WidgetQuiz.slideQuizIsDone(e)}click(e){e.target.classList.contains("narrative-element-quiz-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-quiz-answer")?this.handleAnswer(e):this.handleQuizIsDone(e)}handleQuizIsDone(e){this.slideQuizIsDone(this.element)||e.navigationController.disableNextClick()}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}}class ba{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-quiz");return t?[new va(t,this.slideApi,this.story)]:[]}}class ya extends aa{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetQuizGrouped.init(this.element)}refreshUserData(){this.slideApi.WidgetQuizGrouped.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetQuizGrouped.select(e)}slideQuizIsDone(e){return this.slideApi.WidgetQuizGrouped.slideQuizIsDone(e)}click(e){e.target.classList.contains("narrative-element-quiz-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-quiz-answer")?this.handleAnswer(e):this.handleQuizIsDone(e)}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleQuizIsDone(e){this.slideQuizIsDone(this.element)||e.navigationController.disableNextClick()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}}class wa{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-quiz-grouped");return t?[new ya(t,this.slideApi,this.story)]:[]}}class Sa extends aa{constructor(e,t,r,i){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:i}),this.disableSwipeGesture=this.disableSwipeGesture.bind(this),this.enableSwipeGesture=this.enableSwipeGesture.bind(this)}async init(){this.slideApi.WidgetRangeSlider.init(this.element),this.registerMouseAndTouchEvents()}refreshUserData(){this.slideApi.WidgetRangeSlider.onRefreshUserData(this.element)}click(e){e.target.classList.contains("rangeslider")?this.handleClickSlider(e):e.target.classList.contains("narrative-element-range-slider-next-button")?this.handleClickSliderNextButton(e):this.handleCaptureClick(e)}isClickCapturedBySlider(e){return this.slideApi.WidgetRangeSlider.isClickCapturedBySlider(e)}destroy(){this.unregisterMouseAndTouchEvents()}handleClickSlider(e){e.navigationController.preventDefault()}handleCaptureClick(e){this.isClickCapturedBySlider(this.element)&&e.navigationController.preventDefault()}handleClickSliderNextButton(e){this.slideApi.WidgetRangeSlider.click(e.target),e.navigationController.preventDefault()}disableSwipeGesture(e){this.touchController.disable()}enableSwipeGesture(e){this.touchController.enable()}registerMouseAndTouchEvents(){this.slideContent.addEventListener("mouseup",this.enableSwipeGesture),this.slideContent.addEventListener("touchend",this.enableSwipeGesture),this.slideContent.addEventListener("mousedown",this.disableSwipeGesture),this.slideContent.addEventListener("touchstart",this.disableSwipeGesture)}unregisterMouseAndTouchEvents(){var e,t,r,i;null===(e=this.slideContent)||void 0===e||e.removeEventListener("mouseup",this.enableSwipeGesture),null===(t=this.slideContent)||void 0===t||t.removeEventListener("touchend",this.enableSwipeGesture),null===(r=this.slideContent)||void 0===r||r.removeEventListener("mousedown",this.disableSwipeGesture),null===(i=this.slideContent)||void 0===i||i.removeEventListener("touchstart",this.disableSwipeGesture)}}class _a{constructor(e,t){Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-range-slider");return t?[new Sa(t,this.slideApi,this.touchController,e)]:[]}}class Oa extends aa{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetRate.init(this.element)}click(e){e.target.classList.contains("narrative-element-rate-input")&&(this.select(e.target),e.navigationController.preventDefault())}refreshUserData(){this.slideApi.WidgetRate.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetRate.select(e)}setUserData(e,t=""){this.slideApi.WidgetRate.setUserData(e,t)}}class Ca{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-rate")).map((e=>new Oa(e,this.slideApi)))}}class xa extends aa{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),this.handleShareComplete=this.handleShareComplete.bind(this),this.registerEvents()}async init(){this.slideApi.WidgetShare.init(this.element,Array.from(this.layers))}complete(e,t){this.slideApi.WidgetShare.complete(e,t)}refreshUserData(){this.slideApi.WidgetShare.onRefreshUserData(this.element)}click(e){this.element==e.target&&(this.slideApi.WidgetShare.click(e.target),e.navigationController.preventDefault())}destroy(){this.unregisterEvents()}registerEvents(){fi.on(`${xa.name}.shareComplete`,this.handleShareComplete)}unregisterEvents(){fi.off(`${xa.name}.shareComplete`,this.handleShareComplete)}handleShareComplete({shareId:e,result:t}){ke(`[Share Widget]: share complete, { shareId, result }: ${e}, ${t}}`),this.complete(e,t)}}class ka{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=Array.from(e.querySelectorAll(".narrative-element-share")),r=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));return t.map((e=>new xa(e,r,this.slideApi)))}}class Pa extends aa{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetTest.init(this.element)}refreshUserData(){this.slideApi.WidgetTest.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetTest.select(e)}slideTestIsDone(e){return this.slideApi.WidgetTest.slideTestIsDone(e)}slideTestWithTimer(e){return this.slideApi.WidgetTest.slideTestWithTimer(e)}click(e){e.target.classList.contains("narrative-element-test-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-test-answer")?this.handleAnswer(e):this.handleTestIsDone(e)}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}handleTestIsDone(e){const t=this.slideTestIsDone(this.element);!this.slideTestWithTimer(this.element)||t?t||e.navigationController.disableNextClick():e.navigationController.preventDefault()}}class ja{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-test");return t?[new Pa(t,this.slideApi,this.story)]:[]}}class Ma extends aa{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetVote.init(this.element);const e="narrative-element-quiz-next-button",t=this.element.querySelector(`.${e}`);t&&t.classList.remove(e)}refreshUserData(){this.slideApi.WidgetVote.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetVote.select(e)}click(e){if(e.target.classList.contains("narrative-element-vote-next-button")){if(!this.slideApi.WidgetVote.click(e.target))return void e.navigationController.preventDefault()}e.target.classList.contains("narrative-element-vote-answer")&&(this.slideApi.WidgetVote.select(e.target),e.navigationController.preventDefault())}}class Ea{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-vote")).map((e=>new Ma(e,this.slideApi)))}}class Ia extends aa{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetBarcode.init(this.element)}refreshUserData(){this.slideApi.WidgetBarcode.onRefreshUserData(this.element)}click(e){this.element==e.target&&(this.slideApi.WidgetBarcode.click(e.target),e.navigationController.preventDefault())}}class La{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-barcode")).map((e=>new Ia(e,this.slideApi)))}}class Ta extends aa{constructor(e,t){super(),Object.defineProperty(this,"elements",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetMultiSlide.init(this.elements)}click(){}destroy(){}}class Aa{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));return t.length?[new Ta(t,this.slideApi)]:[]}}var Ra;!function(e){e.TouchStart="touchStart",e.TouchMove="touchMove",e.TouchEnd="touchEnd",e.TouchMoveHorizontal="touchMoveHorizontal",e.TouchMoveVertical="touchMoveVertical",e.LongTouchDetected="longTouchDetected"}(Ra||(Ra={}));class Da{constructor(e,t){Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t})}}class Ba{constructor(e,t,r,i){Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"dx",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"dy",{enumerable:!0,configurable:!0,writable:!0,value:i})}}class Fa extends e.default{constructor(e){super(),Object.defineProperty(this,"$el",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"startPoint",{enumerable:!0,configurable:!0,writable:!0,value:new Da(0,0)}),Object.defineProperty(this,"touchStartTimerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_isSwiping",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"touched",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_horizontalSwipeGesture",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_verticalSwipeGesture",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isLongTouch",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:{threshold:10,touchStartTimeout:-1}}),e&&(this.options=(0,vr.default)(this.options,e)),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}get isSwiping(){return this._isSwiping}get horizontalSwipeGesture(){return this._horizontalSwipeGesture}get verticalSwipeGesture(){return this._verticalSwipeGesture}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){this.$el&&(this.reset(),this.clearTouchStartTimeout(),this.$el.removeEventListener("touchstart",this.handleTouchStart),this.$el.removeEventListener("touchmove",this.handleTouchMove),this.$el.removeEventListener("touchend",this.handleTouchEnd),this.$el=null)}init(e){this.$el||(this.$el=e,this.$el.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),this.$el.addEventListener("touchmove",this.handleTouchMove,{passive:!0}),this.$el.addEventListener("touchend",this.handleTouchEnd))}handleTouchStart(e){e.stopPropagation(),this.enabled&&!this.touched&&(this.touched=!0,this.clearTouchStartTimeout(),this.startPoint=this.getPointByEvent(e),this.emit(Ra.TouchStart,new Ba(this.startPoint.x,this.startPoint.y,0,0)),this.startTouchStartTimer(this.startPoint))}handleTouchMove(e){if(!this.touched)return;const t=this.getPointByEvent(e),r=this.getDeltaPoint(t),i=new Ba(t.x,t.y,r.x,r.y);this.isThresholdExceed(r)&&(this._isSwiping=!0),this._isSwiping&&(this.emit(Ra.TouchMove,i),this.determineSwipeGestureDirection(r),this.handleHorizontalSwipeGesture(i),this.handleVerticalSwipeGesture(i))}isThresholdExceed(e){return Math.abs(e.x)>this.options.threshold||Math.abs(e.y)>this.options.threshold}handleTouchEnd(e){if(!this.touched)return;this._isLongTouch&&e.preventDefault(),e.stopPropagation(),this.clearTouchStartTimeout();const t=this.getPointByEvent(e),r=this.getDeltaPoint(t);this.emit(Ra.TouchEnd,new Ba(t.x,t.y,r.x,r.y)),this.reset()}clearTouchStartTimeout(){this.touchStartTimerId&&(clearTimeout(this.touchStartTimerId),this.touchStartTimerId=null)}startTouchStartTimer(e){null!=this.options.touchStartTimeout&&-1!==this.options.touchStartTimeout&&(this.touchStartTimerId=setTimeout((()=>{this._isLongTouch=!0,this.emit(Ra.LongTouchDetected,e)}),this.options.touchStartTimeout))}getPointByEvent(e){if(e instanceof TouchEvent){const t=e.changedTouches[0];return new Da(t.pageX,t.pageY)}return new Da(e.pageX,e.pageY)}getDeltaPoint(e){const t=e.x-this.startPoint.x,r=e.y-this.startPoint.y;return new Da(t,r)}determineSwipeGestureDirection(e){Math.abs(e.x)>Math.abs(e.y)?this._verticalSwipeGesture||(this._horizontalSwipeGesture=!0):this._horizontalSwipeGesture||(this._verticalSwipeGesture=!0)}handleVerticalSwipeGesture(e){this._verticalSwipeGesture&&this.emit(Ra.TouchMoveVertical,e)}handleHorizontalSwipeGesture(e){this._horizontalSwipeGesture&&this.emit(Ra.TouchMoveHorizontal,e)}reset(){this._isSwiping=!1,this.touched=!1,this._isLongTouch=!1,this._horizontalSwipeGesture=!1,this._verticalSwipeGesture=!1}}class Na{constructor(e){let t;Object.defineProperty(this,"timeout_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getMountPoint",{enumerable:!0,configurable:!0,writable:!0,value:()=>document.body}),this.timeout_id=null,this.duration=3e3,this.content="",this.position="bottom",e&&"object"==typeof e&&(e.duration&&(this.duration="string"==typeof e.duration?parseFloat(e.duration):e.duration),e.content&&(this.content=e.content),e.getMountPoint&&(this.getMountPoint=e.getMountPoint),e.position&&(t=e.position.toLowerCase(),this.position="top"===t||"bottom"===t?t:"bottom"),this.show())}show(){var e;if(!this.content)return!1;this.timeout_id&&clearTimeout(this.timeout_id);const t=document.getElementById("toast_container");t&&(null===(e=t.parentNode)||void 0===e||e.removeChild(t));const r=document.createElement("div");r.setAttribute("id","toast_container"),r.setAttribute("class","toast_fadein");const i=document.createElement("div");i.setAttribute("id","toast"),r.appendChild(i);const a=document.createElement("span");return a.innerHTML=this.content,i.appendChild(a),this.getMountPoint().appendChild(r),this.timeout_id=window.setTimeout(this.hide,this.duration),!0}hide(){const e=document.getElementById("toast_container");if(!e)return!1;function t(){var e;const t=document.getElementById("toast_container");if(!t)return!1;null===(e=t.parentNode)||void 0===e||e.removeChild(t)}return this.timeout_id&&clearTimeout(this.timeout_id),e.className+=" toast_fadeout",e.addEventListener("webkitAnimationEnd",t),e.addEventListener("animationEnd",t),e.addEventListener("msAnimationEnd",t),e.addEventListener("oAnimationEnd",t),!0}}const Ua=(e=>{var t={};return T.d(t,e),t})({default:()=>f.default});class Wa{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"debouncedTryEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:(0,Ua.default)((()=>{this.slider.notifyScrollEnd()}),200)}),this.handleScroll=this.handleScroll.bind(this),this.init(),this.addEventListeners()}destroy(){this.slider.getElementRef().removeEventListener("scroll",this.handleScroll)}init(){const e=this.slider.getElementRef();e.style.overflowX=this.slider.isHorizontal()?"scroll":"hidden",e.style.overflowY=this.slider.isHorizontal()?"hidden":"scroll"}addEventListeners(){this.slider.getElementRef().addEventListener("scroll",this.handleScroll)}scrollTo(e){const t=this.slider.getElementRef(),r=this.slider.dir===ne.LTR?1:-1;t.scrollLeft=r*e.x,t.scrollTop=e.y}scrollWithAnimation(e,t){const r=this.slider.getElementRef(),i=this.slider.dir===ne.LTR?1:-1;r.scrollTo({left:i*e.x,top:e.y,behavior:"smooth"})}stopAnimation(){}handleScroll(){this.slider.notifyScrollStart();const e=this.slider.getElementRef();this.slider.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.slider.testAttraction(e.scrollLeft,e.scrollTop),this.slider.emit("scroll",this.slider.getCurrentPosition()),this.debouncedTryEndScroll()}}class za{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lastClientX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastClientY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pushed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isAnimating",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debouncedTryAnimationEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:(0,Ua.default)((()=>{this.isAnimating=!1,this.slider.notifyScrollEnd()}),200)}),Object.defineProperty(this,"debouncedTryMouseWheelEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:(0,Ua.default)((()=>{this.slider.notifyScrollEnd()}),200)}),this.handleScroll=this.handleScroll.bind(this),this.init(),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.addEventListeners()}init(){const e=this.slider.getElementRef();e.style.overflowX=this.slider.isHorizontal()?"scroll":"hidden",e.style.overflowY=this.slider.isHorizontal()?"hidden":"scroll"}addEventListeners(){const e=this.slider.getElementRef();e.addEventListener("scroll",this.handleScroll),e.addEventListener("mousedown",this.handleMouseDown,De),e.addEventListener("touchstart",this.handleMouseDown,De)}scrollTo(e){const t=this.slider.getElementRef(),r=this.slider.dir===ne.LTR?1:-1;t.scrollLeft=r*e.x,t.scrollTop=e.y,this.slider.updatePosition(Math.abs(t.scrollLeft),Math.abs(t.scrollTop)),this.slider.testAttraction(t.scrollLeft,t.scrollTop),this.slider.emit("scroll",this.slider.getCurrentPosition())}scrollWithAnimation(e,t){this.isAnimating=!0;const r=this.slider.getElementRef(),i=this.slider.dir===ne.LTR?1:-1;r.scrollTo({left:i*e.x,top:e.y,behavior:"smooth"})}stopAnimation(){}destroy(){const e=this.slider.getElementRef();e.removeEventListener("mousedown",this.handleMouseDown,De),e.removeEventListener("touchstart",this.handleMouseDown,De),e.removeEventListener("mouseup",this.handleMouseUp,De),e.removeEventListener("touchend",this.handleMouseUp,De),e.removeEventListener("mousemove",this.handleMouseMove,De),e.removeEventListener("touchmove",this.handleMouseMove,De),e.removeEventListener("scroll",this.handleScroll)}handleMouseDown(e){this.pushed=!0,this.isDragging=!1;const{clientX:t,clientY:r}=this.extractPointerPosition(e);this.lastClientX=t,this.lastClientY=r,window.addEventListener("mouseup",this.handleMouseUp,De),window.addEventListener("touchend",this.handleMouseUp,De),window.addEventListener("mousemove",this.handleMouseMove,De),window.addEventListener("touchmove",this.handleMouseMove,De)}handleMouseUp(){this.pushed&&(this.pushed=!1,this.isDragging=!1,this.slider.notifyScrollEnd(),window.removeEventListener("mouseup",this.handleMouseUp,De),window.removeEventListener("touchend",this.handleMouseUp,De),window.removeEventListener("mousemove",this.handleMouseMove,De),window.removeEventListener("touchmove",this.handleMouseMove,De))}handleMouseMove(e){if(!this.pushed)return;const{clientX:t,clientY:r}=this.extractPointerPosition(e),i=t-this.lastClientX,a=r-this.lastClientY;this.lastClientX=t,this.lastClientY=r;const{x:s,y:n}=this.slider.preparePosition(this.slider.getCurrentPosition().x-i,this.slider.getCurrentPosition().y-a);!this.isDragging&&(Math.abs(i)>=1||Math.abs(a)>=1)&&(this.isDragging=!0),this.isDragging&&this.scrollTo({x:s,y:n})}extractPointerPosition(e){return e instanceof MouseEvent?{clientX:e.clientX,clientY:e.clientY}:{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}handleScroll(){this.isDragging?this.handleScrollByDraggable():this.isAnimating?this.handleScrollByAnimation():this.handleScrollByMouseWheel()}handleScrollByMouseWheel(){this.slider.notifyScrollStart();const e=this.slider.getElementRef();this.slider.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.slider.testAttraction(e.scrollLeft,e.scrollTop),this.slider.emit("scroll",this.slider.getCurrentPosition()),this.debouncedTryMouseWheelEndScroll()}handleScrollByDraggable(){this.slider.notifyScrollStart()}handleScrollByAnimation(){if(!this.isAnimating)return;this.slider.notifyScrollStart();const e=this.slider.getElementRef();this.slider.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.slider.testAttraction(e.scrollLeft,e.scrollTop),this.slider.emit("scroll",this.slider.getCurrentPosition()),this.debouncedTryAnimationEndScroll()}}var Va;!function(e){e.Horizontal="horizontal",e.Vertical="vertical"}(Va||(Va={}));class Ga extends e.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"scrollStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isScrolling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPosition",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"direction",{enumerable:!0,configurable:!0,writable:!0,value:Va.Horizontal}),Object.defineProperty(this,"gap",{enumerable:!0,configurable:!0,writable:!0,value:20}),Object.defineProperty(this,"_reachStart",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_reachEnd",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_dir",{enumerable:!0,configurable:!0,writable:!0,value:ne.LTR})}get isScrolling(){return this._isScrolling}get slides(){return this.slider.children[0]instanceof HTMLSlotElement?this.slider.children[0].assignedElements({flatten:!1}):Array.from(this.slider.children)}get elementRef(){return this.slider}get reachStart(){return this._reachStart}get reachEnd(){return this._reachEnd}get scrollWidth(){return this.slider.scrollWidth}get dir(){return this._dir}mount(e){this.slider=e,this.changeScrollStrategy()}destroy(){this.removeAllListeners(),this.scrollStrategy.destroy()}getLength(){var e,t;return null!==(t=null===(e=this.slider)||void 0===e?void 0:e.children.length)&&void 0!==t?t:0}changeDirection(e){this.direction=e,this.scrollTo(0,0),this.changeScrollStrategy()}setGap(e){this.gap=e}setDesktopMode(e){this.desktopMode=e,this.changeScrollStrategy()}getGap(){return this.gap}scrollTo(e,t=300){e=Math.trunc(e);const r=this.preparePosition(e,e);this.isTheSamePosition(r.x,r.y)||(t>0?this.scrollStrategy.scrollWithAnimation(r,t):this.scrollStrategy.scrollTo(r))}isHorizontal(){return this.direction===Va.Horizontal}updatePosition(e,t){this.currentPosition={x:Math.trunc(e),y:Math.trunc(t)}}getElementRef(){return this.slider}getCurrentPosition(){return this.currentPosition}preparePosition(e,t){let r={x:e,y:t};return this.isHorizontal()?r.y=0:r.x=0,this.attractToBounds(r.x,r.y)}attractToBounds(e,t){return{x:this.attractToBoundsByX(e),y:this.attractToBoundsByY(t)}}attractToBoundsByX(e){return e<=0?0:e+this.slider.clientWidth>=this.slider.scrollWidth?this.slider.scrollWidth-this.slider.clientWidth:e}attractToBoundsByY(e){return e<=0?0:e+this.slider.clientHeight>=this.slider.scrollHeight?this.slider.scrollHeight-this.slider.clientHeight:e}testAttraction(e,t){const r=e+this.slider.clientWidth>=Math.max(this.slider.scrollWidth-1,0),i=t+this.slider.clientHeight>=Math.max(this.slider.scrollHeight-1,0);this._reachStart=e<=0&&t<=0,this._reachEnd=this.isHorizontal()?r:i,this.emit("reachStart",this._reachStart),this.emit("reachEnd",this._reachEnd)}setTextDirection(e){this._dir=e}scrollBySlideIndex(e,t){this.isHorizontal()?this.scrollTo(this.slides[e].offsetLeft,t):this.scrollTo(this.slides[e].offsetTop,t)}scrollByDirection(e,t){const{x:r,y:i}=this.getCurrentPosition(),a=this.isHorizontal()?r:i,s=this.getSlidesPerView(),n=this.getStoryWidth(),o=this.getStoryHeight(),l=a+e*s*(this.isHorizontal()?n:o);this.scrollTo(l,t)}notifyScrollStart(){this.isScrolling||(this._isScrolling=!0,this.emit("scrollstart",this.currentPosition))}notifyScrollEnd(){this.isScrolling&&(this._isScrolling=!1,this.emit("scrollend",this.currentPosition))}async waitStoryListClientWidth(){const e=t=>{this.elementRef.clientWidth>0?t():requestAnimationFrame((()=>e(t)))};return new Promise((t=>{requestAnimationFrame((()=>e(t)))}))}isTheSamePosition(e,t){return e===this.currentPosition.x&&t===this.currentPosition.y}getSlidesPerView(){if(this.isHorizontal()&&this.slider.clientWidth){const e=this.slider.children[0].clientWidth+this.gap;return Math.round(this.slider.clientWidth/e)}if(!this.isHorizontal()&&this.slider.clientHeight){const e=this.slider.children[0].clientHeight+this.gap;return Math.round(this.slider.clientHeight/e)}return 1}getStoryWidth(){var e;return(null===(e=this.slides[0])||void 0===e?void 0:e.clientWidth)+this.gap}getStoryHeight(){var e;return(null===(e=this.slides[0])||void 0===e?void 0:e.clientHeight)+this.gap}changeScrollStrategy(){this.scrollStrategy&&this.scrollStrategy.destroy(),this.scrollStrategy=this.desktopMode?new za(this):new Wa(this)}}const $a=45,Ha=350,qa="linear",Qa=1.6,Ka=2*Math.tan($a*Math.PI/360),Ya=Ha/1e3;class Ja{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"newAngle",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"angleDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"normalizedShift",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"movementStartAt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_currentAngle",{enumerable:!0,configurable:!0,writable:!0,value:0})}get currentAngle(){return this._currentAngle}get perspective(){return 0}get depth(){return 0}startMove(){this.newAngle=0,this.angleDelta=0,this.normalizedShift=0,this.movementStartAt=Date.now()}move(e){this.normalizedShift=e/this.slider.clientWidth*Qa,this.newAngle=this._currentAngle+this.normalizedShift*$a,this.angleDelta=this.newAngle-this._currentAngle}endMove(){if(!this.normalizedShift)return;let e=Math.round(this.angleDelta/$a);e=this.limitByFastMovement(e),e=this.limitBySliderEdges(e),this.slider.emit("touchEnd",e)}limitByFastMovement(e){return this.isFastMovement(e)?this.normalizedShift<0?-1:1:e}isFastMovement(e){return Date.now()-this.movementStartAt<=500&&0===e}limitBySliderEdges(e){return e<0&&this.slider.isBeginning||e>0&&this.slider.isEnd?0:e}}const Za=.05;class Xa extends Ja{init(){this._currentAngle=this.slider.currentIndex*$a}transform(e){const t=this.slider.leftElement,r=this.slider.rightElement,i=this.slider.frontElement;null==t||t.style.setProperty("transform",`translateZ(0) translateX(${-100*(.1- -1*e/10)}%) scale(${Math.min(.9+-1*e/10,1)})`),null==r||r.style.setProperty("transform",`translateZ(0) translateX(${100*(1-e)}%)`),null==i||i.style.setProperty("transform",`translateZ(0) translateX(${e<=0?-100*e:-100*(0- -1*e/10)}%) scale(${e<=0?1:1+-1*e/10})`)}move(e){super.move(e),this.normalizedShift=this.applyBoundsConstraint(this.normalizedShift),this.transform(this.normalizedShift)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"inherit",transform:`translateZ(0) translateX(${0===e?-10:-100*t+100*e}%) scale(${0===e?.9:1})`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=Za&&this.slider.isEnd?Za:e<=-.05&&this.slider.isBeginning?-.05:e:e}}const es=.05;class ts extends Ja{init(){this._currentAngle=this.slider.currentIndex*$a}transform(e){const t=this.slider.leftElement,r=this.slider.rightElement,i=this.slider.frontElement;null==t||t.style.setProperty("transform",`translateZ(0) translateX(${-100*(1+e)}%)`),null==r||r.style.setProperty("transform",`translateZ(0) translateX(${100*(1-e)}%)`),null==i||i.style.setProperty("transform",`translateZ(0) translateX(${-100*e}%)`)}move(e){super.move(e),this.normalizedShift=this.applyBoundsConstraint(this.normalizedShift),this.transform(this.normalizedShift)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"inherit",transform:`translateZ(0) translateX(${-100*t+100*e}%)`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=es&&this.slider.isEnd?es:e<=-.05&&this.slider.isBeginning?-.05:e:e}}class rs extends Ja{get perspective(){return this.slider.clientWidth*Qa}get depth(){return this.slider.clientWidth/Ka}init(){this.transform(this.slider.currentIndex)}async transform(e){this._currentAngle=this._currentAngle+e*$a,this.slider.setTransform(`rotateY(${-this._currentAngle}deg)`)}move(e){super.move(e),this.newAngle=this.applyBoundsConstraint(this.angleDelta),this.slider.setTransform(`rotateY(${-this.newAngle}deg)`)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"",transform:"rotateY("+e*$a+`deg) translateZ(${this.depth}px)`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=5&&this.slider.isEnd?this._currentAngle+5:e<=-5&&this.slider.isBeginning?this._currentAngle-5:this.newAngle:this.newAngle}}class is{static create(e,t){switch(t){case J.FLAT:return new ts(e);case J.COVER:return new Xa(e);case J.CUBE:return new rs(e);default:return new ts(e)}}}var as=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},ss=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},ns=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},os=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let ls=(()=>{var t,r,i,a;let s,n,o,l,d,c,u,h,p,g,f,m,v,b,y,w,S,_=e.EventEmitter,O=[],C=[],x=[],k=[],P=[],j=[],M=[];return t=class extends _{constructor(){super(...arguments),r.set(this,(as(this,O),as(this,C,!1))),i.set(this,(as(this,x),as(this,k,0))),a.set(this,(as(this,P),as(this,j,null))),Object.defineProperty(this,"$el",{enumerable:!0,configurable:!0,writable:!0,value:as(this,M)})}get _animating(){return ns(this,r,"f")}set _animating(e){os(this,r,e,"f")}get _currentIndex(){return ns(this,i,"f")}set _currentIndex(e){os(this,i,e,"f")}get effect(){return ns(this,a,"f")}set effect(e){os(this,a,e,"f")}get clientWidth(){return this.$el.clientWidth}get animating(){return this._animating}get leftElement(){return this.$el.children.item(this._currentIndex-1)}get rightElement(){return this.$el.children.item(this._currentIndex+1)}get frontElement(){return this.$el.children.item(this._currentIndex)}get isBeginning(){return this._currentIndex-1==0}get isEnd(){return this._currentIndex+1===this.$el.children.length-1}get perspective(){var e,t;return null!==(t=null===(e=this.effect)||void 0===e?void 0:e.perspective)&&void 0!==t?t:0}get depth(){var e,t;return null!==(t=null===(e=this.effect)||void 0===e?void 0:e.depth)&&void 0!==t?t:0}get currentIndex(){return this._currentIndex}set currentIndex(e){this._currentIndex=e}getCSSStyle(e,t){var r,i;return null!==(i=null===(r=this.effect)||void 0===r?void 0:r.getCSSStyle(e,t))&&void 0!==i?i:{}}init({$el:e,transformStyle:t}){this.$el=e,this.effect=is.create(this,t),this.effect.init(),this.setTransition("transform 0s"),this.updateSlidesStyle(0)}async transformWithAmimation(e){this.emit("transitionStart"),this._animating=!0,this.setTransition(`transform ${Ya}s ${qa}`),this.effect.transform(e),await this.waitTransitionEnd(),this.updateSlidesStyle(e),this._animating=!1,this.emit("transitionEnd")}startMove(){this.effect.startMove()}move(e){this._animating=!0,this.emit("touchMove"),this.effect.move(e)}endMove(){this._animating=!1,this.effect.endMove()}setTransform(e){this.$el.style.setProperty("transform",e)}updateSlidesStyle(e){const t=Array.from(this.$el.children);for(let r=0;r<t.length;r++){const i=t[r],a=this.effect.getCSSStyle(r,this.currentIndex+e);i.style.display=a.display,i.style.transform=a.transform,i.style.transition=a.transition}}setTransition(e){this.$el.style.setProperty("transition",e)}waitTransitionEnd(){return new Promise((e=>{const t=r=>{Math.round(100*r.elapsedTime)/100===Ya&&"transform"===r.propertyName&&(this.setTransition("transform 0s"),this.$el.removeEventListener("transitionend",t),e())};this.$el.addEventListener("transitionend",t)}))}},r=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{var e;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=_[Symbol.metadata])&&void 0!==e?e:null):void 0;s=[Pe.observable],n=[Pe.observable],o=[Pe.observable],l=[Pe.computed],d=[Pe.computed],c=[Pe.computed],u=[Pe.computed],h=[Pe.computed],p=[Pe.computed],g=[Pe.computed],f=[Pe.computed],m=[Pe.computed],v=[Pe.action],b=[Pe.action],y=[Pe.action],w=[Pe.action],S=[Pe.action],ss(t,null,s,{kind:"accessor",name:"_animating",static:!1,private:!1,access:{has:e=>"_animating"in e,get:e=>e._animating,set:(e,t)=>{e._animating=t}},metadata:r},C,x),ss(t,null,n,{kind:"accessor",name:"_currentIndex",static:!1,private:!1,access:{has:e=>"_currentIndex"in e,get:e=>e._currentIndex,set:(e,t)=>{e._currentIndex=t}},metadata:r},k,P),ss(t,null,o,{kind:"accessor",name:"effect",static:!1,private:!1,access:{has:e=>"effect"in e,get:e=>e.effect,set:(e,t)=>{e.effect=t}},metadata:r},j,M),ss(t,null,l,{kind:"getter",name:"animating",static:!1,private:!1,access:{has:e=>"animating"in e,get:e=>e.animating},metadata:r},null,O),ss(t,null,d,{kind:"getter",name:"leftElement",static:!1,private:!1,access:{has:e=>"leftElement"in e,get:e=>e.leftElement},metadata:r},null,O),ss(t,null,c,{kind:"getter",name:"rightElement",static:!1,private:!1,access:{has:e=>"rightElement"in e,get:e=>e.rightElement},metadata:r},null,O),ss(t,null,u,{kind:"getter",name:"frontElement",static:!1,private:!1,access:{has:e=>"frontElement"in e,get:e=>e.frontElement},metadata:r},null,O),ss(t,null,h,{kind:"getter",name:"isBeginning",static:!1,private:!1,access:{has:e=>"isBeginning"in e,get:e=>e.isBeginning},metadata:r},null,O),ss(t,null,p,{kind:"getter",name:"isEnd",static:!1,private:!1,access:{has:e=>"isEnd"in e,get:e=>e.isEnd},metadata:r},null,O),ss(t,null,g,{kind:"getter",name:"perspective",static:!1,private:!1,access:{has:e=>"perspective"in e,get:e=>e.perspective},metadata:r},null,O),ss(t,null,f,{kind:"getter",name:"depth",static:!1,private:!1,access:{has:e=>"depth"in e,get:e=>e.depth},metadata:r},null,O),ss(t,null,m,{kind:"getter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,get:e=>e.currentIndex},metadata:r},null,O),ss(t,null,v,{kind:"setter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,set:(e,t)=>{e.currentIndex=t}},metadata:r},null,O),ss(t,null,b,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:r},null,O),ss(t,null,y,{kind:"method",name:"transformWithAmimation",static:!1,private:!1,access:{has:e=>"transformWithAmimation"in e,get:e=>e.transformWithAmimation},metadata:r},null,O),ss(t,null,w,{kind:"method",name:"move",static:!1,private:!1,access:{has:e=>"move"in e,get:e=>e.move},metadata:r},null,O),ss(t,null,S,{kind:"method",name:"endMove",static:!1,private:!1,access:{has:e=>"endMove"in e,get:e=>e.endMove},metadata:r},null,O),r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),t})();var ds;!function(e){e.Open="open"}(ds||(ds={}));class cs extends aa{constructor(t,r,i,a,s){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"swipeUpGoodsWidgetHandlers",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_swipeUpLinkTarget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_swipeUpElementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"eventEmitter",{enumerable:!0,configurable:!0,writable:!0,value:new e.EventEmitter}),this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this),this.handleClick=this.handleClick.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}get targetUrl(){var e;return decodeURIComponent(null!==(e=this._swipeUpLinkTarget)&&void 0!==e?e:"")}get elementId(){return this._swipeUpElementId}async init(){var e,t;this._swipeUpLinkTarget=decodeURIComponent(null!==(e=this.element.getAttribute("data-link-target"))&&void 0!==e?e:""),this._swipeUpElementId=null!==(t=this.element.getAttribute("data-element-id"))&&void 0!==t?t:void 0,this.registerEvents()}click(e){}destroy(){this.unregisterEvents()}close(){var e;null===(e=this.touchController)||void 0===e||e.enable(),this.swipeUpGoodsWidgetHandlers.onClose(),this.setGoodsElementOpacity(1)}on(e,t){this.eventEmitter.on(e,t)}off(e,t){this.eventEmitter.off(e,t)}registerEvents(){var e;this.touchController.on(Ra.TouchEnd,this.handleTouchEnd),null===(e=this.element)||void 0===e||e.addEventListener("click",this.handleClick)}unregisterEvents(){var e;this.touchController.off(Ra.TouchEnd,this.handleTouchEnd),null===(e=this.element)||void 0===e||e.removeEventListener("click",this.handleClick)}handleClick(e){e.preventDefault(),e.stopPropagation(),this.open()}handleSwipeUpGesture(){this.open()}handleTouchEnd({dy:e}){this.touchController&&e<10&&this.touchController.verticalSwipeGesture&&this.handleSwipeUpGesture()}open(){var e;this._swipeUpLinkTarget&&this.slideContent&&this._swipeUpElementId&&(null===(e=this.touchController)||void 0===e||e.disable(),this.swipeUpGoodsWidgetHandlers.onOpen(),this.eventEmitter.emit(ds.Open),this.setGoodsElementOpacity(0))}setGoodsElementOpacity(e){var t;const r=null===(t=this.slideContent)||void 0===t?void 0:t.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);r&&r.style.setProperty("display",e>0?"block":"none")}}class us{constructor(e,t,r){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"swipeUpGoodsWidgetHandlers",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e){const t=e.querySelector(".narrative-element-swipe-up-items");return t?[new cs(t,this.slideApi,this.touchController,this.swipeUpGoodsWidgetHandlers,e)]:[]}}class hs extends aa{constructor(e,t,r,i,a){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"linkClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_swipeUpLinkTarget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_swipeUpElementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}get swipeUpLinkTarget(){return this._swipeUpLinkTarget}get swipeUpElementId(){return this._swipeUpElementId}async init(){var e,t,r;this._swipeUpLinkTarget=decodeURIComponent(null!==(e=this.element.getAttribute("data-link-target"))&&void 0!==e?e:""),this._swipeUpElementId=null!==(t=this.element.getAttribute("data-element-id"))&&void 0!==t?t:void 0,null===(r=this.touchController)||void 0===r||r.on(Ra.TouchEnd,this.handleTouchEnd)}click(e){e.target.classList.contains("narrative-element-swipe-up")&&(e.navigationController.preventDefault(),this.linkClickHandler.onLinkClick({widget:this,target:e.target}))}destroy(){var e;null===(e=this.touchController)||void 0===e||e.off(Ra.TouchEnd,this.handleTouchEnd)}handleSwipeUpGesture(){if(!this._swipeUpLinkTarget||!this.slideContent||!this._swipeUpElementId)return;const e=this.slideContent.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);e&&this.linkClickHandler.onLinkClick({widget:this,target:e})}handleTouchEnd({dy:e}){this.touchController&&e<10&&this.touchController.verticalSwipeGesture&&this.handleSwipeUpGesture()}}class ps{constructor(e,t,r){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"linkClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e){const t=e.querySelector(".narrative-element-swipe-up");return t?[new hs(t,this.slideApi,this.touchController,this.linkClickHandler,e)]:[]}}var gs;!function(e){e[e.None=0]="None",e[e.DisableNext=1]="DisableNext",e[e.DisablePrev=2]="DisablePrev"}(gs||(gs={}));class fs{constructor(e,t,r,i,a){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"event",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"geometry",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"dir",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_mode",{enumerable:!0,configurable:!0,writable:!0,value:gs.None}),Object.defineProperty(this,"_defaultPrevented",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_direction",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._direction=this.calcDirection()}get mode(){return this._mode}get direction(){return this._direction}get defaultPrevented(){return this._defaultPrevented||this.slide.navigationDisabled}get navigationDisabled(){return this.slide.navigationDisabled}preventDefault(){this._defaultPrevented=!0}disableNextClick(){this._mode=gs.DisableNext}navigate(){this.direction<0?this.toPrev():this.mode!==gs.DisableNext&&this.toNext()}toPrev(){this.dir===ne.LTR?this.prevSlideOrStory():this.nextSlideOrStory()}toNext(){this.dir===ne.LTR?this.nextSlideOrStory():this.prevSlideOrStory()}prevSlideOrStory(){this.slide.story.reachStart?this.slide.story.prevStory():this.slide.story.prevSlide()}nextSlideOrStory(){this.slide.story.reachEnd?this.slide.story.nextStory():this.slide.story.nextSlide()}calcClickPosition(){var e;let t=0,r=0;return this.desktopMode?(t=this.geometry.calculateWidth(),r=this.event.nativeEvent.offsetX):(t=this.geometry.vw,r=this.event.nativeEvent.pageX||(null===(e=this.event.nativeEvent.touches)||void 0===e?void 0:e[0].pageX)),r/t}calcDirection(){return this.calcClickPosition()<=.3?-1:1}}var ms;!function(e){e.Idle="idle",e.Init="init",e.StartLoading="startLoading",e.Loading="loading",e.Loaded="loaded",e.Starting="starting",e.Started="started",e.Paused="paused",e.Error="error",e.Destroyed="destroyed"}(ms||(ms={}));const vs={step:1,maxSteps:100};class bs{constructor(e,t={}){Object.defineProperty(this,"elements",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"handleWindowResize",{enumerable:!0,configurable:!0,writable:!0,value:(0,Ua.default)((()=>{this.fit(this.elements)}),300)}),this.elements=e,this.settings=Object.assign(Object.assign({},vs),t)}async fit(e){for(const t of e)this.processElement(t)}start(){window.addEventListener("resize",this.handleWindowResize)}destroy(){window.removeEventListener("resize",this.handleWindowResize)}processElement(e){const t=e.parentElement;if(!t)return;const r=this.calculateInnerHeight(t);r<=0?console.warn(`Set a static height and width on the target element ${e.outerHTML} before using textFit!`,e):this.adjustFontSizeToFit(e,r)}calculateInnerHeight(e){const t=window.getComputedStyle(e);return e.getBoundingClientRect().height-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)}adjustFontSizeToFit(e,t){e.style.fontSize="";let r=parseFloat(window.getComputedStyle(e).fontSize);const i=r-this.settings.step*this.settings.maxSteps;for(;r>=i;){if(!(e.getBoundingClientRect().height>t))break;r-=this.settings.step,e.style.fontSize=`${r}px`}}}var ys=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},ws=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Ss=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},_s=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Os=(()=>{var e,t,r;let i,a,s,n,o,l,d,c,u,h=[],p=[],g=[],f=[],m=[];return e=class{get _state(){return Ss(this,t,"f")}set _state(e){_s(this,t,e,"f")}get _muted(){return Ss(this,r,"f")}set _muted(e){_s(this,r,e,"f")}constructor(e,i,a,s,n){Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:(ys(this,h),e)}),Object.defineProperty(this,"widgetManager",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"layersManager",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"slideElement",{enumerable:!0,configurable:!0,writable:!0,value:n}),t.set(this,ys(this,p,ms.Idle)),Object.defineProperty(this,"videoContext",{enumerable:!0,configurable:!0,writable:!0,value:(ys(this,g),null)}),Object.defineProperty(this,"narrativeAnimationContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.set(this,ys(this,f,!1)),Object.defineProperty(this,"_navigationDisabled",{enumerable:!0,configurable:!0,writable:!0,value:(ys(this,m),!1)}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mutex",{enumerable:!0,configurable:!0,writable:!0,value:new ta.Mutex}),Object.defineProperty(this,"autoTextFitter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"handleVideoPlaying",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.context.onSlideResume()}}),Object.defineProperty(this,"handleVideoWaiting",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.context.onSlidePause()}}),Object.defineProperty(this,"handleVideoError",{enumerable:!0,configurable:!0,writable:!0,value:async()=>{const e=await this.mutex.acquire();try{if(this.state===ms.Idle)return;this.context.onSlideVideoError(),this.setState(ms.Error)}catch(e){console.error(e)}finally{e()}}}),this.narrativeAnimationContext=new qi(this.animationApi)}get $el(){return this.slideContent}get widgets(){return this.widgetManager.widgets}get state(){return this._state}get muted(){return this._muted}get navigationDisabled(){return this._navigationDisabled}async resume(){var e;const t=await this.mutex.acquire();try{if(this.state!==ms.Paused)return;await(null===(e=this.videoContext)||void 0===e?void 0:e.resume()),this.narrativeAnimationContext.resume(),this.widgetManager.resume(),this.context.onSlideResume(),this.setState(ms.Started),t()}catch(e){console.error(e)}finally{t()}}async pause(){var e;const t=await this.mutex.acquire();try{if(this.state!==ms.Started)return;null===(e=this.videoContext)||void 0===e||e.pause(),this.narrativeAnimationContext.pause(),this.widgetManager.pause(),this.context.onSlidePause(),this.setState(ms.Paused),t()}finally{t()}}mute(){var e;this._muted=!0,null===(e=this.videoContext)||void 0===e||e.mute()}unmute(){var e;this._muted=!1,null===(e=this.videoContext)||void 0===e||e.unmute()}async onClick({target:e,navigationController:t}){Xs.is(e)?this.slideElement.click(e):(await this.widgetManager.handleWidgetClick(e,t),t.defaultPrevented||t.navigate())}onClickLinkElement(e){this.slideElement.click(e)}async reload(){const e=await this.mutex.acquire();this.setState(ms.Idle),e()}async init(e){const t=await this.mutex.acquire();try{if(this._state!==ms.Idle)return;this.setState(ms.Init),this.slideContent=e,this.parseNavigationDisable(),this.narrativeAnimationContext.init(e),this.context.onSlideBeforeInit(),await this.initLayersAndWidgetManager(e);const t=this.layersManager.activeLayer?this.layersManager.activeLayer:this.slideContent;this.videoContext=await this.createVideoContext(t),this.context.onSlideAfterInit(),await this.load()}catch(e){console.error(e),this.setState(ms.Error)}finally{t()}}async start(){var e,t;const r=await this.mutex.acquire();try{if(this.state===ms.Idle||this.state===ms.Started)return;this.setState(ms.Starting),await(null===(e=this.videoContext)||void 0===e?void 0:e.start()),await this.context.onSlideStarted(),this.narrativeAnimationContext.start(),null===(t=this.autoTextFitter)||void 0===t||t.start(),this.setState(ms.Started)}catch(e){console.error(e),this.setState(ms.Error)}finally{r()}}async stop(){var e;const t=await this.mutex.acquire();try{if(this.state!==ms.Started&&this.state!==ms.Error)return;this.context.onSlideStop(),this.narrativeAnimationContext.stop(),this.widgetManager.stop(),null===(e=this.autoTextFitter)||void 0===e||e.destroy(),this.layersManager.reset(),await this.destroyVideoContext(),this.setState(ms.Idle)}catch(e){console.error(e),this.setState(ms.Error)}finally{t()}}async destroy(){var e;const t=await this.mutex.acquire();try{if(this.state===ms.Idle)return;this.context.onSlideDestroy(),this.narrativeAnimationContext.stop(),this.widgetManager.stop(),null===(e=this.autoTextFitter)||void 0===e||e.destroy(),this.layersManager.reset(),await this.destroyVideoContext()}catch(e){console.error(e)}finally{this.setState(ms.Idle),t()}}findAllWidgetsOfType(e){return this.widgetManager.findAllOfType(e)}refreshWidgetsData(){this.widgetManager.refreshUserData()}async showLayerByIndex(e){const t=this.layersManager.showLayerByIndex(e);if(!t)return;const r=await this.mutex.acquire();try{this.videoContext=await this.createVideoContext(t),await this.videoContext.load(),await this.videoContext.start()}catch(e){throw this.layersManager.reset(),console.error(e),this.setState(ms.Error),e}finally{r()}}async fitContentFontSize(){await this.loadFonts();const e=Array.from(this.slideContent.querySelectorAll(".narrative-element-text-wrapper>.narrative-element-text-lines"));this.autoTextFitter=new bs(e),this.autoTextFitter.fit(e)}async initLayersAndWidgetManager(e){this.layersManager.init(e,this.animationApi),await this.widgetManager.init(this.slideContent),this.layersManager.init(e,this.animationApi)}setState(e){this._state=e,this.context.onSlideStateChanged(e)}async load(){if(this.state!==ms.Loaded)try{this.context.onSlideLoadStart(),this.setState(ms.StartLoading),await this.loadResources(),this.setState(ms.Loaded),this.context.onSlideLoadEnd()}catch(e){console.error(e),this.setState(ms.Error)}}async loadResources(){return new Promise((async(e,t)=>{var r;let i=setTimeout((()=>{t("[IAM]: Media resources were not loaded")}),1e4);try{await this.fitContentFontSize(),await this.loadMediaResources(this.slideContent),await(null===(r=this.videoContext)||void 0===r?void 0:r.load()),e()}catch(e){t(e)}finally{clearTimeout(i)}}))}loadFonts(){return new Promise((e=>{"fonts"in document?document.fonts.ready&&document.fonts.ready.catch(e).finally(e):e()}))}loadMediaResources(e){return new Promise(((t,r)=>function(e,t,r){const i=function(e){return new Promise((function(t,r){if("img"===e.tagName.toLowerCase()&&e instanceof HTMLImageElement){const r=()=>{requestAnimationFrame((()=>requestAnimationFrame((()=>{t(e),e.removeEventListener("load",r)}))))};e.addEventListener("load",r),e.complete&&0!==e.naturalHeight&&requestAnimationFrame((function(){requestAnimationFrame((function(){t(e)}))}))}else t(e);e.addEventListener("error",(function(e){var t=e.target instanceof HTMLImageElement;if(e&&e.target&&t&&e.target.style){e.target.style.display="none";var i=e.target.closest(".narrative-element-image");i&&(i.style.display="none")}r(e)}))}))},a=e.querySelectorAll("img,video");let s,n=[];for(s=0;s<a.length;++s)n.push(i(a[s]));n.length,Promise.all(n).then((e=>{t()})).catch(r)}(e,t,r)))}parseNavigationDisable(){const e=this.slideContent.querySelector(".narrative-slide");if(!e)return!1;this._navigationDisabled="1"===e.dataset.disableNavigation}async createVideoContext(e){await this.destroyVideoContext();const t=new Xi(e,this._muted);return t.on(Ki.Playing,this.handleVideoPlaying),t.on(Ki.Waiting,this.handleVideoWaiting),t.on(Ki.Error,this.handleVideoError),t}async destroyVideoContext(){this.videoContext&&(this.videoContext.off(Ki.Playing,this.handleVideoPlaying),this.videoContext.off(Ki.Waiting,this.handleVideoWaiting),this.videoContext.off(Ki.Waiting,this.handleVideoError),await this.videoContext.destroy())}},t=new WeakMap,r=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;i=[Pe.observable],a=[Pe.observable],s=[Pe.action],n=[Pe.action],o=[Pe.action],l=[Pe.action],d=[Pe.action],c=[Pe.action],u=[Pe.action],ws(e,null,i,{kind:"accessor",name:"_state",static:!1,private:!1,access:{has:e=>"_state"in e,get:e=>e._state,set:(e,t)=>{e._state=t}},metadata:t},p,g),ws(e,null,a,{kind:"accessor",name:"_muted",static:!1,private:!1,access:{has:e=>"_muted"in e,get:e=>e._muted,set:(e,t)=>{e._muted=t}},metadata:t},f,m),ws(e,null,s,{kind:"method",name:"resume",static:!1,private:!1,access:{has:e=>"resume"in e,get:e=>e.resume},metadata:t},null,h),ws(e,null,n,{kind:"method",name:"pause",static:!1,private:!1,access:{has:e=>"pause"in e,get:e=>e.pause},metadata:t},null,h),ws(e,null,o,{kind:"method",name:"mute",static:!1,private:!1,access:{has:e=>"mute"in e,get:e=>e.mute},metadata:t},null,h),ws(e,null,l,{kind:"method",name:"unmute",static:!1,private:!1,access:{has:e=>"unmute"in e,get:e=>e.unmute},metadata:t},null,h),ws(e,null,d,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:t},null,h),ws(e,null,c,{kind:"method",name:"stop",static:!1,private:!1,access:{has:e=>"stop"in e,get:e=>e.stop},metadata:t},null,h),ws(e,null,u,{kind:"method",name:"setState",static:!1,private:!1,access:{has:e=>"setState"in e,get:e=>e.setState},metadata:t},null,h),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Cs{constructor(e){Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){this.storyReader.close()}}class xs{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const t=e.linkTarget;this.emitWidgetLinkEvent(t,e),this.activeStory.markAsOpened(),fi.emit(Ei.TransitionFromSlide,{storyId:this.activeStory.id,slideIndex:this.activeStory.activeSlideIndex})}emitWidgetLinkEvent(e,t){this.storyManager.emit("widgetEvent",{name:"w-link",data:{story_id:this.activeStory.id,slide_index:this.activeStory.activeSlideIndex,widget_id:t.elementId,widget_label:"",widget_value:e}})}}class ks{constructor(e,t,r){Object.defineProperty(this,"userKey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"instanceUserData",{enumerable:!0,configurable:!0,writable:!0,value:r})}set(e){return window.localStorage.setItem(this.key,JSON.stringify(e)),e}get(){var e;let t={};const r=(0,be.default)(this.instanceUserData)?this.instanceUserData:{};try{const r=JSON.parse(null!==(e=window.localStorage.getItem(this.key))&&void 0!==e?e:"{}");(0,be.default)(r)&&(t=r)}catch(e){console.error(e)}return(0,vr.default)(t,r)}get key(){return`game_instance_data_${this.userKey}_${this.gameInstanceId}`}}const Ps=.64516129032;class js{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t,this._vh=this.calcVH()}get vw(){return this._vw}get vh(){return this._vh}getWidth(){return this.viewportRatio>Ps&&!this.isDiffAspectRatioEqualToEps()?`${this.calcWidthByVH()}px`:"auto"}getHeight(){const e=this.isDiffAspectRatioEqualToEps()||this.isPortraitOrientation();return this.viewportRatio>Ps&&!e?`${this.calcHeightByVW()}px`:"100%"}calcWidthByVH(){return Math.ceil(this._vh*Ps)}calcHeightByVW(){return this._vh}isDiffAspectRatioEqualToEps(){return this.viewportRatio>Ps&&this.viewportRatio-Ps<=.1}isPortraitOrientation(){let e;return"matchMedia"in window&&void 0!==(e=window.matchMedia("(orientation: portrait)"))&&e.matches}calcVH(){let e=this._vh;return e-=this.padding.top+this.padding.bottom,e}}class Ms{constructor(e,t){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}getWidth(){return this.viewportRatio>Ps&&!this.isDiffAspectRatioEqualToEps()?`${this.calcWidthByVH()}px`:"auto"}getHeight(){const e=this.isDiffAspectRatioEqualToEps()||this.isPortraitOrientation();return this.viewportRatio>Ps&&!e?`${this.calcHeightByVW()}px`:"100%"}calcWidthByVH(){return this.viewportRatio>Ps?this._vw:Math.ceil(this._vh*Ps)}calcHeightByVW(){return Math.ceil(this._vw/Ps)}isDiffAspectRatioEqualToEps(){return this.viewportRatio>Ps&&this.viewportRatio-Ps<=.1}isPortraitOrientation(){let e;return"matchMedia"in window&&void 0!==(e=window.matchMedia("(orientation: portrait)"))&&e.matches}}class Es{constructor(){}create(e){return e.desktopMode&&e.vw>=e.vh?this.createDesktopGameGeometry(e):this.createMobileGameGeometry(e)}createDesktopGameGeometry(e){return new js(e.vw,e.vh,{top:50,bottom:50})}createMobileGameGeometry(e){return new Ms(e.vw,e.vh)}}class Is{constructor(e){Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value:e})}set(e){sessionStorage.setItem(this.key,JSON.stringify(e))}get(){var e;const t=null!==(e=sessionStorage.getItem(this.key))&&void 0!==e?e:"{}";return window.__activeNarrativeId?JSON.parse(t):{}}get key(){return`narrative_${this.storyId}_data`}}class Ls extends e.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"origin",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.messageListener=this.messageListener.bind(this),window.addEventListener("message",this.messageListener,!1)}messageListener(e){if(e.origin!==this.origin)return;const[t,...r]=e.data;try{if(!Array.isArray(e.data))throw new Error(`Invalid MessageEvent data format ${e.data}`);this.emit(t,...r)}catch(e){console.error(e)}}sendMessage(e,t){var r;null===(r=this.iframe.contentWindow)||void 0===r||r.postMessage([e,t],this.origin)}pauseGameUI(){null==this||this.sendMessage("cb",{cb:"pauseUI",arguments:JSON.stringify([])})}resumeGameUI(){null==this||this.sendMessage("cb",{cb:"resumeUI",arguments:JSON.stringify([])})}shareComplete(e,t){this.sendMessage("shareComplete",{id:e,isSuccess:t})}closeGameReader(){this.sendMessage("closeGameReader")}initGame(e){this.sendMessage("cb",{cb:"initGame",arguments:JSON.stringify([e])})}sendGameCenterEventByApiRequest(e,t){this.sendMessage("cb",{cb:e,plainData:t})}notifyGameCanBeStarted(){this.sendMessage("gameShouldForeground")}destroy(){window.removeEventListener("message",this.messageListener,!1),this.removeAllListeners()}}class Ts{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const{id:t,callback:r}=JSON.parse(e),i=this.gameReaderViewModel.game;if(!i)return;const a=new ks(i.clientConfig.userKey,i.config.gameInstanceId,i.instanceUserData).get();this.gameCenterMessageService.sendMessage("cb",{cb:r,arguments:JSON.stringify([t,JSON.stringify(a)])})}}class As{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:r})}handle(e){const{gameInstanceId:t,data:r}=JSON.parse(e),i=this.gameReaderViewModel.game;if(!i)return;const a=new ks(i.clientConfig.userKey,i.config.gameInstanceId,i.instanceUserData).set(r);this.storyManager.isStatisticsDisabled||Ce.post(`game/${t}/instance-user-data`,JSON.stringify(a)).catch(console.error)}}var Rs;!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Rs||(Rs={}));class Ds{constructor(e,t,r){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e,t){var r,i,a;let s=null!==(r=null==t?void 0:t.url)&&void 0!==r?r:t.text,n=[];t.files&&Array.isArray(t.files)&&t.files.length>0&&(n=await Promise.all(t.files.map((e=>(async({file:e,name:t,type:r})=>{const i=await fetch(`data:${r};base64,${e}`),a=await i.blob();return new File([a],t,{type:r,lastModified:(new Date).getTime()})})(e)))));const o={url:null!=s?s:void 0,files:n.length>0?n:void 0,text:null!==(i=t.text)&&void 0!==i?i:void 0,title:null!==(a=t.title)&&void 0!==a?a:void 0};if(!(o.files&&o.files.length>0||o.url))return void this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!1});let l=navigator.share;if(!navigator.share&&window.parent&&window.parent.navigator.share&&(l=window.parent.navigator.share),!this.desktopMode&&l)try{if(!l)return;l(o).then((()=>this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!0}))).catch((()=>this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!1})))}catch(t){console.error(t),this.openSharePanel({shareConfig:o,sharePath:s,shareId:e})}else this.openSharePanel({shareConfig:o,sharePath:s,shareId:e})}openSharePanel({shareConfig:e,sharePath:t,shareId:r}){let i=Rs.Social,a=t;e.files&&e.files.length>0&&(i=Rs.SlideScreenshot,a=URL.createObjectURL(e.files[0])),this.gameReaderViewModel.emit(Ws.OpenSharePanel,{shareId:r,shareType:i,shareLink:a})}}class Bs{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const t=JSON.parse(e);if(!(0,be.default)(t))return;const{id:r,storyId:i,callback:a}=t;let s=new Is(i).get();this.gameCenterMessageService.sendMessage("cb",{cb:a,arguments:JSON.stringify([r,JSON.stringify(s)])})}}class Fs{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){const t=JSON.parse(e);if(!(0,be.default)(t))return;const{storyId:r,data:i,sendToServer:a}=t;new Is(r).set(i),a&&!this.storyManager.getConfig().isStatisticsDisabled&&Ce.request({url:"story-data/"+r,method:"put",data:JSON.stringify(i)}).catch(console.error)}}const Ns=(e=>{var t={};return T.d(t,e),t})({default:()=>m.default});class Us{constructor(e){Object.defineProperty(this,"window",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"scrollbarHidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get width(){const e=this.window.document.documentElement.clientWidth;return Math.abs(this.window.innerWidth-e)}setScrollbar(e=this.width){this.scrollbarHidden||(this.disableOverFlow(),this.setBodyContainer(),this.setElementAttributes("body","paddingRight",(t=>t+e)),this.scrollbarHidden=!0)}resetScrollbar(){this.scrollbarHidden&&(this.resetElementAttributes("html","overflow"),this.resetElementAttributes("body","overflow"),this.resetElementAttributes("body","paddingRight"),this.resetBodyContainer(),this.scrollbarHidden=!1)}resetElementAttributes(e,t){this.window.document.querySelectorAll(e).forEach((e=>{const r=e.dataset[t];void 0===r?e.style.removeProperty(t):(delete e.dataset[t],e.style[t]=r)}))}disableOverFlow(){const e=this.window.document,t=e.documentElement.style.overflow,r=e.body.style.overflow;r&&(e.body.dataset.overflow=r),t&&(e.documentElement.dataset.overflow=t),e.body.style.overflow="hidden",e.documentElement.style.overflow="hidden"}setElementAttributes(e,t,r){const i=this.width;this.window.document.querySelectorAll(e).forEach((e=>{if(e!==this.window.document.body&&this.window.innerWidth>e.clientWidth+i)return;const a=e.style[t],s=this.window.getComputedStyle(e)[t];e.dataset[t]=a,e.style[t]=`${r(Number.parseFloat(s))}px`}))}setBodyContainer(){const e=this.window.document,t=e.body.style.container;t&&(e.body.dataset.container=t),e.body.style.container="unset"}resetBodyContainer(){this.resetElementAttributes("body","container")}}var Ws,zs=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Vs=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Gs=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},$s=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};!function(e){e.Close="close",e.OpenSharePanel="openSharePanel"}(Ws||(Ws={}));let Hs=(()=>{var e,t,r,i,a,s,n,o,l,d;let c,u,h,p,g,f,m,v,b,y,w,S,_,O,C,x,k,P,j,M,E,I,L,T,A,R,D=le,B=[],F=[],N=[],U=[],W=[],z=[],V=[],G=[],$=[],H=[],q=[],K=[],Y=[],J=[],Z=[],X=[],ee=[],te=[],re=[];return e=class extends D{get _isOpened(){return Gs(this,t,"f")}set _isOpened(e){$s(this,t,e,"f")}get _isGameInited(){return Gs(this,r,"f")}set _isGameInited(e){$s(this,r,e,"f")}get _isGameLoading(){return Gs(this,i,"f")}set _isGameLoading(e){$s(this,i,e,"f")}get _gameInstanceId(){return Gs(this,a,"f")}set _gameInstanceId(e){$s(this,a,e,"f")}get _game(){return Gs(this,s,"f")}set _game(e){$s(this,s,e,"f")}get _gameError(){return Gs(this,n,"f")}set _gameError(e){$s(this,n,e,"f")}get _closeBtnVisible(){return Gs(this,o,"f")}set _closeBtnVisible(e){$s(this,o,e,"f")}get _gameShouldBeShown(){return Gs(this,l,"f")}set _gameShouldBeShown(e){$s(this,l,e,"f")}get desktopMode(){return Gs(this,d,"f")}set desktopMode(e){$s(this,d,e,"f")}constructor(c,u){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(zs(this,B),c)}),Object.defineProperty(this,"gameCenterApi",{enumerable:!0,configurable:!0,writable:!0,value:u}),t.set(this,zs(this,F,!1)),r.set(this,(zs(this,N),zs(this,U,!1))),i.set(this,(zs(this,W),zs(this,z,!1))),a.set(this,(zs(this,V),zs(this,G,null))),s.set(this,(zs(this,$),zs(this,H,null))),n.set(this,(zs(this,q),zs(this,K,null))),o.set(this,(zs(this,Y),zs(this,J,!1))),l.set(this,(zs(this,Z),zs(this,X,!1))),Object.defineProperty(this,"initGameRetryAttempts",{enumerable:!0,configurable:!0,writable:!0,value:(zs(this,ee),0)}),Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"safeAreaInsets",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,bottom:0,left:0,right:0}}),Object.defineProperty(this,"openGameOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),d.set(this,zs(this,te,!0)),Object.defineProperty(this,"dir",{enumerable:!0,configurable:!0,writable:!0,value:(zs(this,re),ne.LTR)}),Object.defineProperty(this,"scrollbarHelper",{enumerable:!0,configurable:!0,writable:!0,value:new Us(window)}),this.handleVisibilityChange=this.handleVisibilityChange.bind(this),document.addEventListener("visibilitychange",this.handleVisibilityChange),this.storyManager.setViewModel(e.id,this)}get closeBtnVisible(){return this._closeBtnVisible}get isGameLoading(){return this._isGameLoading}get isGameInited(){return this._isGameInited}get gameError(){return this._gameError}get game(){return this._game}get gameInstanceId(){return this._gameInstanceId}get isOpened(){return this._isOpened}get gameShouldBeShown(){return this._gameShouldBeShown}async openGame(e,t={}){if(this.isOpened)throw new Error(`Close the launched game with ID "${this.gameInstanceId}"`);this._gameInstanceId=e,this._isOpened=!0,this.openGameOptions=t,this._gameShouldBeShown=!1,await this.launchGameById(e),this.scrollbarHelper.setScrollbar()}async closeGame(){var e;return!!this._isOpened&&(this._isGameInited?null===(e=this.gameCenterMessageService)||void 0===e||e.closeGameReader():this.handleGameComplete({}),!0)}reload(){this._game=null,this.gameInstanceId?this.launchGameById(this.gameInstanceId):console.error("The game instance ID is undefined")}sendGameCenterEventByApiRequest(e,t){var r;null===(r=this.gameCenterMessageService)||void 0===r||r.sendGameCenterEventByApiRequest(e,t)}setSafeAreaInsets(e){this.safeAreaInsets=e}setDesktopMode(e){this.desktopMode=e}setGameCenterIframe(e,{isWidescreen:t}){var r;if(!this._game)throw new Error("GameCenter iframe setup error");if(this._isGameInited)return;null===(r=this.gameCenterMessageService)||void 0===r||r.destroy();const i=new URL(this._game.url).origin;this.gameCenterMessageService=new Ls(e,i),this.initGameCenter({isWidescreen:t,gameCenterMessageService:this.gameCenterMessageService,game:this._game})}pauseGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.pauseGameUI()}resumeGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.resumeGameUI()}confirmSharingComplete({shareId:e,isSuccess:t}){var r;null===(r=this.gameCenterMessageService)||void 0===r||r.shareComplete(e,t)}notifyGameCanBeStarted(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.notifyGameCanBeStarted()}destroy(){var t;null===(t=this.gameCenterMessageService)||void 0===t||t.destroy(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.storyManager.deleteViewModel(e.id)}async launchGameById(e){try{this._gameError=null,this._isGameLoading=!0,await this.storyManager.rootStore.sessionStore.open();const t=await this.gameCenterApi.openGame({gameInstanceId:e,gameOptions:this.openGameOptions});this._game=new br(this.storyManager,t)}catch(e){this._gameError=e}}initGameCenter({isWidescreen:e,gameCenterMessageService:t,game:r}){this.handleGameCenterEvents(t);const i=r.toInitDto({safeAreaInsets:this.safeAreaInsets,dir:this.dir,isWidescreen:e});t.initGame(i)}handleGameCenterEvents(e){e.on("gameLoaded",this.handleGameLoaded.bind(this)).on("gameComplete",this.handleGameComplete.bind(this)).on("sendApiRequest",this.handleSendApiRequest.bind(this)).on("openUrl",this.handleOpenUrl.bind(this)).on("event",this.handleGameEvent.bind(this)).on("reloadGameReader",this.handleReloadGameReader.bind(this)).on("gameLoadFailed",this.handleGameLoadFailed.bind(this)).on("gameShouldForegroundCallback",this.handleGameShouldBeShown.bind(this));const t={share:new Ds(e,this,this.desktopMode),storySetLocalData:new Fs(this.storyManager),storyGetLocalData:new Bs(e,this),gameInstanceGetLocalData:new Ts(e,this),gameInstanceSetLocalData:new As(this.storyManager,e,this)};for(const[r,i]of Object.entries(t))e.on(r,((...e)=>i.handle(...e)))}handleGameShouldBeShown(e){this._gameShouldBeShown=!0;const t=JSON.parse(e);(0,be.default)(t)&&(this._closeBtnVisible=Boolean(t.showClose))}handleGameLoaded(){try{this.initGame(),this.startGame()}catch(e){console.error(e)}}initGame(){this._isGameInited=!0,this._isGameLoading=!1}completeGame(){this._isGameInited=!1,this._isOpened=!1,this._game=null}startGame(){this.storyManager.emit("startGame",{id:this.gameInstanceId})}handleVisibilityChange(){"hidden"===document.visibilityState?this.pauseGameUI():"visible"===document.visibilityState&&this.resumeGameUI()}handleGameComplete(e,t,r,i,a){this.resetGameState(e),this.processGameResult(a,i)}resetGameState(e){var t;this.scrollbarHelper.resetScrollbar(),this.completeGame(),null===(t=this.gameCenterMessageService)||void 0===t||t.destroy(),this.emitGameCompleteEventByStoryManager(e)}processGameResult(e,t){(null==e?void 0:e.id)?this.openGame(e.id,{}):((null==t?void 0:t.id)&&this.storyManager.showStory(t.id),this.emit(Ws.Close))}emitGameCompleteEventByStoryManager(e){(0,Ns.default)(e)?this.storyManager.emit("closeGame",{id:this.gameInstanceId}):this.storyManager.emit("finishGame",{id:this.gameInstanceId,result:e})}async handleSendApiRequest(e){let t,r,i;try{const a=JSON.parse(e);t=a.id,r=a.data,i=a.cb,await Ce.request({url:a.url,method:a.method,params:a.params,data:a.data,headers:a.headers}).catch(console.error),this.sendGameCenterEventByApiRequest(i,JSON.stringify({requestId:t,data:JSON.stringify(r.data),status:r.status,headers:r.headers}))}catch(e){if(e instanceof SyntaxError)return;if(!i)return;this.sendGameCenterEventByApiRequest(i,JSON.stringify({requestId:t,data:JSON.stringify(e),status:400,headers:[{}]}))}}handleOpenUrl(e){const{url:t}=JSON.parse(e);this.storyManager.clickOnButtonAction({src:Q.GAME_READER,payload:{url:t,gameInstanceId:this.gameInstanceId}})}handleGameEvent(e,t){this.storyManager.emit("gameEvent",{name:e,payload:t}),this.storyManager.emit("eventGame",{name:e,payload:t})}handleReloadGameReader(){const e=this._game;this._game=null,this._isGameInited=!1,this._isGameLoading=!0,this._gameShouldBeShown=!1,setTimeout((0,Pe.action)((()=>{this._game=e})))}handleGameLoadFailed(e,t){this._game&&t&&this.initGameRetryAttempts<this._game.canTryReloadCount?(this.initGameRetryAttempts++,this.handleReloadGameReader()):this._gameError=new Error(e)}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=D[Symbol.metadata])&&void 0!==t?t:null):void 0;c=[Pe.observable],u=[Pe.observable],h=[Pe.observable],p=[Pe.observable],g=[Pe.observable],f=[Pe.observable],m=[Pe.observable],v=[Pe.observable],b=[Pe.observable],y=[Pe.computed],w=[Pe.computed],S=[Pe.computed],_=[Pe.computed],O=[Pe.computed],C=[Pe.computed],x=[Pe.computed],k=[Pe.computed],P=[Pe.action],j=[Pe.action],M=[Pe.action],E=[Pe.action],I=[Pe.action],L=[Pe.action],T=[Pe.action],A=[Pe.action],R=[Pe.action],Vs(e,null,c,{kind:"accessor",name:"_isOpened",static:!1,private:!1,access:{has:e=>"_isOpened"in e,get:e=>e._isOpened,set:(e,t)=>{e._isOpened=t}},metadata:r},F,N),Vs(e,null,u,{kind:"accessor",name:"_isGameInited",static:!1,private:!1,access:{has:e=>"_isGameInited"in e,get:e=>e._isGameInited,set:(e,t)=>{e._isGameInited=t}},metadata:r},U,W),Vs(e,null,h,{kind:"accessor",name:"_isGameLoading",static:!1,private:!1,access:{has:e=>"_isGameLoading"in e,get:e=>e._isGameLoading,set:(e,t)=>{e._isGameLoading=t}},metadata:r},z,V),Vs(e,null,p,{kind:"accessor",name:"_gameInstanceId",static:!1,private:!1,access:{has:e=>"_gameInstanceId"in e,get:e=>e._gameInstanceId,set:(e,t)=>{e._gameInstanceId=t}},metadata:r},G,$),Vs(e,null,g,{kind:"accessor",name:"_game",static:!1,private:!1,access:{has:e=>"_game"in e,get:e=>e._game,set:(e,t)=>{e._game=t}},metadata:r},H,q),Vs(e,null,f,{kind:"accessor",name:"_gameError",static:!1,private:!1,access:{has:e=>"_gameError"in e,get:e=>e._gameError,set:(e,t)=>{e._gameError=t}},metadata:r},K,Y),Vs(e,null,m,{kind:"accessor",name:"_closeBtnVisible",static:!1,private:!1,access:{has:e=>"_closeBtnVisible"in e,get:e=>e._closeBtnVisible,set:(e,t)=>{e._closeBtnVisible=t}},metadata:r},J,Z),Vs(e,null,v,{kind:"accessor",name:"_gameShouldBeShown",static:!1,private:!1,access:{has:e=>"_gameShouldBeShown"in e,get:e=>e._gameShouldBeShown,set:(e,t)=>{e._gameShouldBeShown=t}},metadata:r},X,ee),Vs(e,null,b,{kind:"accessor",name:"desktopMode",static:!1,private:!1,access:{has:e=>"desktopMode"in e,get:e=>e.desktopMode,set:(e,t)=>{e.desktopMode=t}},metadata:r},te,re),Vs(e,null,y,{kind:"getter",name:"closeBtnVisible",static:!1,private:!1,access:{has:e=>"closeBtnVisible"in e,get:e=>e.closeBtnVisible},metadata:r},null,B),Vs(e,null,w,{kind:"getter",name:"isGameLoading",static:!1,private:!1,access:{has:e=>"isGameLoading"in e,get:e=>e.isGameLoading},metadata:r},null,B),Vs(e,null,S,{kind:"getter",name:"isGameInited",static:!1,private:!1,access:{has:e=>"isGameInited"in e,get:e=>e.isGameInited},metadata:r},null,B),Vs(e,null,_,{kind:"getter",name:"gameError",static:!1,private:!1,access:{has:e=>"gameError"in e,get:e=>e.gameError},metadata:r},null,B),Vs(e,null,O,{kind:"getter",name:"game",static:!1,private:!1,access:{has:e=>"game"in e,get:e=>e.game},metadata:r},null,B),Vs(e,null,C,{kind:"getter",name:"gameInstanceId",static:!1,private:!1,access:{has:e=>"gameInstanceId"in e,get:e=>e.gameInstanceId},metadata:r},null,B),Vs(e,null,x,{kind:"getter",name:"isOpened",static:!1,private:!1,access:{has:e=>"isOpened"in e,get:e=>e.isOpened},metadata:r},null,B),Vs(e,null,k,{kind:"getter",name:"gameShouldBeShown",static:!1,private:!1,access:{has:e=>"gameShouldBeShown"in e,get:e=>e.gameShouldBeShown},metadata:r},null,B),Vs(e,null,P,{kind:"method",name:"openGame",static:!1,private:!1,access:{has:e=>"openGame"in e,get:e=>e.openGame},metadata:r},null,B),Vs(e,null,j,{kind:"method",name:"closeGame",static:!1,private:!1,access:{has:e=>"closeGame"in e,get:e=>e.closeGame},metadata:r},null,B),Vs(e,null,M,{kind:"method",name:"reload",static:!1,private:!1,access:{has:e=>"reload"in e,get:e=>e.reload},metadata:r},null,B),Vs(e,null,E,{kind:"method",name:"setDesktopMode",static:!1,private:!1,access:{has:e=>"setDesktopMode"in e,get:e=>e.setDesktopMode},metadata:r},null,B),Vs(e,null,I,{kind:"method",name:"handleGameShouldBeShown",static:!1,private:!1,access:{has:e=>"handleGameShouldBeShown"in e,get:e=>e.handleGameShouldBeShown},metadata:r},null,B),Vs(e,null,L,{kind:"method",name:"handleGameLoaded",static:!1,private:!1,access:{has:e=>"handleGameLoaded"in e,get:e=>e.handleGameLoaded},metadata:r},null,B),Vs(e,null,T,{kind:"method",name:"handleGameComplete",static:!1,private:!1,access:{has:e=>"handleGameComplete"in e,get:e=>e.handleGameComplete},metadata:r},null,B),Vs(e,null,A,{kind:"method",name:"handleReloadGameReader",static:!1,private:!1,access:{has:e=>"handleReloadGameReader"in e,get:e=>e.handleReloadGameReader},metadata:r},null,B),Vs(e,null,R,{kind:"method",name:"handleGameLoadFailed",static:!1,private:!1,access:{has:e=>"handleGameLoadFailed"in e,get:e=>e.handleGameLoadFailed},metadata:r},null,B),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),Object.defineProperty(e,"id",{enumerable:!0,configurable:!0,writable:!0,value:"GameReaderViewModel"}),e})();class qs{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){return new Hs(this.storyManager,new lr)}}class Qs{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:t})}async handle(e){try{this.emitWidgetLinkEvent(e.linkTarget,e);const t=this.storyManager.gameReaderViewModel,r=this.storyManager.storyReaderViewModel;await t.openGame(e.linkTarget),r.pauseUI(),t.once(Ws.Close,(()=>{r.resumeUI()}))}catch(e){console.error(e)}}emitWidgetLinkEvent(e,t){this.storyManager.emit("widgetEvent",{name:"w-link",data:{story_id:this.activeStory.id,slide_index:this.activeStory.activeSlideIndex,widget_id:t.elementId,widget_label:"",widget_value:e}})}}class Ks{constructor(e){Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){this.activeStory.activeSlide.showLayerByIndex(parseInt(e.linkTarget))}}class Ys{constructor(e){Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){this.activeStory.toSlide(parseInt(e.linkTarget))}}class Js{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){const t=parseInt(e.linkTarget);this.emitWidgetLinkEvent(e.linkTarget,e);try{await this.storyReader.showStory(t)}catch(e){console.error(e)}}emitWidgetLinkEvent(e,t){this.storyManager.emit("widgetEvent",{name:"w-link",data:{story_id:this.activeStory.id,slide_index:this.activeStory.activeSlideIndex,widget_id:t.elementId,widget_label:"",widget_value:e,feed:this.storyReader.feedSlug}})}}class Zs{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:r})}handle(e){try{const t=decodeURIComponent(e.linkTarget);this.emitWidgetLinkEvent(t,e),this.activeStory.markAsOpened(),fi.emit(Ei.TransitionFromSlide,{storyId:this.activeStory.id,slideIndex:this.activeStory.activeSlideIndex}),this.handleClickOnButton({id:this.activeStory.id,index:this.activeStory.activeSlideIndex,url:t,elementId:e.elementId,dataForSending:null,label:""})}catch(t){t instanceof URIError?console.error(`[IAS]: the URL <${e.linkTarget}> has an invalid format`):console.error(t)}}emitWidgetLinkEvent(e,t){this.storyManager.emit("widgetEvent",{name:"w-link",data:{story_id:this.activeStory.id,slide_index:this.activeStory.activeSlideIndex,widget_id:t.elementId,widget_label:"",widget_value:e}})}handleClickOnButton(e){const t=this.storyManager.getConfig().isStatisticsDisabled;e.dataForSending=t?null:{data:this.storyReader.getStatisticsData()};const r=()=>this.storyManager.clickOnButtonAction({src:Q.STORY_READER,payload:e});!t&&e.dataForSending&&(0,be.default)(e.dataForSending)&&Array.isArray(e.dataForSending.data)&&e.dataForSending.data.length>0?(this.storyReader.cleanupStatisticsData(),Oe("session/update",e.dataForSending,r)):r()}}class Xs{constructor(e){Object.defineProperty(this,"slideElementActionFactory",{enumerable:!0,configurable:!0,writable:!0,value:e})}static is(e){return["narrative-element-link","narrative-element-image"].some((t=>e.classList.contains(t)))}click(e){const{elementId:t,linkType:r,linkTarget:i}=this.parseTargetDataset(e);if(!r)return;this.slideElementActionFactory.create(r).handle({target:e,linkTarget:i,linkType:r,elementId:t})}parseTargetDataset(e){var t,r;const i=e.dataset;return{elementId:null!==(t=i.elementId)&&void 0!==t?t:"",linkType:i.linkType,linkTarget:null!==(r=i.linkTarget)&&void 0!==r?r:""}}}class en{handle(e){console.log(`There is no action handler for <${e.linkType}:${e.linkTarget}>`)}}class tn{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e){switch(e){case"url":return new Zs(this.storyManager,this.storyReader,this.activeStory);case"customAction":return new xs(this.storyManager,this.activeStory);case"slide":return new Ys(this.activeStory);case"story":return new Js(this.storyManager,this.storyReader,this.activeStory);case"game":return new Qs(this.storyManager,this.activeStory);case"layer":return new Ks(this.activeStory);case"closeStory":return new Cs(this.storyReader);default:return new en}}}const rn=.53167701863,an=.64516129032;class sn{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}get vhWitoutPadding(){return this._vh-this.padding.top-this.padding.bottom}getOffset(e){const t=this._vw,r=this.vhWitoutPadding-e,i=this.calculateWidthWithActionPanel(e),a=this.calculateHeightWithActionPanel(e);return this.viewportRatio>an?Math.ceil(a-r)/2*-1+"px auto":`0 ${Math.ceil(i-t)/2*-1}px`}getOffsetX(e){const t=this.calculateWidthWithActionPanel(e);return this.viewportRatio>an?"0px":Math.ceil(t-this._vw)/2+"px"}getOffsetY(e){const t=this.vhWitoutPadding-e;return this.viewportRatio>an?`${Math.ceil(this.calculateHeight()-t)}px`:"0px"}getWidth(){return this.viewportRatio>an?`${this.calculateWidth()}px`:"auto"}getHeight(){return this.viewportRatio>an?`${this.calculateHeight()}px`:"100%"}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return Math.ceil(this.vhWitoutPadding*an)}calculateHeight(){return Math.ceil(this.calculateWidth()/an)}calculateWidthWithActionPanel(e){const t=this.vhWitoutPadding-e;return Math.ceil(t*an)}calculateHeightWithActionPanel(e){return Math.ceil(this.calculateWidthWithActionPanel(e)/an)}}class nn{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}get vhWitoutPadding(){return this._vh-this.padding.top-this.padding.bottom}getOffset(e){const t=this._vw,r=this.vhWitoutPadding-e,i=this.calculateWidthWithActionPanel(e),a=this.calculateHeight();return a>r?Math.ceil(a-r)/2*-1+"px auto":`0 ${Math.ceil(i-t)/2*-1}px`}getOffsetX(e){const t=this.calculateWidthWithActionPanel(e),r=this.vhWitoutPadding-e,i=this.calculateHeight(),a=this._vw;return i>r?"0px":Math.ceil(t-a)/2+"px"}getOffsetY(e){const t=this.vhWitoutPadding-e,r=this.calculateHeight();return r>t?Math.ceil(r-t)/2+"px":"0px"}getWidth(){return this.viewportRatio>an?`${this.calculateWidth()}px`:"auto"}getHeight(){return this.viewportRatio>an?`${this.calculateHeight()}px`:"100%"}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return this.viewportRatio>an?this._vw:Math.ceil(this.vhWitoutPadding*an)}calculateHeight(){return Math.ceil(this._vw/an)}calculateWidthWithActionPanel(e){const t=this.vhWitoutPadding-e;return this.viewportRatio>an?this._vw:Math.ceil(t*an)}}class on{constructor(e){Object.defineProperty(this,"safeAreaFrameCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=e.vw/e.vh;return e.desktopMode&&t>an?this.createDesktopStoryGeometry(e):this.createMobileStoryGeometry(e)}createDesktopStoryGeometry(e){return new sn(e.vw,e.vh,{top:50,bottom:50})}createMobileStoryGeometry(e){var t,r;const{paddingTop:i,paddingBottom:a}=this.safeAreaFrameCalculator.getViewportCorrectionPadding();return new nn(e.vw,e.vh,{top:null!==(t=parseFloat(i))&&void 0!==t?t:0,bottom:null!==(r=parseFloat(a))&&void 0!==r?r:0})}}class ln{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"actionPanelHeight",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get shouldBeShownSafeAreaInsets(){return this.viewportRatio<rn}getViewportCorrectionPadding(){const{paddingTop:e,paddingBottom:t}=this.calcFrameWidthByMobileAspectRatio();return{paddingTop:e+"px",paddingBottom:t+"px"}}calcFrameWidthByMobileAspectRatio(){const e=this._vh-this._vw/rn,t=Math.max(Math.min(e-this.actionPanelHeight,this.actionPanelHeight),0);return{paddingTop:Math.max(e-t,0),paddingBottom:t}}}class dn extends e.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}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("start"),this.setTimer(e)))}stop(){this.isCompleted||(this.clearTimer(),this.emit("stop"),this.isCompleted=!0)}pause(){this.isCompleted||(this.timerPaused=!0,this.clearTimer(),this.progressBeforePause=this.currentProgress,this.emit("pause"))}resume(){if(!this.timerPaused)return;this.timerPaused=!1;const e=1-this.progressBeforePause,t=this.timeout*e;this.setTimer(t),this.emit("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("progress",100),this.emit("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("progress",r)}runTimerTicks(e){let t=performance.now();const r=i=>{let a=(i-t)/e;a>1&&(a=1);let s=a;this.updateProgress(s),a<1&&(this.rafId=requestAnimationFrame(r))};this.rafId=requestAnimationFrame(r)}}class cn{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 un{constructor(){Object.defineProperty(this,"actions",{enumerable:!0,configurable:!0,writable:!0,value:[]})}push(e){this.actions.push(e)}exec(){for(const e of this.actions)e()}flush(){this.actions=[]}}class hn{constructor(e,t,r,i){Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"deferredActionsQueue",{enumerable:!0,configurable:!0,writable:!0,value:new un}),Object.defineProperty(this,"sessionNarrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new cn}),Object.defineProperty(this,"execCalled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}exec(){this.sessionNarrativeDataCache.clear(),this.deferredActionsQueue.exec(),this.deferredActionsQueue.flush(),this.execCalled=!0}changeActiveSlide(){this.execCalled=!1}async getCardLocalData(){const e=this.storyManager.rootStore.sessionStore.userId;let t=this.narrativeDataCache.get(`narrative_${this.story.id}_data_${e}`);return t?JSON.parse(t):{}}setCardLocalData(e,t){const r=this.storyManager.rootStore.sessionStore.userId;let i=JSON.stringify(e);this.narrativeDataCache.set(`narrative_${this.story.id}_data_${r}`,i),t&&this.story.updateNarrativeData(i).catch(console.error)}getCardServerData(e){var t;return null!==(t=this.storyManager.rootStore.storyStore.findStoryById(e).context.widgetsData._narrative_saved_data)&&void 0!==t?t:null}updateCardServerData(e,t){this.storyManager.rootStore.storyStore.findStoryById(e).context.updateNarrativeSavedData(t)}getSlideDuration(e,t){var r,i;return null!==(i=null===(r=this.storyManager.rootStore.storyStore.findStoryById(e).context.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[t])&&void 0!==i?i:null}pauseUI(){this.storyReader.pauseUI()}resumeUI(){this.storyReader.resumeUI()}showCardTextInput(e,t){fi.emit(pn.ShowInputModal,{id:e,config:t})}setCardSessionValue(e,t){this.sessionNarrativeDataCache.set(e,t)}getCardSessionValue(e){return this.sessionNarrativeDataCache.get(e)}getWidgetsSharedData(e,t){const r=this.storyManager.rootStore.storyStore.findStoryById(e);if(!r)return null;const i=r.context.widgetsData;switch(t){case"rangeSlider":return i._narrative_range_slider_data;case"poll":return i._narrative_poll_data;case"vote":return i._narrative_vote_data}return null}openUrl(e){this.story.markAsOpened(),fi.emit(Ei.TransitionFromSlide,{storyId:this.story.id,slideIndex:this.story.activeSlideIndex}),window.open(e,"_parent")}async sendApiRequest(e,t,r,i,a,s){var n,o,l;try{const s=await Ce.request({url:e,method:t,params:null!=r?r:{},headers:null!=i?i:{},data:null!=a?a:{}});return{status:s.status,headers:s.headers,data:s.data}}catch(e){if(e instanceof fe)return{status:null!==(n=e.networkStatus)&&void 0!==n?n: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){null==e&&(e="story-share"),this.storyReader.sharePanel.shareText({shareId:e,config:t,storySlide:this.story.activeSlide})}shareSlideScreenshot(e,t,r){null==e&&(e="slide-screenshot-share"),this.storyReader.sharePanel.shareScreenShot({shareId:e,hideElementsSelector:null!=t?t:"",shareText:r,storySlide:this.story.activeSlide})}showLayer(e){this.story.activeSlide.showLayerByIndex(e)}showCardSlide(e){this.pushToDefferedActionsQueueOrExec((()=>{this.story.toSlide(e)}))}cardShowNext(){this.storyReader.nextStoryWithAnimation()}showNextSlide(e){this.pushToDefferedActionsQueueOrExec((()=>{e?this.story.timer.start(e):this.story.nextSlide()}))}sendStatisticEvent(e,t,r){this.storyManager.emit("widgetEvent",{name:e,data:Object.assign(Object.assign({},r),{feed:this.storyReader.feedSlug})})}destroy(){}async resetStory(e){var t;let r={},i=await this.getCardLocalData();i=Object.assign({},null!==(t=this.getCardServerData(e))&&void 0!==t?t:{},i);for(let e in i)i.hasOwnProperty(e)&&/^_gm_[A-z0-9-_]+_attempts$/.test(e)&&(r[e]=i[e]);this.story.activeSlide.refreshWidgetsData(),this.updateCardServerData(e,r),this.setCardLocalData(r,!0),this.showCardSlide(0),this.showLayer(0)}pushToDefferedActionsQueueOrExec(e){this.execCalled?e():this.deferredActionsQueue.push(e)}getCardFonts(){return this.storyManager.rootStore.sessionStore.session.fontsResources}updateTimeline(e,t,r,i,a,s){}showToast(e){this.story.activeSlide.showToast({content:e})}}var pn,gn;!function(e){e.ShowInputModal="showInputModal"}(pn||(pn={})),function(e){e.Start="start",e.ChangeState="changeState"}(gn||(gn={}));class fn extends le{constructor(e,t,r,i){super(),Object.defineProperty(this,"_story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_index",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storySlideRendererFactory",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(this,"slideRenderer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.slideRenderer=this.storySlideRendererFactory.create({story:e,slide:this})}get $el(){return this.slideRenderer.$el}get state(){return this.slideRenderer.state}get index(){return this._index}get story(){return this._story}get muted(){return this.slideRenderer.muted}get navigationDisabled(){return this.slideRenderer.navigationDisabled}get widgets(){return this.slideRenderer.widgets}get timeline(){return this.slide.timeline}get duration(){return this.slide.duration}get screenshotShare(){return this.slide.screenshotShare}get html(){return this.slide.html}get eventPayload(){return this.slide.eventPayload}findAllWidgetsOfType(e){return this.slideRenderer.findAllWidgetsOfType(e)}refreshWidgetsData(){this.slideRenderer.refreshWidgetsData()}async showLayerByIndex(e){var t,r;try{this.story.timer.stop(),await this.slideRenderer.showLayerByIndex(e),this.story.timer.start(null!==(r=null===(t=this.story.activeSlide)||void 0===t?void 0:t.duration)&&void 0!==r?r:0)}catch(e){this.story.timer.stop()}}async resume(){return this.slideRenderer.resume()}pause(){return this.slideRenderer.pause()}mute(){return this.slideRenderer.mute()}unmute(){return this.slideRenderer.unmute()}async reload(){return this.slideRenderer.reload()}async init(e){return this.slideRenderer.init(e)}async start(){return this.slideRenderer.start()}stop(){return this.slideRenderer.stop()}setUserData(e,t){for(const r of this.widgets)r.setUserData(e,t)}onClick(e,t){this.slideRenderer.onClick({target:e,navigationController:t})}onLinkClick(e){this.slideRenderer.onClickLinkElement(e.target)}showToast(e){new Na(Object.assign({getMountPoint:()=>this.slideRenderer.$el},e))}destroy(){return this.slideRenderer.destroy()}}class mn extends aa{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){}click(e){this.element==e.target&&(this.story.reset().catch(console.error),e.navigationController.preventDefault())}}class vn{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){return Array.from(e.querySelectorAll(".narrative-element-story-repeat")).map((e=>new mn(e,this.slideApi,this.story)))}}class bn{constructor(e,t){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t})}async onSlideStarted(){ke(`[SLIDE][START]:${this.story.id}:${this.slide.index}`),this.story.slideApiHandlers.exec(),this.story.updateNavigationHistory(),this.startTimer(),this.slide.emit(gn.Start)}onSlideStateChanged(e){this.changeTimelineVisibilityByState(),this.slide.emit(gn.ChangeState,e)}onSlideLoadStart(){ke(`[SLIDE][START_LOAD]:${this.story.id}:${this.slide.index}`)}onSlideLoadEnd(){ke(`[SLIDE][END_LOAD]:${this.story.id}:${this.slide.index}`)}onSlideResume(){this.story.resume(),ke(`[SLIDE][RESUME]:${this.story.id}:${this.slide.index}`)}onSlidePause(){this.story.pause(),ke(`[SLIDE][PAUSE]:${this.story.id}:${this.slide.index}`)}onSlideBeforeInit(){ke(`[SLIDE][INIT]:${this.story.id}:${this.slide.index}`)}onSlideAfterInit(){ke(`[SLIDE][WIDGETS]:${this.story.id}:${this.slide.index}`,this.slide.widgets)}onSlideDestroy(){ke(`[SLIDE][DESTROY]:${this.story.id}:${this.slide.index}`)}onSlideStop(){this.story.timer.stop(),ke(`[SLIDE][STOP]:${this.story.id}:${this.slide.index}`)}onSlideVideoError(){this.story.timer.stop()}changeTimelineVisibilityByState(){this.slide.state===ms.Error||this.slide.state===ms.Loading?this.story.hideTimeline():this.story.showTimeline()}startTimer(){var e;this.story.timer.started||this.story.timer.start(null!==(e=this.slide.duration)&&void 0!==e?e:0)}}class yn{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r})}create({story:e,slide:t}){const r=new Hi,i=new ia(e.slideApiHandlers),a=new Xs(new tn(this.storyManager,this.storyReader,e)),s=(0,ea.getSlideApi)(e.slideApiHandlers),n=new Os(new bn(t,e),i,s.Animation,r,a);return this.registerWidgetFactories({widgetManager:i,story:e,slide:t,touchController:this.touchController,slideApi:s}),n}registerWidgetFactories({widgetManager:e,story:t,slide:r,touchController:i,slideApi:a}){e.registerManyFactories([new La(a),new na(a),new la(a),new ca(a),new Aa(a),new ha(a),new ga(a),new ma(t,a),new ba(t,a),new wa(t,a),new _a(i,a),new Ca(a),new ka(a),new us(a,i,{onClose:()=>this.storyReader.resumeUI(),onOpen:()=>this.storyReader.pauseUI()}),new ps(a,i,r),new Ea(a),new ja(t,a),new vn(t,a)])}}var wn=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Sn=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},_n=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},On=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Cn=(()=>{var e,t,r,i,a;let s,n,o,l,d,c,u,h,p,g,f,m,v,b,y,w,S,_,O=le,C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[];return e=class extends O{get _activeSlideIndex(){return _n(this,t,"f")}set _activeSlideIndex(e){On(this,t,e,"f")}get _displayedSlides(){return _n(this,r,"f")}set _displayedSlides(e){On(this,r,e,"f")}get _hiddenTimeline(){return _n(this,i,"f")}set _hiddenTimeline(e){On(this,i,e,"f")}get slides(){return _n(this,a,"f")}set slides(e){On(this,a,e,"f")}constructor(e,s,n,o,l,d,c){var u;super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(wn(this,C),e)}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"sharePanel",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"navigationHistory",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"storySlideRendererFactory",{enumerable:!0,configurable:!0,writable:!0,value:d}),t.set(this,wn(this,x,0)),r.set(this,(wn(this,k),wn(this,P,[]))),i.set(this,(wn(this,j),wn(this,M,!1))),a.set(this,(wn(this,E),wn(this,I,[]))),Object.defineProperty(this,"_hasShare",{enumerable:!0,configurable:!0,writable:!0,value:(wn(this,L),!1)}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:new dn}),Object.defineProperty(this,"storySlidesReactionDisposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.slideApiHandlers=c.create(this),this.nextSlide=this.nextSlide.bind(this),this._hasShare=Boolean(null===(u=this.storyManager.rootStore.sessionStore.session)||void 0===u?void 0:u.share),this.createSlidesViewModels(this.story.slides),this.storySlidesReactionDisposer=(0,Pe.reaction)((()=>({storySlides:this.story.slides,canBeShown:this.story.canBeShown})),(({storySlides:e,canBeShown:t})=>t?this.createSlidesViewModels(e):[]))}get id(){return this.story.id}get title(){return this.story.title}get statTitle(){return this.story.statTitle}get ugcPayload(){return this.story.ugcPayload}get tags(){return this.story.tags}get sourceInfo(){return this.storyReader.sourceInfo}get canBeShown(){return this.story.canBeShown}get like(){return this.story.like}get favorite(){return this.story.favorite}get hasLike(){return Boolean(this.story.likeFunctional)}get hasShare(){return!!Boolean(this.story.shareFunctional)&&this._hasShare}get hasFavorite(){return Boolean(this.story.favoriteFunctional)}get hasAudio(){return Boolean(this.story.hasAudio)}get context(){return this.story.context}get displayedSlides(){return this._displayedSlides}get activeSlideIndex(){return this._activeSlideIndex}get activeSlide(){return this.slides[this._activeSlideIndex]}get slidesCount(){return this.story.slidesCount}get hiddenTimeline(){return 1===this.story.slides.length&&0===this.story.slides[0].duration||this.story.hideTimeline||this._hiddenTimeline||!this.canBeShown}get displayedSlideImage(){return this.isBlank?null:this.story.getImagesPerSlide(this.activeSlideIndex)}get isBlank(){return this.story.id<0}get reachEnd(){return 0===this.slides.length||this._activeSlideIndex===this.slides.length-1}get reachStart(){return 0===this.activeSlideIndex}get disableClose(){return this.story.disableClose}get error(){return this.story.error}get timer(){return this._timer}nextSlide(){this.reachEnd||this.toSlide(this.activeSlideIndex+1)}prevSlide(){this.reachStart||this.toSlide(this.activeSlideIndex-1)}toSlide(e){e!==this.activeSlideIndex&&(this._activeSlideIndex=e,this.slideApiHandlers.changeActiveSlide(),this._displayedSlides=this.getDisplayedSlides(),this.timer.stop())}updateNavigationHistory(){this.navigationHistory.update(this)}async setLike(e){await this.story.setLike(e),this.storyManager.emitEvent(new wi(this,{value:1===e}))}async setDislike(e){await this.story.setLike(e),this.storyManager.emitEvent(new bi(this,{value:-1===e}))}async setBookmark(e){try{await this.story.setFavorite(e),this.storyManager.emitEvent(new yi(this,{value:e}))}catch(e){console.error(e)}}async share(){this.activeSlide&&(this.storyManager.emitEvent(new Si(this)),this.activeSlide.screenshotShare?this.sharePanel.shareScreenShot({shareId:"slide-screenshot-share",hideElementsSelector:"",storySlide:this.activeSlide}):await this.performShareText())}markAsOpened(){this.story.markIsOpened()}hideTimeline(){this._hiddenTimeline=!0}showTimeline(){this._hiddenTimeline=!1}setError(e){this.story.setError(e)}reset(){return this.slideApiHandlers.resetStory(this.id)}async reload(){return this.storyReader.reloadStory(this)}destroy(){var e;this.storySlidesReactionDisposer(),null===(e=this.activeSlide)||void 0===e||e.destroy()}pause(){this.timer.pause()}resume(){this.timer.resume()}enableTimer(){this.timer.enable()}disableTimer(){this.timer.disable()}completeNativeSharing(){this.sharePanel.completeNativeSharing({result:!1})}nextStory(e){this.storyReader.nextStoryWithAnimation(e)}prevStory(e){this.storyReader.prevStoryWithAnimation(e)}async updateNarrativeData(e){return this.story.updateNarrativeData(e)}getDisplayedSlides(){return this.slides.length===this.slidesCount?this.slides.slice(this._activeSlideIndex,this._activeSlideIndex+2):[new fn(this,0,this.storySlideRendererFactory,tr.createEmpty())]}createSlidesViewModels(e){this.slides.length!==this.slidesCount&&(this.slides=e.map(((e,t)=>new fn(this,t,this.storySlideRendererFactory,e))),this._displayedSlides=this.getDisplayedSlides())}async performShareText(){try{const e=await this.story.fetchStorySharePath();if(!e)return;this.storyManager.emitEvent(new _i(this,{url:e}));const t={title:this.story.title,text:"",url:e};this.sharePanel.shareText({shareId:"story-share",config:t,storySlide:this.activeSlide})}catch(e){console.error(e)}}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=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;s=[Pe.observable],n=[Pe.observable],o=[Pe.observable],l=[Pe.observable],d=[Pe.computed],c=[Pe.computed],u=[Pe.computed],h=[Pe.computed],p=[Pe.computed],g=[Pe.computed],f=[Pe.action],m=[Pe.action],v=[Pe.action],b=[Pe.action],y=[Pe.action],w=[Pe.action],S=[Pe.action],_=[Pe.action],Sn(e,null,s,{kind:"accessor",name:"_activeSlideIndex",static:!1,private:!1,access:{has:e=>"_activeSlideIndex"in e,get:e=>e._activeSlideIndex,set:(e,t)=>{e._activeSlideIndex=t}},metadata:r},x,k),Sn(e,null,n,{kind:"accessor",name:"_displayedSlides",static:!1,private:!1,access:{has:e=>"_displayedSlides"in e,get:e=>e._displayedSlides,set:(e,t)=>{e._displayedSlides=t}},metadata:r},P,j),Sn(e,null,o,{kind:"accessor",name:"_hiddenTimeline",static:!1,private:!1,access:{has:e=>"_hiddenTimeline"in e,get:e=>e._hiddenTimeline,set:(e,t)=>{e._hiddenTimeline=t}},metadata:r},M,E),Sn(e,null,l,{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:r},I,L),Sn(e,null,d,{kind:"getter",name:"displayedSlides",static:!1,private:!1,access:{has:e=>"displayedSlides"in e,get:e=>e.displayedSlides},metadata:r},null,C),Sn(e,null,c,{kind:"getter",name:"activeSlideIndex",static:!1,private:!1,access:{has:e=>"activeSlideIndex"in e,get:e=>e.activeSlideIndex},metadata:r},null,C),Sn(e,null,u,{kind:"getter",name:"activeSlide",static:!1,private:!1,access:{has:e=>"activeSlide"in e,get:e=>e.activeSlide},metadata:r},null,C),Sn(e,null,h,{kind:"getter",name:"hiddenTimeline",static:!1,private:!1,access:{has:e=>"hiddenTimeline"in e,get:e=>e.hiddenTimeline},metadata:r},null,C),Sn(e,null,p,{kind:"getter",name:"reachEnd",static:!1,private:!1,access:{has:e=>"reachEnd"in e,get:e=>e.reachEnd},metadata:r},null,C),Sn(e,null,g,{kind:"getter",name:"reachStart",static:!1,private:!1,access:{has:e=>"reachStart"in e,get:e=>e.reachStart},metadata:r},null,C),Sn(e,null,f,{kind:"method",name:"toSlide",static:!1,private:!1,access:{has:e=>"toSlide"in e,get:e=>e.toSlide},metadata:r},null,C),Sn(e,null,m,{kind:"method",name:"setLike",static:!1,private:!1,access:{has:e=>"setLike"in e,get:e=>e.setLike},metadata:r},null,C),Sn(e,null,v,{kind:"method",name:"setDislike",static:!1,private:!1,access:{has:e=>"setDislike"in e,get:e=>e.setDislike},metadata:r},null,C),Sn(e,null,b,{kind:"method",name:"setBookmark",static:!1,private:!1,access:{has:e=>"setBookmark"in e,get:e=>e.setBookmark},metadata:r},null,C),Sn(e,null,y,{kind:"method",name:"share",static:!1,private:!1,access:{has:e=>"share"in e,get:e=>e.share},metadata:r},null,C),Sn(e,null,w,{kind:"method",name:"markAsOpened",static:!1,private:!1,access:{has:e=>"markAsOpened"in e,get:e=>e.markAsOpened},metadata:r},null,C),Sn(e,null,S,{kind:"method",name:"hideTimeline",static:!1,private:!1,access:{has:e=>"hideTimeline"in e,get:e=>e.hideTimeline},metadata:r},null,C),Sn(e,null,_,{kind:"method",name:"showTimeline",static:!1,private:!1,access:{has:e=>"showTimeline"in e,get:e=>e.showTimeline},metadata:r},null,C),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class xn{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e){return new hn(this.narrativeDataCache,this.storyManager,this.storyReader,e)}}const kn=async e=>(await fetch(e)).blob(),Pn=async e=>{const t=await kn(e);return function(e,t=!0){return new Promise((function(r){var i=new FileReader;i.onloadend=function(){if(t){var e=String(i.result).replace("data:","").replace(/^.+,/,"");r(e)}else r(String(i.result))},i.readAsDataURL(e)}))}(new File([t],"image",{type:t.type,lastModified:(new Date).getTime()}),!1)};function jn(e,t,r,i){var a=e.indexOf(r,t);if(-1===a)return null;for(var s="",n=a+r.length;n<e.length&&-1===i.indexOf(e[n]);n++)s+=e[n];return{foundAtIndex:a,value:s}}function Mn(e,t){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e in t)r.setAttributeNS(null,e.replace(/[A-Z]/g,(function(e,t,r,i){return"-"+e.toLowerCase()})),t[e]);return r}var En,In;function Ln(e,t,r,i,a,s,n,o,l,d){var c=Mn("svg",{width:String(a),height:String(s),style:"background-color: #fff;"}),u=Mn("foreignObject",{x:"0",y:"0",width:"100%",height:"100%"});c.appendChild(u);try{u.style.fontSize=document.body.style.fontSize}catch(e){console.error(e)}!function(){const h=t.cloneNode(!0);if(null!=i&&"string"==typeof i&&i.length>0){const e=Array.prototype.slice.call(h.querySelectorAll(i));for(let t=0;t<e.length;t++){const r=e[t];r&&r.style&&r.style.setProperty&&r.style.setProperty("display","none")}}u.appendChild(h);var p=[];(function(e){for(var t=[],r=0;;){var i=jn(e,r,"src: url(",[" ",")","\t"]);if(null==i)break;r=i.foundAtIndex+i.value.length,t.push(i.value.replace(/["']/g,""))}return t})(r).forEach((function(e){p.push(new Promise((function(t,i){Pn(e).then((function(i){r=r.replace(e,i),t()})).catch((function(e){t()}))})))})),u.querySelectorAll("img").forEach((function(e){e.crossOrigin="Anonymous",p.push(new Promise((function(t,r){Pn(e.src).then((function(r){e.onload=r=>e.decode().then((()=>t())),e.onerror=e=>{console.error(e),t()},e.decoding="sync",e.src=r})).catch((function(e){t()}))})))})),u.querySelectorAll("video").forEach((function(e){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)})),u.querySelectorAll(".narrative-element-video").forEach((function(e){e.classList.add("init")})),Promise.all(p).then((function(){const t=Mn("style",{});t.textContent=r,c.appendChild(t);const i=(new XMLSerializer).serializeToString(c),u=new Image;u.onload=t=>{u.decode().then((function(){setTimeout((function(){const e=document.createElement("canvas"),t=e.getContext("2d");if(t){e.style.width=a+"px",e.style.height=s+"px",e.width=2*a,e.height=2*s,t.scale(2,2),t.drawImage(u,0,0);const r=e.toDataURL(n,o);kn(r).then((function(t){l(t),e.remove()}))}}),e===En.IOS?200:void 0)})).catch((e=>{console.log({image:u,encodingError:e},"onDecodeError"),d("error render svg image: "+e)}))},u.onerror=e=>{d("error render svg image: "+e)},u.setAttribute("crossOrigin","Anonymous"),u.crossOrigin="Anonymous",u.decoding="sync",u.src="data:image/svg+xml;base64,"+btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})))}))}()}function Tn(e,t,r,i){return new Promise((function(a,s){null==i&&(i=""),function(e,t,r,i,a,s){Ln(e,t,r,i,t.clientWidth,t.clientHeight,"image/jpeg",1,a,s)}(e,t,r,i,(function(e){a(new File([e],"image.jpeg",{type:e.type,lastModified:(new Date).getTime()}))}),(function(){console.error("Image fail");const e=new Error;e.name="ImageFail",s(e)}))}))}!function(e){e[e.IOS=0]="IOS",e[e.ANDROID=1]="ANDROID",e[e.OTHER=2]="OTHER"}(En||(En={})),function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(In||(In={}));class An{async getScreenShot({hideElementsSelector:e,slideContent:t}){const r=await Tn(En.IOS,t,function(e){let t="";return Array.prototype.slice.call(window.document.styleSheets).forEach((r=>{e(r)&&(t+=Array.prototype.slice.call(r.rules).map((e=>e.cssText)).join(""))})),t}((function(){return!0})),e);return{file:r,url:URL.createObjectURL(r)}}getNavigatorShareFunction(){var e,t;let r=null===(e=navigator.share)||void 0===e?void 0:e.bind(navigator);return!r&&(null===(t=window.parent)||void 0===t?void 0:t.navigator.share)&&(r=window.parent.navigator.share.bind(window.parent.navigator)),r}getFilteredConfigDto(e){const t={};for(const[r,i]of Object.entries(null!=e?e:{}))null!==i&&(t[r]=i);return t}}var Rn=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Dn=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Bn=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Fn=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Nn=(()=>{var e,t,r;let i,a,s,n,o,l,d=[],c=[],u=[],h=[],p=[];return e=class{get _isOpened(){return Bn(this,t,"f")}set _isOpened(e){Fn(this,t,e,"f")}get _params(){return Bn(this,r,"f")}set _params(e){Fn(this,r,e,"f")}constructor(e,i){Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:(Rn(this,d),e)}),Object.defineProperty(this,"sharingService",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"nativeSharingId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"nativeSharingRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),t.set(this,Rn(this,c,!1)),r.set(this,(Rn(this,u),Rn(this,h,{id:"",type:In.Social,link:""}))),Object.defineProperty(this,"currentStorySlide",{enumerable:!0,configurable:!0,writable:!0,value:(Rn(this,p),null)}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isOpened(){return this._isOpened}get params(){return this._params}open(e){this.storyReader.pauseTimer(),this._params={link:e.link,type:e.type,text:e.text,id:e.id},this._isOpened=!0}close(){this.storyReader.resumeTimer(),this._isOpened=!1,this._params={id:"",type:In.Social,link:""}}handleShareComplete(e,t){var r,i;const a=null!==(i=null===(r=this.currentStorySlide)||void 0===r?void 0:r.findAllWidgetsOfType((e=>e instanceof xa)))&&void 0!==i?i:[];for(const r of a)r.handleShareComplete({shareId:e,result:t});this.close()}async shareScreenShot({shareId:e,shareText:t,hideElementsSelector:r,storySlide:i}){let a=null;this.currentStorySlide=i;try{const s=await this.sharingService.getScreenShot({hideElementsSelector:r,slideContent:i.$el});a=s.url;const n={files:[s.file],text:t};if(this.desktopMode)return void this.open({type:In.SlideScreenshot,id:e,link:a,text:t});await this.startNativeSharing(e,n)}catch(r){console.error(r),a&&this.open({type:In.SlideScreenshot,id:e,link:a,text:t})}}async shareText({shareId:e,config:t,storySlide:r}){var i;this.currentStorySlide=r,null==e&&(e="story-share");const a=this.sharingService.getFilteredConfigDto(t),s=a.url=null!==(i=a.url)&&void 0!==i?i:a.text,n={type:In.Social,id:e,link:s};try{if(this.desktopMode)return void this.open(n);await this.startNativeSharing(e,a)}catch(e){this.open(n)}}async startNativeSharing(e,t){const r=this.sharingService.getNavigatorShareFunction();if(!r)throw new Error;try{this.storyReader.pauseTimer(),this.runNativeSharing({id:e}),await r(t),this.completeNativeSharing({result:!0})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;throw e}finally{this.completeNativeSharing({result:!1})}}runNativeSharing({id:e}){this.nativeSharingId=e,this.nativeSharingRunning=!0}completeNativeSharing({result:e}){this.nativeSharingRunning&&(this.handleShareComplete(this.nativeSharingId,e),this.nativeSharingRunning=!1,this.nativeSharingId="",this.storyReader.resumeTimer())}},t=new WeakMap,r=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;i=[Pe.observable],a=[Pe.observable],s=[Pe.computed],n=[Pe.computed],o=[Pe.action],l=[Pe.action],Dn(e,null,i,{kind:"accessor",name:"_isOpened",static:!1,private:!1,access:{has:e=>"_isOpened"in e,get:e=>e._isOpened,set:(e,t)=>{e._isOpened=t}},metadata:t},c,u),Dn(e,null,a,{kind:"accessor",name:"_params",static:!1,private:!1,access:{has:e=>"_params"in e,get:e=>e._params,set:(e,t)=>{e._params=t}},metadata:t},h,p),Dn(e,null,s,{kind:"getter",name:"isOpened",static:!1,private:!1,access:{has:e=>"isOpened"in e,get:e=>e.isOpened},metadata:t},null,d),Dn(e,null,n,{kind:"getter",name:"params",static:!1,private:!1,access:{has:e=>"params"in e,get:e=>e.params},metadata:t},null,d),Dn(e,null,o,{kind:"method",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open},metadata:t},null,d),Dn(e,null,l,{kind:"method",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close},metadata:t},null,d),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var Un=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Wn=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},zn=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Vn=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Gn=(()=>{var e,t,r,i;let a,s,n,o,l,d,c,u,h,p=[],g=[],f=[],m=[],v=[],b=[],y=[];return e=class{get _activeStory(){return zn(this,t,"f")}set _activeStory(e){Vn(this,t,e,"f")}get _currentIndex(){return zn(this,r,"f")}set _currentIndex(e){Vn(this,r,e,"f")}get _nextFlippingStoryIndex(){return zn(this,i,"f")}set _nextFlippingStoryIndex(e){Vn(this,i,e,"f")}constructor(e,a){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Un(this,p),e)}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:a}),t.set(this,Un(this,g,null)),r.set(this,(Un(this,f),Un(this,m,1))),i.set(this,(Un(this,v),Un(this,b,-1))),Object.defineProperty(this,"animatedTransitionAdapter",{enumerable:!0,configurable:!0,writable:!0,value:(Un(this,y),null)}),Object.defineProperty(this,"currentStoryDisplayStrategy",{enumerable:!0,configurable:!0,writable:!0,value:null})}get reachStart(){return 1===this._currentIndex}get reachEnd(){return this._currentIndex===this.storyReaderViewModel.stories.length-2}get nextFlippingStoryIndex(){return this._nextFlippingStoryIndex}get activeStory(){return this._activeStory}get currentIndex(){return this._currentIndex}setAnimatedTransitionAdapter(e){this.animatedTransitionAdapter=e}setCurrentStoryDisplayStrategy(e){this.currentStoryDisplayStrategy=e}nextStory(){var e;this.reachEnd||(null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex+1),this.currentStoryDisplayStrategy.handleNextStoryByIndex(this._currentIndex-1))}prevStory(){var e;this.reachStart||(null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex-1),this.currentStoryDisplayStrategy.handleNextStoryByIndex(this._currentIndex-1))}nextStoryWithAnimation(e){this.storyReaderViewModel.reachEnd?this.handleStoryReaderReachEnd(e):this.navigateStoryWithAnimation(this._currentIndex+1,e)}prevStoryWithAnimation(e){this.reachStart||this.navigateStoryWithAnimation(this.currentIndex-1,e)}destroy(){this._activeStory=null}setActiveStoryById(e){const t=this.storyReaderViewModel.stories;this._currentIndex=t.findIndex((t=>t.id===e)),this._activeStory=t[this._currentIndex]}resetActiveStory(){this._activeStory=null}navigateStoryWithAnimation(e,t="lastSlideClick"){this._nextFlippingStoryIndex=e,this.handleNextFlippingStoryIndexChange(e,t)}handleStoryReaderReachEnd(e){var t;"auto"!==e?this.storyReaderViewModel.close("lastSlideClick"):(null===(t=this.animatedTransitionAdapter)||void 0===t?void 0:t.options.closeOnLastSlideByTimer)&&this.storyReaderViewModel.close("auto")}async handleNextFlippingStoryIndexChange(e,t){var r;if(-1===e)return;const i=this.currentIndex<e?1:-1;await(null===(r=this.animatedTransitionAdapter)||void 0===r?void 0:r.transitionByDirection(i)),this.handleStoryFlippingTransitionEnd(e,t)}handleStoryFlippingTransitionEnd(e,t){this.storyReaderViewModel.emitCloseStoryEvent(t);1===(this.currentIndex<e?1:-1)?this.nextStory():this.prevStory(),this._nextFlippingStoryIndex=-1}setActiveStoryByIndex(e){this._currentIndex=e,this._activeStory=this.storyReaderViewModel.stories[this._currentIndex],this.handleActiveStoryError(this._activeStory)}handleActiveStoryError(e){e.error&&this.storyManager.emit("showStoryFailed",Object.assign({id:e.id,title:e.title},e.error))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;a=[Pe.observable],s=[Pe.observable],n=[Pe.observable],o=[Pe.computed],l=[Pe.computed],d=[Pe.action],c=[Pe.action],u=[Pe.action],h=[Pe.action],Wn(e,null,a,{kind:"accessor",name:"_activeStory",static:!1,private:!1,access:{has:e=>"_activeStory"in e,get:e=>e._activeStory,set:(e,t)=>{e._activeStory=t}},metadata:t},g,f),Wn(e,null,s,{kind:"accessor",name:"_currentIndex",static:!1,private:!1,access:{has:e=>"_currentIndex"in e,get:e=>e._currentIndex,set:(e,t)=>{e._currentIndex=t}},metadata:t},m,v),Wn(e,null,n,{kind:"accessor",name:"_nextFlippingStoryIndex",static:!1,private:!1,access:{has:e=>"_nextFlippingStoryIndex"in e,get:e=>e._nextFlippingStoryIndex,set:(e,t)=>{e._nextFlippingStoryIndex=t}},metadata:t},b,y),Wn(e,null,o,{kind:"getter",name:"reachStart",static:!1,private:!1,access:{has:e=>"reachStart"in e,get:e=>e.reachStart},metadata:t},null,p),Wn(e,null,l,{kind:"getter",name:"reachEnd",static:!1,private:!1,access:{has:e=>"reachEnd"in e,get:e=>e.reachEnd},metadata:t},null,p),Wn(e,null,d,{kind:"method",name:"nextStory",static:!1,private:!1,access:{has:e=>"nextStory"in e,get:e=>e.nextStory},metadata:t},null,p),Wn(e,null,c,{kind:"method",name:"prevStory",static:!1,private:!1,access:{has:e=>"prevStory"in e,get:e=>e.prevStory},metadata:t},null,p),Wn(e,null,u,{kind:"method",name:"nextStoryWithAnimation",static:!1,private:!1,access:{has:e=>"nextStoryWithAnimation"in e,get:e=>e.nextStoryWithAnimation},metadata:t},null,p),Wn(e,null,h,{kind:"method",name:"prevStoryWithAnimation",static:!1,private:!1,access:{has:e=>"prevStoryWithAnimation"in e,get:e=>e.prevStoryWithAnimation},metadata:t},null,p),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var $n,Hn,qn=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Qn=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Kn=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Yn=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};!function(e){e.RedirectToStory="redirectToStory",e.CloseStory="closeStory",e.ShowMultipleStories="showMultipleStories",e.ReloadStory="reloadStory"}($n||($n={})),function(e){e.Close="closeStoryReader"}(Hn||(Hn={}));let Jn=(()=>{var e,t,r,i,a,s;let n,o,l,d,c,u,h,p,g,f,m,v,b,y,w,S=le,_=[],O=[],C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[];return e=class extends S{get _uiPaused(){return Kn(this,t,"f")}set _uiPaused(e){Yn(this,t,e,"f")}get _muted(){return Kn(this,r,"f")}set _muted(e){Yn(this,r,e,"f")}get _timerPaused(){return Kn(this,i,"f")}set _timerPaused(e){Yn(this,i,e,"f")}get _closeGestureInAction(){return Kn(this,a,"f")}set _closeGestureInAction(e){Yn(this,a,e,"f")}get _stories(){return Kn(this,s,"f")}set _stories(e){Yn(this,s,e,"f")}constructor(n,o,l){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(qn(this,_),n)}),Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"storiesApi",{enumerable:!0,configurable:!0,writable:!0,value:l}),t.set(this,qn(this,O,!1)),r.set(this,(qn(this,C),qn(this,x,!0))),i.set(this,(qn(this,k),qn(this,P,!1))),a.set(this,(qn(this,j),qn(this,M,!1))),s.set(this,(qn(this,E),qn(this,I,Pe.observable.map()))),Object.defineProperty(this,"_uiLocked",{enumerable:!0,configurable:!0,writable:!0,value:(qn(this,L),!1)}),Object.defineProperty(this,"scrollbarHelper",{enumerable:!0,configurable:!0,writable:!0,value:new Us(window)}),Object.defineProperty(this,"_sourceInfo",{enumerable:!0,configurable:!0,writable:!0,value:{listType:At.DEFAULT,feedSlug:""}}),Object.defineProperty(this,"windowReferer",{enumerable:!0,configurable:!0,writable:!0,value:re.default}),Object.defineProperty(this,"currentStoryDisplayStrategy",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"navigationHistory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyDisplayStrategyFactory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_touchController",{enumerable:!0,configurable:!0,writable:!0,value:new Fa({touchStartTimeout:200})}),Object.defineProperty(this,"_sharePanelViewModel",{enumerable:!0,configurable:!0,writable:!0,value:new Nn(this,new An)}),Object.defineProperty(this,"navigationController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new cn}),this.navigationHistory=new Ti(this.storyManager,this),this.handleWindowUnload=this.handleWindowUnload.bind(this),this.handleEscKeydown=this.handleEscKeydown.bind(this),n.setViewModel(e.id,this),window.addEventListener("beforeunload",this.handleWindowUnload),this.storyDisplayStrategyFactory=new $i(n,this),this.handleVisibilityChange=this.handleVisibilityChange.bind(this),this.navigationController=new Gn(this.storyManager,this)}get nextFlippingStoryIndex(){return this.navigationController.nextFlippingStoryIndex}get sharePanel(){return this._sharePanelViewModel}get touchController(){return this._touchController}get feedSlug(){var e;return null!==(e=this.sourceInfo.feedSlug)&&void 0!==e?e:""}get sourceInfo(){return this._sourceInfo}get muted(){return this._muted}get uiPaused(){return this._uiPaused}get timerPaused(){return this._timerPaused}get closeGestureInAction(){return this._closeGestureInAction}get stories(){return Array.from(this._stories.values())}get activeStory(){return this.navigationController.activeStory}get isOpened(){return Boolean(this.navigationController.activeStory)}get activeStoryIndex(){return this.navigationController.currentIndex}get reachStart(){return this.navigationController.reachStart}get reachEnd(){return this.navigationController.reachEnd}getStatisticsData(){return this.statisticsService.getData()}cleanupStatisticsData(){return this.statisticsService.cleanupData()}open(e,t){this.resetReaderToDefaultState(),this.windowReferer=e.windowReferer,this.setScrollBar(e.windowReferer),this._sourceInfo=t,this.setStories(e.stories),this.navigationController.setActiveStoryById(e.id),this.navigationController.setCurrentStoryDisplayStrategy(this.currentStoryDisplayStrategy),this.statisticsService.init(t),this.storyManager.getConfig().enableStatistic(),this._touchController.init(document.body),document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("keydown",this.handleEscKeydown)}close(e="closeReaderByCloseBtn"){var t;this.activeStory&&!(null===(t=this.activeStory)||void 0===t?void 0:t.disableClose)&&(this.resetScrollBar(this.windowReferer),this.emit(Hn.Close),this.sourceInfo.listType===At.DEFAULT&&fi.emit(Hn.Close,{id:this.activeStory.id}),this.emitCloseStoryEvent(e),this.resetReaderToDefaultState(),this._sourceInfo={listType:At.DEFAULT,feedSlug:""},this.navigationController.destroy())}resetReaderToDefaultState(){if(this.isOpened){if(this.activeStory){const e=this.activeStory.id,t=this.activeStory.activeSlideIndex;fi.emit(Ei.CloseStoryReader,{storyId:e,slideIndex:t}),this.activeStory.markAsOpened()}this.resumeUI(),this.sharePanel.close(),this.navigationHistory.reset(),this.statisticsService.destroy(),this.clearStoryViewModels(),this._touchController.destroy(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("keydown",this.handleEscKeydown),this.navigationController.resetActiveStory()}}emitCloseStoryEvent(e){this.activeStory&&this.storyManager.emitEvent(new vi(this.activeStory,{action:e}))}canBeClosed(){return!(!this.activeStory||this.activeStory.isBlank)&&!this.activeStory.disableClose}async showStory(e){this.currentStoryDisplayStrategy=this.storyDisplayStrategyFactory.createShowStory(),await this.currentStoryDisplayStrategy.show({storyId:e})}async showStoryOnce(e){this.currentStoryDisplayStrategy=this.storyDisplayStrategyFactory.createShowStoryOnce(),await this.currentStoryDisplayStrategy.show({storyId:e})}async showStoryFromSharePage(e,t){try{const r=this.storyDisplayStrategyFactory.createShowStoryFromSharePage();return this.currentStoryDisplayStrategy=r,await r.show({storyId:e,fetchShareUrl:t}),t&&this.storyManager.getConfig().disableStatistic(),!0}catch(e){return!1}}async showOnboardingStories(e){const t=this.storyDisplayStrategyFactory.createShowOnboardingStories();return this.currentStoryDisplayStrategy=t,t.show(e)}async showMultipleStories(e){var t;const r=this.storyDisplayStrategyFactory.createShowMultipleStories();this.currentStoryDisplayStrategy=r,await r.show({storyId:e.storyId,storyFeed:e.storyFeed,windowReferer:null!==(t=e.windowReferer)&&void 0!==t?t:re.default,filter:e.filter})}async reloadStory(e){var t;e.setError(null),null===(t=this.currentStoryDisplayStrategy)||void 0===t||t.reload({storyId:e.id,feedType:this.sourceInfo.listType,feedSlug:this.sourceInfo.feedSlug})}nextStory(){return this.navigationController.nextStory()}prevStory(){return this.navigationController.prevStory()}nextStoryWithAnimation(e){return this.navigationController.nextStoryWithAnimation(e)}prevStoryWithAnimation(e){return this.navigationController.prevStoryWithAnimation(e)}navigateStoryWithAnimationByIndex(e,t){this.navigationController.navigateStoryWithAnimation(e,t)}destroy(){this.removeAllListeners(),window.removeEventListener("beforeunload",this.handleWindowUnload),this.storyManager.deleteViewModel(e.id)}closeGoodsWidget(){fi.emit("goodsWidget.close")}enableStoryTimer(){this._stories.forEach((e=>e.enableTimer()))}disableStoryTimer(){this._stories.forEach((e=>e.disableTimer()))}setAnimatedTransitionAdapter(e){this.navigationController.setAnimatedTransitionAdapter(e)}resumeTimer(){this._uiLocked=!1,this._timerPaused=!1}pauseTimer(){this._uiLocked=!0,this._timerPaused=!0}pauseUI(){this._uiPaused=!0,this.pauseTimer()}resumeUI(){this._uiPaused=!1,this.resumeTimer()}mute(){this._muted=!0}unmute(){this._muted=!1}enableCloseGesture(){this._closeGestureInAction=!0}disableCloseGesture(){this._closeGestureInAction=!1}setStories(e){const t=new nr({id:-1},this.storyManager.rootStore,this.storiesApi),r=new nr({id:-2},this.storyManager.rootStore,this.storiesApi);e=[t,...e,r];const i=new yn(this.storyManager,this,this._touchController),a=new xn(this.storyManager,this,this.narrativeDataCache);for(const t of e)this._stories.set(t.id,new Cn(this.storyManager,this,this._sharePanelViewModel,t,this.navigationHistory,i,a))}handleVisibilityChange(){"hidden"===document.visibilityState&&this.pauseTimerByVisibility(),"visible"===document.visibilityState&&this.resumeTimerByVisibility()}resumeTimerByVisibility(){this._uiLocked||(this._timerPaused=!1)}pauseTimerByVisibility(){this._uiLocked||(this._timerPaused=!0)}handleEscKeydown(e){27===e.keyCode&&this.close("closeReaderByEscBtn")}clearStoryViewModels(){for(const e of this._stories.values())e.destroy();this._stories=Pe.observable.map()}setScrollBar(e){e===re.default&&this.scrollbarHelper.setScrollbar()}resetScrollBar(e){e===re.default&&this.scrollbarHelper.resetScrollbar()}handleWindowUnload(e){this.activeStory&&(fi.emit(Ei.NextSlide,{fromStoryId:this.activeStory.id,fromSlideIndex:this.activeStory.activeSlideIndex}),this.statisticsService.sendData())}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=S[Symbol.metadata])&&void 0!==t?t:null):void 0;n=[Pe.observable],o=[Pe.observable],l=[Pe.observable],d=[Pe.observable],c=[Pe.observable],u=[Pe.computed],h=[Pe.computed],p=[Pe.action],g=[Pe.action],f=[Pe.action],m=[Pe.action],v=[Pe.action],b=[Pe.action],y=[Pe.action],w=[Pe.action],Qn(e,null,n,{kind:"accessor",name:"_uiPaused",static:!1,private:!1,access:{has:e=>"_uiPaused"in e,get:e=>e._uiPaused,set:(e,t)=>{e._uiPaused=t}},metadata:r},O,C),Qn(e,null,o,{kind:"accessor",name:"_muted",static:!1,private:!1,access:{has:e=>"_muted"in e,get:e=>e._muted,set:(e,t)=>{e._muted=t}},metadata:r},x,k),Qn(e,null,l,{kind:"accessor",name:"_timerPaused",static:!1,private:!1,access:{has:e=>"_timerPaused"in e,get:e=>e._timerPaused,set:(e,t)=>{e._timerPaused=t}},metadata:r},P,j),Qn(e,null,d,{kind:"accessor",name:"_closeGestureInAction",static:!1,private:!1,access:{has:e=>"_closeGestureInAction"in e,get:e=>e._closeGestureInAction,set:(e,t)=>{e._closeGestureInAction=t}},metadata:r},M,E),Qn(e,null,c,{kind:"accessor",name:"_stories",static:!1,private:!1,access:{has:e=>"_stories"in e,get:e=>e._stories,set:(e,t)=>{e._stories=t}},metadata:r},I,L),Qn(e,null,u,{kind:"getter",name:"stories",static:!1,private:!1,access:{has:e=>"stories"in e,get:e=>e.stories},metadata:r},null,_),Qn(e,null,h,{kind:"getter",name:"isOpened",static:!1,private:!1,access:{has:e=>"isOpened"in e,get:e=>e.isOpened},metadata:r},null,_),Qn(e,null,p,{kind:"method",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open},metadata:r},null,_),Qn(e,null,g,{kind:"method",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close},metadata:r},null,_),Qn(e,null,f,{kind:"method",name:"reloadStory",static:!1,private:!1,access:{has:e=>"reloadStory"in e,get:e=>e.reloadStory},metadata:r},null,_),Qn(e,null,m,{kind:"method",name:"nextStory",static:!1,private:!1,access:{has:e=>"nextStory"in e,get:e=>e.nextStory},metadata:r},null,_),Qn(e,null,v,{kind:"method",name:"prevStory",static:!1,private:!1,access:{has:e=>"prevStory"in e,get:e=>e.prevStory},metadata:r},null,_),Qn(e,null,b,{kind:"method",name:"nextStoryWithAnimation",static:!1,private:!1,access:{has:e=>"nextStoryWithAnimation"in e,get:e=>e.nextStoryWithAnimation},metadata:r},null,_),Qn(e,null,y,{kind:"method",name:"prevStoryWithAnimation",static:!1,private:!1,access:{has:e=>"prevStoryWithAnimation"in e,get:e=>e.prevStoryWithAnimation},metadata:r},null,_),Qn(e,null,w,{kind:"method",name:"navigateStoryWithAnimationByIndex",static:!1,private:!1,access:{has:e=>"navigateStoryWithAnimationByIndex"in e,get:e=>e.navigateStoryWithAnimationByIndex},metadata:r},null,_),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),Object.defineProperty(e,"id",{enumerable:!0,configurable:!0,writable:!0,value:"StoryReaderViewModel"}),e})();class Zn{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){const e=new Li(this.storyManager),t=new Ii(this.storyManager,e);return new Jn(this.storyManager,t,new Ht(this.storyManager))}}class Xn{constructor(e,t){Object.defineProperty(this,"animatedSlider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t})}transitionByDirection(e){return this.animatedSlider.transformWithAmimation(e)}}class eo{constructor(e){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_mode",{enumerable:!0,configurable:!0,writable:!0,value:gs.None}),Object.defineProperty(this,"_defaultPrevented",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_direction",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._direction=this.calcDirection()}get mode(){return this._mode}get direction(){return this._direction}get defaultPrevented(){return this._defaultPrevented||this.slide.navigationDisabled}get navigationDisabled(){return!1}preventDefault(){this._defaultPrevented=!0}disableNextClick(){this._mode=gs.DisableNext}navigate(){this.direction<0?this.toPrev():this.mode!==gs.DisableNext&&this.toNext()}toPrev(){}toNext(){}calcClickPosition(){return.3}calcDirection(){return this.calcClickPosition()<=.3?-1:1}}var to=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},ro=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};let io=(()=>{var e;let t,r=le,i=[];return e=class extends r{constructor(e,t,r){super(),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:(to(this,i),e)}),Object.defineProperty(this,"iamMessageSlide",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"messageSlideRendererFactory",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"slideRenderer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.slideRenderer=this.messageSlideRendererFactory.create({slide:this,message:this.message}),this.handleDocumentVisibilityChange=this.handleDocumentVisibilityChange.bind(this)}get isLoading(){return this.slideRenderer.state===ms.Loading}get html(){return this.iamMessageSlide.html}get state(){return this.slideRenderer.state}get navigationDisabled(){return this.slideRenderer.navigationDisabled}async init(e){return this.slideRenderer.init(e)}async start(){return document.addEventListener("visibilitychange",this.handleDocumentVisibilityChange),this.slideRenderer.start()}async reload(){return this.slideRenderer.reload()}stop(){return document.removeEventListener("visibilitychange",this.handleDocumentVisibilityChange),this.slideRenderer.stop()}pause(){return this.slideRenderer.pause()}resume(){return this.slideRenderer.resume()}pauseAndLock(){return this.locked=!0,this.pause()}resumeAndUnlock(){return this.locked=!1,this.resume()}mute(){this.slideRenderer.mute()}unmute(){this.slideRenderer.unmute()}onClick(e){const t=new eo(this);this.slideRenderer.onClick({target:e,navigationController:t})}onLinkClick(e){this.slideRenderer.onClickLinkElement(e.target)}async showLayerByIndex(e){try{await this.slideRenderer.showLayerByIndex(e)}catch(e){}}destroy(){return this.slideRenderer.stop()}showToast(e){new Na(Object.assign({getMountPoint:()=>this.slideRenderer.$el},e))}handleDocumentVisibilityChange(){this.locked||("hidden"===document.visibilityState&&this.pause(),"visible"===document.visibilityState&&this.resume())}},(()=>{var a;const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(a=r[Symbol.metadata])&&void 0!==a?a:null):void 0;t=[Pe.computed],ro(e,null,t,{kind:"getter",name:"isLoading",static:!1,private:!1,access:{has:e=>"isLoading"in e,get:e=>e.isLoading},metadata:s},null,i),s&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})})(),e})();class ao{constructor(e,t,r,i){Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"iamMessage",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"deferredActionsQueue",{enumerable:!0,configurable:!0,writable:!0,value:new un}),Object.defineProperty(this,"activeMessageNarrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new cn}),Object.defineProperty(this,"execCalled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}exec(){this.activeMessageNarrativeDataCache.clear(),this.deferredActionsQueue.exec(),this.deferredActionsQueue.flush(),this.execCalled=!0}changeActiveSlide(){this.execCalled=!1}async getCardLocalData(){let e=this.narrativeDataCache.get(`iam_${this.iamMessage.id}_data_${this.storyManager.rootStore.sessionStore.userId}`);return e?JSON.parse(e):{}}setCardLocalData(e,t){let r=JSON.stringify(e);this.narrativeDataCache.set(`iam_${this.iamMessage.id}_data_${this.storyManager.rootStore.sessionStore.userId}`,r),t&&this.iamMessage.updateUserData(r).catch(console.error)}getCardServerData(e){var t,r;return null!==(r=null===(t=this.iamMessage.context.widgetsData._narrative_saved_data)||void 0===t?void 0:t[e])&&void 0!==r?r:null}updateCardServerData(e,t){this.iamMessage.context.widgetsData._narrative_saved_data=t}getSlideDuration(e,t){var r,i,a;return null!==(a=null===(i=null===(r=this.iamMessage.context.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[e])||void 0===i?void 0:i[t])&&void 0!==a?a:null}pauseUI(){this.iamMessage.activeSlide.pause()}resumeUI(){this.iamMessage.activeSlide.resume()}showCardTextInput(e,t){}setCardSessionValue(e,t){this.activeMessageNarrativeDataCache.set(e,t)}getCardSessionValue(e){return this.activeMessageNarrativeDataCache.get(e)}getWidgetsSharedData(e,t){var r,i,a;const s=this.iamMessage.context.widgetsData;switch(t){case"rangeSlider":return null===(r=s._narrative_range_slider_data)||void 0===r?void 0:r[e];case"poll":return null===(i=s._narrative_poll_data)||void 0===i?void 0:i[e];case"vote":return null===(a=s._narrative_vote_data)||void 0===a?void 0:a[e]}return null}openUrl(e){window.open(e,"_parent")}async sendApiRequest(e,t,r,i,a,s){var n,o,l;try{const s=await Ce.request({url:e,method:t,params:null!=r?r:{},headers:null!=i?i:{},data:null!=a?a:{}});return{status:s.status,headers:s.headers,data:s.data}}catch(e){if(e instanceof fe)return{status:null!==(n=e.networkStatus)&&void 0!==n?n: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.iamMessage.activeSlide.showLayerByIndex(e)}showCardSlide(e){}cardShowNext(){}showNextSlide(e){}sendStatisticEvent(e,t,r){let i=null;switch(e){case"w-copy":i=new Fr(r.widget_id,r.widget_value,r.widget_label);break;case"w-share":i=new zr(r.widget_id,r.widget_answer,r.widget_label,r.widget_value,r.widget_answer_label);break;case"w-rate-answer":i=new Wr(r.widget_id,r.widget_answer,r.widget_label,r.widget_value);break;case"w-range-slider-answer":i=new Ur(r.widget_id,r.widget_answer,r.widget_label)}i&&(this.iamMessage.trackWidgetEvent(i),this.iamReader.emitWidgetEvent(i))}destroy(){}async resetCard(e){}pushToDefferedActionsQueueOrExec(e){this.execCalled?e():this.deferredActionsQueue.push(e)}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:[]}updateTimeline(e,t,r,i,a,s){}showToast(e){this.iamMessage.activeSlide.showToast({content:e})}}class so extends le{constructor(e,t,r,i){super(),Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"iamMessage",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_openTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new cn}),this.slideApiHandlers=new ao(this.narrativeDataCache,this.storyManager,this.iamReader,this),this._slides=this.iamMessage.slides.map((e=>new io(this,e,i)))}get id(){return this.iamMessage.id}get activeSlideIndex(){return this.iamMessage.activeSlideIndex}get activeSlide(){return this.slides[this.activeSlideIndex]}get openTime(){return this._openTime}get slides(){return this._slides}get context(){return this.iamMessage.context}get appearanceOptions(){return this.iamMessage.appearanceOptions}get type(){return this.iamMessage.type}async trackOpen(){await this.iamMessage.trackOpen()}async trackClose(){await this.iamMessage.trackClose()}async trackWidgetEvent(e){await this.iamMessage.trackWidgetEvent(e)}async updateUserData(e){return this.iamMessage.updateUserData(e)}toPublicDto(){return this.iamMessage.toPublicDto()}destroy(){}}class no{constructor(e){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){this.iamReader.close()}}class oo{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamMessage",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"messageSlide",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){var t;this.iamMessage.trackWidgetEvent(new Nr(e.elementId,e.linkTarget,""));try{await this.storyManager.openGame(e.linkTarget),this.messageSlide.pauseAndLock(),null===(t=this.storyManager.gameReaderViewModel)||void 0===t||t.once(Ws.Close,(()=>{this.messageSlide.resumeAndUnlock()}))}catch(e){console.error(e)}}}class lo{constructor(e,t,r){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"iamMessage",{enumerable:!0,configurable:!0,writable:!0,value:r})}handle(e){const t=decodeURIComponent(e.linkTarget);this.emitWidgetEvent(t,e.elementId),this.emitClickOnButtonEvent(t,e.elementId)}emitWidgetEvent(e,t){const r=new Nr(t,e,"");this.iamMessage.trackWidgetEvent(r),this.iamReader.emitWidgetEvent(r)}emitClickOnButtonEvent(e,t){const r=this.getClickOnButtonEventPayload(e,t);this.iamReader.emit(mo.ClickOnButton,r),this.storyManager.clickOnButtonAction({src:Q.IAM_READER,payload:r})}getClickOnButtonEventPayload(e,t){return{id:this.iamMessage.id,index:this.iamMessage.activeSlideIndex,url:e,elementId:t}}}class co{constructor(e,t,r){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"messageSlide",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){const t=parseInt(e.linkTarget);try{await this.storyManager.showStory(t),this.messageSlide.pauseAndLock(),this.storyManager.storyReaderViewModel.once(Hn.Close,(()=>{this.messageSlide.resumeAndUnlock()}))}catch(e){console.error(e)}}}class uo{handle(e){console.log(`There is no action handler for <${e.linkType}:${e.linkTarget}>`)}}class ho{constructor(e,t,r,i){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"messageSlide",{enumerable:!0,configurable:!0,writable:!0,value:i})}create(e){switch(e){case"url":return new lo(this.iamReader,this.storyManager,this.message);case"story":return new co(this.iamReader,this.storyManager,this.messageSlide);case"game":return new oo(this.storyManager,this.message,this.messageSlide);case"closeIAM":return new no(this.iamReader)}return new uo}}class po{constructor(e,t,r){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:r})}onSlideBeforeInit(){}onSlideAfterInit(){}async onSlideStarted(){this.slideApiHandlers.exec()}onSlideStop(){}onSlideStateChanged(e){}onSlideLoadStart(){}onSlideLoadEnd(){}onSlideResume(){}onSlidePause(){}onSlideVideoError(){}onSlideDestroy(){}}class go{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r})}create({slide:e,message:t}){const r=new Hi,i=new ia(t.slideApiHandlers),a=new Xs(new ho(this.storyManager,this.iamReader,t,e)),s=(0,ea.getSlideApi)(t.slideApiHandlers),n=new Os(new po(e,t,t.slideApiHandlers),i,s.Animation,r,a);return this.registerWidgets({widgetManager:i,slideApi:s,message:t,slide:e}),n}registerWidgets({widgetManager:e,slideApi:t,message:r,slide:i}){e.registerManyFactories([new La(t),new na(t),new la(t),new ca(t),new Aa(t),new ha(t),new ga(t),new _a(this.touchController,t),new Ca(t),new ka(t),new ps(t,this.touchController,i),new Ea(t)])}}class fo extends Error{constructor(e){super(`[IAM]: you must close IAM with ID ${e}`),this.name="IamMessageOpenError"}}var mo,vo=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},bo=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},yo=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},wo=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};!function(e){e.Loaded="loaded",e.Close="close",e.WidgetEvent="widgetEvent",e.ClickOnButton="clickOnButton"}(mo||(mo={}));let So=(()=>{var e,t;let r,i,a,s,n=le,o=[],l=[],d=[];return e=class extends n{get _activeMessage(){return yo(this,t,"f")}set _activeMessage(e){wo(this,t,e,"f")}constructor(r,i,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(vo(this,o),r)}),Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"iamDisplayService",{enumerable:!0,configurable:!0,writable:!0,value:a}),t.set(this,vo(this,l,null)),Object.defineProperty(this,"visibilityObserver",{enumerable:!0,configurable:!0,writable:!0,value:vo(this,d)}),Object.defineProperty(this,"_touchController",{enumerable:!0,configurable:!0,writable:!0,value:new Fa}),Object.defineProperty(this,"scrollbarHelper",{enumerable:!0,configurable:!0,writable:!0,value:new Us(window)}),Object.defineProperty(this,"eventPublisher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storyManager.setViewModel(e.id,this),this.visibilityObserver=new ai(this)}get touchController(){return this._touchController}get activeMessage(){return this._activeMessage}get isLoaded(){return this.iamStore.isLoaded}get isLoading(){return this.iamStore.isLoading}get isOpened(){return Boolean(this._activeMessage)}async preload(e){await this.storyManager.waitStoryManagerConfig();return await this.iamStore.preload(e)}async showMessageById(e,t){await this.storyManager.waitStoryManagerConfig(),this.checkMessageNotOpened();const r=await this.iamDisplayService.getMessageById(e,t);return await this.open(r),r}async showMessageByEvent(e,t){await this.storyManager.waitStoryManagerConfig(),this.checkMessageNotOpened();const r=await this.iamDisplayService.getMessageByEvent(e,t);return await this.open(r),r}async close(){this._activeMessage&&(this.emitCloseEvent(this._activeMessage),this.clearActiveMessage(),this.visibilityObserver.unsubscribe(),this.touchController.destroy(),this.scrollbarHelper.resetScrollbar())}async open(e){e.updatePlaceholders(this.storyManager.rootStore.placeholderStore.placeholders),this.touchController.init(document.body),this.setActiveMessage(e),this.visibilityObserver.subscribe(),this.scrollbarHelper.setScrollbar()}destroy(){this.storyManager.deleteViewModel(e.id)}emitWidgetEvent(e){this.emit(mo.WidgetEvent,{message:this.activeMessage.toPublicDto(),name:e.type,data:e.toJSON()})}setEventPublisher(e){this.eventPublisher=e}emit(e,...t){return super.emit(e,...t),this.eventPublisher.emit(e,...t)}emitCloseEvent(e){this.emit(mo.Close,{message:e.toPublicDto()})}setActiveMessage(e){const t=this.createIamMessageViewModel(e);t.trackOpen(),this._activeMessage=t}clearActiveMessage(){this._activeMessage&&(this._activeMessage.trackClose(),this._activeMessage=null)}createIamMessageViewModel(e){const t=new go(this.storyManager,this,this.touchController);return new so(this,this.storyManager,e,t)}checkMessageNotOpened(){if(this.activeMessage)throw new fo(this.activeMessage.id)}},t=new WeakMap,(()=>{var t;const c="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=n[Symbol.metadata])&&void 0!==t?t:null):void 0;r=[Pe.observable],i=[Pe.action],a=[Pe.action],s=[Pe.action],bo(e,null,r,{kind:"accessor",name:"_activeMessage",static:!1,private:!1,access:{has:e=>"_activeMessage"in e,get:e=>e._activeMessage,set:(e,t)=>{e._activeMessage=t}},metadata:c},l,d),bo(e,null,i,{kind:"method",name:"showMessageById",static:!1,private:!1,access:{has:e=>"showMessageById"in e,get:e=>e.showMessageById},metadata:c},null,o),bo(e,null,a,{kind:"method",name:"showMessageByEvent",static:!1,private:!1,access:{has:e=>"showMessageByEvent"in e,get:e=>e.showMessageByEvent},metadata:c},null,o),bo(e,null,s,{kind:"method",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close},metadata:c},null,o),c&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:c})})(),Object.defineProperty(e,"id",{enumerable:!0,configurable:!0,writable:!0,value:"IamReaderViewModel"}),e})();class _o{constructor(t){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"eventEmitter",{enumerable:!0,configurable:!0,writable:!0,value:new e.default}),this.iamReader.setEventPublisher(this.eventEmitter)}get activeMessage(){var e;return null===(e=this.iamReader.activeMessage)||void 0===e?void 0:e.toPublicDto()}get isLoaded(){return this.iamReader.isLoaded}get isLoading(){return this.iamReader.isLoading}get isOpened(){return this.iamReader.isOpened}async preload(e){const t=(await this.iamReader.preload({tags:null==e?void 0:e.tags})).map((e=>e.toPublicDto()));return this.eventEmitter.emit(mo.Loaded,{messages:t}),t}async showMessageById(e,t){return(await this.iamReader.showMessageById(e,{showOnlyIfLoaded:null==t?void 0:t.showOnlyIfLoaded})).toPublicDto()}async showMessageByEvent(e,t){return(await this.iamReader.showMessageByEvent(e,{showOnlyIfLoaded:null==t?void 0:t.showOnlyIfLoaded,tags:null==t?void 0:t.tags})).toPublicDto()}async close(){return this.iamReader.close()}on(e,t){return this.eventEmitter.on(e,t),this}once(e,t){return this.eventEmitter.once(e,t),this}off(e,t){return this.eventEmitter.off(e,t),this}}class Oo{constructor(e,t){var r,i,a,s,n,o;Object.defineProperty(this,"storyFeed",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSwipeUp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isOpened",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"hideTimeline",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.id=e.id,this.title=e.title,this.titleColor=e.titleColor,this.hasAudio=null!==(r=e.hasAudio)&&void 0!==r&&r,this.hasSwipeUp=null!==(i=e.hasSwipeUp)&&void 0!==i&&i,this.isOpened=e.isOpened,this.deeplink=null!==(a=e.deeplink)&&void 0!==a?a:void 0,this.gameInstanceId=null!==(n=null===(s=e.gameInstance)||void 0===s?void 0:s.id)&&void 0!==n?n:void 0,this.hideInReader=null!==(o=e.hideInReader)&&void 0!==o&&o,this.hideTimeline=e.hideTimeline,this.isOpened=e.isOpened,this.story=e}getCover(e){var t,r,i,a;return{imageSrc:null===(r=null===(t=this.story.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url,videoSrc:null!==(i=this.story.videoCoverSrc)&&void 0!==i?i:void 0,backgroundColor:this.story.backgroundColor,feedCoverSrc:null===(a=this.storyFeed)||void 0===a?void 0:a.coverSrc}}}var Co=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},xo=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},ko=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Po=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let jo=(()=>{var e,t;let r,i,a=le,s=[],n=[],o=[];return e=class extends a{get topStory(){return ko(this,t,"f")}set topStory(e){Po(this,t,e,"f")}constructor(e,r={feed:"default"}){var i;super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Co(this,s),e)}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"storyModels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"unreadedStoryModels",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"storiesReactionDisposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"feed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,Co(this,n,null)),Object.defineProperty(this,"_activeIndex",{enumerable:!0,configurable:!0,writable:!0,value:(Co(this,o),-1)}),this.storiesReactionDisposer=(0,Pe.reaction)((()=>{var e;return null===(e=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(this.options.feed))||void 0===e?void 0:e.stories}),(e=>{e&&this.handleStoriesChange(e)})),this.feed=null!==(i=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(this.options.feed))&&void 0!==i?i:void 0}get stories(){return this.storyModels.map((e=>this.createStackFeedStoryByModel(e)))}get length(){return this.storyModels.length}get activeIndex(){return this._activeIndex}get feedCoverSrc(){var e;return null===(e=this.feed)||void 0===e?void 0:e.coverSrc}get top(){return this.topStory}reload(){this.storyModels=[],this.unreadedStoryModels=new Map}destroy(){this.storiesReactionDisposer(),this.emit("destroy")}markStoryAsOpened(e){this.unreadedStoryModels.delete(e),this.resetUnreadedStories(),this.update()}resetUnreadedStories(){0===this.unreadedStoryModels.size&&(this.unreadedStoryModels=new Map(this.storyModels.map((e=>[e.id,e]))))}handleStoriesChange(e){this.storyModels=e.slice(),this.resetUnreadedStories(),this.update()}createStackFeedStoryByModel(e){return new Oo(e,this.feed)}update(){const e=this.unreadedStoryModels.values().next().value;if(!e)throw new Error("[StackedStoryList]: Empty stacked story list");this._activeIndex=this.storyModels.indexOf(e),this.topStory=this.createStackFeedStoryByModel(e),this.onUpdateTopStory(this.topStory),this.emit("update",this.topStory)}},t=new WeakMap,(()=>{var t;const l="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=a[Symbol.metadata])&&void 0!==t?t:null):void 0;r=[Pe.observable],i=[Pe.computed],xo(e,null,r,{kind:"accessor",name:"topStory",static:!1,private:!1,access:{has:e=>"topStory"in e,get:e=>e.topStory,set:(e,t)=>{e.topStory=t}},metadata:l},n,o),xo(e,null,i,{kind:"getter",name:"top",static:!1,private:!1,access:{has:e=>"top"in e,get:e=>e.top},metadata:l},null,s),l&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})})(),e})();class Mo extends jo{constructor(e,t){super(e,t),Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:new Qo}),Object.defineProperty(this,"firstStoryShown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._id=(0,he.v4)(),this.handleShowStory=this.handleShowStory.bind(this),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.handleEventBusEvents=this.handleEventBusEvents.bind(this),this.subscribeToStoryReader(),this.subscribeToFeedCoverageAnalytics(),this.storyManager.setViewModel(this._id,this)}async reload(){return this.firstStoryShown=!1,super.reload(),this.loadStories()}destroy(){const e=this.storyManager.storyReaderViewModel;null==e||e.off("showStory",this.handleShowStory),null==e||e.off(Hn.Close,this.handleCloseStoryReader),fi.off("openGame",this.handleShowStory),fi.off("clickOnStoryDeepLink",this.handleShowStory),this.feedCoverageAnalyticsCalculator.destroy(),super.destroy(),this.storyManager.deleteViewModel(this._id)}showStory(e){var t;const r=$l.instance,i=(0,Be.default)(e.deeplink)&&e.deeplink.trim().length>0,a=e.gameInstanceId;if(!e.hideInReader||i||a){if(i&&null!==e.deeplink){const t={index:0,id:e.id,story:e,isDeeplink:!0,url:e.deeplink};return r.clickOnButtonAction({src:Q.STACK_STORY_LIST,payload:t}),void this.markStoryAsOpened(e.id)}if(a)return r.openGame(a).catch(console.error),void this.markStoryAsOpened(e.id);null===(t=this.storyManager.storyReaderViewModel)||void 0===t||t.showMultipleStories({storyId:e.id,storyFeed:this.feed,windowReferer:re.stacked}),this.markStoryAsOpened(e.id)}else console.error("[StackedStoryList]: Cannot open hidden story id "+e.id)}handleCloseStoryReader(){this.top&&this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(this.top.id)}markStoryAsOpened(e){this.storyManager.rootStore.storyStore.findStoryById(e).markIsOpened(),this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e),super.markStoryAsOpened(e)}onUpdateTopStory(e){this.firstStoryShown||(this.firstStoryShown=!0,this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e.id))}async subscribeToStoryReader(){try{const e=this.storyManager.storyReaderViewModel;fi.on("openGame",this.handleEventBusEvents),fi.on("clickOnStoryDeepLink",this.handleEventBusEvents),null==e||e.on("showStory",this.handleShowStory),null==e||e.on(Hn.Close,this.handleCloseStoryReader)}catch(e){console.error("[StackedStoryList]: error while story reader init")}}handleShowStory({id:e}){this.markStoryAsOpened(e)}handleEventBusEvents({id:e}){this.markStoryAsOpened(e)}async loadStories(){try{this.emit("startLoad"),await this.storyManager.rootStore.storyFeedStore.fetchDefaultFeed({feedSlug:this.options.feed}),this.emit("endLoad")}catch(e){console.error("[StackedStoryList]: error while story list loaded")}}subscribeToFeedCoverageAnalytics(){const e=new Jo(this.storyManager,{listType:At.DEFAULT,feed:this.options.feed,filter:{}});this.feedCoverageAnalyticsCalculator.on("feedImpression",e.handle)}}class Eo{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}createStoryReader(){return new Zn(this.storyManager).create()}createGameReader(){return new qs(this.storyManager).create()}createStoryList(){return new Go(this.storyManager).create()}createInAppMessagingReader(){const e=this.storyManager.rootStore.iamStore;return new So(this.storyManager,e,new ei(this.storyManager,e,new dt(this.storyManager)))}}class Io extends le{constructor(e,t){super(),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"videoCoverSrc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"videoCover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=this.story.id,this.title=this.story.title,this.titleColor=this.story.titleColor,this.background=this.story.background,this.backgroundColor=this.story.backgroundColor,this.deeplink=this.story.deeplink,this.hideInReader=this.story.hideInReader,this.gameInstance=this.story.gameInstance,this.hasAudio=this.story.hasAudio,this.image=this.story.image,this.videoCover=this.story.videoCover,this.videoCoverSrc=this.story.videoCoverSrc}get like(){return this.story.like}get favorite(){return this.story.favorite}get isOpened(){return this.story.isOpened}getAspectRatio(e){var t,r;switch(e){case X.STYLE_CIRCLE:case X.STYLE_QUAD:return 1;case X.STYLE_RECTANGLE:return null!==(r=null===(t=this.storyListViewModel.session)||void 0===t?void 0:t.previewAspectRatio)&&void 0!==r?r:.8;default:return 1}}getImageSrcByCoverQuality(e){var t,r;return null===(r=null===(t=this.story.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url}onClick(e){this.storyListViewModel.onStoryClick(this,e)}destroy(){}}class Lo extends Io{static create(e,t,r,i){var a;const s=new nr({id:-100,title:null!==(a=e.title.content)&&void 0!==a?a:"",title_color:e.title.color,is_opened:!1,background_color:e.backgroundColor,image:Lo.getBgImage(e)},r,i);return new Lo(t,s)}static getBgImage(e){let t=[];return e.image&&e.image.svgSrc&&e.image.svgSrc.baseState&&t.push({width:100,height:100,type:"h",url:`data:image/svg+xml,${Le(e.image.svgSrc.baseState)}`}),t}}class To{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.createFunctionWithTimeout=this.createFunctionWithTimeout.bind(this)}handle(e,t){this.storyManager.rootStore.storyStore.findStoryById(e.id).markIsOpened(),this.handleClickOnStoryCardDeepLink({id:e.id,index:t.index,isDeeplink:!0,url:e.deeplink},{listType:this.storyListViewModel.params.listType})}handleClickOnStoryCardDeepLink(e,{listType:t}){const r={data:[[1,0,e.id,0,0]]},i=()=>{e.isDeeplink&&e.url&&this.storyManager.clickOnButtonAction({src:Q.STORY_LIST,payload:e})};t===At.UGC||this.storyManager.getConfig().isStatisticsDisabled?i():Oe("session/update",r,this.createFunctionWithTimeout(i,1e3))}createFunctionWithTimeout(e,t){let r=!1;function i(){r||(r=!0,e())}return setTimeout(i,t||1e3),i}}class Ao{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){var r;this.storyManager.rootStore.storyStore.findStoryById(e.id).markIsOpened();const i=null===(r=e.gameInstance)||void 0===r?void 0:r.id;this.storyManager.gameReaderViewModel.openGame(i,{})}}class Ro{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){const r=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(this.storyListViewModel.params.feedSlug),i={storyId:e.id,storyFeed:r,windowReferer:this.storyListViewModel.params.isFavorite?re.favorite:re.default};this.openStoryReader(i),this.emitClickOnStory({id:e.id,index:t.index,isDeeplink:!1,storyFeed:r,filter:this.storyListViewModel.params.filter})}async openStoryReader(e){try{await this.storyManager.storyReaderViewModel.showMultipleStories({storyId:e.storyId,storyFeed:e.storyFeed,filter:this.storyListViewModel.params.filter,windowReferer:e.windowReferer})}catch(e){console.error(e)}}emitClickOnStory(e){const t=e.storyFeed,r=t.slug,i=e.filter,a=t.getStoryById(e.id),s={title:null,tags:[],slidesCount:null,feed:null,filter:null,source:null};s.title=a.statTitle,s.tags=a.tags,s.slidesCount=a.slidesCount,t.type===At.DEFAULT?s.feed=r:t.type===At.UGC&&(s.filter=i),s.source=te.list,this.storyManager.emit("clickOnStory",Object.assign({id:e.id,index:e.index,isDeeplink:e.isDeeplink},s))}}class Do{static createHandler(e,t,r){const{deeplink:i,hideInReader:a,gameInstance:s}=e,n=(0,Be.default)(i)&&i.trim().length>0,o=null==s?void 0:s.id;return this.isInvalidStoryClick(Boolean(a),n,o,e.id)?null:n?new To(t,r):o?new Ao(t,r):new Ro(t,r)}static isInvalidStoryClick(e,t,r,i){return!(!e||t||r)&&(console.error(`Cannot open hidden story id ${i}`),!0)}}var Bo=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Fo=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},No=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Uo=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Wo=(()=>{var e,t,r,i,a;let s,n,o,l,d,c,u,h,p,g,f,m,v,b=le,y=[],w=[],S=[],_=[],O=[],C=[],x=[],k=[],P=[];return e=class extends b{get _modeDesktop(){return No(this,t,"f")}set _modeDesktop(e){Uo(this,t,e,"f")}get ugcCardOptions(){return No(this,r,"f")}set ugcCardOptions(e){Uo(this,r,e,"f")}get favoriteCardOptions(){return No(this,i,"f")}set favoriteCardOptions(e){Uo(this,i,e,"f")}get _params(){return No(this,a,"f")}set _params(e){Uo(this,a,e,"f")}set modeDesktop(e){this._modeDesktop!==e&&(this._modeDesktop=e)}get id(){return this._id}get modeDesktop(){return this._modeDesktop}get session(){return this.storyManager.rootStore.sessionStore.session}get stories(){const e=this._params.feedSlug,t=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(e);if(!t)return[];const r=t.stories.map((e=>new Io(this,e)));return this.hasFavoriteCard&&this.favoriteCardOptions&&r.push(this.createFavoriteCard(this.favoriteCardOptions)),this.hasUgcCard&&this.ugcCardOptions&&r.unshift(this.createUgcStoryCard(this.ugcCardOptions)),r}get params(){return this._params}constructor(s,n){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Bo(this,y),s)}),Object.defineProperty(this,"storiesService",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,Bo(this,w,!0)),r.set(this,(Bo(this,S),Bo(this,_,null))),i.set(this,(Bo(this,O),Bo(this,C,null))),a.set(this,(Bo(this,x),Bo(this,k,{listType:At.DEFAULT,feedSlug:"",useUgcCard:!1,isFavorite:!1,hasFavorite:!1}))),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:(Bo(this,P),!1)}),this._id="StoryListViewModel"+e.index++,this.storyManager.setViewModel(this._id,this)}get hasFavoriteCard(){const e=this.storyManager.rootStore.storyFeedStore.getFavoriteFeed();return this._params.hasFavorite&&this._params.listType===At.DEFAULT&&e.stories.length>0}get hasUgcCard(){return this._params.useUgcCard}setParams(e){this._params=e}onStoryClick(e,t=0){var r;null===(r=Do.createHandler(e,this.storyManager,this))||void 0===r||r.handle(e,{index:t})}destroy(){this.removeAllListeners(),this.storyManager.deleteViewModel(this._id)}async reload(){await this.loadStories({needFavorite:!0})}async loadStories(e){var t;if(this.isLoading||this._params.feedSlug===Ut)return;const r=Boolean(this._params.hasFavorite)&&e.needFavorite,i={feed:this._params.feedSlug,filter:{},defaultListLength:0,favoriteListLength:0,success:!0,error:{name:"",networkStatus:200,networkMessage:""}};try{this.emit("startLoading"),this.isLoading=!0;const{defaultStories:e,favoriteStories:t}=await this.storiesService.loadStories(Object.assign(Object.assign({},this._params),{needFavorite:r}));i.success=!0,i.error=null,i.defaultListLength=e.length,this._params.hasFavorite&&this._params.listType===At.DEFAULT&&(i.favoriteListLength=t.length)}catch(e){console.error(e),i.success=!1,e instanceof fe&&(i.error={name:e.name,networkMessage:e.networkMessage,networkStatus:e.networkStatus})}finally{this.isLoading=!1,i.filter=null!==(t=this._params.filter)&&void 0!==t?t:{},this.emit("endLoading",i)}}setUgcCardOptions(e){this.ugcCardOptions=e}setFavoriteCardOptions(e){this.favoriteCardOptions=e}createUgcStoryCard(e){return Lo.create(e,this,this.storyManager.rootStore,new Ht(this.storyManager))}createFavoriteCard(e){return Vo.create(e,this,this.storyManager.rootStore,new Ht(this.storyManager))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=b[Symbol.metadata])&&void 0!==t?t:null):void 0;s=[Pe.observable],n=[Pe.observable],o=[Pe.observable],l=[Pe.observable],d=[Pe.action],c=[Pe.computed],u=[Pe.computed],h=[Pe.computed],p=[Pe.computed],g=[Pe.computed],f=[Pe.computed],m=[Pe.action],v=[Pe.action],Fo(e,null,s,{kind:"accessor",name:"_modeDesktop",static:!1,private:!1,access:{has:e=>"_modeDesktop"in e,get:e=>e._modeDesktop,set:(e,t)=>{e._modeDesktop=t}},metadata:r},w,S),Fo(e,null,n,{kind:"accessor",name:"ugcCardOptions",static:!1,private:!1,access:{has:e=>"ugcCardOptions"in e,get:e=>e.ugcCardOptions,set:(e,t)=>{e.ugcCardOptions=t}},metadata:r},_,O),Fo(e,null,o,{kind:"accessor",name:"favoriteCardOptions",static:!1,private:!1,access:{has:e=>"favoriteCardOptions"in e,get:e=>e.favoriteCardOptions,set:(e,t)=>{e.favoriteCardOptions=t}},metadata:r},C,x),Fo(e,null,l,{kind:"accessor",name:"_params",static:!1,private:!1,access:{has:e=>"_params"in e,get:e=>e._params,set:(e,t)=>{e._params=t}},metadata:r},k,P),Fo(e,null,d,{kind:"setter",name:"modeDesktop",static:!1,private:!1,access:{has:e=>"modeDesktop"in e,set:(e,t)=>{e.modeDesktop=t}},metadata:r},null,y),Fo(e,null,c,{kind:"getter",name:"modeDesktop",static:!1,private:!1,access:{has:e=>"modeDesktop"in e,get:e=>e.modeDesktop},metadata:r},null,y),Fo(e,null,u,{kind:"getter",name:"session",static:!1,private:!1,access:{has:e=>"session"in e,get:e=>e.session},metadata:r},null,y),Fo(e,null,h,{kind:"getter",name:"stories",static:!1,private:!1,access:{has:e=>"stories"in e,get:e=>e.stories},metadata:r},null,y),Fo(e,null,p,{kind:"getter",name:"params",static:!1,private:!1,access:{has:e=>"params"in e,get:e=>e.params},metadata:r},null,y),Fo(e,null,g,{kind:"getter",name:"hasFavoriteCard",static:!1,private:!1,access:{has:e=>"hasFavoriteCard"in e,get:e=>e.hasFavoriteCard},metadata:r},null,y),Fo(e,null,f,{kind:"getter",name:"hasUgcCard",static:!1,private:!1,access:{has:e=>"hasUgcCard"in e,get:e=>e.hasUgcCard},metadata:r},null,y),Fo(e,null,m,{kind:"method",name:"setParams",static:!1,private:!1,access:{has:e=>"setParams"in e,get:e=>e.setParams},metadata:r},null,y),Fo(e,null,v,{kind:"method",name:"reload",static:!1,private:!1,access:{has:e=>"reload"in e,get:e=>e.reload},metadata:r},null,y),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),Object.defineProperty(e,"index",{enumerable:!0,configurable:!0,writable:!0,value:0}),e})();class zo extends Io{constructor(e,t){super(e,t)}}class Vo extends Io{constructor(e,t,r){super(t,r),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:e})}get favoriteStories(){return this.rootStore.storyFeedStore.getFavoriteFeed().stories.map((e=>new zo(this.storyListViewModel,e)))}static create(e,t,r,i){const a=new nr({id:0,title:e.title.content,title_color:e.title.color,is_opened:!0,background_color:"white"},r,i);return new Vo(r,t,a)}}class Go{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){const e=new el(this.storyManager);return new Wo(this.storyManager,e)}}class $o{constructor(e=0,t=0,r=0,i=0){Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.x=e,this.y=t,this.width=r,this.height=i}overlaps(e){return this.x+this.width>=e.x&&this.x<=e.x+e.width&&this.y+this.height>=e.y&&this.y<=e.y+e.height}getIntersection(e){const t=Math.min(this.x+this.width,e.x+e.width),r=Math.max(this.x,e.x),i=Math.min(this.y+this.height,e.y+e.height),a=Math.max(this.y,e.y);return new $o(Math.min(t,r),Math.min(i,a),Math.max(0,t-r),Math.max(0,i-a))}getArea(){return this.width*this.height}getAreaFraction(e){return+(this.getArea()/e.getArea()*100).toFixed(2)}static clone(e){return new $o(e.x,e.y,e.width,e.height)}}class Ho{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storiesIds",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"getNewStoriesIds",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=[];for(const r of e)this.storiesIds.has(r)||t.push(r);return t}})}markStoryAsFullVisible(e){this.storiesIds.has(e)||(this.storiesIds.add(e),this.feedCoverageAnalyticsCalculator.emit("feedImpression",[e]))}calculate(e){const t=this.getNewStoriesIds(e.map((({id:e})=>e)));t.forEach((e=>this.storiesIds.add(e))),0!==t.length&&this.feedCoverageAnalyticsCalculator.emit("feedImpression",t)}}class qo{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e})}calculate(e){const t=e.map((({id:e,areaFraction:t})=>({storyId:e,visibleArea:Math.round(t)/100})));0!==t.length&&this.feedCoverageAnalyticsCalculator.emit("visibleAreaUpdated",t)}}class Qo extends e.EventEmitter{constructor(){super(),Object.defineProperty(this,"storyRects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:new $o}),Object.defineProperty(this,"feedImpressionMetric",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"visibleAreaMetric",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filterStoryRectIntersections",{enumerable:!0,configurable:!0,writable:!0,value:e=>e.filter((e=>-100!==e.id&&e.areaFraction>0))}),this.feedImpressionMetric=new Ho(this),this.visibleAreaMetric=new qo(this)}calculate(e){const t=this.getScrollViewportByCalculationParams(e),r=this.getStoryRectIntersectionsWithViewport(t),i=this.filterStoryRectIntersections(r);this.calculateMetrics(i)}setViewport(e){this.viewport=e}setStoryRects(e){this.storyRects=e}markStoryAsFullVisible(e){this.feedImpressionMetric.markStoryAsFullVisible(e)}destroy(){this.removeAllListeners()}getScrollViewportByCalculationParams(e){const t=$o.clone(this.viewport);return t.x+=e.minOffsetLeft,t.y+=e.minOffsetTop,t.width+=e.maxOffsetLeft-e.minOffsetLeft,t.height+=e.maxOffsetTop-e.minOffsetTop,t}calculateMetrics(e){this.feedImpressionMetric.calculate(e),this.visibleAreaMetric.calculate(e)}getStoryRectIntersectionsWithViewport(e){const t=[];for(const r of this.storyRects)if(r.overlaps(e)){const i=r.getIntersection(e);t.push({id:r.id,areaFraction:i.getAreaFraction(r)})}else t.push({id:r.id,areaFraction:0});return t}}class Ko extends $o{constructor(e,t=0,r=0,i=0,a=0){super(t,r,i,a),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e}static clone(e){return new Ko(e.id,e.x,e.y,e.width,e.height)}}class Yo{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"viewportPadding",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"minOffsetLeft",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxOffsetLeft",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"minOffsetTop",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxOffsetTop",{enumerable:!0,configurable:!0,writable:!0,value:0})}startScroll({x:e,y:t}){this.minOffsetLeft=e,this.minOffsetTop=t,this.maxOffsetLeft=e,this.maxOffsetTop=t}endScroll({x:e,y:t}){this.minOffsetLeft=Math.min(e,this.minOffsetLeft),this.maxOffsetLeft=Math.max(e,this.maxOffsetLeft),this.minOffsetTop=Math.min(t,this.minOffsetTop),this.maxOffsetTop=Math.max(t,this.maxOffsetTop),this.feedCoverageAnalyticsCalculator.calculate({minOffsetLeft:this.minOffsetLeft,maxOffsetLeft:this.maxOffsetLeft,minOffsetTop:this.minOffsetTop,maxOffsetTop:this.maxOffsetTop})}calculate(e,t){this.feedCoverageAnalyticsCalculator.calculate({minOffsetLeft:e,maxOffsetLeft:e,minOffsetTop:t,maxOffsetTop:t})}updateGeometry({stories:e,storyListRect:t,windowRect:r,viewportPadding:i}){this.viewportPadding=i,this.setViewport(t,r),this.setStoryRects(e,t)}destroy(){this.feedCoverageAnalyticsCalculator.destroy()}markStoryAsFullVisible(e){this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e)}setViewport(e,t){const r=this.getViewportByWindowAndStoryList(t,e);this.applyPaddingToViewport(r,e),this.feedCoverageAnalyticsCalculator.setViewport(r)}getViewportByWindowAndStoryList(e,t){let r=new $o;return t.overlaps(e)?(r=t.getIntersection(e),r):r}applyPaddingToViewport(e,t){t.width<768||(e.x+=this.viewportPadding.left,e.y+=this.viewportPadding.top,e.height-=this.viewportPadding.top+this.viewportPadding.bottom,e.width-=this.viewportPadding.left+this.viewportPadding.right)}setStoryRects(e,t){const r=[];e.forEach(((i,a)=>{const s=Number(i.dataset.id),n=new Ko(s,i.offsetLeft,i.offsetTop,i.clientWidth,i.clientHeight);r.push(n),n.x+=t.x,n.y+=t.y,this.applyPaddingAndNegativeMarginToStoryRect(n,a,e.length-1)})),this.feedCoverageAnalyticsCalculator.setStoryRects(r)}applyPaddingAndNegativeMarginToStoryRect(e,t,r){const i=this.viewportPadding;0===t&&(e.x+=i.left,e.width-=i.left),t===r&&(e.width-=i.right)}}class Jo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.handle=this.handle.bind(this)}handle(e){const t=this.storyManager.getConfig();this.params.listType!==At.DEFAULT||t.isStatisticsDisabled||this.sendStat(e);const r=this.params.feed,i=this.params.filter,a={stories:e.map((e=>{const t={title:null,tags:[],slidesCount:null},i=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(r),a=i.getStoryById(e);return a&&(t.title=a.statTitle,t.tags=a.tags,t.slidesCount=a.slidesCount,i.type===At.UGC&&(t.ugcPayload=(0,be.default)(a.ugcPayload)?a.ugcPayload:{})),Object.assign({id:e},t)})),feed:null,filter:null};this.params.listType===At.DEFAULT?a.feed=r:this.params.listType===At.UGC&&(a.filter=i),this.storyManager.emit("feedImpression",a)}sendStat(e){const t=[[5,0,...e]];this.storyManager.rootStore.sessionStore.sendStatisticData({data:t})}}class Zo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.handle=this.handle.bind(this)}handle(e){const t=this.params.feed,r=this.params.filter,i=this.params.listType,a={stories:e.map((({storyId:e,visibleArea:t})=>{const r={title:null,tags:[],slidesCount:null,visibleArea:t},a=this.storyManager.rootStore.storyStore.findStoryById(e);return a&&(r.title=a.statTitle,r.tags=a.tags,r.slidesCount=a.slidesCount,i===At.UGC&&(r.ugcPayload=(0,be.default)(a.ugcPayload)?a.ugcPayload:{})),Object.assign({id:e},r)})),feed:null,filter:null};i===At.DEFAULT?a.feed=t:i===At.UGC&&(a.filter=r),this.storyManager.emit("visibleAreaUpdated",a)}}class Xo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(){const e=new Qo,t=new Jo(this.storyManager,this.params),r=new Zo(this.storyManager,this.params);e.on("feedImpression",t.handle),e.on("visibleAreaUpdated",r.handle);return new Yo(e)}}class el{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async loadStories({feedSlug:e,filter:t={},listType:r,testKey:i,needFavorite:a=!0}){const s=r===At.DEFAULT&&a,n=this.storyManager.rootStore.storyFeedStore,o=await this.fetchStoryFeed(n,e,t,i);let l=null;s&&(l=await n.fetchFavoriteFeed());const d=this.getFeedLoadEventStoryDtos(o);return this.emitFeedLoadEvent(o,d,e,t),this.getStoriesResult(o,l)}async fetchStoryFeed(e,t,r,i){return t===Gt?e.fetchUgcFeed({filter:r,testKey:i}):e.fetchDefaultFeed({feedSlug:t,testKey:i})}getFeedLoadEventStoryDtos(e){return e.stories.map((t=>{const r={title:null,tags:[],slidesCount:null};return r.title=t.statTitle,r.tags=t.tags,r.slidesCount=t.slidesCount,e.type===At.UGC&&(r.ugcPayload=(0,be.default)(t.ugcPayload)?t.ugcPayload:{}),Object.assign({id:t.id},r)}))}emitFeedLoadEvent(e,t,r,i){const a={stories:t,feed:null,filter:null};e.type===At.DEFAULT?a.feed=r:e.type===At.UGC&&(a.filter=i),this.storyManager.emit("feedLoad",a)}getStoriesResult(e,t){var r,i;return{defaultStories:null!==(r=e.stories)&&void 0!==r?r:[],favoriteStories:null!==(i=null==t?void 0:t.stories)&&void 0!==i?i:[]}}}class tl extends e.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"showSharePage",{enumerable:!0,configurable:!0,writable:!0,value:async()=>{this.handleStartLoad();const e=this.storyManager.getConfig().isStatisticsDisabled,t=await this.storyReaderViewModel.showStoryFromSharePage(this.storyId,e);this.handleEndLoad(t)}}),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(),this.storyReaderViewModel.once(Hn.Close,this.handleCloseStoryReader)}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(F.START_LOADING),(0,oe.default)(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(F.END_LOADING,{result:e}),(0,oe.default)(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if((0,oe.default)(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(F.CLOSE_STORY_READER)>0)try{(0,oe.default)(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(F.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class rl{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}install(e,t){this.plugins.set(e.name,e),ke(`[PluginManager]: plugin ${e.name} registered`),e.install(this.storyManager,t),ke(`[PluginManager]: plugin ${e.name} installed`)}uninstall(e){e.uninstall(this.storyManager),this.plugins.delete(e.name),ke(`[PluginManager]: plugin ${e.name} uninstalled`)}get(e){return this.plugins.get(e)}}class il extends Error{constructor(e){super(`[IAM]: not found IAM for event <${e}>`),this.name="IamNotFoundByEventError"}}var al=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},sl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},nl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},ol=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let ll=(()=>{var e,t,r,i;let a,s,n,o,l,d,c,u,h=[],p=[],g=[],f=[],m=[],v=[],b=[];return e=class{get _messages(){return nl(this,t,"f")}set _messages(e){ol(this,t,e,"f")}get _isLoaded(){return nl(this,r,"f")}set _isLoaded(e){ol(this,r,e,"f")}get _isLoading(){return nl(this,i,"f")}set _isLoading(e){ol(this,i,e,"f")}constructor(e,a){Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:(al(this,h),e)}),Object.defineProperty(this,"iamApi",{enumerable:!0,configurable:!0,writable:!0,value:a}),t.set(this,al(this,p,Pe.observable.map())),r.set(this,(al(this,g),al(this,f,!1))),i.set(this,(al(this,m),al(this,v,!1))),Object.defineProperty(this,"_messageContext",{enumerable:!0,configurable:!0,writable:!0,value:al(this,b)})}get messages(){return Array.from(this._messages.values())}get isLoaded(){return this._isLoaded}get isLoading(){return this._isLoading}get messageContext(){return this._messageContext}async preload(e){try{this._isLoaded=!1,this._isLoading=!0;const t=await this.fetchAll(e);return this._isLoaded=!0,t}catch(e){throw console.error(e),e}finally{this._isLoading=!1}}async findById(e){const t=this._messages.get(e.toString());return t||this.fetchById(e)}findAllByEvent(e){let t=Array.from(this._messages.values()).filter((t=>t.hasEvent(e)));if(t.length>0)return t;throw new il(e)}async updateMessageUserData(e,t){return this.iamApi.updateUserData(e,t)}async fetchById(e){await this.rootStore.sessionStore.open(),await this.fetchMessageContext();const t=await this.iamApi.fetchById(e);return this.createMessageByDto(t)}async fetchAll(e){await this.rootStore.sessionStore.open(),await this.fetchMessageContext();const t=e.tags?e.tags:this.rootStore.storyManagerConfigStore.config.tags,r=await this.iamApi.fetchAll({tags:Te(t)});return this.createMessagesByDtos(r)}async fetchMessageContext(){await this.rootStore.sessionStore.open(),this._messageContext||(this._messageContext=await this.iamApi.fetchContext())}createMessagesByDtos(e){this._messages.clear();const t=[];for(const r of e){const e=this.createMessageByDto(r);t.push(e)}return t}createMessageByDto(e){const t=Dr.createByDto(e,this,new qr(this.iamApi));return this._messages.has(t.id.toString())||this._messages.set(t.id.toString(),t),t}},t=new WeakMap,r=new WeakMap,i=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;a=[Pe.observable],s=[Pe.observable],n=[Pe.observable],o=[Pe.computed],l=[Pe.computed],d=[Pe.computed],c=[Pe.computed],u=[Me,Ee],sl(e,null,a,{kind:"accessor",name:"_messages",static:!1,private:!1,access:{has:e=>"_messages"in e,get:e=>e._messages,set:(e,t)=>{e._messages=t}},metadata:t},p,g),sl(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:t},f,m),sl(e,null,n,{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:t},v,b),sl(e,null,o,{kind:"getter",name:"messages",static:!1,private:!1,access:{has:e=>"messages"in e,get:e=>e.messages},metadata:t},null,h),sl(e,null,l,{kind:"getter",name:"isLoaded",static:!1,private:!1,access:{has:e=>"isLoaded"in e,get:e=>e.isLoaded},metadata:t},null,h),sl(e,null,d,{kind:"getter",name:"isLoading",static:!1,private:!1,access:{has:e=>"isLoading"in e,get:e=>e.isLoading},metadata:t},null,h),sl(e,null,c,{kind:"getter",name:"messageContext",static:!1,private:!1,access:{has:e=>"messageContext"in e,get:e=>e.messageContext},metadata:t},null,h),sl(e,null,u,{kind:"method",name:"preload",static:!1,private:!1,access:{has:e=>"preload"in e,get:e=>e.preload},metadata:t},null,h),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var dl=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},cl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},ul=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},hl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let pl=(()=>{var e,t;let r,i,a,s,n=[],o=[],l=[];return e=class{get _session(){return ul(this,t,"f")}set _session(e){hl(this,t,e,"f")}constructor(e,r){Object.defineProperty(this,"sessionApi",{enumerable:!0,configurable:!0,writable:!0,value:(dl(this,n),e)}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:r}),t.set(this,dl(this,o,null)),dl(this,l),this.sessionApi=e,this.rootStore=r}get session(){return this._session}get userId(){var e,t;return null!==(t=null===(e=this._session)||void 0===e?void 0:e.userKey)&&void 0!==t?t:Mt}async open(){if(this._session)return this._session;const e=await this.sessionApi.open(),t=new Et(this,e);return t.loadResources(),this.updatePlaceholders(t),this._session=t,t}close(){this._session=null}async sendStatisticData(e){return this.sessionApi.sendStatisticData(e)}updatePlaceholders(e){this.rootStore.placeholderStore.addPlaceholders([...e.imagePlaceholders,...e.textPlaceholders])}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],i=[Pe.computed],a=[Pe.computed],s=[Me],cl(e,null,r,{kind:"accessor",name:"_session",static:!1,private:!1,access:{has:e=>"_session"in e,get:e=>e._session,set:(e,t)=>{e._session=t}},metadata:t},o,l),cl(e,null,i,{kind:"getter",name:"session",static:!1,private:!1,access:{has:e=>"session"in e,get:e=>e.session},metadata:t},null,n),cl(e,null,a,{kind:"getter",name:"userId",static:!1,private:!1,access:{has:e=>"userId"in e,get:e=>e.userId},metadata:t},null,n),cl(e,null,s,{kind:"method",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open},metadata:t},null,n),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var gl=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},fl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},ml=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},vl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};const bl=Pe.observable.map();let yl=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _storiesByUserId(){return ml(this,t,"f")}set _storiesByUserId(e){vl(this,t,e,"f")}get activeUserStories(){var e;const t=this.rootStore.sessionStore.userId;return t&&null!==(e=this._storiesByUserId.get(t))&&void 0!==e?e:bl}constructor(e,r,i){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(gl(this,a),e)}),Object.defineProperty(this,"storiesApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:i}),t.set(this,gl(this,s,Pe.observable.map())),Object.defineProperty(this,"storyCSSLoaded",{enumerable:!0,configurable:!0,writable:!0,value:(gl(this,n),!1)}),(0,Pe.reaction)((()=>i.placeholderStore.placeholders),(e=>{for(const t of this.activeUserStories.values())t.updatePlaceholders(e)}))}addStoriesByDtos(e){const t=[],r=this.getOrCreateStoriesMap();for(const i of e){let e=r.get(i.id);e?t.push(e):(e=new nr(i,this.rootStore,this.storiesApi),r.set(i.id,e),t.push(e))}return t}addStoryByDto(e){const t=this.getOrCreateStoriesMap();if(t.has(e.id))return t.get(e.id);const r=new nr(e,this.rootStore,this.storiesApi);return t.set(e.id,r),r}async fetchStoryById({storyId:e,feedSlug:t,fetchShareUrl:r,once:i}){let a=this.findStoryById(e);if(null==a?void 0:a.slidesLoaded)return a;await this.rootStore.sessionStore.open(),await this.fetchStoryCSS(),a=await this.fetchStory({storyId:e,feedSlug:t,fetchShareUrl:r,once:i});const s=await this.fetchStoryContext({id:a.id,feedSlug:t});return a.setContext(s),a.setCanBeShown(!0),a}async fetchStoriesSlides(e){const t=this.filterStoriesWithoutSlides(e.stories);if(t.length)try{const r=(new Date).getTime();await this.fetchStoryCSS();const i=await this.fetchStoryContextByIds({storyIds:t.map((e=>e.id)),feedSlug:e.feedSlug});await Promise.all(t.map(((t,a)=>this.processSingleStory(r,t,i[a],e.feedSlug))))}catch(e){for(const r of t)r.setError(e)}}findStoryById(e){return"number"==typeof e?this.activeUserStories.get(e):Array.from(this.activeUserStories.values()).find((t=>t.stringId===e))}filterStoriesWithoutSlides(e){return e.filter((e=>!e.slidesLoaded))}async processSingleStory(e,t,r,i){var a;try{t.error&&t.setError(null),t.setContext(r);const s=await this.storiesApi.fetchStorySlides({id:t.id,feedSlug:i});t.setSlides(null!==(a=s.slides)&&void 0!==a?a:[]),await(async(e,t=300)=>new Promise((r=>{const i=Math.max(0,t-((new Date).getTime()-e));i?setTimeout(r,i):r()})))(e),t.setCanBeShown(!0)}catch(e){t.setError(e)}}async fetchStory({storyId:e,feedSlug:t,fetchShareUrl:r,once:i}){var a;const s=await this.storiesApi.fetchStory({id:e,feedSlug:t,fetchShareUrl:r,once:i}),n=this.addStoryByDto(s);return n.setSlides(null!==(a=s.slides)&&void 0!==a?a:[]),n}async fetchStoryCSS(){if(this.storyCSSLoaded)return;const e=await this.storiesApi.fetchStoryCSS();this.storyCSSLoaded=!0,(e=>{const t="stories-slider-style";let r=document.getElementById(t),i="";null!==e&&(i=null!=e?e:""),null===r?(r=document.createElement("style"),r.type="text/css",r.id=t,r.attributes.setNamedItem(document.createAttribute("scoped")),r.setAttribute("nonce",Re()),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i)),document.head.appendChild(r)):r.styleSheet?r.styleSheet.cssText=i:(r.textContent="",r.appendChild(document.createTextNode(i)))})(e)}async fetchStoryContext({id:e,feedSlug:t}){const r=await this.storiesApi.fetchStoryContext({ids:[e],feedSlug:t});return new or(e,r)}async fetchStoryContextByIds({storyIds:e,feedSlug:t}){const r=await this.storiesApi.fetchStoryContext({ids:e,feedSlug:t});return e.map((e=>new or(e,r)))}getOrCreateStoriesMap(){const e=this.rootStore.sessionStore.userId;let t=Pe.observable.map();return this._storiesByUserId.has(e)?t=this._storiesByUserId.get(e):this._storiesByUserId.set(e,t),t}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],i=[Pe.computed],fl(e,null,r,{kind:"accessor",name:"_storiesByUserId",static:!1,private:!1,access:{has:e=>"_storiesByUserId"in e,get:e=>e._storiesByUserId,set:(e,t)=>{e._storiesByUserId=t}},metadata:t},s,n),fl(e,null,i,{kind:"getter",name:"activeUserStories",static:!1,private:!1,access:{has:e=>"activeUserStories"in e,get:e=>e.activeUserStories},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var wl=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Sl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},_l=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ol=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};const Cl=Pe.observable.map();let xl=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _storyFeedsByUserId(){return _l(this,t,"f")}set _storyFeedsByUserId(e){Ol(this,t,e,"f")}constructor(e,r){Object.defineProperty(this,"storyFeedsApi",{enumerable:!0,configurable:!0,writable:!0,value:(wl(this,a),e)}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:r}),t.set(this,wl(this,s,Pe.observable.map())),wl(this,n),this.storyFeedsApi=e,this.rootStore=r}get activeUserFeeds(){var e;const t=this.rootStore.sessionStore.userId;return t&&null!==(e=this._storyFeedsByUserId.get(t))&&void 0!==e?e:Cl}getUgcFeed(){var e;return null!==(e=this.getFeedBySlug(Gt))&&void 0!==e?e:$t.createByStoryDtos([],this.rootStore)}getFavoriteFeed(){var e;return null!==(e=this.getFeedBySlug(Ut))&&void 0!==e?e:Wt.createByStoryDtos([],this.rootStore)}getFeedBySlug(e){return this.activeUserFeeds.get(e)}async fetchDefaultFeed({feedSlug:e,testKey:t}){const r=await this.rootStore.sessionStore.open(),i=this.rootStore.storyManagerConfigStore.config.tags,a=await this.storyFeedsApi.fetchDefaultFeed({feedSlug:e,tags:i,testKey:t}),s=new Nt(a,this.rootStore,{testKey:t});return this.addStoryFeed(r.userKey,s),s}async fetchFavoriteFeed(){const e=await this.rootStore.sessionStore.open(),t=this.rootStore.storyManagerConfigStore.config.tags,r=await this.storyFeedsApi.fetchFavoriteFeed({tags:t}),i=Wt.createByStoryDtos(r,this.rootStore);return this.addStoryFeed(e.userKey,i),i}async fetchUgcFeed({filter:e,testKey:t}){const r=await this.rootStore.sessionStore.open(),i=this.rootStore.storyManagerConfigStore.config.tags,a=await this.storyFeedsApi.fetchUgcFeed({filter:e,tags:i,testKey:t}),s=$t.createByStoryDtos(a,this.rootStore);return this.addStoryFeed(r.userKey,s),s}addStoryFeed(e,t){let r=Pe.observable.map();this._storyFeedsByUserId.has(e)?r=this._storyFeedsByUserId.get(e):this._storyFeedsByUserId.set(e,r),r.set(t.slug,t)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],i=[Pe.computed],Sl(e,null,r,{kind:"accessor",name:"_storyFeedsByUserId",static:!1,private:!1,access:{has:e=>"_storyFeedsByUserId"in e,get:e=>e._storyFeedsByUserId,set:(e,t)=>{e._storyFeedsByUserId=t}},metadata:t},s,n),Sl(e,null,i,{kind:"getter",name:"activeUserFeeds",static:!1,private:!1,access:{has:e=>"activeUserFeeds"in e,get:e=>e.activeUserFeeds},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var kl=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Pl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},jl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ml=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};const El=Pe.observable.map();let Il=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _onboardingFeedsByUserId(){return jl(this,t,"f")}set _onboardingFeedsByUserId(e){Ml(this,t,e,"f")}constructor(e,r){Object.defineProperty(this,"storyFeedsApi",{enumerable:!0,configurable:!0,writable:!0,value:(kl(this,a),e)}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:r}),t.set(this,kl(this,s,Pe.observable.map())),Object.defineProperty(this,"cacheDataInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:(kl(this,n),!1)}),(0,Pe.reaction)((()=>{const e=this.rootStore.storyManagerConfigStore.config;return e?[e.lang,e.apiKey]:null}),(()=>{this.invalidateCacheData()}))}get activeUserFeeds(){var e;const t=this.rootStore.sessionStore.userId;return t&&null!==(e=this._onboardingFeedsByUserId.get(t))&&void 0!==e?e:El}getFeedBySlug(e){return this.activeUserFeeds.get(null!=e?e:Vt.getDefaultSlug())}removeStoryFromOnboardingFeedsById(e){for(const t of this.activeUserFeeds.values())t.removeById(e)}invalidateCacheData(){this.cacheDataInvalidated=!0}async fetchOnboardingFeed(e){let t=e.feedSlug||Vt.getDefaultSlug();const r=this.getOnboardingParams(e);let i=this.activeUserFeeds.get(t);if(i&&!this.cacheDataInvalidated&&i.isEqualParams(r))return i;const a=await this.rootStore.sessionStore.open(),s=await this.storyFeedsApi.fetchOnboardingFeed(Object.assign(Object.assign({},r),{feedSlug:t}));return i=new Vt(s,this.rootStore,r),this.addOnboardingFeed(a.userKey,i),this.commitCacheData(),i}addOnboardingFeed(e,t){let r=Pe.observable.map();this._onboardingFeedsByUserId.has(e)?r=this._onboardingFeedsByUserId.get(e):this._onboardingFeedsByUserId.set(e,r),r.set(t.slug,t)}getOnboardingParams(e){const t=e.tags.length>0?e.tags:this.rootStore.storyManagerConfigStore.config.tags;return{tags:Te(t),limit:e.limit}}commitCacheData(){this.cacheDataInvalidated=!1}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],i=[Pe.computed],Pl(e,null,r,{kind:"accessor",name:"_onboardingFeedsByUserId",static:!1,private:!1,access:{has:e=>"_onboardingFeedsByUserId"in e,get:e=>e._onboardingFeedsByUserId,set:(e,t)=>{e._onboardingFeedsByUserId=t}},metadata:t},s,n),Pl(e,null,i,{kind:"getter",name:"activeUserFeeds",static:!1,private:!1,access:{has:e=>"activeUserFeeds"in e,get:e=>e.activeUserFeeds},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Ll{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ugcEditorApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:null})}async getUgcEditorConfig(){if(this._config)return this._config;const e=await this.storyManager.rootStore.sessionStore.open(),t=await this.ugcEditorApi.fetchUgcEditorConfig(),r=this.storyManager.getConfig(),i="3.4.3";return this._config={sessionId:e.id,apiKey:r.apiKey,editor:null!=t?t:{},sdkVersion:i,appPackageId:r.appPackageId,deviceId:e.deviceId,userId:null!=r.userId?String(r.userId):void 0,lang:r.lang.toString()},this._config}}class Tl{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async fetchUgcEditorConfig(){return(await Ce.request({method:"GET",url:"ugc/editor-config",params:{}})).data}}var Al=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Rl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Dl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Bl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Fl=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _placeholders(){return Dl(this,t,"f")}set _placeholders(e){Bl(this,t,e,"f")}get placeholders(){return Array.from(this._placeholders.values())}addPlaceholders(e){for(const t of e){const e=this._placeholders.get(t.key);e&&e.priority>t.priority||this._placeholders.set(t.key,t)}}clear(){this._placeholders=Pe.observable.map()}constructor(){t.set(this,(Al(this,a),Al(this,s,Pe.observable.map()))),Al(this,n)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],i=[Pe.computed],Rl(e,null,r,{kind:"accessor",name:"_placeholders",static:!1,private:!1,access:{has:e=>"_placeholders"in e,get:e=>e._placeholders,set:(e,t)=>{e._placeholders=t}},metadata:t},s,n),Rl(e,null,i,{kind:"getter",name:"placeholders",static:!1,private:!1,access:{has:e=>"placeholders"in e,get:e=>e.placeholders},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var Nl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Ul=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Wl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},zl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Vl=(()=>{var e,t;let r,i=[],a=[];return e=class{get _config(){return Wl(this,t,"f")}set _config(e){zl(this,t,e,"f")}constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),t.set(this,Ul(this,i,null)),Ul(this,a),this.storyManager=e}get config(){return this._config}setConfig(e){this._config?this.updateConfig(e):this.initializeConfig(e)}clear(){this._config=null,this.storyManager.rootStore.sessionStore.close()}async waitStoryManagerConfig(){return new Promise(((e,t)=>{let r;const i=()=>{if(this._config)return clearTimeout(r),void e();requestAnimationFrame(i)};r=setTimeout((()=>{t("[IAS]: Timeout waiting for InAppStoryManager config")}),5e3),i()}))}initializeConfig(e){this._config=new Er(this.storyManager,e)}updateConfig(e){this._config.updateByDto(e)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Pe.observable],Nl(e,null,r,{kind:"accessor",name:"_config",static:!1,private:!1,access:{has:e=>"_config"in e,get:e=>e._config,set:(e,t)=>{e._config=t}},metadata:t},i,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Gl{constructor(e){Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sessionStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyFeedStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onboardingFeedStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ugcEditorStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"placeholderStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyManagerConfigStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=new Ht(e),r=new qt(e);this.storyManagerConfigStore=new Vl(e),this.placeholderStore=new Fl,this.iamStore=new ll(this,new dt(e)),this.sessionStore=new pl(new _t(e),this),this.storyStore=new yl(e,t,this),this.storyFeedStore=new xl(r,this),this.onboardingFeedStore=new Il(r,this),this.ugcEditorStore=new Ll(e,new Tl(e))}}class $l extends e.EventEmitter{constructor(){return super(),Object.defineProperty(this,"viewModelStore",{enumerable:!0,configurable:!0,writable:!0,value:new ue}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"pluginManager",{enumerable:!0,configurable:!0,writable:!0,value:new rl(this)}),Object.defineProperty(this,"_rootStore",{enumerable:!0,configurable:!0,writable:!0,value:new Gl(this)}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:this.createInAppMessagingReader()}),Object.defineProperty(this,"clickOnButtonAction",{enumerable:!0,configurable:!0,writable:!0,value:({src:e,payload:t})=>{if((0,oe.default)(this.callbacks.storyLinkClickHandler)||this.listenerCount(se.CLICK_ON_STORY)>0){const r={src:e,data:t};try{(0,oe.default)(this.callbacks.storyLinkClickHandler)&&this.callbacks.storyLinkClickHandler(r),this.emit(se.CLICK_ON_STORY,r)}catch(e){console.error(e)}}else window.open(t.url,"_self")}}),$l.isSingletonInstanceExists()||($l.instance=this),$l.instance}get rootStore(){return this._rootStore}get sdkVersionName(){return"3.4.3"}get sdkVersionCode(){return parseInt(30403)}get lang(){return this.rootStore.storyManagerConfigStore.config.lang}set storyLinkClickHandler(e){(0,oe.default)(e)&&(this.callbacks.storyLinkClickHandler=e)}get storyReaderViewModel(){return this.viewModelStore.get(Jn.id)}get gameReaderViewModel(){return this.viewModelStore.get(Hs.id)}get isStatisticsDisabled(){return this.getConfig().isStatisticsDisabled}static getInstance(){return $l.instance?$l.instance:null}setViewModel(e,t){this.viewModelStore.set(e,t)}deleteViewModel(e){this.viewModelStore.delete(e)}getViewModelByKey(e){return this.viewModelStore.get(e)}getConfig(){return this.rootStore.storyManagerConfigStore.config}setConfig(e){this.rootStore.storyManagerConfigStore.setConfig(e)}async waitViewModel(e){return this.viewModelStore.wait(e)}async waitStoryManagerConfig(){return this.rootStore.storyManagerConfigStore.waitStoryManagerConfig()}async showOnboardingStories(e){var t,r;return(await this.viewModelStore.wait(Jn.id)).showOnboardingStories({feedSlug:null!==(t=null==e?void 0:e.feed)&&void 0!==t?t:void 0,customTags:null==e?void 0:e.customTags,limit:null!==(r=null==e?void 0:e.limit)&&void 0!==r?r:void 0})}async showStory(e){"string"==typeof e&&(e=+e||e);const t=await this.viewModelStore.wait(Jn.id);await t.showStory(e)}async showStoryOnce(e){"string"==typeof e&&(e=+e||e);const t=await this.viewModelStore.wait(Jn.id);await t.showStoryOnce(e)}closeAllReaders(){var e,t;null===(e=this.storyReaderViewModel)||void 0===e||e.close(),null===(t=this.gameReaderViewModel)||void 0===t||t.closeGame()}closeGoodsWidget(){var e;null===(e=this.storyReaderViewModel)||void 0===e||e.closeGoodsWidget()}async openGame(e,t={}){const r=await this.viewModelStore.wait(Hs.id);await r.openGame(e,t)}async closeGame(){return this.gameReaderViewModel.closeGame()}async closeStoryReader(){this.storyReaderViewModel.close()}async getUgcEditorConfig(){return this.rootStore.ugcEditorStore.getUgcEditorConfig()}async showSharePage(e,t){return"string"==typeof e&&(e=+e||e),await this.viewModelStore.wait(Jn.id),new tl(this,this.storyReaderViewModel,e,t)}reloadAllStoryLists(){const e=this.viewModelStore.getAllOfType((e=>e instanceof Wo));return Promise.all(e.map((e=>e.reload())))}reloadAllStackedStoryLists(){const e=this.viewModelStore.getAllOfType((e=>e instanceof Mo));return Promise.all(e.map((e=>e.reload())))}static isSingletonInstanceExists(){return!!$l.instance&&(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),!0)}use(e,t){this.pluginManager.install(e,t)}getPlugin(e){return this.pluginManager.get(e)}createStoryReader(){return new Eo(this).createStoryReader()}createGameReader(){return new Eo(this).createGameReader()}createStoryList(){return new Eo(this).createStoryList()}createInAppMessagingReader(){return new Eo(this).createInAppMessagingReader()}clearConfig(){this.rootStore.storyManagerConfigStore.clear()}emitEvent(e){this.emit(e.name,e.toJSON())}}const Hl=new $l;new class{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.inAppMessaging=new _o(e.inAppMessaging)}get sdkVersionName(){return this.storyManager.sdkVersionName}get sdkVersionCode(){return this.storyManager.sdkVersionCode}set storyLinkClickHandler(e){this.storyManager.storyLinkClickHandler=e}getConfig(){return this.storyManager.getConfig()}getNonce(){return Re()}async showOnboardingStories(e){return this.storyManager.showOnboardingStories(e)}async showStory(e){return this.storyManager.showStory(e)}async showStoryOnce(e){return this.storyManager.showStoryOnce(e)}closeAllReaders(){this.storyManager.closeAllReaders()}async openGame(e,t={}){return this.storyManager.openGame(e,t)}async closeGame(){return this.storyManager.closeGame()}async closeStoryReader(){return this.storyManager.closeStoryReader()}getUgcEditorConfig(){return this.storyManager.getUgcEditorConfig()}showSharePage(e,t){return this.storyManager.showSharePage(e,t)}closeGoodsWidget(){this.storyManager.closeGoodsWidget()}on(e,t){return this.storyManager.on(e,t),this}once(e,t){return this.storyManager.once(e,t),this}off(e,t){return this.storyManager.off(e,t),this}static use(e,t){Hl.use(e,t)}}(Hl);var ql;!function(e){e.UPDATE="update",e.EVENT_UPDATED_COMMON_OPTIONS="updatedCommonOptions",e.EVENT_UPDATED_STORIES_LIST_OPTIONS="updatedStoriesListOptions",e.EVENT_UPDATED_STORY_READER_OPTIONS="updatedStoryReaderOptions",e.EVENT_UPDATED_FAVORITE_READER_OPTIONS="updatedFavoriteReaderOptions",e.EVENT_UPDATED_GAME_READER_OPTIONS="updatedGameReaderOptions",e.EVENT_UPDATED_GOODS_WIDGET_OPTIONS="updatedGoodsWidgetOptions",e.EVENT_UPDATED_INAPPMESSAGING_WIDGET_OPTIONS="updatedInAppMessagingWidgetOptions"}(ql||(ql={}));Error;class Ql extends e.EventEmitter{constructor(){super(),Object.defineProperty(this,"_commonOptions",{enumerable:!0,configurable:!0,writable:!0,value:L}),Object.defineProperty(this,"_storiesListOptions",{enumerable:!0,configurable:!0,writable:!0,value:H}),Object.defineProperty(this,"_storyReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:Z}),Object.defineProperty(this,"_storyFavoriteReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:q}),Object.defineProperty(this,"_goodsWidgetOptions",{enumerable:!0,configurable:!0,writable:!0,value:B}),Object.defineProperty(this,"_gameReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:R})}setCommonOptions(e,t=!0){return this._commonOptions=(0,vr.default)(this._commonOptions,e),this.emit(ql.UPDATE,this.commonOptions),this}get commonOptions(){return this._commonOptions}setStoriesListOptions(e,t=!0){return this._storiesListOptions=(0,vr.default)(this._storiesListOptions,e),t&&(this.emit(ql.UPDATE,this.storiesListOptions),this.emit(ql.EVENT_UPDATED_STORIES_LIST_OPTIONS,this.storiesListOptions)),this}get storiesListOptions(){return this._storiesListOptions}setStoryReaderOptions(e,t=!0){return this._storyReaderOptions=(0,vr.default)(this._storyReaderOptions,e,{arrayMerge:(e,t,r)=>t}),t&&this.emit(ql.UPDATE,{storyReaderOptions:this.storyReaderOptions,gameReaderOptions:this.gameReaderOptions,appearanceCommon:this.commonOptions}),this}get storyReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton,loader:this.commonOptions.loader};return Object.assign(Object.assign({},e),this._storyReaderOptions)}setStoryFavoriteReaderOptions(e,t=!0){return this._storyFavoriteReaderOptions=(0,vr.default)(this._storyFavoriteReaderOptions,e),t&&this.emit(ql.UPDATE,this.storyFavoriteReaderOptions),this}get storyFavoriteReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton};return Object.assign(Object.assign({},e),this._storyFavoriteReaderOptions)}setGoodsWidgetOptions(e,t=!0){return this._goodsWidgetOptions=(0,vr.default)(this._goodsWidgetOptions,e),t&&this.emit(ql.UPDATE,this.goodsWidgetOptions),this}get goodsWidgetOptions(){return this._goodsWidgetOptions}setGameReaderOptions(e,t=!0){return this._gameReaderOptions=(0,vr.default)(this._gameReaderOptions,e),t&&this.emit(ql.UPDATE,this.gameReaderOptions),this}get gameReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton,loader:this.commonOptions.loader,forceDesktopMode:this.commonOptions.forceDesktopMode};return Object.assign(Object.assign({},e),this._gameReaderOptions)}}class Kl{constructor(){Object.defineProperty(this,"_storyLists",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get storyLists(){return this._storyLists}addStoryList(e){this._storyLists.push(e)}updateStoryListById(e,t){const r=this._storyLists.findIndex((t=>t.mountSelector===e));this._storyLists[r]=Object.assign(Object.assign({},this._storyLists[r]),t)}removeStoryListById(e){const t=this._storyLists.findIndex((t=>t.mountSelector===e));this._storyLists.splice(t,1)}}class Yl extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const Jl=e=>{if(null==e||"object"!=typeof e)throw new Yl(null==e?"null":typeof e)};class Zl extends e.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"storyListManager",{enumerable:!0,configurable:!0,writable:!0,value:new Kl}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Jl(t),this.storyListManager.addStoryList(this),this.app.setStoryList(this.storyListManager.storyLists).catch(console.error)}get mountSelector(){return this._mountSelector}get appearanceManager(){return this._appearanceManager}get type(){return At.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){return this.params.feed}get testKey(){return this.params.testKey}get useUgcCard(){return this.params.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()}destroy(){this.storyListManager.removeStoryListById(this.mountSelector),this.app.setStoryList(this.storyListManager.storyLists)}}class Xl extends e.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"storyListManager",{enumerable:!0,configurable:!0,writable:!0,value:new Kl}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Jl(t),this.storyListManager.addStoryList(this),this.app.setUGCStoryList(this.storyListManager.storyLists).catch(console.error)}get mountSelector(){return this._mountSelector}get appearanceManager(){return this._appearanceManager}get type(){return At.UGC}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){return Gt}get testKey(){return this.params.testKey}get useUgcCard(){return this.params.useUgcCard}set api(e){this._api=e}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}destroy(){this.storyListManager.removeStoryListById(this.mountSelector)}}var ed=T(85);const td=(e=>{var t={};return T.d(t,e),t})({createRoot:()=>v.createRoot});var rd=T(649);T(704);window.__IAS__={storyManager:Hl};const id=(e=>{var t={};return T.d(t,e),t})({default:()=>b.default});var ad=T(591),sd=T.n(ad),nd=T(289),od={insert:"head",singleton:!1};sd()(nd.A,od);const ld=nd.A.locals||{};var dd=T(81),cd={insert:"head",singleton:!1};sd()(dd.A,cd);const ud=dd.A.locals||{},hd=({onClick:e,className:t})=>(0,ed.jsx)("div",{className:(0,id.default)(ud.icon,t),onClick:e,children:(0,ed.jsx)("svg",{viewBox:"0 0 24 24",children:(0,ed.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"})})});var pd=T(669),gd={insert:"head",singleton:!1};sd()(pd.A,gd);const fd=pd.A.locals||{},md=({geometry:e,children:t,style:r,isWidescreen:i,className:a})=>{const s=i?{width:"100%",height:"100%"}:{width:e.getWidth(),height:e.getHeight()};return(0,ed.jsx)("div",{className:(0,id.default)(fd["aspect-ratio-box"],a,{[fd["aspect-ratio-box--centered"]]:!i}),style:Object.assign(Object.assign({},r),s),children:(0,ed.jsx)("div",{className:fd["aspect-ratio-box-inside"],children:t})})};var vd=T(138),bd={insert:"head",singleton:!1};sd()(vd.A,bd);const yd=vd.A.locals||{},wd=He(),Sd=e=>{const[t,r]=(0,rd.useState)(!1),i=(0,rd.useCallback)((()=>{if(e.desktopMode)return;const t=wd.type!==e.orientation;e.onOrientationChange({type:wd.type,isWrong:t}),r(t)}),[e.desktopMode,e.orientation]);return(0,rd.useEffect)((()=>(i(),wd.addEventListener("change",i),()=>{wd.removeEventListener("change",i)})),[i]),t?(0,ed.jsx)("div",{className:yd["screen-orientation-lock"]}):null};var _d=T(778),Od={insert:"head",singleton:!1};sd()(_d.A,Od);const Cd=_d.A.locals||{};var xd=T(196),kd={insert:"head",singleton:!1};sd()(xd.A,kd);const Pd=xd.A.locals||{};let jd;function Md(){let e,t;/ipad|iphone/i.test(navigator.userAgent)?(e=document.createRange(),jd&&e.selectNodeContents(jd),t=window.getSelection(),t&&(t.removeAllRanges(),t.addRange(e)),jd&&jd.setSelectionRange(0,999999)):null==jd||jd.select()}const Ed=e=>{!function(e){jd=document.createElement("textarea"),jd.value=e,document.body.appendChild(jd)}(e),Md(),document.execCommand("copy"),jd&&document.body.removeChild(jd)},Id=({shareText:e,shareLink:t,sharePanelOptions:r,onShareComplete:i})=>{var a,s,n,o,l,d,c,u,h,p,g;const[f,m]=(0,rd.useState)(!1),[v,b]=(0,rd.useState)(!1),y=()=>{b(!0),!f&&e||i()};return(0,ed.jsxs)("div",{className:`${Cd["share-panel__body"]} ${Pd["share-panel__body_screenshot"]}`,children:[(0,ed.jsx)("div",{className:`${Cd["share-panel-row"]} ${Pd["share-panel-row"]}`,children:(0,ed.jsx)("a",{className:Pd["share-panel-row__image-link"],onClick:y,href:t,download:"image.jpeg",children:(0,ed.jsx)("img",{src:t,className:Pd["share-panel-row__image"]})})}),(0,ed.jsx)("div",{className:Cd["share-panel-separator"],style:{background:null===(a=r.divider)||void 0===a?void 0:a.background}}),(0,ed.jsx)("div",{className:`${Cd["share-panel-row"]} ${Pd["share-panel-row"]}`,children:(0,ed.jsx)("a",{className:Pd["share-item__download-button"],onClick:y,href:t,download:"image.jpeg",children:(0,ed.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(o=null===(n=null===(s=r.downloadButton)||void 0===s?void 0:s.svgSrc)||void 0===n?void 0:n.baseState)&&void 0!==o?o:""}})})}),e?(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:Cd["share-panel-separator"],style:{background:null===(l=r.divider)||void 0===l?void 0:l.background}}),(0,ed.jsx)("div",{className:`${Cd["share-panel-row"]} ${Pd["share-panel-row"]}`,children:(0,ed.jsxs)("button",{className:(0,id.default)(Pd.btn,Pd["btn-copy"]),onClick:()=>{Ed(null!=e?e:""),m(!0),v&&i()},children:[(0,ed.jsxs)("div",{className:Pd["btn-copy__icon"],children:[(0,ed.jsx)("span",{className:(0,id.default)(Pd["btn-copy__icon-state"],{[Pd["btn-copy__icon-state_default"]]:!f}),dangerouslySetInnerHTML:{__html:null!==(u=null===(c=null===(d=r.copyButton)||void 0===d?void 0:d.svgSrc)||void 0===c?void 0:c.baseState)&&void 0!==u?u:""}}),(0,ed.jsx)("span",{className:(0,id.default)(Pd["btn-copy__icon-state"],{[Pd["btn-copy__icon-state_done"]]:f}),dangerouslySetInnerHTML:{__html:null!==(g=null===(p=null===(h=r.copyButton)||void 0===h?void 0:h.svgSrc)||void 0===p?void 0:p.doneState)&&void 0!==g?g:""}})]}),(0,ed.jsx)("div",{className:Pd["btn-copy__text"],children:e})]})})]}):null]})};var Ld=T(610),Td={insert:"head",singleton:!1};sd()(Ld.A,Td);const Ad=Ld.A.locals||{};var Rd=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Dd=e=>{var t,r,i,a,s,n,o,l,d,c,u,{shareLink:h,sharePanelOptions:p,onShareComplete:g}=e,f=Rd(e,["shareLink","sharePanelOptions","onShareComplete"]);const m=()=>{try{return new URL(h).host}catch(e){return console.error(e),null}},v=()=>{window.removeEventListener("focus",v),g()},b=()=>m()?"":encodeURIComponent(h),y=e=>{var t,r;const i=(()=>{try{return new URL(h)}catch(e){return console.error(e),null}})();if(!i)return"#";const a=null===(t=p.targetParams)||void 0===t?void 0:t[e];return null===(r=null==a?void 0:a.getUrl)||void 0===r?void 0:r.call(a,{url:i.toString(),text:b()})},w=null===(t=p.title)||void 0===t?void 0:t.favicon,S=p.text;return(0,ed.jsxs)("div",{className:Cd["share-panel__body"],children:[(0,ed.jsxs)("div",{className:`${Cd["share-panel-row"]} ${Cd["title-row"]}`,children:[m()&&Boolean(null==w?void 0:w.display)&&(0,ed.jsx)("div",{className:Cd["share-url-favicon"],style:{background:null==w?void 0:w.background},children:(0,ed.jsx)("img",{src:`${null!==(r=f.faviconApiUrl)&&void 0!==r?r:"https://favicon.inappstory.ru"}?sz=64&domain_url=${m()}`})}),(0,ed.jsx)("span",{className:Cd.title,style:S,children:null===(a=null===(i=p.title)||void 0===i?void 0:i.getValue)||void 0===a?void 0:a.call(i,{url:h,text:b()})})]}),(0,ed.jsx)("div",{className:Cd["share-panel-separator"],style:{background:null===(s=p.divider)||void 0===s?void 0:s.background}}),(0,ed.jsx)("div",{className:`${Cd["share-panel-row"]} ${Ad["social-list"]}`,children:null===(n=p.targets)||void 0===n?void 0:n.map(((e,t)=>{var r,i,a;const s=null===(r=p.targetParams)||void 0===r?void 0:r[e],n=null!==(a=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.svgSrc.baseState)&&void 0!==a?a:"<svg></svg>";return(0,ed.jsx)("div",{className:Ad["social-list__item"],children:(0,ed.jsxs)("a",{href:y(e),onClick:()=>((e,t,r)=>{window.addEventListener("focus",v),window.open(e,t,r)})(y(e),"newwindow","width=650,height=570"),target:"_blank",rel:"noopener noreferrer",className:`${Cd["share-item"]} ${Ad["share-item"]}`,children:[(0,ed.jsx)("div",{dangerouslySetInnerHTML:{__html:n}}),(0,ed.jsx)("span",{className:Cd["share-item-title"],style:S,children:null==s?void 0:s.label})]})},t)}))}),(0,ed.jsx)("div",{className:Cd["share-panel-separator"],style:{background:null===(o=p.divider)||void 0===o?void 0:o.background}}),(0,ed.jsx)("div",{className:Cd["share-panel-row"],children:(0,ed.jsxs)("a",{className:`${Cd["share-item"]} ${Ad["share-item"]}`,onClick:()=>{Ed(h),g()},children:[(0,ed.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(c=null===(d=null===(l=p.copyButton)||void 0===l?void 0:l.svgSrc)||void 0===d?void 0:d.baseState)&&void 0!==c?c:""}}),(0,ed.jsx)("span",{className:Cd["share-item-title"],style:S,children:null===(u=p.copyButton)||void 0===u?void 0:u.label})]})})]})};var Bd;!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Bd||(Bd={}));const Fd=({shareType:e,shareLink:t,shareText:r,onShareCompelete:i,sharePanelOptions:a,className:s})=>{const{dir:n}=Wh(),[o,l]=(0,rd.useState)(!1),[d,c]=(0,rd.useState)(!0),u=()=>{l(!0),c(!1)};return(0,ed.jsxs)("div",{dir:n,className:(0,id.default)(Cd["share-panel-wrapper"],s),onClick:e=>{e.stopPropagation()},onTouchStart:e=>{e.stopPropagation(),e.preventDefault()},children:[(0,ed.jsx)("div",{className:(0,id.default)(Cd["share-panel-backdrop"],{[Cd.fadeIn]:d,[Cd.fadeOut]:!d}),onClick:()=>{l(!1),c(!1)}}),(0,ed.jsxs)("div",{className:(0,id.default)(Cd["share-panel"],{[Cd.slideIn]:d,[Cd.slideOut]:!d}),onAnimationEnd:()=>{d||i(o)},style:{"--height":"100%",background:a.background,borderTopLeftRadius:a.borderRadius+"px",borderTopRightRadius:a.borderRadius+"px"},children:[e===Bd.SlideScreenshot&&(0,ed.jsx)(Id,{shareText:r,shareLink:t,onShareComplete:u,sharePanelOptions:a}),e===Bd.Social&&(0,ed.jsx)(Dd,{shareLink:t,onShareComplete:u,sharePanelOptions:a}),(0,ed.jsx)("div",{className:Cd["share-panel-separator"]})]})]})};var Nd=T(495),Ud={insert:"head",singleton:!1};sd()(Nd.A,Ud);const Wd=Nd.A.locals||{},zd=e=>{const t=(0,rd.useRef)(null),[r,i]=(0,rd.useState)(null);return(0,rd.useEffect)((()=>{const r=e.plugin.createLottiePlayer(t.current,e.config);return i(r),()=>{r.destroy()}}),[e.config.sha1]),(0,rd.useEffect)((()=>{r&&e.forceEnd&&r.stop()}),[r,e.forceEnd]),(0,rd.useEffect)((()=>{if(r)return r.on("play",e.onPlay),r.on("complete",e.onComplete),r.on("beforeLoad",e.onBeforeLoad),r.on("load",e.onLoad),r.on("minPlayingTimeExpired",e.onMinPlayingTimeExpired),r.on("error",e.onError),()=>{r.off("play",e.onPlay),r.off("complete",e.onComplete),r.off("beforeLoad",e.onBeforeLoad),r.off("load",e.onLoad),r.off("minPlayingTimeExpired",e.onMinPlayingTimeExpired),r.off("error",e.onError)}}),[r,e.onError,e.onPlay,e.onComplete,e.onLoad,e.onBeforeLoad,e.onMinPlayingTimeExpired]),(0,ed.jsx)("canvas",{ref:t,style:{width:"100%",height:"100%"}})},Vd=e=>{var t,r,i;const{storyManager:a}=Wh(),[s,n]=(0,rd.useState)(!1),[o,l]=(0,rd.useState)(!1),[d,c]=(0,rd.useState)(!1),[u,h]=(0,rd.useState)(!1),[p,g]=(0,rd.useState)(!1),[f,m]=(0,rd.useState)(!1),v=o||u||e.isGameLoading||!e.gameShouldBeShown,b=(0,rd.useMemo)((()=>a.getPlugin("dot-lottie")),[a]),y=d||!b||e.isGameLoadingError?null:(null===(r=null===(t=e.game)||void 0===t?void 0:t.splashLottieScreen)||void 0===r?void 0:r.url)&&(null===(i=e.game)||void 0===i?void 0:i.splashLottieScreen),w=e.game&&!e.isGameLoadingError&&v&&!o&&!y,S=()=>{var t,r,i,a;return e.desktopMode&&(null===(r=null===(t=e.game)||void 0===t?void 0:t.splashLandscapeScreen)||void 0===r?void 0:r.url)?e.game.splashLandscapeScreen.url:null===(a=null===(i=e.game)||void 0===i?void 0:i.splashScreen)||void 0===a?void 0:a.url},_=e.isGameInited&&(!y||p);(0,rd.useEffect)((()=>{_&&e.onSplashCanBeHidden()}),[_]);return(0,ed.jsxs)("div",{className:(0,id.default)(Wd["splash-container"],{[Wd["splash-container--fadeIn"]]:e.game,[Wd["splash-container--fadeOut"]]:e.gameShouldBeShown,[Wd["splash-container--isLoading"]]:w}),children:[(0,ed.jsx)("div",{className:Wd["splash-container__image"],style:{backgroundColor:e.splashImageBackgroundColor},children:S()&&(0,ed.jsx)("img",{src:S(),onLoad:()=>{m(!0)}})}),y&&b&&(0,ed.jsx)("div",{className:Wd["splash-container__lottie"],children:(0,ed.jsx)(zd,{plugin:b,forceEnd:e.gameShouldBeShown,config:y,onError:()=>{c(!0)},onPlay:()=>{l(!0),n(!1)},onComplete:()=>{l(!1),n(!0)},onLoad:()=>{h(!1)},onBeforeLoad:()=>{h(!0)},onMinPlayingTimeExpired:()=>{g(!0)}})})]})};var Gd=T(843),$d={insert:"head",singleton:!1};sd()(Gd.A,$d);const Hd=Gd.A.locals||{},qd=e=>{var t,r;return(0,ed.jsx)("button",{dir:e.dir,onClick:e.onCloseGame,className:Hd["close-btn"],"data-position":e.closeButtonPosition,dangerouslySetInnerHTML:{__html:null!==(r=null===(t=e.closeButtonOptions)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==r?r:""}})};const Qd=(e=>{var t={};return T.d(t,e),t})({observer:()=>y.observer});const Kd=(e=>{var t={};return T.d(t,e),t})({createPortal:()=>w.createPortal}),Yd=(He(),()=>{const e=window.innerWidth;return{vh:window.innerHeight,vw:e}}),Jd=()=>{const[e,t]=(0,rd.useState)((()=>Yd())),r=(0,rd.useCallback)((()=>{t(Yd())}),[]);return(0,rd.useEffect)((()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)})),[]),e},Zd=e=>50+parseFloat(String(e)),Xd=(e,t)=>{const r=e.hasLike&&Boolean(t.hasLike),i=e.hasShare&&Boolean(t.hasShare),a=e.hasFavorite&&Boolean(t.hasFavorite),s=e.hasAudio;return!e.isBlank&&(r||a||i||s)},ec=e=>{const{desktopMode:t,storyReaderOptions:r}=Wh();return(0,rd.useMemo)((()=>{const i=Zd(r.actionPanelBottomOffset),a=new ln(e.vw,e.vh,i),s=new on(a).create({vw:e.vw,vh:e.vh,desktopMode:t}),n=s instanceof nn,o=n?a.getViewportCorrectionPadding():{};return{actionPanelHeight:i,safeAreaFrameCalculator:a,storyGeometry:s,isMobileGeometry:n,correctionPaddingStyle:o}}),[r.actionPanelBottomOffset,e,t])};var tc=T(314),rc={insert:"head",singleton:!1};sd()(tc.A,rc);tc.A.locals;const ic=({storyManager:e,desktopMode:t})=>{const[r,i]=(0,rd.useState)(null),a=(()=>{const e=(0,rd.useRef)({top:0,bottom:0,left:0,right:0});return e.current||(e.current=(()=>{const e=getComputedStyle(document.documentElement),t=t=>parseFloat(e.getPropertyValue(t)),r=t("--ias-sat"),i=t("--ias-sab");return{left:t("--ias-sal"),right:t("--ias-sar"),top:r,bottom:i}})()),e.current})();return(0,rd.useEffect)((()=>{const t=e.createGameReader();return t.setSafeAreaInsets(a),i(t),()=>{t.destroy()}}),[e]),(0,rd.useEffect)((()=>{null==r||r.setDesktopMode(t)}),[r,t]),r},ac=(0,Qd.observer)((({gameReader:e})=>{var t,r,i,a,s,n,o,l,d,c;const{desktopMode:u,dir:h,gameReaderOptions:p,storyReaderOptions:g}=Wh(),f=(0,rd.useRef)(null),{sharePanelOpeningParams:m,handleShareComplete:v,closeSharePanel:b}=(e=>{const[t,r]=(0,rd.useState)(null);return(0,rd.useEffect)((()=>(null==e||e.on("openSharePanel",r),()=>{null==e||e.off("openSharePanel",r)})),[e]),{sharePanelOpeningParams:t,handleShareComplete:i=>{t&&e&&(e.confirmSharingComplete({shareId:t.shareId,isSuccess:i}),r(null))},closeSharePanel:()=>{r(null)}}})(e),{gameGeometry:y,isDesktopGeometry:w}=(()=>{const{desktopMode:e}=Wh(),{vw:t,vh:r}=Jd(),i=(new Es).create({vw:t,vh:r,desktopMode:e});return{isDesktopGeometry:i instanceof js,gameGeometry:i}})(),S=w&&(null===(r=null===(t=e.game)||void 0===t?void 0:t.screenOptions.widescreen)||void 0===r||r);$h((()=>{_()}));const _=()=>{e.closeGame(),b()},{game:O,gameError:C,isGameLoading:x,closeBtnVisible:k}=e,P=(0,id.default)(ld["game-reader"],{[ld["game-reader--desktop-mode"]]:w,[ld["game-reader--widescreen"]]:S}),j={background:null!==(a=null===(i=p.backdrop)||void 0===i?void 0:i.background)&&void 0!==a?a:"",opacity:null!==(n=null===(s=p.backdrop)||void 0===s?void 0:s.opacity)&&void 0!==n?n:0,filter:(null===(o=p.backdrop)||void 0===o?void 0:o.blur)?`blur(${p.backdrop.blur}px)`:"none"},M=null!==(d=null===(l=p.game)||void 0===l?void 0:l.backdropColor)&&void 0!==d?d:"";return(0,Kd.createPortal)((0,ed.jsx)("div",{className:ld["game-reader-container"],style:{"--game-box-border-radius":`${parseFloat(String(p.borderRadius))}px`},children:(0,ed.jsxs)("div",{className:P,children:[(0,ed.jsx)("div",{className:ld["game-reader__backdrop"],style:j}),(0,ed.jsxs)(md,{className:ld["game-reader__game-box"],isWidescreen:S,geometry:y,children:[(0,ed.jsx)(Vd,{onSplashCanBeHidden:()=>{e.notifyGameCanBeStarted()},desktopMode:w,isGameInited:e.isGameInited,isGameLoading:x,isGameLoadingError:Boolean(e.gameError),gameShouldBeShown:e.gameShouldBeShown,game:null!==(c=e.game)&&void 0!==c?c:void 0,splashImageBackgroundColor:e.game?M:j.background}),C&&(0,ed.jsx)(hd,{className:ld["game-reader__refresh-btn"],onClick:()=>{e.reload()}}),(!e.gameShouldBeShown||k)&&(0,ed.jsx)(qd,{closeButtonPosition:p.closeButtonPosition,dir:h,onCloseGame:_,closeButtonOptions:p.closeButton}),O&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("iframe",{src:O.url,onLoad:t=>{f.current=t.target,e.dir=h,e.setGameCenterIframe(f.current,{isWidescreen:S})},style:{opacity:e.gameShouldBeShown?1:0},frameBorder:"0",className:ld["game-reader__iframe"],sandbox:"allow-same-origin allow-top-navigation allow-forms allow-scripts allow-downloads allow-top-navigation-to-custom-protocols",allow:"fullscreen"}),m&&(0,ed.jsx)(Fd,{shareType:m.shareType,shareLink:m.shareLink,onShareCompelete:v,sharePanelOptions:g.sharePanel})]})]}),O&&p.forceCheckOrientation&&(0,ed.jsx)(Sd,{orientation:qe.PORTRAIT_PRIMARY,desktopMode:u,onOrientationChange:({isWrong:t})=>{e.isGameInited&&(t?e.pauseGameUI():e.resumeGameUI())}})]})}),document.body)}));var sc=T(130),nc={insert:"head",singleton:!1};sd()(sc.A,nc);const oc=sc.A.locals||{};class lc{constructor(e,t,r){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storiesViewer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"backdropRef",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"deltaValY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"windowHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"swipeUpGestureInAction",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startMove(){this.storyReaderViewModel.disableCloseGesture(),this.windowHeight=this.storiesViewer.clientHeight,this.storiesViewer.style.setProperty("transition","")}move(e){e>10||this.storyReaderViewModel.closeGestureInAction?(this.storyReaderViewModel.enableCloseGesture(),this.moveDownAndScaleReader(e)):(e<-10||this.swipeUpGestureInAction)&&this.moveUp(e)}endMove(){this.storyReaderViewModel.resumeTimer(),this.deltaValY>=0&&this.handleSwipeDown(),this.storyReaderViewModel.disableCloseGesture()}moveDownAndScaleReader(e){this.deltaValY=e/this.windowHeight;let t=1-(1-.9)*this.deltaValY;t>=1&&(t=1);let r=100*this.deltaValY*.45;r<=0&&(r=0),this.storiesViewer.style.setProperty("transform",`scale(${t}) translateY(${r}%)`)}moveUp(e){this.swipeUpGestureInAction=!0,this.deltaValY=e/this.windowHeight}returnToDefaultState(){this.storiesViewer.style.setProperty("transition","all .3s"),this.storiesViewer.style.setProperty("transform","scale(1) translateY(0%)")}closeStoryReader(){this.storiesViewer.style.setProperty("transition","opacity .3s"),this.storiesViewer.style.setProperty("opacity","0"),this.backdropRef.style.setProperty("transition","opacity .3s"),this.backdropRef.style.setProperty("opacity","0"),setTimeout((()=>{this.storyReaderViewModel.close("swipeDown")}),400)}handleSwipeDown(){this.deltaValY<=.15||!this.storyReaderViewModel.canBeClosed()?this.returnToDefaultState():this.closeStoryReader()}}const dc=(0,Qd.observer)((e=>{const t=(0,rd.useRef)(null),r=(0,rd.useRef)(null),{desktopMode:i,storyReaderOptions:a}=Wh();(({storyReaderViewModel:e,storiesViewerRef:t,backdropRef:r})=>{const i=(0,rd.useRef)(null);(0,rd.useEffect)((()=>{i.current=new lc(e,t.current,r.current)}),[]);const a=()=>{var e;t.current.classList.add(oc["no-select"]),null===(e=i.current)||void 0===e||e.startMove()},s=({dy:e})=>{var t;null===(t=i.current)||void 0===t||t.move(e)},n=()=>{var r;t.current.classList.remove(oc["no-select"]),e.touchController.verticalSwipeGesture&&(null===(r=i.current)||void 0===r||r.endMove())};(0,rd.useEffect)((()=>{const t=e.touchController;return t.on(Ra.TouchStart,a),t.on(Ra.TouchMoveVertical,s),t.on(Ra.TouchEnd,n),()=>{t.off(Ra.TouchStart,a),t.off(Ra.TouchMoveVertical,s),t.off(Ra.TouchEnd,n)}}),[e.touchController])})({storyReaderViewModel:e.storyReader,backdropRef:t,storiesViewerRef:r});const{safeAreaFrameCalculator:s,isMobileGeometry:n}=ec(e.viewport),o=!n||s.shouldBeShownSafeAreaInsets?parseFloat(String(a.borderRadius)):0;return(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{ref:r,className:(0,id.default)("stories-viewer",oc["stories-viewer"],oc.slider3d),style:Object.assign(Object.assign({},{"--loaderBackgroundColor":null===(l=a.loader)||void 0===l?void 0:l.default.color,"--loaderBackgroundAccentColor":null===(d=a.loader)||void 0===d?void 0:d.default.accentColor,"--timelineBlockTopOffset":`${parseFloat(String(a.timelineBlockTopOffset))}px`,"--slideBorderRadius":`${o}px`}),(()=>{var e,t,r,i;return{backgroundColor:null!==(t=null===(e=a.commonBackdrop)||void 0===e?void 0:e.color)&&void 0!==t?t:void 0,backdropFilter:null!==(i=null===(r=a.commonBackdrop)||void 0===r?void 0:r.backdropFilter)&&void 0!==i?i:void 0}})()),children:[i&&(0,ed.jsx)("div",{className:oc["stories-viewer-background"],style:(()=>{var t,r,i;const s=[],n=null===(t=e.storyReader.activeStory)||void 0===t?void 0:t.displayedSlideImage;return null!=a.slideBackdrop&&Array.isArray(a.slideBackdrop.linearGradientOverlay)&&s.push(`linear-gradient(${a.slideBackdrop.linearGradientOverlay.join(", ")})`),null!=n&&s.push(`url(${n})`),{backgroundImage:s.join(", "),opacity:(null===(r=a.slideBackdrop)||void 0===r?void 0:r.opacity)||0,filter:(null===(i=a.slideBackdrop)||void 0===i?void 0:i.blur)?`blur(${a.slideBackdrop.blur}px)`:"none"}})()}),e.children]}),(0,ed.jsx)("div",{ref:t,className:(0,id.default)(oc["stories-viewer-backdrop"],{[oc._desktopMode]:i})})]});var l,d}));var cc=T(390),uc={insert:"head",singleton:!1};sd()(cc.A,uc);const hc=cc.A.locals||{};var pc=T(594),gc={insert:"head",singleton:!1};sd()(pc.A,gc);const fc=pc.A.locals||{};var mc=T(187),vc={insert:"head",singleton:!1};sd()(mc.A,vc);const bc=mc.A.locals||{},yc=(0,Qd.observer)((({story:e,commonOptions:t,storyReaderOptions:r,muted:i,onClickMuteAction:a})=>{const{dir:s}=Wh(),n=e.hasLike&&Boolean(t.hasLike),o=e.hasShare&&Boolean(t.hasShare),l=e.hasFavorite&&Boolean(t.hasFavorite),d=e.hasAudio,c=Xd(e,t)?Zd(r.actionPanelBottomOffset):0;return(0,ed.jsx)("div",{dir:s,className:bc["stories-button-panel"],style:{height:`${c}px`,transform:`translateY(${c}px)`},children:Xd(e,t)&&(0,ed.jsxs)("div",{className:bc["stories-button-panel-actions"],children:[(()=>{if(!n)return null;const t=0===e.like||-1===e.like,i=0===e.like||1===e.like;return(0,ed.jsxs)("span",{children:[(0,ed.jsx)("span",{className:(0,id.default)(bc["button-panel-action"],{"like-up":t,"like-up-filled":1===e.like}),dangerouslySetInnerHTML:{__html:t?r.likeButton.svgSrc.baseState:r.likeButton.svgSrc.activeState},onClick:()=>{e.setLike(1===e.like?0:1)}}),(0,ed.jsx)("span",{className:(0,id.default)(bc["button-panel-action"],{"like-down":i,"like-down-filled":-1===e.like}),dangerouslySetInnerHTML:{__html:i?r.dislikeButton.svgSrc.baseState:r.dislikeButton.svgSrc.activeState},onClick:()=>{e.setDislike(-1===e.like?0:-1)}})]})})(),l&&(0,ed.jsx)("span",{children:(0,ed.jsx)("span",{className:(0,id.default)(bc["button-panel-action"],{bookmark:!e.favorite,"bookmark-filled":e.favorite}),dangerouslySetInnerHTML:{__html:e.favorite?r.favoriteButton.svgSrc.activeState:r.favoriteButton.svgSrc.baseState},onClick:()=>e.setBookmark(!e.favorite)})}),(0,ed.jsxs)("span",{className:bc["right-container"],children:[d&&(0,ed.jsx)("span",{children:(0,ed.jsx)("span",{className:(0,id.default)(bc["button-panel-action"],{"muted-icon":i,"sound-icon":!i}),dangerouslySetInnerHTML:{__html:i?r.muteButton.svgSrc.baseState:r.muteButton.svgSrc.activeState},onClick:a})}),o&&(0,ed.jsx)("span",{className:bc["button-panel-action"],dangerouslySetInnerHTML:{__html:r.shareButton.svgSrc.baseState},onClick:()=>{e.share()}})]})]})})}));var wc=T(349),Sc={insert:"head",singleton:!1};sd()(wc.A,Sc);const _c=wc.A.locals||{},Oc=e=>{var t,r;const{dir:i}=Wh();return(0,ed.jsx)("div",{className:_c["story-header"],children:!e.closeDisabled&&(0,ed.jsx)("button",{dir:i,"data-position":e.options.closeButtonPosition,className:(0,id.default)(_c["stories-viewer__close"],{[_c["_paused-ui"]]:e.uiPaused}),onClick:t=>{t.stopPropagation(),t.preventDefault(),e.onClose()},dangerouslySetInnerHTML:{__html:null!==(r=null===(t=e.options.closeButton)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==r?r:""}})})};var Cc=T(278),xc={insert:"head",singleton:!1};sd()(Cc.A,xc);const kc=Cc.A.locals||{};var Pc=T(323),jc={insert:"head",singleton:!1};sd()(Pc.A,jc);Pc.A.locals;const Mc=e=>{const t=e.slide,{slideContentRef:r}=(({slide:e,activeStory:t,currentStory:r,canBeInitialized:i,currentSlideIndex:a,activeSlideIndex:s,canBeShown:n,muted:o,timerPaused:l})=>{const d=(0,rd.useRef)(null),c=t.id===r.id,u=s===a,h=i&&n&&e.state===ms.Idle&&u,p=!(e.state!==ms.Started&&e.state!==ms.Error||u&&c),g=c&&u&&e.state===ms.Loaded;return(0,rd.useLayoutEffect)((()=>{h&&e.init(d.current)}),[e,h]),(0,rd.useLayoutEffect)((()=>{g&&e.start()}),[c,g]),(0,rd.useLayoutEffect)((()=>{p&&e.stop()}),[p]),(0,rd.useEffect)((()=>{l?e.pause():e.resume()}),[e,l,e.state]),(0,rd.useEffect)((()=>{o?e.mute():e.unmute()}),[e,o,e.state]),(0,rd.useLayoutEffect)((()=>()=>{e.destroy()}),[e]),{slideContentRef:d}})(e);return{slideContentRef:r,needLoadingMask:t.state===ms.Loading||!e.canBeShown,needLoadingAnimation:t.state===ms.Loading||!e.canBeShown}};var Ec=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Ic=(0,Qd.observer)((e=>{var{geometry:t}=e,r=Ec(e,["geometry"]);const{desktopMode:i,dir:a}=Wh(),{slideContentRef:s,needLoadingAnimation:n,needLoadingMask:o}=Mc(r),{slideStyle:l,slideContentStyle:d,needBottomPanel:c}=(({geometry:e,currentStory:t})=>{const{storyReaderOptions:r,commonOptions:i}=Wh(),a=(0,rd.useMemo)((()=>Xd(t,i)),[t,i]),s=a?Zd(r.actionPanelBottomOffset):0;return{needBottomPanel:a,slideStyle:(0,rd.useMemo)((()=>({margin:e.getOffset(s),width:e.getWidth(),height:e.getHeight(),"--y-offset":e.getOffsetY(s),"--x-offset":e.getOffsetX(s)})),[s,e]),slideContentStyle:(0,rd.useMemo)((()=>({fontSize:e.getFontSize()})),[e])}})({geometry:t,currentStory:r.currentStory}),u=r.networkError||r.slide.state===ms.Error,h=(0,rd.useMemo)((()=>({__html:r.slide.html})),[r.slide.html]);return(0,ed.jsxs)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),r.clickDisabled||(e=>{const s=e.target,n=new fs(r.slide,e,t,a,i);r.slide.onClick(s,n)})(e)},className:(0,id.default)(kc["stories-slide"],{[kc["active-slide"]]:r.currentSlideIndex===r.activeSlideIndex,[kc["_with-bottom-panel"]]:c,[kc["_desktop-mode"]]:t instanceof sn}),children:[(0,ed.jsx)("div",{className:kc["stories-slide-offset"],style:l,children:(0,ed.jsx)("div",{className:kc["stories-slide-box"],"data-testid":"stories-slide-box",children:(0,ed.jsx)("div",{ref:s,dangerouslySetInnerHTML:h,className:`${kc["stories-slide-content"]} narrative-slide"`,style:d})})}),(o||u)&&(0,ed.jsx)("div",{className:kc["load-mask"],onClick:e=>{e.preventDefault()},children:u?(0,ed.jsx)(hd,{className:kc["stories-slide__refresh-btn"],onClick:e=>{e.stopPropagation(),r.networkError?r.onReloadStory():r.slide.reload()}}):n&&(0,ed.jsx)("div",{className:kc["loading-spinner-default"]})})]})}));var Lc=T(137),Tc={insert:"head",singleton:!1};sd()(Lc.A,Tc);const Ac=Lc.A.locals||{},Rc=(0,rd.forwardRef)(((e,t)=>{const{desktopMode:r,dir:i}=Wh();return(0,ed.jsx)("div",{ref:t,dir:i,className:(0,id.default)(Ac["stories-pager"],{[Ac["_desktop-mode"]]:r,[Ac["_paused-ui"]]:e.uiPaused}),style:{"--stories-pager-tick-foreground":e.timeline.foreground,"--stories-pager-background":e.timeline.background},children:(0,ed.jsx)("div",{className:`${Ac["stories-pager__ticks"]} ${(0,id.default)({[Ac.hiddenTimeline]:e.hiddenTimeline})}`,children:new Array(e.slidesLength).fill(0).map(((t,r)=>(0,ed.jsxs)("div",{className:Ac["stories-pager__tick"],children:[(0,ed.jsx)("div",{className:(0,id.default)(Ac["stories-pager__tick-progress"],{[Ac._active]:r+1<=e.activeSlideIndex})}),(0,ed.jsx)("div",{className:Ac["stories-pager__tick-progress-loader"],style:{display:r+1===e.activeSlideIndex+1?"block":"none"}})]},r+1)))})})}));const Dc=function(){let e;const t=document.createElement("div"),r={transition:"transitionend",OTransition:"otransitionend",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&void 0!==t.style[e])return r[e]}();function Bc(e,t,r){return new Promise((i=>{let a=!1;const s=()=>{a=!0,clearTimeout(o),void 0!==Dc&&e.removeEventListener(Dc,n),e.style.setProperty("transition",`${t} 0ms`),i()},n=e=>{e.propertyName===t&&(a||s())};void 0!==Dc&&e.addEventListener(Dc,n,!1);const o=setTimeout((()=>{a||s()}),r+20);e.style.setProperty("transition",`${t} ${r}ms`)}))}var Fc=T(212),Nc={insert:"head",singleton:!1};sd()(Fc.A,Nc);const Uc=Fc.A.locals||{},Wc=e=>{const t=(0,rd.useRef)(null),r=(0,rd.useRef)(null),i=(0,rd.useRef)(0),a=(0,rd.useRef)(0);let s;const n=()=>{r.current&&(a.current=-1*function(e){const t=window.getComputedStyle(e),r=t.transform||t.webkitTransform||t.mozTransform;if("none"===r)return{x:0,y:0,z:0};const i=r.includes("3d")?"3d":"2d",a=r.match(/matrix.*\((.+)\)/)[1].split(", ");return"2d"===i?{x:isNaN(a[4])?0:a[4],y:isNaN(a[5])?0:a[5],z:0}:"3d"===i?{x:isNaN(a[12])?0:a[12],y:isNaN(a[13])?0:a[13],z:isNaN(a[14])?0:a[14]}:{x:0,y:0,z:0}}(r.current).x)},[o,l]=(0,rd.useState)(!1),[d,c]=(0,rd.useState)(!1),u=(0,rd.useRef)(!1),h=()=>{const t=rd.Children.count(e.children);return r.current&&t?r.current.scrollWidth/t:0};let p=!1;(0,rd.useEffect)((()=>{var e;return("ontouchstart"in window||window.navigator.msPointerEnabled||"ontouchstart"in document.documentElement)&&(p=!0),p||(r.current&&(s=null===(e=r.current.children[0])||void 0===e?void 0:e.offsetWidth),r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth,n()),i.current===a.current?c(!1):c(!0),0===a.current?l(!1):l(!0)),()=>{}}),[]);const g=(0,rd.useRef)(!1),f=(0,rd.useRef)(0);let m=0;const v=(0,rd.useRef)(!1),[b,y]=(0,rd.useState)(0),w=e=>{e<0&&(e=0),e>i.current&&(e=i.current),y(e)};(0,rd.useEffect)((()=>{b===i.current?c(!1):c(!0),l(0!==b)}),[b]);const S=e=>{if(!u.current)if(g.current){const t=e instanceof MouseEvent?e.pageX:e.touches&&e.touches[0].pageX;if(t!==f.current){v.current=!0,m=t;const e=f.current-m,r=a.current+e;w(r)}}else v.current=!1},_=e=>{v.current&&e.preventDefault(),setTimeout((()=>{v.current=!1})),g.current=!1,document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",_)};return(0,ed.jsxs)("div",{className:Uc["scrolling-carousel"],style:e.style,children:[(0,ed.jsx)("div",{className:Uc["scrolling-carousel__wrapper"],ref:t,onMouseDown:e=>{u.current||(e.preventDefault(),g.current=!0,f.current=e.pageX,r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth),r.current&&n(),document.addEventListener("mousemove",S),document.addEventListener("mouseup",_))},onTouchStart:e=>{u.current||(e.preventDefault(),g.current=!0,f.current=e.touches&&e.touches[0].pageX,r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth),r.current&&n(),document.addEventListener("touchmove",S),document.addEventListener("touchend",_))},onClickCapture:e=>{v.current&&(e.preventDefault(),e.stopPropagation())},children:(0,ed.jsx)("div",{className:Uc["scrolling-carousel__item"],ref:r,style:{transform:`translateX(${-1*b}px)`},children:e.children})}),!p&&(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsx)("div",{className:(0,id.default)(Uc["scrolling-carousel__arrow-button"],Uc["scrolling-carousel__arrow-button--left"],{[Uc["scrolling-carousel__arrow-button--show"]]:o}),onClick:async()=>{if(u.current)return;n();const e=a.current-h();w(e),u.current=!0,r.current&&await Bc(r.current,"transform",300),u.current=!1},children:(0,ed.jsx)("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ed.jsx)("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})})}),(0,ed.jsx)("div",{className:(0,id.default)(Uc["scrolling-carousel__arrow-button"],Uc["scrolling-carousel__arrow-button--right"],{[Uc["scrolling-carousel__arrow-button--show"]]:d}),onClick:async()=>{if(u.current)return;n();const e=a.current+h();w(e),u.current=!0,r.current&&await Bc(r.current,"transform",300),u.current=!1},children:(0,ed.jsx)("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ed.jsx)("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})})})]})]})},zc=({children:e,style:t,color:r,font:i,className:a})=>(0,ed.jsx)("div",{className:a,style:Object.assign({color:r,font:i},t),children:e});var Vc=T(108),Gc={insert:"head",singleton:!1};sd()(Vc.A,Gc);const $c=Vc.A.locals||{},Hc=({goods:e,onClick:t,options:r})=>{var i;const{imgSrc:a,title:s,subTitle:n,price:o,oldPrice:l}=e;return(0,ed.jsxs)("div",{className:(0,id.default)($c["goods-card"]),style:{color:null!==(i=r.mainTextColor)&&void 0!==i?i:"black"},onClick:t,children:[(0,ed.jsx)("div",{className:(0,id.default)($c.figure),style:{borderRadius:r.imageCornerRadius+"px",backgroundColor:r.imageBackgroundColor},children:a&&(0,ed.jsx)("img",{src:a,alt:s,style:{borderRadius:r.imageCornerRadius+"px",backgroundColor:r.imageBackgroundColor}})}),(0,ed.jsx)(zc,{font:r.subtitleFont,children:n}),(0,ed.jsx)(zc,{font:r.titleFont,children:s}),(0,ed.jsxs)("div",{className:$c.prices,children:[(0,ed.jsx)(zc,{font:r.priceFont,children:o}),(0,ed.jsx)(zc,{className:$c["typography--old-price"],font:r.oldPriceFont,color:r.oldPriceTextColor,children:l})]})]})},qc=e=>{const t=e.goodsWidgetOptions,r=t.goodsWidgetRenderingType||t.goodsList.renderingType;let i=[];return r===D.DEFAULT?i=e.goodsList.map(((r,i)=>(0,ed.jsx)(Hc,{options:t.goodsCard,goods:r,onClick:()=>e.onGoodsCardClick(r)},i))):r===D.CUSTOM_CARD&&(0,oe.default)(t.getCardHtml)&&(i=e.goodsList.map(((r,i)=>{var a,s;return(0,ed.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(s=null===(a=t.getCardHtml)||void 0===a?void 0:a.call(t,r,i))&&void 0!==s?s:""},onClick:()=>e.onGoodsCardClick(r)},i)}))),(0,ed.jsx)(Wc,{style:{marginTop:"-15px"},children:i})};var Qc=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Kc=e=>{var{arrowColor:t}=e,r=Qc(e,["arrowColor"]);return(0,ed.jsx)("svg",Object.assign({},r,{width:"32",height:"12.5",viewBox:"0 0 64 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ed.jsx)("path",{d:"M56.293 1.23375C58.054 -0.41125 60.846 -0.41125 62.607 1.23375C64.464 2.96775 64.464 5.85675 62.607 7.59075L35.157 23.2288C33.396 24.8738 30.604 24.8738 28.843 23.2288L1.393 7.59075C0.494002 6.75175 0 5.62775 0 4.41275C0 3.19775 0.494002 2.07375 1.393 1.23475C3.154 -0.410251 5.946 -0.410251 7.707 1.23475L32 13.9237L56.293 1.23375Z",fill:t})}))};var Yc=T(161),Jc={insert:"head",singleton:!1};sd()(Yc.A,Jc);const Zc=Yc.A.locals||{},Xc=({closeImage:e,arrowColor:t,onClick:r})=>(0,ed.jsx)("div",{className:Zc.btn,onClick:r,onTouchStart:r,children:e?(0,ed.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}):(0,ed.jsx)(Kc,{arrowColor:t})});var eu=T(277),tu={insert:"head",singleton:!1};sd()(eu.A,tu);const ru=eu.A.locals||{},iu=({isLoading:e,backgroundColor:t="white",accentBackgroundColor:r="transparent"})=>e?(0,ed.jsx)("div",{className:ru.spinner,style:{border:`solid 2px ${t}`,borderColor:`${r} ${t} ${t} ${t}`}}):null;var au=T(940),su={insert:"head",singleton:!1};sd()(au.A,su);const nu=au.A.locals||{};var ou;!function(e){e[e.IN=0]="IN",e[e.OUT=1]="OUT"}(ou||(ou={}));const lu=({open:e,url:t,goodsWidgetOptions:r,onClosed:i,onClose:a,onGoodsCardClick:s})=>{const n=(0,rd.useRef)(null),[o,l]=(0,rd.useState)([]),[d,c]=(0,rd.useState)(ou.IN),u=r,{dimColor:h,substrateHeight:p,substrateColor:g,closeImage:f,closeBackgroundColor:m}=u.goodsList;(0,rd.useEffect)((()=>{c(e?ou.IN:ou.OUT)}),[e]),(0,rd.useEffect)((()=>{t&&v()}),[t]);const v=async()=>{const e=b(),t=await r.openGoodsWidgetHandler(e);l(t)},b=()=>{try{return JSON.parse(t).map((e=>({sku:e,title:"",subTitle:"",price:"",oldPrice:"",rawData:{}})))}catch(e){return console.error(e),[]}};(0,rd.useEffect)((()=>{const e=n.current;if(d===ou.OUT)return e.addEventListener("animationend",i),()=>{e.removeEventListener("animationend",i)}}),[d]);const y=u.loader.custom?(0,ed.jsx)("div",{dangerouslySetInnerHTML:{__html:u.loader.custom}}):(0,ed.jsx)(iu,{isLoading:!o,backgroundColor:u.loader.default.color,accentBackgroundColor:u.loader.default.accentColor});return(0,ed.jsxs)("div",{className:(0,id.default)(nu["goods-container"],{[nu["goods-container--visible"]]:d===ou.IN,[nu["goods-container--hidden"]]:d===ou.OUT}),ref:n,children:[(0,ed.jsx)("div",{className:(0,id.default)(nu["goods-container__backdrop"]),style:{backgroundColor:h},onClick:a}),(0,ed.jsxs)("div",{className:(0,id.default)(nu["goods-container"]),style:{height:p+"px",backgroundColor:null!=g?g:"white"},children:[y,o&&(0,ed.jsx)(qc,{goodsList:o,onGoodsCardClick:s,goodsWidgetOptions:r}),(0,ed.jsx)(Xc,{onClick:a,closeImage:f,arrowColor:m})]})]})};var du=T(942),cu={insert:"head",singleton:!1};sd()(du.A,cu);const uu=du.A.locals||{},hu=e=>{const[t,r]=(0,rd.useState)(!1),[i,a]=(0,rd.useState)(!1),{storyManager:s}=Wh(),n=()=>{a(!0),r(!0)},o=()=>{r(!1)};(0,rd.useEffect)((()=>(e.widget.on(ds.Open,n),()=>{e.widget.off(ds.Open,n)})),[e.widget]),(0,rd.useEffect)((()=>(fi.addListener("goodsWidget.close",o),()=>{fi.removeListener("goodsWidget.close",o)})),[]),(0,rd.useEffect)((()=>{t&&s.emit("widgetEvent",{name:"w-goods-open",data:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.widget.elementId}})}),[t]);return i?(0,ed.jsx)("div",{className:uu["goods-widget-viewer"],children:(0,ed.jsx)(lu,{open:t,url:e.widget.targetUrl,goodsWidgetOptions:e.goodsWidgetOptions,onClose:()=>{r(!1)},onClosed:()=>{e.widget.close(),a(!1)},onGoodsCardClick:t=>{var r,i;s.emit("widgetEvent",{name:"w-goods-click",data:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.widget.elementId,widget_value:t.sku}}),null===(i=(r=e.goodsWidgetOptions).itemClickHandler)||void 0===i||i.call(r,t)}})}):null},pu={247:"9999",376:"99 99 99",971:"99 999 9999",93:"99 999 9999",1268:"999 9999",1264:"999 9999",355:"999 999 999",374:"99 999 999",599:"999 9999",244:"999 999 999",672:"9 99 999",54:"999 999 9999",1684:"999 9999",43:"999 999 9999",61:"9 9999 9999",297:"999 9999",994:"99 999 99 99",387:"99 999 999",1246:"999 9999",880:"99 999 999",32:"999 999 999",226:"99 99 9999",359:"999 999 999",973:"9999 9999",257:"99 99 9999",229:"99 99 9999",1441:"999 9999",673:"999 9999",591:"9 999 9999",55:"99 99999 9999",1242:"999 9999",975:"99 999 999",267:"99 999 999",375:"99 999 99 99",501:"999 9999",243:"999 999 999",236:"99 99 9999",242:"99 999 9999",41:"99 999 9999",225:"99 999 999",682:"99 999",56:"9 9999 9999",237:"9999 9999",86:"999 9999 9999",57:"999 999 9999",506:"9999 9999",53:"9 999 9999",238:"999 99 99",357:"99 999 999",420:"999 999 999",49:"9999 999 9999",253:"99 99 99 99",45:"99 99 99 99",1767:"999 9999",1809:"999 9999",1829:"999 9999",1849:"999 9999",213:"99 999 9999",593:"99 999 9999",372:"9999 9999",20:"999 999 9999",291:"9 999 999",34:"999 999 999",251:"99 999 9999",358:"999 999 99 99",679:"99 99999",500:"99999",691:"999 9999",298:"999 999",262:"99999 9999",33:"999 999 999",508:"99 9999",590:"999 999 999",241:"9 99 99 99",1473:"999 9999",995:"999 999 999",594:"99999 9999",233:"999 999 999",350:"999 99999",299:"99 99 99",220:"999 99 99",224:"99 999 999",240:"99 999 9999",30:"999 999 9999",502:"9 999 9999",1671:"999 9999",245:"9 999999",592:"999 9999",852:"9999 9999",504:"9999 9999",385:"99 999 999",509:"99 99 9999",36:"999 999 999",628:"99 999 9999",62:"99 999 99",353:"999 999 999",972:"99 999 9999",91:"9999 999 999",246:"999 9999",964:"999 999 9999",98:"999 999 9999",354:"999 9999",39:"999 9999 999",1876:"999 9999",962:"9 9999 9999",81:"99 9999 9999",254:"999 999999",996:"999 999 999",855:"99 999 999",686:"99 999",269:"99 99999",1869:"999 9999",850:"999 999 9999",82:"99 999 9999",965:"9999 9999",1345:"999 9999",76:"99 999 99 99",77:"99 999 99 99",856:"99 99 999 999",961:"99 999 999",1758:"999 9999",423:"999 999 9999",94:"99 999 9999",231:"99 999 999",266:"9 999 9999",370:"999 99 999",352:"999 999 999",371:"99 999 999",218:"99 999 9999",212:"99 9999 999",377:"9999 9999",373:"9999 9999",382:"99 999 999",261:"99 99 99999",692:"999 9999",389:"99 999 999",223:"99 99 9999",95:"99 999 999",976:"99 99 9999",853:"9999 9999",1670:"999 9999",596:"999 99 99 99",222:"99 99 9999",1664:"999 9999",356:"9999 9999",230:"999 9999",960:"999 9999",265:"99 999 9999",52:"999 999 9999",60:"99 999 9999",258:"99 999 999",264:"99 999 9999",687:"99 9999",227:"99 99 9999",234:"999 999 9999",505:"9999 9999",31:"99 999 9999",47:"999 99 999",977:"99 999 999",674:"999 9999",683:"9999",64:"999 999 999",968:"99 999 999",507:"999 9999",51:"999 999 999",689:"99 99 99",675:"999 99 999",63:"999 999 9999",92:"999 999 9999",48:"999 999 999",970:"99 999 9999",351:"99 999 9999",680:"999 9999",595:"999 999 999",974:"9999 9999",40:"99 999 9999",381:"99 999 9999",7:"999 999 99 99",250:"999 999 999",966:"99 999 9999",677:"999 9999",248:"9 999 999",249:"99 999 9999",46:"99 999 9999",65:"9999 9999",290:"99 999",386:"99 999 999",421:"999 999 999",232:"99 999999",378:"9999 999999",221:"99 999 9999",252:"99 999 999",597:"999 9999",211:"99 999 9999",239:"99 99999",503:"99 99 9999",1721:"999 9999",963:"99 9999 999",268:"99 99 9999",1649:"999 9999",235:"99 99 99 99",228:"99 999 999",66:"99 999 9999",992:"99 999 9999",690:"9999",670:"999 9999",993:"9 999 9999",216:"99 999 999",676:"99999",90:"999 999 9999",1868:"999 9999",688:"99 9999",886:"999 999 999",255:"99 999 9999",380:"99 999 99 99",256:"999 999 999",44:"99 9999 9999",598:"9 999 99 99",998:"99 999 9999",396:"999 99999",1784:"999 9999",58:"999 999 9999",1284:"999 9999",1340:"999 9999",84:"99 9999 999",678:"99 99999",681:"99 9999",685:"99 9999",967:"999 999 999",27:"99 999 9999",260:"99 999 9999",263:"9 999999",1:"999 999 9999",383:"9999 9999"};class gu{static isEmailValid(e){return/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(e)}static isTelephoneValid(e,t){return e?e.replace(/\s/g,"").length===t.length&&t.length>0:/^\d+$/.test(t)}}const fu=e=>{switch(e){case"":default:return"text";case"tel":return"tel";case"email":return"email"}},mu=e=>{const[t,r]=(0,rd.useState)({countryCode:"",phone:""}),[i,a]=(0,rd.useState)(""),[s,n]=(0,rd.useState)(!0),o=r=>{var i;const a=fu(null!==(i=null==e?void 0:e.configV2.main.input.type)&&void 0!==i?i:"");return"email"===a?gu.isEmailValid(r):"tel"!==a||gu.isTelephoneValid((()=>{var e;const r=t.countryCode.substring(1);return r&&null!==(e=pu[r])&&void 0!==e?e:""})(),t.phone)};return{value:i,telephone:t,isValid:s,handleTelephoneChange:e=>{r(e),e.phone.length>0?a(e.countryCode+e.phone):a("")},handleChange:e=>{a(e)},handleSubmit:e=>{const t=i.trim(),r=o(i);n(r),r&&e({value:t})},reset:()=>{n(!0),a(""),r({countryCode:"",phone:""})}}};var vu=T(169),bu={insert:"head",singleton:!1};sd()(vu.A,bu);const yu=vu.A.locals||{},wu=(0,rd.forwardRef)(((e,t)=>{const r=(0,rd.useRef)(null);return(0,rd.useEffect)((()=>{Ae(r.current),r.current.focus()}),[]),(0,ed.jsx)("input",{type:"email",className:(0,id.default)(yu.input,yu.input_centered),placeholder:e.placeholder,value:e.value,ref:r,onChange:t=>e.onChange(t.target.value)})}));const Su=(e=>{var t={};return T.d(t,e),t})({default:()=>S.default}),_u=(0,rd.forwardRef)(((e,t)=>{const r=t=>{const r=t.target;r&&(r.value=r.value.replace(/\D/g,""),e.onChange({countryCode:e.value.countryCode,phone:r.value}))},i=e.value.countryCode.substring(1),a=i?pu[i]:"";return(0,ed.jsxs)("div",{className:yu["input-group"],children:[(0,ed.jsxs)("div",{className:yu["input-group__prepend"],children:[(0,ed.jsx)(Su.default,{type:"tel",mask:"+999",maskChar:null,className:yu.input,onChange:t=>{e.onChange({countryCode:t.currentTarget.value,phone:e.value.phone})},value:e.value.countryCode,placeholder:"+",inputRef:e=>{e&&(e=>{setTimeout((()=>{Ae(e),e.focus()}))})(e)}}),(0,ed.jsx)("div",{className:yu["input-group__separator"]})]}),a?(0,ed.jsx)(Su.default,{type:"tel",className:yu.input,mask:a,maskChar:"-",alwaysShowMask:!0,placeholder:e.placeholder,inputRef:e=>{},value:e.value.phone,onChange:r}):(0,ed.jsx)("input",{type:"tel",className:yu.input,placeholder:e.placeholder,ref:e=>{},value:e.value.phone,onChange:r})]})})),Ou=(0,rd.forwardRef)(((e,t)=>{const r=(0,rd.useRef)(null),i=(0,rd.useRef)(null);(0,rd.useEffect)((()=>{i.current.dataset.replicatedValue=e.value,Ae(r.current),r.current.focus(),r.current.setSelectionRange(e.value.length,e.value.length)}),[]);return(0,ed.jsx)("div",{className:yu["textarea-grow-wrap"],ref:i,style:e.style,children:(0,ed.jsx)("textarea",{className:yu.input,placeholder:e.placeholder,rows:1,ref:r,maxLength:e.maxLength,value:e.value,onChange:t=>e.onChange(t.target.value),onInput:e=>{i.current.dataset.replicatedValue=e.currentTarget.value}})})}));var Cu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const xu=e=>{var{form:t,config:r}=e,i=Cu(e,["form","config"]);const[a,s]=(0,rd.useState)(!0),{getMainStyle:n,getMainElementsStyle:o,getQuestionStyle:l,getInputWrapperStyle:d,getButtonStyle:c,getTextareaStyle:u}=(({config:e})=>{const t=t=>t*(e.size.viewportWidth/(e.size.viewportWidth/e.size.fontSize));return{getMainStyle:()=>{const r=e.configV2.main;return{width:`${e.size.absolute.width}px`,height:"auto",left:e.size.absolute.center.x-e.size.absolute.width/2-e.size.slideOffsetX+"px",top:e.size.absolute.center.y-e.size.absolute.height/2-e.size.slideOffsetY+"px",backgroundColor:`${r.background.color}`,border:`${r.border.visible&&`${t(r.border.width)}px solid ${r.border.color}`}`,borderRadius:`${t(r.border.radius)}px`}},getMainElementsStyle:()=>{const r=e.configV2.main;return{width:"100%",padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`}},getQuestionStyle:()=>{const r=e.configV2.main.question;return{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}},getInputWrapperStyle:()=>{const r=e.configV2.main.input;let i=e.configV2.main.input.text.maxLines;return i=i>0?i:1,{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,backgroundColor:`${r.background.color}`,border:`${t(r.border.width)}px solid ${r.border.color}`,borderRadius:`${t(r.border.radius)}px`,lineHeight:`${r.text.lineHeight}`,maxHeight:r.text.lineHeight*i+"em",fontSize:`${t(r.text.size)}px`,overflowY:"scroll",scrollbarWidth:"none"}},getButtonStyle:()=>{const r=e.configV2.main.button;return{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,backgroundColor:`${r.background.color}`,border:`${t(r.border.width)}px solid ${r.border.color}`,color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}},getTextareaStyle:()=>{const r=e.configV2.main.input;return{color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}}}})({config:r}),h=Math.max(r.configV2.main.input.text.limit,0),p=String(r.configV2.main.input.text.placeholder).trim(),g=String(r.configV2.main.button.text.value).trim(),f=String(r.configV2.main.question.text.value).trim(),m=fu(r.configV2.main.input.type),v=({value:e})=>{i.onComplete({result:!0,value:e}),s(!1)};return(0,ed.jsxs)("div",{className:yu.wrapper,children:[(0,ed.jsx)("div",{className:(0,id.default)(yu.backdrop,{[yu.fadeIn]:a,[yu.fadeOut]:!a}),onAnimationEnd:()=>{a||i.onClose()},onClick:()=>{i.onComplete({result:!1,value:t.value}),s(!1)}}),(0,ed.jsxs)("div",{className:yu.main,style:n(),children:[(0,ed.jsxs)("div",{className:yu["main-elements"],style:o(),children:[(0,ed.jsx)("div",{className:yu.question,style:l(),children:f}),(0,ed.jsxs)("div",{className:(0,id.default)(yu["input-wrapper"],{[yu["is-invalid"]]:!t.isValid}),style:d(),children:["text"===m&&(0,ed.jsx)(Ou,{value:t.value,onChange:t.handleChange,style:u(),placeholder:p,maxLength:h}),"email"===m&&(0,ed.jsx)(wu,{value:t.value,onChange:t.handleChange,placeholder:p}),"tel"===m&&(0,ed.jsx)(_u,{value:t.telephone,onChange:t.handleTelephoneChange,placeholder:p})]})]}),t.value.trim().length>0&&(0,ed.jsx)("div",{className:yu["button-wrapper"],children:(0,ed.jsx)("button",{className:yu.button,style:c(),onClick:()=>t.handleSubmit(v),children:g})})]})]})},ku=({storyGeometry:e,activeSlide:t,storyRef:r,storyReader:i})=>{const[a,s]=(0,rd.useState)(null),[n,o]=(0,rd.useState)(null),l=mu(n);(0,rd.useEffect)((()=>(fi.on(pn.ShowInputModal,d),()=>{fi.off(pn.ShowInputModal,d)})),[]);const d=({id:t,config:a})=>{i.pauseUI(),i.touchController.disable(),s(t),(t=>{t.size.fontSize=parseFloat(e.getFontSize()),t.size.viewportWidth=e.calculateWidth();const i=r.current.getBoundingClientRect();t.size.slideOffsetX=i.x,t.size.slideOffsetY=i.y,t.size.slideHeight=i.height,o(t)})(a)};return(0,rd.useLayoutEffect)((()=>()=>{l.reset()}),[a]),n?(0,ed.jsx)(xu,{form:l,config:n,onComplete:e=>{if(!a)throw new Error;((e,r)=>{t.setUserData(e,r)})(a,e.result?e.value:""),i.resumeUI()},onClose:()=>{o(null),i.touchController.enable()}}):null};var Pu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const ju=(0,Qd.observer)((e=>{var t,{story:r,geometry:i,storyReader:a,className:s}=e,n=Pu(e,["story","geometry","storyReader","className"]);const o=(0,rd.useRef)(null),l=(0,rd.useRef)(null);(({story:e,progressBarRef:t})=>{const r=e.timer;(0,rd.useEffect)((()=>{const i=e=>{var r;null===(r=t.current)||void 0===r||r.style.setProperty("--tick",e+"%")},a=({forceEnd:t})=>{t||(e.reachEnd?e.nextStory("auto"):e.nextSlide())},s=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")},n=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")};return r.on("start",s),r.on("stop",n),r.on("progress",i),r.on("complete",a),()=>{r.off("start",s),r.off("progress",i),r.off("complete",a),r.off("stop",n)}}),[r,e])})({story:r,progressBarRef:l});const d=(0,rd.useMemo)((()=>{var e,t;return(null!==(t=null===(e=r.activeSlide)||void 0===e?void 0:e.findAllWidgetsOfType((e=>e instanceof cs)))&&void 0!==t?t:[])[0]}),[null===(t=r.activeSlide)||void 0===t?void 0:t.state]),c=async()=>{try{await r.reload()}catch(e){console.error(e)}};return(0,ed.jsxs)("div",{ref:o,className:(0,id.default)(fc["stories-item"],fc.slider3d__item,s),onMouseDown:()=>{r.completeNativeSharing()},onTouchStart:()=>{r.completeNativeSharing()},"data-testid":"story",style:n.style,children:[(0,ed.jsx)(Oc,{closeDisabled:r.disableClose,options:n.storyReaderOptions,onClose:n.onClose,uiPaused:a.uiPaused}),r.activeSlide&&(0,ed.jsx)(Rc,{ref:l,hiddenTimeline:r.hiddenTimeline,slidesLength:r.slidesCount,timeline:r.activeSlide.timeline,activeSlideIndex:r.activeSlideIndex,uiPaused:a.uiPaused}),r.displayedSlides.map((e=>(0,ed.jsx)(Ic,{clickDisabled:n.slideClickDisabled,onReloadStory:c,activeSlideIndex:r.activeSlideIndex,currentSlideIndex:e.index,canBeInitialized:n.canBeInitialized,networkError:Boolean(r.error),currentStory:r,activeStory:n.activeStory,geometry:i,slide:e,canBeShown:r.canBeShown,timerPaused:a.timerPaused,muted:a.muted},e.html))),(0,ed.jsx)(yc,{story:r,commonOptions:n.commonOptions,storyReaderOptions:n.storyReaderOptions,muted:a.muted,onClickMuteAction:()=>{a.muted?a.unmute():a.mute()}}),d&&n.activeStory===r&&(0,ed.jsx)(hu,{widget:d,story:r,goodsWidgetOptions:n.goodsWidgetOptions}),n.activeStory===r&&r.activeSlide&&(0,ed.jsx)(ku,{storyRef:o,storyGeometry:i,activeSlide:r.activeSlide,storyReader:a})]})})),Mu=({className:e,style:t})=>(0,ed.jsx)("div",{className:(0,id.default)(fc["stories-item"],e),style:t,children:(0,ed.jsx)("div",{className:`${kc["stories-slide"]} ${kc._dummy}`})});var Eu=T(50),Iu={insert:"head",singleton:!1};sd()(Eu.A,Iu);const Lu=Eu.A.locals||{};var Tu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Au=e=>{var{width:t,disabledByUI:r,navigationOptions:i}=e,a=Tu(e,["width","disabledByUI","navigationOptions"]);const{desktopMode:s,dir:n}=Wh(),o=n===ne.LTR,l=(o?a.isNextStoryBlank:a.isPrevStoryBlank)||r,d=(o?a.isPrevStoryBlank:a.isNextStoryBlank)||r;return(0,ed.jsxs)("div",{className:(0,id.default)([Lu["story-reader-controls"]],{[Lu._desktop_mode]:s}),children:[(0,ed.jsx)("div",{className:Lu.slider3d__btn_next,style:{transform:`translateY(-50%) translateX(calc(${t/2}px + 100%))`},children:(0,ed.jsx)("button",{className:Lu["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),a.disabled||(o?a.onNext():a.onPrev())},disabled:l,dangerouslySetInnerHTML:{__html:i.nextButton.svgSrc.baseState}})}),(0,ed.jsx)("div",{className:Lu.slider3d__btn_prev,style:{transform:`translateY(-50%) translateX(calc(-${t/2}px - 200%))`},children:(0,ed.jsx)("button",{className:Lu["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),a.disabled||(o?a.onPrev():a.onNext())},disabled:d,dangerouslySetInnerHTML:{__html:i.prevButton.svgSrc.baseState}})})]})},Ru=e=>{const{storyReaderOptions:t}=Wh(),r=(0,rd.useRef)(null),i=(0,rd.useRef)(new ls).current;(({slider:e,touchController:t})=>{const r=()=>{null==e||e.startMove()},i=({dx:t})=>{null==e||e.move(-t)},a=()=>{t.horizontalSwipeGesture&&(null==e||e.endMove())};(0,rd.useEffect)((()=>(t.on(Ra.TouchStart,r),t.on(Ra.TouchMoveHorizontal,i),t.on(Ra.TouchEnd,a),()=>{t.off(Ra.TouchStart,r),t.off(Ra.TouchMoveHorizontal,i),t.off(Ra.TouchEnd,a)})),[t])})({slider:i,touchController:e.touchController});const a=t.scrollStyle,s=e.stories;i.currentIndex=e.activeStoryIndex;const n=e.touchController;(0,rd.useLayoutEffect)((()=>{const e=()=>{i.init({$el:r.current,transformStyle:a})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[s.length,a]),(0,rd.useLayoutEffect)((()=>{e.setAnimatedTransitionAdapter(new Xn(i,{closeOnLastSlideByTimer:Boolean(t.closeOnLastSlideByTimer)}))}),[e,t.closeOnLastSlideByTimer]),(0,rd.useEffect)((()=>(i.on("transitionStart",l),i.on("transitionEnd",d),i.on("touchMove",o),i.on("touchEnd",c),()=>{i.off("transitionStart",l),i.off("transitionEnd",d),i.off("touchMove",o),i.off("touchEnd",c)})),[e]);const o=()=>{n.disable()},l=()=>{n.disable()},d=()=>{n.enable()},c=t=>{e.resumeTimer(),0===t?i.transformWithAmimation(0):e.navigateStoryWithAnimationByIndex(e.activeStoryIndex+t,"swipe")};return{ref:r,api:i,perspective:i.perspective,depth:i.depth}},Du=(0,Qd.observer)((e=>{const{storyReaderOptions:t,commonOptions:r,goodsWidgetOptions:i}=Wh(),a=Ru(e.storyReader),{actionPanelHeight:s,safeAreaFrameCalculator:n,isMobileGeometry:o,storyGeometry:l,correctionPaddingStyle:d}=ec(e.viewport),c=e.storyReader.activeStory,u=e.storyReader.stories;(0,rd.useEffect)((()=>{a.api.animating?c.timer.pause():c.timer.resume()}),[c,a.api.animating]);return(0,ed.jsxs)(ed.Fragment,{children:[(0,ed.jsxs)("div",{className:(0,id.default)(hc.slider3d__wrapper,{[hc["slider3d__wrapper_swipe-up"]]:e.storyReader.closeGestureInAction,[hc._desktop_mode]:!o}),style:Object.assign({WebkitPerspective:`${a.perspective}px`,perspective:`${a.perspective}px`,width:l.getWidth(),backgroundColor:o&&n.shouldBeShownSafeAreaInsets&&"#000"},d),children:[(0,ed.jsx)("div",{className:hc.slider3d__inner,style:{transform:`translateZ(-${a.depth}px)`},children:(0,ed.jsx)("div",{className:(0,id.default)(hc["stories-face"],hc.slider3d__rotater),ref:a.ref,children:u.map(((n,o)=>{if(n.isBlank)return(0,ed.jsx)(Mu,{style:{bottom:0}},n.id);const d=((t,r)=>t>=e.storyReader.activeStoryIndex-r&&t<=e.storyReader.activeStoryIndex+r)(o,0)||o===e.storyReader.nextFlippingStoryIndex;return(0,ed.jsx)(ju,{slideClickDisabled:e.storyReader.uiPaused||a.api.animating,index:o,story:n,activeStory:c,canBeInitialized:d,geometry:l,style:{bottom:Xd(n,r)?`${s}px`:0},commonOptions:r,storyReaderOptions:t,goodsWidgetOptions:i,onClose:e.onCloseStory,storyReader:e.storyReader},n.id)}))})}),e.sharePanel.isOpened&&(0,ed.jsx)(Fd,{className:hc["share-panel-wrapper"],shareText:e.sharePanel.params.text,shareType:e.sharePanel.params.type,shareLink:e.sharePanel.params.link,onShareCompelete:t=>e.sharePanel.handleShareComplete(e.sharePanel.params.id,t),sharePanelOptions:t.sharePanel})]}),(0,ed.jsx)(Au,{disabled:a.api.animating,disabledByUI:e.storyReader.uiPaused||e.sharePanel.isOpened,isNextStoryBlank:e.storyReader.reachEnd,isPrevStoryBlank:e.storyReader.reachStart,navigationOptions:t.navigation,width:l.calculateWidth(),onNext:()=>e.storyReader.nextStoryWithAnimation(),onPrev:()=>e.storyReader.prevStoryWithAnimation()})]})})),Bu=(0,Qd.observer)((({storyReader:e,desktopMode:t})=>{const r=Jd();(({touchController:e,sharePanelIsOpened:t,desktopMode:r,storyReader:i})=>{(0,rd.useEffect)((()=>{r||t?e.disable():e.enable()}),[e,r,t]),(0,rd.useEffect)((()=>(e.on(Ra.LongTouchDetected,a),e.on(Ra.TouchEnd,s),()=>{e.off(Ra.LongTouchDetected,a),e.off(Ra.TouchEnd,s)})),[e]);const a=()=>{i.pauseTimer()},s=()=>{e.isSwiping||i.resumeTimer()}})({touchController:e.touchController,sharePanelIsOpened:e.sharePanel.isOpened,desktopMode:t,storyReader:e});return e.sharePanel.desktopMode=t,(0,Kd.createPortal)((0,ed.jsxs)(dc,{viewport:r,storyReader:e,children:[(0,ed.jsx)(Du,{viewport:r,storyReader:e,onCloseStory:()=>{e.close()},sharePanel:e.sharePanel}),(0,ed.jsx)(Sd,{orientation:qe.PORTRAIT_PRIMARY,desktopMode:t,onOrientationChange:({isWrong:t})=>{t?e.pauseUI():e.resumeUI()}})]}),document.body)}));const Fu=(e=>{var t={};return T.d(t,e),t})({LitElement:()=>_.LitElement,css:()=>_.css,html:()=>_.html,nothing:()=>_.nothing});const Nu=(e=>{var t={};return T.d(t,e),t})({customElement:()=>O.customElement,property:()=>O.property,query:()=>O.query,state:()=>O.state});class Uu{constructor(e){Object.defineProperty(this,"host",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.host.addController(this),this.calculateViewport=this.calculateViewport.bind(this)}get vw(){return this._vw}get vh(){return this._vh}hostConnected(){window.addEventListener("resize",this.calculateViewport)}hostDisconnected(){window.removeEventListener("resize",this.calculateViewport),this.host.removeController(this)}calculateViewport(){this._vw=window.innerWidth,this._vh=window.innerHeight,this.host.requestUpdate()}}const Wu=(e=>{var t={};return T.d(t,e),t})({html:()=>C.html,literal:()=>C.literal}),zu={[ti.BottomSheet]:Wu.literal`iam-bottom-sheet`,[ti.Fullscreen]:Wu.literal`iam-fullscreen-modal`,[ti.Modal]:Wu.literal`iam-modal`},Vu=Fu.css`
|
|
2
|
-
.bottom-sheet {
|
|
3
|
-
position: fixed;
|
|
4
|
-
inset: 0; // Не поддерживается Safari < 14.1
|
|
5
|
-
top: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
bottom: 0;
|
|
8
|
-
right: 0;
|
|
9
|
-
z-index: 999;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.bottom-sheet__backdrop {
|
|
13
|
-
position: fixed;
|
|
14
|
-
inset: 0; // Не поддерживается Safari < 14.1
|
|
15
|
-
top: 0;
|
|
16
|
-
left: 0;
|
|
17
|
-
bottom: 0;
|
|
18
|
-
right: 0;
|
|
19
|
-
z-index: -1;
|
|
20
|
-
background-color: rgba(0, 0, 0, var(--backdrop-opacity, 0.5));
|
|
21
|
-
opacity: 0;
|
|
22
|
-
transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
23
|
-
pointer-events: none;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.bottom-sheet__backdrop--visible {
|
|
27
|
-
animation: fade-in 300ms forwards;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.bottom-sheet__backdrop--hidden {
|
|
31
|
-
animation: fade-out 300ms forwards;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.bottom-sheet__box {
|
|
35
|
-
position: absolute;
|
|
36
|
-
left: 0;
|
|
37
|
-
right: 0;
|
|
38
|
-
bottom: 0;
|
|
39
|
-
will-change: transform;
|
|
40
|
-
border-top-left-radius: var(--slide-border-top-left-radius, 0);
|
|
41
|
-
border-top-right-radius: var(--slide-border-top-right-radius, 0);
|
|
42
|
-
background-color: transparent;
|
|
43
|
-
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
44
|
-
transform: translate3d(0, 120%, 0);
|
|
45
|
-
pointer-events: all;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.bottom-sheet__box-wrapper {
|
|
49
|
-
position: absolute;
|
|
50
|
-
inset: 0;
|
|
51
|
-
pointer-events: none;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.bottom-sheet__box-wrapper.bottom-sheet__box-wrapper--desktop-mode {
|
|
55
|
-
position: absolute;
|
|
56
|
-
bottom: 0;
|
|
57
|
-
left: 50%;
|
|
58
|
-
transform: translate3d(-50%, 0, 0);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.bottom-sheet__box.bottom-sheet__box--open {
|
|
62
|
-
opacity: 1;
|
|
63
|
-
transform: translate3d(0, 0, 0);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.bottom-sheet__backdrop.bottom-sheet__backdrop--open {
|
|
67
|
-
opacity: 1;
|
|
68
|
-
pointer-events: all;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/* .bottom-sheet__header .close-btn {
|
|
72
|
-
position: absolute;
|
|
73
|
-
top: 8px;
|
|
74
|
-
right: 8px;
|
|
75
|
-
z-index: 10000;
|
|
76
|
-
padding: 0;
|
|
77
|
-
background-color: transparent;
|
|
78
|
-
border: 0;
|
|
79
|
-
-webkit-appearance: none;
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
|
|
82
|
-
&:focus {
|
|
83
|
-
outline: none;
|
|
84
|
-
}
|
|
85
|
-
} */
|
|
86
|
-
|
|
87
|
-
.bottom-sheet__header .close-strip-btn {
|
|
88
|
-
margin-top: 8px;
|
|
89
|
-
width: 32px;
|
|
90
|
-
height: 4px;
|
|
91
|
-
background-color: #00000080;
|
|
92
|
-
border-radius: var(--slide-border-top-left-radius);
|
|
93
|
-
position: absolute;
|
|
94
|
-
z-index: 10000;
|
|
95
|
-
left: 50%;
|
|
96
|
-
transform: translate3d(-50%, 0, 0);
|
|
97
|
-
}
|
|
98
|
-
`;const Gu=(e=>{var t={};return T.d(t,e),t})({styleMap:()=>x.styleMap});const $u=(e=>{var t={};return T.d(t,e),t})({classMap:()=>k.classMap});class Hu{constructor(e){Object.defineProperty(this,"host",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.host.addController(this),this.handleTouchMoveVertical=this.handleTouchMoveVertical.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}hostConnected(){}hostDisconnected(){var e,t;null===(e=this.touchController)||void 0===e||e.off(Ra.TouchMoveVertical,this.handleTouchMoveVertical),null===(t=this.touchController)||void 0===t||t.off(Ra.TouchEnd,this.handleTouchEnd)}setTouchController(e){this.touchController=e,this.touchController.enable(),this.touchController.on(Ra.TouchMoveVertical,this.handleTouchMoveVertical),this.touchController.on(Ra.TouchEnd,this.handleTouchEnd)}handleTouchMoveVertical({dy:e}){const t=this.getTranslateYByDeltaY(e);this.disableBoxTransition(),this.translateBoxOnY(t)}handleTouchEnd({dy:e}){if(!this.touchController.isSwiping)return;this.enableBoxTransition();this.getTranslateYByDeltaY(e)>20?(this.touchController.disable(),this.translateBoxOnY(120),this.host.close()):this.resetToDefaultState()}resetToDefaultState(){this.host.bottomSheetBoxRef.style.transform=""}translateBoxOnY(e){this.host.bottomSheetBoxRef.style.transform=`translate3d(0, ${e}%, 0)`}disableBoxTransition(){this.host.bottomSheetBoxRef.style.transition="none"}enableBoxTransition(){this.host.bottomSheetBoxRef.style.transition="opacity 0.3s ease, transform 0.3s ease"}getTranslateYByDeltaY(e){let t=50*(e/this.host.bottomSheetBoxRef.clientHeight);return t<=0&&(t=0),t}}var qu=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Qu=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ku=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},Yu=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ju=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i,a,s,n,o,l,d;let c,u,h,p,g,f,m,v,b,y,w,S,_=[(0,Nu.customElement)("iam-bottom-sheet")],O=[],C=Fu.LitElement,x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[],T=[],A=[],R=[],D=[],B=[],F=[],N=[],U=[],W=[],z=[],V=[],G=[];u=class extends C{get open(){return Yu(this,e,"f")}set open(t){Ju(this,e,t,"f")}get geometry(){return Yu(this,t,"f")}set geometry(e){Ju(this,t,e,"f")}get appearanceOptions(){return Yu(this,r,"f")}set appearanceOptions(e){Ju(this,r,e,"f")}get touchController(){return Yu(this,i,"f")}set touchController(e){Ju(this,i,e,"f")}get desktopMode(){return Yu(this,a,"f")}set desktopMode(e){Ju(this,a,e,"f")}get isVisible(){return Yu(this,s,"f")}set isVisible(e){Ju(this,s,e,"f")}get isClosed(){return Yu(this,n,"f")}set isClosed(e){Ju(this,n,e,"f")}get backdropRef(){return Yu(this,o,"f")}set backdropRef(e){Ju(this,o,e,"f")}get bottomSheetBoxRef(){return Yu(this,l,"f")}set bottomSheetBoxRef(e){Ju(this,l,e,"f")}get bottomSheetRef(){return Yu(this,d,"f")}set bottomSheetRef(e){Ju(this,d,e,"f")}constructor(){super(),e.set(this,Qu(this,x,!1)),t.set(this,(Qu(this,k),Qu(this,P,void 0))),r.set(this,(Qu(this,j),Qu(this,M,void 0))),i.set(this,(Qu(this,E),Qu(this,I,void 0))),a.set(this,(Qu(this,L),Qu(this,T,void 0))),s.set(this,(Qu(this,A),Qu(this,R,!1))),n.set(this,(Qu(this,D),Qu(this,B,!0))),o.set(this,(Qu(this,F),Qu(this,N,null))),l.set(this,(Qu(this,U),Qu(this,W,null))),d.set(this,(Qu(this,z),Qu(this,V,null))),Object.defineProperty(this,"bottomSheetSwipeController",{enumerable:!0,configurable:!0,writable:!0,value:(Qu(this,G),new Hu(this))}),this.handleTransitionEnd=this.handleTransitionEnd.bind(this)}updated(e){super.updated(e);e.has("open")&&this.handleOpenChanged()}handleOpenChanged(){this.open?(this.isClosed=!1,(({frames:e=3,timeout:t=100,checkStyle:r=(()=>!0)}={})=>new Promise((i=>{let a,s=0,n=!1;const o=()=>{s++,!n&&r()&&(n=!0),s>=e&&n?(clearTimeout(a),i()):requestAnimationFrame(o)};a=setTimeout((()=>i()),t),requestAnimationFrame(o)})))().then((()=>{this.isVisible=!0}))):this.isClosed||this.close()}connectedCallback(){super.connectedCallback(),this.bottomSheetSwipeController.setTouchController(this.touchController)}disconnectedCallback(){super.disconnectedCallback()}close(){this.backdropRef.addEventListener("transitionend",this.handleTransitionEnd),this.isVisible=!1}handleTransitionEnd(){this.backdropRef.removeEventListener("transitionend",this.handleTransitionEnd),setTimeout((()=>{this.isClosed=!0,this.dispatchEvent(new CustomEvent("closed",{bubbles:!0,composed:!0}))}),50)}render(){if(this.isClosed)return Fu.nothing;const e={backgroundColor:this.appearanceOptions.backgroundColor,height:this.geometry.getHeight()+"px",width:this.geometry.getWidth()+"px","--slide-border-top-left-radius":`${this.appearanceOptions.borderRadius}px`,"--slide-border-top-right-radius":`${this.appearanceOptions.borderRadius}px`},t={width:this.geometry.getWidth()+"px"},r={backgroundColor:this.appearanceOptions.closeButton.backgroundColor,width:`${this.appearanceOptions.closeButton.width}px`,height:`${this.appearanceOptions.closeButton.height}px`,marginTop:`${this.appearanceOptions.closeButton.marginTop}px`};return Fu.html`
|
|
99
|
-
<div id="bottom-sheet" class="bottom-sheet">
|
|
100
|
-
<div
|
|
101
|
-
id="bottom-sheet__backdrop"
|
|
102
|
-
style=${(0,Gu.styleMap)({"--backdrop-opacity":this.appearanceOptions.backdrop.opacity})}
|
|
103
|
-
@click=${this.close}
|
|
104
|
-
class="bottom-sheet__backdrop ${(0,$u.classMap)({"bottom-sheet__backdrop--open":this.isVisible})}"
|
|
105
|
-
></div>
|
|
106
|
-
<div class="bottom-sheet__box-wrapper ${(0,$u.classMap)({"bottom-sheet__box-wrapper--desktop-mode":this.desktopMode})}" style=${(0,Gu.styleMap)(t)}>
|
|
107
|
-
<div
|
|
108
|
-
style=${(0,Gu.styleMap)(e)}
|
|
109
|
-
id="bottom-sheet__box"
|
|
110
|
-
class="bottom-sheet__box ${(0,$u.classMap)({"bottom-sheet__box--open":this.isVisible})}"
|
|
111
|
-
>
|
|
112
|
-
<div class="bottom-sheet__header">
|
|
113
|
-
<div class="close-strip-btn" style=${(0,Gu.styleMap)(r)}></div>
|
|
114
|
-
</div>
|
|
115
|
-
<slot></slot>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
`}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,Ku(u,"BottomSheet"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=C[Symbol.metadata])&&void 0!==e?e:null):void 0;h=[(0,Nu.property)({type:Boolean})],p=[(0,Nu.property)({type:Object})],g=[(0,Nu.property)({type:Object})],f=[(0,Nu.property)({type:Object})],m=[(0,Nu.property)({type:Boolean})],v=[(0,Nu.state)()],b=[(0,Nu.state)()],y=[(0,Nu.query)("#bottom-sheet__backdrop")],w=[(0,Nu.query)("#bottom-sheet__box")],S=[(0,Nu.query)("#bottom-sheet")],qu(u,null,h,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},x,k),qu(u,null,p,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},P,j),qu(u,null,g,{kind:"accessor",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions,set:(e,t)=>{e.appearanceOptions=t}},metadata:t},M,E),qu(u,null,f,{kind:"accessor",name:"touchController",static:!1,private:!1,access:{has:e=>"touchController"in e,get:e=>e.touchController,set:(e,t)=>{e.touchController=t}},metadata:t},I,L),qu(u,null,m,{kind:"accessor",name:"desktopMode",static:!1,private:!1,access:{has:e=>"desktopMode"in e,get:e=>e.desktopMode,set:(e,t)=>{e.desktopMode=t}},metadata:t},T,A),qu(u,null,v,{kind:"accessor",name:"isVisible",static:!1,private:!1,access:{has:e=>"isVisible"in e,get:e=>e.isVisible,set:(e,t)=>{e.isVisible=t}},metadata:t},R,D),qu(u,null,b,{kind:"accessor",name:"isClosed",static:!1,private:!1,access:{has:e=>"isClosed"in e,get:e=>e.isClosed,set:(e,t)=>{e.isClosed=t}},metadata:t},B,F),qu(u,null,y,{kind:"accessor",name:"backdropRef",static:!1,private:!1,access:{has:e=>"backdropRef"in e,get:e=>e.backdropRef,set:(e,t)=>{e.backdropRef=t}},metadata:t},N,U),qu(u,null,w,{kind:"accessor",name:"bottomSheetBoxRef",static:!1,private:!1,access:{has:e=>"bottomSheetBoxRef"in e,get:e=>e.bottomSheetBoxRef,set:(e,t)=>{e.bottomSheetBoxRef=t}},metadata:t},W,z),qu(u,null,S,{kind:"accessor",name:"bottomSheetRef",static:!1,private:!1,access:{has:e=>"bottomSheetRef"in e,get:e=>e.bottomSheetRef,set:(e,t)=>{e.bottomSheetRef=t}},metadata:t},V,G),qu(null,c={value:u},_,{kind:"class",name:u.name,metadata:t},null,O),u=c.value,t&&Object.defineProperty(u,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(u,"styles",{enumerable:!0,configurable:!0,writable:!0,value:Vu}),Qu(u,O)})();const Zu=Fu.css`
|
|
120
|
-
.modal {
|
|
121
|
-
position: fixed;
|
|
122
|
-
inset: 0; // Не поддерживается Safari < 14.1
|
|
123
|
-
top: 0;
|
|
124
|
-
left: 0;
|
|
125
|
-
bottom: 0;
|
|
126
|
-
right: 0;
|
|
127
|
-
z-index: 1000;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.modal__backdrop {
|
|
131
|
-
background-color: rgba(0, 0, 0, var(--backdrop-opacity, 0.3));
|
|
132
|
-
position: fixed;
|
|
133
|
-
z-index: -1;
|
|
134
|
-
inset: 0; // Не поддерживается Safari < 14.1
|
|
135
|
-
top: 0;
|
|
136
|
-
left: 0;
|
|
137
|
-
bottom: 0;
|
|
138
|
-
right: 0;
|
|
139
|
-
pointer-events: none;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/* .modal__backdrop.modal__backdrop--animated {
|
|
143
|
-
transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
144
|
-
} */
|
|
145
|
-
|
|
146
|
-
.modal__backdrop.modal__backdrop--open {
|
|
147
|
-
pointer-events: all;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.modal__box {
|
|
151
|
-
display: flex;
|
|
152
|
-
align-items: center;
|
|
153
|
-
justify-content: center;
|
|
154
|
-
position: relative;
|
|
155
|
-
outline: 0px;
|
|
156
|
-
height: 100%;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.modal__box-content {
|
|
160
|
-
position: relative;
|
|
161
|
-
border-top-left-radius: var(--slide-border-top-left-radius, 0);
|
|
162
|
-
border-top-right-radius: var(--slide-border-top-right-radius, 0);
|
|
163
|
-
border-bottom-left-radius: var(--slide-border-bottom-left-radius, 0);
|
|
164
|
-
border-bottom-right-radius: var(--slide-border-bottom-right-radius, 0);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.modal__box-content.modal__box-content--fullscreen {
|
|
168
|
-
position: relative;
|
|
169
|
-
align-self: flex-end;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
@keyframes fadeIn {
|
|
173
|
-
from {
|
|
174
|
-
opacity: 0;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
to {
|
|
178
|
-
opacity: 1;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
@keyframes fadeOut {
|
|
183
|
-
from {
|
|
184
|
-
opacity: 1;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
to {
|
|
188
|
-
opacity: 0;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
@keyframes fadeInWithZoom {
|
|
194
|
-
from {
|
|
195
|
-
opacity: 0;
|
|
196
|
-
transform: scale(0.7);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
to {
|
|
200
|
-
transform: scale(1);
|
|
201
|
-
opacity: 1;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
@keyframes fadeOutWithZoom {
|
|
206
|
-
from {
|
|
207
|
-
opacity: 1;
|
|
208
|
-
transform: scale(1);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
to {
|
|
212
|
-
transform: scale(0.7);
|
|
213
|
-
opacity: 0;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
@keyframes slideInUp {
|
|
218
|
-
from {
|
|
219
|
-
transform: translateY(100%);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
to {
|
|
223
|
-
transform: translateY(0%);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
@keyframes slideInOut {
|
|
228
|
-
from {
|
|
229
|
-
transform: translateY(0%);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
to {
|
|
233
|
-
transform: translateY(100%);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.fadeIn {
|
|
238
|
-
animation: fadeIn 255ms forwards;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.fadeOut {
|
|
242
|
-
animation: fadeOut 255ms forwards;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.fadeInWithZoom {
|
|
246
|
-
animation: fadeInWithZoom 300ms forwards;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.fadeOutWithZoom {
|
|
250
|
-
animation: fadeOutWithZoom 300ms forwards;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.slideInUp {
|
|
254
|
-
animation: slideInUp 300ms forwards;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.slideInOut {
|
|
258
|
-
animation: slideInOut 300ms forwards;
|
|
259
|
-
}
|
|
260
|
-
`;const Xu=(e=>{var t={};return T.d(t,e),t})({unsafeHTML:()=>P.unsafeHTML}),eh=Fu.css`
|
|
261
|
-
.close-btn {
|
|
262
|
-
position: absolute;
|
|
263
|
-
top: 1rem;
|
|
264
|
-
z-index: 10000;
|
|
265
|
-
padding: 0;
|
|
266
|
-
background-color: transparent;
|
|
267
|
-
border: 0;
|
|
268
|
-
-webkit-appearance: none;
|
|
269
|
-
cursor: pointer;
|
|
270
|
-
|
|
271
|
-
&:focus {
|
|
272
|
-
outline: none;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.close-btn.close-btn--position_start {
|
|
277
|
-
left: 1rem;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.close-btn.close-btn--position_end {
|
|
281
|
-
right: 1rem;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.close-btn.close-btn--position_start.close-btn--dir_rtl {
|
|
285
|
-
left: auto;
|
|
286
|
-
right: 1rem;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.close-btn.close-btn--position_end.close-btn--dir_rtl {
|
|
290
|
-
left: 1rem;
|
|
291
|
-
right: auto;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.close-btn.close-btn--position_none {
|
|
295
|
-
display: none;
|
|
296
|
-
}
|
|
297
|
-
`;var th=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},rh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},ih=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},ah=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},sh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t;let r,i,a,s,n=[(0,Nu.customElement)("iam-modal-close-btn")],o=[],l=Fu.LitElement,d=[],c=[],u=[],h=[];i=class extends l{get closeBtnPosition(){return ah(this,e,"f")}set closeBtnPosition(t){sh(this,e,t,"f")}get dir(){return ah(this,t,"f")}set dir(e){sh(this,t,e,"f")}render(){var e;return Fu.html`
|
|
298
|
-
<button class="close-btn ${(0,$u.classMap)({"close-btn--position_start":this.closeBtnPosition===pt.Start,"close-btn--position_end":this.closeBtnPosition===pt.End,"close-btn--position_none":this.closeBtnPosition===pt.None,"close-btn--dir_ltr":this.dir===ne.LTR,"close-btn--dir_rtl":this.dir===ne.RTL})}">${(0,Xu.unsafeHTML)(null===(e=L.closeButton)||void 0===e?void 0:e.svgSrc.baseState)}</button>`}constructor(){super(...arguments),e.set(this,rh(this,d,void 0)),t.set(this,(rh(this,c),rh(this,u,void 0))),rh(this,h)}};e=new WeakMap,t=new WeakMap,ih(i,"Modal"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=l[Symbol.metadata])&&void 0!==e?e:null):void 0;a=[(0,Nu.property)({type:Number})],s=[(0,Nu.property)({type:String})],th(i,null,a,{kind:"accessor",name:"closeBtnPosition",static:!1,private:!1,access:{has:e=>"closeBtnPosition"in e,get:e=>e.closeBtnPosition,set:(e,t)=>{e.closeBtnPosition=t}},metadata:t},d,c),th(i,null,s,{kind:"accessor",name:"dir",static:!1,private:!1,access:{has:e=>"dir"in e,get:e=>e.dir,set:(e,t)=>{e.dir=t}},metadata:t},u,h),th(null,r={value:i},n,{kind:"class",name:i.name,metadata:t},null,o),i=r.value,t&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(i,"styles",{enumerable:!0,configurable:!0,writable:!0,value:eh}),rh(i,o)})();var nh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},oh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},lh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},dh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},ch=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i,a,s,n,o;let l,d,c,u,h,p,g,f,m,v,b=[(0,Nu.customElement)("iam-modal")],y=[],w=Fu.LitElement,S=[],_=[],O=[],C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[],T=[],A=[],R=[],D=[];d=class extends w{get open(){return dh(this,e,"f")}set open(t){ch(this,e,t,"f")}get fullscreen(){return dh(this,t,"f")}set fullscreen(e){ch(this,t,e,"f")}get geometry(){return dh(this,r,"f")}set geometry(e){ch(this,r,e,"f")}get appearanceOptions(){return dh(this,i,"f")}set appearanceOptions(e){ch(this,i,e,"f")}get dir(){return dh(this,a,"f")}set dir(e){ch(this,a,e,"f")}get isVisible(){return dh(this,s,"f")}set isVisible(e){ch(this,s,e,"f")}get isClosed(){return dh(this,n,"f")}set isClosed(e){ch(this,n,e,"f")}get backdropRef(){return dh(this,o,"f")}set backdropRef(e){ch(this,o,e,"f")}constructor(){super(),e.set(this,oh(this,S,!1)),t.set(this,(oh(this,_),oh(this,O,!1))),r.set(this,(oh(this,C),oh(this,x,void 0))),i.set(this,(oh(this,k),oh(this,P,void 0))),a.set(this,(oh(this,j),oh(this,M,void 0))),s.set(this,(oh(this,E),oh(this,I,!1))),n.set(this,(oh(this,L),oh(this,T,!0))),o.set(this,(oh(this,A),oh(this,R,null))),oh(this,D)}close(){const e=this.appearanceOptions.animationType===ht.None?0:350;setTimeout((()=>{this.isClosed=!0,this.dispatchEvent(new CustomEvent("closed",{bubbles:!0,composed:!0}))}),e),this.isVisible=!1}updated(e){super.updated(e);e.has("open")&&this.handleOpenChanged()}handleOpenChanged(){this.open?(this.isClosed=!1,this.isVisible=!0):this.isClosed||this.close()}getEnterModalAnimationCSSClass(e){switch(e){case ht.SlideInUp:return"slideInUp";case ht.FadeIn:return"fadeInWithZoom";default:return""}}getOutModalAnimationCSSClass(e){switch(e){case ht.SlideInUp:return"slideInOut";case ht.FadeIn:return"fadeOutWithZoom";default:return""}}getBackdropAnimationCSSClass(e){return e?"fadeIn":"fadeOut"}render(){const e=this.fullscreen?0:this.appearanceOptions.borderRadius,t={backgroundColor:this.appearanceOptions.backgroundColor,height:this.geometry.getHeight()+"px",width:this.geometry.getWidth()+"px","--slide-border-top-left-radius":`${e}px`,"--slide-border-top-right-radius":`${e}px`,"--slide-border-bottom-left-radius":`${e}px`,"--slide-border-bottom-right-radius":`${e}px`},r=this.appearanceOptions.animationType,i=this.isVisible?this.getEnterModalAnimationCSSClass(r):this.getOutModalAnimationCSSClass(r),a=this.getBackdropAnimationCSSClass(this.isVisible);return Fu.html`
|
|
299
|
-
<div class="modal">
|
|
300
|
-
<div
|
|
301
|
-
id="modal__backdrop"
|
|
302
|
-
style=${(0,Gu.styleMap)({"--backdrop-opacity":this.appearanceOptions instanceof gt?this.appearanceOptions.backdrop.opacity:void 0})}
|
|
303
|
-
class="modal__backdrop ${(0,$u.classMap)({[a]:r!==ht.None})}"
|
|
304
|
-
></div>
|
|
305
|
-
<div @click=${this.close} class="modal__box ${(0,$u.classMap)({[i]:!0})}"
|
|
306
|
-
>
|
|
307
|
-
${this.fullscreen?Fu.html`<div class="modal__header">
|
|
308
|
-
<iam-modal-close-btn @click=${this.close} .dir=${this.dir} .closeBtnPosition=${this.appearanceOptions.closeBtnPosition}></iam-modal-close-btn>
|
|
309
|
-
</div>`:Fu.nothing}
|
|
310
|
-
<div style=${(0,Gu.styleMap)(t)} class="modal__box-content ${(0,$u.classMap)({"modal__box-content--fullscreen":this.fullscreen})}">
|
|
311
|
-
${this.fullscreen?Fu.nothing:Fu.html`<div class="modal__header">
|
|
312
|
-
<iam-modal-close-btn @click=${this.close} .dir=${this.dir} .closeBtnPosition=${this.appearanceOptions.closeBtnPosition}></iam-modal-close-btn>
|
|
313
|
-
</div>`}
|
|
314
|
-
<slot></slot>
|
|
315
|
-
</div>
|
|
316
|
-
</div>
|
|
317
|
-
</div>
|
|
318
|
-
`}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,lh(d,"Modal"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=w[Symbol.metadata])&&void 0!==e?e:null):void 0;c=[(0,Nu.property)({type:Boolean})],u=[(0,Nu.property)({type:Boolean})],h=[(0,Nu.property)({type:Object})],p=[(0,Nu.property)({type:Object})],g=[(0,Nu.property)({type:String})],f=[(0,Nu.state)()],m=[(0,Nu.state)()],v=[(0,Nu.query)("#modal__backdrop")],nh(d,null,c,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},S,_),nh(d,null,u,{kind:"accessor",name:"fullscreen",static:!1,private:!1,access:{has:e=>"fullscreen"in e,get:e=>e.fullscreen,set:(e,t)=>{e.fullscreen=t}},metadata:t},O,C),nh(d,null,h,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},x,k),nh(d,null,p,{kind:"accessor",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions,set:(e,t)=>{e.appearanceOptions=t}},metadata:t},P,j),nh(d,null,g,{kind:"accessor",name:"dir",static:!1,private:!1,access:{has:e=>"dir"in e,get:e=>e.dir,set:(e,t)=>{e.dir=t}},metadata:t},M,E),nh(d,null,f,{kind:"accessor",name:"isVisible",static:!1,private:!1,access:{has:e=>"isVisible"in e,get:e=>e.isVisible,set:(e,t)=>{e.isVisible=t}},metadata:t},I,L),nh(d,null,m,{kind:"accessor",name:"isClosed",static:!1,private:!1,access:{has:e=>"isClosed"in e,get:e=>e.isClosed,set:(e,t)=>{e.isClosed=t}},metadata:t},T,A),nh(d,null,v,{kind:"accessor",name:"backdropRef",static:!1,private:!1,access:{has:e=>"backdropRef"in e,get:e=>e.backdropRef,set:(e,t)=>{e.backdropRef=t}},metadata:t},R,D),nh(null,l={value:d},b,{kind:"class",name:d.name,metadata:t},null,y),d=l.value,t&&Object.defineProperty(d,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(d,"styles",{enumerable:!0,configurable:!0,writable:!0,value:Zu}),oh(d,y)})();var uh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},hh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},ph=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},gh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},fh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r;let i,a,s,n,o,l=[(0,Nu.customElement)("iam-fullscreen-modal")],d=[],c=Fu.LitElement,u=[],h=[],p=[],g=[],f=[],m=[];a=class extends c{get open(){return gh(this,e,"f")}set open(t){fh(this,e,t,"f")}get geometry(){return gh(this,t,"f")}set geometry(e){fh(this,t,e,"f")}get appearanceOptions(){return gh(this,r,"f")}set appearanceOptions(e){fh(this,r,e,"f")}render(){return Fu.html`
|
|
319
|
-
<iam-modal ?open=${this.open} .fullscreen=${!0} .geometry=${this.geometry} .appearanceOptions=${this.appearanceOptions}>
|
|
320
|
-
<slot></slot>
|
|
321
|
-
</iam-modal>
|
|
322
|
-
`}constructor(){super(...arguments),e.set(this,hh(this,u,!1)),t.set(this,(hh(this,h),hh(this,p,void 0))),r.set(this,(hh(this,g),hh(this,f,void 0))),hh(this,m)}};e=new WeakMap,t=new WeakMap,r=new WeakMap,ph(a,"FullscreenModal"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=c[Symbol.metadata])&&void 0!==e?e:null):void 0;s=[(0,Nu.property)({type:Boolean})],n=[(0,Nu.property)({type:Object})],o=[(0,Nu.property)({type:Object})],uh(a,null,s,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},u,h),uh(a,null,n,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},p,g),uh(a,null,o,{kind:"accessor",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions,set:(e,t)=>{e.appearanceOptions=t}},metadata:t},f,m),uh(null,i={value:a},l,{kind:"class",name:a.name,metadata:t},null,d),a=i.value,t&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t}),hh(a,d)})()})();var mh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},vh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},bh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},yh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},wh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i,a,s,n;let o,l,d,c,u,h,p,g,f,m=[(0,Nu.customElement)("message-view-factory")],v=[],b=Fu.LitElement,y=[],w=[],S=[],_=[],O=[],C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[];l=class extends b{get appearanceOptions(){return yh(this,e,"f")}set appearanceOptions(t){wh(this,e,t,"f")}get type(){return yh(this,t,"f")}set type(e){wh(this,t,e,"f")}get open(){return yh(this,r,"f")}set open(e){wh(this,r,e,"f")}get geometry(){return yh(this,i,"f")}set geometry(e){wh(this,i,e,"f")}get touchController(){return yh(this,a,"f")}set touchController(e){wh(this,a,e,"f")}get desktopMode(){return yh(this,s,"f")}set desktopMode(e){wh(this,s,e,"f")}get dir(){return yh(this,n,"f")}set dir(e){wh(this,n,e,"f")}render(){const e=zu[this.type];return e?Wu.html`
|
|
1
|
+
import*as e from"events";import*as t from"lodash/isFunction.js";import*as r from"uuid";import*as i from"lodash/isObject.js";import*as a from"lodash/isNil.js";import*as s from"mobx";import*as n from"lodash/isString.js";import*as o from"lodash/isEqual.js";import*as l from"lodash/head.js";import*as d from"deepmerge";import*as c from"lodash/isNumber.js";import*as u from"@inappstory/video-player";import*as h from"@inappstory/slide-api";import*as p from"async-mutex";import*as g from"lodash/debounce.js";import*as f from"lodash/isEmpty.js";import*as m from"react/jsx-runtime";import*as v from"react-dom/client";import*as b from"react";import*as y from"classnames";import*as w from"mobx-react-lite";import*as S from"react-dom";import*as _ from"react-input-mask";import*as O from"lit";import*as C from"lit/decorators.js";import*as x from"lit/static-html.js";import*as k from"lit/directives/style-map.js";import*as P from"lit/directives/class-map.js";import*as j from"lit/directives/unsafe-html.js";import*as M from"bowser";import*as E from"css-font-parser";import*as I from"parse-css-sides";var L={432:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.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-bottom:25px}.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}}",""]),a.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 s=a},669:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".aspect-ratio-box--u2SLt{overflow:hidden;position:relative}.aspect-ratio-box--u2SLt.aspect-ratio-box--centered--ZWs8d{width:auto;height:100%;left:50%;transform:translateX(-50%)}.aspect-ratio-box-inside--U\\+o3F{position:absolute;top:0;left:0;width:100%;height:100%}",""]),a.locals={"aspect-ratio-box":"aspect-ratio-box--u2SLt","aspect-ratio-box--centered":"aspect-ratio-box--centered--ZWs8d","aspect-ratio-box-inside":"aspect-ratio-box-inside--U+o3F"};const s=a},843:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".close-btn--KhMED{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:20px;z-index:1140;pointer-events:all;cursor:pointer;outline:none;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.close-btn--KhMED:focus{outline:none}.close-btn--KhMED svg{overflow:visible}.close-btn--KhMED[data-position=start],.close-btn--KhMED[data-position=left]{left:10px}.close-btn--KhMED[data-position=start][dir=rtl],.close-btn--KhMED[data-position=left][dir=rtl]{left:auto;right:10px}.close-btn--KhMED[data-position=end],.close-btn--KhMED[data-position=right]{right:10px}.close-btn--KhMED[data-position=end][dir=rtl],.close-btn--KhMED[data-position=right][dir=rtl]{left:10px;right:auto}",""]),a.locals={"close-btn":"close-btn--KhMED"};const s=a},495:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'@keyframes spin--JuRkn{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.splash-container--4toz\\+{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;z-index:-1}.splash-container--4toz\\+ .splash-container__image--\\+1PkF{position:absolute;inset:0px;z-index:0}.splash-container--4toz\\+ .splash-container__image--\\+1PkF img{width:100%;height:100%;object-fit:cover}.splash-container--4toz\\+ .splash-container__lottie--f24Xy{position:absolute;inset:0px;z-index:1}.splash-container--4toz\\+ .splash-container__lottie--f24Xy canvas{width:100%;height:100%}.splash-container--4toz\\+.splash-container--isLoading--d8pYm:after{display:inline-block;position:absolute;top:calc(50% - 1rem);left:calc(50% - 1rem);content:"";width:2rem;height:2rem;border:solid 2px var(--GRLoaderBackgroundColor, white);border-color:var(--GRLoaderBackgroundAccentColor, transparent) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white);border-radius:50%;animation:spin--JuRkn .6s infinite linear;z-index:10}.splash-container--4toz\\+.splash-container--fadeIn--TD58C{opacity:1;transition:opacity ease-in .2s}.splash-container--4toz\\+.splash-container--fadeOut--GW15o{opacity:0;transition:opacity ease-out .3s}',""]),a.locals={"splash-container":"splash-container--4toz+","splash-container__image":"splash-container__image--+1PkF","splash-container__lottie":"splash-container__lottie--f24Xy","splash-container--isLoading":"splash-container--isLoading--d8pYm",spin:"spin--JuRkn","splash-container--fadeIn":"splash-container--fadeIn--TD58C","splash-container--fadeOut":"splash-container--fadeOut--GW15o"};const s=a},289:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.game-reader-container--qAxmf{background-color:rgba(0,0,0,0);position:fixed;left:0px;top:0px;padding:0px;border:0px;z-index:2147483645;width:100%;height:100%;overflow:hidden;color-scheme:auto}.game-reader--vz8\\+v{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0);z-index:1;user-select:none;pointer-events:all;color:#fff}.game-reader--vz8\\+v.game-reader--desktop-mode--hEnbE{padding:50px 0}.game-reader--vz8\\+v.game-reader--desktop-mode--hEnbE .game-reader__game-box--tDgOl{border-radius:var(--game-box-border-radius)}.game-reader--vz8\\+v.game-reader--widescreen--4rob-{padding:0 0}.game-reader--vz8\\+v.game-reader--widescreen--4rob- .game-reader__game-box--tDgOl{border-radius:0px}.game-reader--vz8\\+v .game-reader__refresh-btn--gKfAr{cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%, -50%, 0);z-index:2}.game-reader--vz8\\+v .game-reader__game-box--tDgOl.game-reader__game-box--widescreen--DD\\+rV{border-radius:0px}.game-reader--vz8\\+v .game-reader__iframe--e3dlS{width:100%;height:100%;transition:opacity ease-in .3s}.game-reader--vz8\\+v .game-reader__backdrop--g2Ozw{position:fixed;inset:0;z-index:-1}',""]),a.locals={"game-reader-container":"game-reader-container--qAxmf","game-reader":"game-reader--vz8+v","game-reader--desktop-mode":"game-reader--desktop-mode--hEnbE","game-reader__game-box":"game-reader__game-box--tDgOl","game-reader--widescreen":"game-reader--widescreen--4rob-","game-reader__refresh-btn":"game-reader__refresh-btn--gKfAr","game-reader__game-box--widescreen":"game-reader__game-box--widescreen--DD+rV","game-reader__iframe":"game-reader__iframe--e3dlS","game-reader__backdrop":"game-reader__backdrop--g2Ozw"};const s=a},314:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,":root{--ias-sat: env(safe-area-inset-top);--ias-sar: env(safe-area-inset-right);--ias-sab: env(safe-area-inset-bottom);--ias-sal: env(safe-area-inset-left)}",""]),a.locals={};const s=a},938:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,"h3{margin:0}.stories-list-wrapper--\\+MxOM{background-color:var(--background-color, transparent);height:auto;padding:0;position:relative}.stories-list-wrapper--\\+MxOM.mode-desktop--Blm52.with-list-controls--CGYBY{position:relative}.stories-list--deukx{position:relative;overflow:visible}@media(min-width: 767.99px){.stories-list--deukx{overflow:hidden}}.stories-list__actions--p-QOR{position:absolute;right:0;top:0}.stories-list__viewport--m27BY{overflow:hidden;height:auto}.stories-list__viewport--m27BY:not(.mode-desktop--Blm52){display:flex}.stories-list__viewport-inner--oy\\+N4{display:flex;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding-top:var(--storiesListTopPadding, 0);padding-bottom:var(--storiesListBottomPadding, 0);box-sizing:content-box}.stories-list__viewport-inner--oy\\+N4::-webkit-scrollbar{display:none}.stories-list__viewport-inner--oy\\+N4.mode-desktop--Blm52{scroll-behavior:unset;cursor:grab}.stories-list__viewport-inner--oy\\+N4.isVerticalDirection--P3UBw{flex-flow:row wrap}.stories-list__viewport-inner--oy\\+N4.align-center--9y43R{margin-left:auto;margin-right:auto}.stories-list__viewport-inner--oy\\+N4.align-left--Dm8Do{margin-right:auto}.stories-list__viewport-inner--oy\\+N4.align-right--bQ1a2{margin-left:auto}.stories-list__viewport-inner--oy\\+N4.isTitleCardOutsideTop--AeG\\+D{align-items:flex-end}.stories-list__viewport-inner--oy\\+N4.isTitleCardOutsideBottom--1P95a{align-items:flex-start}",""]),a.locals={"stories-list-wrapper":"stories-list-wrapper--+MxOM","mode-desktop":"mode-desktop--Blm52","with-list-controls":"with-list-controls--CGYBY","stories-list":"stories-list--deukx","stories-list__actions":"stories-list__actions--p-QOR","stories-list__viewport":"stories-list__viewport--m27BY","stories-list__viewport-inner":"stories-list__viewport-inner--oy+N4",isVerticalDirection:"isVerticalDirection--P3UBw","align-center":"align-center--9y43R","align-left":"align-left--Dm8Do","align-right":"align-right--bQ1a2",isTitleCardOutsideTop:"isTitleCardOutsideTop--AeG+D",isTitleCardOutsideBottom:"isTitleCardOutsideBottom--1P95a"};const s=a},533:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".favorite-images-wrapper--ypxcM{display:flex;flex-direction:row;flex-wrap:wrap;padding:var(--storiesListCardFavoriteTitle, --storiesListItemTitlePadding, 0px);gap:var(--storiesListCardFavoriteGap, 3px);box-sizing:border-box}.favorite-image-wrapper--iFI60{flex:0 1 calc(50% - var(--storiesListCardFavoriteGap, 3px));position:relative}.favorite-image--H\\+mP1{position:relative}.favorite-image-item--ylNcQ{position:absolute;inset:0px;border-radius:calc(var(--storiesListInnerBorderRadiusRead, 0)/4);background-position:50% 50%;background-size:cover}.circle_style--umugM .favorite-image-item--ylNcQ{border-radius:50%}",""]),a.locals={"favorite-images-wrapper":"favorite-images-wrapper--ypxcM","favorite-image-wrapper":"favorite-image-wrapper--iFI60","favorite-image":"favorite-image--H+mP1","favorite-image-item":"favorite-image-item--ylNcQ",circle_style:"circle_style--umugM"};const s=a},811:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.stories-slide-wrapper--\\+5j4I:not(:last-child){margin-right:var(--storiesGap, 20px)}.stories-slide-wrapper--\\+5j4I{display:flex;flex-direction:column;flex:0 0 auto;box-sizing:content-box;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.stories-slide-wrapper--\\+5j4I:hover{text-decoration:none}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO{display:block;box-sizing:border-box;text-align:left;position:relative;overflow:visible;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);border:var(--storiesListBorderNotReadWidth, 2px) solid var(--storiesBorderNotReadColor, #00b956);padding:var(--storiesListBorderGapNotRead, 2px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU{border-radius:var(--storiesListBorderRadius, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide-image--cxCFY,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide-image--cxCFY{border-radius:var(--storiesListInnerBorderRadiusNotRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide-image__image--mNEIE,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide-image__image--mNEIE video,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide-image__image--mNEIE,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide-image__image--mNEIE video{border-radius:var(--storiesListInnerBorderRadiusNotRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide__mask--p6utN,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide__mask--p6utN{border-radius:var(--storiesListInnerBorderRadiusNotRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL .stories-slide__content--QrUVw,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU .stories-slide__content--QrUVw{border-radius:var(--storiesListInnerBorderRadiusNotRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe{border-radius:var(--storiesListBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide-image--cxCFY,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide-image--cxCFY{border-radius:var(--storiesListInnerBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide-image__image--mNEIE,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide-image__image--mNEIE video,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide-image__image--mNEIE,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide-image__image--mNEIE video{border-radius:var(--storiesListInnerBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide__mask--p6utN,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide__mask--p6utN{border-radius:var(--storiesListInnerBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-quad--InfBL._is-read--xEVZe .stories-slide__content--QrUVw,.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._format-rectangle--koqBU._is-read--xEVZe .stories-slide__content--QrUVw{border-radius:var(--storiesListInnerBorderRadiusRead, 5px)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._is-read--xEVZe{border:var(--storiesListBorderReadWidth, 1px) solid var(--storiesBorderReadColor, #ededed)}.stories-slide-wrapper--\\+5j4I.isTitleCardOutsideTop--EmWjs{justify-content:flex-end}.stories-slide-wrapper--\\+5j4I.isTitleCardOutsideBottom--W1JSg{justify-content:flex-start}.stories-slide-wrapper--\\+5j4I .stories-slide__inner--doJqj{display:block;position:relative;width:100%;height:100%}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-black--M47zI{background:#000}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-white--0Coab{background:#fff}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-red--UU5V7{background:#ff1a36}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-yellow--0cCZc{background:#fff000}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-green--10A4n{background:#0be361}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-violet--bnIBG{background:#b300bc}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-blue--lpzRG{background:#0761db}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-grey--nbEfc{background:#a8a8a8}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-black-gradient--q\\+aHV{background:#fff;background:linear-gradient(0deg, #c1c1c1, #000)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-white-gradient--YqOjh{background:#fff;background:linear-gradient(180deg, #fff, #ffc800)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-red-gradient---eK73{background:#ff1a36;background:linear-gradient(180deg, #c90174, #eb5c57)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-yellow-gradient--xg23E{background:#fff000;background:linear-gradient(0deg, #fbda61, #f76b1c)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-green-gradient--LfrRF{background:#0be361;background:linear-gradient(0deg, #b4ed50, #429321)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-violet-gradient--EQOBs{background:#b300bc;background:linear-gradient(180deg, #c90174, #0164fd)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-blue-gradient--TJV7z{background:#0761db;background:linear-gradient(180deg, #3023ae, #53a0fe 48%, #b4ed50)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._background-color-grey-gradient--4zJ9u{background:#a8a8a8;background:linear-gradient(0deg, #e2e2e2, #959595)}.stories-slide-wrapper--\\+5j4I .stories-slide-image--cxCFY{position:relative;width:100%;height:100%}.stories-slide-wrapper--\\+5j4I .stories-slide-image__wrap--kAiGt{position:absolute;top:0;bottom:0;left:0;right:0}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE{position:relative;opacity:1;transition:opacity .3s ease-in-out;overflow:hidden}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE._mode_list--K7WdU{width:100%;height:100%}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE.ugc-card-cell--Hmi8u img{object-fit:contain}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE img{width:100%;height:100%;object-fit:cover}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE video{min-height:100%;min-width:100%;width:100%;background-position:center center;background-repeat:no-repeat;object-fit:cover;opacity:0}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE.video-loaded--380fQ img{display:none}.stories-slide-wrapper--\\+5j4I .stories-slide-image__image--mNEIE.video-loaded--380fQ video{opacity:1}.stories-slide-wrapper--\\+5j4I .stories-slide__mask--p6utN{position:absolute;top:0;bottom:0;left:0;right:0;z-index:2;background-color:var(--storiesListItemMaskColor, rgba(0, 0, 0, 0));background-image:var(--storiesListItemMaskLinearGradient, none);opacity:1}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._is-read--xEVZe .stories-slide__mask--p6utN{background-color:var(--storiesListItemOpenedMaskColor, rgba(0, 0, 0, 0));background-image:var(--storiesListItemOpenedMaskLinearGradient, none)}.stories-slide-wrapper--\\+5j4I .stories-slide--KQzLO._ugc-cell--yAsON .stories-slide__mask--p6utN{background-color:var(--storiesListCardUgcMaskColor, rgba(0, 0, 0, 0));background-image:var(--storiesListCardUgcMaskLinearGradient, none)}.stories-slide-wrapper--\\+5j4I .stories-slide__content--QrUVw{position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;height:100%;max-height:100%;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;font-family:var(--storiesListItemTitleFontFamily);font-weight:normal;font-size:1rem;line-height:normal;font:var(--storiesListItemTitleFont, normal);text-decoration:none;padding:var(--storiesListItemTitlePadding, 0px)}.stories-slide-wrapper--\\+5j4I .stories-slide__content--QrUVw.__position_outside_top--5TlyN,.stories-slide-wrapper--\\+5j4I .stories-slide__content--QrUVw.__position_outside_bottom--pXuxb{position:relative;top:unset;right:unset;bottom:unset;left:unset;height:auto}.stories-slide-wrapper--\\+5j4I .clamp--X7TaH{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}.stories-slide-wrapper--\\+5j4I .stories-slide__title--XeSlz{white-space:pre-wrap;overflow-wrap:anywhere;-webkit-user-select:none;user-select:none}.stories-slide-wrapper--\\+5j4I .stories-slide__title--XeSlz.align-left--PkXxY{text-align:left}.stories-slide-wrapper--\\+5j4I .stories-slide__title--XeSlz.align-center--9Flsz{text-align:center}.stories-slide-wrapper--\\+5j4I .stories-slide__title--XeSlz.align-right--wSGXZ{text-align:right}.stories-slide--KQzLO._format-circle--yaqgh,.stories-slide--KQzLO._format-circle--yaqgh .stories-slide-image__image--mNEIE,.stories-slide--KQzLO._format-circle--yaqgh .stories-slide-image__image--mNEIE video,.stories-slide--KQzLO._format-circle--yaqgh .stories-slide__mask--p6utN,.stories-slide--KQzLO._format-circle--yaqgh .stories-slide-image--cxCFY{border-radius:50%}.stories-slide--KQzLO._favorite-cell--CbxlS .stories-slide__mask--p6utN{background-image:linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.5) 100%)}.stories-slide--KQzLO._favorite-cell--CbxlS._format-circle--yaqgh .stories-slide-image__wrap--kAiGt{display:flex}.stories-slide--KQzLO._favorite-cell--CbxlS._format-circle--yaqgh .stories-slide-image__image--mNEIE{width:85%;height:85%;overflow:visible;margin:auto}.stories-slide--KQzLO._favorite-cell--CbxlS._format-circle--yaqgh .favorite-images-wrapper--zfyVz{margin:0;padding:0}.stories-slide--KQzLO._has-drop-shadow--GdCOv{filter:drop-shadow(var(--storiesListCardDropShadow, none))}.stories-slide--KQzLO._has-drop-shadow--GdCOv._is-read--xEVZe{filter:drop-shadow(var(--storiesListCardOpenedDropShadow, none))}.stories-slide--KQzLO._has-drop-shadow--GdCOv._favorite-cell--CbxlS{filter:drop-shadow(var(--storiesListCardFavoriteDropShadow, none))}.stories-slide--KQzLO._has-drop-shadow--GdCOv._ugc-cell--yAsON{filter:drop-shadow(var(--storiesListCardUgcDropShadow, none))}.stories-slide--KQzLO._has-card-svg-mask--0vIiG .stories-slide__inner--doJqj{-webkit-mask-image:var(--storiesListCardMask);mask-image:var(--storiesListCardMask)}.stories-slide--KQzLO._has-card-svg-mask--0vIiG._is-read--xEVZe .stories-slide__inner--doJqj{-webkit-mask-image:var(--storiesListCardOpenedMask);mask-image:var(--storiesListCardOpenedMask)}.stories-slide--KQzLO._has-card-svg-mask--0vIiG._favorite-cell--CbxlS .stories-slide__inner--doJqj{-webkit-mask-image:var(--storiesListCardFavoriteMask);mask-image:var(--storiesListCardFavoriteMask)}.stories-slide--KQzLO._has-card-svg-mask--0vIiG._ugc-cell--yAsON .stories-slide__inner--doJqj{-webkit-mask-image:var(--storiesListCardUgcMask);mask-image:var(--storiesListCardUgcMask)}.stories-slide--KQzLO .card-overlay-svg-mask--NPptq{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;z-index:3}@supports(((mask-image: linear-gradient(0deg, #fff, #fff), linear-gradient(0deg, #fff, #fff)) and (mask-clip: content-box, border-box)) or ((-webkit-mask-image: linear-gradient(0deg, #fff, #fff), linear-gradient(0deg, #fff, #fff)) and (-webkit-mask-clip: content-box, border-box))) and ((mask-composite: exclude) or (-webkit-mask-composite: xor)){.stories-slide--KQzLO._has-border-gradient-color--JRjv-{border-color:rgba(0,0,0,0)}.stories-slide--KQzLO._has-border-gradient-color--JRjv-:before{content:"";position:absolute;border-radius:inherit;box-sizing:border-box;-webkit-mask-composite:xor;mask-composite:exclude;padding:var(--storiesListBorderNotReadWidth, 2px);top:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);right:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);bottom:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);left:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);background:var(--storiesBorderNotReadGradientColor, transparent);-webkit-mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);-webkit-mask-clip:content-box,border-box;mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);mask-clip:content-box,border-box}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._is-read--xEVZe{border-color:rgba(0,0,0,0)}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._is-read--xEVZe:before{padding:var(--storiesListBorderReadWidth, 2px);top:calc(var(--storiesListBorderReadWidth, 2px)*-1);right:calc(var(--storiesListBorderReadWidth, 2px)*-1);bottom:calc(var(--storiesListBorderReadWidth, 2px)*-1);left:calc(var(--storiesListBorderReadWidth, 2px)*-1);background:var(--storiesBorderReadGradientColor, transparent);-webkit-mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);-webkit-mask-clip:content-box,border-box;mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);mask-clip:content-box,border-box}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._favorite-cell--CbxlS{border-color:rgba(0,0,0,0)}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._favorite-cell--CbxlS:before{padding:var(--storiesListBorderNotReadWidth, 2px);top:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);right:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);bottom:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);left:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);background:var(--storiesListCardFavoriteGradientColor, transparent);-webkit-mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);-webkit-mask-clip:content-box,border-box;mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);mask-clip:content-box,border-box}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._ugc-cell--yAsON{border-color:rgba(0,0,0,0)}.stories-slide--KQzLO._has-border-gradient-color--JRjv-._ugc-cell--yAsON:before{padding:var(--storiesListBorderNotReadWidth, 2px);top:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);right:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);bottom:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);left:calc(var(--storiesListBorderNotReadWidth, 2px)*-1);background:var(--storiesListCardUgcGradientColor, transparent);-webkit-mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);-webkit-mask-clip:content-box,border-box;mask-image:linear-gradient(0deg, #fff, #fff),linear-gradient(0deg, #fff, #fff);mask-clip:content-box,border-box}}',""]),a.locals={"stories-slide-wrapper":"stories-slide-wrapper--+5j4I","stories-slide":"stories-slide--KQzLO","_format-quad":"_format-quad--InfBL","_format-rectangle":"_format-rectangle--koqBU","stories-slide-image":"stories-slide-image--cxCFY","stories-slide-image__image":"stories-slide-image__image--mNEIE","stories-slide__mask":"stories-slide__mask--p6utN","stories-slide__content":"stories-slide__content--QrUVw","_is-read":"_is-read--xEVZe",isTitleCardOutsideTop:"isTitleCardOutsideTop--EmWjs",isTitleCardOutsideBottom:"isTitleCardOutsideBottom--W1JSg","stories-slide__inner":"stories-slide__inner--doJqj","_background-color-black":"_background-color-black--M47zI","_background-color-white":"_background-color-white--0Coab","_background-color-red":"_background-color-red--UU5V7","_background-color-yellow":"_background-color-yellow--0cCZc","_background-color-green":"_background-color-green--10A4n","_background-color-violet":"_background-color-violet--bnIBG","_background-color-blue":"_background-color-blue--lpzRG","_background-color-grey":"_background-color-grey--nbEfc","_background-color-black-gradient":"_background-color-black-gradient--q+aHV","_background-color-white-gradient":"_background-color-white-gradient--YqOjh","_background-color-red-gradient":"_background-color-red-gradient---eK73","_background-color-yellow-gradient":"_background-color-yellow-gradient--xg23E","_background-color-green-gradient":"_background-color-green-gradient--LfrRF","_background-color-violet-gradient":"_background-color-violet-gradient--EQOBs","_background-color-blue-gradient":"_background-color-blue-gradient--TJV7z","_background-color-grey-gradient":"_background-color-grey-gradient--4zJ9u","stories-slide-image__wrap":"stories-slide-image__wrap--kAiGt",_mode_list:"_mode_list--K7WdU","ugc-card-cell":"ugc-card-cell--Hmi8u","video-loaded":"video-loaded--380fQ","_ugc-cell":"_ugc-cell--yAsON",__position_outside_top:"__position_outside_top--5TlyN",__position_outside_bottom:"__position_outside_bottom--pXuxb",clamp:"clamp--X7TaH","stories-slide__title":"stories-slide__title--XeSlz","align-left":"align-left--PkXxY","align-center":"align-center--9Flsz","align-right":"align-right--wSGXZ","_format-circle":"_format-circle--yaqgh","_favorite-cell":"_favorite-cell--CbxlS","favorite-images-wrapper":"favorite-images-wrapper--zfyVz","_has-drop-shadow":"_has-drop-shadow--GdCOv","_has-card-svg-mask":"_has-card-svg-mask--0vIiG","card-overlay-svg-mask":"card-overlay-svg-mask--NPptq","_has-border-gradient-color":"_has-border-gradient-color--JRjv-"};const s=a},731:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-list-controls--sC1DN{pointer-events:none}.stories-list-controls--sC1DN .control-start--NWniL,.stories-list-controls--sC1DN .control-end--Ezk33{cursor:pointer;position:absolute;background-color:var(--storiesListControlsBackgroundColor, white);border-radius:50%;z-index:10;height:var(--storiesListControlsSize);width:var(--storiesListControlsSize);top:50%;display:flex;justify-content:center;align-items:center;pointer-events:all}.stories-list-controls--sC1DN .control-icon--D3DFc{width:7px;height:12px;background-color:var(--storiesListControlsColor, black)}.stories-list-controls--sC1DN.horizontal--g63LL .control-start--NWniL{left:0;transform:translateY(-50%)}.stories-list-controls--sC1DN.horizontal--g63LL .control-start--NWniL.control-start_dir_rtl--7Opm5{left:auto;right:0}.stories-list-controls--sC1DN.horizontal--g63LL .control-end--Ezk33{right:0;transform:translateY(-50%)}.stories-list-controls--sC1DN.horizontal--g63LL .control-end--Ezk33.control-end_dir_rtl--twvGk{left:0;right:auto}.stories-list-controls--sC1DN.vertical--1a8qJ .control-start--NWniL{top:var(--storiesListTopPadding, 0);left:50%;transform:translate3d(-50%, 0, 0) rotate(90deg)}.stories-list-controls--sC1DN.vertical--1a8qJ .control-end--Ezk33{top:auto;bottom:var(--storiesListBottomPadding, 0);right:50%;transform:translate3d(50%, 0, 0) rotate(90deg)}.stories-list-controls--sC1DN .control-start--NWniL{display:flex}.stories-list-controls--sC1DN .control-start--NWniL .control-icon--D3DFc{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 11L1 6L6 1' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 11L1 6L6 1' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\")}.stories-list-controls--sC1DN .control-start--NWniL.control-start_reach-start--sBg3n{display:none}.stories-list-controls--sC1DN .control-end--Ezk33{display:flex}.stories-list-controls--sC1DN .control-end--Ezk33 .control-icon--D3DFc{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 11L6 6L1 1' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg width='7' height='12' viewBox='0 0 7 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 11L6 6L1 1' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\")}.stories-list-controls--sC1DN .control-end--Ezk33.control-end_reach-end--\\+gjXw{display:none}",""]),a.locals={"stories-list-controls":"stories-list-controls--sC1DN","control-start":"control-start--NWniL","control-end":"control-end--Ezk33","control-icon":"control-icon--D3DFc",horizontal:"horizontal--g63LL","control-start_dir_rtl":"control-start_dir_rtl--7Opm5","control-end_dir_rtl":"control-end_dir_rtl--twvGk",vertical:"vertical--1a8qJ","control-start_reach-start":"control-start_reach-start--sBg3n","control-end_reach-end":"control-end_reach-end--+gjXw"};const s=a},130:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-viewer--U\\+VEJ{position:fixed;z-index:1100;top:0;left:0;width:100%;height:100%;display:block;transition:opacity .3s ease;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.stories-viewer--U\\+VEJ:-webkit-full-screen,.stories-viewer--U\\+VEJ:-moz-full-screen,.stories-viewer--U\\+VEJ:-ms-fullscreen,.stories-viewer--U\\+VEJ :fullscreen{width:100% !important;height:100% !important}.stories-viewer-background--rxrSL{position:fixed;top:-60px;left:-60px;width:calc(100% + 120px);height:calc(100% + 120px);background-position:center;background-repeat:no-repeat;background-size:cover}.stories-viewer-backdrop--GqsGY{position:fixed;top:0;right:0;bottom:0;left:0;z-index:11;background-color:rgba(255,255,255,.5)}.stories-viewer-backdrop--GqsGY._desktopMode--5f5bI{display:none}.slider3d--fgseF{position:fixed !important}.slider3d--fgseF.no-select--qQk5D{user-select:none}",""]),a.locals={"stories-viewer":"stories-viewer--U+VEJ","stories-viewer-background":"stories-viewer-background--rxrSL","stories-viewer-backdrop":"stories-viewer-backdrop--GqsGY",_desktopMode:"_desktopMode--5f5bI",slider3d:"slider3d--fgseF","no-select":"no-select--qQk5D"};const s=a},187:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-button-panel--tzCuh{position:absolute;z-index:10001;bottom:0;left:0;width:100%;background-color:#000;border-bottom-left-radius:var(--slideBorderRadius, 0);border-bottom-right-radius:var(--slideBorderRadius, 0)}.stories-button-panel--tzCuh[dir=rtl] .stories-button-panel-actions--I0rFL .right-container--Ax9TH{margin-left:0;margin-right:auto}.stories-button-panel-actions--I0rFL{position:absolute;top:0;left:0;width:100%;height:50px;padding:0 4px;display:flex;flex-direction:row;color:#fff;align-items:center}.stories-button-panel-actions--I0rFL>span{display:flex}.stories-button-panel-actions--I0rFL .right-container--Ax9TH{margin-left:auto}.button-panel-action--rHoQs{cursor:pointer;pointer-events:all;display:flex;align-items:center;justify-content:center;height:50px;width:38px}.button-panel-action--rHoQs>*{pointer-events:none}",""]),a.locals={"stories-button-panel":"stories-button-panel--tzCuh","stories-button-panel-actions":"stories-button-panel-actions--I0rFL","right-container":"right-container--Ax9TH","button-panel-action":"button-panel-action--rHoQs"};const s=a},108:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".goods-card--BAL7e{width:100px}.goods-card--BAL7e:first-of-type{margin-left:.5rem}.goods-card--BAL7e:not(:last-child){margin-right:.5rem}.prices--u3Ojw{display:flex}.prices--u3Ojw>div:not(:last-child){margin-right:.5rem}.typography--qlRjl{text-decoration:none}.typography--old-price--SnUxk{text-decoration:line-through}.figure--UwMfT{margin:0;margin-bottom:.5rem;width:100px;height:100px}.figure--UwMfT>img{width:inherit;height:inherit;max-width:100%;border-radius:var(--figure-border-radius, 0px);background-color:var(--figure-background-color, #ffffff)}",""]),a.locals={"goods-card":"goods-card--BAL7e",prices:"prices--u3Ojw",typography:"typography--qlRjl","typography--old-price":"typography--old-price--SnUxk",figure:"figure--UwMfT"};const s=a},212:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".scrolling-carousel--lZnvG{position:relative}.scrolling-carousel__wrapper--Doobh{position:relative;overflow:hidden}.scrolling-carousel__item--A9ial{display:flex;flex-wrap:nowrap;cursor:pointer}.scrolling-carousel__arrow-button--HrmVa{width:36px;height:36px;color:#757575;margin-top:auto;margin-bottom:auto;box-shadow:0 0 0 1px rgba(0,0,0,.04),0 4px 8px 0 rgba(0,0,0,.2);background:#fff;border-radius:50%;cursor:pointer;position:absolute;top:0;bottom:0;opacity:0;transition:opacity .5s}.scrolling-carousel__arrow-button--HrmVa>svg{position:absolute;left:0;right:0;bottom:0;top:0;margin:auto;width:24px;height:24px;fill:#757575}.scrolling-carousel__arrow-button--HrmVa:hover svg{fill:#000}.scrolling-carousel__arrow-button--show--do24\\+{opacity:.9}.scrolling-carousel__arrow-button--show--do24\\+:hover{opacity:1}.scrolling-carousel__arrow-button--right--Werat{right:-18px}.scrolling-carousel__arrow-button--left--M-xt3{left:-18px}@media(pointer: coarse){.scrolling-carousel__arrow-button--HrmVa{display:none !important}}",""]),a.locals={"scrolling-carousel":"scrolling-carousel--lZnvG","scrolling-carousel__wrapper":"scrolling-carousel__wrapper--Doobh","scrolling-carousel__item":"scrolling-carousel__item--A9ial","scrolling-carousel__arrow-button":"scrolling-carousel__arrow-button--HrmVa","scrolling-carousel__arrow-button--show":"scrolling-carousel__arrow-button--show--do24+","scrolling-carousel__arrow-button--right":"scrolling-carousel__arrow-button--right--Werat","scrolling-carousel__arrow-button--left":"scrolling-carousel__arrow-button--left--M-xt3"};const s=a},161:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".btn--dxsSR{margin:auto auto 10px;padding:10px;cursor:pointer}",""]),a.locals={btn:"btn--dxsSR"};const s=a},277:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,"@keyframes spin--Mv6zz{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.spinner--xVBKd{position:absolute;top:calc(50% - 1rem);left:calc(50% - 1rem);width:2rem;height:2rem;border-radius:50%;animation:spin--Mv6zz .6s infinite linear;border:var(--border, 2px solid transparent);border-color:var(--border-color, black)}",""]),a.locals={spinner:"spinner--xVBKd",spin:"spin--Mv6zz"};const s=a},940:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,"@keyframes fadeInFrames--bEyJg{from{opacity:0}to{opacity:1}}@keyframes fadeOutFrames--oBX-p{from{opacity:1}to{opacity:0}}.goods-container--tR-eJ{position:relative;margin-left:auto;margin-right:auto;display:flex;flex-direction:column;width:100%;height:100%;margin-top:0px}.goods-container--visible--dd40k{animation:300ms fadeInFrames--bEyJg}.goods-container--hidden--QAS9\\+{animation:300ms normal forwards fadeOutFrames--oBX-p}.goods-container__backdrop--CyeDo{flex:1}.goods-list--Wax8Q{position:relative;display:flex;flex-direction:column}",""]),a.locals={"goods-container":"goods-container--tR-eJ","goods-container--visible":"goods-container--visible--dd40k",fadeInFrames:"fadeInFrames--bEyJg","goods-container--hidden":"goods-container--hidden--QAS9+",fadeOutFrames:"fadeOutFrames--oBX-p","goods-container__backdrop":"goods-container__backdrop--CyeDo","goods-list":"goods-list--Wax8Q"};const s=a},942:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".goods-widget-viewer--ryMdV{position:absolute;inset:0;z-index:3000;text-align:left}",""]),a.locals={"goods-widget-viewer":"goods-widget-viewer--ryMdV"};const s=a},349:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-viewer__close--zjUnU{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:calc(15px + var(--timelineBlockTopOffset, 5px));pointer-events:all;cursor:pointer;outline:none;transition:opacity .3s ease-in;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.stories-viewer__close--zjUnU:focus{outline:none}.stories-viewer__close--zjUnU svg{overflow:visible}.stories-viewer__close--zjUnU._paused-ui--wbADu{opacity:0}.stories-viewer__close--zjUnU[data-position=start],.stories-viewer__close--zjUnU[data-position=left]{left:10px}.stories-viewer__close--zjUnU[data-position=start][dir=rtl],.stories-viewer__close--zjUnU[data-position=left][dir=rtl]{left:auto;right:10px}.stories-viewer__close--zjUnU[data-position=end],.stories-viewer__close--zjUnU[data-position=right]{right:10px}.stories-viewer__close--zjUnU[data-position=end][dir=rtl],.stories-viewer__close--zjUnU[data-position=right][dir=rtl]{left:10px;right:auto}.story-header--iD7hE{position:relative;z-index:1140}",""]),a.locals={"stories-viewer__close":"stories-viewer__close--zjUnU","_paused-ui":"_paused-ui--wbADu","story-header":"story-header--iD7hE"};const s=a},137:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-pager--JtIm1{position:absolute;top:0;left:0;right:0;bottom:0;height:100%;width:100%;z-index:1131;background-image:linear-gradient(180deg, rgba(0, 0, 0, 0.104) 0%, rgba(0, 0, 0, 0) 20%);pointer-events:none;transition:opacity .3s ease-in}.stories-pager--JtIm1._desktop-mode--MFqdz{border-top-left-radius:5px;border-top-right-radius:5px}.stories-pager--JtIm1._paused-ui--YKpOe{opacity:0}.stories-pager__ticks--IooJa{height:3px;display:flex;margin:8px 8px;margin-top:var(--timelineBlockTopOffset, 8px);opacity:1}.stories-pager__ticks--IooJa.hiddenTimeline--uwXIm{opacity:0}.stories-pager__tick--L96Px{background-color:var(--stories-pager-background, rgba(255, 255, 255, 0.6));width:100%;margin:0 2px;overflow:hidden;position:relative;border-radius:10px}.stories-pager__tick--L96Px:first-child{margin-left:0}.stories-pager__tick--L96Px:last-child{margin-right:0}.stories-pager__tick-progress--lwEYc{width:100%;height:3px}.stories-pager__tick-progress--lwEYc._active---U7hY{background-color:var(--stories-pager-tick-foreground, rgb(255, 255, 255))}.stories-pager__tick-progress-loader--DJvQ6{width:100%;height:3px;position:absolute;top:0;left:0;background:linear-gradient(to right, var(--stories-pager-tick-foreground, rgb(255, 255, 255)) var(--tick), transparent 0)}.stories-pager--JtIm1[dir=rtl] .stories-pager__tick-progress-loader--DJvQ6{background:linear-gradient(to left, var(--stories-pager-tick-foreground, rgb(255, 255, 255)) var(--tick), transparent 0)}",""]),a.locals={"stories-pager":"stories-pager--JtIm1","_desktop-mode":"_desktop-mode--MFqdz","_paused-ui":"_paused-ui--YKpOe","stories-pager__ticks":"stories-pager__ticks--IooJa",hiddenTimeline:"hiddenTimeline--uwXIm","stories-pager__tick":"stories-pager__tick--L96Px","stories-pager__tick-progress":"stories-pager__tick-progress--lwEYc",_active:"_active---U7hY","stories-pager__tick-progress-loader":"stories-pager__tick-progress-loader--DJvQ6"};const s=a},278:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.stories-slide--8v5Pf{top:0;left:0;right:0;bottom:0;position:absolute;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:var(--slideBorderRadius, 0)}.stories-slide--8v5Pf._dummy--Llble{background-color:#fff}.stories-slide--8v5Pf .load-mask--5XCq2{position:absolute;background-color:#000;z-index:2000;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center}.stories-slide--8v5Pf._with-bottom-panel--2p7Pi._desktop-mode--CJL90,.stories-slide--8v5Pf._with-bottom-panel--2p7Pi._desktop-mode--CJL90 .narrative-slide-background--hMuFX,.stories-slide--8v5Pf._with-bottom-panel--2p7Pi._desktop-mode--CJL90 .narrative-slide-elements--i0a24{border-bottom-right-radius:0;border-bottom-left-radius:0}.stories-slide--8v5Pf .stories-slide__refresh-btn--MEBPq{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}.loading-spinner-default--ltiyb{-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--T3-dY .6s infinite linear;animation:loading-spinner--T3-dY .6s infinite linear}@keyframes loading-spinner--T3-dY{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.stories-slide--8v5Pf{z-index:1120;visibility:hidden}.stories-slide--8v5Pf.stories-slide_active--OBnom{z-index:1130;visibility:visible}.stories-slide--8v5Pf.stories-slide_active--OBnom .narrative-slide-elements{visibility:hidden}.stories-slide--8v5Pf.stories-slide_active--OBnom.stories-slide_text-fitted--s2Pmi .narrative-slide-elements{visibility:visible}.stories-slide-offset--R5f2H{pointer-events:none;position:relative;height:100%}.stories-slide-box--Br9iz{position:relative;padding:154.838709677% 0 0 0}.stories-slide-content--CKfk0{position:absolute;top:0;left:0;right:0;bottom:0;-webkit-backface-visibility:hidden;backface-visibility:hidden;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}',""]),a.locals={"stories-slide":"stories-slide--8v5Pf",_dummy:"_dummy--Llble","load-mask":"load-mask--5XCq2","_with-bottom-panel":"_with-bottom-panel--2p7Pi","_desktop-mode":"_desktop-mode--CJL90","narrative-slide-background":"narrative-slide-background--hMuFX","narrative-slide-elements":"narrative-slide-elements--i0a24","stories-slide__refresh-btn":"stories-slide__refresh-btn--MEBPq","loading-spinner-default":"loading-spinner-default--ltiyb","loading-spinner":"loading-spinner--T3-dY","stories-slide_active":"stories-slide_active--OBnom","stories-slide_text-fitted":"stories-slide_text-fitted--s2Pmi","stories-slide-offset":"stories-slide-offset--R5f2H","stories-slide-box":"stories-slide-box--Br9iz","stories-slide-content":"stories-slide-content--CKfk0"};const s=a},594:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".stories-item--s9hOL{visibility:visible;position:absolute;width:100%;height:auto;bottom:0;border-radius:inherit;backface-visibility:hidden}.slider3d__item--7j2AS{position:absolute;left:0;top:0;width:100%;backface-visibility:hidden;transform-style:preserve-3d}",""]),a.locals={"stories-item":"stories-item--s9hOL",slider3d__item:"slider3d__item--7j2AS"};const s=a},50:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".story-reader-controls--8N5W7 .slider3d__btn_next--2GDPW,.story-reader-controls--8N5W7 .slider3d__btn_prev--P6gvY{display:none}.story-reader-controls--8N5W7._desktop_mode--mSlGA .slider3d__btn_next--2GDPW,.story-reader-controls--8N5W7._desktop_mode--mSlGA .slider3d__btn_prev--P6gvY{display:block;position:absolute;top:50%;transform:translateY(-50%);left:50%}.story-reader-controls--8N5W7 .btn-icon--NRFjq{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background-color:rgba(0,0,0,0);border:none;color:#fff;cursor:pointer}.story-reader-controls--8N5W7 .btn-icon--NRFjq:focus{outline:0}.story-reader-controls--8N5W7 .btn-icon--NRFjq:disabled{color:#464646;cursor:not-allowed}",""]),a.locals={"story-reader-controls":"story-reader-controls--8N5W7",slider3d__btn_next:"slider3d__btn_next--2GDPW",slider3d__btn_prev:"slider3d__btn_prev--P6gvY",_desktop_mode:"_desktop_mode--mSlGA","btn-icon":"btn-icon--NRFjq"};const s=a},390:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".slider3d__wrapper--49G6v{left:50%;transform:translateX(-50%);overflow:hidden;box-sizing:border-box}.slider3d__wrapper--49G6v.slider3d__wrapper_swipe-up--r1InL.slider3d__wrapper_swipe-up--r1InL{background-color:rgba(0,0,0,0)}.slider3d__wrapper--49G6v .game-reader-wrapper--vHugs,.slider3d__wrapper--49G6v .share-panel-wrapper--zNSqw{overflow:hidden}.slider3d__wrapper--49G6v._desktop_mode--m7fGP{padding:50px 0}.slider3d__wrapper--49G6v._desktop_mode--m7fGP>.share-panel-wrapper--zNSqw{top:50px;bottom:50px;border-radius:5px}.slider3d__wrapper--49G6v._desktop_mode--m7fGP>.share-panel-wrapper--zNSqw.share-panel-wrapper--zNSqw{border-bottom-left-radius:0;border-bottom-right-radius:0}.slider3d__wrapper--49G6v *,.slider3d__wrapper--49G6v ::after,.slider3d__wrapper--49G6v ::before{box-sizing:border-box}.slider3d__wrapper--49G6v .stories-item--i1n9b,.slider3d__wrapper--49G6v .stories-slide--KXt9a,.slider3d__wrapper--49G6v .narrative-slide-background--LO2L6,.slider3d__wrapper--49G6v .narrative-slide-elements--bUq5g{border-radius:var(--slideBorderRadius, 0)}.slider3d--pT6gr{position:fixed !important}.slider3d--pT6gr.no-select--zMya8{user-select:none}.slider3d__wrapper--49G6v{z-index:1;position:relative;height:100%}.stories-face--tqFop{position:absolute !important;top:0;left:0;right:0;width:100%;width:calc(100% + .01px);height:100%}.slider3d__rotater--eYXIw{--tick: 0%;--tickOpacity: 0}.slider3d__inner--EFsin,.slider3d__rotater--eYXIw{position:relative;height:100%;transform-style:preserve-3d}",""]),a.locals={slider3d__wrapper:"slider3d__wrapper--49G6v","slider3d__wrapper_swipe-up":"slider3d__wrapper_swipe-up--r1InL","game-reader-wrapper":"game-reader-wrapper--vHugs","share-panel-wrapper":"share-panel-wrapper--zNSqw",_desktop_mode:"_desktop_mode--m7fGP","stories-item":"stories-item--i1n9b","stories-slide":"stories-slide--KXt9a","narrative-slide-background":"narrative-slide-background--LO2L6","narrative-slide-elements":"narrative-slide-elements--bUq5g",slider3d:"slider3d--pT6gr","no-select":"no-select--zMya8","stories-face":"stories-face--tqFop",slider3d__rotater:"slider3d__rotater--eYXIw",slider3d__inner:"slider3d__inner--EFsin"};const s=a},169:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.wrapper--A3xCJ{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";position:absolute;inset:0;z-index:3000;border-radius:inherit}.wrapper--A3xCJ .backdrop--CPTm4{display:block;position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:rgba(0,0,0,.5);border-radius:inherit}.main--2Iqns{position:absolute;z-index:2;user-select:none;display:flex;flex-direction:column;text-rendering:geometricprecision;overflow:hidden}.main--2Iqns .question--mn519{width:100%;height:auto}.main--2Iqns .question--mn519:empty{display:none}.main--2Iqns .input-group--jE\\+PN{display:flex}.main--2Iqns .input-group--jE\\+PN .input--Z388z{width:100%}.main--2Iqns .input-group--jE\\+PN .input-group__prepend--KtZUG{display:flex;flex:.35}.main--2Iqns .input-group--jE\\+PN .input-group__separator--44goC{border-right:1px solid #fff;margin-right:.5rem}.main--2Iqns .input-group--jE\\+PN .input--Z388z{flex:1}.main--2Iqns .input-wrapper--yYgPA{overflow:hidden;box-sizing:content-box;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.main--2Iqns .input-wrapper--yYgPA .input--Z388z{background:none;-webkit-tap-highlight-color:rgba(0,0,0,0);text-rendering:inherit;outline:none;border:none}.main--2Iqns .input-wrapper--yYgPA .input--Z388z::placeholder{color:inherit}.main--2Iqns .input-wrapper--yYgPA .input--Z388z.input_centered--0yBvl{text-align:center}.main--2Iqns .input-wrapper--yYgPA.is-invalid--PDNfg{border-color:#dc3545 !important;box-shadow:0 0 0 .25rem rgba(220,53,69,.25)}.textarea-grow-wrap----9bt{display:grid;max-width:100%;word-break:break-all}.textarea-grow-wrap----9bt::after{content:attr(data-replicated-value) " ";white-space:pre-wrap;visibility:hidden}.textarea-grow-wrap----9bt>.input--Z388z{resize:none;overflow:hidden}.textarea-grow-wrap----9bt>.input--Z388z,.textarea-grow-wrap----9bt::after{border:inherit;padding:inherit;font:inherit;text-rendering:inherit;text-align:inherit;line-height:normal;color:inherit;grid-area:1/1/2/2}.button-wrapper--u94hX{width:100%}.button-wrapper--u94hX .button--bQRP7{width:100%;cursor:pointer}.button-wrapper--u94hX .button--bQRP7:disabled,.button-wrapper--u94hX .button--bQRP7[disabled=true]{cursor:not-allowed;pointer-events:none;background-color:#272727 !important}@keyframes fadeIn--b16pe{from{opacity:0}to{opacity:1}}@keyframes fadeOut--DquTc{from{opacity:1}to{opacity:0}}.fadeIn--b16pe{animation:fadeIn--b16pe 300ms forwards}.fadeOut--DquTc{animation:fadeOut--DquTc 0ms forwards}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}',""]),a.locals={wrapper:"wrapper--A3xCJ",backdrop:"backdrop--CPTm4",main:"main--2Iqns",question:"question--mn519","input-group":"input-group--jE+PN",input:"input--Z388z","input-group__prepend":"input-group__prepend--KtZUG","input-group__separator":"input-group__separator--44goC","input-wrapper":"input-wrapper--yYgPA",input_centered:"input_centered--0yBvl","is-invalid":"is-invalid--PDNfg","textarea-grow-wrap":"textarea-grow-wrap----9bt","button-wrapper":"button-wrapper--u94hX",button:"button--bQRP7",fadeIn:"fadeIn--b16pe",fadeOut:"fadeOut--DquTc"};const s=a},138:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.screen-orientation-lock--lAOKa{pointer-events:all;position:absolute;top:0;left:0;right:0;bottom:0;background-color:#fff;z-index:1;user-select:none;background-position:center center;background-size:cover;background-repeat:no-repeat;background-image:url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTc2MiIgaGVpZ2h0PSI4MjkiIHZpZXdCb3g9IjAgMCAxNzYyIDgyOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxyZWN0IHdpZHRoPSIxNzYyIiBoZWlnaHQ9IjgyOSIgZmlsbD0iIzIxMjEyMSIvPg0KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02NjYgNTQ5QzY2MS41ODIgNTQ5IDY1OCA1NDUuNDE4IDY1OCA1NDFMNjU4IDM0OUM2NTggMzQ0LjU4MiA2NjEuNTgyIDM0MSA2NjYgMzQxTDk5NCAzNDFDOTk4LjQxOCAzNDEgMTAwMiAzNDQuNTgyIDEwMDIgMzQ5TDEwMDIgNTQxQzEwMDIgNTQ1LjQxOCA5OTguNDE4IDU0OSA5OTQgNTQ5TDY2NiA1NDlaTTY2OCA1NDFMOTYyIDU0MUw5NjIgMzQ5TDY2OCAzNDlMNjY4IDU0MVoiIGZpbGw9IiMzRjNGM0YiLz4NCjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTAwIDIxNEM5MDAgMjA5LjU4MiA5MDMuNTgyIDIwNiA5MDggMjA2SDExMDBDMTEwNC40MiAyMDYgMTEwOCAyMDkuNTgyIDExMDggMjE0VjU0MkMxMTA4IDU0Ni40MTggMTEwNC40MiA1NTAgMTEwMCA1NTBIOTA4QzkwMy41ODIgNTUwIDkwMCA1NDYuNDE4IDkwMCA1NDJWMjE0Wk05MDggMjE2VjUxMEgxMTAwVjIxNkg5MDhaIiBmaWxsPSJ3aGl0ZSIvPg0KPHBhdGggZD0iTTgwMy41IDIxNkM3NTggMjIwLjUgNzEzLjUgMjU3IDcxNyAzMTcuNUM3MjEgMjc4IDc1OCAyMzcuNSA4MDMuNSAyNDIuNVYyNjRMODQ1LjUgMjI5TDgwMy41IDE5NS41VjIxNloiIGZpbGw9IndoaXRlIi8+DQo8L3N2Zz4=")}',""]),a.locals={"screen-orientation-lock":"screen-orientation-lock--lAOKa"};const s=a},196:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".share-panel__body_screenshot--uZCkX{display:flex;flex-direction:column}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1{cursor:pointer;background:rgba(0,0,0,0);border:none;width:100%;height:100%;display:flex;text-align:left;justify-content:center;align-items:center;color:#fff}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__icon--w7FbM{margin-right:5px;position:relative;width:30px;height:30px;flex-shrink:0}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__icon--w7FbM .btn-copy__icon-state--aOFwh{position:absolute;inset:0px;opacity:0;transition:opacity 300ms ease-in-out}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__icon--w7FbM .btn-copy__icon-state--aOFwh.btn-copy__icon-state_default--n6LWH{opacity:1;visibility:visible}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__icon--w7FbM .btn-copy__icon-state--aOFwh.btn-copy__icon-state_done--r-uzJ{opacity:1;visibility:visible}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1 .btn-copy__text--IQD4A{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:5px}.share-panel__body_screenshot--uZCkX .btn--VzRxf.btn-copy--dhlh1:active{transform:scale(0.96)}.share-panel__body_screenshot--uZCkX .share-panel-row--LzAa0{justify-content:center;height:auto;padding:16px}.share-panel__body_screenshot--uZCkX .share-panel-row--LzAa0:first-child{height:450px;box-sizing:border-box}.share-panel__body_screenshot--uZCkX .share-panel-row__image-link--RXIki{width:100%;height:100%;display:flex;justify-content:center}.share-panel__body_screenshot--uZCkX .share-panel-row__image--HyVwP{max-width:100%;height:100%;object-fit:cover;border-radius:20px}.share-panel__body_screenshot--uZCkX .share-item__download-button--ypCUc{align-self:center;cursor:pointer;height:100%;width:100%;text-decoration:none;color:#fff;display:flex;align-items:center;justify-content:center}.share-panel__body_screenshot--uZCkX .share-item__download-button--ypCUc:active{transform:scale(0.96)}",""]),a.locals={"share-panel__body_screenshot":"share-panel__body_screenshot--uZCkX",btn:"btn--VzRxf","btn-copy":"btn-copy--dhlh1","btn-copy__icon":"btn-copy__icon--w7FbM","btn-copy__icon-state":"btn-copy__icon-state--aOFwh","btn-copy__icon-state_default":"btn-copy__icon-state_default--n6LWH","btn-copy__icon-state_done":"btn-copy__icon-state_done--r-uzJ","btn-copy__text":"btn-copy__text--IQD4A","share-panel-row":"share-panel-row--LzAa0","share-panel-row__image-link":"share-panel-row__image-link--RXIki","share-panel-row__image":"share-panel-row__image--HyVwP","share-item__download-button":"share-item__download-button--ypCUc"};const s=a},610:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".share-item--OHeZZ{color:#fff}a.share-item--OHeZZ{color:#fff;transition:none}a.share-item--OHeZZ:hover{color:#fff}.social-list--5d274{flex-wrap:wrap;height:auto;padding-bottom:1rem}.social-list--5d274 .social-list__item--PmqO7{margin-top:1rem}",""]),a.locals={"share-item":"share-item--OHeZZ","social-list":"social-list--5d274","social-list__item":"social-list__item--PmqO7"};const s=a},778:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,'.share-panel-wrapper--x2oi3{font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";position:absolute;top:0;left:0;right:0;bottom:0;z-index:2}.share-panel-wrapper--x2oi3 .share-panel-backdrop--wh9uo{display:block;position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:rgba(0,0,0,.5)}.share-panel--Qm-mD{position:absolute;top:auto;left:0;right:0;bottom:0;z-index:2;user-select:none}.share-panel-row--LPdKG{width:100%;height:150px;display:flex;flex-direction:row;align-items:center}.share-panel-row--LPdKG .share-item--ZalUh{cursor:pointer;flex:0 0 auto;width:69px;height:90px;margin:0 10px;display:flex;flex-direction:column;align-items:center;text-align:center}.share-panel-row--LPdKG .share-item--ZalUh:first-child{margin-left:20px}.share-panel-row--LPdKG .share-item--ZalUh:last-child{margin-right:20px}.share-panel-row--LPdKG .share-item--ZalUh,.share-panel-row--LPdKG .share-item--ZalUh:visited,.share-panel-row--LPdKG .share-item--ZalUh:active,.share-panel-row--LPdKG .share-item--ZalUh:focus{text-decoration:none}.share-panel-row--LPdKG .share-item--ZalUh .share-item-title--RxVKy{margin-top:20px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;padding:.2rem}.share-panel-row--LPdKG.title-row--Vfan2{height:120px;padding-top:30px;padding-bottom:30px;padding-left:20px;padding-right:20px}.share-panel-row--LPdKG.title-row--Vfan2 .share-url-favicon--cGryk{width:60px;height:60px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}.share-panel-row--LPdKG.title-row--Vfan2 .share-url-favicon--cGryk img{width:30px;height:30px}.share-panel-row--LPdKG.title-row--Vfan2 .title--ZQZ6c{font-size:16px;line-height:1.4rem;margin-left:15px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.share-panel-separator--NXYXt{width:100%;height:1px}.share-panel--Qm-mD{will-change:transform;transition:transform 300ms}.share-panel__body--7Ljnv{width:100%;height:100%}@keyframes slideIn--CzJft{from{transform:translateY(100%)}to{transform:translateY(0%)}}@keyframes slideOut--lNjIY{from{transform:translateY(0%)}to{transform:translateY(100%)}}@keyframes fadeIn--qopSX{from{opacity:0}to{opacity:1}}@keyframes fadeOut--bA6JG{from{opacity:1}to{opacity:0}}.fadeIn--qopSX{animation:fadeIn--qopSX 300ms forwards}.fadeOut--bA6JG{animation:fadeOut--bA6JG 300ms forwards}.slideIn--CzJft{animation:slideIn--CzJft 300ms forwards}.slideOut--lNjIY{animation:slideOut--lNjIY 300ms forwards}',""]),a.locals={"share-panel-wrapper":"share-panel-wrapper--x2oi3","share-panel-backdrop":"share-panel-backdrop--wh9uo","share-panel":"share-panel--Qm-mD","share-panel-row":"share-panel-row--LPdKG","share-item":"share-item--ZalUh","share-item-title":"share-item-title--RxVKy","title-row":"title-row--Vfan2","share-url-favicon":"share-url-favicon--cGryk",title:"title--ZQZ6c","share-panel-separator":"share-panel-separator--NXYXt","share-panel__body":"share-panel__body--7Ljnv",fadeIn:"fadeIn--qopSX",fadeOut:"fadeOut--bA6JG",slideIn:"slideIn--CzJft",slideOut:"slideOut--lNjIY"};const s=a},81:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".icon--5RBkn{width:2rem;height:2rem}",""]),a.locals={icon:"icon--5RBkn"};const s=a},323:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(935),a=r.n(i)()((function(e){return e[1]}));a.push([e.id,".narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-link,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-answer,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-data-input,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-poll-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-answer,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-rate-input,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-answer,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-copy,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-share,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-story-repeat,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-game,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target],.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type=closeStory],.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up-items,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-barcode{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-link *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-answer *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-data-input *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-poll-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-answer *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-rate-input *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-answer *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-copy *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-share *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-story-repeat *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-game *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target] *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type=closeStory] *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up-items *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-barcode *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-input-container .rangeslider{pointer-events:all;cursor:pointer}",""]);const s=a},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,i){"string"==typeof e&&(e=[[null,e,""]]);var a={};if(i)for(var s=0;s<this.length;s++){var n=this[s][0];null!=n&&(a[n]=!0)}for(var o=0;o<e.length;o++){var l=[].concat(e[o]);i&&a[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),t.push(l))}},t}},591:(e,t,r)=>{var i,a=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},s=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]}}(),n=[];function o(e){for(var t=-1,r=0;r<n.length;r++)if(n[r].identifier===e){t=r;break}return t}function l(e,t){for(var r={},i=[],a=0;a<e.length;a++){var s=e[a],l=t.base?s[0]+t.base:s[0],d=r[l]||0,c="".concat(l," ").concat(d);r[l]=d+1;var u=o(c),h={css:s[1],media:s[2],sourceMap:s[3]};-1!==u?(n[u].references++,n[u].updater(h)):n.push({identifier:c,updater:m(h,t),references:1}),i.push(c)}return i}function d(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var a=r.nc;a&&(i.nonce=a)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var n=s(e.insert||"head");if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(t)}return t}var c,u=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function h(e,t,r,i){var a=r?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=u(t,a);else{var s=document.createTextNode(a),n=e.childNodes;n[t]&&e.removeChild(n[t]),n.length?e.insertBefore(s,n[t]):e.appendChild(s)}}function p(e,t,r){var i=r.css,a=r.media,s=r.sourceMap;if(a?e.setAttribute("media",a):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var g=null,f=0;function m(e,t){var r,i,a;if(t.singleton){var s=f++;r=g||(g=d(t)),i=h.bind(null,r,s,!1),a=h.bind(null,r,s,!0)}else r=d(t),i=p.bind(null,r,t),a=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else a()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=a());var r=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<r.length;i++){var a=o(r[i]);n[a].references--}for(var s=l(e,t),d=0;d<r.length;d++){var c=o(r[d]);0===n[c].references&&(n[c].updater(),n.splice(c,1))}r=s}}}},123:(e,t,r)=>{const i=document.querySelector("[nonce]");i&&(r.nc=i.nonce||i.getAttribute("nonce")),window.litNonce=r.nc}},T={};function A(e){var t=T[e];if(void 0!==t)return t.exports;var r=T[e]={id:e,exports:{}};return L[e](r,r.exports,A),r.exports}A.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return A.d(t,{a:t}),t},A.d=(e,t)=>{for(var r in t)A.o(t,r)&&!A.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},A.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),A.nc=void 0;var R={};(()=>{A.d(R,{hS:()=>D,KL:()=>Yl,A7:()=>Y,Yb:()=>T,Tg:()=>B,WH:()=>N,lV:()=>F,IV:()=>Xr,tP:()=>Zr,h8:()=>ei,Xz:()=>vo,wS:()=>sl,VS:()=>st,oC:()=>nt,L8:()=>Yr,NL:()=>Jr,Ez:()=>ve,of:()=>re,Hp:()=>Vp,MD:()=>ne,_U:()=>se,zC:()=>ae,ws:()=>U,Jf:()=>Z,Jd:()=>oe,SK:()=>$,tI:()=>G,Uy:()=>V,SP:()=>z,Jj:()=>H,pt:()=>q,nN:()=>Q,mk:()=>W,Vq:()=>ie,ex:()=>K,yx:()=>ee,qz:()=>X,h0:()=>le,KO:()=>te});const L=(e=>{var t={};return A.d(t,e),t})({EventEmitter:()=>e.EventEmitter,default:()=>e.default});var T;!function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(T||(T={}));const D={hasFavorite:!1,hasLike:!1,hasShare:!1,closeButtonPosition:T.END,loader:{default:{color:"white",accentColor:"transparent"},custom:null},closeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M30 15.2115C30 23.4958 23.2843 30.2115 15 30.2115C6.71573 30.2115 0 23.4958 0 15.2115C0 6.92728 6.71573 0.211548 15 0.211548C23.2843 0.211548 30 6.92728 30 15.2115Z" fill="white"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.8309 10.0424C10.0969 9.77646 10.5281 9.77646 10.7941 10.0424L15 14.2483L19.2059 10.0424C19.4719 9.77646 19.9031 9.77646 20.1691 10.0424C20.4351 10.3084 20.4351 10.7397 20.1691 11.0057L15.9632 15.2115L20.1691 19.4174C20.4351 19.6834 20.4351 20.1147 20.1691 20.3807C19.9031 20.6466 19.4719 20.6466 19.2059 20.3807L15 16.1748L10.7941 20.3807C10.5281 20.6466 10.0969 20.6466 9.8309 20.3807C9.56492 20.1147 9.56492 19.6834 9.8309 19.4174L14.0368 15.2115L9.8309 11.0057C9.56492 10.7397 9.56492 10.3084 9.8309 10.0424Z" fill="#C2C2C4"/>\n</svg>'}},forceDesktopMode:void 0},B={borderRadius:5,loader:{default:{color:"white",accentColor:"transparent"},custom:null},backdropColor:"#1a1a1a",backdrop:{opacity:1,background:"#1a1a1a"},game:{backdropColor:"rgb(51, 51, 51)"},forceDesktopMode:D.forceDesktopMode,forceCheckOrientation:!0};var F;!function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(F||(F={}));const N={goodsWidgetRenderingType:F.DEFAULT,goodsList:{renderingType:F.DEFAULT,closeBackgroundColor:"#000000",substrateHeight:200,substrateColor:"#FFFFFF",dimColor:"rgba(0, 0, 0, 0.5)"},goodsCard:{mainTextColor:"#000000",oldPriceTextColor:"#CCCCCC",imageBackgroundColor:"transparent",imageCornerRadius:8},openGoodsWidgetHandler:e=>Promise.resolve(e),loader:{default:{color:"gray",accentColor:"transparent"}}};var U,W,z,V,G,$,H,q;!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(U||(U={})),function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(W||(W={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(z||(z={})),function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end",e.CENTER="center"}(V||(V={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(G||(G={})),function(e){e.Medium="medium",e.High="high"}($||($={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}(H||(H={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(q||(q={}));const Q={direction:H.ROW,card:{title:{font:'16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',padding:10.6,textAlign:V.START,position:G.CARD_INSIDE_BOTTOM,display:!0,lineClamp:4},gap:10,height:178,aspectRatio:null,coverQuality:$.High,variant:z.RECTANGLE,border:{radius:21,color:"black",width:2,gap:5},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,opened:{border:{radius:null,color:null,width:null,gap:null,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null},coverLazyLoading:!1},favoriteCard:{title:{content:"Favorite",font:"normal",color:"white",padding:15,textAlign:V.START,position:G.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:$.High,coverLazyLoading:!1,variant:z.CIRCLE,border:{radius:0,color:"black",width:2,gap:3,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,opened:{border:{radius:null,color:null,width:null,gap:null,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null}},sidePadding:20,topPadding:20,bottomPadding:20,bottomMargin:17,layout:{height:"auto",backgroundColor:"transparent",sliderAlign:W.START},navigation:{speed:300,showControls:!1,controlsSize:48,controlsBackgroundColor:"white",controlsColor:"black"},autoScrollOnStoryClose:!0,ugcCard:{title:{content:null,font:'16px system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',color:"#000",padding:15,textAlign:V.START,position:G.CARD_INSIDE_BOTTOM,display:!0,lineClamp:3},gap:10,height:70,aspectRatio:null,coverQuality:$.High,coverLazyLoading:!1,variant:z.CIRCLE,border:{radius:0,color:"transparent",width:0,gap:0,gradient:null},boxShadow:null,dropShadow:null,opacity:null,mask:{color:null,linearGradient:null},svgMask:null,image:{svgSrc:{baseState:'<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M50 85.5C69.6061 85.5 85.5 69.6061 85.5 50C85.5 30.3939 69.6061 14.5 50 14.5C30.3939 14.5 14.5 30.3939 14.5 50C14.5 69.6061 30.3939 85.5 50 85.5Z" stroke="white" stroke-width="2"/>\n<path d="M50.5 34.5V65.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M34.5 49.5H65.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>\n'}},backgroundColor:"#0c62f3"}},K={title:{content:"Favorite",font:"1.4rem/1.2 InternalPrimaryFont",color:"white",backgroundColor:"#333333"},headerTopOffset:0,bottomOffset:0,backgroundColor:"#333333"};var Y;!function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader",e.STACK_STORY_LIST="stackStoryList",e.IAM_READER="iamReader"}(Y||(Y={}));const J={label:"X",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 195 195" xmlns="http://www.w3.org/2000/svg">\n<g transform="matrix(.20227 0 0 .20302 -71 -26.7)">\n<circle cx="834.3" cy="610.6" r="481.3" stroke="#fff" strokeMiterlimit="10"/>\n<path d="m537.8 331.8 230 307.6-231.4 250.1h52.2l202.6-219 163.8 219h177.3l-243-324.9 215.5-232.8h-52l-187 201.7-150.7-201.7zm76.6 38.4h81.5l359.7 481h-81.5z" fill="#fff"/>\n</g>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://twitter.com/share?url=${e}&text=${t}`},Z={targets:["vk","ok","facebook","x","linkedin","telegram"],targetParams:{vk:{label:"VK",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">\n<circle cx="24" cy="24" r="21.3" fill="#fff"/>\n<path d="M22.3.7a23.3 23.3 0 0 0-5 45.6A23.4 23.4 0 0 0 30.7 1.7C28 .8 25.2.6 22.3.7Zm1.8 14.5c1.2.1 1.8.3 2 .6l.3.6c.2.4.2.8 0 4.3 0 2.2 0 2.9.2 3.4s.7.8 1.1.6a8 8 0 0 0 1.8-2 29 29 0 0 0 3-5.8c.3-.4.5-.7.8-.8h7.1a.7.7 0 0 1 .5.8c0 .7-.8 2.2-2 4a92.7 92.7 0 0 1-3.5 4.8c-.3.5-.2 1 .2 1.6l1.4 1.4c1.8 1.7 2.6 2.6 3.3 3.6.4.7.6 1.2.5 1.7 0 .2-.2.5-.5.6-.4.2-.9.2-3.7.3H34l-.5-.1c-1-.4-1.8-1-3.5-3-.9-1-1.6-1.5-2-1.5-.5 0-1 .6-1.3 1.3-.1.5-.2.8-.2 1.7-.1 1-.2 1.2-.8 1.5H22a9.5 9.5 0 0 1-4.2-1.4c-1.9-1.1-3-2.2-4.4-3.8a48.7 48.7 0 0 1-7.2-12.5c-.1-.5 0-.9.5-1l3-.1h3c.5.3.7.5 1 1.4L16 22c.5.9 1 1.6 1.5 2 .6.6.9.7 1.3.7.3 0 .4-.1.6-.6.5-1 .6-4.8.1-6.3-.2-.8-.6-1.1-1.7-1.3-.2 0-.2-.2 0-.4.4-.6 1.1-.9 2.6-1H24Z" fill="#45668E"/>\n</svg>'}},getUrl:({url:e,text:t})=>`https://vk.com/share.php?url=${e}&title=${t}`},facebook:{label:"Facebook",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="126.4 2.3 589 589" xmlns="http://www.w3.org/2000/svg">\n<circle cx="420.9" cy="296.8" r="294.5" fill="#3c5a9a"/>\n<path d="M516.7 92.7h-65.2c-38.8 0-81.8 16.3-81.8 72.4.2 19.5 0 38.3 0 59.3h-44.8v71.3h46.2V501h84.8V294.4h56l5-70.2h-62.4V184c0-22.2 23-21 24.4-21h37.8V92.8z" fill="#fff"/>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://www.facebook.com/sharer.php?u=${e}&t=${t}`},x:J,twitter:J,linkedin:{label:"LinkedIn",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" enableBackground="new 0 0 550 550" version="1.1" viewBox="0 0 550 550" xmlSpace="preserve" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">\n<circle cx="275" cy="275" r="256" fill="#04689B"/>\n<path d="m219.2 366.5h-38.8v-124.3h38.8v124.3zm-20.4-139.9h-0.3c-14.1 0-23.2-9.5-23.2-21.6 0-12.3 9.4-21.6 23.7-21.6s23.1 9.3 23.4 21.5c0.1 12.2-9 21.7-23.6 21.7zm175.8 139.9h-44v-64.3c0-16.8-6.9-28.3-22-28.3-11.6 0-18 7.7-21 15.2-1.1 2.7-0.9 6.4-0.9 10.2v67.3h-43.7s0.6-113.9 0-124.3h43.6v19.5c2.6-8.5 16.5-20.7 38.8-20.7 27.6 0 49.3 17.9 49.3 56.4v69z" fill="#fff"/>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://www.linkedin.com/sharing/share-offsite/?url=${e}&title=${t}`},telegram:{label:"Telegram",icon:{svgSrc:{baseState:'<svg data-v-05f1b0f5="" data-v-b5b60290="" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50px" height="50px"><defs data-v-05f1b0f5=""><linearGradient data-v-05f1b0f5="" id="a" x1="120" y1="240" x2="120" gradientUnits="userSpaceOnUse"><stop data-v-05f1b0f5="" offset="0" stop-color="#1d93d2"></stop><stop data-v-05f1b0f5="" offset="1" stop-color="#38b0e3"></stop></linearGradient></defs><circle data-v-05f1b0f5="" cx="120" cy="120" r="120" fill="url(#a)"></circle><path data-v-05f1b0f5="" d="m81.2 128.8 14.3 39.4s1.7 3.7 3.7 3.7 30.2-29.5 30.2-29.5l31.5-61-79.2 37.2Z" fill="#c8daea"></path><path data-v-05f1b0f5="" d="m100.1 138.9-2.7 29s-1.2 9 7.7 0 17.4-15.7 17.4-15.7" fill="#a9c6d8"></path><path data-v-05f1b0f5="" d="m81.5 130.2-29.3-9.6s-3.5-1.4-2.4-4.6c.3-.7.7-1.2 2.1-2.2C58.4 109.3 172 68.4 172 68.4s3.2-1 5.1-.3a2.8 2.8 0 0 1 2 2 9.4 9.4 0 0 1 .2 2.6l-.2 2.6c-.7 11.1-21.4 94.4-21.4 94.4s-1.2 5-5.7 5a8.1 8.1 0 0 1-5.9-2.2 797.1 797.1 0 0 0-45.5-32.2 1.3 1.3 0 0 1-.5-.9c-.1-.4.4-1 .4-1s52.4-46.6 53.8-51.5c.1-.4-.3-.6-.8-.4C150 87.8 89.6 125.9 83 130a3.2 3.2 0 0 1-1.5 0Z" fill="#fff"></path></svg>\n'}},getUrl:({url:e,text:t})=>`https://t.me/share/url?url=${e}&text=${t}`},ok:{label:"OK",icon:{svgSrc:{baseState:'\n<svg width="50px" height="50px" viewBox="0 0 388.4 387.1" xmlSpace="preserve" xmlns="http://www.w3.org/2000/svg">\n<path d="M331.7 330.2a194.2 193.5 0 0 1-273.9 1.1 194.2 193.5 0 0 1-2.6-272.9A194.2 193.5 0 0 1 329 54.2a194.2 193.5 0 0 1 5.7 273" fill="#faab62" style="mixBlendMode:normal"/>\n<path d="m328.7 327.1a189.2 188.5 0 0 1-266.9 1.2 189.2 188.5 0 0 1-2.5-266 189.2 188.5 0 0 1 266.7-4 189.2 188.5 0 0 1 5.6 265.9" fill="#f7931e" style="mixBlendMode:normal"/>\n<g fill="#fff" style="mixBlendMode:normal">\n<path d="m217.4 253.5c28-5.7 44.7-19 45.6-19.7a19 19 0 0 0-23.8-29.6c-0.2 0.1-18 13.8-47.5 13.8a84.5 84.5 0 0 1-47.8-13.8 19 19 0 0 0-23.8 29.6c1 0.7 18.4 14.3 47.1 19.9l-40 41.9a19 19 0 1 0 27.3 26.3l37.2-39.6 41 39.9a19 19 0 1 0 26.9-26.9z"/>\n<path transform="translate(-1.8 .2)" d="m194.5 57.9a69.9 69.9 0 1 0 0 139.8 69.9 69.9 0 0 0 0-139.8zm0 98.8a28.9 28.9 0 1 1 0-57.8 28.9 28.9 0 0 1 0 57.8z" style="mixBlendMode:normal"/>\n</g>\n</svg>\n'}},getUrl:({url:e,text:t})=>`https://connect.ok.ru/offer?url=${e}&title=${t}`}},copyButton:{label:"Copy link",svgSrc:{baseState:'<svg width="30px" height="30px" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 20"><path d="M6.6 0a2 2 0 0 0-2 2v12c0 1.2.9 2 2 2h9a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2h-9Zm0 2h9v12h-9V2Z" fill="currentColor"/><path d="M2.6 20a2 2 0 0 1-2-2V5h2v13h10v2h-10Z" fill="currentColor"/></svg>',doneState:'<svg width="30px" height="30px" fill="none" viewBox="0 0 386 264" xmlns="http://www.w3.org/2000/svg">\n<path d="m379.05 7.3156c8.855 8.8533 8.855 23.207 0 32.06l-210.67 210.67c-17.707 17.707-46.414 17.707-64.121 0l-97.319-97.319c-8.8531-8.855-8.8531-23.208 0-32.061 8.853-8.853 23.207-8.853 32.06 0l97.319 97.319 210.67-210.67c8.852-8.8531 23.206-8.8531 32.058 0z" clip-rule="evenodd" fill="currentColor" fill-rule="evenodd"/>\n</svg>'}},downloadButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 32 32" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g fill="currentColor"><path d="M31 22a1 1 0 0 0-1 1v7H2v-7a1 1 0 0 0-2 0v8c0 .6.4 1 1 1h30c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z"/><path d="M15.3 23.7c.4.4 1 .4 1.4 0l7-6.9c.4-.4.4-1 0-1.4a1 1 0 0 0-1.4 0L17 20.6V1a1 1 0 0 0-2 0v19.6l-5.3-5.2a1 1 0 0 0-1.4 0 1 1 0 0 0 0 1.4l7 7z"/></g></svg>'}},title:{favicon:{background:"white",display:!0},getValue:({url:e})=>e},background:"#202125",borderRadius:20,divider:{background:"#36373b"},text:{color:"white",font:"inherit"}};var X;!function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(X||(X={}));const ee={gameReaderOptions:{loader:{default:{color:"white",accentColor:"transparent"},custom:null}},scrollStyle:X.FLAT,timelineBlockTopOffset:8,actionPanelBottomOffset:0,borderRadius:12,loader:{default:{color:"white",accentColor:"transparent"},custom:null},recycleStoriesList:!1,closeOnLastSlideByTimer:!0,sharePanel:Z,commonBackdrop:{color:"rgba(51, 51, 51, 1)",backdropFilter:null},slideBackdrop:{opacity:.56,blur:30,linearGradientOverlay:["rgba(0, 0, 0, 0.1) 0%","rgba(0, 0, 0, 0.9) 100%"]},faviconApiUrl:"",navigation:{prevButton:{svgSrc:{baseState:'<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M19.8076 6.80761L9.20101 17.4142L7.7868 16L18.3934 5.3934L19.8076 6.80761Z" fill="currentColor" />\n <path d="M18.3934 26.6066L7.7868 16L9.20101 14.5858L19.8076 25.1924L18.3934 26.6066Z" fill="currentColor" />\n </svg>'}},nextButton:{svgSrc:{baseState:'<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.1924 25.1924L22.799 14.5858L24.2132 16L13.6066 26.6066L12.1924 25.1924Z" fill="currentColor" />\n <path d="M13.6066 5.3934L24.2132 16L22.799 17.4142L12.1924 6.80761L13.6066 5.3934Z" fill="currentColor" />\n </svg>'}}},likeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.96277 15.177L8.11552 15.1837C8.75334 15.1873 9.26846 15.7054 9.26846 16.3433V22.7329C9.26846 23.376 8.74519 23.8962 8.10215 23.8925L6.94939 23.8859C6.31157 23.8822 5.79645 23.3641 5.79645 22.7263V16.3366C5.79645 15.6936 6.31972 15.1733 6.96277 15.177Z" stroke="white" stroke-width="1.21546"/>\n<path d="M11.2546 15.0917L11.3801 23.0645C11.3867 23.4802 11.6013 23.8648 11.9516 24.0886C12.119 24.1955 12.4834 24.2735 12.4834 24.2735L13.1084 24.3569L13.9973 24.4541L15.9789 24.5912L17.4834 24.6365H18.9642L19.282 24.6229C19.7715 24.6018 20.258 24.5358 20.7354 24.4256L21.1038 24.3406C21.3122 24.2925 21.516 24.2263 21.7128 24.1428L21.7439 24.1295C22.0493 23.9999 22.3342 23.8269 22.59 23.6157L22.717 23.5108C22.873 23.382 23.0108 23.2326 23.1265 23.0666L23.1451 23.04C23.2426 22.9003 23.3217 22.7485 23.3804 22.5886L23.428 22.4586C23.5278 22.1867 23.5473 21.8918 23.4842 21.6092L23.4296 21.3645C23.4285 21.3594 23.4265 21.3544 23.4237 21.3499C23.4102 21.3285 23.4163 21.3002 23.4374 21.2862L23.7911 21.0504V21.0504C23.8452 21.0143 23.8957 20.9723 23.9416 20.9263V20.9263C23.99 20.8728 24.0444 20.8083 24.0805 20.7458L24.1361 20.6625C24.2924 20.3945 24.3931 20.0167 24.4083 19.7069L24.4118 19.6352C24.4205 19.458 24.4079 19.2804 24.3744 19.1062L24.3305 18.8986C24.325 18.8696 24.2749 18.7163 24.2611 18.6902L24.1718 18.5154C24.1644 18.5014 24.1898 18.473 24.1898 18.473L24.3653 18.2658C24.4983 18.1109 24.6033 17.9305 24.673 17.7386C24.7222 17.6035 24.7532 17.4657 24.775 17.3153L24.7889 17.1764L24.7957 17.0468C24.8164 16.8366 24.7978 16.6244 24.7409 16.421C24.6929 16.2496 24.6183 16.0868 24.5198 15.9385L24.1983 15.4542C24.1843 15.4367 24.1808 15.413 24.1891 15.3922L24.3081 15.1055C24.3652 14.9628 24.4224 14.6641 24.4391 14.4717L24.4307 14.2984C24.4026 14.0113 24.2405 13.6815 24.0757 13.4238L23.9912 13.3055C23.7236 12.9608 23.3474 12.7334 22.9388 12.5804L22.706 12.4932C22.3923 12.3758 22.0667 12.3327 21.7279 12.2916L21.3444 12.2597C20.89 12.2378 20.2444 12.2651 19.7945 12.3327L18.1092 12.5861C18.1014 12.5873 18.0935 12.5879 18.0857 12.5879H18.0692C17.991 12.5879 17.9276 12.5245 17.9276 12.4462C17.9276 12.4387 17.9282 12.4312 17.9293 12.4238L18.1222 11.3847L18.5408 9.72426C18.6303 9.39087 18.6888 9.04995 18.7158 8.70582L18.7581 8.1657C18.7857 7.81269 18.746 7.45764 18.6411 7.11944L18.6144 7.03332C18.52 6.72899 18.3649 6.44697 18.1583 6.20434L18.1116 6.14941C17.819 5.80563 17.4249 5.56351 16.9859 5.45788L16.7169 5.39313C16.4437 5.32739 16.1567 5.3518 15.8986 5.46269C15.6593 5.56548 15.4564 5.73766 15.316 5.95699L15.2994 5.98302C15.155 6.20866 15.0783 6.47094 15.0783 6.73882V7.10777C15.0783 7.45352 15.0109 7.79596 14.88 8.11598L14.1668 9.85969C13.9176 10.4691 13.6196 11.0573 13.2758 11.6188L12.5778 12.7586C12.4514 12.9651 12.3013 13.1561 12.1306 13.3278L12.0855 13.3731C11.6243 13.837 11.3317 14.442 11.2546 15.0917Z" stroke="white" stroke-width="1.21546"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.96277 15.1771L8.11552 15.1838C8.75334 15.1875 9.26846 15.7056 9.26846 16.3434V22.733C9.26846 23.3761 8.74519 23.8964 8.10215 23.8926L6.94939 23.886C6.31157 23.8823 5.79645 23.3642 5.79645 22.7264V16.3368C5.79645 15.6937 6.31972 15.1734 6.96277 15.1771Z" fill="white" stroke="white" stroke-width="1.21546"/>\n<path d="M11.2546 15.0918L11.3801 23.0646C11.3867 23.4803 11.6013 23.8649 11.9516 24.0888C12.119 24.1957 12.4834 24.2737 12.4834 24.2737L13.1084 24.357L13.9973 24.4542L15.9789 24.5913L17.4834 24.6367H18.9642L19.282 24.623C19.7715 24.6019 20.258 24.5359 20.7354 24.4257L21.1038 24.3407C21.3122 24.2926 21.516 24.2264 21.7128 24.1429L21.7439 24.1297C22.0493 24.0001 22.3342 23.827 22.59 23.6158L22.717 23.5109C22.873 23.3821 23.0108 23.2327 23.1265 23.0668L23.1451 23.0401C23.2426 22.9004 23.3217 22.7487 23.3804 22.5887L23.428 22.4588C23.5278 22.1868 23.5473 21.892 23.4842 21.6093L23.4296 21.3647C23.4285 21.3595 23.4265 21.3545 23.4237 21.3501C23.4102 21.3286 23.4163 21.3004 23.4374 21.2863L23.7911 21.0505V21.0505C23.8452 21.0144 23.8957 20.9724 23.9416 20.9265V20.9265C23.99 20.8729 24.0444 20.8084 24.0805 20.7459L24.1361 20.6626C24.2924 20.3946 24.3931 20.0168 24.4083 19.707L24.4118 19.6353C24.4205 19.4581 24.4079 19.2805 24.3744 19.1063L24.3305 18.8987C24.325 18.8697 24.2749 18.7165 24.2611 18.6904L24.1718 18.5155C24.1644 18.5015 24.1898 18.4732 24.1898 18.4732L24.3653 18.2659C24.4983 18.1111 24.6033 17.9306 24.673 17.7387C24.7222 17.6036 24.7532 17.4658 24.775 17.3154L24.7889 17.1765L24.7957 17.0469C24.8164 16.8367 24.7978 16.6245 24.7409 16.4211C24.6929 16.2497 24.6183 16.0869 24.5198 15.9386L24.1983 15.4543C24.1843 15.4368 24.1808 15.4131 24.1891 15.3923L24.3081 15.1056C24.3652 14.9629 24.4224 14.6642 24.4391 14.4718L24.4307 14.2985C24.4026 14.0114 24.2405 13.6817 24.0757 13.4239L23.9912 13.3056C23.7236 12.9609 23.3474 12.7336 22.9388 12.5805L22.706 12.4934C22.3923 12.3759 22.0667 12.3329 21.7279 12.2918L21.3444 12.2598C20.89 12.2379 20.2444 12.2652 19.7945 12.3329L18.1092 12.5863C18.1014 12.5874 18.0935 12.588 18.0857 12.588H18.0692C17.991 12.588 17.9276 12.5246 17.9276 12.4464C17.9276 12.4389 17.9282 12.4313 17.9293 12.4239L18.1222 11.3849L18.5408 9.72438C18.6303 9.391 18.6888 9.05007 18.7158 8.70594L18.7581 8.16582C18.7857 7.81281 18.746 7.45776 18.6411 7.11956L18.6144 7.03344C18.52 6.72911 18.3649 6.4471 18.1583 6.20446L18.1116 6.14953C17.819 5.80575 17.4249 5.56363 16.9859 5.458L16.7169 5.39325C16.4437 5.32751 16.1567 5.35192 15.8986 5.46281C15.6593 5.5656 15.4564 5.73778 15.316 5.95711L15.2994 5.98314C15.155 6.20878 15.0783 6.47106 15.0783 6.73895V7.10789C15.0783 7.45364 15.0109 7.79608 14.88 8.1161L14.1668 9.85982C13.9176 10.4692 13.6196 11.0574 13.2758 11.6189L12.5778 12.7588C12.4514 12.9652 12.3013 13.1562 12.1306 13.3279L12.0855 13.3732C11.6243 13.8371 11.3317 14.4421 11.2546 15.0918Z" fill="white" stroke="white" stroke-width="1.21546"/>\n</svg>'}},dislikeButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.2033 13.6632C24.2033 14.3062 23.68 14.8265 23.037 14.8228L21.8842 14.8161C21.2464 14.8125 20.7313 14.2944 20.7313 13.6565V7.2669C20.7313 6.62385 21.2546 6.10359 21.8976 6.1073L23.0504 6.11395C23.6882 6.11762 24.2033 6.63572 24.2033 7.27355V13.6632Z" stroke="white" stroke-width="1.21547"/>\n<path d="M18.7451 14.9082L18.6196 6.93531C18.6131 6.51965 18.3984 6.13499 18.0481 5.91118C17.8808 5.80428 17.5164 5.72628 17.5164 5.72628L16.8914 5.64295L16.0025 5.54572L14.0208 5.4086L12.5164 5.36328H11.0356L10.7178 5.37695C10.2283 5.398 9.74173 5.46403 9.26432 5.57421L8.89596 5.65921C8.68758 5.7073 8.4838 5.7735 8.28695 5.85706L8.25581 5.87027C7.95049 5.99987 7.66551 6.17296 7.40975 6.38416L7.28278 6.48901C7.12677 6.61783 6.989 6.76725 6.87323 6.93318L6.85466 6.95981C6.75716 7.09955 6.67809 7.25128 6.6194 7.41124L6.57172 7.54119C6.47196 7.81311 6.45245 8.10797 6.51553 8.39066L6.57011 8.63528C6.57127 8.64045 6.57329 8.64539 6.5761 8.64989C6.58951 8.67134 6.58343 8.69958 6.56238 8.71361L6.20864 8.94944V8.94944C6.15453 8.98551 6.10408 9.0275 6.05811 9.07348V9.07348C6.00973 9.12703 5.95532 9.19155 5.91922 9.25403L5.86366 9.33737C5.70735 9.60533 5.60662 9.98309 5.59145 10.2929L5.58794 10.3646C5.57927 10.5418 5.59182 10.7194 5.62532 10.8937L5.66922 11.1012C5.6748 11.1302 5.72484 11.2835 5.73866 11.3096L5.82792 11.4845C5.83532 11.4984 5.80994 11.5268 5.80994 11.5268L5.63444 11.734C5.50143 11.8889 5.3965 12.0693 5.32674 12.2612C5.27758 12.3964 5.24658 12.5341 5.22478 12.6846L5.21089 12.8235L5.20405 12.953C5.18333 13.1632 5.20192 13.3755 5.25887 13.5788C5.30686 13.7503 5.38145 13.9131 5.47991 14.0614L5.80147 14.5456C5.81547 14.5631 5.81898 14.5868 5.81066 14.6076L5.69163 14.8944C5.63456 15.037 5.57739 15.3357 5.56065 15.5282L5.5691 15.7014C5.5972 15.9885 5.75924 16.3183 5.92402 16.576L6.00853 16.6943C6.2762 17.039 6.65231 17.2664 7.06099 17.4194L7.2938 17.5066C7.60742 17.624 7.93309 17.6671 8.27189 17.7082L8.65531 17.7401C9.10973 17.762 9.75538 17.7347 10.2053 17.6671L11.8906 17.4137C11.8984 17.4125 11.9062 17.4119 11.9141 17.4119H11.9305C12.0088 17.4119 12.0722 17.4753 12.0722 17.5536C12.0722 17.5611 12.0716 17.5686 12.0704 17.576L11.8775 18.6151L11.459 20.2756C11.3695 20.6089 11.3109 20.9499 11.284 21.294L11.2417 21.8341C11.214 22.1871 11.2537 22.5422 11.3586 22.8804L11.3853 22.9665C11.4797 23.2708 11.6349 23.5528 11.8414 23.7955L11.8882 23.8504C12.1808 24.1942 12.5749 24.4363 13.0138 24.5419L13.2829 24.6067C13.556 24.6724 13.8431 24.648 14.1012 24.5371C14.3404 24.4343 14.5434 24.2622 14.6837 24.0428L14.7004 24.0168C14.8448 23.7912 14.9215 23.5289 14.9215 23.261V22.892C14.9215 22.5463 14.9888 22.2039 15.1197 21.8838L15.8329 20.1401C16.0821 19.5308 16.3801 18.9425 16.7239 18.381L17.4219 17.2412C17.5483 17.0347 17.6984 16.8437 17.8691 16.6721L17.9142 16.6267C18.3755 16.1629 18.668 15.5578 18.7451 14.9082Z" stroke="white" stroke-width="1.21547"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M24.2035 13.6629C24.2035 14.3059 23.6803 14.8262 23.0372 14.8225L21.8845 14.8158C21.2466 14.8122 20.7315 14.2941 20.7315 13.6562V7.26655C20.7315 6.62348 21.2548 6.10322 21.8978 6.10693L23.0506 6.11358C23.6884 6.11725 24.2035 6.63535 24.2035 7.27319V13.6629Z" fill="white" stroke="white" stroke-width="1.21547"/>\n<path d="M18.7454 14.9079L18.6199 6.93496C18.6133 6.51929 18.3987 6.13463 18.0484 5.91082C17.881 5.80392 17.5166 5.72592 17.5166 5.72592L16.8916 5.64258L16.0027 5.54536L14.021 5.40824L12.5166 5.36292H11.0358L10.718 5.37659C10.2285 5.39764 9.74192 5.46367 9.26451 5.57384L8.89614 5.65885C8.68776 5.70694 8.48398 5.77314 8.28713 5.8567L8.25599 5.86991C7.95066 5.99951 7.66569 6.1726 7.40992 6.3838L7.28295 6.48865C7.12694 6.61747 6.98917 6.7669 6.8734 6.93283L6.85483 6.95946C6.75733 7.0992 6.67826 7.25093 6.61957 7.41088L6.57189 7.54084C6.47212 7.81276 6.45262 8.10762 6.5157 8.39032L6.57028 8.63494C6.57143 8.64011 6.57346 8.64505 6.57627 8.64954C6.58968 8.671 6.5836 8.69923 6.56255 8.71327L6.2088 8.9491C6.1547 8.98517 6.10425 9.02716 6.05827 9.07314C6.0099 9.12669 5.95549 9.19121 5.91938 9.25369L5.86383 9.33703C5.70751 9.60499 5.60678 9.98276 5.59161 10.2926L5.58811 10.3643C5.57943 10.5415 5.59198 10.7191 5.62549 10.8933L5.66938 11.1009C5.67496 11.1299 5.72501 11.2831 5.73883 11.3092L5.82808 11.4841C5.83549 11.4981 5.8101 11.5264 5.8101 11.5264L5.63461 11.7337C5.50159 11.8886 5.39666 12.069 5.3269 12.2609C5.27775 12.396 5.24674 12.5338 5.22494 12.6842L5.21105 12.8231L5.20421 12.9527C5.18349 13.1629 5.20208 13.3751 5.25903 13.5785C5.30702 13.7499 5.38161 13.9128 5.48007 14.061L5.80163 14.5453C5.81564 14.5628 5.81915 14.5865 5.81082 14.6073L5.69179 14.894C5.63472 15.0367 5.57755 15.3354 5.56081 15.5279L5.56926 15.7011C5.59737 15.9882 5.7594 16.318 5.92419 16.5757L6.0087 16.694C6.27636 17.0387 6.65248 17.2661 7.06116 17.4191L7.29397 17.5063C7.6076 17.6237 7.93327 17.6668 8.27207 17.7079L8.65549 17.7398C9.10991 17.7617 9.75557 17.7344 10.2055 17.6668L11.8908 17.4134C11.8986 17.4122 11.9064 17.4116 11.9143 17.4116H11.9307C12.009 17.4116 12.0724 17.4751 12.0724 17.5533C12.0724 17.5608 12.0718 17.5683 12.0706 17.5757L11.8777 18.6148L11.4592 20.2753C11.3697 20.6087 11.3111 20.9496 11.2842 21.2937L11.2419 21.8339C11.2142 22.1869 11.2539 22.5419 11.3588 22.8801L11.3855 22.9662C11.4799 23.2706 11.6351 23.5526 11.8416 23.7952L11.8884 23.8502C12.181 24.1939 12.5751 24.4361 13.014 24.5417L13.2831 24.6064C13.5562 24.6722 13.8433 24.6478 14.1014 24.5369C14.3407 24.4341 14.5436 24.2619 14.6839 24.0426L14.7006 24.0166C14.845 23.7909 14.9217 23.5286 14.9217 23.2607V22.8918C14.9217 22.546 14.989 22.2036 15.1199 21.8836L15.8331 20.1399C16.0824 19.5305 16.3803 18.9422 16.7241 18.3808L17.4221 17.2409C17.5486 17.0344 17.6987 16.8434 17.8694 16.6718L17.9144 16.6264C18.3757 16.1626 18.6683 15.5575 18.7454 14.9079Z" fill="white" stroke="white" stroke-width="1.21547"/>\n</svg>'}},favoriteButton:{svgSrc:{baseState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49976 7.25225V23.2366C7.49976 24.6882 9.33429 25.321 10.2292 24.1782L13.7974 19.6218C14.4088 18.8411 15.5907 18.8411 16.2021 19.6218L19.7703 24.1782C20.6652 25.321 22.4998 24.6882 22.4998 23.2366V7.25225C22.4998 5.98711 21.4742 4.96152 20.209 4.96152H9.79048C8.52535 4.96152 7.49976 5.98712 7.49976 7.25225Z" stroke="white" stroke-width="1.29808"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.49976 7.04073V23.0251C7.49976 24.4767 9.33429 25.1095 10.2292 23.9667L13.7974 19.4103C14.4088 18.6296 15.5907 18.6296 16.2021 19.4103L19.7703 23.9667C20.6652 25.1095 22.4998 24.4766 22.4998 23.0251V7.04072C22.4998 5.77559 21.4742 4.75 20.209 4.75H9.79048C8.52535 4.75 7.49976 5.77559 7.49976 7.04073Z" fill="white" stroke="white" stroke-width="1.29808"/>\n</svg>'}},muteButton:{svgSrc:{baseState:'<svg width="30" height="31" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.40625 13.5734V18.7664C3.40625 19.7239 4.18245 20.5001 5.13993 20.5001H8.04633C8.6342 20.5001 9.17511 20.8213 9.45654 21.3374L11.903 25.8242C12.271 26.4992 12.9783 26.9192 13.7471 26.9192C14.9072 26.9192 15.8477 25.9788 15.8477 24.8187V7.52486C15.8477 6.36469 14.9072 5.42416 13.747 5.42412C12.9783 5.42409 12.2709 5.84393 11.9028 6.51875L9.45651 11.0026C9.17509 11.5184 8.63442 11.8394 8.04683 11.8394H5.14027C4.1826 11.8394 3.40625 12.6157 3.40625 13.5734Z" fill="white"/>\n<path d="M19.8477 13.0466L26.0976 19.2966M26.0976 13.0466L19.8477 19.2966" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>',activeState:'<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M3.40625 12.5733V17.7663C3.40625 18.7238 4.18245 19.5 5.13993 19.5H8.04633C8.6342 19.5 9.17511 19.8212 9.45654 20.3373L11.903 24.8241C12.271 25.4991 12.9783 25.919 13.7471 25.9191C14.9072 25.9191 15.8477 24.9787 15.8477 23.8186V6.52474C15.8477 5.36457 14.9072 4.42404 13.747 4.424C12.9783 4.42397 12.2709 4.84381 11.9028 5.51863L9.45651 10.0025C9.17509 10.5183 8.63442 10.8392 8.04683 10.8392H5.14027C4.1826 10.8392 3.40625 11.6156 3.40625 12.5733Z" fill="white"/>\n<path d="M19.8477 11.4215C20.6323 12.4661 21.0972 13.7645 21.0972 15.1715C21.0972 16.5785 20.6323 17.8769 19.8477 18.9215M22.3472 6.78613C24.6487 8.84608 26.0972 11.8396 26.0972 15.1715C26.0972 18.5034 24.6487 21.4969 22.3472 23.5569" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'}},shareButton:{svgSrc:{baseState:'<svg width="30" height="31" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M19.5 10.9038C20.8488 10.9038 21.9423 9.81036 21.9423 8.46151C21.9423 7.11266 20.8488 6.01921 19.5 6.01921C18.1512 6.01921 17.0577 7.11266 17.0577 8.46151C17.0577 9.81036 18.1512 10.9038 19.5 10.9038ZM19.5 12.2115C21.5711 12.2115 23.25 10.5326 23.25 8.46151C23.25 6.39045 21.5711 4.71151 19.5 4.71151C17.4289 4.71151 15.75 6.39045 15.75 8.46151C15.75 8.98692 15.8581 9.48709 16.0531 9.94101L12.288 12.4511C11.6202 11.8367 10.7288 11.4615 9.74976 11.4615C7.67869 11.4615 5.99976 13.1404 5.99976 15.2115C5.99976 17.2826 7.67869 18.9615 9.74976 18.9615C10.7325 18.9615 11.6269 18.5835 12.2956 17.9649L16.018 20.5665C15.8451 20.9977 15.75 21.4685 15.75 21.9615C15.75 24.0326 17.4289 25.7115 19.5 25.7115C21.5711 25.7115 23.25 24.0326 23.25 21.9615C23.25 19.8904 21.5711 18.2115 19.5 18.2115C18.3369 18.2115 17.2974 18.7411 16.6096 19.5722L13.0138 17.0591C13.3231 16.5138 13.4998 15.8833 13.4998 15.2115C13.4998 14.5368 13.3216 13.9037 13.0097 13.3567L16.667 10.9185C17.3545 11.7106 18.3688 12.2115 19.5 12.2115ZM12.1921 15.2115C12.1921 16.5604 11.0986 17.6538 9.74976 17.6538C8.40091 17.6538 7.30745 16.5604 7.30745 15.2115C7.30745 13.8627 8.40091 12.7692 9.74976 12.7692C11.0986 12.7692 12.1921 13.8627 12.1921 15.2115ZM21.9423 21.9615C21.9423 23.3104 20.8488 24.4038 19.5 24.4038C18.1512 24.4038 17.0577 23.3104 17.0577 21.9615C17.0577 20.6127 18.1512 19.5192 19.5 19.5192C20.8488 19.5192 21.9423 20.6127 21.9423 21.9615Z" fill="white"/>\n</svg>'}}};var te;!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"}(te||(te={}));const re={};var ie,ae,se,ne,oe,le;!function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(ie||(ie={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite",e[e.stacked=2]="stacked"}(ae||(ae={})),function(e){e[e.default=0]="default",e[e.onboarding=1]="onboarding",e[e.favorite=2]="favorite",e[e.direct=3]="direct"}(se||(se={})),function(e){e.list="list",e.favorite="favorite"}(ne||(ne={})),function(e){e.CLICK_ON_STORY="clickOnStoryLink"}(oe||(oe={})),function(e){e.LTR="ltr",e.RTL="rtl"}(le||(le={}));const de=(e=>{var t={};return A.d(t,e),t})({default:()=>t.default});class ce extends L.EventEmitter{}class ue extends Error{constructor(e){super(`[IAS]: Timeout waiting for ViewModel with ID "${e}". You must mount <IASContainer>.`),this.name="IasViewModelTimeoutError"}}class he extends Error{constructor(e){super(`[IAS]: ViewModel with ID "${e}" was deleted before resolving.`),this.name="IasViewModelRejectError"}}class pe{constructor(){Object.defineProperty(this,"viewModels",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"viewModelWaiters",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}set(e,t){this.viewModels.set(e,t),this.resolveWaiters(e,t)}get(e){return this.viewModels.get(e)}async wait(e,t=5e3){const r=this.viewModels.get(e);if(r)return r;if(this.viewModelWaiters.has(e))return this.viewModelWaiters.get(e).promise;let i,a;const s=new Promise(((e,t)=>{i=e,a=t})),n=setTimeout((()=>{this.viewModelWaiters.delete(e),a(new ue(e))}),t);return this.viewModelWaiters.set(e,{resolve:i,reject:a,timerId:n,promise:s}),s}getAll(){return Array.from(this.viewModels.values())}getAllOfType(e){return Array.from(this.viewModels.values()).filter(e)}has(e){return this.viewModels.has(e)}delete(e){this.viewModels.has(e)&&(this.rejectWaiters(e),this.viewModels.delete(e))}resolveWaiters(e,t){const r=this.viewModelWaiters.get(e);r&&(clearTimeout(r.timerId),r.resolve(t),this.viewModelWaiters.delete(e))}rejectWaiters(e){const t=this.viewModelWaiters.get(e);t&&(clearTimeout(t.timerId),t.reject(new he(e)),this.viewModelWaiters.delete(e))}}const ge=(e=>{var t={};return A.d(t,e),t})({v4:()=>r.v4});function fe(e){return e.replace(/^\//,"")}function me(e,t,r){t instanceof Object&&Object.keys(t).forEach((i=>{const a=t[i];if(a instanceof Object&&!Array.isArray(a))return me(e,a,i);r&&(i=`${r}[${i}]`),Array.isArray(a)?a.forEach((t=>{e.append(`${i}[]`,t)})):e.append(i,a)}))}class ve extends Error{constructor(e,t,r){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"networkStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"networkMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="IasNetworkError",this.networkStatus=e,this.networkMessage=t,this.response=null!=r?r:null,console.error({name:this.name,networkStatus:e,networkMessage:t,response:r})}static createByRequestError(e){return new ve(null,JSON.stringify(e.data),e)}static createByFetchError(e){const t=window.navigator&&window.navigator.onLine;return new ve(null,t?e.message:"net::ERR_INTERNET_DISCONNECTED")}}const be={baseUrl:"https://cdn.inappstory.ru",apiUrl:"https://api.inappstory.ru",faviconApiUrl:"https://favicon.inappstory.ru"};function ye(e){if(e.length>32)try{const t=function(e){const t=(e=e.replace(new RegExp("-","g"),"+").replace(new RegExp("_","g"),"/")).length;return e=function(e,t,r){return void 0===t?e:t.length>=e.length?t:r?(e+t).slice(-e.length):(t+e).substring(0,e.length)}(new Array(t%4).fill("=").join(""),e,!1),window.atob(e)}(e),r=t.charCodeAt(13);if(r>0){let e=t.substr(14,r);e=e.replace(/\0+$/,"");const i="{QQN{xuV?1Dv16j3";let a=i,s=0;for(;a.length<r;)a+=i[s],s++,s===i.length&&(s=0);let n="";for(let t=0;t<r;t++)n+=String.fromCharCode(e.charCodeAt(t)^a.charCodeAt(t));return new URL(`https://${n}`).host}}catch(e){console.error(e)}return null}const we=(e=>{var t={};return A.d(t,e),t})({default:()=>i.default});const Se=(e=>{var t={};return A.d(t,e),t})({default:()=>a.default});const _e=`InAppStoryWebSDK/${parseInt(30405)} ${(e=>{let t="";for(let r=0;r<e.length;r++){t+=e.charCodeAt(r)<=255?e[r]:"?"}return t})(navigator.userAgent)}`;function Oe(e,t){return Object.assign(Object.assign({},e),t)}const Ce=new class{constructor(){Object.defineProperty(this,"_deviceInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_baseHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"requestInterceptors",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"interceptors",{enumerable:!0,configurable:!0,writable:!0,value:{request:{use:e=>{this.requestInterceptors.push(e)}}}})}set deviceInfoPromise(e){this._deviceInfoPromise=e}set baseHeaders(e){this._baseHeaders=e}get baseURL(){return`${be.apiUrl}/v2/`}async request(e){return new Promise(((t,r)=>{const i=async()=>{try{if((0,we.default)(e.headers)&&null!=e.headers||(e.headers={}),e.headers=Oe(this._baseHeaders,e.headers),this.requestInterceptors.length)for(const t of this.requestInterceptors)t(e);let i="";!(0,Se.default)(e.params)&&(0,we.default)(e.params)&&(i=new URLSearchParams(Object.entries(e.params).filter((([e,t])=>null!=t&&""!=t))).toString());let a=new URL(`${fe(e.url)}${i?"?"+i:""}`,this.baseURL),s="get";(0,Se.default)(e.method)||(s=e.method);let n={};!(0,Se.default)(e.headers)&&(0,we.default)(e.headers)&&(n=e.headers);let o=null;!(0,Se.default)(e.data)&&(0,we.default)(e.data)&&(o=JSON.stringify(e.data),n["Content-Type"]="application/json");const l=await fetch(a.toString(),{method:s,body:o,headers:n,credentials:"omit"});let d={};204!==l.status&&(d=await l.json());const c={data:d,headersRaw:l.headers,headers:Object.fromEntries([...l.headers]),status:l.status,statusText:l.statusText,ok:l.ok};if(!l.ok)return void r(ve.createByRequestError(c));t(c)}catch(e){r(ve.createByFetchError(e))}};this._deviceInfoPromise?this._deviceInfoPromise.finally(i):i()}))}async post(e,t,r={}){return this.request({method:"post",url:e,data:t,params:r})}async get(e,t={}){return this.request({method:"get",url:e,params:t})}};function xe(e,t,r){if("sendBeacon"in navigator){const a=Ql.rootStore.sessionStore.session,s=new URLSearchParams({access_token:Ql.getConfig().apiKey,session_id:(null==a?void 0:a.id)||"",x_user_agent:_e}),n=Ql.getConfig();null!=n.appPackageId&&s.append("x_app_package_id",n.appPackageId);const o=`${i=Ce.baseURL,i.replace(/\/$/,"")}/${fe(e)}?${s.toString()}`,l=new FormData;Object.keys(t).forEach((e=>{me(l,t[e],e)}));let d=!1;null!=Array.from&&null!=l.keys&&(d=0===Array.from(l.keys()).length),d||navigator.sendBeacon(o,l),r()}else Ce.post(e,t).then((()=>r()),(()=>r()));var i}Ce.interceptors.request.use((e=>{var t;const r=Ql.getConfig(),i=Ql.rootStore.sessionStore.session;return e.headers=Oe(null!==(t=e.headers)&&void 0!==t?t:{},{Authorization:`Bearer ${r.apiKey}`,"Accept-Language":r.lang.toString(),"Auth-Session-Id":null==i?void 0:i.id,"X-User-Id":r.userId||"","X-Request-Id":(0,ge.v4)(),"X-User-Agent":_e}),null!=r.appPackageId&&(e.headers["X-App-Package-Id"]=r.appPackageId),r.disableDeviceId||(e.headers["X-Device-Id"]=null==i?void 0:i.deviceId),e}));const ke=Ce;function Pe(e){return"string"==typeof e&&(!isNaN(Number(e))&&!isNaN(parseFloat(e)))}let je;je=function(){};const Me=(e=>{var t={};return A.d(t,e),t})({Reaction:()=>s.Reaction,action:()=>s.action,computed:()=>s.computed,configure:()=>s.configure,observable:()=>s.observable,reaction:()=>s.reaction,remove:()=>s.remove});function Ee(e){return class extends e{constructor(...e){super(...e),Object.defineProperty(this,"_mobxReaction",{enumerable:!0,configurable:!0,writable:!0,value:null})}update(e){this._mobxReaction?this._mobxReaction.track((()=>{super.update(e)})):super.update(e)}connectedCallback(){super.connectedCallback(),this._mobxReaction||(this._mobxReaction=new Me.Reaction(`${this.constructor.name||this.nodeName}.update()`,(()=>this.requestUpdate()))),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._mobxReaction)||void 0===e||e.dispose(),this._mobxReaction=null}}}function Ie(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)}}function Le(e,t){let r=null,i=null;return async function(...t){const a=JSON.stringify(t);if(r===a)return i;try{return i=await e.apply(this,t),r=a,i}catch(e){throw i=null,r=null,e}}}const Te=/[\r\n%#()<>?[\\\]^`{|}]/g;function Ae(e,t="double"){return(e=(e=(e="double"===t?e.replace(/"/g,"'"):e.replace(/'/g,'"')).replace(/>\s{1,}</g,"><")).replace(/\s{2,}/g," ")).replace(Te,encodeURIComponent)}const Re=e=>{const t=/^[\p{L}_\d][\p{L}_\d\-]{0,49}$/u;return e.filter((e=>{const r=t.test(e);return r||console.error(`[IAS]: The tag <${e}> does not match the regular expression <${t.toString()}>`),r}))},De=e=>{const t=document.createElement("input");t.setAttribute("type","text"),t.style.position="absolute",t.style.opacity="0.1001",t.style.height="0",t.style.fontSize="16px",t.readOnly=!0,document.body.prepend(t),t.focus();return setTimeout((()=>{e.focus(),t.remove()}),300)},Be=()=>null!==A.nc&&void 0!==A.nc?A.nc:"",Fe=!!(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}}),r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch(e){}return e})()&&{passive:!0};const Ne=(e=>{var t={};return A.d(t,e),t})({default:()=>n.default});const Ue=function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}();function We(e){let t=null;if(Ue){let r=window.localStorage.getItem(e);null!==r&&(0,Ne.default)(r)&&r.trim().length>0&&(t=JSON.parse(r))}return t}function ze(e,t){Ue&&window.localStorage.setItem(e,JSON.stringify(t))}function Ve(e){let t=window.isSecureContext;return void 0===t&&"https:"===window.location.protocol&&(t=!0),t?e:e.replace(/^https:\/\//,"http://")}function Ge(e){return e.map((e=>function(e){var t,r,i;if(!e.url)return null;let a={"font-family":null!==(t=e.family)&&void 0!==t?t:"normal",src:`url('${Ve(String(e.url))}')`,"font-style":null!==(r=e.style)&&void 0!==r?r:"normal","font-weight":null!==(i=e.weight)&&void 0!==i?i:"normal"};e.title&&(a.src+=`, local('${e.title}')`);return`@font-face {${s=a,Object.keys(s).reduce(((e,t)=>e+t.split(/(?=[A-Z])/).join("-").toLowerCase()+":"+s[t]+";"),"")}}\n`;var s}(e))).filter(Boolean).join("")}function $e(e){"fonts"in document?e.forEach((e=>{const t=new FontFace(e.family,`url(${e.url})`,{style:e.style,weight:e.weight,display:"block"});document.fonts.add&&document.fonts.add(t),t.load()})):function(e){const t=Ge(e);if(null!=t){const e="stories-font-style";let r=document.getElementById(e);null===r?(r=document.createElement("style"),r.type="text/css",r.id=e,r.attributes.setNamedItem(document.createAttribute("scoped")),r.setAttribute("nonce",Be()),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t)),document.body.appendChild(r)):r.styleSheet?r.styleSheet.cssText=t:(r.textContent="",r.appendChild(document.createTextNode(t)))}}(e)}let He=null;async function qe(){return null!=He?He:new Promise((e=>{!function(e,t){const r=new Image;r.onload=function(){var i=r.width>0&&r.height>0;t(e,i)},r.onerror=function(){t(e,!1)},r.src="data:image/webp;base64,"+{lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"}[e]}("lossy",((t,r)=>{He=r,e(r)}))}))}function Qe(){if(window){var e,t=window.screen;return e="function"==typeof window.ScreenOrientation&&t.orientation instanceof ScreenOrientation&&"function"==typeof t.orientation.addEventListener&&null===t.orientation.onchange&&"string"==typeof t.orientation.type?t.orientation:function(){var e={90:Ke.LANDSCAPE_PRIMARY,"-90":Ke.LANDSCAPE_SECONDARY,0:Ke.PORTRAIT_PRIMARY,180:Ke.PORTRAIT_SECONDARY};function t(){}var r=new t,i=function(e){for(var t=["orientationchange","mozorientationchange","msorientationchange"],r=window.screen,i=0;i<t.length;i++)if(null===r["on"+t[i]])return{delegate:r,event:t[i]};if(void 0!==window.onorientationchange)return{delegate:window,event:"orientationchange"};return{delegate:tt(e),event:"change"}}(r);return t.prototype.addEventListener=Ye("addEventListener",i.delegate,i.event),t.prototype.dispatchEvent=Ye("dispatchEvent",i.delegate,i.event),t.prototype.removeEventListener=Ye("removeEventListener",i.delegate,i.event),t.prototype.lock=function(){var e,t="lockOrientation() is not available on this device.",r=window.screen;e=void 0===r?function(){return!1}:"function"==typeof r.msLockOrientation?r.msLockOrientation.bind(r):"function"==typeof r.mozLockOrientation?r.mozLockOrientation.bind(r):function(){return!1};return function(r){const i=window.Promise;return e(r)?i.resolve(r):i.reject(new Error(t))}}(),t.prototype.unlock=function(){var e=window.screen;return e&&e.orientation&&e.orientation.unlock.bind(e.orientation)||e.msUnlockOrientation&&e.msUnlockOrientation.bind(e)||e.mozUnlockOrientation&&e.mozUnlockOrientation.bind(e)||function(){}}(),Object.defineProperties(r,{onchange:{get:function(){return i.delegate["on"+i.event]||null},set:function(e){i.delegate["on"+i.event]=Xe(e,r)}},type:{get:function(){var t=window.screen;return t.msOrientation||t.mozOrientation||e[window.orientation+""]||(rt().matches?"landscape-primary":"portrait-primary")}},angle:{value:0}}),r}(),e}}var Ke;function Ye(e,t,r){var i=this;return function(){var a=Array.prototype.slice.call(arguments);if("change"===(a[0].type?a[0].type:a[0])){a[0].type?a[0]=et(r,a[0]):a[0]=r;var s,n,o=Xe(a[1],i);return"addEventListener"===e&&function(e,t){var r=Ze.indexOf(e);r>-1?Je[r]=t:(Ze.push(e),Je.push(t))}(a[1],o),"removeEventListener"===e&&(s=a[1],(n=Ze.indexOf(s))>-1&&(Ze.splice(n,1),Je.splice(n,1))),a[1]=o,t[e].apply(t,a)}}}!function(e){e.LANDSCAPE_PRIMARY="landscape-primary",e.LANDSCAPE_SECONDARY="landscape-secondary",e.PORTRAIT_PRIMARY="portrait-primary",e.PORTRAIT_SECONDARY="portrait-secondary"}(Ke||(Ke={}));var Je=[],Ze=[];function Xe(e,t){var r=Ze.indexOf(e);return r>-1?Je[r]:function(r){r.target!==t&&it(r,"target",t),r.currentTarget!==t&&it(r,"currentTarget",t),"change"!==r.type&&it(r,"type","change"),e(r)}}function et(e,t){var r;try{r=new Event(e,t)}catch(e){r={type:"change"}}return r}function tt(e){var t=Object.create({addEventListener:function(e,t){this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)},dispatchEvent:function(t){this.listeners[t.type]&&(this.listeners[t.type].forEach((function(e){e(t)})),"function"==typeof e.onchange&&e.onchange(t))},removeEventListener:function(e,t){if(this.listeners[e]){var r=this.listeners[e].indexOf(t);r>-1&&this.listeners[e].splice(r,1)}}});t.listeners={};var r=rt();return r&&"boolean"==typeof r.matches&&r.addListener((function(){t.dispatchEvent(et("change"))})),t}function rt(){return"function"!=typeof window.matchMedia?{}:window.matchMedia("(orientation: landscape)")}function it(e,t,r){Object.defineProperty(e,t,{value:r})}function at(e,t,r){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>r))}class st extends Error{constructor(e){super(`[IAM]: not found IAM for ID <${e}>`),this.name="IamNotFoundByIdError"}}class nt extends Error{constructor(e){super(`[IAM]: not found IAM limit for ID <${e}>`),this.name="IamNotFoundLimitError"}}var ot=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},lt=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};const dt="campaign_name,id,events,appearance,slides_html,type,frequency_limit,display_to,display_from,need_placeholders,has_limit",ct=dt.split(",").map((e=>`messages.${e}`)).join(",");let ut=(()=>{var e;let t,r,i,a=[];return e=class{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(ot(this,a),e)})}async fetchAll({tags:e}){return(await ke.get("inappmessaging",{fields:ct,tag:e.join(",")})).data.messages}async fetchContext(){return(await ke.get("inappmessaging/message-context",{fields:"style,widgetsData"})).data}async fetchById(e){const t=(await ke.get(`inappmessaging/message/${e}`,{expand:"slides_html",fields:dt})).data;if(!t)throw new st(e);return t}async emitMessageEvent(e,t){try{if(this.storyManager.isStatisticsDisabled)return void console.log(`[IAM]: message <${t.type.toUpperCase()}> event`,{messageId:e,messageEvent:t,type:t.type});await ke.post(`/inappmessaging/message/${e}/event/${t.type}`,t.toQueryParams())}catch(e){console.error(e)}}async fetchUserData(e){try{return(await ke.get(`/inappmessaging/message/${e}/data`)).data.data}catch(e){console.error(e)}}async updateUserData(e,t){try{if(this.storyManager.isStatisticsDisabled)return void console.log("[IAM]: update user data",{messageId:e,payload:t});await ke.request({url:`/inappmessaging/message/${e}/data`,method:"put",data:{data:t}})}catch(e){console.error(e)}}async checkMesageLimit(e){if(this.storyManager.isStatisticsDisabled)return{canOpen:!0};const t=(await ke.post("inappmessaging/message-limit",{id:[e]})).data.find((t=>t.messageId.toString()===e.toString()));if(!t)throw new nt(e);return t}},(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Ie],r=[Ie],i=[Ie],lt(e,null,t,{kind:"method",name:"fetchAll",static:!1,private:!1,access:{has:e=>"fetchAll"in e,get:e=>e.fetchAll},metadata:s},null,a),lt(e,null,r,{kind:"method",name:"fetchContext",static:!1,private:!1,access:{has:e=>"fetchContext"in e,get:e=>e.fetchContext},metadata:s},null,a),lt(e,null,i,{kind:"method",name:"fetchById",static:!1,private:!1,access:{has:e=>"fetchById"in e,get:e=>e.fetchById},metadata:s},null,a),s&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})})(),e})();class ht{constructor(){Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:""})}}class pt extends ht{constructor(e){var t,r,i,a,s,n,o,l,d,c,u;super(),Object.defineProperty(this,"contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"borderRadius",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backdrop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.backgroundColor=null!==(t=e.background_color)&&void 0!==t?t:"#FFFFFFFF",this.borderRadius=null!==(r=e.corner_radius)&&void 0!==r?r:16,this.contentRatio=e.content_ratio||.64,this.backdrop={opacity:null!==(i=e.backdrop_alpha)&&void 0!==i?i:.3},this.closeButton={marginTop:null!==(s=null===(a=e.close_button)||void 0===a?void 0:a.top_margin)&&void 0!==s?s:8,width:null!==(o=null===(n=e.close_button)||void 0===n?void 0:n.width)&&void 0!==o?o:32,height:null!==(d=null===(l=e.close_button)||void 0===l?void 0:l.height)&&void 0!==d?d:4,backgroundColor:null!==(u=null===(c=e.close_button)||void 0===c?void 0:c.color)&&void 0!==u?u:"#00000080"}}}var gt,ft;!function(e){e[e.None=0]="None",e[e.SlideInUp=1]="SlideInUp",e[e.FadeIn=2]="FadeIn"}(gt||(gt={})),function(e){e[e.None=0]="None",e[e.Start=1]="Start",e[e.End=2]="End"}(ft||(ft={}));class mt extends ht{constructor(e){var t,r,i,a,s,n;super(),Object.defineProperty(this,"contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"borderRadius",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"animationType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backdrop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeBtnPosition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"horizontalPadding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.borderRadius=null!==(t=e.corner_radius)&&void 0!==t?t:16,this.contentRatio=e.content_ratio||.64,this.animationType=null!==(r=e.animation_type)&&void 0!==r?r:gt.None,this.backdrop={opacity:null!==(i=e.backdrop_alpha)&&void 0!==i?i:.3},this.backgroundColor=null!==(a=e.background_color)&&void 0!==a?a:"#FFFFFFFF",this.closeBtnPosition=null!==(s=e.close_button_position)&&void 0!==s?s:ft.End,this.horizontalPadding=null!==(n=e.horizontal_padding)&&void 0!==n?n:16}}class vt extends ht{constructor(e){var t,r,i;super(),Object.defineProperty(this,"animationType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeBtnPosition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.animationType=null!==(t=e.animation_type)&&void 0!==t?t:gt.None,this.backgroundColor=null!==(r=e.background_color)&&void 0!==r?r:"#FFFFFFFF",this.closeBtnPosition=null!==(i=e.close_button_position)&&void 0!==i?i:ft.End}}class bt{create(e,t){switch(e){case ii.BottomSheet:return new pt(t);case ii.Modal:return new mt(t);case ii.Fullscreen:return new vt(t)}}}var yt=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},wt=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},St=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},_t=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Ot=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _html(){return St(this,t,"f")}set _html(e){_t(this,t,e,"f")}constructor(e){Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:(yt(this,a),e)}),t.set(this,yt(this,s,"")),yt(this,n),this.message=e}get html(){return this._html}updateByDto(e){this._html=this.getSlideHtml(e)}getSlideHtml(e){var t;let r=e;return r=at(r,"{{nonce}}",null!==(t=Be())&&void 0!==t?t:""),r}updatePlaceholders(e){let t=this._html;for(const r of e)t=at(t,`%${r.key}%`,r.value);this._html=t}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],i=[Me.computed],wt(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},s,n),wt(e,null,i,{kind:"getter",name:"html",static:!1,private:!1,access:{has:e=>"html"in e,get:e=>e.html},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Ct{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async open(){const[e,t]=await Promise.all([this.getDeviceData(),qe()]),r=this.completeDeviceData(e,t),i=await ke.post("session/open",null!=r?r:{},{expand:"cache,storyWidgetsResources",fields:"session,server_timestamp,user_key,share,preview_aspect_ratio,placeholders,image_placeholders,is_allow_ugc"});return i.data.deviceId=e.device_id,i.data}async sendStatisticData(e){return new Promise((t=>{xe("session/update",e,t)}))}completeDeviceData(e,t){"iOS"===e.os_name?window.isIos=!0:"Android"===e.os_name&&(window.Android=!0);const r=this.storyManager.getConfig();return r&&r.userId&&(e.user_id=r.userId,e.user_sign=r.userIdSign),e.features="animation,data,deeplink,placeholder,resetTimers,gameReader,sendApi,swipeUpItems,imgPlaceholder,vod,closeStoryApi",t&&(e.features+=",webp"),e}async getDeviceData(){return new Promise(((e,t)=>{let r=We("device_data"),i=null;if(null!==r&&(i=r.device_id),null!==r&&i&&(0,Ne.default)(i)&&36===i.trim().length)e(r);else{const t={platform:"web",device_id:(0,ge.v4)()};ze("device_data",t),e(t)}}))}}var xt;!function(e){e.TEXT="text",e.IMAGE="image"}(xt||(xt={}));class kt{constructor(e,t,r,i){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"priority",{enumerable:!0,configurable:!0,writable:!0,value:i})}}class Pt extends kt{constructor(e,t){super(xt.IMAGE,e,t,0)}}class jt extends kt{constructor(e,t){super(xt.TEXT,e,t,2)}}class Mt extends kt{constructor(e,t){super(xt.IMAGE,e,t,1)}}class Et extends kt{constructor(e,t){super(xt.TEXT,e,t,3)}}const It="default";class Lt{get textPlaceholders(){return this._textPlaceholders}get imagePlaceholders(){return this._imagePlaceholders}get fontsResources(){return this.resources.filter((e=>"font-face"===e.type))}constructor(e,t){Object.defineProperty(this,"sessionStore",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_textPlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_imagePlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"expireIn",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"share",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"previewAspectRatio",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"resources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=t.session.id,this.expireIn=t.session.expire_in,this.userKey=t.user_key||It,this.previewAspectRatio=t.preview_aspect_ratio,this.share=t.share,this.resources=this.getResources(t),this._textPlaceholders=this.mapTextPlaceholders(t.placeholders),this._imagePlaceholders=this.mapImagePlaceholders(t.image_placeholders),this.deviceId=t.deviceId}loadResources(){$e(this.fontsResources)}getResources(e){return e.cache&&Array.isArray(e.cache)?e.cache:[]}mapTextPlaceholders(e){return e.map((e=>new jt(e.name,e.default_value)))}mapImagePlaceholders(e){return e.map((e=>new Pt(e.name,e.default_value)))}}class Tt extends Error{constructor(e){super(`Story with ID ${e} has already been shown to the user`),this.name="IasStoryAlreadyShownError"}}class At extends Error{constructor(e){super(`Like undefined on story with ID ${e}`),this.name="IasLikeUndefinedError"}}class Rt extends Error{constructor(e){super(`Share url undefined on story with ID ${e}`),this.name="IasShareUrlUndefinedError"}}var Dt,Bt=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ft=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Nt=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ut=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.UGC=1]="UGC",e[e.FAVORITE=2]="FAVORITE",e[e.ONBOARDING=3]="ONBOARDING"}(Dt||(Dt={}));let Wt=(()=>{var e,t;let r,i,a,s=[],n=[],o=[];return e=class{get _stories(){return Nt(this,t,"f")}set _stories(e){Ut(this,t,e,"f")}constructor(e,r,i){var a;Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:(Bt(this,s),r)}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasFavorite",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_cover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_type",{enumerable:!0,configurable:!0,writable:!0,value:Dt.DEFAULT}),t.set(this,Bt(this,n,Me.observable.array())),Bt(this,o),this.rootStore=r,this.params=i,this.id=e.id,this.slug=e.feedSlug,this.hasFavorite=Boolean(e.hasFavorite),this._cover=Zt.createByRawData(null!==(a=e.cover)&&void 0!==a?a:{}),this._stories=r.storyStore.addStoriesByDtos(e.stories)}get stories(){return this._stories}get type(){return this._type}get cover(){return this._cover}get coverSrc(){var e;const t=null===(e=this._cover)||void 0===e?void 0:e.findOneByType("h");return null==t?void 0:t.url}removeById(e){const t=this._stories.findIndex((t=>t.id===e));-1!==t&&(0,Me.remove)(this._stories,t.toString())}unshiftStory(e){-1===this._stories.indexOf(e)&&this._stories.unshift(e)}getStoryById(e){return this.stories.find((t=>t.id===e))}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],i=[Me.action],a=[Me.action],Ft(e,null,r,{kind:"accessor",name:"_stories",static:!1,private:!1,access:{has:e=>"_stories"in e,get:e=>e._stories,set:(e,t)=>{e._stories=t}},metadata:t},n,o),Ft(e,null,i,{kind:"method",name:"removeById",static:!1,private:!1,access:{has:e=>"removeById"in e,get:e=>e.removeById},metadata:t},null,s),Ft(e,null,a,{kind:"method",name:"unshiftStory",static:!1,private:!1,access:{has:e=>"unshiftStory"in e,get:e=>e.unshiftStory},metadata:t},null,s),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const zt="{{__favorite__}}";class Vt extends Wt{constructor(e,t){super(e,t),this._type=Dt.FAVORITE}static createByStoryDtos(e,t){return new Vt({feedSlug:zt,stories:e},t)}}const Gt=(e=>{var t={};return A.d(t,e),t})({default:()=>o.default});class $t extends Wt{constructor(e,t,r){super(e,t),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"limit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._type=Dt.ONBOARDING,this.tags=r.tags,this.limit=r.limit,this.filterOpenedStories()}static getDefaultSlug(){return"onboarding"}isEqualParams(e){return(0,Gt.default)(this.tags,e.tags)&&this.limit===e.limit}filterOpenedStories(){this._stories=this._stories.filter((e=>!e.isOpened))}}const Ht="{{__ugc__}}";class qt extends Wt{constructor(e,t){super(e,t),this._type=Dt.UGC}static createByStoryDtos(e,t){return new qt({feedSlug:Ht,stories:e},t)}}class Qt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async fetchStorySlides({id:e,feedSlug:t}){const{url:r,params:i}=this.getStoryRequestConfig(e,t);return(await ke.get(r,null!=i?i:{})).data}async fetchStory({id:e,feedSlug:t,fetchShareUrl:r,once:i}){const{url:a,params:s}=this.getStoryRequestConfig(e,t,!0,r,i),n=await ke.get(a,null!=s?s:{});if(204===n.status&&i)throw new Tt(e.toString());return n.data}async fetchStoryContext({ids:e}){const{url:t,params:r}=this.getStoryContextRequestConfig(e);return(await ke.get(t,null!=r?r:{})).data}async fetchStoryCSS(){var e;const{url:t,params:r}=this.getStoryCSSRequestConfig();return null!==(e=(await ke.get(t,null!=r?r:{})).data.style)&&void 0!==e?e:""}async setStoryLike(e,t){if(this.storyManager.isStatisticsDisabled)return t;const r=await ke.post(`story-like/${e}`,{value:t});if(null==r.data.like)throw new At(e);return r.data.like}async setStoryBookmark(e,t){if(this.storyManager.isStatisticsDisabled)return t;return(await ke.post(`story-favorite/${e}`,{value:t})).data.favorite}async markStoryAsOpened(e,t){const r=`u/${e}/s_opened`;let i=We(r);Array.isArray(i)||(i=[]);const a=new Set(i);a.add(t),i=Array.from(a),ze(r,i)}async fetchStorySharePath(e){const t=await ke.get(`story-share/${e}`,{});if(!t.data.url)throw new Rt(e);return t.data.url}async updateNarrativeData(e,t){if(!this.storyManager.getConfig().isStatisticsDisabled)return ke.request({url:"story-data/"+e,method:"put",data:{data:t}})}getStoryRequestConfig(e,t,r=!1,i,a){const s=["slides"];i&&s.push("share_url");const n={url:`${t===Ht?"ugc/":""}story/${e}`,method:"GET",params:{expand:s.join(",")}};return n.params.once=Number(Boolean(a)),r||null!=n.params&&(n.params.fields=["id","slides"].join(",")),n}getStoryCSSRequestConfig(){return{url:"story-context",method:"GET",params:{fields:"style"}}}getStoryContextRequestConfig(e){return{url:"story-context",method:"GET",params:{id:e.join(","),fields:"widgetsData"}}}}class Kt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async fetchUgcFeed({filter:e,tags:t,testKey:r}){const i={tags:t.join(","),test:r,f:e&&JSON.stringify(e)};return(await ke.get("ugc/feed",null!=i?i:{})).data}async fetchDefaultFeed({feedSlug:e,tags:t,testKey:r}){const i=`feed/${e}`,a={tags:t.join(","),test:r},s=await ke.get(i,null!=a?a:{});return s.data.feedSlug=e,s.data}async fetchFavoriteFeed({tags:e}){const t={tags:e.join(","),favorite:1};return(await ke.get("story",null!=t?t:{})).data}async fetchOnboardingFeed(e){const t=`feed/${e.feedSlug}/onboarding`,r={tags:e.tags.join(","),limit:e.limit},i=await ke.get(t,null!=r?r:{});return i.data.feedSlug=e.feedSlug,i.data}}const Yt=(e=>{var t={};return A.d(t,e),t})({default:()=>l.default});class Jt{constructor(e){Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:""}),this.width=e.width,this.height=e.height,this.type=e.type,this.url=this.changeUrlProtocol(e.url)}changeUrlProtocol(e){let t=window.isSecureContext;return void 0===t&&"https:"===window.location.protocol&&(t=!0),t?e:e.replace(/^https:\/\//,"http://")}}class Zt{constructor(){Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"gradient",{enumerable:!0,configurable:!0,writable:!0,value:!1})}static createByRawData(e){const t=new Zt;for(let r in e)e.hasOwnProperty(r)&&t.images.push(new Jt(e[r]));return t}findOneByType(e){var t;return null!==(t=this.images.find((t=>t.type===e)))&&void 0!==t?t:null}findOneByCoverQuality(e){return this.findOneByType(this.mapCoverQualityToImageType(e))}findOneByWidth(e,t=!1){var r;let i=null;return this.images.forEach((t=>{t.width===e&&(i=t)})),null!==i?i:(i=null!==(r=(0,Yt.default)(this.images))&&void 0!==r?r:null,t&&null!=i?i:null)}mapCoverQualityToImageType(e){switch(e){case $.Medium:return"m";case $.High:return"h"}}}var Xt=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},er=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},tr=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},rr=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let ir=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _html(){return tr(this,t,"f")}set _html(e){rr(this,t,e,"f")}get html(){return this._html}constructor(e){t.set(this,(Xt(this,a),Xt(this,s,""))),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:Xt(this,n)}),Object.defineProperty(this,"timeline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"screenshotShare",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"eventPayload",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.index=e.index,this.timeline={foreground:e.timeline.foreground,background:e.timeline.background},this.duration=e.duration,this.screenshotShare=e.screenshot_share,this.eventPayload=e.event_payload,this._html=this.replaceSlideNonce(e.html)}static createEmpty(){return new e({index:0,timeline:{foreground:"",background:""},duration:0,screenshot_share:!1,html:""})}replaceSlideNonce(e){var t;return at(e,"{{nonce}}",null!==(t=Be())&&void 0!==t?t:"")}updatePlaceholders(e){let t=this._html;for(const r of e)t=at(t,`%${r.key}%`,r.value);this._html=t}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],i=[Me.computed],er(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},s,n),er(e,null,i,{kind:"getter",name:"html",static:!1,private:!1,access:{has:e=>"html"in e,get:e=>e.html},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var ar=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},sr=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},nr=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},or=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let lr=(()=>{var e,t,r,i,a,s,n,o,l,d;let c,u,h,p,g,f,m,v,b,y=[],w=[],S=[],_=[],O=[],C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[],T=[],A=[],R=[],D=[];return e=class{get _slidesLoaded(){return nr(this,t,"f")}set _slidesLoaded(e){or(this,t,e,"f")}get _error(){return nr(this,r,"f")}set _error(e){or(this,r,e,"f")}get _context(){return nr(this,i,"f")}set _context(e){or(this,i,e,"f")}get _like(){return nr(this,a,"f")}set _like(e){or(this,a,e,"f")}get _favorite(){return nr(this,s,"f")}set _favorite(e){or(this,s,e,"f")}get _shareUrl(){return nr(this,n,"f")}set _shareUrl(e){or(this,n,e,"f")}get _slides(){return nr(this,o,"f")}set _slides(e){or(this,o,e,"f")}get _isOpened(){return nr(this,l,"f")}set _isOpened(e){or(this,l,e,"f")}get _canBeShown(){return nr(this,d,"f")}set _canBeShown(e){or(this,d,e,"f")}constructor(e,c,u){var h,p,g,f,m,v,b,B,F,N,U,W,z,V,G,$,H,q,Q,K,Y,J,Z;Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"storiesApi",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stringId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"statTitle",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:{color:"",gradient:!1}}),Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slidesCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"disableClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"likeFunctional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"favoriteFunctional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shareFunctional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"needPlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"gameInstance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideTimeline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasPlaceholder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSwipeUp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ugcPayload",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_title",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parsedSlideImage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_videoCoverSrc",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_videoCover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,sr(this,y,!1)),r.set(this,(sr(this,w),sr(this,S,null))),i.set(this,(sr(this,_),sr(this,O,null))),a.set(this,(sr(this,C),sr(this,x,0))),s.set(this,(sr(this,k),sr(this,P,!1))),n.set(this,(sr(this,j),sr(this,M,null))),o.set(this,(sr(this,E),sr(this,I,[]))),l.set(this,(sr(this,L),sr(this,T,!1))),d.set(this,(sr(this,A),sr(this,R,!1))),sr(this,D),this.rootStore=c,this.storiesApi=u,this.id=e.id,this._title=null!==(h=e.title)&&void 0!==h?h:"",this._isOpened=null!==(p=e.is_opened)&&void 0!==p&&p,this.statTitle=null!==(g=e.stat_title)&&void 0!==g?g:"",this.titleColor=null!==(f=e.title_color)&&void 0!==f?f:"",this.background=null!==(m=e.background)&&void 0!==m?m:{},this.backgroundColor=null!==(v=e.background_color)&&void 0!==v?v:"",this.slidesCount=null!==(b=e.slides_count)&&void 0!==b?b:0,this.disableClose=null!==(B=e.disable_close)&&void 0!==B&&B,this.hideInReader=null!==(F=e.hide_in_reader)&&void 0!==F&&F,this.likeFunctional=null!==(N=e.like_functional)&&void 0!==N&&N,this.favoriteFunctional=null!==(U=e.favorite_functional)&&void 0!==U&&U,this.shareFunctional=null!==(W=e.share_functional)&&void 0!==W&&W,this.needPlaceholders=null!==(z=e.need_placeholders)&&void 0!==z&&z,this.gameInstance=e.game_instance,this.hasAudio=null!==(V=e.has_audio)&&void 0!==V&&V,this.hasSwipeUp=null!==(G=e.has_swipe_up)&&void 0!==G&&G,this.stringId=null!==($=e.string_id)&&void 0!==$?$:"",this.tags=null!==(H=e.tags)&&void 0!==H?H:[],this._like=null!==(q=e.like)&&void 0!==q?q:0,this._favorite=null!==(Q=e.favorite)&&void 0!==Q&&Q,this.deeplink=null!==(K=e.deeplink)&&void 0!==K?K:"",this.hideTimeline=null!==(Y=e.hide_timeline)&&void 0!==Y&&Y,this.ugcPayload=null!==(J=e.payload)&&void 0!==J?J:{},this._image=Zt.createByRawData(e.image),this._videoCover=Zt.createByRawData(e.video_cover);const X=null!==(Z=e.slides)&&void 0!==Z?Z:[];this.setSlides(X),this.updateTitlePlaceholders(this.rootStore.placeholderStore.placeholders)}get like(){return this._like}get favorite(){return this._favorite}get isOpened(){return this._isOpened}get shareUrl(){return this._shareUrl}get title(){return this._title}get slidesLoaded(){return this._slidesLoaded}get canBeShown(){return this._canBeShown}get error(){return this._error}get slides(){return this._slides}get context(){return this._context}get image(){return this._image}getImagesPerSlide(e){var t,r;return this.parseHtmlSlidesForMainImage(),null!==(r=null===(t=this._parsedSlideImage)||void 0===t?void 0:t[e])&&void 0!==r?r:null}parseHtmlSlidesForMainImage(){!this._parsedSlideImage&&this.slidesLoaded&&(this._parsedSlideImage=this._slides.map((e=>this.parseSlideNarrativeImageSrc(e.html)||this.parseSlideNarrativeVideoPosterSrc(e.html)||null)))}parseSlideNarrativeImageSrc(e){const t=e.match(/<[^<]*narrative-element-image.*<img[^<]*src="([^"]*)"[^<]*>/i);return null==t?void 0:t[1]}parseSlideNarrativeVideoPosterSrc(e){const t=e.match(/<[^<]*narrative-element-video.*<video[^<]*poster\-remote\-src="([^"]*)"[^<]*>/i);return null==t?void 0:t[1]}get videoCover(){return this._videoCover}get videoCoverSrc(){if(!1===this._videoCoverSrc)return null;if(null===this._videoCoverSrc){const e=this.videoCover;if(null===e)return this._videoCoverSrc=!1,null;const t=e.findOneByType("h");if(null!==t)return t.url}return"string"==typeof this._videoCoverSrc?this._videoCoverSrc:null}setSlides(e){!this._slidesLoaded&&e.length&&(this._slides=this.mapSlidesByDto(e),this.updateSlidesPlaceholders(this.rootStore.placeholderStore.placeholders),this._slidesLoaded=!0)}setCanBeShown(e){this._canBeShown=e}setError(e){this._error=e}setContext(e){this._context=e}async setLike(e){if(this._like===e)return;const t=this._like;this._like=e;try{await this.storiesApi.setStoryLike(this.id,e)}catch(e){this._like=t,console.error(e)}}async setFavorite(e){if(this._favorite===e)return;const t=this._favorite;try{this._favorite=e,await this.storiesApi.setStoryBookmark(this.id,e);const t=this.rootStore.storyFeedStore.getFavoriteFeed();e?t.unshiftStory(this):t.removeById(this.id)}catch(e){throw console.error(e),this._favorite=t,e}}markIsOpened(){const e=this.rootStore.sessionStore.session;!this.isOpened&&(null==e?void 0:e.userKey)&&(this.storiesApi.markStoryAsOpened(e.userKey,this.id),this._isOpened=!0,this.rootStore.onboardingFeedStore.removeStoryFromOnboardingFeedsById(this.id))}async fetchStorySharePath(){if(null!==this._shareUrl)return this._shareUrl;const e=await this.storiesApi.fetchStorySharePath(this.id);return this._shareUrl=e,e}async updateNarrativeData(e){return this.storiesApi.updateNarrativeData(this.id,e)}updatePlaceholders(e){this.needPlaceholders&&(this.updateSlidesPlaceholders(e),this.updateTitlePlaceholders(e))}updateSlidesPlaceholders(e){for(const t of this.slides)t.updatePlaceholders(e)}updateTitlePlaceholders(e){let t=this._title;for(const r of e)t=at(t,`%${r.key}%`,r.value);this._title=t}mapSlidesByDto(e){return e.map((e=>new ir(e)))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;c=[Me.observable],u=[Me.observable],h=[Me.observable],p=[Me.observable],g=[Me.observable],f=[Me.observable],m=[Me.observable],v=[Me.observable],b=[Me.observable],ar(e,null,c,{kind:"accessor",name:"_slidesLoaded",static:!1,private:!1,access:{has:e=>"_slidesLoaded"in e,get:e=>e._slidesLoaded,set:(e,t)=>{e._slidesLoaded=t}},metadata:t},y,w),ar(e,null,u,{kind:"accessor",name:"_error",static:!1,private:!1,access:{has:e=>"_error"in e,get:e=>e._error,set:(e,t)=>{e._error=t}},metadata:t},S,_),ar(e,null,h,{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},O,C),ar(e,null,p,{kind:"accessor",name:"_like",static:!1,private:!1,access:{has:e=>"_like"in e,get:e=>e._like,set:(e,t)=>{e._like=t}},metadata:t},x,k),ar(e,null,g,{kind:"accessor",name:"_favorite",static:!1,private:!1,access:{has:e=>"_favorite"in e,get:e=>e._favorite,set:(e,t)=>{e._favorite=t}},metadata:t},P,j),ar(e,null,f,{kind:"accessor",name:"_shareUrl",static:!1,private:!1,access:{has:e=>"_shareUrl"in e,get:e=>e._shareUrl,set:(e,t)=>{e._shareUrl=t}},metadata:t},M,E),ar(e,null,m,{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},I,L),ar(e,null,v,{kind:"accessor",name:"_isOpened",static:!1,private:!1,access:{has:e=>"_isOpened"in e,get:e=>e._isOpened,set:(e,t)=>{e._isOpened=t}},metadata:t},T,A),ar(e,null,b,{kind:"accessor",name:"_canBeShown",static:!1,private:!1,access:{has:e=>"_canBeShown"in e,get:e=>e._canBeShown,set:(e,t)=>{e._canBeShown=t}},metadata:t},R,D),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class dr{constructor(e,t){Object.defineProperty(this,"widgetsData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.widgetsData=this.mapStoryContextDto(e,t)}mapStoryContextDto(e,t){var r;const i={},a=null!==(r=t.widgetsData)&&void 0!==r?r:{};for(const t in a)Array.isArray(a[t])||(i[t]=a[t][e]);return i}updateNarrativeSavedData(e){this.widgetsData._narrative_saved_data=e}}class cr{async openGame({gameInstanceId:e,gameOptions:t}){const r={fields:"splashScreen,splashLandscapeScreen,splashLottieScreen,screenOptions,config,resources,url,downloadUrl,instanceUserData,canTryReloadCount,loggerLevel,lottie"};t&&(0,we.default)(t)&&null!=t.demoMode&&(r.demoMode=Boolean(t.demoMode));return(await ke.post(`game/${e}/launch?expand=config`,r)).data}}var ur;!function(e){e.TEXT="text",e.IMAGE="image"}(ur||(ur={}));class hr{constructor(e){var t;Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"sessionId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lang",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appPackageId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sdkVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"userAgent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"placeholders",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const r=this.storyManager.getConfig(),i=this.storyManager.rootStore.placeholderStore.placeholders,a=this.storyManager.rootStore.sessionStore.session;this.sessionId=a.id,this.userKey=a.userKey,this.apiKey=r.apiKey,this.sdkVersion="3.4.5",this.apiBaseUrl=be.apiUrl,this.userAgent=_e,this.appPackageId=r.appPackageId,this.deviceId=a.deviceId,this.userId=null!==(t=r.userId)&&void 0!==t?t:"",this.lang=r.lang.toString(),this.placeholders=i.map((e=>this.mapPlaceholder(e)))}mapPlaceholder(e){return{type:this.mapPlaceholderType(e.type),name:e.key,value:e.value}}mapPlaceholderType(e){switch(e){case xt.TEXT:return ur.TEXT;case xt.IMAGE:return ur.IMAGE}}toJSON(){return{sessionId:this.sessionId,lang:this.lang,apiKey:this.apiKey,userKey:this.userKey,appPackageId:this.appPackageId,deviceId:this.deviceId,userId:this.userId,sdkVersion:this.sdkVersion,apiBaseUrl:this.apiBaseUrl,userAgent:this.userAgent,placeholders:this.placeholders}}}class pr{constructor(e){Object.defineProperty(this,"rawData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.gameInstanceId=e.gameInstanceId,this.rawData=e}toJSON(){return this.rawData}}class gr{constructor(e){Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sha1",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e.url,this.size=e.size,this.key=e.key,this.sha1=e.sha1}}class fr{constructor(e){Object.defineProperty(this,"fullScreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"widescreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"orientation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.fullScreen=e.fullScreen,this.widescreen=e.widescreen,this.orientation=e.orientation}}class mr{constructor(e){Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sha1",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e.url,this.size=e.size,this.sha1=e.sha1}}class vr{constructor(e){Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sha1",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"durationMinimalMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e.url,this.size=e.size,this.sha1=e.sha1,this.durationMinimalMs=e.durationMinimalMs}}class br{constructor(e){Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sha1",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=e.url,this.size=e.size,this.sha1=e.sha1}}const yr=(e=>{var t={};return A.d(t,e),t})({default:()=>d.default});class wr{constructor(e,t){var r,i;Object.defineProperty(this,"splashScreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"splashLandscapeScreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"splashLottieScreen",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"screenOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resources",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"downloadUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"instanceUserData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"canTryReloadCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"loggerLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lottie",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.splashScreen=t.splashScreen?new br(t.splashScreen):void 0,this.splashLandscapeScreen=t.splashLandscapeScreen?new mr(t.splashLandscapeScreen):void 0,this.splashLottieScreen=t.splashLottieScreen?new vr(t.splashLottieScreen):void 0,this.screenOptions=new fr(t.screenOptions),this.config=new pr(t.config),this.resources=null!==(i=null===(r=t.resources)||void 0===r?void 0:r.map((e=>new gr(e))))&&void 0!==i?i:[],this.url=t.url,this.downloadUrl=t.downloadUrl,this.instanceUserData=t.instanceUserData,this.clientConfig=new hr(e),this.canTryReloadCount=t.canTryReloadCount,this.loggerLevel=t.loggerLevel,this.lottie=t.lottie?{src:t.lottie.src}:void 0}toInitDto(e){return(0,yr.default)(this.config.toJSON(),{clientConfig:Object.assign({fullScreen:!1,screenOrientation:this.screenOptions.orientation,safeAreaInsets:e.safeAreaInsets,widescreen:e.isWidescreen,dir:e.dir,nonce:Be(),sdkFeatures:{gameShouldForegroundCallback:!0}},this.clientConfig.toJSON())})}}class Sr extends Error{constructor(e){super(`Invalid language tag: ${e}. The "lang" value must be comply with the RFC 5646 (also known as BCP 47). Examples of valid language tags include "en-US", "fr-FR", "es-ES", etc.`),this.name="IasInvalidLanguageTagError"}}const _r="en-US";class Or{constructor(e=_r){Object.defineProperty(this,"languageCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"countryCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tag",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rawData",{enumerable:!0,configurable:!0,writable:!0,value:""}),this.rawData=e;const t=this.normalizeAndEnsureCompatibility(e),r=this.validateTag(t);this.parseTag(r)}isValidTag(e){return/^[a-z]+-[a-zA-Z]+$/.test(e)}toRawData(){return this.rawData}toString(){return this.tag}normalizeAndEnsureCompatibility(e){const t=e.toLowerCase();return this.ensureBackwardCompatibility(t)}ensureBackwardCompatibility(e){var t;return null!==(t={ru:"ru-RU",en:"en-US"}[e])&&void 0!==t?t:e}validateTag(e){return this.isValidTag(e)?e:(console.error(new Sr(e).message),this.getNavigatorTag())}getNavigatorTag(){const e=navigator.language.toLowerCase();return this.isValidTag(e)?e:(console.error(`Invalid navigator language tag: ${e}`),_r)}parseTag(e){const[t,r]=e.split("-");this.languageCode=t,this.countryCode=r.toUpperCase(),this.tag=`${this.languageCode}-${this.countryCode}`}}const Cr=(e=>{var t={};return A.d(t,e),t})({default:()=>c.default});class xr extends Error{constructor(){super("[IAS]: you must pass the <userId> value"),this.name="IasEmptyUserIdError"}}class kr extends Error{constructor(e,t){super(`[IAS]: tags (joined by ',') "${e.join(",")}" is bigger then ${t} bytes`),this.name="IasTagsLengthError"}}class Pr extends Error{constructor(e,t){super(`[IAS]: userId "${e}" is bigger then ${t} bytes`),this.name="IasUserIdLengthError"}}var jr=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Mr=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Er=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ir=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Lr=(()=>{var e,t,r,i,a;let s,n,o,l,d,c=[],u=[],h=[],p=[],g=[],f=[],m=[],v=[],b=[];return e=class{get _apiKey(){return Er(this,t,"f")}set _apiKey(e){Ir(this,t,e,"f")}get _tags(){return Er(this,r,"f")}set _tags(e){Ir(this,r,e,"f")}get _lang(){return Er(this,i,"f")}set _lang(e){Ir(this,i,e,"f")}get _userId(){return Er(this,a,"f")}set _userId(e){Ir(this,a,e,"f")}constructor(e,s){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(jr(this,c),e)}),t.set(this,jr(this,u,"")),r.set(this,(jr(this,h),jr(this,p,[]))),i.set(this,(jr(this,g),jr(this,f,new Or))),Object.defineProperty(this,"_disableDeviceId",{enumerable:!0,configurable:!0,writable:!0,value:(jr(this,m),!1)}),Object.defineProperty(this,"_appPackageId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_textPlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_imagePlaceholders",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_isStatisticsDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),a.set(this,jr(this,v,"")),Object.defineProperty(this,"_userIdSign",{enumerable:!0,configurable:!0,writable:!0,value:jr(this,b)}),Object.defineProperty(this,"_isInited",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.updateByDto(s),this._isInited=!0}get userId(){return this._userId}get userIdSign(){return this._userIdSign}get isStatisticsDisabled(){return this._isStatisticsDisabled||"com.inappstory.webpreview"===this._appPackageId}get appPackageId(){return this._appPackageId}get apiKey(){return this._apiKey}get tags(){return this._tags}get lang(){return this._lang}get disableDeviceId(){return this._disableDeviceId}get textPlaceholders(){return this._textPlaceholders}get imagePlaceholders(){return this._imagePlaceholders}disableStatistic(){this._isStatisticsDisabled=!0}enableStatistic(){this._isStatisticsDisabled=!1}setApiKey(e){this._apiKey!==e&&(!function(e){const t=ye(e);if(null!=t){const e=t.split(".").slice(1);be.baseUrl=`https://${["cdn",...e].join(".")}`,be.faviconApiUrl=`https://${["favicon",...e].join(".")}`,be.apiUrl=`https://${t}`}}(e),this._apiKey=e,this.storyManager.rootStore.sessionStore.close())}async setUserId(e,t){if(((0,Ne.default)(e)||(0,Cr.default)(e))&&this._userId!==e){if(this._disableDeviceId&&!this._userId)throw new xr;(new Tr).checkUserIdLength(e.toString()).validate(),this._userId=e,this._userIdSign=t,this._isInited&&await this.reloadSdk()}}async setLang(e){e&&(0,Ne.default)(e)&&this._lang.toRawData()!==e&&(this._lang=new Or(e),this._isInited&&await this.reloadSdk())}setTextPlaceholders(e={}){if(!(0,we.default)(e))return;const t=this.mapTextPlaceholders(e);(0,Gt.default)(this._textPlaceholders,t)||(this._textPlaceholders=t,this.storyManager.rootStore.placeholderStore.addPlaceholders(this._textPlaceholders))}setImagePlaceholders(e={}){if(!(0,we.default)(e))return;const t=this.mapImagePlaceholders(e);(0,Gt.default)(this._imagePlaceholders,t)||(this._imagePlaceholders=t,this.storyManager.rootStore.placeholderStore.addPlaceholders(this._imagePlaceholders))}setTags(e){(0,Gt.default)(this._tags,e)||((new Tr).checkTagsLength(e).validate(),this._tags=Re(e))}updateByDto(e){var t,r,i,a,s;this._appPackageId=null!==(t=e.appPackageId)&&void 0!==t?t:"",this._disableDeviceId=Boolean(e.disableDeviceId),this.setApiKey(e.apiKey),this.setUserId(null!==(r=e.userId)&&void 0!==r?r:"",e.userIdSign),this.setLang(e.lang),this.setTextPlaceholders(null!==(i=e.placeholders)&&void 0!==i?i:{}),this.setImagePlaceholders(null!==(a=e.imagePlaceholders)&&void 0!==a?a:{}),this.setTags(null!==(s=e.tags)&&void 0!==s?s:[])}mapTextPlaceholders(e){const t=[];for(const[r,i]of Object.entries(e))t.push(new Et(r,i));return t}mapImagePlaceholders(e){const t=[];for(const[r,i]of Object.entries(e))t.push(new Mt(r,i));return t}async reloadSdk(){try{this.storyManager.rootStore.sessionStore.close(),this.storyManager.closeAllReaders(),await this.storyManager.reloadAllStoryLists(),await this.storyManager.reloadAllStackedStoryLists()}catch(e){console.error(e)}}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;s=[Me.observable],n=[Me.observable],o=[Me.observable],l=[Me.observable],d=[Ie],Mr(e,null,s,{kind:"accessor",name:"_apiKey",static:!1,private:!1,access:{has:e=>"_apiKey"in e,get:e=>e._apiKey,set:(e,t)=>{e._apiKey=t}},metadata:t},u,h),Mr(e,null,n,{kind:"accessor",name:"_tags",static:!1,private:!1,access:{has:e=>"_tags"in e,get:e=>e._tags,set:(e,t)=>{e._tags=t}},metadata:t},p,g),Mr(e,null,o,{kind:"accessor",name:"_lang",static:!1,private:!1,access:{has:e=>"_lang"in e,get:e=>e._lang,set:(e,t)=>{e._lang=t}},metadata:t},f,m),Mr(e,null,l,{kind:"accessor",name:"_userId",static:!1,private:!1,access:{has:e=>"_userId"in e,get:e=>e._userId,set:(e,t)=>{e._userId=t}},metadata:t},v,b),Mr(e,null,d,{kind:"method",name:"reloadSdk",static:!1,private:!1,access:{has:e=>"reloadSdk"in e,get:e=>e.reloadSdk},metadata:t},null,c),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Tr{constructor(){Object.defineProperty(this,"errors",{enumerable:!0,configurable:!0,writable:!0,value:[]})}checkUserIdLength(e){return e.length>0&&this.getByteLength(e.toString())>255&&this.errors.push(new Pr(e,255)),this}checkTagsLength(e){return e.length>0&&this.getByteLength(e.join(","))>4e3&&this.errors.push(new kr(e,4e3)),this}validate(){if(this.errors.length>0)throw this.errors.shift()}getByteLength(e){let t=e.length;for(let r=e.length-1;r>=0;r--){const i=e.charCodeAt(r);i>127&&i<=2047?t++:i>2047&&i<=65535&&(t+=2),i>=56320&&i<=57343&&r--}return t}}var Ar=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Rr=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Dr=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Br=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Fr=(()=>{var e,t,r,i,a,s,n,o,l;let d,c,u,h,p,g,f,m,v,b,y,w,S,_,O,C,x,k,P=[],j=[],M=[],E=[],I=[],L=[],T=[],A=[],R=[],D=[],B=[],F=[],N=[],U=[],W=[],z=[],V=[];return e=class{get _id(){return Dr(this,t,"f")}set _id(e){Br(this,t,e,"f")}get _events(){return Dr(this,r,"f")}set _events(e){Br(this,r,e,"f")}get _type(){return Dr(this,i,"f")}set _type(e){Br(this,i,e,"f")}get _slides(){return Dr(this,a,"f")}set _slides(e){Br(this,a,e,"f")}get _appearanceOptions(){return Dr(this,s,"f")}set _appearanceOptions(e){Br(this,s,e,"f")}get _needPlaceholders(){return Dr(this,n,"f")}set _needPlaceholders(e){Br(this,n,e,"f")}get _hasLimit(){return Dr(this,o,"f")}set _hasLimit(e){Br(this,o,e,"f")}get _isOnceOpened(){return Dr(this,l,"f")}set _isOnceOpened(e){Br(this,l,e,"f")}constructor(e,d,c){Object.defineProperty(this,"iamStatisticsService",{enumerable:!0,configurable:!0,writable:!0,value:(Ar(this,P),d)}),Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,Ar(this,j,void 0)),r.set(this,(Ar(this,M),Ar(this,E,{}))),i.set(this,(Ar(this,I),Ar(this,L,void 0))),a.set(this,(Ar(this,T),Ar(this,A,[]))),s.set(this,(Ar(this,R),Ar(this,D,new ht))),n.set(this,(Ar(this,B),Ar(this,F,!1))),o.set(this,(Ar(this,N),Ar(this,U,!1))),l.set(this,(Ar(this,W),Ar(this,z,!1))),Object.defineProperty(this,"_frequencyLimit",{enumerable:!0,configurable:!0,writable:!0,value:(Ar(this,V),null)}),Object.defineProperty(this,"_displayFrom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_displayTo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_campaignName",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._id=e}get id(){return this._id}get needPlaceholders(){return this._needPlaceholders}get openTime(){return this.iamStatisticsService.openTime}get timeSinceLastShow(){return this.iamStatisticsService.timeSinceLastShow}get frequencyLimitTimeExceeded(){return null===this._frequencyLimit?this._isOnceOpened:0!==this._frequencyLimit&&Math.trunc(this.timeSinceLastShow/1e3)<=this._frequencyLimit}get withinDisplayTimeRange(){return(!this._displayFrom||Date.now()>=this._displayFrom)&&(!this._displayTo||Date.now()<=this._displayTo)}get isOnceOpened(){return this._isOnceOpened}get hasLimit(){return this._hasLimit}get events(){return this._events}get slides(){return this._slides}get activeSlideIndex(){return 0}get context(){return this.iamStore.messageContext}get appearanceOptions(){return this._appearanceOptions}get type(){return this._type}destroy(){}updateByDto(e){var t,r,i;this._events=this.mapMessageEventsByDto(null!==(t=e.events)&&void 0!==t?t:[]),this._type=e.type,this._campaignName=e.campaign_name,this._frequencyLimit=e.frequency_limit,this._displayFrom=null!==(r=e.display_from)&&void 0!==r?r:null,this._displayTo=null!==(i=e.display_to)&&void 0!==i?i:null,this._hasLimit=Boolean(e.has_limit),this._appearanceOptions=(new bt).create(this._type,e.appearance),this._needPlaceholders=e.need_placeholders,this.updateMessageSlides(e.slides_html)}hasEvent(e){return Boolean(this._events[e])}getEventByName(e){return this._events[e]}toPublicDto(){return{id:this._id,campaignName:this._campaignName,type:this._type}}async trackOpen(){this._isOnceOpened=!0,await this.iamStatisticsService.trackOpen(this)}async trackClose(){await this.iamStatisticsService.trackClose(this)}async trackWidgetEvent(e){await this.iamStatisticsService.trackWidgetEvent(this,e)}async updateUserData(e){return this.iamStore.updateMessageUserData(this.id,e)}updateMessageSlides(e){const t=[];for(const r of e){const e=new Ot(this);e.updateByDto(r),t.push(e)}this._slides=t}mapMessageEventsByDto(e){const t={};for(const r of e)t[r.name]=r;return t}static createByDto(t,r,i){const a=new e(t.id,i,r);return a.updateByDto(t),a}updatePlaceholders(e){for(const t of this._slides)t.updatePlaceholders(e)}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;d=[Me.observable],c=[Me.observable],u=[Me.observable],h=[Me.observable],p=[Me.observable],g=[Me.observable],f=[Me.observable],m=[Me.observable],v=[Me.computed],b=[Me.computed],y=[Me.computed],w=[Me.computed],S=[Me.computed],_=[Me.computed],O=[Me.computed],C=[Me.computed],x=[Me.computed],k=[Me.action],Rr(e,null,d,{kind:"accessor",name:"_id",static:!1,private:!1,access:{has:e=>"_id"in e,get:e=>e._id,set:(e,t)=>{e._id=t}},metadata:t},j,M),Rr(e,null,c,{kind:"accessor",name:"_events",static:!1,private:!1,access:{has:e=>"_events"in e,get:e=>e._events,set:(e,t)=>{e._events=t}},metadata:t},E,I),Rr(e,null,u,{kind:"accessor",name:"_type",static:!1,private:!1,access:{has:e=>"_type"in e,get:e=>e._type,set:(e,t)=>{e._type=t}},metadata:t},L,T),Rr(e,null,h,{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},A,R),Rr(e,null,p,{kind:"accessor",name:"_appearanceOptions",static:!1,private:!1,access:{has:e=>"_appearanceOptions"in e,get:e=>e._appearanceOptions,set:(e,t)=>{e._appearanceOptions=t}},metadata:t},D,B),Rr(e,null,g,{kind:"accessor",name:"_needPlaceholders",static:!1,private:!1,access:{has:e=>"_needPlaceholders"in e,get:e=>e._needPlaceholders,set:(e,t)=>{e._needPlaceholders=t}},metadata:t},F,N),Rr(e,null,f,{kind:"accessor",name:"_hasLimit",static:!1,private:!1,access:{has:e=>"_hasLimit"in e,get:e=>e._hasLimit,set:(e,t)=>{e._hasLimit=t}},metadata:t},U,W),Rr(e,null,m,{kind:"accessor",name:"_isOnceOpened",static:!1,private:!1,access:{has:e=>"_isOnceOpened"in e,get:e=>e._isOnceOpened,set:(e,t)=>{e._isOnceOpened=t}},metadata:t},z,V),Rr(e,null,v,{kind:"getter",name:"id",static:!1,private:!1,access:{has:e=>"id"in e,get:e=>e.id},metadata:t},null,P),Rr(e,null,b,{kind:"getter",name:"needPlaceholders",static:!1,private:!1,access:{has:e=>"needPlaceholders"in e,get:e=>e.needPlaceholders},metadata:t},null,P),Rr(e,null,y,{kind:"getter",name:"isOnceOpened",static:!1,private:!1,access:{has:e=>"isOnceOpened"in e,get:e=>e.isOnceOpened},metadata:t},null,P),Rr(e,null,w,{kind:"getter",name:"hasLimit",static:!1,private:!1,access:{has:e=>"hasLimit"in e,get:e=>e.hasLimit},metadata:t},null,P),Rr(e,null,S,{kind:"getter",name:"events",static:!1,private:!1,access:{has:e=>"events"in e,get:e=>e.events},metadata:t},null,P),Rr(e,null,_,{kind:"getter",name:"slides",static:!1,private:!1,access:{has:e=>"slides"in e,get:e=>e.slides},metadata:t},null,P),Rr(e,null,O,{kind:"getter",name:"context",static:!1,private:!1,access:{has:e=>"context"in e,get:e=>e.context},metadata:t},null,P),Rr(e,null,C,{kind:"getter",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions},metadata:t},null,P),Rr(e,null,x,{kind:"getter",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type},metadata:t},null,P),Rr(e,null,k,{kind:"method",name:"updateByDto",static:!1,private:!1,access:{has:e=>"updateByDto"in e,get:e=>e.updateByDto},metadata:t},null,P),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Nr{}class Ur extends Nr{constructor(e,t,r){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r})}get type(){return"w-copy"}toQueryParams(){return{wi:this.widgetId,wv:this.value,wl:this.label}}toJSON(){return{widgetId:this.widgetId,value:this.value}}}class Wr extends Nr{constructor(e,t,r){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r})}get type(){return"w-link"}toQueryParams(){return{wi:this.widgetId,wv:this.value,wl:this.label}}toJSON(){return{widgetId:this.widgetId,value:this.value}}}class zr extends Nr{constructor(e,t,r){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"answer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r})}get type(){return"w-range-slider"}toQueryParams(){return{wi:this.widgetId,wa:this.answer,wl:this.label}}toJSON(){return{widgetId:this.widgetId,answer:this.answer,label:this.label}}}class Vr extends Nr{constructor(e,t,r,i){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"answer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:i})}get type(){return"w-rate"}toQueryParams(){return{wi:this.widgetId,wa:this.answer,wl:this.label,wv:this.value}}toJSON(){return{widgetId:this.widgetId,value:this.value,answer:this.answer,label:this.label}}}class Gr extends Nr{constructor(e,t,r,i,a){super(),Object.defineProperty(this,"widgetId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"answer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"label",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"answerLabel",{enumerable:!0,configurable:!0,writable:!0,value:a})}get type(){return"w-share"}toQueryParams(){return{wi:this.widgetId,wa:this.answer,wl:this.label,wv:this.value,wal:this.answerLabel}}toJSON(){return{widgetId:this.widgetId,value:this.value,answer:this.answer,label:this.label,answerLabel:this.answerLabel}}}class $r{constructor(e,t,r){Object.defineProperty(this,"iterationId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideIndex",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideTotal",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,ge.v4)()})}toQueryParams(){return{ei:this.eventId,ii:this.iterationId,si:this.slideIndex,st:this.slideTotal}}}class Hr extends $r{constructor(e,t,r,i){super(e,t,r),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:i})}get type(){return"close"}toQueryParams(){return Object.assign(Object.assign({},super.toQueryParams()),{d:this.duration})}}class qr extends $r{constructor(e,t,r){super(e,t,r)}get type(){return"open"}toQueryParams(){return super.toQueryParams()}}class Qr extends $r{constructor(e,t,r,i,a){super(e,t,r),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"widgetEvent",{enumerable:!0,configurable:!0,writable:!0,value:a})}get type(){return this.widgetEvent.type}toQueryParams(){return Object.assign(Object.assign(Object.assign({},super.toQueryParams()),this.widgetEvent.toQueryParams()),{d:this.duration})}}class Kr{constructor(e){Object.defineProperty(this,"iamApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iterationId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_openTime",{enumerable:!0,configurable:!0,writable:!0,value:0})}get openTime(){return this._openTime}get timeSinceLastShow(){return Date.now()-this.openTime}async trackOpen(e){this.iterationId=this.generateId(),this._openTime=Date.now();const t=new qr(this.iterationId,e.activeSlideIndex,e.slides.length);await this.iamApi.emitMessageEvent(e.id,t)}async trackClose(e){const t=this.timeSinceLastShow,r=new Hr(this.iterationId,e.activeSlideIndex,e.slides.length,t);await this.iamApi.emitMessageEvent(e.id,r)}async trackWidgetEvent(e,t){const r=this.timeSinceLastShow,i=new Qr(this.iterationId,e.activeSlideIndex,e.slides.length,r,t);return this.iamApi.emitMessageEvent(e.id,i)}generateId(){return(0,ge.v4)()}}class Yr extends Error{constructor(){super("[IAM]: you must close other opened readers"),this.name="IamOtherReaderIsOpenError"}}class Jr extends Error{constructor(){super("[IAM]: you need preload in app messages"),this.name="IamShowOnlyIfLoadedError"}}class Zr extends Error{constructor(){super("[IAM]: show message frequency limit exceeded"),this.name="IamFrequencyLimitError"}}class Xr extends Error{constructor(){super("[IAM]: not in display time range"),this.name="IamCheckDisplayTimeRangeError"}}class ei extends Error{constructor(e){super(`[IAM]: the limit for displaying IAM with ID ${e} has been reached`),this.name="IamMessageLimitExceededError"}}class ti{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"errors",{enumerable:!0,configurable:!0,writable:!0,value:[]})}checkOtherReadersAreClosed(){var e,t;return((null===(e=this.storyManager.storyReaderViewModel)||void 0===e?void 0:e.isOpened)||(null===(t=this.storyManager.gameReaderViewModel)||void 0===t?void 0:t.isOpened))&&this.errors.push(new Yr),this}checkShowOnlyIfLoaded(e){return!this.iamStore.isLoaded&&e&&this.errors.push(new Jr),this}checkFrequencyLimit(e){return e.frequencyLimitTimeExceeded&&this.errors.push(new Zr),this}checkDisplayTimeRange(e){return e.withinDisplayTimeRange||this.errors.push(new Xr),this}validate(){if(this.errors.length>0)throw this.errors.shift()}}class ri{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"iamApi",{enumerable:!0,configurable:!0,writable:!0,value:r})}async getMessageById(e,t){new ti(this.storyManager,this.iamStore).checkOtherReadersAreClosed().checkShowOnlyIfLoaded(t.showOnlyIfLoaded).validate();const r=await this.iamStore.findById(e);return r.hasLimit&&await this.checkMesageLimit(e),r}async getMessageByEvent(e,t){new ti(this.storyManager,this.iamStore).checkOtherReadersAreClosed().checkShowOnlyIfLoaded(t.showOnlyIfLoaded).validate(),await this.iamStore.preload({tags:t.tags});const r=this.iamStore.findAllByEvent(e),i=this.getMessagesSortedByEventPriority(e,r);return this.getFirstValidMessageByEvent(i)}async getFirstValidMessageByEvent(e){let t=new Error;for(const r of e)try{return await this.validateMessageByEvent(r)}catch(e){t=e}throw t}async validateMessageByEvent(e){return new ti(this.storyManager,this.iamStore).checkFrequencyLimit(e).checkDisplayTimeRange(e).validate(),e.hasLimit&&await this.checkMesageLimit(e.id),e}async checkMesageLimit(e){const{canOpen:t}=await this.iamApi.checkMesageLimit(e);if(!t)throw new ei(e)}getMessagesSortedByEventPriority(e,t){return t.slice().sort(((t,r)=>{const i=t.events[e].priority;return r.events[e].priority-i}))}}var ii,ai,si;!function(e){e[e.BottomSheet=1]="BottomSheet",e[e.Modal=2]="Modal",e[e.Fullscreen=3]="Fullscreen"}(ii||(ii={})),function(e){e[e.None=0]="None",e[e.SlideInUp=1]="SlideInUp",e[e.FadeIn=2]="FadeIn"}(ai||(ai={})),function(e){e[e.None=0]="None",e[e.Left=1]="Left",e[e.Right=2]="Right"}(si||(si={}));class ni{constructor(e){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handleDocumentVisibilityChange=this.handleDocumentVisibilityChange.bind(this)}subscribe(){document.addEventListener("visibilitychange",this.handleDocumentVisibilityChange)}unsubscribe(){document.removeEventListener("visibilitychange",this.handleDocumentVisibilityChange)}handleDocumentVisibilityChange(){const e=this.iamReader.activeMessage;document.hidden?e.trackClose():e.trackOpen()}}class oi{constructor(e,t){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t})}get contentRatio(){return 9/16}getWidth(){return this._vw}getHeight(){return this._vh}}class li{constructor(e,t,r,i){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:i}),this.desktopMode&&this.initViewportWidthForDesktopMode()}get contentRatio(){return this._contentRatio}getWidth(){return this._vw}getHeight(){return Math.ceil(this._vw/this._contentRatio)}initViewportWidthForDesktopMode(){this._vw>557&&(this._vw=557)}}class di{constructor(e,t,r,i){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:i}),this.desktopMode&&this.initViewportWidthForDesktopMode()}get contentRatio(){return this._contentRatio}getWidth(){return this._vw}getHeight(){return Math.ceil(this._vw/this._contentRatio)}initViewportWidthForDesktopMode(){this._vw>557&&(this._vw=557)}}class ci{create(e,t){switch(e){case ii.BottomSheet:return new li(t.vw,t.vh,t.appearanceOptions.contentRatio,t.desktopMode);case ii.Modal:return new di(t.vw,t.vh,t.appearanceOptions.contentRatio,t.desktopMode);case ii.Fullscreen:return new oi(t.vw,t.vh)}}}class ui{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r})}get contentRatio(){return this._contentRatio}getOffset(){const e=this.calculateHeight();return-(Math.ceil(e-this._vh)/2)+"px 0px"}getOffsetX(){return"0px"}getOffsetY(){const e=this.calculateHeight();return`${Math.ceil(e-this._vh)/2}px`}getWidth(){return`${this.calculateWidth()}px`}getHeight(){return`${this.calculateHeight()}px`}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return this._vw}calculateHeight(){return Math.ceil(this._vw/this._contentRatio)}}class hi{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r})}get contentRatio(){return this._contentRatio}get vw(){return this._vw}get vh(){return this._vh}getOffset(){const e=this.calculateWidth();return`0px ${-(Math.ceil(e-this._vw)/2)}px`}getOffsetX(){const e=this.calculateWidth();return`${Math.ceil(e-this._vw)/2}px`}getOffsetY(){return"0px"}getWidth(){return`${this.calculateWidth()}px`}getHeight(){return`${this.calculateHeight()}px`}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return Math.ceil(this._vh*this._contentRatio)}calculateHeight(){return this._vh}}class pi{}class gi extends pi{constructor(e,t,r){super(),Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r})}get contentRatio(){return this._contentRatio}getOffset(){const e=this.calculateHeight();return-(Math.ceil(e-this._vh)/2)+"px 0px"}getOffsetX(){return"0px"}getOffsetY(){const e=this.calculateHeight();return`${Math.ceil(e-this._vh)/2}px`}getWidth(){return`${this.calculateWidth()}px`}getHeight(){return`${this.calculateHeight()}px`}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return this._vw}calculateHeight(){return Math.ceil(this._vw/this._contentRatio)}}class fi extends pi{constructor(e,t,r){super(),Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:r})}get contentRatio(){return this._contentRatio}getOffset(){const e=this.calculateWidth();return`0px ${Math.ceil(this._vw-e)/2}px`}getOffsetX(){const e=this.calculateWidth();return`${Math.ceil(this._vw-e)/2}px`}getOffsetY(){return"0px"}getWidth(){return`${this.calculateWidth()}px`}getHeight(){return`${this.calculateHeight()}px`}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return Math.ceil(this.calculateHeight()*this._contentRatio)}calculateHeight(){return this._vh}}class mi{constructor(){}create(e){const t=this.getViewportParams(e);return this.isFullscreen(e,t)?this.createFullscreenSlideGeometry(t):this.createWideOrSquareGeometry(t)}isFullscreen(e,t){return e instanceof oi}createWideOrSquareGeometry(e){return e.viewportRatio>e.contentRatio?new ui(e.vw,e.vh,e.contentRatio):new hi(e.vw,e.vh,e.contentRatio)}getViewportParams(e){return{vw:e.getWidth(),vh:e.getHeight(),viewportRatio:e.getWidth()/e.getHeight(),contentRatio:e.contentRatio}}createFullscreenSlideGeometry(e){return e.viewportRatio>e.contentRatio?new fi(e.vw,e.vh,e.contentRatio):new gi(e.vw,e.vh,e.contentRatio)}}const vi=new L.EventEmitter;vi.setMaxListeners(50);class bi{constructor(e,t={}){var r,i,a,s,n;Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slidesCount",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"feedSlug",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"filter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"actionSource",{enumerable:!0,configurable:!0,writable:!0,value:ie.list}),Object.defineProperty(this,"ugcPayload",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slideEventPayload",{enumerable:!0,configurable:!0,writable:!0,value:null});const o=this.story.sourceInfo,l=o.listType,d=null!==(r=o.feedSlug)&&void 0!==r?r:null,c=null!==(i=o.filter)&&void 0!==i?i:null;this.title=this.story.statTitle,this.tags=this.story.tags,this.slidesCount=this.story.slidesCount,this.ugcPayload=l===Dt.UGC?this.story.ugcPayload:null,this.feedSlug=l===Dt.DEFAULT?d:null,this.filter=l===Dt.UGC?c:null,this.actionSource=null!=l?this.getStorySourceByFeedType(l):ie.direct,this.slideEventPayload=null!==(n=null===(s=null===(a=e.activeSlide)||void 0===a?void 0:a.eventPayload)||void 0===s?void 0:s.payload)&&void 0!==n?n:null}toJSON(){return Object.assign({id:this.story.id,index:this.story.activeSlideIndex,title:this.title,tags:this.tags,slidesCount:this.slidesCount,feed:this.feedSlug,filter:this.filter,source:this.actionSource,ugcPayload:this.ugcPayload,payload:this.slideEventPayload},this.payload)}getStorySourceByFeedType(e){switch(e){case Dt.DEFAULT:case Dt.UGC:return ie.list;case Dt.FAVORITE:return ie.favorite;case Dt.ONBOARDING:return ie.onboarding;default:return ie.list}}}class yi extends bi{get name(){return"closeStory"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{action:this.payload.action})}}class wi extends bi{get name(){return"dislikeStory"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{value:this.payload.value})}}class Si extends bi{get name(){return"favoriteStory"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{value:this.payload.value})}}class _i extends bi{get name(){return"likeStory"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{value:this.payload.value})}}class Oi extends bi{get name(){return"shareStory"}}class Ci extends bi{get name(){return"shareStoryWithPath"}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{value:this.payload.url})}}class xi extends bi{get name(){return"showSlide"}}class ki extends bi{get name(){return"showStory"}toJSON(){const e=super.toJSON();return e.payload=null,e}}class Pi{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timerId",{enumerable:!0,configurable:!0,writable:!0,value:null})}start(){this.schedule(1e4)}stop(){null!=this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}async flush(){je(`[${Ti.name}]: flush statistics by timer`);this.statisticsService.getData().length>0?this.schedule(1e4):this.schedule(3e4),await this.statisticsService.sendData()}schedule(e){je(`[${Ti.name}]: schedule flush statistics on ${e}ms`),this.timerId=setTimeout((()=>this.flush()),e)}}class ji{constructor(){Object.defineProperty(this,"slideStartedAt",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}calculate(){const e=Date.now(),t=e-this.slideStartedAt;return this.slideStartedAt=e,t}init(){this.slideStartedAt=Date.now()}}class Mi{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),vi.on(Li.CloseStoryReader,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:1,storyId:e.storyId,slideIndex:e.slideIndex})}destroy(){vi.off(Li.CloseStoryReader,this.handle)}}class Ei{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),vi.on(Li.NextSlide,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:1,storyId:e.fromStoryId,slideIndex:e.fromSlideIndex})}destroy(){vi.off(Li.NextSlide,this.handle)}}class Ii{constructor(e){Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:e}),this.handle=this.handle.bind(this),vi.on(Li.TransitionFromSlide,this.handle)}handle(e){this.statisticsService.addSlideEvent({action:2,storyId:e.storyId,slideIndex:e.slideIndex})}destroy(){vi.off(Li.TransitionFromSlide,this.handle)}}var Li;!function(e){e.CloseStoryReader="statistics.closeStoryReader",e.NextSlide="statistics.nextSlide",e.TransitionFromSlide="statistics.transitionFromSlide"}(Li||(Li={}));class Ti extends L.default{constructor(e,t){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"beaconService",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"lastIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sourceInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"flushSheduler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideDurationCalculator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.flushSheduler=new Pi(this),this.slideDurationCalculator=new ji}init(e){this.data=[],this.sourceInfo=e,this.lastIndex=0,this.slideDurationCalculator.init(),this.flushSheduler.start(),this.events=[new Mi(this),new Ei(this),new Ii(this)]}getData(){return this.data.slice()}getLastIndex(){return this.lastIndex}cleanupData(){this.data=[]}addSlideEvent(e){if(this.storyManager.getConfig().isStatisticsDisabled)return;const t=this.slideDurationCalculator.calculate();this.data.push([e.action,this.lastIndex,e.storyId,e.slideIndex,t]),this.lastIndex++}async sendData(){const e=this.getData();if(e.length)try{if(!this.sourceInfo)throw new Error(`[${Ti.name}]: You need pass source info!`);this.cleanupData(),await this.beaconService.updateStatistics({updateDto:{data:e},listType:this.sourceInfo.feedSlug===Ht?Dt.UGC:Dt.DEFAULT})}catch(t){this.data.push(...e),console.error(t)}}async destroy(){this.events.forEach((e=>e.destroy())),this.flushSheduler.stop(),await this.sendData()}}class Ai{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async updateStatistics({listType:e,updateDto:t}){if(0===t.data.length)return t;let r=!1,i="";if(e===Dt.UGC||this.storyManager.getConfig().isStatisticsDisabled)r=!0;else try{xe("session/update",t,(()=>{})),r=!0}catch(e){i=e.toString()}if(r)return t;throw i}}class Ri{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"prevStoryId",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"prevSlideIndex",{enumerable:!0,configurable:!0,writable:!0,value:-1})}update(e){this.prevStoryId!==e.id&&(vi.emit("publicEvents.showStory",{id:e.id}),this.storyManager.emitEvent(new ki(e))),-1!==this.prevStoryId&&vi.emit(Li.NextSlide,{fromStoryId:this.prevStoryId,fromSlideIndex:this.prevSlideIndex}),this.storyManager.emitEvent(new xi(e)),this.prevStoryId=e.id,this.prevSlideIndex=e.activeSlideIndex}reset(){this.prevStoryId=-1,this.prevSlideIndex=-1}}var Di=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Bi=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};let Fi=(()=>{var e;let t,r=[];return e=class{constructor(e,t){Object.defineProperty(this,"showMultipleStoriesStrategy",{enumerable:!0,configurable:!0,writable:!0,value:(Di(this,r),e)}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t})}async show(e){var t,r;const i=this.storyManager.rootStore.onboardingFeedStore,a=await i.fetchOnboardingFeed({feedSlug:e.feedSlug,tags:null!==(t=e.customTags)&&void 0!==t?t:[],limit:null!==(r=e.limit)&&void 0!==r?r:void 0}),s=this.getFeedLoadEvent(a.slug,a.stories);return this.emitFeedLoad(s),a.stories.length?(await this.showMultipleStoriesStrategy.show({windowReferer:ae.default,storyFeed:a,storyId:a.stories[0].id}),s):s}async handleNextStoryByIndex(e){this.showMultipleStoriesStrategy.handleNextStoryByIndex(e)}emitFeedLoad(e){this.storyManager.emit("feedLoad",e)}getFeedLoadEvent(e,t){const r={stories:t.map((e=>{const t={title:null,tags:[],slidesCount:null};return e&&(t.title=e.statTitle,t.tags=e.tags,t.slidesCount=e.slidesCount),Object.assign({id:e.id},t)})),feed:null,filter:null};return r.feed=e,r}async reload(e){this.showMultipleStoriesStrategy.reload(e)}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Ie],Bi(e,null,t,{kind:"method",name:"show",static:!1,private:!1,access:{has:e=>"show"in e,get:e=>e.show},metadata:i},null,r),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),e})();class Ni{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stories",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"storyIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"storyFeed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storyStore=this.storyManager.rootStore.storyStore}async show(e){const{storyId:t,windowReferer:r,filter:i}=e;this.storyFeed=e.storyFeed,this.stories=this.getVisibleStoriesByStoryFeed(this.storyFeed),this.storyIndex=this.findStoryIndex(this.stories,t),this.storyReaderViewModel.open({windowReferer:r,id:t,stories:this.stories},{listType:this.storyFeed.type,feedSlug:this.storyFeed.slug,filter:i}),await this.storyStore.fetchStoriesSlides({stories:this.getStoriesByRange(this.storyIndex),feedSlug:this.storyFeed.slug})}async reload(e){const t=this.findStoryIndex(this.stories,e.storyId);await this.storyStore.fetchStoriesSlides({stories:this.getStoriesByRange(t),feedSlug:this.storyFeed.slug})}async handleNextStoryByIndex(e){await this.storyStore.fetchStoriesSlides({stories:this.getStoriesByRange(e),feedSlug:this.storyFeed.slug})}getVisibleStoriesByStoryFeed(e){var t;return null!==(t=e.stories.filter((e=>!e.hideInReader)))&&void 0!==t?t:[]}findStoryIndex(e,t){return e.findIndex((e=>e.id===t))}getStoriesByRange(e){const t=e-2,r=e+2;return this.stories.slice(Math.max(t,0),r+1)}}class Ui{constructor(e){Object.defineProperty(this,"showStoryStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e})}async show(e){await this.showStoryStrategy.show({storyId:e.storyId,fetchShareUrl:e.fetchShareUrl})}async reload(e){return this.showStoryStrategy.reload(e)}async handleNextStoryByIndex(e){}}var Wi=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},zi=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};let Vi=(()=>{var e;let t,r=[];return e=class{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Wi(this,r),e)}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}async show(e){try{const t=this.storyManager.rootStore.storyStore,r=await t.fetchStoryById({storyId:e.storyId,feedSlug:"",once:!0});if(r.error)throw r.error;if(r.isOpened)throw new Tt(e.storyId.toString());this.openStoryReader(r)}catch(e){throw this.storyReaderViewModel.close(),e}}openStoryReader(e){this.storyReaderViewModel.open({windowReferer:ae.default,id:e.id,stories:[e]},{feedSlug:"",once:!0})}async handleNextStoryByIndex(e){}async reload(e){}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Ie],zi(e,null,t,{kind:"method",name:"show",static:!1,private:!1,access:{has:e=>"show"in e,get:e=>e.show},metadata:i},null,r),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),e})();var Gi=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},$i=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};let Hi=(()=>{var e;let t,r=[];return e=class{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Gi(this,r),e)}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}async show(e){const t=this.storyManager.rootStore.storyStore,r=await t.fetchStoryById({storyId:e.storyId,feedSlug:"",fetchShareUrl:e.fetchShareUrl});this.openStoryReader(r,e)}openStoryReader(e,t){this.storyReaderViewModel.open({windowReferer:ae.default,id:e.id,stories:[e]},{feedSlug:"",fetchShareUrl:t.fetchShareUrl})}async handleNextStoryByIndex(e){}async reload(e){}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Ie],$i(e,null,t,{kind:"method",name:"show",static:!1,private:!1,access:{has:e=>"show"in e,get:e=>e.show},metadata:i},null,r),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),e})();class qi{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}createShowStory(){return new Hi(this.storyManager,this.storyReaderViewModel)}createShowStoryOnce(){return new Vi(this.storyManager,this.storyReaderViewModel)}createShowStoryFromSharePage(){return new Ui(new Hi(this.storyManager,this.storyReaderViewModel))}createShowOnboardingStories(){return new Fi(new Ni(this.storyManager,this.storyReaderViewModel),this.storyManager)}createShowMultipleStories(){return new Ni(this.storyManager,this.storyReaderViewModel)}}class Qi extends L.default{constructor(){super(),Object.defineProperty(this,"layersContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_activeLayer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initialLayer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}init(e,t){this.layersContainer=e,this.animationApi=t,this.layers=Array.from(this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide")),this._activeLayer=this.layers.find((e=>!e.classList.value.includes("hidden"))),this.initialLayer=this._activeLayer}reset(){var e;this.hideAllLayers(),null===(e=this.initialLayer)||void 0===e||e.classList.remove("hidden")}get activeLayer(){return this._activeLayer}getLayers(){return this.layers}hideLayer(e){e.classList.contains("hidden")||(this.animationApi.stop(e,!0),e.classList.add("hidden"))}showLayer(e){return e.classList.remove("hidden"),this.animationApi.start(e,!0),this._activeLayer=e,e}hideAllLayers(){this.getLayers().forEach((e=>this.hideLayer(e)))}showLayerByIndex(e){const t=this.getLayers();t.forEach((e=>this.hideLayer(e)));const r=t[e];if(r)return this.showLayer(r)}hasValidMultiSlides(){let e=!0,t=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide");const r=this.layersContainer.querySelectorAll(".narrative-slide.narrative-multi-slide:not(.hidden)");return t.length>0&&0===r.length&&(e=!1),e}}class Ki{constructor(e){Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideElement",{enumerable:!0,configurable:!0,writable:!0,value:null})}init(e){this.slideElement=e.querySelector(".narrative-slide")}start(){try{if(!this.slideElement)return;this.animationApi.start(this.slideElement,!0)}catch(e){console.error(e)}}stop(){try{if(!this.slideElement)return;this.animationApi.stop(this.slideElement,!0)}catch(e){console.error(e)}}resume(){this.slideElement&&this.animationApi.resume(this.slideElement)}pause(){this.slideElement&&this.animationApi.pause(this.slideElement)}}const Yi=(e=>{var t={};return A.d(t,e),t})({Player:()=>u.Player});var Ji;!function(e){e.Playing="playing",e.Waiting="waiting",e.Error="error"}(Ji||(Ji={}));class Zi{constructor(e,t){Object.defineProperty(this,"videoContext",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"videoEl",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.parseDefaultMuted()}get $video(){return this.videoEl}get muted(){return this.videoEl.muted}get paused(){return this.videoEl.paused}async start(){this.videoEl.pause(),this.videoEl.currentTime=0,await this.play()}async play(){try{const e=this.videoEl.play();e?await e:await new Promise((e=>{setTimeout(e,0)}))}catch(e){throw e}}pause(){this.videoEl.pause()}async resume(){this.videoEl.paused&&await this.videoEl.play()}stop(){this.videoEl.pause(),this.videoEl.currentTime=0}mute(){"1"!==this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted=!0)}unmute(){"1"!==this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted=!1)}async load(e=!0){return new Promise((t=>{const r=this.videoEl.oncanplaythrough?"canplaythrough":"canplay";this.videoEl.addEventListener(r,(()=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{setTimeout((()=>t()),0)}))}))}),{once:!0}),e&&this.videoEl.load()}))}on(e,t){return this.videoEl.addEventListener(e,t),this}once(e,t){return this.videoEl.addEventListener(e,t,{once:!0}),this}off(e,t){return this.videoEl.removeEventListener(e,t),this}async destroy(){this.stop()}parseDefaultMuted(){null===this.videoEl.getAttribute("data-default-muted")&&(this.videoEl.muted?this.videoEl.setAttribute("data-default-muted","1"):this.videoEl.setAttribute("data-default-muted","0"))}onPlaying(){}onWaiting(){}}class Xi{constructor(e){Object.defineProperty(this,"video",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timeupdate",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"playingCheckerTimerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.handleTimeUpdate=this.handleTimeUpdate.bind(this),this.video.$video.addEventListener("timeupdate",this.handleTimeUpdate)}destroy(){null!=this.playingCheckerTimerId&&window.clearTimeout(this.playingCheckerTimerId),this.video.$video.removeEventListener("timeupdate",this.handleTimeUpdate)}handleTimeUpdate(){this.timeupdate=Date.now(),null!=this.playingCheckerTimerId&&window.clearTimeout(this.playingCheckerTimerId),1!==this.state&&(this.state=1,this.triggerUpdate()),this.scheduleUpdate()}scheduleUpdate(){this.playingCheckerTimerId=window.setTimeout((()=>{Date.now()-this.timeupdate>=150&&(this.state=2,this.triggerUpdate())}),300)}triggerUpdate(){1===this.state?this.video.onPlaying():2===this.state&&this.video.onWaiting()}}class ea extends Zi{constructor(e,t){super(e,t),Object.defineProperty(this,"videoContext",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"player",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_vodData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isPlaying",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isDataWaiting",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"attached",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"videoStateAdapter",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.handlePlayerError=this.handlePlayerError.bind(this),this._vodData=ea.parseData(t)}get vodData(){return this._vodData}static get isBrowserSupported(){return Yi.Player.isBrowserSupported()}async load(){try{ea.isBrowserSupported?(this.disableVideoPreload(),await this.initPlayer()):(this.updateVideoSources(),await super.load(),console.error("[VOD]: Browser not supported!"))}catch(e){throw this.stop(),this.detachVideoElement().catch(console.error),e}}async destroy(){this.player.removeEventListener("error",this.handlePlayerError),this.stop(),await this.detachVideoElement(),await this.player.destroy()}static parseData(e){const t=e.getAttribute("data-vod");try{return t&&JSON.parse(t)}catch(e){return null}}async stop(){var e;this.isPlaying=!1,null===(e=this.videoStateAdapter)||void 0===e||e.destroy(),super.stop()}async start(){this.isPlaying||(this.isPlaying=!0,this.videoStateAdapter=new Xi(this),await super.start())}async initPlayer(){this.player=new Yi.Player,this.player.addEventListener("error",this.handlePlayerError),await this.attachVideoElement(),await this.loadVideo()}disableVideoPreload(){this.videoEl.preload="none"}updateVideoSources(){this.videoEl.innerHTML="";for(const e of this.vodData.formats){const t=document.createElement("source");t.src=e.url,t.type=e.mimeType,t.width=e.width,t.height=e.height,this.videoEl.appendChild(t)}}handlePlayerError(e){const t=e.detail,r=`[VOD]: error code ${t.code}; object ${t}`;console.error(r),this.stop(),this.detachVideoElement().catch(console.error).finally((()=>{this.videoContext.emit(Ji.Error,t)}))}async attachVideoElement(){this.attached||(await this.player.attach(this.videoEl),this.attached=!0,je("[VOD]: video element attached",this.videoEl))}async loadVideo(){const e=Yi.Player.convertJsonToUri(this.vodData);await this.player.load(e,0,"application/json"),je(`[VOD]: video ${e} successful loaded`)}async detachVideoElement(){this.attached&&(await this.player.detach(this.videoEl),this.attached=!1,je("[VOD]: video element detached",this.videoEl))}onPlaying(){this.isDataWaiting&&(this.isDataWaiting=!1,this.videoContext.emit(Ji.Playing))}onWaiting(){this.isDataWaiting=!0,this.videoContext.emit(Ji.Waiting)}}class ta extends L.default{constructor(e,t){super(),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"videos",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.fillVideos(t)}async load(){for(const e of this.videos)await e.load()}async start(){for(const e of this.videos)await e.start()}pause(){for(const e of this.videos)e.pause()}async resume(){for(const e of this.videos)await e.play()}stop(){for(const e of this.videos)e.stop()}static hasVideo(e){return Boolean(e.querySelector(".narrative-slide__with-video"))}mute(){for(const e of this.videos)e.mute()}unmute(){for(const e of this.videos)e.unmute()}async destroy(){for(const e of this.videos)await e.destroy(),this.videos.splice(this.videos.indexOf(e),1);this.videos=[]}fillVideos(e){for(const t of Array.from(this.container.querySelectorAll("video"))){const r=this.createVideoByElement(t);e?r.mute():r.unmute(),this.videos.push(r)}}createVideoByElement(e){return ea.parseData(e)?new ea(this,e):new Zi(this,e)}}const ra=(e=>{var t={};return A.d(t,e),t})({getSlideApi:()=>h.getSlideApi});const ia=(e=>{var t={};return A.d(t,e),t})({Mutex:()=>p.Mutex}),aa=new ia.Mutex;class sa{constructor(e){Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_widgetFactories",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"_widgets",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.refreshUserData=this.refreshUserData.bind(this)}get widgets(){return this._widgets}async init(e){const t=await this.acquireSlideApi();try{this._widgets=[];for(const t of this._widgetFactories.values()){const r=t.create(e);r.length?this._widgets.push(...r):this._widgetFactories.delete(t)}await Promise.all(this._widgets.map((e=>e.init())))}catch(e){throw e}finally{t()}}registerFactory(e){this._widgetFactories.add(e)}registerManyFactories(e){this._widgetFactories.clear();for(const t of e)this._widgetFactories.add(t)}pause(){for(const e of this._widgets)e.pause()}resume(){for(const e of this._widgets)e.resume()}findAllOfType(e){return this.widgets.filter(e)}stop(){for(const e of this._widgets)e.destroy();this._widgets=[]}async handleWidgetClick(e,t){const r=await this.acquireSlideApi();for(const r of this.widgets)if(r.click({target:e,navigationController:t}),t.defaultPrevented)break;r()}refreshUserData(){for(const e of this._widgets)e.refreshUserData()}async acquireSlideApi(){const e=await aa.acquire();return(0,ra.getSlideApi)(this.slideApiHandlers),e}}class na{pause(){}resume(){}destroy(){}refreshUserData(){}setUserData(e,t){}}class oa extends na{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetCopy.init(this.element)}refreshUserData(){this.slideApi.WidgetCopy.onRefreshUserData(this.element)}click(e){this.element==e.target&&(this.slideApi.WidgetCopy.click(e.target),e.navigationController.preventDefault())}}class la{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-copy")).map((e=>new oa(e,this.slideApi)))}}class da extends na{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetDataInput.init(this.element)}refreshUserData(){this.slideApi.WidgetDataInput.onRefreshUserData(this.element)}click(e){this.element==e.target&&(this.slideApi.WidgetDataInput.click(e.target),e.navigationController.preventDefault())}setUserData(e,t=""){this.slideApi.WidgetDataInput.setUserData(e,t)}}class ca{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-data-input")).map((e=>new da(e,this.slideApi)))}}class ua extends na{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetDateCountdown.init(this.element,this.layers)}pause(){this.slideApi.WidgetDateCountdown.onPause(this.element)}resume(){this.slideApi.WidgetDateCountdown.onResume(this.element)}refreshUserData(){this.slideApi.WidgetDateCountdown.onRefreshUserData(this.element)}click(){}}class ha{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=Array.from(e.querySelectorAll(".narrative-element-date-countdown")),r=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));return t.map((e=>new ua(e,r,this.slideApi)))}}class pa extends na{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetPoll.init(this.element)}refreshUserData(){this.slideApi.WidgetPoll.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetPoll.select(e)}setUserData(e,t=""){this.slideApi.WidgetPoll.setUserData(e,t)}click(e){e.target.classList.contains("narrative-element-poll-button")&&(this.select(e.target),e.navigationController.preventDefault())}}class ga{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-poll")).map((e=>new pa(e,this.slideApi)))}}class fa extends na{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetPollLayers.init(this.element,this.layers)}refreshUserData(){this.slideApi.WidgetPollLayers.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetPollLayers.select(e)}click(e){e.target.classList.contains("narrative-element-poll-button")&&(this.select(e.target),e.navigationController.preventDefault())}}class ma{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=Array.from(e.querySelectorAll(".narrative-element-poll-layers")),r=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));return t.map((e=>new fa(e,r,this.slideApi)))}}class va extends na{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){return this.slideApi.WidgetQuest.init(this.element)}refreshUserData(){this.slideApi.WidgetQuest.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetQuest.select(e)}click(e){e.target.classList.contains("narrative-element-test-answer")?this.handleTestAnswer(e):this.handleRouteClick(e)}handleTestAnswer(e){this.select(e.target),e.navigationController.preventDefault()}handleRouteClick(e){e.navigationController.navigationDisabled||(e.navigationController.preventDefault(),this.slideApi.WidgetQuest.handleRouteClick(this.element,{direction:e.navigationController.direction>0?"forward":"backward",slideIndex:this.story.activeSlideIndex,slideCount:this.story.slidesCount,click:()=>{e.navigationController.navigate()}}))}}class ba{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-quest");return t?[new va(t,this.slideApi,this.story)]:[]}}class ya extends na{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetQuiz.init(this.element)}refreshUserData(){this.slideApi.WidgetQuiz.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetQuiz.select(e)}slideQuizIsDone(e){return this.slideApi.WidgetQuiz.slideQuizIsDone(e)}click(e){e.target.classList.contains("narrative-element-quiz-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-quiz-answer")?this.handleAnswer(e):this.handleQuizIsDone(e)}handleQuizIsDone(e){this.slideQuizIsDone(this.element)||e.navigationController.disableNextClick()}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}}class wa{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-quiz");return t?[new ya(t,this.slideApi,this.story)]:[]}}class Sa extends na{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetQuizGrouped.init(this.element)}refreshUserData(){this.slideApi.WidgetQuizGrouped.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetQuizGrouped.select(e)}slideQuizIsDone(e){return this.slideApi.WidgetQuizGrouped.slideQuizIsDone(e)}click(e){e.target.classList.contains("narrative-element-quiz-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-quiz-answer")?this.handleAnswer(e):this.handleQuizIsDone(e)}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleQuizIsDone(e){this.slideQuizIsDone(this.element)||e.navigationController.disableNextClick()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}}class _a{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-quiz-grouped");return t?[new Sa(t,this.slideApi,this.story)]:[]}}class Oa extends na{constructor(e,t,r,i){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:i}),this.disableSwipeGesture=this.disableSwipeGesture.bind(this),this.enableSwipeGesture=this.enableSwipeGesture.bind(this)}async init(){this.slideApi.WidgetRangeSlider.init(this.element),this.registerMouseAndTouchEvents()}refreshUserData(){this.slideApi.WidgetRangeSlider.onRefreshUserData(this.element)}click(e){e.target.classList.contains("rangeslider")?this.handleClickSlider(e):e.target.classList.contains("narrative-element-range-slider-next-button")?this.handleClickSliderNextButton(e):this.handleCaptureClick(e)}isClickCapturedBySlider(e){return this.slideApi.WidgetRangeSlider.isClickCapturedBySlider(e)}destroy(){this.unregisterMouseAndTouchEvents()}handleClickSlider(e){e.navigationController.preventDefault()}handleCaptureClick(e){this.isClickCapturedBySlider(this.element)&&e.navigationController.preventDefault()}handleClickSliderNextButton(e){this.slideApi.WidgetRangeSlider.click(e.target),e.navigationController.preventDefault()}disableSwipeGesture(e){this.touchController.disable()}enableSwipeGesture(e){this.touchController.enable()}registerMouseAndTouchEvents(){this.slideContent.addEventListener("mouseup",this.enableSwipeGesture),this.slideContent.addEventListener("touchend",this.enableSwipeGesture),this.slideContent.addEventListener("mousedown",this.disableSwipeGesture),this.slideContent.addEventListener("touchstart",this.disableSwipeGesture)}unregisterMouseAndTouchEvents(){var e,t,r,i;null===(e=this.slideContent)||void 0===e||e.removeEventListener("mouseup",this.enableSwipeGesture),null===(t=this.slideContent)||void 0===t||t.removeEventListener("touchend",this.enableSwipeGesture),null===(r=this.slideContent)||void 0===r||r.removeEventListener("mousedown",this.disableSwipeGesture),null===(i=this.slideContent)||void 0===i||i.removeEventListener("touchstart",this.disableSwipeGesture)}}class Ca{constructor(e,t){Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-range-slider");return t?[new Oa(t,this.slideApi,this.touchController,e)]:[]}}class xa extends na{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetRate.init(this.element)}click(e){e.target.classList.contains("narrative-element-rate-input")&&(this.select(e.target),e.navigationController.preventDefault())}refreshUserData(){this.slideApi.WidgetRate.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetRate.select(e)}setUserData(e,t=""){this.slideApi.WidgetRate.setUserData(e,t)}}class ka{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-rate")).map((e=>new xa(e,this.slideApi)))}}class Pa extends na{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),this.handleShareComplete=this.handleShareComplete.bind(this),this.registerEvents()}async init(){this.slideApi.WidgetShare.init(this.element,Array.from(this.layers))}complete(e,t){this.slideApi.WidgetShare.complete(e,t)}refreshUserData(){this.slideApi.WidgetShare.onRefreshUserData(this.element)}click(e){this.element==e.target&&(this.slideApi.WidgetShare.click(e.target),e.navigationController.preventDefault())}destroy(){this.unregisterEvents()}registerEvents(){vi.on(`${Pa.name}.shareComplete`,this.handleShareComplete)}unregisterEvents(){vi.off(`${Pa.name}.shareComplete`,this.handleShareComplete)}handleShareComplete({shareId:e,result:t}){je(`[Share Widget]: share complete, { shareId, result }: ${e}, ${t}}`),this.complete(e,t)}}class ja{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=Array.from(e.querySelectorAll(".narrative-element-share")),r=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));return t.map((e=>new Pa(e,r,this.slideApi)))}}class Ma extends na{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){this.slideApi.WidgetTest.init(this.element)}refreshUserData(){this.slideApi.WidgetTest.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetTest.select(e)}slideTestIsDone(e){return this.slideApi.WidgetTest.slideTestIsDone(e)}slideTestWithTimer(e){return this.slideApi.WidgetTest.slideTestWithTimer(e)}click(e){e.target.classList.contains("narrative-element-test-next-button")?this.handleNextButton(e):e.target.classList.contains("narrative-element-test-answer")?this.handleAnswer(e):this.handleTestIsDone(e)}handleNextButton(e){this.story.nextSlide(),e.navigationController.preventDefault()}handleAnswer(e){this.select(e.target),e.navigationController.preventDefault()}handleTestIsDone(e){const t=this.slideTestIsDone(this.element);!this.slideTestWithTimer(this.element)||t?t||e.navigationController.disableNextClick():e.navigationController.preventDefault()}}class Ea{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){const t=e.querySelector(".narrative-element-test");return t?[new Ma(t,this.slideApi,this.story)]:[]}}class Ia extends na{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetVote.init(this.element);const e="narrative-element-quiz-next-button",t=this.element.querySelector(`.${e}`);t&&t.classList.remove(e)}refreshUserData(){this.slideApi.WidgetVote.onRefreshUserData(this.element)}select(e){this.slideApi.WidgetVote.select(e)}click(e){if(e.target.classList.contains("narrative-element-vote-next-button")){if(!this.slideApi.WidgetVote.click(e.target))return void e.navigationController.preventDefault()}e.target.classList.contains("narrative-element-vote-answer")&&(this.slideApi.WidgetVote.select(e.target),e.navigationController.preventDefault())}}class La{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-vote")).map((e=>new Ia(e,this.slideApi)))}}class Ta extends na{constructor(e,t){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetBarcode.init(this.element)}refreshUserData(){this.slideApi.WidgetBarcode.onRefreshUserData(this.element)}click(e){this.element==e.target&&(this.slideApi.WidgetBarcode.click(e.target),e.navigationController.preventDefault())}}class Aa{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){return Array.from(e.querySelectorAll(".narrative-element-barcode")).map((e=>new Ta(e,this.slideApi)))}}class Ra extends na{constructor(e,t){super(),Object.defineProperty(this,"elements",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}async init(){this.slideApi.WidgetMultiSlide.init(this.elements)}click(){}destroy(){}}class Da{constructor(e){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=Array.from(e.querySelectorAll(".narrative-slide.narrative-multi-slide"));return t.length?[new Ra(t,this.slideApi)]:[]}}var Ba;!function(e){e.TouchStart="touchStart",e.TouchMove="touchMove",e.TouchEnd="touchEnd",e.TouchMoveHorizontal="touchMoveHorizontal",e.TouchMoveVertical="touchMoveVertical",e.LongTouchDetected="longTouchDetected"}(Ba||(Ba={}));class Fa{constructor(e,t){Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t})}}class Na{constructor(e,t,r,i){Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"dx",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"dy",{enumerable:!0,configurable:!0,writable:!0,value:i})}}class Ua extends L.default{constructor(e){super(),Object.defineProperty(this,"$el",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"startPoint",{enumerable:!0,configurable:!0,writable:!0,value:new Fa(0,0)}),Object.defineProperty(this,"touchStartTimerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_isSwiping",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"touched",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_horizontalSwipeGesture",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_verticalSwipeGesture",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isLongTouch",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:{threshold:10,touchStartTimeout:-1}}),e&&(this.options=(0,yr.default)(this.options,e)),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}get isSwiping(){return this._isSwiping}get horizontalSwipeGesture(){return this._horizontalSwipeGesture}get verticalSwipeGesture(){return this._verticalSwipeGesture}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){this.$el&&(this.reset(),this.clearTouchStartTimeout(),this.$el.removeEventListener("touchstart",this.handleTouchStart),this.$el.removeEventListener("touchmove",this.handleTouchMove),this.$el.removeEventListener("touchend",this.handleTouchEnd),this.$el=null)}init(e){this.$el||(this.$el=e,this.$el.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),this.$el.addEventListener("touchmove",this.handleTouchMove,{passive:!0}),this.$el.addEventListener("touchend",this.handleTouchEnd))}handleTouchStart(e){e.stopPropagation(),this.enabled&&!this.touched&&(this.touched=!0,this.clearTouchStartTimeout(),this.startPoint=this.getPointByEvent(e),this.emit(Ba.TouchStart,new Na(this.startPoint.x,this.startPoint.y,0,0)),this.startTouchStartTimer(this.startPoint))}handleTouchMove(e){if(!this.touched)return;const t=this.getPointByEvent(e),r=this.getDeltaPoint(t),i=new Na(t.x,t.y,r.x,r.y);this.isThresholdExceed(r)&&(this._isSwiping=!0),this._isSwiping&&(this.emit(Ba.TouchMove,i),this.determineSwipeGestureDirection(r),this.handleHorizontalSwipeGesture(i),this.handleVerticalSwipeGesture(i))}isThresholdExceed(e){return Math.abs(e.x)>this.options.threshold||Math.abs(e.y)>this.options.threshold}handleTouchEnd(e){if(!this.touched)return;this._isLongTouch&&e.preventDefault(),e.stopPropagation(),this.clearTouchStartTimeout();const t=this.getPointByEvent(e),r=this.getDeltaPoint(t);this.emit(Ba.TouchEnd,new Na(t.x,t.y,r.x,r.y)),this.reset()}clearTouchStartTimeout(){this.touchStartTimerId&&(clearTimeout(this.touchStartTimerId),this.touchStartTimerId=null)}startTouchStartTimer(e){null!=this.options.touchStartTimeout&&-1!==this.options.touchStartTimeout&&(this.touchStartTimerId=setTimeout((()=>{this._isLongTouch=!0,this.emit(Ba.LongTouchDetected,e)}),this.options.touchStartTimeout))}getPointByEvent(e){if(e instanceof TouchEvent){const t=e.changedTouches[0];return new Fa(t.pageX,t.pageY)}return new Fa(e.pageX,e.pageY)}getDeltaPoint(e){const t=e.x-this.startPoint.x,r=e.y-this.startPoint.y;return new Fa(t,r)}determineSwipeGestureDirection(e){Math.abs(e.x)>Math.abs(e.y)?this._verticalSwipeGesture||(this._horizontalSwipeGesture=!0):this._horizontalSwipeGesture||(this._verticalSwipeGesture=!0)}handleVerticalSwipeGesture(e){this._verticalSwipeGesture&&this.emit(Ba.TouchMoveVertical,e)}handleHorizontalSwipeGesture(e){this._horizontalSwipeGesture&&this.emit(Ba.TouchMoveHorizontal,e)}reset(){this._isSwiping=!1,this.touched=!1,this._isLongTouch=!1,this._horizontalSwipeGesture=!1,this._verticalSwipeGesture=!1}}class Wa{constructor(e){let t;Object.defineProperty(this,"timeout_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getMountPoint",{enumerable:!0,configurable:!0,writable:!0,value:()=>document.body}),this.timeout_id=null,this.duration=3e3,this.content="",this.position="bottom",e&&"object"==typeof e&&(e.duration&&(this.duration="string"==typeof e.duration?parseFloat(e.duration):e.duration),e.content&&(this.content=e.content),e.getMountPoint&&(this.getMountPoint=e.getMountPoint),e.position&&(t=e.position.toLowerCase(),this.position="top"===t||"bottom"===t?t:"bottom"),this.show())}show(){var e;if(!this.content)return!1;this.timeout_id&&clearTimeout(this.timeout_id);const t=document.getElementById("toast_container");t&&(null===(e=t.parentNode)||void 0===e||e.removeChild(t));const r=document.createElement("div");r.setAttribute("id","toast_container"),r.setAttribute("class","toast_fadein");const i=document.createElement("div");i.setAttribute("id","toast"),r.appendChild(i);const a=document.createElement("span");return a.innerHTML=this.content,i.appendChild(a),this.getMountPoint().appendChild(r),this.timeout_id=window.setTimeout(this.hide,this.duration),!0}hide(){const e=document.getElementById("toast_container");if(!e)return!1;function t(){var e;const t=document.getElementById("toast_container");if(!t)return!1;null===(e=t.parentNode)||void 0===e||e.removeChild(t)}return this.timeout_id&&clearTimeout(this.timeout_id),e.className+=" toast_fadeout",e.addEventListener("webkitAnimationEnd",t),e.addEventListener("animationEnd",t),e.addEventListener("msAnimationEnd",t),e.addEventListener("oAnimationEnd",t),!0}}const za=(e=>{var t={};return A.d(t,e),t})({default:()=>g.default});class Va{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"debouncedTryEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:(0,za.default)((()=>{this.slider.notifyScrollEnd()}),200)}),this.handleScroll=this.handleScroll.bind(this),this.init(),this.addEventListeners()}destroy(){this.slider.getElementRef().removeEventListener("scroll",this.handleScroll)}init(){const e=this.slider.getElementRef();e.style.overflowX=this.slider.isHorizontal()?"scroll":"hidden",e.style.overflowY=this.slider.isHorizontal()?"hidden":"scroll"}addEventListeners(){this.slider.getElementRef().addEventListener("scroll",this.handleScroll)}scrollTo(e){const t=this.slider.getElementRef(),r=this.slider.dir===le.LTR?1:-1;t.scrollLeft=r*e.x,t.scrollTop=e.y}scrollWithAnimation(e,t){const r=this.slider.getElementRef(),i=this.slider.dir===le.LTR?1:-1;r.scrollTo({left:i*e.x,top:e.y,behavior:"smooth"})}stopAnimation(){}handleScroll(){this.slider.notifyScrollStart();const e=this.slider.getElementRef();this.slider.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.slider.testAttraction(e.scrollLeft,e.scrollTop),this.slider.emit("scroll",this.slider.getCurrentPosition()),this.debouncedTryEndScroll()}}class Ga{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lastClientX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastClientY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pushed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isAnimating",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debouncedTryAnimationEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:(0,za.default)((()=>{this.isAnimating=!1,this.slider.notifyScrollEnd()}),200)}),Object.defineProperty(this,"debouncedTryMouseWheelEndScroll",{enumerable:!0,configurable:!0,writable:!0,value:(0,za.default)((()=>{this.slider.notifyScrollEnd()}),200)}),this.handleScroll=this.handleScroll.bind(this),this.init(),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.addEventListeners()}init(){const e=this.slider.getElementRef();e.style.overflowX=this.slider.isHorizontal()?"scroll":"hidden",e.style.overflowY=this.slider.isHorizontal()?"hidden":"scroll"}addEventListeners(){const e=this.slider.getElementRef();e.addEventListener("scroll",this.handleScroll),e.addEventListener("mousedown",this.handleMouseDown,Fe),e.addEventListener("touchstart",this.handleMouseDown,Fe)}scrollTo(e){const t=this.slider.getElementRef(),r=this.slider.dir===le.LTR?1:-1;t.scrollLeft=r*e.x,t.scrollTop=e.y,this.slider.updatePosition(Math.abs(t.scrollLeft),Math.abs(t.scrollTop)),this.slider.testAttraction(t.scrollLeft,t.scrollTop),this.slider.emit("scroll",this.slider.getCurrentPosition())}scrollWithAnimation(e,t){this.isAnimating=!0;const r=this.slider.getElementRef(),i=this.slider.dir===le.LTR?1:-1;r.scrollTo({left:i*e.x,top:e.y,behavior:"smooth"})}stopAnimation(){}destroy(){const e=this.slider.getElementRef();e.removeEventListener("mousedown",this.handleMouseDown,Fe),e.removeEventListener("touchstart",this.handleMouseDown,Fe),e.removeEventListener("mouseup",this.handleMouseUp,Fe),e.removeEventListener("touchend",this.handleMouseUp,Fe),e.removeEventListener("mousemove",this.handleMouseMove,Fe),e.removeEventListener("touchmove",this.handleMouseMove,Fe),e.removeEventListener("scroll",this.handleScroll)}handleMouseDown(e){this.pushed=!0,this.isDragging=!1;const{clientX:t,clientY:r}=this.extractPointerPosition(e);this.lastClientX=t,this.lastClientY=r,window.addEventListener("mouseup",this.handleMouseUp,Fe),window.addEventListener("touchend",this.handleMouseUp,Fe),window.addEventListener("mousemove",this.handleMouseMove,Fe),window.addEventListener("touchmove",this.handleMouseMove,Fe)}handleMouseUp(){this.pushed&&(this.pushed=!1,this.isDragging=!1,this.slider.notifyScrollEnd(),window.removeEventListener("mouseup",this.handleMouseUp,Fe),window.removeEventListener("touchend",this.handleMouseUp,Fe),window.removeEventListener("mousemove",this.handleMouseMove,Fe),window.removeEventListener("touchmove",this.handleMouseMove,Fe))}handleMouseMove(e){if(!this.pushed)return;const{clientX:t,clientY:r}=this.extractPointerPosition(e),i=t-this.lastClientX,a=r-this.lastClientY;this.lastClientX=t,this.lastClientY=r;const{x:s,y:n}=this.slider.preparePosition(this.slider.getCurrentPosition().x-i,this.slider.getCurrentPosition().y-a);!this.isDragging&&(Math.abs(i)>=1||Math.abs(a)>=1)&&(this.isDragging=!0),this.isDragging&&this.scrollTo({x:s,y:n})}extractPointerPosition(e){return e instanceof MouseEvent?{clientX:e.clientX,clientY:e.clientY}:{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}handleScroll(){this.isDragging?this.handleScrollByDraggable():this.isAnimating?this.handleScrollByAnimation():this.handleScrollByMouseWheel()}handleScrollByMouseWheel(){this.slider.notifyScrollStart();const e=this.slider.getElementRef();this.slider.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.slider.testAttraction(e.scrollLeft,e.scrollTop),this.slider.emit("scroll",this.slider.getCurrentPosition()),this.debouncedTryMouseWheelEndScroll()}handleScrollByDraggable(){this.slider.notifyScrollStart()}handleScrollByAnimation(){if(!this.isAnimating)return;this.slider.notifyScrollStart();const e=this.slider.getElementRef();this.slider.updatePosition(Math.abs(e.scrollLeft),Math.abs(e.scrollTop)),this.slider.testAttraction(e.scrollLeft,e.scrollTop),this.slider.emit("scroll",this.slider.getCurrentPosition()),this.debouncedTryAnimationEndScroll()}}var $a;!function(e){e.Horizontal="horizontal",e.Vertical="vertical"}($a||($a={}));class Ha extends L.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"scrollStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isScrolling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPosition",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"direction",{enumerable:!0,configurable:!0,writable:!0,value:$a.Horizontal}),Object.defineProperty(this,"gap",{enumerable:!0,configurable:!0,writable:!0,value:20}),Object.defineProperty(this,"_reachStart",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_reachEnd",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_dir",{enumerable:!0,configurable:!0,writable:!0,value:le.LTR})}get isScrolling(){return this._isScrolling}get slides(){return this.slider.children[0]instanceof HTMLSlotElement?this.slider.children[0].assignedElements({flatten:!1}):Array.from(this.slider.children)}get elementRef(){return this.slider}get reachStart(){return this._reachStart}get reachEnd(){return this._reachEnd}get scrollWidth(){return this.slider.scrollWidth}get dir(){return this._dir}mount(e){this.slider=e,this.changeScrollStrategy()}destroy(){this.removeAllListeners(),this.scrollStrategy.destroy()}getLength(){var e,t;return null!==(t=null===(e=this.slider)||void 0===e?void 0:e.children.length)&&void 0!==t?t:0}changeDirection(e){this.direction=e,this.scrollTo(0,0),this.changeScrollStrategy()}setGap(e){this.gap=e}setDesktopMode(e){this.desktopMode=e,this.changeScrollStrategy()}getGap(){return this.gap}scrollTo(e,t=300){e=Math.trunc(e);const r=this.preparePosition(e,e);this.isTheSamePosition(r.x,r.y)||(t>0?this.scrollStrategy.scrollWithAnimation(r,t):this.scrollStrategy.scrollTo(r))}isHorizontal(){return this.direction===$a.Horizontal}updatePosition(e,t){this.currentPosition={x:Math.trunc(e),y:Math.trunc(t)}}getElementRef(){return this.slider}getCurrentPosition(){return this.currentPosition}preparePosition(e,t){let r={x:e,y:t};return this.isHorizontal()?r.y=0:r.x=0,this.attractToBounds(r.x,r.y)}attractToBounds(e,t){return{x:this.attractToBoundsByX(e),y:this.attractToBoundsByY(t)}}attractToBoundsByX(e){return e<=0?0:e+this.slider.clientWidth>=this.slider.scrollWidth?this.slider.scrollWidth-this.slider.clientWidth:e}attractToBoundsByY(e){return e<=0?0:e+this.slider.clientHeight>=this.slider.scrollHeight?this.slider.scrollHeight-this.slider.clientHeight:e}testAttraction(e,t){const r=e+this.slider.clientWidth>=Math.max(this.slider.scrollWidth-1,0),i=t+this.slider.clientHeight>=Math.max(this.slider.scrollHeight-1,0);this._reachStart=e<=0&&t<=0,this._reachEnd=this.isHorizontal()?r:i,this.emit("reachStart",this._reachStart),this.emit("reachEnd",this._reachEnd)}setTextDirection(e){this._dir=e}scrollBySlideIndex(e,t){this.isHorizontal()?this.scrollTo(this.slides[e].offsetLeft,t):this.scrollTo(this.slides[e].offsetTop,t)}scrollByDirection(e,t){const{x:r,y:i}=this.getCurrentPosition(),a=this.isHorizontal()?r:i,s=this.getSlidesPerView(),n=this.getStoryWidth(),o=this.getStoryHeight(),l=a+e*s*(this.isHorizontal()?n:o);this.scrollTo(l,t)}notifyScrollStart(){this.isScrolling||(this._isScrolling=!0,this.emit("scrollstart",this.currentPosition))}notifyScrollEnd(){this.isScrolling&&(this._isScrolling=!1,this.emit("scrollend",this.currentPosition))}async waitStoryListClientWidth(){const e=t=>{this.elementRef.clientWidth>0?t():requestAnimationFrame((()=>e(t)))};return new Promise((t=>{requestAnimationFrame((()=>e(t)))}))}isTheSamePosition(e,t){return e===this.currentPosition.x&&t===this.currentPosition.y}getSlidesPerView(){if(this.isHorizontal()&&this.slider.clientWidth){const e=this.slider.children[0].clientWidth+this.gap;return Math.round(this.slider.clientWidth/e)}if(!this.isHorizontal()&&this.slider.clientHeight){const e=this.slider.children[0].clientHeight+this.gap;return Math.round(this.slider.clientHeight/e)}return 1}getStoryWidth(){var e;return(null===(e=this.slides[0])||void 0===e?void 0:e.clientWidth)+this.gap}getStoryHeight(){var e;return(null===(e=this.slides[0])||void 0===e?void 0:e.clientHeight)+this.gap}changeScrollStrategy(){this.scrollStrategy&&this.scrollStrategy.destroy(),this.scrollStrategy=this.desktopMode?new Ga(this):new Va(this)}}const qa=45,Qa=350,Ka="linear",Ya=1.6,Ja=2*Math.tan(qa*Math.PI/360),Za=Qa/1e3;class Xa{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"newAngle",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"angleDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"normalizedShift",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"movementStartAt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_currentAngle",{enumerable:!0,configurable:!0,writable:!0,value:0})}get currentAngle(){return this._currentAngle}get perspective(){return 0}get depth(){return 0}startMove(){this.newAngle=0,this.angleDelta=0,this.normalizedShift=0,this.movementStartAt=Date.now()}move(e){this.normalizedShift=e/this.slider.clientWidth*Ya,this.newAngle=this._currentAngle+this.normalizedShift*qa,this.angleDelta=this.newAngle-this._currentAngle}endMove(){if(!this.normalizedShift)return;let e=Math.round(this.angleDelta/qa);e=this.limitByFastMovement(e),e=this.limitBySliderEdges(e),this.slider.emit("touchEnd",e)}limitByFastMovement(e){return this.isFastMovement(e)?this.normalizedShift<0?-1:1:e}isFastMovement(e){return Date.now()-this.movementStartAt<=500&&0===e}limitBySliderEdges(e){return e<0&&this.slider.isBeginning||e>0&&this.slider.isEnd?0:e}}const es=.05;class ts extends Xa{init(){this._currentAngle=this.slider.currentIndex*qa}transform(e){const t=this.slider.leftElement,r=this.slider.rightElement,i=this.slider.frontElement;null==t||t.style.setProperty("transform",`translateZ(0) translateX(${-100*(.1- -1*e/10)}%) scale(${Math.min(.9+-1*e/10,1)})`),null==r||r.style.setProperty("transform",`translateZ(0) translateX(${100*(1-e)}%)`),null==i||i.style.setProperty("transform",`translateZ(0) translateX(${e<=0?-100*e:-100*(0- -1*e/10)}%) scale(${e<=0?1:1+-1*e/10})`)}move(e){super.move(e),this.normalizedShift=this.applyBoundsConstraint(this.normalizedShift),this.transform(this.normalizedShift)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"inherit",transform:`translateZ(0) translateX(${0===e?-10:-100*t+100*e}%) scale(${0===e?.9:1})`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=es&&this.slider.isEnd?es:e<=-.05&&this.slider.isBeginning?-.05:e:e}}const rs=.05;class is extends Xa{init(){this._currentAngle=this.slider.currentIndex*qa}transform(e){const t=this.slider.leftElement,r=this.slider.rightElement,i=this.slider.frontElement;null==t||t.style.setProperty("transform",`translateZ(0) translateX(${-100*(1+e)}%)`),null==r||r.style.setProperty("transform",`translateZ(0) translateX(${100*(1-e)}%)`),null==i||i.style.setProperty("transform",`translateZ(0) translateX(${-100*e}%)`)}move(e){super.move(e),this.normalizedShift=this.applyBoundsConstraint(this.normalizedShift),this.transform(this.normalizedShift)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"inherit",transform:`translateZ(0) translateX(${-100*t+100*e}%)`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=rs&&this.slider.isEnd?rs:e<=-.05&&this.slider.isBeginning?-.05:e:e}}class as extends Xa{get perspective(){return this.slider.clientWidth*Ya}get depth(){return this.slider.clientWidth/Ja}init(){this.transform(this.slider.currentIndex)}async transform(e){this._currentAngle=this._currentAngle+e*qa,this.slider.setTransform(`rotateY(${-this._currentAngle}deg)`)}move(e){super.move(e),this.newAngle=this.applyBoundsConstraint(this.angleDelta),this.slider.setTransform(`rotateY(${-this.newAngle}deg)`)}getCSSStyle(e,t){return{display:Math.abs(e-t)<=1?"block":"none",transition:"",transform:"rotateY("+e*qa+`deg) translateZ(${this.depth}px)`}}applyBoundsConstraint(e){return this.slider.isBeginning||this.slider.isEnd?e>=5&&this.slider.isEnd?this._currentAngle+5:e<=-5&&this.slider.isBeginning?this._currentAngle-5:this.newAngle:this.newAngle}}class ss{static create(e,t){switch(t){case X.FLAT:return new is(e);case X.COVER:return new ts(e);case X.CUBE:return new as(e);default:return new is(e)}}}var ns=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},os=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},ls=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},ds=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let cs=(()=>{var e,t,r,i;let a,s,n,o,l,d,c,u,h,p,g,f,m,v,b,y,w,S=L.EventEmitter,_=[],O=[],C=[],x=[],k=[],P=[],j=[];return e=class extends S{constructor(){super(...arguments),t.set(this,(ns(this,_),ns(this,O,!1))),r.set(this,(ns(this,C),ns(this,x,0))),i.set(this,(ns(this,k),ns(this,P,null))),Object.defineProperty(this,"$el",{enumerable:!0,configurable:!0,writable:!0,value:ns(this,j)})}get _animating(){return ls(this,t,"f")}set _animating(e){ds(this,t,e,"f")}get _currentIndex(){return ls(this,r,"f")}set _currentIndex(e){ds(this,r,e,"f")}get effect(){return ls(this,i,"f")}set effect(e){ds(this,i,e,"f")}get clientWidth(){return this.$el.clientWidth}get animating(){return this._animating}get leftElement(){return this.$el.children.item(this._currentIndex-1)}get rightElement(){return this.$el.children.item(this._currentIndex+1)}get frontElement(){return this.$el.children.item(this._currentIndex)}get isBeginning(){return this._currentIndex-1==0}get isEnd(){return this._currentIndex+1===this.$el.children.length-1}get perspective(){var e,t;return null!==(t=null===(e=this.effect)||void 0===e?void 0:e.perspective)&&void 0!==t?t:0}get depth(){var e,t;return null!==(t=null===(e=this.effect)||void 0===e?void 0:e.depth)&&void 0!==t?t:0}get currentIndex(){return this._currentIndex}set currentIndex(e){this._currentIndex=e}getCSSStyle(e,t){var r,i;return null!==(i=null===(r=this.effect)||void 0===r?void 0:r.getCSSStyle(e,t))&&void 0!==i?i:{}}init({$el:e,transformStyle:t}){this.$el=e,this.effect=ss.create(this,t),this.effect.init(),this.setTransition("transform 0s"),this.updateSlidesStyle(0)}async transformWithAmimation(e){this.emit("transitionStart"),this._animating=!0,this.setTransition(`transform ${Za}s ${Ka}`),this.effect.transform(e),await this.waitTransitionEnd(),this.updateSlidesStyle(e),this._animating=!1,this.emit("transitionEnd")}startMove(){this.effect.startMove()}move(e){this._animating=!0,this.emit("touchMove"),this.effect.move(e)}endMove(){this._animating=!1,this.effect.endMove()}setTransform(e){this.$el.style.setProperty("transform",e)}updateSlidesStyle(e){const t=Array.from(this.$el.children);for(let r=0;r<t.length;r++){const i=t[r],a=this.effect.getCSSStyle(r,this.currentIndex+e);i.style.display=a.display,i.style.transform=a.transform,i.style.transition=a.transition}}setTransition(e){this.$el.style.setProperty("transition",e)}waitTransitionEnd(){return new Promise((e=>{const t=r=>{Math.round(100*r.elapsedTime)/100===Za&&"transform"===r.propertyName&&(this.setTransition("transform 0s"),this.$el.removeEventListener("transitionend",t),e())};this.$el.addEventListener("transitionend",t)}))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=S[Symbol.metadata])&&void 0!==t?t:null):void 0;a=[Me.observable],s=[Me.observable],n=[Me.observable],o=[Me.computed],l=[Me.computed],d=[Me.computed],c=[Me.computed],u=[Me.computed],h=[Me.computed],p=[Me.computed],g=[Me.computed],f=[Me.computed],m=[Me.action],v=[Me.action],b=[Me.action],y=[Me.action],w=[Me.action],os(e,null,a,{kind:"accessor",name:"_animating",static:!1,private:!1,access:{has:e=>"_animating"in e,get:e=>e._animating,set:(e,t)=>{e._animating=t}},metadata:r},O,C),os(e,null,s,{kind:"accessor",name:"_currentIndex",static:!1,private:!1,access:{has:e=>"_currentIndex"in e,get:e=>e._currentIndex,set:(e,t)=>{e._currentIndex=t}},metadata:r},x,k),os(e,null,n,{kind:"accessor",name:"effect",static:!1,private:!1,access:{has:e=>"effect"in e,get:e=>e.effect,set:(e,t)=>{e.effect=t}},metadata:r},P,j),os(e,null,o,{kind:"getter",name:"animating",static:!1,private:!1,access:{has:e=>"animating"in e,get:e=>e.animating},metadata:r},null,_),os(e,null,l,{kind:"getter",name:"leftElement",static:!1,private:!1,access:{has:e=>"leftElement"in e,get:e=>e.leftElement},metadata:r},null,_),os(e,null,d,{kind:"getter",name:"rightElement",static:!1,private:!1,access:{has:e=>"rightElement"in e,get:e=>e.rightElement},metadata:r},null,_),os(e,null,c,{kind:"getter",name:"frontElement",static:!1,private:!1,access:{has:e=>"frontElement"in e,get:e=>e.frontElement},metadata:r},null,_),os(e,null,u,{kind:"getter",name:"isBeginning",static:!1,private:!1,access:{has:e=>"isBeginning"in e,get:e=>e.isBeginning},metadata:r},null,_),os(e,null,h,{kind:"getter",name:"isEnd",static:!1,private:!1,access:{has:e=>"isEnd"in e,get:e=>e.isEnd},metadata:r},null,_),os(e,null,p,{kind:"getter",name:"perspective",static:!1,private:!1,access:{has:e=>"perspective"in e,get:e=>e.perspective},metadata:r},null,_),os(e,null,g,{kind:"getter",name:"depth",static:!1,private:!1,access:{has:e=>"depth"in e,get:e=>e.depth},metadata:r},null,_),os(e,null,f,{kind:"getter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,get:e=>e.currentIndex},metadata:r},null,_),os(e,null,m,{kind:"setter",name:"currentIndex",static:!1,private:!1,access:{has:e=>"currentIndex"in e,set:(e,t)=>{e.currentIndex=t}},metadata:r},null,_),os(e,null,v,{kind:"method",name:"init",static:!1,private:!1,access:{has:e=>"init"in e,get:e=>e.init},metadata:r},null,_),os(e,null,b,{kind:"method",name:"transformWithAmimation",static:!1,private:!1,access:{has:e=>"transformWithAmimation"in e,get:e=>e.transformWithAmimation},metadata:r},null,_),os(e,null,y,{kind:"method",name:"move",static:!1,private:!1,access:{has:e=>"move"in e,get:e=>e.move},metadata:r},null,_),os(e,null,w,{kind:"method",name:"endMove",static:!1,private:!1,access:{has:e=>"endMove"in e,get:e=>e.endMove},metadata:r},null,_),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();var us;!function(e){e.Open="open"}(us||(us={}));class hs extends na{constructor(e,t,r,i,a){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"swipeUpGoodsWidgetHandlers",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_swipeUpLinkTarget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_swipeUpElementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"eventEmitter",{enumerable:!0,configurable:!0,writable:!0,value:new L.EventEmitter}),this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this),this.handleClick=this.handleClick.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}get targetUrl(){var e;return decodeURIComponent(null!==(e=this._swipeUpLinkTarget)&&void 0!==e?e:"")}get elementId(){return this._swipeUpElementId}async init(){var e,t;this._swipeUpLinkTarget=decodeURIComponent(null!==(e=this.element.getAttribute("data-link-target"))&&void 0!==e?e:""),this._swipeUpElementId=null!==(t=this.element.getAttribute("data-element-id"))&&void 0!==t?t:void 0,this.registerEvents()}click(e){}destroy(){this.unregisterEvents()}close(){var e;null===(e=this.touchController)||void 0===e||e.enable(),this.swipeUpGoodsWidgetHandlers.onClose(),this.setGoodsElementOpacity(1)}on(e,t){this.eventEmitter.on(e,t)}off(e,t){this.eventEmitter.off(e,t)}registerEvents(){var e;this.touchController.on(Ba.TouchEnd,this.handleTouchEnd),null===(e=this.element)||void 0===e||e.addEventListener("click",this.handleClick)}unregisterEvents(){var e;this.touchController.off(Ba.TouchEnd,this.handleTouchEnd),null===(e=this.element)||void 0===e||e.removeEventListener("click",this.handleClick)}handleClick(e){e.preventDefault(),e.stopPropagation(),this.open()}handleSwipeUpGesture(){this.open()}handleTouchEnd({dy:e}){this.touchController&&e<10&&this.touchController.verticalSwipeGesture&&this.handleSwipeUpGesture()}open(){var e;this._swipeUpLinkTarget&&this.slideContent&&this._swipeUpElementId&&(null===(e=this.touchController)||void 0===e||e.disable(),this.swipeUpGoodsWidgetHandlers.onOpen(),this.eventEmitter.emit(us.Open),this.setGoodsElementOpacity(0))}setGoodsElementOpacity(e){var t;const r=null===(t=this.slideContent)||void 0===t?void 0:t.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);r&&r.style.setProperty("display",e>0?"block":"none")}}class ps{constructor(e,t,r){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"swipeUpGoodsWidgetHandlers",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e){const t=e.querySelector(".narrative-element-swipe-up-items");return t?[new hs(t,this.slideApi,this.touchController,this.swipeUpGoodsWidgetHandlers,e)]:[]}}class gs extends na{constructor(e,t,r,i,a){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"linkClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_swipeUpLinkTarget",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_swipeUpElementId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.handleSwipeUpGesture=this.handleSwipeUpGesture.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}get swipeUpLinkTarget(){return this._swipeUpLinkTarget}get swipeUpElementId(){return this._swipeUpElementId}async init(){var e,t,r;this._swipeUpLinkTarget=decodeURIComponent(null!==(e=this.element.getAttribute("data-link-target"))&&void 0!==e?e:""),this._swipeUpElementId=null!==(t=this.element.getAttribute("data-element-id"))&&void 0!==t?t:void 0,null===(r=this.touchController)||void 0===r||r.on(Ba.TouchEnd,this.handleTouchEnd)}click(e){e.target.classList.contains("narrative-element-swipe-up")&&(e.navigationController.preventDefault(),this.linkClickHandler.onLinkClick({widget:this,target:e.target}))}destroy(){var e;null===(e=this.touchController)||void 0===e||e.off(Ba.TouchEnd,this.handleTouchEnd)}handleSwipeUpGesture(){if(!this._swipeUpLinkTarget||!this.slideContent||!this._swipeUpElementId)return;const e=this.slideContent.querySelector(`[data-element-id="${this._swipeUpElementId}"]`);e&&this.linkClickHandler.onLinkClick({widget:this,target:e})}handleTouchEnd({dy:e}){this.touchController&&e<10&&this.touchController.verticalSwipeGesture&&this.handleSwipeUpGesture()}}class fs{constructor(e,t,r){Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"linkClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e){const t=e.querySelector(".narrative-element-swipe-up");return t?[new gs(t,this.slideApi,this.touchController,this.linkClickHandler,e)]:[]}}var ms;!function(e){e[e.None=0]="None",e[e.DisableNext=1]="DisableNext",e[e.DisablePrev=2]="DisablePrev"}(ms||(ms={}));class vs{constructor(e,t,r,i,a){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"event",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"geometry",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"dir",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_mode",{enumerable:!0,configurable:!0,writable:!0,value:ms.None}),Object.defineProperty(this,"_defaultPrevented",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_direction",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._direction=this.calcDirection()}get mode(){return this._mode}get direction(){return this._direction}get defaultPrevented(){return this._defaultPrevented||this.slide.navigationDisabled}get navigationDisabled(){return this.slide.navigationDisabled}preventDefault(){this._defaultPrevented=!0}disableNextClick(){this._mode=ms.DisableNext}navigate(){this.direction<0?this.toPrev():this.mode!==ms.DisableNext&&this.toNext()}toPrev(){this.dir===le.LTR?this.prevSlideOrStory():this.nextSlideOrStory()}toNext(){this.dir===le.LTR?this.nextSlideOrStory():this.prevSlideOrStory()}prevSlideOrStory(){this.slide.story.reachStart?this.slide.story.prevStory():this.slide.story.prevSlide()}nextSlideOrStory(){this.slide.story.reachEnd?this.slide.story.nextStory():this.slide.story.nextSlide()}calcClickPosition(){var e;let t=0,r=0;return this.desktopMode?(t=this.geometry.calculateWidth(),r=this.event.nativeEvent.offsetX):(t=this.geometry.vw,r=this.event.nativeEvent.pageX||(null===(e=this.event.nativeEvent.touches)||void 0===e?void 0:e[0].pageX)),r/t}calcDirection(){return this.calcClickPosition()<=.3?-1:1}}var bs;!function(e){e.Idle="idle",e.Init="init",e.StartLoading="startLoading",e.Loading="loading",e.Loaded="loaded",e.Starting="starting",e.Started="started",e.Paused="paused",e.Error="error",e.Destroyed="destroyed"}(bs||(bs={}));const ys={step:1,maxSteps:100};class ws{constructor(e,t={}){Object.defineProperty(this,"elements",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"handleWindowResize",{enumerable:!0,configurable:!0,writable:!0,value:(0,za.default)((()=>{this.fit(this.elements)}),300)}),this.elements=e,this.settings=Object.assign(Object.assign({},ys),t)}async fit(e){for(const t of e)this.processElement(t)}start(){window.addEventListener("resize",this.handleWindowResize)}destroy(){window.removeEventListener("resize",this.handleWindowResize)}processElement(e){const t=e.parentElement;if(!t)return;const r=e.style.fontSize;e.style.fontSize="";const i=this.calculateInnerHeight(t);if(i<=0)return console.warn(`Set a static height and width on the target element ${e.outerHTML} before using textFit!`,e),void(e.style.fontSize=r);this.adjustFontSizeToFit(e,i)}calculateInnerHeight(e){const t=window.getComputedStyle(e);return e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)}adjustFontSizeToFit(e,t){let r=parseFloat(window.getComputedStyle(e).fontSize);const i=r-this.settings.step*this.settings.maxSteps;for(;r>=i;){if(!(e.clientHeight>t))break;r-=this.settings.step,e.style.fontSize=`${r}px`}}}var Ss=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},_s=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Os=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Cs=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let xs=(()=>{var e,t,r,i;let a,s,n,o,l,d,c,u,h,p,g=[],f=[],m=[],v=[],b=[],y=[],w=[];return e=class{get _state(){return Os(this,t,"f")}set _state(e){Cs(this,t,e,"f")}get _muted(){return Os(this,r,"f")}set _muted(e){Cs(this,r,e,"f")}get _textFitted(){return Os(this,i,"f")}set _textFitted(e){Cs(this,i,e,"f")}constructor(e,a,s,n,o){Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:(Ss(this,g),e)}),Object.defineProperty(this,"widgetManager",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"animationApi",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"layersManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"slideElement",{enumerable:!0,configurable:!0,writable:!0,value:o}),t.set(this,Ss(this,f,bs.Idle)),Object.defineProperty(this,"videoContext",{enumerable:!0,configurable:!0,writable:!0,value:(Ss(this,m),null)}),Object.defineProperty(this,"narrativeAnimationContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.set(this,Ss(this,v,!1)),i.set(this,(Ss(this,b),Ss(this,y,!1))),Object.defineProperty(this,"_navigationDisabled",{enumerable:!0,configurable:!0,writable:!0,value:(Ss(this,w),!1)}),Object.defineProperty(this,"slideContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mutex",{enumerable:!0,configurable:!0,writable:!0,value:new ia.Mutex}),Object.defineProperty(this,"autoTextFitter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"handleVideoPlaying",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.context.onSlideResume()}}),Object.defineProperty(this,"handleVideoWaiting",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.context.onSlidePause()}}),Object.defineProperty(this,"handleVideoError",{enumerable:!0,configurable:!0,writable:!0,value:async()=>{const e=await this.mutex.acquire();try{if(this.state===bs.Idle)return;this.context.onSlideVideoError(),this.setState(bs.Error)}catch(e){console.error(e)}finally{e()}}}),this.narrativeAnimationContext=new Ki(this.animationApi)}get $el(){return this.slideContent}get widgets(){return this.widgetManager.widgets}get state(){return this._state}get muted(){return this._muted}get navigationDisabled(){return this._navigationDisabled}get textFitted(){return this._textFitted}async resume(){var e;const t=await this.mutex.acquire();try{if(this.state!==bs.Paused)return;await(null===(e=this.videoContext)||void 0===e?void 0:e.resume()),this.narrativeAnimationContext.resume(),this.widgetManager.resume(),this.context.onSlideResume(),this.setState(bs.Started),t()}catch(e){console.error(e)}finally{t()}}async pause(){var e;const t=await this.mutex.acquire();try{if(this.state!==bs.Started)return;null===(e=this.videoContext)||void 0===e||e.pause(),this.narrativeAnimationContext.pause(),this.widgetManager.pause(),this.context.onSlidePause(),this.setState(bs.Paused),t()}finally{t()}}mute(){var e;this._muted=!0,null===(e=this.videoContext)||void 0===e||e.mute()}unmute(){var e;this._muted=!1,null===(e=this.videoContext)||void 0===e||e.unmute()}async onClick({target:e,navigationController:t}){tn.is(e)?this.slideElement.click(e):(await this.widgetManager.handleWidgetClick(e,t),t.defaultPrevented||t.navigate())}onClickLinkElement(e){this.slideElement.click(e)}async reload(){const e=await this.mutex.acquire();this.setState(bs.Idle),e()}async init(e){const t=await this.mutex.acquire();try{if(this._state!==bs.Idle)return;this.setState(bs.Init),this.slideContent=e,this.parseNavigationDisable(),this.narrativeAnimationContext.init(e),this.context.onSlideBeforeInit(),await this.initLayersAndWidgetManager(e);const t=this.layersManager.activeLayer?this.layersManager.activeLayer:this.slideContent;this.videoContext=await this.createVideoContext(t),this.context.onSlideAfterInit(),await this.load()}catch(e){console.error(e),this.setState(bs.Error)}finally{t()}}async start(){var e,t;const r=await this.mutex.acquire();try{if(this.state===bs.Idle||this.state===bs.Started)return;this.setState(bs.Starting),await(null===(e=this.videoContext)||void 0===e?void 0:e.start()),await this.context.onSlideStarted(),this.narrativeAnimationContext.start(),null===(t=this.autoTextFitter)||void 0===t||t.start(),this.setState(bs.Started)}catch(e){console.error(e),this.setState(bs.Error)}finally{r()}}async stop(){const e=await this.mutex.acquire();try{if(this.state!==bs.Started&&this.state!==bs.Error)return;this.context.onSlideStop(),this.narrativeAnimationContext.stop(),this.widgetManager.stop(),this.destroyAutoTextFitter(),this.layersManager.reset(),await this.destroyVideoContext(),this.setState(bs.Idle)}catch(e){console.error(e),this.setState(bs.Error)}finally{e()}}async destroy(){const e=await this.mutex.acquire();try{if(this.state===bs.Idle)return;this.context.onSlideDestroy(),this.narrativeAnimationContext.stop(),this.widgetManager.stop(),this.destroyAutoTextFitter(),this.layersManager.reset(),await this.destroyVideoContext()}catch(e){console.error(e)}finally{this.setState(bs.Idle),e()}}findAllWidgetsOfType(e){return this.widgetManager.findAllOfType(e)}refreshWidgetsData(){this.widgetManager.refreshUserData()}destroyAutoTextFitter(){var e;null===(e=this.autoTextFitter)||void 0===e||e.destroy(),this.autoTextFitter=null}async showLayerByIndex(e){const t=this.layersManager.showLayerByIndex(e);if(!t)return;const r=await this.mutex.acquire();try{this.videoContext=await this.createVideoContext(t),await this.videoContext.load(),await this.videoContext.start()}catch(e){throw this.layersManager.reset(),console.error(e),this.setState(bs.Error),e}finally{r()}}async fitContentFontSize(){if(this.autoTextFitter)return;this._textFitted=!1,await this.loadFonts();const e=Array.from(this.slideContent.querySelectorAll(".narrative-element-text-wrapper>.narrative-element-text-lines"));this.autoTextFitter=new ws(e),this.autoTextFitter.fit(e),this._textFitted=!0}async initLayersAndWidgetManager(e){this.layersManager.init(e,this.animationApi),await this.widgetManager.init(this.slideContent),this.layersManager.init(e,this.animationApi)}setState(e){this._state=e,this.context.onSlideStateChanged(e)}async load(){if(this.state!==bs.Loaded)try{this.context.onSlideLoadStart(),this.setState(bs.StartLoading),await this.loadResources(),this.setState(bs.Loaded),this.context.onSlideLoadEnd()}catch(e){console.error(e),this.setState(bs.Error)}}async loadResources(){return new Promise((async(e,t)=>{var r;let i=setTimeout((()=>{t("[IAM]: Media resources were not loaded")}),1e4);try{await this.fitContentFontSize(),await this.loadMediaResources(this.slideContent),await(null===(r=this.videoContext)||void 0===r?void 0:r.load()),e()}catch(e){t(e)}finally{clearTimeout(i)}}))}loadFonts(){return new Promise((e=>{"fonts"in document?document.fonts.ready&&document.fonts.ready.catch(e).finally(e):e()}))}loadMediaResources(e){return new Promise(((t,r)=>function(e,t,r){const i=function(e){return new Promise((function(t,r){if("img"===e.tagName.toLowerCase()&&e instanceof HTMLImageElement){const r=()=>{requestAnimationFrame((()=>requestAnimationFrame((()=>{t(e),e.removeEventListener("load",r)}))))};e.addEventListener("load",r),e.complete&&0!==e.naturalHeight&&requestAnimationFrame((function(){requestAnimationFrame((function(){t(e)}))}))}else t(e);e.addEventListener("error",(function(e){var t=e.target instanceof HTMLImageElement;if(e&&e.target&&t&&e.target.style){e.target.style.display="none";var i=e.target.closest(".narrative-element-image");i&&(i.style.display="none")}r(e)}))}))},a=e.querySelectorAll("img,video");let s,n=[];for(s=0;s<a.length;++s)n.push(i(a[s]));n.length,Promise.all(n).then((e=>{t()})).catch(r)}(e,t,r)))}parseNavigationDisable(){const e=this.slideContent.querySelector(".narrative-slide");if(!e)return!1;this._navigationDisabled="1"===e.dataset.disableNavigation}async createVideoContext(e){await this.destroyVideoContext();const t=new ta(e,this._muted);return t.on(Ji.Playing,this.handleVideoPlaying),t.on(Ji.Waiting,this.handleVideoWaiting),t.on(Ji.Error,this.handleVideoError),t}async destroyVideoContext(){this.videoContext&&(this.videoContext.off(Ji.Playing,this.handleVideoPlaying),this.videoContext.off(Ji.Waiting,this.handleVideoWaiting),this.videoContext.off(Ji.Waiting,this.handleVideoError),await this.videoContext.destroy())}},t=new WeakMap,r=new WeakMap,i=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;a=[Me.observable],s=[Me.observable],n=[Me.observable],o=[Me.action],l=[Me.action],d=[Me.action],c=[Me.action],u=[Me.action],h=[Me.action],p=[Me.action],_s(e,null,a,{kind:"accessor",name:"_state",static:!1,private:!1,access:{has:e=>"_state"in e,get:e=>e._state,set:(e,t)=>{e._state=t}},metadata:t},f,m),_s(e,null,s,{kind:"accessor",name:"_muted",static:!1,private:!1,access:{has:e=>"_muted"in e,get:e=>e._muted,set:(e,t)=>{e._muted=t}},metadata:t},v,b),_s(e,null,n,{kind:"accessor",name:"_textFitted",static:!1,private:!1,access:{has:e=>"_textFitted"in e,get:e=>e._textFitted,set:(e,t)=>{e._textFitted=t}},metadata:t},y,w),_s(e,null,o,{kind:"method",name:"resume",static:!1,private:!1,access:{has:e=>"resume"in e,get:e=>e.resume},metadata:t},null,g),_s(e,null,l,{kind:"method",name:"pause",static:!1,private:!1,access:{has:e=>"pause"in e,get:e=>e.pause},metadata:t},null,g),_s(e,null,d,{kind:"method",name:"mute",static:!1,private:!1,access:{has:e=>"mute"in e,get:e=>e.mute},metadata:t},null,g),_s(e,null,c,{kind:"method",name:"unmute",static:!1,private:!1,access:{has:e=>"unmute"in e,get:e=>e.unmute},metadata:t},null,g),_s(e,null,u,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:t},null,g),_s(e,null,h,{kind:"method",name:"stop",static:!1,private:!1,access:{has:e=>"stop"in e,get:e=>e.stop},metadata:t},null,g),_s(e,null,p,{kind:"method",name:"setState",static:!1,private:!1,access:{has:e=>"setState"in e,get:e=>e.setState},metadata:t},null,g),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class ks{constructor(e){Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){this.storyReader.close()}}class Ps{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const t=e.linkTarget;this.emitWidgetLinkEvent(t,e),this.activeStory.markAsOpened(),vi.emit(Li.TransitionFromSlide,{storyId:this.activeStory.id,slideIndex:this.activeStory.activeSlideIndex})}emitWidgetLinkEvent(e,t){this.storyManager.emit("widgetEvent",{name:"w-link",data:{story_id:this.activeStory.id,slide_index:this.activeStory.activeSlideIndex,widget_id:t.elementId,widget_label:"",widget_value:e}})}}class js{constructor(e,t,r){Object.defineProperty(this,"userKey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"instanceUserData",{enumerable:!0,configurable:!0,writable:!0,value:r})}set(e){return window.localStorage.setItem(this.key,JSON.stringify(e)),e}get(){var e;let t={};const r=(0,we.default)(this.instanceUserData)?this.instanceUserData:{};try{const r=JSON.parse(null!==(e=window.localStorage.getItem(this.key))&&void 0!==e?e:"{}");(0,we.default)(r)&&(t=r)}catch(e){console.error(e)}return(0,yr.default)(t,r)}get key(){return`game_instance_data_${this.userKey}_${this.gameInstanceId}`}}const Ms=.64516129032;class Es{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t,this._vh=this.calcVH()}get vw(){return this._vw}get vh(){return this._vh}getWidth(){return this.viewportRatio>Ms&&!this.isDiffAspectRatioEqualToEps()?`${this.calcWidthByVH()}px`:"auto"}getHeight(){const e=this.isDiffAspectRatioEqualToEps()||this.isPortraitOrientation();return this.viewportRatio>Ms&&!e?`${this.calcHeightByVW()}px`:"100%"}calcWidthByVH(){return Math.ceil(this._vh*Ms)}calcHeightByVW(){return this._vh}isDiffAspectRatioEqualToEps(){return this.viewportRatio>Ms&&this.viewportRatio-Ms<=.1}isPortraitOrientation(){let e;return"matchMedia"in window&&void 0!==(e=window.matchMedia("(orientation: portrait)"))&&e.matches}calcVH(){let e=this._vh;return e-=this.padding.top+this.padding.bottom,e}}class Is{constructor(e,t){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}getWidth(){return this.viewportRatio>Ms&&!this.isDiffAspectRatioEqualToEps()?`${this.calcWidthByVH()}px`:"auto"}getHeight(){const e=this.isDiffAspectRatioEqualToEps()||this.isPortraitOrientation();return this.viewportRatio>Ms&&!e?`${this.calcHeightByVW()}px`:"100%"}calcWidthByVH(){return this.viewportRatio>Ms?this._vw:Math.ceil(this._vh*Ms)}calcHeightByVW(){return Math.ceil(this._vw/Ms)}isDiffAspectRatioEqualToEps(){return this.viewportRatio>Ms&&this.viewportRatio-Ms<=.1}isPortraitOrientation(){let e;return"matchMedia"in window&&void 0!==(e=window.matchMedia("(orientation: portrait)"))&&e.matches}}class Ls{constructor(){}create(e){return e.desktopMode&&e.vw>=e.vh?this.createDesktopGameGeometry(e):this.createMobileGameGeometry(e)}createDesktopGameGeometry(e){return new Es(e.vw,e.vh,{top:50,bottom:50})}createMobileGameGeometry(e){return new Is(e.vw,e.vh)}}class Ts{constructor(e){Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value:e})}set(e){sessionStorage.setItem(this.key,JSON.stringify(e))}get(){var e;const t=null!==(e=sessionStorage.getItem(this.key))&&void 0!==e?e:"{}";return window.__activeNarrativeId?JSON.parse(t):{}}get key(){return`narrative_${this.storyId}_data`}}class As extends L.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"origin",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.messageListener=this.messageListener.bind(this),window.addEventListener("message",this.messageListener,!1)}messageListener(e){if(e.origin!==this.origin)return;const[t,...r]=e.data;try{if(!Array.isArray(e.data))throw new Error(`Invalid MessageEvent data format ${e.data}`);this.emit(t,...r)}catch(e){console.error(e)}}sendMessage(e,t){var r;null===(r=this.iframe.contentWindow)||void 0===r||r.postMessage([e,t],this.origin)}pauseGameUI(){null==this||this.sendMessage("cb",{cb:"pauseUI",arguments:JSON.stringify([])})}resumeGameUI(){null==this||this.sendMessage("cb",{cb:"resumeUI",arguments:JSON.stringify([])})}shareComplete(e,t){this.sendMessage("shareComplete",{id:e,isSuccess:t})}closeGameReader(){this.sendMessage("closeGameReader")}initGame(e){this.sendMessage("cb",{cb:"initGame",arguments:JSON.stringify([e])})}sendGameCenterEventByApiRequest(e,t){this.sendMessage("cb",{cb:e,plainData:t})}notifyGameCanBeStarted(){this.sendMessage("gameShouldForeground")}destroy(){window.removeEventListener("message",this.messageListener,!1),this.removeAllListeners()}}class Rs{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const{id:t,callback:r}=JSON.parse(e),i=this.gameReaderViewModel.game;if(!i)return;const a=new js(i.clientConfig.userKey,i.config.gameInstanceId,i.instanceUserData).get();this.gameCenterMessageService.sendMessage("cb",{cb:r,arguments:JSON.stringify([t,JSON.stringify(a)])})}}class Ds{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:r})}handle(e){const{gameInstanceId:t,data:r}=JSON.parse(e),i=this.gameReaderViewModel.game;if(!i)return;const a=new js(i.clientConfig.userKey,i.config.gameInstanceId,i.instanceUserData).set(r);this.storyManager.isStatisticsDisabled||ke.post(`game/${t}/instance-user-data`,JSON.stringify(a)).catch(console.error)}}var Bs;!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Bs||(Bs={}));class Fs{constructor(e,t,r){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e,t){var r,i,a;let s=null!==(r=null==t?void 0:t.url)&&void 0!==r?r:t.text,n=[];t.files&&Array.isArray(t.files)&&t.files.length>0&&(n=await Promise.all(t.files.map((e=>(async({file:e,name:t,type:r})=>{const i=await fetch(`data:${r};base64,${e}`),a=await i.blob();return new File([a],t,{type:r,lastModified:(new Date).getTime()})})(e)))));const o={url:null!=s?s:void 0,files:n.length>0?n:void 0,text:null!==(i=t.text)&&void 0!==i?i:void 0,title:null!==(a=t.title)&&void 0!==a?a:void 0};if(!(o.files&&o.files.length>0||o.url))return void this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!1});let l=navigator.share;if(!navigator.share&&window.parent&&window.parent.navigator.share&&(l=window.parent.navigator.share),!this.desktopMode&&l)try{if(!l)return;l(o).then((()=>this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!0}))).catch((()=>this.gameReaderViewModel.confirmSharingComplete({shareId:e,isSuccess:!1})))}catch(t){console.error(t),this.openSharePanel({shareConfig:o,sharePath:s,shareId:e})}else this.openSharePanel({shareConfig:o,sharePath:s,shareId:e})}openSharePanel({shareConfig:e,sharePath:t,shareId:r}){let i=Bs.Social,a=t;e.files&&e.files.length>0&&(i=Bs.SlideScreenshot,a=URL.createObjectURL(e.files[0])),this.gameReaderViewModel.emit(Vs.OpenSharePanel,{shareId:r,shareType:i,shareLink:a})}}class Ns{constructor(e,t){Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"gameReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){const t=JSON.parse(e);if(!(0,we.default)(t))return;const{id:r,storyId:i,callback:a}=t;let s=new Ts(i).get();this.gameCenterMessageService.sendMessage("cb",{cb:a,arguments:JSON.stringify([r,JSON.stringify(s)])})}}class Us{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){const t=JSON.parse(e);if(!(0,we.default)(t))return;const{storyId:r,data:i,sendToServer:a}=t;new Ts(r).set(i),a&&!this.storyManager.getConfig().isStatisticsDisabled&&ke.request({url:"story-data/"+r,method:"put",data:JSON.stringify(i)}).catch(console.error)}}const Ws=(e=>{var t={};return A.d(t,e),t})({default:()=>f.default});class zs{constructor(e){Object.defineProperty(this,"window",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"scrollbarHidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get width(){const e=this.window.document.documentElement.clientWidth;return Math.abs(this.window.innerWidth-e)}setScrollbar(e=this.width){this.scrollbarHidden||(this.disableOverFlow(),this.setBodyContainer(),this.setElementAttributes("body","paddingRight",(t=>t+e)),this.scrollbarHidden=!0)}resetScrollbar(){this.scrollbarHidden&&(this.resetElementAttributes("html","overflow"),this.resetElementAttributes("body","overflow"),this.resetElementAttributes("body","paddingRight"),this.resetBodyContainer(),this.scrollbarHidden=!1)}resetElementAttributes(e,t){this.window.document.querySelectorAll(e).forEach((e=>{const r=e.dataset[t];void 0===r?e.style.removeProperty(t):(delete e.dataset[t],e.style[t]=r)}))}disableOverFlow(){const e=this.window.document,t=e.documentElement.style.overflow,r=e.body.style.overflow;r&&(e.body.dataset.overflow=r),t&&(e.documentElement.dataset.overflow=t),e.body.style.overflow="hidden",e.documentElement.style.overflow="hidden"}setElementAttributes(e,t,r){const i=this.width;this.window.document.querySelectorAll(e).forEach((e=>{if(e!==this.window.document.body&&this.window.innerWidth>e.clientWidth+i)return;const a=e.style[t],s=this.window.getComputedStyle(e)[t];e.dataset[t]=a,e.style[t]=`${r(Number.parseFloat(s))}px`}))}setBodyContainer(){const e=this.window.document,t=e.body.style.container;t&&(e.body.dataset.container=t),e.body.style.container="unset"}resetBodyContainer(){this.resetElementAttributes("body","container")}}var Vs,Gs=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},$s=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Hs=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},qs=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};!function(e){e.Close="close",e.OpenSharePanel="openSharePanel"}(Vs||(Vs={}));let Qs=(()=>{var e,t,r,i,a,s,n,o,l,d;let c,u,h,p,g,f,m,v,b,y,w,S,_,O,C,x,k,P,j,M,E,I,L,T,A,R,D=ce,B=[],F=[],N=[],U=[],W=[],z=[],V=[],G=[],$=[],H=[],q=[],Q=[],K=[],J=[],Z=[],X=[],ee=[],te=[],re=[];return e=class extends D{get _isOpened(){return Hs(this,t,"f")}set _isOpened(e){qs(this,t,e,"f")}get _isGameInited(){return Hs(this,r,"f")}set _isGameInited(e){qs(this,r,e,"f")}get _isGameLoading(){return Hs(this,i,"f")}set _isGameLoading(e){qs(this,i,e,"f")}get _gameInstanceId(){return Hs(this,a,"f")}set _gameInstanceId(e){qs(this,a,e,"f")}get _game(){return Hs(this,s,"f")}set _game(e){qs(this,s,e,"f")}get _gameError(){return Hs(this,n,"f")}set _gameError(e){qs(this,n,e,"f")}get _closeBtnVisible(){return Hs(this,o,"f")}set _closeBtnVisible(e){qs(this,o,e,"f")}get _gameShouldBeShown(){return Hs(this,l,"f")}set _gameShouldBeShown(e){qs(this,l,e,"f")}get desktopMode(){return Hs(this,d,"f")}set desktopMode(e){qs(this,d,e,"f")}constructor(c,u){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Gs(this,B),c)}),Object.defineProperty(this,"gameCenterApi",{enumerable:!0,configurable:!0,writable:!0,value:u}),t.set(this,Gs(this,F,!1)),r.set(this,(Gs(this,N),Gs(this,U,!1))),i.set(this,(Gs(this,W),Gs(this,z,!1))),a.set(this,(Gs(this,V),Gs(this,G,null))),s.set(this,(Gs(this,$),Gs(this,H,null))),n.set(this,(Gs(this,q),Gs(this,Q,null))),o.set(this,(Gs(this,K),Gs(this,J,!1))),l.set(this,(Gs(this,Z),Gs(this,X,!1))),Object.defineProperty(this,"initGameRetryAttempts",{enumerable:!0,configurable:!0,writable:!0,value:(Gs(this,ee),0)}),Object.defineProperty(this,"gameCenterMessageService",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"safeAreaInsets",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,bottom:0,left:0,right:0}}),Object.defineProperty(this,"openGameOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),d.set(this,Gs(this,te,!0)),Object.defineProperty(this,"dir",{enumerable:!0,configurable:!0,writable:!0,value:(Gs(this,re),le.LTR)}),Object.defineProperty(this,"scrollbarHelper",{enumerable:!0,configurable:!0,writable:!0,value:new zs(window)}),this.handleVisibilityChange=this.handleVisibilityChange.bind(this),document.addEventListener("visibilitychange",this.handleVisibilityChange),this.storyManager.setViewModel(e.id,this)}get closeBtnVisible(){return this._closeBtnVisible}get isGameLoading(){return this._isGameLoading}get isGameInited(){return this._isGameInited}get gameError(){return this._gameError}get game(){return this._game}get gameInstanceId(){return this._gameInstanceId}get isOpened(){return this._isOpened}get gameShouldBeShown(){return this._gameShouldBeShown}async openGame(e,t={}){if(this.isOpened)throw new Error(`Close the launched game with ID "${this.gameInstanceId}"`);this._gameInstanceId=e,this._isOpened=!0,this.openGameOptions=t,this._gameShouldBeShown=!1,await this.launchGameById(e),this.scrollbarHelper.setScrollbar()}async closeGame(){var e;return!!this._isOpened&&(this._isGameInited?null===(e=this.gameCenterMessageService)||void 0===e||e.closeGameReader():this.handleGameComplete({}),!0)}reload(){this._game=null,this.gameInstanceId?this.launchGameById(this.gameInstanceId):console.error("The game instance ID is undefined")}sendGameCenterEventByApiRequest(e,t){var r;null===(r=this.gameCenterMessageService)||void 0===r||r.sendGameCenterEventByApiRequest(e,t)}setSafeAreaInsets(e){this.safeAreaInsets=e}setDesktopMode(e){this.desktopMode=e}setGameCenterIframe(e,{isWidescreen:t}){var r;if(!this._game)throw new Error("GameCenter iframe setup error");if(this._isGameInited)return;null===(r=this.gameCenterMessageService)||void 0===r||r.destroy();const i=new URL(this._game.url).origin;this.gameCenterMessageService=new As(e,i),this.initGameCenter({isWidescreen:t,gameCenterMessageService:this.gameCenterMessageService,game:this._game})}pauseGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.pauseGameUI()}resumeGameUI(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.resumeGameUI()}confirmSharingComplete({shareId:e,isSuccess:t}){var r;null===(r=this.gameCenterMessageService)||void 0===r||r.shareComplete(e,t)}notifyGameCanBeStarted(){var e;null===(e=this.gameCenterMessageService)||void 0===e||e.notifyGameCanBeStarted()}destroy(){var t;null===(t=this.gameCenterMessageService)||void 0===t||t.destroy(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.storyManager.deleteViewModel(e.id)}async launchGameById(e){try{this._gameError=null,this._isGameLoading=!0,await this.storyManager.rootStore.sessionStore.open();const t=await this.gameCenterApi.openGame({gameInstanceId:e,gameOptions:this.openGameOptions});this._game=new wr(this.storyManager,t)}catch(e){this._gameError=e}}initGameCenter({isWidescreen:e,gameCenterMessageService:t,game:r}){this.handleGameCenterEvents(t);const i=r.toInitDto({safeAreaInsets:this.safeAreaInsets,dir:this.dir,isWidescreen:e});t.initGame(i)}handleGameCenterEvents(e){e.on("gameLoaded",this.handleGameLoaded.bind(this)).on("gameComplete",this.handleGameComplete.bind(this)).on("sendApiRequest",this.handleSendApiRequest.bind(this)).on("openUrl",this.handleOpenUrl.bind(this)).on("event",this.handleGameEvent.bind(this)).on("reloadGameReader",this.handleReloadGameReader.bind(this)).on("gameLoadFailed",this.handleGameLoadFailed.bind(this)).on("gameShouldForegroundCallback",this.handleGameShouldBeShown.bind(this));const t={share:new Fs(e,this,this.desktopMode),storySetLocalData:new Us(this.storyManager),storyGetLocalData:new Ns(e,this),gameInstanceGetLocalData:new Rs(e,this),gameInstanceSetLocalData:new Ds(this.storyManager,e,this)};for(const[r,i]of Object.entries(t))e.on(r,((...e)=>i.handle(...e)))}handleGameShouldBeShown(e){this._gameShouldBeShown=!0;const t=JSON.parse(e);(0,we.default)(t)&&(this._closeBtnVisible=Boolean(t.showClose))}handleGameLoaded(){try{this.initGame(),this.startGame()}catch(e){console.error(e)}}initGame(){this._isGameInited=!0,this._isGameLoading=!1}completeGame(){this._isGameInited=!1,this._isOpened=!1,this._game=null}startGame(){this.storyManager.emit("startGame",{id:this.gameInstanceId})}handleVisibilityChange(){"hidden"===document.visibilityState?this.pauseGameUI():"visible"===document.visibilityState&&this.resumeGameUI()}handleGameComplete(e,t,r,i,a){this.resetGameState(e),this.processGameResult(a,i)}resetGameState(e){var t;this.scrollbarHelper.resetScrollbar(),this.completeGame(),null===(t=this.gameCenterMessageService)||void 0===t||t.destroy(),this.emitGameCompleteEventByStoryManager(e)}processGameResult(e,t){(null==e?void 0:e.id)?this.openGame(e.id,{}):((null==t?void 0:t.id)&&this.storyManager.showStory(t.id),this.emit(Vs.Close))}emitGameCompleteEventByStoryManager(e){(0,Ws.default)(e)?this.storyManager.emit("closeGame",{id:this.gameInstanceId}):this.storyManager.emit("finishGame",{id:this.gameInstanceId,result:e})}async handleSendApiRequest(e){let t,r,i;try{const a=JSON.parse(e);t=a.id,r=a.data,i=a.cb,await ke.request({url:a.url,method:a.method,params:a.params,data:a.data,headers:a.headers}).catch(console.error),this.sendGameCenterEventByApiRequest(i,JSON.stringify({requestId:t,data:JSON.stringify(r.data),status:r.status,headers:r.headers}))}catch(e){if(e instanceof SyntaxError)return;if(!i)return;this.sendGameCenterEventByApiRequest(i,JSON.stringify({requestId:t,data:JSON.stringify(e),status:400,headers:[{}]}))}}handleOpenUrl(e){const{url:t}=JSON.parse(e);this.storyManager.clickOnButtonAction({src:Y.GAME_READER,payload:{url:t,gameInstanceId:this.gameInstanceId}})}handleGameEvent(e,t){this.storyManager.emit("gameEvent",{name:e,payload:t}),this.storyManager.emit("eventGame",{name:e,payload:t})}handleReloadGameReader(){const e=this._game;this._game=null,this._isGameInited=!1,this._isGameLoading=!0,this._gameShouldBeShown=!1,setTimeout((0,Me.action)((()=>{this._game=e})))}handleGameLoadFailed(e,t){this._game&&t&&this.initGameRetryAttempts<this._game.canTryReloadCount?(this.initGameRetryAttempts++,this.handleReloadGameReader()):this._gameError=new Error(e)}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=D[Symbol.metadata])&&void 0!==t?t:null):void 0;c=[Me.observable],u=[Me.observable],h=[Me.observable],p=[Me.observable],g=[Me.observable],f=[Me.observable],m=[Me.observable],v=[Me.observable],b=[Me.observable],y=[Me.computed],w=[Me.computed],S=[Me.computed],_=[Me.computed],O=[Me.computed],C=[Me.computed],x=[Me.computed],k=[Me.computed],P=[Me.action],j=[Me.action],M=[Me.action],E=[Me.action],I=[Me.action],L=[Me.action],T=[Me.action],A=[Me.action],R=[Me.action],$s(e,null,c,{kind:"accessor",name:"_isOpened",static:!1,private:!1,access:{has:e=>"_isOpened"in e,get:e=>e._isOpened,set:(e,t)=>{e._isOpened=t}},metadata:r},F,N),$s(e,null,u,{kind:"accessor",name:"_isGameInited",static:!1,private:!1,access:{has:e=>"_isGameInited"in e,get:e=>e._isGameInited,set:(e,t)=>{e._isGameInited=t}},metadata:r},U,W),$s(e,null,h,{kind:"accessor",name:"_isGameLoading",static:!1,private:!1,access:{has:e=>"_isGameLoading"in e,get:e=>e._isGameLoading,set:(e,t)=>{e._isGameLoading=t}},metadata:r},z,V),$s(e,null,p,{kind:"accessor",name:"_gameInstanceId",static:!1,private:!1,access:{has:e=>"_gameInstanceId"in e,get:e=>e._gameInstanceId,set:(e,t)=>{e._gameInstanceId=t}},metadata:r},G,$),$s(e,null,g,{kind:"accessor",name:"_game",static:!1,private:!1,access:{has:e=>"_game"in e,get:e=>e._game,set:(e,t)=>{e._game=t}},metadata:r},H,q),$s(e,null,f,{kind:"accessor",name:"_gameError",static:!1,private:!1,access:{has:e=>"_gameError"in e,get:e=>e._gameError,set:(e,t)=>{e._gameError=t}},metadata:r},Q,K),$s(e,null,m,{kind:"accessor",name:"_closeBtnVisible",static:!1,private:!1,access:{has:e=>"_closeBtnVisible"in e,get:e=>e._closeBtnVisible,set:(e,t)=>{e._closeBtnVisible=t}},metadata:r},J,Z),$s(e,null,v,{kind:"accessor",name:"_gameShouldBeShown",static:!1,private:!1,access:{has:e=>"_gameShouldBeShown"in e,get:e=>e._gameShouldBeShown,set:(e,t)=>{e._gameShouldBeShown=t}},metadata:r},X,ee),$s(e,null,b,{kind:"accessor",name:"desktopMode",static:!1,private:!1,access:{has:e=>"desktopMode"in e,get:e=>e.desktopMode,set:(e,t)=>{e.desktopMode=t}},metadata:r},te,re),$s(e,null,y,{kind:"getter",name:"closeBtnVisible",static:!1,private:!1,access:{has:e=>"closeBtnVisible"in e,get:e=>e.closeBtnVisible},metadata:r},null,B),$s(e,null,w,{kind:"getter",name:"isGameLoading",static:!1,private:!1,access:{has:e=>"isGameLoading"in e,get:e=>e.isGameLoading},metadata:r},null,B),$s(e,null,S,{kind:"getter",name:"isGameInited",static:!1,private:!1,access:{has:e=>"isGameInited"in e,get:e=>e.isGameInited},metadata:r},null,B),$s(e,null,_,{kind:"getter",name:"gameError",static:!1,private:!1,access:{has:e=>"gameError"in e,get:e=>e.gameError},metadata:r},null,B),$s(e,null,O,{kind:"getter",name:"game",static:!1,private:!1,access:{has:e=>"game"in e,get:e=>e.game},metadata:r},null,B),$s(e,null,C,{kind:"getter",name:"gameInstanceId",static:!1,private:!1,access:{has:e=>"gameInstanceId"in e,get:e=>e.gameInstanceId},metadata:r},null,B),$s(e,null,x,{kind:"getter",name:"isOpened",static:!1,private:!1,access:{has:e=>"isOpened"in e,get:e=>e.isOpened},metadata:r},null,B),$s(e,null,k,{kind:"getter",name:"gameShouldBeShown",static:!1,private:!1,access:{has:e=>"gameShouldBeShown"in e,get:e=>e.gameShouldBeShown},metadata:r},null,B),$s(e,null,P,{kind:"method",name:"openGame",static:!1,private:!1,access:{has:e=>"openGame"in e,get:e=>e.openGame},metadata:r},null,B),$s(e,null,j,{kind:"method",name:"closeGame",static:!1,private:!1,access:{has:e=>"closeGame"in e,get:e=>e.closeGame},metadata:r},null,B),$s(e,null,M,{kind:"method",name:"reload",static:!1,private:!1,access:{has:e=>"reload"in e,get:e=>e.reload},metadata:r},null,B),$s(e,null,E,{kind:"method",name:"setDesktopMode",static:!1,private:!1,access:{has:e=>"setDesktopMode"in e,get:e=>e.setDesktopMode},metadata:r},null,B),$s(e,null,I,{kind:"method",name:"handleGameShouldBeShown",static:!1,private:!1,access:{has:e=>"handleGameShouldBeShown"in e,get:e=>e.handleGameShouldBeShown},metadata:r},null,B),$s(e,null,L,{kind:"method",name:"handleGameLoaded",static:!1,private:!1,access:{has:e=>"handleGameLoaded"in e,get:e=>e.handleGameLoaded},metadata:r},null,B),$s(e,null,T,{kind:"method",name:"handleGameComplete",static:!1,private:!1,access:{has:e=>"handleGameComplete"in e,get:e=>e.handleGameComplete},metadata:r},null,B),$s(e,null,A,{kind:"method",name:"handleReloadGameReader",static:!1,private:!1,access:{has:e=>"handleReloadGameReader"in e,get:e=>e.handleReloadGameReader},metadata:r},null,B),$s(e,null,R,{kind:"method",name:"handleGameLoadFailed",static:!1,private:!1,access:{has:e=>"handleGameLoadFailed"in e,get:e=>e.handleGameLoadFailed},metadata:r},null,B),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),Object.defineProperty(e,"id",{enumerable:!0,configurable:!0,writable:!0,value:"GameReaderViewModel"}),e})();class Ks{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){return new Qs(this.storyManager,new cr)}}class Ys{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:t})}async handle(e){try{this.emitWidgetLinkEvent(e.linkTarget,e);const t=this.storyManager.gameReaderViewModel,r=this.storyManager.storyReaderViewModel;await t.openGame(e.linkTarget),r.pauseUI(),t.once(Vs.Close,(()=>{r.resumeUI()}))}catch(e){console.error(e)}}emitWidgetLinkEvent(e,t){this.storyManager.emit("widgetEvent",{name:"w-link",data:{story_id:this.activeStory.id,slide_index:this.activeStory.activeSlideIndex,widget_id:t.elementId,widget_label:"",widget_value:e}})}}class Js{constructor(e){Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){this.activeStory.activeSlide.showLayerByIndex(parseInt(e.linkTarget))}}class Zs{constructor(e){Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){this.activeStory.toSlide(parseInt(e.linkTarget))}}class Xs{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){const t=parseInt(e.linkTarget);this.emitWidgetLinkEvent(e.linkTarget,e);try{await this.storyReader.showStory(t)}catch(e){console.error(e)}}emitWidgetLinkEvent(e,t){this.storyManager.emit("widgetEvent",{name:"w-link",data:{story_id:this.activeStory.id,slide_index:this.activeStory.activeSlideIndex,widget_id:t.elementId,widget_label:"",widget_value:e,feed:this.storyReader.feedSlug}})}}class en{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:r})}handle(e){try{const t=decodeURIComponent(e.linkTarget);this.emitWidgetLinkEvent(t,e),this.activeStory.markAsOpened(),vi.emit(Li.TransitionFromSlide,{storyId:this.activeStory.id,slideIndex:this.activeStory.activeSlideIndex}),this.handleClickOnButton({id:this.activeStory.id,index:this.activeStory.activeSlideIndex,url:t,elementId:e.elementId,dataForSending:null,label:""})}catch(t){t instanceof URIError?console.error(`[IAS]: the URL <${e.linkTarget}> has an invalid format`):console.error(t)}}emitWidgetLinkEvent(e,t){this.storyManager.emit("widgetEvent",{name:"w-link",data:{story_id:this.activeStory.id,slide_index:this.activeStory.activeSlideIndex,widget_id:t.elementId,widget_label:"",widget_value:e}})}handleClickOnButton(e){const t=this.storyManager.getConfig().isStatisticsDisabled;e.dataForSending=t?null:{data:this.storyReader.getStatisticsData()};const r=()=>this.storyManager.clickOnButtonAction({src:Y.STORY_READER,payload:e});!t&&e.dataForSending&&(0,we.default)(e.dataForSending)&&Array.isArray(e.dataForSending.data)&&e.dataForSending.data.length>0?(this.storyReader.cleanupStatisticsData(),xe("session/update",e.dataForSending,r)):r()}}class tn{constructor(e){Object.defineProperty(this,"slideElementActionFactory",{enumerable:!0,configurable:!0,writable:!0,value:e})}static is(e){return["narrative-element-link","narrative-element-image"].some((t=>e.classList.contains(t)))}click(e){const{elementId:t,linkType:r,linkTarget:i}=this.parseTargetDataset(e);if(!r)return;this.slideElementActionFactory.create(r).handle({target:e,linkTarget:i,linkType:r,elementId:t})}parseTargetDataset(e){var t,r;const i=e.dataset;return{elementId:null!==(t=i.elementId)&&void 0!==t?t:"",linkType:i.linkType,linkTarget:null!==(r=i.linkTarget)&&void 0!==r?r:""}}}class rn{handle(e){console.log(`There is no action handler for <${e.linkType}:${e.linkTarget}>`)}}class an{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"activeStory",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e){switch(e){case"url":return new en(this.storyManager,this.storyReader,this.activeStory);case"customAction":return new Ps(this.storyManager,this.activeStory);case"slide":return new Zs(this.activeStory);case"story":return new Xs(this.storyManager,this.storyReader,this.activeStory);case"game":return new Ys(this.storyManager,this.activeStory);case"layer":return new Js(this.activeStory);case"closeStory":return new ks(this.storyReader);default:return new rn}}}const sn=.53167701863,nn=.64516129032;class on{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}get vhWitoutPadding(){return this._vh-this.padding.top-this.padding.bottom}getOffset(e){const t=this._vw,r=this.vhWitoutPadding-e,i=this.calculateWidthWithActionPanel(e),a=this.calculateHeightWithActionPanel(e);return this.viewportRatio>nn?Math.ceil(a-r)/2*-1+"px auto":`0 ${Math.ceil(i-t)/2*-1}px`}getOffsetX(e){const t=this.calculateWidthWithActionPanel(e);return this.viewportRatio>nn?"0px":Math.ceil(t-this._vw)/2+"px"}getOffsetY(e){const t=this.vhWitoutPadding-e;return this.viewportRatio>nn?`${Math.ceil(this.calculateHeight()-t)}px`:"0px"}getWidth(){return this.viewportRatio>nn?`${this.calculateWidth()}px`:"auto"}getHeight(){return this.viewportRatio>nn?`${this.calculateHeight()}px`:"100%"}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return Math.ceil(this.vhWitoutPadding*nn)}calculateHeight(){return Math.ceil(this.calculateWidth()/nn)}calculateWidthWithActionPanel(e){const t=this.vhWitoutPadding-e;return Math.ceil(t*nn)}calculateHeightWithActionPanel(e){return Math.ceil(this.calculateWidthWithActionPanel(e)/nn)}}class ln{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get vw(){return this._vw}get vh(){return this._vh}get vhWitoutPadding(){return this._vh-this.padding.top-this.padding.bottom}getOffset(e){const t=this._vw,r=this.vhWitoutPadding-e,i=this.calculateWidthWithActionPanel(e),a=this.calculateHeight();return a>r?Math.ceil(a-r)/2*-1+"px auto":`0 ${Math.ceil(i-t)/2*-1}px`}getOffsetX(e){const t=this.calculateWidthWithActionPanel(e),r=this.vhWitoutPadding-e,i=this.calculateHeight(),a=this._vw;return i>r?"0px":Math.ceil(t-a)/2+"px"}getOffsetY(e){const t=this.vhWitoutPadding-e,r=this.calculateHeight();return r>t?Math.ceil(r-t)/2+"px":"0px"}getWidth(){return this.viewportRatio>nn?`${this.calculateWidth()}px`:"auto"}getHeight(){return this.viewportRatio>nn?`${this.calculateHeight()}px`:"100%"}getFontSize(){return this.calculateWidth()/20+"px"}calculateWidth(){return this.viewportRatio>nn?this._vw:Math.ceil(this.vhWitoutPadding*nn)}calculateHeight(){return Math.ceil(this._vw/nn)}calculateWidthWithActionPanel(e){const t=this.vhWitoutPadding-e;return this.viewportRatio>nn?this._vw:Math.ceil(t*nn)}}class dn{constructor(e){Object.defineProperty(this,"safeAreaFrameCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(e){const t=e.vw/e.vh;return e.desktopMode&&t>nn?this.createDesktopStoryGeometry(e):this.createMobileStoryGeometry(e)}createDesktopStoryGeometry(e){return new on(e.vw,e.vh,{top:50,bottom:50})}createMobileStoryGeometry(e){var t,r;const{paddingTop:i,paddingBottom:a}=this.safeAreaFrameCalculator.getViewportCorrectionPadding();return new ln(e.vw,e.vh,{top:null!==(t=parseFloat(i))&&void 0!==t?t:0,bottom:null!==(r=parseFloat(a))&&void 0!==r?r:0})}}class cn{constructor(e,t,r){Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"actionPanelHeight",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"viewportRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.viewportRatio=e/t}get shouldBeShownSafeAreaInsets(){return this.viewportRatio<sn}getViewportCorrectionPadding(){const{paddingTop:e,paddingBottom:t}=this.calcFrameWidthByMobileAspectRatio();return{paddingTop:e+"px",paddingBottom:t+"px"}}calcFrameWidthByMobileAspectRatio(){const e=this._vh-this._vw/sn,t=Math.max(Math.min(e-this.actionPanelHeight,this.actionPanelHeight),0);return{paddingTop:Math.max(e-t,0),paddingBottom:t}}}class un extends L.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}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("start"),this.setTimer(e)))}stop(){this.isCompleted||(this.clearTimer(),this.emit("stop"),this.isCompleted=!0)}pause(){this.isCompleted||(this.timerPaused=!0,this.clearTimer(),this.progressBeforePause=this.currentProgress,this.emit("pause"))}resume(){if(!this.timerPaused)return;this.timerPaused=!1;const e=1-this.progressBeforePause,t=this.timeout*e;this.setTimer(t),this.emit("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("progress",100),this.emit("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("progress",r)}runTimerTicks(e){let t=performance.now();const r=i=>{let a=(i-t)/e;a>1&&(a=1);let s=a;this.updateProgress(s),a<1&&(this.rafId=requestAnimationFrame(r))};this.rafId=requestAnimationFrame(r)}}class hn{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 pn{constructor(){Object.defineProperty(this,"actions",{enumerable:!0,configurable:!0,writable:!0,value:[]})}push(e){this.actions.push(e)}exec(){for(const e of this.actions)e()}flush(){this.actions=[]}}class gn{constructor(e,t,r,i){Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"deferredActionsQueue",{enumerable:!0,configurable:!0,writable:!0,value:new pn}),Object.defineProperty(this,"sessionNarrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new hn}),Object.defineProperty(this,"execCalled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}exec(){this.sessionNarrativeDataCache.clear(),this.deferredActionsQueue.exec(),this.deferredActionsQueue.flush(),this.execCalled=!0}changeActiveSlide(){this.execCalled=!1}async getCardLocalData(){const e=this.storyManager.rootStore.sessionStore.userId;let t=this.narrativeDataCache.get(`narrative_${this.story.id}_data_${e}`);return t?JSON.parse(t):{}}setCardLocalData(e,t){const r=this.storyManager.rootStore.sessionStore.userId;let i=JSON.stringify(e);this.narrativeDataCache.set(`narrative_${this.story.id}_data_${r}`,i),t&&this.story.updateNarrativeData(i).catch(console.error)}getCardServerData(e){var t;return null!==(t=this.storyManager.rootStore.storyStore.findStoryById(e).context.widgetsData._narrative_saved_data)&&void 0!==t?t:null}updateCardServerData(e,t){this.storyManager.rootStore.storyStore.findStoryById(e).context.updateNarrativeSavedData(t)}getSlideDuration(e,t){var r,i;return null!==(i=null===(r=this.storyManager.rootStore.storyStore.findStoryById(e).context.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[t])&&void 0!==i?i:null}pauseUI(){this.storyReader.pauseUI()}resumeUI(){this.storyReader.resumeUI()}showCardTextInput(e,t){vi.emit(fn.ShowInputModal,{id:e,config:t})}setCardSessionValue(e,t){this.sessionNarrativeDataCache.set(e,t)}getCardSessionValue(e){return this.sessionNarrativeDataCache.get(e)}getWidgetsSharedData(e,t){const r=this.storyManager.rootStore.storyStore.findStoryById(e);if(!r)return null;const i=r.context.widgetsData;switch(t){case"rangeSlider":return i._narrative_range_slider_data;case"poll":return i._narrative_poll_data;case"vote":return i._narrative_vote_data}return null}openUrl(e){this.story.markAsOpened(),vi.emit(Li.TransitionFromSlide,{storyId:this.story.id,slideIndex:this.story.activeSlideIndex}),window.open(e,"_parent")}async sendApiRequest(e,t,r,i,a,s){var n,o,l;try{const s=await ke.request({url:e,method:t,params:null!=r?r:{},headers:null!=i?i:{},data:null!=a?a:{}});return{status:s.status,headers:s.headers,data:s.data}}catch(e){if(e instanceof ve)return{status:null!==(n=e.networkStatus)&&void 0!==n?n: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){null==e&&(e="story-share"),this.storyReader.sharePanel.shareText({shareId:e,config:t,storySlide:this.story.activeSlide})}shareSlideScreenshot(e,t,r){null==e&&(e="slide-screenshot-share"),this.storyReader.sharePanel.shareScreenShot({shareId:e,hideElementsSelector:null!=t?t:"",shareText:r,storySlide:this.story.activeSlide})}showLayer(e){this.story.activeSlide.showLayerByIndex(e)}showCardSlide(e){this.pushToDefferedActionsQueueOrExec((()=>{this.story.toSlide(e)}))}cardShowNext(){this.storyReader.nextStoryWithAnimation()}showNextSlide(e){this.pushToDefferedActionsQueueOrExec((()=>{e?this.story.timer.start(e):this.story.nextSlide()}))}sendStatisticEvent(e,t,r){this.storyManager.emit("widgetEvent",{name:e,data:Object.assign(Object.assign({},r),{feed:this.storyReader.feedSlug})})}destroy(){}async resetStory(e){var t;let r={},i=await this.getCardLocalData();i=Object.assign({},null!==(t=this.getCardServerData(e))&&void 0!==t?t:{},i);for(let e in i)i.hasOwnProperty(e)&&/^_gm_[A-z0-9-_]+_attempts$/.test(e)&&(r[e]=i[e]);this.story.activeSlide.refreshWidgetsData(),this.updateCardServerData(e,r),this.setCardLocalData(r,!0),this.showCardSlide(0),this.showLayer(0)}pushToDefferedActionsQueueOrExec(e){this.execCalled?e():this.deferredActionsQueue.push(e)}getCardFonts(){return this.storyManager.rootStore.sessionStore.session.fontsResources}updateTimeline(e,t,r,i,a,s){}showToast(e){this.story.activeSlide.showToast({content:e})}}var fn,mn;!function(e){e.ShowInputModal="showInputModal"}(fn||(fn={})),function(e){e.Start="start",e.ChangeState="changeState"}(mn||(mn={}));class vn extends ce{constructor(e,t,r,i){super(),Object.defineProperty(this,"_story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_index",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storySlideRendererFactory",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(this,"slideRenderer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.slideRenderer=this.storySlideRendererFactory.create({story:e,slide:this})}get $el(){return this.slideRenderer.$el}get state(){return this.slideRenderer.state}get index(){return this._index}get story(){return this._story}get muted(){return this.slideRenderer.muted}get navigationDisabled(){return this.slideRenderer.navigationDisabled}get widgets(){return this.slideRenderer.widgets}get timeline(){return this.slide.timeline}get duration(){return this.slide.duration}get screenshotShare(){return this.slide.screenshotShare}get html(){return this.slide.html}get eventPayload(){return this.slide.eventPayload}get textFitted(){return this.slideRenderer.textFitted}findAllWidgetsOfType(e){return this.slideRenderer.findAllWidgetsOfType(e)}refreshWidgetsData(){this.slideRenderer.refreshWidgetsData()}async showLayerByIndex(e){var t,r;try{this.story.timer.stop(),await this.slideRenderer.showLayerByIndex(e),this.story.timer.start(null!==(r=null===(t=this.story.activeSlide)||void 0===t?void 0:t.duration)&&void 0!==r?r:0)}catch(e){this.story.timer.stop()}}async resume(){return this.slideRenderer.resume()}pause(){return this.slideRenderer.pause()}mute(){return this.slideRenderer.mute()}unmute(){return this.slideRenderer.unmute()}async reload(){return this.slideRenderer.reload()}async init(e){return this.slideRenderer.init(e)}async start(){return this.slideRenderer.start()}stop(){return this.slideRenderer.stop()}setUserData(e,t){for(const r of this.widgets)r.setUserData(e,t)}onClick(e,t){this.slideRenderer.onClick({target:e,navigationController:t})}onLinkClick(e){this.slideRenderer.onClickLinkElement(e.target)}showToast(e){new Wa(Object.assign({getMountPoint:()=>this.slideRenderer.$el},e))}destroy(){return this.slideRenderer.destroy()}}class bn extends na{constructor(e,t,r){super(),Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:r})}async init(){}click(e){this.element==e.target&&(this.story.reset().catch(console.error),e.navigationController.preventDefault())}}class yn{constructor(e,t){Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(e){return Array.from(e.querySelectorAll(".narrative-element-story-repeat")).map((e=>new bn(e,this.slideApi,this.story)))}}class wn{constructor(e,t){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t})}async onSlideStarted(){je(`[SLIDE][START]:${this.story.id}:${this.slide.index}`),this.story.slideApiHandlers.exec(),this.story.updateNavigationHistory(),this.startTimer(),this.slide.emit(mn.Start)}onSlideStateChanged(e){this.changeTimelineVisibilityByState(),this.slide.emit(mn.ChangeState,e)}onSlideLoadStart(){je(`[SLIDE][START_LOAD]:${this.story.id}:${this.slide.index}`)}onSlideLoadEnd(){je(`[SLIDE][END_LOAD]:${this.story.id}:${this.slide.index}`)}onSlideResume(){this.story.resume(),je(`[SLIDE][RESUME]:${this.story.id}:${this.slide.index}`)}onSlidePause(){this.story.pause(),je(`[SLIDE][PAUSE]:${this.story.id}:${this.slide.index}`)}onSlideBeforeInit(){je(`[SLIDE][INIT]:${this.story.id}:${this.slide.index}`)}onSlideAfterInit(){je(`[SLIDE][WIDGETS]:${this.story.id}:${this.slide.index}`,this.slide.widgets)}onSlideDestroy(){je(`[SLIDE][DESTROY]:${this.story.id}:${this.slide.index}`)}onSlideStop(){this.story.timer.stop(),je(`[SLIDE][STOP]:${this.story.id}:${this.slide.index}`)}onSlideVideoError(){this.story.timer.stop()}changeTimelineVisibilityByState(){this.slide.state===bs.Error||this.slide.state===bs.Loading?this.story.hideTimeline():this.story.showTimeline()}startTimer(){var e;this.story.timer.started||this.story.timer.start(null!==(e=this.slide.duration)&&void 0!==e?e:0)}}class Sn{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r})}create({story:e,slide:t}){const r=new Qi,i=new sa(e.slideApiHandlers),a=new tn(new an(this.storyManager,this.storyReader,e)),s=(0,ra.getSlideApi)(e.slideApiHandlers),n=new xs(new wn(t,e),i,s.Animation,r,a);return this.registerWidgetFactories({widgetManager:i,story:e,slide:t,touchController:this.touchController,slideApi:s}),n}registerWidgetFactories({widgetManager:e,story:t,slide:r,touchController:i,slideApi:a}){e.registerManyFactories([new Aa(a),new la(a),new ca(a),new ha(a),new Da(a),new ga(a),new ma(a),new ba(t,a),new wa(t,a),new _a(t,a),new Ca(i,a),new ka(a),new ja(a),new ps(a,i,{onClose:()=>this.storyReader.resumeUI(),onOpen:()=>this.storyReader.pauseUI()}),new fs(a,i,r),new La(a),new Ea(t,a),new yn(t,a)])}}var _n=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},On=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Cn=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},xn=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let kn=(()=>{var e,t,r,i,a;let s,n,o,l,d,c,u,h,p,g,f,m,v,b,y,w,S,_,O=ce,C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[];return e=class extends O{get _activeSlideIndex(){return Cn(this,t,"f")}set _activeSlideIndex(e){xn(this,t,e,"f")}get _displayedSlides(){return Cn(this,r,"f")}set _displayedSlides(e){xn(this,r,e,"f")}get _hiddenTimeline(){return Cn(this,i,"f")}set _hiddenTimeline(e){xn(this,i,e,"f")}get slides(){return Cn(this,a,"f")}set slides(e){xn(this,a,e,"f")}constructor(e,s,n,o,l,d,c){var u;super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(_n(this,C),e)}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"sharePanel",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"navigationHistory",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"storySlideRendererFactory",{enumerable:!0,configurable:!0,writable:!0,value:d}),t.set(this,_n(this,x,0)),r.set(this,(_n(this,k),_n(this,P,[]))),i.set(this,(_n(this,j),_n(this,M,!1))),a.set(this,(_n(this,E),_n(this,I,[]))),Object.defineProperty(this,"_hasShare",{enumerable:!0,configurable:!0,writable:!0,value:(_n(this,L),!1)}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:new un}),Object.defineProperty(this,"storySlidesReactionDisposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.slideApiHandlers=c.create(this),this.nextSlide=this.nextSlide.bind(this),this._hasShare=Boolean(null===(u=this.storyManager.rootStore.sessionStore.session)||void 0===u?void 0:u.share),this.createSlidesViewModels(this.story.slides),this.storySlidesReactionDisposer=(0,Me.reaction)((()=>({storySlides:this.story.slides,canBeShown:this.story.canBeShown})),(({storySlides:e,canBeShown:t})=>t?this.createSlidesViewModels(e):[]))}get id(){return this.story.id}get title(){return this.story.title}get statTitle(){return this.story.statTitle}get ugcPayload(){return this.story.ugcPayload}get tags(){return this.story.tags}get sourceInfo(){return this.storyReader.sourceInfo}get canBeShown(){return this.story.canBeShown}get like(){return this.story.like}get favorite(){return this.story.favorite}get hasLike(){return Boolean(this.story.likeFunctional)}get hasShare(){return!!Boolean(this.story.shareFunctional)&&this._hasShare}get hasFavorite(){return Boolean(this.story.favoriteFunctional)}get hasAudio(){return Boolean(this.story.hasAudio)}get context(){return this.story.context}get displayedSlides(){return this._displayedSlides}get activeSlideIndex(){return this._activeSlideIndex}get activeSlide(){return this.slides[this._activeSlideIndex]}get slidesCount(){return this.story.slidesCount}get hiddenTimeline(){return 1===this.story.slides.length&&0===this.story.slides[0].duration||this.story.hideTimeline||this._hiddenTimeline||!this.canBeShown}get displayedSlideImage(){return this.isBlank?null:this.story.getImagesPerSlide(this.activeSlideIndex)}get isBlank(){return this.story.id<0}get reachEnd(){return 0===this.slides.length||this._activeSlideIndex===this.slides.length-1}get reachStart(){return 0===this.activeSlideIndex}get disableClose(){return this.story.disableClose}get error(){return this.story.error}get timer(){return this._timer}nextSlide(){this.reachEnd||this.toSlide(this.activeSlideIndex+1)}prevSlide(){this.reachStart||this.toSlide(this.activeSlideIndex-1)}toSlide(e){e!==this.activeSlideIndex&&(this._activeSlideIndex=e,this.slideApiHandlers.changeActiveSlide(),this._displayedSlides=this.getDisplayedSlides(),this.timer.stop())}updateNavigationHistory(){this.navigationHistory.update(this)}async setLike(e){await this.story.setLike(e),this.storyManager.emitEvent(new _i(this,{value:1===e}))}async setDislike(e){await this.story.setLike(e),this.storyManager.emitEvent(new wi(this,{value:-1===e}))}async setBookmark(e){try{await this.story.setFavorite(e),this.storyManager.emitEvent(new Si(this,{value:e}))}catch(e){console.error(e)}}async share(){this.activeSlide&&(this.storyManager.emitEvent(new Oi(this)),this.activeSlide.screenshotShare?this.sharePanel.shareScreenShot({shareId:"slide-screenshot-share",hideElementsSelector:"",storySlide:this.activeSlide}):await this.performShareText())}markAsOpened(){this.story.markIsOpened()}hideTimeline(){this._hiddenTimeline=!0}showTimeline(){this._hiddenTimeline=!1}setError(e){this.story.setError(e)}reset(){return this.slideApiHandlers.resetStory(this.id)}async reload(){return this.storyReader.reloadStory(this)}destroy(){var e;this.storySlidesReactionDisposer(),null===(e=this.activeSlide)||void 0===e||e.destroy()}pause(){this.timer.pause()}resume(){this.timer.resume()}enableTimer(){this.timer.enable()}disableTimer(){this.timer.disable()}completeNativeSharing(){this.sharePanel.completeNativeSharing({result:!1})}nextStory(e){this.storyReader.nextStoryWithAnimation(e)}prevStory(e){this.storyReader.prevStoryWithAnimation(e)}async updateNarrativeData(e){return this.story.updateNarrativeData(e)}getDisplayedSlides(){return this.slides.length===this.slidesCount?this.slides.slice(this._activeSlideIndex,this._activeSlideIndex+2):[new vn(this,0,this.storySlideRendererFactory,ir.createEmpty())]}createSlidesViewModels(e){this.slides.length!==this.slidesCount&&(this.slides=e.map(((e,t)=>new vn(this,t,this.storySlideRendererFactory,e))),this._displayedSlides=this.getDisplayedSlides())}async performShareText(){try{const e=await this.story.fetchStorySharePath();if(!e)return;this.storyManager.emitEvent(new Ci(this,{url:e}));const t={title:this.story.title,text:"",url:e};this.sharePanel.shareText({shareId:"story-share",config:t,storySlide:this.activeSlide})}catch(e){console.error(e)}}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=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;s=[Me.observable],n=[Me.observable],o=[Me.observable],l=[Me.observable],d=[Me.computed],c=[Me.computed],u=[Me.computed],h=[Me.computed],p=[Me.computed],g=[Me.computed],f=[Me.action],m=[Me.action],v=[Me.action],b=[Me.action],y=[Me.action],w=[Me.action],S=[Me.action],_=[Me.action],On(e,null,s,{kind:"accessor",name:"_activeSlideIndex",static:!1,private:!1,access:{has:e=>"_activeSlideIndex"in e,get:e=>e._activeSlideIndex,set:(e,t)=>{e._activeSlideIndex=t}},metadata:r},x,k),On(e,null,n,{kind:"accessor",name:"_displayedSlides",static:!1,private:!1,access:{has:e=>"_displayedSlides"in e,get:e=>e._displayedSlides,set:(e,t)=>{e._displayedSlides=t}},metadata:r},P,j),On(e,null,o,{kind:"accessor",name:"_hiddenTimeline",static:!1,private:!1,access:{has:e=>"_hiddenTimeline"in e,get:e=>e._hiddenTimeline,set:(e,t)=>{e._hiddenTimeline=t}},metadata:r},M,E),On(e,null,l,{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:r},I,L),On(e,null,d,{kind:"getter",name:"displayedSlides",static:!1,private:!1,access:{has:e=>"displayedSlides"in e,get:e=>e.displayedSlides},metadata:r},null,C),On(e,null,c,{kind:"getter",name:"activeSlideIndex",static:!1,private:!1,access:{has:e=>"activeSlideIndex"in e,get:e=>e.activeSlideIndex},metadata:r},null,C),On(e,null,u,{kind:"getter",name:"activeSlide",static:!1,private:!1,access:{has:e=>"activeSlide"in e,get:e=>e.activeSlide},metadata:r},null,C),On(e,null,h,{kind:"getter",name:"hiddenTimeline",static:!1,private:!1,access:{has:e=>"hiddenTimeline"in e,get:e=>e.hiddenTimeline},metadata:r},null,C),On(e,null,p,{kind:"getter",name:"reachEnd",static:!1,private:!1,access:{has:e=>"reachEnd"in e,get:e=>e.reachEnd},metadata:r},null,C),On(e,null,g,{kind:"getter",name:"reachStart",static:!1,private:!1,access:{has:e=>"reachStart"in e,get:e=>e.reachStart},metadata:r},null,C),On(e,null,f,{kind:"method",name:"toSlide",static:!1,private:!1,access:{has:e=>"toSlide"in e,get:e=>e.toSlide},metadata:r},null,C),On(e,null,m,{kind:"method",name:"setLike",static:!1,private:!1,access:{has:e=>"setLike"in e,get:e=>e.setLike},metadata:r},null,C),On(e,null,v,{kind:"method",name:"setDislike",static:!1,private:!1,access:{has:e=>"setDislike"in e,get:e=>e.setDislike},metadata:r},null,C),On(e,null,b,{kind:"method",name:"setBookmark",static:!1,private:!1,access:{has:e=>"setBookmark"in e,get:e=>e.setBookmark},metadata:r},null,C),On(e,null,y,{kind:"method",name:"share",static:!1,private:!1,access:{has:e=>"share"in e,get:e=>e.share},metadata:r},null,C),On(e,null,w,{kind:"method",name:"markAsOpened",static:!1,private:!1,access:{has:e=>"markAsOpened"in e,get:e=>e.markAsOpened},metadata:r},null,C),On(e,null,S,{kind:"method",name:"hideTimeline",static:!1,private:!1,access:{has:e=>"hideTimeline"in e,get:e=>e.hideTimeline},metadata:r},null,C),On(e,null,_,{kind:"method",name:"showTimeline",static:!1,private:!1,access:{has:e=>"showTimeline"in e,get:e=>e.showTimeline},metadata:r},null,C),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Pn{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e){return new gn(this.narrativeDataCache,this.storyManager,this.storyReader,e)}}const jn=async e=>(await fetch(e)).blob(),Mn=async e=>{const t=await jn(e);return function(e,t=!0){return new Promise((function(r){var i=new FileReader;i.onloadend=function(){if(t){var e=String(i.result).replace("data:","").replace(/^.+,/,"");r(e)}else r(String(i.result))},i.readAsDataURL(e)}))}(new File([t],"image",{type:t.type,lastModified:(new Date).getTime()}),!1)};function En(e,t,r,i){var a=e.indexOf(r,t);if(-1===a)return null;for(var s="",n=a+r.length;n<e.length&&-1===i.indexOf(e[n]);n++)s+=e[n];return{foundAtIndex:a,value:s}}function In(e,t){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e in t)r.setAttributeNS(null,e.replace(/[A-Z]/g,(function(e,t,r,i){return"-"+e.toLowerCase()})),t[e]);return r}var Ln,Tn;function An(e,t,r,i,a,s,n,o,l,d){var c=In("svg",{width:String(a),height:String(s),style:"background-color: #fff;"}),u=In("foreignObject",{x:"0",y:"0",width:"100%",height:"100%"});c.appendChild(u);try{u.style.fontSize=document.body.style.fontSize}catch(e){console.error(e)}!function(){const h=t.cloneNode(!0);if(null!=i&&"string"==typeof i&&i.length>0){const e=Array.prototype.slice.call(h.querySelectorAll(i));for(let t=0;t<e.length;t++){const r=e[t];r&&r.style&&r.style.setProperty&&r.style.setProperty("display","none")}}u.appendChild(h);var p=[];(function(e){for(var t=[],r=0;;){var i=En(e,r,"src: url(",[" ",")","\t"]);if(null==i)break;r=i.foundAtIndex+i.value.length,t.push(i.value.replace(/["']/g,""))}return t})(r).forEach((function(e){p.push(new Promise((function(t,i){Mn(e).then((function(i){r=r.replace(e,i),t()})).catch((function(e){t()}))})))})),u.querySelectorAll("img").forEach((function(e){e.crossOrigin="Anonymous",p.push(new Promise((function(t,r){Mn(e.src).then((function(r){e.onload=r=>e.decode().then((()=>t())),e.onerror=e=>{console.error(e),t()},e.decoding="sync",e.src=r})).catch((function(e){t()}))})))})),u.querySelectorAll("video").forEach((function(e){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)})),u.querySelectorAll(".narrative-element-video").forEach((function(e){e.classList.add("init")})),Promise.all(p).then((function(){const t=In("style",{});t.textContent=r,c.appendChild(t);const i=(new XMLSerializer).serializeToString(c),u=new Image;u.onload=t=>{u.decode().then((function(){setTimeout((function(){const e=document.createElement("canvas"),t=e.getContext("2d");if(t){e.style.width=a+"px",e.style.height=s+"px",e.width=2*a,e.height=2*s,t.scale(2,2),t.drawImage(u,0,0);const r=e.toDataURL(n,o);jn(r).then((function(t){l(t),e.remove()}))}}),e===Ln.IOS?200:void 0)})).catch((e=>{console.log({image:u,encodingError:e},"onDecodeError"),d("error render svg image: "+e)}))},u.onerror=e=>{d("error render svg image: "+e)},u.setAttribute("crossOrigin","Anonymous"),u.crossOrigin="Anonymous",u.decoding="sync",u.src="data:image/svg+xml;base64,"+btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})))}))}()}function Rn(e,t,r,i){return new Promise((function(a,s){null==i&&(i=""),function(e,t,r,i,a,s){An(e,t,r,i,t.clientWidth,t.clientHeight,"image/jpeg",1,a,s)}(e,t,r,i,(function(e){a(new File([e],"image.jpeg",{type:e.type,lastModified:(new Date).getTime()}))}),(function(){console.error("Image fail");const e=new Error;e.name="ImageFail",s(e)}))}))}!function(e){e[e.IOS=0]="IOS",e[e.ANDROID=1]="ANDROID",e[e.OTHER=2]="OTHER"}(Ln||(Ln={})),function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Tn||(Tn={}));class Dn{async getScreenShot({hideElementsSelector:e,slideContent:t}){const r=await Rn(Ln.IOS,t,function(e){let t="";return Array.prototype.slice.call(window.document.styleSheets).forEach((r=>{e(r)&&(t+=Array.prototype.slice.call(r.rules).map((e=>e.cssText)).join(""))})),t}((function(){return!0})),e);return{file:r,url:URL.createObjectURL(r)}}getNavigatorShareFunction(){var e,t;let r=null===(e=navigator.share)||void 0===e?void 0:e.bind(navigator);return!r&&(null===(t=window.parent)||void 0===t?void 0:t.navigator.share)&&(r=window.parent.navigator.share.bind(window.parent.navigator)),r}getFilteredConfigDto(e){const t={};for(const[r,i]of Object.entries(null!=e?e:{}))null!==i&&(t[r]=i);return t}}var Bn=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Fn=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Nn=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Un=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Wn=(()=>{var e,t,r;let i,a,s,n,o,l,d=[],c=[],u=[],h=[],p=[];return e=class{get _isOpened(){return Nn(this,t,"f")}set _isOpened(e){Un(this,t,e,"f")}get _params(){return Nn(this,r,"f")}set _params(e){Un(this,r,e,"f")}constructor(e,i){Object.defineProperty(this,"storyReader",{enumerable:!0,configurable:!0,writable:!0,value:(Bn(this,d),e)}),Object.defineProperty(this,"sharingService",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"nativeSharingId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"nativeSharingRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),t.set(this,Bn(this,c,!1)),r.set(this,(Bn(this,u),Bn(this,h,{id:"",type:Tn.Social,link:""}))),Object.defineProperty(this,"currentStorySlide",{enumerable:!0,configurable:!0,writable:!0,value:(Bn(this,p),null)}),Object.defineProperty(this,"desktopMode",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isOpened(){return this._isOpened}get params(){return this._params}open(e){this.storyReader.pauseTimer(),this._params={link:e.link,type:e.type,text:e.text,id:e.id},this._isOpened=!0}close(){this.storyReader.resumeTimer(),this._isOpened=!1,this._params={id:"",type:Tn.Social,link:""}}handleShareComplete(e,t){var r,i;const a=null!==(i=null===(r=this.currentStorySlide)||void 0===r?void 0:r.findAllWidgetsOfType((e=>e instanceof Pa)))&&void 0!==i?i:[];for(const r of a)r.handleShareComplete({shareId:e,result:t});this.close()}async shareScreenShot({shareId:e,shareText:t,hideElementsSelector:r,storySlide:i}){let a=null;this.currentStorySlide=i;try{const s=await this.sharingService.getScreenShot({hideElementsSelector:r,slideContent:i.$el});a=s.url;const n={files:[s.file],text:t};if(this.desktopMode)return void this.open({type:Tn.SlideScreenshot,id:e,link:a,text:t});await this.startNativeSharing(e,n)}catch(r){console.error(r),a&&this.open({type:Tn.SlideScreenshot,id:e,link:a,text:t})}}async shareText({shareId:e,config:t,storySlide:r}){var i;this.currentStorySlide=r,null==e&&(e="story-share");const a=this.sharingService.getFilteredConfigDto(t),s=a.url=null!==(i=a.url)&&void 0!==i?i:a.text,n={type:Tn.Social,id:e,link:s};try{if(this.desktopMode)return void this.open(n);await this.startNativeSharing(e,a)}catch(e){this.open(n)}}async startNativeSharing(e,t){const r=this.sharingService.getNavigatorShareFunction();if(!r)throw new Error;try{this.storyReader.pauseTimer(),this.runNativeSharing({id:e}),await r(t),this.completeNativeSharing({result:!0})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;throw e}finally{this.completeNativeSharing({result:!1})}}runNativeSharing({id:e}){this.nativeSharingId=e,this.nativeSharingRunning=!0}completeNativeSharing({result:e}){this.nativeSharingRunning&&(this.handleShareComplete(this.nativeSharingId,e),this.nativeSharingRunning=!1,this.nativeSharingId="",this.storyReader.resumeTimer())}},t=new WeakMap,r=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;i=[Me.observable],a=[Me.observable],s=[Me.computed],n=[Me.computed],o=[Me.action],l=[Me.action],Fn(e,null,i,{kind:"accessor",name:"_isOpened",static:!1,private:!1,access:{has:e=>"_isOpened"in e,get:e=>e._isOpened,set:(e,t)=>{e._isOpened=t}},metadata:t},c,u),Fn(e,null,a,{kind:"accessor",name:"_params",static:!1,private:!1,access:{has:e=>"_params"in e,get:e=>e._params,set:(e,t)=>{e._params=t}},metadata:t},h,p),Fn(e,null,s,{kind:"getter",name:"isOpened",static:!1,private:!1,access:{has:e=>"isOpened"in e,get:e=>e.isOpened},metadata:t},null,d),Fn(e,null,n,{kind:"getter",name:"params",static:!1,private:!1,access:{has:e=>"params"in e,get:e=>e.params},metadata:t},null,d),Fn(e,null,o,{kind:"method",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open},metadata:t},null,d),Fn(e,null,l,{kind:"method",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close},metadata:t},null,d),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var zn=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Vn=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Gn=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},$n=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Hn=(()=>{var e,t,r,i;let a,s,n,o,l,d,c,u,h,p=[],g=[],f=[],m=[],v=[],b=[],y=[];return e=class{get _activeStory(){return Gn(this,t,"f")}set _activeStory(e){$n(this,t,e,"f")}get _currentIndex(){return Gn(this,r,"f")}set _currentIndex(e){$n(this,r,e,"f")}get _nextFlippingStoryIndex(){return Gn(this,i,"f")}set _nextFlippingStoryIndex(e){$n(this,i,e,"f")}constructor(e,a){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(zn(this,p),e)}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:a}),t.set(this,zn(this,g,null)),r.set(this,(zn(this,f),zn(this,m,1))),i.set(this,(zn(this,v),zn(this,b,-1))),Object.defineProperty(this,"animatedTransitionAdapter",{enumerable:!0,configurable:!0,writable:!0,value:(zn(this,y),null)}),Object.defineProperty(this,"currentStoryDisplayStrategy",{enumerable:!0,configurable:!0,writable:!0,value:null})}get reachStart(){return 1===this._currentIndex}get reachEnd(){return this._currentIndex===this.storyReaderViewModel.stories.length-2}get nextFlippingStoryIndex(){return this._nextFlippingStoryIndex}get activeStory(){return this._activeStory}get currentIndex(){return this._currentIndex}setAnimatedTransitionAdapter(e){this.animatedTransitionAdapter=e}setCurrentStoryDisplayStrategy(e){this.currentStoryDisplayStrategy=e}nextStory(){var e;this.reachEnd||(null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex+1),this.currentStoryDisplayStrategy.handleNextStoryByIndex(this._currentIndex-1))}prevStory(){var e;this.reachStart||(null===(e=this.activeStory)||void 0===e||e.markAsOpened(),this.setActiveStoryByIndex(this._currentIndex-1),this.currentStoryDisplayStrategy.handleNextStoryByIndex(this._currentIndex-1))}nextStoryWithAnimation(e){this.storyReaderViewModel.reachEnd?this.handleStoryReaderReachEnd(e):this.navigateStoryWithAnimation(this._currentIndex+1,e)}prevStoryWithAnimation(e){this.reachStart||this.navigateStoryWithAnimation(this.currentIndex-1,e)}destroy(){this._activeStory=null}setActiveStoryById(e){const t=this.storyReaderViewModel.stories;this._currentIndex=t.findIndex((t=>t.id===e)),this._activeStory=t[this._currentIndex]}resetActiveStory(){this._activeStory=null}navigateStoryWithAnimation(e,t="lastSlideClick"){this._nextFlippingStoryIndex=e,this.handleNextFlippingStoryIndexChange(e,t)}handleStoryReaderReachEnd(e){var t;"auto"!==e?this.storyReaderViewModel.close("lastSlideClick"):(null===(t=this.animatedTransitionAdapter)||void 0===t?void 0:t.options.closeOnLastSlideByTimer)&&this.storyReaderViewModel.close("auto")}async handleNextFlippingStoryIndexChange(e,t){var r;if(-1===e)return;const i=this.currentIndex<e?1:-1;await(null===(r=this.animatedTransitionAdapter)||void 0===r?void 0:r.transitionByDirection(i)),this.handleStoryFlippingTransitionEnd(e,t)}handleStoryFlippingTransitionEnd(e,t){this.storyReaderViewModel.emitCloseStoryEvent(t);1===(this.currentIndex<e?1:-1)?this.nextStory():this.prevStory(),this._nextFlippingStoryIndex=-1}setActiveStoryByIndex(e){this._currentIndex=e,this._activeStory=this.storyReaderViewModel.stories[this._currentIndex],this.handleActiveStoryError(this._activeStory)}handleActiveStoryError(e){e.error&&this.storyManager.emit("showStoryFailed",Object.assign({id:e.id,title:e.title},e.error))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;a=[Me.observable],s=[Me.observable],n=[Me.observable],o=[Me.computed],l=[Me.computed],d=[Me.action],c=[Me.action],u=[Me.action],h=[Me.action],Vn(e,null,a,{kind:"accessor",name:"_activeStory",static:!1,private:!1,access:{has:e=>"_activeStory"in e,get:e=>e._activeStory,set:(e,t)=>{e._activeStory=t}},metadata:t},g,f),Vn(e,null,s,{kind:"accessor",name:"_currentIndex",static:!1,private:!1,access:{has:e=>"_currentIndex"in e,get:e=>e._currentIndex,set:(e,t)=>{e._currentIndex=t}},metadata:t},m,v),Vn(e,null,n,{kind:"accessor",name:"_nextFlippingStoryIndex",static:!1,private:!1,access:{has:e=>"_nextFlippingStoryIndex"in e,get:e=>e._nextFlippingStoryIndex,set:(e,t)=>{e._nextFlippingStoryIndex=t}},metadata:t},b,y),Vn(e,null,o,{kind:"getter",name:"reachStart",static:!1,private:!1,access:{has:e=>"reachStart"in e,get:e=>e.reachStart},metadata:t},null,p),Vn(e,null,l,{kind:"getter",name:"reachEnd",static:!1,private:!1,access:{has:e=>"reachEnd"in e,get:e=>e.reachEnd},metadata:t},null,p),Vn(e,null,d,{kind:"method",name:"nextStory",static:!1,private:!1,access:{has:e=>"nextStory"in e,get:e=>e.nextStory},metadata:t},null,p),Vn(e,null,c,{kind:"method",name:"prevStory",static:!1,private:!1,access:{has:e=>"prevStory"in e,get:e=>e.prevStory},metadata:t},null,p),Vn(e,null,u,{kind:"method",name:"nextStoryWithAnimation",static:!1,private:!1,access:{has:e=>"nextStoryWithAnimation"in e,get:e=>e.nextStoryWithAnimation},metadata:t},null,p),Vn(e,null,h,{kind:"method",name:"prevStoryWithAnimation",static:!1,private:!1,access:{has:e=>"prevStoryWithAnimation"in e,get:e=>e.prevStoryWithAnimation},metadata:t},null,p),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var qn,Qn,Kn=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Yn=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Jn=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Zn=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};!function(e){e.RedirectToStory="redirectToStory",e.CloseStory="closeStory",e.ShowMultipleStories="showMultipleStories",e.ReloadStory="reloadStory"}(qn||(qn={})),function(e){e.Close="closeStoryReader"}(Qn||(Qn={}));let Xn=(()=>{var e,t,r,i,a,s;let n,o,l,d,c,u,h,p,g,f,m,v,b,y,w,S=ce,_=[],O=[],C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[];return e=class extends S{get _uiPaused(){return Jn(this,t,"f")}set _uiPaused(e){Zn(this,t,e,"f")}get _muted(){return Jn(this,r,"f")}set _muted(e){Zn(this,r,e,"f")}get _timerPaused(){return Jn(this,i,"f")}set _timerPaused(e){Zn(this,i,e,"f")}get _closeGestureInAction(){return Jn(this,a,"f")}set _closeGestureInAction(e){Zn(this,a,e,"f")}get _stories(){return Jn(this,s,"f")}set _stories(e){Zn(this,s,e,"f")}constructor(n,o,l){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Kn(this,_),n)}),Object.defineProperty(this,"statisticsService",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"storiesApi",{enumerable:!0,configurable:!0,writable:!0,value:l}),t.set(this,Kn(this,O,!1)),r.set(this,(Kn(this,C),Kn(this,x,!0))),i.set(this,(Kn(this,k),Kn(this,P,!1))),a.set(this,(Kn(this,j),Kn(this,M,!1))),s.set(this,(Kn(this,E),Kn(this,I,Me.observable.map()))),Object.defineProperty(this,"_uiLocked",{enumerable:!0,configurable:!0,writable:!0,value:(Kn(this,L),!1)}),Object.defineProperty(this,"scrollbarHelper",{enumerable:!0,configurable:!0,writable:!0,value:new zs(window)}),Object.defineProperty(this,"_sourceInfo",{enumerable:!0,configurable:!0,writable:!0,value:{listType:Dt.DEFAULT,feedSlug:""}}),Object.defineProperty(this,"windowReferer",{enumerable:!0,configurable:!0,writable:!0,value:ae.default}),Object.defineProperty(this,"currentStoryDisplayStrategy",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"navigationHistory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyDisplayStrategyFactory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_touchController",{enumerable:!0,configurable:!0,writable:!0,value:new Ua({touchStartTimeout:200})}),Object.defineProperty(this,"_sharePanelViewModel",{enumerable:!0,configurable:!0,writable:!0,value:new Wn(this,new Dn)}),Object.defineProperty(this,"navigationController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new hn}),this.navigationHistory=new Ri(this.storyManager,this),this.handleWindowUnload=this.handleWindowUnload.bind(this),this.handleEscKeydown=this.handleEscKeydown.bind(this),n.setViewModel(e.id,this),window.addEventListener("beforeunload",this.handleWindowUnload),this.storyDisplayStrategyFactory=new qi(n,this),this.handleVisibilityChange=this.handleVisibilityChange.bind(this),this.navigationController=new Hn(this.storyManager,this)}get nextFlippingStoryIndex(){return this.navigationController.nextFlippingStoryIndex}get sharePanel(){return this._sharePanelViewModel}get touchController(){return this._touchController}get feedSlug(){var e;return null!==(e=this.sourceInfo.feedSlug)&&void 0!==e?e:""}get sourceInfo(){return this._sourceInfo}get muted(){return this._muted}get uiPaused(){return this._uiPaused}get timerPaused(){return this._timerPaused}get closeGestureInAction(){return this._closeGestureInAction}get stories(){return Array.from(this._stories.values())}get activeStory(){return this.navigationController.activeStory}get isOpened(){return Boolean(this.navigationController.activeStory)}get activeStoryIndex(){return this.navigationController.currentIndex}get reachStart(){return this.navigationController.reachStart}get reachEnd(){return this.navigationController.reachEnd}getStatisticsData(){return this.statisticsService.getData()}cleanupStatisticsData(){return this.statisticsService.cleanupData()}open(e,t){this.resetReaderToDefaultState(),this.windowReferer=e.windowReferer,this.setScrollBar(e.windowReferer),this._sourceInfo=t,this.setStories(e.stories),this.navigationController.setActiveStoryById(e.id),this.navigationController.setCurrentStoryDisplayStrategy(this.currentStoryDisplayStrategy),this.statisticsService.init(t),this.storyManager.getConfig().enableStatistic(),this._touchController.init(document.body),document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("keydown",this.handleEscKeydown)}close(e="closeReaderByCloseBtn"){var t;this.activeStory&&!(null===(t=this.activeStory)||void 0===t?void 0:t.disableClose)&&(this.resetScrollBar(this.windowReferer),this.emit(Qn.Close),this.sourceInfo.listType===Dt.DEFAULT&&vi.emit(Qn.Close,{id:this.activeStory.id}),this.emitCloseStoryEvent(e),this.resetReaderToDefaultState(),this._sourceInfo={listType:Dt.DEFAULT,feedSlug:""},this.navigationController.destroy())}resetReaderToDefaultState(){if(this.isOpened){if(this.activeStory){const e=this.activeStory.id,t=this.activeStory.activeSlideIndex;vi.emit(Li.CloseStoryReader,{storyId:e,slideIndex:t}),this.activeStory.markAsOpened()}this.resumeUI(),this.sharePanel.close(),this.navigationHistory.reset(),this.statisticsService.destroy(),this.clearStoryViewModels(),this._touchController.destroy(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("keydown",this.handleEscKeydown),this.navigationController.resetActiveStory()}}emitCloseStoryEvent(e){this.activeStory&&this.storyManager.emitEvent(new yi(this.activeStory,{action:e}))}canBeClosed(){return!(!this.activeStory||this.activeStory.isBlank)&&!this.activeStory.disableClose}async showStory(e){this.currentStoryDisplayStrategy=this.storyDisplayStrategyFactory.createShowStory(),await this.currentStoryDisplayStrategy.show({storyId:e})}async showStoryOnce(e){this.currentStoryDisplayStrategy=this.storyDisplayStrategyFactory.createShowStoryOnce(),await this.currentStoryDisplayStrategy.show({storyId:e})}async showStoryFromSharePage(e,t){try{const r=this.storyDisplayStrategyFactory.createShowStoryFromSharePage();return this.currentStoryDisplayStrategy=r,await r.show({storyId:e,fetchShareUrl:t}),t&&this.storyManager.getConfig().disableStatistic(),!0}catch(e){return!1}}async showOnboardingStories(e){const t=this.storyDisplayStrategyFactory.createShowOnboardingStories();return this.currentStoryDisplayStrategy=t,t.show(e)}async showMultipleStories(e){var t;const r=this.storyDisplayStrategyFactory.createShowMultipleStories();this.currentStoryDisplayStrategy=r,await r.show({storyId:e.storyId,storyFeed:e.storyFeed,windowReferer:null!==(t=e.windowReferer)&&void 0!==t?t:ae.default,filter:e.filter})}async reloadStory(e){var t;e.setError(null),null===(t=this.currentStoryDisplayStrategy)||void 0===t||t.reload({storyId:e.id,feedType:this.sourceInfo.listType,feedSlug:this.sourceInfo.feedSlug})}nextStory(){return this.navigationController.nextStory()}prevStory(){return this.navigationController.prevStory()}nextStoryWithAnimation(e){return this.navigationController.nextStoryWithAnimation(e)}prevStoryWithAnimation(e){return this.navigationController.prevStoryWithAnimation(e)}navigateStoryWithAnimationByIndex(e,t){this.navigationController.navigateStoryWithAnimation(e,t)}destroy(){this.removeAllListeners(),window.removeEventListener("beforeunload",this.handleWindowUnload),this.storyManager.deleteViewModel(e.id)}closeGoodsWidget(){vi.emit("goodsWidget.close")}enableStoryTimer(){this._stories.forEach((e=>e.enableTimer()))}disableStoryTimer(){this._stories.forEach((e=>e.disableTimer()))}setAnimatedTransitionAdapter(e){this.navigationController.setAnimatedTransitionAdapter(e)}resumeTimer(){this._uiLocked=!1,this._timerPaused=!1}pauseTimer(){this._uiLocked=!0,this._timerPaused=!0}pauseUI(){this._uiPaused=!0,this.pauseTimer()}resumeUI(){this._uiPaused=!1,this.resumeTimer()}mute(){this._muted=!0}unmute(){this._muted=!1}enableCloseGesture(){this._closeGestureInAction=!0}disableCloseGesture(){this._closeGestureInAction=!1}setStories(e){const t=new lr({id:-1},this.storyManager.rootStore,this.storiesApi),r=new lr({id:-2},this.storyManager.rootStore,this.storiesApi);e=[t,...e,r];const i=new Sn(this.storyManager,this,this._touchController),a=new Pn(this.storyManager,this,this.narrativeDataCache);for(const t of e)this._stories.set(t.id,new kn(this.storyManager,this,this._sharePanelViewModel,t,this.navigationHistory,i,a))}handleVisibilityChange(){"hidden"===document.visibilityState&&this.pauseTimerByVisibility(),"visible"===document.visibilityState&&this.resumeTimerByVisibility()}resumeTimerByVisibility(){this._uiLocked||(this._timerPaused=!1)}pauseTimerByVisibility(){this._uiLocked||(this._timerPaused=!0)}handleEscKeydown(e){27===e.keyCode&&this.close("closeReaderByEscBtn")}clearStoryViewModels(){for(const e of this._stories.values())e.destroy();this._stories=Me.observable.map()}setScrollBar(e){e===ae.default&&this.scrollbarHelper.setScrollbar()}resetScrollBar(e){e===ae.default&&this.scrollbarHelper.resetScrollbar()}handleWindowUnload(e){this.activeStory&&(vi.emit(Li.NextSlide,{fromStoryId:this.activeStory.id,fromSlideIndex:this.activeStory.activeSlideIndex}),this.statisticsService.sendData())}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=S[Symbol.metadata])&&void 0!==t?t:null):void 0;n=[Me.observable],o=[Me.observable],l=[Me.observable],d=[Me.observable],c=[Me.observable],u=[Me.computed],h=[Me.computed],p=[Me.action],g=[Me.action],f=[Me.action],m=[Me.action],v=[Me.action],b=[Me.action],y=[Me.action],w=[Me.action],Yn(e,null,n,{kind:"accessor",name:"_uiPaused",static:!1,private:!1,access:{has:e=>"_uiPaused"in e,get:e=>e._uiPaused,set:(e,t)=>{e._uiPaused=t}},metadata:r},O,C),Yn(e,null,o,{kind:"accessor",name:"_muted",static:!1,private:!1,access:{has:e=>"_muted"in e,get:e=>e._muted,set:(e,t)=>{e._muted=t}},metadata:r},x,k),Yn(e,null,l,{kind:"accessor",name:"_timerPaused",static:!1,private:!1,access:{has:e=>"_timerPaused"in e,get:e=>e._timerPaused,set:(e,t)=>{e._timerPaused=t}},metadata:r},P,j),Yn(e,null,d,{kind:"accessor",name:"_closeGestureInAction",static:!1,private:!1,access:{has:e=>"_closeGestureInAction"in e,get:e=>e._closeGestureInAction,set:(e,t)=>{e._closeGestureInAction=t}},metadata:r},M,E),Yn(e,null,c,{kind:"accessor",name:"_stories",static:!1,private:!1,access:{has:e=>"_stories"in e,get:e=>e._stories,set:(e,t)=>{e._stories=t}},metadata:r},I,L),Yn(e,null,u,{kind:"getter",name:"stories",static:!1,private:!1,access:{has:e=>"stories"in e,get:e=>e.stories},metadata:r},null,_),Yn(e,null,h,{kind:"getter",name:"isOpened",static:!1,private:!1,access:{has:e=>"isOpened"in e,get:e=>e.isOpened},metadata:r},null,_),Yn(e,null,p,{kind:"method",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open},metadata:r},null,_),Yn(e,null,g,{kind:"method",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close},metadata:r},null,_),Yn(e,null,f,{kind:"method",name:"reloadStory",static:!1,private:!1,access:{has:e=>"reloadStory"in e,get:e=>e.reloadStory},metadata:r},null,_),Yn(e,null,m,{kind:"method",name:"nextStory",static:!1,private:!1,access:{has:e=>"nextStory"in e,get:e=>e.nextStory},metadata:r},null,_),Yn(e,null,v,{kind:"method",name:"prevStory",static:!1,private:!1,access:{has:e=>"prevStory"in e,get:e=>e.prevStory},metadata:r},null,_),Yn(e,null,b,{kind:"method",name:"nextStoryWithAnimation",static:!1,private:!1,access:{has:e=>"nextStoryWithAnimation"in e,get:e=>e.nextStoryWithAnimation},metadata:r},null,_),Yn(e,null,y,{kind:"method",name:"prevStoryWithAnimation",static:!1,private:!1,access:{has:e=>"prevStoryWithAnimation"in e,get:e=>e.prevStoryWithAnimation},metadata:r},null,_),Yn(e,null,w,{kind:"method",name:"navigateStoryWithAnimationByIndex",static:!1,private:!1,access:{has:e=>"navigateStoryWithAnimationByIndex"in e,get:e=>e.navigateStoryWithAnimationByIndex},metadata:r},null,_),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),Object.defineProperty(e,"id",{enumerable:!0,configurable:!0,writable:!0,value:"StoryReaderViewModel"}),e})();class eo{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){const e=new Ai(this.storyManager),t=new Ti(this.storyManager,e);return new Xn(this.storyManager,t,new Qt(this.storyManager))}}class to{constructor(e,t){Object.defineProperty(this,"animatedSlider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t})}transitionByDirection(e){return this.animatedSlider.transformWithAmimation(e)}}class ro{constructor(e){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_mode",{enumerable:!0,configurable:!0,writable:!0,value:ms.None}),Object.defineProperty(this,"_defaultPrevented",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_direction",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._direction=this.calcDirection()}get mode(){return this._mode}get direction(){return this._direction}get defaultPrevented(){return this._defaultPrevented||this.slide.navigationDisabled}get navigationDisabled(){return!1}preventDefault(){this._defaultPrevented=!0}disableNextClick(){this._mode=ms.DisableNext}navigate(){this.direction<0?this.toPrev():this.mode!==ms.DisableNext&&this.toNext()}toPrev(){}toNext(){}calcClickPosition(){return.3}calcDirection(){return this.calcClickPosition()<=.3?-1:1}}var io=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},ao=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0};let so=(()=>{var e;let t,r=ce,i=[];return e=class extends r{constructor(e,t,r){super(),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:(io(this,i),e)}),Object.defineProperty(this,"iamMessageSlide",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"messageSlideRendererFactory",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"slideRenderer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.slideRenderer=this.messageSlideRendererFactory.create({slide:this,message:this.message}),this.handleDocumentVisibilityChange=this.handleDocumentVisibilityChange.bind(this)}get isLoading(){return this.slideRenderer.state===bs.Loading}get html(){return this.iamMessageSlide.html}get state(){return this.slideRenderer.state}get navigationDisabled(){return this.slideRenderer.navigationDisabled}async init(e){return this.slideRenderer.init(e)}async start(){return document.addEventListener("visibilitychange",this.handleDocumentVisibilityChange),this.slideRenderer.start()}async reload(){return this.slideRenderer.reload()}stop(){return document.removeEventListener("visibilitychange",this.handleDocumentVisibilityChange),this.slideRenderer.stop()}pause(){return this.slideRenderer.pause()}resume(){return this.slideRenderer.resume()}pauseAndLock(){return this.locked=!0,this.pause()}resumeAndUnlock(){return this.locked=!1,this.resume()}mute(){this.slideRenderer.mute()}unmute(){this.slideRenderer.unmute()}onClick(e){const t=new ro(this);this.slideRenderer.onClick({target:e,navigationController:t})}onLinkClick(e){this.slideRenderer.onClickLinkElement(e.target)}async showLayerByIndex(e){try{await this.slideRenderer.showLayerByIndex(e)}catch(e){}}destroy(){return this.slideRenderer.stop()}showToast(e){new Wa(Object.assign({getMountPoint:()=>this.slideRenderer.$el},e))}handleDocumentVisibilityChange(){this.locked||("hidden"===document.visibilityState&&this.pause(),"visible"===document.visibilityState&&this.resume())}},(()=>{var a;const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(a=r[Symbol.metadata])&&void 0!==a?a:null):void 0;t=[Me.computed],ao(e,null,t,{kind:"getter",name:"isLoading",static:!1,private:!1,access:{has:e=>"isLoading"in e,get:e=>e.isLoading},metadata:s},null,i),s&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})})(),e})();class no{constructor(e,t,r,i){Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"iamMessage",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"deferredActionsQueue",{enumerable:!0,configurable:!0,writable:!0,value:new pn}),Object.defineProperty(this,"activeMessageNarrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new hn}),Object.defineProperty(this,"execCalled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}exec(){this.activeMessageNarrativeDataCache.clear(),this.deferredActionsQueue.exec(),this.deferredActionsQueue.flush(),this.execCalled=!0}changeActiveSlide(){this.execCalled=!1}async getCardLocalData(){let e=this.narrativeDataCache.get(`iam_${this.iamMessage.id}_data_${this.storyManager.rootStore.sessionStore.userId}`);return e?JSON.parse(e):{}}setCardLocalData(e,t){let r=JSON.stringify(e);this.narrativeDataCache.set(`iam_${this.iamMessage.id}_data_${this.storyManager.rootStore.sessionStore.userId}`,r),t&&this.iamMessage.updateUserData(r).catch(console.error)}getCardServerData(e){var t,r;return null!==(r=null===(t=this.iamMessage.context.widgetsData._narrative_saved_data)||void 0===t?void 0:t[e])&&void 0!==r?r:null}updateCardServerData(e,t){this.iamMessage.context.widgetsData._narrative_saved_data=t}getSlideDuration(e,t){var r,i,a;return null!==(a=null===(i=null===(r=this.iamMessage.context.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[e])||void 0===i?void 0:i[t])&&void 0!==a?a:null}pauseUI(){this.iamMessage.activeSlide.pause()}resumeUI(){this.iamMessage.activeSlide.resume()}showCardTextInput(e,t){}setCardSessionValue(e,t){this.activeMessageNarrativeDataCache.set(e,t)}getCardSessionValue(e){return this.activeMessageNarrativeDataCache.get(e)}getWidgetsSharedData(e,t){var r,i,a;const s=this.iamMessage.context.widgetsData;switch(t){case"rangeSlider":return null===(r=s._narrative_range_slider_data)||void 0===r?void 0:r[e];case"poll":return null===(i=s._narrative_poll_data)||void 0===i?void 0:i[e];case"vote":return null===(a=s._narrative_vote_data)||void 0===a?void 0:a[e]}return null}openUrl(e){window.open(e,"_parent")}async sendApiRequest(e,t,r,i,a,s){var n,o,l;try{const s=await ke.request({url:e,method:t,params:null!=r?r:{},headers:null!=i?i:{},data:null!=a?a:{}});return{status:s.status,headers:s.headers,data:s.data}}catch(e){if(e instanceof ve)return{status:null!==(n=e.networkStatus)&&void 0!==n?n: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.iamMessage.activeSlide.showLayerByIndex(e)}showCardSlide(e){}cardShowNext(){}showNextSlide(e){}sendStatisticEvent(e,t,r){let i=null;switch(e){case"w-copy":i=new Ur(r.widget_id,r.widget_value,r.widget_label);break;case"w-share":i=new Gr(r.widget_id,r.widget_answer,r.widget_label,r.widget_value,r.widget_answer_label);break;case"w-rate-answer":i=new Vr(r.widget_id,r.widget_answer,r.widget_label,r.widget_value);break;case"w-range-slider-answer":i=new zr(r.widget_id,r.widget_answer,r.widget_label)}i&&(this.iamMessage.trackWidgetEvent(i),this.iamReader.emitWidgetEvent(i))}destroy(){}async resetCard(e){}pushToDefferedActionsQueueOrExec(e){this.execCalled?e():this.deferredActionsQueue.push(e)}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:[]}updateTimeline(e,t,r,i,a,s){}showToast(e){this.iamMessage.activeSlide.showToast({content:e})}}class oo extends ce{constructor(e,t,r,i){super(),Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"iamMessage",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_openTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new hn}),this.slideApiHandlers=new no(this.narrativeDataCache,this.storyManager,this.iamReader,this),this._slides=this.iamMessage.slides.map((e=>new so(this,e,i)))}get id(){return this.iamMessage.id}get activeSlideIndex(){return this.iamMessage.activeSlideIndex}get activeSlide(){return this.slides[this.activeSlideIndex]}get openTime(){return this._openTime}get slides(){return this._slides}get context(){return this.iamMessage.context}get appearanceOptions(){return this.iamMessage.appearanceOptions}get type(){return this.iamMessage.type}async trackOpen(){await this.iamMessage.trackOpen()}async trackClose(){await this.iamMessage.trackClose()}async trackWidgetEvent(e){await this.iamMessage.trackWidgetEvent(e)}async updateUserData(e){return this.iamMessage.updateUserData(e)}toPublicDto(){return this.iamMessage.toPublicDto()}destroy(){}}class lo{constructor(e){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e})}handle(e){this.iamReader.close()}}class co{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamMessage",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"messageSlide",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){var t;this.iamMessage.trackWidgetEvent(new Wr(e.elementId,e.linkTarget,""));try{await this.storyManager.openGame(e.linkTarget),this.messageSlide.pauseAndLock(),null===(t=this.storyManager.gameReaderViewModel)||void 0===t||t.once(Vs.Close,(()=>{this.messageSlide.resumeAndUnlock()}))}catch(e){console.error(e)}}}class uo{constructor(e,t,r){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"iamMessage",{enumerable:!0,configurable:!0,writable:!0,value:r})}handle(e){const t=decodeURIComponent(e.linkTarget);this.emitWidgetEvent(t,e.elementId),this.emitClickOnButtonEvent(t,e.elementId)}emitWidgetEvent(e,t){const r=new Wr(t,e,"");this.iamMessage.trackWidgetEvent(r),this.iamReader.emitWidgetEvent(r)}emitClickOnButtonEvent(e,t){const r=this.getClickOnButtonEventPayload(e,t);this.iamReader.emit(bo.ClickOnButton,r),this.storyManager.clickOnButtonAction({src:Y.IAM_READER,payload:r})}getClickOnButtonEventPayload(e,t){return{id:this.iamMessage.id,index:this.iamMessage.activeSlideIndex,url:e,elementId:t}}}class ho{constructor(e,t,r){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"messageSlide",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){const t=parseInt(e.linkTarget);try{await this.storyManager.showStory(t),this.messageSlide.pauseAndLock(),this.storyManager.storyReaderViewModel.once(Qn.Close,(()=>{this.messageSlide.resumeAndUnlock()}))}catch(e){console.error(e)}}}class po{handle(e){console.log(`There is no action handler for <${e.linkType}:${e.linkTarget}>`)}}class go{constructor(e,t,r,i){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"messageSlide",{enumerable:!0,configurable:!0,writable:!0,value:i})}create(e){switch(e){case"url":return new uo(this.iamReader,this.storyManager,this.message);case"story":return new ho(this.iamReader,this.storyManager,this.messageSlide);case"game":return new co(this.storyManager,this.message,this.messageSlide);case"closeIAM":return new lo(this.iamReader)}return new po}}class fo{constructor(e,t,r){Object.defineProperty(this,"slide",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApiHandlers",{enumerable:!0,configurable:!0,writable:!0,value:r})}onSlideBeforeInit(){}onSlideAfterInit(){}async onSlideStarted(){this.slideApiHandlers.exec()}onSlideStop(){}onSlideStateChanged(e){}onSlideLoadStart(){}onSlideLoadEnd(){}onSlideResume(){}onSlidePause(){}onSlideVideoError(){}onSlideDestroy(){}}class mo{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:r})}create({slide:e,message:t}){const r=new Qi,i=new sa(t.slideApiHandlers),a=new tn(new go(this.storyManager,this.iamReader,t,e)),s=(0,ra.getSlideApi)(t.slideApiHandlers),n=new xs(new fo(e,t,t.slideApiHandlers),i,s.Animation,r,a);return this.registerWidgets({widgetManager:i,slideApi:s,message:t,slide:e}),n}registerWidgets({widgetManager:e,slideApi:t,message:r,slide:i}){e.registerManyFactories([new Aa(t),new la(t),new ca(t),new ha(t),new Da(t),new ga(t),new ma(t),new Ca(this.touchController,t),new ka(t),new ja(t),new fs(t,this.touchController,i),new La(t)])}}class vo extends Error{constructor(e){super(`[IAM]: you must close IAM with ID ${e}`),this.name="IamMessageOpenError"}}var bo,yo=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},wo=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},So=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},_o=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};!function(e){e.Loaded="loaded",e.Close="close",e.WidgetEvent="widgetEvent",e.ClickOnButton="clickOnButton"}(bo||(bo={}));let Oo=(()=>{var e,t;let r,i,a,s,n=ce,o=[],l=[],d=[];return e=class extends n{get _activeMessage(){return So(this,t,"f")}set _activeMessage(e){_o(this,t,e,"f")}constructor(r,i,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(yo(this,o),r)}),Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"iamDisplayService",{enumerable:!0,configurable:!0,writable:!0,value:a}),t.set(this,yo(this,l,null)),Object.defineProperty(this,"visibilityObserver",{enumerable:!0,configurable:!0,writable:!0,value:yo(this,d)}),Object.defineProperty(this,"_touchController",{enumerable:!0,configurable:!0,writable:!0,value:new Ua}),Object.defineProperty(this,"scrollbarHelper",{enumerable:!0,configurable:!0,writable:!0,value:new zs(window)}),Object.defineProperty(this,"eventPublisher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storyManager.setViewModel(e.id,this),this.visibilityObserver=new ni(this)}get touchController(){return this._touchController}get activeMessage(){return this._activeMessage}get isLoaded(){return this.iamStore.isLoaded}get isLoading(){return this.iamStore.isLoading}get isOpened(){return Boolean(this._activeMessage)}async preload(e){await this.storyManager.waitStoryManagerConfig();return await this.iamStore.preload(e)}async showMessageById(e,t){await this.storyManager.waitStoryManagerConfig(),this.checkMessageNotOpened();const r=await this.iamDisplayService.getMessageById(e,t);return await this.open(r),r}async showMessageByEvent(e,t){await this.storyManager.waitStoryManagerConfig(),this.checkMessageNotOpened();const r=await this.iamDisplayService.getMessageByEvent(e,t);return await this.open(r),r}async close(){this._activeMessage&&(this.emitCloseEvent(this._activeMessage),this.clearActiveMessage(),this.visibilityObserver.unsubscribe(),this.touchController.destroy(),this.scrollbarHelper.resetScrollbar())}async open(e){e.updatePlaceholders(this.storyManager.rootStore.placeholderStore.placeholders),this.touchController.init(document.body),this.setActiveMessage(e),this.visibilityObserver.subscribe(),this.scrollbarHelper.setScrollbar()}destroy(){this.storyManager.deleteViewModel(e.id)}emitWidgetEvent(e){this.emit(bo.WidgetEvent,{message:this.activeMessage.toPublicDto(),name:e.type,data:e.toJSON()})}setEventPublisher(e){this.eventPublisher=e}emit(e,...t){return super.emit(e,...t),this.eventPublisher.emit(e,...t)}emitCloseEvent(e){this.emit(bo.Close,{message:e.toPublicDto()})}setActiveMessage(e){const t=this.createIamMessageViewModel(e);t.trackOpen(),this._activeMessage=t}clearActiveMessage(){this._activeMessage&&(this._activeMessage.trackClose(),this._activeMessage=null)}createIamMessageViewModel(e){const t=new mo(this.storyManager,this,this.touchController);return new oo(this,this.storyManager,e,t)}checkMessageNotOpened(){if(this.activeMessage)throw new vo(this.activeMessage.id)}},t=new WeakMap,(()=>{var t;const c="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=n[Symbol.metadata])&&void 0!==t?t:null):void 0;r=[Me.observable],i=[Me.action],a=[Me.action],s=[Me.action],wo(e,null,r,{kind:"accessor",name:"_activeMessage",static:!1,private:!1,access:{has:e=>"_activeMessage"in e,get:e=>e._activeMessage,set:(e,t)=>{e._activeMessage=t}},metadata:c},l,d),wo(e,null,i,{kind:"method",name:"showMessageById",static:!1,private:!1,access:{has:e=>"showMessageById"in e,get:e=>e.showMessageById},metadata:c},null,o),wo(e,null,a,{kind:"method",name:"showMessageByEvent",static:!1,private:!1,access:{has:e=>"showMessageByEvent"in e,get:e=>e.showMessageByEvent},metadata:c},null,o),wo(e,null,s,{kind:"method",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close},metadata:c},null,o),c&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:c})})(),Object.defineProperty(e,"id",{enumerable:!0,configurable:!0,writable:!0,value:"IamReaderViewModel"}),e})();class Co{constructor(e){Object.defineProperty(this,"iamReader",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventEmitter",{enumerable:!0,configurable:!0,writable:!0,value:new L.default}),this.iamReader.setEventPublisher(this.eventEmitter)}get activeMessage(){var e;return null===(e=this.iamReader.activeMessage)||void 0===e?void 0:e.toPublicDto()}get isLoaded(){return this.iamReader.isLoaded}get isLoading(){return this.iamReader.isLoading}get isOpened(){return this.iamReader.isOpened}async preload(e){const t=(await this.iamReader.preload({tags:null==e?void 0:e.tags})).map((e=>e.toPublicDto()));return this.eventEmitter.emit(bo.Loaded,{messages:t}),t}async showMessageById(e,t){return(await this.iamReader.showMessageById(e,{showOnlyIfLoaded:null==t?void 0:t.showOnlyIfLoaded})).toPublicDto()}async showMessageByEvent(e,t){return(await this.iamReader.showMessageByEvent(e,{showOnlyIfLoaded:null==t?void 0:t.showOnlyIfLoaded,tags:null==t?void 0:t.tags})).toPublicDto()}async close(){return this.iamReader.close()}on(e,t){return this.eventEmitter.on(e,t),this}once(e,t){return this.eventEmitter.once(e,t),this}off(e,t){return this.eventEmitter.off(e,t),this}}class xo{constructor(e,t){var r,i,a,s,n,o;Object.defineProperty(this,"storyFeed",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSwipeUp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isOpened",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstanceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"hideTimeline",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.id=e.id,this.title=e.title,this.titleColor=e.titleColor,this.hasAudio=null!==(r=e.hasAudio)&&void 0!==r&&r,this.hasSwipeUp=null!==(i=e.hasSwipeUp)&&void 0!==i&&i,this.isOpened=e.isOpened,this.deeplink=null!==(a=e.deeplink)&&void 0!==a?a:void 0,this.gameInstanceId=null!==(n=null===(s=e.gameInstance)||void 0===s?void 0:s.id)&&void 0!==n?n:void 0,this.hideInReader=null!==(o=e.hideInReader)&&void 0!==o&&o,this.hideTimeline=e.hideTimeline,this.isOpened=e.isOpened,this.story=e}getCover(e){var t,r,i,a;return{imageSrc:null===(r=null===(t=this.story.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url,videoSrc:null!==(i=this.story.videoCoverSrc)&&void 0!==i?i:void 0,backgroundColor:this.story.backgroundColor,feedCoverSrc:null===(a=this.storyFeed)||void 0===a?void 0:a.coverSrc}}}var ko=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Po=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},jo=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Mo=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Eo=(()=>{var e,t;let r,i,a=ce,s=[],n=[],o=[];return e=class extends a{get topStory(){return jo(this,t,"f")}set topStory(e){Mo(this,t,e,"f")}constructor(e,r={feed:"default"}){var i;super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(ko(this,s),e)}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"storyModels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"unreadedStoryModels",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"storiesReactionDisposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"feed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,ko(this,n,null)),Object.defineProperty(this,"_activeIndex",{enumerable:!0,configurable:!0,writable:!0,value:(ko(this,o),-1)}),this.storiesReactionDisposer=(0,Me.reaction)((()=>{var e;return null===(e=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(this.options.feed))||void 0===e?void 0:e.stories}),(e=>{e&&this.handleStoriesChange(e)})),this.feed=null!==(i=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(this.options.feed))&&void 0!==i?i:void 0}get stories(){return this.storyModels.map((e=>this.createStackFeedStoryByModel(e)))}get length(){return this.storyModels.length}get activeIndex(){return this._activeIndex}get feedCoverSrc(){var e;return null===(e=this.feed)||void 0===e?void 0:e.coverSrc}get top(){return this.topStory}reload(){this.storyModels=[],this.unreadedStoryModels=new Map}destroy(){this.storiesReactionDisposer(),this.emit("destroy")}markStoryAsOpened(e){this.unreadedStoryModels.delete(e),this.resetUnreadedStories(),this.update()}resetUnreadedStories(){0===this.unreadedStoryModels.size&&(this.unreadedStoryModels=new Map(this.storyModels.map((e=>[e.id,e]))))}handleStoriesChange(e){this.storyModels=e.slice(),this.resetUnreadedStories(),this.update()}createStackFeedStoryByModel(e){return new xo(e,this.feed)}update(){const e=this.unreadedStoryModels.values().next().value;if(!e)throw new Error("[StackedStoryList]: Empty stacked story list");this._activeIndex=this.storyModels.indexOf(e),this.topStory=this.createStackFeedStoryByModel(e),this.onUpdateTopStory(this.topStory),this.emit("update",this.topStory)}},t=new WeakMap,(()=>{var t;const l="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=a[Symbol.metadata])&&void 0!==t?t:null):void 0;r=[Me.observable],i=[Me.computed],Po(e,null,r,{kind:"accessor",name:"topStory",static:!1,private:!1,access:{has:e=>"topStory"in e,get:e=>e.topStory,set:(e,t)=>{e.topStory=t}},metadata:l},n,o),Po(e,null,i,{kind:"getter",name:"top",static:!1,private:!1,access:{has:e=>"top"in e,get:e=>e.top},metadata:l},null,s),l&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})})(),e})();class Io extends Eo{constructor(e,t){super(e,t),Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:new Yo}),Object.defineProperty(this,"firstStoryShown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._id=(0,ge.v4)(),this.handleShowStory=this.handleShowStory.bind(this),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.handleEventBusEvents=this.handleEventBusEvents.bind(this),this.subscribeToStoryReader(),this.subscribeToFeedCoverageAnalytics(),this.storyManager.setViewModel(this._id,this)}async reload(){return this.firstStoryShown=!1,super.reload(),this.loadStories()}destroy(){const e=this.storyManager.storyReaderViewModel;null==e||e.off("showStory",this.handleShowStory),null==e||e.off(Qn.Close,this.handleCloseStoryReader),vi.off("openGame",this.handleShowStory),vi.off("clickOnStoryDeepLink",this.handleShowStory),this.feedCoverageAnalyticsCalculator.destroy(),super.destroy(),this.storyManager.deleteViewModel(this._id)}showStory(e){var t;const r=ql.instance,i=(0,Ne.default)(e.deeplink)&&e.deeplink.trim().length>0,a=e.gameInstanceId;if(!e.hideInReader||i||a){if(i&&null!==e.deeplink){const t={index:0,id:e.id,story:e,isDeeplink:!0,url:e.deeplink};return r.clickOnButtonAction({src:Y.STACK_STORY_LIST,payload:t}),void this.markStoryAsOpened(e.id)}if(a)return r.openGame(a).catch(console.error),void this.markStoryAsOpened(e.id);null===(t=this.storyManager.storyReaderViewModel)||void 0===t||t.showMultipleStories({storyId:e.id,storyFeed:this.feed,windowReferer:ae.stacked}),this.markStoryAsOpened(e.id)}else console.error("[StackedStoryList]: Cannot open hidden story id "+e.id)}handleCloseStoryReader(){this.top&&this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(this.top.id)}markStoryAsOpened(e){this.storyManager.rootStore.storyStore.findStoryById(e).markIsOpened(),this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e),super.markStoryAsOpened(e)}onUpdateTopStory(e){this.firstStoryShown||(this.firstStoryShown=!0,this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e.id))}async subscribeToStoryReader(){try{const e=this.storyManager.storyReaderViewModel;vi.on("openGame",this.handleEventBusEvents),vi.on("clickOnStoryDeepLink",this.handleEventBusEvents),null==e||e.on("showStory",this.handleShowStory),null==e||e.on(Qn.Close,this.handleCloseStoryReader)}catch(e){console.error("[StackedStoryList]: error while story reader init")}}handleShowStory({id:e}){this.markStoryAsOpened(e)}handleEventBusEvents({id:e}){this.markStoryAsOpened(e)}async loadStories(){try{this.emit("startLoad"),await this.storyManager.rootStore.storyFeedStore.fetchDefaultFeed({feedSlug:this.options.feed}),this.emit("endLoad")}catch(e){console.error("[StackedStoryList]: error while story list loaded")}}subscribeToFeedCoverageAnalytics(){const e=new Xo(this.storyManager,{listType:Dt.DEFAULT,feed:this.options.feed,filter:{}});this.feedCoverageAnalyticsCalculator.on("feedImpression",e.handle)}}class Lo{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}createStoryReader(){return new eo(this.storyManager).create()}createGameReader(){return new Ks(this.storyManager).create()}createStoryList(){return new Ho(this.storyManager).create()}createInAppMessagingReader(){const e=this.storyManager.rootStore.iamStore;return new Oo(this.storyManager,e,new ri(this.storyManager,e,new ut(this.storyManager)))}}class To extends ce{constructor(e,t){super(),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"story",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"backgroundColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deeplink",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideInReader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"gameInstance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasAudio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"videoCoverSrc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"videoCover",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=this.story.id,this.title=this.story.title,this.titleColor=this.story.titleColor,this.background=this.story.background,this.backgroundColor=this.story.backgroundColor,this.deeplink=this.story.deeplink,this.hideInReader=this.story.hideInReader,this.gameInstance=this.story.gameInstance,this.hasAudio=this.story.hasAudio,this.image=this.story.image,this.videoCover=this.story.videoCover,this.videoCoverSrc=this.story.videoCoverSrc}get like(){return this.story.like}get favorite(){return this.story.favorite}get isOpened(){return this.story.isOpened}getAspectRatio(e){var t,r;switch(e){case te.STYLE_CIRCLE:case te.STYLE_QUAD:return 1;case te.STYLE_RECTANGLE:return null!==(r=null===(t=this.storyListViewModel.session)||void 0===t?void 0:t.previewAspectRatio)&&void 0!==r?r:.8;default:return 1}}getImageSrcByCoverQuality(e){var t,r;return null===(r=null===(t=this.story.image)||void 0===t?void 0:t.findOneByCoverQuality(e))||void 0===r?void 0:r.url}onClick(e){this.storyListViewModel.onStoryClick(this,e)}destroy(){}}class Ao extends To{static create(e,t,r,i){var a;const s=new lr({id:-100,title:null!==(a=e.title.content)&&void 0!==a?a:"",title_color:e.title.color,is_opened:!1,background_color:e.backgroundColor,image:Ao.getBgImage(e)},r,i);return new Ao(t,s)}static getBgImage(e){let t=[];return e.image&&e.image.svgSrc&&e.image.svgSrc.baseState&&t.push({width:100,height:100,type:"h",url:`data:image/svg+xml,${Ae(e.image.svgSrc.baseState)}`}),t}}class Ro{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.createFunctionWithTimeout=this.createFunctionWithTimeout.bind(this)}handle(e,t){this.storyManager.rootStore.storyStore.findStoryById(e.id).markIsOpened(),this.handleClickOnStoryCardDeepLink({id:e.id,index:t.index,isDeeplink:!0,url:e.deeplink},{listType:this.storyListViewModel.params.listType})}handleClickOnStoryCardDeepLink(e,{listType:t}){const r={data:[[1,0,e.id,0,0]]},i=()=>{e.isDeeplink&&e.url&&this.storyManager.clickOnButtonAction({src:Y.STORY_LIST,payload:e})};t===Dt.UGC||this.storyManager.getConfig().isStatisticsDisabled?i():xe("session/update",r,this.createFunctionWithTimeout(i,1e3))}createFunctionWithTimeout(e,t){let r=!1;function i(){r||(r=!0,e())}return setTimeout(i,t||1e3),i}}class Do{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){var r;this.storyManager.rootStore.storyStore.findStoryById(e.id).markIsOpened();const i=null===(r=e.gameInstance)||void 0===r?void 0:r.id;this.storyManager.gameReaderViewModel.openGame(i,{})}}class Bo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e,t){const r=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(this.storyListViewModel.params.feedSlug),i={storyId:e.id,storyFeed:r,windowReferer:this.storyListViewModel.params.isFavorite?ae.favorite:ae.default};this.openStoryReader(i),this.emitClickOnStory({id:e.id,index:t.index,isDeeplink:!1,storyFeed:r,filter:this.storyListViewModel.params.filter})}async openStoryReader(e){try{await this.storyManager.storyReaderViewModel.showMultipleStories({storyId:e.storyId,storyFeed:e.storyFeed,filter:this.storyListViewModel.params.filter,windowReferer:e.windowReferer})}catch(e){console.error(e)}}emitClickOnStory(e){const t=e.storyFeed,r=t.slug,i=e.filter,a=t.getStoryById(e.id),s={title:null,tags:[],slidesCount:null,feed:null,filter:null,source:null};s.title=a.statTitle,s.tags=a.tags,s.slidesCount=a.slidesCount,t.type===Dt.DEFAULT?s.feed=r:t.type===Dt.UGC&&(s.filter=i),s.source=ie.list,this.storyManager.emit("clickOnStory",Object.assign({id:e.id,index:e.index,isDeeplink:e.isDeeplink},s))}}class Fo{static createHandler(e,t,r){const{deeplink:i,hideInReader:a,gameInstance:s}=e,n=(0,Ne.default)(i)&&i.trim().length>0,o=null==s?void 0:s.id;return this.isInvalidStoryClick(Boolean(a),n,o,e.id)?null:n?new Ro(t,r):o?new Do(t,r):new Bo(t,r)}static isInvalidStoryClick(e,t,r,i){return!(!e||t||r)&&(console.error(`Cannot open hidden story id ${i}`),!0)}}var No=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Uo=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Wo=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},zo=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Vo=(()=>{var e,t,r,i,a;let s,n,o,l,d,c,u,h,p,g,f,m,v,b=ce,y=[],w=[],S=[],_=[],O=[],C=[],x=[],k=[],P=[];return e=class extends b{get _modeDesktop(){return Wo(this,t,"f")}set _modeDesktop(e){zo(this,t,e,"f")}get ugcCardOptions(){return Wo(this,r,"f")}set ugcCardOptions(e){zo(this,r,e,"f")}get favoriteCardOptions(){return Wo(this,i,"f")}set favoriteCardOptions(e){zo(this,i,e,"f")}get _params(){return Wo(this,a,"f")}set _params(e){zo(this,a,e,"f")}set modeDesktop(e){this._modeDesktop!==e&&(this._modeDesktop=e)}get id(){return this._id}get modeDesktop(){return this._modeDesktop}get session(){return this.storyManager.rootStore.sessionStore.session}get stories(){const e=this._params.feedSlug,t=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(e);if(!t)return[];const r=t.stories.map((e=>new To(this,e)));return this.hasFavoriteCard&&this.favoriteCardOptions&&r.push(this.createFavoriteCard(this.favoriteCardOptions)),this.hasUgcCard&&this.ugcCardOptions&&r.unshift(this.createUgcStoryCard(this.ugcCardOptions)),r}get params(){return this._params}constructor(s,n){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(No(this,y),s)}),Object.defineProperty(this,"storiesService",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,No(this,w,!0)),r.set(this,(No(this,S),No(this,_,null))),i.set(this,(No(this,O),No(this,C,null))),a.set(this,(No(this,x),No(this,k,{listType:Dt.DEFAULT,feedSlug:"",useUgcCard:!1,isFavorite:!1,hasFavorite:!1}))),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:(No(this,P),!1)}),this._id="StoryListViewModel"+e.index++,this.storyManager.setViewModel(this._id,this)}get hasFavoriteCard(){const e=this.storyManager.rootStore.storyFeedStore.getFavoriteFeed();return this._params.hasFavorite&&this._params.listType===Dt.DEFAULT&&e.stories.length>0}get hasUgcCard(){return this._params.useUgcCard}setParams(e){this._params=e}onStoryClick(e,t=0){var r;null===(r=Fo.createHandler(e,this.storyManager,this))||void 0===r||r.handle(e,{index:t})}destroy(){this.removeAllListeners(),this.storyManager.deleteViewModel(this._id)}async reload(){await this.loadStories({needFavorite:!0})}async loadStories(e){var t;if(this.isLoading||this._params.feedSlug===zt)return;const r=Boolean(this._params.hasFavorite)&&e.needFavorite,i={feed:this._params.feedSlug,filter:{},defaultListLength:0,favoriteListLength:0,success:!0,error:{name:"",networkStatus:200,networkMessage:""}};try{this.emit("startLoading"),this.isLoading=!0;const{defaultStories:e,favoriteStories:t}=await this.storiesService.loadStories(Object.assign(Object.assign({},this._params),{needFavorite:r}));i.success=!0,i.error=null,i.defaultListLength=e.length,this._params.hasFavorite&&this._params.listType===Dt.DEFAULT&&(i.favoriteListLength=t.length)}catch(e){console.error(e),i.success=!1,e instanceof ve&&(i.error={name:e.name,networkMessage:e.networkMessage,networkStatus:e.networkStatus})}finally{this.isLoading=!1,i.filter=null!==(t=this._params.filter)&&void 0!==t?t:{},this.emit("endLoading",i)}}setUgcCardOptions(e){this.ugcCardOptions=e}setFavoriteCardOptions(e){this.favoriteCardOptions=e}createUgcStoryCard(e){return Ao.create(e,this,this.storyManager.rootStore,new Qt(this.storyManager))}createFavoriteCard(e){return $o.create(e,this,this.storyManager.rootStore,new Qt(this.storyManager))}},t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=b[Symbol.metadata])&&void 0!==t?t:null):void 0;s=[Me.observable],n=[Me.observable],o=[Me.observable],l=[Me.observable],d=[Me.action],c=[Me.computed],u=[Me.computed],h=[Me.computed],p=[Me.computed],g=[Me.computed],f=[Me.computed],m=[Me.action],v=[Me.action],Uo(e,null,s,{kind:"accessor",name:"_modeDesktop",static:!1,private:!1,access:{has:e=>"_modeDesktop"in e,get:e=>e._modeDesktop,set:(e,t)=>{e._modeDesktop=t}},metadata:r},w,S),Uo(e,null,n,{kind:"accessor",name:"ugcCardOptions",static:!1,private:!1,access:{has:e=>"ugcCardOptions"in e,get:e=>e.ugcCardOptions,set:(e,t)=>{e.ugcCardOptions=t}},metadata:r},_,O),Uo(e,null,o,{kind:"accessor",name:"favoriteCardOptions",static:!1,private:!1,access:{has:e=>"favoriteCardOptions"in e,get:e=>e.favoriteCardOptions,set:(e,t)=>{e.favoriteCardOptions=t}},metadata:r},C,x),Uo(e,null,l,{kind:"accessor",name:"_params",static:!1,private:!1,access:{has:e=>"_params"in e,get:e=>e._params,set:(e,t)=>{e._params=t}},metadata:r},k,P),Uo(e,null,d,{kind:"setter",name:"modeDesktop",static:!1,private:!1,access:{has:e=>"modeDesktop"in e,set:(e,t)=>{e.modeDesktop=t}},metadata:r},null,y),Uo(e,null,c,{kind:"getter",name:"modeDesktop",static:!1,private:!1,access:{has:e=>"modeDesktop"in e,get:e=>e.modeDesktop},metadata:r},null,y),Uo(e,null,u,{kind:"getter",name:"session",static:!1,private:!1,access:{has:e=>"session"in e,get:e=>e.session},metadata:r},null,y),Uo(e,null,h,{kind:"getter",name:"stories",static:!1,private:!1,access:{has:e=>"stories"in e,get:e=>e.stories},metadata:r},null,y),Uo(e,null,p,{kind:"getter",name:"params",static:!1,private:!1,access:{has:e=>"params"in e,get:e=>e.params},metadata:r},null,y),Uo(e,null,g,{kind:"getter",name:"hasFavoriteCard",static:!1,private:!1,access:{has:e=>"hasFavoriteCard"in e,get:e=>e.hasFavoriteCard},metadata:r},null,y),Uo(e,null,f,{kind:"getter",name:"hasUgcCard",static:!1,private:!1,access:{has:e=>"hasUgcCard"in e,get:e=>e.hasUgcCard},metadata:r},null,y),Uo(e,null,m,{kind:"method",name:"setParams",static:!1,private:!1,access:{has:e=>"setParams"in e,get:e=>e.setParams},metadata:r},null,y),Uo(e,null,v,{kind:"method",name:"reload",static:!1,private:!1,access:{has:e=>"reload"in e,get:e=>e.reload},metadata:r},null,y),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),Object.defineProperty(e,"index",{enumerable:!0,configurable:!0,writable:!0,value:0}),e})();class Go extends To{constructor(e,t){super(e,t)}}class $o extends To{constructor(e,t,r){super(t,r),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:e})}get favoriteStories(){return this.rootStore.storyFeedStore.getFavoriteFeed().stories.map((e=>new Go(this.storyListViewModel,e)))}static create(e,t,r,i){const a=new lr({id:0,title:e.title.content,title_color:e.title.color,is_opened:!0,background_color:"white"},r,i);return new $o(r,t,a)}}class Ho{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}create(){const e=new rl(this.storyManager);return new Vo(this.storyManager,e)}}class qo{constructor(e=0,t=0,r=0,i=0){Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.x=e,this.y=t,this.width=r,this.height=i}overlaps(e){return this.x+this.width>=e.x&&this.x<=e.x+e.width&&this.y+this.height>=e.y&&this.y<=e.y+e.height}getIntersection(e){const t=Math.min(this.x+this.width,e.x+e.width),r=Math.max(this.x,e.x),i=Math.min(this.y+this.height,e.y+e.height),a=Math.max(this.y,e.y);return new qo(Math.min(t,r),Math.min(i,a),Math.max(0,t-r),Math.max(0,i-a))}getArea(){return this.width*this.height}getAreaFraction(e){return+(this.getArea()/e.getArea()*100).toFixed(2)}static clone(e){return new qo(e.x,e.y,e.width,e.height)}}class Qo{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storiesIds",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"getNewStoriesIds",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=[];for(const r of e)this.storiesIds.has(r)||t.push(r);return t}})}markStoryAsFullVisible(e){this.storiesIds.has(e)||(this.storiesIds.add(e),this.feedCoverageAnalyticsCalculator.emit("feedImpression",[e]))}calculate(e){const t=this.getNewStoriesIds(e.map((({id:e})=>e)));t.forEach((e=>this.storiesIds.add(e))),0!==t.length&&this.feedCoverageAnalyticsCalculator.emit("feedImpression",t)}}class Ko{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e})}calculate(e){const t=e.map((({id:e,areaFraction:t})=>({storyId:e,visibleArea:Math.round(t)/100})));0!==t.length&&this.feedCoverageAnalyticsCalculator.emit("visibleAreaUpdated",t)}}class Yo extends L.EventEmitter{constructor(){super(),Object.defineProperty(this,"storyRects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:new qo}),Object.defineProperty(this,"feedImpressionMetric",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"visibleAreaMetric",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filterStoryRectIntersections",{enumerable:!0,configurable:!0,writable:!0,value:e=>e.filter((e=>-100!==e.id&&e.areaFraction>0))}),this.feedImpressionMetric=new Qo(this),this.visibleAreaMetric=new Ko(this)}calculate(e){const t=this.getScrollViewportByCalculationParams(e),r=this.getStoryRectIntersectionsWithViewport(t),i=this.filterStoryRectIntersections(r);this.calculateMetrics(i)}setViewport(e){this.viewport=e}setStoryRects(e){this.storyRects=e}markStoryAsFullVisible(e){this.feedImpressionMetric.markStoryAsFullVisible(e)}destroy(){this.removeAllListeners()}getScrollViewportByCalculationParams(e){const t=qo.clone(this.viewport);return t.x+=e.minOffsetLeft,t.y+=e.minOffsetTop,t.width+=e.maxOffsetLeft-e.minOffsetLeft,t.height+=e.maxOffsetTop-e.minOffsetTop,t}calculateMetrics(e){this.feedImpressionMetric.calculate(e),this.visibleAreaMetric.calculate(e)}getStoryRectIntersectionsWithViewport(e){const t=[];for(const r of this.storyRects)if(r.overlaps(e)){const i=r.getIntersection(e);t.push({id:r.id,areaFraction:i.getAreaFraction(r)})}else t.push({id:r.id,areaFraction:0});return t}}class Jo extends qo{constructor(e,t=0,r=0,i=0,a=0){super(t,r,i,a),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e}static clone(e){return new Jo(e.id,e.x,e.y,e.width,e.height)}}class Zo{constructor(e){Object.defineProperty(this,"feedCoverageAnalyticsCalculator",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"viewportPadding",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"minOffsetLeft",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxOffsetLeft",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"minOffsetTop",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxOffsetTop",{enumerable:!0,configurable:!0,writable:!0,value:0})}startScroll({x:e,y:t}){this.minOffsetLeft=e,this.minOffsetTop=t,this.maxOffsetLeft=e,this.maxOffsetTop=t}endScroll({x:e,y:t}){this.minOffsetLeft=Math.min(e,this.minOffsetLeft),this.maxOffsetLeft=Math.max(e,this.maxOffsetLeft),this.minOffsetTop=Math.min(t,this.minOffsetTop),this.maxOffsetTop=Math.max(t,this.maxOffsetTop),this.feedCoverageAnalyticsCalculator.calculate({minOffsetLeft:this.minOffsetLeft,maxOffsetLeft:this.maxOffsetLeft,minOffsetTop:this.minOffsetTop,maxOffsetTop:this.maxOffsetTop})}calculate(e,t){this.feedCoverageAnalyticsCalculator.calculate({minOffsetLeft:e,maxOffsetLeft:e,minOffsetTop:t,maxOffsetTop:t})}updateGeometry({stories:e,storyListRect:t,windowRect:r,viewportPadding:i}){this.viewportPadding=i,this.setViewport(t,r),this.setStoryRects(e,t)}destroy(){this.feedCoverageAnalyticsCalculator.destroy()}markStoryAsFullVisible(e){this.feedCoverageAnalyticsCalculator.markStoryAsFullVisible(e)}setViewport(e,t){const r=this.getViewportByWindowAndStoryList(t,e);this.applyPaddingToViewport(r,e),this.feedCoverageAnalyticsCalculator.setViewport(r)}getViewportByWindowAndStoryList(e,t){let r=new qo;return t.overlaps(e)?(r=t.getIntersection(e),r):r}applyPaddingToViewport(e,t){t.width<768||(e.x+=this.viewportPadding.left,e.y+=this.viewportPadding.top,e.height-=this.viewportPadding.top+this.viewportPadding.bottom,e.width-=this.viewportPadding.left+this.viewportPadding.right)}setStoryRects(e,t){const r=[];e.forEach(((i,a)=>{const s=Number(i.dataset.id),n=new Jo(s,i.offsetLeft,i.offsetTop,i.clientWidth,i.clientHeight);r.push(n),n.x+=t.x,n.y+=t.y,this.applyPaddingAndNegativeMarginToStoryRect(n,a,e.length-1)})),this.feedCoverageAnalyticsCalculator.setStoryRects(r)}applyPaddingAndNegativeMarginToStoryRect(e,t,r){const i=this.viewportPadding;0===t&&(e.x+=i.left,e.width-=i.left),t===r&&(e.width-=i.right)}}class Xo{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.handle=this.handle.bind(this)}handle(e){const t=this.storyManager.getConfig();this.params.listType!==Dt.DEFAULT||t.isStatisticsDisabled||this.sendStat(e);const r=this.params.feed,i=this.params.filter,a={stories:e.map((e=>{const t={title:null,tags:[],slidesCount:null},i=this.storyManager.rootStore.storyFeedStore.getFeedBySlug(r),a=i.getStoryById(e);return a&&(t.title=a.statTitle,t.tags=a.tags,t.slidesCount=a.slidesCount,i.type===Dt.UGC&&(t.ugcPayload=(0,we.default)(a.ugcPayload)?a.ugcPayload:{})),Object.assign({id:e},t)})),feed:null,filter:null};this.params.listType===Dt.DEFAULT?a.feed=r:this.params.listType===Dt.UGC&&(a.filter=i),this.storyManager.emit("feedImpression",a)}sendStat(e){const t=[[5,0,...e]];this.storyManager.rootStore.sessionStore.sendStatisticData({data:t})}}class el{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t}),this.handle=this.handle.bind(this)}handle(e){const t=this.params.feed,r=this.params.filter,i=this.params.listType,a={stories:e.map((({storyId:e,visibleArea:t})=>{const r={title:null,tags:[],slidesCount:null,visibleArea:t},a=this.storyManager.rootStore.storyStore.findStoryById(e);return a&&(r.title=a.statTitle,r.tags=a.tags,r.slidesCount=a.slidesCount,i===Dt.UGC&&(r.ugcPayload=(0,we.default)(a.ugcPayload)?a.ugcPayload:{})),Object.assign({id:e},r)})),feed:null,filter:null};i===Dt.DEFAULT?a.feed=t:i===Dt.UGC&&(a.filter=r),this.storyManager.emit("visibleAreaUpdated",a)}}class tl{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:t})}create(){const e=new Yo,t=new Xo(this.storyManager,this.params),r=new el(this.storyManager,this.params);e.on("feedImpression",t.handle),e.on("visibleAreaUpdated",r.handle);return new Zo(e)}}class rl{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async loadStories({feedSlug:e,filter:t={},listType:r,testKey:i,needFavorite:a=!0}){const s=r===Dt.DEFAULT&&a,n=this.storyManager.rootStore.storyFeedStore,o=await this.fetchStoryFeed(n,e,t,i);let l=null;s&&(l=await n.fetchFavoriteFeed());const d=this.getFeedLoadEventStoryDtos(o);return this.emitFeedLoadEvent(o,d,e,t),this.getStoriesResult(o,l)}async fetchStoryFeed(e,t,r,i){return t===Ht?e.fetchUgcFeed({filter:r,testKey:i}):e.fetchDefaultFeed({feedSlug:t,testKey:i})}getFeedLoadEventStoryDtos(e){return e.stories.map((t=>{const r={title:null,tags:[],slidesCount:null};return r.title=t.statTitle,r.tags=t.tags,r.slidesCount=t.slidesCount,e.type===Dt.UGC&&(r.ugcPayload=(0,we.default)(t.ugcPayload)?t.ugcPayload:{}),Object.assign({id:t.id},r)}))}emitFeedLoadEvent(e,t,r,i){const a={stories:t,feed:null,filter:null};e.type===Dt.DEFAULT?a.feed=r:e.type===Dt.UGC&&(a.filter=i),this.storyManager.emit("feedLoad",a)}getStoriesResult(e,t){var r,i;return{defaultStories:null!==(r=e.stories)&&void 0!==r?r:[],favoriteStories:null!==(i=null==t?void 0:t.stories)&&void 0!==i?i:[]}}}class il extends L.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"showSharePage",{enumerable:!0,configurable:!0,writable:!0,value:async()=>{this.handleStartLoad();const e=this.storyManager.getConfig().isStatisticsDisabled,t=await this.storyReaderViewModel.showStoryFromSharePage(this.storyId,e);this.handleEndLoad(t)}}),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(),this.storyReaderViewModel.once(Qn.Close,this.handleCloseStoryReader)}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(U.START_LOADING),(0,de.default)(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(U.END_LOADING,{result:e}),(0,de.default)(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if((0,de.default)(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(U.CLOSE_STORY_READER)>0)try{(0,de.default)(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(U.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class al{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}install(e,t){this.plugins.set(e.name,e),je(`[PluginManager]: plugin ${e.name} registered`),e.install(this.storyManager,t),je(`[PluginManager]: plugin ${e.name} installed`)}uninstall(e){e.uninstall(this.storyManager),this.plugins.delete(e.name),je(`[PluginManager]: plugin ${e.name} uninstalled`)}get(e){return this.plugins.get(e)}}class sl extends Error{constructor(e){super(`[IAM]: not found IAM for event <${e}>`),this.name="IamNotFoundByEventError"}}var nl=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},ol=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},ll=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},dl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let cl=(()=>{var e,t,r,i;let a,s,n,o,l,d,c,u,h=[],p=[],g=[],f=[],m=[],v=[],b=[];return e=class{get _messages(){return ll(this,t,"f")}set _messages(e){dl(this,t,e,"f")}get _isLoaded(){return ll(this,r,"f")}set _isLoaded(e){dl(this,r,e,"f")}get _isLoading(){return ll(this,i,"f")}set _isLoading(e){dl(this,i,e,"f")}constructor(e,a){Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:(nl(this,h),e)}),Object.defineProperty(this,"iamApi",{enumerable:!0,configurable:!0,writable:!0,value:a}),t.set(this,nl(this,p,Me.observable.map())),r.set(this,(nl(this,g),nl(this,f,!1))),i.set(this,(nl(this,m),nl(this,v,!1))),Object.defineProperty(this,"_messageContext",{enumerable:!0,configurable:!0,writable:!0,value:nl(this,b)})}get messages(){return Array.from(this._messages.values())}get isLoaded(){return this._isLoaded}get isLoading(){return this._isLoading}get messageContext(){return this._messageContext}async preload(e){try{this._isLoaded=!1,this._isLoading=!0;const t=await this.fetchAll(e);return this._isLoaded=!0,t}catch(e){throw console.error(e),e}finally{this._isLoading=!1}}async findById(e){const t=this._messages.get(e.toString());return t||this.fetchById(e)}findAllByEvent(e){let t=Array.from(this._messages.values()).filter((t=>t.hasEvent(e)));if(t.length>0)return t;throw new sl(e)}async updateMessageUserData(e,t){return this.iamApi.updateUserData(e,t)}async fetchById(e){await this.rootStore.sessionStore.open(),await this.fetchMessageContext();const t=await this.iamApi.fetchById(e);return this.createMessageByDto(t)}async fetchAll(e){await this.rootStore.sessionStore.open(),await this.fetchMessageContext();const t=e.tags?e.tags:this.rootStore.storyManagerConfigStore.config.tags,r=await this.iamApi.fetchAll({tags:Re(t)});return this.createMessagesByDtos(r)}async fetchMessageContext(){await this.rootStore.sessionStore.open(),this._messageContext||(this._messageContext=await this.iamApi.fetchContext())}createMessagesByDtos(e){this._messages.clear();const t=[];for(const r of e){const e=this.createMessageByDto(r);t.push(e)}return t}createMessageByDto(e){const t=Fr.createByDto(e,this,new Kr(this.iamApi));return this._messages.has(t.id.toString())||this._messages.set(t.id.toString(),t),t}},t=new WeakMap,r=new WeakMap,i=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;a=[Me.observable],s=[Me.observable],n=[Me.observable],o=[Me.computed],l=[Me.computed],d=[Me.computed],c=[Me.computed],u=[Ie,Le],ol(e,null,a,{kind:"accessor",name:"_messages",static:!1,private:!1,access:{has:e=>"_messages"in e,get:e=>e._messages,set:(e,t)=>{e._messages=t}},metadata:t},p,g),ol(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:t},f,m),ol(e,null,n,{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:t},v,b),ol(e,null,o,{kind:"getter",name:"messages",static:!1,private:!1,access:{has:e=>"messages"in e,get:e=>e.messages},metadata:t},null,h),ol(e,null,l,{kind:"getter",name:"isLoaded",static:!1,private:!1,access:{has:e=>"isLoaded"in e,get:e=>e.isLoaded},metadata:t},null,h),ol(e,null,d,{kind:"getter",name:"isLoading",static:!1,private:!1,access:{has:e=>"isLoading"in e,get:e=>e.isLoading},metadata:t},null,h),ol(e,null,c,{kind:"getter",name:"messageContext",static:!1,private:!1,access:{has:e=>"messageContext"in e,get:e=>e.messageContext},metadata:t},null,h),ol(e,null,u,{kind:"method",name:"preload",static:!1,private:!1,access:{has:e=>"preload"in e,get:e=>e.preload},metadata:t},null,h),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var ul=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},hl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},pl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},gl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let fl=(()=>{var e,t;let r,i,a,s,n=[],o=[],l=[];return e=class{get _session(){return pl(this,t,"f")}set _session(e){gl(this,t,e,"f")}constructor(e,r){Object.defineProperty(this,"sessionApi",{enumerable:!0,configurable:!0,writable:!0,value:(ul(this,n),e)}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:r}),t.set(this,ul(this,o,null)),ul(this,l),this.sessionApi=e,this.rootStore=r}get session(){return this._session}get userId(){var e,t;return null!==(t=null===(e=this._session)||void 0===e?void 0:e.userKey)&&void 0!==t?t:It}async open(){if(this._session)return this._session;const e=await this.sessionApi.open(),t=new Lt(this,e);return t.loadResources(),this.updatePlaceholders(t),this._session=t,t}close(){this._session=null}async sendStatisticData(e){return this.sessionApi.sendStatisticData(e)}updatePlaceholders(e){this.rootStore.placeholderStore.addPlaceholders([...e.imagePlaceholders,...e.textPlaceholders])}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],i=[Me.computed],a=[Me.computed],s=[Ie],hl(e,null,r,{kind:"accessor",name:"_session",static:!1,private:!1,access:{has:e=>"_session"in e,get:e=>e._session,set:(e,t)=>{e._session=t}},metadata:t},o,l),hl(e,null,i,{kind:"getter",name:"session",static:!1,private:!1,access:{has:e=>"session"in e,get:e=>e.session},metadata:t},null,n),hl(e,null,a,{kind:"getter",name:"userId",static:!1,private:!1,access:{has:e=>"userId"in e,get:e=>e.userId},metadata:t},null,n),hl(e,null,s,{kind:"method",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open},metadata:t},null,n),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var ml=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},vl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},bl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},yl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};const wl=Me.observable.map();let Sl=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _storiesByUserId(){return bl(this,t,"f")}set _storiesByUserId(e){yl(this,t,e,"f")}get activeUserStories(){var e;const t=this.rootStore.sessionStore.userId;return t&&null!==(e=this._storiesByUserId.get(t))&&void 0!==e?e:wl}constructor(e,r,i){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(ml(this,a),e)}),Object.defineProperty(this,"storiesApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:i}),t.set(this,ml(this,s,Me.observable.map())),Object.defineProperty(this,"storyCSSLoaded",{enumerable:!0,configurable:!0,writable:!0,value:(ml(this,n),!1)}),(0,Me.reaction)((()=>i.placeholderStore.placeholders),(e=>{for(const t of this.activeUserStories.values())t.updatePlaceholders(e)}))}addStoriesByDtos(e){const t=[],r=this.getOrCreateStoriesMap();for(const i of e){let e=r.get(i.id);e?t.push(e):(e=new lr(i,this.rootStore,this.storiesApi),r.set(i.id,e),t.push(e))}return t}addStoryByDto(e){const t=this.getOrCreateStoriesMap();if(t.has(e.id))return t.get(e.id);const r=new lr(e,this.rootStore,this.storiesApi);return t.set(e.id,r),r}async fetchStoryById({storyId:e,feedSlug:t,fetchShareUrl:r,once:i}){let a=this.findStoryById(e);if(null==a?void 0:a.slidesLoaded)return a;await this.rootStore.sessionStore.open(),await this.fetchStoryCSS(),a=await this.fetchStory({storyId:e,feedSlug:t,fetchShareUrl:r,once:i});const s=await this.fetchStoryContext({id:a.id,feedSlug:t});return a.setContext(s),a.setCanBeShown(!0),a}async fetchStoriesSlides(e){const t=this.filterStoriesWithoutSlides(e.stories);if(t.length)try{const r=(new Date).getTime();await this.fetchStoryCSS();const i=await this.fetchStoryContextByIds({storyIds:t.map((e=>e.id)),feedSlug:e.feedSlug});await Promise.all(t.map(((t,a)=>this.processSingleStory(r,t,i[a],e.feedSlug))))}catch(e){for(const r of t)r.setError(e)}}findStoryById(e){return"number"==typeof e?this.activeUserStories.get(e):Array.from(this.activeUserStories.values()).find((t=>t.stringId===e))}filterStoriesWithoutSlides(e){return e.filter((e=>!e.slidesLoaded))}async processSingleStory(e,t,r,i){var a;try{t.error&&t.setError(null),t.setContext(r);const s=await this.storiesApi.fetchStorySlides({id:t.id,feedSlug:i});t.setSlides(null!==(a=s.slides)&&void 0!==a?a:[]),await(async(e,t=300)=>new Promise((r=>{const i=Math.max(0,t-((new Date).getTime()-e));i?setTimeout(r,i):r()})))(e),t.setCanBeShown(!0)}catch(e){t.setError(e)}}async fetchStory({storyId:e,feedSlug:t,fetchShareUrl:r,once:i}){var a;const s=await this.storiesApi.fetchStory({id:e,feedSlug:t,fetchShareUrl:r,once:i}),n=this.addStoryByDto(s);return n.setSlides(null!==(a=s.slides)&&void 0!==a?a:[]),n}async fetchStoryCSS(){if(this.storyCSSLoaded)return;const e=await this.storiesApi.fetchStoryCSS();this.storyCSSLoaded=!0,(e=>{const t="stories-slider-style";let r=document.getElementById(t),i="";null!==e&&(i=null!=e?e:""),null===r?(r=document.createElement("style"),r.type="text/css",r.id=t,r.attributes.setNamedItem(document.createAttribute("scoped")),r.setAttribute("nonce",Be()),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i)),document.head.appendChild(r)):r.styleSheet?r.styleSheet.cssText=i:(r.textContent="",r.appendChild(document.createTextNode(i)))})(e)}async fetchStoryContext({id:e,feedSlug:t}){const r=await this.storiesApi.fetchStoryContext({ids:[e],feedSlug:t});return new dr(e,r)}async fetchStoryContextByIds({storyIds:e,feedSlug:t}){const r=await this.storiesApi.fetchStoryContext({ids:e,feedSlug:t});return e.map((e=>new dr(e,r)))}getOrCreateStoriesMap(){const e=this.rootStore.sessionStore.userId;let t=Me.observable.map();return this._storiesByUserId.has(e)?t=this._storiesByUserId.get(e):this._storiesByUserId.set(e,t),t}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],i=[Me.computed],vl(e,null,r,{kind:"accessor",name:"_storiesByUserId",static:!1,private:!1,access:{has:e=>"_storiesByUserId"in e,get:e=>e._storiesByUserId,set:(e,t)=>{e._storiesByUserId=t}},metadata:t},s,n),vl(e,null,i,{kind:"getter",name:"activeUserStories",static:!1,private:!1,access:{has:e=>"activeUserStories"in e,get:e=>e.activeUserStories},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var _l=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ol=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Cl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},xl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};const kl=Me.observable.map();let Pl=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _storyFeedsByUserId(){return Cl(this,t,"f")}set _storyFeedsByUserId(e){xl(this,t,e,"f")}constructor(e,r){Object.defineProperty(this,"storyFeedsApi",{enumerable:!0,configurable:!0,writable:!0,value:(_l(this,a),e)}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:r}),t.set(this,_l(this,s,Me.observable.map())),_l(this,n),this.storyFeedsApi=e,this.rootStore=r}get activeUserFeeds(){var e;const t=this.rootStore.sessionStore.userId;return t&&null!==(e=this._storyFeedsByUserId.get(t))&&void 0!==e?e:kl}getUgcFeed(){var e;return null!==(e=this.getFeedBySlug(Ht))&&void 0!==e?e:qt.createByStoryDtos([],this.rootStore)}getFavoriteFeed(){var e;return null!==(e=this.getFeedBySlug(zt))&&void 0!==e?e:Vt.createByStoryDtos([],this.rootStore)}getFeedBySlug(e){return this.activeUserFeeds.get(e)}async fetchDefaultFeed({feedSlug:e,testKey:t}){const r=await this.rootStore.sessionStore.open(),i=this.rootStore.storyManagerConfigStore.config.tags,a=await this.storyFeedsApi.fetchDefaultFeed({feedSlug:e,tags:i,testKey:t}),s=new Wt(a,this.rootStore,{testKey:t});return this.addStoryFeed(r.userKey,s),s}async fetchFavoriteFeed(){const e=await this.rootStore.sessionStore.open(),t=this.rootStore.storyManagerConfigStore.config.tags,r=await this.storyFeedsApi.fetchFavoriteFeed({tags:t}),i=Vt.createByStoryDtos(r,this.rootStore);return this.addStoryFeed(e.userKey,i),i}async fetchUgcFeed({filter:e,testKey:t}){const r=await this.rootStore.sessionStore.open(),i=this.rootStore.storyManagerConfigStore.config.tags,a=await this.storyFeedsApi.fetchUgcFeed({filter:e,tags:i,testKey:t}),s=qt.createByStoryDtos(a,this.rootStore);return this.addStoryFeed(r.userKey,s),s}addStoryFeed(e,t){let r=Me.observable.map();this._storyFeedsByUserId.has(e)?r=this._storyFeedsByUserId.get(e):this._storyFeedsByUserId.set(e,r),r.set(t.slug,t)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],i=[Me.computed],Ol(e,null,r,{kind:"accessor",name:"_storyFeedsByUserId",static:!1,private:!1,access:{has:e=>"_storyFeedsByUserId"in e,get:e=>e._storyFeedsByUserId,set:(e,t)=>{e._storyFeedsByUserId=t}},metadata:t},s,n),Ol(e,null,i,{kind:"getter",name:"activeUserFeeds",static:!1,private:!1,access:{has:e=>"activeUserFeeds"in e,get:e=>e.activeUserFeeds},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var jl=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ml=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},El=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Il=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};const Ll=Me.observable.map();let Tl=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _onboardingFeedsByUserId(){return El(this,t,"f")}set _onboardingFeedsByUserId(e){Il(this,t,e,"f")}constructor(e,r){Object.defineProperty(this,"storyFeedsApi",{enumerable:!0,configurable:!0,writable:!0,value:(jl(this,a),e)}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:r}),t.set(this,jl(this,s,Me.observable.map())),Object.defineProperty(this,"cacheDataInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:(jl(this,n),!1)}),(0,Me.reaction)((()=>{const e=this.rootStore.storyManagerConfigStore.config;return e?[e.lang,e.apiKey]:null}),(()=>{this.invalidateCacheData()}))}get activeUserFeeds(){var e;const t=this.rootStore.sessionStore.userId;return t&&null!==(e=this._onboardingFeedsByUserId.get(t))&&void 0!==e?e:Ll}getFeedBySlug(e){return this.activeUserFeeds.get(null!=e?e:$t.getDefaultSlug())}removeStoryFromOnboardingFeedsById(e){for(const t of this.activeUserFeeds.values())t.removeById(e)}invalidateCacheData(){this.cacheDataInvalidated=!0}async fetchOnboardingFeed(e){let t=e.feedSlug||$t.getDefaultSlug();const r=this.getOnboardingParams(e);let i=this.activeUserFeeds.get(t);if(i&&!this.cacheDataInvalidated&&i.isEqualParams(r))return i;const a=await this.rootStore.sessionStore.open(),s=await this.storyFeedsApi.fetchOnboardingFeed(Object.assign(Object.assign({},r),{feedSlug:t}));return i=new $t(s,this.rootStore,r),this.addOnboardingFeed(a.userKey,i),this.commitCacheData(),i}addOnboardingFeed(e,t){let r=Me.observable.map();this._onboardingFeedsByUserId.has(e)?r=this._onboardingFeedsByUserId.get(e):this._onboardingFeedsByUserId.set(e,r),r.set(t.slug,t)}getOnboardingParams(e){const t=e.tags.length>0?e.tags:this.rootStore.storyManagerConfigStore.config.tags;return{tags:Re(t),limit:e.limit}}commitCacheData(){this.cacheDataInvalidated=!1}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],i=[Me.computed],Ml(e,null,r,{kind:"accessor",name:"_onboardingFeedsByUserId",static:!1,private:!1,access:{has:e=>"_onboardingFeedsByUserId"in e,get:e=>e._onboardingFeedsByUserId,set:(e,t)=>{e._onboardingFeedsByUserId=t}},metadata:t},s,n),Ml(e,null,i,{kind:"getter",name:"activeUserFeeds",static:!1,private:!1,access:{has:e=>"activeUserFeeds"in e,get:e=>e.activeUserFeeds},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Al{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ugcEditorApi",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:null})}async getUgcEditorConfig(){if(this._config)return this._config;const e=await this.storyManager.rootStore.sessionStore.open(),t=await this.ugcEditorApi.fetchUgcEditorConfig(),r=this.storyManager.getConfig(),i="3.4.5";return this._config={sessionId:e.id,apiKey:r.apiKey,editor:null!=t?t:{},sdkVersion:i,appPackageId:r.appPackageId,deviceId:e.deviceId,userId:null!=r.userId?String(r.userId):void 0,lang:r.lang.toString()},this._config}}class Rl{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e})}async fetchUgcEditorConfig(){return(await ke.request({method:"GET",url:"ugc/editor-config",params:{}})).data}}var Dl=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Bl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Fl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Nl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let Ul=(()=>{var e,t;let r,i,a=[],s=[],n=[];return e=class{get _placeholders(){return Fl(this,t,"f")}set _placeholders(e){Nl(this,t,e,"f")}get placeholders(){return Array.from(this._placeholders.values())}addPlaceholders(e){for(const t of e){const e=this._placeholders.get(t.key);e&&e.priority>t.priority||this._placeholders.set(t.key,t)}}clear(){this._placeholders=Me.observable.map()}constructor(){t.set(this,(Dl(this,a),Dl(this,s,Me.observable.map()))),Dl(this,n)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],i=[Me.computed],Bl(e,null,r,{kind:"accessor",name:"_placeholders",static:!1,private:!1,access:{has:e=>"_placeholders"in e,get:e=>e._placeholders,set:(e,t)=>{e._placeholders=t}},metadata:t},s,n),Bl(e,null,i,{kind:"getter",name:"placeholders",static:!1,private:!1,access:{has:e=>"placeholders"in e,get:e=>e.placeholders},metadata:t},null,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var Wl=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},zl=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Vl=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Gl=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};let $l=(()=>{var e,t;let r,i=[],a=[];return e=class{get _config(){return Vl(this,t,"f")}set _config(e){Gl(this,t,e,"f")}constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),t.set(this,zl(this,i,null)),zl(this,a),this.storyManager=e}get config(){return this._config}setConfig(e){this._config?this.updateConfig(e):this.initializeConfig(e)}clear(){this._config=null,this.storyManager.rootStore.sessionStore.close()}async waitStoryManagerConfig(){return new Promise(((e,t)=>{let r;const i=()=>{if(this._config)return clearTimeout(r),void e();requestAnimationFrame(i)};r=setTimeout((()=>{t("[IAS]: Timeout waiting for InAppStoryManager config")}),5e3),i()}))}initializeConfig(e){this._config=new Lr(this.storyManager,e)}updateConfig(e){this._config.updateByDto(e)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[Me.observable],Wl(e,null,r,{kind:"accessor",name:"_config",static:!1,private:!1,access:{has:e=>"_config"in e,get:e=>e._config,set:(e,t)=>{e._config=t}},metadata:t},i,a),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Hl{constructor(e){Object.defineProperty(this,"iamStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sessionStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyFeedStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onboardingFeedStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ugcEditorStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"placeholderStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyManagerConfigStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=new Qt(e),r=new Kt(e);this.storyManagerConfigStore=new $l(e),this.placeholderStore=new Ul,this.iamStore=new cl(this,new ut(e)),this.sessionStore=new fl(new Ct(e),this),this.storyStore=new Sl(e,t,this),this.storyFeedStore=new Pl(r,this),this.onboardingFeedStore=new Tl(r,this),this.ugcEditorStore=new Al(e,new Rl(e))}}class ql extends L.EventEmitter{constructor(){return super(),Object.defineProperty(this,"viewModelStore",{enumerable:!0,configurable:!0,writable:!0,value:new pe}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"pluginManager",{enumerable:!0,configurable:!0,writable:!0,value:new al(this)}),Object.defineProperty(this,"_rootStore",{enumerable:!0,configurable:!0,writable:!0,value:new Hl(this)}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:this.createInAppMessagingReader()}),Object.defineProperty(this,"clickOnButtonAction",{enumerable:!0,configurable:!0,writable:!0,value:({src:e,payload:t})=>{if((0,de.default)(this.callbacks.storyLinkClickHandler)||this.listenerCount(oe.CLICK_ON_STORY)>0){const r={src:e,data:t};try{(0,de.default)(this.callbacks.storyLinkClickHandler)&&this.callbacks.storyLinkClickHandler(r),this.emit(oe.CLICK_ON_STORY,r),this.emit("clickOnButton",t)}catch(e){console.error(e)}}else window.open(t.url,"_self")}}),ql.isSingletonInstanceExists()||(ql.instance=this),ql.instance}get rootStore(){return this._rootStore}get sdkVersionName(){return"3.4.5"}get sdkVersionCode(){return parseInt(30405)}get lang(){return this.rootStore.storyManagerConfigStore.config.lang}set storyLinkClickHandler(e){(0,de.default)(e)&&(this.callbacks.storyLinkClickHandler=e)}get storyReaderViewModel(){return this.viewModelStore.get(Xn.id)}get gameReaderViewModel(){return this.viewModelStore.get(Qs.id)}get isStatisticsDisabled(){return this.getConfig().isStatisticsDisabled}static getInstance(){return ql.instance?ql.instance:null}setViewModel(e,t){this.viewModelStore.set(e,t)}deleteViewModel(e){this.viewModelStore.delete(e)}getViewModelByKey(e){return this.viewModelStore.get(e)}getConfig(){return this.rootStore.storyManagerConfigStore.config}setConfig(e){this.rootStore.storyManagerConfigStore.setConfig(e)}async waitViewModel(e){return this.viewModelStore.wait(e)}async waitStoryManagerConfig(){return this.rootStore.storyManagerConfigStore.waitStoryManagerConfig()}async showOnboardingStories(e){var t,r;return(await this.viewModelStore.wait(Xn.id)).showOnboardingStories({feedSlug:null!==(t=null==e?void 0:e.feed)&&void 0!==t?t:void 0,customTags:null==e?void 0:e.customTags,limit:null!==(r=null==e?void 0:e.limit)&&void 0!==r?r:void 0})}async showStory(e){"string"==typeof e&&(e=+e||e);const t=await this.viewModelStore.wait(Xn.id);await t.showStory(e)}async showStoryOnce(e){"string"==typeof e&&(e=+e||e);const t=await this.viewModelStore.wait(Xn.id);await t.showStoryOnce(e)}closeAllReaders(){var e,t;null===(e=this.storyReaderViewModel)||void 0===e||e.close(),null===(t=this.gameReaderViewModel)||void 0===t||t.closeGame()}closeGoodsWidget(){var e;null===(e=this.storyReaderViewModel)||void 0===e||e.closeGoodsWidget()}async openGame(e,t={}){const r=await this.viewModelStore.wait(Qs.id);await r.openGame(e,t)}async closeGame(){return this.gameReaderViewModel.closeGame()}async closeStoryReader(){this.storyReaderViewModel.close()}async getUgcEditorConfig(){return this.rootStore.ugcEditorStore.getUgcEditorConfig()}async showSharePage(e,t){return"string"==typeof e&&(e=+e||e),await this.viewModelStore.wait(Xn.id),new il(this,this.storyReaderViewModel,e,t)}reloadAllStoryLists(){const e=this.viewModelStore.getAllOfType((e=>e instanceof Vo));return Promise.all(e.map((e=>e.reload())))}reloadAllStackedStoryLists(){const e=this.viewModelStore.getAllOfType((e=>e instanceof Io));return Promise.all(e.map((e=>e.reload())))}static isSingletonInstanceExists(){return!!ql.instance&&(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),!0)}use(e,t){this.pluginManager.install(e,t)}getPlugin(e){return this.pluginManager.get(e)}createStoryReader(){return new Lo(this).createStoryReader()}createGameReader(){return new Lo(this).createGameReader()}createStoryList(){return new Lo(this).createStoryList()}createInAppMessagingReader(){return new Lo(this).createInAppMessagingReader()}clearConfig(){this.rootStore.storyManagerConfigStore.clear()}emitEvent(e){this.emit(e.name,e.toJSON())}}const Ql=new ql;new class{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.inAppMessaging=new Co(e.inAppMessaging)}get sdkVersionName(){return this.storyManager.sdkVersionName}get sdkVersionCode(){return this.storyManager.sdkVersionCode}set storyLinkClickHandler(e){this.storyManager.storyLinkClickHandler=e}getConfig(){return this.storyManager.getConfig()}getNonce(){return Be()}async showOnboardingStories(e){return this.storyManager.showOnboardingStories(e)}async showStory(e){return this.storyManager.showStory(e)}async showStoryOnce(e){return this.storyManager.showStoryOnce(e)}closeAllReaders(){this.storyManager.closeAllReaders()}async openGame(e,t={}){return this.storyManager.openGame(e,t)}async closeGame(){return this.storyManager.closeGame()}async closeStoryReader(){return this.storyManager.closeStoryReader()}getUgcEditorConfig(){return this.storyManager.getUgcEditorConfig()}showSharePage(e,t){return this.storyManager.showSharePage(e,t)}closeGoodsWidget(){this.storyManager.closeGoodsWidget()}on(e,t){return this.storyManager.on(e,t),this}once(e,t){return this.storyManager.once(e,t),this}off(e,t){return this.storyManager.off(e,t),this}static use(e,t){Ql.use(e,t)}}(Ql);var Kl;!function(e){e.UPDATE="update",e.EVENT_UPDATED_COMMON_OPTIONS="updatedCommonOptions",e.EVENT_UPDATED_STORIES_LIST_OPTIONS="updatedStoriesListOptions",e.EVENT_UPDATED_STORY_READER_OPTIONS="updatedStoryReaderOptions",e.EVENT_UPDATED_FAVORITE_READER_OPTIONS="updatedFavoriteReaderOptions",e.EVENT_UPDATED_GAME_READER_OPTIONS="updatedGameReaderOptions",e.EVENT_UPDATED_GOODS_WIDGET_OPTIONS="updatedGoodsWidgetOptions",e.EVENT_UPDATED_INAPPMESSAGING_WIDGET_OPTIONS="updatedInAppMessagingWidgetOptions"}(Kl||(Kl={}));Error;class Yl extends L.EventEmitter{constructor(){super(),Object.defineProperty(this,"_commonOptions",{enumerable:!0,configurable:!0,writable:!0,value:D}),Object.defineProperty(this,"_storiesListOptions",{enumerable:!0,configurable:!0,writable:!0,value:Q}),Object.defineProperty(this,"_storyReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:ee}),Object.defineProperty(this,"_storyFavoriteReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:K}),Object.defineProperty(this,"_goodsWidgetOptions",{enumerable:!0,configurable:!0,writable:!0,value:N}),Object.defineProperty(this,"_gameReaderOptions",{enumerable:!0,configurable:!0,writable:!0,value:B})}setCommonOptions(e,t=!0){return this._commonOptions=(0,yr.default)(this._commonOptions,e),this.emit(Kl.UPDATE,this.commonOptions),this}get commonOptions(){return this._commonOptions}setStoriesListOptions(e,t=!0){return this._storiesListOptions=(0,yr.default)(this._storiesListOptions,e),t&&(this.emit(Kl.UPDATE,this.storiesListOptions),this.emit(Kl.EVENT_UPDATED_STORIES_LIST_OPTIONS,this.storiesListOptions)),this}get storiesListOptions(){return this._storiesListOptions}setStoryReaderOptions(e,t=!0){return this._storyReaderOptions=(0,yr.default)(this._storyReaderOptions,e,{arrayMerge:(e,t,r)=>t}),t&&this.emit(Kl.UPDATE,{storyReaderOptions:this.storyReaderOptions,gameReaderOptions:this.gameReaderOptions,appearanceCommon:this.commonOptions}),this}get storyReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton,loader:this.commonOptions.loader};return Object.assign(Object.assign({},e),this._storyReaderOptions)}setStoryFavoriteReaderOptions(e,t=!0){return this._storyFavoriteReaderOptions=(0,yr.default)(this._storyFavoriteReaderOptions,e),t&&this.emit(Kl.UPDATE,this.storyFavoriteReaderOptions),this}get storyFavoriteReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton};return Object.assign(Object.assign({},e),this._storyFavoriteReaderOptions)}setGoodsWidgetOptions(e,t=!0){return this._goodsWidgetOptions=(0,yr.default)(this._goodsWidgetOptions,e),t&&this.emit(Kl.UPDATE,this.goodsWidgetOptions),this}get goodsWidgetOptions(){return this._goodsWidgetOptions}setGameReaderOptions(e,t=!0){return this._gameReaderOptions=(0,yr.default)(this._gameReaderOptions,e),t&&this.emit(Kl.UPDATE,this.gameReaderOptions),this}get gameReaderOptions(){const e={closeButtonPosition:this.commonOptions.closeButtonPosition,closeButton:this.commonOptions.closeButton,loader:this.commonOptions.loader,forceDesktopMode:this.commonOptions.forceDesktopMode};return Object.assign(Object.assign({},e),this._gameReaderOptions)}}(0,Me.configure)({enforceActions:"never"});class Jl{constructor(){Object.defineProperty(this,"_storyLists",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get storyLists(){return this._storyLists}addStoryList(e){this._storyLists.push(e)}updateStoryListById(e,t){const r=this._storyLists.findIndex((t=>t.mountSelector===e));this._storyLists[r]=Object.assign(Object.assign({},this._storyLists[r]),t)}removeStoryListById(e){const t=this._storyLists.findIndex((t=>t.mountSelector===e));this._storyLists.splice(t,1)}}class Zl extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const Xl=e=>{if(null==e||"object"!=typeof e)throw new Zl(null==e?"null":typeof e)};class ed extends L.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"storyListManager",{enumerable:!0,configurable:!0,writable:!0,value:new Jl}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Xl(t),this.storyListManager.addStoryList(this),this.app.setStoryList(this.storyListManager.storyLists).catch(console.error)}get mountSelector(){return this._mountSelector}get appearanceManager(){return this._appearanceManager}get type(){return Dt.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){return this.params.feed}get testKey(){return this.params.testKey}get useUgcCard(){return this.params.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()}destroy(){this.storyListManager.removeStoryListById(this.mountSelector),this.app.setStoryList(this.storyListManager.storyLists)}}class td extends L.EventEmitter{constructor(e,t,r,i){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"storyListManager",{enumerable:!0,configurable:!0,writable:!0,value:new Jl}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Xl(t),this.storyListManager.addStoryList(this),this.app.setUGCStoryList(this.storyListManager.storyLists).catch(console.error)}get mountSelector(){return this._mountSelector}get appearanceManager(){return this._appearanceManager}get type(){return Dt.UGC}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){return Ht}get testKey(){return this.params.testKey}get useUgcCard(){return this.params.useUgcCard}set api(e){this._api=e}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}destroy(){this.storyListManager.removeStoryListById(this.mountSelector)}}const rd=(e=>{var t={};return A.d(t,e),t})({Fragment:()=>m.Fragment,jsx:()=>m.jsx,jsxs:()=>m.jsxs});const id=(e=>{var t={};return A.d(t,e),t})({createRoot:()=>v.createRoot});const ad=(e=>{var t={};return A.d(t,e),t})({Children:()=>b.Children,default:()=>b.default,forwardRef:()=>b.forwardRef,useCallback:()=>b.useCallback,useContext:()=>b.useContext,useEffect:()=>b.useEffect,useImperativeHandle:()=>b.useImperativeHandle,useLayoutEffect:()=>b.useLayoutEffect,useMemo:()=>b.useMemo,useRef:()=>b.useRef,useState:()=>b.useState});A(123);window.__IAS__={storyManager:Ql},(0,Me.configure)({enforceActions:"never"});const sd=(e=>{var t={};return A.d(t,e),t})({default:()=>y.default});var nd=A(591),od=A.n(nd),ld=A(289),dd={insert:"head",singleton:!1};od()(ld.A,dd);const cd=ld.A.locals||{};var ud=A(81),hd={insert:"head",singleton:!1};od()(ud.A,hd);const pd=ud.A.locals||{},gd=({onClick:e,className:t})=>(0,rd.jsx)("div",{className:(0,sd.default)(pd.icon,t),onClick:e,children:(0,rd.jsx)("svg",{viewBox:"0 0 24 24",children:(0,rd.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"})})});var fd=A(669),md={insert:"head",singleton:!1};od()(fd.A,md);const vd=fd.A.locals||{},bd=({geometry:e,children:t,style:r,isWidescreen:i,className:a})=>{const s=i?{width:"100%",height:"100%"}:{width:e.getWidth(),height:e.getHeight()};return(0,rd.jsx)("div",{className:(0,sd.default)(vd["aspect-ratio-box"],a,{[vd["aspect-ratio-box--centered"]]:!i}),style:Object.assign(Object.assign({},r),s),children:(0,rd.jsx)("div",{className:vd["aspect-ratio-box-inside"],children:t})})};var yd=A(138),wd={insert:"head",singleton:!1};od()(yd.A,wd);const Sd=yd.A.locals||{},_d=Qe(),Od=e=>{const[t,r]=(0,ad.useState)(!1),i=(0,ad.useCallback)((()=>{if(e.desktopMode)return;const t=_d.type!==e.orientation;e.onOrientationChange({type:_d.type,isWrong:t}),r(t)}),[e.desktopMode,e.orientation]);return(0,ad.useEffect)((()=>(i(),_d.addEventListener("change",i),()=>{_d.removeEventListener("change",i)})),[i]),t?(0,rd.jsx)("div",{className:Sd["screen-orientation-lock"]}):null};var Cd=A(778),xd={insert:"head",singleton:!1};od()(Cd.A,xd);const kd=Cd.A.locals||{};var Pd=A(196),jd={insert:"head",singleton:!1};od()(Pd.A,jd);const Md=Pd.A.locals||{};let Ed;function Id(){let e,t;/ipad|iphone/i.test(navigator.userAgent)?(e=document.createRange(),Ed&&e.selectNodeContents(Ed),t=window.getSelection(),t&&(t.removeAllRanges(),t.addRange(e)),Ed&&Ed.setSelectionRange(0,999999)):null==Ed||Ed.select()}const Ld=e=>{!function(e){Ed=document.createElement("textarea"),Ed.value=e,document.body.appendChild(Ed)}(e),Id(),document.execCommand("copy"),Ed&&document.body.removeChild(Ed)},Td=({shareText:e,shareLink:t,sharePanelOptions:r,onShareComplete:i})=>{var a,s,n,o,l,d,c,u,h,p,g;const[f,m]=(0,ad.useState)(!1),[v,b]=(0,ad.useState)(!1),y=()=>{b(!0),!f&&e||i()};return(0,rd.jsxs)("div",{className:`${kd["share-panel__body"]} ${Md["share-panel__body_screenshot"]}`,children:[(0,rd.jsx)("div",{className:`${kd["share-panel-row"]} ${Md["share-panel-row"]}`,children:(0,rd.jsx)("a",{className:Md["share-panel-row__image-link"],onClick:y,href:t,download:"image.jpeg",children:(0,rd.jsx)("img",{src:t,className:Md["share-panel-row__image"]})})}),(0,rd.jsx)("div",{className:kd["share-panel-separator"],style:{background:null===(a=r.divider)||void 0===a?void 0:a.background}}),(0,rd.jsx)("div",{className:`${kd["share-panel-row"]} ${Md["share-panel-row"]}`,children:(0,rd.jsx)("a",{className:Md["share-item__download-button"],onClick:y,href:t,download:"image.jpeg",children:(0,rd.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(o=null===(n=null===(s=r.downloadButton)||void 0===s?void 0:s.svgSrc)||void 0===n?void 0:n.baseState)&&void 0!==o?o:""}})})}),e?(0,rd.jsxs)(rd.Fragment,{children:[(0,rd.jsx)("div",{className:kd["share-panel-separator"],style:{background:null===(l=r.divider)||void 0===l?void 0:l.background}}),(0,rd.jsx)("div",{className:`${kd["share-panel-row"]} ${Md["share-panel-row"]}`,children:(0,rd.jsxs)("button",{className:(0,sd.default)(Md.btn,Md["btn-copy"]),onClick:()=>{Ld(null!=e?e:""),m(!0),v&&i()},children:[(0,rd.jsxs)("div",{className:Md["btn-copy__icon"],children:[(0,rd.jsx)("span",{className:(0,sd.default)(Md["btn-copy__icon-state"],{[Md["btn-copy__icon-state_default"]]:!f}),dangerouslySetInnerHTML:{__html:null!==(u=null===(c=null===(d=r.copyButton)||void 0===d?void 0:d.svgSrc)||void 0===c?void 0:c.baseState)&&void 0!==u?u:""}}),(0,rd.jsx)("span",{className:(0,sd.default)(Md["btn-copy__icon-state"],{[Md["btn-copy__icon-state_done"]]:f}),dangerouslySetInnerHTML:{__html:null!==(g=null===(p=null===(h=r.copyButton)||void 0===h?void 0:h.svgSrc)||void 0===p?void 0:p.doneState)&&void 0!==g?g:""}})]}),(0,rd.jsx)("div",{className:Md["btn-copy__text"],children:e})]})})]}):null]})};var Ad=A(610),Rd={insert:"head",singleton:!1};od()(Ad.A,Rd);const Dd=Ad.A.locals||{};var Bd=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Fd=e=>{var t,r,i,a,s,n,o,l,d,c,u,{shareLink:h,sharePanelOptions:p,onShareComplete:g}=e,f=Bd(e,["shareLink","sharePanelOptions","onShareComplete"]);const m=()=>{try{return new URL(h).host}catch(e){return console.error(e),null}},v=()=>{window.removeEventListener("focus",v),g()},b=()=>m()?"":encodeURIComponent(h),y=e=>{var t,r;const i=(()=>{try{return new URL(h)}catch(e){return console.error(e),null}})();if(!i)return"#";const a=null===(t=p.targetParams)||void 0===t?void 0:t[e];return null===(r=null==a?void 0:a.getUrl)||void 0===r?void 0:r.call(a,{url:i.toString(),text:b()})},w=null===(t=p.title)||void 0===t?void 0:t.favicon,S=p.text;return(0,rd.jsxs)("div",{className:kd["share-panel__body"],children:[(0,rd.jsxs)("div",{className:`${kd["share-panel-row"]} ${kd["title-row"]}`,children:[m()&&Boolean(null==w?void 0:w.display)&&(0,rd.jsx)("div",{className:kd["share-url-favicon"],style:{background:null==w?void 0:w.background},children:(0,rd.jsx)("img",{src:`${null!==(r=f.faviconApiUrl)&&void 0!==r?r:"https://favicon.inappstory.ru"}?sz=64&domain_url=${m()}`})}),(0,rd.jsx)("span",{className:kd.title,style:S,children:null===(a=null===(i=p.title)||void 0===i?void 0:i.getValue)||void 0===a?void 0:a.call(i,{url:h,text:b()})})]}),(0,rd.jsx)("div",{className:kd["share-panel-separator"],style:{background:null===(s=p.divider)||void 0===s?void 0:s.background}}),(0,rd.jsx)("div",{className:`${kd["share-panel-row"]} ${Dd["social-list"]}`,children:null===(n=p.targets)||void 0===n?void 0:n.map(((e,t)=>{var r,i,a;const s=null===(r=p.targetParams)||void 0===r?void 0:r[e],n=null!==(a=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.svgSrc.baseState)&&void 0!==a?a:"<svg></svg>";return(0,rd.jsx)("div",{className:Dd["social-list__item"],children:(0,rd.jsxs)("a",{href:y(e),onClick:()=>((e,t,r)=>{window.addEventListener("focus",v),window.open(e,t,r)})(y(e),"newwindow","width=650,height=570"),target:"_blank",rel:"noopener noreferrer",className:`${kd["share-item"]} ${Dd["share-item"]}`,children:[(0,rd.jsx)("div",{dangerouslySetInnerHTML:{__html:n}}),(0,rd.jsx)("span",{className:kd["share-item-title"],style:S,children:null==s?void 0:s.label})]})},t)}))}),(0,rd.jsx)("div",{className:kd["share-panel-separator"],style:{background:null===(o=p.divider)||void 0===o?void 0:o.background}}),(0,rd.jsx)("div",{className:kd["share-panel-row"],children:(0,rd.jsxs)("a",{className:`${kd["share-item"]} ${Dd["share-item"]}`,onClick:()=>{Ld(h),g()},children:[(0,rd.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(c=null===(d=null===(l=p.copyButton)||void 0===l?void 0:l.svgSrc)||void 0===d?void 0:d.baseState)&&void 0!==c?c:""}}),(0,rd.jsx)("span",{className:kd["share-item-title"],style:S,children:null===(u=p.copyButton)||void 0===u?void 0:u.label})]})})]})};var Nd;!function(e){e.Social="social",e.SlideScreenshot="slide-screenshot"}(Nd||(Nd={}));const Ud=({shareType:e,shareLink:t,shareText:r,onShareCompelete:i,sharePanelOptions:a,className:s})=>{const{dir:n}=Gh(),[o,l]=(0,ad.useState)(!1),[d,c]=(0,ad.useState)(!0),u=()=>{l(!0),c(!1)};return(0,rd.jsxs)("div",{dir:n,className:(0,sd.default)(kd["share-panel-wrapper"],s),onClick:e=>{e.stopPropagation()},onTouchStart:e=>{e.stopPropagation(),e.preventDefault()},children:[(0,rd.jsx)("div",{className:(0,sd.default)(kd["share-panel-backdrop"],{[kd.fadeIn]:d,[kd.fadeOut]:!d}),onClick:()=>{l(!1),c(!1)}}),(0,rd.jsxs)("div",{className:(0,sd.default)(kd["share-panel"],{[kd.slideIn]:d,[kd.slideOut]:!d}),onAnimationEnd:()=>{d||i(o)},style:{"--height":"100%",background:a.background,borderTopLeftRadius:a.borderRadius+"px",borderTopRightRadius:a.borderRadius+"px"},children:[e===Nd.SlideScreenshot&&(0,rd.jsx)(Td,{shareText:r,shareLink:t,onShareComplete:u,sharePanelOptions:a}),e===Nd.Social&&(0,rd.jsx)(Fd,{shareLink:t,onShareComplete:u,sharePanelOptions:a}),(0,rd.jsx)("div",{className:kd["share-panel-separator"]})]})]})};var Wd=A(495),zd={insert:"head",singleton:!1};od()(Wd.A,zd);const Vd=Wd.A.locals||{},Gd=e=>{const t=(0,ad.useRef)(null),[r,i]=(0,ad.useState)(null);return(0,ad.useEffect)((()=>{const r=e.plugin.createLottiePlayer(t.current,e.config);return i(r),()=>{r.destroy()}}),[e.config.sha1]),(0,ad.useEffect)((()=>{r&&e.forceEnd&&r.stop()}),[r,e.forceEnd]),(0,ad.useEffect)((()=>{if(r)return r.on("play",e.onPlay),r.on("complete",e.onComplete),r.on("beforeLoad",e.onBeforeLoad),r.on("load",e.onLoad),r.on("minPlayingTimeExpired",e.onMinPlayingTimeExpired),r.on("error",e.onError),()=>{r.off("play",e.onPlay),r.off("complete",e.onComplete),r.off("beforeLoad",e.onBeforeLoad),r.off("load",e.onLoad),r.off("minPlayingTimeExpired",e.onMinPlayingTimeExpired),r.off("error",e.onError)}}),[r,e.onError,e.onPlay,e.onComplete,e.onLoad,e.onBeforeLoad,e.onMinPlayingTimeExpired]),(0,rd.jsx)("canvas",{ref:t,style:{width:"100%",height:"100%"}})},$d=e=>{var t,r,i;const{storyManager:a}=Gh(),[s,n]=(0,ad.useState)(!1),[o,l]=(0,ad.useState)(!1),[d,c]=(0,ad.useState)(!1),[u,h]=(0,ad.useState)(!1),[p,g]=(0,ad.useState)(!1),[f,m]=(0,ad.useState)(!1),v=o||u||e.isGameLoading||!e.gameShouldBeShown,b=(0,ad.useMemo)((()=>a.getPlugin("dot-lottie")),[a]),y=d||!b||e.isGameLoadingError?null:(null===(r=null===(t=e.game)||void 0===t?void 0:t.splashLottieScreen)||void 0===r?void 0:r.url)&&(null===(i=e.game)||void 0===i?void 0:i.splashLottieScreen),w=e.game&&!e.isGameLoadingError&&v&&!o&&!y,S=()=>{var t,r,i,a;return e.desktopMode&&(null===(r=null===(t=e.game)||void 0===t?void 0:t.splashLandscapeScreen)||void 0===r?void 0:r.url)?e.game.splashLandscapeScreen.url:null===(a=null===(i=e.game)||void 0===i?void 0:i.splashScreen)||void 0===a?void 0:a.url},_=e.isGameInited&&(!y||p);(0,ad.useEffect)((()=>{_&&e.onSplashCanBeHidden()}),[_]);return(0,rd.jsxs)("div",{className:(0,sd.default)(Vd["splash-container"],{[Vd["splash-container--fadeIn"]]:e.game,[Vd["splash-container--fadeOut"]]:e.gameShouldBeShown,[Vd["splash-container--isLoading"]]:w}),children:[(0,rd.jsx)("div",{className:Vd["splash-container__image"],style:{backgroundColor:e.splashImageBackgroundColor},children:S()&&(0,rd.jsx)("img",{src:S(),onLoad:()=>{m(!0)}})}),y&&b&&(0,rd.jsx)("div",{className:Vd["splash-container__lottie"],children:(0,rd.jsx)(Gd,{plugin:b,forceEnd:e.gameShouldBeShown,config:y,onError:()=>{c(!0)},onPlay:()=>{l(!0),n(!1)},onComplete:()=>{l(!1),n(!0)},onLoad:()=>{h(!1)},onBeforeLoad:()=>{h(!0)},onMinPlayingTimeExpired:()=>{g(!0)}})})]})};var Hd=A(843),qd={insert:"head",singleton:!1};od()(Hd.A,qd);const Qd=Hd.A.locals||{},Kd=e=>{var t,r;return(0,rd.jsx)("button",{dir:e.dir,onClick:e.onCloseGame,className:Qd["close-btn"],"data-position":e.closeButtonPosition,dangerouslySetInnerHTML:{__html:null!==(r=null===(t=e.closeButtonOptions)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==r?r:""}})};const Yd=(e=>{var t={};return A.d(t,e),t})({observer:()=>w.observer});const Jd=(e=>{var t={};return A.d(t,e),t})({createPortal:()=>S.createPortal}),Zd=(Qe(),()=>{const e=window.innerWidth;return{vh:window.innerHeight,vw:e}}),Xd=()=>{const[e,t]=(0,ad.useState)((()=>Zd())),r=(0,ad.useCallback)((()=>{t(Zd())}),[]);return(0,ad.useEffect)((()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)})),[]),e},ec=e=>50+parseFloat(String(e)),tc=(e,t)=>{const r=e.hasLike&&Boolean(t.hasLike),i=e.hasShare&&Boolean(t.hasShare),a=e.hasFavorite&&Boolean(t.hasFavorite),s=e.hasAudio;return!e.isBlank&&(r||a||i||s)},rc=e=>{const{desktopMode:t,storyReaderOptions:r}=Gh();return(0,ad.useMemo)((()=>{const i=ec(r.actionPanelBottomOffset),a=new cn(e.vw,e.vh,i),s=new dn(a).create({vw:e.vw,vh:e.vh,desktopMode:t}),n=s instanceof ln,o=n?a.getViewportCorrectionPadding():{};return{actionPanelHeight:i,safeAreaFrameCalculator:a,storyGeometry:s,isMobileGeometry:n,correctionPaddingStyle:o}}),[r.actionPanelBottomOffset,e,t])};var ic=A(314),ac={insert:"head",singleton:!1};od()(ic.A,ac);ic.A.locals;const sc=({storyManager:e,desktopMode:t})=>{const[r,i]=(0,ad.useState)(null),a=(()=>{const e=(0,ad.useRef)({top:0,bottom:0,left:0,right:0});return e.current||(e.current=(()=>{const e=getComputedStyle(document.documentElement),t=t=>parseFloat(e.getPropertyValue(t)),r=t("--ias-sat"),i=t("--ias-sab");return{left:t("--ias-sal"),right:t("--ias-sar"),top:r,bottom:i}})()),e.current})();return(0,ad.useEffect)((()=>{const t=e.createGameReader();return t.setSafeAreaInsets(a),i(t),()=>{t.destroy()}}),[e]),(0,ad.useEffect)((()=>{null==r||r.setDesktopMode(t)}),[r,t]),r},nc=(0,Yd.observer)((({gameReader:e})=>{var t,r,i,a,s,n,o,l,d,c;const{desktopMode:u,dir:h,gameReaderOptions:p,storyReaderOptions:g}=Gh(),f=(0,ad.useRef)(null),{sharePanelOpeningParams:m,handleShareComplete:v,closeSharePanel:b}=(e=>{const[t,r]=(0,ad.useState)(null);return(0,ad.useEffect)((()=>(null==e||e.on("openSharePanel",r),()=>{null==e||e.off("openSharePanel",r)})),[e]),{sharePanelOpeningParams:t,handleShareComplete:i=>{t&&e&&(e.confirmSharingComplete({shareId:t.shareId,isSuccess:i}),r(null))},closeSharePanel:()=>{r(null)}}})(e),{gameGeometry:y,isDesktopGeometry:w}=(()=>{const{desktopMode:e}=Gh(),{vw:t,vh:r}=Xd(),i=(new Ls).create({vw:t,vh:r,desktopMode:e});return{isDesktopGeometry:i instanceof Es,gameGeometry:i}})(),S=w&&(null===(r=null===(t=e.game)||void 0===t?void 0:t.screenOptions.widescreen)||void 0===r||r);Qh((()=>{_()}));const _=()=>{e.closeGame(),b()},{game:O,gameError:C,isGameLoading:x,closeBtnVisible:k}=e,P=(0,sd.default)(cd["game-reader"],{[cd["game-reader--desktop-mode"]]:w,[cd["game-reader--widescreen"]]:S}),j={background:null!==(a=null===(i=p.backdrop)||void 0===i?void 0:i.background)&&void 0!==a?a:"",opacity:null!==(n=null===(s=p.backdrop)||void 0===s?void 0:s.opacity)&&void 0!==n?n:0,filter:(null===(o=p.backdrop)||void 0===o?void 0:o.blur)?`blur(${p.backdrop.blur}px)`:"none"},M=null!==(d=null===(l=p.game)||void 0===l?void 0:l.backdropColor)&&void 0!==d?d:"";return(0,Jd.createPortal)((0,rd.jsx)("div",{className:cd["game-reader-container"],style:{"--game-box-border-radius":`${parseFloat(String(p.borderRadius))}px`},children:(0,rd.jsxs)("div",{className:P,children:[(0,rd.jsx)("div",{className:cd["game-reader__backdrop"],style:j}),(0,rd.jsxs)(bd,{className:cd["game-reader__game-box"],isWidescreen:S,geometry:y,children:[(0,rd.jsx)($d,{onSplashCanBeHidden:()=>{e.notifyGameCanBeStarted()},desktopMode:w,isGameInited:e.isGameInited,isGameLoading:x,isGameLoadingError:Boolean(e.gameError),gameShouldBeShown:e.gameShouldBeShown,game:null!==(c=e.game)&&void 0!==c?c:void 0,splashImageBackgroundColor:e.game?M:j.background}),C&&(0,rd.jsx)(gd,{className:cd["game-reader__refresh-btn"],onClick:()=>{e.reload()}}),(!e.gameShouldBeShown||k)&&(0,rd.jsx)(Kd,{closeButtonPosition:p.closeButtonPosition,dir:h,onCloseGame:_,closeButtonOptions:p.closeButton}),O&&(0,rd.jsxs)(rd.Fragment,{children:[(0,rd.jsx)("iframe",{src:O.url,onLoad:t=>{f.current=t.target,e.dir=h,e.setGameCenterIframe(f.current,{isWidescreen:S})},style:{opacity:e.gameShouldBeShown?1:0},frameBorder:"0",className:cd["game-reader__iframe"],sandbox:"allow-same-origin allow-top-navigation allow-forms allow-scripts allow-downloads allow-top-navigation-to-custom-protocols",allow:"fullscreen"}),m&&(0,rd.jsx)(Ud,{shareType:m.shareType,shareLink:m.shareLink,onShareCompelete:v,sharePanelOptions:g.sharePanel})]})]}),O&&p.forceCheckOrientation&&(0,rd.jsx)(Od,{orientation:Ke.PORTRAIT_PRIMARY,desktopMode:u,onOrientationChange:({isWrong:t})=>{e.isGameInited&&(t?e.pauseGameUI():e.resumeGameUI())}})]})}),document.body)}));var oc=A(130),lc={insert:"head",singleton:!1};od()(oc.A,lc);const dc=oc.A.locals||{};class cc{constructor(e,t,r){Object.defineProperty(this,"storyReaderViewModel",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storiesViewer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"backdropRef",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"deltaValY",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"windowHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"swipeUpGestureInAction",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startMove(){this.storyReaderViewModel.disableCloseGesture(),this.windowHeight=this.storiesViewer.clientHeight,this.storiesViewer.style.setProperty("transition","")}move(e){e>10||this.storyReaderViewModel.closeGestureInAction?(this.storyReaderViewModel.enableCloseGesture(),this.moveDownAndScaleReader(e)):(e<-10||this.swipeUpGestureInAction)&&this.moveUp(e)}endMove(){this.storyReaderViewModel.resumeTimer(),this.deltaValY>=0&&this.handleSwipeDown(),this.storyReaderViewModel.disableCloseGesture()}moveDownAndScaleReader(e){this.deltaValY=e/this.windowHeight;let t=1-(1-.9)*this.deltaValY;t>=1&&(t=1);let r=100*this.deltaValY*.45;r<=0&&(r=0),this.storiesViewer.style.setProperty("transform",`scale(${t}) translateY(${r}%)`)}moveUp(e){this.swipeUpGestureInAction=!0,this.deltaValY=e/this.windowHeight}returnToDefaultState(){this.storiesViewer.style.setProperty("transition","all .3s"),this.storiesViewer.style.setProperty("transform","scale(1) translateY(0%)")}closeStoryReader(){this.storiesViewer.style.setProperty("transition","opacity .3s"),this.storiesViewer.style.setProperty("opacity","0"),this.backdropRef.style.setProperty("transition","opacity .3s"),this.backdropRef.style.setProperty("opacity","0"),setTimeout((()=>{this.storyReaderViewModel.close("swipeDown")}),400)}handleSwipeDown(){this.deltaValY<=.15||!this.storyReaderViewModel.canBeClosed()?this.returnToDefaultState():this.closeStoryReader()}}const uc=(0,Yd.observer)((e=>{const t=(0,ad.useRef)(null),r=(0,ad.useRef)(null),{desktopMode:i,storyReaderOptions:a}=Gh();(({storyReaderViewModel:e,storiesViewerRef:t,backdropRef:r})=>{const i=(0,ad.useRef)(null);(0,ad.useEffect)((()=>{i.current=new cc(e,t.current,r.current)}),[]);const a=()=>{var e;t.current.classList.add(dc["no-select"]),null===(e=i.current)||void 0===e||e.startMove()},s=({dy:e})=>{var t;null===(t=i.current)||void 0===t||t.move(e)},n=()=>{var r;t.current.classList.remove(dc["no-select"]),e.touchController.verticalSwipeGesture&&(null===(r=i.current)||void 0===r||r.endMove())};(0,ad.useEffect)((()=>{const t=e.touchController;return t.on(Ba.TouchStart,a),t.on(Ba.TouchMoveVertical,s),t.on(Ba.TouchEnd,n),()=>{t.off(Ba.TouchStart,a),t.off(Ba.TouchMoveVertical,s),t.off(Ba.TouchEnd,n)}}),[e.touchController])})({storyReaderViewModel:e.storyReader,backdropRef:t,storiesViewerRef:r});const{safeAreaFrameCalculator:s,isMobileGeometry:n}=rc(e.viewport),o=!n||s.shouldBeShownSafeAreaInsets?parseFloat(String(a.borderRadius)):0;return(0,rd.jsxs)(rd.Fragment,{children:[(0,rd.jsxs)("div",{ref:r,className:(0,sd.default)("stories-viewer",dc["stories-viewer"],dc.slider3d),style:Object.assign(Object.assign({},{"--loaderBackgroundColor":null===(l=a.loader)||void 0===l?void 0:l.default.color,"--loaderBackgroundAccentColor":null===(d=a.loader)||void 0===d?void 0:d.default.accentColor,"--timelineBlockTopOffset":`${parseFloat(String(a.timelineBlockTopOffset))}px`,"--slideBorderRadius":`${o}px`}),(()=>{var e,t,r,i;return{backgroundColor:null!==(t=null===(e=a.commonBackdrop)||void 0===e?void 0:e.color)&&void 0!==t?t:void 0,backdropFilter:null!==(i=null===(r=a.commonBackdrop)||void 0===r?void 0:r.backdropFilter)&&void 0!==i?i:void 0}})()),children:[i&&(0,rd.jsx)("div",{className:dc["stories-viewer-background"],style:(()=>{var t,r,i;const s=[],n=null===(t=e.storyReader.activeStory)||void 0===t?void 0:t.displayedSlideImage;return null!=a.slideBackdrop&&Array.isArray(a.slideBackdrop.linearGradientOverlay)&&s.push(`linear-gradient(${a.slideBackdrop.linearGradientOverlay.join(", ")})`),null!=n&&s.push(`url(${n})`),{backgroundImage:s.join(", "),opacity:(null===(r=a.slideBackdrop)||void 0===r?void 0:r.opacity)||0,filter:(null===(i=a.slideBackdrop)||void 0===i?void 0:i.blur)?`blur(${a.slideBackdrop.blur}px)`:"none"}})()}),e.children]}),(0,rd.jsx)("div",{ref:t,className:(0,sd.default)(dc["stories-viewer-backdrop"],{[dc._desktopMode]:i})})]});var l,d}));var hc=A(390),pc={insert:"head",singleton:!1};od()(hc.A,pc);const gc=hc.A.locals||{};var fc=A(594),mc={insert:"head",singleton:!1};od()(fc.A,mc);const vc=fc.A.locals||{};var bc=A(187),yc={insert:"head",singleton:!1};od()(bc.A,yc);const wc=bc.A.locals||{},Sc=(0,Yd.observer)((({story:e,commonOptions:t,storyReaderOptions:r,muted:i,onClickMuteAction:a})=>{const{dir:s}=Gh(),n=e.hasLike&&Boolean(t.hasLike),o=e.hasShare&&Boolean(t.hasShare),l=e.hasFavorite&&Boolean(t.hasFavorite),d=e.hasAudio,c=tc(e,t)?ec(r.actionPanelBottomOffset):0;return(0,rd.jsx)("div",{dir:s,className:wc["stories-button-panel"],style:{height:`${c}px`,transform:`translateY(${c}px)`},children:tc(e,t)&&(0,rd.jsxs)("div",{className:wc["stories-button-panel-actions"],children:[(()=>{if(!n)return null;const t=0===e.like||-1===e.like,i=0===e.like||1===e.like;return(0,rd.jsxs)("span",{children:[(0,rd.jsx)("span",{className:(0,sd.default)(wc["button-panel-action"],{"like-up":t,"like-up-filled":1===e.like}),dangerouslySetInnerHTML:{__html:t?r.likeButton.svgSrc.baseState:r.likeButton.svgSrc.activeState},onClick:()=>{e.setLike(1===e.like?0:1)}}),(0,rd.jsx)("span",{className:(0,sd.default)(wc["button-panel-action"],{"like-down":i,"like-down-filled":-1===e.like}),dangerouslySetInnerHTML:{__html:i?r.dislikeButton.svgSrc.baseState:r.dislikeButton.svgSrc.activeState},onClick:()=>{e.setDislike(-1===e.like?0:-1)}})]})})(),l&&(0,rd.jsx)("span",{children:(0,rd.jsx)("span",{className:(0,sd.default)(wc["button-panel-action"],{bookmark:!e.favorite,"bookmark-filled":e.favorite}),dangerouslySetInnerHTML:{__html:e.favorite?r.favoriteButton.svgSrc.activeState:r.favoriteButton.svgSrc.baseState},onClick:()=>e.setBookmark(!e.favorite)})}),(0,rd.jsxs)("span",{className:wc["right-container"],children:[d&&(0,rd.jsx)("span",{children:(0,rd.jsx)("span",{className:(0,sd.default)(wc["button-panel-action"],{"muted-icon":i,"sound-icon":!i}),dangerouslySetInnerHTML:{__html:i?r.muteButton.svgSrc.baseState:r.muteButton.svgSrc.activeState},onClick:a})}),o&&(0,rd.jsx)("span",{className:wc["button-panel-action"],dangerouslySetInnerHTML:{__html:r.shareButton.svgSrc.baseState},onClick:()=>{e.share()}})]})]})})}));var _c=A(349),Oc={insert:"head",singleton:!1};od()(_c.A,Oc);const Cc=_c.A.locals||{},xc=e=>{var t,r;const{dir:i}=Gh();return(0,rd.jsx)("div",{className:Cc["story-header"],children:!e.closeDisabled&&(0,rd.jsx)("button",{dir:i,"data-position":e.options.closeButtonPosition,className:(0,sd.default)(Cc["stories-viewer__close"],{[Cc["_paused-ui"]]:e.uiPaused}),onClick:t=>{t.stopPropagation(),t.preventDefault(),e.onClose()},dangerouslySetInnerHTML:{__html:null!==(r=null===(t=e.options.closeButton)||void 0===t?void 0:t.svgSrc.baseState)&&void 0!==r?r:""}})})};var kc=A(278),Pc={insert:"head",singleton:!1};od()(kc.A,Pc);const jc=kc.A.locals||{};var Mc=A(323),Ec={insert:"head",singleton:!1};od()(Mc.A,Ec);Mc.A.locals;const Ic=e=>{const t=e.slide,{slideContentRef:r}=(({slide:e,activeStory:t,currentStory:r,canBeInitialized:i,currentSlideIndex:a,activeSlideIndex:s,canBeShown:n,muted:o,timerPaused:l})=>{const d=(0,ad.useRef)(null),c=t.id===r.id,u=s===a,h=i&&n&&e.state===bs.Idle&&u,p=!(e.state!==bs.Started&&e.state!==bs.Error||u&&c),g=c&&u&&e.state===bs.Loaded;return(0,ad.useLayoutEffect)((()=>{h&&e.init(d.current)}),[e,h]),(0,ad.useLayoutEffect)((()=>{g&&e.start()}),[c,g]),(0,ad.useLayoutEffect)((()=>{p&&e.stop()}),[p]),(0,ad.useEffect)((()=>{l?e.pause():e.resume()}),[e,l,e.state]),(0,ad.useEffect)((()=>{o?e.mute():e.unmute()}),[e,o,e.state]),(0,ad.useLayoutEffect)((()=>()=>{e.destroy()}),[e]),{slideContentRef:d}})(e);return{slideContentRef:r,needLoadingMask:t.state===bs.Loading||!e.canBeShown,needLoadingAnimation:t.state===bs.Loading||!e.canBeShown}};var Lc=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Tc=(0,Yd.observer)((e=>{var{geometry:t}=e,r=Lc(e,["geometry"]);const{desktopMode:i,dir:a}=Gh(),{slideContentRef:s,needLoadingAnimation:n,needLoadingMask:o}=Ic(r),{slideStyle:l,slideContentStyle:d,needBottomPanel:c}=(({geometry:e,currentStory:t})=>{const{storyReaderOptions:r,commonOptions:i}=Gh(),a=(0,ad.useMemo)((()=>tc(t,i)),[t,i]),s=a?ec(r.actionPanelBottomOffset):0;return{needBottomPanel:a,slideStyle:(0,ad.useMemo)((()=>({margin:e.getOffset(s),width:e.getWidth(),height:e.getHeight(),"--y-offset":e.getOffsetY(s),"--x-offset":e.getOffsetX(s)})),[s,e]),slideContentStyle:(0,ad.useMemo)((()=>({fontSize:e.getFontSize()})),[e])}})({geometry:t,currentStory:r.currentStory}),u=r.networkError||r.slide.state===bs.Error,h=(0,ad.useMemo)((()=>({__html:r.slide.html})),[r.slide.html]);return(0,rd.jsxs)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),r.clickDisabled||(e=>{const s=e.target,n=new vs(r.slide,e,t,a,i);r.slide.onClick(s,n)})(e)},className:(0,sd.default)(jc["stories-slide"],{[jc["stories-slide_active"]]:r.currentSlideIndex===r.activeSlideIndex,[jc["stories-slide_text-fitted"]]:r.slide.textFitted,[jc["_with-bottom-panel"]]:c,[jc["_desktop-mode"]]:t instanceof on}),children:[(0,rd.jsx)("div",{className:jc["stories-slide-offset"],style:l,children:(0,rd.jsx)("div",{className:jc["stories-slide-box"],"data-testid":"stories-slide-box",children:(0,rd.jsx)("div",{ref:s,dangerouslySetInnerHTML:h,className:`${jc["stories-slide-content"]} narrative-slide"`,style:d})})}),(o||u)&&(0,rd.jsx)("div",{className:jc["load-mask"],onClick:e=>{e.preventDefault()},children:u?(0,rd.jsx)(gd,{className:jc["stories-slide__refresh-btn"],onClick:e=>{e.stopPropagation(),r.networkError?r.onReloadStory():r.slide.reload()}}):n&&(0,rd.jsx)("div",{className:jc["loading-spinner-default"]})})]})}));var Ac=A(137),Rc={insert:"head",singleton:!1};od()(Ac.A,Rc);const Dc=Ac.A.locals||{},Bc=(0,ad.forwardRef)(((e,t)=>{const{desktopMode:r,dir:i}=Gh();return(0,rd.jsx)("div",{ref:t,dir:i,className:(0,sd.default)(Dc["stories-pager"],{[Dc["_desktop-mode"]]:r,[Dc["_paused-ui"]]:e.uiPaused}),style:{"--stories-pager-tick-foreground":e.timeline.foreground,"--stories-pager-background":e.timeline.background},children:(0,rd.jsx)("div",{className:`${Dc["stories-pager__ticks"]} ${(0,sd.default)({[Dc.hiddenTimeline]:e.hiddenTimeline})}`,children:new Array(e.slidesLength).fill(0).map(((t,r)=>(0,rd.jsxs)("div",{className:Dc["stories-pager__tick"],children:[(0,rd.jsx)("div",{className:(0,sd.default)(Dc["stories-pager__tick-progress"],{[Dc._active]:r+1<=e.activeSlideIndex})}),(0,rd.jsx)("div",{className:Dc["stories-pager__tick-progress-loader"],style:{display:r+1===e.activeSlideIndex+1?"block":"none"}})]},r+1)))})})}));const Fc=function(){let e;const t=document.createElement("div"),r={transition:"transitionend",OTransition:"otransitionend",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&void 0!==t.style[e])return r[e]}();function Nc(e,t,r){return new Promise((i=>{let a=!1;const s=()=>{a=!0,clearTimeout(o),void 0!==Fc&&e.removeEventListener(Fc,n),e.style.setProperty("transition",`${t} 0ms`),i()},n=e=>{e.propertyName===t&&(a||s())};void 0!==Fc&&e.addEventListener(Fc,n,!1);const o=setTimeout((()=>{a||s()}),r+20);e.style.setProperty("transition",`${t} ${r}ms`)}))}var Uc=A(212),Wc={insert:"head",singleton:!1};od()(Uc.A,Wc);const zc=Uc.A.locals||{},Vc=e=>{const t=(0,ad.useRef)(null),r=(0,ad.useRef)(null),i=(0,ad.useRef)(0),a=(0,ad.useRef)(0);let s;const n=()=>{r.current&&(a.current=-1*function(e){const t=window.getComputedStyle(e),r=t.transform||t.webkitTransform||t.mozTransform;if("none"===r)return{x:0,y:0,z:0};const i=r.includes("3d")?"3d":"2d",a=r.match(/matrix.*\((.+)\)/)[1].split(", ");return"2d"===i?{x:isNaN(a[4])?0:a[4],y:isNaN(a[5])?0:a[5],z:0}:"3d"===i?{x:isNaN(a[12])?0:a[12],y:isNaN(a[13])?0:a[13],z:isNaN(a[14])?0:a[14]}:{x:0,y:0,z:0}}(r.current).x)},[o,l]=(0,ad.useState)(!1),[d,c]=(0,ad.useState)(!1),u=(0,ad.useRef)(!1),h=()=>{const t=ad.Children.count(e.children);return r.current&&t?r.current.scrollWidth/t:0};let p=!1;(0,ad.useEffect)((()=>{var e;return("ontouchstart"in window||window.navigator.msPointerEnabled||"ontouchstart"in document.documentElement)&&(p=!0),p||(r.current&&(s=null===(e=r.current.children[0])||void 0===e?void 0:e.offsetWidth),r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth,n()),i.current===a.current?c(!1):c(!0),0===a.current?l(!1):l(!0)),()=>{}}),[]);const g=(0,ad.useRef)(!1),f=(0,ad.useRef)(0);let m=0;const v=(0,ad.useRef)(!1),[b,y]=(0,ad.useState)(0),w=e=>{e<0&&(e=0),e>i.current&&(e=i.current),y(e)};(0,ad.useEffect)((()=>{b===i.current?c(!1):c(!0),l(0!==b)}),[b]);const S=e=>{if(!u.current)if(g.current){const t=e instanceof MouseEvent?e.pageX:e.touches&&e.touches[0].pageX;if(t!==f.current){v.current=!0,m=t;const e=f.current-m,r=a.current+e;w(r)}}else v.current=!1},_=e=>{v.current&&e.preventDefault(),setTimeout((()=>{v.current=!1})),g.current=!1,document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",_)};return(0,rd.jsxs)("div",{className:zc["scrolling-carousel"],style:e.style,children:[(0,rd.jsx)("div",{className:zc["scrolling-carousel__wrapper"],ref:t,onMouseDown:e=>{u.current||(e.preventDefault(),g.current=!0,f.current=e.pageX,r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth),r.current&&n(),document.addEventListener("mousemove",S),document.addEventListener("mouseup",_))},onTouchStart:e=>{u.current||(e.preventDefault(),g.current=!0,f.current=e.touches&&e.touches[0].pageX,r.current&&(i.current=r.current.scrollWidth-r.current.clientWidth),r.current&&n(),document.addEventListener("touchmove",S),document.addEventListener("touchend",_))},onClickCapture:e=>{v.current&&(e.preventDefault(),e.stopPropagation())},children:(0,rd.jsx)("div",{className:zc["scrolling-carousel__item"],ref:r,style:{transform:`translateX(${-1*b}px)`},children:e.children})}),!p&&(0,rd.jsxs)(rd.Fragment,{children:[(0,rd.jsx)("div",{className:(0,sd.default)(zc["scrolling-carousel__arrow-button"],zc["scrolling-carousel__arrow-button--left"],{[zc["scrolling-carousel__arrow-button--show"]]:o}),onClick:async()=>{if(u.current)return;n();const e=a.current-h();w(e),u.current=!0,r.current&&await Nc(r.current,"transform",300),u.current=!1},children:(0,rd.jsx)("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,rd.jsx)("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})})}),(0,rd.jsx)("div",{className:(0,sd.default)(zc["scrolling-carousel__arrow-button"],zc["scrolling-carousel__arrow-button--right"],{[zc["scrolling-carousel__arrow-button--show"]]:d}),onClick:async()=>{if(u.current)return;n();const e=a.current+h();w(e),u.current=!0,r.current&&await Nc(r.current,"transform",300),u.current=!1},children:(0,rd.jsx)("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,rd.jsx)("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})})})]})]})},Gc=({children:e,style:t,color:r,font:i,className:a})=>(0,rd.jsx)("div",{className:a,style:Object.assign({color:r,font:i},t),children:e});var $c=A(108),Hc={insert:"head",singleton:!1};od()($c.A,Hc);const qc=$c.A.locals||{},Qc=({goods:e,onClick:t,options:r})=>{var i;const{imgSrc:a,title:s,subTitle:n,price:o,oldPrice:l}=e;return(0,rd.jsxs)("div",{className:(0,sd.default)(qc["goods-card"]),style:{color:null!==(i=r.mainTextColor)&&void 0!==i?i:"black"},onClick:t,children:[(0,rd.jsx)("div",{className:(0,sd.default)(qc.figure),style:{borderRadius:r.imageCornerRadius+"px",backgroundColor:r.imageBackgroundColor},children:a&&(0,rd.jsx)("img",{src:a,alt:s,style:{borderRadius:r.imageCornerRadius+"px",backgroundColor:r.imageBackgroundColor}})}),(0,rd.jsx)(Gc,{font:r.subtitleFont,children:n}),(0,rd.jsx)(Gc,{font:r.titleFont,children:s}),(0,rd.jsxs)("div",{className:qc.prices,children:[(0,rd.jsx)(Gc,{font:r.priceFont,children:o}),(0,rd.jsx)(Gc,{className:qc["typography--old-price"],font:r.oldPriceFont,color:r.oldPriceTextColor,children:l})]})]})},Kc=e=>{const t=e.goodsWidgetOptions,r=t.goodsWidgetRenderingType||t.goodsList.renderingType;let i=[];return r===F.DEFAULT?i=e.goodsList.map(((r,i)=>(0,rd.jsx)(Qc,{options:t.goodsCard,goods:r,onClick:()=>e.onGoodsCardClick(r)},i))):r===F.CUSTOM_CARD&&(0,de.default)(t.getCardHtml)&&(i=e.goodsList.map(((r,i)=>{var a,s;return(0,rd.jsx)("div",{dangerouslySetInnerHTML:{__html:null!==(s=null===(a=t.getCardHtml)||void 0===a?void 0:a.call(t,r,i))&&void 0!==s?s:""},onClick:()=>e.onGoodsCardClick(r)},i)}))),(0,rd.jsx)(Vc,{style:{marginTop:"-15px"},children:i})};var Yc=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Jc=e=>{var{arrowColor:t}=e,r=Yc(e,["arrowColor"]);return(0,rd.jsx)("svg",Object.assign({},r,{width:"32",height:"12.5",viewBox:"0 0 64 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,rd.jsx)("path",{d:"M56.293 1.23375C58.054 -0.41125 60.846 -0.41125 62.607 1.23375C64.464 2.96775 64.464 5.85675 62.607 7.59075L35.157 23.2288C33.396 24.8738 30.604 24.8738 28.843 23.2288L1.393 7.59075C0.494002 6.75175 0 5.62775 0 4.41275C0 3.19775 0.494002 2.07375 1.393 1.23475C3.154 -0.410251 5.946 -0.410251 7.707 1.23475L32 13.9237L56.293 1.23375Z",fill:t})}))};var Zc=A(161),Xc={insert:"head",singleton:!1};od()(Zc.A,Xc);const eu=Zc.A.locals||{},tu=({closeImage:e,arrowColor:t,onClick:r})=>(0,rd.jsx)("div",{className:eu.btn,onClick:r,onTouchStart:r,children:e?(0,rd.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}):(0,rd.jsx)(Jc,{arrowColor:t})});var ru=A(277),iu={insert:"head",singleton:!1};od()(ru.A,iu);const au=ru.A.locals||{},su=({isLoading:e,backgroundColor:t="white",accentBackgroundColor:r="transparent"})=>e?(0,rd.jsx)("div",{className:au.spinner,style:{border:`solid 2px ${t}`,borderColor:`${r} ${t} ${t} ${t}`}}):null;var nu=A(940),ou={insert:"head",singleton:!1};od()(nu.A,ou);const lu=nu.A.locals||{},du=e=>{let t=[];return t=e.goodsList.map(((t,r)=>e.renderGoods({goods:t,index:r,onClick:t=>{e.onGoodsCardClick(t)}}))),(0,rd.jsx)(Vc,{children:t})};var cu;!function(e){e[e.IN=0]="IN",e[e.OUT=1]="OUT"}(cu||(cu={}));const uu=({open:e,url:t,goodsWidgetOptions:r,onClosed:i,onClose:a,onGoodsCardClick:s})=>{const n=(0,ad.useRef)(null),[o,l]=(0,ad.useState)([]),[d,c]=(0,ad.useState)(cu.IN),u=r,{dimColor:h,substrateHeight:p,substrateColor:g,closeImage:f,closeBackgroundColor:m}=u.goodsList;(0,ad.useEffect)((()=>{c(e?cu.IN:cu.OUT)}),[e]),(0,ad.useEffect)((()=>{t&&v()}),[t]);const v=async()=>{const e=b(),t=await r.openGoodsWidgetHandler(e);l(t)},b=()=>{try{return JSON.parse(t).map((e=>({sku:e,title:"",subTitle:"",price:"",oldPrice:""})))}catch(e){return console.error(e),[]}};(0,ad.useEffect)((()=>{const e=n.current;if(d===cu.OUT)return e.addEventListener("animationend",i),()=>{e.removeEventListener("animationend",i)}}),[d]);const y=u.loader.custom?(0,rd.jsx)("div",{dangerouslySetInnerHTML:{__html:u.loader.custom}}):(0,rd.jsx)(su,{isLoading:Boolean(r.isLoading),backgroundColor:u.loader.default.color,accentBackgroundColor:u.loader.default.accentColor});return(0,rd.jsxs)("div",{className:(0,sd.default)(lu["goods-container"],{[lu["goods-container--visible"]]:d===cu.IN,[lu["goods-container--hidden"]]:d===cu.OUT}),ref:n,children:[(0,rd.jsx)("div",{className:(0,sd.default)(lu["goods-container__backdrop"]),style:{backgroundColor:h},onClick:a}),(0,rd.jsxs)("div",{className:(0,sd.default)(lu["goods-container"]),style:{height:p+"px",backgroundColor:null!=g?g:"white"},children:[y,r.renderItem?(0,rd.jsx)(du,{goodsWidgetOptions:r,goodsList:o,renderGoods:r.renderItem,onGoodsCardClick:s}):(0,rd.jsx)(Kc,{goodsList:o,onGoodsCardClick:s,goodsWidgetOptions:r}),(0,rd.jsx)(tu,{onClick:a,closeImage:f,arrowColor:m})]})]})};var hu=A(942),pu={insert:"head",singleton:!1};od()(hu.A,pu);const gu=hu.A.locals||{},fu=e=>{const[t,r]=(0,ad.useState)(!1),[i,a]=(0,ad.useState)(!1),{storyManager:s}=Gh(),n=()=>{a(!0),r(!0)},o=()=>{r(!1)};(0,ad.useEffect)((()=>(e.widget.on(us.Open,n),()=>{e.widget.off(us.Open,n)})),[e.widget]),(0,ad.useEffect)((()=>(vi.addListener("goodsWidget.close",o),()=>{vi.removeListener("goodsWidget.close",o)})),[]),(0,ad.useEffect)((()=>{t&&s.emit("widgetEvent",{name:"w-goods-open",data:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.widget.elementId,skus:l(e.widget.targetUrl)}})}),[t]);const l=e=>{try{return JSON.parse(e)}catch(e){return[]}};return i?(0,rd.jsx)("div",{className:gu["goods-widget-viewer"],children:(0,rd.jsx)(uu,{open:t,url:e.widget.targetUrl,goodsWidgetOptions:e.goodsWidgetOptions,onClose:()=>{r(!1)},onClosed:()=>{e.widget.close(),a(!1)},onGoodsCardClick:t=>{var r,i;s.emit("widgetEvent",{name:"w-goods-click",data:{story_id:e.story.id,slide_index:e.story.activeSlideIndex,widget_id:e.widget.elementId,widget_value:t.sku}}),null===(i=(r=e.goodsWidgetOptions).itemClickHandler)||void 0===i||i.call(r,t)}})}):null},mu={247:"9999",376:"99 99 99",971:"99 999 9999",93:"99 999 9999",1268:"999 9999",1264:"999 9999",355:"999 999 999",374:"99 999 999",599:"999 9999",244:"999 999 999",672:"9 99 999",54:"999 999 9999",1684:"999 9999",43:"999 999 9999",61:"9 9999 9999",297:"999 9999",994:"99 999 99 99",387:"99 999 999",1246:"999 9999",880:"99 999 999",32:"999 999 999",226:"99 99 9999",359:"999 999 999",973:"9999 9999",257:"99 99 9999",229:"99 99 9999",1441:"999 9999",673:"999 9999",591:"9 999 9999",55:"99 99999 9999",1242:"999 9999",975:"99 999 999",267:"99 999 999",375:"99 999 99 99",501:"999 9999",243:"999 999 999",236:"99 99 9999",242:"99 999 9999",41:"99 999 9999",225:"99 999 999",682:"99 999",56:"9 9999 9999",237:"9999 9999",86:"999 9999 9999",57:"999 999 9999",506:"9999 9999",53:"9 999 9999",238:"999 99 99",357:"99 999 999",420:"999 999 999",49:"9999 999 9999",253:"99 99 99 99",45:"99 99 99 99",1767:"999 9999",1809:"999 9999",1829:"999 9999",1849:"999 9999",213:"99 999 9999",593:"99 999 9999",372:"9999 9999",20:"999 999 9999",291:"9 999 999",34:"999 999 999",251:"99 999 9999",358:"999 999 99 99",679:"99 99999",500:"99999",691:"999 9999",298:"999 999",262:"99999 9999",33:"999 999 999",508:"99 9999",590:"999 999 999",241:"9 99 99 99",1473:"999 9999",995:"999 999 999",594:"99999 9999",233:"999 999 999",350:"999 99999",299:"99 99 99",220:"999 99 99",224:"99 999 999",240:"99 999 9999",30:"999 999 9999",502:"9 999 9999",1671:"999 9999",245:"9 999999",592:"999 9999",852:"9999 9999",504:"9999 9999",385:"99 999 999",509:"99 99 9999",36:"999 999 999",628:"99 999 9999",62:"99 999 99",353:"999 999 999",972:"99 999 9999",91:"9999 999 999",246:"999 9999",964:"999 999 9999",98:"999 999 9999",354:"999 9999",39:"999 9999 999",1876:"999 9999",962:"9 9999 9999",81:"99 9999 9999",254:"999 999999",996:"999 999 999",855:"99 999 999",686:"99 999",269:"99 99999",1869:"999 9999",850:"999 999 9999",82:"99 999 9999",965:"9999 9999",1345:"999 9999",76:"99 999 99 99",77:"99 999 99 99",856:"99 99 999 999",961:"99 999 999",1758:"999 9999",423:"999 999 9999",94:"99 999 9999",231:"99 999 999",266:"9 999 9999",370:"999 99 999",352:"999 999 999",371:"99 999 999",218:"99 999 9999",212:"99 9999 999",377:"9999 9999",373:"9999 9999",382:"99 999 999",261:"99 99 99999",692:"999 9999",389:"99 999 999",223:"99 99 9999",95:"99 999 999",976:"99 99 9999",853:"9999 9999",1670:"999 9999",596:"999 99 99 99",222:"99 99 9999",1664:"999 9999",356:"9999 9999",230:"999 9999",960:"999 9999",265:"99 999 9999",52:"999 999 9999",60:"99 999 9999",258:"99 999 999",264:"99 999 9999",687:"99 9999",227:"99 99 9999",234:"999 999 9999",505:"9999 9999",31:"99 999 9999",47:"999 99 999",977:"99 999 999",674:"999 9999",683:"9999",64:"999 999 999",968:"99 999 999",507:"999 9999",51:"999 999 999",689:"99 99 99",675:"999 99 999",63:"999 999 9999",92:"999 999 9999",48:"999 999 999",970:"99 999 9999",351:"99 999 9999",680:"999 9999",595:"999 999 999",974:"9999 9999",40:"99 999 9999",381:"99 999 9999",7:"999 999 99 99",250:"999 999 999",966:"99 999 9999",677:"999 9999",248:"9 999 999",249:"99 999 9999",46:"99 999 9999",65:"9999 9999",290:"99 999",386:"99 999 999",421:"999 999 999",232:"99 999999",378:"9999 999999",221:"99 999 9999",252:"99 999 999",597:"999 9999",211:"99 999 9999",239:"99 99999",503:"99 99 9999",1721:"999 9999",963:"99 9999 999",268:"99 99 9999",1649:"999 9999",235:"99 99 99 99",228:"99 999 999",66:"99 999 9999",992:"99 999 9999",690:"9999",670:"999 9999",993:"9 999 9999",216:"99 999 999",676:"99999",90:"999 999 9999",1868:"999 9999",688:"99 9999",886:"999 999 999",255:"99 999 9999",380:"99 999 99 99",256:"999 999 999",44:"99 9999 9999",598:"9 999 99 99",998:"99 999 9999",396:"999 99999",1784:"999 9999",58:"999 999 9999",1284:"999 9999",1340:"999 9999",84:"99 9999 999",678:"99 99999",681:"99 9999",685:"99 9999",967:"999 999 999",27:"99 999 9999",260:"99 999 9999",263:"9 999999",1:"999 999 9999",383:"9999 9999"};class vu{static isEmailValid(e){return/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(e)}static isTelephoneValid(e,t){return e?e.replace(/\s/g,"").length===t.length&&t.length>0:/^\d+$/.test(t)}}const bu=e=>{switch(e){case"":default:return"text";case"tel":return"tel";case"email":return"email"}},yu=e=>{const[t,r]=(0,ad.useState)({countryCode:"",phone:""}),[i,a]=(0,ad.useState)(""),[s,n]=(0,ad.useState)(!0),o=r=>{var i;const a=bu(null!==(i=null==e?void 0:e.configV2.main.input.type)&&void 0!==i?i:"");return"email"===a?vu.isEmailValid(r):"tel"!==a||vu.isTelephoneValid((()=>{var e;const r=t.countryCode.substring(1);return r&&null!==(e=mu[r])&&void 0!==e?e:""})(),t.phone)};return{value:i,telephone:t,isValid:s,handleTelephoneChange:e=>{r(e),e.phone.length>0?a(e.countryCode+e.phone):a("")},handleChange:e=>{a(e)},handleSubmit:e=>{const t=i.trim(),r=o(i);n(r),r&&e({value:t})},reset:()=>{n(!0),a(""),r({countryCode:"",phone:""})}}};var wu=A(169),Su={insert:"head",singleton:!1};od()(wu.A,Su);const _u=wu.A.locals||{},Ou=(0,ad.forwardRef)(((e,t)=>{const r=(0,ad.useRef)(null);return(0,ad.useEffect)((()=>{De(r.current),r.current.focus()}),[]),(0,rd.jsx)("input",{type:"email",className:(0,sd.default)(_u.input,_u.input_centered),placeholder:e.placeholder,value:e.value,ref:r,onChange:t=>e.onChange(t.target.value)})}));const Cu=(e=>{var t={};return A.d(t,e),t})({default:()=>_.default}),xu=(0,ad.forwardRef)(((e,t)=>{const r=t=>{const r=t.target;r&&(r.value=r.value.replace(/\D/g,""),e.onChange({countryCode:e.value.countryCode,phone:r.value}))},i=e.value.countryCode.substring(1),a=i?mu[i]:"";return(0,rd.jsxs)("div",{className:_u["input-group"],children:[(0,rd.jsxs)("div",{className:_u["input-group__prepend"],children:[(0,rd.jsx)(Cu.default,{type:"tel",mask:"+999",maskChar:null,className:_u.input,onChange:t=>{e.onChange({countryCode:t.currentTarget.value,phone:e.value.phone})},value:e.value.countryCode,placeholder:"+",inputRef:e=>{e&&(e=>{setTimeout((()=>{De(e),e.focus()}))})(e)}}),(0,rd.jsx)("div",{className:_u["input-group__separator"]})]}),a?(0,rd.jsx)(Cu.default,{type:"tel",className:_u.input,mask:a,maskChar:"-",alwaysShowMask:!0,placeholder:e.placeholder,inputRef:e=>{},value:e.value.phone,onChange:r}):(0,rd.jsx)("input",{type:"tel",className:_u.input,placeholder:e.placeholder,ref:e=>{},value:e.value.phone,onChange:r})]})})),ku=(0,ad.forwardRef)(((e,t)=>{const r=(0,ad.useRef)(null),i=(0,ad.useRef)(null);(0,ad.useEffect)((()=>{i.current.dataset.replicatedValue=e.value,De(r.current),r.current.focus(),r.current.setSelectionRange(e.value.length,e.value.length)}),[]);return(0,rd.jsx)("div",{className:_u["textarea-grow-wrap"],ref:i,style:e.style,children:(0,rd.jsx)("textarea",{className:_u.input,placeholder:e.placeholder,rows:1,ref:r,maxLength:e.maxLength,value:e.value,onChange:t=>e.onChange(t.target.value),onInput:e=>{i.current.dataset.replicatedValue=e.currentTarget.value}})})}));var Pu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const ju=e=>{var{form:t,config:r}=e,i=Pu(e,["form","config"]);const[a,s]=(0,ad.useState)(!0),{getMainStyle:n,getMainElementsStyle:o,getQuestionStyle:l,getInputWrapperStyle:d,getButtonStyle:c,getTextareaStyle:u}=(({config:e})=>{const t=t=>t*(e.size.viewportWidth/(e.size.viewportWidth/e.size.fontSize));return{getMainStyle:()=>{const r=e.configV2.main;return{width:`${e.size.absolute.width}px`,height:"auto",left:e.size.absolute.center.x-e.size.absolute.width/2-e.size.slideOffsetX+"px",top:e.size.absolute.center.y-e.size.absolute.height/2-e.size.slideOffsetY+"px",backgroundColor:`${r.background.color}`,border:`${r.border.visible&&`${t(r.border.width)}px solid ${r.border.color}`}`,borderRadius:`${t(r.border.radius)}px`}},getMainElementsStyle:()=>{const r=e.configV2.main;return{width:"100%",padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`}},getQuestionStyle:()=>{const r=e.configV2.main.question;return{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}},getInputWrapperStyle:()=>{const r=e.configV2.main.input;let i=e.configV2.main.input.text.maxLines;return i=i>0?i:1,{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,backgroundColor:`${r.background.color}`,border:`${t(r.border.width)}px solid ${r.border.color}`,borderRadius:`${t(r.border.radius)}px`,lineHeight:`${r.text.lineHeight}`,maxHeight:r.text.lineHeight*i+"em",fontSize:`${t(r.text.size)}px`,overflowY:"scroll",scrollbarWidth:"none"}},getButtonStyle:()=>{const r=e.configV2.main.button;return{padding:`${t(r.padding.top)}px ${t(r.padding.right)}px ${t(r.padding.bottom)}px ${t(r.padding.left)}px`,backgroundColor:`${r.background.color}`,border:`${t(r.border.width)}px solid ${r.border.color}`,color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}},getTextareaStyle:()=>{const r=e.configV2.main.input;return{color:`${r.text.color}`,fontSize:`${t(r.text.size)}px`,lineHeight:`${r.text.lineHeight}`,textAlign:`${r.text.align}`,fontFamily:`${r.text.type}`,fontWeight:`${r.text.weight}`,fontStyle:`${r.text.style}`}}}})({config:r}),h=Math.max(r.configV2.main.input.text.limit,0),p=String(r.configV2.main.input.text.placeholder).trim(),g=String(r.configV2.main.button.text.value).trim(),f=String(r.configV2.main.question.text.value).trim(),m=bu(r.configV2.main.input.type),v=({value:e})=>{i.onComplete({result:!0,value:e}),s(!1)};return(0,rd.jsxs)("div",{className:_u.wrapper,children:[(0,rd.jsx)("div",{className:(0,sd.default)(_u.backdrop,{[_u.fadeIn]:a,[_u.fadeOut]:!a}),onAnimationEnd:()=>{a||i.onClose()},onClick:()=>{i.onComplete({result:!1,value:t.value}),s(!1)}}),(0,rd.jsxs)("div",{className:_u.main,style:n(),children:[(0,rd.jsxs)("div",{className:_u["main-elements"],style:o(),children:[(0,rd.jsx)("div",{className:_u.question,style:l(),children:f}),(0,rd.jsxs)("div",{className:(0,sd.default)(_u["input-wrapper"],{[_u["is-invalid"]]:!t.isValid}),style:d(),children:["text"===m&&(0,rd.jsx)(ku,{value:t.value,onChange:t.handleChange,style:u(),placeholder:p,maxLength:h}),"email"===m&&(0,rd.jsx)(Ou,{value:t.value,onChange:t.handleChange,placeholder:p}),"tel"===m&&(0,rd.jsx)(xu,{value:t.telephone,onChange:t.handleTelephoneChange,placeholder:p})]})]}),t.value.trim().length>0&&(0,rd.jsx)("div",{className:_u["button-wrapper"],children:(0,rd.jsx)("button",{className:_u.button,style:c(),onClick:()=>t.handleSubmit(v),children:g})})]})]})},Mu=({storyGeometry:e,activeSlide:t,storyRef:r,storyReader:i})=>{const[a,s]=(0,ad.useState)(null),[n,o]=(0,ad.useState)(null),l=yu(n);(0,ad.useEffect)((()=>(vi.on(fn.ShowInputModal,d),()=>{vi.off(fn.ShowInputModal,d)})),[]);const d=({id:t,config:a})=>{i.pauseUI(),i.touchController.disable(),s(t),(t=>{t.size.fontSize=parseFloat(e.getFontSize()),t.size.viewportWidth=e.calculateWidth();const i=r.current.getBoundingClientRect();t.size.slideOffsetX=i.x,t.size.slideOffsetY=i.y,t.size.slideHeight=i.height,o(t)})(a)};return(0,ad.useLayoutEffect)((()=>()=>{l.reset()}),[a]),n?(0,rd.jsx)(ju,{form:l,config:n,onComplete:e=>{if(!a)throw new Error;((e,r)=>{t.setUserData(e,r)})(a,e.result?e.value:""),i.resumeUI()},onClose:()=>{o(null),i.touchController.enable()}}):null};var Eu=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Iu=(0,Yd.observer)((e=>{var t,{story:r,geometry:i,storyReader:a,className:s}=e,n=Eu(e,["story","geometry","storyReader","className"]);const o=(0,ad.useRef)(null),l=(0,ad.useRef)(null);(({story:e,progressBarRef:t})=>{const r=e.timer;(0,ad.useEffect)((()=>{const i=e=>{var r;null===(r=t.current)||void 0===r||r.style.setProperty("--tick",e+"%")},a=({forceEnd:t})=>{t||(e.reachEnd?e.nextStory("auto"):e.nextSlide())},s=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")},n=()=>{var e;null===(e=t.current)||void 0===e||e.style.setProperty("--tick","0%")};return r.on("start",s),r.on("stop",n),r.on("progress",i),r.on("complete",a),()=>{r.off("start",s),r.off("progress",i),r.off("complete",a),r.off("stop",n)}}),[r,e])})({story:r,progressBarRef:l});const d=(0,ad.useMemo)((()=>{var e,t;return(null!==(t=null===(e=r.activeSlide)||void 0===e?void 0:e.findAllWidgetsOfType((e=>e instanceof hs)))&&void 0!==t?t:[])[0]}),[null===(t=r.activeSlide)||void 0===t?void 0:t.state]),c=async()=>{try{await r.reload()}catch(e){console.error(e)}};return(0,rd.jsxs)("div",{ref:o,className:(0,sd.default)(vc["stories-item"],vc.slider3d__item,s),onMouseDown:()=>{r.completeNativeSharing()},onTouchStart:()=>{r.completeNativeSharing()},"data-testid":"story",style:n.style,children:[(0,rd.jsx)(xc,{closeDisabled:r.disableClose,options:n.storyReaderOptions,onClose:n.onClose,uiPaused:a.uiPaused}),r.activeSlide&&(0,rd.jsx)(Bc,{ref:l,hiddenTimeline:r.hiddenTimeline,slidesLength:r.slidesCount,timeline:r.activeSlide.timeline,activeSlideIndex:r.activeSlideIndex,uiPaused:a.uiPaused}),r.displayedSlides.map((e=>(0,rd.jsx)(Tc,{clickDisabled:n.slideClickDisabled,onReloadStory:c,activeSlideIndex:r.activeSlideIndex,currentSlideIndex:e.index,canBeInitialized:n.canBeInitialized,networkError:Boolean(r.error),currentStory:r,activeStory:n.activeStory,geometry:i,slide:e,canBeShown:r.canBeShown,timerPaused:a.timerPaused,muted:a.muted},e.html))),(0,rd.jsx)(Sc,{story:r,commonOptions:n.commonOptions,storyReaderOptions:n.storyReaderOptions,muted:a.muted,onClickMuteAction:()=>{a.muted?a.unmute():a.mute()}}),d&&n.activeStory===r&&(0,rd.jsx)(fu,{widget:d,story:r,goodsWidgetOptions:n.goodsWidgetOptions}),n.activeStory===r&&r.activeSlide&&(0,rd.jsx)(Mu,{storyRef:o,storyGeometry:i,activeSlide:r.activeSlide,storyReader:a})]})})),Lu=({className:e,style:t})=>(0,rd.jsx)("div",{className:(0,sd.default)(vc["stories-item"],e),style:t,children:(0,rd.jsx)("div",{className:`${jc["stories-slide"]} ${jc._dummy}`})});var Tu=A(50),Au={insert:"head",singleton:!1};od()(Tu.A,Au);const Ru=Tu.A.locals||{};var Du=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Bu=e=>{var{width:t,disabledByUI:r,navigationOptions:i}=e,a=Du(e,["width","disabledByUI","navigationOptions"]);const{desktopMode:s,dir:n}=Gh(),o=n===le.LTR,l=(o?a.isNextStoryBlank:a.isPrevStoryBlank)||r,d=(o?a.isPrevStoryBlank:a.isNextStoryBlank)||r;return(0,rd.jsxs)("div",{className:(0,sd.default)([Ru["story-reader-controls"]],{[Ru._desktop_mode]:s}),children:[(0,rd.jsx)("div",{className:Ru.slider3d__btn_next,style:{transform:`translateY(-50%) translateX(calc(${t/2}px + 100%))`},children:(0,rd.jsx)("button",{className:Ru["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),a.disabled||(o?a.onNext():a.onPrev())},disabled:l,dangerouslySetInnerHTML:{__html:i.nextButton.svgSrc.baseState}})}),(0,rd.jsx)("div",{className:Ru.slider3d__btn_prev,style:{transform:`translateY(-50%) translateX(calc(-${t/2}px - 200%))`},children:(0,rd.jsx)("button",{className:Ru["btn-icon"],onClick:e=>{e.stopPropagation(),e.preventDefault(),a.disabled||(o?a.onPrev():a.onNext())},disabled:d,dangerouslySetInnerHTML:{__html:i.prevButton.svgSrc.baseState}})})]})},Fu=e=>{const{storyReaderOptions:t}=Gh(),r=(0,ad.useRef)(null),i=(0,ad.useRef)(new cs).current;(({slider:e,touchController:t})=>{const r=()=>{null==e||e.startMove()},i=({dx:t})=>{null==e||e.move(-t)},a=()=>{t.horizontalSwipeGesture&&(null==e||e.endMove())};(0,ad.useEffect)((()=>(t.on(Ba.TouchStart,r),t.on(Ba.TouchMoveHorizontal,i),t.on(Ba.TouchEnd,a),()=>{t.off(Ba.TouchStart,r),t.off(Ba.TouchMoveHorizontal,i),t.off(Ba.TouchEnd,a)})),[t])})({slider:i,touchController:e.touchController});const a=t.scrollStyle,s=e.stories;i.currentIndex=e.activeStoryIndex;const n=e.touchController;(0,ad.useLayoutEffect)((()=>{const e=()=>{i.init({$el:r.current,transformStyle:a})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[s.length,a]),(0,ad.useLayoutEffect)((()=>{e.setAnimatedTransitionAdapter(new to(i,{closeOnLastSlideByTimer:Boolean(t.closeOnLastSlideByTimer)}))}),[e,t.closeOnLastSlideByTimer]),(0,ad.useEffect)((()=>(i.on("transitionStart",l),i.on("transitionEnd",d),i.on("touchMove",o),i.on("touchEnd",c),()=>{i.off("transitionStart",l),i.off("transitionEnd",d),i.off("touchMove",o),i.off("touchEnd",c)})),[e]);const o=()=>{n.disable()},l=()=>{n.disable()},d=()=>{n.enable()},c=t=>{e.resumeTimer(),0===t?i.transformWithAmimation(0):e.navigateStoryWithAnimationByIndex(e.activeStoryIndex+t,"swipe")};return{ref:r,api:i,perspective:i.perspective,depth:i.depth}},Nu=(0,Yd.observer)((e=>{const{storyReaderOptions:t,commonOptions:r,goodsWidgetOptions:i}=Gh(),a=Fu(e.storyReader),{actionPanelHeight:s,safeAreaFrameCalculator:n,isMobileGeometry:o,storyGeometry:l,correctionPaddingStyle:d}=rc(e.viewport),c=e.storyReader.activeStory,u=e.storyReader.stories;(0,ad.useEffect)((()=>{a.api.animating?c.timer.pause():c.timer.resume()}),[c,a.api.animating]);return(0,rd.jsxs)(rd.Fragment,{children:[(0,rd.jsxs)("div",{className:(0,sd.default)(gc.slider3d__wrapper,{[gc["slider3d__wrapper_swipe-up"]]:e.storyReader.closeGestureInAction,[gc._desktop_mode]:!o}),style:Object.assign({WebkitPerspective:`${a.perspective}px`,perspective:`${a.perspective}px`,width:l.getWidth(),backgroundColor:o&&n.shouldBeShownSafeAreaInsets&&"#000"},d),children:[(0,rd.jsx)("div",{className:gc.slider3d__inner,style:{transform:`translateZ(-${a.depth}px)`},children:(0,rd.jsx)("div",{className:(0,sd.default)(gc["stories-face"],gc.slider3d__rotater),ref:a.ref,children:u.map(((n,o)=>{if(n.isBlank)return(0,rd.jsx)(Lu,{style:{bottom:0}},n.id);const d=((t,r)=>t>=e.storyReader.activeStoryIndex-r&&t<=e.storyReader.activeStoryIndex+r)(o,0)||o===e.storyReader.nextFlippingStoryIndex;return(0,rd.jsx)(Iu,{slideClickDisabled:e.storyReader.uiPaused||a.api.animating,index:o,story:n,activeStory:c,canBeInitialized:d,geometry:l,style:{bottom:tc(n,r)?`${s}px`:0},commonOptions:r,storyReaderOptions:t,goodsWidgetOptions:i,onClose:e.onCloseStory,storyReader:e.storyReader},n.id)}))})}),e.sharePanel.isOpened&&(0,rd.jsx)(Ud,{className:gc["share-panel-wrapper"],shareText:e.sharePanel.params.text,shareType:e.sharePanel.params.type,shareLink:e.sharePanel.params.link,onShareCompelete:t=>e.sharePanel.handleShareComplete(e.sharePanel.params.id,t),sharePanelOptions:t.sharePanel})]}),(0,rd.jsx)(Bu,{disabled:a.api.animating,disabledByUI:e.storyReader.uiPaused||e.sharePanel.isOpened,isNextStoryBlank:e.storyReader.reachEnd,isPrevStoryBlank:e.storyReader.reachStart,navigationOptions:t.navigation,width:l.calculateWidth(),onNext:()=>e.storyReader.nextStoryWithAnimation(),onPrev:()=>e.storyReader.prevStoryWithAnimation()})]})})),Uu=(0,Yd.observer)((({storyReader:e,desktopMode:t})=>{const r=Xd();(({touchController:e,sharePanelIsOpened:t,desktopMode:r,storyReader:i})=>{(0,ad.useEffect)((()=>{r||t?e.disable():e.enable()}),[e,r,t]),(0,ad.useEffect)((()=>(e.on(Ba.LongTouchDetected,a),e.on(Ba.TouchEnd,s),()=>{e.off(Ba.LongTouchDetected,a),e.off(Ba.TouchEnd,s)})),[e]);const a=()=>{i.pauseTimer()},s=()=>{e.isSwiping||i.resumeTimer()}})({touchController:e.touchController,sharePanelIsOpened:e.sharePanel.isOpened,desktopMode:t,storyReader:e});return e.sharePanel.desktopMode=t,(0,Jd.createPortal)((0,rd.jsxs)(uc,{viewport:r,storyReader:e,children:[(0,rd.jsx)(Nu,{viewport:r,storyReader:e,onCloseStory:()=>{e.close()},sharePanel:e.sharePanel}),(0,rd.jsx)(Od,{orientation:Ke.PORTRAIT_PRIMARY,desktopMode:t,onOrientationChange:({isWrong:t})=>{t?e.pauseUI():e.resumeUI()}})]}),document.body)}));const Wu=(e=>{var t={};return A.d(t,e),t})({LitElement:()=>O.LitElement,css:()=>O.css,html:()=>O.html,nothing:()=>O.nothing});const zu=(e=>{var t={};return A.d(t,e),t})({customElement:()=>C.customElement,property:()=>C.property,query:()=>C.query,state:()=>C.state});class Vu{constructor(e){Object.defineProperty(this,"host",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_vw",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_vh",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.host.addController(this),this.calculateViewport=this.calculateViewport.bind(this)}get vw(){return this._vw}get vh(){return this._vh}hostConnected(){window.addEventListener("resize",this.calculateViewport)}hostDisconnected(){window.removeEventListener("resize",this.calculateViewport),this.host.removeController(this)}calculateViewport(){this._vw=window.innerWidth,this._vh=window.innerHeight,this.host.requestUpdate()}}const Gu=(e=>{var t={};return A.d(t,e),t})({html:()=>x.html,literal:()=>x.literal}),$u={[ii.BottomSheet]:Gu.literal`iam-bottom-sheet`,[ii.Fullscreen]:Gu.literal`iam-fullscreen-modal`,[ii.Modal]:Gu.literal`iam-modal`},Hu=Wu.css`.bottom-sheet{position:fixed;inset:0;left:0;bottom:0;right:0;z-index:999}.bottom-sheet__backdrop{position:fixed;inset:0;left:0;bottom:0;right:0;z-index:-1;background-color:rgba(0,0,0,var(--backdrop-opacity,.5));opacity:0;transition:opacity 225ms cubic-bezier(.4,0,.2,1);pointer-events:none}.bottom-sheet__backdrop--visible{animation:fade-in .3s forwards}.bottom-sheet__backdrop--hidden{animation:fade-out .3s forwards}.bottom-sheet__box{position:absolute;left:0;right:0;bottom:0;will-change:transform;border-top-left-radius:var(--slide-border-top-left-radius,0);border-top-right-radius:var(--slide-border-top-right-radius,0);background-color:transparent;transition:opacity .3s ease,transform .3s ease;transform:translate3d(0,120%,0);pointer-events:all}.bottom-sheet__box-wrapper{position:absolute;inset:0;pointer-events:none}.bottom-sheet__box-wrapper.bottom-sheet__box-wrapper--desktop-mode{position:absolute;bottom:0;left:50%;transform:translate3d(-50%,0,0)}.bottom-sheet__box.bottom-sheet__box--open{opacity:1;transform:translate3d(0,0,0)}.bottom-sheet__backdrop.bottom-sheet__backdrop--open{opacity:1;pointer-events:all}.bottom-sheet__header .close-strip-btn{margin-top:8px;width:32px;height:4px;background-color:#00000080;border-radius:var(--slide-border-top-left-radius);position:absolute;z-index:10000;left:50%;transform:translate3d(-50%,0,0)}`;const qu=(e=>{var t={};return A.d(t,e),t})({styleMap:()=>k.styleMap});const Qu=(e=>{var t={};return A.d(t,e),t})({classMap:()=>P.classMap});class Ku{constructor(e){Object.defineProperty(this,"host",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"touchController",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.host.addController(this),this.handleTouchMoveVertical=this.handleTouchMoveVertical.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}hostConnected(){}hostDisconnected(){var e,t;null===(e=this.touchController)||void 0===e||e.off(Ba.TouchMoveVertical,this.handleTouchMoveVertical),null===(t=this.touchController)||void 0===t||t.off(Ba.TouchEnd,this.handleTouchEnd)}setTouchController(e){this.touchController=e,this.touchController.enable(),this.touchController.on(Ba.TouchMoveVertical,this.handleTouchMoveVertical),this.touchController.on(Ba.TouchEnd,this.handleTouchEnd)}handleTouchMoveVertical({dy:e}){const t=this.getTranslateYByDeltaY(e);this.disableBoxTransition(),this.translateBoxOnY(t)}handleTouchEnd({dy:e}){if(!this.touchController.isSwiping)return;this.enableBoxTransition();this.getTranslateYByDeltaY(e)>20?(this.touchController.disable(),this.translateBoxOnY(120),this.host.close()):this.resetToDefaultState()}resetToDefaultState(){this.host.bottomSheetBoxRef.style.transform=""}translateBoxOnY(e){this.host.bottomSheetBoxRef.style.transform=`translate3d(0, ${e}%, 0)`}disableBoxTransition(){this.host.bottomSheetBoxRef.style.transition="none"}enableBoxTransition(){this.host.bottomSheetBoxRef.style.transition="opacity 0.3s ease, transform 0.3s ease"}getTranslateYByDeltaY(e){let t=50*(e/this.host.bottomSheetBoxRef.clientHeight);return t<=0&&(t=0),t}}var Yu=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Ju=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Zu=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},Xu=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},eh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i,a,s,n,o,l,d;let c,u,h,p,g,f,m,v,b,y,w,S,_=[(0,zu.customElement)("iam-bottom-sheet")],O=[],C=Wu.LitElement,x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[],T=[],A=[],R=[],D=[],B=[],F=[],N=[],U=[],W=[],z=[],V=[],G=[];u=class extends C{get open(){return Xu(this,e,"f")}set open(t){eh(this,e,t,"f")}get geometry(){return Xu(this,t,"f")}set geometry(e){eh(this,t,e,"f")}get appearanceOptions(){return Xu(this,r,"f")}set appearanceOptions(e){eh(this,r,e,"f")}get touchController(){return Xu(this,i,"f")}set touchController(e){eh(this,i,e,"f")}get desktopMode(){return Xu(this,a,"f")}set desktopMode(e){eh(this,a,e,"f")}get isVisible(){return Xu(this,s,"f")}set isVisible(e){eh(this,s,e,"f")}get isClosed(){return Xu(this,n,"f")}set isClosed(e){eh(this,n,e,"f")}get backdropRef(){return Xu(this,o,"f")}set backdropRef(e){eh(this,o,e,"f")}get bottomSheetBoxRef(){return Xu(this,l,"f")}set bottomSheetBoxRef(e){eh(this,l,e,"f")}get bottomSheetRef(){return Xu(this,d,"f")}set bottomSheetRef(e){eh(this,d,e,"f")}constructor(){super(),e.set(this,Ju(this,x,!1)),t.set(this,(Ju(this,k),Ju(this,P,void 0))),r.set(this,(Ju(this,j),Ju(this,M,void 0))),i.set(this,(Ju(this,E),Ju(this,I,void 0))),a.set(this,(Ju(this,L),Ju(this,T,void 0))),s.set(this,(Ju(this,A),Ju(this,R,!1))),n.set(this,(Ju(this,D),Ju(this,B,!0))),o.set(this,(Ju(this,F),Ju(this,N,null))),l.set(this,(Ju(this,U),Ju(this,W,null))),d.set(this,(Ju(this,z),Ju(this,V,null))),Object.defineProperty(this,"bottomSheetSwipeController",{enumerable:!0,configurable:!0,writable:!0,value:(Ju(this,G),new Ku(this))}),this.handleTransitionEnd=this.handleTransitionEnd.bind(this)}updated(e){super.updated(e);e.has("open")&&this.handleOpenChanged()}handleOpenChanged(){this.open?(this.isClosed=!1,(({frames:e=3,timeout:t=100,checkStyle:r=(()=>!0)}={})=>new Promise((i=>{let a,s=0,n=!1;const o=()=>{s++,!n&&r()&&(n=!0),s>=e&&n?(clearTimeout(a),i()):requestAnimationFrame(o)};a=setTimeout((()=>i()),t),requestAnimationFrame(o)})))().then((()=>{this.isVisible=!0}))):this.isClosed||this.close()}connectedCallback(){super.connectedCallback(),this.bottomSheetSwipeController.setTouchController(this.touchController)}disconnectedCallback(){super.disconnectedCallback()}close(){this.backdropRef.addEventListener("transitionend",this.handleTransitionEnd),this.isVisible=!1}handleTransitionEnd(){this.backdropRef.removeEventListener("transitionend",this.handleTransitionEnd),setTimeout((()=>{this.isClosed=!0,this.dispatchEvent(new CustomEvent("closed",{bubbles:!0,composed:!0}))}),50)}render(){if(this.isClosed)return Wu.nothing;const e={backgroundColor:this.appearanceOptions.backgroundColor,height:this.geometry.getHeight()+"px",width:this.geometry.getWidth()+"px","--slide-border-top-left-radius":`${this.appearanceOptions.borderRadius}px`,"--slide-border-top-right-radius":`${this.appearanceOptions.borderRadius}px`},t={width:this.geometry.getWidth()+"px"},r={backgroundColor:this.appearanceOptions.closeButton.backgroundColor,width:`${this.appearanceOptions.closeButton.width}px`,height:`${this.appearanceOptions.closeButton.height}px`,marginTop:`${this.appearanceOptions.closeButton.marginTop}px`};return Wu.html`<div id="bottom-sheet" class="bottom-sheet"><div id="bottom-sheet__backdrop" style="${(0,qu.styleMap)({"--backdrop-opacity":this.appearanceOptions.backdrop.opacity})}" @click="${this.close}" class="bottom-sheet__backdrop ${(0,Qu.classMap)({"bottom-sheet__backdrop--open":this.isVisible})}"></div><div class="bottom-sheet__box-wrapper ${(0,Qu.classMap)({"bottom-sheet__box-wrapper--desktop-mode":this.desktopMode})}" style="${(0,qu.styleMap)(t)}"><div style="${(0,qu.styleMap)(e)}" id="bottom-sheet__box" class="bottom-sheet__box ${(0,Qu.classMap)({"bottom-sheet__box--open":this.isVisible})}"><div class="bottom-sheet__header"><div class="close-strip-btn" style="${(0,qu.styleMap)(r)}"></div></div><slot></slot></div></div></div>`}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,Zu(u,"BottomSheet"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=C[Symbol.metadata])&&void 0!==e?e:null):void 0;h=[(0,zu.property)({type:Boolean})],p=[(0,zu.property)({type:Object})],g=[(0,zu.property)({type:Object})],f=[(0,zu.property)({type:Object})],m=[(0,zu.property)({type:Boolean})],v=[(0,zu.state)()],b=[(0,zu.state)()],y=[(0,zu.query)("#bottom-sheet__backdrop")],w=[(0,zu.query)("#bottom-sheet__box")],S=[(0,zu.query)("#bottom-sheet")],Yu(u,null,h,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},x,k),Yu(u,null,p,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},P,j),Yu(u,null,g,{kind:"accessor",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions,set:(e,t)=>{e.appearanceOptions=t}},metadata:t},M,E),Yu(u,null,f,{kind:"accessor",name:"touchController",static:!1,private:!1,access:{has:e=>"touchController"in e,get:e=>e.touchController,set:(e,t)=>{e.touchController=t}},metadata:t},I,L),Yu(u,null,m,{kind:"accessor",name:"desktopMode",static:!1,private:!1,access:{has:e=>"desktopMode"in e,get:e=>e.desktopMode,set:(e,t)=>{e.desktopMode=t}},metadata:t},T,A),Yu(u,null,v,{kind:"accessor",name:"isVisible",static:!1,private:!1,access:{has:e=>"isVisible"in e,get:e=>e.isVisible,set:(e,t)=>{e.isVisible=t}},metadata:t},R,D),Yu(u,null,b,{kind:"accessor",name:"isClosed",static:!1,private:!1,access:{has:e=>"isClosed"in e,get:e=>e.isClosed,set:(e,t)=>{e.isClosed=t}},metadata:t},B,F),Yu(u,null,y,{kind:"accessor",name:"backdropRef",static:!1,private:!1,access:{has:e=>"backdropRef"in e,get:e=>e.backdropRef,set:(e,t)=>{e.backdropRef=t}},metadata:t},N,U),Yu(u,null,w,{kind:"accessor",name:"bottomSheetBoxRef",static:!1,private:!1,access:{has:e=>"bottomSheetBoxRef"in e,get:e=>e.bottomSheetBoxRef,set:(e,t)=>{e.bottomSheetBoxRef=t}},metadata:t},W,z),Yu(u,null,S,{kind:"accessor",name:"bottomSheetRef",static:!1,private:!1,access:{has:e=>"bottomSheetRef"in e,get:e=>e.bottomSheetRef,set:(e,t)=>{e.bottomSheetRef=t}},metadata:t},V,G),Yu(null,c={value:u},_,{kind:"class",name:u.name,metadata:t},null,O),u=c.value,t&&Object.defineProperty(u,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(u,"styles",{enumerable:!0,configurable:!0,writable:!0,value:Hu}),Ju(u,O)})();const th=Wu.css`.modal{position:fixed;inset:0;left:0;bottom:0;right:0;z-index:1000}.modal__backdrop{background-color:rgba(0,0,0,var(--backdrop-opacity,.3));position:fixed;z-index:-1;inset:0;left:0;bottom:0;right:0;pointer-events:none}.modal__backdrop.modal__backdrop--open{pointer-events:all}.modal__box{display:flex;align-items:center;justify-content:center;position:relative;outline:0;height:100%}.modal__box-content{position:relative;border-top-left-radius:var(--slide-border-top-left-radius,0);border-top-right-radius:var(--slide-border-top-right-radius,0);border-bottom-left-radius:var(--slide-border-bottom-left-radius,0);border-bottom-right-radius:var(--slide-border-bottom-right-radius,0)}.modal__box-content.modal__box-content--fullscreen{position:relative;align-self:flex-end}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}@keyframes fadeInWithZoom{from{opacity:0;transform:scale(.7)}to{transform:scale(1);opacity:1}}@keyframes fadeOutWithZoom{from{opacity:1;transform:scale(1)}to{transform:scale(.7);opacity:0}}@keyframes slideInUp{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideInOut{from{transform:translateY(0)}to{transform:translateY(100%)}}.fadeIn{animation:fadeIn 255ms forwards}.fadeOut{animation:fadeOut 255ms forwards}.fadeInWithZoom{animation:fadeInWithZoom .3s forwards}.fadeOutWithZoom{animation:fadeOutWithZoom .3s forwards}.slideInUp{animation:slideInUp .3s forwards}.slideInOut{animation:slideInOut .3s forwards}`;const rh=(e=>{var t={};return A.d(t,e),t})({unsafeHTML:()=>j.unsafeHTML}),ih=Wu.css`.close-btn{position:absolute;top:1rem;z-index:10000;padding:0;background-color:transparent;border:0;-webkit-appearance:none;cursor:pointer}.close-btn.close-btn--position_start{left:1rem}.close-btn.close-btn--position_end{right:1rem}.close-btn.close-btn--position_start.close-btn--dir_rtl{left:auto;right:1rem}.close-btn.close-btn--position_end.close-btn--dir_rtl{left:1rem;right:auto}.close-btn.close-btn--position_none{display:none}`;var ah=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},sh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},nh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},oh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},lh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t;let r,i,a,s,n=[(0,zu.customElement)("iam-modal-close-btn")],o=[],l=Wu.LitElement,d=[],c=[],u=[],h=[];i=class extends l{get closeBtnPosition(){return oh(this,e,"f")}set closeBtnPosition(t){lh(this,e,t,"f")}get dir(){return oh(this,t,"f")}set dir(e){lh(this,t,e,"f")}render(){var e;return Wu.html`<button class="close-btn ${(0,Qu.classMap)({"close-btn--position_start":this.closeBtnPosition===ft.Start,"close-btn--position_end":this.closeBtnPosition===ft.End,"close-btn--position_none":this.closeBtnPosition===ft.None,"close-btn--dir_ltr":this.dir===le.LTR,"close-btn--dir_rtl":this.dir===le.RTL})}">${(0,rh.unsafeHTML)(null===(e=D.closeButton)||void 0===e?void 0:e.svgSrc.baseState)}</button>`}constructor(){super(...arguments),e.set(this,sh(this,d,void 0)),t.set(this,(sh(this,c),sh(this,u,void 0))),sh(this,h)}};e=new WeakMap,t=new WeakMap,nh(i,"Modal"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=l[Symbol.metadata])&&void 0!==e?e:null):void 0;a=[(0,zu.property)({type:Number})],s=[(0,zu.property)({type:String})],ah(i,null,a,{kind:"accessor",name:"closeBtnPosition",static:!1,private:!1,access:{has:e=>"closeBtnPosition"in e,get:e=>e.closeBtnPosition,set:(e,t)=>{e.closeBtnPosition=t}},metadata:t},d,c),ah(i,null,s,{kind:"accessor",name:"dir",static:!1,private:!1,access:{has:e=>"dir"in e,get:e=>e.dir,set:(e,t)=>{e.dir=t}},metadata:t},u,h),ah(null,r={value:i},n,{kind:"class",name:i.name,metadata:t},null,o),i=r.value,t&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(i,"styles",{enumerable:!0,configurable:!0,writable:!0,value:ih}),sh(i,o)})();var dh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},ch=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},uh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},hh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},ph=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i,a,s,n,o;let l,d,c,u,h,p,g,f,m,v,b=[(0,zu.customElement)("iam-modal")],y=[],w=Wu.LitElement,S=[],_=[],O=[],C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[],T=[],A=[],R=[],D=[];d=class extends w{get open(){return hh(this,e,"f")}set open(t){ph(this,e,t,"f")}get fullscreen(){return hh(this,t,"f")}set fullscreen(e){ph(this,t,e,"f")}get geometry(){return hh(this,r,"f")}set geometry(e){ph(this,r,e,"f")}get appearanceOptions(){return hh(this,i,"f")}set appearanceOptions(e){ph(this,i,e,"f")}get dir(){return hh(this,a,"f")}set dir(e){ph(this,a,e,"f")}get isVisible(){return hh(this,s,"f")}set isVisible(e){ph(this,s,e,"f")}get isClosed(){return hh(this,n,"f")}set isClosed(e){ph(this,n,e,"f")}get backdropRef(){return hh(this,o,"f")}set backdropRef(e){ph(this,o,e,"f")}constructor(){super(),e.set(this,ch(this,S,!1)),t.set(this,(ch(this,_),ch(this,O,!1))),r.set(this,(ch(this,C),ch(this,x,void 0))),i.set(this,(ch(this,k),ch(this,P,void 0))),a.set(this,(ch(this,j),ch(this,M,void 0))),s.set(this,(ch(this,E),ch(this,I,!1))),n.set(this,(ch(this,L),ch(this,T,!0))),o.set(this,(ch(this,A),ch(this,R,null))),ch(this,D)}close(){const e=this.appearanceOptions.animationType===gt.None?0:350;setTimeout((()=>{this.isClosed=!0,this.dispatchEvent(new CustomEvent("closed",{bubbles:!0,composed:!0}))}),e),this.isVisible=!1}updated(e){super.updated(e);e.has("open")&&this.handleOpenChanged()}handleOpenChanged(){this.open?(this.isClosed=!1,this.isVisible=!0):this.isClosed||this.close()}getEnterModalAnimationCSSClass(e){switch(e){case gt.SlideInUp:return"slideInUp";case gt.FadeIn:return"fadeInWithZoom";default:return""}}getOutModalAnimationCSSClass(e){switch(e){case gt.SlideInUp:return"slideInOut";case gt.FadeIn:return"fadeOutWithZoom";default:return""}}getBackdropAnimationCSSClass(e){return e?"fadeIn":"fadeOut"}render(){const e=this.fullscreen?0:this.appearanceOptions.borderRadius,t={backgroundColor:this.appearanceOptions.backgroundColor,height:this.geometry.getHeight()+"px",width:this.geometry.getWidth()+"px","--slide-border-top-left-radius":`${e}px`,"--slide-border-top-right-radius":`${e}px`,"--slide-border-bottom-left-radius":`${e}px`,"--slide-border-bottom-right-radius":`${e}px`},r=this.appearanceOptions.animationType,i=this.isVisible?this.getEnterModalAnimationCSSClass(r):this.getOutModalAnimationCSSClass(r),a=this.getBackdropAnimationCSSClass(this.isVisible);return Wu.html`<div class="modal"><div id="modal__backdrop" style="${(0,qu.styleMap)({"--backdrop-opacity":this.appearanceOptions instanceof mt?this.appearanceOptions.backdrop.opacity:void 0})}" class="modal__backdrop ${(0,Qu.classMap)({[a]:r!==gt.None})}"></div><div @click="${this.close}" class="modal__box ${(0,Qu.classMap)({[i]:!0})}">${this.fullscreen?Wu.html`<div class="modal__header"><iam-modal-close-btn @click="${this.close}" .dir="${this.dir}" .closeBtnPosition="${this.appearanceOptions.closeBtnPosition}"></iam-modal-close-btn></div>`:Wu.nothing}<div style="${(0,qu.styleMap)(t)}" class="modal__box-content ${(0,Qu.classMap)({"modal__box-content--fullscreen":this.fullscreen})}">${this.fullscreen?Wu.nothing:Wu.html`<div class="modal__header"><iam-modal-close-btn @click="${this.close}" .dir="${this.dir}" .closeBtnPosition="${this.appearanceOptions.closeBtnPosition}"></iam-modal-close-btn></div>`}<slot></slot></div></div></div>`}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap,uh(d,"Modal"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=w[Symbol.metadata])&&void 0!==e?e:null):void 0;c=[(0,zu.property)({type:Boolean})],u=[(0,zu.property)({type:Boolean})],h=[(0,zu.property)({type:Object})],p=[(0,zu.property)({type:Object})],g=[(0,zu.property)({type:String})],f=[(0,zu.state)()],m=[(0,zu.state)()],v=[(0,zu.query)("#modal__backdrop")],dh(d,null,c,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},S,_),dh(d,null,u,{kind:"accessor",name:"fullscreen",static:!1,private:!1,access:{has:e=>"fullscreen"in e,get:e=>e.fullscreen,set:(e,t)=>{e.fullscreen=t}},metadata:t},O,C),dh(d,null,h,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},x,k),dh(d,null,p,{kind:"accessor",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions,set:(e,t)=>{e.appearanceOptions=t}},metadata:t},P,j),dh(d,null,g,{kind:"accessor",name:"dir",static:!1,private:!1,access:{has:e=>"dir"in e,get:e=>e.dir,set:(e,t)=>{e.dir=t}},metadata:t},M,E),dh(d,null,f,{kind:"accessor",name:"isVisible",static:!1,private:!1,access:{has:e=>"isVisible"in e,get:e=>e.isVisible,set:(e,t)=>{e.isVisible=t}},metadata:t},I,L),dh(d,null,m,{kind:"accessor",name:"isClosed",static:!1,private:!1,access:{has:e=>"isClosed"in e,get:e=>e.isClosed,set:(e,t)=>{e.isClosed=t}},metadata:t},T,A),dh(d,null,v,{kind:"accessor",name:"backdropRef",static:!1,private:!1,access:{has:e=>"backdropRef"in e,get:e=>e.backdropRef,set:(e,t)=>{e.backdropRef=t}},metadata:t},R,D),dh(null,l={value:d},b,{kind:"class",name:d.name,metadata:t},null,y),d=l.value,t&&Object.defineProperty(d,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(d,"styles",{enumerable:!0,configurable:!0,writable:!0,value:th}),ch(d,y)})();var gh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},fh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},mh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},vh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},bh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r;let i,a,s,n,o,l=[(0,zu.customElement)("iam-fullscreen-modal")],d=[],c=Wu.LitElement,u=[],h=[],p=[],g=[],f=[],m=[];a=class extends c{get open(){return vh(this,e,"f")}set open(t){bh(this,e,t,"f")}get geometry(){return vh(this,t,"f")}set geometry(e){bh(this,t,e,"f")}get appearanceOptions(){return vh(this,r,"f")}set appearanceOptions(e){bh(this,r,e,"f")}render(){return Wu.html`<iam-modal ?open="${this.open}" .fullscreen="${!0}" .geometry="${this.geometry}" .appearanceOptions="${this.appearanceOptions}"><slot></slot></iam-modal>`}constructor(){super(...arguments),e.set(this,fh(this,u,!1)),t.set(this,(fh(this,h),fh(this,p,void 0))),r.set(this,(fh(this,g),fh(this,f,void 0))),fh(this,m)}};e=new WeakMap,t=new WeakMap,r=new WeakMap,mh(a,"FullscreenModal"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=c[Symbol.metadata])&&void 0!==e?e:null):void 0;s=[(0,zu.property)({type:Boolean})],n=[(0,zu.property)({type:Object})],o=[(0,zu.property)({type:Object})],gh(a,null,s,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},u,h),gh(a,null,n,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},p,g),gh(a,null,o,{kind:"accessor",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions,set:(e,t)=>{e.appearanceOptions=t}},metadata:t},f,m),gh(null,i={value:a},l,{kind:"class",name:a.name,metadata:t},null,d),a=i.value,t&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t}),fh(a,d)})()})();var yh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},wh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Sh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},_h=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Oh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i,a,s,n;let o,l,d,c,u,h,p,g,f,m=[(0,zu.customElement)("message-view-factory")],v=[],b=Wu.LitElement,y=[],w=[],S=[],_=[],O=[],C=[],x=[],k=[],P=[],j=[],M=[],E=[],I=[],L=[];l=class extends b{get appearanceOptions(){return _h(this,e,"f")}set appearanceOptions(t){Oh(this,e,t,"f")}get type(){return _h(this,t,"f")}set type(e){Oh(this,t,e,"f")}get open(){return _h(this,r,"f")}set open(e){Oh(this,r,e,"f")}get geometry(){return _h(this,i,"f")}set geometry(e){Oh(this,i,e,"f")}get touchController(){return _h(this,a,"f")}set touchController(e){Oh(this,a,e,"f")}get desktopMode(){return _h(this,s,"f")}set desktopMode(e){Oh(this,s,e,"f")}get dir(){return _h(this,n,"f")}set dir(e){Oh(this,n,e,"f")}render(){const e=$u[this.type];return e?Gu.html`
|
|
323
2
|
<${e}
|
|
324
3
|
.open=${this.open}
|
|
325
4
|
.geometry=${this.geometry}
|
|
@@ -329,282 +8,4 @@ import*as e from"react";import*as t from"events";import*as r from"lodash/isFunct
|
|
|
329
8
|
.dir=${this.dir}>
|
|
330
9
|
<slot></slot>
|
|
331
10
|
</${e}>
|
|
332
|
-
`:null}constructor(){super(...arguments),e.set(this,vh(this,y,void 0)),t.set(this,(vh(this,w),vh(this,S,void 0))),r.set(this,(vh(this,_),vh(this,O,!1))),i.set(this,(vh(this,C),vh(this,x,void 0))),a.set(this,(vh(this,k),vh(this,P,void 0))),s.set(this,(vh(this,j),vh(this,M,void 0))),n.set(this,(vh(this,E),vh(this,I,void 0))),vh(this,L)}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,bh(l,"MessageViewFactory"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=b[Symbol.metadata])&&void 0!==e?e:null):void 0;d=[(0,Nu.property)({type:Object})],c=[(0,Nu.property)({type:Number})],u=[(0,Nu.property)({type:Boolean})],h=[(0,Nu.property)({type:Object})],p=[(0,Nu.property)({type:Object})],g=[(0,Nu.property)({type:Boolean})],f=[(0,Nu.property)({type:String})],mh(l,null,d,{kind:"accessor",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions,set:(e,t)=>{e.appearanceOptions=t}},metadata:t},y,w),mh(l,null,c,{kind:"accessor",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:t},S,_),mh(l,null,u,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},O,C),mh(l,null,h,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},x,k),mh(l,null,p,{kind:"accessor",name:"touchController",static:!1,private:!1,access:{has:e=>"touchController"in e,get:e=>e.touchController,set:(e,t)=>{e.touchController=t}},metadata:t},P,j),mh(l,null,g,{kind:"accessor",name:"desktopMode",static:!1,private:!1,access:{has:e=>"desktopMode"in e,get:e=>e.desktopMode,set:(e,t)=>{e.desktopMode=t}},metadata:t},M,E),mh(l,null,f,{kind:"accessor",name:"dir",static:!1,private:!1,access:{has:e=>"dir"in e,get:e=>e.dir,set:(e,t)=>{e.dir=t}},metadata:t},I,L),mh(null,o={value:l},m,{kind:"class",name:l.name,metadata:t},null,v),l=o.value,t&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(l,"styles",{enumerable:!0,configurable:!0,writable:!0,value:Fu.css``}),vh(l,v)})();const Sh=Fu.css`
|
|
333
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-link {
|
|
334
|
-
pointer-events: all;
|
|
335
|
-
cursor: pointer;
|
|
336
|
-
}
|
|
337
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-link * {
|
|
338
|
-
pointer-events: none;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-answer {
|
|
342
|
-
pointer-events: all;
|
|
343
|
-
cursor: pointer;
|
|
344
|
-
}
|
|
345
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-answer * {
|
|
346
|
-
pointer-events: none;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-data-input {
|
|
350
|
-
pointer-events: all;
|
|
351
|
-
cursor: pointer;
|
|
352
|
-
}
|
|
353
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-data-input * {
|
|
354
|
-
pointer-events: none;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-input-container .rangeslider {
|
|
358
|
-
pointer-events: all;
|
|
359
|
-
cursor: pointer;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-poll-button {
|
|
363
|
-
pointer-events: all;
|
|
364
|
-
cursor: pointer;
|
|
365
|
-
}
|
|
366
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-poll-button * {
|
|
367
|
-
pointer-events: none;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-answer {
|
|
371
|
-
pointer-events: all;
|
|
372
|
-
cursor: pointer;
|
|
373
|
-
}
|
|
374
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-answer * {
|
|
375
|
-
pointer-events: none;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-rate-input {
|
|
379
|
-
pointer-events: all;
|
|
380
|
-
cursor: pointer;
|
|
381
|
-
}
|
|
382
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-rate-input * {
|
|
383
|
-
pointer-events: none;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-next-button {
|
|
387
|
-
pointer-events: all;
|
|
388
|
-
cursor: pointer;
|
|
389
|
-
}
|
|
390
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-next-button * {
|
|
391
|
-
pointer-events: none;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-answer {
|
|
395
|
-
pointer-events: all;
|
|
396
|
-
cursor: pointer;
|
|
397
|
-
}
|
|
398
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-answer * {
|
|
399
|
-
pointer-events: none;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-next-button,
|
|
403
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-next-button {
|
|
404
|
-
pointer-events: all;
|
|
405
|
-
cursor: pointer;
|
|
406
|
-
}
|
|
407
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-next-button *,
|
|
408
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-next-button * {
|
|
409
|
-
pointer-events: none;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-copy {
|
|
413
|
-
pointer-events: all;
|
|
414
|
-
cursor: pointer;
|
|
415
|
-
}
|
|
416
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-copy * {
|
|
417
|
-
pointer-events: none;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-share {
|
|
421
|
-
pointer-events: all;
|
|
422
|
-
cursor: pointer;
|
|
423
|
-
}
|
|
424
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-share * {
|
|
425
|
-
pointer-events: none;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-story-repeat {
|
|
429
|
-
pointer-events: all;
|
|
430
|
-
cursor: pointer;
|
|
431
|
-
}
|
|
432
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-story-repeat * {
|
|
433
|
-
pointer-events: none;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-game {
|
|
437
|
-
pointer-events: all;
|
|
438
|
-
cursor: pointer;
|
|
439
|
-
}
|
|
440
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-game * {
|
|
441
|
-
pointer-events: none;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target],
|
|
445
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type="closeStory"] {
|
|
446
|
-
pointer-events: all;
|
|
447
|
-
cursor: pointer;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target],
|
|
451
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type="closeIAM"] {
|
|
452
|
-
pointer-events: all;
|
|
453
|
-
cursor: pointer;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target] *,
|
|
457
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type="closeStory"] * {
|
|
458
|
-
pointer-events: none;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target] *,
|
|
462
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type="closeIAM"] * {
|
|
463
|
-
pointer-events: none;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up {
|
|
467
|
-
pointer-events: all;
|
|
468
|
-
cursor: pointer;
|
|
469
|
-
}
|
|
470
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up * {
|
|
471
|
-
pointer-events: none;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up-items {
|
|
475
|
-
pointer-events: all;
|
|
476
|
-
cursor: pointer;
|
|
477
|
-
}
|
|
478
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up-items * {
|
|
479
|
-
pointer-events: none;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-next-button {
|
|
483
|
-
pointer-events: all;
|
|
484
|
-
cursor: pointer;
|
|
485
|
-
}
|
|
486
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-next-button * {
|
|
487
|
-
pointer-events: none;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-barcode {
|
|
491
|
-
pointer-events: all;
|
|
492
|
-
cursor: pointer;
|
|
493
|
-
}
|
|
494
|
-
.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-barcode * {
|
|
495
|
-
pointer-events: none;
|
|
496
|
-
}
|
|
497
|
-
`,_h=Fu.css`
|
|
498
|
-
* {
|
|
499
|
-
user-select: none;
|
|
500
|
-
-moz-user-select: none;
|
|
501
|
-
-webkit-user-select: none;
|
|
502
|
-
-webkit-touch-callout: none;
|
|
503
|
-
-webkit-user-drag: none;
|
|
504
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
.narrative-slide-wrapper {
|
|
508
|
-
position: absolute;
|
|
509
|
-
left: 0;
|
|
510
|
-
right: 0;
|
|
511
|
-
top: 0;
|
|
512
|
-
bottom: 0;
|
|
513
|
-
width: 100%;
|
|
514
|
-
height: 100%;
|
|
515
|
-
overflow: hidden;
|
|
516
|
-
|
|
517
|
-
border-top-right-radius: var(--slide-border-top-right-radius, 0);
|
|
518
|
-
border-top-left-radius: var(--slide-border-top-left-radius, 0);
|
|
519
|
-
border-bottom-right-radius: var(--slide-border-bottom-right-radius, 0);
|
|
520
|
-
border-bottom-left-radius: var(--slide-border-bottom-left-radius, 0);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
.narrative-slide-offset {
|
|
524
|
-
position: relative;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.narrative-slide-box {
|
|
528
|
-
position: absolute;
|
|
529
|
-
top: 0;
|
|
530
|
-
left: 0;
|
|
531
|
-
right: 0;
|
|
532
|
-
bottom: 0;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
.narrative-slide-box-prerender {
|
|
536
|
-
pointer-events: none;
|
|
537
|
-
z-index: -1;
|
|
538
|
-
opacity: 0;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
.narrative-slide-box-rendered {
|
|
542
|
-
pointer-events: all;
|
|
543
|
-
z-index: 1;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
.narrative-slide-offset-fullscreen .narrative-slide-background {
|
|
547
|
-
height: 100vh;
|
|
548
|
-
position: fixed;
|
|
549
|
-
top: 0;
|
|
550
|
-
left: 0;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
`;var Oh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Ch=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},xh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},kh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Ph=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i;let a,s,n,o,l,d,c=[(0,Nu.customElement)("message-slide")],u=[],h=Fu.LitElement,p=[],g=[],f=[],m=[],v=[],b=[],y=[],w=[];s=class extends h{get slide(){return kh(this,e,"f")}set slide(t){Ph(this,e,t,"f")}get styleContext(){return kh(this,t,"f")}set styleContext(e){Ph(this,t,e,"f")}get geometry(){return kh(this,r,"f")}set geometry(e){Ph(this,r,e,"f")}get slideContent(){return kh(this,i,"f")}set slideContent(e){Ph(this,i,e,"f")}constructor(){super(),e.set(this,Ch(this,p,void 0)),t.set(this,(Ch(this,g),Ch(this,f,void 0))),r.set(this,(Ch(this,m),Ch(this,v,void 0))),i.set(this,(Ch(this,b),Ch(this,y,null))),Object.defineProperty(this,"fontFamilies",{enumerable:!0,configurable:!0,writable:!0,value:(Ch(this,w),"")})}get slideStyle(){return{margin:this.geometry.getOffset(),width:this.geometry.getWidth(),height:this.geometry.getHeight(),"--y-offset":this.geometry.getOffsetY(),"--x-offset":this.geometry.getOffsetX()}}aconnectedCallback(){super.connectedCallback()}firstUpdated(e){super.firstUpdated(e),this.initAndStartSlide()}disconnectedCallback(){super.disconnectedCallback(),this.slide.stop()}handleSlideClick(e){e.preventDefault(),e.stopPropagation();const t=e.target;this.slide.onClick(t)}async initAndStartSlide(){const e=this.slideContent;if(!e)throw new Error("[IAM]: no slide content");await this.slide.init(e),await this.slide.start()}render(){var e;const t=this.geometry instanceof ui,r=1/this.geometry.contentRatio*100;return Fu.html`
|
|
554
|
-
<style nonce=${Re()}>
|
|
555
|
-
${null!==(e=this.styleContext)&&void 0!==e?e:""}
|
|
556
|
-
</style>
|
|
557
|
-
<div class="stories-viewer narrative-slide-wrapper" @click=${this.handleSlideClick}>
|
|
558
|
-
<div
|
|
559
|
-
class=${(0,$u.classMap)({"narrative-slide-offset":!0,"narrative-slide-offset-fullscreen":t})}
|
|
560
|
-
style=${(0,Gu.styleMap)(this.slideStyle)}>
|
|
561
|
-
<div id="narrative-slide-box" class="narrative-slide-box" style=${(0,Gu.styleMap)({fontSize:this.geometry.getFontSize(),padding:`${r}% 0 0 0`})}>
|
|
562
|
-
${(0,Xu.unsafeHTML)(this.slide.html)}
|
|
563
|
-
</div>
|
|
564
|
-
</div>
|
|
565
|
-
</div>
|
|
566
|
-
`}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,xh(s,"MessageSlide"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=h[Symbol.metadata])&&void 0!==e?e:null):void 0;n=[(0,Nu.property)({type:Object})],o=[(0,Nu.property)({type:String})],l=[(0,Nu.property)({type:Object})],d=[(0,Nu.query)("#narrative-slide-box")],Oh(s,null,n,{kind:"accessor",name:"slide",static:!1,private:!1,access:{has:e=>"slide"in e,get:e=>e.slide,set:(e,t)=>{e.slide=t}},metadata:t},p,g),Oh(s,null,o,{kind:"accessor",name:"styleContext",static:!1,private:!1,access:{has:e=>"styleContext"in e,get:e=>e.styleContext,set:(e,t)=>{e.styleContext=t}},metadata:t},f,m),Oh(s,null,l,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},v,b),Oh(s,null,d,{kind:"accessor",name:"slideContent",static:!1,private:!1,access:{has:e=>"slideContent"in e,get:e=>e.slideContent,set:(e,t)=>{e.slideContent=t}},metadata:t},y,w),Oh(null,a={value:s},c,{kind:"class",name:s.name,metadata:t},null,u),s=a.value,t&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(s,"styles",{enumerable:!0,configurable:!0,writable:!0,value:[Sh,_h]}),Ch(s,u)})();const jh=Fu.css`
|
|
567
|
-
@keyframes spin {
|
|
568
|
-
from {
|
|
569
|
-
-webkit-transform: rotate(0deg);
|
|
570
|
-
transform: rotate(0deg);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
to {
|
|
574
|
-
-webkit-transform: rotate(359deg);
|
|
575
|
-
transform: rotate(359deg);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
.spinner {
|
|
580
|
-
position: absolute;
|
|
581
|
-
top: calc(50% - 2rem / 2);
|
|
582
|
-
left: calc(50% - 2rem / 2);
|
|
583
|
-
width: 2rem;
|
|
584
|
-
height: 2rem;
|
|
585
|
-
border-radius: 50%;
|
|
586
|
-
animation: spin 0.6s infinite linear;
|
|
587
|
-
}
|
|
588
|
-
`;var Mh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Eh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ih=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})};(()=>{let e,t,r=[(0,Nu.customElement)("iam-spinner")],i=[],a=Fu.LitElement;t=class extends a{render(){const e="white";return Fu.html`
|
|
589
|
-
<div
|
|
590
|
-
class="spinner"
|
|
591
|
-
style=${(0,Gu.styleMap)({border:`solid 2px ${e}`,borderColor:`transparent ${e} ${e} ${e}`})}></div>
|
|
592
|
-
`}};Ih(t,"Spinner"),(()=>{var s;const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(s=a[Symbol.metadata])&&void 0!==s?s:null):void 0;Mh(null,e={value:t},r,{kind:"class",name:t.name,metadata:n},null,i),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),Object.defineProperty(t,"styles",{enumerable:!0,configurable:!0,writable:!0,value:jh}),Eh(t,i)})();var Lh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Th=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ah=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},Rh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Dh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i,a;let s,n,o,l,d,c,u,h=[(0,Nu.customElement)("iam-reader"),je],p=[],g=Fu.LitElement,f=[],m=[],v=[],b=[],y=[],w=[],S=[],_=[],O=[],C=[];n=class extends g{get options(){return Rh(this,e,"f")}set options(t){Dh(this,e,t,"f")}get desktopMode(){return Rh(this,t,"f")}set desktopMode(e){Dh(this,t,e,"f")}get dir(){return Rh(this,r,"f")}set dir(e){Dh(this,r,e,"f")}get viewModel(){return Rh(this,i,"f")}set viewModel(e){Dh(this,i,e,"f")}get open(){return Rh(this,a,"f")}set open(e){Dh(this,a,e,"f")}constructor(){super(),e.set(this,Th(this,f,{})),t.set(this,(Th(this,m),Th(this,v,!1))),r.set(this,(Th(this,b),Th(this,y,ne.LTR))),i.set(this,(Th(this,w),Th(this,S,null))),a.set(this,(Th(this,_),Th(this,O,!0))),Object.defineProperty(this,"viewportController",{enumerable:!0,configurable:!0,writable:!0,value:(Th(this,C),new Uu(this))}),this.handleKeydown=this.handleKeydown.bind(this)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.handleKeydown)}firstUpdated(){setTimeout((()=>{this.viewportController.calculateViewport()}),100)}handleKeydown(e){"Escape"===e.key&&(this.open=!1)}handleClosed(){this.open=!1,this.viewModel.close()}updated(e){var t;super.updated(e);const r=document.documentElement.style.overflow;(null===(t=this.viewModel)||void 0===t?void 0:t.activeMessage)?(this.open=!0,document.documentElement.style.overflow="hidden"):(this.open=!1,document.documentElement.style.overflow=r)}getMessageTypeByEnviroment(e){return this.desktopMode&&e===ti.Fullscreen?(console.warn("[IAM]: desktop only supports modal window"),ti.Modal):e}createSlideGeometry(e){return(new gi).create(e)}createMessageGeometry(e,t){return(new li).create(e,{appearanceOptions:t,vw:this.viewportController.vw,vh:this.viewportController.vh,desktopMode:this.desktopMode})}render(){var e,t;const r=null===(e=this.viewModel)||void 0===e?void 0:e.activeMessage,i=null===(t=this.viewModel)||void 0===t?void 0:t.touchController;if(!r)return null;const a=r.type,s=this.createMessageGeometry(a,r.appearanceOptions),n=this.createSlideGeometry(s);return Fu.html`
|
|
593
|
-
<message-view-factory
|
|
594
|
-
type=${a}
|
|
595
|
-
@closed=${this.handleClosed}
|
|
596
|
-
.appearanceOptions=${r.appearanceOptions}
|
|
597
|
-
.geometry=${s}
|
|
598
|
-
.open=${this.open}
|
|
599
|
-
.dir=${this.dir}
|
|
600
|
-
.desktopMode=${this.desktopMode}
|
|
601
|
-
.touchController=${i}>
|
|
602
|
-
<message-slide .slide=${r.slides[0]} .styleContext=${r.context.style} .geometry=${n}></message-slide>
|
|
603
|
-
</message-view-factory>
|
|
604
|
-
`}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,Ah(n,"InAppMessagingReader"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=g[Symbol.metadata])&&void 0!==e?e:null):void 0;o=[(0,Nu.property)({type:Object})],l=[(0,Nu.property)({type:Boolean})],d=[(0,Nu.property)({type:String})],c=[(0,Nu.property)({type:Object})],u=[(0,Nu.state)()],Lh(n,null,o,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:t},f,m),Lh(n,null,l,{kind:"accessor",name:"desktopMode",static:!1,private:!1,access:{has:e=>"desktopMode"in e,get:e=>e.desktopMode,set:(e,t)=>{e.desktopMode=t}},metadata:t},v,b),Lh(n,null,d,{kind:"accessor",name:"dir",static:!1,private:!1,access:{has:e=>"dir"in e,get:e=>e.dir,set:(e,t)=>{e.dir=t}},metadata:t},y,w),Lh(n,null,c,{kind:"accessor",name:"viewModel",static:!1,private:!1,access:{has:e=>"viewModel"in e,get:e=>e.viewModel,set:(e,t)=>{e.viewModel=t}},metadata:t},S,_),Lh(n,null,u,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},O,C),Lh(null,s={value:n},h,{kind:"class",name:n.name,metadata:t},null,p),n=s.value,t&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(n,"styles",{enumerable:!0,configurable:!0,writable:!0,value:Fu.css`
|
|
605
|
-
.iam-container {
|
|
606
|
-
position: fixed;
|
|
607
|
-
inset: 0;
|
|
608
|
-
z-index: 1000;
|
|
609
|
-
}
|
|
610
|
-
`}),Th(n,p)})();const Bh=e=>{const{storyManager:t,desktopMode:r,dir:i}=Wh(),a=(0,rd.useRef)(null);return(0,rd.useEffect)((()=>{const e=a.current;e.desktopMode=r,e.dir=i,e.viewModel=t.inAppMessaging}),[t,r]),(0,ed.jsx)("iam-reader",{ref:a})},Fh=rd.default.createContext({dir:ne.LTR,storyManager:Hl,desktopMode:!1,commonOptions:L,storyReaderOptions:Z,gameReaderOptions:R,goodsWidgetOptions:B,inAppMessagingOptions:ee});let Nh=!1;const Uh=(0,Qd.observer)((e=>{Hh(e.config),qh(e);const{commonOptions:t,gameReaderOptions:r,storyReaderOptions:i,goodsWidgetOptions:a,inAppMessagingOptions:s}=Qh(e),n=Gh(),o=(({storyManager:e})=>{const[t,r]=(0,rd.useState)(null);return(0,rd.useEffect)((()=>{const t=e.createStoryReader();return r(t),()=>{t.destroy()}}),[e]),t})({storyManager:Hl}),l=ic({storyManager:Hl,desktopMode:n});(0,rd.useEffect)((()=>{if(Nh)throw new Error("There can only be one instance of <IASContainer /> per application");return Nh=!0,()=>{Nh=!1,Hl.clearConfig()}}),[]);const d=(0,rd.useMemo)((()=>getComputedStyle(document.documentElement).direction),[]),c=(0,rd.useMemo)((()=>({storyManager:Hl,desktopMode:n,dir:d,commonOptions:t,gameReaderOptions:r,storyReaderOptions:i,goodsWidgetOptions:a,inAppMessagingOptions:s})),[Hl,n,d,t,r,i,a]);return(0,ed.jsxs)(Fh.Provider,{value:c,children:[(null==l?void 0:l.isOpened)&&(0,ed.jsx)(ac,{gameReader:l}),(null==o?void 0:o.isOpened)&&(0,ed.jsx)(Bu,{storyReader:o,desktopMode:n}),(0,ed.jsx)(Bh,{}),e.children]})})),Wh=()=>(0,rd.useContext)(Fh);const zh=(e=>{var t={};return T.d(t,e),t})({default:()=>j.default}),Vh=zh.default.getParser(window.navigator.userAgent).parse(),Gh=()=>{const[e,t]=(0,rd.useState)(!1);(0,rd.useLayoutEffect)((()=>(r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)})),[]);const r=()=>{"mobile"===Vh.getPlatformType()?t(!1):t(!0)};return e},$h=e=>{const t=t=>{27===t.keyCode&&e()};(0,rd.useEffect)((()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)})),[])},Hh=e=>{(0,rd.useEffect)((()=>{Hl.setConfig(e)}),[JSON.stringify(e)])},qh=({onClickOnStory:e,onShowStory:t,onCloseStory:r,onShowSlide:i,onClickOnButton:a,onLikeStory:s,onDislikeStory:n,onFavoriteStory:o,onShareStory:l,onShareStoryWithPath:d,onFeedImpression:c,onVisibleAreaUpdated:u,onWidgetEvent:h})=>{(0,rd.useEffect)((()=>(e&&Hl.on("clickOnStory",e),t&&Hl.on("showStory",t),r&&Hl.on("closeStory",r),i&&Hl.on("showSlide",i),a&&Hl.on("clickOnButton",a),s&&Hl.on("likeStory",s),n&&Hl.on("dislikeStory",n),o&&Hl.on("favoriteStory",o),l&&Hl.on("shareStory",l),d&&Hl.on("shareStoryWithPath",d),c&&Hl.on("feedImpression",c),u&&Hl.on("visibleAreaUpdated",u),h&&Hl.on("widgetEvent",h),()=>{e&&Hl.off("clickOnStory",e),t&&Hl.off("showStory",t),r&&Hl.off("closeStory",r),i&&Hl.off("showSlide",i),a&&Hl.off("clickOnButton",a),s&&Hl.off("likeStory",s),n&&Hl.off("dislikeStory",n),o&&Hl.off("favoriteStory",o),l&&Hl.off("shareStory",l),d&&Hl.off("shareStoryWithPath",d),c&&Hl.off("feedImpression",c),u&&Hl.off("visibleAreaUpdated",u),h&&Hl.off("widgetEvent",h)})),[e,t,r,i,a,s,n,o,l,d,c,u,h])},Qh=({commonOptions:e,gameReaderOptions:t,storyReaderOptions:r,goodsWidgetOptions:i})=>{const a=(0,rd.useRef)(new Ql).current,s=(0,rd.useMemo)((()=>(e&&a.setCommonOptions(e),a.commonOptions)),[JSON.stringify(e)]),n=(0,rd.useMemo)((()=>(t&&a.setGameReaderOptions(t),a.gameReaderOptions)),[JSON.stringify(t)]),o=(0,rd.useMemo)((()=>(i&&a.setGoodsWidgetOptions(i),a.goodsWidgetOptions)),[JSON.stringify(i),null==i?void 0:i.itemClickHandler,null==i?void 0:i.openGoodsWidgetHandler]);return{commonOptions:s,gameReaderOptions:n,storyReaderOptions:(0,rd.useMemo)((()=>(r&&a.setStoryReaderOptions(r),a.storyReaderOptions)),[JSON.stringify(r)]),goodsWidgetOptions:o,inAppMessagingOptions:ee}};var Kh=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Yh=e=>{var{listType:t,feedSlug:r,testKey:i,storyManager:a,options:s,filter:n,useUgcCard:o=!1,hasFavorite:l,isFavorite:d}=e,c=Kh(e,["listType","feedSlug","testKey","storyManager","options","filter","useUgcCard","hasFavorite","isFavorite"]);const[u,h]=(0,rd.useState)(),{desktopMode:p}=Wh(),{storyListOptions:g}=(e=>{const t=(0,rd.useRef)(new Ql).current;return{storyListOptions:(0,rd.useMemo)((()=>(e&&t.setStoriesListOptions(e),t.storiesListOptions)),[JSON.stringify(e)])}})(s),f=()=>{var e;null===(e=c.onLoadStart)||void 0===e||e.call(c)},m=e=>{var t;null===(t=c.onLoadEnd)||void 0===t||t.call(c,e)};return(0,rd.useEffect)((()=>{const e=a.createStoryList();return e.on("startLoading",f),e.on("endLoading",m),h(e),()=>{e.destroy()}}),[a]),(0,rd.useEffect)((()=>{u&&(u.setParams({listType:t,testKey:i,feedSlug:r,filter:n,useUgcCard:o,isFavorite:d,hasFavorite:l}),d||u.loadStories({needFavorite:!0}))}),[u,i,r,n]),(0,rd.useEffect)((()=>{u&&(u.modeDesktop=p)}),[p,u]),{storyListViewModel:u,storyListOptions:g}};const Jh=(e=>{var t={};return T.d(t,e),t})({parseFont:()=>M.parseFont});const Zh=(e=>{var t={};return T.d(t,e),t})({default:()=>E.default});class Xh{constructor(){Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontVariant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontWeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lineHeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontFamily",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}toString(){return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${this.fontSize}px/${this.lineHeight} ${this.fontFamily.join(", ")}`}clone(){const e=new Xh;return e.fontStyle=this.fontStyle,e.fontVariant=this.fontVariant,e.fontWeight=this.fontWeight,e.fontSize=this.fontSize,e.lineHeight=this.lineHeight,e.fontFamily=this.fontFamily.slice(),e}}class ep{constructor(e,t){Object.defineProperty(this,"obj",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cardTitleOptions",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"cardTitleFont",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cardTitleFont=this.getCardTitleParsedFont(t.font)}getCardTitleFont(){return this.cardTitleFont.clone()}getScaledFontSizeInWebView(){const e=this.measureScaledFontSizeInWebView(this.cardTitleFont.fontSize)/this.cardTitleFont.fontSize;return this.cardTitleFont.fontSize/e}getStoryTitleBlockHeight(){if(!this.isOutsideTitle())return 0;const e=this.cardTitleOptions.padding,t={top:0,bottom:0};try{if("number"==typeof e)t.top=e,t.bottom=e;else{const r=(0,Zh.default)(e);t.top=parseFloat(r.top),t.bottom=parseFloat(r.bottom)}}catch(e){console.error(e)}const r=this.cardTitleOptions.lineClamp,i=Math.round(this.cardTitleFont.fontSize*this.cardTitleFont.lineHeight*100)/100;return t.top+t.bottom+r*i}measureScaledFontSizeInWebView(e){const t=document.createElement("span");t.style.fontSize=e+"px",t.style.display="none",this.obj.append(t);const r=getComputedStyle(t).fontSize;return this.obj.removeChild(t),parseFloat(r)||e}isOutsideTitle(){return this.cardTitleOptions.display&&(this.cardTitleOptions.position===z.CARD_OUTSIDE_TOP||this.cardTitleOptions.position===z.CARD_OUTSIDE_BOTTOM)}getCardTitleParsedFont(e){const t=new Xh;t.fontStyle="normal",t.fontVariant="normal",t.fontWeight="normal",t.fontSize=14,t.lineHeight=1.2,t.fontFamily=["system-ui",'"Segoe UI"',"Roboto","Helvetica","Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"'];try{const r=(0,Jh.parseFont)(e);if(null!=r["font-style"]&&(t.fontStyle=r["font-style"]),null!=r["font-variant"]&&(t.fontVariant=r["font-variant"]),null!=r["font-weight"]&&(t.fontWeight=r["font-weight"]),null!=r["font-size"]){const e=parseFloat(r["font-size"]);String(`${e}px`)===r["font-size"]&&(t.fontSize=e)}if(null!=r["line-height"]){const e=parseFloat(r["line-height"]);String(`${e}px`)===r["line-height"]?t.lineHeight=Math.round(e/t.fontSize*100)/100:String(e)===r["line-height"]&&(t.lineHeight=parseFloat(r["line-height"]))}null!=r["font-family"]&&Array.isArray(r["font-family"])&&(t.fontFamily=r["font-family"])}catch(e){console.error(e)}return t}}class tp{constructor(e){Object.defineProperty(this,"storiesListOptions",{enumerable:!0,configurable:!0,writable:!0,value:e})}getStoriesListStyleOptions(e){var t,r,i,a,s,n;const o={storiesHeight:null!==(r=null===(t=this.storiesListOptions.card)||void 0===t?void 0:t.height)&&void 0!==r?r:70,storiesLayoutHeight:null!==(a=null===(i=this.storiesListOptions.layout)||void 0===i?void 0:i.height)&&void 0!==a?a:0,storiesListTopPadding:null!==(s=this.storiesListOptions.topPadding)&&void 0!==s?s:0,storiesListBottomPadding:null!==(n=this.storiesListOptions.bottomPadding)&&void 0!==n?n:0};let l=parseFloat(o.storiesHeight),d=l;if(parseFloat(o.storiesLayoutHeight))return l=parseFloat(o.storiesLayoutHeight),{storiesListHeight:l,storiesListInnerHeight:d};return l+=parseFloat(o.storiesListTopPadding)+parseFloat(o.storiesListBottomPadding)+e,d+=e,{storiesListHeight:l,storiesListInnerHeight:d}}}var rp=T(938),ip={insert:"head",singleton:!1};sd()(rp.A,ip);const ap=rp.A.locals||{},sp=({slider:e,storyListViewModel:t,storyListOptions:r,isFavorite:i,listType:a,feed:s,filter:n,storyManager:o})=>{const l=(({storyManager:e,listType:t,feed:r,filter:i})=>{const[a,s]=(0,rd.useState)();return(0,rd.useEffect)((()=>{const a=new Xo(e,{listType:t,feed:r,filter:i}).create();return s(a),()=>{a.destroy()}}),[r,JSON.stringify(i)]),a})({listType:a,feed:s,filter:n,storyManager:o}),d=(0,rd.useCallback)((0,Ua.default)((()=>{if(!e||!l)return;const{x:t,y:r}=e.getCurrentPosition();l.calculate(t,r)}),300),[e,l]),c=(0,rd.useCallback)((()=>{if(!e||!l)return;const t=e.elementRef.getBoundingClientRect(),r=new $o(t.left,t.top,t.width,t.height),i=Array.from(e.slides),a=new $o(0,0,window.innerWidth,window.innerHeight),s=u();l.updateGeometry({stories:i,storyListRect:r,windowRect:a,viewportPadding:s}),d()}),[e,l,d]);(0,rd.useEffect)((()=>{if(!e||i||!l)return;const t=l.startScroll.bind(l),r=l.endScroll.bind(l);return e.addListener("scrollstart",t),e.addListener("scrollend",r),window.addEventListener("scroll",c),window.addEventListener("resize",c),()=>{e.removeListener("scrollstart",t),e.removeListener("scrollend",r),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}}),[e,i,c]),(0,rd.useEffect)((()=>{!i&&e&&e.waitStoryListClientWidth().then((()=>{c()}))}),[e,r.direction,r.card.aspectRatio,r.card.height,t.stories,i,c]),(0,rd.useEffect)((()=>{if(!l)return;const e=({id:e})=>l.markStoryAsFullVisible(e);return fi.on("publicEvents.showStory",e),()=>{fi.off("publicEvents.showStory",e)}}),[l,t]);const u=()=>{const e=r.sidePadding,t={left:e,right:e,top:r.topPadding,bottom:r.bottomPadding};return"vertical"===r.direction&&(t.left=0,t.right=0),t}},np=(e,t,r)=>{const{dir:i}=Wh();(0,rd.useEffect)((()=>{if(e&&t.autoScrollOnStoryClose)return fi.on(Hn.Close,a),()=>{fi.off(Hn.Close,a)}}),[e,t.direction,t.autoScrollOnStoryClose]);const a=({id:a})=>{if(!e)return;const s=((e,t)=>e.slides.find((e=>Number(e.dataset.id)===t)))(e,a);if(!s)return;const n=(e=>{const{x:t,y:i}=e.getCurrentPosition(),a=r.current.getBoundingClientRect();return new $o(a.x+t,a.y+i,a.width,a.height)})(e),o=((e,t)=>new $o(i===ne.LTR?e.offsetLeft:t.width-e.offsetLeft-e.clientWidth,e.offsetTop,e.clientWidth,e.clientHeight))(s,n);if(o.overlaps(n))return;const l="horizontal"===t.direction?o.x:s.offsetTop;e.scrollTo(l)}},op=(0,rd.forwardRef)(((e,t)=>{const r=e.sliderOptions.card,i=e.sliderOptions.favoriteCard,a=r.border,s=r.opened.border,n=e.sliderOptions.navigation,o=()=>{var e,t,r;return(null!==(e=s.radius)&&void 0!==e?e:a.radius)-parseFloat(null!==(t=s.width)&&void 0!==t?t:a.width)-parseFloat(null!==(r=s.gap)&&void 0!==r?r:a.gap)};return(0,ed.jsx)("div",{dir:e.dir,ref:t,className:e.className,style:Object.assign(Object.assign({},(()=>{var t,l,d,c,u,h,p,g,f,m,v,b,y,w,S,_,O,C,x,k,P;const j=e=>{let t="";return null!=e&&Array.isArray(e.linearGradient)&&(t=e.linearGradient.map((({direction:e,points:t})=>`linear-gradient(${[e,t].filter(Boolean).join(", ")})`)).join(", ")),t},M={"--storiesBorderNotReadColor":a.color,"--storiesBorderReadColor":null!==(t=s.color)&&void 0!==t?t:a.color,"--storiesBorderNotReadGradientColor":null==a?void 0:a.gradient,"--storiesBorderReadGradientColor":null!==(l=null==s?void 0:s.gradient)&&void 0!==l?l:null==a?void 0:a.gradient,"--storiesListCardFavoriteGradientColor":null===(d=e.sliderOptions.favoriteCard.border)||void 0===d?void 0:d.gradient,"--storiesListCardUgcGradientColor":null===(c=e.sliderOptions.ugcCard.border)||void 0===c?void 0:c.gradient,"--storiesGap":r.gap+"px","--storiesHeight":r.height+"px","--storiesListSidePadding":e.sliderOptions.sidePadding+"px","--storiesListBorderNotReadWidth":a.width+"px","--storiesListBorderReadWidth":(null!==(u=s.width)&&void 0!==u?u:s.width)+"px","--storiesListBorderGapNotRead":a.gap+"px","--storiesListBorderGapRead":(null!==(h=s.gap)&&void 0!==h?h:s.gap)+"px","--storiesListBorderRadius":a.radius+"px","--storiesListBorderRadiusRead":(null!==(p=s.radius)&&void 0!==p?p:s.radius)+"px","--storiesListItemMaskColor":r.mask.color,"--storiesListItemOpenedMaskColor":null!==(g=r.opened.mask.color)&&void 0!==g?g:r.mask.color,"--storiesListItemMaskLinearGradient":j(r.mask),"--storiesListItemOpenedMaskLinearGradient":j(null!=(null===(m=null===(f=r.opened)||void 0===f?void 0:f.mask)||void 0===m?void 0:m.linearGradient)?r.opened.mask:r.mask),"--storiesListCardFavoriteTitle":xe(i.title.padding.toString())?i.title.padding+"px":i.title.padding,"--storiesListCardFavoriteGap":xe(i.gap.toString())?i.gap+"px":i.gap,"--storiesListCardUgcMaskColor":e.sliderOptions.ugcCard.mask.color,"--storiesListCardUgcMaskLinearGradient":j(e.sliderOptions.ugcCard.mask),"--storiesListItemTitleFontFamily":"InternalPrimaryFont","--storiesListItemTitleFont":r.title.font,"--storiesListItemTitlePadding":xe(r.title.padding.toString())?r.title.padding+"px":r.title.padding,"--storiesListControlsSize":xe(n.controlsSize.toString())?n.controlsSize+"px":n.controlsSize,"--storiesListControlsBackgroundColor":n.controlsBackgroundColor,"--storiesListControlsColor":n.controlsColor,"--storiesListInnerBorderRadiusNotRead":a.radius-parseFloat(a.width)-parseFloat(a.gap)+"px","--storiesListInnerBorderRadiusRead":o()+"px","--storiesListCardDropShadow":r.dropShadow,"--storiesListCardOpenedDropShadow":null!==(v=r.opened.dropShadow)&&void 0!==v?v:r.dropShadow,"--storiesListCardFavoriteDropShadow":e.sliderOptions.favoriteCard.dropShadow,"--storiesListCardUgcDropShadow":e.sliderOptions.ugcCard.dropShadow,"--storiesListCardMask":(null===(b=r.svgMask)||void 0===b?void 0:b.cardMask)?`url("data:image/svg+xml,${Le(null===(y=r.svgMask)||void 0===y?void 0:y.cardMask)}")`:null,"--storiesListCardOpenedMask":(null===(w=r.opened.svgMask)||void 0===w?void 0:w.cardMask)?`url("data:image/svg+xml,${Le(null===(S=r.opened.svgMask)||void 0===S?void 0:S.cardMask)}")`:null,"--storiesListCardFavoriteMask":(null===(_=e.sliderOptions.ugcCard.svgMask)||void 0===_?void 0:_.cardMask)?`url("data:image/svg+xml,${Le(null===(O=e.sliderOptions.ugcCard.svgMask)||void 0===O?void 0:O.cardMask)}")`:null};let E=null;return E=null===(C=r.svgMask)||void 0===C?void 0:C.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Le(e.mask)}")`:null)),E=null===(x=r.opened.svgMask)||void 0===x?void 0:x.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardOpenedOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Le(e.mask)}")`:null)),E=null===(k=e.sliderOptions.favoriteCard.svgMask)||void 0===k?void 0:k.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardFavoriteOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Le(e.mask)}")`:null)),E=null===(P=e.sliderOptions.ugcCard.svgMask)||void 0===P?void 0:P.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardUgcOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Le(e.mask)}")`:null)),M})()),e.style),children:e.children})})),lp=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"),dp=({videoCoverSrc:e,onVideoCoverLoaded:t})=>{const r=(0,rd.useRef)(null);return(0,rd.useEffect)((()=>{(()=>{if(!e)return;const i=r.current,a=()=>{i.play().then((()=>{if(lp){let e=1;const r=()=>{e>=2&&(i.removeEventListener("timeupdate",r),i.currentTime=0,t()),e++};i.addEventListener("timeupdate",r,!1)}else t()})).catch((e=>{console.error(e)})),i.removeEventListener("canplaythrough",a)};i.addEventListener("canplaythrough",a),i.load()})()}),[]),(0,ed.jsx)("video",{ref:r,src:e,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true",preload:"auto"})},cp=({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{const a=(e,t)=>null!=t&&Array.isArray(t)?t.map(((t,r)=>s(t,e,r))):[],s=(e,t,r)=>({maskImage:`var(--${t}${r}Mask)`,WebKitMaskImage:`var(--${t}${r}Mask)`,background:e.background});return{getAllCardsOverlayMaskStyles:()=>{let s=[];var n;return e instanceof Vo&&(s=s.concat(a("storiesListCardFavoriteOverlay",null===(n=r.svgMask)||void 0===n?void 0:n.overlayMask))),s=e instanceof Lo?s.concat((()=>{var e;return a("storiesListCardUgcOverlay",null===(e=i.svgMask)||void 0===e?void 0:e.overlayMask)})()):e.isOpened?s.concat((()=>{var e;return a("storiesListCardOpenedOverlay",null===(e=t.opened.svgMask)||void 0===e?void 0:e.overlayMask)})()):s.concat((()=>{var e;return a("storiesListCardOverlay",null===(e=t.svgMask)||void 0===e?void 0:e.overlayMask)})()),s}}};var up=T(811),hp={insert:"head",singleton:!1};sd()(up.A,hp);const pp=up.A.locals||{},gp=(0,Qd.observer)((({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i,wrapperStyle:a,children:s,onClick:n})=>{const o={story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i},[l,d]=(0,rd.useState)(!1),{getAllCardsOverlayMaskStyles:c}=cp(o),{getCardTitleAlignClass:u,getTitleStyle:h,getTitleWrapperStyle:p}=(({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{const{dir:a}=Wh();return{getCardTitleAlignClass:()=>{const e=t.title.textAlign,r=e===W.START||e===W.LEFT,i=e===W.END||e===W.RIGHT,s=a===ne.LTR;return{[pp["align-left"]]:r&&s||i&&!s,[pp["align-center"]]:e===W.CENTER,[pp["align-right"]]:i&&s||r&&!s}},getTitleStyle:()=>{const r={};return e.titleColor&&t.title.position===z.CARD_INSIDE_BOTTOM&&Object.assign(r,{color:e.titleColor}),r.WebkitLineClamp=String(parseInt(t.title.lineClamp)),r},getTitleWrapperStyle:()=>{let t={};return e.titleColor&&e instanceof Vo&&(t=Object.assign(Object.assign({},t),{color:r.title.color})),e.titleColor&&e instanceof Lo&&(t=Object.assign(Object.assign({},t),{color:i.title.color})),t}}})(o),{getSlideClassList:g,getSlideStyleList:f,getSlideWrapperStyle:m}=(({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{var a;const s=null!==(a=t.aspectRatio)&&void 0!==a?a:e.getAspectRatio(t.variant);return{getSlideClassList:()=>{var a,s;const n=e.background;let o="";void 0!==n&&(o=pp[`_background-color-${n.color}`+(!0===n.gradient?"-gradient":"")]);const l=(()=>{let a;return a=e instanceof Vo?r:e instanceof Lo?i:e.isOpened&&t.opened||t,a})(),d=Boolean(l.dropShadow),c=Boolean(null===(a=l.svgMask)||void 0===a?void 0:a.cardMask),u=Boolean(null===(s=l.border)||void 0===s?void 0:s.gradient);return[o,{[pp["_is-read"]]:e.isOpened},{[pp["_format-rectangle"]]:t.variant===X.STYLE_RECTANGLE},{[pp["_format-circle"]]:t.variant===X.STYLE_CIRCLE},{[pp["_format-quad"]]:t.variant===X.STYLE_QUAD},{[pp["_favorite-cell"]]:e instanceof Vo},{[pp["_ugc-cell"]]:e instanceof Lo},{[pp["_has-drop-shadow"]]:d},{[pp["_has-card-svg-mask"]]:c},{[pp["_has-border-gradient-color"]]:u}]},getSlideStyleList:()=>{const r={width:s*t.height+"px",opacity:null!==t.opacity?t.opacity:1,boxShadow:t.boxShadow||"unset",height:`${t.height}px`};return e.isOpened&&(r.boxShadow=t.opened.boxShadow||r.boxShadow,r.opacity=null!==t.opened.opacity?t.opened.opacity:r.opacity),r},getSlideWrapperStyle:()=>{const e={};return e.width=s*t.height+"px",e}}})(o),v=e.getImageSrcByCoverQuality(t.coverQuality),b=t.title.position===z.CARD_INSIDE_BOTTOM,y=t.title.position===z.CARD_OUTSIDE_TOP,w=t.title.position===z.CARD_OUTSIDE_BOTTOM;return(0,ed.jsxs)("div",{"data-id":e.id,className:(0,id.default)("ias-stories-slide-wrapper",pp["stories-slide-wrapper"],{[pp.isTitleCardOutsideTop]:y,[pp.isTitleCardOutsideBottom]:w}),style:Object.assign(Object.assign({},m()),a),rel:"noreferrer",onClick:t=>{t.stopPropagation(),t.preventDefault(),n(e)},children:[t.title.display&&y&&(0,ed.jsx)("div",{className:(0,id.default)(pp["stories-slide__content"],pp.__position_outside_top),style:p(),children:(0,ed.jsx)("div",{className:(0,id.default)(pp["stories-slide__title"],pp.clamp,u()),style:h(),children:e.title})}),(0,ed.jsxs)("div",{className:(0,id.default)("ias-stories-slide",pp["stories-slide"],g()),style:f(),children:[(0,ed.jsxs)("div",{className:pp["stories-slide__inner"],children:[(0,ed.jsx)("div",{className:pp["stories-slide-image"],style:{backgroundColor:e.backgroundColor?e.backgroundColor:"transparent"},children:(0,ed.jsx)("div",{className:pp["stories-slide-image__wrap"],children:(0,ed.jsxs)("div",{className:(0,id.default)(pp["stories-slide-image__image"],pp._mode_list,{[pp["video-loaded"]]:l,[pp["ugc-card-cell"]]:e instanceof Lo}),children:[v&&(0,ed.jsx)("img",{src:v,alt:e.title,loading:t.coverLazyLoading?"lazy":"eager"},v),e.videoCoverSrc&&(0,ed.jsx)(dp,{onVideoCoverLoaded:()=>d(!0),videoCoverSrc:e.videoCoverSrc}),s]})})}),(0,ed.jsx)("div",{className:pp["stories-slide__mask"]}),t.title.display&&b&&(0,ed.jsx)("div",{className:pp["stories-slide__content"],style:p(),children:(0,ed.jsx)("div",{className:(0,id.default)(pp["stories-slide__title"],pp.clamp,u()),style:h(),children:e.title})})]}),c().map(((e,t)=>(0,ed.jsx)("div",{style:e,className:pp["card-overlay-svg-mask"]},t)))]}),t.title.display&&w&&(0,ed.jsx)("div",{className:(0,id.default)(pp["stories-slide__content"],pp.__position_outside_bottom),style:p(),children:(0,ed.jsx)("div",{className:(0,id.default)(pp["stories-slide__title"],pp.clamp,u()),style:h(),children:e.title})})]})}));var fp=T(731),mp={insert:"head",singleton:!1};sd()(fp.A,mp);const vp=fp.A.locals||{};var bp=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const yp=e=>{var{sliderDirection:t,slider:r}=e,i=bp(e,["sliderDirection","slider"]);const[a,s]=(0,rd.useState)(!0),[n,o]=(0,rd.useState)(!0),l=i.navigationOptions.speed;(0,rd.useEffect)((()=>(r.on("reachStart",d),r.on("reachEnd",c),()=>{r.off("reachStart",d),r.off("reachEnd",c)})),[r]);const d=()=>{s(r.reachStart)},c=()=>{o(r.reachEnd)};return i.navigationView?i.navigationView({dir:i.dir,defaultStyles:vp,reachStart:a,reachEnd:n,onPrev:()=>r.scrollByDirection(-1,l),onNext:()=>r.scrollByDirection(1,l),slider:{direction:t,viewport:r.elementRef.getBoundingClientRect()}}):i.navigationOptions.showControls?(0,ed.jsxs)("div",{className:(0,id.default)("ias-stories-list-controls",vp["stories-list-controls"],vp[t]),children:[(0,ed.jsx)("div",{onClick:()=>r.scrollByDirection(-1,l),className:(0,id.default)("ias-control-start",vp["control-start"],{[vp["control-start_dir_rtl"]]:"rtl"===i.dir,[vp["control-start_reach-start"]]:a,"ias-control-start_dir_rtl":"rtl"===i.dir,"ias-control-start_reach-start":a}),children:(0,ed.jsx)("div",{className:(0,id.default)("ias-control-icon",vp["control-icon"])})}),(0,ed.jsx)("div",{onClick:()=>r.scrollByDirection(1,l),className:(0,id.default)("ias-control-end",vp["control-end"],{[vp["control-end_dir_rtl"]]:"rtl"===i.dir,[vp["control-end_reach-end"]]:n,"ias-control-end_dir_rtl":"rtl"===i.dir,"ias-control-end_reach-end":n}),children:(0,ed.jsx)("div",{className:(0,id.default)("ias-control-icon",vp["control-icon"])})})]}):null};var wp=T(533),Sp={insert:"head",singleton:!1};sd()(wp.A,Sp);const _p=wp.A.locals||{},Op=({favoriteStories:e,cardOptions:t,favoriteCardOptions:r})=>{const i=e=>{var r;return{paddingTop:1/(null!==(r=t.aspectRatio)&&void 0!==r?r:e.getAspectRatio(t.variant))*100+"%"}},a=e=>{const t=e.getImageSrcByCoverQuality(r.coverQuality),i={};return t?i.backgroundImage=`url('${t}')`:i.backgroundColor=e.backgroundColor,i};return(0,ed.jsx)("div",{className:_p["favorite-images-wrapper"],children:e.slice(0,4).map(((e,r)=>(0,ed.jsx)("div",{className:_p["favorite-image-wrapper"],children:(0,ed.jsx)("div",{style:i(e),className:(0,id.default)(_p["favorite-image"],{[_p.circle_style]:t.variant===X.STYLE_CIRCLE}),children:(0,ed.jsx)("div",{className:_p["favorite-image-item"],style:a(e)})})},r)))})};var Cp=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const xp=(0,Qd.observer)((0,rd.forwardRef)(((e,t)=>{var{isFavorite:r=!1,storyListViewModel:i}=e,a=Cp(e,["isFavorite","storyListViewModel"]);const s=(0,rd.useRef)(null),n=(0,rd.useRef)(null);((e,t)=>{(0,rd.useImperativeHandle)(e,(()=>({reload:t.reload.bind(t)})),[t])})(t,i);const o=((e,t)=>{const[r,i]=(0,rd.useState)(t);(0,rd.useLayoutEffect)((()=>{const r=e.current;a(r,t),i(t)}),[JSON.stringify(t)]);const a=(e,t)=>{const r=new ep(e,t.card.title);s(r,t),n(r,t)},s=(e,t)=>{const r=e.getCardTitleFont();r.fontSize=e.getScaledFontSizeInWebView(),t.card.title.font=r.toString()},n=(e,t)=>{const r=new tp(t),{storiesListHeight:i,storiesListInnerHeight:a}=r.getStoriesListStyleOptions(e.getStoryTitleBlockHeight()),s=t.layout.height;t.layout.height=(0,_r.default)(s)?`${i}px`:s};return r})(s,a.storyListOptions),{sliderRef:l,slider:d,isScrolling:c}=((e,t)=>{const{dir:r,desktopMode:i}=Wh(),a=(0,rd.useRef)(null),s=(0,rd.useRef)(null),[n,o]=(0,rd.useState)(!1),[l,d]=(0,rd.useState)(null),c=()=>{clearTimeout(a.current),o(!0)},u=()=>{a.current=setTimeout((()=>o(!1)),100)},h=(0,rd.useCallback)((()=>{if(!l)return;const{x:e,y:t}=l.getCurrentPosition();l.testAttraction(e,t)}),[l]);return(0,rd.useEffect)((()=>{if(!s.current)return;const e=new Ga;return e.mount(s.current),d(e),e.on("scrollstart",c),e.on("scrollend",u),()=>{e.destroy(),e.off("scrollstart",c),e.off("scrollend",u)}}),[]),(0,rd.useEffect)((()=>{l&&(l.setGap(e.card.gap),l.setDesktopMode(i),l.changeDirection(e.direction))}),[l,e.card.gap,i,e.direction]),(0,rd.useEffect)((()=>{l&&(l.setTextDirection(r),l.scrollTo(0,0))}),[l,r]),(0,rd.useEffect)((()=>{l&&(l.scrollTo(0,0),(async(e,t)=>{t>0&&await e.waitStoryListClientWidth();const{x:r,y:i}=e.getCurrentPosition();e.testAttraction(r,i)})(l,t))}),[l,t]),(0,rd.useEffect)((()=>(window.addEventListener("resize",h),()=>{window.addEventListener("resize",h)})),[l,h]),{sliderRef:s,slider:l,isScrolling:n}})(o,i.stories.length);sp({slider:d,storyListViewModel:i,storyListOptions:o,isFavorite:r,listType:a.listType,feed:a.feedSlug,filter:a.filter,storyManager:a.storyManager}),np(d,o,n);const{getRootStyle:u,getStoryWrapperStyle:h,viewportInnerClassList:p,viewportInnerStyle:g}=(e=>{const{dir:t,desktopMode:r}=Wh();return{getRootStyle:()=>({"--background-color":e.layout.backgroundColor,paddingLeft:e.sidePadding+"px",paddingRight:e.sidePadding+"px","--storiesListTopPadding":e.topPadding+"px","--storiesListBottomPadding":e.bottomPadding+"px","--storiesListSidePadding":e.sidePadding+"px",backgroundColor:e.layout.backgroundColor}),getStoryWrapperStyle:(t,r)=>{const i={marginRight:"0",paddingLeft:"0",paddingRight:"0"};return"vertical"===e.direction||(t!==r-1?i.marginRight=e.card.gap+"px":i.paddingRight=e.sidePadding+"px",0===t&&(i.paddingLeft=e.sidePadding+"px")),i},viewportInnerClassList:r?(0,id.default)(ap["stories-list__viewport-inner"],ap["mode-desktop"],{[ap["with-list-controls"]]:e.navigation.showControls,[ap.isTitleCardOutsideTop]:e.card.title.position===z.CARD_OUTSIDE_TOP,[ap.isTitleCardOutsideBottom]:e.card.title.position===z.CARD_OUTSIDE_BOTTOM,[ap.isVerticalDirection]:"vertical"===e.direction}):(0,id.default)(ap["stories-list__viewport-inner"],Object.assign(Object.assign({},(()=>{const r=e.layout.sliderAlign,i=r===N.START||r===N.LEFT,a=r===N.END||r===N.RIGHT,s=t===ne.LTR;return{[ap["align-left"]]:i&&s||a&&!s,[ap["align-center"]]:r===N.CENTER,[ap["align-right"]]:a&&s||i&&!s}})()),{[ap.isTitleCardOutsideTop]:e.card.title.position===z.CARD_OUTSIDE_TOP,[ap.isTitleCardOutsideBottom]:e.card.title.position===z.CARD_OUTSIDE_BOTTOM,[ap.isVerticalDirection]:"vertical"===e.direction})),viewportInnerStyle:{height:e.layout.height,gap:"vertical"===e.direction?`${e.card.gap}px`:0}}})(o),f=o.card,m=o.favoriteCard,v=o.ugcCard;(0,rd.useLayoutEffect)((()=>{i.setFavoriteCardOptions(m),i.setUgcCardOptions(v)}),[i,m,v]);return(0,ed.jsxs)(op,{className:(0,id.default)("ias-stories-list-wrapper",ap["stories-list-wrapper"],{[ap["mode-desktop"]]:i.modeDesktop,[ap["with-list-controls"]]:o.navigation.showControls,"ias-mode-desktop":i.modeDesktop,"ias-with-list-controls":o.navigation.showControls}),dir:a.dir,style:u(),sliderOptions:o,ref:s,children:[(0,ed.jsx)("div",{className:(0,id.default)("ias-stories-list",ap["stories-list"]),children:(0,ed.jsx)("div",{ref:n,className:(0,id.default)(ap["stories-list__viewport"],{[ap["mode-desktop"]]:i.modeDesktop,"ias-mode-desktop":i.modeDesktop}),style:"horizontal"===o.direction?{marginLeft:-o.sidePadding+"px",marginRight:-o.sidePadding+"px"}:{},children:(0,ed.jsx)("div",{ref:l,className:p,style:g,children:i.stories.map(((e,t)=>{var r;const s=e instanceof Vo,n=a.storyCardView&&!s;return s&&a.favoriteCardView?(0,ed.jsx)(rd.default.Fragment,{children:a.favoriteCardView(e)},e.id):(0,ed.jsx)(rd.default.Fragment,{children:n?null===(r=a.storyCardView)||void 0===r?void 0:r.call(a,e):(0,ed.jsx)(gp,{story:e,cardOptions:f,favoriteCardOptions:m,ugcCardOptions:v,wrapperStyle:h(t,i.stories.length),onClick:()=>((e,t)=>{var r,s,n;c||(null===(r=a.onStoryCardClick)||void 0===r||r.call(a,e),e instanceof Lo?null===(s=a.onUgcCardClick)||void 0===s||s.call(a):e instanceof Vo?null===(n=a.onFavoriteCardClick)||void 0===n||n.call(a):i.onStoryClick(e,t))})(e,t),children:s&&(0,ed.jsx)(Op,{favoriteStories:e.favoriteStories,favoriteCardOptions:o.favoriteCard,cardOptions:f})},e.id)},e.id)}))})})}),d&&(0,ed.jsx)(yp,{dir:a.dir,navigationOptions:o.navigation,navigationView:a.navigationView,sliderDirection:o.direction,storiesLength:i.stories.length,slider:d})]})}))),kp=(0,Qd.observer)((0,rd.forwardRef)(((e,t)=>{var r,i,a;const{storyManager:s,dir:n}=Wh(),o=null!==(r=e.feedSlug)&&void 0!==r?r:"default",l=At.DEFAULT,{storyListViewModel:d,storyListOptions:c}=Yh(Object.assign(Object.assign({},e),{storyManager:s,feedSlug:o,listType:l,hasFavorite:Boolean(e.hasFavorite),isFavorite:!1}));return d&&(null===(i=d.session)||void 0===i?void 0:i.id)?(0,ed.jsx)(xp,Object.assign({},e,{dir:n,storyManager:s,feedSlug:null!==(a=e.feedSlug)&&void 0!==a?a:"default",listType:At.DEFAULT,storyListViewModel:d,storyListOptions:c,onStoryCardClick:e.onStoryCardClick,onFavoriteCardClick:()=>{var t;s.emit("clickOnFavoriteCell",{feed:o}),null===(t=e.onFavoriteCardClick)||void 0===t||t.call(e)},ref:t})):null}))),Pp=(0,Qd.observer)((0,rd.forwardRef)(((e,t)=>{var r;const{storyManager:i,dir:a}=Wh(),s=Gt,n=At.UGC,{storyListViewModel:o,storyListOptions:l}=Yh(Object.assign(Object.assign({},e),{storyManager:i,feedSlug:s,listType:n,isFavorite:!1,hasFavorite:!1}));return o&&(null===(r=o.session)||void 0===r?void 0:r.id)?(0,ed.jsx)(xp,Object.assign({},e,{ref:t,dir:a,storyListOptions:l,storyManager:i,listType:At.UGC,feedSlug:Gt,storyListViewModel:o,onStoryCardClick:e.onStoryCardClick})):null}))),jp=e=>{const{storyManager:t,dir:r}=Wh(),i=Ut,a=At.FAVORITE,{storyListViewModel:s,storyListOptions:n}=Yh(Object.assign(Object.assign({},e),{storyManager:t,feedSlug:i,listType:a,isFavorite:!0,hasFavorite:!0}));return s?(0,ed.jsx)(xp,Object.assign({},e,{storyListOptions:n,storyManager:t,dir:r,feedSlug:i,listType:a,storyListViewModel:s,isFavorite:!0})):null};var Mp=T(432),Ep={insert:"head",singleton:!1};sd()(Mp.A,Ep);const Ip=Mp.A.locals||{},Lp=({open:e,options:t,storyListOptions:r,onClose:i})=>{var a,s;const{dir:n}=Wh();(0,rd.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,ed.jsx)("div",{className:Ip["favorite-story-list-modal"],style:(()=>{var e,r,i,a;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!==(a=null===(i=t.bottomOffset)||void 0===i?void 0:i.toString())&&void 0!==a?a:"0")+"px","--storiesFavoriteBackgroundColor":t.backgroundColor}})(),children:(0,ed.jsxs)("div",{className:Ip.container,children:[(0,ed.jsxs)("div",{className:Ip.header,children:[(0,ed.jsx)("p",{className:Ip.title,children:t.title.content}),(0,ed.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),i()},className:Ip["header__close-btn"],style:(()=>{const e="start"===t.closeButtonPosition||"left"===t.closeButtonPosition,r=n===ne.LTR;return{[e&&r||!e&&!r?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(s=null===(a=t.closeButton)||void 0===a?void 0:a.svgSrc.baseState)&&void 0!==s?s:""}})]}),(0,ed.jsx)("div",{className:Ip.content,children:(0,ed.jsx)("div",{className:Ip["favorite-story-list"],children:(0,ed.jsx)(jp,{options:Object.assign(Object.assign(Object.assign({},r),{sidePadding:0}),{direction:G.COLUMN,layout:{height:"auto"}})})})}),(0,ed.jsx)("div",{className:Ip.footer}),(0,ed.jsx)("div",{className:Ip["bottom-offset"]})]})}):null},Tp=({storyList:e,onStoryCardClick:t,onFavoriteCardClick:r})=>{const[i,a]=(0,rd.useState)(e.appearanceManager.storiesListOptions),s=(0,rd.useRef)(null);return(0,rd.useEffect)((()=>{e.api=s.current}),[]),(0,rd.useEffect)((()=>(e.appearanceManager.on(ql.EVENT_UPDATED_STORIES_LIST_OPTIONS,a),()=>{e.appearanceManager.off(ql.EVENT_UPDATED_STORIES_LIST_OPTIONS,a)})),[e.appearanceManager]),(0,Kd.createPortal)((0,ed.jsx)(kp,{ref:s,options:i,hasFavorite:e.appearanceManager.commonOptions.hasFavorite,testKey:e.testKey,useUgcCard:e.useUgcCard,feedSlug:e.feedSlug,onLoadStart:()=>{e.emit($.START_LOADER)},onLoadEnd:t=>{e.emit($.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()},onFavoriteCardClick:r,onStoryCardClick:t},e.mountSelector),document.querySelector(e.mountSelector))},Ap=({ugcStoryList:e,onStoryCardClick:t})=>{const[r,i]=(0,rd.useState)(e.appearanceManager.storiesListOptions),a=(0,rd.useRef)(null);return(0,rd.useEffect)((()=>{e.api=a.current}),[]),(0,rd.useEffect)((()=>(e.appearanceManager.on(ql.EVENT_UPDATED_STORIES_LIST_OPTIONS,i),()=>{e.appearanceManager.off(ql.EVENT_UPDATED_STORIES_LIST_OPTIONS,i)})),[e.appearanceManager]),(0,Kd.createPortal)((0,ed.jsx)(Pp,{ref:a,options:r,testKey:e.testKey,useUgcCard:e.useUgcCard,onStoryCardClick:t,onLoadStart:()=>{e.emit($.START_LOADER)},onLoadEnd:t=>{e.emit($.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()}}),document.querySelector(e.mountSelector))},Rp=e=>{const[t,r]=(0,rd.useState)(!1);return(0,ed.jsxs)(Uh,{config:e.storyManagerConfigDto,storyReaderOptions:e.appearanceManager.storyReaderOptions,commonOptions:e.appearanceManager.commonOptions,gameReaderOptions:e.appearanceManager.gameReaderOptions,goodsWidgetOptions:e.appearanceManager.goodsWidgetOptions,children:[e.storyLists.map((t=>(0,ed.jsx)(Tp,{onFavoriteCardClick:()=>{r(!0)},onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)},storyList:t},t.mountSelector))),e.ugcStoryLists.map((t=>(0,ed.jsx)(Ap,{ugcStoryList:t,onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)}},t.mountSelector))),(0,ed.jsx)(Lp,{open:t,onClose:()=>r(!1),options:e.appearanceManager.storyFavoriteReaderOptions,storyListOptions:e.appearanceManager.storiesListOptions})]})};class Dp{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:void 0}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storyLists",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"ugcStoryLists",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new Ql}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async setStoryList(e){await this.storyManager.waitStoryManagerConfig(),this.storyLists=e.slice(),this.render()}async setUGCStoryList(e){await this.storyManager.waitStoryManagerConfig(),this.ugcStoryLists=e.slice(),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){this.root.render((0,ed.jsx)(Rp,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,ugcStoryLists:this.ugcStoryLists,storyLists:this.storyLists,onAppearanceManagerChange:this.setAppearanceManager}))}createAppRoot(){const e=document.createElement("div");e.id="ias-app",document.body.append(e),this.root=(0,td.createRoot)(e)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(ql.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(ql.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}class Bp extends e.EventEmitter{constructor(e,t,r,i,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"sharePage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Jl(t),this.showSharePage(e,t,a)}async showSharePage(e,t,r){this.app.setAppearanceManager(t),this.sharePage=await this.storyManager.showSharePage(e,r)}async closeStoryReader(){var e;null===(e=this.sharePage)||void 0===e||e.closeStoryReader()}}class Fp extends e.default{constructor(e,t,r,i){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Jl(e),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new Mo(this.storyManager,{feed:t.feed}),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()}}class Np{constructor(e){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new Dp(Hl)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends Zl{constructor(e,t,r){super(e,t,r,Np.instance.app)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends Xl{constructor(e,t,r){super(e,t,r,Np.instance.app)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends Bp{constructor(e,t,r){super(e,t,Hl,Np.instance.app,r)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends Fp{constructor(e,t){super(e,t,Hl,Np.instance.app)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:new _o(Hl.inAppMessaging)}),Np.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),Np.instance):(Np.instance=this,this.app.setStoryManagerConfig(e),Np.instance)}get sdkVersionName(){return Hl.sdkVersionName}get sdkVersionCode(){return Hl.sdkVersionCode}set storyLinkClickHandler(e){Hl.storyLinkClickHandler=e}static getInstance(){return Np.instance?Np.instance:null}static use(e,t){Hl.use(e,t)}getConfig(){return Hl.getConfig()}async showOnboardingStories(e,t){return Jl(e),this.app.setAppearanceManager(e),Hl.showOnboardingStories(t)}async showStory(e,t){Jl(t),this.app.setAppearanceManager(t),await Hl.showStory(e)}async showStoryOnce(e,t){return Jl(t),this.app.setAppearanceManager(t),Hl.showStoryOnce(e)}closeAllReaders(){Hl.closeAllReaders()}async openGame(e,t,r={}){return Jl(t),this.app.setAppearanceManager(t),Hl.openGame(e,r)}async closeGame(){return Hl.closeGame()}async closeStoryReader(){return Hl.closeStoryReader()}getUgcEditorConfig(){return Hl.getUgcEditorConfig()}closeGoodsWidget(){Hl.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return Re()}async setUserId(e,t){this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setTags(e){this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(e,t){return Hl.on(e,t),this}once(e,t){return Hl.once(e,t),this}off(e,t){return Hl.off(e,t),this}destroy(){null!=Np.instance&&(Np.instance=null,this.closeAllReaders())}}})();var R=A.hS,D=A.KL,B=A.A7,F=A.Yb,N=A.Tg,U=A.WH,W=A.lV,z=A.IV,V=A.tP,G=A.h8,$=A.Xz,H=A.wS,q=A.VS,Q=A.oC,K=A.L8,Y=A.NL,J=A.Ez,Z=A.of,X=A.Hp,ee=A.MD,te=A._U,re=A.zC,ie=A.ws,ae=A.Jf,se=A.Jd,ne=A.SK,oe=A.tI,le=A.Uy,de=A.SP,ce=A.Jj,ue=A.pt,he=A.nN,pe=A.mk,ge=A.Vq,fe=A.ex,me=A.yx,ve=A.qz,be=A.h0,ye=A.KO;export{R as AppearanceCommonOptionsDefault,D as AppearanceManager,B as CTASource,F as CloseButtonPosition,N as GameReaderOptionsDefault,U as GoodsWidgetOptionsDefault,W as GoodsWidgetRenderingType,z as IamCheckDisplayTimeRangeError,V as IamFrequencyLimitError,G as IamMessageLimitExceededError,$ as IamMessageOpenError,H as IamNotFoundByEventError,q as IamNotFoundByIdError,Q as IamNotFoundLimitError,K as IamOtherReaderIsOpenError,Y as IamShowOnlyIfLoadedError,J as IasNetworkError,Z as InAppMessagingOptionsDefault,X as InAppStoryManager,ee as STORY_FEED_LIST,te as STORY_LIST_TYPE,re as STORY_READER_WINDOW_REFERER,ie as SharePageEvents,ae as SharePanelDefault,se as StoriesEvents,ne as StoriesListCardCoverQuality,oe as StoriesListCardTitlePosition,le as StoriesListCardTitleTextAlign,de as StoriesListCardViewVariant,ce as StoriesListDirection,ue as StoriesListEvents,he as StoriesListOptionsDefault,pe as StoriesListSliderAlign,ge as StoryActionSource,fe as StoryFavoriteReaderOptionsDefault,me as StoryReaderOptionsDefault,ve as StoryReaderSwipeStyle,be as TextDir,ye as WidgetStoriesOptions};
|
|
11
|
+
`:null}constructor(){super(...arguments),e.set(this,wh(this,y,void 0)),t.set(this,(wh(this,w),wh(this,S,void 0))),r.set(this,(wh(this,_),wh(this,O,!1))),i.set(this,(wh(this,C),wh(this,x,void 0))),a.set(this,(wh(this,k),wh(this,P,void 0))),s.set(this,(wh(this,j),wh(this,M,void 0))),n.set(this,(wh(this,E),wh(this,I,void 0))),wh(this,L)}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,Sh(l,"MessageViewFactory"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=b[Symbol.metadata])&&void 0!==e?e:null):void 0;d=[(0,zu.property)({type:Object})],c=[(0,zu.property)({type:Number})],u=[(0,zu.property)({type:Boolean})],h=[(0,zu.property)({type:Object})],p=[(0,zu.property)({type:Object})],g=[(0,zu.property)({type:Boolean})],f=[(0,zu.property)({type:String})],yh(l,null,d,{kind:"accessor",name:"appearanceOptions",static:!1,private:!1,access:{has:e=>"appearanceOptions"in e,get:e=>e.appearanceOptions,set:(e,t)=>{e.appearanceOptions=t}},metadata:t},y,w),yh(l,null,c,{kind:"accessor",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:t},S,_),yh(l,null,u,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},O,C),yh(l,null,h,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},x,k),yh(l,null,p,{kind:"accessor",name:"touchController",static:!1,private:!1,access:{has:e=>"touchController"in e,get:e=>e.touchController,set:(e,t)=>{e.touchController=t}},metadata:t},P,j),yh(l,null,g,{kind:"accessor",name:"desktopMode",static:!1,private:!1,access:{has:e=>"desktopMode"in e,get:e=>e.desktopMode,set:(e,t)=>{e.desktopMode=t}},metadata:t},M,E),yh(l,null,f,{kind:"accessor",name:"dir",static:!1,private:!1,access:{has:e=>"dir"in e,get:e=>e.dir,set:(e,t)=>{e.dir=t}},metadata:t},I,L),yh(null,o={value:l},m,{kind:"class",name:l.name,metadata:t},null,v),l=o.value,t&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(l,"styles",{enumerable:!0,configurable:!0,writable:!0,value:Wu.css``}),wh(l,v)})();const Ch=Wu.css`.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-link{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-link *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-answer{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-answer *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-data-input{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-data-input *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-input-container .rangeslider{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-poll-button{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-poll-button *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-answer{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-answer *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-rate-input{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-rate-input *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-next-button{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-range-slider-next-button *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-answer{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-answer *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-next-button,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-next-button{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-quiz-next-button *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-test-next-button *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-copy{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-copy *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-share{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-share *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-story-repeat{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-story-repeat *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-game{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-game *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target],.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type=closeStory]{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target],.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type=closeIAM]{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target] *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type=closeStory] *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-target] *,.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-image[data-link-type=closeIAM] *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up-items{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-swipe-up-items *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-next-button{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-vote-next-button *{pointer-events:none}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-barcode{pointer-events:all;cursor:pointer}.narrative-slide.narrative-slide .narrative-slide-elements .narrative-element-barcode *{pointer-events:none}`,xh=Wu.css`*{user-select:none;-moz-user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-user-drag:none;-webkit-tap-highlight-color:transparent}.narrative-slide-wrapper{position:absolute;left:0;right:0;top:0;bottom:0;width:100%;height:100%;overflow:hidden;border-top-right-radius:var(--slide-border-top-right-radius,0);border-top-left-radius:var(--slide-border-top-left-radius,0);border-bottom-right-radius:var(--slide-border-bottom-right-radius,0);border-bottom-left-radius:var(--slide-border-bottom-left-radius,0)}.narrative-slide-offset{position:relative}.narrative-slide-box{position:absolute;top:0;left:0;right:0;bottom:0}.narrative-slide-box-prerender{pointer-events:none;z-index:-1;opacity:0}.narrative-slide-box-rendered{pointer-events:all;z-index:1}.narrative-slide-offset-fullscreen .narrative-slide-background{height:100vh;position:fixed;top:0;left:0}`;var kh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Ph=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},jh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},Mh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Eh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i;let a,s,n,o,l,d,c=[(0,zu.customElement)("message-slide")],u=[],h=Wu.LitElement,p=[],g=[],f=[],m=[],v=[],b=[],y=[],w=[];s=class extends h{get slide(){return Mh(this,e,"f")}set slide(t){Eh(this,e,t,"f")}get styleContext(){return Mh(this,t,"f")}set styleContext(e){Eh(this,t,e,"f")}get geometry(){return Mh(this,r,"f")}set geometry(e){Eh(this,r,e,"f")}get slideContent(){return Mh(this,i,"f")}set slideContent(e){Eh(this,i,e,"f")}constructor(){super(),e.set(this,Ph(this,p,void 0)),t.set(this,(Ph(this,g),Ph(this,f,void 0))),r.set(this,(Ph(this,m),Ph(this,v,void 0))),i.set(this,(Ph(this,b),Ph(this,y,null))),Object.defineProperty(this,"fontFamilies",{enumerable:!0,configurable:!0,writable:!0,value:(Ph(this,w),"")})}get slideStyle(){return{margin:this.geometry.getOffset(),width:this.geometry.getWidth(),height:this.geometry.getHeight(),"--y-offset":this.geometry.getOffsetY(),"--x-offset":this.geometry.getOffsetX()}}aconnectedCallback(){super.connectedCallback()}firstUpdated(e){super.firstUpdated(e),this.initAndStartSlide()}disconnectedCallback(){super.disconnectedCallback(),this.slide.stop()}handleSlideClick(e){e.preventDefault(),e.stopPropagation();const t=e.target;this.slide.onClick(t)}async initAndStartSlide(){const e=this.slideContent;if(!e)throw new Error("[IAM]: no slide content");await this.slide.init(e),await this.slide.start()}render(){var e;const t=this.geometry instanceof pi,r=1/this.geometry.contentRatio*100;return Wu.html`<style nonce="${Be()}">${null!==(e=this.styleContext)&&void 0!==e?e:""}</style><div class="stories-viewer narrative-slide-wrapper" @click="${this.handleSlideClick}"><div class="${(0,Qu.classMap)({"narrative-slide-offset":!0,"narrative-slide-offset-fullscreen":t})}" style="${(0,qu.styleMap)(this.slideStyle)}"><div id="narrative-slide-box" class="narrative-slide-box" style="${(0,qu.styleMap)({fontSize:this.geometry.getFontSize(),padding:`${r}% 0 0 0`})}">${(0,rh.unsafeHTML)(this.slide.html)}</div></div></div>`}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,jh(s,"MessageSlide"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=h[Symbol.metadata])&&void 0!==e?e:null):void 0;n=[(0,zu.property)({type:Object})],o=[(0,zu.property)({type:String})],l=[(0,zu.property)({type:Object})],d=[(0,zu.query)("#narrative-slide-box")],kh(s,null,n,{kind:"accessor",name:"slide",static:!1,private:!1,access:{has:e=>"slide"in e,get:e=>e.slide,set:(e,t)=>{e.slide=t}},metadata:t},p,g),kh(s,null,o,{kind:"accessor",name:"styleContext",static:!1,private:!1,access:{has:e=>"styleContext"in e,get:e=>e.styleContext,set:(e,t)=>{e.styleContext=t}},metadata:t},f,m),kh(s,null,l,{kind:"accessor",name:"geometry",static:!1,private:!1,access:{has:e=>"geometry"in e,get:e=>e.geometry,set:(e,t)=>{e.geometry=t}},metadata:t},v,b),kh(s,null,d,{kind:"accessor",name:"slideContent",static:!1,private:!1,access:{has:e=>"slideContent"in e,get:e=>e.slideContent,set:(e,t)=>{e.slideContent=t}},metadata:t},y,w),kh(null,a={value:s},c,{kind:"class",name:s.name,metadata:t},null,u),s=a.value,t&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(s,"styles",{enumerable:!0,configurable:!0,writable:!0,value:[Ch,xh]}),Ph(s,u)})();const Ih=Wu.css`@keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.spinner{position:absolute;top:calc(50% - 2rem / 2);left:calc(50% - 2rem / 2);width:2rem;height:2rem;border-radius:50%;animation:spin .6s infinite linear}`;var Lh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Th=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Ah=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})};(()=>{let e,t,r=[(0,zu.customElement)("iam-spinner")],i=[],a=Wu.LitElement;t=class extends a{render(){const e="white";return Wu.html`<div class="spinner" style="${(0,qu.styleMap)({border:`solid 2px ${e}`,borderColor:`transparent ${e} ${e} ${e}`})}"></div>`}};Ah(t,"Spinner"),(()=>{var s;const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(s=a[Symbol.metadata])&&void 0!==s?s:null):void 0;Lh(null,e={value:t},r,{kind:"class",name:t.name,metadata:n},null,i),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),Object.defineProperty(t,"styles",{enumerable:!0,configurable:!0,writable:!0,value:Ih}),Th(t,i)})();var Rh=function(e,t,r,i,a,s){function n(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?i.static?e:e.prototype:null,u=t||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(n(e||null))};var m=(0,r[p])("accessor"===l?{get:u.get,set:u.set}:u[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=n(m.get))&&(u.get=o),(o=n(m.set))&&(u.set=o),(o=n(m.init))&&a.unshift(o)}else(o=n(m))&&("field"===l?a.unshift(o):u[d]=o)}c&&Object.defineProperty(c,i.name,u),h=!0},Dh=function(e,t,r){for(var i=arguments.length>2,a=0;a<t.length;a++)r=i?t[a].call(e,r):t[a].call(e);return i?r:void 0},Bh=function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})},Fh=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},Nh=function(e,t,r,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,r):a?a.value=r:t.set(e,r),r};(()=>{var e,t,r,i,a;let s,n,o,l,d,c,u,h=[(0,zu.customElement)("iam-reader"),Ee],p=[],g=Wu.LitElement,f=[],m=[],v=[],b=[],y=[],w=[],S=[],_=[],O=[],C=[];n=class extends g{get options(){return Fh(this,e,"f")}set options(t){Nh(this,e,t,"f")}get desktopMode(){return Fh(this,t,"f")}set desktopMode(e){Nh(this,t,e,"f")}get dir(){return Fh(this,r,"f")}set dir(e){Nh(this,r,e,"f")}get viewModel(){return Fh(this,i,"f")}set viewModel(e){Nh(this,i,e,"f")}get open(){return Fh(this,a,"f")}set open(e){Nh(this,a,e,"f")}constructor(){super(),e.set(this,Dh(this,f,{})),t.set(this,(Dh(this,m),Dh(this,v,!1))),r.set(this,(Dh(this,b),Dh(this,y,le.LTR))),i.set(this,(Dh(this,w),Dh(this,S,null))),a.set(this,(Dh(this,_),Dh(this,O,!0))),Object.defineProperty(this,"viewportController",{enumerable:!0,configurable:!0,writable:!0,value:(Dh(this,C),new Vu(this))}),this.handleKeydown=this.handleKeydown.bind(this)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.handleKeydown)}firstUpdated(){setTimeout((()=>{this.viewportController.calculateViewport()}),100)}handleKeydown(e){"Escape"===e.key&&(this.open=!1)}handleClosed(){this.open=!1,this.viewModel.close()}updated(e){var t;super.updated(e);const r=document.documentElement.style.overflow;(null===(t=this.viewModel)||void 0===t?void 0:t.activeMessage)?(this.open=!0,document.documentElement.style.overflow="hidden"):(this.open=!1,document.documentElement.style.overflow=r)}getMessageTypeByEnviroment(e){return this.desktopMode&&e===ii.Fullscreen?(console.warn("[IAM]: desktop only supports modal window"),ii.Modal):e}createSlideGeometry(e){return(new mi).create(e)}createMessageGeometry(e,t){return(new ci).create(e,{appearanceOptions:t,vw:this.viewportController.vw,vh:this.viewportController.vh,desktopMode:this.desktopMode})}render(){var e,t;const r=null===(e=this.viewModel)||void 0===e?void 0:e.activeMessage,i=null===(t=this.viewModel)||void 0===t?void 0:t.touchController;if(!r)return null;const a=r.type,s=this.createMessageGeometry(a,r.appearanceOptions),n=this.createSlideGeometry(s);return Wu.html`<message-view-factory type="${a}" @closed="${this.handleClosed}" .appearanceOptions="${r.appearanceOptions}" .geometry="${s}" .open="${this.open}" .dir="${this.dir}" .desktopMode="${this.desktopMode}" .touchController="${i}"><message-slide .slide="${r.slides[0]}" .styleContext="${r.context.style}" .geometry="${n}"></message-slide></message-view-factory>`}};e=new WeakMap,t=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,Bh(n,"InAppMessagingReader"),(()=>{var e;const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=g[Symbol.metadata])&&void 0!==e?e:null):void 0;o=[(0,zu.property)({type:Object})],l=[(0,zu.property)({type:Boolean})],d=[(0,zu.property)({type:String})],c=[(0,zu.property)({type:Object})],u=[(0,zu.state)()],Rh(n,null,o,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:t},f,m),Rh(n,null,l,{kind:"accessor",name:"desktopMode",static:!1,private:!1,access:{has:e=>"desktopMode"in e,get:e=>e.desktopMode,set:(e,t)=>{e.desktopMode=t}},metadata:t},v,b),Rh(n,null,d,{kind:"accessor",name:"dir",static:!1,private:!1,access:{has:e=>"dir"in e,get:e=>e.dir,set:(e,t)=>{e.dir=t}},metadata:t},y,w),Rh(n,null,c,{kind:"accessor",name:"viewModel",static:!1,private:!1,access:{has:e=>"viewModel"in e,get:e=>e.viewModel,set:(e,t)=>{e.viewModel=t}},metadata:t},S,_),Rh(n,null,u,{kind:"accessor",name:"open",static:!1,private:!1,access:{has:e=>"open"in e,get:e=>e.open,set:(e,t)=>{e.open=t}},metadata:t},O,C),Rh(null,s={value:n},h,{kind:"class",name:n.name,metadata:t},null,p),n=s.value,t&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),Object.defineProperty(n,"styles",{enumerable:!0,configurable:!0,writable:!0,value:Wu.css`.iam-container{position:fixed;inset:0;z-index:1000}`}),Dh(n,p)})();const Uh=e=>{const{storyManager:t,desktopMode:r,dir:i}=Gh(),a=(0,ad.useRef)(null);return(0,ad.useEffect)((()=>{const e=a.current;e.desktopMode=r,e.dir=i,e.viewModel=t.inAppMessaging}),[t,r]),(0,rd.jsx)("iam-reader",{ref:a})},Wh=ad.default.createContext({dir:le.LTR,storyManager:Ql,desktopMode:!1,commonOptions:D,storyReaderOptions:ee,gameReaderOptions:B,goodsWidgetOptions:N,inAppMessagingOptions:re});let zh=!1;const Vh=(0,Yd.observer)((e=>{Kh(e.config),Yh(e);const{commonOptions:t,gameReaderOptions:r,storyReaderOptions:i,goodsWidgetOptions:a,inAppMessagingOptions:s}=Jh(e),n=qh(),o=(({storyManager:e})=>{const[t,r]=(0,ad.useState)(null);return(0,ad.useEffect)((()=>{const t=e.createStoryReader();return r(t),()=>{t.destroy()}}),[e]),t})({storyManager:Ql}),l=sc({storyManager:Ql,desktopMode:n});(0,ad.useEffect)((()=>{if(zh)throw new Error("There can only be one instance of <IASContainer /> per application");return zh=!0,()=>{zh=!1,Ql.clearConfig()}}),[]);const d=(0,ad.useMemo)((()=>getComputedStyle(document.documentElement).direction),[]),c=(0,ad.useMemo)((()=>({storyManager:Ql,desktopMode:n,dir:d,commonOptions:t,gameReaderOptions:r,storyReaderOptions:i,goodsWidgetOptions:a,inAppMessagingOptions:s})),[Ql,n,d,t,r,i,a]);return(0,rd.jsxs)(Wh.Provider,{value:c,children:[(null==l?void 0:l.isOpened)&&(0,rd.jsx)(nc,{gameReader:l}),(null==o?void 0:o.isOpened)&&(0,rd.jsx)(Uu,{storyReader:o,desktopMode:n}),(0,rd.jsx)(Uh,{}),e.children]})})),Gh=()=>(0,ad.useContext)(Wh);const $h=(e=>{var t={};return A.d(t,e),t})({default:()=>M.default}),Hh=$h.default.getParser(window.navigator.userAgent).parse(),qh=()=>{const[e,t]=(0,ad.useState)(!1);(0,ad.useLayoutEffect)((()=>(r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)})),[]);const r=()=>{"mobile"===Hh.getPlatformType()?t(!1):t(!0)};return e},Qh=e=>{const t=t=>{27===t.keyCode&&e()};(0,ad.useEffect)((()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)})),[])},Kh=e=>{(0,ad.useEffect)((()=>{Ql.setConfig(e)}),[JSON.stringify(e)])},Yh=({onClickOnStory:e,onShowStory:t,onCloseStory:r,onShowSlide:i,onClickOnButton:a,onLikeStory:s,onDislikeStory:n,onFavoriteStory:o,onShareStory:l,onShareStoryWithPath:d,onFeedImpression:c,onVisibleAreaUpdated:u,onWidgetEvent:h})=>{(0,ad.useEffect)((()=>{const p=[{event:"clickOnStory",handler:e},{event:"showStory",handler:t},{event:"closeStory",handler:r},{event:"showSlide",handler:i},{event:"clickOnButton",handler:a},{event:"likeStory",handler:s},{event:"dislikeStory",handler:n},{event:"favoriteStory",handler:o},{event:"shareStory",handler:l},{event:"shareStoryWithPath",handler:d},{event:"feedImpression",handler:c},{event:"visibleAreaUpdated",handler:u},{event:"widgetEvent",handler:h}];return p.forEach((({event:e,handler:t})=>{t&&Ql.on(e,t)})),()=>{p.forEach((({event:e,handler:t})=>{t&&Ql.off(e,t)}))}}),[e,t,r,i,a,s,n,o,l,d,c,u,h])},Jh=({commonOptions:e,gameReaderOptions:t,storyReaderOptions:r,goodsWidgetOptions:i})=>{const a=(0,ad.useRef)(new Yl).current,s=(0,ad.useMemo)((()=>(e&&a.setCommonOptions(e),a.commonOptions)),[JSON.stringify(e)]),n=(0,ad.useMemo)((()=>(t&&a.setGameReaderOptions(t),a.gameReaderOptions)),[JSON.stringify(t)]),o=(0,ad.useMemo)((()=>(i&&a.setGoodsWidgetOptions(i),a.goodsWidgetOptions)),[JSON.stringify(i),null==i?void 0:i.itemClickHandler,null==i?void 0:i.openGoodsWidgetHandler]);return{commonOptions:s,gameReaderOptions:n,storyReaderOptions:(0,ad.useMemo)((()=>(r&&a.setStoryReaderOptions(r),a.storyReaderOptions)),[JSON.stringify(r)]),goodsWidgetOptions:o,inAppMessagingOptions:re}};var Zh=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Xh=e=>{var{listType:t,feedSlug:r,testKey:i,storyManager:a,options:s,filter:n,useUgcCard:o=!1,hasFavorite:l,isFavorite:d}=e,c=Zh(e,["listType","feedSlug","testKey","storyManager","options","filter","useUgcCard","hasFavorite","isFavorite"]);const[u,h]=(0,ad.useState)(),{desktopMode:p}=Gh(),{storyListOptions:g}=(e=>{const t=(0,ad.useRef)(new Yl).current;return{storyListOptions:(0,ad.useMemo)((()=>(e&&t.setStoriesListOptions(e),t.storiesListOptions)),[JSON.stringify(e)])}})(s),f=()=>{var e;null===(e=c.onLoadStart)||void 0===e||e.call(c)},m=e=>{var t;null===(t=c.onLoadEnd)||void 0===t||t.call(c,e)};return(0,ad.useEffect)((()=>{const e=a.createStoryList();return e.on("startLoading",f),e.on("endLoading",m),h(e),()=>{e.destroy()}}),[a]),(0,ad.useEffect)((()=>{u&&(u.setParams({listType:t,testKey:i,feedSlug:r,filter:n,useUgcCard:o,isFavorite:d,hasFavorite:l}),d||u.loadStories({needFavorite:!0}))}),[u,i,r,n]),(0,ad.useEffect)((()=>{u&&(u.modeDesktop=p)}),[p,u]),{storyListViewModel:u,storyListOptions:g}};const ep=(e=>{var t={};return A.d(t,e),t})({parseFont:()=>E.parseFont});const tp=(e=>{var t={};return A.d(t,e),t})({default:()=>I.default});class rp{constructor(){Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontVariant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontWeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lineHeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontFamily",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}toString(){return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${this.fontSize}px/${this.lineHeight} ${this.fontFamily.join(", ")}`}clone(){const e=new rp;return e.fontStyle=this.fontStyle,e.fontVariant=this.fontVariant,e.fontWeight=this.fontWeight,e.fontSize=this.fontSize,e.lineHeight=this.lineHeight,e.fontFamily=this.fontFamily.slice(),e}}class ip{constructor(e,t){Object.defineProperty(this,"obj",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cardTitleOptions",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"cardTitleFont",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cardTitleFont=this.getCardTitleParsedFont(t.font)}getCardTitleFont(){return this.cardTitleFont.clone()}getScaledFontSizeInWebView(){const e=this.measureScaledFontSizeInWebView(this.cardTitleFont.fontSize)/this.cardTitleFont.fontSize;return this.cardTitleFont.fontSize/e}getStoryTitleBlockHeight(){if(!this.isOutsideTitle())return 0;const e=this.cardTitleOptions.padding,t={top:0,bottom:0};try{if("number"==typeof e)t.top=e,t.bottom=e;else{const r=(0,tp.default)(e);t.top=parseFloat(r.top),t.bottom=parseFloat(r.bottom)}}catch(e){console.error(e)}const r=this.cardTitleOptions.lineClamp,i=Math.round(this.cardTitleFont.fontSize*this.cardTitleFont.lineHeight*100)/100;return t.top+t.bottom+r*i}measureScaledFontSizeInWebView(e){const t=document.createElement("span");t.style.fontSize=e+"px",t.style.display="none",this.obj.append(t);const r=getComputedStyle(t).fontSize;return this.obj.removeChild(t),parseFloat(r)||e}isOutsideTitle(){return this.cardTitleOptions.display&&(this.cardTitleOptions.position===G.CARD_OUTSIDE_TOP||this.cardTitleOptions.position===G.CARD_OUTSIDE_BOTTOM)}getCardTitleParsedFont(e){const t=new rp;t.fontStyle="normal",t.fontVariant="normal",t.fontWeight="normal",t.fontSize=14,t.lineHeight=1.2,t.fontFamily=["system-ui",'"Segoe UI"',"Roboto","Helvetica","Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"'];try{const r=(0,ep.parseFont)(e);if(null!=r["font-style"]&&(t.fontStyle=r["font-style"]),null!=r["font-variant"]&&(t.fontVariant=r["font-variant"]),null!=r["font-weight"]&&(t.fontWeight=r["font-weight"]),null!=r["font-size"]){const e=parseFloat(r["font-size"]);String(`${e}px`)===r["font-size"]&&(t.fontSize=e)}if(null!=r["line-height"]){const e=parseFloat(r["line-height"]);String(`${e}px`)===r["line-height"]?t.lineHeight=Math.round(e/t.fontSize*100)/100:String(e)===r["line-height"]&&(t.lineHeight=parseFloat(r["line-height"]))}null!=r["font-family"]&&Array.isArray(r["font-family"])&&(t.fontFamily=r["font-family"])}catch(e){console.error(e)}return t}}var ap=A(938),sp={insert:"head",singleton:!1};od()(ap.A,sp);const np=ap.A.locals||{},op=({slider:e,storyListViewModel:t,storyListOptions:r,isFavorite:i,listType:a,feed:s,filter:n,storyManager:o})=>{const l=(({storyManager:e,listType:t,feed:r,filter:i})=>{const[a,s]=(0,ad.useState)();return(0,ad.useEffect)((()=>{const a=new tl(e,{listType:t,feed:r,filter:i}).create();return s(a),()=>{a.destroy()}}),[r,JSON.stringify(i)]),a})({listType:a,feed:s,filter:n,storyManager:o}),d=(0,ad.useCallback)((0,za.default)((()=>{if(!e||!l)return;const{x:t,y:r}=e.getCurrentPosition();l.calculate(t,r)}),300),[e,l]),c=(0,ad.useCallback)((()=>{if(!e||!l)return;const t=e.elementRef.getBoundingClientRect(),r=new qo(t.left,t.top,t.width,t.height),i=Array.from(e.slides),a=new qo(0,0,window.innerWidth,window.innerHeight),s=u();l.updateGeometry({stories:i,storyListRect:r,windowRect:a,viewportPadding:s}),d()}),[e,l,d]);(0,ad.useEffect)((()=>{if(!e||i||!l)return;const t=l.startScroll.bind(l),r=l.endScroll.bind(l);return e.addListener("scrollstart",t),e.addListener("scrollend",r),window.addEventListener("scroll",c),window.addEventListener("resize",c),()=>{e.removeListener("scrollstart",t),e.removeListener("scrollend",r),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}}),[e,i,c]),(0,ad.useEffect)((()=>{!i&&e&&e.waitStoryListClientWidth().then((()=>{c()}))}),[e,r.direction,r.card.aspectRatio,r.card.height,t.stories,i,c]),(0,ad.useEffect)((()=>{if(!l)return;const e=({id:e})=>l.markStoryAsFullVisible(e);return vi.on("publicEvents.showStory",e),()=>{vi.off("publicEvents.showStory",e)}}),[l,t]);const u=()=>{const e=r.sidePadding,t={left:e,right:e,top:r.topPadding,bottom:r.bottomPadding};return"vertical"===r.direction&&(t.left=0,t.right=0),t}},lp=(e,t,r)=>{const{dir:i}=Gh();(0,ad.useEffect)((()=>{if(e&&t.autoScrollOnStoryClose)return vi.on(Qn.Close,a),()=>{vi.off(Qn.Close,a)}}),[e,t.direction,t.autoScrollOnStoryClose]);const a=({id:a})=>{if(!e)return;const s=((e,t)=>e.slides.find((e=>Number(e.dataset.id)===t)))(e,a);if(!s)return;const n=(e=>{const{x:t,y:i}=e.getCurrentPosition(),a=r.current.getBoundingClientRect();return new qo(a.x+t,a.y+i,a.width,a.height)})(e),o=((e,t)=>new qo(i===le.LTR?e.offsetLeft:t.width-e.offsetLeft-e.clientWidth,e.offsetTop,e.clientWidth,e.clientHeight))(s,n);if(o.overlaps(n))return;const l="horizontal"===t.direction?o.x:s.offsetTop;e.scrollTo(l)}},dp=(0,ad.forwardRef)(((e,t)=>{const r=e.sliderOptions.card,i=e.sliderOptions.favoriteCard,a=r.border,s=r.opened.border,n=e.sliderOptions.navigation,o=()=>{var e,t,r;return(null!==(e=s.radius)&&void 0!==e?e:a.radius)-parseFloat(null!==(t=s.width)&&void 0!==t?t:a.width)-parseFloat(null!==(r=s.gap)&&void 0!==r?r:a.gap)};return(0,rd.jsx)("div",{dir:e.dir,ref:t,className:e.className,style:Object.assign(Object.assign({},(()=>{var t,l,d,c,u,h,p,g,f,m,v,b,y,w,S,_,O,C,x,k,P;const j=e=>{let t="";return null!=e&&Array.isArray(e.linearGradient)&&(t=e.linearGradient.map((({direction:e,points:t})=>`linear-gradient(${[e,t].filter(Boolean).join(", ")})`)).join(", ")),t},M={"--storiesBorderNotReadColor":a.color,"--storiesBorderReadColor":null!==(t=s.color)&&void 0!==t?t:a.color,"--storiesBorderNotReadGradientColor":null==a?void 0:a.gradient,"--storiesBorderReadGradientColor":null!==(l=null==s?void 0:s.gradient)&&void 0!==l?l:null==a?void 0:a.gradient,"--storiesListCardFavoriteGradientColor":null===(d=e.sliderOptions.favoriteCard.border)||void 0===d?void 0:d.gradient,"--storiesListCardUgcGradientColor":null===(c=e.sliderOptions.ugcCard.border)||void 0===c?void 0:c.gradient,"--storiesGap":r.gap+"px","--storiesHeight":r.height+"px","--storiesListSidePadding":e.sliderOptions.sidePadding+"px","--storiesListBorderNotReadWidth":a.width+"px","--storiesListBorderReadWidth":(null!==(u=s.width)&&void 0!==u?u:s.width)+"px","--storiesListBorderGapNotRead":a.gap+"px","--storiesListBorderGapRead":(null!==(h=s.gap)&&void 0!==h?h:s.gap)+"px","--storiesListBorderRadius":a.radius+"px","--storiesListBorderRadiusRead":(null!==(p=s.radius)&&void 0!==p?p:s.radius)+"px","--storiesListItemMaskColor":r.mask.color,"--storiesListItemOpenedMaskColor":null!==(g=r.opened.mask.color)&&void 0!==g?g:r.mask.color,"--storiesListItemMaskLinearGradient":j(r.mask),"--storiesListItemOpenedMaskLinearGradient":j(null!=(null===(m=null===(f=r.opened)||void 0===f?void 0:f.mask)||void 0===m?void 0:m.linearGradient)?r.opened.mask:r.mask),"--storiesListCardFavoriteTitle":Pe(i.title.padding.toString())?i.title.padding+"px":i.title.padding,"--storiesListCardFavoriteGap":Pe(i.gap.toString())?i.gap+"px":i.gap,"--storiesListCardUgcMaskColor":e.sliderOptions.ugcCard.mask.color,"--storiesListCardUgcMaskLinearGradient":j(e.sliderOptions.ugcCard.mask),"--storiesListItemTitleFontFamily":"InternalPrimaryFont","--storiesListItemTitleFont":r.title.font,"--storiesListItemTitlePadding":Pe(r.title.padding.toString())?r.title.padding+"px":r.title.padding,"--storiesListControlsSize":Pe(n.controlsSize.toString())?n.controlsSize+"px":n.controlsSize,"--storiesListControlsBackgroundColor":n.controlsBackgroundColor,"--storiesListControlsColor":n.controlsColor,"--storiesListInnerBorderRadiusNotRead":a.radius-parseFloat(a.width)-parseFloat(a.gap)+"px","--storiesListInnerBorderRadiusRead":o()+"px","--storiesListCardDropShadow":r.dropShadow,"--storiesListCardOpenedDropShadow":null!==(v=r.opened.dropShadow)&&void 0!==v?v:r.dropShadow,"--storiesListCardFavoriteDropShadow":e.sliderOptions.favoriteCard.dropShadow,"--storiesListCardUgcDropShadow":e.sliderOptions.ugcCard.dropShadow,"--storiesListCardMask":(null===(b=r.svgMask)||void 0===b?void 0:b.cardMask)?`url("data:image/svg+xml,${Ae(null===(y=r.svgMask)||void 0===y?void 0:y.cardMask)}")`:null,"--storiesListCardOpenedMask":(null===(w=r.opened.svgMask)||void 0===w?void 0:w.cardMask)?`url("data:image/svg+xml,${Ae(null===(S=r.opened.svgMask)||void 0===S?void 0:S.cardMask)}")`:null,"--storiesListCardFavoriteMask":(null===(_=e.sliderOptions.ugcCard.svgMask)||void 0===_?void 0:_.cardMask)?`url("data:image/svg+xml,${Ae(null===(O=e.sliderOptions.ugcCard.svgMask)||void 0===O?void 0:O.cardMask)}")`:null};let E=null;return E=null===(C=r.svgMask)||void 0===C?void 0:C.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Ae(e.mask)}")`:null)),E=null===(x=r.opened.svgMask)||void 0===x?void 0:x.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardOpenedOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Ae(e.mask)}")`:null)),E=null===(k=e.sliderOptions.favoriteCard.svgMask)||void 0===k?void 0:k.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardFavoriteOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Ae(e.mask)}")`:null)),E=null===(P=e.sliderOptions.ugcCard.svgMask)||void 0===P?void 0:P.overlayMask,null!=E&&Array.isArray(E)&&E.forEach(((e,t)=>M[`--storiesListCardUgcOverlay${t}Mask`]=e.mask?`url("data:image/svg+xml,${Ae(e.mask)}")`:null)),M})()),e.style),children:e.children})})),cp=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"),up=({videoCoverSrc:e,onVideoCoverLoaded:t})=>{const r=(0,ad.useRef)(null);return(0,ad.useEffect)((()=>{(()=>{if(!e)return;const i=r.current,a=()=>{i.play().then((()=>{if(cp){let e=1;const r=()=>{e>=2&&(i.removeEventListener("timeupdate",r),i.currentTime=0,t()),e++};i.addEventListener("timeupdate",r,!1)}else t()})).catch((e=>{console.error(e)})),i.removeEventListener("canplaythrough",a)};i.addEventListener("canplaythrough",a),i.load()})()}),[]),(0,rd.jsx)("video",{ref:r,src:e,loop:!0,muted:!0,playsInline:!0,"webkit-playsinline":"true",preload:"auto"})},hp=({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{const a=(e,t)=>null!=t&&Array.isArray(t)?t.map(((t,r)=>s(t,e,r))):[],s=(e,t,r)=>({maskImage:`var(--${t}${r}Mask)`,WebKitMaskImage:`var(--${t}${r}Mask)`,background:e.background});return{getAllCardsOverlayMaskStyles:()=>{let s=[];var n;return e instanceof $o&&(s=s.concat(a("storiesListCardFavoriteOverlay",null===(n=r.svgMask)||void 0===n?void 0:n.overlayMask))),s=e instanceof Ao?s.concat((()=>{var e;return a("storiesListCardUgcOverlay",null===(e=i.svgMask)||void 0===e?void 0:e.overlayMask)})()):e.isOpened?s.concat((()=>{var e;return a("storiesListCardOpenedOverlay",null===(e=t.opened.svgMask)||void 0===e?void 0:e.overlayMask)})()):s.concat((()=>{var e;return a("storiesListCardOverlay",null===(e=t.svgMask)||void 0===e?void 0:e.overlayMask)})()),s}}};var pp=A(811),gp={insert:"head",singleton:!1};od()(pp.A,gp);const fp=pp.A.locals||{},mp=(0,Yd.observer)((({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i,wrapperStyle:a,children:s,onClick:n})=>{const o={story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i},[l,d]=(0,ad.useState)(!1),{getAllCardsOverlayMaskStyles:c}=hp(o),{getCardTitleAlignClass:u,getTitleStyle:h,getTitleWrapperStyle:p}=(({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{const{dir:a}=Gh();return{getCardTitleAlignClass:()=>{const e=t.title.textAlign,r=e===V.START||e===V.LEFT,i=e===V.END||e===V.RIGHT,s=a===le.LTR;return{[fp["align-left"]]:r&&s||i&&!s,[fp["align-center"]]:e===V.CENTER,[fp["align-right"]]:i&&s||r&&!s}},getTitleStyle:()=>{const r={};return e.titleColor&&t.title.position===G.CARD_INSIDE_BOTTOM&&Object.assign(r,{color:e.titleColor}),r.WebkitLineClamp=String(parseInt(t.title.lineClamp)),r},getTitleWrapperStyle:()=>{let t={};return e.titleColor&&e instanceof $o&&(t=Object.assign(Object.assign({},t),{color:r.title.color})),e.titleColor&&e instanceof Ao&&(t=Object.assign(Object.assign({},t),{color:i.title.color})),t}}})(o),{getSlideClassList:g,getSlideStyleList:f,getSlideWrapperStyle:m}=(({story:e,cardOptions:t,favoriteCardOptions:r,ugcCardOptions:i})=>{var a;const s=null!==(a=t.aspectRatio)&&void 0!==a?a:e.getAspectRatio(t.variant);return{getSlideClassList:()=>{var a,s;const n=e.background;let o="";void 0!==n&&(o=fp[`_background-color-${n.color}`+(!0===n.gradient?"-gradient":"")]);const l=(()=>{let a;return a=e instanceof $o?r:e instanceof Ao?i:e.isOpened&&t.opened||t,a})(),d=Boolean(l.dropShadow),c=Boolean(null===(a=l.svgMask)||void 0===a?void 0:a.cardMask),u=Boolean(null===(s=l.border)||void 0===s?void 0:s.gradient);return[o,{[fp["_is-read"]]:e.isOpened},{[fp["_format-rectangle"]]:t.variant===te.STYLE_RECTANGLE},{[fp["_format-circle"]]:t.variant===te.STYLE_CIRCLE},{[fp["_format-quad"]]:t.variant===te.STYLE_QUAD},{[fp["_favorite-cell"]]:e instanceof $o},{[fp["_ugc-cell"]]:e instanceof Ao},{[fp["_has-drop-shadow"]]:d},{[fp["_has-card-svg-mask"]]:c},{[fp["_has-border-gradient-color"]]:u}]},getSlideStyleList:()=>{const r={width:s*t.height+"px",opacity:null!==t.opacity?t.opacity:1,boxShadow:t.boxShadow||"unset",height:`${t.height}px`};return e.isOpened&&(r.boxShadow=t.opened.boxShadow||r.boxShadow,r.opacity=null!==t.opened.opacity?t.opened.opacity:r.opacity),r},getSlideWrapperStyle:()=>{const e={};return e.width=s*t.height+"px",e}}})(o),v=e.getImageSrcByCoverQuality(t.coverQuality),b=t.title.position===G.CARD_INSIDE_BOTTOM,y=t.title.position===G.CARD_OUTSIDE_TOP,w=t.title.position===G.CARD_OUTSIDE_BOTTOM;return(0,rd.jsxs)("div",{"data-id":e.id,className:(0,sd.default)("ias-stories-slide-wrapper",fp["stories-slide-wrapper"],{[fp.isTitleCardOutsideTop]:y,[fp.isTitleCardOutsideBottom]:w}),style:Object.assign(Object.assign({},m()),a),rel:"noreferrer",onClick:t=>{t.stopPropagation(),t.preventDefault(),n(e)},children:[t.title.display&&y&&(0,rd.jsx)("div",{className:(0,sd.default)(fp["stories-slide__content"],fp.__position_outside_top),style:p(),children:(0,rd.jsx)("div",{className:(0,sd.default)(fp["stories-slide__title"],fp.clamp,u()),style:h(),children:e.title})}),(0,rd.jsxs)("div",{className:(0,sd.default)("ias-stories-slide",fp["stories-slide"],g()),style:f(),children:[(0,rd.jsxs)("div",{className:fp["stories-slide__inner"],children:[(0,rd.jsx)("div",{className:fp["stories-slide-image"],style:{backgroundColor:e.backgroundColor?e.backgroundColor:"transparent"},children:(0,rd.jsx)("div",{className:fp["stories-slide-image__wrap"],children:(0,rd.jsxs)("div",{className:(0,sd.default)(fp["stories-slide-image__image"],fp._mode_list,{[fp["video-loaded"]]:l,[fp["ugc-card-cell"]]:e instanceof Ao}),children:[v&&(0,rd.jsx)("img",{src:v,alt:e.title,loading:t.coverLazyLoading?"lazy":"eager"},v),e.videoCoverSrc&&(0,rd.jsx)(up,{onVideoCoverLoaded:()=>d(!0),videoCoverSrc:e.videoCoverSrc}),s]})})}),(0,rd.jsx)("div",{className:fp["stories-slide__mask"]}),t.title.display&&b&&(0,rd.jsx)("div",{className:fp["stories-slide__content"],style:p(),children:(0,rd.jsx)("div",{className:(0,sd.default)(fp["stories-slide__title"],fp.clamp,u()),style:h(),children:e.title})})]}),c().map(((e,t)=>(0,rd.jsx)("div",{style:e,className:fp["card-overlay-svg-mask"]},t)))]}),t.title.display&&w&&(0,rd.jsx)("div",{className:(0,sd.default)(fp["stories-slide__content"],fp.__position_outside_bottom),style:p(),children:(0,rd.jsx)("div",{className:(0,sd.default)(fp["stories-slide__title"],fp.clamp,u()),style:h(),children:e.title})})]})}));var vp=A(731),bp={insert:"head",singleton:!1};od()(vp.A,bp);const yp=vp.A.locals||{};var wp=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Sp=e=>{var{sliderDirection:t,slider:r}=e,i=wp(e,["sliderDirection","slider"]);const[a,s]=(0,ad.useState)(!0),[n,o]=(0,ad.useState)(!0),l=i.navigationOptions.speed;(0,ad.useEffect)((()=>(r.on("reachStart",d),r.on("reachEnd",c),()=>{r.off("reachStart",d),r.off("reachEnd",c)})),[r]);const d=()=>{s(r.reachStart)},c=()=>{o(r.reachEnd)};return i.navigationView?i.navigationView({dir:i.dir,defaultStyles:yp,reachStart:a,reachEnd:n,onPrev:()=>r.scrollByDirection(-1,l),onNext:()=>r.scrollByDirection(1,l),slider:{direction:t,viewport:r.elementRef.getBoundingClientRect()}}):i.navigationOptions.showControls?(0,rd.jsxs)("div",{className:(0,sd.default)("ias-stories-list-controls",yp["stories-list-controls"],yp[t]),children:[(0,rd.jsx)("div",{onClick:()=>r.scrollByDirection(-1,l),className:(0,sd.default)("ias-control-start",yp["control-start"],{[yp["control-start_dir_rtl"]]:"rtl"===i.dir,[yp["control-start_reach-start"]]:a,"ias-control-start_dir_rtl":"rtl"===i.dir,"ias-control-start_reach-start":a}),children:(0,rd.jsx)("div",{className:(0,sd.default)("ias-control-icon",yp["control-icon"])})}),(0,rd.jsx)("div",{onClick:()=>r.scrollByDirection(1,l),className:(0,sd.default)("ias-control-end",yp["control-end"],{[yp["control-end_dir_rtl"]]:"rtl"===i.dir,[yp["control-end_reach-end"]]:n,"ias-control-end_dir_rtl":"rtl"===i.dir,"ias-control-end_reach-end":n}),children:(0,rd.jsx)("div",{className:(0,sd.default)("ias-control-icon",yp["control-icon"])})})]}):null};var _p=A(533),Op={insert:"head",singleton:!1};od()(_p.A,Op);const Cp=_p.A.locals||{},xp=({favoriteStories:e,cardOptions:t,favoriteCardOptions:r})=>{const i=e=>{var r;return{paddingTop:1/(null!==(r=t.aspectRatio)&&void 0!==r?r:e.getAspectRatio(t.variant))*100+"%"}},a=e=>{const t=e.getImageSrcByCoverQuality(r.coverQuality),i={};return t?i.backgroundImage=`url('${t}')`:i.backgroundColor=e.backgroundColor,i};return(0,rd.jsx)("div",{className:Cp["favorite-images-wrapper"],children:e.slice(0,4).map(((e,r)=>(0,rd.jsx)("div",{className:Cp["favorite-image-wrapper"],children:(0,rd.jsx)("div",{style:i(e),className:(0,sd.default)(Cp["favorite-image"],{[Cp.circle_style]:t.variant===te.STYLE_CIRCLE}),children:(0,rd.jsx)("div",{className:Cp["favorite-image-item"],style:a(e)})})},r)))})};var kp=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]])}return r};const Pp=(0,Yd.observer)((0,ad.forwardRef)(((e,t)=>{var{isFavorite:r=!1,storyListViewModel:i}=e,a=kp(e,["isFavorite","storyListViewModel"]);const s=(0,ad.useRef)(null),n=(0,ad.useRef)(null);((e,t)=>{(0,ad.useImperativeHandle)(e,(()=>({reload:t.reload.bind(t)})),[t])})(t,i);const o=((e,t)=>{const[r,i]=(0,ad.useState)(t);(0,ad.useLayoutEffect)((()=>{const r=e.current;a(r,t),i(t)}),[JSON.stringify(t)]);const a=(e,t)=>{const r=new ip(e,t.card.title);s(r,t)},s=(e,t)=>{const r=e.getCardTitleFont();r.fontSize=e.getScaledFontSizeInWebView(),t.card.title.font=r.toString()};return r})(s,a.storyListOptions),{sliderRef:l,slider:d,isScrolling:c}=((e,t)=>{const{dir:r,desktopMode:i}=Gh(),a=(0,ad.useRef)(null),s=(0,ad.useRef)(null),[n,o]=(0,ad.useState)(!1),[l,d]=(0,ad.useState)(null),c=()=>{clearTimeout(a.current),o(!0)},u=()=>{a.current=setTimeout((()=>o(!1)),100)},h=(0,ad.useCallback)((()=>{if(!l)return;const{x:e,y:t}=l.getCurrentPosition();l.testAttraction(e,t)}),[l]);return(0,ad.useEffect)((()=>{if(!s.current)return;const e=new Ha;return e.mount(s.current),d(e),e.on("scrollstart",c),e.on("scrollend",u),()=>{e.destroy(),e.off("scrollstart",c),e.off("scrollend",u)}}),[]),(0,ad.useEffect)((()=>{l&&(l.setGap(e.card.gap),l.setDesktopMode(i),l.changeDirection(e.direction))}),[l,e.card.gap,i,e.direction]),(0,ad.useEffect)((()=>{l&&(l.setTextDirection(r),l.scrollTo(0,0))}),[l,r]),(0,ad.useEffect)((()=>{l&&(l.scrollTo(0,0),(async(e,t)=>{t>0&&await e.waitStoryListClientWidth();const{x:r,y:i}=e.getCurrentPosition();e.testAttraction(r,i)})(l,t))}),[l,t]),(0,ad.useEffect)((()=>(window.addEventListener("resize",h),()=>{window.addEventListener("resize",h)})),[l,h]),{sliderRef:s,slider:l,isScrolling:n}})(o,i.stories.length);op({slider:d,storyListViewModel:i,storyListOptions:o,isFavorite:r,listType:a.listType,feed:a.feedSlug,filter:a.filter,storyManager:a.storyManager}),lp(d,o,n);const{getRootStyle:u,getStoryWrapperStyle:h,viewportInnerClassList:p,viewportInnerStyle:g}=(e=>{const{dir:t,desktopMode:r}=Gh();return{getRootStyle:()=>({"--background-color":e.layout.backgroundColor,paddingLeft:e.sidePadding+"px",paddingRight:e.sidePadding+"px","--storiesListTopPadding":e.topPadding+"px","--storiesListBottomPadding":e.bottomPadding+"px","--storiesListSidePadding":e.sidePadding+"px",backgroundColor:e.layout.backgroundColor}),getStoryWrapperStyle:(t,r)=>{const i={marginRight:"0",paddingLeft:"0",paddingRight:"0"};return"vertical"===e.direction||(t!==r-1?i.marginRight=e.card.gap+"px":i.paddingRight=e.sidePadding+"px",0===t&&(i.paddingLeft=e.sidePadding+"px")),i},viewportInnerClassList:r?(0,sd.default)(np["stories-list__viewport-inner"],np["mode-desktop"],{[np["with-list-controls"]]:e.navigation.showControls,[np.isTitleCardOutsideTop]:e.card.title.position===G.CARD_OUTSIDE_TOP,[np.isTitleCardOutsideBottom]:e.card.title.position===G.CARD_OUTSIDE_BOTTOM,[np.isVerticalDirection]:"vertical"===e.direction}):(0,sd.default)(np["stories-list__viewport-inner"],Object.assign(Object.assign({},(()=>{const r=e.layout.sliderAlign,i=r===W.START||r===W.LEFT,a=r===W.END||r===W.RIGHT,s=t===le.LTR;return{[np["align-left"]]:i&&s||a&&!s,[np["align-center"]]:r===W.CENTER,[np["align-right"]]:a&&s||i&&!s}})()),{[np.isTitleCardOutsideTop]:e.card.title.position===G.CARD_OUTSIDE_TOP,[np.isTitleCardOutsideBottom]:e.card.title.position===G.CARD_OUTSIDE_BOTTOM,[np.isVerticalDirection]:"vertical"===e.direction})),viewportInnerStyle:{height:e.layout.height,gap:"vertical"===e.direction?`${e.card.gap}px`:0}}})(o),f=o.card,m=o.favoriteCard,v=o.ugcCard;(0,ad.useLayoutEffect)((()=>{i.setFavoriteCardOptions(m),i.setUgcCardOptions(v)}),[i,m,v]);return(0,rd.jsxs)(dp,{className:(0,sd.default)("ias-stories-list-wrapper",np["stories-list-wrapper"],{[np["mode-desktop"]]:i.modeDesktop,[np["with-list-controls"]]:o.navigation.showControls,"ias-mode-desktop":i.modeDesktop,"ias-with-list-controls":o.navigation.showControls}),dir:a.dir,style:u(),sliderOptions:o,ref:s,children:[(0,rd.jsx)("div",{className:(0,sd.default)("ias-stories-list",np["stories-list"]),children:(0,rd.jsx)("div",{ref:n,className:(0,sd.default)(np["stories-list__viewport"],{[np["mode-desktop"]]:i.modeDesktop,"ias-mode-desktop":i.modeDesktop}),style:"horizontal"===o.direction?{marginLeft:-o.sidePadding+"px",marginRight:-o.sidePadding+"px"}:{},children:(0,rd.jsx)("div",{ref:l,className:p,style:g,children:i.stories.map(((e,t)=>{var r;const s=e instanceof $o,n=a.storyCardView&&!s;return s&&a.favoriteCardView?(0,rd.jsx)(ad.default.Fragment,{children:a.favoriteCardView(e)},e.id):(0,rd.jsx)(ad.default.Fragment,{children:n?null===(r=a.storyCardView)||void 0===r?void 0:r.call(a,e):(0,rd.jsx)(mp,{story:e,cardOptions:f,favoriteCardOptions:m,ugcCardOptions:v,wrapperStyle:h(t,i.stories.length),onClick:()=>((e,t)=>{var r,s,n;c||(null===(r=a.onStoryCardClick)||void 0===r||r.call(a,e),e instanceof Ao?null===(s=a.onUgcCardClick)||void 0===s||s.call(a):e instanceof $o?null===(n=a.onFavoriteCardClick)||void 0===n||n.call(a):i.onStoryClick(e,t))})(e,t),children:s&&(0,rd.jsx)(xp,{favoriteStories:e.favoriteStories,favoriteCardOptions:o.favoriteCard,cardOptions:f})},e.id)},e.id)}))})})}),d&&(0,rd.jsx)(Sp,{dir:a.dir,navigationOptions:o.navigation,navigationView:a.navigationView,sliderDirection:o.direction,storiesLength:i.stories.length,slider:d})]})}))),jp=(0,Yd.observer)((0,ad.forwardRef)(((e,t)=>{var r,i,a;const{storyManager:s,dir:n}=Gh(),o=null!==(r=e.feedSlug)&&void 0!==r?r:"default",l=Dt.DEFAULT,{storyListViewModel:d,storyListOptions:c}=Xh(Object.assign(Object.assign({},e),{storyManager:s,feedSlug:o,listType:l,hasFavorite:Boolean(e.hasFavorite),isFavorite:!1}));return d&&(null===(i=d.session)||void 0===i?void 0:i.id)?(0,rd.jsx)(Pp,Object.assign({},e,{dir:n,storyManager:s,feedSlug:null!==(a=e.feedSlug)&&void 0!==a?a:"default",listType:Dt.DEFAULT,storyListViewModel:d,storyListOptions:c,onStoryCardClick:e.onStoryCardClick,onFavoriteCardClick:()=>{var t;s.emit("clickOnFavoriteCell",{feed:o}),null===(t=e.onFavoriteCardClick)||void 0===t||t.call(e)},ref:t})):null}))),Mp=(0,Yd.observer)((0,ad.forwardRef)(((e,t)=>{var r;const{storyManager:i,dir:a}=Gh(),s=Ht,n=Dt.UGC,{storyListViewModel:o,storyListOptions:l}=Xh(Object.assign(Object.assign({},e),{storyManager:i,feedSlug:s,listType:n,isFavorite:!1,hasFavorite:!1}));return o&&(null===(r=o.session)||void 0===r?void 0:r.id)?(0,rd.jsx)(Pp,Object.assign({},e,{ref:t,dir:a,storyListOptions:l,storyManager:i,listType:Dt.UGC,feedSlug:Ht,storyListViewModel:o,onStoryCardClick:e.onStoryCardClick})):null}))),Ep=e=>{const{storyManager:t,dir:r}=Gh(),i=zt,a=Dt.FAVORITE,{storyListViewModel:s,storyListOptions:n}=Xh(Object.assign(Object.assign({},e),{storyManager:t,feedSlug:i,listType:a,isFavorite:!0,hasFavorite:!0}));return s?(0,rd.jsx)(Pp,Object.assign({},e,{storyListOptions:n,storyManager:t,dir:r,feedSlug:i,listType:a,storyListViewModel:s,isFavorite:!0})):null};var Ip=A(432),Lp={insert:"head",singleton:!1};od()(Ip.A,Lp);const Tp=Ip.A.locals||{},Ap=({open:e,options:t,storyListOptions:r,onClose:i})=>{var a,s;const{dir:n}=Gh();(0,ad.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,rd.jsx)("div",{className:Tp["favorite-story-list-modal"],style:(()=>{var e,r,i,a;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!==(a=null===(i=t.bottomOffset)||void 0===i?void 0:i.toString())&&void 0!==a?a:"0")+"px","--storiesFavoriteBackgroundColor":t.backgroundColor}})(),children:(0,rd.jsxs)("div",{className:Tp.container,children:[(0,rd.jsxs)("div",{className:Tp.header,children:[(0,rd.jsx)("p",{className:Tp.title,children:t.title.content}),(0,rd.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),i()},className:Tp["header__close-btn"],style:(()=>{const e="start"===t.closeButtonPosition||"left"===t.closeButtonPosition,r=n===le.LTR;return{[e&&r||!e&&!r?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(s=null===(a=t.closeButton)||void 0===a?void 0:a.svgSrc.baseState)&&void 0!==s?s:""}})]}),(0,rd.jsx)("div",{className:Tp.content,children:(0,rd.jsx)("div",{className:Tp["favorite-story-list"],children:(0,rd.jsx)(Ep,{options:Object.assign(Object.assign(Object.assign({},r),{sidePadding:0}),{direction:H.COLUMN,layout:{height:"auto"}})})})}),(0,rd.jsx)("div",{className:Tp.footer}),(0,rd.jsx)("div",{className:Tp["bottom-offset"]})]})}):null},Rp=({storyList:e,onStoryCardClick:t,onFavoriteCardClick:r})=>{const[i,a]=(0,ad.useState)(e.appearanceManager.storiesListOptions),s=(0,ad.useRef)(null),n=document.querySelector(e.mountSelector);return(0,ad.useEffect)((()=>{e.api=s.current}),[]),(0,ad.useEffect)((()=>(e.appearanceManager.on(Kl.EVENT_UPDATED_STORIES_LIST_OPTIONS,a),()=>{e.appearanceManager.off(Kl.EVENT_UPDATED_STORIES_LIST_OPTIONS,a)})),[e.appearanceManager]),(0,ad.useEffect)((()=>{n||(console.warn(`[IAS]: Unsafe destruction of story feed with ID ${e.mountSelector}. You must call destroy() on StoriesList instance.`),e.destroy())}),[n,e]),n?(0,Jd.createPortal)((0,rd.jsx)(jp,{ref:s,options:i,hasFavorite:e.appearanceManager.commonOptions.hasFavorite,testKey:e.testKey,useUgcCard:e.useUgcCard,feedSlug:e.feedSlug,onLoadStart:()=>{e.emit(q.START_LOADER)},onLoadEnd:t=>{e.emit(q.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()},onFavoriteCardClick:r,onStoryCardClick:t},e.mountSelector),n):null},Dp=({ugcStoryList:e,onStoryCardClick:t})=>{const[r,i]=(0,ad.useState)(e.appearanceManager.storiesListOptions),a=(0,ad.useRef)(null),s=document.querySelector(e.mountSelector);return(0,ad.useEffect)((()=>{e.api=a.current}),[]),(0,ad.useEffect)((()=>(e.appearanceManager.on(Kl.EVENT_UPDATED_STORIES_LIST_OPTIONS,i),()=>{e.appearanceManager.off(Kl.EVENT_UPDATED_STORIES_LIST_OPTIONS,i)})),[e.appearanceManager]),(0,ad.useEffect)((()=>{s||(console.warn(`[IAS]: Unsafe destruction of story feed with ID ${e.mountSelector}. You must call destroy() on UGCStoriesList instance.`),e.destroy())}),[s,e]),s?(0,Jd.createPortal)((0,rd.jsx)(Mp,{ref:a,options:r,testKey:e.testKey,useUgcCard:e.useUgcCard,onStoryCardClick:t,onLoadStart:()=>{e.emit(q.START_LOADER)},onLoadEnd:t=>{e.emit(q.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()}}),s):null},Bp=e=>{const[t,r]=(0,ad.useState)(!1);return(0,rd.jsxs)(Vh,{config:e.storyManagerConfigDto,storyReaderOptions:e.appearanceManager.storyReaderOptions,commonOptions:e.appearanceManager.commonOptions,gameReaderOptions:e.appearanceManager.gameReaderOptions,goodsWidgetOptions:e.appearanceManager.goodsWidgetOptions,children:[e.storyLists.map((t=>(0,rd.jsx)(Rp,{onFavoriteCardClick:()=>{r(!0)},onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)},storyList:t},t.mountSelector))),e.ugcStoryLists.map((t=>(0,rd.jsx)(Dp,{ugcStoryList:t,onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)}},t.mountSelector))),(0,rd.jsx)(Ap,{open:t,onClose:()=>r(!1),options:e.appearanceManager.storyFavoriteReaderOptions,storyListOptions:e.appearanceManager.storiesListOptions})]})};class Fp{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,"storyLists",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"ugcStoryLists",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new Yl}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async setStoryList(e){await this.storyManager.waitStoryManagerConfig(),this.storyLists=e.slice(),this.render()}async setUGCStoryList(e){await this.storyManager.waitStoryManagerConfig(),this.ugcStoryLists=e.slice(),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,rd.jsx)(Bp,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,ugcStoryLists:this.ugcStoryLists,storyLists:this.storyLists,onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.root.unmount(),this.storyLists=[],this.ugcStoryLists=[],this.unscubscribeToAppearanceManagerEvents(),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,id.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(Kl.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(Kl.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}class Np extends L.EventEmitter{constructor(e,t,r,i,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"sharePage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Xl(t),this.showSharePage(e,t,a)}async showSharePage(e,t,r){this.app.setAppearanceManager(t),this.sharePage=await this.storyManager.showSharePage(e,r)}async closeStoryReader(){var e;null===(e=this.sharePage)||void 0===e||e.closeStoryReader()}}class Up extends L.default{constructor(e,t,r,i){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Xl(e),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new Io(this.storyManager,{feed:t.feed}),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()}}class Wp extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}const zp=()=>{if(!Vp.instance)throw new Wp};class Vp{constructor(e){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new Fp(Ql)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends ed{constructor(e,t,r){super(e,t,r,Vp.instance.app)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends td{constructor(e,t,r){super(e,t,r,Vp.instance.app)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends Np{constructor(e,t,r){super(e,t,Ql,Vp.instance.app,r)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends Up{constructor(e,t){super(e,t,Ql,Vp.instance.app)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:new Co(Ql.inAppMessaging)}),Vp.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),Vp.instance):(Vp.instance=this,this.app.setStoryManagerConfig(e),Vp.instance)}get sdkVersionName(){return Ql.sdkVersionName}get sdkVersionCode(){return Ql.sdkVersionCode}set storyLinkClickHandler(e){Ql.storyLinkClickHandler=e}static getInstance(){return Vp.instance?Vp.instance:null}static use(e,t){Ql.use(e,t)}getConfig(){return Ql.getConfig()}async showOnboardingStories(e,t){return Xl(e),this.app.setAppearanceManager(e),Ql.showOnboardingStories(t)}async showStory(e,t){zp(),Xl(t),this.app.setAppearanceManager(t),await Ql.showStory(e)}async showStoryOnce(e,t){return zp(),Xl(t),this.app.setAppearanceManager(t),Ql.showStoryOnce(e)}closeAllReaders(){Ql.closeAllReaders()}async openGame(e,t,r={}){return zp(),Xl(t),this.app.setAppearanceManager(t),Ql.openGame(e,r)}async closeGame(){return Ql.closeGame()}async closeStoryReader(){return Ql.closeStoryReader()}getUgcEditorConfig(){return Ql.getUgcEditorConfig()}closeGoodsWidget(){Ql.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return Be()}async setUserId(e,t){zp(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setTags(e){zp(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){zp(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){zp(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(e,t){return Ql.on(e,t),this}once(e,t){return Ql.once(e,t),this}off(e,t){return Ql.off(e,t),this}destroy(){null!=Vp.instance&&(Vp.instance=null,this.closeAllReaders(),this.app.destroy())}}})();var D=R.hS,B=R.KL,F=R.A7,N=R.Yb,U=R.Tg,W=R.WH,z=R.lV,V=R.IV,G=R.tP,$=R.h8,H=R.Xz,q=R.wS,Q=R.VS,K=R.oC,Y=R.L8,J=R.NL,Z=R.Ez,X=R.of,ee=R.Hp,te=R.MD,re=R._U,ie=R.zC,ae=R.ws,se=R.Jf,ne=R.Jd,oe=R.SK,le=R.tI,de=R.Uy,ce=R.SP,ue=R.Jj,he=R.pt,pe=R.nN,ge=R.mk,fe=R.Vq,me=R.ex,ve=R.yx,be=R.qz,ye=R.h0,we=R.KO;export{D as AppearanceCommonOptionsDefault,B as AppearanceManager,F as CTASource,N as CloseButtonPosition,U as GameReaderOptionsDefault,W as GoodsWidgetOptionsDefault,z as GoodsWidgetRenderingType,V as IamCheckDisplayTimeRangeError,G as IamFrequencyLimitError,$ as IamMessageLimitExceededError,H as IamMessageOpenError,q as IamNotFoundByEventError,Q as IamNotFoundByIdError,K as IamNotFoundLimitError,Y as IamOtherReaderIsOpenError,J as IamShowOnlyIfLoadedError,Z as IasNetworkError,X as InAppMessagingOptionsDefault,ee as InAppStoryManager,te as STORY_FEED_LIST,re as STORY_LIST_TYPE,ie as STORY_READER_WINDOW_REFERER,ae as SharePageEvents,se as SharePanelDefault,ne as StoriesEvents,oe as StoriesListCardCoverQuality,le as StoriesListCardTitlePosition,de as StoriesListCardTitleTextAlign,ce as StoriesListCardViewVariant,ue as StoriesListDirection,he as StoriesListEvents,pe as StoriesListOptionsDefault,ge as StoriesListSliderAlign,fe as StoryActionSource,me as StoryFavoriteReaderOptionsDefault,ve as StoryReaderOptionsDefault,be as StoryReaderSwipeStyle,ye as TextDir,we as WidgetStoriesOptions};
|