!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.firebase=e()}(this,function(){"use strict";!function(t){if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=function(t){return t&&DataView.prototype.isPrototypeOf(t)},o=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};f.prototype.append=function(t,e){t=a(t),e=c(e);var r=this.map[t];this.map[t]=r?r+","+e:e},f.prototype.delete=function(t){delete this.map[a(t)]},f.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},f.prototype.set=function(t,e){this.map[a(t)]=c(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),u(t)},f.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),u(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),u(t)},e.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},y.call(v.prototype),y.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},m.error=function(){var t=new m(null,{status:0,statusText:""});return t.type="error",t};var s=[301,302,303,307,308];m.redirect=function(t,e){if(-1===s.indexOf(e))throw new RangeError("Invalid status code");return new m(null,{status:e,headers:{location:t}})},t.Headers=f,t.Request=v,t.Response=m,t.fetch=function(t,r){return new Promise(function(n,o){var i=new v(t,r),s=new XMLHttpRequest;s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;n(new m(o,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&e.blob&&(s.responseType="blob"),i.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function c(t){return"string"!=typeof t&&(t=String(t)),t}function u(t){var r={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(r[Symbol.iterator]=function(){return r}),r}function f(t){this.map={},t instanceof f?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function l(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&n(t))this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!o(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=d(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=h(this);if(t)return t;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(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,e,r,n=h(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function b(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function m(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:void 0);var t=setTimeout;function e(){}function r(t){if(!(this instanceof r))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],a(t,this)}function n(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,r._immediateFn(function(){var r=1===t._state?e.onFulfilled:e.onRejected;if(null!==r){var n;try{n=r(t._value)}catch(t){return void i(e.promise,t)}o(e.promise,n)}else(1===t._state?o:i)(e.promise,t._value)})):t._deferreds.push(e)}function o(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof r)return t._state=3,t._value=e,void s(t);if("function"==typeof n)return void a((o=n,c=e,function(){o.apply(c,arguments)}),t)}t._state=1,t._value=e,s(t)}catch(e){i(t,e)}var o,c}function i(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&r._immediateFn(function(){t._handled||r._unhandledRejectionFn(t._value)});for(var e=0,o=t._deferreds.length;e0?U(function(t){return isNaN(t=+t)?0:(t>0?R:N)(t)}(t),9007199254740991):0},L=Array.isArray||function(t){return"Array"==B(t)},z=f["__core-js_shared__"]||(f["__core-js_shared__"]={}),M=function(t){return z[t]||(z[t]={})},W=u(function(t){var e=M("wks"),r=f.Symbol,n="function"==typeof r;(t.exports=function(t){return e[t]||(e[t]=n&&r[t]||(n?r:P)("Symbol."+t))}).store=e}),$=W("species"),q=function(t,e){return new(function(t){var e;return L(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!L(e.prototype)||(e=void 0),p(e)&&null===(e=e[$])&&(e=void 0)),void 0===e?Array:e}(t))(e)},H=function(t,e){var r=1==t,n=2==t,o=3==t,i=4==t,s=6==t,a=5==t||s,c=e||q;return function(e,u,f){for(var h,p,l=Object(I(e)),d=D(l),y=S(u,f,3),v=C(d.length),b=0,m=r?c(e,v):n?c(e,0):void 0;v>b;b++)if((a||b in d)&&(p=y(h=d[b],b,l),t))if(r)m[b]=p;else if(p)switch(t){case 3:return!0;case 5:return h;case 6:return b;case 2:m.push(h)}else if(i)return!1;return s?-1:o||i?i:m}},G=W("unscopables"),K=Array.prototype;void 0==K[G]&&g(K,G,{});var V=function(t){K[G][t]=!0},X=H(5),J=!0;"find"in[]&&Array(1).find(function(){J=!1}),k(k.P+k.F*J,"Array",{find:function(t){return X(this,t,arguments.length>1?arguments[1]:void 0)}}),V("find");h.Array.find;var Q=H(6),Y=!0;"findIndex"in[]&&Array(1).findIndex(function(){Y=!1}),k(k.P+k.F*Y,"Array",{findIndex:function(t){return Q(this,t,arguments.length>1?arguments[1]:void 0)}}),V("findIndex");h.Array.findIndex;var Z=W("match"),tt=function(t,e,r){if(p(n=e)&&(void 0!==(o=n[Z])?o:"RegExp"==B(n)))throw TypeError("String#"+r+" doesn't accept regex!");var n,o;return String(I(t))},et=W("match"),rt="".startsWith;k(k.P+k.F*function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[et]=!1,!"/./"[t](e)}catch(t){}}return!0}("startsWith"),"String",{startsWith:function(t){var e=tt(this,t,"startsWith"),r=C(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),n=String(t);return rt?rt.call(e,n,r):e.slice(r,r+n.length)===n}});h.String.startsWith;var nt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};function ot(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var r in e)e.hasOwnProperty(r)&&(t[r]=ot(t[r],e[r]));return t}function it(t,e,r){t[e]=r}var st="FirebaseError",at=Error.captureStackTrace,ct=function(){return function(t,e){if(this.code=t,this.message=e,at)at(this,ut.prototype.create);else{var r=Error.apply(this,arguments);this.name=st,Object.defineProperty(this,"stack",{get:function(){return r.stack}})}}}();ct.prototype=Object.create(Error.prototype),ct.prototype.constructor=ct,ct.prototype.name=st;var ut=function(){function t(t,e,r){this.service=t,this.serviceName=e,this.errors=r,this.pattern=/\{\$([^}]+)}/g}return t.prototype.create=function(t,e){void 0===e&&(e={});var r,n=this.errors[t],o=this.service+"/"+t;r=void 0===n?"Error":n.replace(this.pattern,function(t,r){var n=e[r];return void 0!==n?n.toString():"<"+r+"?>"}),r=this.serviceName+": "+r+" ("+o+").";var i=new ct(o,r);for(var s in e)e.hasOwnProperty(s)&&"_"!==s.slice(-1)&&(i[s]=e[s]);return i},t}();!function(t){function e(){var e=t.call(this)||this;e.chain_=[],e.buf_=[],e.W_=[],e.pad_=[],e.inbuf_=0,e.total_=0,e.blockSize=64,e.pad_[0]=128;for(var r=1;r>>31)}var i,s,a=this.chain_[0],c=this.chain_[1],u=this.chain_[2],f=this.chain_[3],h=this.chain_[4];for(n=0;n<80;n++){n<40?n<20?(i=f^c&(u^f),s=1518500249):(i=c^u^f,s=1859775393):n<60?(i=c&u|f&(c|u),s=2400959708):(i=c^u^f,s=3395469782);o=(a<<5|a>>>27)+i+h+s+r[n]&4294967295;h=f,f=u,u=4294967295&(c<<30|c>>>2),c=a,a=o}this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+c&4294967295,this.chain_[2]=this.chain_[2]+u&4294967295,this.chain_[3]=this.chain_[3]+f&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},e.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var r=e-this.blockSize,n=0,o=this.buf_,i=this.inbuf_;n=56;r--)this.buf_[r]=255&e,e/=256;this.compress_(this.buf_);var n=0;for(r=0;r<5;r++)for(var o=24;o>=0;o-=8)t[n]=this.chain_[r]>>o&255,++n;return t}}(function(){return function(){this.blockSize=-1}}());function ft(t,e){var r=new ht(t,e);return r.subscribe.bind(r)}var ht=function(){function t(t,e){var r=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(function(){t(r)}).catch(function(t){r.error(t)})}return t.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},t.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},t.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},t.prototype.subscribe=function(t,e,r){var n,o=this;if(void 0===t&&void 0===e&&void 0===r)throw new Error("Missing Observer.");void 0===(n=function(t,e){if("object"!=typeof t||null===t)return!1;for(var r=0,n=e;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]"}),n=this.serviceName+": "+n+" ("+i+").";var o=new u(i,n);for(var s in t)t.hasOwnProperty(s)&&"_"!==s.slice(-1)&&(o[s]=t[s]);return o},e}();(function(e){function t(){var t=e.call(this)||this;t.chain_=[],t.buf_=[],t.W_=[],t.pad_=[],t.inbuf_=0,t.total_=0,t.blockSize=64,t.pad_[0]=128;for(var n=1;n>>31)}var o,s,a=this.chain_[0],c=this.chain_[1],u=this.chain_[2],h=this.chain_[3],f=this.chain_[4];for(r=0;r<80;r++){r<40?r<20?(o=h^c&(u^h),s=1518500249):(o=c^u^h,s=1859775393):r<60?(o=c&u|h&(c|u),s=2400959708):(o=c^u^h,s=3395469782);i=(a<<5|a>>>27)+o+f+s+n[r]&4294967295;f=h,h=u,u=4294967295&(c<<30|c>>>2),c=a,a=i}this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+c&4294967295,this.chain_[2]=this.chain_[2]+u&4294967295,this.chain_[3]=this.chain_[3]+h&4294967295,this.chain_[4]=this.chain_[4]+f&4294967295},t.prototype.update=function(e,t){if(null!=e){void 0===t&&(t=e.length);for(var n=t-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r=56;n--)this.buf_[n]=255&t,t/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)e[r]=this.chain_[n]>>i&255,++r;return e}})(function(){return function(){this.blockSize=-1}}());function f(e,t){var n=new d(e,t);return n.subscribe.bind(n)}var d=function(){function e(e,t){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(n)}).catch(function(e){n.error(e)})}return e.prototype.next=function(e){this.forEachObserver(function(t){t.next(e)})},e.prototype.error=function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)},e.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},e.prototype.subscribe=function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!=typeof e||null===e)return!1;for(var n=0,r=t;n0?2==t.length?typeof t[1]==e?this[t[0]]=t[1].call(this,w):this[t[0]]=t[1]:3==t.length?typeof t[1]!==e||t[1].exec&&t[1].test?this[t[0]]=w?w.replace(t[1],t[2]):s:this[t[0]]=w?t[1].call(this,w,t[2]):s:4==t.length&&(this[t[0]]=w?t[3].call(this,w.replace(t[1],t[2])):s):this[t]=w||s;u+=2}},str:function(i,e){for(var r in e)if(typeof e[r]===o&&e[r].length>0){for(var n=0;n0){var e=document.getElementsByClassName(Y+"-resubscribe-div")[0];document.body.removeChild(e)}},this.showPopUp=function(){null!=I&&I.close(),oSpP.removeTransparentDiv(),P&&oSpP.sendPromptStat("prompt_granted");var e=void 0!==window.screenLeft?window.screenLeft:screen.left,t=void 0!==window.screenTop?window.screenTop:screen.top,o=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,n=o/2-290+e,p=i/3-i/3+t,a=oSpP.getBrowserlanguage();""==a&&(a="en"),I=window.open(s+"/"+a+"/"+g+"/"+r,"_blank","scrollbars=yes, width=580, height=580, top="+p+", left="+n),window.focus&&I.focus(),M=setInterval((function(){I.postMessage("init",s),I.postMessage("initpage|"+window.location.href,s),I.postMessage("initvariables|"+JSON.stringify(oSpP.getUserVariables()),s)}),100),P?oSpP.closePrompt(!0):J||oSpP.closePrompt(!0)},this.closePrompt=function(e){void 0===e&&oSpP.sendPromptStat("prompt_closed"),document.getElementsByClassName(Y+"-prompt").length>0&&document.body.removeChild(document.querySelector("."+Y+"-prompt")),document.getElementsByClassName(Y+"-prompt-backdrop").length>0&&document.body.removeChild(document.querySelector("."+Y+"-prompt-backdrop")),oSpP.putValueToDb("SPIDs",{type:"PromptClosed",value:j})},this.push=function(t,o){if(!oSpP.detectSite())return oSpP.log("Application allowed only for "+e),!1;T[t]=o,oSpP.getDbValue("SPIDs","SubscriptionId",(function(e){void 0===e.target.result?L||(L=setInterval((function(){oSpP.getDbValue("SPIDs","SubscriptionId",(function(e){void 0!==e.target.result&&(oSpP.sendUpdatesToServer(e.target.result.value),clearInterval(L),L=!1)}))}),1e3)):oSpP.sendUpdatesToServer(e.target.result.value)}))},this.sendUpdatesToServer=function(e){var t=oSpPOptions.sSubscriptionPrefix;switch(l){case"safari":case"firefox":t=""}var o=new XMLHttpRequest;o.open("POST",S,!0),o.setRequestHeader("Content-Type","application/json");var i={action:"subscription",subscriptionId:e,subscription_type:t,subscription_action:"update_variables",appkey:g,sPushHostHash:r,custom_data:{variables:T}};o.send(JSON.stringify(i))},this.sendPromptStat=function(e){"prompt_denied"===e&&oSpP.putValueToDb("SPIDs",{type:"SubscriptionId",value:"denied"})},this.showhelpPromptText=function(){var e=document.getElementsByTagName("head")[0],t=document.createElement("link");if(t.rel="stylesheet",t.type="text/css",t.href="https://"+a+"/dist/css/push/"+W.toLowerCase()+"-prompt.min.css?v="+q,t.media="all",e.appendChild(t),v.length>=0&&"-"!=v){var o=document.createElement("div");o.setAttribute("class",Y+"-backdrop-info"),o.setAttribute("style","display:none;");var i=document.createElement("div");i.setAttribute("class","backdrop-close"),i.innerHTML+="×
ESC",i.setAttribute("onclick","oSpP.closePromptHelpText(false); return false;"),o.appendChild(i);var r=document.createElement("div");if(r.setAttribute("class","backdrop-message"),r.innerHTML+=v,o.appendChild(r),"chrome"===c.name.toLowerCase()){var s=this.getPushHintDiv();o.appendChild(s)}document.body.insertBefore(o,document.body.childNodes[0]),setTimeout((function(){oSpP.getDbValue("SPIDs","PromptClosed",(function(e){void 0===e.target.result&&(o.className+=o.className?" show-prompt":"show-prompt")}))}),1e3)}},this.showPushLabel=function(){if(J){var e=!0,t=new UAParser,i=t.getBrowser();if(i.os=t.getOS().name,void 0!==V&&0==V&&(e=!1),e){var r=document.createElement("div"),s='Web Push '+W+"";if(document.getElementsByClassName(Y+"-backdrop-info").length){if(r.setAttribute("class",Y+"-bottom-push-label "+Y+"-show"),r.innerHTML+=s,"chrome"===i.name.toLowerCase()&&!document.getElementsByClassName(Y+"-hint-popover").length){var n=this.getPushHintDiv();document.getElementsByClassName(Y+"-backdrop-info")[0].appendChild(n)}document.getElementsByClassName(Y+"-backdrop-info")[0].appendChild(r)}else{var p=Y+"-"+u.toLowerCase().replace(" ",""),a=Y+"-lang-"+oSpP.getBrowserlanguage().toLowerCase().replace(" ",""),c=Y+"-"+i.name.toLowerCase().replace(" ",""),l=c+i.major;r.setAttribute("style","display:none"),r.setAttribute("class",Y+"-webpush-label "+p+" "+c+" "+a+" "+l),r.setAttribute("onclick","this.remove();");var d=document.createElement("div");if(d.setAttribute("class",Y+"-inner-content"),d.innerHTML+=s,"chrome"===i.name.toLowerCase()){n=this.getPushHintDiv();r.appendChild(n)}r.appendChild(d),document.body.insertBefore(r,document.body.childNodes[0])}setTimeout((function(){if(null!==document.querySelector("."+Y+"-webpush-label")){var e=document.querySelector("."+Y+"-webpush-label");e.setAttribute("class",e.getAttribute("class")+" "+Y+"-show")}}),1e3)}}},this.getPushHintDiv=function(){var e=oSpP.getMessageLang(oSpP.getBrowserlanguage()),t=document.createElement("div"),o=Y+"-prompt "+Y+"-hint-popover show-prompt";oSpP.isYandexBrowser()&&(o+=" "+Y+"-yandex"),t.setAttribute("class",o);var i=document.createElement("div");i.setAttribute("class",Y+"-prompt-message");var r=document.createElement("div");r.setAttribute("class",Y+"-table-wrapper");var s=document.createElement("div");s.setAttribute("class",Y+"-cell"),s.innerHTML+=Z[e];var n=document.createElement("div");n.setAttribute("class",Y+"-cell"),n.innerHTML="",r.appendChild(s),r.appendChild(n);var p=document.createElement("div");return p.setAttribute("class",Y+"-prompt-message-text"),p.innerHTML=Q[e],i.appendChild(r),i.appendChild(p),t.appendChild(i),t},this.showCustomPrompt=function(){oSpP.getDbValue("SPIDs","PromptShowed",(function(e){void 0===e.target.result?(oSpP.sendPromptStat("prompt_showed"),oSpP.putValueToDb("SPIDs",{type:"PromptShowed",value:1})):oSpP.sendPromptStat("prompt_showed_again")}));var e,t=document.getElementsByTagName("head")[0],o=document.createElement("link");o.rel="stylesheet",o.type="text/css",o.href="https://"+a+"/dist/css/push/"+W.toLowerCase()+"-prompt.min.css?v="+q,o.media="all",t.appendChild(o);var i=Y+"-popover",r="display:none;",s=!0;void 0!==V&&0==V&&(s=!1);var n=oSpP.getMessageLang(oSpP.getBrowserlanguage());if(b.length<=0&&D.length>0&&!J&&P&&(b=D,e=JSON.parse(b),w=e.text),b.length>0){if("Sendbox"===W)var p='';else p='';var c='';(i=(e=JSON.parse(b)).style)===Y+"-popover"&&(i=Y+"-native-popover");var l=document.createElement("div"),u=Y+"-prompt "+i;l.setAttribute("class",u),e.backgroundcolor.length>0&&i!=Y+"-fab"&&(r=r+"background-color: "+e.backgroundcolor+";"),l.setAttribute("style",r);var d=document.createElement("div");d.setAttribute("class",Y+"-prompt-message");var S=document.createElement("img");if(S.setAttribute("class",Y+"-bell-icon"),S.setAttribute("width","14"),S.setAttribute("height","14"),S.setAttribute("src","https://"+a+"/img/push/icon-ring.svg"),s){var m=document.createElement("span");m.setAttribute("class",Y+"-link-wrapper"),(L=document.createElement("a")).setAttribute("class",Y+"-link"),L.setAttribute("href",B),L.setAttribute("target","_blank");var g=document.createElement("span");i===Y+"-modal"&&(L.setAttribute("style","color: "+e.textcolor+" !important;"),m.setAttribute("style","color: "+e.textcolor+" !important;"),g.setAttribute("style","color: "+e.textcolor+" !important;")),g.innerHTML=R[n],i!=Y+"-bar"&&(L.innerHTML=p),L.appendChild(g),m.appendChild(L)}if(i===Y+"-native-popover"){r=r+"color: "+e.textcolor+" !important;",l.setAttribute("style",r),void 0!==e.custom&&void 0!==e.custom.prompt_position&&(u+=" "+Y+"-pos-"+e.custom.prompt_position,l.setAttribute("class",u)),(C=document.createElement("div")).setAttribute("class",Y+"-native-info-inner "+Y+"-table-wrapper");var v=document.createElement("div");v.setAttribute("class",Y+"-cell"),S.setAttribute("src","https://"+a+e.icon),S.setAttribute("width","64"),S.setAttribute("height","64"),v.appendChild(S);var f=document.createElement("div");f.setAttribute("class",Y+"-cell");var M=document.createElement("div");M.setAttribute("class",Y+"-prompt-info "+Y+"-prompt-message-text"),M.innerHTML+=w,f.appendChild(M),C.appendChild(v),C.appendChild(f)}else if(i==Y+"-bar"){(C=document.createElement("div")).setAttribute("class",Y+"-prompt-info "+Y+"-prompt-message-text"),C.setAttribute("style","color: "+e.textcolor+" !important;"),C.innerHTML+=w;var I=document.createElement("span");d.innerHTML+=c+' '}else if(i==Y+"-fab"){if((C=document.createElement("div")).setAttribute("class",Y+"-prompt-title "+Y+"-prompt-message-text"),e.textcolor.length>0&&C.setAttribute("style","color: "+e.textcolor+" !important;"),C.innerHTML=h,(I=document.createElement("div")).setAttribute("class",Y+"-prompt-info "+Y+"-prompt-message-text"),e.textcolor.length>0&&I.setAttribute("style","color: "+e.textcolor+" !important;"),I.innerHTML+=w,void 0!==e.custom&&void 0!==e.custom.prompt_size&&"big"===e.custom.prompt_size){I=null,u=Y+"-prompt "+Y+"-floating-panel",l.setAttribute("class",u),d.setAttribute("style","background-color: "+e.btncolor+"; color: "+e.textcolor+" !important;"),d.setAttribute("onclick","oSpP.startSubscription(); return false;"),(C=document.createElement("div")).setAttribute("style","color: "+e.textcolor+" !important;"),C.setAttribute("class",Y+"-table-wrapper");var y=document.createElement("div");y.setAttribute("class",Y+"-cell");var O=document.createElement("a");O.innerHTML+=''+c+"",O.setAttribute("href","#"),y.appendChild(O);var A=document.createElement("div");A.setAttribute("class",Y+"-cell");var T=document.createElement("a");T.setAttribute("href","#"),T.innerHTML=h,A.appendChild(T),C.appendChild(y),C.appendChild(A);var L,x=document.createElement("div");x.setAttribute("class",Y+"-prompt-label"),(L=document.createElement("a")).setAttribute("href",B),L.setAttribute("target","_blank"),(g=document.createElement("span")).innerHTML=R[n],L.appendChild(g),x.appendChild(L)}else{var N=document.createElement("div");N.setAttribute("class",Y+"-prompt-fab "+Y+"_notify_prompt"),N.setAttribute("onclick","oSpP.startSubscription();oSpP.showHintDiv(); return false;"),e.btncolor.length>0&&N.setAttribute("style","background-color: "+e.btncolor+" !important;"),N.innerHTML+=c+''}void 0!==e.custom&&void 0!==e.custom.prompt_position&&(u+=" "+Y+"-fab-"+e.custom.prompt_position,l.setAttribute("class",u))}else if(i==Y+"-modal"||i==Y+"-safari"){var C;(C=document.createElement("div")).setAttribute("class",Y+"-prompt-title "+Y+"-prompt-message-text"),e.textcolor.length>0&&C.setAttribute("style","color: "+e.textcolor+" !important;"),C.innerHTML=h,(I=document.createElement("div")).setAttribute("class",Y+"-prompt-info "+Y+"-prompt-message-text"),e.textcolor.length>0&&I.setAttribute("style","color: "+e.textcolor+" !important;"),I.innerHTML+=w,i==Y+"-safari"?(S.setAttribute("src","https://"+a+e.icon),S.setAttribute("width","64"),S.setAttribute("height","64"),d.appendChild(S)):d.innerHTML+=c+' '}if(i!=Y+"-fab"){var E=document.createElement("div");E.setAttribute("class",Y+"-prompt-buttons");var j=document.createElement("button");j.setAttribute("class",Y+"-prompt-btn "+Y+"-accept-btn "+Y+"_notify_prompt"),j.setAttribute("type","button"),j.setAttribute("onclick","oSpP.startSubscription();oSpP.showHintDiv();oSpP.closeCustomPrompt(true); return false;");var k=document.createElement("button");if(k.setAttribute("class",Y+"-prompt-btn "+Y+"-disallow-btn"),k.setAttribute("type","button"),k.setAttribute("onclick","oSpP.sendPromptStat('prompt_denied');oSpP.closeCustomPrompt(true); return false;"),j.innerHTML=e.allowbtntext,k.innerHTML=e.disallowbtntext,j.setAttribute("style","background-color:"+e.buttoncolor+" !important;border-color:"+e.buttoncolor+" !important;"),k.setAttribute("style","color:"+e.buttoncolor+" !important;"),i===Y+"-native-popover"){var _=document.createElement("div");_.setAttribute("class",Y+"-table-wrapper");var z=document.createElement("div");z.setAttribute("class",Y+"-cell"),s&&void 0!==m&&z.appendChild(m);var U=document.createElement("div");U.setAttribute("class",Y+"-cell"),U.appendChild(k);var H=document.createElement("div");H.setAttribute("class",Y+"-cell"),H.appendChild(j),_.appendChild(z),_.appendChild(U),_.appendChild(H),E.appendChild(_)}else E.appendChild(k),E.appendChild(j);if(s&&i==Y+"-modal"){var Z=document.createElement("div");Z.innerHTML=" ",E.appendChild(Z)}}if(d.appendChild(C),void 0!==I&&null!=I&&i!=Y+"-native-popover"&&d.appendChild(I),i!==Y+"-fab"?(d.appendChild(E),s&&void 0!==m&&i!==Y+"-native-popover"&&E.appendChild(m),l.appendChild(d)):void 0!==e.custom.prompt_size&&"big"===e.custom.prompt_size?(l.appendChild(d),s&&void 0!==x&&l.appendChild(x)):(s&&void 0!==m&&d.appendChild(m),l.appendChild(d),l.appendChild(N)),i!=Y+"-fab"){var Q=document.createElement("button");Q.setAttribute("class",Y+"-prompt-close"),Q.setAttribute("onclick","oSpP.closeCustomPrompt(false); return false;"),Q.setAttribute("style","color:"+e.textcolor+" !important;"),Q.innerHTML="×",l.appendChild(Q)}if(document.body.insertBefore(l,document.body.childNodes[0]),i==Y+"-modal"){var G=document.createElement("div");G.setAttribute("class",Y+"-prompt-backdrop"),G.setAttribute("style","display:none;"),document.body.insertBefore(G,document.body.childNodes[1])}setTimeout((function(){l.className+=l.className?" show-prompt":"show-prompt"}),1e3)}},this.closeCustomPrompt=function(e){oSpP.sendPromptStat("prompt_closed"),null!==document.body.querySelector("."+Y+"-prompt")&&document.body.querySelector("."+Y+"-prompt").remove(),oSpP.closePromptHelpText(!0),e||oSpP.putValueToDb("SPIDs",{type:"PromptClosed",value:j})},this.showHintDiv=function(){if(J&&"chrome"===c.name.toLowerCase()){var e=this.getPushHintDiv();e.setAttribute("class",Y+"-prompt "+Y+"-hint-popover show-prompt "+Y+"-secure-mode"),document.body.appendChild(e)}},this.hideHintDiv=function(){document.getElementsByClassName(Y+"-hint-popover").length&&document.querySelector("."+Y+"-hint-popover").remove()},this.closePromptHelpText=function(e){null!==document.querySelector("."+Y+"-backdrop-info")&&document.querySelector("."+Y+"-backdrop-info").remove(),e?oSpP.sendPromptStat("prompt_closed"):oSpP.putValueToDb("SPIDs",{type:"PromptClosed",value:j})},this.closePushLabel=function(){null!==document.querySelector("."+Y+"-bottom-push-label")&&document.querySelector("."+Y+"-bottom-push-label").remove(),null!==document.querySelector("."+Y+"-webpush-label")&&document.querySelector("."+Y+"-webpush-label").remove()},this.getMessageLang=function(e){return"ua"==(e=e.substring(0,2).toLowerCase())||"uk"==e?"ua":"ru"==e?"ru":"en"},this.storeSubscription=function(e){oSpP.log("StoreSubscription: "+e),oSpP.putValueToDb("SPIDs",{type:"SubscriptionId",value:e})},this.getPromptDelay=function(){return parseInt(G)},this.getSettingsShowByVisitNumber=function(){return parseInt(F)},this.startDelayedSubscription=function(e){if(parseInt(G)>0)var t=setInterval((function(){oSpP.getDbValue("SPIDs","PromptDelay",(function(o){void 0!==o.target.result?(new Date).getTime()>=o.target.result.value&&(clearInterval(t),e()):(clearInterval(t),e())}))}),1e3);else e()},this.getAuthEmailFromUrl=function(){var e=window.location.href,t=new RegExp("[?&]spush(=([^&#]*)|&|#|$)").exec(e);if(t&&t[2]){var o=atob(decodeURIComponent(t[2].replace(/\+/g," ")));void 0!==o&&o.length>0&&oSpP.push("email",o)}},this.getVisitsCount=function(){var e=1;oSpP.getDbValue("SPIDs","VisitsCount",(function(t){void 0===t.target.result?(oSpP.putValueToDb("SPIDs",{type:"VisitsCount",value:e}),e>=oSpP.getSettingsShowByVisitNumber()&&oSpP.checkIsServiceWorkerExitsAndInitPrompt(!1)):(e=t.target.result.value,e+=1,oSpP.putValueToDb("SPIDs",{type:"VisitsCount",value:e}),e>=oSpP.getSettingsShowByVisitNumber()&&oSpP.checkIsServiceWorkerExitsAndInitPrompt(!1))}))},this.checkIsPopUpWindow=function(){return-1===oSpP.clearDomain(window.location.href.toLowerCase()).indexOf(oSpP.clearDomain(oSpPOptions.sAppUrlShow.toLowerCase()))&&-1!==oSpP.clearDomain(window.location.href.toLowerCase()).indexOf(oSpP.clearDomain(oSpPOptions.sPushSubSomain.toLowerCase()))},this.initPrompt=function(){oSpP.getPromptDelay()>0?oSpP.getDbValue("SPIDs","PromptDelay",(function(e){void 0===e.target.result?(oSpP.putValueToDb("SPIDs",{type:"PromptDelay",value:(new Date).getTime()+1e3*oSpP.getPromptDelay()}),oSpP.start()):oSpP.start()})):oSpP.start(),oSpP.getAuthEmailFromUrl()},this.urlBase64ToUint8Array=function(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),o=window.atob(t),i=new Uint8Array(o.length),r=0;r1?oSpP.getVisitsCount():oSpP.checkIsServiceWorkerExitsAndInitPrompt(!1)}));var oSpP=new oPromptPush;document.onkeyup=function(e){27===(e=e||window.event).keyCode&&oSpP.closePromptHelpText(!1)};