/*! For license information please see core.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.core=t():e.core=t()}("undefined"!=typeof window?window:self,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=61)}([function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=200&&a.status<300?n(a.response):c()},a.onerror=function(){return c()},d&&(a.timeout=u,a.ontimeout=function(){c()}),a.withCredentials=!0,a.send(JSON.stringify(t))}))},this.format=function(e){var t=e.eventName,n=void 0===t?"":t,r=e.context,i=void 0===r?{}:r,a=e.params,s=void 0===a?{}:a,c=i.ad,u=void 0===c?{}:c,l=i.pixel,d=void 0===l?{}:l,p=i.libVersion,f=void 0===p?"":p,h=i.trackFlag,v=void 0!==h&&h;return{clickid:u.callback||"",event_name:o.EVENT_NAME[n]||o.UNKNOWN_EVENT,is_attributed:0,mmpcode:"PL",pixelId:d.code||"",pixelSdkVersion:f,testFlag:!o.PRODUCTION,trackFlag:v,pixelExtData:JSON.stringify(s)}},this.get=function(e){return new Promise((function(t,n){var o=new XMLHttpRequest,a=function(t){var a;n(o.statusText),(0,r.APILogger)({apiPath:e,actionStatus:i.ActionStatus.ERROR,error:null!=t?t:"statusText : ".concat(null!==(a=o.statusText)&&void 0!==a?a:o.status)})};o.responseType="json",o.open("GET",e),o.onload=function(){if(o.status>=200&&o.status<300){var e=o.response;e.data&&e.data.length>0?t(e):a("pixel not exist")}else a()},o.onerror=function(){return a()},o.withCredentials=!0,o.send()}))}};t.xhrService=new a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CostInfoType=t.ActionStatus=t.LOGGER_TYPES_NAME=void 0,function(e){e.successConfig="successConfig",e.errConfig="errConfig",e.errBefroeSetBridge="errBefroeSetBridge",e.successSetBridge="successSetBridge",e.errSetBridge="errSetBridge",e.successBridge="successBridge",e.errBridge="errBridge",e.errBridgeForUnPixel="errBridgeForNotPixelAd",e.errMatchPixelId="errMatchPixelId",e.errPixelId="errPixelId",e.errClickId="errClickId",e.errUp="errUp",e.successUp="successUp",e.successUpForOther="successUpForOther",e.wAndc="windowAndcookie",e.previewErrUp="previewErrUp",e.GET_AD_INFO_COUNT="GET_AD_INFO_COUNT",e.GET_AD_INFO_FROM_SESSION="GET_AD_INFO_FROM_SESSION",e.GET_AD_INFO_FROM_COOKIE="GET_AD_INFO_FROM_COOKIE",e.GET_AD_INFO_FROM_URL="GET_AD_INFO_FROM_URL",e.GET_AD_INFO_FROM_BRIDGE="GET_AD_INFO_FROM_BRIDGE",e.I18N_AD_COST_LOG="I18N_AD_COST_LOG",e.CATCH_JS_ERROR="CATCH_JS_ERROR",e.CATCH_API_ERROR="CATCH_API_ERROR"}(t.LOGGER_TYPES_NAME||(t.LOGGER_TYPES_NAME={})),function(e){e.SUCCESS="SUCCESS",e.ERROR="ERROR"}(t.ActionStatus||(t.ActionStatus={})),function(e){e.BridgeYodaV2="BridgeYodaV2"}(t.CostInfoType||(t.CostInfoType={}))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1||"string"==typeof e&&(e.indexOf("type=preload")>-1||e.indexOf("kwai_type=preload")>-1)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getQueryStringWithIframeCheck=t.getQueryString=void 0;var r=n(1),o=n(15),i=n(0);t.getQueryString=function(e,t,n){var r="";try{var o=new URL(null!=t?t:"");if(o.searchParams.has(e))r=o.searchParams.get(e)||"";else if(o.hash)if(o.hash.includes("?")){var a=o.hash.slice(o.hash.indexOf("?"));(s=new URLSearchParams(a)).has(e)&&(r=s.get(e)||"")}else{var s;(s=new URLSearchParams(o.hash.slice(1))).has(e)&&(r=s.get(e)||"")}}catch(e){(0,i.JSLogger)({error:e}),null==n||n(e)}return r?decodeURIComponent(r):""};t.getQueryStringWithIframeCheck=function(e,n,i){var a,s=(0,t.getQueryString)(e,n,i);if(!s&&(0,o.isInIframe)())try{s=(0,t.getQueryString)(e,null===(a=null===r.windowSnapshot||void 0===r.windowSnapshot?void 0:r.windowSnapshot.top)||void 0===a?void 0:a.location.href,i)}catch(e){}return s}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInIframe=void 0;var r=n(1);t.isInIframe=function(){return(0,r.checkWindow)(r.GlobalThis)&&r.GlobalThis.self!==r.GlobalThis.top}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Plugin=void 0;var r=function(){function e(e){this.context=e}return e.prototype.pageDidLoad=function(){},e.prototype.pageUrlWillChange=function(e,t){},e.prototype.pageUrlDidChange=function(e){},e.prototype.pageWillLeave=function(e){},e.prototype.pixelCreateStart=function(e){},e.prototype.pixelCreateEnd=function(e){},e.prototype.pixelDidMount=function(e){},e.prototype.initStart=function(){},e.prototype.initEnd=function(){},e.prototype.adInfoInitStart=function(){},e.prototype.adInfoInitEnd=function(){},e.prototype.contextInitStart=function(){},e.prototype.contextInitEnd=function(){},e.prototype.pluginInitStart=function(e){},e.prototype.pluginInitEnd=function(e){},e}();t.Plugin=r},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.getIsGtm=t.getWdata=void 0;var o=n(1),i="",a=[{partner:"shopyy",tests:{windowProperties:["ymcart_goods_id","ymcart_countrys","ymcart_data_id","ymcart_store_id"],cookie:["ymcart"]}},{partner:"shoplazza",tests:{windowProperties:["SHOPLAZZA","SHOPLAZZA_APPS_COMMON","SHOP_PARAMS","Shoplazza"],cookie:["shoplazza"]}},{partner:"shopline",tests:{windowProperties:["Shopline"]}},{partner:"shopify",tests:{windowProperties:["Shopify","shopifySpbJsonp","ShopifyAnalytics","ShopifyPaypalV4VisibilityTracking"],cookie:["shopify"]},children:[{partner:"yampi",tests:{windowProperties:["yampiCheckoutUrl","yampiClick","ympData"]}}]},{partner:"wordpress",tests:{windowProperties:["wp"]}},{partner:"aliexpress",tests:{windowProperties:["AES","ali_analytics"],link:["aliexpress"]}},{partner:"yampi",tests:{windowProperties:["yampiCheckoutUrl","yampiClick","ympData"]}}],s={partner:"gtm",tests:{windowProperties:["google_tag_manager"]}},c=function(e){return function(t){return t.some(e)}},u=((r={}).windowProperties=c((function(e){var t;return null!==(t=o.windowSnapshot&&e in o.windowSnapshot)&&void 0!==t&&t})),r.cookie=c((function(e){return i.includes(e)})),r.link=c((function(e){var t;return null!==(t=null===o.windowSnapshot||void 0===o.windowSnapshot?void 0:o.windowSnapshot.location.href.includes(e))&&void 0!==t&&t})),r),l=function(e){for(var t="",n=0;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function u(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function l(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,s,"next",e)}function s(e){u(i,r,o,a,s,"throw",e)}a(void 0)}))}}function d(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){return(_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function w(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function E(e,t,n){return(E=S()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&_(o,n.prototype),o}).apply(null,arguments)}function O(e){var t="function"==typeof Map?new Map:void 0;return(O=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return E(e,arguments,b(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_(r,e)})(e)}n.r(t),n.d(t,"addListener",(function(){return et})),n.d(t,"invoke",(function(){return $e})),n.d(t,"isBridgeError",(function(){return Ue})),n.d(t,"removeListener",(function(){return tt})),n.d(t,"setGlobalConfig",(function(){return He})),n.d(t,"version",(function(){return Ke}));var k,P=a((function e(){var t=this;s(this,e),this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))})),I=(k=Object.prototype.hasOwnProperty,function(e,t){return k.call(e,t)}),A=function(e){return"object"===r(e)&&null!==e},x=function(e){return"function"==typeof e},T=function(e){return new Promise((function(t){return setTimeout(t,e)}))},C=function(e,t){if(!e||!t)return Number.NaN;for(var n=e.split(".").map((function(e){return+e})),r=t.split(".").map((function(e){return+e})),o=0;o1&&void 0!==arguments[1]?arguments[1]:function(){return arguments.length<=0?void 0:arguments[0]},n=new Map,r=new WeakMap;return function(){var o,i=t.apply(void 0,arguments),a=A(i)?r:n,s=null!==(o=a.get(i))&&void 0!==o?o:e.apply(void 0,arguments);return a.has(i)||a.set(i,s),s}}((function(e){var t,n;return null!==(t=null===(n=new RegExp("(?:".concat(e,")\\/([\\d+.]+)"),"u").exec("undefined"==typeof navigator?"":navigator.userAgent))||void 0===n?void 0:n[1])&&void 0!==t?t:""})),L=function(e){return C(N("Yoda"),e)},R=function(e){return C(N("Kwai|ksNebula"),e)},U=function(){if("undefined"==typeof navigator)return"unknown";var e=navigator,t=e.userAgent,n=e.maxTouchPoints;return/android/i.test(t)?"Android":/iPhone|iPad|iPod/.test(t)||t.includes("Mac")&&n>1?"iOS":"unknown"}(),D="Android"===U,M="iOS"===U,j=function(){var e;return"undefined"!=typeof window&&"function"==typeof(null===(e=window.__yodaBridge__)||void 0===e?void 0:e.invoke)},G=!!N("Kwai|ksNebula"),B=Number.MAX_SAFE_INTEGER||9007199254740991,V=!1,W=1,K=F();function F(){var e="".concat(B),t=Number(e.slice(0,3))-100,n=Math.floor(Math.random()*t),r="".concat(Date.now()),o=r.slice(r.length-9),i=new Array(e.length-12).fill(0).join("");return Number("".concat(n).concat(o).concat(i))}function H(e){var t=function(e){var t=K+W++;for(;V||e&&e[t];)t=K+W++;return t}(e);return t>=B?(V=!0,W=1,K=F(),H()):t}function J(e){return H(e)}function Y(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,r=null;return function(){for(var o=arguments.length,i=new Array(o),a=0;a=30?ae():se())})),n}};function ue(e){var t=null,n=new Promise((function(e){t=e}));return e&&(n=n.then(e,e)),{isMulti:!1,resolve:t,promise:n}}function le(e){return{isMulti:!0,resolve:e,promise:new Promise((function(){}))}}var de={},pe={pushMQ:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=n?ee():J(de),o=e?le(t):ue(t);return o.traceId=String(r),de[r]=o,o},removeMQ:function(e){de[e]=void 0},create:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=this.pushMQ(n,r);o.namespace=e,o.name=t;var i=ce({namespace:e,name:t,type:"invoke",callbackId:o.traceId});return de[o.traceId].startTime=i,{id:o.traceId,promise:o.promise}},resolve:function(e,t){if(!e.startsWith($)&&!te(e)){var n=de[e];n&&(ce({namespace:n.namespace,name:n.name,type:"callback",callbackId:n.traceId,resultCode:t.result},n.startTime),n.resolve(t),n.isMulti||this.removeMQ(e))}},reject:function(e,t){var n=de[e];n&&(n.resolve(t),n.isMulti||this.removeMQ(e),te(e)||ce({namespace:n.namespace,name:n.name,type:"callback",callbackId:n.traceId,resultCode:t.result,errorMsg:t.message},n.startTime))}},fe={kwai:"Kwai",kwaiAd:"KwaiAd",kwaiAdThird:"KwaiAdThird",kwaiMerchant:"KwaiMerchant",kwaiLive:"KwaiLive",Kwai:"Kwai",KwaiAd:"KwaiAd",KwaiAdThird:"KwaiAdThird",KwaiMerchant:"KwaiMerchant",KwaiLive:"KwaiLive"},he=["popBack","exitWebView"],ve=["setPhysicalBackButton","setTopLeftBtn","setTopLeftSecondBtn","setTopRightBtn","setTopRightSecondBtn"],ge=["on","off"];function ye(e,t,n){var r=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),(e?"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx":"xxxxxxxx_xxxx_4xxx_yxxx_xxxxxxxxxxxx").replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))}(!1),o="yoda_kuaishou_plugin_callback_".concat(n,"_").concat(r);return window[o]=function(n){if("string"==typeof n)try{n=JSON.parse(n)}catch(e){}x(e)?e.call(window,n):"string"==typeof e&&x(window[e])&&window[e].call(window,n),t||delete window[o]},o}function me(e,t){var n=e;return e&&Array.isArray(e.actions)&&(n.actions=e.actions.map((function(e){return e&&e.url&&x(e.url)&&(e.url=ye(e.url,!0,t)),e}))),n}var _e={};function be(e,t,n,r){var o=f({},n),i="".concat(e,"_").concat(t);if(ve.includes(t))o.onClick=ye(o.onClick,!0,i);else if(he.includes(t))o=null;else if(ge.includes(t)){var a=ye(r,!1,i);o.handler&&x(o.handler)&&(o.handler=function(e,t){var n="",r=null;if(Object.keys(_e).some((function(t){var o=_e[t];return o===e&&(r=o,n=t,!0)})),r!==e&&e){var o=ye(e,!0,t);_e[o]=e,n=o}return n}(o.handler,i)),o.callback=a}else if("showDialog"===t){var s=o,c=s.positiveButton,u=s.negativeButton,l=s.neutralButton;c&&(o.positiveButton=me(c,i)),u&&(o.negativeButton=me(u,i)),l&&(o.neutralButton=me(l,i))}else if(Object.keys(fe).includes(e)){var d=ye(r,!0,i);o.callback=o.callback||d}return o}var Se,we=function(){return new Error("当前环境存在 Yoda 多实例问题,详细请参考 https://docs.corp.kuaishou.com/k/home/VbQx2ulc6v3M/fcADLOKqHyHpSr7hiCKKQVtVM")},Ee="production",Oe=function(){return Ee},ke=["debug","info","log","warn","error"],Pe=function(e,t){var n;if("production"!==Oe()){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i=0&&t({"hybrid.getHybridStatus":"webview.pageContentStatus","hybrid.getAndUpdateHybridDetail":"webview.pageContentInfo","hybrid.preloadVideoList":"media.pvList","hybrid.isVideoFullyCached":"media.vReady"}))&&!(M&&R("10.7.20")<0&&t({"merchant.getSidToken":"kwai.getSidToken"}))&&!(D&&R("10.6.50")<0&&t({"ui.setStatusBarStyle":"kwai.setStatusBarStyle"}))&&(!(R("10.4.30")<0)&&G||!t(Ge))&&!(M&&R("10.4.10")<0&&n({"system.startVibrate":{strength:"low",duration:300}}))&&(!(R("10.3.20")<0)&&G||!t({"webview.exitCurrentWebView":"kwai.".concat(M?"exitCurrentWebview":"exitWebView")})))){if(!(R("9.6.20")<0&&["syncLocationWithPermissionCheck","getLocationWithPermissionCheck","requestLocationPermissionWithPermissionCheck"].includes(s)))break;e.bridge="".concat(a,".").concat(s.replace("WithPermissionCheck",""))}}return e},Ye=["result"],ze=function(e){var t=m(e,3),n=t[0],r=t[1],o=void 0===r?{}:r,i=t[2],a=m("function"==typeof i?[{},i]:[null!=i?i:{}],2);return{initialBridge:n,bridge:n,params:o,options:a[0],callback:a[1]}},qe=function(e){return e.bridge.startsWith("yoda.")},Qe=function(e){var t=e.bridge,n=e.params,r=m(t.split("."),2)[1];return(0,je[r])(n)},Xe=function(e){var t=q(),n=e.initialBridge,r=e.bridge,o=e.params,i=e.callback,a=m(r.split("."),2),s=a[0],c=a[1];return new Promise((function(a,u){t.bridge(s,c,o,(function(t){var o;if(Ie.info("Received a response from '".concat(r,"'"),t),We.has(n)&&(null==i||i(t)),1!==t.result){var s=t.message,c=void 0===s?function(e){return I(e,"error_msg")&&"string"==typeof e.error_msg?e.error_msg:""}(t):s,l=new Re(c,t.result,e);null===(o=Fe.errorHandler)||void 0===o||o.call(Fe,l),u(l)}else{t.result;var d=y(t,Ye);a(d)}}),Ve.has(n))}))},$e=function(){var e=l(c().mark((function e(){var t,n,r,o,i,a,s,u,l,d,p,f,h,v=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(e.prev=0,n=v.length,r=new Array(n),o=0;o0&&Number.isFinite(l))){e.next=19;break}return e.next=16,Promise.race([d,T(l).then((function(){return Promise.reject(new Re("Bridge invocation timed out after ".concat(l,"ms."),125010,a))}))]);case 16:e.t0=e.sent,e.next=22;break;case 19:return e.next=21,d;case 21:e.t0=e.sent;case 22:return f=e.t0,e.abrupt("return",f);case 26:throw e.prev=26,e.t1=e.catch(0),Ue(e.t1)&&(null===(h=Fe.errorHandler)||void 0===h||h.call(Fe,e.t1)),e.t1;case 30:case"end":return e.stop()}}),e,null,[[0,26]])})));return function(){return e.apply(this,arguments)}}(),Ze=new Set(["native_pageFinished","native_visible","native_background","native_foreground","native_will_leave","native_leave","native_reentry","native_loadPage","native_networkChanged","native_web_view_display_mode_changed","native_share_dialog_event","native_shake","native_darkModeChange"]),et=function(){var e=l(c().mark((function e(t,n,r){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ze.has(t)){e.next=4;break}return e.next=3,$e("kwai.on",{type:t,handler:n});case 3:return e.abrupt("return");case 4:return e.next=6,$e("event.addEventListener",{type:void 0===(null==r?void 0:r.data)?t:{type:t,options:r.data},listener:n});case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),tt=function(){var e=l(c().mark((function e(t,n){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ze.has(t)){e.next=4;break}return e.next=3,$e("kwai.off",{type:t,handler:n});case 3:return e.abrupt("return");case 4:return e.next=6,$e("event.removeEventListener",{type:t,listener:n});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),nt={};function rt(e){var t,n=nt[e];return t=n.callbackId,Z+String(t)}function ot(e){var t=nt[e];return Object.keys((null==t?void 0:t.eventRecord)||{}).length>0}!function(e){e.x="x",e.y="y",e.z="z"}(Te||(Te={}));var it="shaked",at={level:2,times:3,intervalTime:1300,iOSIntervalTime:500,androidIntervalTime:1300,isEmitImmediately:!0},st={1:{basic:13,total:450},2:{basic:16,total:700},3:{basic:20,total:1100}},ct={1:{basic:9,total:220},2:{basic:12,total:400},3:{basic:14,total:500}},ut=function(){function e(t){var n=this;s(this,e),this.shakeConfig={},this.shakedArr=[],this.isChecking=!1,this.nowStatus={x:0,y:0,z:0},this.lastStatus={x:0,y:0,z:0},this.stopMark=null,this.checkIsShakeStoped=!1,this.notEmitButShaked=!0,this.isShakeStarted=!1,this.isAndroid=!1,this.isArrivedConfigStandard=!1,this.levelMap=st,this.dispatchEvent=null,this.setStillShaking=Y((function(){return n.notShaking()}),1e3),this.dispatchEvent=t.dispatchEvent,this.isAndroid=t.isAndroid,this.levelMap=this.isAndroid?st:ct}var t;return a(e,[{key:"setOptions",value:function(e){e?(this.shakeConfig=f(f({},at),e),this.shakeConfig.times=this.isAndroid?this.shakeConfig.times-1:2*(this.shakeConfig.times-1),this.shakeConfig.intervalTime=this.isAndroid?this.shakeConfig.androidIntervalTime:this.shakeConfig.iOSIntervalTime):this.shakeConfig=f({},at)}},{key:"resetShakeStatus",value:function(e){this.shakedArr=[],this.isChecking=!1,this.notEmitButShaked=!1,e&&(this.isArrivedConfigStandard=!1,this.isShakeStarted=!1)}},{key:"checkIsShake",value:function(e){var t=this;if(this.isChecking=!0,Object.keys(this.nowStatus).forEach((function(n){return t.nowStatus[n]=9.8*e[n]})),this.judgeArrivedTerminal())return this.lastStatus={x:0,y:0,z:0},this.handleShakeHappend(),this.setStillShaking(),void(this.isChecking=!1);this.judgeLikelyShake()?this.handleArrivedStandard():this.isChecking=!1}},{key:"judgeLikelyShake",value:function(){var e=this.nowStatus,t=e.x,n=e.y,r=e.z,o=this.levelMap[this.shakeConfig.level],i=o.basic,a=o.total;return t>i||n>i||r>i||t*t+n*n+r*r>a}},{key:"judgeArrivedTerminal",value:function(){var e=this,t=0,n=0,r=Te.x;return Object.keys(this.nowStatus).forEach((function(o){n=Math.abs(e.lastStatus[o]-e.nowStatus[o]),t0?e-this.shakedArr[this.shakedArr.length-1]<=t?this.shakedArr.push(e):(this.shakedArr=[],this.isChecking=!1):this.shakedArr.push(e),this.shakedArr.length>=this.shakeConfig.times?this.handleArrivedEmitStandard():this.isChecking=!1}},{key:"handleArrivedEmitStandard",value:function(){this.isArrivedConfigStandard=!0,this.resetShakeStatus(),this.shakeConfig.isEmitImmediately?this.dispatchEvent({type:it,data:{}}):this.notEmitButShaked=!0}},{key:"checkDoDelayEmit",value:function(){this.notEmitButShaked&&this.checkIsShakeStoped&&!this.shakeConfig.isEmitImmediately&&this.dispatchEvent({type:it,data:{}}),this.isShakeStarted&&this.dispatchEvent({type:"shake-end",data:{isArrivedConfigStandard:this.isArrivedConfigStandard}}),this.resetShakeStatus(!0)}}]),e}(),lt=null,dt=null,pt=function(){var e=l(c().mark((function e(){var t,n,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=q(),e.next=3,t.bridge("system","startAccelerometer",{interval:60});case 3:return n=e.sent,dt=lt.checkIsShake.bind(lt),e.next=7,t.bridge("event","addEventListener",{type:"accelerometer-change",listener:dt});case 7:if(r=e.sent,1===n.result&&1!==r.result&&vt(),1===n.result&&1===r.result){e.next=11;break}throw new Error("摇一摇初始化失败,请稍后重试。AccelerometerRes:".concat(JSON.stringify(n),";eventRes:").concat(JSON.stringify(r)));case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ft=function(e){if(e){var t=e.level,n=e.times,r=e.isEmitImmediately;if(void 0!==t&&!st[t])throw new Error("请传入正确的level,可选值为1、2、3");if(void 0!==n){if(!Number.isInteger(n))throw new Error("times应为整数");if(n<1)throw new Error("times应大于1")}if(void 0!==r&&"boolean"!=typeof r)throw new Error("isEmitImmediately应为boolean类型")}},ht=function(){var e=l(c().mark((function e(t){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=q(),e.next=3,Q("system","startAccelerometer");case 3:if(e.sent){e.next=5;break}throw new Error("当前APP暂不支持摇一摇");case 5:if(!lt){e.next=7;break}throw new Error("当前存在尚未结束监听的摇一摇");case 7:return lt=new ut({dispatchEvent:function(){var e=l(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.bridge("event","dispatchEvent",t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),isAndroid:D}),ft(t),lt.setOptions(t),lt.resetShakeStatus(),e.next=14,pt.bind(n)();case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vt=function(){var e=l(c().mark((function e(){var t,n,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=q(),e.next=3,Q("system","stopAccelerometer");case 3:if(e.sent){e.next=5;break}throw new Error("当前APP暂不支持摇一摇");case 5:return lt=null,e.next=8,t.bridge("event","removeEventListener",{type:"accelerometer-change",listener:dt});case 8:return n=e.sent,e.next=11,t.bridge("system","stopAccelerometer",{});case 11:if(r=e.sent,1===n.result&&1===r.result){e.next=14;break}throw new Error("摇一摇停止监听失败。stopRes:".concat(JSON.stringify(r),";eventRes:").concat(JSON.stringify(n)));case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),gt=it,yt=d({},gt,ht),mt=d({},gt,vt),_t=function(e,t){var n,r=e.type,o=e.listener,i="string"==typeof r?r:r.type,a="string"==typeof r?{}:r.options;if(null===(n=yt[i])||void 0===n||n.call(yt,a),!o.__yodaCallbackId__&&(o.__yodaCallbackId__={}),o.__yodaCallbackId__[i])throw new Error("addEventListener ".concat(i," 的 listener 已经被绑定过了"));var s=ot(i),c=null,u=Promise.resolve();if(s)x(t)&&t({result:1});else{var l=pe.pushMQ(!0,function(e){return function(t){var n=nt[e];Object.keys((null==n?void 0:n.eventRecord)||{}).forEach((function(e){return n.eventRecord[Number(e)](JSON.parse(JSON.stringify(t)))}))}}(i),!0);c=parseInt(l.traceId.replace(Z,"")),u=Ae({namespace:"event",name:"addEventListener",params:{type:i,listener:String(l.traceId)},callback:t})}return function(e,t,n){var r=nt[e]||{callbackId:n,eventRecord:{}},o=J();t.__yodaCallbackId__[e]=String(o),r.eventRecord[o]=t,nt[e]=r}(i,o,c),u},bt=function(e,t){var n,r=e.type,o=e.listener;null===(n=mt[r])||void 0===n||n.call(mt);var i=Promise.resolve();if(o.__yodaCallbackId__){var a=rt(r);!function(e,t){var n=nt[e],r=t.__yodaCallbackId__[e];delete n.eventRecord[Number(r)],delete t.__yodaCallbackId__[e],ot(e)||delete nt[e]}(r,o),ot(r)||(i=Ae({namespace:"event",name:"removeEventListener",params:{type:r,listener:a},callback:t}),pe.removeMQ(a))}return i};z={bridge:function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i={namespace:e,name:t,params:n,multiCallback:o,callback:r};if("event"===e){if("addEventListener"===t)return _t(n,r);if("removeEventListener"===t)return bt(n,r)}return 0===R("9.9.20")&&D?Ne(i):Ae(i)}},Le={invoke:$e,addListener:et,removeListener:tt}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.KwaiManager=void 0;var i=n(1),a=n(22),s=n(33),c=n(9),u=n(49),l=n(0),d=function(e){function t(t){var n=e.call(this,new a.KwaiContext(t))||this;return n.init=function(){n.initDynamicPlugin(),n.context.init(),n.setPageInfo(null===i.windowSnapshot||void 0===i.windowSnapshot?void 0:i.windowSnapshot.location.href,null===i.windowSnapshot||void 0===i.windowSnapshot?void 0:i.windowSnapshot.document.referrer),n.handleCache()},n.handleCache=function(){var e=(0,c.getWorkspace)(),t=e._i;if(Object.entries(t).forEach((function(e){var t=e[0],r=e[1],o=!1;if(!0!==r._init&&(n.loadPixel(t),r._init=!0,o=r.length>0),o)for(;r.length;){var i=r.shift();if(i){var a=i[0],s=i.slice(1),c=n.instance(t);if(!n.isEmptyInstance(c))switch(a){case"page":n.page(s[0]);break;case"track":c.track(s[0],s[1])}}}})),e.length>0)for(;e.length;){var r=e.shift();if(r){var o=r[0],i=r.slice(1);switch(o){case"page":n.page(i[0]);break;case"track":n.track(i[0],i[1])}}}},n.createPixel=function(e){return new s.KwaiPixel(e,n.context)},n.initDynamicPlugin=function(){var e=(0,c.getWorkspace)().dynamicPlugins;(void 0===e?[]:e).forEach((function(e){try{n.useDynamicPlugin(e)}catch(e){(0,l.JSLogger)({error:e})}}))},n}return o(t,e),t}(u.Manager);t.KwaiManager=d},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&(l.extraData=JSON.stringify(f),u.PreviewReportService.report(l,n))}},n.resetTestId(),n}return o(t,e),t.prototype.resetTestId=function(){return i(this,void 0,void 0,(function(){var e,t;return a(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),e=this,[4,(0,c.getTrackFlag)()];case 1:return e.trackFlag=n.sent(),[3,3];case 2:return t=n.sent(),(0,p.JSLogger)({error:t}),[3,3];case 3:return[2]}}))}))},t.prototype.onContextInitStart=function(){this.pluginsArray.forEach((function(e){return e.contextInitStart()}))},t}(l.Context);t.KwaiContext=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDomain=void 0;var r=n(1),o=n(24);t.getDomain=function(e){e||(e=(null===r.windowSnapshot||void 0===r.windowSnapshot?void 0:r.windowSnapshot.location.hostname)||"");var t=e.split("."),n=t.length,i=t[n-1],a=Number.parseInt(i);if(2==n)return"."+e;if(!isNaN(a))return e;for(var s=[];t.length;){var c=t.pop();if(!c)break;if(s.unshift(c),-1===o.DOMAINS.indexOf(c))break}return"."+s.join(".")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DOMAINS=void 0,t.DOMAINS=["ac","ad","ae","af","ag","ai","al","am","ao","aq","ar","as","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bm","bn","bo","br","bs","bt","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gd","ge","gf","gg","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","io","iq","ir","is","it","je","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","ye","yt","za","zm","zw","bar","bible","biz","church","club","college","com","design","dev","download","eco","eus","google","green","hiv","icu","info","kaufen","kiwi","lat","lgbt","moe","name","net","ninja","ngo","one","ong","ooo","org","top","pro","wiki","wtf","xyz","app","aero","asia","cat","coop","edu","gov","int","jobs","mil","mobi","museum","post","tel","travel","xxx","africa","alsace","amsterdam","bcn","berlin","brussels","bzh","cymru","eu","eus","frl","gal","gent","irish","ist ","istanbul","kiwi","krd","lat","london","melbourne","miami","nyc","paris","quebec","rio","saarland","scot","sydney","taipei","tokyo","vegas","vlaanderen","wales","wien","arpa","nato","example","invalid","localhost","test","onion","bit","bitnet","csnet","exit","local","onion","root","uucp","chn","africa","bcn","wales","bzh","cym","cymru","eng","lli","sic","wales","geo","mail","web","free","kid","kids","music","bl ","bq ","eh ","mf","bv ","gb ","sj","an ","bu ","cs ","dd ","tp ","um ","yu ","zr","bet","fun"]},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&-1!==(n=e.indexOf(t+"="))?(r=n+t.length+1,s=e.indexOf(";",r),c="",c=-1===s?e.substring(r):e.substring(r,s),[2,decodeURIComponent(c)]):[3,3];case 2:return u=o.sent(),(0,i.JSLogger)({error:u}),[3,3];case 3:return[2,""]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRandom=void 0;t.getRandom=function(e){return"".concat(e,"-").concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toHump=void 0;t.toHump=function(e){return e.replace(/_(\w)/g,(function(e,t){return t.toUpperCase()}))}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0))for(var o=0;o-1&&this.track(a.EVENT_NAME_FORMAT[r],e,!0,c.AccessMode.Standard);else i.windowSnapshot&&this.bindEvents(e.traceContent[0].destination,null!==(n=null===(t=e.traceContent[0])||void 0===t?void 0:t.traceUrl)&&void 0!==n?n:"",r,e)},e.prototype.bindEvents=function(e,t,n,d){return r(this,void 0,void 0,(function(){var t,r,p=this;return o(this,(function(o){try{t=this.pixelId,i.windowSnapshot&&(r=(0,u.getWorkspace)(),e.forEach((function(e){var o,s,u=null===i.windowSnapshot||void 0===i.windowSnapshot?void 0:i.windowSnapshot.document.querySelector(e),f="".concat(t,"-").concat(e,"-").concat(n),h=function(){p.track(a.EVENT_NAME_FORMAT[n],d,!0,c.AccessMode.Standard)};if(u)l[f]&&u.removeEventListener("click",l[f],!0),(null===(o=r.delegatesListenerCache)||void 0===o?void 0:o[f])&&delete r.delegatesListenerCache[f],u.addEventListener("click",h,!0),l[f]=h;else{var v=null!==(s=r.delegatesListenerCache)&&void 0!==s?s:{};r.delegatesListenerCache||(r.delegatesListenerCache=v,null===i.windowSnapshot||void 0===i.windowSnapshot||i.windowSnapshot.addEventListener("click",(function(e){Object.keys(v).forEach((function(t){var n=v[t],r=n.selector,o=n.listener;e.target&&e.target.closest(r)&&"function"==typeof o&&o()}))}))),v[f]={selector:e,listener:h}}})))}catch(e){(0,s.JSLogger)({error:e})}return[2]}))}))},e}();t.Pixel=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TraceMethod=t.AccessMode=t.InstallType=void 0,function(e){e[e.Unknown=0]="Unknown",e[e.Manual=1]="Manual",e[e.Third=2]="Third"}(t.InstallType||(t.InstallType={})),function(e){e[e.EventApi=0]="EventApi",e[e.Develop=1]="Develop",e[e.Standard=2]="Standard"}(t.AccessMode||(t.AccessMode={})),function(e){e[e.Unknown=0]="Unknown",e[e.Url=1]="Url",e[e.Click=2]="Click"}(t.TraceMethod||(t.TraceMethod={}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]1&&void 0!==arguments[1]?arguments[1]:{},n=t.selectorTypes,r=void 0===n?["ID","Class","Tag","NthChild"]:n,o=t.attributesToIgnore,i=void 0===o?["id","class","length"]:o,a=t.excludeRegex,s=void 0===a?null:a,c=[],d=(0,l.getParents)(e),p=!0,f=!1,v=void 0;try{for(var g,y=d[Symbol.iterator]();!(p=(g=y.next()).done);p=!0){var m=g.value,_=h(m,r,i,s);Boolean(_)&&c.push(_)}}catch(e){f=!0,v=e}finally{try{!p&&y.return&&y.return()}finally{if(f)throw v}}var b=[],S=!0,w=!1,E=void 0;try{for(var O,k=c[Symbol.iterator]();!(S=(O=k.next()).done);S=!0){var P=O.value;b.unshift(P);var I=b.join(" > ");if((0,u.isUnique)(e,I))return I}}catch(e){w=!0,E=e}finally{try{!S&&k.return&&k.return()}finally{if(w)throw E}}return null};var r=n(38),o=n(39),i=n(40),a=n(41),s=n(42),c=n(43),u=n(44),l=n(45);function d(e,t){var n=e.parentNode.querySelectorAll(t);return 1===n.length&&n[0]===e}function p(e,t){return t.find(d.bind(null,e))}function f(e,t,n){var r=(0,i.getCombinations)(t,3),o=p(e,r);return Boolean(o)||Boolean(n)&&(o=p(e,r=r.map((function(e){return n+e}))),Boolean(o))?o:null}function h(e,t,n,i){var u=void 0,l=function(e,t,n){var i={Tag:c.getTag,NthChild:s.getNthChild,Attributes:function(e){return(0,a.getAttributes)(e,n)},Class:o.getClassSelectors,ID:r.getID};return t.reduce((function(t,n){return t[n]=i[n](e),t}),{})}(e,t,n);i&&i instanceof RegExp&&(l.ID=i.test(l.ID)?null:l.ID,l.Class=l.Class.filter((function(e){return!i.test(e)})));var p=!0,h=!1,v=void 0;try{for(var g,y=t[Symbol.iterator]();!(p=(g=y.next()).done);p=!0){var m=g.value,_=l.ID,b=l.Tag,S=l.Class,w=l.Attributes,E=l.NthChild;switch(m){case"ID":if(Boolean(_)&&d(e,_))return _;break;case"Tag":if(Boolean(b)&&d(e,b))return b;break;case"Class":if(Boolean(S)&&S.length&&(u=f(e,S,b)))return u;break;case"Attributes":if(Boolean(w)&&w.length&&(u=f(e,w,b)))return u;break;case"NthChild":if(Boolean(E))return E}}}catch(e){h=!0,v=e}finally{try{!p&&y.return&&y.return()}finally{if(h)throw v}}return"*"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getID=function(e){var t=e.getAttribute("id");if(null!==t&&""!==t)return t.match(/(?:^\d|:)/)?'[id="'+t+'"]':"#"+t;return null}},function(e,t,n){"use strict";function r(e){if(!e.hasAttribute("class"))return[];try{return Array.prototype.slice.call(e.classList).filter((function(e){return/^[a-z_-][a-z\d_-]*$/i.test(e)?e:null}))}catch(n){var t=e.getAttribute("class");return(t=t.trim().replace(/\s+/g," ")).split(" ")}}Object.defineProperty(t,"__esModule",{value:!0}),t.getClasses=r,t.getClassSelectors=function(e){return r(e).filter(Boolean).map((function(e){return"."+e}))}},function(e,t,n){"use strict";function r(e,t,n,o,i,a,s){if(a!==s)for(var c=o;c<=i&&i-c+1>=s-a;++c)n[a]=t[c],r(e,t,n,c+1,i,a+1,s);else e.push(n.slice(0,a).join(""))}Object.defineProperty(t,"__esModule",{value:!0}),t.getCombinations=function(e,t){for(var n=[],o=e.length,i=[],a=1;a<=t;++a)r(n,e,i,0,o-1,0,a);return n}},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:["id","class","length"],n=e.attributes,o=[].concat(r(n));return o.reduce((function(e,n){return t.indexOf(n.nodeName)>-1||e.push("["+n.nodeName+'="'+n.value+'"]'),e}),[])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNthChild=function(e){var t=0,n=void 0,o=void 0,i=e.parentNode;if(Boolean(i)){var a=i.childNodes,s=a.length;for(n=0;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1&&this.setAdInfo(e,t)),[2,e];case 5:return h=a.sent(),(0,v.JSLogger)({error:h}),[3,6];case 6:return[2]}}))}))},y.getAdInfoFromSource=function(){return i(y,void 0,void 0,(function(){var e,t,n,r,o,i,s,c,u,p,g,y,m,_,b,S,w,E;return a(this,(function(a){switch(a.label){case 0:e=[],t=!1,n=l.KWAI_CALLBACK_SOURCE_ENUM.UNKNOWN,r=[d.KWAI_CALLBACK,d.KWAI_PIXEL_ID],a.label=1;case 1:return a.trys.push([1,6,,7]),this.getUrl(),o=(0,h.getParamsFromUrl)(r,null===(b=this.url)||void 0===b?void 0:b.href),i=o.urlVals,o.isFindAllInUrl?(e=i,t=!0,n=l.KWAI_CALLBACK_SOURCE_ENUM.URL,this.logAdInfoAction(f.LOGGER_TYPES_NAME.GET_AD_INFO_FROM_URL,f.ActionStatus.SUCCESS),[3,5]):[3,2];case 2:return this.logAdInfoAction(f.LOGGER_TYPES_NAME.GET_AD_INFO_FROM_URL,f.ActionStatus.ERROR),this.needBridge?[4,(0,h.getParamsFromBridge)(r,null===(S=this.context.plugins.logger)||void 0===S?void 0:S.logger)]:[3,5];case 3:return s=a.sent(),c=s.adInfoFromBridge,u=s.isReadBridgeSuccess,[4,this.getAdInfoFromCache({enabledLog:!1})];case 4:p=a.sent(),g=p.adInfoFromCache,y=p.isReadCacheSuccess,m=(null==c?void 0:c[0])&&(null==c?void 0:c[0])===(null==g?void 0:g.callback)&&(null==c?void 0:c[1])&&(null==c?void 0:c[1])===(null==g?void 0:g.pixelId),(!y||!m)&&(u?(e=c,t=!0,n=l.KWAI_CALLBACK_SOURCE_ENUM.BRIDGE,this.logAdInfoAction(f.LOGGER_TYPES_NAME.GET_AD_INFO_FROM_BRIDGE,f.ActionStatus.SUCCESS)):this.logAdInfoAction(f.LOGGER_TYPES_NAME.GET_AD_INFO_FROM_BRIDGE,{actionStatus:f.ActionStatus.ERROR,bridgeValue:{valArray:c,keyArray:r}})),a.label=5;case 5:return[3,7];case 6:return _=a.sent(),(0,v.JSLogger)({error:_}),[3,7];case 7:return[2,{adInfoFromSource:{callback:null!==(w=e[0])&&void 0!==w?w:"",pixelId:null!==(E=e[1])&&void 0!==E?E:""},isReadSourceSuccess:t,callbackSource:n}]}}))}))},y.getAdInfoFromCache=function(e){return i(y,void 0,void 0,(function(){var t,n,r,o,i,s,c,u,l;return a(this,(function(a){switch(a.label){case 0:t=(null!=e?e:{}).enabledLog,r=!1,o=void 0===t||t?this.logAdInfoAction:void 0,a.label=1;case 1:return a.trys.push([1,6,,7]),[4,(0,h.getParamsFromCookie)()];case 2:return i=a.sent(),s=i.adInfoFromCookie,i.isReadCookieSuccess?(n=s,r=!0,null==o||o(f.LOGGER_TYPES_NAME.GET_AD_INFO_FROM_COOKIE,f.ActionStatus.SUCCESS),[3,5]):[3,3];case 3:return null==o||o(f.LOGGER_TYPES_NAME.GET_AD_INFO_FROM_COOKIE,f.ActionStatus.ERROR),[4,(0,h.getParamsFromSession)()];case 4:c=a.sent(),u=c.adInfoFromSession,c.isReadSessionSuccess?(n=u,r=!0,null==o||o(f.LOGGER_TYPES_NAME.GET_AD_INFO_FROM_SESSION,f.ActionStatus.SUCCESS)):null==o||o(f.LOGGER_TYPES_NAME.GET_AD_INFO_FROM_SESSION,f.ActionStatus.ERROR),a.label=5;case 5:return[3,7];case 6:return l=a.sent(),(0,v.JSLogger)({error:l}),[3,7];case 7:return[2,{adInfoFromCache:n,isReadCacheSuccess:r}]}}))}))},y.setAdInfo=function(e,t){return i(y,void 0,void 0,(function(){var n,r,o,i,c,l,d,p;return a(this,(function(a){switch(a.label){case 0:if(a.trys.push([0,7,,8]),n=JSON.stringify({bridgeData:e,currentHref:null===s.windowSnapshot||void 0===s.windowSnapshot?void 0:s.windowSnapshot.location.href,kwaiAdInfoSource:t}),!(e&&e.callback&&e.pixelId&&18==e.pixelId.length&&0!=e.callback.length))return[3,5];if((null===s.windowSnapshot||void 0===s.windowSnapshot?void 0:s.windowSnapshot.location.href)&&!(0,u.getIsPreload)(null===s.windowSnapshot||void 0===s.windowSnapshot?void 0:s.windowSnapshot.location.href))return[2];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.setAdInfoA({pixelId:e.pixelId,clickId:e.callback})];case 2:return r=a.sent(),null===(c=this.context.plugins.logger)||void 0===c||c.logger({name:f.LOGGER_TYPES_NAME.successSetBridge,return:r,extra_info:n}),[3,4];case 3:return o=a.sent(),(0,v.JSLogger)({error:o}),null===(l=this.context.plugins.logger)||void 0===l||l.logger({name:f.LOGGER_TYPES_NAME.errSetBridge,return:null!==(d=null==o?void 0:o.message)&&void 0!==d?d:o,extra_info:n}),[3,4];case 4:return[3,6];case 5:null===(p=this.context.plugins.logger)||void 0===p||p.logger({name:f.LOGGER_TYPES_NAME.errBefroeSetBridge,extra_info:n}),a.label=6;case 6:return[3,8];case 7:return i=a.sent(),(0,v.JSLogger)({error:i}),[3,8];case 8:return[2]}}))}))},y.setAdInfoA=function(e){return i(y,void 0,void 0,(function(){var t;return a(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,(0,p.ks_pixel_setPixelBaseInfo)(e)];case 1:return[2,n.sent()];case 2:return t=n.sent(),(0,v.JSLogger)({error:t}),[3,3];case 3:return[2]}}))}))},y.logAdInfoAction=function(e,t){var n,r="object"==typeof t?t:{actionStatus:t};null===(n=y.context.plugins.logger)||void 0===n||n.logAdInfoAction({name:e,extra_info_obj:r})},y.updateCache=function(e){return i(y,void 0,void 0,(function(){return a(this,(function(t){try{(0,u.writeVal)({key:d.KWAI_CALLBACK_SESSION_KEY,val:e})}catch(e){(0,v.JSLogger)({error:e})}return[2]}))}))},y.url=o,y.needBridge=g,y}return o(t,e),t.prototype.getUrl=function(){var e=s.windowSnapshot?new URL(s.windowSnapshot.location.href):void 0;this.url=e},t}(c.Plugin);t.CachePlugin=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KWAI_CALLBACK_SOURCE_ENUM=void 0,function(e){e.CONTEXT="context",e.BRIDGE="bridge",e.URL="url",e.UNKNOWN="unknown"}(t.KWAI_CALLBACK_SOURCE_ENUM||(t.KWAI_CALLBACK_SOURCE_ENUM={}))},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(55),t),o(n(56),t),o(n(57),t),o(n(58),t)},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]o[0]&&c[1]=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),i=o.next();!i.done;i=o.next()){var s=a(i.value.split("="),2),c=s[0],u=s[1];c in r?r[c]instanceof Array?r[c].push(u):r[c]=[r[c],u]:r[c]=u}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r}function X(e){throw new Error("radar error "+e)}var $=function(){return($=Object.assign||function(e){for(var t,n=1,r=arguments.length;nn.queueConfig.maxBatchLength-1)return n.flush(),clearTimeout(n.batchTimer),void(n.batchTimer=0);n.batchTimer||(n.batchTimer=window.setTimeout((function(){n.flush(),clearTimeout(n.batchTimer),n.batchTimer=0}),n.queueConfig.wait))}},this.flush=function(){var e;n.logQueue.length<=0||(e=null,(e=n.config.httpReportFirst?e:n.reportByBridge())&&!n.config.httpReportFirst||n.reportByHttp(),n.logQueue=[])},"object"==typeof e&&null!==e||X("108"),"string"!=typeof e.projectId&&X("109"),J("radarSessionId"));this.radarSessionId=null!=r?r:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),this.config=e,this.sampling="number"==typeof(t=null!=(r=this.config.sampling)?r:1)&&0<=t&&t<=1?t:(h("110"),1),this.bindWeblogger(e.weblogger),null!=(r=this.config)&&r.ignoreList&&Array.isArray(null==(e=this.config)?void 0:e.ignoreList)&&(this.ignoreList=this.ignoreList.concat(this.config.ignoreList.map((function(e){return e.replace(/^(https?:)?\/\//,"")})))),this.queueConfig=$($({},this.queueConfig),null!=(r=this.config)&&r.queueConfig?this.config.queueConfig:{}),null!=(e=this.config)&&e.customDimensions&&this.setDimensions(null==(r=this.config)?void 0:r.customDimensions),R(window,this.eventName,this.flush),"undefined"!=typeof window&&window.yodaCollectErrorDataDestroy&&window.yodaCollectErrorDataDestroy()}return e.prototype.genSessionIncreaseId=function(e){return this.runtimeIdMap[e]||(this.runtimeIdMap[e]=0),this.runtimeIdMap[e]++},e.prototype.bindWeblogger=function(e){var t,n=this;if(null!=e&&"object"!=typeof e)X("106");else{if(this.weblog)return void f("122");this.weblog=e,this.updateUrlPackage(),void 0!==(null==(t=null==e?void 0:e.logger)?void 0:t.radarUrl)&&this.ignoreList.push(null==(t=null==e?void 0:e.logger)?void 0:t.radarUrl),void 0!==(null==(t=null==e?void 0:e.logger)?void 0:t.url)&&this.ignoreList.push(null==(t=null==e?void 0:e.logger)?void 0:t.url),this.isInYoda=!(null==(t=null==(e=this.weblog)?void 0:e.Utils)||!t.yoda),this.getSampleData()}0=n.randomSampling){var t=n.getCommonData(),r=(e.dimension.app_version_name=t.app_version_name,e.h5_extra_attr=JSON.stringify($($({},null==(t=n.weblog.commonPackage)?void 0:t.getH5ExtraAttr()),JSON.parse(e.h5_extra_attr))),function(e){if(-1===(n=(e=void 0===e?location.href:e).lastIndexOf("?")))return{page:e};var t=e.slice(0,n),n=e.slice(n+1);return{url:e,page:t,params:Q(n)}}(e.base_href)),o=null==(t=n.weblog.logConfig)?void 0:t.urlMap;t={};if("function"==typeof o)try{var i=o(r);"string"==typeof i?t={page:i}:"object"==typeof i&&(t={page:i.page,params:i.params})}catch(e){}else if("object"==typeof o){var a,s="";for(a in o)if(-1<(r.page||r.url||"").indexOf(a)){s=o[a];break}s&&(t={page:s})}e.url_package={page:t&&t.page||r.page},i=n.referUrlPackage&&n.referUrlPackage.toJSON(),e.refer_url_package=i,delete e.base_href,n.logQueue.push(e)}})),this.preStoredLogQueue=[],this.flush())},e.prototype.getSampleData=function(){var e,t,n=this;this.isInYoda?(this.sampleData={isHit:!0,core:this.sampling,api:1,resource:.1,error:1,event:1},t=window.updateYodaSampleRateWithParams,window.updateYodaSampleRateWithParams=function(e){p("104",e),n.updateYodaSampleRate(e),n.broadcastSample.emit(n.sampleData),t&&t(e)},window.__yodaCommonDataObject__&&window.__yodaCommonDataObject__.sampleData?(this.updateYodaSampleRate(window.__yodaCommonDataObject__.sampleData),this.collect(c.EVENT,{name:"客户端采样率注入成功",event_type:"radar_sample_inject_success"},{})):"function"==typeof(null==(e=null==(e=null==(e=this.weblog)?void 0:e.Utils)?void 0:e.yoda)?void 0:e.getWebviewLoadPerf)&&null!=(e=this.weblog)&&e.Utils.yoda.getWebviewLoadPerf().then((function(e){null!=e&&e.sampleData&&n.updateYodaSampleRate(e.sampleData)}))):this.sampleData={isHit:this.samplingControl(this.sampling),core:this.sampling}},e.prototype.updateYodaSampleRate=function(e){var t=this,n=null;try{var r=e;n="string"==typeof r?JSON.parse(r):r}catch(e){return void p("error: ",e)}n&&Object.keys(n).forEach((function(e){"load"===e?t.sampleData.core=n[e]:"did_rate"===e?t.didRate=n[e]:t.sampleData[e]=n[e]}))},e.prototype.updateUrlPackage=function(){var e;null!=(e=this.weblog)&&e.currentUrlPackage&&(this.currentUrlPackage=this.weblog.currentUrlPackage,this.referUrlPackage=this.weblog.referUrlPackage)},e.prototype.setDimensions=function(e){var t=this,n=Object.keys(e);n.some((function(e){return-1===te.indexOf(e)}))&&h("113","".concat(n.join("、"))),n.forEach((function(n){null==e[n]?delete t.customDimension[n]:t.customDimension[n]=e[n]}))},e.prototype.setCommonDimension=function(e,t,n){this.commonDimension[e]=(n=void 0===n||n)||null==(n=this.commonDimension[e])?t:n},e.prototype.decorateLog=function(e){this.currentUrlPackage||this.updateUrlPackage(),0")):null===t&&null!=n&&n.message&&"Uncaught null"!==n.message?(r="Error","".concat(e," - message: ").concat(n.message)):(r=null==t?"".concat(t):typeof t,n=function(e){var t;try{t=e.toString(),e&&"object"==typeof e&&(t=JSON.stringify(e))}catch(e){}return"string"!=typeof t||""===t?t=null===e?"":void 0===e?"":""===t?"":"":2e3>>0;if(0===o)return-1;var i=+t||0;if(Math.abs(i)===1/0&&(i=0),i>=o)return-1;for(n=Math.max(i>=0?i:o-Math.abs(i),0);n>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)for(var i=t?decodeURIComponent:function(e){return e},a=e.split(/;\s/g),s=null,c=null,u=null,l=0,d=a.length;l>=1,n+=n;return r+e}var I=function(e){void 0===e&&(e=v.navigator.userAgent.toLowerCase());try{for(var t=0;t-1)return!0}catch(e){return!1}};function A(e){for(var t={},n=0,r=e.split("&");no)&&(ui)&&l1;return r||o}())},D=function(e){try{return Math.abs(Math.floor(e))}catch(t){return e}};function M(e){return"string"==typeof e?e:"object"==typeof e?JSON.stringify(e):""}var j=function(){function e(){this.events={}}return e.prototype.on=function(e,t){var n;t&&"function"==typeof t&&(this.events[e]=this.events[e]||[],null===(n=this.events[e])||void 0===n||n.push(t))},e.prototype.off=function(e,t){if(this.events[e]){if(t&&"function"==typeof t){var n=this.events[e];n&&(o=t,(i=(r=n).indexOf(o))>-1&&r.splice(i,1))}var r,o,i;t||(this.events[e]=[])}},e.prototype.emit=function(e){for(var t,n=[],r=1;r>>0,t=[],n=0;n<7;n++)t.push("0123456789ABCDEF".charAt(16*Math.random()));return e+t.join("")}());var t=new Date;t.setFullYear(t.getFullYear()+1),b("_did",e,{expires:t,domain:W(),path:"/"})}return e}catch(e){return""}}var F="WEBLOGGER_SESSIONID",H=function(e){function t(t,n,r){var o=e.call(this,{},n)||this;if("string"==typeof t){var i=T(t);o.page=i.page,o.params=i.params}else o.page=(t||{}).page||"",o.params=(t||{}).params||void 0;return o.identity=o.generatePageId(),r&&"string"==typeof t&&o.init(t,r),o}return a(t,e),t.prototype.init=function(e,t){void 0===t&&(t={});var n=function(e,t){var n=e.url,r=e.page,o=e.params,i=e.pageId;if(!r&&"string"==typeof n){var a=T(n);r=a.page,o=a.params}if("function"==typeof t)try{var s=t({url:n,page:r,params:o});"string"==typeof s?r=s:"object"==typeof s&&(s.page&&(r=s.page),s.params&&(o=s.params),s.pageId&&(i=s.pageId))}catch(e){}else if("object"==typeof t){var c="";for(var u in t)if((n||r||"").indexOf(u)>-1){c=t[u];break}c&&(r=c)}return{page:r,params:o,pageId:i}}({url:e,page:this.page,params:this.params},t),r=n.page,o=n.params;this.update(r,o)},t.prototype.attachUrl=function(){var e;if(this.params||(this.params={}),null===location||void 0===location?void 0:location.href){this.params.origin_url=this.params.origin_url||(null===(e=v.location)||void 0===e?void 0:e.href);var t=T(v.location.href).page,n=void 0===t?"":t;this.params.origin_pathname=n}},t.prototype.getRealUrlPackage=function(){var e=T(v.location.href),t=e.page,n=e.params;return{page:t,params:JSON.stringify(s({page_code:this.page,url:v.location.href,query:n},n)),page_type:this.page_type,identity:this.identity}},t.prototype.generatePageId=function(){return V()},t}(f),J="https://data-track.corp.kuaishou.com",Y=J+"/",z="production",q="logger",Q="logger-oversea",X="rest/wd/common/log/collect/",$=[z,"test","development",q,"oversea"],Z="https://logsdk.kwai-pro.com/",ee={v2:"rest/kd/log/collect?_json=1&biz=",v3:"".concat(X,"misc2"),radar:"".concat(X,"radar")},te={v2:{production:["https://wlog.ksapisrv.com/","https://wlog.gifshow.com/"][Math.round(Math.random())],development:Y,test:Y,oversea:Z},v3:{production:"https://log-sdk.ksapisrv.com/",development:Y,test:Y,oversea:Z}},ne=function(e,t,n){return void 0===e&&(e=z),void 0===t&&(t=!1),void 0===n&&(n="v3"),-1===$.indexOf(e)?e+ee[n]:t&&te.v3[e]?te.v3[e]+ee.radar:te[n][e]&&ee[n]?te[n][e]+ee[n]:te.v3.production+ee.v3},re=function(e,t){if(!t)return e;try{return/\?(.+?)$/.test(e)?e.replace(/\?(.+?)$/,"?".concat(t,"&$1")):e+"?".concat(t)}catch(t){return e}},oe=function(){function e(e,t){var n=this;this.asyncQueue=[],this.throttleQueue=[],this.errorQueue=[],this.sendingQueue={},this.url="",this.isV2=!1,this.isDebug=!1,this.radarUrl="",this.drained=!1,this.batchCount=50,this.isSetSamplingResult=!1,this.sendingYield=null,this.flush=function(e){n.sendLogs(n.throttleQueue.concat(n.asyncQueue),e),n.throttleQueue=[],n.asyncQueue=[]},this.drain=function(){n.drained=!0,n.flush(),n.flushErrorLogs(),setTimeout((function(){n.drained=!1}),1e3)},this.config=e,this.config.maxBatchLength&&this.config.maxBatchLength>1&&(this.batchCount=Math.min(50,this.config.maxBatchLength)),this.commonPackage=t,this.isDebug=this.config.logger||"logger"===this.config.env,this.isV2="v2"===this.config.proto,this.updateUrls()}return e.prototype.sendData=function(e,t){return"function"==typeof this.config.sender?this.config.sender(e,t):this.baseSendData(e,t)},Object.defineProperty(e.prototype,"responseSamplingStorageKey",{get:function(){var e=this.commonPackage.app_package,t=e.product_name,n=e.product,r=this.commonPackage.identity_package.device_id;return"RESPONSE_SAMPLING_STORAGE_KEY_".concat(t||n,"_").concat(r)},enumerable:!1,configurable:!0}),e.prototype.updateUrls=function(){var e=this.config.env;e&&/^(https?:)?\/\//.test(e)?this.url=e:this.url=ne(e),this.formatUrl()},e.prototype.formatUrl=function(){this.radarUrl||(this.radarUrl=this.url.replace(-1!==this.url.indexOf(ee.v2)?ee.v2:ee.v3,ee.radar),-1!==this.radarUrl.indexOf(te.v2.production||"")&&this.radarUrl.replace(te.v2.production||"",te.v3.production));var e=this.commonPackage.app_package,t=e.product_name,n=e.product,r="v=3.10.28&kpn=".concat(t||n);this.url=re(this.url,r),this.radarUrl=re(this.radarUrl,r)},e.prototype.getCommonPackageJSON=function(){return this.commonPackage.toJSON()},e.prototype.send=function(e,t,n){if(void 0===t&&(t=!1),n||this.drained)return this.sendLogs([e],n);t?this.sendAsync(e,n):this.sendThrottle(e)},e.prototype.sendAsync=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.asyncQueue.push(e),this.asyncQueue.length>=this.batchCount?(this.flush(),[2]):this.sendingYield?[4,this.sendingYield]:[3,2];case 1:t.sent(),this.sendingYield=null,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,Promise.resolve()];case 3:case 4:return t.sent(),[3,5];case 5:return this.asyncQueue.length?(this.flush(),[2]):[2]}}))}))},e.prototype.sendThrottle=function(e){var t=this;this.throttleQueue.push(e),this.throttleQueue.length>=this.batchCount?this.flush():(clearTimeout(this.batchWaitTimer),this.batchWaitTimer=setTimeout((function(){t.flush()}),this.config.wait))},e.prototype.sendLogs=function(e,t){var n=this;if(!e||!e.length)return"function"==typeof t&&t();var r=this.buildLogPackage(e,this.url);this.sendPackage(r,(function(e){e?n.errHandler(r):n.flushErrorLogs(),"function"==typeof t&&t(e)}))},e.prototype.sendPackage=function(e,t){var n=this.config.timeout;try{this.sendData(s(s({},e),{isDebug:this.isDebug,isDrained:this.drained,timeout:n}),t)}catch(e){"function"==typeof t&&t(e)}},e.prototype.buildLogPackage=function(e,t){return this.isV2?this.buildV2Package(e,t):this.buildV3Package(e,t)},e.prototype.buildV2Package=function(e,t){return{url:t,data:{log:{event:e}}}},e.prototype.buildV3Package=function(e,t,n){var r=this.getCommonPackageJSON();return n&&Object.assign(r,n),{url:t,data:{common:r,logs:e}}},e.prototype.errHandler=function(e){var t;if(this.isV2)this.errorQueue.unshift(e);else{var n=e.data;if(n.logs.length){delete n.common.h5_extra_attr.http_seq_id,delete n.common.h5_extra_attr.client_timestamp;for(var r=!1,o=0;o=5&&this.errorQueue.pop(),this.errorQueue.unshift(e))}}},e.prototype.flushErrorLogs=function(){var e=this;this.errorQueue.forEach((function(t){e.sendPackage(t)})),this.errorQueue=[]},e.prototype.destory=function(){this.batchWaitTimer&&clearTimeout(this.batchWaitTimer),this.compensateTimer&&clearTimeout(this.compensateTimer)},e.prototype.sendRadar=function(e,t){var n=t?{service_name:t}:void 0,r=this.buildV3Package([e],this.radarUrl||this.url,n);this.sendPackage(r)},e}(),ie=function(e,t,n){return E("[error 400]","埋点上报接口请求报错","\nurl:",t,"\ndata",n,"\nerror:",e||"server decode log failed")};function ae(e,t){var n=e.url,r=e.data,o=e.timeout;return new Promise((function(e){if("undefined"!=typeof XMLHttpRequest){var i=new XMLHttpRequest;return i.open("POST",n),i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),"object"!=typeof r||r instanceof Uint8Array||(r=JSON.stringify(r)),o&&(i.timeout=o),i.onload=function(){var o=function(e,t,n,r){var o;if(e<200||e>=300&&304!==e);else try{var i=JSON.parse(t),a=i.exception,s=i.result,c=i.error_msg;a&&(o=a),1!==s&&(o=c||"result is ".concat(s))}catch(e){o=e.message}return o&&ie(o,n,r),o}(i.status,i.response,n,r);t&&t(o),e({error:o,response:o?void 0:i.response})},i.ontimeout=i.onerror=function(o){o&&ie(o,n,r),t&&t(o?"networkTimeout":""),e({error:"networkTimeout"})},i.send(r),i}}))}var se=function(e){if("undefined"!=typeof XMLHttpRequest){var t=function(t){return E("[error 401]","GET 请求出错 url: ".concat(e),t)};try{var n=new XMLHttpRequest;n.open("GET",e),n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),n.send(),n.onerror=t}catch(e){t(e)}}},ce=null==v?void 0:v.navigator,ue=ce&&-1!==ce.userAgent.indexOf("Chrome"),le="function"==typeof ce.sendBeacon;function de(e,t){var n=e.url,r=e.data,o=e.timeout;e.isDebug;var i=e.isDrained,a=e.forceSendBeacon;return u(this,void 0,void 0,(function(){var e;return l(this,(function(s){switch(s.label){case 0:return r=JSON.stringify(r),i&&function(e){var t,n=e.url,r=e.data,o=e.forceSendBeacon;if(!ue&&!o||!le)return!1;"object"==typeof r&&r.fd&&(r=r.fd);try{return null===(t=v.navigator)||void 0===t?void 0:t.sendBeacon(n,r)}catch(e){return E("[error 403]","navigator.sendBeacon 报错",e),!1}}({url:n,data:r,forceSendBeacon:a})?(t&&t(),[2]):[4,ae({url:n,data:r,timeout:o},t)];case 1:return[2,(e=s.sent()).error?void 0:e.response]}}))}))}var pe,fe=function(e,t,n){void 0===e&&(e=J);var r="".concat(e,"/#/logger/index?sessionId=").concat(n);return w("%c埋点抓包校验: %c".concat(r),"color:#1abf89;font-size:1.2em;line-height:2.4em;","font-size:1.2em;"),"".concat(t,"/").concat(n,"/")};!function(e){e.loading="loading",e.loaded="loaded"}(pe||(pe={}));var he,ve,ge,ye=Object.create(null),me="weblogger_switch",_e=function(e){var t=function(){try{var e=_(me)||"undefined"!=typeof sessionStorage&&sessionStorage.getItem(me);if(!e)return;var t=JSON.parse(e),n=t.loggerSessionId,r=t.reportHost,o=t.loggerHost,i=t.handshakeApi;return n?(se(i||"".concat(r,"/").concat(n)),fe(o,r,n)):""}catch(e){return""}}()||function(e){void 0===e&&(e=v.location.href);var t=e.lastIndexOf("?");if(-1===t)return"";var n=A(e.slice(t+1)).webloggerSwitch;if(!n)return"";try{var r=decodeURIComponent(n),o=JSON.parse(r),i=o.loggerSessionId,a=o.reportHost,s=o.loggerHost,c=o.handshakeApi;return i?("undefined"!=typeof sessionStorage&&v.sessionStorage.setItem(me,r),se(c||"".concat(a,"/").concat(i)),fe(s,a,i)):""}catch(e){return""}}();if(t)return ne(t,!1,e)},be=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.baseSendData=r.sendLog,r.getResponseSamplingStorage(),r}return a(t,e),t.prototype.getResponseSamplingStorage=function(){return u(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Promise.resolve()];case 1:return t.sent(),(e=Number(v.localStorage.getItem(this.responseSamplingStorageKey)))&&Date.now()1e8&&(t=0),function(e,t){try{v&&v.localStorage&&v.localStorage.setItem(e,JSON.stringify(t))}catch(e){return!1}}(e,t+1),t}}catch(e){}return Te[e]||(Te[e]=0),Te[e]++},Ne=(Se=(new Date).getTimezoneOffset()/60)<=0?"GMT+".concat(P(-Se+"",2,"0"),":00"):"GMT-".concat(P(Se+"",2,"0"),":00"),Le=function(){function e(e,t){void 0===t&&(t=!1),this.client_timestamp=D((new Date).valueOf()),this.client_increment_id=0,this.session_id=p.sessionId,this.event_id="",t||(this.time_zone=Ne),Object.assign(this,e),this.genIncrementId()}return e.prototype.genIncrementId=function(){this.client_increment_id=this.isCustomStatEvent()?Ce("WEBLOGGER_CUSTOM_INCREAMENT_ID_KEY"):Ce("WEBLOGGER_INCREAMENT_ID_KEY")},e.prototype.isCustomStatEvent=function(){return!(!this.stat_package||!("custom_stat_event"in this.stat_package))},e.prototype.getEventType=function(){if(this.event_package){var e=this.event_package,t=e.task_event,n=e.show_event,r=e.click_event,o=e.custom_event;if(n)return"showEvent";if(r)return"clickEvent";if(t)return"taskEvent";if(o)return"customEvent"}return"customEvent"},e}();function Re(e,t,n){var r;void 0===n&&(n=!1);var o,i=t.eventId,a=t.currentUrlPackage,s=t.referUrlPackage,u=t.contentPackage,l=t.name,d=t.params;switch(n&&"RADAR"!==e&&"CUSTOM"!==e&&(a&&(a.page2=a.page,delete a.page),s&&(s.page2=s.page,delete s.page)),e){case"PV":case"SHOW":return new Le({event_package:Pe({type:e,status:t.status,currentUrlPackage:a,referUrlPackage:s,action:t.type,beginTime:t.beginTime,actionType:t.actionType,name:l,params:d,contentPackage:u,operationDirection:t.operationDirection,auto:t.auto},n),event_id:i},n);case"CUSTOM":case"CUSTOM_STAT_EVENT":var f=Ae({name:l,params:d,currentUrlPackage:a,referUrlPackage:s});return new Le(n?{event_package:{custom_event:f},event_id:i}:{stat_package:{custom_stat_event:f},event_id:i},n);case"RADAR":return new Le({stat_package:{custom_stat_event:Ae({name:l,params:d,currentUrlPackage:a,referUrlPackage:s})},event_id:i},n);case"HEART_BEAT_EVENT":case"LAUNCH_EVENT":case"APP_USAGE_STAT_EVENT":case"EXCEPTION_EVENT":case"DEVICE_STAT_EVENT":return new Le({stat_package:(r={},r[e.toLowerCase()]=(o=t,o.currentUrlPackage,o.referUrlPackage,o.taskType,c(o,["currentUrlPackage","referUrlPackage","taskType"])),r)},n);case"VIDEO":return new Le(n?{stat_package:xe({currentUrlPackage:a,referUrlPackage:s,options:d.params}),event_id:i}:{event_package:Ie({type:e,status:t.status,taskType:t.taskType,sessionId:p.sessionId,currentUrlPackage:a,referUrlPackage:s,name:l,params:d.params,contentPackage:u},n),event_id:i},n);default:return new Le({event_package:Ie({type:e,status:t.status,taskType:t.taskType,sessionId:p.sessionId,currentUrlPackage:a,referUrlPackage:s,name:l,params:d,contentPackage:u},n),event_id:i},n)}}var Ue,De=(null===(we=null==v?void 0:v.navigator)||void 0===we?void 0:we.userAgent)||"",Me=function(e){var t,n,r,o;if(void 0===e&&(e=null===(t=null==v?void 0:v.navigator)||void 0===t?void 0:t.userAgent),Ee&&e===De)return Ee;var i="unknow",a=/android/i,s="Mac OS",c="Windows",u="Android",l="iPhone",d="iPad",p="Windows Phone",f="Linux";Ee={os:{name:i,version:i},model:i};try{var h=e.match(/\((.*?)\)/);if(!h)return a.test(e)&&(Ee.os.name=u),Ee;var g=h[1]+")",y=g.split(";").map((function(e){return e.trim()})),m=void 0,_=void 0,b=void 0;if(e.indexOf(p)>-1)b=m=p,(E=g.match(/Windows\sPhone\s(.*?)[;\)\s]/))&&(_=E[1]),b=null===(n=y[y.length-1])||void 0===n?void 0:n.replace(")","");else if(a.test(e)){m=u;var S=g.match(/android.*?;(.*?)build\//i);S&&(b=(b=null===(r=S[1])||void 0===r?void 0:r.split(";").pop())&&b.trim());for(var w=0;w-1||e.indexOf(d)>-1)b=e.indexOf(l)>-1?l:d,m="iOS",(E=g.match(/OS\s(.*?)\slike/))&&(_=E[1]);else if(e.indexOf(s)>-1)b=m=s,(E=g.match(/OS\sX\s(.*?)[;\)\s]/))&&(_=E[1]);else if(e.indexOf(c)>-1){var E;b=m=c,(E=g.match(/Windows\s(.*?)[;\)]/))&&(_=E[1])}else if(e.indexOf("Nokia")>-1){m="Symbian";var O=e.match(/Symbian.*?\/(.*?);/);O&&(_=O[1]);var k=e.match(/Nokia(.*?)\//);k&&(b=k[1])}else g.indexOf(f)>-1&&(m=b=f);Ee={os:{name:m||i,version:_&&_.replace(/_/g,".").trim()||i},model:b||i}}catch(e){}return Ee};function je(){return void 0===Ue&&(Ue=I()&&_("kpn")||function(){if("undefined"==typeof window)return"";for(var e=window.navigator.userAgent,t=[[/ Kwai\//,"KUAISHOU"],[/ ksthanos\//,"THANOS"],[/ ksNebula\//i,"NEBULA"]],n=0;n