(function(t,n){typeof exports=="object"&&typeof module=="object"?module.exports=n():typeof define=="function"&&define.amd?define([],n):typeof exports=="object"&&(exports.advads_postscribe=n()),t.advads_postscribe=n()})(this,function(){return function(e){var n={};function t(s){if(n[s])return n[s].exports;var o=n[s]={exports:{},id:s,loaded:!1};return e[s].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var s=n(1),o=i(s);function i(e){return e&&e.__esModule?e:{default:e}}e.exports=o.default},function(e,t,n){"use strict";t.__esModule=!0;var s,i,a,r,l,u,h,f,d=Object.assign||function(e){for(var t,s,n=1;n<arguments.length;n++){t=arguments[n];for(s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e};t.default=c,f=n(2),l=p(f),u=n(4),a=g(u);function g(e){if(e&&e.__esModule)return e;var n,t={};if(e!=null)for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function p(e){return e&&e.__esModule?e:{default:e}}function o(){}h={afterAsync:o,afterDequeue:o,afterStreamStart:o,afterWrite:o,autoFix:!0,beforeEnqueue:o,beforeWriteToken:function(t){return t},beforeWrite:function(t){return t},done:o,error:function(t){throw new Error(t.msg)},releaseAsync:!1},r=0,i=[],s=null;function m(){var t,e=i.shift();e&&(t=a.last(e),t.afterDequeue(),e.stream=v.apply(void 0,e),t.afterStreamStart())}function v(e,t,n){s=new l.default(e,n),s.id=r++,s.name=n.name||s.id,c.streams[s.name]=s;var a,i=e.ownerDocument,h={close:i.close,open:i.open,write:i.write,writeln:i.writeln};function u(e){e=n.beforeWrite(e),s.write(e),n.afterWrite(e)}return d(i,{close:o,open:o,write:function(){for(var n=arguments.length,s=Array(n),t=0;t<n;t++)s[t]=arguments[t];return u(s.join(""))},writeln:function(){for(var n=arguments.length,s=Array(n),t=0;t<n;t++)s[t]=arguments[t];return u(s.join("")+`
`)}}),a=s.win.onerror||o,s.win.onerror=function(e,t,o){n.error({msg:e+" - "+t+": "+o}),a.apply(s.win,[e,t,o])},s.write(t,function(){d(i,h),s.win.onerror=a,n.done(),s=null,m()}),s}function c(e,t,n){if(a.isFunction(n))n={done:n};else if(n==="clear"){i=[],s=null,r=0;return}n=a.defaults(n,h),/^#/.test(e)?e=window.document.getElementById(e.substr(1)):e=e.jquery?e[0]:e;var c=[e,t,n];return e.postscribe={cancel:function(){c.stream?c.stream.abort():c[1]=o}},n.beforeEnqueue(c),i.push(c),s||m(),e.postscribe}d(c,{streams:{},queue:i,WriteStream:l.default})},function(e,t,n){"use strict";t.__esModule=!0;var o,i,r,c,l,p=Object.assign||function(e){for(var t,s,n=1;n<arguments.length;n++){t=arguments[n];for(s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},v=n(3),g=m(v),u=n(4),s=f(u);function f(e){if(e&&e.__esModule)return e;var n,t={};if(e!=null)for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function m(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}i=!1,o="data-ps-",c="ps-style",r="ps-script";function a(e,t){var i=o+t,n=e.getAttribute(i);return s.existy(n)?String(n):n}function d(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=o+t;s.existy(n)&&n!==""?e.setAttribute(i,n):e.removeAttribute(i)}l=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};h(this,e),this.root=t,this.options=n,this.doc=t.ownerDocument,this.win=this.doc.defaultView||this.doc.parentWindow,this.parser=new g.default("",{autoFix:n.autoFix}),this.actuals=[t],this.proxyHistory="",this.proxyRoot=this.doc.createElement(t.nodeName),this.scriptStack=[],this.writeQueue=[],d(this.proxyRoot,"proxyof",0)}return e.prototype.write=function(){for((n=this.writeQueue).push.apply(n,arguments);!this.deferredRemote&&this.writeQueue.length;){var n,t=this.writeQueue.shift();s.isFunction(t)?this._callFunction(t):this._writeImpl(t)}},e.prototype._callFunction=function(t){var n={type:"function",value:t.name||t.toString()};this._onScriptStart(n),t.call(this.win,this.doc),this._onScriptDone(n)},e.prototype._writeImpl=function(t){this.parser.append(t);for(var n=void 0,i=void 0,a=void 0,o=[];(n=this.parser.readToken())&&!(i=s.isScript(n))&&!(a=s.isStyle(n));)n=this.options.beforeWriteToken(n),n&&o.push(n);o.length>0&&this._writeStaticTokens(o),i&&this._handleScriptToken(n),a&&this._handleStyleToken(n)},e.prototype._writeStaticTokens=function(t){var n=this._buildChunk(t);return n.actual?(n.html=this.proxyHistory+n.actual,this.proxyHistory+=n.proxy,this.proxyRoot.innerHTML=n.html,i&&(n.proxyInnerHTML=this.proxyRoot.innerHTML),this._walkChunk(),i&&(n.actualInnerHTML=this.root.innerHTML),n):null},e.prototype._buildChunk=function(t){for(var n,s,d,h=this.actuals.length,u=[],i=[],a=[],m=t.length,l=0;l<m;l++)n=t[l],s=n.toString(),u.push(s),n.attrs?/^noscript$/i.test(n.tagName)||(d=h++,i.push(s.replace(/(\/?>)/," "+o+"id="+d+" $1")),n.attrs.id!==r&&n.attrs.id!==c&&a.push(n.type==="atomicTag"?"":"<"+n.tagName+" "+o+"proxyof="+d+(n.unary?" />":">"))):(i.push(s),a.push(n.type==="endTag"?s:""));return{tokens:t,raw:u.join(""),actual:i.join(""),proxy:a.join("")}},e.prototype._walkChunk=function(){for(var o,i,r,t=void 0,n=[this.proxyRoot];s.existy(t=n.shift());)o=t.nodeType===1,r=o&&a(t,"proxyof"),r||(o&&(this.actuals[a(t,"id")]=t,d(t,"id")),i=t.parentNode&&a(t.parentNode,"proxyof"),i&&this.actuals[i].appendChild(t)),n.unshift.apply(n,s.toArray(t.childNodes))},e.prototype._handleScriptToken=function(t){var s=this,n=this.parser.clear();if(n&&this.writeQueue.unshift(n),t.src=t.attrs.src||t.attrs.SRC,t=this.options.beforeWriteToken(t),!t)return;t.src&&this.scriptStack.length?this.deferredRemote=t:this._onScriptStart(t),this._writeScriptToken(t,function(){s._onScriptDone(t)})},e.prototype._handleStyleToken=function(t){var n=this.parser.clear();n&&this.writeQueue.unshift(n),t.type=t.attrs.type||t.attrs.TYPE||"text/css",t=this.options.beforeWriteToken(t),t&&this._writeStyleToken(t),n&&this.write()},e.prototype._writeStyleToken=function(t){var n=this._buildStyle(t);this._insertCursor(n,c),t.content&&(n.styleSheet&&!n.sheet?n.styleSheet.cssText=t.content:n.appendChild(this.doc.createTextNode(t.content)))},e.prototype._buildStyle=function(t){var n=this.doc.createElement(t.tagName);return n.setAttribute("type",t.type),s.eachKey(t.attrs,function(e,t){n.setAttribute(e,t)}),n},e.prototype._insertCursor=function(t,n){this._writeImpl('<span id="'+n+'"/>');var s=this.doc.getElementById(n);s&&s.parentNode.replaceChild(t,s)},e.prototype._onScriptStart=function(t){t.outerWrites=this.writeQueue,this.writeQueue=[],this.scriptStack.unshift(t)},e.prototype._onScriptDone=function(t){if(t!==this.scriptStack[0]){this.options.error({msg:"Bad script nesting or script finished twice"});return}this.scriptStack.shift(),this.write.apply(this,t.outerWrites),!this.scriptStack.length&&this.deferredRemote&&(this._onScriptStart(this.deferredRemote),this.deferredRemote=null)},e.prototype._writeScriptToken=function(t,n){var s=this._buildScript(t),o=this._shouldRelease(s),i=this.options.afterAsync;t.src&&(s.src=t.src,this._scriptLoadHandler(s,o?i:function(){n(),i()}));try{this._insertCursor(s,r),(!s.src||o)&&n()}catch(e){this.options.error(e),n()}},e.prototype._buildScript=function(t){var n=this.doc.createElement(t.tagName);return s.eachKey(t.attrs,function(e,t){n.setAttribute(e,t)}),t.content&&(n.text=t.content),n},e.prototype._scriptLoadHandler=function(t,n){function o(){t=t.onload=t.onreadystatechange=t.onerror=null}var r=this.options.error;function i(){o(),n!=null&&n(),n=null}function s(e){o(),r(e),n!=null&&n(),n=null}function a(e,t){var n=e["on"+t];n!=null&&(e["_on"+t]=n)}a(t,"load"),a(t,"error"),p(t,{onload:function(){if(t._onload)try{t._onload.apply(this,Array.prototype.slice.call(arguments,0))}catch(e){s({msg:"onload handler failed "+e+" @ "+t.src})}i()},onerror:function(){if(t._onerror)try{t._onerror.apply(this,Array.prototype.slice.call(arguments,0))}catch(e){s({msg:"onerror handler failed "+e+" @ "+t.src});return}s({msg:"remote script failed "+t.src})},onreadystatechange:function(){/^(loaded|complete)$/.test(t.readyState)&&i()}})},e.prototype._shouldRelease=function(t){var n=/^script$/i.test(t.nodeName);return!n||!!(this.options.releaseAsync&&t.src&&t.hasAttribute("async"))},e}(),t.default=l},function(e,t){(function(s,o){e.exports=o()})(this,function(){return function(e){var n={};function t(s){if(n[s])return n[s].exports;var o=n[s]={exports:{},id:s,loaded:!1};return e[s].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var s=n(1),o=i(s);function i(e){return e&&e.__esModule?e:{default:e}}e.exports=o.default},function(e,t,n){"use strict";t.__esModule=!0;var s,i,a,u=n(2),o=r(u),p=n(3),f=r(p),m=n(6),c=d(m),l=n(5);function d(e){return e&&e.__esModule?e:{default:e}}function r(e){if(e&&e.__esModule)return e;var n,t={};if(e!=null)for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}i={comment:/^<!--/,endTag:/^<\//,atomicTag:/^<\s*(script|style|noscript|iframe|textarea)[\s/>]/i,startTag:/^</,chars:/^[^<]/},s=function(){function e(){var t,n,s,i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};h(this,e),this.stream=a,n=!1,t={};for(s in o)o.hasOwnProperty(s)&&(r.autoFix&&(t[s+"Fix"]=!0),n=n||t[s+"Fix"]);n?(this._readToken=(0,c.default)(this,t,function(){return i._readTokenImpl()}),this._peekToken=(0,c.default)(this,t,function(){return i._peekTokenImpl()})):(this._readToken=this._readTokenImpl,this._peekToken=this._peekTokenImpl)}return e.prototype.append=function(t){this.stream+=t},e.prototype.prepend=function(t){this.stream=t+this.stream},e.prototype._readTokenImpl=function(){var t=this._peekTokenImpl();if(t)return this.stream=this.stream.slice(t.length),t},e.prototype._peekTokenImpl=function(){for(n in i)if(i.hasOwnProperty(n)&&i[n].test(this.stream)){var n,t=f[n](this.stream);if(t)return t.type==="startTag"&&/script|style/i.test(t.tagName)?null:(t.text=this.stream.substr(0,t.length),t)}},e.prototype.peekToken=function(){return this._peekToken()},e.prototype.readToken=function(){return this._readToken()},e.prototype.readTokens=function(t){for(var n=void 0;n=this.readToken();)if(t[n.type]&&t[n.type](n)===!1)return},e.prototype.clear=function(){var t=this.stream;return this.stream="",t},e.prototype.rest=function(){return this.stream},e}(),t.default=s,s.tokenToString=function(e){return e.toString()},s.escapeAttributes=function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=(0,l.escapeQuotes)(e[t],null));return n},s.supports=o;for(a in o)o.hasOwnProperty(a)&&(s.browserHasFlaw=s.browserHasFlaw||!o[a]&&a)},function(e,t){"use strict";t.__esModule=!0;var i,s=!1,o=!1,n=window.document.createElement("div");try{i="<P><I></P></I>",n.innerHTML=i,t.tagSoup=s=n.innerHTML!==i}catch{t.tagSoup=s=!1}try{n.innerHTML="<P><i><P></P></i></P>",t.selfClose=o=n.childNodes.length===2}catch{t.selfClose=o=!1}n=null,t.tagSoup=s,t.selfClose=o},function(e,t,n){"use strict";t.__esModule=!0;var s,o,a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.comment=r,t.chars=c,t.startTag=i,t.atomicTag=l,t.endTag=d,s=n(4),o={startTag:/^<([-A-Za-z0-9_]+)((?:\s+[\w-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,endTag:/^<\/([-A-Za-z0-9_]+)[^>]*>/,attr:/(?:([-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([-A-Za-z0-9_]+)(\s|$)+)/g,fillAttr:/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i};function r(e){var t=e.indexOf("-->");if(t>=0)return new s.CommentToken(e.substr(4,t-1),t+3)}function c(e){var t=e.indexOf("<");return new s.CharsToken(t>=0?t:e.length)}function i(e){var t,n,i=e.indexOf(">");if(i!==-1&&(t=e.match(o.startTag),t&&(n=function(){var e={},i={},n=t[2];return t[2].replace(o.attr,function(t,s){arguments[2]||arguments[3]||arguments[4]||arguments[5]?arguments[5]?(e[arguments[5]]="",i[arguments[5]]=!0):e[s]=arguments[2]||arguments[3]||arguments[4]||o.fillAttr.test(s)&&s||"":e[s]="",n=n.replace(t,"")}),{v:new s.StartTagToken(t[1],t[0].length,e,i,!!t[3],n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))}}(),(typeof n=="undefined"?"undefined":a(n))==="object")))return n.v}function l(e){var n,o,t=i(e);if(t&&(o=e.slice(t.length),o.match(new RegExp("</\\s*"+t.tagName+"\\s*>","i"))&&(n=o.match(new RegExp("([\\s\\S]*?)</\\s*"+t.tagName+"\\s*>","i")),n)))return new s.AtomicTagToken(t.tagName,n[0].length+t.length,t.attrs,t.booleanAttrs,n[1])}function d(e){var t=e.match(o.endTag);if(t)return new s.EndTagToken(t[1],t[0].length)}},function(e,t,n){"use strict";t.__esModule=!0,t.EndTagToken=t.AtomicTagToken=t.StartTagToken=t.TagToken=t.CharsToken=t.CommentToken=t.Token=void 0;var o,a,r,c,l,d,u,i=n(5);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}a=t.Token=function e(t,n){s(this,e),this.type=t,this.length=n,this.text=""},r=t.CommentToken=function(){function e(t,n){s(this,e),this.type="comment",this.length=n||(t?t.length:0),this.text="",this.content=t}return e.prototype.toString=function(){return"<!--"+this.content},e}(),c=t.CharsToken=function(){function e(t){s(this,e),this.type="chars",this.length=t,this.text=""}return e.prototype.toString=function(){return this.text},e}(),o=t.TagToken=function(){function e(t,n,o,i,a){s(this,e),this.type=t,this.length=o,this.text="",this.tagName=n,this.attrs=i,this.booleanAttrs=a,this.unary=!1,this.html5Unary=!1}return e.formatTag=function(t){var s,a,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n="<"+t.tagName;for(s in t.attrs)t.attrs.hasOwnProperty(s)&&(n+=" "+s,a=t.attrs[s],(typeof t.booleanAttrs=="undefined"||typeof t.booleanAttrs[s]=="undefined")&&(n+='="'+(0,i.escapeQuotes)(a)+'"'));return t.rest&&(n+=" "+t.rest),t.unary&&!t.html5Unary?n+="/>":n+=">",o!=null&&(n+=o+"</"+t.tagName+">"),n},e}(),l=t.StartTagToken=function(){function e(t,n,o,i,a,r){s(this,e),this.type="startTag",this.length=n,this.text="",this.tagName=t,this.attrs=o,this.booleanAttrs=i,this.html5Unary=!1,this.unary=a,this.rest=r}return e.prototype.toString=function(){return o.formatTag(this)},e}(),d=t.AtomicTagToken=function(){function e(t,n,o,i,a){s(this,e),this.type="atomicTag",this.length=n,this.text="",this.tagName=t,this.attrs=o,this.booleanAttrs=i,this.unary=!1,this.html5Unary=!1,this.content=a}return e.prototype.toString=function(){return o.formatTag(this,this.content)},e}(),u=t.EndTagToken=function(){function e(t,n){s(this,e),this.type="endTag",this.length=n,this.text="",this.tagName=t}return e.prototype.toString=function(){return"</"+this.tagName+">"},e}()},function(e,t){"use strict";t.__esModule=!0,t.escapeQuotes=n;function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return e?e.replace(/([^"]*)"/g,function(e,t){return/\\/.test(t)?t+'"':t+'\\"'}):t}},function(e,t){"use strict";t.__esModule=!0,t.default=c;var o=/^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i,i=/^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i;function n(e){return e&&e.type==="startTag"&&(e.unary=o.test(e.tagName)||e.unary,e.html5Unary=!/\/>$/.test(e.text)),e}function a(e,t){var s=e.stream,o=n(t());return e.stream=s,o}function s(e,t){var n=t.pop();e.prepend("</"+n.tagName+">")}function r(){var e=[];return e.last=function(){return this[this.length-1]},e.lastTagNameEq=function(e){var t=this.last();return t&&t.tagName&&t.tagName.toUpperCase()===e.toUpperCase()},e.containsTagName=function(e){for(var n,t=0;n=this[t];t++)if(n.tagName===e)return!0;return!1},e}function c(e,t,o){var c=r(),d={startTag:function(o){var a=o.tagName;a.toUpperCase()==="TR"&&c.lastTagNameEq("TABLE")?(e.prepend("<TBODY>"),l()):t.selfCloseFix&&i.test(a)&&c.containsTagName(a)?c.lastTagNameEq(a)?s(e,c):(e.prepend("</"+o.tagName+">"),l()):o.unary||c.push(o)},endTag:function(i){var a=c.last();a?t.tagSoupFix&&!c.lastTagNameEq(i.tagName)?s(e,c):c.pop():t.tagSoupFix&&(o(),l())}};function l(){var t=a(e,o);t&&d[t.type]&&d[t.type](t)}return function(){return l(),n(o())}}}])})},function(e,t){"use strict";t.__esModule=!0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.existy=s,t.isFunction=r,t.each=o,t.eachKey=i,t.defaults=c,t.toArray=l,t.last=d,t.isTag=n,t.isScript=u,t.isStyle=h;function s(e){return e!=null}function r(e){return"function"==typeof e}function o(e,t,n){var s=void 0,o=e&&e.length||0;for(s=0;s<o;s++)t.call(n,e[s],s)}function i(e,t,n){for(var s in e)e.hasOwnProperty(s)&&t.call(n,s,e[s])}function c(e,t){return e=e||{},i(t,function(t,n){s(e[t])||(e[t]=n)}),e}function l(e){try{return Array.prototype.slice.call(e)}catch{var t=function(){var t=[];return o(e,function(e){t.push(e)}),{v:t}}();if((typeof t=="undefined"?"undefined":a(t))==="object")return t.v}}function d(e){return e[e.length-1]}function n(e,t){return!(!e||e.type!=="startTag"&&e.type!=="atomicTag"||!("tagName"in e))&&!!~e.tagName.toLowerCase().indexOf(t)}function u(e){return n(e,"script")}function h(e){return n(e,"style")}}])})