-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.689a273e7ee8fe8e650d.js
1 lines (1 loc) · 44.1 KB
/
main.689a273e7ee8fe8e650d.js
1
!function(){var e={328:function(e,t,o){o(624),e.exports=self.fetch.bind(self)},624:function(e,t,o){"use strict";o.r(t),o.d(t,{DOMException:function(){return q},Headers:function(){return c},Request:function(){return g},Response:function(){return b},fetch:function(){return w}});var r="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==o.g&&o.g||{},n={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};if(n.arrayBuffer)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function i(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n.iterable&&(t[Symbol.iterator]=function(){return t}),t}function c(e){this.map={},e instanceof c?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function d(e){return new Promise((function(t,o){e.onload=function(){t(e.result)},e.onerror=function(){o(e.error)}}))}function y(e){var t=new FileReader,o=d(t);return t.readAsArrayBuffer(e),o}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:n.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:n.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():n.arrayBuffer&&n.blob&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||s(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=h(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(n.blob)return this.blob().then(y);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,o,r,n,a=h(this);if(a)return a;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,o=d(t),r=/charset=([A-Za-z0-9_-]+)/.exec(e.type),n=r?r[1]:"utf-8",t.readAsText(e,n),o;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),o=new Array(t.length),r=0;r<t.length;r++)o[r]=String.fromCharCode(t[r]);return o.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(e,t){e=i(e),t=u(t);var o=this.map[e];this.map[e]=o?o+", "+t:t},c.prototype.delete=function(e){delete this.map[i(e)]},c.prototype.get=function(e){return e=i(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(i(e))},c.prototype.set=function(e,t){this.map[i(e)]=u(t)},c.prototype.forEach=function(e,t){for(var o in this.map)this.map.hasOwnProperty(o)&&e.call(t,this.map[o],o,this)},c.prototype.keys=function(){var e=[];return this.forEach((function(t,o){e.push(o)})),l(e)},c.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),l(e)},c.prototype.entries=function(){var e=[];return this.forEach((function(t,o){e.push([o,t])})),l(e)},n.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var f=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function g(e,t){if(!(this instanceof g))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var o,n,a=(t=t||{}).body;if(e instanceof g){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,a||null==e._bodyInit||(a=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new c(t.headers)),this.method=(o=t.method||this.method||"GET",n=o.toUpperCase(),f.indexOf(n)>-1?n:o),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in r)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&a)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(a),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function _(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var o=e.split("="),r=o.shift().replace(/\+/g," "),n=o.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(n))}})),t}function b(e,t){if(!(this instanceof b))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},m.call(g.prototype),m.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},b.error=function(){var e=new b(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var v=[301,302,303,307,308];b.redirect=function(e,t){if(-1===v.indexOf(t))throw new RangeError("Invalid status code");return new b(null,{status:t,headers:{location:e}})};var q=r.DOMException;try{new q}catch(e){(q=function(e,t){this.message=e,this.name=t;var o=Error(e);this.stack=o.stack}).prototype=Object.create(Error.prototype),q.prototype.constructor=q}function w(e,t){return new Promise((function(o,a){var s=new g(e,t);if(s.signal&&s.signal.aborted)return a(new q("Aborted","AbortError"));var l=new XMLHttpRequest;function h(){l.abort()}if(l.onload=function(){var e,t,r={statusText:l.statusText,headers:(e=l.getAllResponseHeaders()||"",t=new c,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var o=e.split(":"),r=o.shift().trim();if(r){var n=o.join(":").trim();try{t.append(r,n)}catch(e){}}})),t)};0===s.url.indexOf("file://")&&(l.status<200||l.status>599)?r.status=200:r.status=l.status,r.url="responseURL"in l?l.responseURL:r.headers.get("X-Request-URL");var n="response"in l?l.response:l.responseText;setTimeout((function(){o(new b(n,r))}),0)},l.onerror=function(){setTimeout((function(){a(new TypeError("Network request failed"))}),0)},l.ontimeout=function(){setTimeout((function(){a(new TypeError("Network request timed out"))}),0)},l.onabort=function(){setTimeout((function(){a(new q("Aborted","AbortError"))}),0)},l.open(s.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(s.url),!0),"include"===s.credentials?l.withCredentials=!0:"omit"===s.credentials&&(l.withCredentials=!1),"responseType"in l&&(n.blob?l.responseType="blob":n.arrayBuffer&&(l.responseType="arraybuffer")),t&&"object"==typeof t.headers&&!(t.headers instanceof c||r.Headers&&t.headers instanceof r.Headers)){var d=[];Object.getOwnPropertyNames(t.headers).forEach((function(e){d.push(i(e)),l.setRequestHeader(e,u(t.headers[e]))})),s.headers.forEach((function(e,t){-1===d.indexOf(t)&&l.setRequestHeader(t,e)}))}else s.headers.forEach((function(e,t){l.setRequestHeader(t,e)}));s.signal&&(s.signal.addEventListener("abort",h),l.onreadystatechange=function(){4===l.readyState&&s.signal.removeEventListener("abort",h)}),l.send(void 0===s._bodyInit?null:s._bodyInit)}))}w.polyfill=!0,r.fetch||(r.fetch=w,r.Headers=c,r.Request=g,r.Response=b)}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,o),a.exports}o.d=function(e,t){for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e}(),function(){"use strict";const e=document.querySelector(".greeting__name"),t=()=>localStorage.setItem("name",e.textContent.trim()),r=document.querySelector(".settings__language-select"),n=Array.from(r.children),a=(e,t)=>{const o=n.find((t=>t.value===e));o&&(o.selected=t)},s=()=>localStorage.getItem("language")||"en",i=document.querySelector(".weather__icon"),u=e=>{[d,y,p,m,i].forEach((t=>t.classList[e]("weather__items_hide")))},l=document.querySelector(".weather_error"),c=e=>l.classList[e]("weather_error-show"),h={en:{wind:"Wind speed:",units:"m/s",humidity:"Humidity:",error:"Error: City wasn't found!"},ru:{wind:"Скорость ветра:",units:"м/c",humidity:"Влажность:",error:"Ошибка: Город не найден!"}},d=document.querySelector(".weather__temperature"),y=document.querySelector(".weather__description"),p=document.querySelector(".weather__wind"),m=document.querySelector(".weather__humidity"),f=document.querySelector(".weather__input"),g=async()=>{try{const e=s(),t=f.value.trim(),o=`https://api.openweathermap.org/data/2.5/weather?q=${t}&lang=${e}&appid=707403e9cd5fd98433ce849d45e3e0f2&units=metric`;f.value=t;const r=await fetch(o),n=await r.json();(e=>{i.className="weather__icon owf",i.classList.add(`owf-${e.weather[0].id}`)})(n),((e,t)=>{u("remove"),d.textContent=Math.round(e.main.temp)+"°C",y.textContent=e.weather[0].description.slice(0,1).toUpperCase()+e.weather[0].description.slice(1),p.textContent=`${h[t].wind} ${Math.round(e.wind.speed)} ${h[t].units}`,m.textContent=`${h[t].humidity} ${Math.round(e.main.humidity)}%`,l.textContent=""})(n,e),c("remove")}catch(e){(()=>{u("add");const e=s();d.textContent="",y.textContent="",p.textContent="",m.textContent="",l.textContent=`${h[e].error}`})(),c("add")}},_=document.body,b=new Image,v=e=>{b.src=e,b.onload=()=>_.style.backgroundImage=`url(${e})`},q=document.querySelector(".slider__popup"),w=document.querySelector(".slider__shadow"),S=e=>{q.classList[e]("slider__popup_show"),w.classList[e]("slider__shadow_show"),_.classList[e]("body_fixed")},x=()=>+localStorage.getItem("pexelsNum"),A=e=>localStorage.setItem("pexelsNum",e);var E={photo:"https://api.pexels.com/v1/",video:"https://api.pexels.com/videos/",collections:"https://api.pexels.com/v1/collections/"};function T(e,t){var o={method:"GET",headers:{Accept:"application/json","Content-Type":"application/json","User-Agent":"Pexels/JavaScript",Authorization:e}},r=E[t];return function(e,t){return fetch(""+r+e+"?"+function(e){return Object.keys(e).map((function(t){return t+"="+e[t]})).join("&")}(t||{}),o).then((function(e){if(!e.ok)throw new Error(e.statusText);return e.json()}))}}function k(e){var t=T(e,"collections");return{all:function(e){return void 0===e&&(e={}),t("",e)},media:function(e){var o=e.id,r=function(e,t){if(null==e)return{};var o,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(o=a[r])>=0||(n[o]=e[o]);return n}(e,["id"]);return t(""+o,r)},featured:function(e){return void 0===e&&(e={}),t("featured",e)}}}function L(e){return!(!e||!e.photos)}var I={__proto__:null,isPhotos:L,isVideos:function(e){return!(!e||!e.videos)},isError:function(e){return!!e.error}};function C(e){var t=T(e,"photo");return{search:function(e){return t("/search",e)},curated:function(e){return void 0===e&&(e={}),t("/curated",e)},show:function(e){return t("/photos/"+e.id)},random:function(){try{var e=Math.floor(1e3*Math.random());return Promise.resolve(this.curated({page:e,per_page:1})).then((function(e){return L(e)?e.photos[0]:e}))}catch(e){return Promise.reject(e)}}}}function B(e){var t=T(e,"video");return{search:function(e){return t("/search",e)},popular:function(e){return void 0===e&&(e={}),t("/popular",e)},show:function(e){return t("/videos/"+e.id)}}}let P;o(328);const O=e=>P=e,D=()=>localStorage.getItem("source")||"github",j=e=>localStorage.setItem("source",e),R=function(e){if(!e||"string"!=typeof e)throw new TypeError("An ApiKey must be provided when initiating the Pexel's client.");return{typeCheckers:I,photos:C(e),videos:B(e),collections:k(e)}}("5hopODRoIFw4TPxHIxDAQJItNDcFirsqca011wJt3lfNH9ZGBPaCHKtj");let N;const U=()=>{const e=D(),t=x(),o=window.innerWidth<=768?"large2x":"landscape";"pexels"===e&&($.classList.remove("settings__query_hide"),R.photos.search({query:P,locale:"ru-RU",per_page:80}).then((e=>{e&&e.photos&&e.photos.length>1?(N=e.photos.length-1,t?v(t>=0?e.photos[t].src[`${o}`]:e.photos[N+t].src[`${o}`]):(A(0),v(e.photos[t].src[`${o}`]))):S("add")})))},$=document.querySelector(".settings__query"),H=document.querySelector(".settings__query-input"),M=["#","%","&","+",";"],W=()=>localStorage.getItem("queryInputValue"),F={en:"[Enter name]",ru:"[Введите имя]"},G=o=>{const r=localStorage.getItem("name");r&&F.en!==r&&F.ru!==r||(e.textContent=F[o],t())},J={en:["Good night, ","Good morning, ","Good afternoon, ","Good evening, "],ru:["Доброй ночи, ","Доброе утро, ","Добрый день, ","Добрый вечер, "]},K=document.querySelector(".greeting__text"),V=()=>{const e=s(),t=(new Date).getHours(),o=J[e][Math.floor(t/6)];return K.textContent=o,o},z={en:"Source of images:",ru:"Источник изображений:"},Y=document.querySelector(".settings__source-description"),X=e=>Y.textContent=z[e],Q={en:{en:"English",ru:"Russian"},ru:{en:"Английский",ru:"Русский"}},Z=(e,t,o,r)=>{n[0].label=Q[e][t],n[1].label=Q[o][r]},ee={en:"Change language:",ru:"Изменить язык:"},te=document.querySelector(".settings__language-description"),oe=e=>te.textContent=ee[e],re={en:"Search for images by tag:",ru:"Поиск изображений по тэгу:"},ne=document.querySelector(".settings__query-label"),ae=e=>ne.textContent=re[e],se={en:["No images were found for your query. <br> Enter another query."],ru:["По вашему запросу изображения не найдены. <br> Введите другой запрос."]},ie=document.querySelector(".slider__popup-message"),ue=e=>ie.innerHTML=se[e],le=document.querySelector(".settings__button"),ce=document.querySelector(".settings__title"),he=e=>{ce.classList[e]("settings__title_active"),le.classList[e]("settings__button_active")},de={en:"SETTINGS",ru:"НАСТРОЙКИ"},ye=e=>ce.textContent=de[e],pe={en:["Hide","Player","Weather","Clock","Date","Greeting","Quotes"],ru:["Скрыть","Плеер","Погода","Часы","Дата","Приветствие","Цитата"]},me=document.querySelectorAll(".settings__blocks-hide p"),fe=e=>{me.forEach(((t,o)=>{t.textContent=pe[e][o]}))},ge={en:"Character limit exceeded.",ru:"Превышен лимит символов."},_e=document.querySelector(".greeting__popup-message"),be=e=>{_e.textContent=ge[e]},ve=()=>{const e=s();"en"===e?(G("en"),X("en"),Z("en","en","en","ru"),oe("en"),ae("en"),ue("en"),ye("en"),fe("en"),be("en")):"ru"===e&&(G("ru"),X("ru"),Z("ru","en","ru","ru"),oe("ru"),ae("ru"),ue("ru"),ye("ru"),fe("ru"),be("ru")),V()},qe=document.querySelector(".date__time"),we=()=>{const e=(new Date).toLocaleTimeString();qe.textContent=e},Se=document.querySelector(".date__date"),xe={weekday:"long",month:"long",day:"numeric"},Ae=()=>{const e=s(),t=(new Date).toLocaleDateString(e,xe);Se.textContent=t},Ee=(e,t)=>{const o=e.target;for(const r in t)if(o.closest(r)){t[r](e);break}},Te=document.querySelector(".quotes__change-btn");let ke=0;const Le=document.querySelectorAll(".settings__blocks-hide input"),Ie=()=>{const e=Array.from(Le).map(((e,t)=>e.checked?t:null)).filter((e=>null!==e));localStorage.setItem("indexOfCheckedInputs",JSON.stringify(e))},Ce=["settings__blocks-hide-title","settings__blocks-hide"],Be=["[Enter name]","[Введите имя]"];let Pe=0;const Oe=e=>Pe=e;let De=!1;const je=e=>De=e,Re=document.querySelector(".player__progress-input");var Ne=o.p+"assets/images/pauseSongBtn.svg";const Ue=document.querySelector(".player__track-name"),$e=document.querySelector(".player__audio"),He=document.querySelector(".player__playback-play"),Me=document.querySelector(".player__playback-play-icon use"),We=()=>{document.querySelectorAll("li")[Pe].classList.add("player__list-item_active"),Ue.classList.add("player__track-name_active"),$e.play(),Me.setAttribute("href",`${Ne}#pauseSong`),He.classList.add("player__playback-play_active"),je(!0),Re.removeAttribute("disabled"),Re.classList.add("player__progress-input_pointer")};var Fe=o.p+"assets/images/playSongBtn.svg";const Ge=()=>De?($e.pause(),Me.setAttribute("href",`${Fe}#playSong`),He.classList.remove("player__playback-play_active"),void je(!1)):We();var Je=[{title:"ДДТ - Дождь",src:o.p+"assets/sounds/ДДТ - Дождь.mp3",duration:"05:04"},{title:"Scorpions - Still loving you",src:o.p+"assets/sounds/Scorpions - Still loving you.mp3",duration:"06:28"},{title:"Imagine Dragons - Warriors",src:o.p+"assets/sounds/Imagine Dragons - Warriors.mp3",duration:"02:50"},{title:"КиШ - Утренний рассвет",src:o.p+"assets/sounds/КиШ - Утренний рассвет.mp3",duration:"02:29"}];let Ke,Ve;let ze=document.querySelector(".player__current-time"),Ye=document.querySelector(".player__duration-time");const Xe=()=>{var e;ze.textContent=(e=$e.currentTime,Ke=parseInt(e),Ve=parseInt(Ke/60),Ke-=60*Ve,`${Ve}:${String(Ke).padStart(2,0)}`),Ye.textContent=Je[Pe].duration},Qe=e=>e.title.length>28?e.title.slice(0,28)+"...":e.title,Ze=()=>{const e=Je[Pe],t=Qe(e);$e.src=e.src,Ue.textContent=t,Xe()},et=()=>{document.querySelectorAll(".player__list-item")[Pe].classList.remove("player__list-item_active"),Pe++,Pe>Je.length-1&&Oe(0),Ze(),We()};let tt=!0;const ot=e=>{let t=x();"pexels"===D()&&tt&&(tt=!1,A("prev"===e?t<=0?N:--t:t>=N?0:++t),U(),setTimeout((()=>{tt=!0}),1e3))},rt={"ночи":"night","утро":"morning","день":"afternoon","вечер":"evening"},nt=e=>rt[e],at=()=>{if("github"===D()){$.classList.add("settings__query_hide");const e=V().split(" ")[1].slice(0,-1);let t="en"===s()?e:nt(e),o=it.toString().padStart(2,"0");v(`https://raw.githubusercontent.com/W0x3R/momentum-images/Main/${t}/${o}.webp`)}},st=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1)+e));let it=st(1,20),ut=!0;const lt=e=>{"github"===D()&&ut&&(ut=!1,it="prev"===e?1===it?20:it-1:20===it?1:it+1,at(),setTimeout((()=>{ut=!0}),1e3))};var ct=o.p+"assets/images/muteSongBtn.svg",ht=o.p+"assets/images/unMuteSongBtn.svg";const dt=ct,yt=ht,pt=document.querySelector(".player__volume-mute svg use"),mt=(e,t)=>pt.setAttribute("href",`${e}#${t}`),ft=document.querySelector(".player__volume-mute"),gt=document.querySelector(".player__volume-input"),_t=()=>localStorage.setItem("volumeValue",gt.value),bt=()=>localStorage.getItem("volumeValue")||gt.value,vt=e=>localStorage.setItem("isMute",e),qt=()=>localStorage.getItem("isMute")||"false",wt=document.querySelector(".settings__shadow"),St=document.querySelector(".settings__menu"),xt=e=>{St.classList[e]("settings__menu_show"),wt.classList[e]("settings__shadow_show"),_.classList[e]("body_fixed")};var At=JSON.parse('[{"quote":"Life isn’t about getting and having, it’s about giving and being.","author":"Kevin Kruse"},{"quote":"Whatever the mind of man can conceive and believe, it can achieve.","author":"Napoleon Hill"},{"quote":"Strive not to be a success, but rather to be of value.","author":"Albert Einstein"},{"quote":"Believe you can and you\'re halfway there.","author":"Theodore Roosevelt"},{"quote":"I attribute my success to this: I never gave or took any excuse.","author":"Florence Nightingale"},{"quote":"You miss 100% of the shots you don’t take.","author":"Wayne Gretzky"},{"quote":"The most difficult thing is the decision to act, the rest is merely tenacity.","author":"Amelia Earhart"},{"quote":"Every strike brings me closer to the next home run.","author":"Babe Ruth"},{"quote":"Definiteness of purpose is the starting point of all achievement.","author":"W. Clement Stone"},{"quote":"We must balance conspicuous consumption with conscious capitalism.","author":"Kevin Kruse"},{"quote":"Life is what happens to you while you’re busy making other plans.","author":"John Lennon"},{"quote":"We become what we think about.","author":"Earl Nightingale"},{"quote":"Be yourself; everyone else is already taken.","author":"Oscar Wilde"},{"quote":"Well done is better than well said.","author":"Benjamin Franklin"},{"quote":"Life is 10% what happens to me and 90% of how I react to it.","author":"Charles Swindoll"},{"quote":"The most common way people give up their power is by thinking they don’t have any.","author":"Alice Walker"},{"quote":"The mind is everything. What you think you become.","author":"Buddha"},{"quote":"The best time to plant a tree was 20 years ago. The second best time is now.","author":"Chinese Proverb"},{"quote":"An unexamined life is not worth living.","author":"Socrates"},{"quote":"Eighty percent of success is showing up.","author":"Woody Allen"},{"quote":"Your time is limited, so don’t waste it living someone else’s life.","author":"Steve Jobs"},{"quote":"Winning isn’t everything, but wanting to win is.","author":"Vince Lombardi"},{"quote":"I am not a product of my circumstances. I am a product of my decisions.","author":"Stephen Covey"},{"quote":"Every child is an artist. The problem is how to remain an artist once he grows up.","author":"Pablo Picasso"},{"quote":"You can never cross the ocean until you have the courage to lose sight of the shore.","author":"Christopher Columbus"},{"quote":"The only way to do great work is to love what you do.","author":"Steve Jobs"},{"quote":"Either you run the day, or the day runs you.","author":"Jim Rohn"},{"quote":"Whether you think you can or you think you can’t, you’re right.","author":"Henry Ford"},{"quote":"Don\'t be afraid to give up the good to go for the great.","author":"John D. Rockefeller"},{"quote":"Don\'t let yesterday take up too much of today.","author":"Will Rogers"},{"quote":"The best revenge is massive success.","author":"Frank Sinatra"},{"quote":"In order to succeed, we must first believe that we can.","author":"Nikos Kazantzakis"},{"quote":"Life shrinks or expands in proportion to one’s courage.","author":"Anais Nin"},{"quote":"I never dreamed about success. I worked for it.","author":"Estee Lauder"},{"quote":"There is only one way to avoid criticism: do nothing, say nothing, and be nothing.","author":"Aristotle"},{"quote":"Dream big and dare to fail.","author":"Norman Vaughan"},{"quote":"The only person you are destined to become is the person you decide to be.","author":"Ralph Waldo Emerson"},{"quote":"Go confidently in the direction of your dreams. Live the life you have imagined.","author":"Henry David Thoreau"},{"quote":"The best revenge is massive success.","author":"Frank Sinatra"},{"quote":"Get busy living or get busy dying.","author":"Stephen King"},{"quote":"Certain things catch your eye, but pursue only those that capture the heart.","author":" Ancient Indian Proverb"},{"quote":"Believe you can and you’re halfway there.","author":"Theodore Roosevelt"},{"quote":"Everything you’ve ever wanted is on the other side of fear.","author":"George Addair"},{"quote":"I like criticism. It makes you strong.","author":"LeBron James"},{"quote":"Teach thy tongue to say, “I do not know,” and thous shalt progress.","author":"Maimonides"},{"quote":"Start where you are. Use what you have. Do what you can.","author":"Arthur Ashe"},{"quote":"Life would be tragic if it weren’t funny.","author":"Stephen Hawking"},{"quote":"Fall seven times and stand up eight.","author":"Japanese Proverb"},{"quote":"Every moment is a fresh beginning.","author":"T.S. Eliot"},{"quote":"Everything has beauty, but not everyone can see.","author":"Confucius"},{"quote":"Be happy for this moment. This moment is your life.","author":"Omar Khayyam"},{"quote":"When I let go of what I am, I become what I might be.","author":"Lao Tzu"},{"quote":"As you know, life is an echo; we get what we give.","author":"David DeNotaris"},{"quote":"Happiness is not something readymade. It comes from your own actions.","author":"Dalai Lama"},{"quote":"If you’re offered a seat on a rocket ship, don’t ask what seat! Just get on.","author":"Sheryl Sandberg"},{"quote":"Make each day your masterpiece.","author":"John Wooden"},{"quote":"If the wind will not serve, take to the oars.","author":"Latin Proverb"},{"quote":"When you have a dream, you’ve got to grab it and never let go.","author":"Carol Burnett"},{"quote":"Do one thing every day that scares you.","author":"Eleanor Roosevelt"},{"quote":"Too many of us are not living our dreams because we are living our fears.","author":"Les Brown"},{"quote":"If you cannot do great things, do small things in a great way.","author":"Napoleon Hill"},{"quote":"If you want to lift yourself up, lift up someone else.","author":"Booker T. Washington"},{"quote":"Keep your face towards the sunshine and shadows will fall behind you.","author":"Walt Whitman"},{"quote":"A problem is a chance for you to do your best.","author":"Duke Ellington"},{"quote":"You miss 100% of the shots you don’t take.","author":"Wayne Gretzky"},{"quote":"Dreaming, after all, is a form of planning.","author":"Gloria Steinem"},{"quote":"I didn’t fail the test. I just found 100 ways to do it wrong.","author":"Benjamin Franklin"}]'),Et=JSON.parse('[{"quote":"Не ищите смысла в жизни, создавайте его сами.","author":"Альберт Эйнштейн "},{"quote":"Вы можете изменить свою жизнь, изменив свои мысли.","author":"Норман Винсент Пил"},{"quote":"Бессмысленно продолжать делать то же самое и ждать других результатов.","author":"Альберт Эйнштейн"},{"quote":"Ты должен быть сильным, иначе зачем тебе быть?","author":"Виктор Цой"},{"quote":"Даже если вы проходите через ад, продолжайте идти.","author":"Уинстон Черчилль"},{"quote":"Не бойтесь отказываться от хорошего ради великого.","author":"Джон Д. Рокфеллер"},{"quote":"В конечном итоге всё будет хорошо. Если пока не хорошо, значит, это ещё не конец.","author":"Пауло Коэльо"},{"quote":"Мы не можем помочь всем, но каждый может помочь кому-то.","author":"Рональд Рейган"},{"quote":"Счастье — это направление, а не место.","author":"Сидней Дж. Харрис"},{"quote":"Большинство начинают вопить о несправедливости, только когда это касается их лично.","author":"Чарльз Буковски"},{"quote":"Проблема с честными людьми в том, что они ждут честности от всех остальных.","author":"Нил Стивенсон"},{"quote":"Довольствуйся настоящим, но стремись к лучшему.","author":"Сократ"},{"quote":"Боритесь со злом внутри вас, а не со злом внутри других.","author":"Конфуций"},{"quote":"Вы никогда не пересечете океан, если не наберетесь мужества потерять берег из виду.","author":"Христофор Колумб"},{"quote":"Каждый великий успех когда-то был невозможной мечтой.","author":"Неизвестный"},{"quote":"О нас думают плохо лишь те, кто хуже нас, а те кто лучше нас… Им просто не до нас…","author":"Омар Хайям"},{"quote":"Ваше время ограничено, не тратьте его, живя чужой жизнью.","author":"Стив Джобс"},{"quote":"Ничто не обходится в жизни так дорого, как болезнь и — глупость.","author":"Зигмунд Фрейд"},{"quote":"Живите ради чужой похвалы, и вы станете их пленником.","author":"Лао Цзы"},{"quote":"У кого-то к успеху есть ключ, но у кого-то есть лом и отмычка.","author":"Oxxxymiron"},{"quote":"Тот, кто смело шагает вперед, выигрывает битву.","author":"Теодор Рузвельт"},{"quote":"Я считаю, что человек живет на планете, а не в государстве.","author":"Виктор Цой"},{"quote":"Если к дверям не подходят ключи — вышиби двери плечом.","author":"Виктор Цой"},{"quote":"Выбери себе работу по душе, и тебе не придётся работать ни одного дня в своей жизни.","author":"Конфуций"},{"quote":"Что будут стоить тысячи слов, когда важна будет крепость руки?","author":"Виктор Цой"},{"quote":"Свобода — это не то, что вам дали. Это — то, что у вас нельзя отнять.","author":"Вольтер"},{"quote":"Никакое дело не покажется невыполнимым, если разбить его на части.","author":"Генри Форд"},{"quote":"Кратковременная неудача лучше кратковременной удачи.","author":"Абу-ль-Фарадж бин Харун"},{"quote":"Самое высшее наслаждение — сделать то, что, по мнению других, вы сделать не можете.","author":"Уолтер Бэджет"},{"quote":"Чтобы выигрывать, прежде всего, нужно играть.","author":"Альберт Эйнштейн"},{"quote":"Успех — это умение двигаться от неудачи к неудаче, не теряя энтузиазма.","author":"Уинстон Черчилль"},{"quote":"Не обязательно быть лучше всех, достаточно быть лучше, чем ты был вчера.","author":"Джо Фрейзер"},{"quote":"Лучший способ предсказать будущее — создавать его.","author":"Авраам Линкольн"},{"quote":"Самая большая слабость - в отказе от борьбы.","author":"Элисон Бич"},{"quote":"Самое трудное - это начать. Остальное зависит от упорства.","author":"Амелия Эрхарт"},{"quote":"Трудности укрепляют умы, так же как ветры укрепляют корабли.","author":"Эпиктет"},{"quote":"Счастье - это не что-то готовое. Оно поступает из ваших собственных действий.","author":"Далай Лама"},{"quote":"Ты должен верить в себя, даже если никто другой не верит в тебя.","author":"Брайан Трейси"},{"quote":"Счастье - это найти удовольствие в простых вещах.","author":"Джон Шепард"},{"quote":"Когда вы достигнете своей цели, поставьте новую и двигайтесь дальше.","author":"Лес Браун"},{"quote":"Чтобы пройти долгий путь, нужно делать маленькие шаги.","author":"Цзысянь"},{"quote":"Не бойтесь взглянуть на мир с другой точки зрения. Иногда это меняет все.","author":"Блэкстон"},{"quote":"Мудрость - это то, что вы делаете с тем, что вы узнали.","author":"Иэн Крамер"},{"quote":"Не все мечты могут стать реальностью, но все реальности начинаются с мечты.","author":"Джеймс Барри"},{"quote":"Возможности так же бесконечны, как ваше воображение.","author":"Валери Грассо"},{"quote":"Когда вы перестаете мечтать, вы перестаете жить.","author":"Малкольм Форбс"},{"quote":"Посвящайте свою энергию на построение нового, а не на борьбу с прошлым.","author":"Джек Мейер"},{"quote":"Безвыходным мы называем положение, выход из которого нам не нравится.","author":"Станислав Ежи Лец"},{"quote":"Позитивное мышление приводит к позитивным результатам.","author":"Вильям Джеймс"},{"quote":"Не переживайте об упущенных возможностях. Новая дверь открывается для каждой закрытой.","author":"Женевьев Нашим"},{"quote":"Чтобы добиться успеха, вы должны быть готовы к провалам.","author":"Гарри С. Трумэн"},{"quote":"Если всё будет так, как тебе хочется, то жить станет неинтересно.","author":"Харуки Мураками"},{"quote":"Не жди. Время никогда не будет «подходящим».","author":"Наполеон Хилл"},{"quote":"Родится дураком не позор. А вот умереть дураком стыдно.","author":"Эрих Мария Ремарк"},{"quote":"Каждый человек кузнец своего счастья.","author":"Саллюстий"},{"quote":"Если наши жизни уже написаны, то нужно быть смелым человеком, чтобы изменить сценарий.","author":"Alan Wake"},{"quote":"Начинать всегда стоит с того, что сеет сомнения.","author":"Борис Стругацкий"},{"quote":"Не завышай свои ожидания и ты никогда не будешь разочарован.","author":"Kratos"},{"quote":"Однажды сбившись с пути не значит быть навсегда потерянным.","author":"Charles Xavier"},{"quote":"Успех — это результат скрещивания удачи и тяжёлого труда","author":"Дастин Московиц"},{"quote":"Не стоит волноваться. В мире нет ничего страшнее нас самих.","author":"Туве Янссон"},{"quote":"Лучший способ предсказать будущее — это создать его.","author":"Абрахам Линкольн"},{"quote":"Существует два способа стать счастливым: улучшить реальность или снизить ожидания.","author":"Джоди Пиколт"},{"quote":"Хорошо сформулированная проблема — это наполовину решенная проблема.","author":"Чарльз Кеттеринг"},{"quote":"Не совершай классическую ошибку всех умников: не думай, что нет людей умнее тебя.","author":"Карл Ван Лун"},{"quote":"Ничто так не выдает человека, как то, над чем он смеётся.","author":"Иоганн Вольфганг фон Гёте"},{"quote":"Тот, кто боится страданий, уже страдает от страха.","author":"Мишель де Монтень"}]');const Tt=async()=>"en"===s()?At:Et,kt=document.querySelector(".quotes__text"),Lt=document.querySelector(".quotes__author"),It=async()=>{try{(e=>{const t=st(0,e.length-1);kt.textContent=e[t].quote,Lt.textContent=e[t].author})(await Tt())}catch(e){}},Ct=document.querySelector(".greeting__shadow"),Bt=document.querySelector(".greeting__popup"),Pt=e=>{Bt.classList[e]("greeting__popup_show"),Ct.classList[e]("greeting__shadow_show"),_.classList[e]("body_fixed")},Ot={".slider__button_prev":()=>{lt("prev"),ot("prev")},".slider__button_next":()=>{lt("next"),ot("next")},".player__playback-play":Ge,".player__playback-prev":()=>{document.querySelectorAll(".player__list-item")[Pe].classList.remove("player__list-item_active"),Pe--,Pe<0&&Oe(Je.length-1),Ze(),We()},".player__playback-next":et,".player__list":e=>(e=>{const t=parseInt(e.target.getAttribute("song_number"));isNaN(t)||(Pe!==t?(document.querySelectorAll(".player__list-item")[Pe].classList.remove("player__list-item_active"),Oe(t),Ze(),We()):Ge())})(e),".player__volume-mute":()=>{const e=bt(),t=qt();"true"===t?($e.volume=e,mt(dt,"muteSong"),vt("false")):"false"===t&&($e.volume=0,mt(yt,"unMuteSong"),vt("true"))},".slider__popup-close-button":()=>S("remove"),".settings__shadow_show":()=>{xt("remove"),he("remove")},".greeting__popup-close-button":()=>Pt("remove"),".slider__shadow_show":()=>S("remove"),".greeting__shadow_show":()=>Pt("remove"),".settings__header":()=>{he("toggle"),xt("toggle")},".settings__close-button":()=>{xt("remove"),he("remove")},".quotes__change-btn":()=>{It(),ke+=180,Te.style.transform=`rotate(${ke}deg)`},".settings__blocks-hide":e=>{(e=>{if(e.target.closest(".settings__blocks-hide-inner")&&"INPUT"!==e.target.tagName){const t=e.target.closest(".settings__blocks-hide-inner").querySelector("input");t.checked=!t.checked}})(e),(e=>{if(!Ce.includes(e.target.className)){const t=e.target.closest("[data-blockshide]").dataset.blockshide;document.querySelector(`.${t}`).classList.toggle("settings__blocks-hide_hide")}})(e),Ie()},".greeting__name":()=>{Be.includes(e.textContent)&&(e.textContent="",t())}},Dt=document.querySelector(".settings__language-inner"),jt=e=>e.blur(),Rt=()=>{const e=s();"en"===e?(Dt.classList.remove("settings__language-inner_ru"),Dt.classList.add("settings__language-inner_en")):"ru"===e&&(Dt.classList.remove("settings__language-inner_en"),Dt.classList.add("settings__language-inner_ru"))},Nt=document.querySelector(".settings__source-select"),Ut=Array.from(Nt.children),$t=(e,t)=>Ut[e].selected=t,Ht={".settings__query-input":()=>{const e=String(H.value.trim()),t=Array.from(e).some((e=>M.includes(e)));""===e||t?S("add"):(O(e),H.value=e,A(0),U())},".settings__source-select":e=>{(e=>{"github"===e.target.value?(j("github"),at()):(j("pexels"),U())})(e),jt(Nt)},".settings__language-select":()=>{localStorage.setItem("language",r.value),g(),Ae(),ve(),It(),Rt(),jt(r)},".weather__input":g},Mt={".player__volume-input":()=>{$e.volume=gt.value,_t(),0===$e.volume?(mt(yt,"unMuteSong"),ft.setAttribute("disabled",!0),vt("true")):(mt(dt,"muteSong"),ft.removeAttribute("disabled"),vt("false"))},".greeting__name":()=>{t(),e.textContent.length>=19&&(e.blur(),e.textContent=e.textContent.slice(0,18),t(),Pt("add"))},".player__progress-input":()=>{const e=Re.value,t=Re.max;$e.currentTime=e/t*$e.duration}},Wt=document.querySelector(".player__list"),Ft=V().split(" ")[1].slice(0,-1),Gt=document.querySelector(".slider__popup-close-button"),Jt=e=>Gt.classList[e]("slider__popup-close-button_hover"),Kt=()=>e.textContent=e.textContent.trim(),Vt={Enter:()=>{e.blur(),f.blur(),H.blur(),Kt()},Escape:()=>{xt("remove"),he("remove"),Pt("remove"),S("remove")}},zt=document.querySelector(".greeting__popup-close-button"),Yt=e=>{zt.classList[e]("greeting__popup-close-button_hover")},Xt=document.querySelector(".settings__close-button"),Qt=e=>{Xt.classList[e]("settings__close-button_hover")};setInterval((()=>{we(),Ae()}),1e3),Ae(),we(),ve(),It(),Je.forEach(((e,t)=>{const o=document.createElement("li"),r=Qe(e);o.classList.add("player__list-item"),o.textContent=r,o.setAttribute("song_number",t),Wt.append(o)})),Ze(),Re.setAttribute("disabled",!0),(()=>{const e=s();"en"===e?(a("ru",!1),a("en",!0)):"ru"===e&&(a("en",!1),a("ru",!0))})(),Rt(),(()=>{const e=D();"github"===e?($t(1,!1),$t(0,!0)):"pexels"===e&&($t(0,!1),$t(1,!0))})(),f.value=localStorage.getItem("city")||"Гомель",g(),e.textContent=localStorage.getItem("name"),(()=>{const e=W(),t=s();O(e||("ru"===t?nt(Ft):Ft))})(),at(),U(),(()=>{const e=bt();$e.volume=e,gt.value=e,0===$e.volume?(mt(yt,"unMuteSong"),ft.setAttribute("disabled",!0)):(mt(dt,"muteSong"),ft.removeAttribute("disabled"),_t())})(),H.value=W(),(()=>{const e=JSON.parse(localStorage.getItem("indexOfCheckedInputs"));e&&e.map((e=>Le[e].checked=!0))})(),Array.from(Le).filter((e=>e.checked)).map((e=>document.querySelector(`.${e.getAttribute("name")}`).classList.add("settings__blocks-hide_hide"))),(()=>{const e=bt(),t=qt();"true"===t?(mt(yt,"unMuteSong"),$e.volume=0):"false"===t&&(mt(dt,"muteSong"),$e.volume=e)})(),window.addEventListener("beforeunload",(()=>{localStorage.setItem("city",f.value),localStorage.setItem("queryInputValue",H.value.trim())})),$e.addEventListener("timeupdate",(function(e){Xe(),(e=>{const{duration:t,currentTime:o}=e.srcElement;t&&(Re.max=t,Re.value=o)})(e)})),window.addEventListener("click",(function(t){Ee(t,Ot),(t=>{t.target.classList.contains("greeting__name")||(e.blur(),Kt())})(t)})),$e.addEventListener("ended",et),window.addEventListener("input",(e=>Ee(e,Mt))),window.addEventListener("change",(e=>Ee(e,Ht))),window.addEventListener("keydown",(e=>(e=>{const t=e.key;t in Vt&&Vt[t]()})(e))),q.addEventListener("mouseleave",(()=>Jt("add"))),q.addEventListener("mouseenter",(()=>Jt("remove"))),Bt.addEventListener("mouseleave",(()=>Yt("add"))),Bt.addEventListener("mouseenter",(()=>Yt("remove"))),St.addEventListener("mouseleave",(()=>Qt("add"))),St.addEventListener("mouseenter",(()=>Qt("remove")))}()}();