var device_type='desktop';var browser_name='Chrome';var browser_version={value:'62.0.3202.94'};//add swv&bv in all req !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.async=n.async||{})}(this,function(n){"use strict";function t(n,t,e){switch(e.length){case 0:return n.call(t);case 1:return n.call(t,e[0]);case 2:return n.call(t,e[0],e[1]);case 3:return n.call(t,e[0],e[1],e[2])}return n.apply(t,e)}function e(n,e){return e=et(void 0===e?n.length-1:e,0),function(){for(var r=arguments,u=-1,i=et(r.length-e,0),o=Array(i);++u-1&&n%1==0&&ft>=n}function a(n){return null!=n&&f(rt(n))&&!c(n)}function l(){}function s(n){return function(){if(null!==n){var t=n;n=null,t.apply(this,arguments)}}}function p(n){return at&&n[at]&&n[at]()}function h(n,t){return function(e){return n(t(e))}}function y(n,t){return null!=n&&(ht.call(n,t)||"object"==typeof n&&t in n&&null===st(n))}function v(n,t){for(var e=-1,r=Array(n);++e-1&&n%1==0&&t>n}function k(n){var t=n&&n.constructor,e="function"==typeof t&&t.prototype||xt;return n===e}function w(n){var t=k(n);if(!t&&!a(n))return vt(n);var e=S(n),r=!!e,u=e||[],i=u.length;for(var o in n)!y(n,o)||r&&("length"==o||j(o,i))||t&&"constructor"==o||u.push(o);return u}function L(n){var t=-1,e=n.length;return function(){return++te?{value:n[u],key:u}:null}}function x(n){if(a(n))return L(n);var t=p(n);return t?E(t):O(n)}function A(n){return function(){if(null===n)throw new Error("Callback was already called.");var t=n;n=null,t.apply(this,arguments)}}function _(n){return function(t,e,r){function u(n){if(f-=1,n)c=!0,r(n);else{if(c&&0>=f)return r(null);i()}}function i(){for(;n>f&&!c;){var t=o();if(null===t)return c=!0,void(0>=f&&r(null));f+=1,e(t.value,t.key,A(u))}}if(r=s(r||l),0>=n||!t)return r(null);var o=x(t),c=!1,f=0;i()}}function I(n,t,e,r){_(t)(n,e,r)}function T(n,t){return function(e,r,u){return n(e,t,r,u)}}function F(n,t,e){function r(n){n?e(n):++i===o&&e(null)}e=s(e||l);var u=0,i=0,o=n.length;for(0===o&&e(null);o>u;u++)t(n[u],u,A(r))}function z(n,t,e){var r=a(n)?F:At;r(n,t,e)}function B(n){return function(t,e,r){return n(z,t,e,r)}}function M(n,t,e,r){r=s(r||l),t=t||[];var u=[],i=0;n(t,function(n,t,r){var o=i++;e(n,function(n,t){u[o]=t,r(n)})},function(n){r(n,u)})}function V(n){return function(t,e,r,u){return n(_(e),t,r,u)}}function q(n){return r(function(t,e){var r;try{r=n.apply(this,t)}catch(u){return e(u)}o(r)&&"function"==typeof r.then?r.then(function(n){e(null,n)},function(n){e(n.message?n:new Error(n))}):e(null,r)})}function $(n,t){for(var e=-1,r=n?n.length:0;++em;){var n=b.shift();n()}}function o(n,t){var e=g[n];e||(e=g[n]=[]),e.push(t)}function c(n){var t=g[n]||[];$(t,function(n){n()}),i()}function f(n,t){if(!d){var u=A(e(function(t,e){if(m--,e.length<=1&&(e=e[0]),t){var u={};D(v,function(n,t){u[t]=n}),u[n]=e,d=!0,g=[],r(t,u)}else v[n]=e,c(n)}));m++;var i=t[t.length-1];t.length>1?i(v,u):i(u)}}function a(){for(var n,t=0;S.length;)n=S.pop(),t++,$(p(n),function(n){0===--j[n]&&S.push(n)});if(t!==y)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function p(t){var e=[];return D(n,function(n,r){jt(n)&&U(n,t,0)>=0&&e.push(r)}),e}"function"==typeof t&&(r=t,t=null),r=s(r||l);var h=w(n),y=h.length;if(!y)return r(null);t||(t=y);var v={},m=0,d=!1,g={},b=[],S=[],j={};D(n,function(t,e){if(!jt(t))return u(e,[t]),void S.push(e);var r=t.slice(0,t.length-1),i=r.length;return 0===i?(u(e,t),void S.push(e)):(j[e]=i,void $(r,function(c){if(!n[c])throw new Error("async.auto task `"+e+"` has a non-existent dependency in "+r.join(", "));o(c,function(){i--,0===i&&u(e,t)})}))}),a(),i()}function W(n,t){for(var e=-1,r=n?n.length:0,u=Array(r);++et&&(t=-t>u?0:u+t),e=e>u?u:e,0>e&&(e+=u),u=t>e?0:e-t>>>0,t>>>=0;for(var i=Array(u);++r=r?n:K(n,t,e)}function X(n,t){for(var e=n.length;e--&&U(t,n[e],0)>-1;);return e}function Y(n,t){for(var e=-1,r=n.length;++e-1;);return e}function Z(n){return n.match(ae)}function nn(n){return null==n?"":J(n)}function tn(n,t,e){if(n=nn(n),n&&(e||void 0===t))return n.replace(le,"");if(!n||!(t=J(t)))return n;var r=Z(n),u=Z(t),i=Y(r,u),o=X(r,u)+1;return N(r,i,o).join("")}function en(n){return n=n.toString().replace(ye,""),n=n.match(se)[2].replace(" ",""),n=n?n.split(pe):[],n=n.map(function(n){return tn(n.replace(he,""))})}function rn(n,t){var e={};D(n,function(n,t){function r(t,e){var r=W(u,function(n){return t[n]});r.push(e),n.apply(null,r)}var u;if(jt(n))u=G(n),n=u.pop(),e[t]=u.concat(u.length>0?r:n);else if(1===n.length)e[t]=n;else{if(u=en(n),0===n.length&&0===u.length)throw new Error("autoInject task functions require explicit parameters.");u.pop(),e[t]=u.concat(r)}}),Q(e,t)}function un(n){setTimeout(n,0)}function on(n){return e(function(t,e){n(function(){t.apply(null,e)})})}function cn(){this.head=this.tail=null,this.length=0}function fn(n,t){n.length=1,n.head=n.tail=t}function an(n,t,r){function u(n,t,e){if(null!=e&&"function"!=typeof e)throw new Error("task callback must be a function");return f.started=!0,jt(n)||(n=[n]),0===n.length&&f.idle()?de(function(){f.drain()}):($(n,function(n){var r={data:n,callback:e||l};t?f._tasks.unshift(r):f._tasks.push(r)}),void de(f.process))}function i(n){return e(function(t){o-=1,$(n,function(n){$(c,function(t,e){return t===n?(c.splice(e,1),!1):void 0}),n.callback.apply(n,t),null!=t[0]&&f.error(t[0],n.data)}),o<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()})}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var o=0,c=[],f={_tasks:new cn,concurrency:t,payload:r,saturated:l,unsaturated:l,buffer:t/4,empty:l,drain:l,error:l,started:!1,paused:!1,push:function(n,t){u(n,!1,t)},kill:function(){f.drain=l,f._tasks.empty()},unshift:function(n,t){u(n,!0,t)},process:function(){for(;!f.paused&&ou;u++){var a=f._tasks.shift();t.push(a),e.push(a.data)}0===f._tasks.length&&f.empty(),o+=1,c.push(t[0]),o===f.concurrency&&f.saturated();var l=A(i(t));n(e,l)}},length:function(){return f._tasks.length},running:function(){return o},workersList:function(){return c},idle:function(){return f._tasks.length+o===0},pause:function(){f.paused=!0},resume:function(){if(f.paused!==!1){f.paused=!1;for(var n=Math.min(f.concurrency,f._tasks.length),t=1;n>=t;t++)de(f.process)}}};return f}function ln(n,t){return an(n,1,t)}function sn(n,t,e,r){r=s(r||l),be(n,function(n,r,u){e(t,n,function(n,e){t=e,u(n)})},function(n){r(n,t)})}function pn(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(n,t){u=u.concat(t||[]),r(n)})},function(n){r(n,u)})}function hn(n){return function(t,e,r){return n(be,t,e,r)}}function yn(n){return n}function vn(n,t,e){return function(r,u,i,o){function c(n){o&&(n?o(n):o(null,e(!1)))}function f(n,r,u){return o?void i(n,function(r,c){o&&(r?(o(r),o=i=!1):t(c)&&(o(null,e(!0,n)),o=i=!1)),u()}):u()}arguments.length>3?(o=o||l,n(r,u,f,c)):(o=i,o=o||l,i=u,n(r,f,c))}}function mn(n,t){return t}function dn(n){return e(function(t,r){t.apply(null,r.concat([e(function(t,e){"object"==typeof console&&(t?console.error&&console.error(t):console[n]&&$(e,function(t){console[n](t)}))})]))})}function gn(n,t,r){function u(t,e){return t?r(t):e?void n(i):r(null)}r=A(r||l);var i=e(function(n,e){return n?r(n):(e.push(u),void t.apply(this,e))});u(null,!0)}function bn(n,t,r){r=A(r||l);var u=e(function(e,i){return e?r(e):t.apply(this,i)?n(u):void r.apply(null,[null].concat(i))});n(u)}function Sn(n,t,e){bn(n,function(){return!t.apply(this,arguments)},e)}function jn(n,t,e){function r(t){return t?e(t):void n(u)}function u(n,u){return n?e(n):u?void t(r):e(null)}e=A(e||l),n(u)}function kn(n){return function(t,e,r){return n(t,r)}}function wn(n,t,e){z(n,kn(t),e)}function Ln(n,t,e,r){_(t)(n,kn(e),r)}function En(n){return r(function(t,e){var r=!0;t.push(function(){var n=arguments;r?de(function(){e.apply(null,n)}):e.apply(null,n)}),n.apply(this,t),r=!1})}function On(n){return!n}function xn(n,t,e,r){r=s(r||l);var u=[];n(t,function(n,t,r){e(n,function(e,i){e?r(e):(i&&u.push({index:t,value:n}),r())})},function(n){n?r(n):r(null,W(u.sort(function(n,t){return n.index-t.index}),i("value")))})}function An(n,t){function e(n){return n?r(n):void u(e)}var r=A(t||l),u=En(n);e()}function _n(n,t,e,r){r=s(r||l);var u={};I(n,t,function(n,t,r){e(n,t,function(n,e){return n?r(n):(u[t]=e,void r())})},function(n){r(n,u)})}function In(n,t){return t in n}function Tn(n,t){var u=Object.create(null),i=Object.create(null);t=t||yn;var o=r(function(r,o){var c=t.apply(null,r);In(u,c)?de(function(){o.apply(null,u[c])}):In(i,c)?i[c].push(o):(i[c]=[o],n.apply(null,r.concat([e(function(n){u[c]=n;var t=i[c];delete i[c];for(var e=0,r=t.length;r>e;e++)t[e].apply(null,n)})])))});return o.memo=u,o.unmemoized=n,o}function Fn(n,t,r){r=r||l;var u=a(t)?[]:{};n(t,function(n,t,r){n(e(function(n,e){e.length<=1&&(e=e[0]),u[t]=e,r(n)}))},function(n){r(n,u)})}function zn(n,t){Fn(z,n,t)}function Bn(n,t,e){Fn(_(t),n,e)}function Mn(n,t){return an(function(t,e){n(t[0],e)},t,1)}function Vn(n,t){var e=Mn(n,t);return e.push=function(n,t,r){if(null==r&&(r=l),"function"!=typeof r)throw new Error("task callback must be a function");if(e.started=!0,jt(n)||(n=[n]),0===n.length)return de(function(){e.drain()});t=t||0;for(var u=e._tasks.head;u&&t>=u.priority;)u=u.next;$(n,function(n){var i={data:n,priority:t,callback:r};u?e._tasks.insertBefore(u,i):e._tasks.push(i)}),de(e.process)},delete e.unshift,e}function qn(n,t){return t=s(t||l),jt(n)?n.length?void $(n,function(n){n(t)}):t():t(new TypeError("First argument to race must be an array of functions"))}function $n(n,t,e,r){var u=De.call(n).reverse();sn(u,t,e,r)}function Cn(n){return r(function(t,r){return t.push(e(function(n,t){if(n)r(null,{error:n});else{var e=null;1===t.length?e=t[0]:t.length>1&&(e=t),r(null,{value:e})}})),n.apply(this,t)})}function Dn(n,t,e,r){xn(n,t,function(n,t){e(n,function(n,e){n?t(n):t(null,!e)})},r)}function Pn(n){var t;return jt(n)?t=W(n,Cn):(t={},D(n,function(n,e){t[e]=Cn.call(this,n)})),t}function Rn(n){return function(){return n}}function Un(n,t,e){function r(n,t){if("object"==typeof t)n.times=+t.times||i,n.intervalFunc="function"==typeof t.interval?t.interval:Rn(+t.interval||o);else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");n.times=+t||i}}function u(){t(function(n){n&&f++e?-1:e>r?1:0}_t(n,function(n,e){t(n,function(t,r){return t?e(t):void e(null,{value:n,criteria:r})})},function(n,t){return n?e(n):void e(null,W(t.sort(r),i("value")))})}function Hn(n,t,e){function u(){f||(o.apply(null,arguments),clearTimeout(c))}function i(){var t=n.name||"anonymous",r=new Error('Callback function "'+t+'" timed out.');r.code="ETIMEDOUT",e&&(r.info=e),f=!0,o(r)}var o,c,f=!1;return r(function(e,r){o=r,c=setTimeout(i,t),n.apply(null,e.concat(u))})}function Jn(n,t,e,r){for(var u=-1,i=Je(He((t-n)/(e||1)),0),o=Array(i);i--;)o[r?i:++u]=n,n+=e;return o}function Kn(n,t,e,r){Tt(Jn(0,n,1),t,e,r)}function Nn(n,t,e,r){3===arguments.length&&(r=e,e=t,t=jt(n)?[]:{}),r=s(r||l),z(n,function(n,r,u){e(t,n,r,u)},function(n){r(n,t)})}function Xn(n){return function(){return(n.unmemoized||n).apply(null,arguments)}}function Yn(n,t,r){if(r=A(r||l),!n())return r(null);var u=e(function(e,i){return e?r(e):n()?t(u):void r.apply(null,[null].concat(i))});t(u)}function Zn(n,t,e){Yn(function(){return!n.apply(this,arguments)},t,e)}function nt(n,t){function r(i){if(u===n.length)return t.apply(null,[null].concat(i));var o=A(e(function(n,e){return n?t.apply(null,[n].concat(e)):void r(e)}));i.push(o);var c=n[u++];c.apply(null,i)}if(t=s(t||l),!jt(n))return t(new Error("First argument to waterfall must be an array of functions"));if(!n.length)return t();var u=0;r([])}var tt,et=Math.max,rt=i("length"),ut="[object Function]",it="[object GeneratorFunction]",ot=Object.prototype,ct=ot.toString,ft=9007199254740991,at="function"==typeof Symbol&&Symbol.iterator,lt=Object.getPrototypeOf,st=h(lt,Object),pt=Object.prototype,ht=pt.hasOwnProperty,yt=Object.keys,vt=h(yt,Object),mt="[object Arguments]",dt=Object.prototype,gt=dt.hasOwnProperty,bt=dt.toString,St=dt.propertyIsEnumerable,jt=Array.isArray,kt="[object String]",wt=Object.prototype,Lt=wt.toString,Et=9007199254740991,Ot=/^(?:0|[1-9]\d*)$/,xt=Object.prototype,At=T(I,1/0),_t=B(M),It=u(_t),Tt=V(M),Ft=T(Tt,1),zt=u(Ft),Bt=e(function(n,t){return e(function(e){return n.apply(null,t.concat(e))})}),Mt=C(),Vt="object"==typeof global&&global&&global.Object===Object&&global,qt="object"==typeof self&&self&&self.Object===Object&&self,$t=Vt||qt||Function("return this")(),Ct=$t.Symbol,Dt="[object Symbol]",Pt=Object.prototype,Rt=Pt.toString,Ut=1/0,Qt=Ct?Ct.prototype:void 0,Wt=Qt?Qt.toString:void 0,Gt="\\ud800-\\udfff",Ht="\\u0300-\\u036f\\ufe20-\\ufe23",Jt="\\u20d0-\\u20f0",Kt="\\ufe0e\\ufe0f",Nt="["+Gt+"]",Xt="["+Ht+Jt+"]",Yt="\\ud83c[\\udffb-\\udfff]",Zt="(?:"+Xt+"|"+Yt+")",ne="[^"+Gt+"]",te="(?:\\ud83c[\\udde6-\\uddff]){2}",ee="[\\ud800-\\udbff][\\udc00-\\udfff]",re="\\u200d",ue=Zt+"?",ie="["+Kt+"]?",oe="(?:"+re+"(?:"+[ne,te,ee].join("|")+")"+ie+ue+")*",ce=ie+ue+oe,fe="(?:"+[ne+Xt+"?",Xt,te,ee,Nt].join("|")+")",ae=RegExp(Yt+"(?="+Yt+")|"+fe+ce,"g"),le=/^\s+|\s+$/g,se=/^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,pe=/,/,he=/(=.+)?(\s*)$/,ye=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,ve="function"==typeof setImmediate&&setImmediate,me="object"==typeof process&&"function"==typeof process.nextTick;tt=ve?setImmediate:me?process.nextTick:un;var de=on(tt);cn.prototype.removeLink=function(n){return n.prev?n.prev.next=n.next:this.head=n.next,n.next?n.next.prev=n.prev:this.tail=n.prev,n.prev=n.next=null,this.length-=1,n},cn.prototype.empty=cn,cn.prototype.insertAfter=function(n,t){t.prev=n,t.next=n.next,n.next?n.next.prev=t:this.tail=t,n.next=t,this.length+=1},cn.prototype.insertBefore=function(n,t){t.prev=n.prev,t.next=n,n.prev?n.prev.next=t:this.head=t,n.prev=t,this.length+=1},cn.prototype.unshift=function(n){this.head?this.insertBefore(this.head,n):fn(this,n)},cn.prototype.push=function(n){this.tail?this.insertAfter(this.tail,n):fn(this,n)},cn.prototype.shift=function(){return this.head&&this.removeLink(this.head)},cn.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)};var ge,be=T(I,1),Se=e(function(n){return e(function(t){var r=this,u=t[t.length-1];"function"==typeof u?t.pop():u=l,sn(n,t,function(n,t,u){t.apply(r,n.concat([e(function(n,t){u(n,t)})]))},function(n,t){u.apply(r,[n].concat(t))})})}),je=e(function(n){return Se.apply(null,n.reverse())}),ke=B(pn),we=hn(pn),Le=e(function(n){var t=[null].concat(n);return r(function(n,e){return e.apply(this,t)})}),Ee=vn(z,yn,mn),Oe=vn(I,yn,mn),xe=vn(be,yn,mn),Ae=dn("dir"),_e=T(Ln,1),Ie=vn(z,On,On),Te=vn(I,On,On),Fe=T(Te,1),ze=B(xn),Be=V(xn),Me=T(Be,1),Ve=dn("log"),qe=T(_n,1/0),$e=T(_n,1);ge=me?process.nextTick:ve?setImmediate:un;var Ce=on(ge),De=Array.prototype.slice,Pe=B(Dn),Re=V(Dn),Ue=T(Re,1),Qe=vn(z,Boolean,yn),We=vn(I,Boolean,yn),Ge=T(We,1),He=Math.ceil,Je=Math.max,Ke=T(Kn,1/0),Ne=T(Kn,1),Xe={applyEach:It,applyEachSeries:zt,apply:Bt,asyncify:q,auto:Q,autoInject:rn,cargo:ln,compose:je,concat:ke,concatSeries:we,constant:Le,detect:Ee,detectLimit:Oe,detectSeries:xe,dir:Ae,doDuring:gn,doUntil:Sn,doWhilst:bn,during:jn,each:wn,eachLimit:Ln,eachOf:z,eachOfLimit:I,eachOfSeries:be,eachSeries:_e,ensureAsync:En,every:Ie,everyLimit:Te,everySeries:Fe,filter:ze,filterLimit:Be,filterSeries:Me,forever:An,log:Ve,map:_t,mapLimit:Tt,mapSeries:Ft,mapValues:qe,mapValuesLimit:_n,mapValuesSeries:$e,memoize:Tn,nextTick:Ce,parallel:zn,parallelLimit:Bn,priorityQueue:Vn,queue:Mn,race:qn,reduce:sn,reduceRight:$n,reflect:Cn,reflectAll:Pn,reject:Pe,rejectLimit:Re,rejectSeries:Ue,retry:Un,retryable:Qn,seq:Se,series:Wn,setImmediate:de,some:Qe,someLimit:We,someSeries:Ge,sortBy:Gn,timeout:Hn,times:Ke,timesLimit:Kn,timesSeries:Ne,transform:Nn,unmemoize:Xn,until:Zn,waterfall:nt,whilst:Yn,all:Ie,any:Qe,forEach:wn,forEachSeries:_e,forEachLimit:Ln,forEachOf:z,forEachOfSeries:be,forEachOfLimit:I,inject:sn,foldl:sn,foldr:$n,select:ze,selectLimit:Be,selectSeries:Me,wrapSync:q};n["default"]=Xe,n.applyEach=It,n.applyEachSeries=zt,n.apply=Bt,n.asyncify=q,n.auto=Q,n.autoInject=rn,n.cargo=ln,n.compose=je,n.concat=ke,n.concatSeries=we,n.constant=Le,n.detect=Ee,n.detectLimit=Oe,n.detectSeries=xe,n.dir=Ae,n.doDuring=gn,n.doUntil=Sn,n.doWhilst=bn,n.during=jn,n.each=wn,n.eachLimit=Ln,n.eachOf=z,n.eachOfLimit=I,n.eachOfSeries=be,n.eachSeries=_e,n.ensureAsync=En,n.every=Ie,n.everyLimit=Te,n.everySeries=Fe,n.filter=ze,n.filterLimit=Be,n.filterSeries=Me,n.forever=An,n.log=Ve,n.map=_t,n.mapLimit=Tt,n.mapSeries=Ft,n.mapValues=qe,n.mapValuesLimit=_n,n.mapValuesSeries=$e,n.memoize=Tn,n.nextTick=Ce,n.parallel=zn,n.parallelLimit=Bn,n.priorityQueue=Vn,n.queue=Mn,n.race=qn,n.reduce=sn,n.reduceRight=$n,n.reflect=Cn,n.reflectAll=Pn,n.reject=Pe,n.rejectLimit=Re,n.rejectSeries=Ue,n.retry=Un,n.retryable=Qn,n.seq=Se,n.series=Wn,n.setImmediate=de,n.some=Qe,n.someLimit=We,n.someSeries=Ge,n.sortBy=Gn,n.timeout=Hn,n.times=Ke,n.timesLimit=Kn,n.timesSeries=Ne,n.transform=Nn,n.unmemoize=Xn,n.until=Zn,n.waterfall=nt,n.whilst=Yn,n.all=Ie,n.allLimit=Te,n.allSeries=Fe,n.any=Qe,n.anyLimit=We,n.anySeries=Ge,n.find=Ee,n.findLimit=Oe,n.findSeries=xe,n.forEach=wn,n.forEachSeries=_e,n.forEachLimit=Ln,n.forEachOf=z,n.forEachOfSeries=be,n.forEachOfLimit=I,n.inject=sn,n.foldl=sn,n.foldr=$n,n.select=ze,n.selectLimit=Be,n.selectSeries=Me,n.wrapSync=q}); var swversion='2.0.0'; var api_add="https://gateway.pushengage.com/p/v1"; var api_restofall="https://clients-api.pushengage.com/p/v1"; var isPushEnabled = false; var PushSubscriberID=false; if(typeof(dialog_box) == "undefined") var dialog_box=false; var segment=false; var first=true; var device_id=false; var bv=browser_version.value; var geoinfo={"geobytescountry":"Iran","geobytesinternet":"IR","geobytesregion":"Ostan-e Tehran","geobytescode":"07","geobytescity":"Tehran","geobyteslatitude":35.7261,"geobyteslongitude":51.3304,"geobytesfqcn":"Tehran,07,Iran","geobytesipaddress":"145.249.24.70"}; if(typeof navigator.serviceWorker != "undefined") navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { // To unsubscribe from push messaging, you need get the // subcription object, which you can call unsubscribe() on. serviceWorkerRegistration.pushManager.getSubscription().then( function(pushSubscription) { if (!pushSubscription && Notification.permission!="denied") { first=true; } else{ first=false; isPushEnabled = true; } } ); }); (function _peinitialise(){ var is_mobile=screen.width<=800; var is_chicklet_enabled=chicklet_settings&&chicklet_settings.enabled; if(is_mobile || !is_chicklet_enabled) return false; if(document.readyState!="complete"){ setTimeout(function(){ _peinitialise(); }, 100); } else { var docbody = document.getElementsByTagName("BODY")[0]; var isSsl= window.location.protocol=="https:"; var nativedeny = Notification.permission=="denied"; if(isSsl && dialog_box && nativedeny) { docbody.insertAdjacentHTML('beforeend',""); docbody.insertAdjacentHTML('beforeend',"

