tcic-electron-sdk 1.5.234 → 1.5.238

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "resources": [
3
3
  {
4
- "version": "8ce889cd1710a8af218b5f55449039f3cdeda8e5",
4
+ "version": "645127fd0b5ac6022c1eb766d9daa82636c1134b",
5
5
  "sdkAppId": "0",
6
6
  "schoolId": "0",
7
- "url": "https://class.qcloudclass.com/1.5.0/cache/offline_8ce889cd1710a8af218b5f55449039f3cdeda8e5.zip",
7
+ "url": "https://class.qcloudclass.com/1.5.0/cache/offline_645127fd0b5ac6022c1eb766d9daa82636c1134b.zip",
8
8
  "files": {
9
9
  },
10
10
  "regexes": {
@@ -25,7 +25,7 @@
25
25
  "supportFomats": "mp4|rmvb|avi|mov|flv|wmv|m3u8|mpeg|mp3|wav|pcm|aac|ogg"
26
26
  },
27
27
  "expired": 200,
28
- "devBuildTime": 1638100396,
28
+ "devBuildTime": 1638281116,
29
29
  "domains": {
30
30
  "www.xxx.com": [
31
31
  "www.aaa.com"
@@ -1 +1 @@
1
- !function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.TCIC=i():e.TCIC=i()}(global,(function(){return(()=>{"use strict";var e={555:function(e,i,t){var n=this&&this.__createBinding||(Object.create?function(e,i,t,n){void 0===n&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return i[t]}})}:function(e,i,t,n){void 0===n&&(n=t),e[n]=i[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&n(i,e,t);return o(i,e),i},r=this&&this.__awaiter||function(e,i,t,n){return new(t||(t=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var i;e.done?o(e.value):(i=e.value,i instanceof t?i:new t((function(e){e(i)}))).then(r,a)}c((n=n.apply(e,i||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.TencentCloudClass=void 0;const c=a(t(933)),d=a(t(765)),h=a(t(747)),l=a(t(622)),u=s(t(293)),w=s(t(450)),f=s(t(975)),S=t(376),p=t(741),g=s(t(42)),W=a(t(528)),m=a(t(239)),y=t(311);p.TIWCacheManager.RegisterAsPrivileged();const M=W.default.use(m.default(((e,i,t)=>{const n=l.default.resolve(__dirname,"..","locales",`${e}.json`);h.default.promises.readFile(n,"utf8").then((e=>{t(null,JSON.parse(e))})).catch((e=>{t(e,null)}))}))).init({lng:"zh",load:"languageOnly",fallbackLng:!1,keySeparator:!1,nsSeparator:!1});let C;if(C="win32"===process.platform?l.default.join(process.env.USERPROFILE,"TencentCloudClass"):l.default.join(process.env.HOME,"TencentCloudClass"),h.default.existsSync(C)||h.default.mkdirSync(C,{recursive:!0}),c.default.app.setPath("crashDumps",l.default.join(C,"crash")),"win32"===process.platform){const e=g.getPrimaryDisplaySize();e.width*e.height<=2073600&&(g.getMaxTouches()>1||g.isWin7())&&c.default.app.commandLine.appendSwitch("disable-gpu-compositing"),g.isWin7()&&c.default.app.commandLine.appendSwitch("disable-site-isolation-trials")}const b=new d.default;class v extends y.TLoggerElectronModule{constructor(){super(...arguments),this.classUrl="",this.windowTitle="",this.tcicMainView=null,this.tcicBoardView=null,this.isBoardViewLoaded=!1,this.tcicScreenShareVideoWindow=null,this.tcicDefaultEntryMainWindow=null,this.tcicScreenShareMainWindow=null,this.tcicScreenShareBoardWindow=null,this.tcicScreenShareCameraWindow=null,this.watchMouseEventEnabled=!1,this.watchMouseMoveTimer=null,this.touchScreenOptimizeEnabled=!1,this.touchScreenOptimizePerformed=!1,this.screenShareMainWindowMouseEventIgnored=!1,this.mainViewDevTools=null,this.boardViewDevTools=null,this.videoWindowDevTools=null,this.cameraWindowDevTools=null,this.shouldFullscreen=!1,this.closeAllWindowInvoking=!1,this.callBoardMethodCache=[],this.needToShowTaskbarFix=!1,this.isTaskbarAutoHiddenInDesktopEnabled=!1,this.isTaskbarAutoHiddenInTabletEnabled=!1,this.isShowTaskbarOnMultipleDisplays=!1,this.onAllWindowClosedCallback=null,this.lastSelectedScreenBoardToolType=0,this.ipcListeners=[],this.ipcHandlers=[],this.seriousErrorTimes=0,this.isScreenSharing=!1,this.shareParams=null,this.isMainWindowMaximized=!1,this.mainWindowBoundsBeforeMaximize={},this.gpuInfoWatcher=null,this.checkShareWindowBoundsTimer=null,this.shareWindowBounds={x:0,y:0,width:0,height:0},this.shareMainWindowDisplay=null,this.shareBoardWindowDisplay=null}initialize(e){return r(this,void 0,void 0,(function*(){if(this.checkHasInitialize())return this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow.show(),!1;if("function"==typeof e.onClose&&(this.onAllWindowClosedCallback=e.onClose),e.sign){const i=new Buffer(e.sign.split(".")[1],"base64"),t=JSON.parse(i.toString("utf-8"));e.schoolId=t.school_id,e.classId=t.class_id,e.userId=t.user_id,e.cid=t.cid,e.uid=t.uid,e.scene=t.scene,e.token=e.sign,t.hasOwnProperty("class_type")&&(e.classType=t.class_type)}const i=new y.TLoggerConfig;i.sdkAppId=e.schoolId,i.userId=e.userId,i.roomId=e.classId,i.nativeSdkVersion=S.tcicSdkVersion,this._setConfig(i),this._info("Initialize",JSON.stringify(e)),yield M;let t=`schoolid=${e.schoolId}&userid=${e.userId}&classid=${e.classId}&token=${e.token}&webloadstamp=${(new Date).getTime()}&classtype=${e.classType}&watermark=${e.waterMark?JSON.stringify(e.waterMark):""}`;e.lng&&(t+=`&lng=${e.lng}`,W.default.changeLanguage(e.lng).then()),e.scene&&(t+=`&scene=${e.scene}`),e.debugCss&&(t+=`&debugCss=${e.debugCss}`),e.debugJs&&(t+=`&debugJs=${e.debugJs}`),e.customParams&&(t+=`&${e.customParams}`);let n=e.url;if(!n){let i="";const o=S.tcicSdkVersion.split("."),s=`/${o[0]}.${o[1]}.${o[2]}`;e.env&&"prod"!==e.env&&(i=`${e.env}-`),n=`https://${i}class.qcloudclass.com${s}/class.html?${e.env?`env=${e.env}&`:""}${t}`,process.defaultApp&&(process.argv.includes("--local")?n=`http://localhost:8080/class.html?${e.env?`env=${e.env}&`:""}${t}`:process.argv.includes("--vm")&&(n=`http://10.211.55.2:8080/class.html?${e.env?`env=${e.env}&`:""}${t}`))}return this.classUrl=n,this.createAndInitDefaultEntryMainWindow(),c.default.app.whenReady().then((()=>{this.createAndInitWindow()})),c.default.globalShortcut.unregister("CmdOrCtrl+F11"),c.default.globalShortcut.register("CmdOrCtrl+F11",(()=>{this.openDevTools()})),c.default.globalShortcut.unregister("CmdOrCtrl+Q"),c.default.globalShortcut.register("CmdOrCtrl+Q",(()=>{this.closeAllWindow().then()})),c.default.globalShortcut.unregister("CmdOrCtrl+Shift+F11"),c.default.globalShortcut.register("CmdOrCtrl+Shift+F11",(()=>{const e={watch_mouse_event:this.watchMouseEventEnabled,touch_optimize_enabled:this.touchScreenOptimizeEnabled,touch_optimize_performed:this.touchScreenOptimizePerformed,gpu_compositing_enabled:c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled"),max_touches:g.getMaxTouches(),primary_screen:g.getPrimaryDisplaySize()||c.default.screen.getPrimaryDisplay().size};"win32"===process.platform&&(e.aero_glass_enabled=c.default.systemPreferences.isAeroGlassEnabled());const i={type:"info",title:"系统信息",message:JSON.stringify(e,null,2),buttons:["关闭","打开GPU排障页面",b.get("autoOpenDevTools")?"启动时不打开调试工具":"启动时打开调试工具",b.get("screenShareNotOnTop")?"屏幕分享时窗口置顶":"屏幕分享时窗口不置顶",b.get("screenShareNotSetParent")?"屏幕分享时设置父子窗口":"屏幕分享时窗口不设置父子窗口","清除本地记录信息"]};c.default.dialog.showMessageBox(i).then((e=>{switch(e.response){case 1:{const e=new c.default.BrowserWindow({title:"GPU排障"});e.setMenu(null),e.loadURL("chrome://gpu"),e.show()}break;case 2:b.set("autoOpenDevTools",!b.get("autoOpenDevTools"));break;case 3:b.set("screenShareNotOnTop",!b.get("screenShareNotOnTop"));break;case 4:b.set("screenShareNotSetParent",!b.get("screenShareNotSetParent"));break;case 5:b.clear()}}))})),!0}))}closeAllWindow(e){if(this.closeAllWindowInvoking)return;this._info("CloseAllWindowStart"),this.closeAllWindowInvoking=!0;let i=Promise.resolve();this.tcicMainView&&(this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),i=new Promise((e=>{this.tcicMainView.webContents.once("destroyed",(()=>{this._info("MainViewDestroyed"),this.tcicMainView=null,this.mainViewDevTools&&this.mainViewDevTools.close(),e()})),this.tcicMainView.webContents.destroy()})));let t=Promise.resolve(),n=Promise.resolve();this.tcicBoardView&&(n=new Promise((e=>{this.tcicBoardView.webContents.once("destroyed",(()=>{this._info("BoardViewDestroyed"),this.tcicBoardView=null,this.boardViewDevTools&&this.boardViewDevTools.close(),e()})),this.tcicBoardView.webContents.destroy()})));let o=Promise.resolve();this.tcicScreenShareBoardWindow&&(o=new Promise((e=>{this.tcicScreenShareBoardWindow.once("closed",(()=>{this._info("ShareBoardWindowClosed"),e()})),this.tcicScreenShareBoardWindow.close()})));let s=Promise.resolve();this.tcicScreenShareMainWindow&&(s=new Promise((e=>{this.tcicScreenShareMainWindow.once("closed",(()=>{this._info("ShareMainWindowClosed"),e()})),this.tcicScreenShareMainWindow.close()})));let r=Promise.resolve();if(this.tcicScreenShareCameraWindow&&(r=new Promise((e=>{this.tcicScreenShareCameraWindow.once("closed",(()=>{this._info("CameraMainWindowClosed"),e()})),this.tcicScreenShareCameraWindow.close()}))),this.ipcListeners&&(this.ipcListeners.forEach((e=>{c.default.ipcMain.off(e.channel,e.listener)})),this.ipcListeners=[]),this.ipcHandlers&&(this.ipcHandlers.forEach((e=>{c.default.ipcMain.removeHandler(e.channel)})),this.ipcHandlers=[]),this.gpuInfoWatcher&&c.default.app.off("gpu-info-update",this.gpuInfoWatcher),!e){this.tcicDefaultEntryMainWindow&&(t=new Promise((e=>{this.tcicDefaultEntryMainWindow.once("closed",(()=>{this._info("EntryMainWindowClosed"),this.tcicDefaultEntryMainWindow=null,e()})),this.tcicDefaultEntryMainWindow.close()})));try{this.onAllWindowClosedCallback&&this.onAllWindowClosedCallback()}catch(e){console.error("业务侧传入的onClose回调内发生了异常:",e)}}let a=Promise.resolve();return this.tcicScreenShareVideoWindow&&(a=new Promise((e=>{this.tcicScreenShareVideoWindow.once("closed",(()=>{this._info("ShareVideoWindowClosed"),e()})),this.tcicScreenShareVideoWindow.close()}))),Promise.all([i,t,n,o,s,a,r]).then((()=>{this.closeAllWindowInvoking=!1,this._info("CloseAllWindowFinish")}))}focus(){this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.focus():this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.focus()}show(){this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()}sendCustomData(e){this.tcicMainView.webContents.send("sendCustomMessage",e)}_getClassName(){return"TencentCloudClass"}closeScreenShareBoardWindow(){this.tcicScreenShareBoardWindow&&(this.tcicScreenShareBoardWindow.getChildWindows().forEach((e=>{e.setParentWindow(null)})),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.getBrowserViews().length>0&&this.tcicScreenShareBoardWindow.removeBrowserView(this.tcicBoardView),this.tcicScreenShareBoardWindow.close())}seriousErrorHandler(e,i=""){this.seriousErrorTimes+=1,this._info("SeriouseError",JSON.stringify({times:this.seriousErrorTimes,reason:e})),console.error("TCIC seriousErrorHandler",this.seriousErrorTimes,e);let t=!this.closeAllWindowInvoking&&this.seriousErrorTimes<=3,n=`客户端遇到多次异常即将关闭,可从课堂列表再次进入,如果问题持续出现,请联系客服人员\n\n异常原因:${e} - ${i}\n\n异常上报UUID:${S.crashReportUUID}`;switch(e){case"clean-exit":case"abnormal-exit":case"killed":t=!1;break;case"oom":n=`客户端由于内存不足无法正常工作,请退出其它应用后从课堂列表再次进入\n\n异常上报UUID:${S.crashReportUUID}`,t=!1}this.closeAllWindow(t).then((()=>{if(t)this.createAndInitWindow();else{const e={type:"info",title:"客户端异常",message:n,buttons:["退出课堂"]};c.default.dialog.showMessageBox(e).then((e=>{}))}}))}detectScreenShareMainWindowMouseEventIgnored(e,i){if(!this.watchMouseEventEnabled||!this.tcicScreenShareMainWindow||!this.tcicMainView)return;const t=this.tcicScreenShareMainWindow.getPosition(),n=e-t[0],o=i-t[1];this.tcicMainView.webContents.capturePage({x:n,y:o,width:1,height:1}).then((e=>{const i=0===e.getBitmap()[3];i!==this.screenShareMainWindowMouseEventIgnored&&(this.screenShareMainWindowMouseEventIgnored=i,this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(i,{forward:this.touchScreenOptimizeEnabled}),console.log("setIgnoreMouseEvents",i,this.touchScreenOptimizeEnabled),i&&"darwin"===process.platform&&(0===this.lastSelectedScreenBoardToolType||this.tcicScreenShareBoardWindow.isFocused()||this.tcicScreenShareBoardWindow.focus()))}))}enableScreenShareMainWindowTouchScreenOptimize(){!this.touchScreenOptimizePerformed&&this.watchMouseEventEnabled&&this.touchScreenOptimizeEnabled&&(this.touchScreenOptimizePerformed=!0,console.log("enableScreenShareMainWindowTouchScreenOptimize"),this.tcicMainView&&this.tcicMainView.webContents.postMessage("enableWatchMouseMoveEvent",!0),this.tcicBoardView&&(this.tcicBoardView.webContents.isLoading()?this.tcicBoardView.webContents.on("did-finish-load",(()=>{this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!0)})):this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!0)))}disableScreenShareMainWindowTouchScreenOptimize(){this.touchScreenOptimizePerformed&&(this.touchScreenOptimizePerformed=!1,console.log("disableScreenShareMainWindowTouchScreenOptimize"),this.tcicMainView&&this.tcicMainView.webContents.postMessage("enableWatchMouseMoveEvent",!1),this.tcicScreenShareBoardWindow&&(this.tcicBoardView.webContents.isLoading()?this.tcicBoardView.webContents.on("did-finish-load",(()=>{this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!1)})):this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!1)))}enableScreenShareMainWindowWatchMouseMove(){if(this.watchMouseEventEnabled)return;this.watchMouseEventEnabled=!0,console.log("enableWatchMouseMove");let e=0,i=0;this.watchMouseMoveTimer=setInterval((()=>{const t=c.default.screen.getCursorScreenPoint();t.x===e&&t.y===i||(e=t.x,i=t.y,this.detectScreenShareMainWindowMouseEventIgnored(e,i))}),100),this.enableScreenShareMainWindowTouchScreenOptimize(),this.tcicScreenShareMainWindow.on("closed",(()=>{this.disableScreenShareMainWindowWatchMouseMove()}))}disableScreenShareMainWindowWatchMouseMove(){this.watchMouseEventEnabled&&(this.watchMouseEventEnabled=!1,console.log("disableWatchMouseMove"),this.watchMouseMoveTimer&&(clearInterval(this.watchMouseMoveTimer),this.watchMouseMoveTimer=null),this.disableScreenShareMainWindowTouchScreenOptimize(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(!1))}patchScreenShareMainWindowClickThrough(){"darwin"===process.platform?this.enableScreenShareMainWindowWatchMouseMove():"win32"===process.platform&&(g.isWin7()||c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled")&&(this.enableScreenShareMainWindowWatchMouseMove(),this.gpuInfoWatcher||(this.gpuInfoWatcher=()=>{c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled")||this.disableScreenShareMainWindowWatchMouseMove()},c.default.app.on("gpu-info-update",this.gpuInfoWatcher))))}createAndInitMainView(){if(this.tcicMainView)return;this.tcicMainView=new c.default.BrowserView({webPreferences:{preload:l.default.join(__dirname,"mainRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicMainView.webContents.once("dom-ready",(()=>{this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()})),p.TIWCacheManager.EnableWebContentsCache(this.tcicMainView.webContents,!0),this.tcicMainView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),this.tcicMainView.webContents.on("page-title-updated",((e,i,t)=>{t&&(this.windowTitle=i,this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.setTitle(i),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setTitle(i))}));const e=`${this.classUrl}&seriousError=${this.seriousErrorTimes}`,i=this.tcicMainView.webContents.loadURL(e),t=new Promise(((e,i)=>{this.tcicMainView.webContents.on("did-finish-load",(()=>{this._info("MainViewDidFinishLoad"),e()})),this.tcicMainView.webContents.on("did-fail-load",((e,t,n,o,s,r,a)=>{this._info("MainViewDidFailLoad",JSON.stringify({code:t,desc:n})),i(e)}))}));Promise.all([i,t]).then((()=>{this._info("MainViewInitFinish"),this.tcicMainView.webContents.send("init")})).catch((e=>{this._info("MainViewInitFail",JSON.stringify({error:JSON.stringify(e)}));const i={type:"error",title:"",message:`网络异常,课堂加载失败: ${JSON.stringify(e)}\n\n运维ID:${S.crashReportUUID}`,buttons:["退出课堂"]};c.default.dialog.showMessageBox(i).then((e=>{this.closeAllWindow()}))})),this.tcicMainView.webContents.on("render-process-gone",((e,i)=>{this._info("MainViewRenderProcessGone",JSON.stringify({reason:i.reason})),this.seriousErrorHandler(i.reason)})),this.tcicMainView.webContents.on("unresponsive",(()=>{this._info("MainViewUnresponsive"),this.seriousErrorHandler("unresponsive")})),this._info("MainViewInit",JSON.stringify({url:e}))}getMainWindowMinSize(e){e||(e="top");const i=c.default.screen.getPrimaryDisplay().workAreaSize;let t=718,n=110+t+45;n>i.height&&(t=Math.ceil(538.5),n=110+t+45,n>i.height&&(t=Math.ceil(359),n=110+t+45));const o=Math.ceil(t/9*16);return{width:Math.max(o,890),height:n}}createAndInitDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow)return;this._info("EntryMainWindowInit");const e=this.getMainWindowMinSize();let i=e;b.has("MainWindowBounds")&&(i=b.get("MainWindowBounds")),this.tcicDefaultEntryMainWindow=new c.default.BrowserWindow({width:i.width<e.width?e.width:i.width,height:i.height<e.height?e.height:i.height,minWidth:e.width,minHeight:e.height,show:!1,frame:!1,maximizable:!1,fullscreen:!1,skipTaskbar:!1,title:this.windowTitle,backgroundColor:"#14181D",webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicDefaultEntryMainWindow.setMenu(null);let t=null;this.tcicDefaultEntryMainWindow.on("resize",(()=>{if(t&&clearTimeout(t),t=setTimeout((()=>{if(t=null,!this.tcicDefaultEntryMainWindow.isMinimized()&&!this.isMainWindowMaximized){const e=this.tcicDefaultEntryMainWindow.getBounds();b.set("MainWindowBounds",e)}}),100),this.tcicScreenShareVideoWindow){const e=this.tcicScreenShareVideoWindow.getBounds();this.resizeScreenShareVideoWindow({width:e.width,height:e.height})}if(this.tcicScreenShareCameraWindow){const e=this.tcicScreenShareCameraWindow.getBounds();this.resizeScreenShareCameraWindow({width:e.width,height:e.height})}})),this.tcicDefaultEntryMainWindow.on("move",(()=>{if(this.tcicScreenShareVideoWindow){const e=this.tcicDefaultEntryMainWindow.getPosition();this.tcicScreenShareVideoWindow.setPosition(e[0],e[1])}if(this.tcicScreenShareCameraWindow){const e=this.tcicDefaultEntryMainWindow.getPosition();this.tcicScreenShareCameraWindow.setPosition(e[0],e[1])}})),this.tcicDefaultEntryMainWindow.on("close",(e=>{this._info("CloseDefaultEntryMainWindow",JSON.stringify({invoke:this.closeAllWindowInvoking,sharing:this.isScreenSharing})),this.closeAllWindowInvoking||(e.preventDefault(),this.isScreenSharing||this.tcicMainView.webContents.send("leaveClass"))}))}createAndInitBoardView(e,i){if(!this.tcicBoardView){if(this._info("BoardViewInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(i)})),this.tcicBoardView=new c.default.BrowserView({webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicBoardView.webContents.once("dom-ready",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.show()})),p.TIWCacheManager.EnableWebContentsCache(this.tcicBoardView.webContents,!0),this.tcicBoardView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),i){const t=this.tcicBoardView.webContents.loadFile(l.default.join(__dirname,"board.html")),n=new Promise(((e,i)=>{this.tcicBoardView.webContents.on("did-finish-load",(()=>{this._info("BoardViewDidFinishLoad"),e()})),this.tcicBoardView.webContents.on("did-fail-load",((e,t,n,o,s,r,a)=>{this._info("BoardViewDidFailLoad",JSON.stringify({code:t,desc:n})),i(e)}))}));Promise.all([t,n]).then((()=>{this._info("BoardViewInitFinish",JSON.stringify({boardMethodCache:JSON.stringify(this.callBoardMethodCache)})),i.shareWindowBounds={x:this.shareWindowBounds.x-e.bounds.x,y:this.shareWindowBounds.y-e.bounds.y,width:this.shareWindowBounds.width,height:this.shareWindowBounds.height},this.isBoardViewLoaded=!0,this.tcicBoardView.webContents.send("initBoard",i),this.callBoardMethodCache.forEach((e=>{this.callBoardMethod(e)})),this.callBoardMethodCache=[]})).catch((e=>{this._info("BoardViewInitFail",JSON.stringify({error:JSON.stringify(e)}))}))}this.tcicBoardView.webContents.on("render-process-gone",((e,i)=>{this._info("BoardViewRenderProcessGone",JSON.stringify({reason:i.reason})),this.seriousErrorHandler(i.reason)})),this.tcicBoardView.webContents.on("unresponsive",(()=>{this._info("BoardViewUnResponsive"),this.seriousErrorHandler("unresponsive")}))}}createAndInitScreenShareBoardWindow(e,i){this._info("BoardWindowInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(i)})),this.tcicScreenShareBoardWindow=new c.default.BrowserWindow({x:e.bounds.x,y:e.bounds.y,enableLargerThanScreen:!0,width:e.bounds.width,height:e.bounds.height,fullscreen:this.shouldFullscreen,frame:!1,transparent:!0,hasShadow:!1,skipTaskbar:!1,title:this.windowTitle,minimizable:!0,maximizable:!1,resizable:!1,acceptFirstMouse:!0,webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicScreenShareBoardWindow.setMenu(null),this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareBoardWindow.on("restore",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setOpacity(1)})),this.tcicScreenShareBoardWindow.on("closed",(()=>{this.tcicScreenShareBoardWindow=null})),this.tcicScreenShareBoardWindow.on("minimize",(()=>{this.tcicScreenShareMainWindow.restore(),setTimeout((()=>{this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,this.shareParams),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1),console.log("restore board window")}),100)}))}createAndInitScreenShareCameraWindow(e){this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.close(),this.tcicScreenShareCameraWindow=null);const i=this.tcicDefaultEntryMainWindow.getBounds();this._info("CameraWindowInit",JSON.stringify({bounds:JSON.stringify(i),params:JSON.stringify(e)})),this.tcicScreenShareCameraWindow=new c.default.BrowserWindow({x:i.x,y:i.y,width:i.width,height:i.height,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,skipTaskbar:!0,focusable:!1,opacity:0,title:"",webPreferences:{preload:l.default.join(__dirname,"cameraRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.resizeScreenShareCameraWindow({width:960,height:540}),this.tcicScreenShareCameraWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareCameraWindow.setMenu(null),this.tcicScreenShareCameraWindow.once("show",(()=>{this.tcicDefaultEntryMainWindow.moveAbove(this.tcicScreenShareCameraWindow.getMediaSourceId()),this.tcicDefaultEntryMainWindow.show();const e="win32"===process.platform?0:1;this.tcicScreenShareCameraWindow.setOpacity(e)}));const t=this.tcicScreenShareCameraWindow.webContents.loadFile(l.default.join(__dirname,"camera.html")),n=new Promise(((e,i)=>{this.tcicScreenShareCameraWindow.webContents.on("did-finish-load",(()=>{this._info("CameraWindowDidFinishLoad"),e()})),this.tcicScreenShareCameraWindow.webContents.on("did-fail-load",((e,t,n,o,s,r,a)=>{this._info("CameraWindowDidFailLoad",JSON.stringify({code:t,desc:n})),i(e)}))}));return new Promise(((e,i)=>{Promise.all([t,n]).then((()=>{const i=this.tcicScreenShareCameraWindow.getMediaSourceId().split(":")[1];this._info("CameraWindowInitFinish",JSON.stringify({sourceId:i})),e({sourceId:i})})).catch((e=>{this._info("CameraWindowInitFail",JSON.stringify({error:JSON.stringify(e)})),i(e)}))}))}resizeScreenShareCameraWindow(e){const i=this.tcicDefaultEntryMainWindow.getBounds();e.width>i.width&&(e.height=Math.floor(e.height/e.width*i.width),e.width=i.width),e.height>i.height&&(e.width=Math.floor(e.width/e.height*i.height),e.height=i.height),i.width=e.width,i.height=e.height,this.tcicScreenShareCameraWindow.setBounds(i)}closeScreenShareCameraWindow(){this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.close(),this.tcicScreenShareCameraWindow=null)}createAndInitScreenShareMainWindow(e){this.tcicScreenShareMainWindow||(this._info("ShareMainWindowInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height})),this.tcicScreenShareMainWindow=new c.default.BrowserWindow({x:e.bounds.x,y:e.bounds.y,enableLargerThanScreen:!0,width:e.bounds.width,height:e.bounds.height,fullscreen:this.shouldFullscreen,transparent:!0,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,resizable:!1,skipTaskbar:!0,acceptFirstMouse:!0,webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicScreenShareMainWindow.setMenu(null),this.tcicScreenShareMainWindow.on("close",(e=>{!this.closeAllWindowInvoking&&this.isScreenSharing&&e.preventDefault()})),this.tcicScreenShareMainWindow.on("closed",(()=>{this.tcicScreenShareMainWindow=null})),this.patchScreenShareMainWindowClickThrough())}createAndInitScreenShareVideoWindow(e){this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.close(),this.tcicScreenShareVideoWindow=null);const i=this.tcicDefaultEntryMainWindow.getBounds();this._info("VideoWindowInit",JSON.stringify({x:i.x,y:i.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(e)})),this.tcicScreenShareVideoWindow=new c.default.BrowserWindow({x:i.x,y:i.y,width:e.bounds.width,height:e.bounds.height,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,skipTaskbar:!0,focusable:!1,opacity:0,title:"",webPreferences:{preload:l.default.join(__dirname,"videoRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicScreenShareVideoWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareVideoWindow.setMenu(null),this.tcicScreenShareVideoWindow.once("show",(()=>{this.tcicDefaultEntryMainWindow.moveAbove(this.tcicScreenShareVideoWindow.getMediaSourceId()),this.tcicDefaultEntryMainWindow.show();const e="win32"===process.platform?0:1;this.tcicScreenShareVideoWindow.setOpacity(e)}));const t=this.tcicScreenShareVideoWindow.webContents.loadFile(l.default.join(__dirname,"video.html")),n=new Promise(((e,i)=>{this.tcicScreenShareVideoWindow.webContents.on("did-finish-load",(()=>{this._info("VideoWindowDidFinishLoad"),e()})),this.tcicScreenShareVideoWindow.webContents.on("did-fail-load",((e,t,n,o,s,r,a)=>{this._info("VideoWindowDidFailLoad",JSON.stringify({code:t,desc:n})),i(e)}))}));return new Promise(((e,i)=>{Promise.all([t,n]).then((()=>{const i=this.tcicScreenShareVideoWindow.getMediaSourceId().split(":")[1];this._info("VideoWindowInitFinish",JSON.stringify({sourceId:i})),e({sourceId:i})})).catch((e=>{this._info("VideoWindowInitFail",JSON.stringify({error:JSON.stringify(e)})),i(e)}))}))}resizeScreenShareVideoWindow(e){const i=this.tcicDefaultEntryMainWindow.getBounds();e.width>i.width&&(e.height=Math.floor(e.height/e.width*i.width),e.width=i.width),e.height>i.height&&(e.width=Math.floor(e.width/e.height*i.height),e.height=i.height),i.width=e.width,i.height=e.height,this.tcicScreenShareVideoWindow.setBounds(i)}closeScreenShareVideoWindow(){this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.close(),this.tcicScreenShareVideoWindow=null)}attachMainViewToDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow&&this.tcicMainView){this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.getBrowserViews().length>0&&this.tcicScreenShareMainWindow.removeBrowserView(this.tcicMainView),0===this.tcicDefaultEntryMainWindow.getBrowserViews().length&&this.tcicDefaultEntryMainWindow.addBrowserView(this.tcicMainView);const e=this.tcicDefaultEntryMainWindow.getContentBounds();this.tcicMainView.setBounds({x:0,y:0,width:e.width,height:e.height})}}attachMainViewToScreenShareMainWindow(){if(this.tcicScreenShareMainWindow&&this.tcicMainView){this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),0===this.tcicScreenShareMainWindow.getBrowserViews().length&&this.tcicScreenShareMainWindow.addBrowserView(this.tcicMainView);const e=this.tcicScreenShareMainWindow.getContentBounds();this.tcicMainView.setBounds({x:0,y:0,width:e.width,height:e.height})}}attachBoardViewToScreenShareBoardWindow(){if(this.tcicScreenShareBoardWindow&&this.tcicBoardView){this.tcicScreenShareBoardWindow.addBrowserView(this.tcicBoardView);const e=this.tcicScreenShareBoardWindow.getContentBounds();this.tcicBoardView.setBounds({x:0,y:0,width:e.width,height:e.height})}}openDevTools(){const e=c.default.screen.getPrimaryDisplay().size,i=e.width/2,t=600;this.tcicMainView&&(this.mainViewDevTools||(this.mainViewDevTools=new c.default.BrowserWindow({width:i,height:t,x:(e.width-2*i)/2+i,y:(e.height-t)/2,title:"开发者调试工具 - 主视图",webPreferences:{backgroundThrottling:!1}}),this.mainViewDevTools.on("close",(e=>{this.tcicMainView?(e.preventDefault(),this.mainViewDevTools.hide()):this.mainViewDevTools=null})),this.tcicMainView.webContents.setDevToolsWebContents(this.mainViewDevTools.webContents)),this.tcicMainView.webContents.openDevTools({mode:"detach"}),this.mainViewDevTools.show()),this.tcicBoardView&&(this.boardViewDevTools||(this.boardViewDevTools=new c.default.BrowserWindow({width:i,height:t,x:(e.width-2*i)/2,y:(e.height-t)/2,title:"开发者调试工具 - 白板",webPreferences:{backgroundThrottling:!1}}),this.boardViewDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.boardViewDevTools.hide()):this.boardViewDevTools=null})),this.tcicBoardView.webContents.setDevToolsWebContents(this.boardViewDevTools.webContents)),this.tcicBoardView.webContents.openDevTools({mode:"detach"}),this.boardViewDevTools.show()),this.tcicScreenShareVideoWindow&&(this.videoWindowDevTools||(this.videoWindowDevTools=new c.default.BrowserWindow({width:i,height:t,x:(e.width-2*i)/2,y:(e.height-t)/2,title:"开发者调试工具 - 视频",webPreferences:{backgroundThrottling:!1}}),this.videoWindowDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.videoWindowDevTools.hide()):this.videoWindowDevTools=null})),this.tcicScreenShareVideoWindow.webContents.setDevToolsWebContents(this.videoWindowDevTools.webContents)),this.tcicScreenShareVideoWindow.webContents.openDevTools({mode:"detach"}),this.videoWindowDevTools.show()),this.tcicScreenShareCameraWindow&&(this.cameraWindowDevTools||(this.cameraWindowDevTools=new c.default.BrowserWindow({width:i,height:t,x:(e.width-2*i)/2,y:(e.height-t)/2,title:"开发者调试工具 - 辅助摄像头",webPreferences:{backgroundThrottling:!1}}),this.cameraWindowDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.cameraWindowDevTools.hide()):this.cameraWindowDevTools=null})),this.tcicScreenShareCameraWindow.webContents.setDevToolsWebContents(this.cameraWindowDevTools.webContents)),this.tcicScreenShareCameraWindow.webContents.openDevTools({mode:"detach"}),this.cameraWindowDevTools.show())}callBoardMethod(e){if(this.isBoardViewLoaded){if(this._info("CallBoardMethod",JSON.stringify({params:JSON.stringify(e)})),"board"===e.module){if("setToolType"===e.method){const i=e.params[0];0===i?(this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),"darwin"===process.platform&&this.tcicScreenShareBoardWindow.blur()):this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!1),this.lastSelectedScreenBoardToolType=i}this.tcicBoardView.webContents.send("callMethod",e)}}else this.callBoardMethodCache.push(e)}addLifecycleIPCListener(e,i){c.default.ipcMain.on(e,i),this.ipcListeners.push({channel:e,listener:i})}addLifecycleIPCHandler(e,i){c.default.ipcMain.handle(e,i),this.ipcHandlers.push({channel:e,handler:i})}registerIPCEvent(){this.addLifecycleIPCHandler("getSystemInfo",((e,i)=>r(this,void 0,void 0,(function*(){return yield u.get(i)})))),this.addLifecycleIPCListener("callMethod",((e,i)=>{this.callBoardMethod(i)})),this.addLifecycleIPCListener("enableTouchScreenOptimize",(e=>{this.touchScreenOptimizeEnabled=!0,this.enableScreenShareMainWindowTouchScreenOptimize()})),this.addLifecycleIPCListener("onMouseEvent",((e,i)=>{this.detectScreenShareMainWindowMouseEventIgnored(i.x,i.y)})),this.addLifecycleIPCListener("onReloadWindow",((e,i,t)=>{this.seriousErrorHandler(i,t)})),this.addLifecycleIPCListener("onPageFinished",((e,i)=>{this.seriousErrorTimes=0})),this.addLifecycleIPCListener("onCloseWindow",(()=>{this.closeAllWindow().then()})),this.addLifecycleIPCListener("onMinimizeWindow",(()=>{this.tcicDefaultEntryMainWindow.isMinimized()?(this.tcicDefaultEntryMainWindow.restore(),console.log("TCIC unminimized")):(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.setOpacity(0),this.tcicDefaultEntryMainWindow.minimize(),console.log("TCIC minimized"))})),this.tcicDefaultEntryMainWindow.on("restore",(()=>{if(this.tcicScreenShareVideoWindow){const e="win32"===process.platform?0:1;this.tcicScreenShareVideoWindow.setOpacity(e)}})),this.addLifecycleIPCListener("onMaximizeWindow",(()=>{this.isMainWindowMaximized?(console.log("TCIC unmaximized"),this.isMainWindowMaximized=!1,this.tcicDefaultEntryMainWindow.setResizable(!0),this.tcicDefaultEntryMainWindow.unmaximize(),g.setThickFrame(this.tcicDefaultEntryMainWindow,!0).then((()=>{this.tcicDefaultEntryMainWindow.setBounds(this.mainWindowBoundsBeforeMaximize)}))):(this.mainWindowBoundsBeforeMaximize=this.tcicDefaultEntryMainWindow.getBounds(),g.setThickFrame(this.tcicDefaultEntryMainWindow,!1).then((()=>{console.log("TCIC maximized"),this.isMainWindowMaximized=!0,this.tcicDefaultEntryMainWindow.maximize(),this.tcicDefaultEntryMainWindow.setResizable(!1)})))})),this.addLifecycleIPCListener("onClassLayoutChanged",((e,i)=>{if(!this.isMainWindowMaximized){const e=this.getMainWindowMinSize(i);this.tcicDefaultEntryMainWindow.setMinimumSize(e.width,e.height);const t=this.tcicDefaultEntryMainWindow.getBounds();if(t.width<e.width||t.height<e.height){this.tcicDefaultEntryMainWindow.setBounds({width:t.width<e.width?e.width:t.width,height:t.height<e.height?e.height:t.height},!0);const i=this.tcicDefaultEntryMainWindow.getBounds();b.set("MainWindowBounds",i),console.log("TCIC resize after layout",i)}}})),this.addLifecycleIPCListener("onScreenShareSnapshot",((e,i)=>{this.tcicMainView.webContents.send("onScreenShareSnapshot",i)})),this.addLifecycleIPCListener("onBoardCanRedoChange",((e,i)=>{this.tcicMainView.webContents.send("onBoardCanRedoChange",i)})),this.addLifecycleIPCListener("onBoardCanUndoChange",((e,i)=>{this.tcicMainView.webContents.send("onBoardCanUndoChange",i)})),this.addLifecycleIPCHandler("saveImage",((e,i)=>new Promise(((e,t)=>{const n=n=>{const o=i.base64Data.replace(/^data:image\/\w+;base64,/,""),s=Buffer.from(o,"base64");n?h.default.writeFile(n,s,(n=>{n?t({snapId:i.snapId,module:"electron",errcode:-5,errmsg:n.message}):e({snapId:i.snapId,snapName:i.snapName,totalSlices:1,totalSize:o.length,sliceIndex:0,sliceSize:o.length})})):t({snapId:i.snapId,module:"electron",errcode:0,errmsg:""})};i.dialog?c.default.dialog.showSaveDialog(this.tcicDefaultEntryMainWindow,{defaultPath:i.snapName,title:"保存图片",filters:[{name:"Custom File Type",extensions:["png","jpg"]}]}).then((e=>{n(e.filePath)})):g.getDesktopPath().then((e=>{const t=l.default.join(e,i.snapName);n(t)}))})))),this.addLifecycleIPCHandler("downloadMusic",((e,i)=>new Promise(((e,t)=>{let n;n="win32"===process.platform?l.default.join(process.env.USERPROFILE,"TencentCloudClass"):l.default.join(process.env.HOME,"TencentCloudClass"),n=l.default.join(n,"document"),h.default.existsSync(n)||h.default.mkdirSync(n,{recursive:!0});const o=l.default.join(n,`${i.documentId}_${i.url.substring(i.url.lastIndexOf("/")+1)}`);h.default.existsSync(o)?e(o):w.httpRequest(i.url,null,null,o).then((()=>{e(o)})).catch((e=>{t(e)}))})))),this.addLifecycleIPCHandler("loadVideo",((e,i)=>new Promise(((e,t)=>{this.createAndInitScreenShareVideoWindow(i).then((t=>{c.default.ipcMain.once("canplay",((i,n)=>{this.resizeScreenShareVideoWindow(n),e(t)})),this.tcicScreenShareVideoWindow.webContents.send("loadVideo",i.url)}))})))),this.addLifecycleIPCHandler("playVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("playVideo")})),this.addLifecycleIPCHandler("seekVideo",((e,i)=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("seekVideo",i)})),this.addLifecycleIPCHandler("pauseVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("pauseVideo")})),this.addLifecycleIPCHandler("stopVideo",(e=>{this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.webContents.send("stopVideo"),this.closeScreenShareVideoWindow())})),this.addLifecycleIPCHandler("setVideoVolume",((e,i)=>(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("setVideoVolume",i),Promise.resolve()))),this.addLifecycleIPCListener("onVideoTimeSeeked",((e,i)=>{this.tcicMainView.webContents.send("onVideoTimeSeeked",i)})),this.addLifecycleIPCListener("onVideoTimeUpdate",((e,i)=>{this.tcicMainView.webContents.send("onVideoTimeUpdate",i)})),this.addLifecycleIPCHandler("startSubCamera",((e,i)=>new Promise(((e,t)=>{this.createAndInitScreenShareCameraWindow(i).then((t=>{c.default.ipcMain.once("playing",((i,n)=>{this.resizeScreenShareCameraWindow(n),e(t)})),this.tcicScreenShareCameraWindow.webContents.send("start",i)}))})))),this.addLifecycleIPCHandler("stopSubCamera",((e,i)=>new Promise(((e,i)=>{this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.webContents.send("stop"),this.closeScreenShareCameraWindow()),e()})))),this.addLifecycleIPCHandler("startScreenShare",((e,i)=>r(this,void 0,void 0,(function*(){this._info("StartScreenShare",JSON.stringify(i)),this.shareParams=i,this.isScreenSharing=!0,this.tcicDefaultEntryMainWindow.hide();const e=this.getDisplay(i);return this.needToShowTaskbarFix="win32"===process.platform&&e.size.width===e.workAreaSize.width&&e.size.height===e.workAreaSize.height,this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled=yield g.isTaskbarAutoHiddenInDesktopEnabled(),this.isTaskbarAutoHiddenInDesktopEnabled&&g.setTaskbarAutoHiddenInDesktopEnabled(!1).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled=yield g.isTaskbarAutoHiddenInTabletEnabled(),this.isTaskbarAutoHiddenInTabletEnabled&&g.setTaskbarAutoHiddenInTabletEnabled(!1).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays=yield g.isShowTaskbarOnMultipleDisplays(),this.isShowTaskbarOnMultipleDisplays||g.setShowTaskbarOnMultipleDisplays(!0).then((()=>{})))),new Promise((e=>{const t=()=>{i.followTarget?(this.shareMainWindowDisplay=this.getDisplay(i),this.shareBoardWindowDisplay=this.shareMainWindowDisplay):(this.shareMainWindowDisplay=this.getCurrentDisplay(),this.shareBoardWindowDisplay=this.getDisplay(i)),this.createAndInitBoardView(this.shareBoardWindowDisplay,i),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,i),this.attachBoardViewToScreenShareBoardWindow(),this.createAndInitScreenShareMainWindow(this.shareMainWindowDisplay),this.attachMainViewToScreenShareMainWindow(),this.tcicScreenShareBoardWindow.show(),this.tcicScreenShareMainWindow.show(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.checkShareWindowBoundsTimer=setInterval((()=>{const e=this.getShareWindowBounds(i);if(this.shareWindowBounds.x!==e.x||this.shareWindowBounds.y!==e.y||this.shareWindowBounds.width!==e.width||this.shareWindowBounds.height!==e.height){this.shareWindowBounds=e;const t=this.getDisplay(i);this.shareBoardWindowDisplay.id!==t.id&&(this._info("ShareBoardWindowDisplayChanged",JSON.stringify({from:JSON.stringify(this.shareBoardWindowDisplay.bounds),to:JSON.stringify(t.bounds)})),this.shareBoardWindowDisplay=t,this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(t,i),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1)),this.tcicBoardView.webContents.send("onShareWindowBoundsChanged",{x:e.x-t.bounds.x,y:e.y-t.bounds.y,width:e.width,height:e.height})}}),100);const t=this.tcicScreenShareMainWindow.getMediaSourceId().split(":")[1],n=this.tcicScreenShareBoardWindow.getMediaSourceId().split(":")[1];0===i.type?e({excludeShareWindowSourceIds:[t],includeShareWindowSourceIds:[n]}):e({excludeShareWindowSourceIds:[t],includeShareWindowSourceIds:[]})};if("win32"===process.platform){let e=0;const n=setInterval((()=>{const o=this.getDisplay(i);e+=1,(o.size.width!==o.workAreaSize.width||o.size.height!==o.workAreaSize.height||e>50)&&(clearInterval(n),t())}),100)}else t()}))})))),this.addLifecycleIPCHandler("hasScreenCapturePermission",(e=>r(this,void 0,void 0,(function*(){return"granted"===c.default.systemPreferences.getMediaAccessStatus("screen")})))),this.addLifecycleIPCHandler("openSystemPreferences",(e=>r(this,void 0,void 0,(function*(){return f.requestScreenCaptureAccess()})))),this.addLifecycleIPCHandler("getExcludeSelectWindows",(e=>r(this,void 0,void 0,(function*(){const e=[];if(this.tcicDefaultEntryMainWindow){const i=this.tcicDefaultEntryMainWindow.getMediaSourceId().split(":")[1];e.push(i)}return Promise.resolve(e)})))),this.addLifecycleIPCHandler("stopScreenShare",((e,i)=>(this._info("StopScreenShare",JSON.stringify(i)),this.isScreenSharing=!1,this.tcicDefaultEntryMainWindow.show(),this.attachMainViewToDefaultEntryMainWindow(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.close(),this.tcicBoardView&&this.tcicBoardView.webContents.destroy(),this.tcicBoardView=null,this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.close(),this.checkShareWindowBoundsTimer&&(clearInterval(this.checkShareWindowBoundsTimer),this.checkShareWindowBoundsTimer=null),this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled&&g.setTaskbarAutoHiddenInDesktopEnabled(!0).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled&&g.setTaskbarAutoHiddenInTabletEnabled(!0).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays||g.setShowTaskbarOnMultipleDisplays(!1).then((()=>{})))),Promise.resolve())))}getCurrentDisplay(){return c.default.screen.getDisplayMatching(this.tcicDefaultEntryMainWindow.getBounds())}updateZOrderAccordingShareWindow(e,i){b.get("screenShareNotOnTop")||this.tcicScreenShareMainWindow&&this.tcicScreenShareBoardWindow&&(e.id===i.id?b.get("screenShareNotSetParent")?this.tcicScreenShareMainWindow.setAlwaysOnTop(!0,"screen-saver"):(this.tcicScreenShareMainWindow.setAlwaysOnTop(!1),this.tcicScreenShareMainWindow.setParentWindow(this.tcicScreenShareBoardWindow),this.tcicScreenShareBoardWindow.setAlwaysOnTop(!0,"screen-saver")):(this.tcicScreenShareMainWindow.setParentWindow(null),this.tcicScreenShareMainWindow.setAlwaysOnTop(!0,"screen-saver"),this.tcicScreenShareBoardWindow.setAlwaysOnTop(!0,"screen-saver")))}getShareWindowBounds(e){if(0===e.type){if("win32"===process.platform){const i=g.getWindowBounds(parseInt(e.displayId,10));return c.default.screen.screenToDipRect(null,i)}if("darwin"===process.platform)return f.getWindowBounds(parseInt(e.displayId,10))}return this.getDisplay(e).bounds}getDisplay(e){if(e.displayId){const i=c.default.screen.getAllDisplays();if(i.length>0){if("win32"===process.platform)return 0===e.type?c.default.screen.getDisplayMatching(g.getWindowBounds(parseInt(e.displayId,10))):c.default.screen.getDisplayMatching(g.getDesktopBounds(parseInt(e.displayId,10)));if("darwin"===process.platform&&0===e.type)return c.default.screen.getDisplayMatching(f.getWindowBounds(parseInt(e.displayId,10)))}for(const t of i)if(t.id.toString()===e.displayId)return t}return this.getCurrentDisplay()}initCacheModule(){return new Promise(((e,i)=>{let t=this.classUrl,n=t.indexOf(".html");-1!==n&&(n=t.length);const o=t.lastIndexOf("/",n);-1===o?c.default.dialog.showErrorBox("出错",`传入非法URL,课堂无法正常初始化: ${this.classUrl}`):t=t.substring(0,o),p.TIWCacheManager.SetCallback((e=>{this.tcicMainView.webContents.send("onVersionUpdate",{force:e})})),p.TIWCacheManager.SetConfig({configUrl:`${t}/cache/tiwcache.json`,configPath:l.default.join(__dirname,"config.json"),resourcePath:l.default.join(__dirname,"resource.zip"),resourceDir:C}).then((()=>{this._info("initCacheModule",JSON.stringify({code:0,error:""})),e()})).catch((i=>{this._info("initCacheModule",JSON.stringify({code:-1,error:JSON.stringify(i)})),e()}))}))}createAndInitWindow(){this.shouldFullscreen=!1,"win32"===process.platform&&(c.default.systemPreferences.isAeroGlassEnabled()?this.shouldFullscreen=!0:c.default.dialog.showErrorBox("出错","DWM未开启,不支持窗口透明特性")),this.initCacheModule().then((()=>{this.createAndInitMainView(),b.get("autoOpenDevTools")&&this.openDevTools(),this.attachMainViewToDefaultEntryMainWindow(),this.registerIPCEvent()}))}checkHasInitialize(){return!!this.tcicDefaultEntryMainWindow}}i.TencentCloudClass=v},975:function(e,i,t){var n=this&&this.__createBinding||(Object.create?function(e,i,t,n){void 0===n&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return i[t]}})}:function(e,i,t,n){void 0===n&&(n=t),e[n]=i[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&n(i,e,t);return o(i,e),i},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.requestScreenCaptureAccess=i.macOSVersion=i.getWindowBounds=void 0;const a=s(t(124)),c=r(t(420)),d=s(t(728)),h=r(t(451)),l=r(t(747)),u=t(933),w=d.types.void,f=d.types.int,S=d.types.int,p=process.arch.includes("64")?d.types.uint64:d.types.uint32,g=p,W=g,m=g,y=g,M=p,C=d.types.uint32,b=d.types.uint32,v=d.types.int,D=d.types.CString,T=d.types.double,I=h.default({x:T,y:T}),B=h.default({width:T,height:T}),V=h.default({origin:I,size:B}),P=d.refType(V),E=c.default(p);let _,k=null,x=null;if("darwin"===process.platform)try{const e=a.DynamicLibrary("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics");k=a.Library(e,{CGWindowListCopyWindowInfo:[m,[M,C]],CGWindowListCreateDescriptionFromArray:[m,[m]],CGRectMakeWithDictionaryRepresentation:[f,[y,P]],CGWindowListCreateImage:[g,[V,S,S,S]]});const i=a.DynamicLibrary("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation");x=a.Library(i,{CFArrayCreate:[m,[S,E,S,S]],CFStringCreateWithCString:[W,[S,D,b]],CFArrayGetCount:[v,[m]],CFArrayGetValueAtIndex:[g,[m,v]],CFDictionaryGetValue:[g,[y,W]],CFRelease:[w,[g]]})}catch(e){console.error(e)}function O(){if(!_){const e=(e=>{const i=/<key>ProductVersion<\/key>\s*<string>([\d.]+)<\/string>/.exec(e);if(i)return i[1].replace("10.16","11")})(l.default.readFileSync("/System/Library/CoreServices/SystemVersion.plist","utf8"));if(!e)return;_=(e=>{const{length:i}=e.split(".");return 1===i?`${e}.0.0`:2===i?`${e}.0`:e})(e)}return _}i.getWindowBounds=function(e){const i={x:0,y:0,width:0,height:0};if(k&&x)try{const t=new E(1);t[0]=e;const n=x.CFArrayCreate(0,t,t.length,0),o=k.CGWindowListCreateDescriptionFromArray(n);if(0===o)return i;if(x.CFArrayGetCount(o)>0){const e=x.CFArrayGetValueAtIndex(o,0),t=x.CFStringCreateWithCString(0,"kCGWindowBounds",134217984),n=x.CFDictionaryGetValue(e,t),s=new V;k.CGRectMakeWithDictionaryRepresentation(n,s.ref()),i.x=s.origin.x,i.y=s.origin.y,i.width=s.size.width,i.height=s.size.height,x.CFRelease(t)}x.CFRelease(o),x.CFRelease(n)}catch(e){console.error(e)}return console.log("getWindowBounds",JSON.stringify(i)),i},i.macOSVersion=O;let A=!1;i.requestScreenCaptureAccess=function(){if(k&&x)try{const e=O().split(".").map((e=>parseInt(e,10)));if(e[0]<10||10===e[0]&&e[1]<15)return;const i=new V;i.origin.x=0,i.origin.y=0,i.size.width=1,i.size.height=1;const t=k.CGWindowListCreateImage(i,1,0,0);if(x.CFRelease(t),A){const e="security",i="Privacy_ScreenCapture";u.shell.openExternal(`x-apple.systempreferences:com.apple.preference.${e}${i?`?${i}`:""}`)}else A=!0}catch(e){console.error(e)}}},196:function(e,i,t){var n=this&&this.__awaiter||function(e,i,t,n){return new(t||(t=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var i;e.done?o(e.value):(i=e.value,i instanceof t?i:new t((function(e){e(i)}))).then(r,a)}c((n=n.apply(e,i||[])).next())}))};Object.defineProperty(i,"__esModule",{value:!0}),i.TCIC=void 0;const o=t(555),s=t(376);let r=null;i.TCIC={initialize(e){return n(this,void 0,void 0,(function*(){const i=e.onClose;e.onClose=()=>{i&&i(),r=null},r?this.show():(r=new o.TencentCloudClass,yield r.initialize(e))}))},closeAllWindow(){r&&r.focus()},focus(){r&&r.focus()},show(){r&&r.show()},getVersion:()=>s.tcicSdkVersion},e.exports=i.TCIC},376:(e,i,t)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.crashReportUUID=i.tcicSdkVersion=void 0;const n=t(425);i.tcicSdkVersion="1.5.0.234",i.crashReportUUID=Date.now().toString()+Math.round(1e4*Math.random()).toString(),n.init({appName:"tcic-electron-sdk",dsn:"https://87864dd8403142e795f3c38e19ffab17@report.url.cn/sentry/2466",enableJavaScript:!0}),n.configureScope((e=>{e.setTag("extra.sdk",i.tcicSdkVersion),e.setTag("extra.uuid",i.crashReportUUID)}))},741:function(e,i,t){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.TIWCacheManager=void 0;const o=t(933),s=n(t(747)),r=n(t(622)),a=n(t(605)),c=n(t(211)),d=n(t(138));class h{static EnableCache(e){if(h._enabled=e,h._timer&&(clearTimeout(h._timer),h._timer=null),h._enabled&&h._config&&h._serverConfig){const e=()=>{h.RefreshServerConfig().catch((e=>{console.error(e)})),h._timer=setTimeout(e,1e3*this._serverConfig.interval)};e()}}static SetCallback(e){h._cacheCallback=e}static SetConfig(e){return new Promise(((i,t)=>{h._config=e;const n=h.GetConfigDir(),o=h.GetZipDir(),r=h.GetResourceDir(),a=h.GetDocumentDir();s.default.existsSync(n)||s.default.mkdirSync(n,{recursive:!0}),s.default.existsSync(o)||s.default.mkdirSync(o,{recursive:!0}),s.default.existsSync(r)||s.default.mkdirSync(r,{recursive:!0}),s.default.existsSync(a)||s.default.mkdirSync(a,{recursive:!0});const c=h.GetConfigPath(),l=h.GetZipPath();let u=null;s.default.existsSync(c)&&(u=h.LoadServerConfigFromLocalFile(c),h.IsBundleResourceNew(e.configPath,u)&&(h.RemoveDirSync(r),s.default.promises.unlink(c).then(),s.default.existsSync(l)&&s.default.promises.unlink(l).then(),u=null)),u?(console.info("TIWCacheManager use cache files"),h._serverConfig=u,h.EnableCache(!0),i()):s.default.existsSync(e.configPath)?s.default.existsSync(e.resourcePath)?s.default.promises.copyFile(e.configPath,c).then((()=>{console.info("TIWCacheManager update config file");const n=h.LoadServerConfigFromLocalFile(c);s.default.promises.copyFile(e.resourcePath,l).then((()=>{console.info("TIWCacheManager update resource file");try{h.RemoveDirSync(r),new d.default(l).extractAllTo(r,!0),h._serverConfig=n,h.EnableCache(!0),i()}catch(e){s.default.promises.unlink(c).then(),s.default.promises.unlink(l).then(),console.error("TIWCacheManager resource unzip failed",e),t(e)}})).catch((()=>{t(`TIWCacheManager copyFile file error: ${e.resourcePath}`)}))})).catch((()=>{t(`TIWCacheManager resource file not found: ${e.configPath}`)})):t(`TIWCacheManager resource file not found: ${e.resourcePath}`):t(`TIWCacheManager config file not found: ${e.configPath}`)}))}static RefreshServerConfig(){if(!h._config.configUrl)return Promise.reject("缺少配置文件URL");if(h._isRefreshing)return Promise.reject("上次刷新未完成");h._isRefreshing=!0;const e=h.GetConfigPath(!0),i=h._config.configUrl;return h.HttpRequest(i,null,null,e).then((()=>{const i=h.LoadServerConfigFromLocalFile(e),t=h.GetResourceInfo(i);if(!t)return Promise.reject("新配置缺少可用资源信息");const n=h.GetResourceInfo(h._serverConfig);if(n&&t&&n.version===t.version&&t.devBuildTime<=n.devBuildTime)return Promise.reject(`新配置版本低于老配置版本: ${t.version} < ${n.version}`);console.log("TIWCacheManager new config fetched",i);const o=h.GetZipPath(!0);return h.HttpRequest(t.url,null,null,o).then((()=>{const t=h.GetResourceDir();h.RemoveDirSync(t),new d.default(o).extractAllTo(t,!0);const n=h.GetConfigPath();s.default.unlinkSync(n),s.default.renameSync(e,n);const r=h.GetZipPath();if(s.default.unlinkSync(r),s.default.renameSync(o,r),h._serverConfig=i,console.log("TIWCacheManager resource prepare done"),h._cacheCallback){const e=h._serverConfig.forceUpdate;h._cacheCallback(e)}return Promise.resolve()})).catch((e=>{s.default.unlinkSync(o),console.error("TIWCacheManager resource fetch failed",e)}))})).catch((i=>{s.default.unlinkSync(e),console.error("TIWCacheManager config fetch failed",i)})).finally((()=>{h._isRefreshing=!1}))}static RegisterAsPrivileged(){return o.app.isReady()?(console.error("RegisterAsPrivileged can only be used before the ready event of the app module gets emitted!!!"),!1):(o.protocol.registerSchemesAsPrivileged([{scheme:h.TIWCacheSchemeHttp,privileges:h.TIWCacheSchemePrivileges},{scheme:h.TIWCacheSchemeHttps,privileges:h.TIWCacheSchemePrivileges}]),!0)}static GetResourcePath(e){if(h._enabled&&h._config&&h._config.resourceDir){const i=h.GetResourceInfo(h._serverConfig);if(i){let t="";do{const n=new URL(e),o=`${n.origin}${n.pathname}`;if(i.files&&i.files.hasOwnProperty(o)){const e=i.files[o];t=e.toLowerCase().startsWith("http")?e:r.default.join(h.GetResourceDir(),e);break}if(!t&&i.regexes)for(const e in i.regexes){let n=i.regexes[e];const s=o.match(e);if(s&&s.length>0){for(let e=1;e<=s.length;++e){const i=new RegExp(`\\$${e}`,"g");n=n.replace(i,s[e])}t=r.default.join(h.GetResourceDir(),n);break}}if(!t&&i.documents)for(const e in i.documents){const n=i.documents[e],a=o.match(e);if(a&&a.length>=3){const e=a[1],i=a[2],c=h.GetDocumentDir();t=o.replace(e,c),s.default.existsSync(t)||h.DownloadDocumentCategory(r.default.join(c,i,n),`${e}/${i}/${n}`);break}}}while(0);return s.default.existsSync(t)?console.log("TIWCacheManager GetResourcePath",e,t):t="",t}}return""}static EnableWebContentsCache(e,i){if(i){const i=(e,i)=>{h.TIWCacheFileMap.has(e.url)?(i({path:h.TIWCacheFileMap.get(e.url)}),h.TIWCacheFileMap.delete(e.url)):i({statusCode:404})};e.session.protocol.registerFileProtocol(h.TIWCacheSchemeHttp,i),e.session.protocol.registerFileProtocol(h.TIWCacheSchemeHttps,i),e.session.webRequest.onBeforeRequest(((e,i)=>{let t=e.url;const n=t.indexOf("://"),o=t.substring(0,n).toLowerCase(),s=t.substring(n);if(o===h.TIWCacheSchemeHttp||o===h.TIWCacheSchemeHttps){if(h.TIWCacheFileMap.has(t))return void i({cancel:!1});t=o===h.TIWCacheSchemeHttp?`http${s}`:`https${s}`}else if("http"!==o&&"https"!==o)return void i({cancel:!1});const r=h.GetResourcePath(t);""===r?i({cancel:!1}):r.startsWith("http")?i({cancel:!1,redirectURL:r}):(t="https"===o||o===h.TIWCacheSchemeHttps?h.TIWCacheSchemeHttps+s:h.TIWCacheSchemeHttp+s,h.TIWCacheFileMap.set(t,r),t===e.url?i({cancel:!1}):i({cancel:!1,redirectURL:t}))}))}else e.session.protocol.unregisterProtocol(h.TIWCacheSchemeHttp),e.session.protocol.unregisterProtocol(h.TIWCacheSchemeHttps),e.session.webRequest.onBeforeSendHeaders(null)}static HttpRequest(e,i,t,n){const o=e.toLowerCase().startsWith("https://")?c.default:a.default;return new Promise(((r,a)=>{const c=n?s.default.createWriteStream(n):null,d=t?JSON.stringify(t):null,h=d?"POST":"GET";i||(i={}),d&&(i.hasOwnProperty("Content-Type")||(i["Content-Type"]="application/json"),i.hasOwnProperty("Content-Length")||(i["Content-Length"]=d.length.toString()));const l={method:h,headers:i},u=o.request(e,l,(i=>{if(200!==i.statusCode){const t=new Error(`Failed to get '${e}' (${i.statusCode})`);return console.error(t),void a(t)}if(c)i.pipe(c);else{let e="";i.on("data",(i=>{e+=i.toString()})),i.on("end",(()=>{r(e)}))}}));t&&u.write(d),c&&(c.on("finish",(()=>r(null))),c.on("error",(e=>{console.error(e),s.default.unlink(n,(()=>a(e)))}))),u.on("error",(e=>{console.error(e),n?s.default.unlink(n,(()=>a(e))):a(e)})),u.end()}))}static LoadServerConfigFromLocalFile(e){const i=s.default.readFileSync(e,"utf8");return JSON.parse(i)}static GetResourceInfo(e){const i=`${h._config.sdkAppId}`,t=`${h._config.schoolId}`;let n=e.resources.find((e=>-1!==i.search(e.sdkAppId)&&-1!==t.search(e.schoolId)));return n||(n=e.resources.find((e=>"0"===e.sdkAppId&&"0"===e.schoolId))),n}static GetConfigPath(e){return r.default.join(h.GetConfigDir(),`${e?(+new Date).toString():""}tiwcache.json`)}static GetZipPath(e){return r.default.join(h.GetZipDir(),`${e?(+new Date).toString():""}tiwresource.zip`)}static GetConfigDir(){return r.default.join(h._config.resourceDir,"tiwcache")}static GetLogDir(){return r.default.join(h._config.resourceDir,"tiwcache")}static GetZipDir(){return r.default.join(h._config.resourceDir,"tiwcache")}static GetResourceDir(){return r.default.join(h._config.resourceDir,"tiwcache","resource")}static GetDocumentDir(){return r.default.join(h._config.resourceDir,"tiwcache","document")}static IsBundleResourceNew(e,i){const t=h.LoadServerConfigFromLocalFile(e),n=h.GetResourceInfo(t),o=h.GetResourceInfo(i);return n&&o&&n.devBuildTime>o.devBuildTime}static DownloadDocumentCategory(e,i){if(s.default.existsSync(e))return h.DownloadDocumentFiles(e,i);if(h._documentState.get(i))return Promise.reject("下载中");h._documentState.set(i,!0),console.log("TIWCacheManager document downloading",i);const t=r.default.normalize(e.substring(0,e.lastIndexOf(r.default.sep)+1));return s.default.mkdirSync(t),h.HttpRequest(i,null,null,e).then((()=>(console.log("TIWCacheManager document downloaded",i,e),h.ClearExpiredDocuments(),h.DownloadDocumentFiles(e,i)))).finally((()=>{h._documentState.set(i,!1)}))}static DownloadDocumentFiles(e,i,t=0){let n=h._documentInfo.get(e);if(!n){if(n=h.LoadDocumentInfoFromLocalFile(e,i),!n)return Promise.reject("课件文件列表解析失败");n.files.sort(((e,i)=>e.priority-i.priority)),console.log("TIWCacheManager document info",i,n),h._documentInfo.set(e,n)}if(t>=n.files.length)return Promise.resolve();const o=n.files[t];if(!s.default.existsSync(o.path)){const n=o.path.substring(0,o.path.lastIndexOf(r.default.sep)+1);return s.default.mkdirSync(n,{recursive:!0}),console.log("TIWCacheManager document file downloading",i,t),h.HttpRequest(o.url,null,null,o.path).then((()=>(console.log("TIWCacheManager document file downloaded",i,t,o),h.DownloadDocumentFiles(e,i,t+1))))}return h.DownloadDocumentFiles(e,i,t+1)}static LoadDocumentInfoFromLocalFile(e,i){const t=s.default.readFileSync(e,"utf-8"),n=JSON.parse(t);n.path=e,n.url=i;const o=e.substring(0,e.lastIndexOf(r.default.sep)+1),a=i.substring(0,i.lastIndexOf("/")+1);return n.files.forEach((e=>{e.path=r.default.join(o,e.name),e.url=`${a}/${e.name}`})),n}static RemoveDirSync(e,i){if(!s.default.existsSync(e))return!0;let t=!0;return s.default.readdirSync(e).forEach((n=>{const o=r.default.join(e,n),a=s.default.statSync(o);!i||i(a)?a.isDirectory()?h.RemoveDirSync(o)||(t=!1):s.default.unlinkSync(o):a.isDirectory()&&h.RemoveDirSync(o,i)||(t=!1)})),!!t&&(s.default.rmdirSync(e),!0)}static ClearExpiredDocuments(){const e=new Date;h.RemoveDirSync(h.GetDocumentDir(),(i=>!i.isDirectory()||new Date(i.atime.getTime()+2592e5)<e))}}i.TIWCacheManager=h,h.TIWCacheSchemeHttp="tiw-cache",h.TIWCacheSchemeHttps="tiw-caches",h.TIWCacheSchemePrivileges={standard:!0,secure:!0,bypassCSP:!0,allowServiceWorkers:!0,supportFetchAPI:!0,corsEnabled:!0,stream:!1},h.TIWCacheFileMap=new Map,h._enabled=!1,h._timer=null,h._isRefreshing=!1,h._documentState=new Map,h._documentInfo=new Map,h._cacheCallback=null},450:function(e,i,t){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.httpRequest=void 0;const o=n(t(211)),s=n(t(605)),r=n(t(747));i.httpRequest=function(e,i,t,n){const a=e.toLowerCase().startsWith("https://")?o.default:s.default;return new Promise(((o,s)=>{const c=n?r.default.createWriteStream(n):null,d=t?JSON.stringify(t):null,h=d?"POST":"GET";i||(i={}),d&&(i.hasOwnProperty("Content-Type")||(i["Content-Type"]="application/json"),i.hasOwnProperty("Content-Length")||(i["Content-Length"]=d.length.toString()));const l={method:h,headers:i},u=a.request(e,l,(i=>{if(200!==i.statusCode){const t=new Error(`Failed to get '${e}' (${i.statusCode})`);return console.error(t),void s(t)}if(c)i.pipe(c);else{let e="";i.on("data",(i=>{e+=i.toString()})),i.on("end",(()=>{o(e)}))}}));t&&u.write(d),c&&(c.on("finish",(()=>o(null))),c.on("error",(e=>{console.error(e),r.default.unlink(n,(()=>s(e)))}))),u.on("error",(e=>{console.error(e),n?r.default.unlink(n,(()=>s(e))):s(e)})),u.end()}))}},42:function(e,i,t){var n=this&&this.__createBinding||(Object.create?function(e,i,t,n){void 0===n&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return i[t]}})}:function(e,i,t,n){void 0===n&&(n=t),e[n]=i[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&n(i,e,t);return o(i,e),i},r=this&&this.__awaiter||function(e,i,t,n){return new(t||(t=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var i;e.done?o(e.value):(i=e.value,i instanceof t?i:new t((function(e){e(i)}))).then(r,a)}c((n=n.apply(e,i||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.isWin7=i.getDesktopBounds=i.getWindowBounds=i.setThickFrame=i.setShowTaskbarOnMultipleDisplays=i.isShowTaskbarOnMultipleDisplays=i.setTaskbarAutoHiddenInTabletEnabled=i.isTaskbarAutoHiddenInTabletEnabled=i.setTaskbarAutoHiddenInDesktopEnabled=i.isTaskbarAutoHiddenInDesktopEnabled=i.getPrimaryDisplaySize=i.getMaxTouches=i.getDesktopPath=void 0;const c=a(t(124)),d=a(t(747)),h=s(t(87)),l=a(t(622)),u=a(t(728)),w=a(t(451)),f=a(t(26)),S=u.default.types.bool,p=u.default.types.int,g=u.default.types.uint,W=process.arch.includes("64")?u.default.types.uint64:u.default.types.uint32,m=u.default.types.long,y=u.default.types.ulong,M=y,C=process.arch.includes("64")?u.default.types.int64:u.default.types.int32,b=process.arch.includes("64")?u.default.types.ulonglong:y,v=b,D=b,T=b,I=w.default({left:m,top:m,right:m,bottom:m}),B=u.default.refType(I),V=w.default({cbSize:M,hWnd:T,uCallbackMessage:g,uEdge:g,rc:I,lParam:C}),P=u.default.refType(V);let E=null,_=null;if("win32"===process.platform)try{E=c.default.Library("user32",{SendNotifyMessageA:[S,[T,g,W,"string"]],GetSystemMetrics:[p,[p]],FindWindowA:[T,["string",m]],GetWindowLongA:[m,[T,p]],SetWindowLongA:[m,[T,p,m]],GetWindowRect:[S,[T,B]],EnumDisplayMonitors:[S,[D,m,"pointer",C]]}),_=c.default.Library("shell32",{SHAppBarMessage:[g,[g,P]]})}catch(e){console.error(e)}const k=function(e){return new Promise(((i,t)=>{const n={};f.default.list(e).on("data",(e=>{n[e.key]=e.data})).on("finish",(()=>{i(n)})).on("error",(e=>{t(e)}))}))},x=function(e){return new Promise(((i,t)=>{f.default.putValue(e,(e=>{e&&t(e),i()}))}))},O=function(){E&&E.SendNotifyMessageA(65535,26,0,"TraySettings")};i.getDesktopPath=function(){return r(this,void 0,void 0,(function*(){let e=l.default.join(h.homedir(),"Desktop"),i=d.default.existsSync(e);if("win32"===process.platform&&!i){const t="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",[n,o]=yield k(t).then((e=>[null,e])).catch((e=>[e,null]));if(!n&&o)try{i=!0,e=o[t].values.Desktop.value}catch(e){}}return i?e:""}))},i.getMaxTouches=function(){if(E){const e=95;return E.GetSystemMetrics(e)}return 0},i.getPrimaryDisplaySize=function(){if(E){const e=0,i=1;return{width:E.GetSystemMetrics(e),height:E.GetSystemMetrics(i)}}return null},i.isTaskbarAutoHiddenInDesktopEnabled=function(){return r(this,void 0,void 0,(function*(){if(_){const e=new V;return e.cbSize=V.size,1===_.SHAppBarMessage(4,e.ref())}return!1}))},i.setTaskbarAutoHiddenInDesktopEnabled=function(e){return r(this,void 0,void 0,(function*(){if(E&&_){const i=new V;return i.cbSize=V.size,i.hWnd=E.FindWindowA("Shell_TrayWnd",0),i.lParam=e?1:0,_.SHAppBarMessage(10,i.ref()),!0}return!1}))},i.isTaskbarAutoHiddenInTabletEnabled=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[i,t]=yield k(e).then((e=>[null,e])).catch((e=>[e,null]));if(!i&&t)try{return!!t[e].values.TaskbarAutoHideInTabletMode.value}catch(e){}}return!1}))},i.setTaskbarAutoHiddenInTabletEnabled=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const i={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{TaskbarAutoHideInTabletMode:{value:e?1:0,type:"REG_DWORD"}}};return yield x(i),O(),!0}catch(e){}return!1}))},i.isShowTaskbarOnMultipleDisplays=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[i,t]=yield k(e).then((e=>[null,e])).catch((e=>[e,null]));if(!i&&t)try{return!!t[e].values.MMTaskbarEnabled.value}catch(e){}}return!1}))},i.setShowTaskbarOnMultipleDisplays=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const i={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{MMTaskbarEnabled:{value:e?1:0,type:"REG_DWORD"}}};return yield x(i),O(),!0}catch(e){}return!1}))},i.setThickFrame=function(e,i){return r(this,void 0,void 0,(function*(){if(E){const t=parseInt(e.getMediaSourceId().split(":")[1],10),n=E.GetWindowLongA(t,-16),o=i?262144|n:-262145&n;return E.SetWindowLongA(t,-16,o),!0}return!1}))},i.getWindowBounds=function(e){const i={x:0,y:0,width:0,height:0};if(E){const t=new I;E.GetWindowRect(e,t.ref())&&(i.x=t.left,i.y=t.top,i.width=t.right-t.left,i.height=t.bottom-t.top)}return i};const A=new Map;i.getDesktopBounds=function(e){let i=A.get(e);if(i)return i;if(i={x:0,y:0,width:0,height:0},E){let t=0;const n=e,o=c.default.Callback(S,[v,D,B,C],((e,o,s,r)=>{if(t+=1,t===n){const e=s.deref();return i.x=e.left,i.y=e.top,i.width=e.right-e.left,i.height=e.bottom-e.top,!1}return!0}));E.EnumDisplayMonitors(0,0,o,0)}return A.set(e,i),i},i.isWin7=function(){const e=h.release().split(".");if(e.length>=3){const i=parseInt(e[0],10),t=parseInt(e[1],10);return!(i>=10||6===i&&t>=2)}return!1}},425:e=>{e.exports=require("@sentry/electron")},138:e=>{e.exports=require("adm-zip")},933:e=>{e.exports=require("electron")},765:e=>{e.exports=require("electron-store")},124:e=>{e.exports=require("ffi-napi")},747:e=>{e.exports=require("fs")},605:e=>{e.exports=require("http")},211:e=>{e.exports=require("https")},528:e=>{e.exports=require("i18next")},239:e=>{e.exports=require("i18next-resources-to-backend")},87:e=>{e.exports=require("os")},622:e=>{e.exports=require("path")},420:e=>{e.exports=require("ref-array-napi")},728:e=>{e.exports=require("ref-napi")},451:e=>{e.exports=require("ref-struct-napi")},26:e=>{e.exports=require("regedit")},293:e=>{e.exports=require("systeminformation")},311:e=>{e.exports=require("tiw-log")}},i={};return function t(n){var o=i[n];if(void 0!==o)return o.exports;var s=i[n]={exports:{}};return e[n].call(s.exports,s,s.exports,t),s.exports}(196)})()}));
1
+ !function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.TCIC=i():e.TCIC=i()}(global,(function(){return(()=>{"use strict";var e={555:function(e,i,t){var n=this&&this.__createBinding||(Object.create?function(e,i,t,n){void 0===n&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return i[t]}})}:function(e,i,t,n){void 0===n&&(n=t),e[n]=i[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&n(i,e,t);return o(i,e),i},r=this&&this.__awaiter||function(e,i,t,n){return new(t||(t=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var i;e.done?o(e.value):(i=e.value,i instanceof t?i:new t((function(e){e(i)}))).then(r,a)}c((n=n.apply(e,i||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.TencentCloudClass=void 0;const c=a(t(933)),d=a(t(765)),h=a(t(747)),l=a(t(622)),u=s(t(293)),w=s(t(450)),f=s(t(975)),S=t(376),p=t(741),g=s(t(42)),W=a(t(528)),m=a(t(239)),y=t(311);p.TIWCacheManager.RegisterAsPrivileged();const M=W.default.use(m.default(((e,i,t)=>{const n=l.default.resolve(__dirname,"..","locales",`${e}.json`);h.default.promises.readFile(n,"utf8").then((e=>{t(null,JSON.parse(e))})).catch((e=>{t(e,null)}))}))).init({lng:"zh",load:"languageOnly",fallbackLng:!1,keySeparator:!1,nsSeparator:!1});let C;if(C="win32"===process.platform?l.default.join(process.env.USERPROFILE,"TencentCloudClass"):l.default.join(process.env.HOME,"TencentCloudClass"),h.default.existsSync(C)||h.default.mkdirSync(C,{recursive:!0}),c.default.app.setPath("crashDumps",l.default.join(C,"crash")),"win32"===process.platform){const e=g.getPrimaryDisplaySize();e.width*e.height<=2073600&&(g.getMaxTouches()>1||g.isWin7())&&c.default.app.commandLine.appendSwitch("disable-gpu-compositing"),g.isWin7()&&c.default.app.commandLine.appendSwitch("disable-site-isolation-trials")}const b=new d.default;class v extends y.TLoggerElectronModule{constructor(){super(...arguments),this.classUrl="",this.windowTitle="",this.tcicMainView=null,this.tcicBoardView=null,this.isBoardViewLoaded=!1,this.tcicScreenShareVideoWindow=null,this.tcicDefaultEntryMainWindow=null,this.tcicScreenShareMainWindow=null,this.tcicScreenShareBoardWindow=null,this.tcicScreenShareCameraWindow=null,this.watchMouseEventEnabled=!1,this.watchMouseMoveTimer=null,this.touchScreenOptimizeEnabled=!1,this.touchScreenOptimizePerformed=!1,this.screenShareMainWindowMouseEventIgnored=!1,this.mainViewDevTools=null,this.boardViewDevTools=null,this.videoWindowDevTools=null,this.cameraWindowDevTools=null,this.shouldFullscreen=!1,this.closeAllWindowInvoking=!1,this.callBoardMethodCache=[],this.needToShowTaskbarFix=!1,this.isTaskbarAutoHiddenInDesktopEnabled=!1,this.isTaskbarAutoHiddenInTabletEnabled=!1,this.isShowTaskbarOnMultipleDisplays=!1,this.onAllWindowClosedCallback=null,this.lastSelectedScreenBoardToolType=0,this.ipcListeners=[],this.ipcHandlers=[],this.seriousErrorTimes=0,this.isScreenSharing=!1,this.shareParams=null,this.isMainWindowMaximized=!1,this.mainWindowBoundsBeforeMaximize={},this.gpuInfoWatcher=null,this.checkShareWindowBoundsTimer=null,this.shareWindowBounds={x:0,y:0,width:0,height:0},this.shareMainWindowDisplay=null,this.shareBoardWindowDisplay=null}initialize(e){return r(this,void 0,void 0,(function*(){if(this.checkHasInitialize())return this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow.show(),!1;if("function"==typeof e.onClose&&(this.onAllWindowClosedCallback=e.onClose),e.sign){const i=new Buffer(e.sign.split(".")[1],"base64"),t=JSON.parse(i.toString("utf-8"));e.schoolId=t.school_id,e.classId=t.class_id,e.userId=t.user_id,e.cid=t.cid,e.uid=t.uid,e.scene=t.scene,e.token=e.sign,t.hasOwnProperty("class_type")&&(e.classType=t.class_type)}const i=new y.TLoggerConfig;i.sdkAppId=e.schoolId,i.userId=e.userId,i.roomId=e.classId,i.nativeSdkVersion=S.tcicSdkVersion,this._setConfig(i),this._info("Initialize",JSON.stringify(e)),yield M;let t=`schoolid=${e.schoolId}&userid=${e.userId}&classid=${e.classId}&token=${e.token}&webloadstamp=${(new Date).getTime()}&classtype=${e.classType}&watermark=${e.waterMark?JSON.stringify(e.waterMark):""}`;e.lng&&(t+=`&lng=${e.lng}`,W.default.changeLanguage(e.lng).then()),e.scene&&(t+=`&scene=${e.scene}`),e.debugCss&&(t+=`&debugCss=${e.debugCss}`),e.debugJs&&(t+=`&debugJs=${e.debugJs}`),e.customParams&&(t+=`&${e.customParams}`);let n=e.url;if(!n){let i="";const o=S.tcicSdkVersion.split("."),s=`/${o[0]}.${o[1]}.${o[2]}`;e.env&&"prod"!==e.env&&(i=`${e.env}-`),n=`https://${i}class.qcloudclass.com${s}/class.html?${e.env?`env=${e.env}&`:""}${t}`,process.defaultApp&&(process.argv.includes("--local")?n=`http://localhost:8080/class.html?${e.env?`env=${e.env}&`:""}${t}`:process.argv.includes("--vm")&&(n=`http://10.211.55.2:8080/class.html?${e.env?`env=${e.env}&`:""}${t}`))}return this.classUrl=n,this.createAndInitDefaultEntryMainWindow(),c.default.app.whenReady().then((()=>{this.createAndInitWindow()})),c.default.globalShortcut.unregister("CmdOrCtrl+F11"),c.default.globalShortcut.register("CmdOrCtrl+F11",(()=>{this.openDevTools()})),c.default.globalShortcut.unregister("CmdOrCtrl+Q"),c.default.globalShortcut.register("CmdOrCtrl+Q",(()=>{this.closeAllWindow().then()})),c.default.globalShortcut.unregister("CmdOrCtrl+Shift+F11"),c.default.globalShortcut.register("CmdOrCtrl+Shift+F11",(()=>{const e={watch_mouse_event:this.watchMouseEventEnabled,touch_optimize_enabled:this.touchScreenOptimizeEnabled,touch_optimize_performed:this.touchScreenOptimizePerformed,gpu_compositing_enabled:c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled"),max_touches:g.getMaxTouches(),primary_screen:g.getPrimaryDisplaySize()||c.default.screen.getPrimaryDisplay().size};"win32"===process.platform&&(e.aero_glass_enabled=c.default.systemPreferences.isAeroGlassEnabled());const i={type:"info",title:"系统信息",message:JSON.stringify(e,null,2),buttons:["关闭","打开GPU排障页面",b.get("autoOpenDevTools")?"启动时不打开调试工具":"启动时打开调试工具",b.get("screenShareNotOnTop")?"屏幕分享时窗口置顶":"屏幕分享时窗口不置顶",b.get("screenShareNotSetParent")?"屏幕分享时设置父子窗口":"屏幕分享时窗口不设置父子窗口","清除本地记录信息"]};c.default.dialog.showMessageBox(i).then((e=>{switch(e.response){case 1:{const e=new c.default.BrowserWindow({title:"GPU排障"});e.setMenu(null),e.loadURL("chrome://gpu"),e.show()}break;case 2:b.set("autoOpenDevTools",!b.get("autoOpenDevTools"));break;case 3:b.set("screenShareNotOnTop",!b.get("screenShareNotOnTop"));break;case 4:b.set("screenShareNotSetParent",!b.get("screenShareNotSetParent"));break;case 5:b.clear()}}))})),!0}))}closeAllWindow(e){if(this.closeAllWindowInvoking)return;this._info("CloseAllWindowStart"),this.closeAllWindowInvoking=!0;let i=Promise.resolve();this.tcicMainView&&(this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),i=new Promise((e=>{this.tcicMainView.webContents.once("destroyed",(()=>{this._info("MainViewDestroyed"),this.tcicMainView=null,this.mainViewDevTools&&this.mainViewDevTools.close(),e()})),this.tcicMainView.webContents.destroy()})));let t=Promise.resolve(),n=Promise.resolve();this.tcicBoardView&&(n=new Promise((e=>{this.tcicBoardView.webContents.once("destroyed",(()=>{this._info("BoardViewDestroyed"),this.tcicBoardView=null,this.boardViewDevTools&&this.boardViewDevTools.close(),e()})),this.tcicBoardView.webContents.destroy()})));let o=Promise.resolve();this.tcicScreenShareBoardWindow&&(o=new Promise((e=>{this.tcicScreenShareBoardWindow.once("closed",(()=>{this._info("ShareBoardWindowClosed"),e()})),this.tcicScreenShareBoardWindow.close()})));let s=Promise.resolve();this.tcicScreenShareMainWindow&&(s=new Promise((e=>{this.tcicScreenShareMainWindow.once("closed",(()=>{this._info("ShareMainWindowClosed"),e()})),this.tcicScreenShareMainWindow.close()})));let r=Promise.resolve();if(this.tcicScreenShareCameraWindow&&(r=new Promise((e=>{this.tcicScreenShareCameraWindow.once("closed",(()=>{this._info("CameraMainWindowClosed"),e()})),this.tcicScreenShareCameraWindow.close()}))),this.ipcListeners&&(this.ipcListeners.forEach((e=>{c.default.ipcMain.off(e.channel,e.listener)})),this.ipcListeners=[]),this.ipcHandlers&&(this.ipcHandlers.forEach((e=>{c.default.ipcMain.removeHandler(e.channel)})),this.ipcHandlers=[]),this.gpuInfoWatcher&&c.default.app.off("gpu-info-update",this.gpuInfoWatcher),!e){this.tcicDefaultEntryMainWindow&&(t=new Promise((e=>{this.tcicDefaultEntryMainWindow.once("closed",(()=>{this._info("EntryMainWindowClosed"),this.tcicDefaultEntryMainWindow=null,e()})),this.tcicDefaultEntryMainWindow.close()})));try{this.onAllWindowClosedCallback&&this.onAllWindowClosedCallback()}catch(e){console.error("业务侧传入的onClose回调内发生了异常:",e)}}let a=Promise.resolve();return this.tcicScreenShareVideoWindow&&(a=new Promise((e=>{this.tcicScreenShareVideoWindow.once("closed",(()=>{this._info("ShareVideoWindowClosed"),e()})),this.tcicScreenShareVideoWindow.close()}))),Promise.all([i,t,n,o,s,a,r]).then((()=>{this.closeAllWindowInvoking=!1,this._info("CloseAllWindowFinish")}))}focus(){this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.focus():this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.focus()}show(){this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()}sendCustomData(e){this.tcicMainView.webContents.send("sendCustomMessage",e)}_getClassName(){return"TencentCloudClass"}closeScreenShareBoardWindow(){this.tcicScreenShareBoardWindow&&(this.tcicScreenShareBoardWindow.getChildWindows().forEach((e=>{e.setParentWindow(null)})),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.getBrowserViews().length>0&&this.tcicScreenShareBoardWindow.removeBrowserView(this.tcicBoardView),this.tcicScreenShareBoardWindow.close())}seriousErrorHandler(e,i=""){this.seriousErrorTimes+=1,this._info("SeriouseError",JSON.stringify({times:this.seriousErrorTimes,reason:e})),console.error("TCIC seriousErrorHandler",this.seriousErrorTimes,e);let t=!this.closeAllWindowInvoking&&this.seriousErrorTimes<=3,n=`客户端遇到多次异常即将关闭,可从课堂列表再次进入,如果问题持续出现,请联系客服人员\n\n异常原因:${e} - ${i}\n\n异常上报UUID:${S.crashReportUUID}`;switch(e){case"clean-exit":case"abnormal-exit":case"killed":t=!1;break;case"oom":n=`客户端由于内存不足无法正常工作,请退出其它应用后从课堂列表再次进入\n\n异常上报UUID:${S.crashReportUUID}`,t=!1}this.closeAllWindow(t).then((()=>{if(t)this.createAndInitWindow();else{const e={type:"info",title:"客户端异常",message:n,buttons:["退出课堂"]};c.default.dialog.showMessageBox(e).then((e=>{}))}}))}detectScreenShareMainWindowMouseEventIgnored(e,i){if(!this.watchMouseEventEnabled||!this.tcicScreenShareMainWindow||!this.tcicMainView)return;const t=this.tcicScreenShareMainWindow.getPosition(),n=e-t[0],o=i-t[1];this.tcicMainView.webContents.capturePage({x:n,y:o,width:1,height:1}).then((e=>{const i=0===e.getBitmap()[3];i!==this.screenShareMainWindowMouseEventIgnored&&(this.screenShareMainWindowMouseEventIgnored=i,this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(i,{forward:this.touchScreenOptimizeEnabled}),console.log("setIgnoreMouseEvents",i,this.touchScreenOptimizeEnabled),i&&"darwin"===process.platform&&(0===this.lastSelectedScreenBoardToolType||this.tcicScreenShareBoardWindow.isFocused()||this.tcicScreenShareBoardWindow.focus()))}))}enableScreenShareMainWindowTouchScreenOptimize(){!this.touchScreenOptimizePerformed&&this.watchMouseEventEnabled&&this.touchScreenOptimizeEnabled&&(this.touchScreenOptimizePerformed=!0,console.log("enableScreenShareMainWindowTouchScreenOptimize"),this.tcicMainView&&this.tcicMainView.webContents.postMessage("enableWatchMouseMoveEvent",!0),this.tcicBoardView&&(this.tcicBoardView.webContents.isLoading()?this.tcicBoardView.webContents.on("did-finish-load",(()=>{this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!0)})):this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!0)))}disableScreenShareMainWindowTouchScreenOptimize(){this.touchScreenOptimizePerformed&&(this.touchScreenOptimizePerformed=!1,console.log("disableScreenShareMainWindowTouchScreenOptimize"),this.tcicMainView&&this.tcicMainView.webContents.postMessage("enableWatchMouseMoveEvent",!1),this.tcicScreenShareBoardWindow&&(this.tcicBoardView.webContents.isLoading()?this.tcicBoardView.webContents.on("did-finish-load",(()=>{this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!1)})):this.tcicBoardView.webContents.postMessage("enableWatchMouseMoveEvent",!1)))}enableScreenShareMainWindowWatchMouseMove(){if(this.watchMouseEventEnabled)return;this.watchMouseEventEnabled=!0,console.log("enableWatchMouseMove");let e=0,i=0;this.watchMouseMoveTimer=setInterval((()=>{const t=c.default.screen.getCursorScreenPoint();t.x===e&&t.y===i||(e=t.x,i=t.y,this.detectScreenShareMainWindowMouseEventIgnored(e,i))}),100),this.enableScreenShareMainWindowTouchScreenOptimize(),this.tcicScreenShareMainWindow.on("closed",(()=>{this.disableScreenShareMainWindowWatchMouseMove()}))}disableScreenShareMainWindowWatchMouseMove(){this.watchMouseEventEnabled&&(this.watchMouseEventEnabled=!1,console.log("disableWatchMouseMove"),this.watchMouseMoveTimer&&(clearInterval(this.watchMouseMoveTimer),this.watchMouseMoveTimer=null),this.disableScreenShareMainWindowTouchScreenOptimize(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(!1))}patchScreenShareMainWindowClickThrough(){"darwin"===process.platform?this.enableScreenShareMainWindowWatchMouseMove():"win32"===process.platform&&(g.isWin7()||c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled")&&(this.enableScreenShareMainWindowWatchMouseMove(),this.gpuInfoWatcher||(this.gpuInfoWatcher=()=>{c.default.app.getGPUFeatureStatus().gpu_compositing.includes("enabled")||this.disableScreenShareMainWindowWatchMouseMove()},c.default.app.on("gpu-info-update",this.gpuInfoWatcher))))}createAndInitMainView(){if(this.tcicMainView)return;this.tcicMainView=new c.default.BrowserView({webPreferences:{preload:l.default.join(__dirname,"mainRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicMainView.webContents.once("dom-ready",(()=>{this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()})),p.TIWCacheManager.EnableWebContentsCache(this.tcicMainView.webContents,!0),this.tcicMainView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),this.tcicMainView.webContents.on("page-title-updated",((e,i,t)=>{t&&(this.windowTitle=i,this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.setTitle(i),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setTitle(i))}));const e=`${this.classUrl}&seriousError=${this.seriousErrorTimes}`,i=this.tcicMainView.webContents.loadURL(e),t=new Promise(((e,i)=>{this.tcicMainView.webContents.on("did-finish-load",(()=>{this._info("MainViewDidFinishLoad"),e()})),this.tcicMainView.webContents.on("did-fail-load",((e,t,n,o,s,r,a)=>{this._info("MainViewDidFailLoad",JSON.stringify({code:t,desc:n})),i(e)}))}));Promise.all([i,t]).then((()=>{this._info("MainViewInitFinish"),this.tcicMainView.webContents.send("init")})).catch((e=>{this._info("MainViewInitFail",JSON.stringify({error:JSON.stringify(e)}));const i={type:"error",title:"",message:`网络异常,课堂加载失败: ${JSON.stringify(e)}\n\n运维ID:${S.crashReportUUID}`,buttons:["退出课堂"]};c.default.dialog.showMessageBox(i).then((e=>{this.closeAllWindow()}))})),this.tcicMainView.webContents.on("render-process-gone",((e,i)=>{this._info("MainViewRenderProcessGone",JSON.stringify({reason:i.reason})),this.seriousErrorHandler(i.reason)})),this.tcicMainView.webContents.on("unresponsive",(()=>{this._info("MainViewUnresponsive"),this.seriousErrorHandler("unresponsive")})),this._info("MainViewInit",JSON.stringify({url:e}))}getMainWindowMinSize(e){e||(e="top");const i=c.default.screen.getPrimaryDisplay().workAreaSize;let t=718,n=110+t+45;n>i.height&&(t=Math.ceil(538.5),n=110+t+45,n>i.height&&(t=Math.ceil(359),n=110+t+45));const o=Math.ceil(t/9*16);return{width:Math.max(o,890),height:n}}createAndInitDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow)return;this._info("EntryMainWindowInit");const e=this.getMainWindowMinSize();let i=e;b.has("MainWindowBounds")&&(i=b.get("MainWindowBounds")),this.tcicDefaultEntryMainWindow=new c.default.BrowserWindow({width:i.width<e.width?e.width:i.width,height:i.height<e.height?e.height:i.height,minWidth:e.width,minHeight:e.height,show:!1,frame:!1,maximizable:!1,fullscreen:!1,skipTaskbar:!1,title:this.windowTitle,backgroundColor:"#14181D",webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicDefaultEntryMainWindow.setMenu(null);let t=null;this.tcicDefaultEntryMainWindow.on("resize",(()=>{if(t&&clearTimeout(t),t=setTimeout((()=>{if(t=null,!this.tcicDefaultEntryMainWindow.isMinimized()&&!this.isMainWindowMaximized){const e=this.tcicDefaultEntryMainWindow.getBounds();b.set("MainWindowBounds",e)}}),100),this.tcicScreenShareVideoWindow){const e=this.tcicScreenShareVideoWindow.getBounds();this.resizeScreenShareVideoWindow({width:e.width,height:e.height})}if(this.tcicScreenShareCameraWindow){const e=this.tcicScreenShareCameraWindow.getBounds();this.resizeScreenShareCameraWindow({width:e.width,height:e.height})}})),this.tcicDefaultEntryMainWindow.on("move",(()=>{if(this.tcicScreenShareVideoWindow){const e=this.tcicDefaultEntryMainWindow.getPosition();this.tcicScreenShareVideoWindow.setPosition(e[0],e[1])}if(this.tcicScreenShareCameraWindow){const e=this.tcicDefaultEntryMainWindow.getPosition();this.tcicScreenShareCameraWindow.setPosition(e[0],e[1])}})),this.tcicDefaultEntryMainWindow.on("close",(e=>{this._info("CloseDefaultEntryMainWindow",JSON.stringify({invoke:this.closeAllWindowInvoking,sharing:this.isScreenSharing})),this.closeAllWindowInvoking||(e.preventDefault(),this.isScreenSharing||this.tcicMainView.webContents.send("leaveClass"))}))}createAndInitBoardView(e,i){if(!this.tcicBoardView){if(this._info("BoardViewInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(i)})),this.tcicBoardView=new c.default.BrowserView({webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicBoardView.webContents.once("dom-ready",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.show()})),p.TIWCacheManager.EnableWebContentsCache(this.tcicBoardView.webContents,!0),this.tcicBoardView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),i){const t=this.tcicBoardView.webContents.loadFile(l.default.join(__dirname,"board.html")),n=new Promise(((e,i)=>{this.tcicBoardView.webContents.on("did-finish-load",(()=>{this._info("BoardViewDidFinishLoad"),e()})),this.tcicBoardView.webContents.on("did-fail-load",((e,t,n,o,s,r,a)=>{this._info("BoardViewDidFailLoad",JSON.stringify({code:t,desc:n})),i(e)}))}));Promise.all([t,n]).then((()=>{this._info("BoardViewInitFinish",JSON.stringify({boardMethodCache:JSON.stringify(this.callBoardMethodCache)})),i.shareWindowBounds={x:this.shareWindowBounds.x-e.bounds.x,y:this.shareWindowBounds.y-e.bounds.y,width:this.shareWindowBounds.width,height:this.shareWindowBounds.height},this.isBoardViewLoaded=!0,this.tcicBoardView.webContents.send("initBoard",i),this.callBoardMethodCache.forEach((e=>{this.callBoardMethod(e)})),this.callBoardMethodCache=[]})).catch((e=>{this._info("BoardViewInitFail",JSON.stringify({error:JSON.stringify(e)}))}))}this.tcicBoardView.webContents.on("render-process-gone",((e,i)=>{this._info("BoardViewRenderProcessGone",JSON.stringify({reason:i.reason})),this.seriousErrorHandler(i.reason)})),this.tcicBoardView.webContents.on("unresponsive",(()=>{this._info("BoardViewUnResponsive"),this.seriousErrorHandler("unresponsive")}))}}createAndInitScreenShareBoardWindow(e,i){this._info("BoardWindowInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(i)})),this.tcicScreenShareBoardWindow=new c.default.BrowserWindow({x:e.bounds.x,y:e.bounds.y,enableLargerThanScreen:!0,width:e.bounds.width,height:e.bounds.height,fullscreen:this.shouldFullscreen,frame:!1,transparent:!0,hasShadow:!1,skipTaskbar:!1,title:this.windowTitle,minimizable:!0,maximizable:!1,resizable:!1,acceptFirstMouse:!0,webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicScreenShareBoardWindow.setMenu(null),this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareBoardWindow.on("restore",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setOpacity(1)})),this.tcicScreenShareBoardWindow.on("closed",(()=>{this.tcicScreenShareBoardWindow=null})),this.tcicScreenShareBoardWindow.on("minimize",(()=>{this.tcicScreenShareMainWindow.restore(),setTimeout((()=>{this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,this.shareParams),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1),console.log("restore board window")}),100)}))}createAndInitScreenShareCameraWindow(e){this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.close(),this.tcicScreenShareCameraWindow=null);const i=this.tcicDefaultEntryMainWindow.getBounds();this._info("CameraWindowInit",JSON.stringify({bounds:JSON.stringify(i),params:JSON.stringify(e)})),this.tcicScreenShareCameraWindow=new c.default.BrowserWindow({x:i.x,y:i.y,width:i.width,height:i.height,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,skipTaskbar:!0,focusable:!1,opacity:0,title:"",webPreferences:{preload:l.default.join(__dirname,"cameraRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.resizeScreenShareCameraWindow({width:960,height:540}),this.tcicScreenShareCameraWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareCameraWindow.setMenu(null),this.tcicScreenShareCameraWindow.once("show",(()=>{this.tcicDefaultEntryMainWindow.moveAbove(this.tcicScreenShareCameraWindow.getMediaSourceId()),this.tcicDefaultEntryMainWindow.show();const e="win32"===process.platform?0:1;this.tcicScreenShareCameraWindow.setOpacity(e)}));const t=this.tcicScreenShareCameraWindow.webContents.loadFile(l.default.join(__dirname,"camera.html")),n=new Promise(((e,i)=>{this.tcicScreenShareCameraWindow.webContents.on("did-finish-load",(()=>{this._info("CameraWindowDidFinishLoad"),e()})),this.tcicScreenShareCameraWindow.webContents.on("did-fail-load",((e,t,n,o,s,r,a)=>{this._info("CameraWindowDidFailLoad",JSON.stringify({code:t,desc:n})),i(e)}))}));return new Promise(((e,i)=>{Promise.all([t,n]).then((()=>{const i=this.tcicScreenShareCameraWindow.getMediaSourceId().split(":")[1];this._info("CameraWindowInitFinish",JSON.stringify({sourceId:i})),e({sourceId:i})})).catch((e=>{this._info("CameraWindowInitFail",JSON.stringify({error:JSON.stringify(e)})),i(e)}))}))}resizeScreenShareCameraWindow(e){const i=this.tcicDefaultEntryMainWindow.getBounds();e.width>i.width&&(e.height=Math.floor(e.height/e.width*i.width),e.width=i.width),e.height>i.height&&(e.width=Math.floor(e.width/e.height*i.height),e.height=i.height),i.width=e.width,i.height=e.height,this.tcicScreenShareCameraWindow.setBounds(i)}closeScreenShareCameraWindow(){this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.close(),this.tcicScreenShareCameraWindow=null)}createAndInitScreenShareMainWindow(e){this.tcicScreenShareMainWindow||(this._info("ShareMainWindowInit",JSON.stringify({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height})),this.tcicScreenShareMainWindow=new c.default.BrowserWindow({x:e.bounds.x,y:e.bounds.y,enableLargerThanScreen:!0,width:e.bounds.width,height:e.bounds.height,fullscreen:this.shouldFullscreen,transparent:!0,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,resizable:!1,skipTaskbar:!0,acceptFirstMouse:!0,webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicScreenShareMainWindow.setMenu(null),this.tcicScreenShareMainWindow.on("close",(e=>{!this.closeAllWindowInvoking&&this.isScreenSharing&&e.preventDefault()})),this.tcicScreenShareMainWindow.on("closed",(()=>{this.tcicScreenShareMainWindow=null})),this.patchScreenShareMainWindowClickThrough())}createAndInitScreenShareVideoWindow(e){this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.close(),this.tcicScreenShareVideoWindow=null);const i=this.tcicDefaultEntryMainWindow.getBounds();this._info("VideoWindowInit",JSON.stringify({x:i.x,y:i.y,width:e.bounds.width,height:e.bounds.height,params:JSON.stringify(e)})),this.tcicScreenShareVideoWindow=new c.default.BrowserWindow({x:i.x,y:i.y,width:e.bounds.width,height:e.bounds.height,frame:!1,hasShadow:!1,minimizable:!1,maximizable:!1,skipTaskbar:!0,focusable:!1,opacity:0,title:"",webPreferences:{preload:l.default.join(__dirname,"videoRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicScreenShareVideoWindow.setIgnoreMouseEvents(!0),this.tcicScreenShareVideoWindow.setMenu(null),this.tcicScreenShareVideoWindow.once("show",(()=>{this.tcicDefaultEntryMainWindow.moveAbove(this.tcicScreenShareVideoWindow.getMediaSourceId()),this.tcicDefaultEntryMainWindow.show();const e="win32"===process.platform?0:1;this.tcicScreenShareVideoWindow.setOpacity(e)}));const t=this.tcicScreenShareVideoWindow.webContents.loadFile(l.default.join(__dirname,"video.html")),n=new Promise(((e,i)=>{this.tcicScreenShareVideoWindow.webContents.on("did-finish-load",(()=>{this._info("VideoWindowDidFinishLoad"),e()})),this.tcicScreenShareVideoWindow.webContents.on("did-fail-load",((e,t,n,o,s,r,a)=>{this._info("VideoWindowDidFailLoad",JSON.stringify({code:t,desc:n})),i(e)}))}));return new Promise(((e,i)=>{Promise.all([t,n]).then((()=>{const i=this.tcicScreenShareVideoWindow.getMediaSourceId().split(":")[1];this._info("VideoWindowInitFinish",JSON.stringify({sourceId:i})),e({sourceId:i})})).catch((e=>{this._info("VideoWindowInitFail",JSON.stringify({error:JSON.stringify(e)})),i(e)}))}))}resizeScreenShareVideoWindow(e){const i=this.tcicDefaultEntryMainWindow.getBounds();e.width>i.width&&(e.height=Math.floor(e.height/e.width*i.width),e.width=i.width),e.height>i.height&&(e.width=Math.floor(e.width/e.height*i.height),e.height=i.height),i.width=e.width,i.height=e.height,this.tcicScreenShareVideoWindow.setBounds(i)}closeScreenShareVideoWindow(){this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.close(),this.tcicScreenShareVideoWindow=null)}attachMainViewToDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow&&this.tcicMainView){this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.getBrowserViews().length>0&&this.tcicScreenShareMainWindow.removeBrowserView(this.tcicMainView),0===this.tcicDefaultEntryMainWindow.getBrowserViews().length&&this.tcicDefaultEntryMainWindow.addBrowserView(this.tcicMainView);const e=this.tcicDefaultEntryMainWindow.getContentBounds();this.tcicMainView.setBounds({x:0,y:0,width:e.width,height:e.height})}}attachMainViewToScreenShareMainWindow(){if(this.tcicScreenShareMainWindow&&this.tcicMainView){this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),0===this.tcicScreenShareMainWindow.getBrowserViews().length&&this.tcicScreenShareMainWindow.addBrowserView(this.tcicMainView);const e=this.tcicScreenShareMainWindow.getContentBounds();this.tcicMainView.setBounds({x:0,y:0,width:e.width,height:e.height})}}attachBoardViewToScreenShareBoardWindow(){if(this.tcicScreenShareBoardWindow&&this.tcicBoardView){this.tcicScreenShareBoardWindow.addBrowserView(this.tcicBoardView);const e=this.tcicScreenShareBoardWindow.getContentBounds();this.tcicBoardView.setBounds({x:0,y:0,width:e.width,height:e.height})}}openDevTools(){const e=c.default.screen.getPrimaryDisplay().size,i=e.width/2,t=600;this.tcicMainView&&(this.mainViewDevTools||(this.mainViewDevTools=new c.default.BrowserWindow({width:i,height:t,x:(e.width-2*i)/2+i,y:(e.height-t)/2,title:"开发者调试工具 - 主视图",webPreferences:{backgroundThrottling:!1}}),this.mainViewDevTools.on("close",(e=>{this.tcicMainView?(e.preventDefault(),this.mainViewDevTools.hide()):this.mainViewDevTools=null})),this.tcicMainView.webContents.setDevToolsWebContents(this.mainViewDevTools.webContents)),this.tcicMainView.webContents.openDevTools({mode:"detach"}),this.mainViewDevTools.show()),this.tcicBoardView&&(this.boardViewDevTools||(this.boardViewDevTools=new c.default.BrowserWindow({width:i,height:t,x:(e.width-2*i)/2,y:(e.height-t)/2,title:"开发者调试工具 - 白板",webPreferences:{backgroundThrottling:!1}}),this.boardViewDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.boardViewDevTools.hide()):this.boardViewDevTools=null})),this.tcicBoardView.webContents.setDevToolsWebContents(this.boardViewDevTools.webContents)),this.tcicBoardView.webContents.openDevTools({mode:"detach"}),this.boardViewDevTools.show()),this.tcicScreenShareVideoWindow&&(this.videoWindowDevTools||(this.videoWindowDevTools=new c.default.BrowserWindow({width:i,height:t,x:(e.width-2*i)/2,y:(e.height-t)/2,title:"开发者调试工具 - 视频",webPreferences:{backgroundThrottling:!1}}),this.videoWindowDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.videoWindowDevTools.hide()):this.videoWindowDevTools=null})),this.tcicScreenShareVideoWindow.webContents.setDevToolsWebContents(this.videoWindowDevTools.webContents)),this.tcicScreenShareVideoWindow.webContents.openDevTools({mode:"detach"}),this.videoWindowDevTools.show()),this.tcicScreenShareCameraWindow&&(this.cameraWindowDevTools||(this.cameraWindowDevTools=new c.default.BrowserWindow({width:i,height:t,x:(e.width-2*i)/2,y:(e.height-t)/2,title:"开发者调试工具 - 辅助摄像头",webPreferences:{backgroundThrottling:!1}}),this.cameraWindowDevTools.on("close",(e=>{this.tcicScreenShareBoardWindow?(e.preventDefault(),this.cameraWindowDevTools.hide()):this.cameraWindowDevTools=null})),this.tcicScreenShareCameraWindow.webContents.setDevToolsWebContents(this.cameraWindowDevTools.webContents)),this.tcicScreenShareCameraWindow.webContents.openDevTools({mode:"detach"}),this.cameraWindowDevTools.show())}callBoardMethod(e){if(this.isBoardViewLoaded){if(this._info("CallBoardMethod",JSON.stringify({params:JSON.stringify(e)})),"board"===e.module){if("setToolType"===e.method){const i=e.params[0];0===i?(this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),"darwin"===process.platform&&this.tcicScreenShareBoardWindow.blur()):this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!1),this.lastSelectedScreenBoardToolType=i}this.tcicBoardView.webContents.send("callMethod",e)}}else this.callBoardMethodCache.push(e)}addLifecycleIPCListener(e,i){c.default.ipcMain.on(e,i),this.ipcListeners.push({channel:e,listener:i})}addLifecycleIPCHandler(e,i){c.default.ipcMain.handle(e,i),this.ipcHandlers.push({channel:e,handler:i})}registerIPCEvent(){this.addLifecycleIPCHandler("getSystemInfo",((e,i)=>r(this,void 0,void 0,(function*(){return yield u.get(i)})))),this.addLifecycleIPCListener("callMethod",((e,i)=>{this.callBoardMethod(i)})),this.addLifecycleIPCListener("enableTouchScreenOptimize",(e=>{this.touchScreenOptimizeEnabled=!0,this.enableScreenShareMainWindowTouchScreenOptimize()})),this.addLifecycleIPCListener("onMouseEvent",((e,i)=>{this.detectScreenShareMainWindowMouseEventIgnored(i.x,i.y)})),this.addLifecycleIPCListener("onReloadWindow",((e,i,t)=>{this.seriousErrorHandler(i,t)})),this.addLifecycleIPCListener("onPageFinished",((e,i)=>{this.seriousErrorTimes=0})),this.addLifecycleIPCListener("onCloseWindow",(()=>{this.closeAllWindow().then()})),this.addLifecycleIPCListener("onMinimizeWindow",(()=>{this.tcicDefaultEntryMainWindow.isMinimized()?(this.tcicDefaultEntryMainWindow.restore(),console.log("TCIC unminimized")):(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.setOpacity(0),this.tcicDefaultEntryMainWindow.minimize(),console.log("TCIC minimized"))})),this.tcicDefaultEntryMainWindow.on("restore",(()=>{if(this.tcicScreenShareVideoWindow){const e="win32"===process.platform?0:1;this.tcicScreenShareVideoWindow.setOpacity(e)}})),this.addLifecycleIPCListener("onMaximizeWindow",(()=>{this.isMainWindowMaximized?(console.log("TCIC unmaximized"),this.isMainWindowMaximized=!1,this.tcicDefaultEntryMainWindow.setResizable(!0),this.tcicDefaultEntryMainWindow.unmaximize(),g.setThickFrame(this.tcicDefaultEntryMainWindow,!0).then((()=>{this.tcicDefaultEntryMainWindow.setBounds(this.mainWindowBoundsBeforeMaximize)}))):(this.mainWindowBoundsBeforeMaximize=this.tcicDefaultEntryMainWindow.getBounds(),g.setThickFrame(this.tcicDefaultEntryMainWindow,!1).then((()=>{console.log("TCIC maximized"),this.isMainWindowMaximized=!0,this.tcicDefaultEntryMainWindow.maximize(),this.tcicDefaultEntryMainWindow.setResizable(!1)})))})),this.addLifecycleIPCListener("onClassLayoutChanged",((e,i)=>{if(!this.isMainWindowMaximized){const e=this.getMainWindowMinSize(i);this.tcicDefaultEntryMainWindow.setMinimumSize(e.width,e.height);const t=this.tcicDefaultEntryMainWindow.getBounds();if(t.width<e.width||t.height<e.height){this.tcicDefaultEntryMainWindow.setBounds({width:t.width<e.width?e.width:t.width,height:t.height<e.height?e.height:t.height},!0);const i=this.tcicDefaultEntryMainWindow.getBounds();b.set("MainWindowBounds",i),console.log("TCIC resize after layout",i)}}})),this.addLifecycleIPCListener("onScreenShareSnapshot",((e,i)=>{this.tcicMainView.webContents.send("onScreenShareSnapshot",i)})),this.addLifecycleIPCListener("onBoardCanRedoChange",((e,i)=>{this.tcicMainView.webContents.send("onBoardCanRedoChange",i)})),this.addLifecycleIPCListener("onBoardCanUndoChange",((e,i)=>{this.tcicMainView.webContents.send("onBoardCanUndoChange",i)})),this.addLifecycleIPCHandler("saveImage",((e,i)=>new Promise(((e,t)=>{const n=n=>{const o=i.base64Data.replace(/^data:image\/\w+;base64,/,""),s=Buffer.from(o,"base64");n?h.default.writeFile(n,s,(n=>{n?t({snapId:i.snapId,module:"electron",errcode:-5,errmsg:n.message}):e({snapId:i.snapId,snapName:i.snapName,totalSlices:1,totalSize:o.length,sliceIndex:0,sliceSize:o.length})})):t({snapId:i.snapId,module:"electron",errcode:0,errmsg:""})};i.dialog?c.default.dialog.showSaveDialog(this.tcicDefaultEntryMainWindow,{defaultPath:i.snapName,title:"保存图片",filters:[{name:"Custom File Type",extensions:["png","jpg"]}]}).then((e=>{n(e.filePath)})):g.getDesktopPath().then((e=>{const t=l.default.join(e,i.snapName);n(t)}))})))),this.addLifecycleIPCHandler("downloadMusic",((e,i)=>new Promise(((e,t)=>{let n;n="win32"===process.platform?l.default.join(process.env.USERPROFILE,"TencentCloudClass"):l.default.join(process.env.HOME,"TencentCloudClass"),n=l.default.join(n,"document"),h.default.existsSync(n)||h.default.mkdirSync(n,{recursive:!0});const o=l.default.join(n,`${i.documentId}_${i.url.substring(i.url.lastIndexOf("/")+1)}`);h.default.existsSync(o)?e(o):w.httpRequest(i.url,null,null,o).then((()=>{e(o)})).catch((e=>{t(e)}))})))),this.addLifecycleIPCHandler("loadVideo",((e,i)=>new Promise(((e,t)=>{this.createAndInitScreenShareVideoWindow(i).then((t=>{c.default.ipcMain.once("canplay",((i,n)=>{this.resizeScreenShareVideoWindow(n),e(t)})),this.tcicScreenShareVideoWindow.webContents.send("loadVideo",i.url)}))})))),this.addLifecycleIPCHandler("playVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("playVideo")})),this.addLifecycleIPCHandler("seekVideo",((e,i)=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("seekVideo",i)})),this.addLifecycleIPCHandler("pauseVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("pauseVideo")})),this.addLifecycleIPCHandler("stopVideo",(e=>{this.tcicScreenShareVideoWindow&&(this.tcicScreenShareVideoWindow.webContents.send("stopVideo"),this.closeScreenShareVideoWindow())})),this.addLifecycleIPCHandler("setVideoVolume",((e,i)=>(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("setVideoVolume",i),Promise.resolve()))),this.addLifecycleIPCListener("onVideoTimeSeeked",((e,i)=>{this.tcicMainView.webContents.send("onVideoTimeSeeked",i)})),this.addLifecycleIPCListener("onVideoTimeUpdate",((e,i)=>{this.tcicMainView.webContents.send("onVideoTimeUpdate",i)})),this.addLifecycleIPCHandler("startSubCamera",((e,i)=>new Promise(((e,t)=>{this.createAndInitScreenShareCameraWindow(i).then((t=>{c.default.ipcMain.once("playing",((i,n)=>{this.resizeScreenShareCameraWindow(n),e(t)})),this.tcicScreenShareCameraWindow.webContents.send("start",i)}))})))),this.addLifecycleIPCHandler("stopSubCamera",((e,i)=>new Promise(((e,i)=>{this.tcicScreenShareCameraWindow&&(this.tcicScreenShareCameraWindow.webContents.send("stop"),this.closeScreenShareCameraWindow()),e()})))),this.addLifecycleIPCHandler("startScreenShare",((e,i)=>r(this,void 0,void 0,(function*(){this._info("StartScreenShare",JSON.stringify(i)),this.shareParams=i,this.isScreenSharing=!0,this.tcicDefaultEntryMainWindow.hide();const e=this.getDisplay(i);return this.needToShowTaskbarFix="win32"===process.platform&&e.size.width===e.workAreaSize.width&&e.size.height===e.workAreaSize.height,this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled=yield g.isTaskbarAutoHiddenInDesktopEnabled(),this.isTaskbarAutoHiddenInDesktopEnabled&&g.setTaskbarAutoHiddenInDesktopEnabled(!1).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled=yield g.isTaskbarAutoHiddenInTabletEnabled(),this.isTaskbarAutoHiddenInTabletEnabled&&g.setTaskbarAutoHiddenInTabletEnabled(!1).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays=yield g.isShowTaskbarOnMultipleDisplays(),this.isShowTaskbarOnMultipleDisplays||g.setShowTaskbarOnMultipleDisplays(!0).then((()=>{})))),new Promise((e=>{const t=()=>{i.followTarget?(this.shareMainWindowDisplay=this.getDisplay(i),this.shareBoardWindowDisplay=this.shareMainWindowDisplay):(this.shareMainWindowDisplay=this.getCurrentDisplay(),this.shareBoardWindowDisplay=this.getDisplay(i)),this.createAndInitBoardView(this.shareBoardWindowDisplay,i),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,i),this.attachBoardViewToScreenShareBoardWindow(),this.createAndInitScreenShareMainWindow(this.shareMainWindowDisplay),this.attachMainViewToScreenShareMainWindow(),this.tcicScreenShareBoardWindow.show(),this.tcicScreenShareMainWindow.show(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.checkShareWindowBoundsTimer=setInterval((()=>{const e=this.getShareWindowBounds(i);if(this.shareWindowBounds.x!==e.x||this.shareWindowBounds.y!==e.y||this.shareWindowBounds.width!==e.width||this.shareWindowBounds.height!==e.height){this.shareWindowBounds=e;const t=this.getDisplay(i);this.shareBoardWindowDisplay.id!==t.id&&(this._info("ShareBoardWindowDisplayChanged",JSON.stringify({from:JSON.stringify(this.shareBoardWindowDisplay.bounds),to:JSON.stringify(t.bounds)})),this.shareBoardWindowDisplay=t,this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(t,i),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1)),this.tcicBoardView.webContents.send("onShareWindowBoundsChanged",{x:e.x-t.bounds.x,y:e.y-t.bounds.y,width:e.width,height:e.height})}}),100);const t=this.tcicScreenShareMainWindow.getMediaSourceId().split(":")[1],n=this.tcicScreenShareBoardWindow.getMediaSourceId().split(":")[1];0===i.type?e({excludeShareWindowSourceIds:[t],includeShareWindowSourceIds:[n]}):e({excludeShareWindowSourceIds:[t],includeShareWindowSourceIds:[]})};if("win32"===process.platform){let e=0;const n=setInterval((()=>{const o=this.getDisplay(i);e+=1,(o.size.width!==o.workAreaSize.width||o.size.height!==o.workAreaSize.height||e>50)&&(clearInterval(n),t())}),100)}else t()}))})))),this.addLifecycleIPCHandler("hasScreenCapturePermission",(e=>r(this,void 0,void 0,(function*(){return"granted"===c.default.systemPreferences.getMediaAccessStatus("screen")})))),this.addLifecycleIPCHandler("openSystemPreferences",(e=>r(this,void 0,void 0,(function*(){return f.requestScreenCaptureAccess()})))),this.addLifecycleIPCHandler("getExcludeSelectWindows",(e=>r(this,void 0,void 0,(function*(){const e=[];if(this.tcicDefaultEntryMainWindow){const i=this.tcicDefaultEntryMainWindow.getMediaSourceId().split(":")[1];e.push(i)}return Promise.resolve(e)})))),this.addLifecycleIPCHandler("stopScreenShare",((e,i)=>(this._info("StopScreenShare",JSON.stringify(i)),this.isScreenSharing=!1,this.tcicDefaultEntryMainWindow.show(),this.attachMainViewToDefaultEntryMainWindow(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.close(),this.tcicBoardView&&this.tcicBoardView.webContents.destroy(),this.tcicBoardView=null,this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.close(),this.checkShareWindowBoundsTimer&&(clearInterval(this.checkShareWindowBoundsTimer),this.checkShareWindowBoundsTimer=null),this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled&&g.setTaskbarAutoHiddenInDesktopEnabled(!0).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled&&g.setTaskbarAutoHiddenInTabletEnabled(!0).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays||g.setShowTaskbarOnMultipleDisplays(!1).then((()=>{})))),Promise.resolve())))}getCurrentDisplay(){return c.default.screen.getDisplayMatching(this.tcicDefaultEntryMainWindow.getBounds())}updateZOrderAccordingShareWindow(e,i){b.get("screenShareNotOnTop")||this.tcicScreenShareMainWindow&&this.tcicScreenShareBoardWindow&&(e.id===i.id?b.get("screenShareNotSetParent")?this.tcicScreenShareMainWindow.setAlwaysOnTop(!0,"screen-saver"):(this.tcicScreenShareMainWindow.setAlwaysOnTop(!1),this.tcicScreenShareMainWindow.setParentWindow(this.tcicScreenShareBoardWindow),this.tcicScreenShareBoardWindow.setAlwaysOnTop(!0,"screen-saver")):(this.tcicScreenShareMainWindow.setParentWindow(null),this.tcicScreenShareMainWindow.setAlwaysOnTop(!0,"screen-saver"),this.tcicScreenShareBoardWindow.setAlwaysOnTop(!0,"screen-saver")))}getShareWindowBounds(e){if(0===e.type){if("win32"===process.platform){const i=g.getWindowBounds(parseInt(e.displayId,10));return c.default.screen.screenToDipRect(null,i)}if("darwin"===process.platform)return f.getWindowBounds(parseInt(e.displayId,10))}return this.getDisplay(e).bounds}getDisplay(e){if(e.displayId){const i=c.default.screen.getAllDisplays();if(i.length>0){if("win32"===process.platform)return 0===e.type?c.default.screen.getDisplayMatching(g.getWindowBounds(parseInt(e.displayId,10))):c.default.screen.getDisplayMatching(g.getDesktopBounds(parseInt(e.displayId,10)));if("darwin"===process.platform&&0===e.type)return c.default.screen.getDisplayMatching(f.getWindowBounds(parseInt(e.displayId,10)))}for(const t of i)if(t.id.toString()===e.displayId)return t}return this.getCurrentDisplay()}initCacheModule(){return new Promise(((e,i)=>{let t=this.classUrl,n=t.indexOf(".html");-1!==n&&(n=t.length);const o=t.lastIndexOf("/",n);-1===o?c.default.dialog.showErrorBox("出错",`传入非法URL,课堂无法正常初始化: ${this.classUrl}`):t=t.substring(0,o),p.TIWCacheManager.SetCallback((e=>{this.tcicMainView.webContents.send("onVersionUpdate",{force:e})})),p.TIWCacheManager.SetConfig({configUrl:`${t}/cache/tiwcache.json`,configPath:l.default.join(__dirname,"config.json"),resourcePath:l.default.join(__dirname,"resource.zip"),resourceDir:C}).then((()=>{this._info("initCacheModule",JSON.stringify({code:0,error:""})),e()})).catch((i=>{this._info("initCacheModule",JSON.stringify({code:-1,error:JSON.stringify(i)})),e()}))}))}createAndInitWindow(){this.shouldFullscreen=!1,"win32"===process.platform&&(c.default.systemPreferences.isAeroGlassEnabled()?this.shouldFullscreen=!0:c.default.dialog.showErrorBox("出错","DWM未开启,不支持窗口透明特性")),this.initCacheModule().then((()=>{this.createAndInitMainView(),b.get("autoOpenDevTools")&&this.openDevTools(),this.attachMainViewToDefaultEntryMainWindow(),this.registerIPCEvent()}))}checkHasInitialize(){return!!this.tcicDefaultEntryMainWindow}}i.TencentCloudClass=v},975:function(e,i,t){var n=this&&this.__createBinding||(Object.create?function(e,i,t,n){void 0===n&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return i[t]}})}:function(e,i,t,n){void 0===n&&(n=t),e[n]=i[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&n(i,e,t);return o(i,e),i},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.requestScreenCaptureAccess=i.macOSVersion=i.getWindowBounds=void 0;const a=s(t(124)),c=r(t(420)),d=s(t(728)),h=r(t(451)),l=r(t(747)),u=t(933),w=d.types.void,f=d.types.int,S=d.types.int,p=process.arch.includes("64")?d.types.uint64:d.types.uint32,g=p,W=g,m=g,y=g,M=p,C=d.types.uint32,b=d.types.uint32,v=d.types.int,D=d.types.CString,T=d.types.double,I=h.default({x:T,y:T}),B=h.default({width:T,height:T}),V=h.default({origin:I,size:B}),P=d.refType(V),E=c.default(p);let _,k=null,x=null;if("darwin"===process.platform)try{const e=a.DynamicLibrary("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics");k=a.Library(e,{CGWindowListCopyWindowInfo:[m,[M,C]],CGWindowListCreateDescriptionFromArray:[m,[m]],CGRectMakeWithDictionaryRepresentation:[f,[y,P]],CGWindowListCreateImage:[g,[V,S,S,S]]});const i=a.DynamicLibrary("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation");x=a.Library(i,{CFArrayCreate:[m,[S,E,S,S]],CFStringCreateWithCString:[W,[S,D,b]],CFArrayGetCount:[v,[m]],CFArrayGetValueAtIndex:[g,[m,v]],CFDictionaryGetValue:[g,[y,W]],CFRelease:[w,[g]]})}catch(e){console.error(e)}function O(){if(!_){const e=(e=>{const i=/<key>ProductVersion<\/key>\s*<string>([\d.]+)<\/string>/.exec(e);if(i)return i[1].replace("10.16","11")})(l.default.readFileSync("/System/Library/CoreServices/SystemVersion.plist","utf8"));if(!e)return;_=(e=>{const{length:i}=e.split(".");return 1===i?`${e}.0.0`:2===i?`${e}.0`:e})(e)}return _}i.getWindowBounds=function(e){const i={x:0,y:0,width:0,height:0};if(k&&x)try{const t=new E(1);t[0]=e;const n=x.CFArrayCreate(0,t,t.length,0),o=k.CGWindowListCreateDescriptionFromArray(n);if(0===o)return i;if(x.CFArrayGetCount(o)>0){const e=x.CFArrayGetValueAtIndex(o,0),t=x.CFStringCreateWithCString(0,"kCGWindowBounds",134217984),n=x.CFDictionaryGetValue(e,t),s=new V;k.CGRectMakeWithDictionaryRepresentation(n,s.ref()),i.x=s.origin.x,i.y=s.origin.y,i.width=s.size.width,i.height=s.size.height,x.CFRelease(t)}x.CFRelease(o),x.CFRelease(n)}catch(e){console.error(e)}return console.log("getWindowBounds",JSON.stringify(i)),i},i.macOSVersion=O;let A=!1;i.requestScreenCaptureAccess=function(){if(k&&x)try{const e=O().split(".").map((e=>parseInt(e,10)));if(e[0]<10||10===e[0]&&e[1]<15)return;const i=new V;i.origin.x=0,i.origin.y=0,i.size.width=1,i.size.height=1;const t=k.CGWindowListCreateImage(i,1,0,0);if(x.CFRelease(t),A){const e="security",i="Privacy_ScreenCapture";u.shell.openExternal(`x-apple.systempreferences:com.apple.preference.${e}${i?`?${i}`:""}`)}else A=!0}catch(e){console.error(e)}}},196:function(e,i,t){var n=this&&this.__awaiter||function(e,i,t,n){return new(t||(t=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var i;e.done?o(e.value):(i=e.value,i instanceof t?i:new t((function(e){e(i)}))).then(r,a)}c((n=n.apply(e,i||[])).next())}))};Object.defineProperty(i,"__esModule",{value:!0}),i.TCIC=void 0;const o=t(555),s=t(376);let r=null;i.TCIC={initialize(e){return n(this,void 0,void 0,(function*(){const i=e.onClose;e.onClose=()=>{i&&i(),r=null},r?this.show():(r=new o.TencentCloudClass,yield r.initialize(e))}))},closeAllWindow(){r&&r.focus()},focus(){r&&r.focus()},show(){r&&r.show()},getVersion:()=>s.tcicSdkVersion},e.exports=i.TCIC},376:(e,i,t)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.crashReportUUID=i.tcicSdkVersion=void 0;const n=t(425);i.tcicSdkVersion="1.5.0.238",i.crashReportUUID=Date.now().toString()+Math.round(1e4*Math.random()).toString(),n.init({appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:!0}),n.configureScope((e=>{e.setTag("extra.sdk",i.tcicSdkVersion),e.setTag("extra.uuid",i.crashReportUUID)}))},741:function(e,i,t){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.TIWCacheManager=void 0;const o=t(933),s=n(t(747)),r=n(t(622)),a=n(t(605)),c=n(t(211)),d=n(t(138));class h{static EnableCache(e){if(h._enabled=e,h._timer&&(clearTimeout(h._timer),h._timer=null),h._enabled&&h._config&&h._serverConfig){const e=()=>{h.RefreshServerConfig().catch((e=>{console.error(e)})),h._timer=setTimeout(e,1e3*this._serverConfig.interval)};e()}}static SetCallback(e){h._cacheCallback=e}static SetConfig(e){return new Promise(((i,t)=>{h._config=e;const n=h.GetConfigDir(),o=h.GetZipDir(),r=h.GetResourceDir(),a=h.GetDocumentDir();s.default.existsSync(n)||s.default.mkdirSync(n,{recursive:!0}),s.default.existsSync(o)||s.default.mkdirSync(o,{recursive:!0}),s.default.existsSync(r)||s.default.mkdirSync(r,{recursive:!0}),s.default.existsSync(a)||s.default.mkdirSync(a,{recursive:!0});const c=h.GetConfigPath(),l=h.GetZipPath();let u=null;s.default.existsSync(c)&&(u=h.LoadServerConfigFromLocalFile(c),h.IsBundleResourceNew(e.configPath,u)&&(h.RemoveDirSync(r),s.default.promises.unlink(c).then(),s.default.existsSync(l)&&s.default.promises.unlink(l).then(),u=null)),u?(console.info("TIWCacheManager use cache files"),h._serverConfig=u,h.EnableCache(!0),i()):s.default.existsSync(e.configPath)?s.default.existsSync(e.resourcePath)?s.default.promises.copyFile(e.configPath,c).then((()=>{console.info("TIWCacheManager update config file");const n=h.LoadServerConfigFromLocalFile(c);s.default.promises.copyFile(e.resourcePath,l).then((()=>{console.info("TIWCacheManager update resource file");try{h.RemoveDirSync(r),new d.default(l).extractAllTo(r,!0),h._serverConfig=n,h.EnableCache(!0),i()}catch(e){s.default.promises.unlink(c).then(),s.default.promises.unlink(l).then(),console.error("TIWCacheManager resource unzip failed",e),t(e)}})).catch((()=>{t(`TIWCacheManager copyFile file error: ${e.resourcePath}`)}))})).catch((()=>{t(`TIWCacheManager resource file not found: ${e.configPath}`)})):t(`TIWCacheManager resource file not found: ${e.resourcePath}`):t(`TIWCacheManager config file not found: ${e.configPath}`)}))}static RefreshServerConfig(){if(!h._config.configUrl)return Promise.reject("缺少配置文件URL");if(h._isRefreshing)return Promise.reject("上次刷新未完成");h._isRefreshing=!0;const e=h.GetConfigPath(!0),i=h._config.configUrl;return h.HttpRequest(i,null,null,e).then((()=>{const i=h.LoadServerConfigFromLocalFile(e),t=h.GetResourceInfo(i);if(!t)return Promise.reject("新配置缺少可用资源信息");const n=h.GetResourceInfo(h._serverConfig);if(n&&t&&n.version===t.version&&t.devBuildTime<=n.devBuildTime)return Promise.reject(`新配置版本低于老配置版本: ${t.version} < ${n.version}`);console.log("TIWCacheManager new config fetched",i);const o=h.GetZipPath(!0);return h.HttpRequest(t.url,null,null,o).then((()=>{const t=h.GetResourceDir();h.RemoveDirSync(t),new d.default(o).extractAllTo(t,!0);const n=h.GetConfigPath();s.default.unlinkSync(n),s.default.renameSync(e,n);const r=h.GetZipPath();if(s.default.unlinkSync(r),s.default.renameSync(o,r),h._serverConfig=i,console.log("TIWCacheManager resource prepare done"),h._cacheCallback){const e=h._serverConfig.forceUpdate;h._cacheCallback(e)}return Promise.resolve()})).catch((e=>{s.default.unlinkSync(o),console.error("TIWCacheManager resource fetch failed",e)}))})).catch((i=>{s.default.unlinkSync(e),console.error("TIWCacheManager config fetch failed",i)})).finally((()=>{h._isRefreshing=!1}))}static RegisterAsPrivileged(){return o.app.isReady()?(console.error("RegisterAsPrivileged can only be used before the ready event of the app module gets emitted!!!"),!1):(o.protocol.registerSchemesAsPrivileged([{scheme:h.TIWCacheSchemeHttp,privileges:h.TIWCacheSchemePrivileges},{scheme:h.TIWCacheSchemeHttps,privileges:h.TIWCacheSchemePrivileges}]),!0)}static GetResourcePath(e){if(h._enabled&&h._config&&h._config.resourceDir){const i=h.GetResourceInfo(h._serverConfig);if(i){let t="";do{const n=new URL(e),o=`${n.origin}${n.pathname}`;if(i.files&&i.files.hasOwnProperty(o)){const e=i.files[o];t=e.toLowerCase().startsWith("http")?e:r.default.join(h.GetResourceDir(),e);break}if(!t&&i.regexes)for(const e in i.regexes){let n=i.regexes[e];const s=o.match(e);if(s&&s.length>0){for(let e=1;e<=s.length;++e){const i=new RegExp(`\\$${e}`,"g");n=n.replace(i,s[e])}t=r.default.join(h.GetResourceDir(),n);break}}if(!t&&i.documents)for(const e in i.documents){const n=i.documents[e],a=o.match(e);if(a&&a.length>=3){const e=a[1],i=a[2],c=h.GetDocumentDir();t=o.replace(e,c),s.default.existsSync(t)||h.DownloadDocumentCategory(r.default.join(c,i,n),`${e}/${i}/${n}`);break}}}while(0);return s.default.existsSync(t)?console.log("TIWCacheManager GetResourcePath",e,t):t="",t}}return""}static EnableWebContentsCache(e,i){if(i){const i=(e,i)=>{h.TIWCacheFileMap.has(e.url)?(i({path:h.TIWCacheFileMap.get(e.url)}),h.TIWCacheFileMap.delete(e.url)):i({statusCode:404})};e.session.protocol.registerFileProtocol(h.TIWCacheSchemeHttp,i),e.session.protocol.registerFileProtocol(h.TIWCacheSchemeHttps,i),e.session.webRequest.onBeforeRequest(((e,i)=>{let t=e.url;const n=t.indexOf("://"),o=t.substring(0,n).toLowerCase(),s=t.substring(n);if(o===h.TIWCacheSchemeHttp||o===h.TIWCacheSchemeHttps){if(h.TIWCacheFileMap.has(t))return void i({cancel:!1});t=o===h.TIWCacheSchemeHttp?`http${s}`:`https${s}`}else if("http"!==o&&"https"!==o)return void i({cancel:!1});const r=h.GetResourcePath(t);""===r?i({cancel:!1}):r.startsWith("http")?i({cancel:!1,redirectURL:r}):(t="https"===o||o===h.TIWCacheSchemeHttps?h.TIWCacheSchemeHttps+s:h.TIWCacheSchemeHttp+s,h.TIWCacheFileMap.set(t,r),t===e.url?i({cancel:!1}):i({cancel:!1,redirectURL:t}))}))}else e.session.protocol.unregisterProtocol(h.TIWCacheSchemeHttp),e.session.protocol.unregisterProtocol(h.TIWCacheSchemeHttps),e.session.webRequest.onBeforeSendHeaders(null)}static HttpRequest(e,i,t,n){const o=e.toLowerCase().startsWith("https://")?c.default:a.default;return new Promise(((r,a)=>{const c=n?s.default.createWriteStream(n):null,d=t?JSON.stringify(t):null,h=d?"POST":"GET";i||(i={}),d&&(i.hasOwnProperty("Content-Type")||(i["Content-Type"]="application/json"),i.hasOwnProperty("Content-Length")||(i["Content-Length"]=d.length.toString()));const l={method:h,headers:i},u=o.request(e,l,(i=>{if(200!==i.statusCode){const t=new Error(`Failed to get '${e}' (${i.statusCode})`);return console.error(t),void a(t)}if(c)i.pipe(c);else{let e="";i.on("data",(i=>{e+=i.toString()})),i.on("end",(()=>{r(e)}))}}));t&&u.write(d),c&&(c.on("finish",(()=>r(null))),c.on("error",(e=>{console.error(e),s.default.unlink(n,(()=>a(e)))}))),u.on("error",(e=>{console.error(e),n?s.default.unlink(n,(()=>a(e))):a(e)})),u.end()}))}static LoadServerConfigFromLocalFile(e){const i=s.default.readFileSync(e,"utf8");return JSON.parse(i)}static GetResourceInfo(e){const i=`${h._config.sdkAppId}`,t=`${h._config.schoolId}`;let n=e.resources.find((e=>-1!==i.search(e.sdkAppId)&&-1!==t.search(e.schoolId)));return n||(n=e.resources.find((e=>"0"===e.sdkAppId&&"0"===e.schoolId))),n}static GetConfigPath(e){return r.default.join(h.GetConfigDir(),`${e?(+new Date).toString():""}tiwcache.json`)}static GetZipPath(e){return r.default.join(h.GetZipDir(),`${e?(+new Date).toString():""}tiwresource.zip`)}static GetConfigDir(){return r.default.join(h._config.resourceDir,"tiwcache")}static GetLogDir(){return r.default.join(h._config.resourceDir,"tiwcache")}static GetZipDir(){return r.default.join(h._config.resourceDir,"tiwcache")}static GetResourceDir(){return r.default.join(h._config.resourceDir,"tiwcache","resource")}static GetDocumentDir(){return r.default.join(h._config.resourceDir,"tiwcache","document")}static IsBundleResourceNew(e,i){const t=h.LoadServerConfigFromLocalFile(e),n=h.GetResourceInfo(t),o=h.GetResourceInfo(i);return n&&o&&n.devBuildTime>o.devBuildTime}static DownloadDocumentCategory(e,i){if(s.default.existsSync(e))return h.DownloadDocumentFiles(e,i);if(h._documentState.get(i))return Promise.reject("下载中");h._documentState.set(i,!0),console.log("TIWCacheManager document downloading",i);const t=r.default.normalize(e.substring(0,e.lastIndexOf(r.default.sep)+1));return s.default.mkdirSync(t),h.HttpRequest(i,null,null,e).then((()=>(console.log("TIWCacheManager document downloaded",i,e),h.ClearExpiredDocuments(),h.DownloadDocumentFiles(e,i)))).finally((()=>{h._documentState.set(i,!1)}))}static DownloadDocumentFiles(e,i,t=0){let n=h._documentInfo.get(e);if(!n){if(n=h.LoadDocumentInfoFromLocalFile(e,i),!n)return Promise.reject("课件文件列表解析失败");n.files.sort(((e,i)=>e.priority-i.priority)),console.log("TIWCacheManager document info",i,n),h._documentInfo.set(e,n)}if(t>=n.files.length)return Promise.resolve();const o=n.files[t];if(!s.default.existsSync(o.path)){const n=o.path.substring(0,o.path.lastIndexOf(r.default.sep)+1);return s.default.mkdirSync(n,{recursive:!0}),console.log("TIWCacheManager document file downloading",i,t),h.HttpRequest(o.url,null,null,o.path).then((()=>(console.log("TIWCacheManager document file downloaded",i,t,o),h.DownloadDocumentFiles(e,i,t+1))))}return h.DownloadDocumentFiles(e,i,t+1)}static LoadDocumentInfoFromLocalFile(e,i){const t=s.default.readFileSync(e,"utf-8"),n=JSON.parse(t);n.path=e,n.url=i;const o=e.substring(0,e.lastIndexOf(r.default.sep)+1),a=i.substring(0,i.lastIndexOf("/")+1);return n.files.forEach((e=>{e.path=r.default.join(o,e.name),e.url=`${a}/${e.name}`})),n}static RemoveDirSync(e,i){if(!s.default.existsSync(e))return!0;let t=!0;return s.default.readdirSync(e).forEach((n=>{const o=r.default.join(e,n),a=s.default.statSync(o);!i||i(a)?a.isDirectory()?h.RemoveDirSync(o)||(t=!1):s.default.unlinkSync(o):a.isDirectory()&&h.RemoveDirSync(o,i)||(t=!1)})),!!t&&(s.default.rmdirSync(e),!0)}static ClearExpiredDocuments(){const e=new Date;h.RemoveDirSync(h.GetDocumentDir(),(i=>!i.isDirectory()||new Date(i.atime.getTime()+2592e5)<e))}}i.TIWCacheManager=h,h.TIWCacheSchemeHttp="tiw-cache",h.TIWCacheSchemeHttps="tiw-caches",h.TIWCacheSchemePrivileges={standard:!0,secure:!0,bypassCSP:!0,allowServiceWorkers:!0,supportFetchAPI:!0,corsEnabled:!0,stream:!1},h.TIWCacheFileMap=new Map,h._enabled=!1,h._timer=null,h._isRefreshing=!1,h._documentState=new Map,h._documentInfo=new Map,h._cacheCallback=null},450:function(e,i,t){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.httpRequest=void 0;const o=n(t(211)),s=n(t(605)),r=n(t(747));i.httpRequest=function(e,i,t,n){const a=e.toLowerCase().startsWith("https://")?o.default:s.default;return new Promise(((o,s)=>{const c=n?r.default.createWriteStream(n):null,d=t?JSON.stringify(t):null,h=d?"POST":"GET";i||(i={}),d&&(i.hasOwnProperty("Content-Type")||(i["Content-Type"]="application/json"),i.hasOwnProperty("Content-Length")||(i["Content-Length"]=d.length.toString()));const l={method:h,headers:i},u=a.request(e,l,(i=>{if(200!==i.statusCode){const t=new Error(`Failed to get '${e}' (${i.statusCode})`);return console.error(t),void s(t)}if(c)i.pipe(c);else{let e="";i.on("data",(i=>{e+=i.toString()})),i.on("end",(()=>{o(e)}))}}));t&&u.write(d),c&&(c.on("finish",(()=>o(null))),c.on("error",(e=>{console.error(e),r.default.unlink(n,(()=>s(e)))}))),u.on("error",(e=>{console.error(e),n?r.default.unlink(n,(()=>s(e))):s(e)})),u.end()}))}},42:function(e,i,t){var n=this&&this.__createBinding||(Object.create?function(e,i,t,n){void 0===n&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return i[t]}})}:function(e,i,t,n){void 0===n&&(n=t),e[n]=i[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}:function(e,i){e.default=i}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var i={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&n(i,e,t);return o(i,e),i},r=this&&this.__awaiter||function(e,i,t,n){return new(t||(t=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var i;e.done?o(e.value):(i=e.value,i instanceof t?i:new t((function(e){e(i)}))).then(r,a)}c((n=n.apply(e,i||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.isWin7=i.getDesktopBounds=i.getWindowBounds=i.setThickFrame=i.setShowTaskbarOnMultipleDisplays=i.isShowTaskbarOnMultipleDisplays=i.setTaskbarAutoHiddenInTabletEnabled=i.isTaskbarAutoHiddenInTabletEnabled=i.setTaskbarAutoHiddenInDesktopEnabled=i.isTaskbarAutoHiddenInDesktopEnabled=i.getPrimaryDisplaySize=i.getMaxTouches=i.getDesktopPath=void 0;const c=a(t(124)),d=a(t(747)),h=s(t(87)),l=a(t(622)),u=a(t(728)),w=a(t(451)),f=a(t(26)),S=u.default.types.bool,p=u.default.types.int,g=u.default.types.uint,W=process.arch.includes("64")?u.default.types.uint64:u.default.types.uint32,m=u.default.types.long,y=u.default.types.ulong,M=y,C=process.arch.includes("64")?u.default.types.int64:u.default.types.int32,b=process.arch.includes("64")?u.default.types.ulonglong:y,v=b,D=b,T=b,I=w.default({left:m,top:m,right:m,bottom:m}),B=u.default.refType(I),V=w.default({cbSize:M,hWnd:T,uCallbackMessage:g,uEdge:g,rc:I,lParam:C}),P=u.default.refType(V);let E=null,_=null;if("win32"===process.platform)try{E=c.default.Library("user32",{SendNotifyMessageA:[S,[T,g,W,"string"]],GetSystemMetrics:[p,[p]],FindWindowA:[T,["string",m]],GetWindowLongA:[m,[T,p]],SetWindowLongA:[m,[T,p,m]],GetWindowRect:[S,[T,B]],EnumDisplayMonitors:[S,[D,m,"pointer",C]]}),_=c.default.Library("shell32",{SHAppBarMessage:[g,[g,P]]})}catch(e){console.error(e)}const k=function(e){return new Promise(((i,t)=>{const n={};f.default.list(e).on("data",(e=>{n[e.key]=e.data})).on("finish",(()=>{i(n)})).on("error",(e=>{t(e)}))}))},x=function(e){return new Promise(((i,t)=>{f.default.putValue(e,(e=>{e&&t(e),i()}))}))},O=function(){E&&E.SendNotifyMessageA(65535,26,0,"TraySettings")};i.getDesktopPath=function(){return r(this,void 0,void 0,(function*(){let e=l.default.join(h.homedir(),"Desktop"),i=d.default.existsSync(e);if("win32"===process.platform&&!i){const t="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",[n,o]=yield k(t).then((e=>[null,e])).catch((e=>[e,null]));if(!n&&o)try{i=!0,e=o[t].values.Desktop.value}catch(e){}}return i?e:""}))},i.getMaxTouches=function(){if(E){const e=95;return E.GetSystemMetrics(e)}return 0},i.getPrimaryDisplaySize=function(){if(E){const e=0,i=1;return{width:E.GetSystemMetrics(e),height:E.GetSystemMetrics(i)}}return null},i.isTaskbarAutoHiddenInDesktopEnabled=function(){return r(this,void 0,void 0,(function*(){if(_){const e=new V;return e.cbSize=V.size,1===_.SHAppBarMessage(4,e.ref())}return!1}))},i.setTaskbarAutoHiddenInDesktopEnabled=function(e){return r(this,void 0,void 0,(function*(){if(E&&_){const i=new V;return i.cbSize=V.size,i.hWnd=E.FindWindowA("Shell_TrayWnd",0),i.lParam=e?1:0,_.SHAppBarMessage(10,i.ref()),!0}return!1}))},i.isTaskbarAutoHiddenInTabletEnabled=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[i,t]=yield k(e).then((e=>[null,e])).catch((e=>[e,null]));if(!i&&t)try{return!!t[e].values.TaskbarAutoHideInTabletMode.value}catch(e){}}return!1}))},i.setTaskbarAutoHiddenInTabletEnabled=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const i={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{TaskbarAutoHideInTabletMode:{value:e?1:0,type:"REG_DWORD"}}};return yield x(i),O(),!0}catch(e){}return!1}))},i.isShowTaskbarOnMultipleDisplays=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[i,t]=yield k(e).then((e=>[null,e])).catch((e=>[e,null]));if(!i&&t)try{return!!t[e].values.MMTaskbarEnabled.value}catch(e){}}return!1}))},i.setShowTaskbarOnMultipleDisplays=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const i={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{MMTaskbarEnabled:{value:e?1:0,type:"REG_DWORD"}}};return yield x(i),O(),!0}catch(e){}return!1}))},i.setThickFrame=function(e,i){return r(this,void 0,void 0,(function*(){if(E){const t=parseInt(e.getMediaSourceId().split(":")[1],10),n=E.GetWindowLongA(t,-16),o=i?262144|n:-262145&n;return E.SetWindowLongA(t,-16,o),!0}return!1}))},i.getWindowBounds=function(e){const i={x:0,y:0,width:0,height:0};if(E){const t=new I;E.GetWindowRect(e,t.ref())&&(i.x=t.left,i.y=t.top,i.width=t.right-t.left,i.height=t.bottom-t.top)}return i};const A=new Map;i.getDesktopBounds=function(e){let i=A.get(e);if(i)return i;if(i={x:0,y:0,width:0,height:0},E){let t=0;const n=e,o=c.default.Callback(S,[v,D,B,C],((e,o,s,r)=>{if(t+=1,t===n){const e=s.deref();return i.x=e.left,i.y=e.top,i.width=e.right-e.left,i.height=e.bottom-e.top,!1}return!0}));E.EnumDisplayMonitors(0,0,o,0)}return A.set(e,i),i},i.isWin7=function(){const e=h.release().split(".");if(e.length>=3){const i=parseInt(e[0],10),t=parseInt(e[1],10);return!(i>=10||6===i&&t>=2)}return!1}},425:e=>{e.exports=require("@sentry/electron")},138:e=>{e.exports=require("adm-zip")},933:e=>{e.exports=require("electron")},765:e=>{e.exports=require("electron-store")},124:e=>{e.exports=require("ffi-napi")},747:e=>{e.exports=require("fs")},605:e=>{e.exports=require("http")},211:e=>{e.exports=require("https")},528:e=>{e.exports=require("i18next")},239:e=>{e.exports=require("i18next-resources-to-backend")},87:e=>{e.exports=require("os")},622:e=>{e.exports=require("path")},420:e=>{e.exports=require("ref-array-napi")},728:e=>{e.exports=require("ref-napi")},451:e=>{e.exports=require("ref-struct-napi")},26:e=>{e.exports=require("regedit")},293:e=>{e.exports=require("systeminformation")},311:e=>{e.exports=require("tiw-log")}},i={};return function t(n){var o=i[n];if(void 0!==o)return o.exports;var s=i[n]={exports:{}};return e[n].call(s.exports,s,s.exports,t),s.exports}(196)})()}));
@@ -1 +1 @@
1
- (()=>{"use strict";var e={853:function(e,n,t){var o=this&&this.__createBinding||(Object.create?function(e,n,t,o){void 0===o&&(o=t),Object.defineProperty(e,o,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,o){void 0===o&&(o=t),e[o]=n[t]}),i=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&o(n,e,t);return i(n,e),n},s=this&&this.__awaiter||function(e,n,t,o){return new(t||(t=Promise))((function(i,r){function s(e){try{d(o.next(e))}catch(e){r(e)}}function a(e){try{d(o.throw(e))}catch(e){r(e)}}function d(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}d((o=o.apply(e,n||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const d=r(t(933)),c=a(t(881)),u=a(t(557)),w=r(t(574)),C=r(t(280)),p=t(376);let l=0,S="";const h="TStateScreenShareBoardUndo",T="TStateScreenShareBoardRedo";window.TRTCCloud=u.default,window.TRTCDefine=w,window.Electron={getPlatform:()=>process.platform,hasScreenCapturePermission:()=>d.ipcRenderer.invoke("hasScreenCapturePermission"),openSystemPreferences:()=>d.ipcRenderer.invoke("openSystemPreferences"),getExcludeSelectWindows:()=>d.ipcRenderer.invoke("getExcludeSelectWindows"),getClientInfo:()=>({sdkVersion:p.tcicSdkVersion,crashReportUUID:p.crashReportUUID}),getSystemInfo:e=>d.ipcRenderer.invoke("getSystemInfo",e),sendCustomMessage(e){d.ipcRenderer.send("onRecvCustomMessage",e)},reloadWindow(e,n){d.ipcRenderer.send("onReloadWindow",e,n)},onPageFinished(e){d.ipcRenderer.send("onPageFinished",e)},closeWindow(){if(window.TCIC){const e=window.TCIC.SDK.instance.getState(window.TCIC.TMainState.Class_Status),n=v(e);n!==S&&d.ipcRenderer.send(n)}d.ipcRenderer.send("onCloseWindow",0)},minimizeWindow(){d.ipcRenderer.send("onMinimizeWindow",0)},maximizeWindow(){d.ipcRenderer.send("onMaximizeWindow",0)},openUrl(e){d.shell.openExternal(e)},selectScreenCaptureTarget(e){this._selectedSource=e},startScreenShare(e){return s(this,void 0,void 0,(function*(){return this._selectedSource&&(e.type=this._selectedSource.type,e.displayId=this._selectedSource.sourceId),d.ipcRenderer.invoke("startScreenShare",e)}))},stopScreenShare:()=>d.ipcRenderer.invoke("stopScreenShare"),callMethod(e){d.ipcRenderer.send("callMethod",e),"board"===e.module&&"setToolType"===e.method&&(l=e.params[0])},saveSnapshot(e,n,t,o){const i={snapId:e,base64Data:n,snapName:t,dialog:o};return d.ipcRenderer.invoke("saveImage",i)},checkDNSParsing:e=>new Promise((n=>{const t=Date.now();c.default.lookup(e,((e,o,i)=>{n({error:e,cost:Date.now()-t,address:o})}))})),loadVideo(e,n){const t=e.getBoundingClientRect(),o={x:t.left,y:t.top,width:t.width,height:t.height};return d.ipcRenderer.invoke("loadVideo",{bounds:o,url:n})},playVideo:()=>d.ipcRenderer.invoke("playVideo"),pauseVideo:()=>d.ipcRenderer.invoke("pauseVideo"),stopVideo:()=>d.ipcRenderer.invoke("stopVideo"),seekVideo:e=>d.ipcRenderer.invoke("seekVideo",e),setVideoVolume:e=>d.ipcRenderer.invoke("setVideoVolume",e),downloadMusic:e=>d.ipcRenderer.invoke("downloadMusic",e),startSubCamera:e=>d.ipcRenderer.invoke("startSubCamera",e),stopSubCamera:()=>d.ipcRenderer.invoke("stopSubCamera")};const v=e=>e===window.TCIC.TClassStatus.Already_Start?"onTCICClassStart":e===window.TCIC.TClassStatus.Has_Ended?"onTCICClassStop":e===window.TCIC.TClassStatus.Has_Expired?"onTCICClassExpired":"onTCICClassInit";new Promise(((e,n)=>{d.ipcRenderer.on("init",((n,t)=>{console.log("init",t),window.TCIC&&(window.TCIC.SDK.instance.registerState(h,"屏幕共享白板撤销状态",!1),window.TCIC.SDK.instance.registerState(T,"屏幕共享白板重做状态",!1),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Layout,(e=>{d.ipcRenderer.send("onClassLayoutChanged",e)})),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Status,(e=>{S=v(e),d.ipcRenderer.send(S)})),window.TCIC.SDK.instance.on(window.TCIC.TMainEvent.Start_Class,(()=>{})),window.TCIC.SDK.instance.on(window.TCIC.TMainEvent.Stop_Class,(()=>{}))),e(t)})),d.ipcRenderer.on("onScreenShareSnapshot",((e,n)=>{window.screenShareSnapshotCallback&&window.screenShareSnapshotCallback(n)})),d.ipcRenderer.on("leaveClass",(e=>{window.TCIC?window.TCIC.SDK.instance.leaveClass():window.Electron.closeWindow()})),d.ipcRenderer.on("sendCustomMessage",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Recv_Custom_Msg,n)})),d.ipcRenderer.on("onBoardCanRedoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(T,n)})),d.ipcRenderer.on("onBoardCanUndoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(h,n)})),d.ipcRenderer.on("onVideoTimeUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Update,n)})),d.ipcRenderer.on("onVideoTimeSeeked",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Seeked,n)})),d.ipcRenderer.on("onVersionUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Version_Update,n)}))})).then((e=>{setTimeout((()=>{!function(e){const n="touchstart",t=()=>{window.removeEventListener(n,t,!0),d.ipcRenderer.send("enableTouchScreenOptimize");const e=["touchstart","touchmove","touchend","mousedown","mousemove","mouseup"];d.ipcRenderer.on("enableWatchMouseMoveEvent",((n,t)=>{C.watchEvents(window,e,t)}))};window.addEventListener(n,t,!0)}()}),1e3)}))},280:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.watchEvents=void 0;const o=t(933),i=e=>{let n,t;if(e instanceof TouchEvent?(n=Math.round(e.changedTouches[0].screenX),t=Math.round(e.changedTouches[0].screenY)):(n=e.screenX,t=e.screenY),0!==n||0!==t){const i={type:e.type,x:n,y:t};o.ipcRenderer.send("onMouseEvent",i),console.log("onMouseEvent",i)}};n.watchEvents=function(e,n,t){n.forEach((n=>{t?e.addEventListener(n,i,{capture:!0,passive:!1}):e.removeEventListener(n,i,{capture:!0})}))}},376:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.crashReportUUID=n.tcicSdkVersion=void 0;const o=t(425);n.tcicSdkVersion="1.5.0.234",n.crashReportUUID=Date.now().toString()+Math.round(1e4*Math.random()).toString(),o.init({appName:"tcic-electron-sdk",dsn:"https://87864dd8403142e795f3c38e19ffab17@report.url.cn/sentry/2466",enableJavaScript:!0}),o.configureScope((e=>{e.setTag("extra.sdk",n.tcicSdkVersion),e.setTag("extra.uuid",n.crashReportUUID)}))},425:e=>{e.exports=require("@sentry/electron")},881:e=>{e.exports=require("dns")},933:e=>{e.exports=require("electron")},557:e=>{e.exports=require("trtc-electron-sdk")},574:e=>{e.exports=require("trtc-electron-sdk/liteav/trtc_define")}},n={};!function t(o){var i=n[o];if(void 0!==i)return i.exports;var r=n[o]={exports:{}};return e[o].call(r.exports,r,r.exports,t),r.exports}(853)})();
1
+ (()=>{"use strict";var e={853:function(e,n,t){var o=this&&this.__createBinding||(Object.create?function(e,n,t,o){void 0===o&&(o=t),Object.defineProperty(e,o,{enumerable:!0,get:function(){return n[t]}})}:function(e,n,t,o){void 0===o&&(o=t),e[o]=n[t]}),i=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&o(n,e,t);return i(n,e),n},s=this&&this.__awaiter||function(e,n,t,o){return new(t||(t=Promise))((function(i,r){function s(e){try{d(o.next(e))}catch(e){r(e)}}function a(e){try{d(o.throw(e))}catch(e){r(e)}}function d(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}d((o=o.apply(e,n||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const d=r(t(933)),c=a(t(881)),u=a(t(557)),w=r(t(574)),C=r(t(280)),p=t(376);let l=0,S="";const h="TStateScreenShareBoardUndo",T="TStateScreenShareBoardRedo";window.TRTCCloud=u.default,window.TRTCDefine=w,window.Electron={getPlatform:()=>process.platform,hasScreenCapturePermission:()=>d.ipcRenderer.invoke("hasScreenCapturePermission"),openSystemPreferences:()=>d.ipcRenderer.invoke("openSystemPreferences"),getExcludeSelectWindows:()=>d.ipcRenderer.invoke("getExcludeSelectWindows"),getClientInfo:()=>({sdkVersion:p.tcicSdkVersion,crashReportUUID:p.crashReportUUID}),getSystemInfo:e=>d.ipcRenderer.invoke("getSystemInfo",e),sendCustomMessage(e){d.ipcRenderer.send("onRecvCustomMessage",e)},reloadWindow(e,n){d.ipcRenderer.send("onReloadWindow",e,n)},onPageFinished(e){d.ipcRenderer.send("onPageFinished",e)},closeWindow(){if(window.TCIC){const e=window.TCIC.SDK.instance.getState(window.TCIC.TMainState.Class_Status),n=v(e);n!==S&&d.ipcRenderer.send(n)}d.ipcRenderer.send("onCloseWindow",0)},minimizeWindow(){d.ipcRenderer.send("onMinimizeWindow",0)},maximizeWindow(){d.ipcRenderer.send("onMaximizeWindow",0)},openUrl(e){d.shell.openExternal(e)},selectScreenCaptureTarget(e){this._selectedSource=e},startScreenShare(e){return s(this,void 0,void 0,(function*(){return this._selectedSource&&(e.type=this._selectedSource.type,e.displayId=this._selectedSource.sourceId),d.ipcRenderer.invoke("startScreenShare",e)}))},stopScreenShare:()=>d.ipcRenderer.invoke("stopScreenShare"),callMethod(e){d.ipcRenderer.send("callMethod",e),"board"===e.module&&"setToolType"===e.method&&(l=e.params[0])},saveSnapshot(e,n,t,o){const i={snapId:e,base64Data:n,snapName:t,dialog:o};return d.ipcRenderer.invoke("saveImage",i)},checkDNSParsing:e=>new Promise((n=>{const t=Date.now();c.default.lookup(e,((e,o,i)=>{n({error:e,cost:Date.now()-t,address:o})}))})),loadVideo(e,n){const t=e.getBoundingClientRect(),o={x:t.left,y:t.top,width:t.width,height:t.height};return d.ipcRenderer.invoke("loadVideo",{bounds:o,url:n})},playVideo:()=>d.ipcRenderer.invoke("playVideo"),pauseVideo:()=>d.ipcRenderer.invoke("pauseVideo"),stopVideo:()=>d.ipcRenderer.invoke("stopVideo"),seekVideo:e=>d.ipcRenderer.invoke("seekVideo",e),setVideoVolume:e=>d.ipcRenderer.invoke("setVideoVolume",e),downloadMusic:e=>d.ipcRenderer.invoke("downloadMusic",e),startSubCamera:e=>d.ipcRenderer.invoke("startSubCamera",e),stopSubCamera:()=>d.ipcRenderer.invoke("stopSubCamera")};const v=e=>e===window.TCIC.TClassStatus.Already_Start?"onTCICClassStart":e===window.TCIC.TClassStatus.Has_Ended?"onTCICClassStop":e===window.TCIC.TClassStatus.Has_Expired?"onTCICClassExpired":"onTCICClassInit";new Promise(((e,n)=>{d.ipcRenderer.on("init",((n,t)=>{console.log("init",t),window.TCIC&&(window.TCIC.SDK.instance.registerState(h,"屏幕共享白板撤销状态",!1),window.TCIC.SDK.instance.registerState(T,"屏幕共享白板重做状态",!1),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Layout,(e=>{d.ipcRenderer.send("onClassLayoutChanged",e)})),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Status,(e=>{S=v(e),d.ipcRenderer.send(S)})),window.TCIC.SDK.instance.on(window.TCIC.TMainEvent.Start_Class,(()=>{})),window.TCIC.SDK.instance.on(window.TCIC.TMainEvent.Stop_Class,(()=>{}))),e(t)})),d.ipcRenderer.on("onScreenShareSnapshot",((e,n)=>{window.screenShareSnapshotCallback&&window.screenShareSnapshotCallback(n)})),d.ipcRenderer.on("leaveClass",(e=>{window.TCIC?window.TCIC.SDK.instance.leaveClass():window.Electron.closeWindow()})),d.ipcRenderer.on("sendCustomMessage",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Recv_Custom_Msg,n)})),d.ipcRenderer.on("onBoardCanRedoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(T,n)})),d.ipcRenderer.on("onBoardCanUndoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(h,n)})),d.ipcRenderer.on("onVideoTimeUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Update,n)})),d.ipcRenderer.on("onVideoTimeSeeked",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Seeked,n)})),d.ipcRenderer.on("onVersionUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Version_Update,n)}))})).then((e=>{setTimeout((()=>{!function(e){const n="touchstart",t=()=>{window.removeEventListener(n,t,!0),d.ipcRenderer.send("enableTouchScreenOptimize");const e=["touchstart","touchmove","touchend","mousedown","mousemove","mouseup"];d.ipcRenderer.on("enableWatchMouseMoveEvent",((n,t)=>{C.watchEvents(window,e,t)}))};window.addEventListener(n,t,!0)}()}),1e3)}))},280:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.watchEvents=void 0;const o=t(933),i=e=>{let n,t;if(e instanceof TouchEvent?(n=Math.round(e.changedTouches[0].screenX),t=Math.round(e.changedTouches[0].screenY)):(n=e.screenX,t=e.screenY),0!==n||0!==t){const i={type:e.type,x:n,y:t};o.ipcRenderer.send("onMouseEvent",i),console.log("onMouseEvent",i)}};n.watchEvents=function(e,n,t){n.forEach((n=>{t?e.addEventListener(n,i,{capture:!0,passive:!1}):e.removeEventListener(n,i,{capture:!0})}))}},376:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.crashReportUUID=n.tcicSdkVersion=void 0;const o=t(425);n.tcicSdkVersion="1.5.0.238",n.crashReportUUID=Date.now().toString()+Math.round(1e4*Math.random()).toString(),o.init({appName:"tcic-electron-sdk",dsn:"https://9497a4f3e4e64dddb4dd2b2f12b39a7a@sentry.qcloudtiw.com/2",enableJavaScript:!0}),o.configureScope((e=>{e.setTag("extra.sdk",n.tcicSdkVersion),e.setTag("extra.uuid",n.crashReportUUID)}))},425:e=>{e.exports=require("@sentry/electron")},881:e=>{e.exports=require("dns")},933:e=>{e.exports=require("electron")},557:e=>{e.exports=require("trtc-electron-sdk")},574:e=>{e.exports=require("trtc-electron-sdk/liteav/trtc_define")}},n={};!function t(o){var i=n[o];if(void 0!==i)return i.exports;var r=n[o]={exports:{}};return e[o].call(r.exports,r,r.exports,t),r.exports}(853)})();
package/dist/resource.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tcic-electron-sdk",
3
- "version": "1.5.234",
3
+ "version": "1.5.238",
4
4
  "description": "腾讯云课堂aPaaS",
5
5
  "main": "./dist/main.bundle.js",
6
6
  "author": "Tencent",
@@ -21,7 +21,7 @@
21
21
  "url": "https://git.woa.com/kennethmiao/apaas-sdk.git"
22
22
  },
23
23
  "dependencies": {
24
- "@sentry/electron": "1.5.2",
24
+ "@sentry/electron": "2.5.4",
25
25
  "@types/adm-zip": "^0.4.34",
26
26
  "adm-zip": "^0.5.5",
27
27
  "electron-store": "^8.0.0",
@@ -34,7 +34,7 @@
34
34
  "ref-struct-napi": "^1.1.1",
35
35
  "regedit": "3.0.3",
36
36
  "systeminformation": "^5.8.0",
37
- "trtc-electron-sdk": "9.3.105-beta.0",
37
+ "trtc-electron-sdk": "9.3.105-beta.2",
38
38
  "tiw-log": "1.0.28"
39
39
  },
40
40
  "devDependencies": {