define("app.js",(function(e,t,a,n,r,i,o,s,l,c,u,d,p,f,g,_,h,m,y,v,L,b,E,w){"use strict";var x=M(e("./polifill/index.js")),I=e("./utils/slardarSetup"),P=e("./services/index"),D=M(e("./utils/intl")),T=e("./utils/util"),k=M(e("./i18n/locale/index")),R=e("./utils/sentry/index"),A=e("./utils/checkAuthority"),U=e("./libs/event/index"),C=e("./utils/tea"),F=e("./utils/const"),S=e("./trace/index"),q=M(e("./utils/logger")),H=e("./extComponents/xor-crypt-ts/xorEncrypt"),N=e("./utils/forceUpdate"),O=M(e("./config/index")),B=e("./const/events");function M(e){return e&&e.__esModule?e:{default:e}}function j(e,t,a,n,r,i,o){try{var s=e[i](o),l=s.value}catch(e){return void a(e)}s.done?t(l):Promise.resolve(l).then(n,r).catch((function(e){throw getApp().globalData.sendError(e),e}))}function W(e){return function(){var t=this,a=arguments;return new Promise((function(n,r){var i=e.apply(t,a);function o(e){j(i,n,r,o,s,"next",e)}function s(e){j(i,n,r,o,s,"throw",e)}o(void 0)})).catch((function(e){throw getApp().globalData.sendError(e),e}))}}var Y,V,z=O.default.env,G=T.sysInfo.platform,J=["pages/inputPassword/inputPassword","pages/identify/identify","pages/noAuth/noAuth","pages/downloadLark/downloadLark"],K={online:"lark_payroll_minigram_force_update",staging:"lark_payroll_mini_program_setting_staging","global-online":"lark_payroll_minigram_force_update_global_online","global-staging":"lark_payroll_minigram_force_update_global_online_staging"};(0,C.initTea)(),App({query:{},onLaunch:(V=W(x.default.mark((function e(t){var a,n,r,i,o=this;return x.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return U.appLifeEvents.on(B.ReachLimitEvents.REACH_LIMIT,(function(){o.globalData.reachLimit=!0})),U.appLifeEvents.on(B.ReachLimitEvents.RESET_STATUS,(function(){o.globalData.reachLimit=!1})),a=K[z],this._setLocal(),e.next=6,(0,A.checkSaasAuth)();case 6:if(!e.sent){e.next=17;break}return U.appLifeEvents.emit("launch"),e.next=11,(0,P.getSaasUserInfo)(!0);case 11:return(n=e.sent)&&n.success?(r=(t||{}).query,this.query=r||{},this.initByUserInfo(),U.appLifeEvents.emit("userInfoReady")):(0,R.sentryReportError)("获取用户信息失败"),e.next=15,(0,P.getFeatgray)();case 15:(i=e.sent)&&i.success&&(this.globalData.gateWay=(i.data.remuneration||[]).some((function(e){return"feat-sass-payroll-gateWay"===e})),this.globalData.isDetailFeatgrey=(i.data.remuneration||[]).some((function(e){return"feat-payroll-new"===e})));case 17:(0,N.checkUpdate)(a,!0,"lark_payroll_mini_program_setting");case 18:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)}),onShow:function(e){var t=e||{},a=t.scene,n=t.path,r=t.query,i=Number(a)===F.OPEN_SCENE_MAP.FROM_APP_CENTER;if(this.enterTime=Date.now(),this.scene=a,this.appHideFlag=!1,this.globalData.reachLimit&&(this.globalData.reachLimit=!1,n)){var o=(0,T.clapFormat)(r);tt.reLaunch({url:"".concat(n).concat(o?"?".concat(o):"")})}else"dev"!==z&&setTimeout((function(){var e=(0,T.getCurPage)();if(e){var t=e.__route__,a=e.options;if(J.every((function(e){return e!==t}))){var n="/".concat(t,"?")+(0,T.clapFormat)(a);if(i)tt.reLaunch({url:"/pages/inputPassword/inputPassword"});else{if("pages/secondaryDetail/secondaryDetail"===t){var r=getCurrentPages(),o=["pages/detailv2/detail","pages/detail/detail"],s=r.reverse().findIndex((function(e){return-1!==o.indexOf(e.__route__)}));if(-1!==s){var l=r[s],c=l.__route__,u=l.options;return tt.reLaunch({url:"/pages/inputPassword/inputPassword?next=".concat(encodeURIComponent("/".concat(c,"?").concat((0,T.clapFormat)(u))))})}}tt.reLaunch({url:"/pages/inputPassword/inputPassword?next=".concat(encodeURIComponent(n))})}}}}),300)},teaTrack:function(e){var t=e.id,a=e.userId,n=e.tenantId,r=e.bytedance,i=e.is_global_tenant,o=e.country;(0,C.setUserInfoToTea)({id:t},{userId:a},{tenantId:n,bytedance:r,is_global_tenant:i});var s=this.query.detail?"bot":"normal",l="from-".concat(s);(0,C.trackPage)(l),(0,S.Tea_ENTER_PAYROLL)(s,o)},initByUserInfo:function(){var e=this.globalData.UserInfo,t=e.name,a=e.id,n=e.tenant_id,r=e.email,i=e.overseas,o=e.country_location,s=this.globalData.isBytedance;this.teaTrack({id:a,userId:a,tenantId:n,bytedance:s?1:0,is_global_tenant:i?1:0,country:o&&o.name||""}),(0,R.sentryInit)({name:t,email:r}),q.default.log("logId:",(0,H.encrypto)(a,147,16)),(0,I.setSlardarUserConfig)({userId:a})},_setLocal:function(){var e=T.systemLanguage.localePrefix,t=new D.default;try{t.config({currentLocale:e,locales:k.default}),this.globalData.intl=t}catch(e){console.error("intl config fail:",e)}},onHide:(Y=W(x.default.mark((function e(){var t;return x.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._reset(),this.enterTime&&(t=Date.now()-this.enterTime,(0,S.Tea_LEAVE_PAYROLL)(t));case 2:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)}),onError:function(e){(0,R.sentryReportError)(e),e&&I.sladarLogger.error(e)},_reset:function(){this.appHideFlag=!0},appHideFlag:!1,globalData:{UserInfo:void 0,intl:null,isBytedance:!1,sendError:R.sentryReportError,platform:G,reachLimit:!1}})}));