You seem to have previously blocked/denied push notifications. See the image below to know how to unblock them.

"); var PEChickletInstModalClose = document.getElementById("PE-cancel-btn"); var PEChickletInstModalRetry = document.getElementById("PE-retry-btn"); var PEChickletInstModal = document.getElementById("PE-chicklet-inst-modal"); PEChickletInstModal.style.display = "block"; PEChickletInstModalClose.onclick = function() { window.close(); } PEChickletInstModalRetry.onclick = function() { if(Notification.permission!="denied") { first=true; pe.subscribe(); PEChickletInstModal.style.display = "none"; } } } } })(); function _peCollectEmail() { var docbody = document.getElementsByTagName("BODY")[0]; docbody.insertAdjacentHTML('beforeend',""); docbody.insertAdjacentHTML('beforeend',"") var PEChickletInstModal = document.getElementById("PE-chicklet-inst-modal"); var PEChickletInstModalClose = document.getElementById("PE-cancel-btn"); var PEChickletInstModalRetry = document.getElementById("PE-retry-btn"); var PEEmailInput = document.getElementById("email"); PEChickletInstModal.style.display = "block"; PEChickletInstModalClose.onclick = function() { PEChickletInstModal.style.display = "none"; window.close(); } PEChickletInstModalRetry.onclick = function() { if(PEEmailInput.value){ var _pushid=unescape(getCookie("PushSubscriberID"+"_"+Number(_peapp.app_id))); if(typeof WhichBrowser != 'undefined') { var result = new WhichBrowser(); bv=result.browser.version; } var xhttp = new XMLHttpRequest(); xhttp.open("POST", api_restofall+"/subscriber/profile-id/add?swv="+swversion+"&bv="+bv, false); xhttp.setRequestHeader("Content-type", "application/json"); var data = JSON.stringify({"device_token":_pushid,"profile_id":PEEmailInput.value,"site_id":_peapp.app_id}); xhttp.send(data); } PEChickletInstModal.style.display = "none"; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 ) { window.close(); } }; xhttp.open("POST", _peapp.app_subdomain+"/saveEmail", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("action=addemail&email="+PEEmailInput.value); } } var pe={ subscribe : function(maincallback){ var closeIntermidiatePopup=false; if(Notification.permission=="default"){ closeIntermidiatePopup=true; } if(typeof navigator.serviceWorker == "undefined"){ return; } navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { if(typeof(_pe_optin_settings) !== "undefined" && typeof(_pe_optin_settings.desktop) !== "undefined" && typeof(_pe_optin_settings.desktop.optin_type) !== "undefined" && _pe_optin_settings.desktop.optin_type== 5) navigator.geolocation.getCurrentPosition(function(){console.log("success")}, function(){console.log("error")}); Notification.requestPermission().then(function(permissionStatus){ if(permissionStatus=="default") { date = new Date(); date.setTime(date.getTime()+(7*24*60*60*1000)); document.cookie="peclosed=true; expires="+date.toGMTString()+";path=/;";//domain="+domain; if (typeof(maincallback)==='function') { return maincallback({"status":"CLOSED"}); } } if(Notification.permission=="denied") { if (typeof(maincallback)==='function') { return maincallback({"status":"DENIED"}); } if(closeIntermidiatePopup){ window.close(); } // if(dialog_box) // { // if((typeof pe_redirect_to !== "undefined") && pe_redirect_to) // window.location=redirect_to; // else // window.close(); // } } if(Notification.permission=="granted") serviceWorkerRegistration.pushManager.subscribe({userVisibleOnly: true}) .then(function(subscription) { // The subscription was successful isPushEnabled = true; //PushSubscriber ID var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; if(is_firefox) { PushSubscriberID = subscription.endpoint.slice(subscription.endpoint.search("v1/")+3); } else { PushSubscriberID = subscription.endpoint.slice(subscription.endpoint.search("send/")+5); } //PushSubscriberID=subscription.endpoint.slice(subscription.endpoint.search("send/")+5); date = new Date(); date.setTime(date.getTime()+(30*24*60*60*1000)); expires = "; expires="+date.toGMTString(); document.cookie="isPushEnabled="+isPushEnabled+";domain=.pushengage.com"+expires; document.cookie="PushSubscriberID_"+_peapp.app_id+"="+PushSubscriberID+";domain=.pushengage.com"+expires; // Send the subscription subscription.endpoint // to server and save it to send a push message async.series([ function(callback) { pe.sendSubscriptionToServer(subscription,callback); }, function(callback) { if (segment != false) { if(segmentDays && segmentDays == parseInt(segmentDays, 10)){ pe.addSubscriberToDynamicSegment(segment,segmentDays,callback) } else{ pe.addSubscriberToSegment(segment,callback); } } else return callback(null,"Nosegment"); }, function(callback) { if (first && welcome_notification && welcome_notification.welcome_enabled=="true") { navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { var options = { body: welcome_notification.notification_message, tag: "welcome_notification", icon: _peapp.app_image, data: welcome_notification.notification_url }; serviceWorkerRegistration.showNotification(welcome_notification.notification_title, options).then(function(){ callback(null,"Shown welcome_notification"); }); }); } else return callback(null,"Nowelcomenotification"); }, function(callback){ if(dialog_box && typeof(pe_collect_email)!="undefined" && pe_collect_email ){ _peCollectEmail(); } else{ return callback(null,"Not collecting email"); } }, function(callback) { var calledprofileid=false; if(typeof(_pedata)!="undefined") _pedata.forEach(function(item,index){ if (item.action=="addProfileId") {calledprofileid=true;return pe.addProfileId(item.data,callback)} }); if(!calledprofileid) return callback(null,"NoProfileid"); }, function(callback) { var calledsegment=false; if(typeof(_pedata)!="undefined") _pedata.forEach(function(item,index){ if (item.action=="addSubscriberToSegment") {calledsegment=true;return pe.addSubscriberToSegment(item.data,callback)} }); if(!calledsegment) return callback(null,"Nosegment"); }, function(callback) { var calledsegment=false; if(typeof(_pedata)!="undefined") _pedata.forEach(function(item,index){ if (item.action=="removeSubscriberFromSegment") {calledsegment=true;return pe.removeSubscriberFromSegment(item.data,callback)} }); if(!calledsegment) return callback(null,"Nosegment"); } ], function(err, results) { _pedata=[]; var subdata=JSON.parse(results[0]); if (typeof(maincallback)==='function' && typeof(subdata.data)!="undefined") { maincallback({"status":"SUBSCRIBED","subscriber_hash":subdata.data.subscriber_hash}); } if(dialog_box) { if((typeof pe_redirect_to !== "undefined") && pe_redirect_to) window.location=pe_redirect_to; else window.close(); } else{ return true; } }); // return true; }) .catch(function(e) { if (Notification.permission === 'denied') { // The user denied the notification permission which // means we failed to subscribe and the user will need // to manually change the notification permission to // subscribe to push messages console.log('Permission for Notifications was denied'); } else { // A problem occurred with the subscription, this can // often be down to an issue or lack of the gcm_sender_id // and / or gcm_user_visible_only console.log('Unable to subscribe to push.', e); } if(dialog_box) { if((typeof pe_redirect_to !== "undefined") && pe_redirect_to) window.location=pe_redirect_to; else window.close(); } }); }); }); }, sendSubscriptionToServer :function(subscription,callback) { if(!first) return callback(null,'{"message":"already subscribed"}'); //where library object var brower_prop_array = {}; if(true)//typeof WhichBrowser != 'undefined') { // var result = new WhichBrowser(); brower_prop_array['device_type'] = browser_name;//from php // brower_prop_array['browser_engine'] = result.engine; brower_prop_array['browser_version'] = browser_version;//from php brower_prop_array['user_agent'] = navigator.userAgent; // brower_prop_array['platform'] = result.os; brower_prop_array['language'] = navigator.language; brower_prop_array['total_scr_width_height'] = screen.width + '*' +screen.height; brower_prop_array['available_scr_width_height'] = screen.availWidth + '*' +screen.availHeight; brower_prop_array['colour_resolution'] = screen.pixelDepth; brower_prop_array['host'] = location.host; brower_prop_array['device'] = device_type;//from php // brower_prop_array['device_model'] = result.device.model; // brower_prop_array['device_manufacturer'] = result.device.manufacturer; brower_prop_array['pe_ref_url'] = "https://circuitdigest.com/calculators/resistor-color-code-calculator"; // for (key in brower_prop_array) // { // brower_prop_array.push(key + '=' + encodeURIComponent(brower_prop_array[key])); // } } //Device id device_id = subscription.endpoint.split("/")[subscription.endpoint.split("/").length-1]; var pe_subscription=JSON.parse(JSON.stringify(subscription)); // console.log(JSON.stringify(subscription)); // var temp3=JSON.parse(JSON.stringify(subscription)); //delete temp3.keys; // console.log(temp3); // console.log(temp3.endpoint); // console.log("done"); // var pe_subscription=temp3; // console.log(pe_subscription); pe_subscription['project_id']=project_id; var final_info={}; final_info['site_id']=_peapp.app_id; final_info['browser_info']=brower_prop_array; final_info['subscription_url']="https://circuitdigest.com/microcontroller-projects/16x2-lcd-interfacing-with-pic-microcontroller"; final_info['subscription']=pe_subscription; final_info['geo_info']=geoinfo; // console.log(final_info); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var response = this.responseText; if(response){ if(isValidSubscriberHash(response)) callback(null,response); } } }; if(typeof WhichBrowser != 'undefined') { var result = new WhichBrowser(); bv=result.browser.version; } xhttp.open("POST", api_add+"/subscriber/add?swv="+swversion+"&bv="+bv, true); xhttp.setRequestHeader("Content-type", "application/json"); var data = JSON.stringify(final_info); xhttp.send(data); htmlbody1 = document.getElementsByTagName("BODY")[0]; htmlbody1.insertAdjacentHTML( 'beforeend', ''); return true; }, unsubscribe : function(){ navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { // To unsubscribe from push messaging, you need get the // subscription object, which you can call unsubscribe() on. serviceWorkerRegistration.pushManager.getSubscription().then( function(pushSubscription) { // Check we have a subscription to unsubscribe if (!pushSubscription) { // No subscription object, so set the state // to allow the user to subscribe to push isPushEnabled = false; return; } // We have a subscription, so call unsubscribe on it pushSubscription.unsubscribe().then(function(successful) { isPushEnabled = false; }).catch(function(e) { // We failed to unsubscribe, this can lead to // an unusual state, so may be best to remove // the users data from your data store and // inform the user that you have done so console.log('Unsubscription error: ', e); }); }).catch(function(e) { console.error('Error thrown while unsubscribing from push messaging.', e); }); }); }, addSubscriberToSegment :function(segmentName,callback) { console.log("secure"); var _pushid=getCookie("PushSubscriberID"); if(device_id){_pushid=device_id;} if(_pushid==null || _pushid=="" || _pushid=="false" || typeof(segmentName)=="undefined" || segmentName=="false" || segmentName=="" || segmentName==false){callback(null,"No Subscription"); return true;} var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 ) { callback(null,this.responseText); } }; if(typeof WhichBrowser != 'undefined') { var result = new WhichBrowser(); bv=result.browser.version; } xhttp.open("POST", api_restofall+"/subscriber/segments/add?swv="+swversion+"&bv="+bv, true); xhttp.setRequestHeader("Content-type", "application/json"); var data = JSON.stringify({"device_token":_pushid,"segment":segmentName,"site_id":_peapp.app_id}); xhttp.send(data); return true; }, addSubscriberToDynamicSegment :function(segmentName,days,callback) { var _pushid=getCookie("PushSubscriberID"); if(device_id){_pushid=device_id;} if(_pushid==null || _pushid=="" || _pushid=="false" || typeof(segmentName)=="undefined" || segmentName=="false" || segmentName=="" || segmentName==false){callback(null,"No Subscription"); return true;} var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 ) { callback(null,this.responseText); } }; if(typeof WhichBrowser != 'undefined') { var result = new WhichBrowser(); bv=result.browser.version; } xhttp.open("POST", api_restofall+"/subscriber/dynamicSegments/add?swv="+swversion+"&bv="+bv, true); xhttp.setRequestHeader("Content-type", "application/json"); var data = JSON.stringify({"device_token":_pushid,"segment":segmentName,"site_id":_peapp.app_id,"days":days}); xhttp.send(data); return true; }, addProfileId :function(profileId,callback) { var _pushid=getCookie("PushSubscriberID"); if(device_id){_pushid=device_id;} var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 ) { callback(null,this.responseText); } }; if(typeof WhichBrowser != 'undefined') { var result = new WhichBrowser(); bv=result.browser.version; } xhttp.open("POST", api_restofall+"/subscriber/profile-id/add?swv="+swversion+"&bv="+bv, true); xhttp.setRequestHeader("Content-type", "application/json"); var data = JSON.stringify({"device_token":_pushid,"profile_id":profileId}); xhttp.send(data); return true; }, removeSubscriberFromSegment :function(segmentName,callback) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 ) { callback(null,this.responseText); } }; xhttp.open("POST", _peapp.app_subdomain+"/segments.php", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("action=remove_subscriber_from_segment&segment_name="+segmentName); return true; }, isSubscribed :function(callback) { navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { serviceWorkerRegistration.pushManager.getSubscription().then( function(pushSubscription) { callback(pushSubscription!=null && typeof(pushSubscription) == "object"); } ); }); }, initialiseState: function () { if (!('showNotification' in ServiceWorkerRegistration.prototype)) { console.warn('Notifications aren\'t supported.'); return; } if (Notification.permission === 'denied') { console.warn('The user has blocked notifications.'); return; } if (!('PushManager' in window)) { console.warn('Push messaging isn\'t supported.'); return; } navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { serviceWorkerRegistration.pushManager.getSubscription() .then(function(subscription) { // Enable any UI which subscribes / unsubscribes from // push messages. // var pushButton = document.querySelector('.js-push-button'); // pushButton.disabled = false; if (!subscription) { // We aren't subscribed to push, so set UI // to allow the user to enable push return; } // Keep your server in sync with the latest subscriptionId // sendSubscriptionToServer(subscription); console.log(subscription);//display it // document.getElementById('sid').textContent=subscription.subscriptionId; // Set your UI to show they have subscribed for // push messages // pushButton.textContent = 'Disable Push Messages'; isPushEnabled = true; var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; if(is_firefox) { PushSubscriberID = subscription.endpoint.slice(subscription.endpoint.search("v1/")+3); } else { PushSubscriberID = subscription.endpoint.slice(subscription.endpoint.search("send/")+5); } //PushSubscriberID=subscription.endpoint.slice(subscription.endpoint.search("send/")+5); }) .catch(function(err) { console.warn('Error during getSubscription()', err); }); }); } }; var service_worker_support= !((typeof _pe_optin_settings !== 'undefined') && (typeof _pe_optin_settings.desktop !== 'undefined') && (typeof _pe_optin_settings.desktop.optin_sw_support !== 'undefined') && !_pe_optin_settings.desktop.optin_sw_support); if ('serviceWorker' in navigator && service_worker_support) { var linkNode = document.createElement('link'); linkNode.rel = 'manifest'; linkNode.href = pathvars.manifest; // if(document.querySelectorAll('link[rel=manifest]').length==0) document.getElementsByTagName("head")[0].appendChild(linkNode); navigator.serviceWorker.register(pathvars.worker, {scope: "/"}) .then(this.initialiseState); } else { console.warn('Service workers aren\'t supported in this browser.'); } //}); function isValidSubscriberHash(response){ response = JSON.parse(response); if(response.data){ response = response.data.subscriber_hash; if(response && response.length==64) return true; else return false; } else{ return false; } }