text: 'use strict';var _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a};!function(require,directRequire){function a(){n.removeAudio(),o.removeAudio(),y.resetNetworkStatus(),z.clearAuthorizeQueue()}function b(a){const b={scene:q.SCENE_DEFAULT,path:'',query:{}};if(a&&a.condiction)b.path=a.condiction.pathName||'',b.query=a.condiction.query||{},b.scene=a.condiction.scene||q.SCENE_DEFAULT;else{const a=i.getCompileCondiction();if(a){const c=a.query&&a.query.split('&')||[];c.forEach((a)=>{if(a){const c=a.split('=');b.query[c[0]]=c[1]||''}}),a.pathName&&(b.path=a.pathName);const d=b.scene=a.scene||q.SCENE_DEFAULT;if(d==q.SCENE_SHARE_TICKET&&(b.shareInfo=a.shareInfo),(d==q.SCENE_MINI_PROGRAM||d==q.SCENE_MINI_PROGRAM_BACK||d==q.SCENE_PROFILE||d==q.SCENE_CUSTOM_MENU||d==q.SCENE_APP_SHARE_MESSAGE||d==q.SCENE_TEMPLETE_MESSAGE)&&(b.referrerInfo=_extends({},a.referrerInfo),d==q.SCENE_MINI_PROGRAM||d==q.SCENE_MINI_PROGRAM_BACK))try{b.referrerInfo.extraData=JSON.parse(b.referrerInfo.extraData||'{}')}catch(a){b.referrerInfo.extraData={}}}}return b}function c(a){return{type:g.SIMULATOR_SET_BACKGROUND,data:a}}const d=require('path'),e=require('url'),f=require('child_process'),g=require('./0634ee2ebd3e560d9d4804ecc960160f.js'),h=require('./15ba1827c7f6564a45df6bd44da3a977.js'),i=require('./3bfffbe88b3d923921f851c0697974fe.js'),j=require('./1dea83a77e99a7c94f6b6f01f5c175b0.js'),k=require('./1bd2563d13db26950ae47494b2c34454.js'),l=require('./f171257bbcaef547a3cf27266ccb0db2.js'),m=require('./72653d4b93cdd7443296229431a7aa9a.js'),n=require('./35a5c665bbd039baf968211c3ff216fc.js'),o=require('./f7806acc0e6f141f3b11c7faf34d32ad.js'),p=require('./83822ab95828f61bf6a61c04d53246a8.js'),q=require('./6242f55dbdfe53c2f07b7a51568311f2.js'),r=require('./da7c31daaf542cf1796023d8e344b98a.js'),s=require('./2dfc6a3df6d6fc51266b293c8420e88b.js'),t=require('./56c390e04c10e91a4aa2a2c19d9a885d.js'),u=require('./common/locales/index.js'),v=require('./cc2c2970ff81ae4a83123e81ee123da2.js'),w=require('./fc137838572a83604db39acff8e909e0.js'),x=require('./d3976cc01aeebc5b09e11c4135b6bd8d.js'),y=require('./a81bc67025235ccc252f27ad624704e9.js'),z=require('./fbb55aa732a5fdce7b8e14171c2b3361.js'),A=require('./9fdd4ac31a05c27355910f0d74accd4c.js'),B=require('./633001216e9782bc5ed307a07380083e.js'),C=require('./a78e6d6a87de1708226375ca4c320d76.js'),D=require('./344232cd2199c9c3a024b4005d054672.js'),{canSimulatorRotate:E}=require('./a3d662b5798bbb27bf21be3e3587a588.js'),F=(a,b)=>({type:g.SIMULATOR_LOAD_SUBPACKAGE,data:{root:a,loaded:b}}),G=(a={})=>{const b=i.getCurrent(),c=b.appid,d=a.origin;return d==t.COMPILE_ORIGIN.SAVE_FILE?r('weapp_filechange_compile',c):d==t.COMPILE_ORIGIN.BUTTON?r('weapp_toolbar_compile',c):d==t.COMPILE_ORIGIN.SHORT_CUT&&r('weapp_key_compile',c),async(c)=>{await C.disableAllAttached('simulator'),(d==t.COMPILE_ORIGIN.BUTTON||d==t.COMPILE_ORIGIN.SHORT_CUT)&&b.setting&&b.setting.scriptsEnable&&b.scripts&&b.scripts.beforeCompile?B(c,a,{command:b.scripts.beforeCompile,options:{cwd:b.projectpath,shell:!0}}):c({type:g.SIMULATOR_COMPILE,data:a})}};module.exports={launch:function(){return a(),async(a,c)=>{const e=i.getCurrent()||{},f=c(),h=await j(e),k=h.extAppid||e.appid,l=h.entryPagePath.replace(/\.html$/,'');let m=!1;e.runtimeAttr&&e.runtimeAttr.appid===k||(a(v.setProjectRuntimeAttr({appid:k})),await v.requestProjectAttr(!0)(a));const n=b(f.simulator.compileCommand);n.path=n.path||l,E(f,{pathName:n.path,appConfig:h})||a(w.setDeviceRotated(!1));const o=n.path;l!=o&&(m=!0);let p=!1;if(-1===h.pages.indexOf(o)){const b=x.checkIsInSubPackage(h,o);if(!b)p=!0;else{let c=!1;b.pages.forEach((a)=>{d.posix.join(b.root,a)==o&&(c=!0)}),c?setTimeout(()=>{a(F(b.root,!1))}):p=!0}}p&&s.display({command:t.DISPLAY_ERROR,data:{title:u.config.JSON_CUSTOM_COMPILE_PATH_NOT_EXISTS_TITLE,error:{message:u.config.JSON_CUSTOM_COMPILE_PATH_NOT_EXISTS.format(o)}}}),a({type:g.SIMULATOR_LAUNCH,data:{home:m,pathName:o,query:n.query,scene:n.scene,appLaunchInfo:n,isEntryPage:!0,pageNotFound:p},appConfig:h})}},setAppLaunched:(a)=>(b)=>{a&&b({type:g.SIMULATOR_SET_APP_LAUNCHED,flag:a})},setWebviewReady:function(a,b){return{type:g.SIMULATOR_SET_WEBVIEW_READY,webviewID:a,ready:b}},hidePreviewImage:function(){return{type:g.SIMULATOR_SET_PREVIEW_IMAGE,data:{show:!1}}},hideActionSheet:function({callbackID:a,res:b}){return(c)=>{c({type:g.SIMULATOR_SET_ACTIONSHEET,data:{show:!1,callbackID:null,showOnWebviewID:-1}}),a&&c({type:g.ASSDK_CALLBACK,callbackID:a,res:b})}},hideModal:function({callbackID:a,res:b}){return(c)=>{c({type:g.SIMULATOR_UNSET_MODAL,data:{callbackID:a}}),a&&c({type:g.ASSDK_CALLBACK,callbackID:a,res:b})}},hidePicker:function({callbackID:a,webviewID:b,res:c}){return(d)=>{d({type:g.SIMULATOR_SET_PICKER,data:{show:!1}}),a&&d({type:g.JSSDK_CALLBACK,callbackID:a,webviewID:b,res:c})}},hideShare:function({callbackID:a,res:b}){return(c)=>{c({type:g.SIMULATOR_SET_SHARE,data:{show:!1}}),a&&c({type:g.ASSDK_CALLBACK,callbackID:a,res:b})}},hideGroupList:function(a){return(b)=>{b({type:g.SIMULATOR_SET_GROUP_INFO,data:{show:!1}}),a&&b({type:g.SIMULATOR_SET_SHARE,data:{show:!0,group:a}})}},setDebuggee:function(a,b,c){return{type:g.SIMULATOR_SET_DEBUGGEE,debuggee:a,webviewID:b,flag:c}},hideConfirm:function(){return{type:g.SIMULATOR_SET_CONFIRM,data:{show:!1,content:'',callback:()=>{}}}},hideSetting:function({scopeList:a,callbackID:b,api:c}){return async(d)=>{let f='';if(a&&0<a.length)try{const{body:b}=await h({url:`${l.setAuth}`,method:'post',body:JSON.stringify({appid:i.getProjectAppID(),auth_item:a}),needToken:1,needAppID:1})}catch(a){m.error(`hideSetting setAuth error ${a}`),f=a}const e={};if(f)e.errMsg=`${c}:fail ${f}`;else{const b=a.map((a)=>({state:a.state,scope:a.scope,desc:a.scope_desc}));e.errMsg=`${c}:ok`,e.authSetting=b}d({type:g.SIMULATOR_SET_SETTING,data:{show:!1}}),d({type:g.ASSDK_CALLBACK,callbackID:b,res:e})}},hideAddPhoneContact:function({confirm:a=!1,callbackID:b=-1,api:c=''}={}){return(d)=>{d({type:g.SIMULATOR_SET_ADDPHONECONTACT,data:{show:!1,contactData:{}}});let e;e=a?{errMsg:`${c}:ok`}:{errMsg:`${c}:fail cancel`},d({type:g.ASSDK_CALLBACK,callbackID:b,res:e})}},hideChooseAddress:function({confirm:a=!1,callbackID:b=-1,api:c=''}={}){return(d)=>{d({type:g.SIMULATOR_SET_CHOOSEADDRESS,data:{show:!1}});let e;e=a?{errMsg:`${c}:ok`,addressPostalCode:'510000',proviceFirstStageName:u.config.PROVINCE_PLACEHOLDER,addressCitySecondStageName:u.config.CITY_PLACEHOLDER,addressCountiesThirdStageName:u.config.COUNTY_PLACEHOLDER,addressDetailInfo:u.config.ADDRESS_DETAIL_PLACEHOLDER,userName:u.config.NAME_PLACEHORDER,nationalCode:'510000',telNumber:'020-81167888'}:{errMsg:`${c}:fail cancel`},d({type:g.ASSDK_CALLBACK,callbackID:b,res:e})}},hideChooseInvoiceTitle:function({confirm:a=!1,callbackID:b=-1,api:c=''}={}){return(d)=>{d({type:g.SIMULATOR_SET_CHOOSEINVOICETITLE,data:{show:!1}});let e;e=a?{errMsg:`${c}:ok`,invoiceTitleInfo:JSON.stringify({type:0,title:u.config.GUANGZHOU_TENCENT,taxNumber:'91440101327598294H',companyAddress:u.config.COMPANY_ADDRESS_PLACEHORDER,telephone:'020-81167888',bankName:u.config.BANKNAME_PLACEHORDER,bankAccount:'1209 0928 2210 301'})}:{errMsg:`${c}:fail cancel`},d({type:g.ASSDK_CALLBACK,callbackID:b,res:e})}},setAppRoute:function(a){return{type:g.SIMULATOR_SET_APP_ROUTE,data:a}},switchTab:function(a,b){return{type:g.SIMULATOR_OPEN_TABBAR,data:{pathName:a,tabbarIndex:b}}},setAuthorize:function(a){return{type:g.SIMULATOR_SET_AUTHORIZE_CONFIRM,data:{show:a}}},setShareDataURI:function(a,b){return{type:g.SIMULATOR_SET_SHARE_DATAURI,data:{webviewID:a,dataURI:b}}},setRightBtnActionSheet:function(a){return{type:g.SIMULATOR_SET_RIGHTBTN_ACTIONSHEET,data:a}},setPayment:function(a){return{type:g.SIMULATOR_SET_PAYMENT_QRWND,data:a}},hideMap:function({callbackID:a,res:b}){return(c)=>{c({type:g.SIMULATOR_SET_LOCATION,data:{show:!1,callbackID:null,src:''}}),a&&c({type:g.ASSDK_CALLBACK,callbackID:a,res:b})}},hideCardView:function({callbackID:a,res:b}){return(c)=>{c({type:g.SIMULATOR_SET_CARD_VIEW,data:{show:'none',cardInfo:[]}}),a&&c({type:g.ASSDK_CALLBACK,callbackID:a,res:b})}},batchAddCard:function({callbackID:a,list:b}){return(c)=>{const d={appid:i.getProjectAppID(),acceptitem_list:b},e={url:`${l.batchAddCardURL}?isapp=1`,body:JSON.stringify(d),method:'post',needToken:1,needAppID:1};h(e).then((d)=>{const e=d.body;let f=e.resp_list;f=f.map((a,c)=>{const d=b[c],e=JSON.parse(a.json_ret);return{cardId:d.card_id,cardExt:d.card_ext,code:e.encrypt_code,isSuccess:!0}}),c({type:g.ASSDK_CALLBACK,callbackID:a,res:{errMsg:'addCard:ok',cardList:f}})}).catch((b)=>{c({type:g.ASSDK_CALLBACK,callbackID:a,res:{errMsg:`addCard:fail ${b}`}})}),c({type:g.SIMULATOR_SET_CARD_VIEW,data:{show:'none',cardInfo:[]}})}},setBackground:c,toggleBackground:function(){return{type:g.SIMULATOR_TOGGLE_BACKGROUND}},setWidget:function(a){return{type:g.SIMULATOR_SET_WIDGET,data:a}},setGame:function(a){return{type:g.SIMULATOR_SET_GAME,data:a}},reLaunchToIndexPage:function(){return{type:g.SIMULATOR_RELAUNCH_TO_INDEX}},setWxmlInspect:function(a){return{type:g.SIMULATOR_SET_WXMLINSPECT,data:a}},setVibrate:function(a){return{type:g.SIMULATOR_SET_VIBRATE,data:{type:a}}},insertHTMLWebView:function({callbackID:a,webviewID:b,res:c}){return(d)=>{a&&d({type:g.JSSDK_CALLBACK,callbackID:a,webviewID:b,res:c})}},updateHTMLWebView:function({callbackID:a,webviewID:b,res:c}){return(d)=>{a&&d({type:g.JSSDK_CALLBACK,callbackID:a,webviewID:b,res:c})}},compile:(a={})=>{return(b,c)=>{const d=c();if(!global.isSimple&&!global.autoTest){const b=d.settings.edit.saveBeforeCompile,c=a.origin===t.COMPILE_ORIGIN.BUTTON||a.origin===t.COMPILE_ORIGIN.SHORT_CUT;let e=null;if(b&&c?e='saveAllAndInitiativeCompile':b?e='saveAllAndCompile':c&&(e='initiativeCompile'),e)return p.ready=!0,void p.send({type:'COMMAND',data:a.origin,command:e})}b(G(a))}},compileImmediate:G,setConfirm:function(a){return{type:g.SIMULATOR_SET_CONFIRM,data:a}},setSubPackage:F,setGameSubPackage:(a,b)=>({type:g.SIMULATOR_LOAD_GAME_SUBPACKAGE,data:{root:a,loaded:b}}),assdkCallback:function({callbackID:a,res:b}){return(c)=>{c({type:g.ASSDK_CALLBACK,callbackID:a,res:b})}},widgetJumpToWeapp:function(a){return(b)=>{b({type:g.PROJECT_SET_COMPILE_TYPE,data:A.weapp}),b({type:g.SIMULATOR_COMPILE,data:a})}},simulatorReset:a,gameLaunch:function(){return a(),async(a,c)=>{const d=c(),e=i.getCurrent()||{},f=await k(e);d.simulator.appConfig.resizable!==f.resizable&&a(w.setDeviceRotated(!1));const h=b(d.simulator.compileCommand);a({type:g.SIMULATOR_GAME_LAUNCH,data:{appLaunchInfo:h},appConfig:f})}},hideKeyboard:function(){return{type:g.SIMULATOR_SET_KEYBOARD,data:{show:!1}}},setSimulateUpdate:(a)=>(b)=>{b({type:g.SIMULATOR_SET_SIMULATE_UPDATE,simulateUpdate:a})},setAnyHTMLWebView:function(a){return(b)=>{b({type:g.SIMULATOR_SET_ANY_HTMLWEBVIEW,data:a})}},setDebugger:function(a){return{type:g.SIMULATOR_SET_DEBUGGER,data:a}},simulatorBack:function(){return(a,b)=>{const d=b(),{simulator:e}=d,f=e.currentWebviewID,h=e.webviewInfos[f];e.anyHtmlWebviewInfo||h&&-1!=h.parent?a({type:g.SIMULATOR_NAVIGATE_BACK,delta:1}):a(c({show:!0}))}}}}(require('lazyload'),require);