hina-cloud-js-sdk 3.1.8 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/dist/hina.cjs.js +1 -0
  2. package/dist/hina.esm.full.js +1 -0
  3. package/dist/hina.esm.js +1 -0
  4. package/dist/hina.full.js +1 -0
  5. package/dist/hina.iife.js +1 -0
  6. package/dist/index.d.ts +411 -0
  7. package/package.json +27 -37
  8. package/readme.md +1 -0
  9. package/.eslintrc.js +0 -12
  10. package/.gitlab-ci.yml +0 -16
  11. package/.vscode/settings.json +0 -5
  12. package/build/hina.cjs.min.js +0 -1
  13. package/build/hina.esm.min.js +0 -1
  14. package/build/hina.min.js +0 -1
  15. package/build/hotAnalyse.min.js +0 -1
  16. package/packages/core/dist/index.cjs.js +0 -64
  17. package/packages/core/dist/index.cjs.js.map +0 -1
  18. package/packages/core/dist/index.d.ts +0 -45
  19. package/packages/core/dist/index.esm.js +0 -62
  20. package/packages/core/dist/index.esm.js.map +0 -1
  21. package/packages/core/dist/index.global.js +0 -1199
  22. package/packages/core/dist/index.global.js.map +0 -1
  23. package/packages/core/dist/index.js +0 -1200
  24. package/packages/core/dist/index.js.map +0 -1
  25. package/packages/monitor/dist/index.cjs.js +0 -150
  26. package/packages/monitor/dist/index.cjs.js.map +0 -1
  27. package/packages/monitor/dist/index.d.ts +0 -35
  28. package/packages/monitor/dist/index.esm.js +0 -145
  29. package/packages/monitor/dist/index.esm.js.map +0 -1
  30. package/packages/monitor/dist/index.global.js +0 -1343
  31. package/packages/monitor/dist/index.global.js.map +0 -1
  32. package/packages/monitor/dist/index.js +0 -1344
  33. package/packages/monitor/dist/index.js.map +0 -1
  34. package/packages/track/dist/index.cjs.js +0 -1930
  35. package/packages/track/dist/index.cjs.js.map +0 -1
  36. package/packages/track/dist/index.d.ts +0 -212
  37. package/packages/track/dist/index.esm.js +0 -1925
  38. package/packages/track/dist/index.esm.js.map +0 -1
  39. package/packages/track/dist/index.global.js +0 -4259
  40. package/packages/track/dist/index.global.js.map +0 -1
  41. package/packages/track/dist/index.js +0 -4260
  42. package/packages/track/dist/index.js.map +0 -1
  43. package/packages/types/dist/index.d.ts +0 -603
  44. package/packages/types/dist/index.esm.js +0 -25
  45. package/packages/types/dist/index.esm.js.map +0 -1
  46. package/packages/utils/dist/index.cjs.js +0 -1535
  47. package/packages/utils/dist/index.cjs.js.map +0 -1
  48. package/packages/utils/dist/index.d.ts +0 -394
  49. package/packages/utils/dist/index.esm.js +0 -1465
  50. package/packages/utils/dist/index.esm.js.map +0 -1
  51. package/packages/utils/dist/index.global.js +0 -2507
  52. package/packages/utils/dist/index.global.js.map +0 -1
  53. package/packages/utils/dist/index.js +0 -2508
  54. package/packages/utils/dist/index.js.map +0 -1
  55. package/report.json +0 -101
  56. package/rollup.config.epm.js +0 -42
  57. package/rollup.config.sdk.js +0 -42
  58. package/sonar-project.properties +0 -3
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("hina-cloud-js-core"),e=require("hina-cloud-type"),i=require("hina-cloud-util"),r=require("hina-cloud-js-monitor"),o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)};function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var s=function(){return s=Object.assign||function(t){for(var e,i=1,r=arguments.length;i<r;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},s.apply(this,arguments)};function a(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],r=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var r,o,n=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(i=n.return)&&i.call(n)}finally{if(o)throw o.error}}return s}function l(t,e,i){if(i||2===arguments.length)for(var r,o=0,n=e.length;o<n;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var u=["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"],p=["a","input","button","textarea"],h=["abtestExperimentId","paramName","valueType","defaultValue","callback","timeoutMilliseconds","customProperties","customIds"],f=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="ClickTrackPlugin",r.isReady=!1,r.isTrackList={a:!0,button:!0},r}return n(r,t),r.prototype.init=function(t){var r=this,o=this.options.autoTrackConfig,n=o.clickAutoTrack,s=o.isCollectUrl,a=o.isCollectElement,c=o.addCustomProperty;!0===n&&(this.isReady?this.context.log("ClickTrack plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN):(this.isReady=!0,document.addEventListener("click",(function(e){if(s()){var o=e||window.event;if(o){var n=o.target||o.srcElement,l=r.getTargetElement(n);if(l){if(i.isFunction(a)&&!a(l))return!1;var u=r.getClickElementInfo(l),p=i.getPageXYInfo(o,l),h=p.H_page_x,f=p.H_page_y;if(u.H_page_x=h,u.H_page_y=f,i.isFunction(c)){var g=c(l);i.isObject(g)&&(u=i.merge(u,g))}t(u)}}}}),!0)))},r.prototype.transform=function(t){return this.context.getReportData("track","H_WebClick",t)},r.prototype.hasAttribute=function(t,e){var i;return t.hasAttribute?t.hasAttribute(e):t.attributes?!!(null===(i=t.attributes[e])||void 0===i?void 0:i.value):void 0},r.prototype.hasAttributes=function(t,e){if(i.isArray(e))for(var r=0;r<e.length;r++)if(this.hasAttribute(t,e[r]))return!0;return!1},r.prototype.hasElement=function(t){var e,r,o,n=i.getElementParents(t),s=this.options.autoTrackConfig.trackAttr||[];if(i.isArray(n)&&n.length>0)try{for(var c=a(n),l=c.next();!l.done;l=c.next()){var u=l.value,p=u.tagName&&(null===(o=u.tagName)||void 0===o?void 0:o.toLowerCase());if(i.isElement(u)&&(this.isTrackList[p]||this.hasAttributes(u,s)))return u}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}},r.prototype.getDivMaxLevel=function(){var t;return(null===(t=this.options.autoTrackConfig.collectTags.div)||void 0===t?void 0:t.maxLevel)||1},r.prototype.isStyleTag=function(t){var e,i=(null===(e=this.options.autoTrackConfig.collectTags.div)||void 0===e?void 0:e.ignoreTags)||[];return null==i?void 0:i.includes(t)},r.prototype.getCollectableParent=function(t){var i;try{var r=t.parentNode,o=r?null===(i=r.tagName)||void 0===i?void 0:i.toLowerCase():"";if("body"===o)return!1;var n=this.getDivMaxLevel();if("div"===o&&(n>1||this.isCollectableDiv(r)))return r;if(r&&this.isStyleTag(o))return this.getCollectableParent(r)}catch(t){this.context.log(t,e.ConsoleTypes.ERROR)}return!1},r.prototype.isCollectableDiv=function(t){var r;try{var o=t.children||[];if(0===o.length)return!0;for(var n=0;n<o.length;n++){var s=o[n];if(i.isElement(s)){var a=null===(r=s.tagName)||void 0===r?void 0:r.toLowerCase(),c=this.getDivMaxLevel();if(!("div"===a&&c>1||this.isStyleTag(a)))return!1;if(!this.isCollectableDiv(s))return!1}}return!0}catch(t){this.context.log(t,e.ConsoleTypes.ERROR)}return!1},r.prototype.isDivLevelValid=function(t){for(var e=this.getDivMaxLevel(),i=t.getElementsByTagName("div"),r=i.length-1;r>=0;r--)if(this.getDivLevels(i[r],t)>e)return!1;return!0},r.prototype.getElementPath=function(t,e,r){for(var o,n,s=[];i.isElement(t)&&t.parentNode;){if(t.id&&!e&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.id)){var a=t.tagName||"";s.unshift("".concat(a.toLowerCase(),"#").concat(t.id));break}if(r&&t===r){s.unshift(null===(o=t.tagName)||void 0===o?void 0:o.toLowerCase());break}if(t===document.body){s.unshift("body");break}s.unshift(null===(n=t.tagName)||void 0===n?void 0:n.toLowerCase()),t=t.parentNode}return s.join(" > ")},r.prototype.getDivLevels=function(t,e){var i=this.getElementPath(t,!0,e).split(" > "),r=0;return i.forEach((function(t){"div"===t&&r++})),r},r.prototype.getTargetElement=function(t){var e;if(!i.isElement(t))return null;var r=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if(!i.isString(r))return null;if(["body","html"].includes(r))return null;if(this.context.trackTags.includes(r)&&"div"!==r)return t;if("div"===r&&this.options.autoTrackConfig.collectTags.div&&(this.isDivLevelValid(t)&&(this.getDivMaxLevel()>1||this.isCollectableDiv(t))))return t;if(this.options.autoTrackConfig.collectTags.div&&this.isStyleTag(r)){var o=this.getCollectableParent(t);if(o&&this.isDivLevelValid(o))return o}return this.hasElement(t)||null},r.prototype.getClickElementInfo=function(t){var e=this.options.autoTrackConfig.isCollectInput,r=!1;i.isFunction(e)&&(r=e(t));var o=this.getDomSelector(t),n=i.getElementProperties(t,r);return n.H_element_selector=o,n.H_element_path=this.getElementPath(t,!1),n},r.prototype.getDomSelector=function(t){for(var e,r=[];t;){if("body"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase())||!i.isElement(t)){r.unshift("body");break}if(r.unshift(this.getSelector(t)),(null==t?void 0:t.getAttribute("id"))&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.getAttribute("id")))break;t=t.parentNode}return r.join(" > ")},r.prototype.getSelector=function(t){var e,i,r=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),o=-1;9!==(null===(i=t.parentNode)||void 0===i?void 0:i.nodeType)&&(o=this.getDomIndex(t));var n=t.getAttribute("id");return n&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(n)?"#".concat(n):r+(o>-1?":nth-of-type(".concat(o+1,")"):"")},r.prototype.getDomIndex=function(t){var e,i;if(t.parentNode)for(var r=0,o=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),n=t.parentNode.children,s=0;s<n.length;s++){var a=n[s];if((null===(i=a.tagName)||void 0===i?void 0:i.toLowerCase())===o){if(a===t)return r;r++}}return-1},r}(e.PluginBase),g=function(t){function r(e,r){var o=t.call(this,e,r)||this;return o.options=e,o.context=r,o.name="StayTrackPlugin",o.isReady=!1,o.timer=null,o.previousTime=i.nowStamp(),o.previousOffsetTop=0,o}return n(r,t),r.prototype.init=function(t){var r=this,o=this.options,n=o.autoTrackConfig,s=o.stayAutoTrackConfig;if(!0===n.stayAutoTrack)if(this.isReady)this.context.log("StayTrack plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN);else{this.isReady=!0;var a=s.isCollectUrl;i.isFunction(a)||(a=function(){return!0}),this.timer&&(clearTimeout(this.timer),this.timer=null),this.previousTime=i.nowStamp(),window.addEventListener("load",(function(){r.previousOffsetTop=i.getScrollTop()})),window.addEventListener("scroll",(function(){a()&&(r.timer||(r.timer=setTimeout((function(){r.run(t),clearTimeout(r.timer),r.timer=null}),1e3)))})),window.addEventListener("unload",(function(){a()&&r.run(t,!0)}))}},r.prototype.transform=function(t){return this.context.getReportData("track","H_WebStay",t)},r.prototype.run=function(t,e){void 0===e&&(e=!1);var r=this.options.autoTrackConfig,o=r.stayDelayTime,n=r.maxStayPageDuration,s=i.getScrollTop(),a=i.nowStamp(),c=a-this.previousTime;(e||c>o&&s!==this.previousOffsetTop)&&t({H_viewport_position:this.previousOffsetTop,event_duration:Math.min(c/1e3,n)});this.previousTime=a,this.previousOffsetTop=s},r}(e.PluginBase),d=function(t){function r(e,r){var o=t.call(this,e,r)||this;return o.options=e,o.context=r,o.name="PageLeave",o.isReady=!1,o.pageId=i.generatorTrackId(),o.storageName="hinasdk_pageleave_",o.heartbeatIntervalTime=5e3,o.maxDuration=432e3,o.heartbeatIntervalTimer=null,o.startTime=i.nowStamp(),o.url=window.location.href,o.pageShowStatus=!0,o}return n(r,t),r.prototype.init=function(){if(this.options.autoTrackConfig.pageLeaveAutoTrack)if(this.context.store.localStorage)if(this.isReady)this.context.log("PageLeave plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN);else{this.isReady=!0;var t=this.normalizePageLeaveAutoTrack(),r=t.heartbeat_interval_time,o=t.max_duration;r&&r>0&&(this.heartbeatIntervalTime=1e3*r),o&&o>0&&(this.maxDuration=Number(o)),this.startTime=i.nowStamp(),this.addPageLeaveEventListener(),document.hidden?this.pageShowStatus=!1:this.startHeartBeatInterval()}else this.context.log("PageLeave plugin需要使用localstorage存储数据,但是您的浏览器不支持localstorage,所以不能使用该功能",e.ConsoleTypes.WARN)},r.prototype.transform=function(){},r.prototype.normalizePageLeaveAutoTrack=function(){var t=this.options.autoTrackConfig.pageLeaveAutoTrack;return i.isObject(t)?t:{}},r.prototype.addPageLeaveEventListener=function(){this.addPageStartListener(),this.addPageSwitchListener(),this.addSinglePageListener(),this.addPageEndListener()},r.prototype.addPageStartListener=function(){var t=this;"onpageshow"in window&&window.addEventListener("pageshow",(function(){t.pageStartHandler()}))},r.prototype.addPageSwitchListener=function(){var t=this;new i.ListenPageState({visible:function(){t.pageStartHandler(),t.startHeartBeatInterval()},hidden:function(){t.url=window.location.href,t.pageEndHandler(),t.stopHeartBeatInterval()}})},r.prototype.addSinglePageListener=function(){var t=this;i.mitt.on("urlChange",(function(e){var i=e.fromHref;i!==e.toHref&&(t.url=i,t.pageEndHandler(),t.stopHeartBeatInterval(),t.pageStartHandler(),t.startHeartBeatInterval())}))},r.prototype.addPageEndListener=function(){var t=this,e=["pagehide","beforeunload","unload"];e.forEach((function(i){"on".concat(e)in window&&window.addEventListener(i,(function(){t.pageEndHandler(),t.stopHeartBeatInterval()}))}))},r.prototype.pageStartHandler=function(){this.startTime=i.nowStamp(),this.pageShowStatus=!document.hidden,this.url=window.location.href},r.prototype.pageEndHandler=function(){if(this.pageShowStatus){if(this.pageShowStatus=!1,this.isCollectUrl()){var t=this.getPageLeaveProperties(),e=this.context.getReportData("track","H_WebPageLeave",t);this.context.report(e)}this.delHeartBeatData()}},r.prototype.startHeartBeatInterval=function(){var t=this;this.heartbeatIntervalTimer&&this.stopHeartBeatInterval(),this.isCollectUrl()&&(this.heartbeatIntervalTimer=setInterval((function(){t.saveHeartBeatData()}),this.heartbeatIntervalTime),this.saveHeartBeatData("first_heartbeat")),this.reissueHeartBeatData()},r.prototype.reissueHeartBeatData=function(){for(var t=this.context.store.localStorage,e=t.length(),r=0;r<e;r++){var o=t.key(r);if(o&&o!==this.storageName+this.pageId&&o.includes(this.storageName)){var n=t.get(o),s=i.safeJSONParse(n);i.isObject(s)&&i.nowStamp()-s.time>s.heartbeat_interval_time+5e3&&(delete s.heartbeat_interval_time,this.context.report(s)),this.delHeartBeatData(o)}}},r.prototype.stopHeartBeatInterval=function(){this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)},r.prototype.delHeartBeatData=function(t){this.context.store.localStorage.remove(t||this.storageName+this.pageId)},r.prototype.isCollectUrl=function(){var t=this.normalizePageLeaveAutoTrack().isCollectUrl;return!i.isFunction(t)||t(this.url)},r.prototype.saveHeartBeatData=function(t){var e=this.getPageLeaveProperties();e.H_time=i.nowStamp(),"first_heartbeat"===t&&(e.event_duration=3);var r=this.context.getReportData("track","H_WebPageLeave",e);r.heartbeat_interval_time=this.heartbeatIntervalTime,this.context.store.localStorage.set(this.storageName+this.pageId,JSON.stringify(r))},r.prototype.getPageLeaveProperties=function(){var t=(i.nowStamp()-this.startTime)/1e3;t=t<=0||t>this.maxDuration?0:i.formatDecimal(t,3);var e=i.getURL(this.url),r=e.pathname,o=e.hash,n={H_url:this.url,H_url_path:r,H_url_hash:o};t&&(n.event_duration=t);var a=this.normalizePageLeaveAutoTrack().custom_props;return i.isObject(a)&&(n=s(s({},n),a||{})),n},r}(e.PluginBase),v=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="SiteLinker",r.isReady=!1,r.linker=[],r}return n(r,t),r.prototype.init=function(){if(this.options.siteLinkerConfig){var t=this.getLinkerConfig().linker;i.isArray(t)&&t.length>0?this.isReady?this.context.log("SiteLinker plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN):(this.isReady=!0,this.resolveOption(),this.setRefferId(),this.addClickListen()):this.context.log("siteLinker plugin: 请配置正确的linker参数",e.ConsoleTypes.WARN)}},r.prototype.transform=function(){},r.prototype.getLinkerConfig=function(){var t=this.options.siteLinkerConfig||{},e=t.linker;return{linker:(void 0===e?[]:e)||[],re_login:t.re_login}},r.prototype.resolveOption=function(){for(var t=this.getLinkerConfig().linker,r=t.length,o=[],n=0;n<r;n++){var s=t[n],a=s.part_url,c=s.after_hash;/[A-Za-z0-9]+\./.test(a)&&i.isBoolean(c)?o.push({part_url:a,after_hash:c}):this.context.log("The configuration of linker ".concat(n+1," is not supported.Please check format"),e.ConsoleTypes.WARN)}this.linker=o},r.prototype.setRefferId=function(){var t=this.getLinkerConfig().re_login,e=this.getUrlId(),i=e.startsWith("a");if(""!==(e=e.substring(1))){var r=this.context.store.getAnonymousId(),o=this.context.store.getAccountId();if(i){if(e!==r&&(this.context.store.state.anonymousId=e,this.context.store.save()),o){var n=this.context.getReportData("track_signup","H_SignUp",{});this.context.report(n)}}else(!o||t&&o!==e)&&this.context.setUserUId(e)}},r.prototype.getUrlId=function(){var t=window.location.href.match(/_hnsdk=([au][^\?\#\&\=]+)/);return i.isArray(t)&&t[1]?i.handleDecodeURLComponent(t[1]):""},r.prototype.getPartUrl=function(t){for(var e=this.linker.length,i=0;i<e;i++)if(t.includes(this.linker[i].part_url))return!0;return!1},r.prototype.getPartHash=function(t){for(var e=this.linker.length,i=0;i<e;i++)if(t.includes(this.linker[i].part_url))return this.linker[i].after_hash;return!1},r.prototype.getCurrentId=function(){var t=this.context.store.getAccountId(),e=this.context.store.getAnonymousId(),r=t?"u".concat(t):"a".concat(e);return i.handleEncodeURLComponent(r)},r.prototype.rewriteUrl=function(t,e){var i=/([^?#]+)(\?[^#]*)?(#.*)?/.exec(t),r="";if(i){var o=i[1]||"",n=i[2]||"",s=i[3]||"",a="_hnsdk=".concat(this.getCurrentId()),c=function(t){var e=t.split("&"),i=[];return e.forEach((function(t){t.includes("_hnsdk")?i.push(a):i.push(t)})),i.join("&")};if(this.getPartHash(t)){var l=s.includes("?"),u=s.indexOf("_hnsdk");r=l?u>=0?"".concat(o).concat(n,"#").concat(s.substring(1,u)).concat(c(s.substring(u,s.length))):"".concat(o).concat(n,"#").concat(s.substring(1),"&").concat(a):"".concat(o).concat(n,"#").concat(s.substring(1),"?").concat(a)}else{r=(l=/^\?(\w)+/.test(n))?n.includes("_hnsdk")?"".concat(o,"?").concat(c(n.substring(1))).concat(s):"".concat(o).concat(n,"&").concat(a).concat(s):"".concat(o,"?").concat(a).concat(s)}return e&&(e.href=r),r}},r.prototype.addClickListen=function(){var t=this,e=function(e){var r,o,n=e.target;if(n){var s=null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase(),a=n.parentNode,c=null===(o=null==a?void 0:a.tagName)||void 0===o?void 0:o.toLowerCase();if("a"===s&&n.href||"a"===c&&a.href){var l=void 0,u=void 0;"a"===s&&n.href?(l=n.href,u=n):(l=a.href,u=a);var p=i.getURL(l).protocol;"http:"!==p&&"https:"!==p||t.getPartUrl(l)&&t.rewriteUrl(l,u)}}};"PointerEvent"in window?document.addEventListener("pointerdown",e):document.addEventListener("mousedown",e)},r}(e.PluginBase),y=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="HistoryPlugin",r.isReady=!1,r.lastHref=window.location.href,r.lastPath=window.location.pathname,r}return n(r,t),r.prototype.init=function(){if(i.supportHistory())if(this.isReady)this.context.log("History plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN);else{this.isReady=!0;var t=this,r=window.onpopstate,o=function(e,r){var o={fromPath:t.lastPath,fromHref:t.lastHref,toPath:e,toHref:r};t.lastPath=e,t.lastHref=r,i.mitt.emit("urlChange",s(s({},o),{mode:"history"}))};window.onpopstate=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=window.location.pathname,n=window.location.href;o(i,n),r&&r.apply(this,t)},i.replaceOld(window.history,"pushState",n),i.replaceOld(window.history,"replaceState",n)}function n(t){return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];t.apply(this,e);var r=window.location.pathname,n=window.location.href;o(r,n)}}},r.prototype.transform=function(){},r}(e.PluginBase),m=function(t){function r(e,i){var r=t.call(this,e,i)||this;return r.options=e,r.context=i,r.name="HashPlugin",r.isReady=!1,r.lastHref=window.location.href,r.lastPath=window.location.hash,r}return n(r,t),r.prototype.init=function(){var t=this;this.isReady?this.context.log("Hash plugin:插件已经运行,无需重复执行",e.ConsoleTypes.WARN):(this.isReady=!0,window.addEventListener("hashchange",(function(e){var r=e.newURL,o=i.getURL(r).hash,n={fromPath:t.lastPath,fromHref:t.lastHref,toPath:o,toHref:r};t.lastHref=r,t.lastPath=o,i.mitt.emit("urlChange",s(s({},n),{mode:"hash"}))})))},r.prototype.transform=function(){},r}(e.PluginBase),T="4.0.1",b=function(t){function r(e,r){var o=t.call(this,e,r)||this;return o.options=e,o.context=r,o.name="HinaABTest",o.isReady=!1,o.platform=i.getPlatform(),o.projectKey="",o.storageName="hina_webjs_sdk_abtest",o}return n(r,t),r.prototype.init=function(){var t=this;if(this.context.store.localStorage){var r=this.options.abTestingPluginConfig,o=null==r?void 0:r.url;if(i.isString(o)){var n=i.getQueryParam(o,"project-key");if(n){this.projectKey=n;var s=i.getURL(o).protocol,a=i.getURL(window.location.href).protocol;if(s&&s!==a)this.context.log("A/B Testing 初始化失败,".concat(a," 页面必须使用 ").concat(a," 的 URL"),e.ConsoleTypes.WARN);else if(this.isReady)this.context.log("A/B Testing 插件已经运行,无需重复执行",e.ConsoleTypes.WARN);else{var c=this.context.getUserUid();this.context.log("当前accountId为:".concat(c),e.ConsoleTypes.INFO),i.mitt.on("changeAccountId",(function(){t.context.store.localStorage.set(t.storageName,"")})),this.isReady=!0}}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL(必须包含 project-key)")}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL!",e.ConsoleTypes.WARN)}else this.context.log("A/B Testing 初始化失败,浏览器不支持localStorage",e.ConsoleTypes.WARN)},r.prototype.transform=function(){},r.prototype.valueMatchType=function(t,r){switch(r){case e.VariablesTypes.INTEGER:return i.isNumber(t);case e.VariablesTypes.STRING:return i.isString(t);case e.VariablesTypes.BOOLEAN:return i.isBoolean(t);default:return!1}},r.prototype.normalizeParams=function(t,r,o){var n,s;void 0===o&&(o=h);var c={verify_success:!0,para:r};try{for(var l=a(o),u=l.next();!u.done;u=l.next()){var p=u.value;if(!c.verify_success)break;var f=r.customIds||{},g={};switch(p){case"abtestExperimentId":i.isString(r.abtestExperimentId)&&r.abtestExperimentId.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(r.abtestExperimentId),e.ConsoleTypes.WARN),c.verify_success=!1);break;case"paramName":i.isString(r.paramName)&&r.paramName.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(r.paramName),e.ConsoleTypes.WARN),c.verify_success=!1);break;case"valueType":[e.VariablesTypes.BOOLEAN,e.VariablesTypes.INTEGER,e.VariablesTypes.STRING].includes(r.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(r.valueType),e.ConsoleTypes.WARN),c.verify_success=!1);break;case"defaultValue":this.valueMatchType(r.defaultValue,r.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"类型必须与valueType一致!"),e.ConsoleTypes.WARN),c.verify_success=!1);break;case"callback":i.isFunction(r.callback)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置")),r.callback=i.noop,c.verify_success=!1);break;case"timeoutMilliseconds":(!i.isNumber(r.timeoutMilliseconds)||r.timeoutMilliseconds<=0)&&(this.context.log("".concat(p,"参数错误:").concat(r.timeoutMilliseconds),e.ConsoleTypes.WARN),r.timeoutMilliseconds=3e3),r.timeoutMilliseconds<200&&(r.timeoutMilliseconds=200);break;case"customProperties":r.customProperties=i.isObject(r.customProperties)?r.customProperties:{};break;case"customIds":for(var d in f)(i.isString(f[d])||i.isNumber(f[d]))&&(g[d]=f[d]);r.customIds=g}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(n)throw n.error}}return c},r.prototype.sendTriggerEvent=function(t){var e=t.abtest_experiment_group_id,i=t.abtest_experiment_id;this.context.track("H_ABTestTrigger",{H_abtest_experiment_id:i,H_abtest_experiment_group_id:e})},r.prototype.getExpResult=function(t,e){var r,o;void 0===e&&(e=[]);var n,s=t.abtestExperimentId,c=t.paramName,l=t.valueType;if(0===e.length){var u=this.getStorageData();i.isObject(u)&&(e=u.result||[])}try{for(var p=a(e),h=p.next();!h.done;h=p.next()){var f=h.value,g=f.abtest_experiment_id,d=f.abtest_experiment_group_id,v=f.is_white_list,y=f.variables;if(g===s){var m=y.find((function(t){return t.name===c&&t.type===l}));if(m){v||this.sendTriggerEvent({abtest_experiment_id:g,abtest_experiment_group_id:d}),n=m.value;break}}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}return n},r.prototype.getStorageData=function(){var t=this.context.store.localStorage.get(this.storageName);return i.isValid(t)?i.safeJSONParse(t):null},r.prototype.saveResponseData=function(t){var e=this.getStorageData(),r={updateTime:i.nowStamp()};if(e&&i.isObject(e)){var o=[],n=e.result||[];t.forEach((function(t){var e=t.abtest_experiment_group_id,i=t.abtest_experiment_id,r=t.variables,s=n.find((function(t){return t.abtest_experiment_id===i&&t.abtest_experiment_group_id===e}));if(s){var a=[];r.forEach((function(t){var e=t.name,i=t.type,r=s.variables.findIndex((function(t){return t.name===e&&t.type===i}));r>=0?s.variables[r]=t:a.push(t)})),s.variables=l(l([],c(s.variables),!1),c(a),!1)}else o.push(t)})),r.result=l(l([],c(n),!1),c(o),!1)}else r.result=t;this.context.store.localStorage.set(this.storageName,JSON.stringify(r))},r.prototype.createRequestData=function(t){var e=t.paramName,r=t.customProperties,o=t.customIds,n={anonymous_id:this.context.store.getAnonymousId(),platform:this.platform,abtest_lib_version:T,param_name:e,properties:this.context.getPresetProperties()};return i.isObject(r)&&!i.isEmptyObject(r)&&(n.custom_properties=r),i.isObject(o)&&!i.isEmptyObject(o)&&(n.custom_ids=o),this.context.getUserUid()&&(n.login_id=this.context.getUserUid()),n},r.prototype.getResultFromServer=function(t){var e=this;return new Promise((function(r,o){var n=e.createRequestData(t);new i.AjaxRequest({url:e.options.abTestingPluginConfig.url,data:JSON.stringify(n),contentType:"application/json",customHeaders:{"project-key":e.projectKey},timeout:t.timeoutMilliseconds}).run().then((function(t){var i=t.data;"SUCCESS"===(null==i?void 0:i.status)?(e.saveResponseData(i.results),r(i)):o()}))}))},r.prototype.asyncFetch=function(t){var e=this;return new Promise((function(i){e.getResultFromServer(t).then((function(t){i(t)})).catch((function(){t.callback(t.defaultValue)}))}))},r.prototype.preFetch=function(t,r){return this.isReady?!!i.isObject(r)||(this.context.log("".concat(t," 方法参数必须是对象"),e.ConsoleTypes.WARN),!1):(this.context.log("A/B Testing 插件尚未运行,请先执行该插件",e.ConsoleTypes.WARN),!1)},r.prototype.asyncFetchABTest=function(t){var e=this;if(this.preFetch("asyncFetchABTest",t)){var i=this.normalizeParams("asyncFetchABTest",t),r=i.verify_success,o=i.para;r?this.asyncFetch(o).then((function(t){var i=e.getExpResult(o,t.results);o.callback(i||o.defaultValue)})):o.callback(o.defaultValue)}},r.prototype.fetchCacheABTest=function(t){if(this.preFetch("fetchCacheABTest",t)){var e=this.normalizeParams("fetchCacheABTest",t),i=e.verify_success,r=e.para;if(i){var o=this.getExpResult(r);r.callback(o||r.defaultValue)}else r.callback(r.defaultValue)}},r.prototype.fastFetchABTest=function(t){var e=this;if(this.preFetch("fastFetchABTest",t)){var r=this.normalizeParams("fastFetchABTest",t),o=r.verify_success,n=r.para;if(o){var s=this.getExpResult(n);i.isValid(s)?n.callback(s):this.asyncFetch(n).then((function(){var t=e.getExpResult(n);n.callback(t||n.defaultValue)}))}else n.callback(n.defaultValue)}},r}(e.PluginBase),_=function(t){function o(e,i){void 0===i&&(i=!0);var r=t.call(this,e,i)||this;return r.consolePrefix="埋点SDK",r.trackTags=p,r.presetProps={},r.useInstancing&&r.init(e),r}return n(o,t),o.prototype.init=function(t){if(this.isReady)this.log("hinaSDK has been initialized",e.ConsoleTypes.ERROR);else{var r={name:"",serverUrl:"",showLog:!1,autoTrackConfig:{clickAutoTrack:!0,stayAutoTrack:!0,isCollectUrl:function(){return!0},isCollectElement:function(){return!0},isCollectInput:function(){return!1},addCustomProperty:function(){},stayDelayTime:4e3,maxStayPageDuration:18e3,collectTags:{div:!1},trackAttr:["hn-click"],pageviewAutoTrack:!1,pageLeaveAutoTrack:!1},stayAutoTrackConfig:{isCollectUrl:function(){return!0}},maxStringLength:1024,imgUseCrossOrigin:!1,isSinglePage:!1,batchSend:!1,appJsBridge:!1,sendType:e.ReportTypes.BEACON,customHeaders:{},credentials:!1,dataSendTimeout:3e3,presetProperties:{latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,url:!0,title:!0},sourceChannel:[],plugins:[]},o=t.performanceErrorConfig,n=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(i[r[o]]=t[r[o]])}return i}(t,["performanceErrorConfig"]);this.options=i.merge(r,n),this.options=s(s({},this.options),{performanceErrorConfig:o}),this.initState(),this.normalizeConfig(),this.initAdvProps(),this.initPlugins(),this.isReady=!0}},o.prototype.initState=function(){this.store=new i.State(this.options),this.store.init()},o.prototype.normalizeConfig=function(){var t=this,r=this.options,o=r.serverUrl,n=r.sendType,a=r.batchSend,c=r.maxStringLength,l=r.isSinglePage,p=r.autoTrackConfig,h=void 0===p?{}:p,f=h.trackAttr,g=void 0===f?[]:f,d=h.collectTags,v=h.pageLeaveAutoTrack,y=h.pageviewAutoTrack;if(""===(o=(o=o||"").trim()))this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",e.ConsoleTypes.WARN);else{var m=window.location.href,T=i.getURL(m).protocol||"";(i.getURL(o).protocol||"")!==T&&this.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为:https 下面发送 http 的图片请求会失败。",e.ConsoleTypes.WARN)}[e.ReportTypes.IMAGE,e.ReportTypes.AJAX,e.ReportTypes.BEACON].includes(n)||this.setConfig({sendType:e.ReportTypes.AJAX});var b=c;if(!i.isNumber(c)||c<0?b=1024:c>5120&&(b=5120),this.options.maxStringLength=b,(!0===v||i.isObject(v)&&i.isEmptyObject(v))&&(this.options.autoTrackConfig.pageLeaveAutoTrack={heartbeat_interval_time:5e3,max_duration:432e3}),i.isArray(g)?(g=g.filter((function(t){return i.isString(t)}))).includes("hn-click")||g.push("hn-click"):g=["hn-click"],this.options.autoTrackConfig.trackAttr=g,i.isObject(d))if(!0===d.div)this.options.autoTrackConfig.collectTags.div={ignoreTags:u,maxLevel:1};else if(i.isObject(d.div)){var _=1,k=d.div;i.isNumber(k.maxLevel)&&[1,2,3].includes(k.maxLevel)&&(_=k.maxLevel),this.options.autoTrackConfig.collectTags.div={ignoreTags:u,maxLevel:_}}else this.options.autoTrackConfig.collectTags.div=!1;else this.options.autoTrackConfig.collectTags={div:!1};this.updateTrackTags(),(!0===a||i.isObject(a)&&!i.isEmptyObject(a))&&(this.options.batchSend=s({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},a),this.batchSender=new i.BatchSend(this.options,e.PlatformTypes.WEB,"hinasdk_tab","hinasdk_data_")),"auto"===y?this.autoTrack():("singlePage"===y||l)&&(this.autoTrack(),i.mitt.on("urlChange",(function(e){var r=e.fromHref;if(r!==e.toHref){if(i.isFunction(l)){var o=l();i.isObject(o)&&(e=s(s({},e),o))}t.autoTrack(s(s({},e),{H_referrer:r}))}})))},o.prototype.updateTrackTags=function(){var t=this.options.autoTrackConfig.collectTags,e=l([],c(p),!1);Object.keys(t||{}).forEach((function(r){var o=t[r];!0!==o&&!i.isObject(o)||e.includes(r)||e.push(r)})),this.trackTags=e},o.prototype.initAdvProps=function(){var t={},e=this.options,r=e.presetProperties,o=e.sourceChannel;Object.keys(r||{}).forEach((function(e){var o=r[e];if(e.includes("latest_")&&(e=e.slice(7),o)){var n=i.getCurrentDomain();if("utm"!==e&&"url解析失败"===n)t["H_latest_".concat(e)]="url的domain解析失败";else if(i.isReferralTraffic())switch(e){case"traffic_source_type":t.H_latest_traffic_source_type=i.SearchKeyword.getSourceFromReferrer();break;case"search_keyword":var s=i.SearchKeyword.getKeywordFromReferrer();s&&(t.H_latest_search_keyword=s);break;case"referrer":t.H_latest_referrer=i.getReferrer()}}}));var n=this.store.state.props||{},a={};r.latest_utm&&(a=i.getUmtsParams("H_latest_"));var c={};n.H_utm_source||(c=i.getUmtsParams("H_"));var l={},u={};if(i.isArray(o)&&o.length>0){var p=o.filter((function(t){return!i.utmTypes.includes(t)}));p.length>0&&(n["H_".concat(p[0])]||(u=i.getCustomUmtsParams("H_",p)),l=i.getCustomUmtsParams("H_latest_",p))}this.store.state.props=s(s(s(s(s(s({},this.store.state.props),t),a),l),u),c),this.store.setProps(this.store.state.props)},o.prototype.initPlugins=function(){var t=this,e=this.options,o=e.serverUrl,n=e.name,a=e.showLog,c=e.sendType,l=e.customHeaders,u=e.credentials,p=e.dataSendTimeout,h=e.batchSend,T=e.imgUseCrossOrigin,_=e.globalCallback,k=e.plugins,w=void 0===k?[]:k,C=e.performanceErrorConfig,S=e.autoTrackConfig,P=e.siteLinkerConfig,A=e.abTestingPluginConfig;w=w||[];var x=S.pageLeaveAutoTrack,R=new f(this.options,this),L=new g(this.options,this),O=new y(this.options,this),E=new m(this.options,this);if(this.plugins=[R,L,O,E],i.isObject(x)&&!i.isEmptyObject(x)){var H=new d(this.options,this);this.plugins.push(H)}var N=(P||{}).linker;if(i.isArray(N)&&N.length>0){var I=new v(this.options,this);this.plugins.push(I)}if(i.isObject(A)&&!i.isEmptyObject(A)){var j=new b(this.options,this);this.plugins.push(j)}if(w.forEach((function(e){var i=new e(t.options,t);t.plugins.push(i)})),i.isObject(C)&&!i.isEmptyObject(C)){var D=s({serverUrl:o,name:n,showLog:a,sendType:c,customHeaders:l,credentials:u,dataSendTimeout:p,batchSend:h,imgUseCrossOrigin:T,globalCallback:_},C);this.epmInstance=new r.Monitor(D,!0)}this.runPlugins(this.plugins)},o.prototype.use=function(t,r){var o=this,n=this.options,s=n.autoTrackConfig,a=n.siteLinkerConfig,c=n.abTestingPluginConfig,l=s.pageLeaveAutoTrack,u=function(t){var e=new t(o.options,o);o.plugins.push(e),e.init()};if(this.isReady){if(i.isObject(r))return"PageLeave"===t?i.isObject(l)&&!i.isEmptyObject(l)?this.log("PageLeave插件已运行,无需重复执行",e.ConsoleTypes.WARN):(this.options.autoTrackConfig.pageLeaveAutoTrack=r,u(d)):"SiteLinker"===t?i.isObject(a)&&!i.isEmptyObject(a)?this.log("SiteLinker插件已插件已运行,无需重复执行",e.ConsoleTypes.WARN):(this.options.siteLinkerConfig=r,u(v)):"HinaABTest"===t&&(i.isObject(c)&&!i.isEmptyObject(c)?this.log("HinaABTest插件已运行,无需重复执行",e.ConsoleTypes.WARN):(this.options.abTestingPluginConfig=r,u(b))),this.getPluginInstance(t);this.log("".concat(t,"插件配置项必须是一个对象类型"),e.ConsoleTypes.WARN)}else this.log("请先初始化埋点SDK",e.ConsoleTypes.WARN)},o.prototype.getPluginInstance=function(t){return this.plugins.find((function(e){return e.name===t}))},o.prototype.setConfig=function(t){this.options=i.merge(this.options,t),this.normalizeConfig()},o.prototype.getConfig=function(t){return t?this.options[t]:this.options},o.prototype.setUserUId=function(t,r){if(t=null!=t?t:"",i.isNumber(t)||i.isString(t))if(t=String(t).trim(),this.store.getAccountId()!==t){this.store.setAccountId(t);var o=this.getReportData("track_signup","H_SignUp",{});this.report(o,r),i.mitt.emit("changeAccountId")}else this.log("setUserUId: uid is equal to account_id, , failed to execute setUserUId",e.ConsoleTypes.WARN);else this.log("setUserUId: uid must be string or number",e.ConsoleTypes.WARN)},o.prototype.getUserUid=function(){return this.store.state.accountId},o.prototype.setDeviceUId=function(t){this.store.setDeviceId(t)},o.prototype.getDeviceUId=function(){return this.store.getDeviceId()},o.prototype.userSet=function(t,e){if(i.isObject(t)&&!i.isEmptyObject(t)){var r=this.getReportData("user_set","",t);this.report(r,e)}},o.prototype.userSetOnce=function(t,e){if(i.isObject(t)&&!i.isEmptyObject(t)){var r=this.getReportData("user_setOnce","",t);this.report(r,e)}},o.prototype.userAdd=function(t,r){var o,n=this;i.isString(t)&&((o={})[t]=1,t=o);if(i.isObject(t)&&!i.isEmptyObject(t)&&function(t){for(var i in t)if(!/-*\d+/.test(String(t[i])))return n.log("userAdd属性的值只能是数字",e.ConsoleTypes.WARN),!1;return!0}(t)){var s=this.getReportData("user_add","",t);this.report(s,r)}},o.prototype.userAppend=function(t,e){var r={};if(i.isObject(t)&&(Object.keys(t).forEach((function(e){var o=t[e];i.isArray(o)?r[e]=o:r[e]=[o]})),!i.isEmptyObject(r))){var o=this.getReportData("user_append","",r);this.report(o,e)}},o.prototype.userUnset=function(t,r){var o=this,n={};if(i.isString(t)&&(t=[t]),i.isArray(t)){if(t.forEach((function(t){i.isString(t)?n[t]=!0:o.log("userUnset参数数组里面的值必须时string,已经过滤掉".concat(t),e.ConsoleTypes.WARN)})),!i.isEmptyObject(n)){var s=this.getReportData("user_unset","",n);this.report(s,r)}}else this.log("userUnset参数必须是数组或字符串",e.ConsoleTypes.WARN)},o.prototype.userDelete=function(t){var e=this.getReportData("user_delete","",{});this.report(e,t),this.store.setAccountId("")},o.prototype.registerCommonProperties=function(t){this.presetProps=i.merge(this.presetProps,t)},o.prototype.getPresetProperties=function(){return{H_is_first_day:this.store.isFirstDay,H_is_first_time:this.store.isFirstTime,device_id:this.store.getDeviceId(),anonymous_id:this.store.getAnonymousId(),account_id:this.store.getAccountId(),properties:s(s(s({},this.presetProps),i.getPageProperties()),i.getBrowserInfo(T))}},o.prototype.clearPageRegister=function(t){var e=this;void 0===t&&(t=!0),!0===t?this.presetProps={}:i.isArray(t)&&t.forEach((function(t){t in e.presetProps&&delete e.presetProps[t]}))},o.prototype.checkReportProperties=function(t){var e=this,r=this.options.maxStringLength;Object.keys(t).forEach((function(o){var n=t[o];if(i.isString(n)&&n.length>r)e.log("属性 ".concat(o," 已经做截取")),t[o]=n.slice(0,r);else if(i.isObject(n))e.checkReportProperties(n);else if(i.isFunction(n))try{t[o]=n(t),i.isFunction(t[o])?(e.log("属性--".concat(o," 格式不满足要求, 已被删除")),delete t[o]):i.isObject(t[o])?e.checkReportProperties(t[o]):i.isString(t[o])&&t[o].length>r&&(t[o]=t[o].slice(0,r))}catch(i){e.log("属性--".concat(o," 格式不满足要求, 已被删除")),delete t[o]}}))},o.prototype.track=function(t,r,o){if(o=o||function(){},i.isString(t)){r=i.isObject(r)?r:{};var n=this.getReportData("track",t,r);this.report(n,o)}else this.log("track事件名必须是字符串,属性必须是是一个对象",e.ConsoleTypes.WARN)},o.prototype.quick=function(t,e,r){var o={};r=i.isFunction(r)?r:i.noop,i.isObject(e)?o=e:i.isFunction(e)&&(r=e),this.autoTrack(o,r)},o.prototype.autoTrack=function(t,e){void 0===t&&(t={}),void 0===e&&(e=i.noop);var r=this.getReportData("track","H_pageview",t);if(this.report(r,e),this.store.isSetFirstVisit){this.store.isSetFirstVisit=!1;var o=i.getReferrer();this.userSetOnce({H_first_referrer:o,H_first_referrer_host:o?i.getHostname(o,"取值异常"):"",H_first_traffic_source_type:i.SearchKeyword.getSourceFromReferrer(),H_first_search_keyword:i.SearchKeyword.getKeywordFromReferrer(),H_first_visit_time:i.nowStamp(),H_first_browser_language:i.isString(navigator.language)?navigator.language.toLowerCase():"取值异常"})}},o.prototype.report=function(t,r,o){var n,s,a=this.options,c=a.appJsBridge,l=a.serverUrl;if(this.log(t),c){var u=!0,p=null===window||void 0===window?void 0:window.Hina_Cloud_H5_Bridge;if(i.isObject(p)&&p.track)u=!1,p.track(t.event,t.type,JSON.stringify(t));else{var h=null===(s=null===(n=null===window||void 0===window?void 0:window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===s?void 0:s.hinaNativeTracker;if(null==h?void 0:h.postMessage){u=!1;var f=JSON.stringify({eventName:t.event,eventType:t.type,properties:t});h.postMessage(f)}}if(u)return void this.log("JSBridge 发送数据失败",e.ConsoleTypes.WARN);i.isFunction(r)&&r(l,t)}else this.sendReportData(t,r,o)},o.prototype.getReportData=function(t,e,r){var o=this.store.getAnonymousId(),n=this.store.getAccountId(),a=i.nowStamp(),c=this.getReportProperties(t,e),l=s(s({},c),r||{});this.checkReportProperties(l);var u={anonymous_id:o,type:t,event:e,time:a,_track_id:i.generatorTrackId(),properties:l};return n&&(u.account_id=n),u.send_time=i.nowStamp(),u},o.prototype.getReportProperties=function(t,e){void 0===t&&(t=""),void 0===e&&(e="");var r=i.merge(this.presetProps),o=s(s({device_id:this.store.getDeviceId()},this.store.state.props),r);return t&&"user"===t.slice(0,4)||(o=s(s(s({},o),i.getPageProperties()),i.getBrowserInfo(T))),"track"===t&&(o.H_is_first_day=this.store.isFirstDay,this.store.isFirstDay=!1,"H_pageview"===e&&(o.H_is_first_time=this.store.isFirstTime,this.store.isFirstTime=!1)),o},o}(t.WebClient);var k=new _({},!1);exports.HinaTrack=_,exports.default=k,Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
@@ -0,0 +1 @@
1
+ var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};function e(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var r,i,n,o,a,s,c=function(){return c=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},c.apply(this,arguments)};function u(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function p(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.LOG="log",t.INFO="info",t.WARN="warn",t.ERROR="error",t.ASSERT="assert"}(r||(r={})),function(t){t.BEACON="beacon",t.IMAGE="image",t.AJAX="ajax"}(i||(i={})),function(t){t.WEB="web",t.MINI_APP="mini_app"}(n||(n={})),function(t){t.JS_ERROR="JsError",t.RESOURCE_ERROR="ResourceError",t.FETCH_ERROR="FetchError",t.AJAX_ERROR="AjaxError",t.PROMISE_ERROR="PromiseError",t.WHITE_SCREEN_ERROR="WhiteScreenError",t.VUE_ERROR="VueError",t.REACT_ERROR="ReactError",t.CAPTURE_EVENT="CaptureEvent",t.CAPTURE_EXCEPTION="CaptureException"}(o||(o={})),function(t){t.BASIC="basic",t.VITALS="vitals",t.RESOURCE="resource",t.LONG_TASK="longtask"}(a||(a={})),function(t){t.INTEGER="INTEGER",t.STRING="STRING",t.BOOLEAN="BOOLEAN"}(s||(s={}));var d=function(t,e){this.options=t,this.context=e},f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var g={exports:{}};!function(t,e){!function(r,i){var n="function",o="undefined",a="object",s="string",c="major",u="model",l="name",p="type",d="vendor",f="version",h="architecture",g="console",v="mobile",m="tablet",_="smarttv",y="wearable",w="embedded",b="Amazon",S="Apple",k="ASUS",H="BlackBerry",x="Browser",T="Chrome",R="Firefox",E="Google",C="Huawei",A="LG",P="Microsoft",O="Motorola",L="Opera",I="Samsung",N="Sharp",D="Sony",U="Xiaomi",q="Zebra",j="Facebook",B="Chromium OS",M="Mac OS",W=" Browser",F=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},z=function(t,e){return typeof t===s&&-1!==V(e).indexOf(V(t))},V=function(t){return t.toLowerCase()},J=function(t,e){if(typeof t===s)return t=t.replace(/^\s\s*/,""),typeof e===o?t:t.substring(0,500)},K=function(t,e){for(var r,o,s,c,u,l,p=0;p<e.length&&!u;){var d=e[p],f=e[p+1];for(r=o=0;r<d.length&&!u&&d[r];)if(u=d[r++].exec(t))for(s=0;s<f.length;s++)l=u[++o],typeof(c=f[s])===a&&c.length>0?2===c.length?typeof c[1]==n?this[c[0]]=c[1].call(this,l):this[c[0]]=c[1]:3===c.length?typeof c[1]!==n||c[1].exec&&c[1].test?this[c[0]]=l?l.replace(c[1],c[2]):i:this[c[0]]=l?c[1].call(this,l,c[2]):i:4===c.length&&(this[c[0]]=l?c[3].call(this,l.replace(c[1],c[2])):i):this[c]=l||i;p+=2}},G=function(t,e){for(var r in e)if(typeof e[r]===a&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(z(e[r][n],t))return"?"===r?i:r}else if(z(e[r],t))return"?"===r?i:r;return e.hasOwnProperty("*")?e["*"]:t},$={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,f],[/opios[\/ ]+([\w\.]+)/i],[f,[l,L+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[l,L+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[l,L]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[l,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[l,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[l,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[l,"UC"+x]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[l,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[l,"Smart Lenovo "+x]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+x],f],[/\bfocus\/([\w\.]+)/i],[f,[l,R+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[l,L+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[l,L+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[l,"MIUI "+x]],[/fxios\/([-\w\.]+)/i],[f,[l,R]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360"+W]],[/\b(qq)\/([\w\.]+)/i],[[l,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1"+W],f],[/samsungbrowser\/([\w\.]+)/i],[f,[l,I+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],f],[/metasr[\/ ]?([\d\.]+)/i],[f,[l,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[l,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[l,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,j],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[l,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[l,T+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,T+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[l,"Android "+x]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[f,G,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],f],[/(wolvic)\/([\w\.]+)/i],[l,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[l,R+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[l,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,V]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",V]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,V]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[d,I],[p,m]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,I],[p,v]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[d,S],[p,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,S],[p,m]],[/(macintosh);/i],[u,[d,S]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,N],[p,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,C],[p,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,C],[p,v]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[u,/_/g," "],[d,U],[p,v]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,U],[p,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[d,"OPPO"],[p,v]],[/\b(opd2\d{3}a?) bui/i],[u,[d,"OPPO"],[p,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[p,v]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[u,[d,"Realme"],[p,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[d,O],[p,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,O],[p,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,A],[p,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,A],[p,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[p,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[p,v]],[/(pixel c)\b/i],[u,[d,E],[p,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,E],[p,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[d,D],[p,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,D],[p,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[p,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,b],[p,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,b],[p,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[p,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,H],[p,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,k],[p,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,k],[p,v]],[/(nexus 9)/i],[u,[d,"HTC"],[p,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[p,v]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[u,[d,"TCL"],[p,m]],[/(itel) ((\w+))/i],[[d,V],u,[p,G,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[p,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"Meizu"],[p,v]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[u,[d,"Ulefone"],[p,v]],[/droid.+; (a(?:015|06[35]|142p?))/i],[u,[d,"Nothing"],[p,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,u,[p,v]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,u,[p,m]],[/(surface duo)/i],[u,[d,P],[p,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[p,v]],[/(u304aa)/i],[u,[d,"AT&T"],[p,v]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[p,v]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[p,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[p,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[p,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[p,m]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[p,m]],[/\b(k88) b/i],[u,[d,"ZTE"],[p,m]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[p,v]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[p,v]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[p,m]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[p,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[p,m]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[p,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[p,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[p,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[p,v]],[/\b(ph-1) /i],[u,[d,"Essential"],[p,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[p,m]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[p,m]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[p,m]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[p,m]],[/(sprint) (\w+)/i],[d,u,[p,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,P],[p,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,q],[p,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,q],[p,v]],[/smart-tv.+(samsung)/i],[d,[p,_]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,I],[p,_]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,A],[p,_]],[/(apple) ?tv/i],[d,[u,S+" TV"],[p,_]],[/crkey/i],[[u,T+"cast"],[d,E],[p,_]],[/droid.+aft(\w+)( bui|\))/i],[u,[d,b],[p,_]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,N],[p,_]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,D],[p,_]],[/(mitv-\w{5}) bui/i],[u,[d,U],[p,_]],[/Hbbtv.*(technisat) (.*);/i],[d,u,[p,_]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[d,J],[u,J],[p,_]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[p,_]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[p,g]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[p,g]],[/(playstation [345portablevi]+)/i],[u,[d,D],[p,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,P],[p,g]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[u,[d,I],[p,y]],[/((pebble))app/i],[d,u,[p,y]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[d,S],[p,y]],[/droid.+; (glass) \d/i],[u,[d,E],[p,y]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,q],[p,y]],[/(quest( \d| pro)?)/i],[u,[d,j],[p,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[p,w]],[/(aeobc)\b/i],[u,[d,b],[p,w]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[u,[p,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[p,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[p,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[p,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[l,[f,G,$]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,G,$],[l,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,M],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,f],[/\(bb(10);/i],[f,[l,H]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[l,R+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[l,T+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,B],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,f],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,f]]},Z=function(t,e){if(typeof t===a&&(e=t,t=i),!(this instanceof Z))return new Z(t,e).getResult();var g=typeof r!==o&&r.navigator?r.navigator:i,_=t||(g&&g.userAgent?g.userAgent:""),y=g&&g.userAgentData?g.userAgentData:i,w=e?function(t,e){var r={};for(var i in t)e[i]&&e[i].length%2==0?r[i]=e[i].concat(t[i]):r[i]=t[i];return r}(X,e):X,b=g&&g.userAgent==_;return this.getBrowser=function(){var t={};return t[l]=i,t[f]=i,K.call(t,_,w.browser),t[c]=function(t){return typeof t===s?t.replace(/[^\d\.]/g,"").split(".")[0]:i}(t[f]),b&&g&&g.brave&&typeof g.brave.isBrave==n&&(t[l]="Brave"),t},this.getCPU=function(){var t={};return t[h]=i,K.call(t,_,w.cpu),t},this.getDevice=function(){var t={};return t[d]=i,t[u]=i,t[p]=i,K.call(t,_,w.device),b&&!t[p]&&y&&y.mobile&&(t[p]=v),b&&"Macintosh"==t[u]&&g&&typeof g.standalone!==o&&g.maxTouchPoints&&g.maxTouchPoints>2&&(t[u]="iPad",t[p]=m),t},this.getEngine=function(){var t={};return t[l]=i,t[f]=i,K.call(t,_,w.engine),t},this.getOS=function(){var t={};return t[l]=i,t[f]=i,K.call(t,_,w.os),b&&!t[l]&&y&&y.platform&&"Unknown"!=y.platform&&(t[l]=y.platform.replace(/chrome os/i,B).replace(/macos/i,M)),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return _},this.setUA=function(t){return _=typeof t===s&&t.length>500?J(t,500):t,this},this.setUA(_),this};Z.VERSION="1.0.39",Z.BROWSER=F([l,f,c]),Z.CPU=F([h]),Z.DEVICE=F([u,d,p,g,v,_,m,y,w]),Z.ENGINE=Z.OS=F([l,f]),t.exports&&(e=t.exports=Z),e.UAParser=Z;var Y=typeof r!==o&&(r.jQuery||r.Zepto);if(Y&&!Y.ua){var Q=new Z;Y.ua=Q.getResult(),Y.ua.get=function(){return Q.getUA()},Y.ua.set=function(t){Q.setUA(t);var e=Q.getResult();for(var r in e)Y.ua[r]=e[r]}}}("object"==typeof window?window:f)}(g,g.exports);var v=h(g.exports),m=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],_=["www.baidu.","m.baidu.","m.sm.cn","so.com","sogou.com","youdao.com","google.","yahoo.com/","bing.com/","ask.com/"],y=["weibo.com","renren.com","kaixin001.com","douban.com","qzone.qq.com","zhihu.com","tieba.baidu.com","weixin.qq.com"],w={baidu:["wd","word","kw","keyword"],google:"q",bing:"q",yahoo:"p",sogou:["query","keyword"],so:"q",sm:"q"},b="hinasdk_domain_test",S=Object.prototype.toString;function k(t){return"[object Object]"===S.call(t)}function H(t){return null!=t}function x(t){return Array.isArray(t)}function T(t){return"function"==typeof t}function R(t){return"string"==typeof t}function E(t){return"number"==typeof t}function C(t){return"boolean"==typeof t}function A(t){var e="";if(R(t))return t;if(null==t?void 0:t.stack)e=k(t.stack)?JSON.stringify(t.stack):t.stack;else{if(!t)return"未知js错误";e=k(t)?JSON.stringify(t):t.toString()}return e}function P(){}function O(t){try{return JSON.parse(t)}catch(t){}return t}function L(t){try{return JSON.stringify(t)}catch(e){return t}}function I(t){return 0===Object.keys(t).length}function N(){return Date.now&&T(Date.now)?Date.now():(new Date).getTime()}function D(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach((function(t){t&&Object.keys(t).forEach((function(e){var i=t[e];k(i)?k(r[e])?r[e]=D(r[e],i):r[e]=D(i):r[e]=i}))})),r}function U(t){return Object.keys(t).reduce((function(e,r){return H(t[r])&&""!==t[r]&&(e[r]=t[r]),e}),{})}function q(t){var e={};try{e=new URL(t)}catch(t){}return e}function j(t,e){if(void 0===e&&(e=3),!t)return t;var r=t.toString(),i=r.indexOf(".");return r=-1!==i?r.substring(0,i+e+1):r.substring(0),parseFloat(r)}function B(t){t=t||window.location.hostname,/^[a-zA-Z0-9\u4e00-\u9fa5\-\\.]+$/.exec(t)||(t="");var e=t.split(".");if(e.length>=2&&!/^(\d+\.)+\d+$/.test(t))for(var r=".".concat(e.splice(e.length-1,1));e.length>0;)if(r=".".concat(e.splice(e.length-1,1)).concat(r),document.cookie="".concat(b,"=true; path=/; domain=").concat(r),-1!==document.cookie.indexOf("".concat(b,"=true")))return document.cookie="".concat(b,"=true; path=/; domain=").concat(r,"; max-age=0"),r;return""}function M(){var t=B();return""===t?"url解析失败":t}function W(t){var e=t||document.referrer;return"string"!=typeof e?"referrer exception".concat(String(e)):(e.startsWith("https://www.baidu.com/")&&(e=e.split("?")[0]),"string"==typeof(e=e.slice(0,200))?e:"")}function F(t,e){return e&&"string"==typeof e||(e="hostname解析异常"),t&&(q(t).hostname||"")||e}function z(){var t=N(),e=Math.floor(1e6*Math.random());return"".concat(t,"_").concat(e)}function V(){var t=N(),e=Math.floor(1e6*Math.random());return Number(String(t).slice(-5)+String(e).slice(0,4))}function J(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return e>>>0}function K(t,e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),t=decodeURIComponent(t);var r=new RegExp("[\\?&]".concat(e,"=([^&#]*)")).exec(t);return null===r||r&&"string"!=typeof r[1]&&r[1].length?"":decodeURIComponent(r[1])}function G(t){try{return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x".concat(e)))})))}catch(e){return t}}function $(t,e,r,i){if(void 0!==t&&(e in t||i)){var n=r(t[e]);T(n)&&(t[e]=n)}}function X(t){if(!t)return"";var e=t.match(/\/([^/]+)$/);return e?e[1]:""}function Z(t){if(void 0===(null==t?void 0:t.stack)||!(null==t?void 0:t.stack))return[];for(var e,r=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,i=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,n=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,o=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,a=t.stack.split("\n"),s=[],c=0;c<a.length;c++){var u=a[c];(e=r.exec(u))||(e=i.exec(u))?s.push({source:e[2],filename:X(e[2]),lineno:e[3]?+e[3]:null,colno:e[4]?+e[4]:null}):(e=n.exec(u))?s.push({source:e[3],filename:X(e[3]),lineno:e[4]?+e[4]:null,colno:e[5]?+e[5]:null}):(e=o.exec(u))&&s.push({source:e[5],filename:X(e[5]),lineno:e[1]?+e[1]:null,colno:e[2]?+e[2]:null})}return s.length>0?[s[0]]:s}var Y=function(t,e){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Y(t,e)};function Q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Y(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function tt(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;var et=function(){function t(){this.name="CookieStorage"}return t.prototype.isSupport=function(t,e){var r=this;return void 0===t&&(t="cookie_support_test"),void 0===e&&(e="1"),navigator.cookieEnabled&&(r.set(t,e),r.get(t)===e&&(r.remove(t),!0))},t.prototype.get=function(t){var e,r,i=document.cookie.split(";");try{for(var n=tt(i),o=n.next();!o.done;o=n.next()){var a=o.value.split("=");if(a[0].trim()===t)return decodeURIComponent(a[1])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return null},t.prototype.set=function(t,e,r,i,n,o,a){i=i||"/",t=t.trim(),e=e.trim();var s="".concat(t,"=").concat(encodeURIComponent(e),"; path=").concat(i,";");r=H(r)?r:63072e8,s+=" max-age=".concat(r,";"),a&&(s+=" secure;"),n&&(s+=" domain=".concat(n,";")),["Strict","Lax","None"].includes(o)&&(s+=" SameSite=".concat(o,";")),document.cookie=s},t.prototype.remove=function(t,e){void 0===e&&(e="/"),this.set(t,"1",0,e)},t.prototype.setDomain=function(t,e,r){var i=M();"url解析失败"===i&&(i=""),this.set(t,e,r,"/",i)},t}(),rt=function(){function t(){this.name="LocalStorage"}return t.prototype.isSupport=function(){var t=!0;try{var e="__localStorageSupport__",r="testIsSupportStorage";this.set(e,r),this.get(e)!==r&&(t=!1),this.remove(e)}catch(e){t=!1}return t},t.prototype.key=function(t){return window.localStorage.key(t)},t.prototype.get=function(t){return window.localStorage.getItem(t)},t.prototype.length=function(){return window.localStorage.length},t.prototype.set=function(t,e){try{window.localStorage.setItem(t,e)}catch(t){}},t.prototype.remove=function(t){window.localStorage.removeItem(t)},t.prototype.parse=function(t){var e=this.get(t);try{e=JSON.parse(e)}catch(t){e=""}return e},t}(),it=function(){function t(){this.name="MemoryStorage",this.data={}}return t.prototype.get=function(t){var e=this.data[t];return H(null==e?void 0:e.expireTime)?e.expireTime<N()?null:e.value:null==e?void 0:e.value},t.prototype.set=function(t,e,r){if(H(r)){var i=N()+1e3*r;this.data[t]={value:e,expireTime:i}}this.data[t]={value:e}},t.prototype.setDomain=function(t,e,r){this.set(t,e,r)},t}(),nt=new v;function ot(t){var e=nt.getResult(),r=e.browser,i=e.device,n=e.os,o=e.ua,a={H_timezone_offset:(new Date).getTimezoneOffset(),H_viewport_width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0,H_viewport_height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0,H_screen_width:window.screen.width,H_screen_height:window.screen.height,H_lib_version:t,H_lib:"js",H_lib_method:"code",H_browser:r.name.toLowerCase(),H_browser_version:r.version,H_os:n.name,H_os_version:n.version,H_browser_user_agent:o,H_language:R(navigator.language)?navigator.language.toLowerCase():"取值异常",H_network_type:st()};return"mobile"===i.type?a.H_model=i.vendor?i.model:"UnknownPhone":a.H_model=i.model,a}function at(){return document.documentElement.scrollTop||document.body.scrollTop||0}function st(){if(void 0===navigator.connection)return"unknown";var t=navigator.connection;return t.effectiveType?t.effectiveType:t.type?t.type:"取值异常"}var ct=function(){function t(t){this.visibleHandler=function(){},this.hiddenHandler=function(){};var e=t.visible,r=t.hidden;T(e)&&(this.visibleHandler=e),T(r)&&(this.hiddenHandler=r),this.init()}return t.prototype.isSupport=function(){return void 0!==document.hidden},t.prototype.init=function(){var t=this;this.isSupport()?document.addEventListener("visibilitychange",(function(){document.hidden?t.hiddenHandler():t.visibleHandler()})):(window.addEventListener("focus",this.visibleHandler),window.addEventListener("blur",this.hiddenHandler))},t}();function ut(){return"undefined"!=typeof console}function lt(t){return 1===(null==t?void 0:t.nodeType)}function pt(t,e){var r;if("input"===(null===(r=t.tagName)||void 0===r?void 0:r.toLowerCase()))return(["button","submit"].includes(t.type)||e)&&t.value||"";var i="";return t.textContent?i=t.textContent.trim():t.innerText&&(i=t.innerText.trim()),i&&(i=i.replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)),i||""}function dt(){var t=W(),e=M(),r=Math.round(at());return U({H_referrer:t,H_referrer_host:t?F(t):"",H_url:window.location.href,H_url_host:F(window.location.href,"url_host取值异常"),H_url_domain:e,H_url_path:window.location.pathname,H_url_hash:window.location.hash,H_title:document.title,H_viewport_position:r})}function ft(t,e){if(!t)return{};var r=document.documentElement.scrollLeft||document.body.scrollLeft||0,i=at(),n=e.getBoundingClientRect(),o=t.pageX||t.clientX+r||t.offsetX+((null==n?void 0:n.left)||0)+r,a=t.pageY||t.clientY+i||t.offsetY+((null==n?void 0:n.top)||0)+i;return{H_page_x:j(o,3),H_page_y:j(a,3)}}var ht=function(){function t(){}return t.getSourceFromReferrer=function(){var t=function(t,e){for(var r=0;r<t.length;r++)if(-1!==e.split("?")[0].indexOf(t[r]))return!0},e="(".concat(m.join("|"),")\\=[^&]+"),r=document.referrer||"",i=window.location.href;if(i){var n=i.match(new RegExp(e));return n&&n[0]?"付费广告流量":t(_,r)?"自然搜索流量":t(y,r)?"社交网站流量":""===r?"直接流量":"引荐流量"}return"获取url异常"},t.getReferSearchEngine=function(t){var e,r,i=F(t);if(!i||"hostname解析异常"===i)return"";var n={baidu:[/^.*\.baidu\.com$/],bing:[/^.*\.bing\.com$/],google:[/^www\.google\.com$/,/^www\.google\.com\.[a-z]{2}$/,/^www\.google\.[a-z]{2}$/],sm:[/^m\.sm\.cn$/],so:[/^.+\.so\.com$/],sogou:[/^.*\.sogou\.com$/],yahoo:[/^.*\.yahoo\.com$/]};for(var o in n){var a=n[o];try{for(var s=(e=void 0,tt(a)),c=s.next();!c.done;c=s.next())if(c.value.test(i))return o}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}}return"未知搜索引擎"},t.getKeywordFromReferrer=function(){var t=document.referrer||"";if(0===t.indexOf("http")){var e=this.getReferSearchEngine(t),r=function(t){t=t||"";var e={};return new URLSearchParams(t).forEach((function(t,r){e[r]=t})),e}(q(t).search);if(I(r))return"未取到值";for(var i in w){var n=w[i];if(i===e)if(x(n))for(var o=0;o<n.length;o++){var a=r[n[o]];if(a)return a}else if(r[n])return r[n]}return"未取到值"}return""===t?"未取到值_直接打开":"未取到值_非http的url"},t}();function gt(t){void 0===t&&(t="");var e=function(){var t={};return m.forEach((function(e){var r=K(window.location.href,e);r.length&&(t[e]=r)})),t}(),r={};return Object.keys(e).forEach((function(i){r[t+i]=e[i]})),r}function vt(t,e){void 0===t&&(t=""),void 0===e&&(e=[]);var r={};return e.forEach((function(e){var i=K(window.location.href,e);i&&(r[e]=i,r["".concat(t).concat(e)]=i)})),r}var mt=function(t){this.options=t},_t=function(t){function e(e){var r=t.call(this,e)||this;return r.options=e,r}return Q(e,t),e.prototype.run=function(){var t=this;return new Promise((function(e){var r=t.options,i=r.imgUseCrossOrigin,n=r.url,o=r.data,a=new Image;i&&(a.crossOrigin="anonymous");var s=-1===n.indexOf("?")?"?":"&";a.src="".concat(n).concat(s).concat(o);var c=function(t){a=null,e({type:t})};a.onload=function(){c("success")},a.onerror=function(){c("success")}}))},e}(mt),yt=function(t){function e(e){var r=t.call(this,e)||this;return r.options=e,r}return Q(e,t),e.prototype.run=function(){var t=this;return new Promise((function(e){var r=t.options,i=r.url,n=r.data,o=r.timeout,a=r.credentials,s=r.contentType,c=r.customHeaders,u=void 0===c?{}:c,l=new XMLHttpRequest;l.open("POST",i,!0),l.timeout=o||2e4,l.isMonitor=!0,a&&(l.withCredentials=!0),l.setRequestHeader("Content-Type",s||"application/x-www-form-urlencoded"),k(u)&&!I(u)&&Object.keys(u).forEach((function(t){l.setRequestHeader(t,u[t])})),l.send(n||null),l.ontimeout=function(){l.abort()},l.onreadystatechange=function(){4===l.readyState&&(l.status>=200&&l.status<300||304===l.status?e({data:JSON.parse(l.responseText)||{},type:"success"}):e({type:"fail",msg:"网络异常, 请求失败,状态码=".concat(l.status)}))}}))},e}(mt),wt=function(t){function e(e){var r=t.call(this,e)||this;return r.options=e,r}return Q(e,t),e.prototype.run=function(){var t=this;return new Promise((function(e){var r=t.options,i=r.url,n=r.data;navigator.sendBeacon&&e(navigator.sendBeacon(i,n)?{type:"success"}:{type:"fail",msg:"sendBeacon 请求失败"})}))},e}(mt);var bt=function(t){return{all:t=t||new Map,on:function(e,r){var i=t.get(e);i?i.push(r):t.set(e,[r])},emit:function(e,r){var i=t.get(e);i&&i.forEach((function(t){t(r)}))},off:function(e,r){var i=t.get(e);if(i)if(r){var n=i.indexOf(r);n>=0&&i.splice(n,1)}else t.set(e,[])}}}();function St(t,e){void 0===e&&(e=r.LOG);var i=console[e]||console.log;"function"==typeof i&&i(t)}var kt=function(){function t(t){this.options=t,this.storeName="hinasdk_crossdata",this.state=this.getDefaultState(),this.isFirstTime=!1,this.isFirstDay=!1,this.isSetFirstVisit=!0}return t.prototype.getDefaultState=function(){return{accountId:null,deviceId:null,anonymousId:null,sessionId:null,firstVisitTime:N(),props:{}}},t.prototype.log=function(t,e){void 0===e&&(e=r.LOG);var i=this.options.showLog;ut()&&i&&St(t,e)},t.prototype.init=function(){var t,e=new et,i=new it,n=new rt;e.isSupport()?this.storage=e:(this.log("Cookie storage is not supported, SDK internal cache has been enabled",r.WARN),this.storage=i),n.isSupport()?this.localStorage=n:this.log("localStorage is not supported, SDK internal cache has been enabled",r.WARN),!(t=this.storage.get(this.storeName))&&this.localStorage&&(t=this.localStorage.get(this.storeName)),t&&function(t){try{JSON.parse(t)}catch(t){return!1}return!0}(t)&&(this.state=O(t)),t?(this.isSetFirstVisit=!1,this.save()):(this.isFirstDay=!0,this.isFirstTime=!0);var o=function(){var t=function(){for(var t=N(),e=0;t===N();)e++;return t.toString(16)+e.toString(16)},e=String(window.screen.height*window.screen.width);e=e&&/\d{5,}/.test(e)?e.toString(16):String(31242*Math.random()).replace(".","").slice(0,8);var r="".concat(t(),"-").concat(Math.random().toString(16).replace(".",""),"-").concat(function(){var t,e,r=navigator.userAgent,i=[],n=0;function o(t,e){var r,n=0;for(r=0;r<e.length;r++)n|=i[r]<<8*r;return t^n}for(t=0;t<r.length;t++)e=r.charCodeAt(t),i.unshift(255&e),i.length>=4&&(n=o(n,i),i=[]);return i.length>0&&(n=o(n,i)),n.toString(16)}(),"-").concat(e,"-").concat(t());return r||(String(Math.random())+String(Math.random())+String(Math.random())).slice(2,15)}();this.getAnonymousId()||this.setAnonymousId(o),this.getDeviceId()||this.setDeviceId(o)},t.prototype.clear=function(){this.state={},this.save()},t.prototype.save=function(){this.storage.setDomain(this.storeName,JSON.stringify(this.state)),this.localStorage&&this.localStorage.set(this.storeName,JSON.stringify(this.state))},t.prototype.set=function(t,e){this.state[t]=e,this.save()},t.prototype.checkSetValue=function(t,e){return!(!E(e=null!=e?e:"")&&!R(e)&&(this.log("".concat(t,": id must be string or number"),r.WARN),1))},t.prototype.setDeviceId=function(t){void 0===t&&(t=""),this.checkSetValue("deviceId",t)&&this.set("deviceId",t)},t.prototype.setAccountId=function(t){void 0===t&&(t=""),this.checkSetValue("accountId",t)&&this.set("accountId",t)},t.prototype.setAnonymousId=function(t){this.state.anonymousId?this.log("Current anonymousId is ".concat(this.getAnonymousId(),", it has been set"),r.WARN):this.checkSetValue("anonymousId",t)&&this.set("anonymousId",t)},t.prototype.setSessionId=function(t){this.set("sessionId",t)},t.prototype.setProps=function(t){var e=D(this.state.props||{},t);for(var r in e)"string"==typeof e[r]&&(e[r]=e[r].slice(0,200));this.set("props",e)},t.prototype.getAnonymousId=function(){return this.state.anonymousId},t.prototype.getDeviceId=function(){return this.state.deviceId},t.prototype.getAccountId=function(){return this.state.accountId},t.prototype.getSessionId=function(){return this.state.sessionId||""},t.prototype.getSessionIdCreateTime=function(){var t=this.getSessionId().split("_")[0],e=Number(t);return Number.isNaN(e)?0:e},t.prototype.getCookie=function(){return this.storage.get(this.storeName)},t}(),Ht=function(){function t(t,e,r,i){void 0===r&&(r="hinasdk_tab"),void 0===i&&(i="hinasdk_data_"),this.options=t,this.platform=e,this.batchKey=r,this.batchDataKey=i,this.init()}return t.prototype.log=function(t,e){void 0===e&&(e=r.LOG);var i=this.options.showLog;ut()&&i&&St(t,e)},t.prototype.init=function(){var t=new rt;t.isSupport()?(this.localStorage=t,this.isSupport=!0):(this.isSupport=!1,this.log("批量发送功能需要使用localstorage存储数据,但是您的浏览器不支持localstorage,所以不能使用该功能",r.WARN)),this.batchInterval()},t.prototype.getBatchConfig=function(){return this.options.batchSend},t.prototype.getStorageList=function(){if(!this.isSupport)return[];var t=[],e=this.localStorage.get(this.batchKey);return e&&(x(t=O(e))||(t=[])),t},t.prototype.batchInterval=function(){var t=this;if(this.isSupport){var e=this.getBatchConfig().sendInterval;setTimeout((function(){t.send().then((function(){t.batchInterval()}))}),e)}},t.prototype.send=function(){var t=this;return new Promise((function(e){var r=t.getStorageList();if(r.length>0&&t.isSupport){for(var i=t.getBatchConfig(),n=i.storageLimit,o=i.dataSendTimeout,a=N(),s=[],c={},u=r.length,l=0;l<u;l++){var p=r[l],d=p.dataKey,f=p.expireTime;f>=a?(c[d]={dataKey:d,expireTime:f},(w=t.localStorage.get(d))&&s.push(O(w))):(t.localStorage.remove(d),r.splice(l,1),u--,l--)}if(t.localStorage.set(t.batchKey,JSON.stringify(r)),(s=s.filter(Boolean)).length>n&&(s=s.slice(0,n)),0===s.length)e();else{var h=t.options,g=h.serverUrl,v=h.customHeaders,m=h.credentials,_=h.globalCallback,y=JSON.stringify(s),w=encodeURIComponent(G(y));new yt({url:g,data:"data_list=".concat(w),timeout:o,credentials:m,customHeaders:v}).run().then((function(r){T(_)&&_(g,s,r.type,r.msg||""),"success"===r.type&&t.remove(c),e()}))}}else e()}))},t.prototype.remove=function(t){var e=this;if(this.isSupport){var r=this.getStorageList(),i=Object.keys(t);if(i.forEach((function(t){e.localStorage.remove(t)})),r.length===i.length)this.localStorage.set(this.batchKey,JSON.stringify([]));else{var n=r.filter((function(e){return!t[e.dataKey]}));this.localStorage.set(this.batchKey,JSON.stringify(n))}}},t.prototype.add=function(t){if(this.isSupport){var e=this.getBatchConfig(),r=e.sendInterval,i=e.storageLimit,n=this.batchDataKey+z(),o=this.getStorageList();o.unshift({dataKey:n,expireTime:N()+2*r}),this.localStorage.set(this.batchKey,JSON.stringify(o)),this.localStorage.set(n,JSON.stringify(t)),(o.length>i||"track_signup"===t.type||"H_pageview"===t.event)&&this.send()}},t}(),xt=function(){function t(t,e){void 0===e&&(e=!0),this.isReady=!1,this.consolePrefix="",this.useInstancing=!0,this.plugins=[],this.options=t,this.useInstancing=e}return t.prototype.log=function(t,e){void 0===e&&(e=r.LOG);var i=this.options.showLog;ut()&&i&&("string"==typeof t&&this.consolePrefix&&(t="".concat(this.consolePrefix,":").concat(t)),St(t,e))},t.prototype.runPlugins=function(t){for(var e=this,r=function(r){var i=t[r];i.init((function(t){if(i.transform){var r=i.transform(t);r&&e.report(r)}}))},i=0;i<t.length;i++)r(i)},t.prototype.applyPlugins=function(t){var e=this;if(this.isReady){x(t)||(t=[t]);var i=[];t.forEach((function(t){var r=new t(e.options,e);e.plugins.push(r),i.push(r)})),this.runPlugins(i)}else this.log("请先初始化SDK实例",r.WARN)},t}(),Tt=function(t,e){return Tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},Tt(t,e)};"function"==typeof SuppressedError&&SuppressedError;var Rt,Et,Ct,At,Pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Tt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.sendReportData=function(t,e,n){var o=this.options,a=o.batchSend,s=o.globalCallback,c=o.serverUrl,u=o.dataSendTimeout,l=o.sendType,p=o.customHeaders,d=o.credentials,f=o.imgUseCrossOrigin;if(l=n||l,c){if(k(t)&&!I(t))if(a)this.batchSender.add(t);else{var h=t;R(t)||(h=L(t));var g=G(h),v={data:"data=".concat(encodeURIComponent(g)),url:c,timeout:u,imgUseCrossOrigin:f,customHeaders:p,credentials:d};(l===i.BEACON&&navigator.sendBeacon?new wt(v):l===i.IMAGE&&v.data.length<2048?new _t(v):new yt(v)).run().then((function(r){return T(s)&&s(c,t,r.type,r.msg||""),T(e)&&e(c,t,r.type,r.msg||""),r}))}}else this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",r.WARN)},e}(xt),Ot=-1,Lt=function(t){addEventListener("pageshow",(function(e){e.persisted&&(Ot=e.timeStamp,t(e))}),!0)},It=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Nt=function(){var t=It();return t&&t.activationStart||0},Dt=function(t,e){var r=It(),i="navigate";return Ot>=0?i="back-forward-cache":r&&(document.prerendering||Nt()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-"))),{name:t,value:void 0===e?-1:e,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Ut=function(t,e,r){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var i=new PerformanceObserver((function(t){Promise.resolve().then((function(){e(t.getEntries())}))}));return i.observe(Object.assign({type:t,buffered:!0},r||{})),i}}catch(t){}},qt=function(t,e,r,i){var n,o;return function(a){e.value>=0&&(a||i)&&((o=e.value-(n||0))||void 0===n)&&(n=e.value,e.delta=o,e.rating=function(t,e){return t>e[1]?"poor":t>e[0]?"needs-improvement":"good"}(e.value,r),t(e))}},jt=function(t){requestAnimationFrame((function(){return requestAnimationFrame((function(){return t()}))}))},Bt=function(t){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&t()}))},Mt=function(t){var e=!1;return function(){e||(t(),e=!0)}},Wt=-1,Ft=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},zt=function(t){"hidden"===document.visibilityState&&Wt>-1&&(Wt="visibilitychange"===t.type?t.timeStamp:0,Jt())},Vt=function(){addEventListener("visibilitychange",zt,!0),addEventListener("prerenderingchange",zt,!0)},Jt=function(){removeEventListener("visibilitychange",zt,!0),removeEventListener("prerenderingchange",zt,!0)},Kt=function(){return Wt<0&&(Wt=Ft(),Vt(),Lt((function(){setTimeout((function(){Wt=Ft(),Vt()}),0)}))),{get firstHiddenTime(){return Wt}}},Gt=function(t){document.prerendering?addEventListener("prerenderingchange",(function(){return t()}),!0):t()},$t=[1800,3e3],Xt=function(t,e){e=e||{},Gt((function(){var r,i=Kt(),n=Dt("FCP"),o=Ut("paint",(function(t){t.forEach((function(t){"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<i.firstHiddenTime&&(n.value=Math.max(t.startTime-Nt(),0),n.entries.push(t),r(!0)))}))}));o&&(r=qt(t,n,$t,e.reportAllChanges),Lt((function(i){n=Dt("FCP"),r=qt(t,n,$t,e.reportAllChanges),jt((function(){n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},Zt=[.1,.25],Yt=[2500,4e3],Qt={},te=function(t,e){e=e||{},Gt((function(){var r,i=Kt(),n=Dt("LCP"),o=function(t){e.reportAllChanges||(t=t.slice(-1)),t.forEach((function(t){t.startTime<i.firstHiddenTime&&(n.value=Math.max(t.startTime-Nt(),0),n.entries=[t],r())}))},a=Ut("largest-contentful-paint",o);if(a){r=qt(t,n,Yt,e.reportAllChanges);var s=Mt((function(){Qt[n.id]||(o(a.takeRecords()),a.disconnect(),Qt[n.id]=!0,r(!0))}));["keydown","click"].forEach((function(t){addEventListener(t,(function(){return function(t){var e=self.requestIdleCallback||self.setTimeout,r=-1;return t=Mt(t),"hidden"===document.visibilityState?t():(r=e(t),Bt(t)),r}(s)}),!0)})),Bt(s),Lt((function(i){n=Dt("LCP"),r=qt(t,n,Yt,e.reportAllChanges),jt((function(){n.value=performance.now()-i.timeStamp,Qt[n.id]=!0,r(!0)}))}))}}))},ee=[800,1800],re=function t(e){document.prerendering?Gt((function(){return t(e)})):"complete"!==document.readyState?addEventListener("load",(function(){return t(e)}),!0):setTimeout(e,0)},ie=function(t,e){e=e||{};var r=Dt("TTFB"),i=qt(t,r,ee,e.reportAllChanges);re((function(){var n=It();n&&(r.value=Math.max(n.responseStart-Nt(),0),r.entries=[n],i(!0),Lt((function(){r=Dt("TTFB",0),(i=qt(t,r,ee,e.reportAllChanges))(!0)})))}))},ne={passive:!0,capture:!0},oe=new Date,ae=function(t,e){Rt||(Rt=e,Et=t,Ct=new Date,ue(removeEventListener),se())},se=function(){if(Et>=0&&Et<Ct-oe){var t={entryType:"first-input",name:Rt.type,target:Rt.target,cancelable:Rt.cancelable,startTime:Rt.timeStamp,processingStart:Rt.timeStamp+Et};At.forEach((function(e){e(t)})),At=[]}},ce=function(t){if(t.cancelable){var e=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,e){var r=function(){ae(t,e),n()},i=function(){n()},n=function(){removeEventListener("pointerup",r,ne),removeEventListener("pointercancel",i,ne)};addEventListener("pointerup",r,ne),addEventListener("pointercancel",i,ne)}(e,t):ae(e,t)}},ue=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach((function(e){return t(e,ce,ne)}))},le=[100,300],pe=function(t,e){e=e||{},Gt((function(){var r,i=Kt(),n=Dt("FID"),o=function(t){t.startTime<i.firstHiddenTime&&(n.value=t.processingStart-t.startTime,n.entries.push(t),r(!0))},a=function(t){t.forEach(o)},s=Ut("first-input",a);r=qt(t,n,le,e.reportAllChanges),s&&(Bt(Mt((function(){a(s.takeRecords()),s.disconnect()}))),Lt((function(){var i;n=Dt("FID"),r=qt(t,n,le,e.reportAllChanges),At=[],Et=-1,Rt=null,ue(addEventListener),i=o,At.push(i),se()})))}))},de=function(t,e){return de=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},de(t,e)};function fe(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}de(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var he=function(){return he=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},he.apply(this,arguments)};function ge(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function ve(t,e,r){if(2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var me=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="JsErrorPlugin",i.isReady=!1,i}return fe(e,t),e.prototype.init=function(t){this.isReady||(this.isReady=!0,window.onerror=function(e,r,i,n,a){if("ResizeObserver loop limit exceeded"!==e.toString()){var s=A(a);t({H_js_error_id:J(s),H_error_category:o.JS_ERROR,H_error_type:a.name||o.JS_ERROR,H_error_message:a.message,H_error_stack:JSON.stringify({details:Z(a),errorStack:s})})}})},e.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},e}(d),_e=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="DomErrorPlugin",i.isReady=!1,i}return fe(e,t),e.prototype.init=function(t){this.isReady||(this.isReady=!0,window.addEventListener("error",(function(e){if(e.target!==window){var r=e.target,i=r.src||r.href,n=function(t){var e=t.tagName.toLowerCase(),r=t.getAttributeNames(),i="";return r.forEach((function(e){i+=" ".concat(e,"='").concat(t.getAttribute(e),"'")})),"<".concat(e).concat(i,">")}(r);t({H_js_error_id:J(n),H_error_category:o.RESOURCE_ERROR,H_error_type:o.RESOURCE_ERROR,H_error_message:n,H_source_element:n,H_source_src:i})}}),!0))},e.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},e}(d);var ye=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="PerformancePlugin",i.isReady=!1,i}return fe(e,t),e.prototype.init=function(t){if(!this.isReady){this.isReady=!0;var e=this.options.performanceOff;e.includes(a.VITALS)||Promise.all([new Promise((function(t){te((function(e){t(e.value)}))})),new Promise((function(t){pe((function(e){t(e.value)}))})),new Promise((function(t){!function(t,e){e=e||{},Xt(Mt((function(){var r,i=Dt("CLS",0),n=0,o=[],a=function(t){t.forEach((function(t){if(!t.hadRecentInput){var e=o[0],r=o[o.length-1];n&&t.startTime-r.startTime<1e3&&t.startTime-e.startTime<5e3?(n+=t.value,o.push(t)):(n=t.value,o=[t])}})),n>i.value&&(i.value=n,i.entries=o,r())},s=Ut("layout-shift",a);s&&(r=qt(t,i,Zt,e.reportAllChanges),Bt((function(){a(s.takeRecords()),r(!0)})),Lt((function(){n=0,i=Dt("CLS",0),r=qt(t,i,Zt,e.reportAllChanges),jt((function(){return r()}))})),setTimeout(r,0))})))}((function(e){t(e.value)}),{reportAllChanges:!0})})),new Promise((function(t){ie((function(e){t(e.value)}))})),new Promise((function(t){Xt((function(e){t(e.value)}))})),new Promise((function(t){"PerformanceObserver"in window?new PerformanceObserver((function(e){var r,i,n=e.getEntries();try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(n),a=o.next();!a.done;a=o.next()){var s=a.value;"first-paint"===s.name&&t(s.startTime)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}})).observe({entryTypes:["paint"]}):t(0)}))]).then((function(t){var e=ge(t,6),r=e[0],i=e[1],n=e[2],o=e[3],a=e[4];return{H_first_paint_time:j(e[5]),H_first_contentful_paint_time:j(a),H_largest_contentful_paint_time:j(r),H_time_to_first_byte:j(o),H_first_input_delay:j(i),H_cumulative_layout_shift:j(n)}})).then((function(e){t(he({event:"H_performance_page",H_category:a.VITALS},e))})),e.includes(a.LONG_TASK)||function(t){if("PerformanceObserver"in window){var e=new PerformanceObserver((function(e){var r=e.getEntries(),i=0,n=[];r.forEach((function(t){var e=t.duration,r=t.name,o=t.startTime;i+=e,n.push({duration:j(e),startTime:j(o),name:r})})),t({H_long_task_time:j(i),H_long_task:r.length,H_long_task_list:n})}));e.observe({entryTypes:["longtask"]})}}((function(e){t(he({event:"H_performance_page",H_category:a.LONG_TASK,H_url:window.location.href},e))})),window.addEventListener("load",(function(){e.includes(a.BASIC)||t(he({event:"H_performance_loading",H_category:a.BASIC},function(){if(void 0!==window.performance&&"function"==typeof window.performance.getEntriesByType){var t=performance.getEntriesByType("navigation")[0],e=t.startTime,r=t.redirectStart,i=t.redirectEnd,n=t.fetchStart,o=t.domainLookupStart,a=t.domainLookupEnd,s=t.connectStart,c=t.secureConnectionStart,u=t.connectEnd,l=t.requestStart,p=t.responseStart,d=t.responseEnd,f=t.domInteractive,h=t.domContentLoadedEventEnd,g=t.loadEventStart,v=t.loadEventEnd,m=t.redirectCount,_=t.duration,y=t.unloadEventEnd,w=t.unloadEventStart;return{H_first_byte_time:j(p-e),H_unload_time:j(y-w),H_redirect_time:j(i-r),H_redirect_count:m,H_cache_check_time:j(o-n),H_dns_time:j(a-o),H_tcp_time:j(u-s),H_ssl_time:j(u-c),H_first_byte_response_time:j(p-r),H_dom_ready_time:j(h-n),H_request_time:j(p-l),H_content_transfer_time:j(d-p),H_dom_parsing_time:j(f-d),H_page_load_time:j(v-e),H_resource_load_time:j(g-h),H_resource_duration:_,H_load_event_time:j(v-g)}}var b=performance.timing,S=b.navigationStart,k=b.responseStart,H=b.unloadEventEnd,x=b.unloadEventStart,T=b.requestStart,R=b.responseEnd,E=b.redirectStart,C=b.redirectEnd,A=b.domainLookupStart,P=b.fetchStart,O=b.domainLookupEnd,L=b.connectStart,I=b.connectEnd,N=b.secureConnectionStart,D=b.domContentLoadedEventEnd,U=b.domInteractive,q=b.loadEventStart,B=b.loadEventEnd;return{H_first_byte_time:j(k-S),H_unload_time:j(H-x),H_redirect_time:j(C-E),H_cache_check_time:j(A-P),H_dns_time:j(O-A),H_tcp_time:j(I-L),H_ssl_time:j(I-N),H_first_byte_response_time:j(k-E),H_dom_ready_time:j(D-P),H_request_time:j(k-T),H_content_transfer_time:j(R-k),H_dom_parsing_time:j(U-R),H_page_load_time:j(B-S),H_resource_load_time:j(q-D),H_load_event_time:j(B-q)}}()))}))}},e.prototype.transform=function(t){return this.context.getReportData(t.event,t)},e}(d),we=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="FetchPlugin",i.isReady=!1,i}return fe(e,t),e.prototype.init=function(t){if(window.fetch&&!this.isReady){this.isReady=!0;var e=this;$(window,"fetch",(function(r){return function(i,n){void 0===n&&(n={});var a=N(),s=n||{},c=s.headers,u=s.signal,l=s.method;return r(i,n).then((function(r){if(!r.ok){var s=he(he({},e.context.getRequestHeaders()),c||{}),u=N();r.clone().text().then((function(e){t({H_js_error_id:J("url=".concat(i,"&method=").concat(l)),H_error_category:o.FETCH_ERROR,H_error_type:o.FETCH_ERROR,H_error_message:i,H_request_url:i,H_request_headers:L(s),H_request_method:n.method.toLowerCase(),H_request_params:R(n.body)?n.body:"",H_response_status:r.status,H_response_status_text:r.statusText,H_request_time:a,H_response_time:u,H_response_data:e})}))}return r})).catch((function(r){if(u&&u.aborted)throw r;var s="";s=(s=r instanceof Error?null==r?void 0:r.message:L(r))||"网络错误,或者无法连接";var p=he(he({},e.context.getRequestHeaders()),c||{});throw t({H_js_error_id:J("url=".concat(i,"&method=").concat(l)),H_error_category:o.FETCH_ERROR,H_error_type:o.FETCH_ERROR,H_error_message:i,H_request_url:i,H_request_headers:L(p),H_request_method:n.method.toLowerCase(),H_request_params:R(n.body)?n.body:"",H_response_status:0,H_response_status_text:s,H_request_time:a,H_response_time:N(),H_response_data:s}),r}))}}))}},e.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},e}(d),be=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="XhrPlugin",i.isReady=!1,i}return fe(e,t),e.prototype.init=function(t){if(!this.isReady){this.isReady=!0;var e=this,r=XMLHttpRequest.prototype.open,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.H_request_method=t[0],this.H_request_url=t[1],this.H_request_time=N(),r.apply(this,t)},XMLHttpRequest.prototype.send=function(r){var n=this;this.addEventListener("abort",(function(){n.H_response_status_text="abort"})),this.addEventListener("error",(function(){n.H_response_status_text="error"})),this.addEventListener("timeout",(function(){n.H_response_status_text="timeout"})),this.addEventListener("loadend",(function(){var i=n,a=i.status,s=i.statusText,c=i.responseType,u=i.responseText,l=i.response,p=i.H_request_method,d=i.H_request_url,f=i.H_request_time,h=i.H_response_status_text;if(!(a>=200&&a<300||"abort"===h||n.isMonitor)){var g=c&&"text"!==c?l:u,v=h||s;"error"===h?v="网络错误,或者无法连接":"timeout"===h&&(v="请求超时"),t({H_js_error_id:J("url=".concat(d,"&method=").concat(p)),H_error_category:o.AJAX_ERROR,H_error_type:o.AJAX_ERROR,H_error_message:d,H_request_url:d,H_request_headers:L(e.context.getRequestHeaders()),H_request_method:p,H_request_params:k(r)?L(r):R(r)?r:"",H_response_status:a,H_response_status_text:v,H_request_time:f,H_response_time:N(),H_response_data:g&&L(g)})}delete n.H_request_method,delete n.H_request_url,delete n.H_request_time,delete n.H_response_status_text}));try{i.call(this,r)}catch(t){}}}},e.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},e}(d),Se=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="PromiseErrorPlugin",i.isReady=!1,i}return fe(e,t),e.prototype.init=function(t){this.isReady||(this.isReady=!0,window.addEventListener("unhandledrejection",(function(e){var r=e.reason,i=o.PROMISE_ERROR,n="",a="";R(r)?n=r:void 0===r?n="undefined":(null==r?void 0:r.stack)?(i=r.name,n=r.message,a=JSON.stringify({errorStack:A(r),details:Z(r)})):n=L(r),["axioserror","cancelederror","aborterror"].includes(i.toLowerCase())||t({H_js_error_id:J("message=".concat(n,"&stack=").concat(a)),H_error_category:o.PROMISE_ERROR,H_error_type:i||o.PROMISE_ERROR,H_error_message:n,H_error_stack:a})})))},e.prototype.transform=function(t){return this.context.getReportData("H_performance_js",t)},e}(d),ke=function(t){function e(e,r){void 0===r&&(r=!0);var i=t.call(this,e,r)||this;return i.consolePrefix="性能监控SDK",i.presetProps={},i.requestHeaders={},i.useInstancing&&i.init(e),i}return fe(e,t),e.prototype.init=function(t){var e=this;if(this.isReady)this.log("Monitor has been initialized",r.ERROR);else{var n={serverUrl:"",name:"",showLog:!1,errorCapture:!0,performance:!0,openPromiseCapture:!1,sendType:i.BEACON,customHeaders:{},credentials:!1,dataSendTimeout:3e3,batchSend:!1,imgUseCrossOrigin:!1,performanceOff:[],plugins:[]};this.options=he(he({},n),t),this.initState(),this.normalizeConfig(),this.initPlugins(),this.isReady=!0,window.addEventListener("beforeunload",(function(){e.store.setSessionId("")}))}},e.prototype.initState=function(){this.store=new kt(this.options),this.store.init()},e.prototype.normalizeConfig=function(){var t=this.options,e=t.serverUrl,i=t.batchSend;""===(e=(e=e||"").trim())&&this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",r.WARN),(!0===i||k(i)&&!I(i))&&(this.options.batchSend=he({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},i),this.batchSender=new Ht(this.options,n.WEB,"hinaepm_tab","hinaepm_data_"))},e.prototype.initPlugins=function(){var t=this,e=this.options,r=e.errorCapture,i=e.performance,n=e.openPromiseCapture,o=e.plugins,a=void 0===o?[]:o;a=a||[];var s=[],c=[];if(r&&(s=[new me(this.options,this),new _e(this.options,this),new we(this.options,this),new be(this.options,this)],!0===n)){var u=new Se(this.options,this);s.push(u)}i&&(c=[new ye(this.options,this)]),this.plugins=ve(ve([],ge(s),!1),ge(c),!1),a.forEach((function(e){var r=new e(t.options,t);t.plugins.push(r)})),this.runPlugins(this.plugins)},e.prototype.report=function(t,e,r){var i=this.options.beforeSend,n=t;T(i)&&(n=i(n)),this.log(n),this.sendReportData(n,e,r)},e.prototype.getReportData=function(t,e){var r=this.options.sourcemapVersion;r||(r="1.0.0");var i=this.store.getAnonymousId(),n=this.store.getAccountId(),o=this.store.getSessionId(),a=N(),s=he(he(he({},this.getReportProperties()),{H_js_sourcemap_version:r}),e||{}),c={anonymous_id:i,type:"track",event:t,time:a,_track_id:V(),properties:s};return n&&(c.account_id=n),o?N()-this.store.getSessionIdCreateTime()>18e5&&(o=z(),this.store.setSessionId(o)):(o=z(),this.store.setSessionId(o)),s.H_session_id=o,c.send_time=N(),c},e.prototype.getReportProperties=function(){return he(he(he({},ot("4.0.0")),this.getCommonProperties()),{H_url:window.location.href,H_title:document.title})},e.prototype.captureException=function(t,e,r){t instanceof Error||(t=new Error(t)),k(e)||(e={});var i=A(t),n=this.getReportData("H_performance_js",{H_js_error_id:J(i),H_error_category:o.CAPTURE_EXCEPTION,H_error_type:o.CAPTURE_EXCEPTION,H_error_message:t.message,H_error_stack:JSON.stringify({details:Z(t),errorStack:i}),H_capture_extra:JSON.stringify(e)});this.report(n,r)},e.prototype.captureEvent=function(t,e){if(k(t)){var r=t.message,i=t.extra;k(i)||(i={});var n=this.getReportData("H_performance_js",{H_js_error_id:J(r||""),H_error_category:o.CAPTURE_EVENT,H_error_type:o.CAPTURE_EVENT,H_error_message:r||"",H_capture_message:r||"",H_capture_extra:JSON.stringify(i)});this.report(n,e)}else this.log("captureEvent event参数错误:event必须是一个对象")},e.prototype.setCommonProperties=function(t){k(t)&&!I(t)&&(this.presetProps=D(this.presetProps,t))},e.prototype.getCommonProperties=function(){return this.presetProps},e.prototype.clearCommonProperties=function(t){var e=this;void 0===t&&(t=!0),!0===t?this.presetProps={}:x(t)&&t.forEach((function(t){t in e.presetProps&&delete e.presetProps[t]}))},e.prototype.setRequestHeaders=function(t){void 0===t&&(t={}),k(t)&&!I(t)&&(this.requestHeaders=D(this.requestHeaders,t))},e.prototype.getRequestHeaders=function(){return this.requestHeaders},e.prototype.clearRequestHeaders=function(t){void 0===t&&(t=!0),!0===t?this.requestHeaders={}:x(t)&&t.forEach((function(t){}))},e}(Pt);new ke({},!1);var He=["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"],xe=["a","input","button","textarea"],Te=["abtestExperimentId","paramName","valueType","defaultValue","callback","timeoutMilliseconds","customProperties","customIds"],Re=function(t){function i(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="ClickTrackPlugin",i.isReady=!1,i.isTrackList={a:!0,button:!0},i}return e(i,t),i.prototype.init=function(t){var e=this,i=this.options.autoTrackConfig,n=i.clickAutoTrack,o=i.isCollectUrl,a=i.isCollectElement,s=i.addCustomProperty;!0===n&&(this.isReady?this.context.log("ClickTrack plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,document.addEventListener("click",(function(r){if(o()){var i=r||window.event;if(i){var n=i.target||i.srcElement,c=e.getTargetElement(n);if(c){if(T(a)&&!a(c))return!1;var u=e.getClickElementInfo(c),l=ft(i,c),p=l.H_page_x,d=l.H_page_y;if(u.H_page_x=p,u.H_page_y=d,T(s)){var f=s(c);k(f)&&(u=D(u,f))}t(u)}}}}),!0)))},i.prototype.transform=function(t){return this.context.getReportData("track","H_WebClick",t)},i.prototype.hasAttribute=function(t,e){var r;return t.hasAttribute?t.hasAttribute(e):t.attributes?!!(null===(r=t.attributes[e])||void 0===r?void 0:r.value):void 0},i.prototype.hasAttributes=function(t,e){if(x(e))for(var r=0;r<e.length;r++)if(this.hasAttribute(t,e[r]))return!0;return!1},i.prototype.hasElement=function(t){var e,r,i,n=function(t){var e=[t];try{if(!lt(t))return e;if(null===t||null===t.parentElement)return e;for(;null!==t.parentElement;)t=t.parentElement,e.push(t);return e}catch(t){}return e}(t),o=this.options.autoTrackConfig.trackAttr||[];if(x(n)&&n.length>0)try{for(var a=u(n),s=a.next();!s.done;s=a.next()){var c=s.value,l=c.tagName&&(null===(i=c.tagName)||void 0===i?void 0:i.toLowerCase());if(lt(c)&&(this.isTrackList[l]||this.hasAttributes(c,o)))return c}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}},i.prototype.getDivMaxLevel=function(){var t;return(null===(t=this.options.autoTrackConfig.collectTags.div)||void 0===t?void 0:t.maxLevel)||1},i.prototype.isStyleTag=function(t){var e,r=(null===(e=this.options.autoTrackConfig.collectTags.div)||void 0===e?void 0:e.ignoreTags)||[];return null==r?void 0:r.includes(t)},i.prototype.getCollectableParent=function(t){var e;try{var i=t.parentNode,n=i?null===(e=i.tagName)||void 0===e?void 0:e.toLowerCase():"";if("body"===n)return!1;var o=this.getDivMaxLevel();if("div"===n&&(o>1||this.isCollectableDiv(i)))return i;if(i&&this.isStyleTag(n))return this.getCollectableParent(i)}catch(t){this.context.log(t,r.ERROR)}return!1},i.prototype.isCollectableDiv=function(t){var e;try{var i=t.children||[];if(0===i.length)return!0;for(var n=0;n<i.length;n++){var o=i[n];if(lt(o)){var a=null===(e=o.tagName)||void 0===e?void 0:e.toLowerCase(),s=this.getDivMaxLevel();if(!("div"===a&&s>1||this.isStyleTag(a)))return!1;if(!this.isCollectableDiv(o))return!1}}return!0}catch(t){this.context.log(t,r.ERROR)}return!1},i.prototype.isDivLevelValid=function(t){for(var e=this.getDivMaxLevel(),r=t.getElementsByTagName("div"),i=r.length-1;i>=0;i--)if(this.getDivLevels(r[i],t)>e)return!1;return!0},i.prototype.getElementPath=function(t,e,r){for(var i,n,o=[];lt(t)&&t.parentNode;){if(t.id&&!e&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.id)){var a=t.tagName||"";o.unshift("".concat(a.toLowerCase(),"#").concat(t.id));break}if(r&&t===r){o.unshift(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase());break}if(t===document.body){o.unshift("body");break}o.unshift(null===(n=t.tagName)||void 0===n?void 0:n.toLowerCase()),t=t.parentNode}return o.join(" > ")},i.prototype.getDivLevels=function(t,e){var r=this.getElementPath(t,!0,e).split(" > "),i=0;return r.forEach((function(t){"div"===t&&i++})),i},i.prototype.getTargetElement=function(t){var e;if(!lt(t))return null;var r=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if(!R(r))return null;if(["body","html"].includes(r))return null;if(this.context.trackTags.includes(r)&&"div"!==r)return t;if("div"===r&&this.options.autoTrackConfig.collectTags.div&&(this.isDivLevelValid(t)&&(this.getDivMaxLevel()>1||this.isCollectableDiv(t))))return t;if(this.options.autoTrackConfig.collectTags.div&&this.isStyleTag(r)){var i=this.getCollectableParent(t);if(i&&this.isDivLevelValid(i))return i}return this.hasElement(t)||null},i.prototype.getClickElementInfo=function(t){var e=this.options.autoTrackConfig.isCollectInput,r=!1;T(e)&&(r=e(t));var i=this.getDomSelector(t),n=function(t,e){var r;return lt(t)?U({H_element_type:null===(r=t.tagName)||void 0===r?void 0:r.toLowerCase(),H_element_name:t.getAttribute("name"),H_element_id:t.getAttribute("id"),H_element_target_url:t.getAttribute("href"),H_element_class_name:t.getAttribute("className"),H_element_content:pt(t,e)}):{}}(t,r);return n.H_element_selector=i,n.H_element_path=this.getElementPath(t,!1),n},i.prototype.getDomSelector=function(t){for(var e,r=[];t;){if("body"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase())||!lt(t)){r.unshift("body");break}if(r.unshift(this.getSelector(t)),(null==t?void 0:t.getAttribute("id"))&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.getAttribute("id")))break;t=t.parentNode}return r.join(" > ")},i.prototype.getSelector=function(t){var e,r,i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),n=-1;9!==(null===(r=t.parentNode)||void 0===r?void 0:r.nodeType)&&(n=this.getDomIndex(t));var o=t.getAttribute("id");return o&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(o)?"#".concat(o):i+(n>-1?":nth-of-type(".concat(n+1,")"):"")},i.prototype.getDomIndex=function(t){var e,r;if(t.parentNode)for(var i=0,n=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),o=t.parentNode.children,a=0;a<o.length;a++){var s=o[a];if((null===(r=s.tagName)||void 0===r?void 0:r.toLowerCase())===n){if(s===t)return i;i++}}return-1},i}(d),Ee=function(t){function i(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="StayTrackPlugin",i.isReady=!1,i.timer=null,i.previousTime=N(),i.previousOffsetTop=0,i}return e(i,t),i.prototype.init=function(t){var e=this,i=this.options,n=i.autoTrackConfig,o=i.stayAutoTrackConfig;if(!0===n.stayAutoTrack)if(this.isReady)this.context.log("StayTrack plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var a=o.isCollectUrl;T(a)||(a=function(){return!0}),this.timer&&(clearTimeout(this.timer),this.timer=null),this.previousTime=N(),window.addEventListener("load",(function(){e.previousOffsetTop=at()})),window.addEventListener("scroll",(function(){a()&&(e.timer||(e.timer=setTimeout((function(){e.run(t),clearTimeout(e.timer),e.timer=null}),1e3)))})),window.addEventListener("unload",(function(){a()&&e.run(t,!0)}))}},i.prototype.transform=function(t){return this.context.getReportData("track","H_WebStay",t)},i.prototype.run=function(t,e){void 0===e&&(e=!1);var r=this.options.autoTrackConfig,i=r.stayDelayTime,n=r.maxStayPageDuration,o=at(),a=N(),s=a-this.previousTime;(e||s>i&&o!==this.previousOffsetTop)&&t({H_viewport_position:this.previousOffsetTop,event_duration:Math.min(s/1e3,n)});this.previousTime=a,this.previousOffsetTop=o},i}(d),Ce=function(t){function i(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="PageLeave",i.isReady=!1,i.pageId=V(),i.storageName="hinasdk_pageleave_",i.heartbeatIntervalTime=5e3,i.maxDuration=432e3,i.heartbeatIntervalTimer=null,i.startTime=N(),i.url=window.location.href,i.pageShowStatus=!0,i}return e(i,t),i.prototype.init=function(){if(this.options.autoTrackConfig.pageLeaveAutoTrack)if(this.context.store.localStorage)if(this.isReady)this.context.log("PageLeave plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var t=this.normalizePageLeaveAutoTrack(),e=t.heartbeat_interval_time,i=t.max_duration;e&&e>0&&(this.heartbeatIntervalTime=1e3*e),i&&i>0&&(this.maxDuration=Number(i)),this.startTime=N(),this.addPageLeaveEventListener(),document.hidden?this.pageShowStatus=!1:this.startHeartBeatInterval()}else this.context.log("PageLeave plugin需要使用localstorage存储数据,但是您的浏览器不支持localstorage,所以不能使用该功能",r.WARN)},i.prototype.transform=function(){},i.prototype.normalizePageLeaveAutoTrack=function(){var t=this.options.autoTrackConfig.pageLeaveAutoTrack;return k(t)?t:{}},i.prototype.addPageLeaveEventListener=function(){this.addPageStartListener(),this.addPageSwitchListener(),this.addSinglePageListener(),this.addPageEndListener()},i.prototype.addPageStartListener=function(){var t=this;"onpageshow"in window&&window.addEventListener("pageshow",(function(){t.pageStartHandler()}))},i.prototype.addPageSwitchListener=function(){var t=this;new ct({visible:function(){t.pageStartHandler(),t.startHeartBeatInterval()},hidden:function(){t.url=window.location.href,t.pageEndHandler(),t.stopHeartBeatInterval()}})},i.prototype.addSinglePageListener=function(){var t=this;bt.on("urlChange",(function(e){var r=e.fromHref;r!==e.toHref&&(t.url=r,t.pageEndHandler(),t.stopHeartBeatInterval(),t.pageStartHandler(),t.startHeartBeatInterval())}))},i.prototype.addPageEndListener=function(){var t=this,e=["pagehide","beforeunload","unload"];e.forEach((function(r){"on".concat(e)in window&&window.addEventListener(r,(function(){t.pageEndHandler(),t.stopHeartBeatInterval()}))}))},i.prototype.pageStartHandler=function(){this.startTime=N(),this.pageShowStatus=!document.hidden,this.url=window.location.href},i.prototype.pageEndHandler=function(){if(this.pageShowStatus){if(this.pageShowStatus=!1,this.isCollectUrl()){var t=this.getPageLeaveProperties(),e=this.context.getReportData("track","H_WebPageLeave",t);this.context.report(e)}this.delHeartBeatData()}},i.prototype.startHeartBeatInterval=function(){var t=this;this.heartbeatIntervalTimer&&this.stopHeartBeatInterval(),this.isCollectUrl()&&(this.heartbeatIntervalTimer=setInterval((function(){t.saveHeartBeatData()}),this.heartbeatIntervalTime),this.saveHeartBeatData("first_heartbeat")),this.reissueHeartBeatData()},i.prototype.reissueHeartBeatData=function(){for(var t=this.context.store.localStorage,e=t.length(),r=0;r<e;r++){var i=t.key(r);if(i&&i!==this.storageName+this.pageId&&i.includes(this.storageName)){var n=O(t.get(i));k(n)&&N()-n.time>n.heartbeat_interval_time+5e3&&(delete n.heartbeat_interval_time,this.context.report(n)),this.delHeartBeatData(i)}}},i.prototype.stopHeartBeatInterval=function(){this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)},i.prototype.delHeartBeatData=function(t){this.context.store.localStorage.remove(t||this.storageName+this.pageId)},i.prototype.isCollectUrl=function(){var t=this.normalizePageLeaveAutoTrack().isCollectUrl;return!T(t)||t(this.url)},i.prototype.saveHeartBeatData=function(t){var e=this.getPageLeaveProperties();e.H_time=N(),"first_heartbeat"===t&&(e.event_duration=3);var r=this.context.getReportData("track","H_WebPageLeave",e);r.heartbeat_interval_time=this.heartbeatIntervalTime,this.context.store.localStorage.set(this.storageName+this.pageId,JSON.stringify(r))},i.prototype.getPageLeaveProperties=function(){var t=(N()-this.startTime)/1e3;t=t<=0||t>this.maxDuration?0:j(t,3);var e=q(this.url),r=e.pathname,i=e.hash,n={H_url:this.url,H_url_path:r,H_url_hash:i};t&&(n.event_duration=t);var o=this.normalizePageLeaveAutoTrack().custom_props;return k(o)&&(n=c(c({},n),o||{})),n},i}(d),Ae=function(t){function i(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="SiteLinker",i.isReady=!1,i.linker=[],i}return e(i,t),i.prototype.init=function(){if(this.options.siteLinkerConfig){var t=this.getLinkerConfig().linker;x(t)&&t.length>0?this.isReady?this.context.log("SiteLinker plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,this.resolveOption(),this.setRefferId(),this.addClickListen()):this.context.log("siteLinker plugin: 请配置正确的linker参数",r.WARN)}},i.prototype.transform=function(){},i.prototype.getLinkerConfig=function(){var t=this.options.siteLinkerConfig||{},e=t.linker;return{linker:(void 0===e?[]:e)||[],re_login:t.re_login}},i.prototype.resolveOption=function(){for(var t=this.getLinkerConfig().linker,e=t.length,i=[],n=0;n<e;n++){var o=t[n],a=o.part_url,s=o.after_hash;/[A-Za-z0-9]+\./.test(a)&&C(s)?i.push({part_url:a,after_hash:s}):this.context.log("The configuration of linker ".concat(n+1," is not supported.Please check format"),r.WARN)}this.linker=i},i.prototype.setRefferId=function(){var t=this.getLinkerConfig().re_login,e=this.getUrlId(),r=e.startsWith("a");if(""!==(e=e.substring(1))){var i=this.context.store.getAnonymousId(),n=this.context.store.getAccountId();if(r){if(e!==i&&(this.context.store.state.anonymousId=e,this.context.store.save()),n){var o=this.context.getReportData("track_signup","H_SignUp",{});this.context.report(o)}}else(!n||t&&n!==e)&&this.context.setUserUId(e)}},i.prototype.getUrlId=function(){var t=window.location.href.match(/_hnsdk=([au][^\?\#\&\=]+)/);return x(t)&&t[1]?function(t){var e=t;try{e=decodeURIComponent(t)}catch(t){}return e}(t[1]):""},i.prototype.getPartUrl=function(t){for(var e=this.linker.length,r=0;r<e;r++)if(t.includes(this.linker[r].part_url))return!0;return!1},i.prototype.getPartHash=function(t){for(var e=this.linker.length,r=0;r<e;r++)if(t.includes(this.linker[r].part_url))return this.linker[r].after_hash;return!1},i.prototype.getCurrentId=function(){var t=this.context.store.getAccountId(),e=this.context.store.getAnonymousId();return function(t){var e=t;try{e=encodeURIComponent(t)}catch(t){}return e}(t?"u".concat(t):"a".concat(e))},i.prototype.rewriteUrl=function(t,e){var r=/([^?#]+)(\?[^#]*)?(#.*)?/.exec(t),i="";if(r){var n=r[1]||"",o=r[2]||"",a=r[3]||"",s="_hnsdk=".concat(this.getCurrentId()),c=function(t){var e=t.split("&"),r=[];return e.forEach((function(t){t.includes("_hnsdk")?r.push(s):r.push(t)})),r.join("&")};if(this.getPartHash(t)){var u=a.includes("?"),l=a.indexOf("_hnsdk");i=u?l>=0?"".concat(n).concat(o,"#").concat(a.substring(1,l)).concat(c(a.substring(l,a.length))):"".concat(n).concat(o,"#").concat(a.substring(1),"&").concat(s):"".concat(n).concat(o,"#").concat(a.substring(1),"?").concat(s)}else{i=(u=/^\?(\w)+/.test(o))?o.includes("_hnsdk")?"".concat(n,"?").concat(c(o.substring(1))).concat(a):"".concat(n).concat(o,"&").concat(s).concat(a):"".concat(n,"?").concat(s).concat(a)}return e&&(e.href=i),i}},i.prototype.addClickListen=function(){var t=this,e=function(e){var r,i,n=e.target;if(n){var o=null===(r=n.tagName)||void 0===r?void 0:r.toLowerCase(),a=n.parentNode,s=null===(i=null==a?void 0:a.tagName)||void 0===i?void 0:i.toLowerCase();if("a"===o&&n.href||"a"===s&&a.href){var c=void 0,u=void 0;"a"===o&&n.href?(c=n.href,u=n):(c=a.href,u=a);var l=q(c).protocol;"http:"!==l&&"https:"!==l||t.getPartUrl(c)&&t.rewriteUrl(c,u)}}};"PointerEvent"in window?document.addEventListener("pointerdown",e):document.addEventListener("mousedown",e)},i}(d),Pe=function(t){function i(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HistoryPlugin",i.isReady=!1,i.lastHref=window.location.href,i.lastPath=window.location.pathname,i}return e(i,t),i.prototype.init=function(){if(window&&window.history.pushState&&window.history.replaceState)if(this.isReady)this.context.log("History plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var t=this,e=window.onpopstate,i=function(e,r){var i={fromPath:t.lastPath,fromHref:t.lastHref,toPath:e,toHref:r};t.lastPath=e,t.lastHref=r,bt.emit("urlChange",c(c({},i),{mode:"history"}))};window.onpopstate=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=window.location.pathname,o=window.location.href;i(n,o),e&&e.apply(this,t)},$(window.history,"pushState",n),$(window.history,"replaceState",n)}function n(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];t.apply(this,e);var n=window.location.pathname,o=window.location.href;i(n,o)}}},i.prototype.transform=function(){},i}(d),Oe=function(t){function i(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HashPlugin",i.isReady=!1,i.lastHref=window.location.href,i.lastPath=window.location.hash,i}return e(i,t),i.prototype.init=function(){var t=this;this.isReady?this.context.log("Hash plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,window.addEventListener("hashchange",(function(e){var r=e.newURL,i=q(r).hash,n={fromPath:t.lastPath,fromHref:t.lastHref,toPath:i,toHref:r};t.lastHref=r,t.lastPath=i,bt.emit("urlChange",c(c({},n),{mode:"hash"}))})))},i.prototype.transform=function(){},i}(d),Le="4.0.1",Ie=function(t){function i(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HinaABTest",i.isReady=!1,i.platform=function(){var t,e=null===(t=nt.getUA())||void 0===t?void 0:t.toLowerCase();return/android|webos|iphone|ipod|blackberry/i.test(e)?"H5":"Web"}(),i.projectKey="",i.storageName="hina_webjs_sdk_abtest",i}return e(i,t),i.prototype.init=function(){var t=this;if(this.context.store.localStorage){var e=this.options.abTestingPluginConfig,i=null==e?void 0:e.url;if(R(i)){var n=K(i,"project-key");if(n){this.projectKey=n;var o=q(i).protocol,a=q(window.location.href).protocol;if(o&&o!==a)this.context.log("A/B Testing 初始化失败,".concat(a," 页面必须使用 ").concat(a," 的 URL"),r.WARN);else if(this.isReady)this.context.log("A/B Testing 插件已经运行,无需重复执行",r.WARN);else{var s=this.context.getUserUid();this.context.log("当前accountId为:".concat(s),r.INFO),bt.on("changeAccountId",(function(){t.context.store.localStorage.set(t.storageName,"")})),this.isReady=!0}}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL(必须包含 project-key)")}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL!",r.WARN)}else this.context.log("A/B Testing 初始化失败,浏览器不支持localStorage",r.WARN)},i.prototype.transform=function(){},i.prototype.valueMatchType=function(t,e){switch(e){case s.INTEGER:return E(t);case s.STRING:return R(t);case s.BOOLEAN:return C(t);default:return!1}},i.prototype.normalizeParams=function(t,e,i){var n,o;void 0===i&&(i=Te);var a={verify_success:!0,para:e};try{for(var c=u(i),l=c.next();!l.done;l=c.next()){var p=l.value;if(!a.verify_success)break;var d=e.customIds||{},f={};switch(p){case"abtestExperimentId":R(e.abtestExperimentId)&&e.abtestExperimentId.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(e.abtestExperimentId),r.WARN),a.verify_success=!1);break;case"paramName":R(e.paramName)&&e.paramName.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(e.paramName),r.WARN),a.verify_success=!1);break;case"valueType":[s.BOOLEAN,s.INTEGER,s.STRING].includes(e.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置!").concat(p,": ").concat(e.valueType),r.WARN),a.verify_success=!1);break;case"defaultValue":this.valueMatchType(e.defaultValue,e.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"类型必须与valueType一致!"),r.WARN),a.verify_success=!1);break;case"callback":T(e.callback)||(this.context.log("".concat(t,"方法调用失败,").concat(p,"参数未正确配置")),e.callback=P,a.verify_success=!1);break;case"timeoutMilliseconds":(!E(e.timeoutMilliseconds)||e.timeoutMilliseconds<=0)&&(this.context.log("".concat(p,"参数错误:").concat(e.timeoutMilliseconds),r.WARN),e.timeoutMilliseconds=3e3),e.timeoutMilliseconds<200&&(e.timeoutMilliseconds=200);break;case"customProperties":e.customProperties=k(e.customProperties)?e.customProperties:{};break;case"customIds":for(var h in d)(R(d[h])||E(d[h]))&&(f[h]=d[h]);e.customIds=f}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}return a},i.prototype.sendTriggerEvent=function(t){var e=t.abtest_experiment_group_id,r=t.abtest_experiment_id;this.context.track("H_ABTestTrigger",{H_abtest_experiment_id:r,H_abtest_experiment_group_id:e})},i.prototype.getExpResult=function(t,e){var r,i;void 0===e&&(e=[]);var n,o=t.abtestExperimentId,a=t.paramName,s=t.valueType;if(0===e.length){var c=this.getStorageData();k(c)&&(e=c.result||[])}try{for(var l=u(e),p=l.next();!p.done;p=l.next()){var d=p.value,f=d.abtest_experiment_id,h=d.abtest_experiment_group_id,g=d.is_white_list,v=d.variables;if(f===o){var m=v.find((function(t){return t.name===a&&t.type===s}));if(m){g||this.sendTriggerEvent({abtest_experiment_id:f,abtest_experiment_group_id:h}),n=m.value;break}}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}return n},i.prototype.getStorageData=function(){var t=this.context.store.localStorage.get(this.storageName);return H(t)?O(t):null},i.prototype.saveResponseData=function(t){var e=this.getStorageData(),r={updateTime:N()};if(e&&k(e)){var i=[],n=e.result||[];t.forEach((function(t){var e=t.abtest_experiment_group_id,r=t.abtest_experiment_id,o=t.variables,a=n.find((function(t){return t.abtest_experiment_id===r&&t.abtest_experiment_group_id===e}));if(a){var s=[];o.forEach((function(t){var e=t.name,r=t.type,i=a.variables.findIndex((function(t){return t.name===e&&t.type===r}));i>=0?a.variables[i]=t:s.push(t)})),a.variables=p(p([],l(a.variables),!1),l(s),!1)}else i.push(t)})),r.result=p(p([],l(n),!1),l(i),!1)}else r.result=t;this.context.store.localStorage.set(this.storageName,JSON.stringify(r))},i.prototype.createRequestData=function(t){var e=t.paramName,r=t.customProperties,i=t.customIds,n={anonymous_id:this.context.store.getAnonymousId(),platform:this.platform,abtest_lib_version:Le,param_name:e,properties:this.context.getPresetProperties()};return k(r)&&!I(r)&&(n.custom_properties=r),k(i)&&!I(i)&&(n.custom_ids=i),this.context.getUserUid()&&(n.login_id=this.context.getUserUid()),n},i.prototype.getResultFromServer=function(t){var e=this;return new Promise((function(r,i){var n=e.createRequestData(t);new yt({url:e.options.abTestingPluginConfig.url,data:JSON.stringify(n),contentType:"application/json",customHeaders:{"project-key":e.projectKey},timeout:t.timeoutMilliseconds}).run().then((function(t){var n=t.data;"SUCCESS"===(null==n?void 0:n.status)?(e.saveResponseData(n.results),r(n)):i()}))}))},i.prototype.asyncFetch=function(t){var e=this;return new Promise((function(r){e.getResultFromServer(t).then((function(t){r(t)})).catch((function(){t.callback(t.defaultValue)}))}))},i.prototype.preFetch=function(t,e){return this.isReady?!!k(e)||(this.context.log("".concat(t," 方法参数必须是对象"),r.WARN),!1):(this.context.log("A/B Testing 插件尚未运行,请先执行该插件",r.WARN),!1)},i.prototype.asyncFetchABTest=function(t){var e=this;if(this.preFetch("asyncFetchABTest",t)){var r=this.normalizeParams("asyncFetchABTest",t),i=r.verify_success,n=r.para;i?this.asyncFetch(n).then((function(t){var r=e.getExpResult(n,t.results);n.callback(r||n.defaultValue)})):n.callback(n.defaultValue)}},i.prototype.fetchCacheABTest=function(t){if(this.preFetch("fetchCacheABTest",t)){var e=this.normalizeParams("fetchCacheABTest",t),r=e.verify_success,i=e.para;if(r){var n=this.getExpResult(i);i.callback(n||i.defaultValue)}else i.callback(i.defaultValue)}},i.prototype.fastFetchABTest=function(t){var e=this;if(this.preFetch("fastFetchABTest",t)){var r=this.normalizeParams("fastFetchABTest",t),i=r.verify_success,n=r.para;if(i){var o=this.getExpResult(n);H(o)?n.callback(o):this.asyncFetch(n).then((function(){var t=e.getExpResult(n);n.callback(t||n.defaultValue)}))}else n.callback(n.defaultValue)}},i}(d),Ne=function(t){function o(e,r){void 0===r&&(r=!0);var i=t.call(this,e,r)||this;return i.consolePrefix="埋点SDK",i.trackTags=xe,i.presetProps={},i.useInstancing&&i.init(e),i}return e(o,t),o.prototype.init=function(t){if(this.isReady)this.log("hinaSDK has been initialized",r.ERROR);else{var e={name:"",serverUrl:"",showLog:!1,autoTrackConfig:{clickAutoTrack:!0,stayAutoTrack:!0,isCollectUrl:function(){return!0},isCollectElement:function(){return!0},isCollectInput:function(){return!1},addCustomProperty:function(){},stayDelayTime:4e3,maxStayPageDuration:18e3,collectTags:{div:!1},trackAttr:["hn-click"],pageviewAutoTrack:!1,pageLeaveAutoTrack:!1},stayAutoTrackConfig:{isCollectUrl:function(){return!0}},maxStringLength:1024,imgUseCrossOrigin:!1,isSinglePage:!1,batchSend:!1,appJsBridge:!1,sendType:i.BEACON,customHeaders:{},credentials:!1,dataSendTimeout:3e3,presetProperties:{latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,url:!0,title:!0},sourceChannel:[],plugins:[]},n=t.performanceErrorConfig,o=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}(t,["performanceErrorConfig"]);this.options=D(e,o),this.options=c(c({},this.options),{performanceErrorConfig:n}),this.initState(),this.normalizeConfig(),this.initAdvProps(),this.initPlugins(),this.isReady=!0}},o.prototype.initState=function(){this.store=new kt(this.options),this.store.init()},o.prototype.normalizeConfig=function(){var t=this,e=this.options,o=e.serverUrl,a=e.sendType,s=e.batchSend,u=e.maxStringLength,l=e.isSinglePage,p=e.autoTrackConfig,d=void 0===p?{}:p,f=d.trackAttr,h=void 0===f?[]:f,g=d.collectTags,v=d.pageLeaveAutoTrack,m=d.pageviewAutoTrack;if(""===(o=(o=o||"").trim()))this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",r.WARN);else{var _=q(window.location.href).protocol||"";(q(o).protocol||"")!==_&&this.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为:https 下面发送 http 的图片请求会失败。",r.WARN)}[i.IMAGE,i.AJAX,i.BEACON].includes(a)||this.setConfig({sendType:i.AJAX});var y=u;if(!E(u)||u<0?y=1024:u>5120&&(y=5120),this.options.maxStringLength=y,(!0===v||k(v)&&I(v))&&(this.options.autoTrackConfig.pageLeaveAutoTrack={heartbeat_interval_time:5e3,max_duration:432e3}),x(h)?(h=h.filter((function(t){return R(t)})),h.includes("hn-click")||h.push("hn-click")):h=["hn-click"],this.options.autoTrackConfig.trackAttr=h,k(g))if(!0===g.div)this.options.autoTrackConfig.collectTags.div={ignoreTags:He,maxLevel:1};else if(k(g.div)){var w=1,b=g.div;E(b.maxLevel)&&[1,2,3].includes(b.maxLevel)&&(w=b.maxLevel),this.options.autoTrackConfig.collectTags.div={ignoreTags:He,maxLevel:w}}else this.options.autoTrackConfig.collectTags.div=!1;else this.options.autoTrackConfig.collectTags={div:!1};this.updateTrackTags(),(!0===s||k(s)&&!I(s))&&(this.options.batchSend=c({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},s),this.batchSender=new Ht(this.options,n.WEB,"hinasdk_tab","hinasdk_data_")),"auto"===m?this.autoTrack():("singlePage"===m||l)&&(this.autoTrack(),bt.on("urlChange",(function(e){var r=e.fromHref;if(r!==e.toHref){if(T(l)){var i=l();k(i)&&(e=c(c({},e),i))}t.autoTrack(c(c({},e),{H_referrer:r}))}})))},o.prototype.updateTrackTags=function(){var t=this.options.autoTrackConfig.collectTags,e=p([],l(xe),!1);Object.keys(t||{}).forEach((function(r){var i=t[r];!0!==i&&!k(i)||e.includes(r)||e.push(r)})),this.trackTags=e},o.prototype.initAdvProps=function(){var t={},e=this.options,r=e.presetProperties,i=e.sourceChannel;Object.keys(r||{}).forEach((function(e){var i=r[e];if(e.includes("latest_")&&(e=e.slice(7),i)){var n=M();if("utm"!==e&&"url解析失败"===n)t["H_latest_".concat(e)]="url的domain解析失败";else if(function(t){return""===(t=t||document.referrer)||B(F(t))!==B()}())switch(e){case"traffic_source_type":t.H_latest_traffic_source_type=ht.getSourceFromReferrer();break;case"search_keyword":var o=ht.getKeywordFromReferrer();o&&(t.H_latest_search_keyword=o);break;case"referrer":t.H_latest_referrer=W()}}}));var n=this.store.state.props||{},o={};r.latest_utm&&(o=gt("H_latest_"));var a={};n.H_utm_source||(a=gt("H_"));var s={},u={};if(x(i)&&i.length>0){var l=i.filter((function(t){return!m.includes(t)}));l.length>0&&(n["H_".concat(l[0])]||(u=vt("H_",l)),s=vt("H_latest_",l))}this.store.state.props=c(c(c(c(c(c({},this.store.state.props),t),o),s),u),a),this.store.setProps(this.store.state.props)},o.prototype.initPlugins=function(){var t=this,e=this.options,r=e.serverUrl,i=e.name,n=e.showLog,o=e.sendType,a=e.customHeaders,s=e.credentials,u=e.dataSendTimeout,l=e.batchSend,p=e.imgUseCrossOrigin,d=e.globalCallback,f=e.plugins,h=void 0===f?[]:f,g=e.performanceErrorConfig,v=e.autoTrackConfig,m=e.siteLinkerConfig,_=e.abTestingPluginConfig;h=h||[];var y=v.pageLeaveAutoTrack,w=new Re(this.options,this),b=new Ee(this.options,this),S=new Pe(this.options,this),H=new Oe(this.options,this);if(this.plugins=[w,b,S,H],k(y)&&!I(y)){var T=new Ce(this.options,this);this.plugins.push(T)}var R=(m||{}).linker;if(x(R)&&R.length>0){var E=new Ae(this.options,this);this.plugins.push(E)}if(k(_)&&!I(_)){var C=new Ie(this.options,this);this.plugins.push(C)}if(h.forEach((function(e){var r=new e(t.options,t);t.plugins.push(r)})),k(g)&&!I(g)){var A=c({serverUrl:r,name:i,showLog:n,sendType:o,customHeaders:a,credentials:s,dataSendTimeout:u,batchSend:l,imgUseCrossOrigin:p,globalCallback:d},g);this.epmInstance=new ke(A,!0)}this.runPlugins(this.plugins)},o.prototype.use=function(t,e){var i=this,n=this.options,o=n.autoTrackConfig,a=n.siteLinkerConfig,s=n.abTestingPluginConfig,c=o.pageLeaveAutoTrack,u=function(t){var e=new t(i.options,i);i.plugins.push(e),e.init()};if(this.isReady){if(k(e))return"PageLeave"===t?k(c)&&!I(c)?this.log("PageLeave插件已运行,无需重复执行",r.WARN):(this.options.autoTrackConfig.pageLeaveAutoTrack=e,u(Ce)):"SiteLinker"===t?k(a)&&!I(a)?this.log("SiteLinker插件已插件已运行,无需重复执行",r.WARN):(this.options.siteLinkerConfig=e,u(Ae)):"HinaABTest"===t&&(k(s)&&!I(s)?this.log("HinaABTest插件已运行,无需重复执行",r.WARN):(this.options.abTestingPluginConfig=e,u(Ie))),this.getPluginInstance(t);this.log("".concat(t,"插件配置项必须是一个对象类型"),r.WARN)}else this.log("请先初始化埋点SDK",r.WARN)},o.prototype.getPluginInstance=function(t){return this.plugins.find((function(e){return e.name===t}))},o.prototype.setConfig=function(t){this.options=D(this.options,t),this.normalizeConfig()},o.prototype.getConfig=function(t){return t?this.options[t]:this.options},o.prototype.setUserUId=function(t,e){if(E(t=null!=t?t:"")||R(t))if(t=String(t).trim(),this.store.getAccountId()!==t){this.store.setAccountId(t);var i=this.getReportData("track_signup","H_SignUp",{});this.report(i,e),bt.emit("changeAccountId")}else this.log("setUserUId: uid is equal to account_id, , failed to execute setUserUId",r.WARN);else this.log("setUserUId: uid must be string or number",r.WARN)},o.prototype.getUserUid=function(){return this.store.state.accountId},o.prototype.setDeviceUId=function(t){this.store.setDeviceId(t)},o.prototype.getDeviceUId=function(){return this.store.getDeviceId()},o.prototype.userSet=function(t,e){if(k(t)&&!I(t)){var r=this.getReportData("user_set","",t);this.report(r,e)}},o.prototype.userSetOnce=function(t,e){if(k(t)&&!I(t)){var r=this.getReportData("user_setOnce","",t);this.report(r,e)}},o.prototype.userAdd=function(t,e){var i,n=this;R(t)&&((i={})[t]=1,t=i);if(k(t)&&!I(t)&&function(t){for(var e in t)if(!/-*\d+/.test(String(t[e])))return n.log("userAdd属性的值只能是数字",r.WARN),!1;return!0}(t)){var o=this.getReportData("user_add","",t);this.report(o,e)}},o.prototype.userAppend=function(t,e){var r={};if(k(t)&&(Object.keys(t).forEach((function(e){var i=t[e];x(i)?r[e]=i:r[e]=[i]})),!I(r))){var i=this.getReportData("user_append","",r);this.report(i,e)}},o.prototype.userUnset=function(t,e){var i=this,n={};if(R(t)&&(t=[t]),x(t)){if(t.forEach((function(t){R(t)?n[t]=!0:i.log("userUnset参数数组里面的值必须时string,已经过滤掉".concat(t),r.WARN)})),!I(n)){var o=this.getReportData("user_unset","",n);this.report(o,e)}}else this.log("userUnset参数必须是数组或字符串",r.WARN)},o.prototype.userDelete=function(t){var e=this.getReportData("user_delete","",{});this.report(e,t),this.store.setAccountId("")},o.prototype.registerCommonProperties=function(t){this.presetProps=D(this.presetProps,t)},o.prototype.getPresetProperties=function(){return{H_is_first_day:this.store.isFirstDay,H_is_first_time:this.store.isFirstTime,device_id:this.store.getDeviceId(),anonymous_id:this.store.getAnonymousId(),account_id:this.store.getAccountId(),properties:c(c(c({},this.presetProps),dt()),ot(Le))}},o.prototype.clearPageRegister=function(t){var e=this;void 0===t&&(t=!0),!0===t?this.presetProps={}:x(t)&&t.forEach((function(t){t in e.presetProps&&delete e.presetProps[t]}))},o.prototype.checkReportProperties=function(t){var e=this,r=this.options.maxStringLength;Object.keys(t).forEach((function(i){var n=t[i];if(R(n)&&n.length>r)e.log("属性 ".concat(i," 已经做截取")),t[i]=n.slice(0,r);else if(k(n))e.checkReportProperties(n);else if(T(n))try{t[i]=n(t),T(t[i])?(e.log("属性--".concat(i," 格式不满足要求, 已被删除")),delete t[i]):k(t[i])?e.checkReportProperties(t[i]):R(t[i])&&t[i].length>r&&(t[i]=t[i].slice(0,r))}catch(r){e.log("属性--".concat(i," 格式不满足要求, 已被删除")),delete t[i]}}))},o.prototype.track=function(t,e,i){if(i=i||function(){},R(t)){e=k(e)?e:{};var n=this.getReportData("track",t,e);this.report(n,i)}else this.log("track事件名必须是字符串,属性必须是是一个对象",r.WARN)},o.prototype.quick=function(t,e,r){var i={};r=T(r)?r:P,k(e)?i=e:T(e)&&(r=e),this.autoTrack(i,r)},o.prototype.autoTrack=function(t,e){void 0===t&&(t={}),void 0===e&&(e=P);var r=this.getReportData("track","H_pageview",t);if(this.report(r,e),this.store.isSetFirstVisit){this.store.isSetFirstVisit=!1;var i=W();this.userSetOnce({H_first_referrer:i,H_first_referrer_host:i?F(i,"取值异常"):"",H_first_traffic_source_type:ht.getSourceFromReferrer(),H_first_search_keyword:ht.getKeywordFromReferrer(),H_first_visit_time:N(),H_first_browser_language:R(navigator.language)?navigator.language.toLowerCase():"取值异常"})}},o.prototype.report=function(t,e,i){var n,o,a=this.options,s=a.appJsBridge,c=a.serverUrl;if(this.log(t),s){var u=!0,l=null===window||void 0===window?void 0:window.Hina_Cloud_H5_Bridge;if(k(l)&&l.track)u=!1,l.track(t.event,t.type,JSON.stringify(t));else{var p=null===(o=null===(n=null===window||void 0===window?void 0:window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===o?void 0:o.hinaNativeTracker;if(null==p?void 0:p.postMessage){u=!1;var d=JSON.stringify({eventName:t.event,eventType:t.type,properties:t});p.postMessage(d)}}if(u)return void this.log("JSBridge 发送数据失败",r.WARN);T(e)&&e(c,t)}else this.sendReportData(t,e,i)},o.prototype.getReportData=function(t,e,r){var i=this.store.getAnonymousId(),n=this.store.getAccountId(),o=N(),a=this.getReportProperties(t,e),s=c(c({},a),r||{});this.checkReportProperties(s);var u={anonymous_id:i,type:t,event:e,time:o,_track_id:V(),properties:s};return n&&(u.account_id=n),u.send_time=N(),u},o.prototype.getReportProperties=function(t,e){void 0===t&&(t=""),void 0===e&&(e="");var r=D(this.presetProps),i=c(c({device_id:this.store.getDeviceId()},this.store.state.props),r);return t&&"user"===t.slice(0,4)||(i=c(c(c({},i),dt()),ot(Le))),"track"===t&&(i.H_is_first_day=this.store.isFirstDay,this.store.isFirstDay=!1,"H_pageview"===e&&(i.H_is_first_time=this.store.isFirstTime,this.store.isFirstTime=!1)),i},o}(Pt);var De=new Ne({},!1);export{r as ConsoleTypes,o as ErrorTypes,Ne as HinaTrack,a as PerformanceFeat,n as PlatformTypes,d as PluginBase,i as ReportTypes,s as VariablesTypes,De as default};
@@ -0,0 +1 @@
1
+ import{WebClient as t}from"hina-cloud-js-core";import{ReportTypes as e,ConsoleTypes as r,PluginBase as i,VariablesTypes as o,PlatformTypes as n}from"hina-cloud-type";export*from"hina-cloud-type";import{isFunction as a,getPageXYInfo as s,isObject as c,merge as l,isArray as u,getElementParents as p,isElement as h,isString as f,getElementProperties as g,nowStamp as d,getScrollTop as v,generatorTrackId as m,ListenPageState as y,mitt as _,safeJSONParse as k,formatDecimal as T,getURL as b,isBoolean as w,handleDecodeURLComponent as x,handleEncodeURLComponent as A,supportHistory as R,replaceOld as C,getPlatform as P,getQueryParam as S,isNumber as L,noop as H,isValid as N,isEmptyObject as I,AjaxRequest as E,State as D,BatchSend as U,getCurrentDomain as O,isReferralTraffic as B,getReferrer as W,SearchKeyword as F,getUmtsParams as j,utmTypes as M,getCustomUmtsParams as z,getPageProperties as V,getBrowserInfo as J,getHostname as K}from"hina-cloud-util";import{Monitor as Z}from"hina-cloud-js-monitor";var G=function(t,e){return G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},G(t,e)};function q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}G(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var $=function(){return $=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},$.apply(this,arguments)};function X(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Q(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,o,n=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}function Y(t,e,r){if(r||2===arguments.length)for(var i,o=0,n=e.length;o<n;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var tt=["mark","/mark","strong","b","em","i","u","abbr","ins","del","s","sup"],et=["a","input","button","textarea"],rt=["abtestExperimentId","paramName","valueType","defaultValue","callback","timeoutMilliseconds","customProperties","customIds"],it=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="ClickTrackPlugin",i.isReady=!1,i.isTrackList={a:!0,button:!0},i}return q(e,t),e.prototype.init=function(t){var e=this,i=this.options.autoTrackConfig,o=i.clickAutoTrack,n=i.isCollectUrl,u=i.isCollectElement,p=i.addCustomProperty;!0===o&&(this.isReady?this.context.log("ClickTrack plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,document.addEventListener("click",(function(r){if(n()){var i=r||window.event;if(i){var o=i.target||i.srcElement,h=e.getTargetElement(o);if(h){if(a(u)&&!u(h))return!1;var f=e.getClickElementInfo(h),g=s(i,h),d=g.H_page_x,v=g.H_page_y;if(f.H_page_x=d,f.H_page_y=v,a(p)){var m=p(h);c(m)&&(f=l(f,m))}t(f)}}}}),!0)))},e.prototype.transform=function(t){return this.context.getReportData("track","H_WebClick",t)},e.prototype.hasAttribute=function(t,e){var r;return t.hasAttribute?t.hasAttribute(e):t.attributes?!!(null===(r=t.attributes[e])||void 0===r?void 0:r.value):void 0},e.prototype.hasAttributes=function(t,e){if(u(e))for(var r=0;r<e.length;r++)if(this.hasAttribute(t,e[r]))return!0;return!1},e.prototype.hasElement=function(t){var e,r,i,o=p(t),n=this.options.autoTrackConfig.trackAttr||[];if(u(o)&&o.length>0)try{for(var a=X(o),s=a.next();!s.done;s=a.next()){var c=s.value,l=c.tagName&&(null===(i=c.tagName)||void 0===i?void 0:i.toLowerCase());if(h(c)&&(this.isTrackList[l]||this.hasAttributes(c,n)))return c}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}},e.prototype.getDivMaxLevel=function(){var t;return(null===(t=this.options.autoTrackConfig.collectTags.div)||void 0===t?void 0:t.maxLevel)||1},e.prototype.isStyleTag=function(t){var e,r=(null===(e=this.options.autoTrackConfig.collectTags.div)||void 0===e?void 0:e.ignoreTags)||[];return null==r?void 0:r.includes(t)},e.prototype.getCollectableParent=function(t){var e;try{var i=t.parentNode,o=i?null===(e=i.tagName)||void 0===e?void 0:e.toLowerCase():"";if("body"===o)return!1;var n=this.getDivMaxLevel();if("div"===o&&(n>1||this.isCollectableDiv(i)))return i;if(i&&this.isStyleTag(o))return this.getCollectableParent(i)}catch(t){this.context.log(t,r.ERROR)}return!1},e.prototype.isCollectableDiv=function(t){var e;try{var i=t.children||[];if(0===i.length)return!0;for(var o=0;o<i.length;o++){var n=i[o];if(h(n)){var a=null===(e=n.tagName)||void 0===e?void 0:e.toLowerCase(),s=this.getDivMaxLevel();if(!("div"===a&&s>1||this.isStyleTag(a)))return!1;if(!this.isCollectableDiv(n))return!1}}return!0}catch(t){this.context.log(t,r.ERROR)}return!1},e.prototype.isDivLevelValid=function(t){for(var e=this.getDivMaxLevel(),r=t.getElementsByTagName("div"),i=r.length-1;i>=0;i--)if(this.getDivLevels(r[i],t)>e)return!1;return!0},e.prototype.getElementPath=function(t,e,r){for(var i,o,n=[];h(t)&&t.parentNode;){if(t.id&&!e&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.id)){var a=t.tagName||"";n.unshift("".concat(a.toLowerCase(),"#").concat(t.id));break}if(r&&t===r){n.unshift(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase());break}if(t===document.body){n.unshift("body");break}n.unshift(null===(o=t.tagName)||void 0===o?void 0:o.toLowerCase()),t=t.parentNode}return n.join(" > ")},e.prototype.getDivLevels=function(t,e){var r=this.getElementPath(t,!0,e).split(" > "),i=0;return r.forEach((function(t){"div"===t&&i++})),i},e.prototype.getTargetElement=function(t){var e;if(!h(t))return null;var r=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if(!f(r))return null;if(["body","html"].includes(r))return null;if(this.context.trackTags.includes(r)&&"div"!==r)return t;if("div"===r&&this.options.autoTrackConfig.collectTags.div&&(this.isDivLevelValid(t)&&(this.getDivMaxLevel()>1||this.isCollectableDiv(t))))return t;if(this.options.autoTrackConfig.collectTags.div&&this.isStyleTag(r)){var i=this.getCollectableParent(t);if(i&&this.isDivLevelValid(i))return i}return this.hasElement(t)||null},e.prototype.getClickElementInfo=function(t){var e=this.options.autoTrackConfig.isCollectInput,r=!1;a(e)&&(r=e(t));var i=this.getDomSelector(t),o=g(t,r);return o.H_element_selector=i,o.H_element_path=this.getElementPath(t,!1),o},e.prototype.getDomSelector=function(t){for(var e,r=[];t;){if("body"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase())||!h(t)){r.unshift("body");break}if(r.unshift(this.getSelector(t)),(null==t?void 0:t.getAttribute("id"))&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.getAttribute("id")))break;t=t.parentNode}return r.join(" > ")},e.prototype.getSelector=function(t){var e,r,i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),o=-1;9!==(null===(r=t.parentNode)||void 0===r?void 0:r.nodeType)&&(o=this.getDomIndex(t));var n=t.getAttribute("id");return n&&/^[A-Za-z][-A-Za-z0-9_:.]*$/.test(n)?"#".concat(n):i+(o>-1?":nth-of-type(".concat(o+1,")"):"")},e.prototype.getDomIndex=function(t){var e,r;if(t.parentNode)for(var i=0,o=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase(),n=t.parentNode.children,a=0;a<n.length;a++){var s=n[a];if((null===(r=s.tagName)||void 0===r?void 0:r.toLowerCase())===o){if(s===t)return i;i++}}return-1},e}(i),ot=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="StayTrackPlugin",i.isReady=!1,i.timer=null,i.previousTime=d(),i.previousOffsetTop=0,i}return q(e,t),e.prototype.init=function(t){var e=this,i=this.options,o=i.autoTrackConfig,n=i.stayAutoTrackConfig;if(!0===o.stayAutoTrack)if(this.isReady)this.context.log("StayTrack plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var s=n.isCollectUrl;a(s)||(s=function(){return!0}),this.timer&&(clearTimeout(this.timer),this.timer=null),this.previousTime=d(),window.addEventListener("load",(function(){e.previousOffsetTop=v()})),window.addEventListener("scroll",(function(){s()&&(e.timer||(e.timer=setTimeout((function(){e.run(t),clearTimeout(e.timer),e.timer=null}),1e3)))})),window.addEventListener("unload",(function(){s()&&e.run(t,!0)}))}},e.prototype.transform=function(t){return this.context.getReportData("track","H_WebStay",t)},e.prototype.run=function(t,e){void 0===e&&(e=!1);var r=this.options.autoTrackConfig,i=r.stayDelayTime,o=r.maxStayPageDuration,n=v(),a=d(),s=a-this.previousTime;(e||s>i&&n!==this.previousOffsetTop)&&t({H_viewport_position:this.previousOffsetTop,event_duration:Math.min(s/1e3,o)});this.previousTime=a,this.previousOffsetTop=n},e}(i),nt=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="PageLeave",i.isReady=!1,i.pageId=m(),i.storageName="hinasdk_pageleave_",i.heartbeatIntervalTime=5e3,i.maxDuration=432e3,i.heartbeatIntervalTimer=null,i.startTime=d(),i.url=window.location.href,i.pageShowStatus=!0,i}return q(e,t),e.prototype.init=function(){if(this.options.autoTrackConfig.pageLeaveAutoTrack)if(this.context.store.localStorage)if(this.isReady)this.context.log("PageLeave plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var t=this.normalizePageLeaveAutoTrack(),e=t.heartbeat_interval_time,i=t.max_duration;e&&e>0&&(this.heartbeatIntervalTime=1e3*e),i&&i>0&&(this.maxDuration=Number(i)),this.startTime=d(),this.addPageLeaveEventListener(),document.hidden?this.pageShowStatus=!1:this.startHeartBeatInterval()}else this.context.log("PageLeave plugin需要使用localstorage存储数据,但是您的浏览器不支持localstorage,所以不能使用该功能",r.WARN)},e.prototype.transform=function(){},e.prototype.normalizePageLeaveAutoTrack=function(){var t=this.options.autoTrackConfig.pageLeaveAutoTrack;return c(t)?t:{}},e.prototype.addPageLeaveEventListener=function(){this.addPageStartListener(),this.addPageSwitchListener(),this.addSinglePageListener(),this.addPageEndListener()},e.prototype.addPageStartListener=function(){var t=this;"onpageshow"in window&&window.addEventListener("pageshow",(function(){t.pageStartHandler()}))},e.prototype.addPageSwitchListener=function(){var t=this;new y({visible:function(){t.pageStartHandler(),t.startHeartBeatInterval()},hidden:function(){t.url=window.location.href,t.pageEndHandler(),t.stopHeartBeatInterval()}})},e.prototype.addSinglePageListener=function(){var t=this;_.on("urlChange",(function(e){var r=e.fromHref;r!==e.toHref&&(t.url=r,t.pageEndHandler(),t.stopHeartBeatInterval(),t.pageStartHandler(),t.startHeartBeatInterval())}))},e.prototype.addPageEndListener=function(){var t=this,e=["pagehide","beforeunload","unload"];e.forEach((function(r){"on".concat(e)in window&&window.addEventListener(r,(function(){t.pageEndHandler(),t.stopHeartBeatInterval()}))}))},e.prototype.pageStartHandler=function(){this.startTime=d(),this.pageShowStatus=!document.hidden,this.url=window.location.href},e.prototype.pageEndHandler=function(){if(this.pageShowStatus){if(this.pageShowStatus=!1,this.isCollectUrl()){var t=this.getPageLeaveProperties(),e=this.context.getReportData("track","H_WebPageLeave",t);this.context.report(e)}this.delHeartBeatData()}},e.prototype.startHeartBeatInterval=function(){var t=this;this.heartbeatIntervalTimer&&this.stopHeartBeatInterval(),this.isCollectUrl()&&(this.heartbeatIntervalTimer=setInterval((function(){t.saveHeartBeatData()}),this.heartbeatIntervalTime),this.saveHeartBeatData("first_heartbeat")),this.reissueHeartBeatData()},e.prototype.reissueHeartBeatData=function(){for(var t=this.context.store.localStorage,e=t.length(),r=0;r<e;r++){var i=t.key(r);if(i&&i!==this.storageName+this.pageId&&i.includes(this.storageName)){var o=t.get(i),n=k(o);c(n)&&d()-n.time>n.heartbeat_interval_time+5e3&&(delete n.heartbeat_interval_time,this.context.report(n)),this.delHeartBeatData(i)}}},e.prototype.stopHeartBeatInterval=function(){this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)},e.prototype.delHeartBeatData=function(t){this.context.store.localStorage.remove(t||this.storageName+this.pageId)},e.prototype.isCollectUrl=function(){var t=this.normalizePageLeaveAutoTrack().isCollectUrl;return!a(t)||t(this.url)},e.prototype.saveHeartBeatData=function(t){var e=this.getPageLeaveProperties();e.H_time=d(),"first_heartbeat"===t&&(e.event_duration=3);var r=this.context.getReportData("track","H_WebPageLeave",e);r.heartbeat_interval_time=this.heartbeatIntervalTime,this.context.store.localStorage.set(this.storageName+this.pageId,JSON.stringify(r))},e.prototype.getPageLeaveProperties=function(){var t=(d()-this.startTime)/1e3;t=t<=0||t>this.maxDuration?0:T(t,3);var e=b(this.url),r=e.pathname,i=e.hash,o={H_url:this.url,H_url_path:r,H_url_hash:i};t&&(o.event_duration=t);var n=this.normalizePageLeaveAutoTrack().custom_props;return c(n)&&(o=$($({},o),n||{})),o},e}(i),at=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="SiteLinker",i.isReady=!1,i.linker=[],i}return q(e,t),e.prototype.init=function(){if(this.options.siteLinkerConfig){var t=this.getLinkerConfig().linker;u(t)&&t.length>0?this.isReady?this.context.log("SiteLinker plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,this.resolveOption(),this.setRefferId(),this.addClickListen()):this.context.log("siteLinker plugin: 请配置正确的linker参数",r.WARN)}},e.prototype.transform=function(){},e.prototype.getLinkerConfig=function(){var t=this.options.siteLinkerConfig||{},e=t.linker;return{linker:(void 0===e?[]:e)||[],re_login:t.re_login}},e.prototype.resolveOption=function(){for(var t=this.getLinkerConfig().linker,e=t.length,i=[],o=0;o<e;o++){var n=t[o],a=n.part_url,s=n.after_hash;/[A-Za-z0-9]+\./.test(a)&&w(s)?i.push({part_url:a,after_hash:s}):this.context.log("The configuration of linker ".concat(o+1," is not supported.Please check format"),r.WARN)}this.linker=i},e.prototype.setRefferId=function(){var t=this.getLinkerConfig().re_login,e=this.getUrlId(),r=e.startsWith("a");if(""!==(e=e.substring(1))){var i=this.context.store.getAnonymousId(),o=this.context.store.getAccountId();if(r){if(e!==i&&(this.context.store.state.anonymousId=e,this.context.store.save()),o){var n=this.context.getReportData("track_signup","H_SignUp",{});this.context.report(n)}}else(!o||t&&o!==e)&&this.context.setUserUId(e)}},e.prototype.getUrlId=function(){var t=window.location.href.match(/_hnsdk=([au][^\?\#\&\=]+)/);return u(t)&&t[1]?x(t[1]):""},e.prototype.getPartUrl=function(t){for(var e=this.linker.length,r=0;r<e;r++)if(t.includes(this.linker[r].part_url))return!0;return!1},e.prototype.getPartHash=function(t){for(var e=this.linker.length,r=0;r<e;r++)if(t.includes(this.linker[r].part_url))return this.linker[r].after_hash;return!1},e.prototype.getCurrentId=function(){var t=this.context.store.getAccountId(),e=this.context.store.getAnonymousId(),r=t?"u".concat(t):"a".concat(e);return A(r)},e.prototype.rewriteUrl=function(t,e){var r=/([^?#]+)(\?[^#]*)?(#.*)?/.exec(t),i="";if(r){var o=r[1]||"",n=r[2]||"",a=r[3]||"",s="_hnsdk=".concat(this.getCurrentId()),c=function(t){var e=t.split("&"),r=[];return e.forEach((function(t){t.includes("_hnsdk")?r.push(s):r.push(t)})),r.join("&")};if(this.getPartHash(t)){var l=a.includes("?"),u=a.indexOf("_hnsdk");i=l?u>=0?"".concat(o).concat(n,"#").concat(a.substring(1,u)).concat(c(a.substring(u,a.length))):"".concat(o).concat(n,"#").concat(a.substring(1),"&").concat(s):"".concat(o).concat(n,"#").concat(a.substring(1),"?").concat(s)}else{i=(l=/^\?(\w)+/.test(n))?n.includes("_hnsdk")?"".concat(o,"?").concat(c(n.substring(1))).concat(a):"".concat(o).concat(n,"&").concat(s).concat(a):"".concat(o,"?").concat(s).concat(a)}return e&&(e.href=i),i}},e.prototype.addClickListen=function(){var t=this,e=function(e){var r,i,o=e.target;if(o){var n=null===(r=o.tagName)||void 0===r?void 0:r.toLowerCase(),a=o.parentNode,s=null===(i=null==a?void 0:a.tagName)||void 0===i?void 0:i.toLowerCase();if("a"===n&&o.href||"a"===s&&a.href){var c=void 0,l=void 0;"a"===n&&o.href?(c=o.href,l=o):(c=a.href,l=a);var u=b(c).protocol;"http:"!==u&&"https:"!==u||t.getPartUrl(c)&&t.rewriteUrl(c,l)}}};"PointerEvent"in window?document.addEventListener("pointerdown",e):document.addEventListener("mousedown",e)},e}(i),st=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HistoryPlugin",i.isReady=!1,i.lastHref=window.location.href,i.lastPath=window.location.pathname,i}return q(e,t),e.prototype.init=function(){if(R())if(this.isReady)this.context.log("History plugin:插件已经运行,无需重复执行",r.WARN);else{this.isReady=!0;var t=this,e=window.onpopstate,i=function(e,r){var i={fromPath:t.lastPath,fromHref:t.lastHref,toPath:e,toHref:r};t.lastPath=e,t.lastHref=r,_.emit("urlChange",$($({},i),{mode:"history"}))};window.onpopstate=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=window.location.pathname,n=window.location.href;i(o,n),e&&e.apply(this,t)},C(window.history,"pushState",o),C(window.history,"replaceState",o)}function o(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];t.apply(this,e);var o=window.location.pathname,n=window.location.href;i(o,n)}}},e.prototype.transform=function(){},e}(i),ct=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HashPlugin",i.isReady=!1,i.lastHref=window.location.href,i.lastPath=window.location.hash,i}return q(e,t),e.prototype.init=function(){var t=this;this.isReady?this.context.log("Hash plugin:插件已经运行,无需重复执行",r.WARN):(this.isReady=!0,window.addEventListener("hashchange",(function(e){var r=e.newURL,i=b(r).hash,o={fromPath:t.lastPath,fromHref:t.lastHref,toPath:i,toHref:r};t.lastHref=r,t.lastPath=i,_.emit("urlChange",$($({},o),{mode:"hash"}))})))},e.prototype.transform=function(){},e}(i),lt="4.0.1",ut=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.options=e,i.context=r,i.name="HinaABTest",i.isReady=!1,i.platform=P(),i.projectKey="",i.storageName="hina_webjs_sdk_abtest",i}return q(e,t),e.prototype.init=function(){var t=this;if(this.context.store.localStorage){var e=this.options.abTestingPluginConfig,i=null==e?void 0:e.url;if(f(i)){var o=S(i,"project-key");if(o){this.projectKey=o;var n=b(i).protocol,a=b(window.location.href).protocol;if(n&&n!==a)this.context.log("A/B Testing 初始化失败,".concat(a," 页面必须使用 ").concat(a," 的 URL"),r.WARN);else if(this.isReady)this.context.log("A/B Testing 插件已经运行,无需重复执行",r.WARN);else{var s=this.context.getUserUid();this.context.log("当前accountId为:".concat(s),r.INFO),_.on("changeAccountId",(function(){t.context.store.localStorage.set(t.storageName,"")})),this.isReady=!0}}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL(必须包含 project-key)")}else this.context.log("A/B Testing 初始化失败,请使用正确的 URL!",r.WARN)}else this.context.log("A/B Testing 初始化失败,浏览器不支持localStorage",r.WARN)},e.prototype.transform=function(){},e.prototype.valueMatchType=function(t,e){switch(e){case o.INTEGER:return L(t);case o.STRING:return f(t);case o.BOOLEAN:return w(t);default:return!1}},e.prototype.normalizeParams=function(t,e,i){var n,s;void 0===i&&(i=rt);var l={verify_success:!0,para:e};try{for(var u=X(i),p=u.next();!p.done;p=u.next()){var h=p.value;if(!l.verify_success)break;var g=e.customIds||{},d={};switch(h){case"abtestExperimentId":f(e.abtestExperimentId)&&e.abtestExperimentId.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(h,"参数未正确配置!").concat(h,": ").concat(e.abtestExperimentId),r.WARN),l.verify_success=!1);break;case"paramName":f(e.paramName)&&e.paramName.trim()||(this.context.log("".concat(t,"方法调用失败,").concat(h,"参数未正确配置!").concat(h,": ").concat(e.paramName),r.WARN),l.verify_success=!1);break;case"valueType":[o.BOOLEAN,o.INTEGER,o.STRING].includes(e.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(h,"参数未正确配置!").concat(h,": ").concat(e.valueType),r.WARN),l.verify_success=!1);break;case"defaultValue":this.valueMatchType(e.defaultValue,e.valueType)||(this.context.log("".concat(t,"方法调用失败,").concat(h,"类型必须与valueType一致!"),r.WARN),l.verify_success=!1);break;case"callback":a(e.callback)||(this.context.log("".concat(t,"方法调用失败,").concat(h,"参数未正确配置")),e.callback=H,l.verify_success=!1);break;case"timeoutMilliseconds":(!L(e.timeoutMilliseconds)||e.timeoutMilliseconds<=0)&&(this.context.log("".concat(h,"参数错误:").concat(e.timeoutMilliseconds),r.WARN),e.timeoutMilliseconds=3e3),e.timeoutMilliseconds<200&&(e.timeoutMilliseconds=200);break;case"customProperties":e.customProperties=c(e.customProperties)?e.customProperties:{};break;case"customIds":for(var v in g)(f(g[v])||L(g[v]))&&(d[v]=g[v]);e.customIds=d}}}catch(t){n={error:t}}finally{try{p&&!p.done&&(s=u.return)&&s.call(u)}finally{if(n)throw n.error}}return l},e.prototype.sendTriggerEvent=function(t){var e=t.abtest_experiment_group_id,r=t.abtest_experiment_id;this.context.track("H_ABTestTrigger",{H_abtest_experiment_id:r,H_abtest_experiment_group_id:e})},e.prototype.getExpResult=function(t,e){var r,i;void 0===e&&(e=[]);var o,n=t.abtestExperimentId,a=t.paramName,s=t.valueType;if(0===e.length){var l=this.getStorageData();c(l)&&(e=l.result||[])}try{for(var u=X(e),p=u.next();!p.done;p=u.next()){var h=p.value,f=h.abtest_experiment_id,g=h.abtest_experiment_group_id,d=h.is_white_list,v=h.variables;if(f===n){var m=v.find((function(t){return t.name===a&&t.type===s}));if(m){d||this.sendTriggerEvent({abtest_experiment_id:f,abtest_experiment_group_id:g}),o=m.value;break}}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return o},e.prototype.getStorageData=function(){var t=this.context.store.localStorage.get(this.storageName);return N(t)?k(t):null},e.prototype.saveResponseData=function(t){var e=this.getStorageData(),r={updateTime:d()};if(e&&c(e)){var i=[],o=e.result||[];t.forEach((function(t){var e=t.abtest_experiment_group_id,r=t.abtest_experiment_id,n=t.variables,a=o.find((function(t){return t.abtest_experiment_id===r&&t.abtest_experiment_group_id===e}));if(a){var s=[];n.forEach((function(t){var e=t.name,r=t.type,i=a.variables.findIndex((function(t){return t.name===e&&t.type===r}));i>=0?a.variables[i]=t:s.push(t)})),a.variables=Y(Y([],Q(a.variables),!1),Q(s),!1)}else i.push(t)})),r.result=Y(Y([],Q(o),!1),Q(i),!1)}else r.result=t;this.context.store.localStorage.set(this.storageName,JSON.stringify(r))},e.prototype.createRequestData=function(t){var e=t.paramName,r=t.customProperties,i=t.customIds,o={anonymous_id:this.context.store.getAnonymousId(),platform:this.platform,abtest_lib_version:lt,param_name:e,properties:this.context.getPresetProperties()};return c(r)&&!I(r)&&(o.custom_properties=r),c(i)&&!I(i)&&(o.custom_ids=i),this.context.getUserUid()&&(o.login_id=this.context.getUserUid()),o},e.prototype.getResultFromServer=function(t){var e=this;return new Promise((function(r,i){var o=e.createRequestData(t);new E({url:e.options.abTestingPluginConfig.url,data:JSON.stringify(o),contentType:"application/json",customHeaders:{"project-key":e.projectKey},timeout:t.timeoutMilliseconds}).run().then((function(t){var o=t.data;"SUCCESS"===(null==o?void 0:o.status)?(e.saveResponseData(o.results),r(o)):i()}))}))},e.prototype.asyncFetch=function(t){var e=this;return new Promise((function(r){e.getResultFromServer(t).then((function(t){r(t)})).catch((function(){t.callback(t.defaultValue)}))}))},e.prototype.preFetch=function(t,e){return this.isReady?!!c(e)||(this.context.log("".concat(t," 方法参数必须是对象"),r.WARN),!1):(this.context.log("A/B Testing 插件尚未运行,请先执行该插件",r.WARN),!1)},e.prototype.asyncFetchABTest=function(t){var e=this;if(this.preFetch("asyncFetchABTest",t)){var r=this.normalizeParams("asyncFetchABTest",t),i=r.verify_success,o=r.para;i?this.asyncFetch(o).then((function(t){var r=e.getExpResult(o,t.results);o.callback(r||o.defaultValue)})):o.callback(o.defaultValue)}},e.prototype.fetchCacheABTest=function(t){if(this.preFetch("fetchCacheABTest",t)){var e=this.normalizeParams("fetchCacheABTest",t),r=e.verify_success,i=e.para;if(r){var o=this.getExpResult(i);i.callback(o||i.defaultValue)}else i.callback(i.defaultValue)}},e.prototype.fastFetchABTest=function(t){var e=this;if(this.preFetch("fastFetchABTest",t)){var r=this.normalizeParams("fastFetchABTest",t),i=r.verify_success,o=r.para;if(i){var n=this.getExpResult(o);N(n)?o.callback(n):this.asyncFetch(o).then((function(){var t=e.getExpResult(o);o.callback(t||o.defaultValue)}))}else o.callback(o.defaultValue)}},e}(i),pt=function(t){function i(e,r){void 0===r&&(r=!0);var i=t.call(this,e,r)||this;return i.consolePrefix="埋点SDK",i.trackTags=et,i.presetProps={},i.useInstancing&&i.init(e),i}return q(i,t),i.prototype.init=function(t){if(this.isReady)this.log("hinaSDK has been initialized",r.ERROR);else{var i={name:"",serverUrl:"",showLog:!1,autoTrackConfig:{clickAutoTrack:!0,stayAutoTrack:!0,isCollectUrl:function(){return!0},isCollectElement:function(){return!0},isCollectInput:function(){return!1},addCustomProperty:function(){},stayDelayTime:4e3,maxStayPageDuration:18e3,collectTags:{div:!1},trackAttr:["hn-click"],pageviewAutoTrack:!1,pageLeaveAutoTrack:!1},stayAutoTrackConfig:{isCollectUrl:function(){return!0}},maxStringLength:1024,imgUseCrossOrigin:!1,isSinglePage:!1,batchSend:!1,appJsBridge:!1,sendType:e.BEACON,customHeaders:{},credentials:!1,dataSendTimeout:3e3,presetProperties:{latest_utm:!0,latest_traffic_source_type:!0,latest_search_keyword:!0,latest_referrer:!0,url:!0,title:!0},sourceChannel:[],plugins:[]},o=t.performanceErrorConfig,n=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(r[i[o]]=t[i[o]])}return r}(t,["performanceErrorConfig"]);this.options=l(i,n),this.options=$($({},this.options),{performanceErrorConfig:o}),this.initState(),this.normalizeConfig(),this.initAdvProps(),this.initPlugins(),this.isReady=!0}},i.prototype.initState=function(){this.store=new D(this.options),this.store.init()},i.prototype.normalizeConfig=function(){var t=this,i=this.options,o=i.serverUrl,s=i.sendType,l=i.batchSend,p=i.maxStringLength,h=i.isSinglePage,g=i.autoTrackConfig,d=void 0===g?{}:g,v=d.trackAttr,m=void 0===v?[]:v,y=d.collectTags,k=d.pageLeaveAutoTrack,T=d.pageviewAutoTrack;if(""===(o=(o=o||"").trim()))this.log("当前 serverUrl 为空,network 中不会发数据,请配置正确的 serverUrl!",r.WARN);else{var w=window.location.href,x=b(w).protocol||"";(b(o).protocol||"")!==x&&this.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为:https 下面发送 http 的图片请求会失败。",r.WARN)}[e.IMAGE,e.AJAX,e.BEACON].includes(s)||this.setConfig({sendType:e.AJAX});var A=p;if(!L(p)||p<0?A=1024:p>5120&&(A=5120),this.options.maxStringLength=A,(!0===k||c(k)&&I(k))&&(this.options.autoTrackConfig.pageLeaveAutoTrack={heartbeat_interval_time:5e3,max_duration:432e3}),u(m)?(m=m.filter((function(t){return f(t)}))).includes("hn-click")||m.push("hn-click"):m=["hn-click"],this.options.autoTrackConfig.trackAttr=m,c(y))if(!0===y.div)this.options.autoTrackConfig.collectTags.div={ignoreTags:tt,maxLevel:1};else if(c(y.div)){var R=1,C=y.div;L(C.maxLevel)&&[1,2,3].includes(C.maxLevel)&&(R=C.maxLevel),this.options.autoTrackConfig.collectTags.div={ignoreTags:tt,maxLevel:R}}else this.options.autoTrackConfig.collectTags.div=!1;else this.options.autoTrackConfig.collectTags={div:!1};this.updateTrackTags(),(!0===l||c(l)&&!I(l))&&(this.options.batchSend=$({dataSendTimeout:6e3,sendInterval:6e3,storageLimit:200},l),this.batchSender=new U(this.options,n.WEB,"hinasdk_tab","hinasdk_data_")),"auto"===T?this.autoTrack():("singlePage"===T||h)&&(this.autoTrack(),_.on("urlChange",(function(e){var r=e.fromHref;if(r!==e.toHref){if(a(h)){var i=h();c(i)&&(e=$($({},e),i))}t.autoTrack($($({},e),{H_referrer:r}))}})))},i.prototype.updateTrackTags=function(){var t=this.options.autoTrackConfig.collectTags,e=Y([],Q(et),!1);Object.keys(t||{}).forEach((function(r){var i=t[r];!0!==i&&!c(i)||e.includes(r)||e.push(r)})),this.trackTags=e},i.prototype.initAdvProps=function(){var t={},e=this.options,r=e.presetProperties,i=e.sourceChannel;Object.keys(r||{}).forEach((function(e){var i=r[e];if(e.includes("latest_")&&(e=e.slice(7),i)){var o=O();if("utm"!==e&&"url解析失败"===o)t["H_latest_".concat(e)]="url的domain解析失败";else if(B())switch(e){case"traffic_source_type":t.H_latest_traffic_source_type=F.getSourceFromReferrer();break;case"search_keyword":var n=F.getKeywordFromReferrer();n&&(t.H_latest_search_keyword=n);break;case"referrer":t.H_latest_referrer=W()}}}));var o=this.store.state.props||{},n={};r.latest_utm&&(n=j("H_latest_"));var a={};o.H_utm_source||(a=j("H_"));var s={},c={};if(u(i)&&i.length>0){var l=i.filter((function(t){return!M.includes(t)}));l.length>0&&(o["H_".concat(l[0])]||(c=z("H_",l)),s=z("H_latest_",l))}this.store.state.props=$($($($($($({},this.store.state.props),t),n),s),c),a),this.store.setProps(this.store.state.props)},i.prototype.initPlugins=function(){var t=this,e=this.options,r=e.serverUrl,i=e.name,o=e.showLog,n=e.sendType,a=e.customHeaders,s=e.credentials,l=e.dataSendTimeout,p=e.batchSend,h=e.imgUseCrossOrigin,f=e.globalCallback,g=e.plugins,d=void 0===g?[]:g,v=e.performanceErrorConfig,m=e.autoTrackConfig,y=e.siteLinkerConfig,_=e.abTestingPluginConfig;d=d||[];var k=m.pageLeaveAutoTrack,T=new it(this.options,this),b=new ot(this.options,this),w=new st(this.options,this),x=new ct(this.options,this);if(this.plugins=[T,b,w,x],c(k)&&!I(k)){var A=new nt(this.options,this);this.plugins.push(A)}var R=(y||{}).linker;if(u(R)&&R.length>0){var C=new at(this.options,this);this.plugins.push(C)}if(c(_)&&!I(_)){var P=new ut(this.options,this);this.plugins.push(P)}if(d.forEach((function(e){var r=new e(t.options,t);t.plugins.push(r)})),c(v)&&!I(v)){var S=$({serverUrl:r,name:i,showLog:o,sendType:n,customHeaders:a,credentials:s,dataSendTimeout:l,batchSend:p,imgUseCrossOrigin:h,globalCallback:f},v);this.epmInstance=new Z(S,!0)}this.runPlugins(this.plugins)},i.prototype.use=function(t,e){var i=this,o=this.options,n=o.autoTrackConfig,a=o.siteLinkerConfig,s=o.abTestingPluginConfig,l=n.pageLeaveAutoTrack,u=function(t){var e=new t(i.options,i);i.plugins.push(e),e.init()};if(this.isReady){if(c(e))return"PageLeave"===t?c(l)&&!I(l)?this.log("PageLeave插件已运行,无需重复执行",r.WARN):(this.options.autoTrackConfig.pageLeaveAutoTrack=e,u(nt)):"SiteLinker"===t?c(a)&&!I(a)?this.log("SiteLinker插件已插件已运行,无需重复执行",r.WARN):(this.options.siteLinkerConfig=e,u(at)):"HinaABTest"===t&&(c(s)&&!I(s)?this.log("HinaABTest插件已运行,无需重复执行",r.WARN):(this.options.abTestingPluginConfig=e,u(ut))),this.getPluginInstance(t);this.log("".concat(t,"插件配置项必须是一个对象类型"),r.WARN)}else this.log("请先初始化埋点SDK",r.WARN)},i.prototype.getPluginInstance=function(t){return this.plugins.find((function(e){return e.name===t}))},i.prototype.setConfig=function(t){this.options=l(this.options,t),this.normalizeConfig()},i.prototype.getConfig=function(t){return t?this.options[t]:this.options},i.prototype.setUserUId=function(t,e){if(L(t=null!=t?t:"")||f(t))if(t=String(t).trim(),this.store.getAccountId()!==t){this.store.setAccountId(t);var i=this.getReportData("track_signup","H_SignUp",{});this.report(i,e),_.emit("changeAccountId")}else this.log("setUserUId: uid is equal to account_id, , failed to execute setUserUId",r.WARN);else this.log("setUserUId: uid must be string or number",r.WARN)},i.prototype.getUserUid=function(){return this.store.state.accountId},i.prototype.setDeviceUId=function(t){this.store.setDeviceId(t)},i.prototype.getDeviceUId=function(){return this.store.getDeviceId()},i.prototype.userSet=function(t,e){if(c(t)&&!I(t)){var r=this.getReportData("user_set","",t);this.report(r,e)}},i.prototype.userSetOnce=function(t,e){if(c(t)&&!I(t)){var r=this.getReportData("user_setOnce","",t);this.report(r,e)}},i.prototype.userAdd=function(t,e){var i,o=this;f(t)&&((i={})[t]=1,t=i);if(c(t)&&!I(t)&&function(t){for(var e in t)if(!/-*\d+/.test(String(t[e])))return o.log("userAdd属性的值只能是数字",r.WARN),!1;return!0}(t)){var n=this.getReportData("user_add","",t);this.report(n,e)}},i.prototype.userAppend=function(t,e){var r={};if(c(t)&&(Object.keys(t).forEach((function(e){var i=t[e];u(i)?r[e]=i:r[e]=[i]})),!I(r))){var i=this.getReportData("user_append","",r);this.report(i,e)}},i.prototype.userUnset=function(t,e){var i=this,o={};if(f(t)&&(t=[t]),u(t)){if(t.forEach((function(t){f(t)?o[t]=!0:i.log("userUnset参数数组里面的值必须时string,已经过滤掉".concat(t),r.WARN)})),!I(o)){var n=this.getReportData("user_unset","",o);this.report(n,e)}}else this.log("userUnset参数必须是数组或字符串",r.WARN)},i.prototype.userDelete=function(t){var e=this.getReportData("user_delete","",{});this.report(e,t),this.store.setAccountId("")},i.prototype.registerCommonProperties=function(t){this.presetProps=l(this.presetProps,t)},i.prototype.getPresetProperties=function(){return{H_is_first_day:this.store.isFirstDay,H_is_first_time:this.store.isFirstTime,device_id:this.store.getDeviceId(),anonymous_id:this.store.getAnonymousId(),account_id:this.store.getAccountId(),properties:$($($({},this.presetProps),V()),J(lt))}},i.prototype.clearPageRegister=function(t){var e=this;void 0===t&&(t=!0),!0===t?this.presetProps={}:u(t)&&t.forEach((function(t){t in e.presetProps&&delete e.presetProps[t]}))},i.prototype.checkReportProperties=function(t){var e=this,r=this.options.maxStringLength;Object.keys(t).forEach((function(i){var o=t[i];if(f(o)&&o.length>r)e.log("属性 ".concat(i," 已经做截取")),t[i]=o.slice(0,r);else if(c(o))e.checkReportProperties(o);else if(a(o))try{t[i]=o(t),a(t[i])?(e.log("属性--".concat(i," 格式不满足要求, 已被删除")),delete t[i]):c(t[i])?e.checkReportProperties(t[i]):f(t[i])&&t[i].length>r&&(t[i]=t[i].slice(0,r))}catch(r){e.log("属性--".concat(i," 格式不满足要求, 已被删除")),delete t[i]}}))},i.prototype.track=function(t,e,i){if(i=i||function(){},f(t)){e=c(e)?e:{};var o=this.getReportData("track",t,e);this.report(o,i)}else this.log("track事件名必须是字符串,属性必须是是一个对象",r.WARN)},i.prototype.quick=function(t,e,r){var i={};r=a(r)?r:H,c(e)?i=e:a(e)&&(r=e),this.autoTrack(i,r)},i.prototype.autoTrack=function(t,e){void 0===t&&(t={}),void 0===e&&(e=H);var r=this.getReportData("track","H_pageview",t);if(this.report(r,e),this.store.isSetFirstVisit){this.store.isSetFirstVisit=!1;var i=W();this.userSetOnce({H_first_referrer:i,H_first_referrer_host:i?K(i,"取值异常"):"",H_first_traffic_source_type:F.getSourceFromReferrer(),H_first_search_keyword:F.getKeywordFromReferrer(),H_first_visit_time:d(),H_first_browser_language:f(navigator.language)?navigator.language.toLowerCase():"取值异常"})}},i.prototype.report=function(t,e,i){var o,n,s=this.options,l=s.appJsBridge,u=s.serverUrl;if(this.log(t),l){var p=!0,h=null===window||void 0===window?void 0:window.Hina_Cloud_H5_Bridge;if(c(h)&&h.track)p=!1,h.track(t.event,t.type,JSON.stringify(t));else{var f=null===(n=null===(o=null===window||void 0===window?void 0:window.webkit)||void 0===o?void 0:o.messageHandlers)||void 0===n?void 0:n.hinaNativeTracker;if(null==f?void 0:f.postMessage){p=!1;var g=JSON.stringify({eventName:t.event,eventType:t.type,properties:t});f.postMessage(g)}}if(p)return void this.log("JSBridge 发送数据失败",r.WARN);a(e)&&e(u,t)}else this.sendReportData(t,e,i)},i.prototype.getReportData=function(t,e,r){var i=this.store.getAnonymousId(),o=this.store.getAccountId(),n=d(),a=this.getReportProperties(t,e),s=$($({},a),r||{});this.checkReportProperties(s);var c={anonymous_id:i,type:t,event:e,time:n,_track_id:m(),properties:s};return o&&(c.account_id=o),c.send_time=d(),c},i.prototype.getReportProperties=function(t,e){void 0===t&&(t=""),void 0===e&&(e="");var r=l(this.presetProps),i=$($({device_id:this.store.getDeviceId()},this.store.state.props),r);return t&&"user"===t.slice(0,4)||(i=$($($({},i),V()),J(lt))),"track"===t&&(i.H_is_first_day=this.store.isFirstDay,this.store.isFirstDay=!1,"H_pageview"===e&&(i.H_is_first_time=this.store.isFirstTime,this.store.isFirstTime=!1)),i},i}(t);var ht=new pt({},!1);export{pt as HinaTrack,ht as default};