/*! @ztracker --v1.1.37 */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ztracker=e():t.ztracker=e()}(self,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>ut});var r,n,o="https://log.adtimaserver.vn",i="https://s.zzcdn.me";!function(t){t[t.BUTTON=1]="BUTTON",t[t.LINK=2]="LINK",t[t.STANDARD=3]="STANDARD",t[t.WEB_ELEMENT=4]="WEB_ELEMENT"}(r||(r={})),function(t){t.PAGEVIEW="pageview",t.VIEWABLE="viewable",t.CONVERSION="conversion",t.EVENT="event"}(n||(n={}));var a=[/_ladi_trck(.*)/gi],c=document.URL,u="_ztrdebug",l="zaclid";function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function f(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */f=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,o){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),c=new j(o||[]);return n(a,"_invoke",{value:_(t,r,c)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var p={};function v(){}function h(){}function y(){}var m={};u(m,i,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(L([])));w&&w!==e&&r.call(w,i)&&(m=w);var b=y.prototype=v.prototype=Object.create(m);function k(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function o(n,i,a,c){var u=d(t[n],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==s(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return o("throw",t,a,c)}))}c(u.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function _(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=S(a,r);if(c){if(c===p)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=d(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function S(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=d(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function d(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function p(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:this.getCURL();t=t.replace(/[\\[\]]/g,"\\$&");var r=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)"),n=r.exec(e);return n&&n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):null}},{key:"getCURL",value:function(){var t=new URL(document.URL);if(!t.searchParams.get(l))if(window.zaclid&&window.zaclid.length>0)t.searchParams.set(l,window.zaclid);else if(window.furl&&window.furl.length>0){var e=this.getParam(l,window.furl);e&&t.searchParams.set(l,e)}return t.toString()}},{key:"acceptInspect",value:function(){try{return window.self!==window.top&&["localhost","log.adtimaserver.vn"].filter((function(t){return document.referrer.indexOf(t)>-1})).length>0}catch(t){return!0}}},{key:"isMobile",value:function(){var t=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase();return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}},{key:"isMiniApp",value:function(){return/h5.zdn.vn\/zapps\/[0-9]/gi.test(document.location.href)||"zalo-mini-app"===window.APP_CONTEXT}},{key:"getMiniAppInfo",value:(o=f().mark((function t(){var e,r,n;return f().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isMiniApp()){t.next=9;break}if((e={zaloAppId:window.zmpGlobal.zaloAppId,appId:window.APP_ID,znId:window.zmpGlobal.noiseUserId}).appId||(r=window.location.pathname.split("/"),e.appId=r[r.indexOf("zapps")+1]||""),e.znId){t.next=8;break}return t.next=6,U.Browser.getVisitorID();case 6:n=t.sent,e.znId=n;case 8:return t.abrupt("return",e);case 9:return t.abrupt("return",{});case 10:case"end":return t.stop()}}),t,this)})),i=function(){var t=this,e=arguments;return new Promise((function(r,n){var i=o.apply(t,e);function a(t){d(i,r,n,a,c,"next",t)}function c(t){d(i,r,n,a,c,"throw",t)}a(void 0)}))},function(){return i.apply(this,arguments)})},{key:"getUID",value:function(){return new Promise((function(t){var e=!1,r=function(r){e=!0,r&&U.Storage.setItem("_uid",r),t(r)};try{var n,o=U.Storage.getItem("_uid");if(o)e=!0,t(o);else if("function"==typeof(null===(n=window.ZA)||void 0===n?void 0:n.getVisitorID))window.ZA.getVisitorID(r);else{var i=setTimeout(r,300),a="https://za.zdn.vn/v3/za.js?"+Math.floor((new Date).getTime()/864e5);U.Browser.loadScript("zasdk",a).then((function(){document.addEventListener("ZA.onready",(function(){clearTimeout(i),!e&&window.ZA.getVisitorID(r)}))}),(function(){return r()}))}}catch(t){r()}}))}},{key:"getVisitorID",value:function(){return new Promise((function(t,e){var r,n="";if("function"!=typeof(null===(r=window.ZJSBridge)||void 0===r?void 0:r.callCustomAction))return e("ZJSBridge is undefined");window.ZJSBridge.callCustomAction("action.mp.get.visitor.id",{},(function(r){return 0==r.error_code&&"{}"!=r.data?(n=r.data,t(n)):e("get visitor id error")}))}))}},{key:"loadScript",value:function(t,e){return new Promise((function(r,n){try{document.getElementById(t)&&r(!0);var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.id=t,o.src=e,o.onload=function(){return r(!0)},o.onerror=function(){return n()},document.head.appendChild(o)}catch(t){n()}}))}},{key:"loadStyle",value:function(t,e){var r=document.getElementById(t);r||((r=document.createElement("style")).innerHTML=e,r.id=t,document.head.appendChild(r))}},{key:"elementOrParentIsFixed",value:function(t){var e;if(null!==(e=Array.isArray(t)?t[0]:"string"==typeof t?document.querySelector(t):t))for(;"object"===s(e)&&"body"!==e.nodeName.toLowerCase();){if("fixed"===window.getComputedStyle(e).getPropertyValue("position").toLowerCase())return!0;e=e.parentElement}return!1}},{key:"includeTracking",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.id&&document.getElementById(e.id)){var r,n=document.getElementById(e.id);null!==n&&(null===(r=n.parentElement)||void 0===r||r.removeChild(n))}var o=new URL(t);if(o.searchParams.set("atmrk",Math.random().toString()),"complete"===document.readyState){var i,a=document.getElementById("trackheader");a||((a=document.createElement("div")).id="trackheader",a.setAttribute("style","overflow:hidden;width:0;height:0;padding:0;margin:0;position:relative;"),document.body.appendChild(a));var c=document.createElement("img");c.width=1,c.height=1,c.src=o.href,c.setAttribute("style","border:0;overflow:hidden;position:absolute;width:1px;height:1px;"),Object.keys(e).forEach((function(t){return c.setAttribute(t,e[t])})),null===(i=a)||void 0===i||i.appendChild(c)}else(new Image).src=o.href}},{key:"documentOnReady",value:function(){return new Promise((function(t){"complete"===document.readyState?t(document):document.addEventListener("readystatechange",(function(){"complete"===document.readyState&&t(document)}))}))}},{key:"toJson",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];try{if(t&&t.length)return JSON.parse(t);throw new Error("Input empty!")}catch(t){return e}}},{key:"parsePixelIds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.split(",").filter((function(t){return t.length>15&&/^\d+$/.test(t)}))}},{key:"queryWebElements",value:function(t){var e=[];return t.id.length||t.class.length||t.text.length?(t.id.length>0&&(e=Array.from(document.querySelectorAll("#".concat(t.id.join(", #"))))),t.class.length>0&&(e=e.length>0?e.filter((function(e){return t.class.every((function(t){return t.split(" ").every((function(t){return e.classList.contains(t)}))}))})):Array.from(document.querySelectorAll("".concat(t.class.map((function(t){return t.split(" ").map((function(t){return".".concat(t)})).join("")})).join(", "))))),t.text.length>0&&(e=e.length>0?e.filter((function(e){return t.text.every((function(t){var r;return null===(r=e.textContent)||void 0===r?void 0:r.includes(t)}))})):Array.from(document.querySelectorAll(':contains("'.concat(t.text.join('"), :contains("'),'")')))),e):e}},{key:"queryWebButtons",value:function(t){if(0===t.length)return{selector:"",elements:[]};var e="#".concat(t.join(", #"));return{selector:e,elements:Array.from(document.querySelectorAll(e))}}},{key:"getSelectorFromWebElement",value:function(t,e){var r={id:"",class:"",text:""},n=(e.id||[]).find((function(e){return t.id===e}));n&&(r.id=n);var o=(e.class||[]).filter((function(e){return e.split(" ").every((function(e){return t.classList.contains(e)}))}));o.length>0&&(r.class=o.join(","));var i=(e.text||[]).filter((function(e){var r;return null===(r=t.textContent)||void 0===r?void 0:r.includes(e)}));return i.length>0&&(r.text=i.join(",")),JSON.stringify(r)}},{key:"formatDate",value:function(t){return t.toISOString().slice(0,19).replace(/-/g,"/").replace("T"," ")}}],r&&p(e.prototype,r),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();const h=v;function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function m(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=new Date;n&&1==n?o=new Date(o.getTime()+1e3*r):o.setDate(o.getDate()+r);var i=encodeURIComponent(e)+"; expires="+o.toUTCString()+"; path=/";document.cookie=t+"="+i}},{key:"get",value:function(t){var e=document.cookie.split(";"),r=null;return e.forEach((function(e){var n=e.split("="),o=n[0].replace(/^\s+|\s+$/g,"").trim();("string"==typeof t?o===t:t.test(o))&&n[1]&&(r=[o,decodeURIComponent(n[1].replace(/^\s+|\s+$/g,""))])})),r}}],r&&m(e.prototype,r),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();const w=g;function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]&&arguments[0];k(this,t),_(this,"showLog",!1),this.showLog=j||e}var e,r,n;return e=t,(r=[{key:"enableDebugger",value:function(t){U.Browser.loadScript("eruda","".concat(i,"/ztr/eruda.min.js")).then((function(){document.onreadystatechange=function(){if("complete"===document.readyState){var e=document.createElement("div");e.style.position="relative",e.style.zIndex="999999999",document.body.appendChild(e),t=t||{container:e},window.eruda.init(t)}}}))}},{key:"printLog",value:function(t){var e=t.log,r=t.type,n=void 0===r?0:r,o=[console.log,console.info,console.log,console.error];this.showLog&&o[n].apply(console,function(t,e){var r=[];r=Array.isArray(t)?x(t):[t];var n,o,i=!U.Browser.isMiniApp()||j;return i&&r.unshift((n=L[e],"display: inline-block; color: ".concat(o||"#fff","; background: ").concat(n,"; padding: 1px 4px; border-radius: 3px;"))),r.unshift(i?"%cAdtimaPixel":"[AdtimaPixel]"),r}(e,n)),window.zplogs=window.zplogs||[],window.zplogs.push({log:e,time:new Date})}}])&&E(e.prototype,r),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function P(t){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(t)}function A(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{},n=r.expire,o=void 0===n?30:n;if(this.storage.setItem(t,e),this.isMiniApp&&o>0){var i=new Date;i.setDate(i.getDate()+o),this.storage.setItem("".concat(t,"_exp"),i.getTime().toString())}}},{key:"getItem",value:function(t){if(this.isMiniApp){var e=this.storage.getItem(t);if(e){var r=this.storage.getItem("".concat(t,"_exp"));if(r){var n=parseInt(r);(isNaN(n)||nt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:this._pixelIds;r.forEach((function(t){var r;if(!e._pageviews[t]){var i=H(H({type:n.PAGEVIEW,pId:t},e._query),e._zma);!isNaN(null===(r=window._ztrk)||void 0===r?void 0:r.ready)&&window._ztrk.ready>0&&(i.dur=Date.now()-window._ztrk.ready),U.Browser.includeTracking("".concat(o,"/tracklp?").concat(Object.keys(i).map((function(t){return"".concat(t,"=").concat(encodeURIComponent(i[t]))})).join("&")),{"z2-type":"pv"}),U.Debug.printLog({log:["Log PageView",i]})}})),"function"==typeof(null===(t=window.ztrDebug)||void 0===t?void 0:t.postMessage)&&window.ztrDebug.postMessage({type:n.PAGEVIEW,path:"/tracklp",data:H({type:n.PAGEVIEW,pId:this._pixelIds.join(",")},this._query)})}},{key:"logEvent",value:function(t){var e,r=this,n=t.type,i=t.value,a=t.attrs,c=void 0===a?{}:a;this._pixelIds.forEach((function(t){var e=H(H({type:n,value:i,pId:t},r._query),r._zma);U.Browser.includeTracking("".concat(o,"/tracklp?").concat(Object.keys(e).map((function(t){return"".concat(t,"=").concat(encodeURIComponent(e[t]))})).join("&")),c),U.Debug.printLog({log:["Log UserEvent <".concat(n,">"),e]})})),"function"==typeof(null===(e=window.ztrDebug)||void 0===e?void 0:e.postMessage)&&window.ztrDebug.postMessage({type:n,path:"/tracklp",data:H({type:n,value:i,pId:this._pixelIds.join(",")},this._query)})}},{key:"logConversion",value:function(t){var e,i=t.pixelId,a=t.eventId,c=t.eventType,u=t.selector,s=t.value,f=void 0===s?"":s,d=t.stdParam,p=t.attrs,v=void 0===p?{}:p;if(i){var h=H(H({pId:i,eId:a,et:c,url:U.Browser.getCURL(),value:f},this._query),this._zma);if(d&&(h.stdParam=d),u){var y,m=($(y={},r.BUTTON,"eclck"),$(y,r.LINK,"eurl"),$(y,r.STANDARD,"estd"),$(y,r.WEB_ELEMENT,"eclckcb"),y);h[m[c]||"eclck"]=u}var g=U.Browser.getParam(l)||U.Storage.getItem("_".concat(l));g&&(h[l]=g),U.Browser.includeTracking("".concat(o,"/ptrck/log?").concat(Object.keys(h).map((function(t){return"".concat(t,"=").concat(encodeURIComponent(h[t]))})).join("&")),v),U.Debug.printLog({log:["Log ".concat(u||c),h]}),"function"==typeof(null===(e=window.ztrDebug)||void 0===e?void 0:e.postMessage)&&window.ztrDebug.postMessage({type:n.CONVERSION,path:"/ptrck/log",data:h})}}},{key:"logOrder",value:function(t){var e=H(H({created_datetime:Date.now()},t||{}),this._zma);U.Browser.includeTracking("".concat(o,"/ptrck/order?").concat(Object.keys(e).map((function(t){return"".concat(t,"=").concat(encodeURIComponent(e[t]))})).join("&")),{}),U.Debug.printLog({log:["Log Order",e]})}}],i&&J(e.prototype,i),a&&J(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}();const K=Y;function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function X(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */X=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,o){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),c=new x(o||[]);return n(a,"_invoke",{value:k(t,r,c)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function d(){}function p(){}function v(){}var h={};u(h,i,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(I([])));m&&m!==e&&r.call(m,i)&&(h=m);var g=v.prototype=d.prototype=Object.create(h);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function o(n,i,a,c){var u=s(t[n],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==Q(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return o("throw",t,a,c)}))}c(u.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function k(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function I(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:I(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function tt(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function et(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){tt(i,n,o,a,c,"next",t)}function c(t){tt(i,n,o,a,c,"throw",t)}a(void 0)}))}}function rt(t){return function(t){if(Array.isArray(t))return nt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return nt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nt(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1||!t[0])&&(r={}),r=it({},t[0],e)):e.id&&t.includes(e.id)&&Array.isArray(e.data)&&(r=it({},e.id,e.data)),r}},{key:"init",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt(this.tracker.pixelIds),r=U.Browser.getParam(l),n=Promise.all([this.onReady].concat(rt(e.map((function(e){return t.getEvents(e)})))));n.then((function(n){var o=n.shift(),i=t.getLocalData(e);if(n.forEach((function(t,r){var n=t,o=e[r];n.length>0&&(i[o]=[].concat(rt(n),rt((i[o]||[]).filter((function(t){return!n.find((function(e){return e.cid===t.cid}))})))))})),r&&U.Storage.setItem("_".concat(l),r),sessionStorage.setItem("_eztrk",JSON.stringify(i)),r&&sessionStorage.setItem("_zaclid",r),Object.keys(i).forEach((function(r){e.includes(r)&&(t._events=[].concat(rt(t._events),rt(i[r])))})),t.handleViewable(o),t.handleElementEvents(o),window.ztrq=function(){return t.signalsEvents.apply(t,arguments)},Array.isArray(window._ztrk.queue))for(;window._ztrk.queue.length;){var a=window._ztrk.queue.shift();t.signalsEvents.apply(t,rt(a))}}))}},{key:"signalsEvents",value:function(){for(var t=arguments.length,e=new Array(t),r=0;ru&&!e._timer.viewStart?(e._timer.viewStart=(new Date).getTime(),e.tracker.logEvent({type:n.VIEWABLE,value:"view_area=90;duration=".concat(e._timer.viewStart-e._start),attrs:{"z2-type":"vp-end"}})):t>c&&!e._timer.viewMiddle?(e._timer.viewMiddle=(new Date).getTime(),e.tracker.logEvent({type:n.VIEWABLE,value:"view_area=60;duration=".concat(e._timer.viewMiddle-e._start),attrs:{"z2-type":"vp-mid"}})):t>a&&!e._timer.viewEnd&&(e._timer.viewEnd=(new Date).getTime(),e.tracker.logEvent({type:n.VIEWABLE,value:"view_area=30;duration=".concat(e._timer.viewEnd-e._start),attrs:{"z2-type":"vp-start"}}))};window.addEventListener("scroll",l),l()}},{key:"handleElementEvents",value:function(t){var e=this;this._events.forEach((function(n){if(!n.bind)switch(n.bind=!0,n.kind){case r.BUTTON:var o=n.keys.split(",").map((function(t){return'[id*="'.concat(t,'"]')})),i=t.querySelectorAll(o.join(","));e._logs.push([o.join(","),i.length]),i.forEach((function(t){t.addEventListener("click",(function(){var r=U.Browser.elementOrParentIsFixed(t);return e.tracker.logConversion({pixelId:n.pid,eventId:n.cid,eventType:n.kind,selector:t.getAttribute("id"),value:"view_percent=".concat(e._scrollTopPercent,";popup=").concat(JSON.stringify(r)),attrs:{"z2-type":"convs"}}),!0}),!1)}));break;case r.LINK:var a=n.keys.split(",").filter((function(t){return c.indexOf(t)>-1}));a.length&&e.tracker.logConversion({pixelId:n.pid,eventId:n.cid,eventType:n.kind,selector:a.join(","),value:"view_percent=".concat(e._scrollTopPercent),attrs:{"z2-type":"convs"}});break;case r.WEB_ELEMENT:try{var u=JSON.parse(n.keys),l=U.Browser.queryWebElements(u);e._logs.push(["Query conversion elements",l.map((function(t){return U.Browser.getSelectorFromWebElement(t,u)}))]),l.forEach((function(t){t.addEventListener("click",(function(){var r=U.Browser.elementOrParentIsFixed(t);return e.tracker.logConversion({pixelId:n.pid,eventId:n.cid,eventType:n.kind,selector:U.Browser.getSelectorFromWebElement(t,u),value:"view_percent=".concat(e._scrollTopPercent,";popup=").concat(JSON.stringify(r)),attrs:{"z2-type":"convs"}}),!0}),!1)}))}catch(t){e._logs.push(["error","Cannot find web element from keys [".concat(n.keys,"]")])}}})),this._bindLinkEvents||(this._bindLinkEvents=!0,t.querySelectorAll("a[href]").forEach((function(t){t.addEventListener("click",(function(){var r=U.Browser.elementOrParentIsFixed(t),o=t.getAttribute("href"),i=o.startsWith("tel:")?"tel":o.startsWith("mailto:")?"mail":"url";return e.tracker.logEvent({type:n.EVENT,value:"cta=".concat(i,";view_percent=").concat(e._scrollTopPercent,";popup=").concat(JSON.stringify(r)),attrs:{"z2-type":n.EVENT}}),!0}),!1)})))}},{key:"handleStandardEvent",value:function(){for(var t=this,e=arguments.length,n=new Array(e),o=0;o0&&t.tracker.logConversion({pixelId:e.pid,eventId:e.cid,eventType:e.kind,selector:o.join(","),stdParam:n[0]?JSON.stringify(n[0]):"",attrs:{"z2-type":"stde"}})}}))}}}],s&&ot(e.prototype,s),f&&ot(e,f),Object.defineProperty(e,"prototype",{writable:!1}),t}();const ut=function(){var t=et(X().mark((function t(){var e,r,n,o,i=arguments;return X().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.length>0&&void 0!==i[0]?i[0]:window._ztrk||{}).ready){t.next=13;break}return window._ztrk=e,e.ready=Date.now(),e.push=function(t){return t&&(e.pid=t)},t.next=7,U.Browser.getMiniAppInfo();case 7:r=t.sent,n=new ct(r),e.version=n.version,e.logs=function(){return n.logs},t.next=15;break;case 13:(o=U.Browser.getParam("id",document.currentScript.getAttribute("src")))&&!(e.pid||"").split(",").includes(o)&&("function"==typeof window._ztrk.push?window._ztrk.push(o):window.ztrq("pid",o));case 15:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()();return e})()));