1app.gameViewerComponent={components:{spinner:app.commonSpinnerComponent,},props:{slug:{type:String,required:!0},loc:{type:Object,default:()=>({})},onAuthRequired:{type:Function,default:null},locale:{type:String,default:''},iframeBase:{type:String,default:''},companyId:{type:[String,Number],default:''},},data(){return{protocol:'foodpicasso.game',msgVersion:'1',state:'loading',session:null,errorMsg:'',errorCode:'',retryAtText:'',iframeReady:!1,finishing:!1,}},computed:{encodedSlug(){return encodeURIComponent(this.slug)},iframeSrc(){const path='games/'+this.encodedSlug+'?v=1.0.0'+(this.companyId?'&company='+this.companyId:'');if(!this.iframeBase){return'/'+path} 2const base=this.iframeBase.slice(-1)==='/'?this.iframeBase:this.iframeBase+'/';return base+path},iframeTitle(){return this.locValue('profile/games/iframe/title','Game')},resolvedLocale(){return this.locale||document.documentElement.lang||'ru'},iframeOrigin(){return this.iframeBase?'*':window.location.origin},isLoading(){return this.state==='loading'},isError(){return this.state==='error'},isAuthRequired(){return this.errorCode==='auth_required'},showIframe(){return this.state==='ready'||this.state==='playing'},authTitle(){return this.locValue('profile/games/auth/title','Sign in to play')},authText(){return this.locValue('profile/games/auth/text','Sign in to spin the wheel and claim prizes')},authButton(){return this.locValue('profile/games/auth/button','Sign in')},},mounted(){this.startSession();window.addEventListener('message',this.onMessage)},beforeDestroy(){window.removeEventListener('message',this.onMessage)},methods:{signIn(){if(this.onAuthRequired){this.onAuthRequired(()=>this.startSession())}},startSession(){this.state='loading';this.session=null;this.errorMsg='';this.errorCode='';this.retryAtText='';this.iframeReady=!1;this.finishing=!1;app.fetch('/games/'+this.encodedSlug+'/start',{},(res)=>{if(res.error||(res.code&&res.code!=='attempt_denied')){this.state='error';this.errorCode=res.code||'';this.retryAtText=res.retryAtText||'';this.errorMsg=this.errorMessage(res,'start');return} 3this.session=res;this.state='ready';this.onIframeLoad()})},refreshSession(){app.fetch('/games/'+this.encodedSlug+'/start',{},(res)=>{if(res.error||(res.code&&res.code!=='attempt_denied')){this.state='error';this.errorCode=res.code||'';this.retryAtText=res.retryAtText||'';this.errorMsg=this.errorMessage(res,'start');return} 4this.session=res;this.sendToIframe('game:init',{config:res.config||{},prizes:res.prizes||[],sessionId:res.sessionId,locale:this.resolvedLocale,loc:this.gameLabels(),runtimeVersion:'1.0.0',sdkVersion:'sdk@1',})})},onIframeLoad(){if(!this.session||!this.iframeReady){return} 5this.sendToIframe('game:init',{config:this.session.config||{},prizes:this.session.prizes||[],sessionId:this.session.sessionId,locale:document.documentElement.lang||'ru',loc:this.gameLabels(),runtimeVersion:'1.0.0',sdkVersion:'sdk@1',});this.state='playing'},onMessage(event){const iframe=this.$refs.gameIframe;if(!iframe||event.source!==iframe.contentWindow){return} 6const data=event.data;if(!data||data.protocol!==this.protocol||data.version!==this.msgVersion){return} 7if(data.type==='game:ready'){this.iframeReady=!0;this.onIframeLoad()}else if(data.type==='game:finish'){this.finishSession(data.payload?data.payload.prizeId:null)}else if(data.type==='game:retry'){this.refreshSession()}else if(data.type==='game:error'&&data.payload&&data.payload.fatal){this.state='error';this.errorMsg=data.payload.message||this.locValue('profile/games/error/generic','Game error')}},finishSession(prizeId){if(!this.session||this.finishing){return} 8this.finishing=!0;app.fetch('/games/session/'+this.session.sessionId+'/finish',{prizeId:prizeId!==undefined?prizeId:null},(res)=>{if(res.error||res.code){this.state='error';this.errorMsg=this.errorMessage(res,'finish');this.finishing=!1;return} 9this.sendToIframe('game:result',res);this.finishing=!1})},errorMessage(res,action){const code=res?res.code:null;const messages={attempt_denied:this.attemptDeniedMessage(res),game_not_found:this.locValue('profile/games/error/gameNotFound','Game is unavailable'),session_expired:this.locValue('profile/games/error/sessionExpired','Game session expired'),session_not_found:this.locValue('profile/games/error/sessionNotFound','Game session not found'),invalid_prize:this.locValue('profile/games/error/invalidPrize','Prize is unavailable'),prize_exhausted:this.locValue('profile/games/error/prizeExhausted','Prize is no longer available'),};return messages[code]||this.locValue('profile/games/error/'+action,'')||(res&&res.message?res.message:'')||this.locValue('profile/games/error/generic','Game error')},attemptDeniedMessage(res){if(res&&res.retryAtText){return this.locValue('profile/games/error/attemptDenied/messageWithTime','No attempts left today. New attempts will be available at {time}.').replace('{time}',res.retryAtText)} 10return this.locValue('profile/games/error/attemptDenied/messageLater','No attempts left today. Please come back later.')},gameLabels(){return{title:this.locValue('profile/games/wheelOfFortune/title','Wheel of fortune'),spin:this.locValue('profile/games/wheelOfFortune/spin','Spin'),retry:this.locValue('profile/games/wheelOfFortune/retry','Try again'),prizeFallback:this.locValue('profile/games/wheelOfFortune/prizeFallback','Prize'),noPrizes:this.locValue('profile/games/wheelOfFortune/noPrizes','No prizes available'),}},locValue(key,fallback){return this.loc&&this.loc[key]?this.loc[key]:fallback},sendToIframe(type,payload){const iframe=this.$refs.gameIframe;if(!iframe||!iframe.contentWindow){return} 11iframe.contentWindow.postMessage({protocol:this.protocol,version:this.msgVersion,type:type,id:this.uuid(),payload:payload},this.iframeOrigin)},uuid(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,(c)=>{const r=(Math.random()*16)|0;return(c==='x'?r:(r&0x3)|0x8).toString(16)})},},template:` 12 <div class="gameViewer" v-cloak> 13 <div class="gameViewer__grab"></div> 14 <div v-if="isLoading" class="gameViewer__loader"> 15 <spinner/> 16 </div> 17 <div v-else-if="isError" class="gameViewer__error"> 18 <div v-if="isAuthRequired" class="gameViewerAuth"> 19 <div class="gameViewerAuth__icon"> 20 <svg viewBox="0 0 24 24" aria-hidden="true"> 21 <circle cx="12" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="1.8"></circle> 22 <path d="M4 20c0-3.6 3.6-6 8-6s8 2.4 8 6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path> 23 </svg> 24 </div> 25 <div class="gameViewerAuth__title">{{ authTitle }}</div> 26 <div class="gameViewerAuth__text">{{ authText }}</div> 27 <button type="button" class="gameViewerAuth__btn" @click="sign
27In">{{ authButton }}</button> 28 </div> 29 <p v-else>{{ errorMsg }}</p> 30 </div> 31 <iframe v-if="showIframe" 32 ref="gameIframe" 33 :src="iframeSrc" 34 sandbox="allow-scripts allow-same-origin" 35 referrerpolicy="no-referrer" 36 loading="eager" 37 class="gameViewer__iframe" 38 :title="iframeTitle"></iframe> 39 </div> 40 `,};app.addModule(function(){const showGameViewer=function(params){const slug=params&¶ms.slug;if(!slug){return} 41const encodedSlug=encodeURIComponent(slug);app.openViewer({desktop:{maxWidth:'400px',borderRadius:'32px',overflow:'hidden',bgClose:!0,},mobile:{maxHeight:'90dvh',withTick:!0,},url:`${window.location.pathname}${window.location.search}#game-${encodedSlug}`,component:app.gameViewerComponent,props:{slug:slug,loc:(app.store&&app.store.state)?app.store.state.loc:{},iframeBase:'',companyId:'',onAuthRequired:function(retry){PubSub.publish('showAuth',{cb:function(){retry()},})},},})};PubSub.subscribe('showGameViewer',function(e,params){showGameViewer(params)})});app.addModule(function(){const bigPromoComponent={props:['promo'],data(){return{isShareOpen:!1,imgLoaded:!1,}},computed:Object.assign({locApply(){return this.loc['promo/apply']},locToCart(){return this.loc['btn/to-cart']},shareOptions(){return[{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 13 13" fill="none"> 42<path d="M9.7691 5.03361L11.7146 6.97915C12.0303 7.29065 12.2813 7.66152 12.4531 8.07041C12.6249 8.4793 12.7141 8.91813 12.7156 9.36163C12.717 9.80514 12.6308 10.2446 12.4617 10.6546C12.2927 11.0646 12.0442 11.4372 11.7306 11.7508C11.417 12.0644 11.0445 12.3129 10.6344 12.4819C10.2244 12.6509 9.785 12.7372 9.34149 12.7357C8.89799 12.7342 8.45916 12.645 8.05027 12.4732C7.64138 12.3015 7.2705 12.0505 6.95901 11.7348L6.3109 11.0867C6.22327 11.0021 6.15335 10.9009 6.10523 10.7891C6.05711 10.6772 6.03176 10.5569 6.03064 10.4351C6.02953 10.3133 6.05268 10.1925 6.09874 10.0798C6.1448 9.96708 6.21285 9.86465 6.29892 9.7785C6.38499 9.69234 6.48736 9.6242 6.60005 9.57803C6.71274 9.53186 6.83349 9.5086 6.95527 9.5096C7.07705 9.5106 7.1974 9.53584 7.30932 9.58385C7.42124 9.63187 7.52247 9.70169 7.60711 9.78924L8.25644 10.438C8.54357 10.7225 8.93172 10.8817 9.33596 10.8808C9.7402 10.8798 10.1276 10.7188 10.4134 10.4329C10.6992 10.1471 10.8601 9.7596 10.8609 9.35537C10.8618 8.95113 10.7024 8.56302 10.4178 8.27597L8.47227 6.33043C8.26199 6.12006 7.99489 5.9756 7.70372 5.91479C7.41256 5.85397 7.10997 5.87942 6.83305 5.98804C6.73441 6.02717 6.64188 6.06711 6.55547 6.10787L6.27177 6.24055C5.89269 6.41175 5.60104 6.48512 5.22991 6.1146C4.69675 5.58144 4.83493 5.08925 5.48487 4.64107C6.13231 4.19557 6.91534 3.9909 7.69797 4.0626C8.4806 4.13431 9.2134 4.47787 9.7691 5.03361ZM6.09446 1.35897L6.74256 2.00707C6.90971 2.17997 7.00226 2.41159 7.00029 2.65206C6.99831 2.89253 6.90197 3.12261 6.732 3.29273C6.56204 3.46286 6.33205 3.55942 6.09158 3.56162C5.85112 3.56383 5.6194 3.47149 5.44635 3.30451L4.79763 2.6564C4.65667 2.51037 4.48803 2.39387 4.30157 2.31371C4.1151 2.23355 3.91454 2.19133 3.71158 2.1895C3.50862 2.18768 3.30733 2.2263 3.11945 2.30311C2.93158 2.37991 2.76088 2.49336 2.61732 2.63684C2.47376 2.78032 2.36021 2.95095 2.2833 3.13878C2.20639 3.32662 2.16766 3.52788 2.16937 3.73084C2.17107 3.9338 2.21318 4.13439 2.29324 4.32091C2.37329 4.50742 2.4897 4.67612 2.63565 4.81716L4.58119 6.76271C4.79147 6.97308 5.05857 7.11753 5.34974 7.17835C5.64091 7.23917 5.9435 7.21371 6.22041 7.1051C6.31905 7.06597 6.41158 7.02603 6.49799 6.98526L6.78169 6.85259C7.16078 6.68139 7.45303 6.60802 7.82356 6.97854C8.35672 7.5117 8.21853 8.00389 7.56859 8.45206C6.92115 8.89757 6.13813 9.10224 5.3555 9.03054C4.57286 8.95883 3.84007 8.61527 3.28436 8.05953L1.33882 6.11399C1.02312 5.80249 0.772156 5.43162 0.600376 5.02273C0.428596 4.61384 0.339395 4.17501 0.337909 3.7315C0.336424 3.288 0.422682 2.84858 0.591719 2.43855C0.760755 2.02852 1.00923 1.65598 1.32284 1.34237C1.63644 1.02876 2.00899 0.780286 2.41902 0.61125C2.82905 0.442213 3.26847 0.35595
425 3.71197 0.357441C4.15548 0.358927 4.59431 0.448127 5.0032 0.619907C5.41209 0.791687 5.78296 1.04326 6.09446 1.35897Z" fill="white"/> 43</svg>`,name:this.loc['common/copyLink'],url:window.location.href,method:this.handleCopyLink,}]}},Vuex.mapState(['loc'])),mounted(){document.addEventListener('click',this.clickOutside)},beforeDestroy(){document.removeEventListener('click',this.clickOutside)},methods:{handleOpenShare(){this.isShareOpen=!0},clickOutside(event){if(this.$refs.shareList.contains(event.target)){return} 44this.isShareOpen=!1},handleCopyLink(){navigator.clipboard.writeText(`${window.location.href}`).then(()=>{}).catch(()=>console.log('Ðе полÑÑилоÑÑ ÑкопиÑоваÑÑ'));this.isShareOpen=!1},toCart(){this.$emit('close');let forceAddress=!1;if(app.store.state.address&&app.store.state.address.warning){forceAddress='showUserAddress'} 45const action=this.promo.actions[0];if(action.type==='product'){const dish=action.meta;PubSub.publish('showTopping',{dish:{id:dish.id,name:dish.name,ingredients:dish.ingredients,nutrients:dish.nutrients?dish.nutrients:'',prices:dish.prices,price:dish.priceFromFormatted?dish.priceFromFormatted:dish.priceCoreFormatted,balance:dish.balance||'',media:dish.media?dish.media:null,size:dish.sizeCoreFormatted?dish.sizeCoreFormatted:'',params:dish.params,photo:{full:dish.photo&&dish.photo.full||'',low:dish.photo&&dish.photo.low||'',ratio:dish.photo&&dish.photo.ratio||'',},extraPhotos:dish.extraPhotos?dish.extraPhotos:null},forceAddress:forceAddress,modifiers:dish.modifiers?JSON.parse(JSON.stringify(dish.modifiers)):null,})}},applyPromocode(){this.$emit('close');setTimeout(()=>{PubSub.publish("recalcCart",{cartSwitchConfirmed:!0,changePromocode:this.promo.promocode,})},500);PubSub.publish('sendAnalytics',{type:'promo',event:'apply',payload:{promoId:this.promo.id},})},},template:` 46 47 48 <div class="big-prviewer"> 49 50 <div class="big-prviewer__share"> 51 52 <div class="big-prviewer__shareIcon" @click.stop="handleOpenShare"> 53 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="12" viewBox="0 0 16 12" fill="none"> 54 <path d="M0.234696 9.59969C0.150577 9.76582 0.180828 9.96698 0.310084 10.101C0.439341 10.2351 0.639277 10.2726 0.808347 10.1946L2.99527 9.18522C4.83329 8.33691 6.83909 7.94883 8.84143 8.04011C8.86521 8.68311 8.90051 9.3258 8.94731 9.96785L9.0072 10.7894C9.04353 11.2879 9.59931 11.5665 10.0204 11.2974C11.8483 10.1295 13.4374 8.6245 14.7029 6.86277L15.1056 6.30223C15.2151 6.1497 15.2151 5.94426 15.1056 5.79173L14.7029 5.23119C13.4374 3.46947 11.8483 1.96451 10.0204 0.796539C9.59931 0.527446 9.04353 0.806079 9.0072 1.30452L8.94731 2.12611C8.90713 2.67724 8.87544 3.22882 8.85223 3.78068H8.28952C5.15617 3.78067 2.28904 5.54262 0.873556 8.33802L0.234696 9.59969Z" fill="white"/> 55 </svg> 56 </div> 57 58 <div class="big-prviewer__shareList" 59 :class="{'big-prviewer__shareList--open': isShareOpen}" 60 ref="shareList"> 61 <div v-for="(option, index) in shareOptions" 62 :key="index" 63 class="big-prviewer__shareOption" 64 @click="option.method"> 65 <div class="big-prviewer__shareOptionIcon" v-html="option.svg"> 66 </div> 67 {{ option.name }} 68 </div> 69 </div> 70 71 </div> 72 73 <div class="big-prviewer__preview-wrapper"> 74 <img class="big-prviewer__preview" 75 :src="promo.photo.crop.high" 76 :data-loaded="imgLoaded" 77 @load="imgLoaded = true"> 78 </div> 79 80 <div class="big-prviewer__info"> 81 82 <div class="big-prviewer__title">{{promo.name}}</div> 83 84 <div v-if="promo.text" class="big-prviewer__descr" v-html="promo.text"></div> 85 86 <div v-if="promo.promocode || promo.product" 87 class="big-prviewer__actions"> 88 89 <template v-if="promo.promocode"> 90 91 <button class="big-prviewer__copy" 92 ref="copy" 93 @click="applyPromocode()"> 94 {{locApply}} 95 </button> 96 97 <div class="big-prviewer__promocode-wrapper"> 98 <div class="big-prviewer__promocode"> 99 {{promo.promocode}} 100 </div> 101 </div> 102 103 </template> 104 105 <template v-else-if="!!promo.product"> 106 <button class="big-prviewer__copy" 107 @click="toCart()"> 108 {{locToCart}} 109 </button> 110 </template> 111 112 </div> 113 114 </div> 115 116 117 118 </div> 119 120 121 `,};const show=function(params){PubSub.publish('sendAnalytics',{type:'promo',event:'open',payload:{promoId:params.promo.id},});if(params&¶ms.promo&¶ms.promo.gameSlug){PubSub.publish('showGameViewer',{slug:params.promo.gameSlug});return} 122if(params&¶ms.promo&¶ms.promo.url){window.open(params.promo.url,'_blank');return} 123document.documentElement.classList.add('html--promoCurtain');app.openViewer({desktop:{maxWidth:'890px',borderRadius:'24px',overflow:'hidden',class:'vr--big-prviewer',},mobile:{withTick:!0,bgClose:!0,maxHeight:'90dvh',class:'vr--big-prviewer',},component:bigPromoComponent,props:{promo:params.promo},url:`${window.location.pathname}${window.location.search}#promo${params.promo.id}`,onClose(){document.documentElement.classList.remove('html--promoCurtain');PubSub.publish('sendAnalytics',{type:'promo',event:'close',payload:{promoId:params.promo.id},})}})};PubSub.subscribe("showBigPromo",function(e,params){show(params)})});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.