tcic-electron-sdk 1.3.141 → 1.3.182
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/boardRenderer.bundle.js +1 -1
- package/dist/config.json +11 -11
- package/dist/main.bundle.js +1 -1
- package/dist/mainRenderer.bundle.js +1 -1
- package/dist/resource.zip +0 -0
- package/dist/video.html +24 -0
- package/dist/videoRenderer.bundle.js +1 -0
- package/package.json +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={761:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(933),a=d(o(280)),i=o(376);console.log("version",i.tcicSdkVersion);class l{static setVisibleRect(e){e?(0!==l.screenHeight&&0!==l.screenWidth||(l.screenHeight=screen.height,l.screenWidth=screen.width,l.boardElement.style.width=`${screen.width}px`,l.boardElement.style.height=`${screen.height}px`),l.boardWrapElement.style.width=`${e.width}px`,l.boardWrapElement.style.height=`${e.height}px`,l.boardWrapElement.style.left=`${e.x}px`,l.boardWrapElement.style.top=`${e.y}px`,l.boardWrapElement.style.position="absolute"):(l.boardWrapElement.removeAttribute("style"),l.boardElement.removeAttribute("style"))}static updateCursor(){if(!l.teduBoard)return;const e=l.teduBoard.getToolType(),t=l.teduBoard.getBrushColor();if(e===l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_PEN){const o=`data:image/svg+xml;charset=utf-8,${escape(`<?xml version="1.0" encoding="UTF-8"?><svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>mouse_pen</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-89.000000, -268.000000)">\n <g id="mouse_pen" transform="translate(89.000000, 268.000000)">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组-13" transform="translate(8.000000, 3.000000)" fill="${t}" stroke="#182E25">\n <path d="M0.756984031,32.1383216 L3.68816089e-13,26.5292023 L17.8941729,7.81597009e-14 L24.5264735,4.47354323 L6.63230058,31.0027455 L0.756984031,32.1383216 Z" id="形状结合"></path>\n </g>\n </g>\n </g>\n </g>\n </svg>`)}`;l.teduBoard.setCursorIcon(e,{cursor:"url",url:o,offsetX:10,offsetY:40})}else if(e===l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_LINE){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_line</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-785.000000, -272.000000)">\n <g id="mouse_line" transform="translate(785.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <line x1="28.5" y1="7.5" x2="36.5" y2="7.5" id="直线-6" stroke="${t}" stroke-width="2" stroke-linecap="square"></line>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;l.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20})}else if(e===l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_RECT){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_rectangle</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-551.000000, -272.000000)">\n <g id="mouse_rectangle" transform="translate(551.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <rect id="矩形" stroke="${t}" stroke-width="2" x="28" y="3" width="8" height="8"></rect>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;l.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20}),l.teduBoard.setCursorIcon(l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_SQUARE,{cursor:"url",url:r,offsetX:20,offsetY:20})}else if(e===l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_OVAL){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_circle</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-323.000000, -272.000000)">\n <g id="mouse_circle" transform="translate(323.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <circle id="椭圆形" stroke="${t}" stroke-width="2" cx="32" cy="7" r="4"></circle>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;l.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20}),l.teduBoard.setCursorIcon(l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_CIRCLE,{cursor:"url",url:r,offsetX:20,offsetY:20})}l.teduBoard.setToolType(e)}static callBoardMethod(e){console.log("callBoardMethod",l.teduBoard,JSON.stringify(e)),l.teduBoard&&(l.teduBoard[e.method].apply(l.teduBoard,e.params),l.updateCursor())}}l.TEduBoard=window.TEduBoard,l.teduBoard=null,l.boardElement=null,l.boardWrapElement=null,l.screenWidth=0,l.screenHeight=0,l.callMethodCache=[],l.isBoardReady=!1,window.BoardRender=l,s.ipcRenderer.on("initBoard",((e,t)=>{const o=window.BoardRender;if(o.teduBoard)return;const r={id:"board",sdkAppId:t.sdkAppId,classId:t.roomId,userId:t.userId,userSig:t.userSig,ratio:`${screen.width}:${screen.height}`,systemCursorEnable:!1,enableLocalMode:!0,styleConfig:{globalBackgroundColor:"rgba(0, 0, 0, 0.01)",textColor:"#ff0000",selectBoxColor:"#727272",cursorSize:[40,40],brushThin:50,selectAnchorColor:"#006eff"}};o.teduBoard=new o.TEduBoard(r),o.teduBoard.on(o.TEduBoard.EVENT.TEB_ERROR,((e,t)=>{})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_WARNING,((e,t)=>{})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_HISTROYDATA_SYNCCOMPLETED,(()=>{o.teduBoard.setToolType(o.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_MOUSE),o.teduBoard.setHandwritingEnable(!0),o.teduBoard.setCursorIcon(o.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_ERASER,{cursor:"url",url:"https://res.qcloudtiw.com/board/icons/xkt/eraser.svg",offsetX:7,offsetY:25}),o.updateCursor(),0===o.callMethodCache.length?o.teduBoard.setToolType(0):(o.callMethodCache.forEach((e=>{o.callBoardMethod(e)})),o.callMethodCache=[]),o.isBoardReady=!0})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_SNAPSHOT,(e=>{s.ipcRenderer.send("onScreenShareSnapshot",e)})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_OPERATE_CANREDO_STATUS_CHANGED,(e=>{s.ipcRenderer.send("onBoardCanRedoChange",e)})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_OPERATE_CANUNDO_STATUS_CHANGED,(e=>{s.ipcRenderer.send("onBoardCanUndoChange",e)})),o.setVisibleRect(t.shareWindowBounds)})),s.ipcRenderer.on("onShareWindowBoundsChanged",((e,t)=>{window.BoardRender.setVisibleRect(t)})),s.ipcRenderer.on("callMethod",((e,t)=>{const o=window.BoardRender;o.isBoardReady?o.callBoardMethod(t):o.callMethodCache.push(t)}));const c=["touchstart","touchend"];s.ipcRenderer.on("enableWatchMouseMoveEvent",((e,t)=>{a.watchEvents(document,c,t)})),window.onload=()=>{l.boardWrapElement=document.getElementById("board-wrap"),l.boardElement=document.getElementById("board")}},280:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.watchEvents=void 0;const r=o(933),n=e=>{let t,o;if(e instanceof TouchEvent?(t=Math.round(e.changedTouches[0].screenX),o=Math.round(e.changedTouches[0].screenY)):(t=e.screenX,o=e.screenY),0!==t||0!==o){const n={type:e.type,x:t,y:o};r.ipcRenderer.send("onMouseEvent",n),console.log("onMouseEvent",n)}};t.watchEvents=function(e,t,o){t.forEach((t=>{o?e.addEventListener(t,n,{capture:!0,passive:!1}):e.removeEventListener(t,n,{capture:!0})}))}},376:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.crashReportUUID=t.tcicSdkVersion=void 0;const r=o(425);t.tcicSdkVersion="1.3.3.141",t.crashReportUUID=Date.now().toString()+Math.round(1e4*Math.random()).toString(),r.init({appName:"tcic-electron-sdk",dsn:"https://87864dd8403142e795f3c38e19ffab17@report.url.cn/sentry/2466",enableJavaScript:"browser"===process.type}),r.configureScope((e=>{e.setTag("extra.sdk",t.tcicSdkVersion),e.setTag("extra.uuid",t.crashReportUUID)}))},425:e=>{e.exports=require("@sentry/electron")},933:e=>{e.exports=require("electron")}},t={};!function o(r){var n=t[r];if(void 0!==n)return n.exports;var d=t[r]={exports:{}};return e[r].call(d.exports,d,d.exports,o),d.exports}(761)})();
|
|
1
|
+
(()=>{"use strict";var e={761:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(933),a=d(o(280)),i=o(376);console.log("version",i.tcicSdkVersion);class l{static setVisibleRect(e){e?(0!==l.screenHeight&&0!==l.screenWidth||(l.screenHeight=screen.height,l.screenWidth=screen.width,l.boardElement.style.width=`${screen.width}px`,l.boardElement.style.height=`${screen.height}px`),l.boardWrapElement.style.width=`${e.width}px`,l.boardWrapElement.style.height=`${e.height}px`,l.boardWrapElement.style.left=`${e.x}px`,l.boardWrapElement.style.top=`${e.y}px`,l.boardWrapElement.style.position="absolute"):(l.boardWrapElement.removeAttribute("style"),l.boardElement.removeAttribute("style"))}static updateCursor(){if(!l.teduBoard)return;const e=l.teduBoard.getToolType(),t=l.teduBoard.getBrushColor();if(e===l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_PEN){const o=`data:image/svg+xml;charset=utf-8,${escape(`<?xml version="1.0" encoding="UTF-8"?><svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>mouse_pen</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-89.000000, -268.000000)">\n <g id="mouse_pen" transform="translate(89.000000, 268.000000)">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组-13" transform="translate(8.000000, 3.000000)" fill="${t}" stroke="#182E25">\n <path d="M0.756984031,32.1383216 L3.68816089e-13,26.5292023 L17.8941729,7.81597009e-14 L24.5264735,4.47354323 L6.63230058,31.0027455 L0.756984031,32.1383216 Z" id="形状结合"></path>\n </g>\n </g>\n </g>\n </g>\n </svg>`)}`;l.teduBoard.setCursorIcon(e,{cursor:"url",url:o,offsetX:10,offsetY:40})}else if(e===l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_LINE){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_line</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-785.000000, -272.000000)">\n <g id="mouse_line" transform="translate(785.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <line x1="28.5" y1="7.5" x2="36.5" y2="7.5" id="直线-6" stroke="${t}" stroke-width="2" stroke-linecap="square"></line>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;l.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20})}else if(e===l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_RECT){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_rectangle</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-551.000000, -272.000000)">\n <g id="mouse_rectangle" transform="translate(551.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <rect id="矩形" stroke="${t}" stroke-width="2" x="28" y="3" width="8" height="8"></rect>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;l.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20}),l.teduBoard.setCursorIcon(l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_SQUARE,{cursor:"url",url:r,offsetX:20,offsetY:20})}else if(e===l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_OVAL){const o=`<?xml version="1.0" encoding="UTF-8"?>\n <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>mouse_circle</title>\n <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="光标及状态栏状态" transform="translate(-323.000000, -272.000000)">\n <g id="mouse_circle" transform="translate(323.000000, 272.000000)">\n <g id="编组-3">\n <rect id="矩形" x="0" y="0" width="40" height="40"></rect>\n <g id="编组" transform="translate(2.628157, 2.500000)" fill="#000000" stroke="#FFFFFF">\n <path d="M19.6574089,0 L19.657,15.5 L34.6259534,15.5 L34.6259534,19.5 L19.657,19.5 L19.6574089,35 L15.6574089,35 L15.657,19.5 L-1.13686838e-13,19.5 L-1.13686838e-13,15.5 L15.657,15.5 L15.6574089,0 L19.6574089,0 Z" id="形状结合"></path>\n </g>\n </g>\n <circle id="椭圆形" stroke="${t}" stroke-width="2" cx="32" cy="7" r="4"></circle>\n </g>\n </g>\n </g>\n </svg>`,r=`data:image/svg+xml;base64,${window.btoa(unescape(encodeURIComponent(o)))}`;l.teduBoard.setCursorIcon(e,{cursor:"url",url:r,offsetX:20,offsetY:20}),l.teduBoard.setCursorIcon(l.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_CIRCLE,{cursor:"url",url:r,offsetX:20,offsetY:20})}l.teduBoard.setToolType(e)}static callBoardMethod(e){console.log("callBoardMethod",l.teduBoard,JSON.stringify(e)),l.teduBoard&&(l.teduBoard[e.method].apply(l.teduBoard,e.params),l.updateCursor())}}l.TEduBoard=window.TEduBoard,l.teduBoard=null,l.boardElement=null,l.boardWrapElement=null,l.screenWidth=0,l.screenHeight=0,l.callMethodCache=[],l.isBoardReady=!1,window.BoardRender=l,s.ipcRenderer.on("initBoard",((e,t)=>{const o=window.BoardRender;if(o.teduBoard)return;const r={id:"board",sdkAppId:t.sdkAppId,classId:t.roomId,userId:t.userId,userSig:t.userSig,ratio:`${screen.width}:${screen.height}`,systemCursorEnable:!1,enableLocalMode:!0,styleConfig:{globalBackgroundColor:"rgba(0, 0, 0, 0.01)",textColor:"#ff0000",selectBoxColor:"#727272",cursorSize:[40,40],brushThin:50,selectAnchorColor:"#006eff"}};o.teduBoard=new o.TEduBoard(r),o.teduBoard.on(o.TEduBoard.EVENT.TEB_ERROR,((e,t)=>{})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_WARNING,((e,t)=>{})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_HISTROYDATA_SYNCCOMPLETED,(()=>{o.teduBoard.setToolType(o.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_MOUSE),o.teduBoard.setHandwritingEnable(!0),o.teduBoard.setCursorIcon(o.TEduBoard.TEduBoardToolType.TEDU_BOARD_TOOL_TYPE_ERASER,{cursor:"url",url:"https://res.qcloudtiw.com/board/icons/xkt/eraser.svg",offsetX:7,offsetY:25}),o.updateCursor(),0===o.callMethodCache.length?o.teduBoard.setToolType(0):(o.callMethodCache.forEach((e=>{o.callBoardMethod(e)})),o.callMethodCache=[]),o.isBoardReady=!0})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_SNAPSHOT,(e=>{s.ipcRenderer.send("onScreenShareSnapshot",e)})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_OPERATE_CANREDO_STATUS_CHANGED,(e=>{s.ipcRenderer.send("onBoardCanRedoChange",e)})),o.teduBoard.on(o.TEduBoard.EVENT.TEB_OPERATE_CANUNDO_STATUS_CHANGED,(e=>{s.ipcRenderer.send("onBoardCanUndoChange",e)})),o.setVisibleRect(t.shareWindowBounds)})),s.ipcRenderer.on("onShareWindowBoundsChanged",((e,t)=>{window.BoardRender.setVisibleRect(t)})),s.ipcRenderer.on("callMethod",((e,t)=>{const o=window.BoardRender;o.isBoardReady?o.callBoardMethod(t):o.callMethodCache.push(t)}));const c=["touchstart","touchend"];s.ipcRenderer.on("enableWatchMouseMoveEvent",((e,t)=>{a.watchEvents(document,c,t)})),window.onload=()=>{l.boardWrapElement=document.getElementById("board-wrap"),l.boardElement=document.getElementById("board")}},280:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.watchEvents=void 0;const r=o(933),n=e=>{let t,o;if(e instanceof TouchEvent?(t=Math.round(e.changedTouches[0].screenX),o=Math.round(e.changedTouches[0].screenY)):(t=e.screenX,o=e.screenY),0!==t||0!==o){const n={type:e.type,x:t,y:o};r.ipcRenderer.send("onMouseEvent",n),console.log("onMouseEvent",n)}};t.watchEvents=function(e,t,o){t.forEach((t=>{o?e.addEventListener(t,n,{capture:!0,passive:!1}):e.removeEventListener(t,n,{capture:!0})}))}},376:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.crashReportUUID=t.tcicSdkVersion=void 0;const r=o(425);t.tcicSdkVersion="1.3.5.182",t.crashReportUUID=Date.now().toString()+Math.round(1e4*Math.random()).toString(),r.init({appName:"tcic-electron-sdk",dsn:"https://87864dd8403142e795f3c38e19ffab17@report.url.cn/sentry/2466",enableJavaScript:"browser"===process.type}),r.configureScope((e=>{e.setTag("extra.sdk",t.tcicSdkVersion),e.setTag("extra.uuid",t.crashReportUUID)}))},425:e=>{e.exports=require("@sentry/electron")},933:e=>{e.exports=require("electron")}},t={};!function o(r){var n=t[r];if(void 0!==n)return n.exports;var d=t[r]={exports:{}};return e[r].call(d.exports,d,d.exports,o),d.exports}(761)})();
|
package/dist/config.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"resources": [
|
|
3
3
|
{
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "75848278fb6f73cf21e90885885da157f10f6e2b",
|
|
5
5
|
"sdkAppId": "0",
|
|
6
6
|
"schoolId": "0",
|
|
7
|
-
"url": "https://class.qcloudclass.com/1.3.
|
|
7
|
+
"url": "https://class.qcloudclass.com/1.3.5/cache/offline_75848278fb6f73cf21e90885885da157f10f6e2b.zip",
|
|
8
8
|
"files": {
|
|
9
9
|
},
|
|
10
10
|
"regexes": {
|
|
11
|
-
"https:\\/\\/dev\\-class\\.qcloudclass\\.com\\/1.3.
|
|
12
|
-
"https:\\/\\/dev\\-class\\.qcloudclass\\.com\\/1.3.
|
|
13
|
-
"https:\\/\\/test\\-class\\.qcloudclass\\.com\\/1.3.
|
|
14
|
-
"https:\\/\\/test\\-class\\.qcloudclass\\.com\\/1.3.
|
|
15
|
-
"https:\\/\\/pre\\-class\\.qcloudclass\\.com\\/1.3.
|
|
16
|
-
"https:\\/\\/pre\\-class\\.qcloudclass\\.com\\/1.3.
|
|
17
|
-
"https:\\/\\/class\\.qcloudclass\\.com\\/1.3.
|
|
18
|
-
"https:\\/\\/class\\.qcloudclass\\.com\\/1.3.
|
|
11
|
+
"https:\\/\\/dev\\-class\\.qcloudclass\\.com\\/1.3.5\\/cache/(.+)": "/unmatch/$1",
|
|
12
|
+
"https:\\/\\/dev\\-class\\.qcloudclass\\.com\\/1.3.5\\/(.+)": "$1",
|
|
13
|
+
"https:\\/\\/test\\-class\\.qcloudclass\\.com\\/1.3.5\\/cache/(.+)": "/unmatch/$1",
|
|
14
|
+
"https:\\/\\/test\\-class\\.qcloudclass\\.com\\/1.3.5\\/(.+)": "$1",
|
|
15
|
+
"https:\\/\\/pre\\-class\\.qcloudclass\\.com\\/1.3.5\\/cache/(.+)": "/unmatch/$1",
|
|
16
|
+
"https:\\/\\/pre\\-class\\.qcloudclass\\.com\\/1.3.5\\/(.+)": "$1",
|
|
17
|
+
"https:\\/\\/class\\.qcloudclass\\.com\\/1.3.5\\/cache/(.+)": "/unmatch/$1",
|
|
18
|
+
"https:\\/\\/class\\.qcloudclass\\.com\\/1.3.5\\/(.+)": "$1",
|
|
19
19
|
"https:\\/\\/res\\.qcloudclass\\.com\\/assets\\/(.+)": "/static/assets/$1",
|
|
20
20
|
"https:\\/\\/res\\.qcloudtiw\\.com\\/board\\/(.+)": "/static/libs/board/$1",
|
|
21
21
|
"https:\\/\\/log\\.qcloudtiw\\.com\\/(.+)": "/static/log/$1"
|
|
@@ -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":
|
|
28
|
+
"devBuildTime": 1634005342,
|
|
29
29
|
"domains": {
|
|
30
30
|
"www.xxx.com": [
|
|
31
31
|
"www.aaa.com"
|
package/dist/main.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TCIC=t():e.TCIC=t()}(global,(function(){return(()=>{"use strict";var e={555:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=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 t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TencentCloudClass=void 0;const c=a(i(933)),d=a(i(765)),l=a(i(747)),h=a(i(622)),u=s(i(293)),w=s(i(975)),f=i(376),p=i(741),S=s(i(42));let g;if(p.TIWCacheManager.RegisterAsPrivileged(),g="win32"===process.platform?h.default.join(process.env.USERPROFILE,"TencentCloudClass"):h.default.join(process.env.HOME,"TencentCloudClass"),l.default.existsSync(g)||l.default.mkdirSync(g,{recursive:!0}),c.default.app.setPath("crashDumps",h.default.join(g,"crash")),"win32"===process.platform){const e=S.getPrimaryDisplaySize();e.width*e.height<=2073600&&(S.getMaxTouches()>1||S.isWin7())&&c.default.app.commandLine.appendSwitch("disable-gpu-compositing"),S.isWin7()&&c.default.app.commandLine.appendSwitch("disable-site-isolation-trials")}const y=new d.default;t.TencentCloudClass=class{constructor(){this.classUrl="",this.windowTitle="",this.tcicMainView=null,this.tcicBoardView=null,this.isBoardViewLoaded=!1,this.tcicDefaultEntryMainWindow=null,this.tcicScreenShareMainWindow=null,this.tcicScreenShareBoardWindow=null,this.watchMouseEventEnabled=!1,this.watchMouseMoveTimer=null,this.touchScreenOptimizeEnabled=!1,this.touchScreenOptimizePerformed=!1,this.screenShareMainWindowMouseEventIgnored=!1,this.mainViewDevTools=null,this.boardViewDevTools=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){if(console.log("TCIC initialize",e),this.checkHasInitialize())return this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow.show(),!1;if("function"==typeof e.onClose&&(this.onAllWindowClosedCallback=e.onClose),e.sign){const t=new Buffer(e.sign.split(".")[1],"base64"),i=JSON.parse(t.toString("utf-8"));e.schoolId=i.school_id,e.classId=i.class_id,e.userId=i.user_id,e.cid=i.cid,e.uid=i.uid,e.scene=i.scene,e.token=e.sign}let t=`schoolid=${e.schoolId}&userid=${e.userId}&classid=${e.classId}&token=${e.token}&webloadstamp=${(new Date).getTime()}`;e.scene&&(t+=`&scene=${e.scene}`),e.debugCss&&(t+=`&debugCss=${e.debugCss}`),e.debugJs&&(t+=`&debugJs=${e.debugJs}`),e.customParams&&(t+=`&${e.customParams}`);let i=e.url;if(!i){let n="",o="";e.version&&(o=`/${e.version}`),e.env&&"prod"!==e.env&&(n=`${e.env}-`),i=`https://${n}class.qcloudclass.com${o}/class.html?${e.env?`env=${e.env}&`:""}${t}`,process.defaultApp&&(process.argv.includes("--local")?i=`http://localhost:8080/class.html?${e.env?`env=${e.env}&`:""}${t}`:process.argv.includes("--vm")&&(i=`http://10.211.55.2:8080/class.html?${e.env?`env=${e.env}&`:""}${t}`))}return this.classUrl=i,console.log("TCIC url",i),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:S.getMaxTouches(),primary_screen:S.getPrimaryDisplaySize()||c.default.screen.getPrimaryDisplay().size};"win32"===process.platform&&(e.aero_glass_enabled=c.default.systemPreferences.isAeroGlassEnabled());const t={type:"info",title:"系统信息",message:JSON.stringify(e,null,2),buttons:["关闭","打开GPU排障页面",y.get("autoOpenDevTools")?"启动时不打开调试工具":"启动时打开调试工具",y.get("screenShareNotOnTop")?"屏幕分享时窗口置顶":"屏幕分享时窗口不置顶","清除本地记录信息"]};c.default.dialog.showMessageBox(t).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:y.set("autoOpenDevTools",!y.get("autoOpenDevTools"));break;case 3:y.set("screenShareNotOnTop",!y.get("screenShareNotOnTop"));break;case 4:y.clear()}}))})),y.get("autoOpenDevTools")&&this.openDevTools(),!0}closeAllWindow(e){if(this.closeAllWindowInvoking)return void console.log("TCIC closeAllWindow ignore");console.log("TCIC closeAllWindow start"),this.closeAllWindowInvoking=!0;let t=Promise.resolve();this.tcicMainView&&(this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),t=new Promise((e=>{this.tcicMainView.webContents.once("destroyed",(()=>{this.tcicMainView=null,this.mainViewDevTools&&this.mainViewDevTools.close(),e()})),this.tcicMainView.webContents.destroy()})));let i=Promise.resolve(),n=Promise.resolve();this.tcicBoardView&&(n=new Promise((e=>{this.tcicBoardView.webContents.once("destroyed",(()=>{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",(()=>{e()})),this.tcicScreenShareBoardWindow.close()})));let s=Promise.resolve();if(this.tcicScreenShareMainWindow&&(s=new Promise((e=>{this.tcicScreenShareMainWindow.once("closed",(()=>{e()})),this.tcicScreenShareMainWindow.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&&(i=new Promise((e=>{this.tcicDefaultEntryMainWindow.once("closed",(()=>{this.tcicDefaultEntryMainWindow=null,e()})),this.tcicDefaultEntryMainWindow.close()})));try{this.onAllWindowClosedCallback&&this.onAllWindowClosedCallback()}catch(e){console.error("业务侧传入的onClose回调内发生了异常:",e)}}return Promise.all([t,i,n,o,s]).then((()=>{this.closeAllWindowInvoking=!1,console.log("TCIC closeAllWindow done")}))}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)}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,t=""){this.seriousErrorTimes+=1,console.error("TCIC seriousErrorHandler",this.seriousErrorTimes,e);let i=!this.closeAllWindowInvoking&&this.seriousErrorTimes<=3,n=`客户端遇到多次异常即将关闭,可从教室列表再次进入,如果问题持续出现,请联系客服人员\n\n异常原因:${e} - ${t}\n\n异常上报UUID:${f.crashReportUUID}`;switch(e){case"clean-exit":case"abnormal-exit":case"killed":i=!1;break;case"oom":n=`客户端由于内存不足无法正常工作,请退出其它应用后从教室列表再次进入\n\n异常上报UUID:${f.crashReportUUID}`,i=!1}this.closeAllWindow(i).then((()=>{if(i)this.createAndInitWindow();else{const e={type:"info",title:"客户端异常",message:n,buttons:["退出教室"]};c.default.dialog.showMessageBox(e).then((e=>{}))}}))}detectScreenShareMainWindowMouseEventIgnored(e,t){if(!this.watchMouseEventEnabled||!this.tcicScreenShareMainWindow||!this.tcicMainView)return;const i=this.tcicScreenShareMainWindow.getPosition(),n=e-i[0],o=t-i[1];this.tcicMainView.webContents.capturePage({x:n,y:o,width:1,height:1}).then((e=>{const t=0===e.getBitmap()[3];t!==this.screenShareMainWindowMouseEventIgnored&&(this.screenShareMainWindowMouseEventIgnored=t,this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(t,{forward:this.touchScreenOptimizeEnabled}),console.log("setIgnoreMouseEvents",t,this.touchScreenOptimizeEnabled),t&&"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,t=0;this.watchMouseMoveTimer=setInterval((()=>{const i=c.default.screen.getCursorScreenPoint();i.x===e&&i.y===t||(e=i.x,t=i.y,this.detectScreenShareMainWindowMouseEventIgnored(e,t))}),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&&(S.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:h.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,t,i)=>{i&&(this.windowTitle=t,this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.setTitle(t),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setTitle(t))}));const e=this.tcicMainView.webContents.loadURL(`${this.classUrl}&seriousError=${this.seriousErrorTimes}`),t=new Promise(((e,t)=>{this.tcicMainView.webContents.on("did-finish-load",(()=>{e()})),this.tcicMainView.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{t(e)}))}));Promise.all([e,t]).then((()=>{this.tcicMainView.webContents.send("init")})).catch((e=>{console.error("TCIC load main view",e);const t={type:"error",title:"",message:`网络异常,课堂加载失败: ${JSON.stringify(e)}\n\n运维ID:${f.crashReportUUID}`,buttons:["退出教室"]};c.default.dialog.showMessageBox(t).then((e=>{this.closeAllWindow()}))})),this.tcicMainView.webContents.on("render-process-gone",((e,t)=>{this.seriousErrorHandler(t.reason)})),this.tcicMainView.webContents.on("unresponsive",(()=>{this.seriousErrorHandler("unresponsive")}))}getMainWindowMinSize(e){e||(e="top");const t=c.default.screen.getPrimaryDisplay().workAreaSize,i="top"===e?55:80;let n=718,o=2*i+n+45;return o>t.height&&(n=Math.ceil(538.5),o=2*i+n+45,o>t.height&&(n=Math.ceil(359),o=2*i+n+45)),{width:Math.ceil(n/9*16),height:o}}createAndInitDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow)return;const e=this.getMainWindowMinSize();let t=e;y.has("MainWindowBounds")&&(t=y.get("MainWindowBounds"),console.log("TCIC restore size",t)),this.tcicDefaultEntryMainWindow=new c.default.BrowserWindow({width:t.width<e.width?e.width:t.width,height:t.height<e.height?e.height:t.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 i=null;this.tcicDefaultEntryMainWindow.on("resize",(()=>{i&&clearTimeout(i),i=setTimeout((()=>{if(i=null,!this.tcicDefaultEntryMainWindow.isMinimized()&&!this.isMainWindowMaximized){const e=this.tcicDefaultEntryMainWindow.getBounds();y.set("MainWindowBounds",e),console.log("TCIC resize",e)}}),100)})),this.tcicDefaultEntryMainWindow.on("close",(e=>{this.closeAllWindowInvoking||(e.preventDefault(),this.isScreenSharing||this.tcicMainView.webContents.send("leaveClass"))}))}createAndInitBoardView(e,t){if(!this.tcicBoardView){if(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}),t){console.log("createAndInitBoardView",h.default.join(__dirname,"board.html"));const i=this.tcicBoardView.webContents.loadFile(h.default.join(__dirname,"board.html")),n=new Promise(((e,t)=>{this.tcicBoardView.webContents.on("did-finish-load",(()=>{e()})),this.tcicBoardView.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{t(e)}))}));Promise.all([i,n]).then((()=>{t.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",t),this.callBoardMethodCache.forEach((e=>{this.callBoardMethod(e)})),this.callBoardMethodCache=[]})).catch((e=>{}))}this.tcicBoardView.webContents.on("render-process-gone",((e,t)=>{this.seriousErrorHandler(t.reason)})),this.tcicBoardView.webContents.on("unresponsive",(()=>{this.seriousErrorHandler("unresponsive")}))}}createAndInitScreenShareBoardWindow(e,t){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)}))}createAndInitScreenShareMainWindow(e){this.tcicScreenShareMainWindow||(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())}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,t=e.width/2,i=600;this.tcicMainView&&(this.mainViewDevTools||(this.mainViewDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2+t,y:(e.height-i)/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:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/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())}callBoardMethod(e){if(this.isBoardViewLoaded){if("board"===e.module){if("setToolType"===e.method){const t=e.params[0];0===t?(this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),"darwin"===process.platform&&this.tcicScreenShareBoardWindow.blur()):this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!1),this.lastSelectedScreenBoardToolType=t}this.tcicBoardView.webContents.send("callMethod",e)}}else this.callBoardMethodCache.push(e)}addLifecycleIPCListener(e,t){c.default.ipcMain.on(e,t),this.ipcListeners.push({channel:e,listener:t})}addLifecycleIPCHandler(e,t){c.default.ipcMain.handle(e,t),this.ipcHandlers.push({channel:e,handler:t})}registerIPCEvent(){this.addLifecycleIPCHandler("getSystemInfo",((e,t)=>r(this,void 0,void 0,(function*(){return yield u.get(t)})))),this.addLifecycleIPCListener("callMethod",((e,t)=>{this.callBoardMethod(t)})),this.addLifecycleIPCListener("enableTouchScreenOptimize",(e=>{this.touchScreenOptimizeEnabled=!0,this.enableScreenShareMainWindowTouchScreenOptimize()})),this.addLifecycleIPCListener("onMouseEvent",((e,t)=>{this.detectScreenShareMainWindowMouseEventIgnored(t.x,t.y)})),this.addLifecycleIPCListener("onReloadWindow",((e,t,i)=>{this.seriousErrorHandler(t,i)})),this.addLifecycleIPCListener("onPageFinished",((e,t)=>{this.seriousErrorTimes=0})),this.addLifecycleIPCListener("onCloseWindow",(()=>{this.closeAllWindow().then()})),this.addLifecycleIPCListener("onMinimizeWindow",(()=>{this.tcicDefaultEntryMainWindow.isMinimized()?(this.tcicDefaultEntryMainWindow.restore(),console.log("TCIC unminimized")):(this.tcicDefaultEntryMainWindow.minimize(),console.log("TCIC minimized"))})),this.addLifecycleIPCListener("onMaximizeWindow",(()=>{this.isMainWindowMaximized?(console.log("TCIC unmaximized"),this.isMainWindowMaximized=!1,this.tcicDefaultEntryMainWindow.setResizable(!0),this.tcicDefaultEntryMainWindow.unmaximize(),S.setThickFrame(this.tcicDefaultEntryMainWindow,!0).then((()=>{this.tcicDefaultEntryMainWindow.setBounds(this.mainWindowBoundsBeforeMaximize)}))):(this.mainWindowBoundsBeforeMaximize=this.tcicDefaultEntryMainWindow.getBounds(),S.setThickFrame(this.tcicDefaultEntryMainWindow,!1).then((()=>{console.log("TCIC maximized"),this.isMainWindowMaximized=!0,this.tcicDefaultEntryMainWindow.maximize(),this.tcicDefaultEntryMainWindow.setResizable(!1)})))})),this.addLifecycleIPCListener("onClassLayoutChanged",((e,t)=>{if(!this.isMainWindowMaximized){const e=this.getMainWindowMinSize(t);this.tcicDefaultEntryMainWindow.setMinimumSize(e.width,e.height);const i=this.tcicDefaultEntryMainWindow.getBounds();if(i.width<e.width||i.height<e.height){this.tcicDefaultEntryMainWindow.setBounds({width:i.width<e.width?e.width:i.width,height:i.height<e.height?e.height:i.height},!0);const t=this.tcicDefaultEntryMainWindow.getBounds();y.set("MainWindowBounds",t),console.log("TCIC resize after layout",t)}}})),this.addLifecycleIPCListener("onScreenShareSnapshot",((e,t)=>{this.tcicMainView.webContents.send("onScreenShareSnapshot",t)})),this.addLifecycleIPCListener("onBoardCanRedoChange",((e,t)=>{this.tcicMainView.webContents.send("onBoardCanRedoChange",t)})),this.addLifecycleIPCListener("onBoardCanUndoChange",((e,t)=>{this.tcicMainView.webContents.send("onBoardCanUndoChange",t)})),this.addLifecycleIPCHandler("startScreenShare",((e,t)=>r(this,void 0,void 0,(function*(){this.shareParams=t,this.isScreenSharing=!0,this.tcicDefaultEntryMainWindow.hide();const e=this.getDisplay(t);return this.needToShowTaskbarFix="win32"===process.platform&&e.size.width===e.workAreaSize.width&&e.size.height===e.workAreaSize.height,this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled=yield S.isTaskbarAutoHiddenInDesktopEnabled(),this.isTaskbarAutoHiddenInDesktopEnabled&&S.setTaskbarAutoHiddenInDesktopEnabled(!1).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled=yield S.isTaskbarAutoHiddenInTabletEnabled(),this.isTaskbarAutoHiddenInTabletEnabled&&S.setTaskbarAutoHiddenInTabletEnabled(!1).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays=yield S.isShowTaskbarOnMultipleDisplays(),this.isShowTaskbarOnMultipleDisplays||S.setShowTaskbarOnMultipleDisplays(!0).then((()=>{})))),new Promise((e=>{const i=()=>{this.shareMainWindowDisplay=this.getDisplay(t),this.shareBoardWindowDisplay=this.shareMainWindowDisplay,this.createAndInitBoardView(this.shareBoardWindowDisplay,t),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,t),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(t);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 i=this.getDisplay(t);this.shareBoardWindowDisplay.id!==i.id&&(this.shareBoardWindowDisplay=i,this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(i,t),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1)),console.log("getShareWindowBounds",JSON.stringify(e)),console.log("shareBoardWindowDisplay",JSON.stringify(i)),this.tcicBoardView.webContents.send("onShareWindowBoundsChanged",{x:e.x-i.bounds.x,y:e.y-i.bounds.y,width:e.width,height:e.height})}}),100);const i=this.tcicScreenShareMainWindow.getMediaSourceId().split(":")[1],n=this.tcicScreenShareBoardWindow.getMediaSourceId().split(":")[1];0===t.type?e({excludeShareWindowSourceIds:[i],includeShareWindowSourceIds:[n]}):e({excludeShareWindowSourceIds:[i],includeShareWindowSourceIds:[]})};if("win32"===process.platform){let e=0;const n=setInterval((()=>{const o=this.getDisplay(t);e+=1,(o.size.width!==o.workAreaSize.width||o.size.height!==o.workAreaSize.height||e>50)&&(clearInterval(n),i())}),100)}else i()}))})))),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 yield c.default.shell.openExternal(`x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture`)})))),this.addLifecycleIPCHandler("getExcludeSelectWindows",(e=>r(this,void 0,void 0,(function*(){const e=[];if(this.tcicDefaultEntryMainWindow){const t=this.tcicDefaultEntryMainWindow.getMediaSourceId().split(":")[1];e.push(t)}return Promise.resolve(e)})))),this.addLifecycleIPCHandler("stopScreenShare",((e,t)=>(this.isScreenSharing=!1,this.attachMainViewToDefaultEntryMainWindow(),this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.close(),this.tcicBoardView&&this.tcicBoardView.webContents.destroy(),this.tcicBoardView=null,this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.close(),this.tcicDefaultEntryMainWindow.show(),this.checkShareWindowBoundsTimer&&(clearInterval(this.checkShareWindowBoundsTimer),this.checkShareWindowBoundsTimer=null),this.needToShowTaskbarFix&&(this.isTaskbarAutoHiddenInDesktopEnabled&&S.setTaskbarAutoHiddenInDesktopEnabled(!0).then((()=>{})),this.isTaskbarAutoHiddenInTabletEnabled&&S.setTaskbarAutoHiddenInTabletEnabled(!0).then((()=>{})),c.default.screen.getAllDisplays().length>1&&(this.isShowTaskbarOnMultipleDisplays||S.setShowTaskbarOnMultipleDisplays(!1).then((()=>{})))),Promise.resolve()))),this.addLifecycleIPCHandler("getDesktopPath",(e=>r(this,void 0,void 0,(function*(){return S.getDesktopPath()}))))}getCurrentDisplay(){return c.default.screen.getDisplayMatching(this.tcicDefaultEntryMainWindow.getBounds())}updateZOrderAccordingShareWindow(e,t){this.tcicScreenShareMainWindow&&this.tcicScreenShareBoardWindow&&(e.id===t.id?(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 t=S.getWindowBounds(parseInt(e.displayId,10));return c.default.screen.screenToDipRect(null,t)}if("darwin"===process.platform)return w.getWindowBounds(parseInt(e.displayId,10))}return this.getDisplay(e).bounds}getDisplay(e){if(e.displayId){const t=c.default.screen.getAllDisplays();if(t.length>0){if("win32"===process.platform)return 0===e.type?c.default.screen.getDisplayMatching(S.getWindowBounds(parseInt(e.displayId,10))):c.default.screen.getDisplayMatching(S.getDesktopBounds(parseInt(e.displayId,10)));if("darwin"===process.platform&&0===e.type)return c.default.screen.getDisplayMatching(w.getWindowBounds(parseInt(e.displayId,10)))}for(const i of t)if(i.id.toString()===e.displayId)return i}return this.getCurrentDisplay()}initCacheModule(){let e=this.classUrl,t=e.indexOf(".html");-1!==t&&(t=e.length);const i=e.lastIndexOf("/",t);-1===i?c.default.dialog.showErrorBox("出错",`传入非法URL,课堂无法正常初始化: ${this.classUrl}`):e=e.substring(0,i);try{const t=h.default.join(__dirname,"config.json"),i=h.default.join(g,"config.json");l.default.existsSync(t)&&(console.log("TCIC copyFile",t,"--\x3e",i),l.default.copyFileSync(t,i));const n=h.default.join(__dirname,"resource.zip"),o=h.default.join(g,"resource.zip");return l.default.existsSync(n)&&(console.log("TCIC copyFile",n,"--\x3e",o),l.default.copyFileSync(n,o)),p.TIWCacheManager.SetConfig({configUrl:`${e}/cache/tiwcache.json`,configPath:i,resourcePath:o,resourceDir:g}).catch((e=>{console.error("TCIC cache init",e)}))}catch(e){return console.error("TCIC cache init",e),Promise.reject(e)}}createAndInitWindow(){console.log("TCIC createAndInitWindow"),this.shouldFullscreen=!1,"win32"===process.platform&&(c.default.systemPreferences.isAeroGlassEnabled()?this.shouldFullscreen=!0:c.default.dialog.showErrorBox("出错","DWM未开启,不支持窗口透明特性")),this.initCacheModule().then((()=>{this.createAndInitMainView(),this.attachMainViewToDefaultEntryMainWindow(),this.registerIPCEvent()}))}checkHasInitialize(){return!!this.tcicDefaultEntryMainWindow}}},975:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getWindowBounds=void 0;const a=s(i(124)),c=r(i(420)),d=s(i(728)),l=r(i(451)),h=d.types.void,u=d.types.int,w=process.arch.includes("64")?d.types.uint64:d.types.uint32,f=w,p=f,S=f,g=f,y=w,m=d.types.uint32,M=d.types.uint32,W=d.types.int,b=d.types.CString,C=d.types.double,v=l.default({x:C,y:C}),D=l.default({width:C,height:C}),T=l.default({origin:v,size:D}),I=d.refType(T),B=c.default(p),E=c.default(g);t.getWindowBounds=function(e){const t={x:0,y:0,width:0,height:0};if("darwin"===process.platform)try{const i=a.DynamicLibrary("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics"),n=a.Library(i,{CGWindowListCopyWindowInfo:[S,[y,m]],CGRectMakeWithDictionaryRepresentation:[u,[g,I]]}),o=a.DynamicLibrary("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"),s=a.Library(o,{CFStringGetCStringPtr:[b,[p,M]],CFArrayGetCount:[W,[S]],CFArrayGetValueAtIndex:[f,[S,W]],CFDictionaryGetCount:[W,[g]],CFDictionaryGetKeysAndValues:[h,[g,B,E]],CFDictionaryGetValue:[f,[g,p]],CFRelease:[h,[f]]}),r=n.CGWindowListCopyWindowInfo(8,e);if(0===r)return t;if(s.CFArrayGetCount(r)>0){const e=s.CFArrayGetValueAtIndex(r,0),i=s.CFDictionaryGetCount(e),o=new B(i);s.CFDictionaryGetKeysAndValues(e,o,0);for(let r=0;r<i;++r)if("kCGWindowBounds"===s.CFStringGetCStringPtr(o[r],134217984)){const i=s.CFDictionaryGetValue(e,o[r]),a=new T;n.CGRectMakeWithDictionaryRepresentation(i,a.ref()),t.x=a.origin.x,t.y=a.origin.y,t.width=a.size.width,t.height=a.size.height}}s.CFRelease(r)}catch(e){console.error(e)}return console.log("getWindowBounds",JSON.stringify(t)),t}},196:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TCIC=void 0;const n=i(555),o=i(376);let s=null;t.TCIC={initialize(e){const t=e.onClose;e.onClose=()=>{t&&t(),s=null},s?this.show():(s=new n.TencentCloudClass,s.initialize(e))},closeAllWindow(){s&&s.focus()},focus(){s&&s.focus()},show(){s&&s.show()},getVersion:()=>o.tcicSdkVersion},e.exports=t.TCIC},376:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.crashReportUUID=t.tcicSdkVersion=void 0;const n=i(425);t.tcicSdkVersion="1.3.3.141",t.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:"browser"===process.type}),n.configureScope((e=>{e.setTag("extra.sdk",t.tcicSdkVersion),e.setTag("extra.uuid",t.crashReportUUID)}))},741:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TIWCacheManager=void 0;const o=i(933),s=n(i(747)),r=n(i(622)),a=n(i(605)),c=n(i(211)),d=n(i(138));class l{static EnableCache(e){if(l._enabled=e,l._timer&&(clearTimeout(l._timer),l._timer=null),l._enabled&&l._cacheConfig&&l._serverConfig){const e=()=>{l.RefreshServerConfig().catch((e=>{console.error(e)})),l._timer=setTimeout(e,1e3*this._serverConfig.interval)};e()}}static SetConfig(e){return new Promise(((t,i)=>{l._cacheConfig=e;const n=l.GetConfigDir(),o=l.GetZipDir(),r=l.GetResourceDir(),a=l.GetDocumentDir();s.default.mkdirSync(n,{recursive:!0}),s.default.mkdirSync(o,{recursive:!0}),s.default.mkdirSync(r,{recursive:!0}),s.default.mkdirSync(a,{recursive:!0});const c=l.GetConfigPath(),h=l.GetZipPath(),u=e.configPath;let w=s.default.existsSync(c),f=!1;if(w&&(f=l.IsBundleResourceNew(u,c),f)){const e=l.GetResourceDir();l.RemoveDirSync(e),s.default.unlinkSync(c),s.default.unlinkSync(h),w=s.default.existsSync(c)}if(w&&!f)l._serverConfig=l.LoadServerConfigFromLocalFile(c),l.EnableCache(!0),t();else if(s.default.existsSync(e.configPath)){s.default.renameSync(e.configPath,c);const n=l.LoadServerConfigFromLocalFile(c);if(s.default.existsSync(e.resourcePath)){s.default.renameSync(e.resourcePath,h);try{l.RemoveDirSync(r),new d.default(h).extractAllTo(r,!0),l._serverConfig=n,l.EnableCache(!0),t()}catch(e){s.default.unlinkSync(c),s.default.unlinkSync(h),console.error("TIWCacheManager resource unzip failed",e),i(e)}}else i(`资源文件不存在: ${e.resourcePath}`)}else i(`配置文件不存在: ${e.configPath}`)}))}static RefreshServerConfig(){if(!l._cacheConfig.configUrl)return Promise.reject("缺少配置文件URL");if(l._isRefreshing)return Promise.reject("上次刷新未完成");l._isRefreshing=!0;const e=l.GetConfigPath(!0),t=l._cacheConfig.configUrl;return l.HttpRequest(t,null,null,e).then((()=>{const t=l.LoadServerConfigFromLocalFile(e),i=l.GetResourceInfo(t);if(!i)return Promise.reject("新配置缺少可用资源信息");const n=l.GetResourceInfo(l._serverConfig);if(n&&i&&n.version===i.version&&i.devBuildTime>=n.devBuildTime)return Promise.reject(`新配置版本低于老配置版本: ${i.version} < ${n.version}`);console.log("TIWCacheManager new config fetched",t);const o=l.GetZipPath(!0);return l.HttpRequest(i.url,null,null,o).then((()=>{const i=l.GetResourceDir();l.RemoveDirSync(i),new d.default(o).extractAllTo(i,!0);const n=l.GetConfigPath();s.default.unlinkSync(n),s.default.renameSync(e,n);const r=l.GetZipPath();return s.default.unlinkSync(r),s.default.renameSync(o,r),l._serverConfig=t,console.log("TIWCacheManager resource prepare done"),Promise.resolve()})).catch((e=>{s.default.unlinkSync(o),console.error("TIWCacheManager resource fetch failed",e)}))})).catch((t=>{s.default.unlinkSync(e),console.error("TIWCacheManager config fetch failed",t)})).finally((()=>{l._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:l.TIWCacheSchemeHttp,privileges:l.TIWCacheSchemePrivileges},{scheme:l.TIWCacheSchemeHttps,privileges:l.TIWCacheSchemePrivileges}]),!0)}static GetResourcePath(e){if(l._enabled&&l._cacheConfig&&l._cacheConfig.resourceDir){const t=l.GetResourceInfo(l._serverConfig);if(t){let i="";do{const n=new URL(e),o=`${n.origin}${n.pathname}`;if(t.files&&t.files.hasOwnProperty(o)){const e=t.files[o];i=e.toLowerCase().startsWith("http")?e:r.default.join(l.GetResourceDir(),e);break}if(!i&&t.regexes)for(const e in t.regexes){let n=t.regexes[e];const s=o.match(e);if(s&&s.length>0){for(let e=1;e<=s.length;++e){const t=new RegExp(`\\$${e}`,"g");n=n.replace(t,s[e])}i=r.default.join(l.GetResourceDir(),n);break}}if(!i&&t.documents)for(const e in t.documents){const n=t.documents[e],a=o.match(e);if(a&&a.length>=3){const e=a[1],t=a[2],c=l.GetDocumentDir();i=o.replace(e,c),s.default.existsSync(i)||l.DownloadDocumentCategory(r.default.join(c,t,n),`${e}/${t}/${n}`);break}}}while(0);return s.default.existsSync(i)?console.log("TIWCacheManager GetResourcePath",e,i):i="",i}}return""}static EnableWebContentsCache(e,t){if(t){const t=(e,t)=>{l.TIWCacheFileMap.has(e.url)?(t({path:l.TIWCacheFileMap.get(e.url)}),l.TIWCacheFileMap.delete(e.url)):t({statusCode:404})};e.session.protocol.registerFileProtocol(l.TIWCacheSchemeHttp,t),e.session.protocol.registerFileProtocol(l.TIWCacheSchemeHttps,t),e.session.webRequest.onBeforeRequest(((e,t)=>{let i=e.url;const n=i.indexOf("://"),o=i.substring(0,n).toLowerCase(),s=i.substring(n);if(o===l.TIWCacheSchemeHttp||o===l.TIWCacheSchemeHttps){if(l.TIWCacheFileMap.has(i))return void t({cancel:!1});i=o===l.TIWCacheSchemeHttp?`http${s}`:`https${s}`}else if("http"!==o&&"https"!==o)return void t({cancel:!1});const r=l.GetResourcePath(i);""===r?t({cancel:!1}):r.startsWith("http")?t({cancel:!1,redirectURL:r}):(i="https"===o||o===l.TIWCacheSchemeHttps?l.TIWCacheSchemeHttps+s:l.TIWCacheSchemeHttp+s,l.TIWCacheFileMap.set(i,r),i===e.url?t({cancel:!1}):t({cancel:!1,redirectURL:i}))}))}else e.session.protocol.unregisterProtocol(l.TIWCacheSchemeHttp),e.session.protocol.unregisterProtocol(l.TIWCacheSchemeHttps),e.session.webRequest.onBeforeSendHeaders(null)}static HttpRequest(e,t,i,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=i?JSON.stringify(i):null,l=d?"POST":"GET";t||(t={}),d&&(t.hasOwnProperty("Content-Type")||(t["Content-Type"]="application/json"),t.hasOwnProperty("Content-Length")||(t["Content-Length"]=d.length.toString()));const h={method:l,headers:t},u=o.request(e,h,(t=>{if(200!==t.statusCode){const i=new Error(`Failed to get '${e}' (${t.statusCode})`);return console.error(i),void a(i)}if(c)t.pipe(c);else{let e="";t.on("data",(t=>{e+=t.toString()})),t.on("end",(()=>{r(e)}))}}));i&&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 t=s.default.readFileSync(e,"utf8");return JSON.parse(t)}static GetResourceInfo(e){const t=`${l._cacheConfig.sdkAppId}`,i=`${l._cacheConfig.schoolId}`;let n=e.resources.find((e=>-1!==t.search(e.sdkAppId)&&-1!==i.search(e.schoolId)));return n||(n=e.resources.find((e=>"0"===e.sdkAppId&&"0"===e.schoolId))),n}static GetConfigPath(e){return r.default.join(l.GetConfigDir(),`${e?(+new Date).toString():""}tiwcache.json`)}static GetZipPath(e){return r.default.join(l.GetConfigDir(),`${e?(+new Date).toString():""}tiwresource.zip`)}static GetConfigDir(){return r.default.join(l._cacheConfig.resourceDir,"tiwcache")}static GetLogDir(){return r.default.join(l._cacheConfig.resourceDir,"tiwcache")}static GetZipDir(){return r.default.join(l._cacheConfig.resourceDir,"tiwcache")}static GetResourceDir(){return r.default.join(l._cacheConfig.resourceDir,"tiwcache","resource")}static GetDocumentDir(){return r.default.join(l._cacheConfig.resourceDir,"tiwcache","document")}static IsBundleResourceNew(e,t){const i=l.LoadServerConfigFromLocalFile(e),n=l.LoadServerConfigFromLocalFile(t),o=l.GetResourceInfo(i),s=l.GetResourceInfo(n);return o&&s&&o.devBuildTime>s.devBuildTime}static DownloadDocumentCategory(e,t){if(s.default.existsSync(e))return l.DownloadDocumentFiles(e,t);if(l._documentState.get(t))return Promise.reject("下载中");l._documentState.set(t,!0),console.log("TIWCacheManager document downloading",t);const i=r.default.normalize(e.substring(0,e.lastIndexOf(r.default.sep)+1));return s.default.mkdirSync(i),l.HttpRequest(t,null,null,e).then((()=>(console.log("TIWCacheManager document downloaded",t,e),l.ClearExpiredDocuments(),l.DownloadDocumentFiles(e,t)))).finally((()=>{l._documentState.set(t,!1)}))}static DownloadDocumentFiles(e,t,i=0){let n=l._documentInfo.get(e);if(!n){if(n=l.LoadDocumentInfoFromLocalFile(e,t),!n)return Promise.reject("课件文件列表解析失败");n.files.sort(((e,t)=>e.priority-t.priority)),console.log("TIWCacheManager document info",t,n),l._documentInfo.set(e,n)}if(i>=n.files.length)return Promise.resolve();const o=n.files[i];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",t,i),l.HttpRequest(o.url,null,null,o.path).then((()=>(console.log("TIWCacheManager document file downloaded",t,i,o),l.DownloadDocumentFiles(e,t,i+1))))}return l.DownloadDocumentFiles(e,t,i+1)}static LoadDocumentInfoFromLocalFile(e,t){const i=s.default.readFileSync(e,"utf-8"),n=JSON.parse(i);n.path=e,n.url=t;const o=e.substring(0,e.lastIndexOf(r.default.sep)+1),a=t.substring(0,t.lastIndexOf("/")+1);return n.files.forEach((e=>{e.path=r.default.join(o,e.name),e.url=`${a}/${e.name}`})),n}static RemoveDirSync(e,t){if(!s.default.existsSync(e))return!0;let i=!0;return s.default.readdirSync(e).forEach((n=>{const o=r.default.join(e,n),a=s.default.statSync(o);!t||t(a)?a.isDirectory()?l.RemoveDirSync(o)||(i=!1):s.default.unlinkSync(o):a.isDirectory()&&l.RemoveDirSync(o,t)||(i=!1)})),!!i&&(s.default.rmdirSync(e),!0)}static ClearExpiredDocuments(){const e=new Date;l.RemoveDirSync(l.GetDocumentDir(),(t=>!t.isDirectory()||new Date(t.atime.getTime()+2592e5)<e))}}t.TIWCacheManager=l,l.TIWCacheSchemeHttp="tiw-cache",l.TIWCacheSchemeHttps="tiw-caches",l.TIWCacheSchemePrivileges={standard:!0,secure:!0,bypassCSP:!0,allowServiceWorkers:!0,supportFetchAPI:!0,corsEnabled:!0,stream:!1},l.TIWCacheFileMap=new Map,l._enabled=!1,l._timer=null,l._isRefreshing=!1,l._documentState=new Map,l._documentInfo=new Map},42:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=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 t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isWin7=t.getDesktopBounds=t.getWindowBounds=t.setThickFrame=t.setShowTaskbarOnMultipleDisplays=t.isShowTaskbarOnMultipleDisplays=t.setTaskbarAutoHiddenInTabletEnabled=t.isTaskbarAutoHiddenInTabletEnabled=t.setTaskbarAutoHiddenInDesktopEnabled=t.isTaskbarAutoHiddenInDesktopEnabled=t.getPrimaryDisplaySize=t.getMaxTouches=t.getDesktopPath=void 0;const c=a(i(124)),d=a(i(747)),l=s(i(87)),h=a(i(622)),u=a(i(728)),w=a(i(451)),f=a(i(26)),p=u.default.types.bool,S=u.default.types.int,g=u.default.types.uint,y=process.arch.includes("64")?u.default.types.uint64:u.default.types.uint32,m=u.default.types.long,M=u.default.types.ulong,W=M,b=process.arch.includes("64")?u.default.types.int64:u.default.types.int32,C=process.arch.includes("64")?u.default.types.ulonglong:M,v=C,D=C,T=C,I=w.default({left:m,top:m,right:m,bottom:m}),B=u.default.refType(I),E=w.default({cbSize:W,hWnd:T,uCallbackMessage:g,uEdge:g,rc:I,lParam:b}),P=u.default.refType(E),k=function(e){return new Promise(((t,i)=>{const n={};f.default.list(e).on("data",(e=>{n[e.key]=e.data})).on("finish",(()=>{t(n)})).on("error",(e=>{i(e)}))}))},V=function(e){return new Promise(((t,i)=>{f.default.putValue(e,(e=>{e&&i(e),t()}))}))},x=function(){c.default.Library("user32",{SendNotifyMessageA:[p,[T,g,y,"string"]]}).SendNotifyMessageA(65535,26,0,"TraySettings")};t.getDesktopPath=function(){return r(this,void 0,void 0,(function*(){let e=h.default.join(l.homedir(),"Desktop"),t=d.default.existsSync(e);if("win32"===process.platform&&!t){const i="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",[n,o]=yield k(i).then((e=>[null,e])).catch((e=>[e,null]));if(!n&&o)try{t=!0,e=o[i].values.Desktop.value}catch(e){}}return t?e:""}))},t.getMaxTouches=function(){if("win32"===process.platform){const e=95;return c.default.Library("user32",{GetSystemMetrics:[S,[S]]}).GetSystemMetrics(e)}return 0},t.getPrimaryDisplaySize=function(){if("win32"===process.platform){const e=c.default.Library("user32",{GetSystemMetrics:[S,[S]]}),t=0,i=1;return{width:e.GetSystemMetrics(t),height:e.GetSystemMetrics(i)}}return null},t.isTaskbarAutoHiddenInDesktopEnabled=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e=c.default.Library("shell32",{SHAppBarMessage:[g,[g,P]]}),t=new E;return t.cbSize=E.size,1===e.SHAppBarMessage(4,t.ref())}return!1}))},t.setTaskbarAutoHiddenInDesktopEnabled=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const t=c.default.Library("user32",{FindWindowA:[T,["string",m]]}),i=c.default.Library("shell32",{SHAppBarMessage:[g,[g,P]]}),n=new E;return n.cbSize=E.size,n.hWnd=t.FindWindowA("Shell_TrayWnd",0),n.lParam=e?1:0,i.SHAppBarMessage(10,n.ref()),!0}return!1}))},t.isTaskbarAutoHiddenInTabletEnabled=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[t,i]=yield k(e).then((e=>[null,e])).catch((e=>[e,null]));if(!t&&i)try{return!!i[e].values.TaskbarAutoHideInTabletMode.value}catch(e){}}return!1}))},t.setTaskbarAutoHiddenInTabletEnabled=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const t={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{TaskbarAutoHideInTabletMode:{value:e?1:0,type:"REG_DWORD"}}};return yield V(t),x(),!0}catch(e){}return!1}))},t.isShowTaskbarOnMultipleDisplays=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[t,i]=yield k(e).then((e=>[null,e])).catch((e=>[e,null]));if(!t&&i)try{return!!i[e].values.MMTaskbarEnabled.value}catch(e){}}return!1}))},t.setShowTaskbarOnMultipleDisplays=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const t={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{MMTaskbarEnabled:{value:e?1:0,type:"REG_DWORD"}}};return yield V(t),x(),!0}catch(e){}return!1}))},t.setThickFrame=function(e,t){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const i=c.default.Library("user32",{GetWindowLongA:[m,[T,S]],SetWindowLongA:[m,[T,S,m]]}),n=parseInt(e.getMediaSourceId().split(":")[1],10),o=i.GetWindowLongA(n,-16),s=t?262144|o:-262145&o;return i.SetWindowLongA(n,-16,s),!0}return!1}))},t.getWindowBounds=function(e){const t={x:0,y:0,width:0,height:0};if("win32"===process.platform){const i=c.default.Library("user32",{GetWindowRect:[p,[T,B]]}),n=new I;i.GetWindowRect(e,n.ref())&&(t.x=n.left,t.y=n.top,t.width=n.right-n.left,t.height=n.bottom-n.top)}return t};const _=new Map;t.getDesktopBounds=function(e){let t=_.get(e);if(t)return t;if(t={x:0,y:0,width:0,height:0},"win32"===process.platform){const i=c.default.Library("user32",{EnumDisplayMonitors:[p,[D,m,"pointer",b]]});let n=0;const o=e,s=c.default.Callback(p,[v,D,B,b],((e,i,s,r)=>{if(n+=1,n===o){const e=s.deref();return t.x=e.left,t.y=e.top,t.width=e.right-e.left,t.height=e.bottom-e.top,!1}return!0}));i.EnumDisplayMonitors(0,0,s,0)}return _.set(e,t),t},t.isWin7=function(){const e=l.release().split(".");if(e.length>=3){const t=parseInt(e[0],10),i=parseInt(e[1],10);return!(t>=10||6===t&&i>=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")},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")}},t={};return function i(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}(196)})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TCIC=t():e.TCIC=t()}(global,(function(){return(()=>{"use strict";var e={555:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=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 t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TencentCloudClass=void 0;const c=a(i(933)),d=a(i(765)),l=a(i(747)),h=a(i(622)),u=s(i(293)),w=s(i(450)),f=s(i(975)),p=i(376),S=i(741),g=s(i(42)),W=a(i(528)),m=a(i(239));S.TIWCacheManager.RegisterAsPrivileged();const y=W.default.use(m.default(((e,t,i)=>{const n=h.default.resolve(__dirname,"..","locales",`${e}.json`);l.default.promises.readFile(n,"utf8").then((e=>{i(null,JSON.parse(e))})).catch((e=>{i(e,null)}))}))).init({lng:"zh",fallbackLng:!1,keySeparator:!1,nsSeparator:!1});let M;if(M="win32"===process.platform?h.default.join(process.env.USERPROFILE,"TencentCloudClass"):h.default.join(process.env.HOME,"TencentCloudClass"),l.default.existsSync(M)||l.default.mkdirSync(M,{recursive:!0}),c.default.app.setPath("crashDumps",h.default.join(M,"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 C=new d.default;t.TencentCloudClass=class{constructor(){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.watchMouseEventEnabled=!1,this.watchMouseMoveTimer=null,this.touchScreenOptimizeEnabled=!1,this.touchScreenOptimizePerformed=!1,this.screenShareMainWindowMouseEventIgnored=!1,this.mainViewDevTools=null,this.boardViewDevTools=null,this.videoWindowDevTools=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(console.log("TCIC initialize",e),this.checkHasInitialize())return this.tcicScreenShareBoardWindow?this.tcicScreenShareBoardWindow.show():this.tcicDefaultEntryMainWindow.show(),!1;if("function"==typeof e.onClose&&(this.onAllWindowClosedCallback=e.onClose),e.sign){const t=new Buffer(e.sign.split(".")[1],"base64"),i=JSON.parse(t.toString("utf-8"));e.schoolId=i.school_id,e.classId=i.class_id,e.userId=i.user_id,e.cid=i.cid,e.uid=i.uid,e.scene=i.scene,e.token=e.sign}yield y;let t=`schoolid=${e.schoolId}&userid=${e.userId}&classid=${e.classId}&token=${e.token}&webloadstamp=${(new Date).getTime()}`;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 i=e.url;if(!i){let n="";const o=p.tcicSdkVersion.split("."),s=`/${o[0]}.${o[1]}.${o[2]}`;e.env&&"prod"!==e.env&&(n=`${e.env}-`),i=`https://${n}class.qcloudclass.com${s}/class.html?${e.env?`env=${e.env}&`:""}${t}`,process.defaultApp&&(process.argv.includes("--local")?i=`http://localhost:8080/class.html?${e.env?`env=${e.env}&`:""}${t}`:process.argv.includes("--vm")&&(i=`http://10.211.55.2:8080/class.html?${e.env?`env=${e.env}&`:""}${t}`))}return this.classUrl=i,console.log("TCIC url",i),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 t={type:"info",title:"系统信息",message:JSON.stringify(e,null,2),buttons:["关闭","打开GPU排障页面",C.get("autoOpenDevTools")?"启动时不打开调试工具":"启动时打开调试工具",C.get("screenShareNotOnTop")?"屏幕分享时窗口置顶":"屏幕分享时窗口不置顶","清除本地记录信息"]};c.default.dialog.showMessageBox(t).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:C.set("autoOpenDevTools",!C.get("autoOpenDevTools"));break;case 3:C.set("screenShareNotOnTop",!C.get("screenShareNotOnTop"));break;case 4:C.clear()}}))})),!0}))}closeAllWindow(e){if(this.closeAllWindowInvoking)return void console.log("TCIC closeAllWindow ignore");console.log("TCIC closeAllWindow start"),this.closeAllWindowInvoking=!0;let t=Promise.resolve();this.tcicMainView&&(this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.getBrowserViews().length>0&&this.tcicDefaultEntryMainWindow.removeBrowserView(this.tcicMainView),t=new Promise((e=>{this.tcicMainView.webContents.once("destroyed",(()=>{this.tcicMainView=null,this.mainViewDevTools&&this.mainViewDevTools.close(),e()})),this.tcicMainView.webContents.destroy()})));let i=Promise.resolve(),n=Promise.resolve();this.tcicBoardView&&(n=new Promise((e=>{this.tcicBoardView.webContents.once("destroyed",(()=>{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",(()=>{e()})),this.tcicScreenShareBoardWindow.close()})));let s=Promise.resolve();if(this.tcicScreenShareMainWindow&&(s=new Promise((e=>{this.tcicScreenShareMainWindow.once("closed",(()=>{e()})),this.tcicScreenShareMainWindow.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&&(i=new Promise((e=>{this.tcicDefaultEntryMainWindow.once("closed",(()=>{this.tcicDefaultEntryMainWindow=null,e()})),this.tcicDefaultEntryMainWindow.close()})));try{this.onAllWindowClosedCallback&&this.onAllWindowClosedCallback()}catch(e){console.error("业务侧传入的onClose回调内发生了异常:",e)}}let r=Promise.resolve();return this.tcicScreenShareVideoWindow&&(r=new Promise((e=>{this.tcicScreenShareVideoWindow.once("closed",(()=>{e()})),this.tcicScreenShareVideoWindow.close()}))),Promise.all([t,i,n,o,s,r]).then((()=>{this.closeAllWindowInvoking=!1,console.log("TCIC closeAllWindow done")}))}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)}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,t=""){this.seriousErrorTimes+=1,console.error("TCIC seriousErrorHandler",this.seriousErrorTimes,e);let i=!this.closeAllWindowInvoking&&this.seriousErrorTimes<=3,n=`客户端遇到多次异常即将关闭,可从课堂列表再次进入,如果问题持续出现,请联系客服人员\n\n异常原因:${e} - ${t}\n\n异常上报UUID:${p.crashReportUUID}`;switch(e){case"clean-exit":case"abnormal-exit":case"killed":i=!1;break;case"oom":n=`客户端由于内存不足无法正常工作,请退出其它应用后从课堂列表再次进入\n\n异常上报UUID:${p.crashReportUUID}`,i=!1}this.closeAllWindow(i).then((()=>{if(i)this.createAndInitWindow();else{const e={type:"info",title:"客户端异常",message:n,buttons:["退出课堂"]};c.default.dialog.showMessageBox(e).then((e=>{}))}}))}detectScreenShareMainWindowMouseEventIgnored(e,t){if(!this.watchMouseEventEnabled||!this.tcicScreenShareMainWindow||!this.tcicMainView)return;const i=this.tcicScreenShareMainWindow.getPosition(),n=e-i[0],o=t-i[1];this.tcicMainView.webContents.capturePage({x:n,y:o,width:1,height:1}).then((e=>{const t=0===e.getBitmap()[3];t!==this.screenShareMainWindowMouseEventIgnored&&(this.screenShareMainWindowMouseEventIgnored=t,this.tcicScreenShareMainWindow&&this.tcicScreenShareMainWindow.setIgnoreMouseEvents(t,{forward:this.touchScreenOptimizeEnabled}),console.log("setIgnoreMouseEvents",t,this.touchScreenOptimizeEnabled),t&&"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,t=0;this.watchMouseMoveTimer=setInterval((()=>{const i=c.default.screen.getCursorScreenPoint();i.x===e&&i.y===t||(e=i.x,t=i.y,this.detectScreenShareMainWindowMouseEventIgnored(e,t))}),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:h.default.join(__dirname,"mainRenderer.bundle.js"),nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicMainView.webContents.once("dom-ready",(()=>{this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.show()})),S.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,t,i)=>{i&&(this.windowTitle=t,this.tcicDefaultEntryMainWindow&&this.tcicDefaultEntryMainWindow.setTitle(t),this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.setTitle(t))}));const e=this.tcicMainView.webContents.loadURL(`${this.classUrl}&seriousError=${this.seriousErrorTimes}`),t=new Promise(((e,t)=>{this.tcicMainView.webContents.on("did-finish-load",(()=>{e()})),this.tcicMainView.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{t(e)}))}));Promise.all([e,t]).then((()=>{this.tcicMainView.webContents.send("init")})).catch((e=>{console.error("TCIC load main view",e);const t={type:"error",title:"",message:`网络异常,课堂加载失败: ${JSON.stringify(e)}\n\n运维ID:${p.crashReportUUID}`,buttons:["退出课堂"]};c.default.dialog.showMessageBox(t).then((e=>{this.closeAllWindow()}))})),this.tcicMainView.webContents.on("render-process-gone",((e,t)=>{this.seriousErrorHandler(t.reason)})),this.tcicMainView.webContents.on("unresponsive",(()=>{this.seriousErrorHandler("unresponsive")}))}getMainWindowMinSize(e){e||(e="top");const t=c.default.screen.getPrimaryDisplay().workAreaSize;let i=718,n=110+i+45;n>t.height&&(i=Math.ceil(538.5),n=110+i+45,n>t.height&&(i=Math.ceil(359),n=110+i+45));const o=Math.ceil(i/9*16);return{width:Math.max(o,890),height:n}}createAndInitDefaultEntryMainWindow(){if(this.tcicDefaultEntryMainWindow)return;const e=this.getMainWindowMinSize();let t=e;C.has("MainWindowBounds")&&(t=C.get("MainWindowBounds"),console.log("TCIC restore size",t)),this.tcicDefaultEntryMainWindow=new c.default.BrowserWindow({width:t.width<e.width?e.width:t.width,height:t.height<e.height?e.height:t.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 i=null;this.tcicDefaultEntryMainWindow.on("resize",(()=>{if(i&&clearTimeout(i),i=setTimeout((()=>{if(i=null,!this.tcicDefaultEntryMainWindow.isMinimized()&&!this.isMainWindowMaximized){const e=this.tcicDefaultEntryMainWindow.getBounds();C.set("MainWindowBounds",e),console.log("TCIC resize",e)}}),100),this.tcicScreenShareVideoWindow){const e=this.tcicScreenShareVideoWindow.getBounds();this.resizeScreenShareVideoWindow({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])}})),this.tcicDefaultEntryMainWindow.on("close",(e=>{this.closeAllWindowInvoking||(e.preventDefault(),this.isScreenSharing||this.tcicMainView.webContents.send("leaveClass"))}))}createAndInitBoardView(e,t){if(!this.tcicBoardView){if(this.tcicBoardView=new c.default.BrowserView({webPreferences:{nodeIntegration:!0,enableRemoteModule:!0,backgroundThrottling:!1}}),this.tcicBoardView.webContents.once("dom-ready",(()=>{this.tcicScreenShareBoardWindow&&this.tcicScreenShareBoardWindow.show()})),S.TIWCacheManager.EnableWebContentsCache(this.tcicBoardView.webContents,!0),this.tcicBoardView.setAutoResize({width:!0,height:!0,horizontal:!0,vertical:!0}),t){console.log("createAndInitBoardView",h.default.join(__dirname,"board.html"));const i=this.tcicBoardView.webContents.loadFile(h.default.join(__dirname,"board.html")),n=new Promise(((e,t)=>{this.tcicBoardView.webContents.on("did-finish-load",(()=>{e()})),this.tcicBoardView.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{t(e)}))}));Promise.all([i,n]).then((()=>{t.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",t),this.callBoardMethodCache.forEach((e=>{this.callBoardMethod(e)})),this.callBoardMethodCache=[]})).catch((e=>{}))}this.tcicBoardView.webContents.on("render-process-gone",((e,t)=>{this.seriousErrorHandler(t.reason)})),this.tcicBoardView.webContents.on("unresponsive",(()=>{this.seriousErrorHandler("unresponsive")}))}}createAndInitScreenShareBoardWindow(e,t){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)}))}createAndInitScreenShareMainWindow(e){this.tcicScreenShareMainWindow||(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 t=this.tcicDefaultEntryMainWindow.getBounds();this.tcicScreenShareVideoWindow=new c.default.BrowserWindow({x:t.x,y:t.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:h.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)})),console.log("createAndInitScreenShareVideoWindow",h.default.join(__dirname,"video.html"));const i=this.tcicScreenShareVideoWindow.webContents.loadFile(h.default.join(__dirname,"video.html")),n=new Promise(((e,t)=>{this.tcicScreenShareVideoWindow.webContents.on("did-finish-load",(()=>{e()})),this.tcicScreenShareVideoWindow.webContents.on("did-fail-load",((e,i,n,o,s,r,a)=>{t(e)}))}));return new Promise(((e,t)=>{Promise.all([i,n]).then((()=>{const t=this.tcicScreenShareVideoWindow.getMediaSourceId().split(":")[1];e({sourceId:t})})).catch((e=>{t(e)}))}))}resizeScreenShareVideoWindow(e){const t=this.tcicDefaultEntryMainWindow.getBounds();e.width>t.width&&(e.height=Math.floor(e.height/e.width*t.width),e.width=t.width),e.height>t.height&&(e.width=Math.floor(e.width/e.height*t.height),e.height=t.height),t.width=e.width,t.height=e.height,this.tcicScreenShareVideoWindow.setBounds(t)}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,t=e.width/2,i=600;this.tcicMainView&&(this.mainViewDevTools||(this.mainViewDevTools=new c.default.BrowserWindow({width:t,height:i,x:(e.width-2*t)/2+t,y:(e.height-i)/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:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/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:t,height:i,x:(e.width-2*t)/2,y:(e.height-i)/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())}callBoardMethod(e){if(this.isBoardViewLoaded){if("board"===e.module){if("setToolType"===e.method){const t=e.params[0];0===t?(this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!0),"darwin"===process.platform&&this.tcicScreenShareBoardWindow.blur()):this.tcicScreenShareBoardWindow.setIgnoreMouseEvents(!1),this.lastSelectedScreenBoardToolType=t}this.tcicBoardView.webContents.send("callMethod",e)}}else this.callBoardMethodCache.push(e)}addLifecycleIPCListener(e,t){c.default.ipcMain.on(e,t),this.ipcListeners.push({channel:e,listener:t})}addLifecycleIPCHandler(e,t){c.default.ipcMain.handle(e,t),this.ipcHandlers.push({channel:e,handler:t})}registerIPCEvent(){this.addLifecycleIPCHandler("getSystemInfo",((e,t)=>r(this,void 0,void 0,(function*(){return yield u.get(t)})))),this.addLifecycleIPCListener("callMethod",((e,t)=>{this.callBoardMethod(t)})),this.addLifecycleIPCListener("enableTouchScreenOptimize",(e=>{this.touchScreenOptimizeEnabled=!0,this.enableScreenShareMainWindowTouchScreenOptimize()})),this.addLifecycleIPCListener("onMouseEvent",((e,t)=>{this.detectScreenShareMainWindowMouseEventIgnored(t.x,t.y)})),this.addLifecycleIPCListener("onReloadWindow",((e,t,i)=>{this.seriousErrorHandler(t,i)})),this.addLifecycleIPCListener("onPageFinished",((e,t)=>{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,t)=>{if(!this.isMainWindowMaximized){const e=this.getMainWindowMinSize(t);this.tcicDefaultEntryMainWindow.setMinimumSize(e.width,e.height);const i=this.tcicDefaultEntryMainWindow.getBounds();if(i.width<e.width||i.height<e.height){this.tcicDefaultEntryMainWindow.setBounds({width:i.width<e.width?e.width:i.width,height:i.height<e.height?e.height:i.height},!0);const t=this.tcicDefaultEntryMainWindow.getBounds();C.set("MainWindowBounds",t),console.log("TCIC resize after layout",t)}}})),this.addLifecycleIPCListener("onScreenShareSnapshot",((e,t)=>{this.tcicMainView.webContents.send("onScreenShareSnapshot",t)})),this.addLifecycleIPCListener("onBoardCanRedoChange",((e,t)=>{this.tcicMainView.webContents.send("onBoardCanRedoChange",t)})),this.addLifecycleIPCListener("onBoardCanUndoChange",((e,t)=>{this.tcicMainView.webContents.send("onBoardCanUndoChange",t)})),this.addLifecycleIPCHandler("downloadMusic",((e,t)=>new Promise(((e,i)=>{let n;n="win32"===process.platform?h.default.join(process.env.USERPROFILE,"TencentCloudClass"):h.default.join(process.env.HOME,"TencentCloudClass"),n=h.default.join(n,"document"),l.default.existsSync(n)||l.default.mkdirSync(n,{recursive:!0});const o=h.default.join(n,`${t.documentId}_${t.url.substring(t.url.lastIndexOf("/")+1)}`);l.default.existsSync(o)?e(o):w.httpRequest(t.url,null,null,o).then((()=>{e(o)})).catch((e=>{i(e)}))})))),this.addLifecycleIPCHandler("loadVideo",((e,t)=>new Promise(((e,i)=>{this.createAndInitScreenShareVideoWindow(t).then((i=>{c.default.ipcMain.once("canplay",((t,n)=>{this.resizeScreenShareVideoWindow(n),e(i)})),this.tcicScreenShareVideoWindow.webContents.send("loadVideo",t.url)}))})))),this.addLifecycleIPCHandler("playVideo",(e=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("playVideo")})),this.addLifecycleIPCHandler("seekVideo",((e,t)=>{this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("seekVideo",t)})),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,t)=>(this.tcicScreenShareVideoWindow&&this.tcicScreenShareVideoWindow.webContents.send("setVideoVolume",t),Promise.resolve()))),this.addLifecycleIPCListener("onVideoTimeSeeked",((e,t)=>{this.tcicMainView.webContents.send("onVideoTimeSeeked",t)})),this.addLifecycleIPCListener("onVideoTimeUpdate",((e,t)=>{this.tcicMainView.webContents.send("onVideoTimeUpdate",t)})),this.addLifecycleIPCHandler("setVideoBounds",((e,t)=>(this.tcicScreenShareVideoWindow,Promise.resolve()))),this.addLifecycleIPCHandler("startScreenShare",((e,t)=>r(this,void 0,void 0,(function*(){this.shareParams=t,this.isScreenSharing=!0,this.tcicDefaultEntryMainWindow.hide();const e=this.getDisplay(t);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 i=()=>{this.shareMainWindowDisplay=this.getDisplay(t),this.shareBoardWindowDisplay=this.shareMainWindowDisplay,this.createAndInitBoardView(this.shareBoardWindowDisplay,t),this.createAndInitScreenShareBoardWindow(this.shareBoardWindowDisplay,t),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(t);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 i=this.getDisplay(t);this.shareBoardWindowDisplay.id!==i.id&&(this.shareBoardWindowDisplay=i,this.closeScreenShareBoardWindow(),this.createAndInitScreenShareBoardWindow(i,t),this.attachBoardViewToScreenShareBoardWindow(),this.updateZOrderAccordingShareWindow(this.shareMainWindowDisplay,this.shareBoardWindowDisplay),this.tcicScreenShareBoardWindow.flashFrame(!1)),console.log("getShareWindowBounds",JSON.stringify(e)),console.log("shareBoardWindowDisplay",JSON.stringify(i)),this.tcicBoardView.webContents.send("onShareWindowBoundsChanged",{x:e.x-i.bounds.x,y:e.y-i.bounds.y,width:e.width,height:e.height})}}),100);const i=this.tcicScreenShareMainWindow.getMediaSourceId().split(":")[1],n=this.tcicScreenShareBoardWindow.getMediaSourceId().split(":")[1];0===t.type?e({excludeShareWindowSourceIds:[i],includeShareWindowSourceIds:[n]}):e({excludeShareWindowSourceIds:[i],includeShareWindowSourceIds:[]})};if("win32"===process.platform){let e=0;const n=setInterval((()=>{const o=this.getDisplay(t);e+=1,(o.size.width!==o.workAreaSize.width||o.size.height!==o.workAreaSize.height||e>50)&&(clearInterval(n),i())}),100)}else i()}))})))),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 t=this.tcicDefaultEntryMainWindow.getMediaSourceId().split(":")[1];e.push(t)}return Promise.resolve(e)})))),this.addLifecycleIPCHandler("stopScreenShare",((e,t)=>(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()))),this.addLifecycleIPCHandler("getDesktopPath",(e=>r(this,void 0,void 0,(function*(){return g.getDesktopPath()}))))}getCurrentDisplay(){return c.default.screen.getDisplayMatching(this.tcicDefaultEntryMainWindow.getBounds())}updateZOrderAccordingShareWindow(e,t){this.tcicScreenShareMainWindow&&this.tcicScreenShareBoardWindow&&(e.id===t.id?(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 t=g.getWindowBounds(parseInt(e.displayId,10));return c.default.screen.screenToDipRect(null,t)}if("darwin"===process.platform)return f.getWindowBounds(parseInt(e.displayId,10))}return this.getDisplay(e).bounds}getDisplay(e){if(e.displayId){const t=c.default.screen.getAllDisplays();if(t.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 i of t)if(i.id.toString()===e.displayId)return i}return this.getCurrentDisplay()}initCacheModule(){let e=this.classUrl,t=e.indexOf(".html");-1!==t&&(t=e.length);const i=e.lastIndexOf("/",t);-1===i?c.default.dialog.showErrorBox("出错",`传入非法URL,课堂无法正常初始化: ${this.classUrl}`):e=e.substring(0,i);try{return S.TIWCacheManager.SetConfig({configUrl:`${e}/cache/tiwcache.json`,configPath:h.default.join(__dirname,"config.json"),resourcePath:h.default.join(__dirname,"resource.zip"),resourceDir:M}).catch((e=>(console.error("TCIC cache init",e),Promise.resolve())))}catch(e){return console.error("TCIC cache init",e),Promise.resolve()}}createAndInitWindow(){console.log("TCIC createAndInitWindow"),this.shouldFullscreen=!1,"win32"===process.platform&&(c.default.systemPreferences.isAeroGlassEnabled()?this.shouldFullscreen=!0:c.default.dialog.showErrorBox("出错","DWM未开启,不支持窗口透明特性")),this.initCacheModule().then((()=>{this.createAndInitMainView(),C.get("autoOpenDevTools")&&this.openDevTools(),this.attachMainViewToDefaultEntryMainWindow(),this.registerIPCEvent()}))}checkHasInitialize(){return!!this.tcicDefaultEntryMainWindow}}},975:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.requestScreenCaptureAccess=t.macOSVersion=t.getWindowBounds=void 0;const a=s(i(124)),c=r(i(420)),d=s(i(728)),l=r(i(451)),h=r(i(747)),u=i(933),w=d.types.void,f=d.types.int,p=d.types.int,S=process.arch.includes("64")?d.types.uint64:d.types.uint32,g=S,W=g,m=g,y=g,M=S,C=d.types.uint32,b=d.types.uint32,v=d.types.int,T=d.types.CString,D=d.types.double,I=l.default({x:D,y:D}),B=l.default({width:D,height:D}),V=l.default({origin:I,size:B}),P=d.refType(V),E=c.default(S);let k,x=null,_=null;if("darwin"===process.platform)try{const e=a.DynamicLibrary("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics");x=a.Library(e,{CGWindowListCopyWindowInfo:[m,[M,C]],CGWindowListCreateDescriptionFromArray:[m,[m]],CGRectMakeWithDictionaryRepresentation:[f,[y,P]],CGWindowListCreateImage:[g,[V,p,p,p]]});const t=a.DynamicLibrary("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation");_=a.Library(t,{CFArrayCreate:[m,[p,E,p,p]],CFStringCreateWithCString:[W,[p,T,b]],CFArrayGetCount:[v,[m]],CFArrayGetValueAtIndex:[g,[m,v]],CFDictionaryGetValue:[g,[y,W]],CFRelease:[w,[g]]})}catch(e){console.error(e)}function A(){if(!k){const e=(e=>{const t=/<key>ProductVersion<\/key>\s*<string>([\d.]+)<\/string>/.exec(e);if(t)return t[1].replace("10.16","11")})(h.default.readFileSync("/System/Library/CoreServices/SystemVersion.plist","utf8"));if(!e)return;k=(e=>{const{length:t}=e.split(".");return 1===t?`${e}.0.0`:2===t?`${e}.0`:e})(e)}return k}t.getWindowBounds=function(e){const t={x:0,y:0,width:0,height:0};if(x&&_)try{const i=new E(1);i[0]=e;const n=_.CFArrayCreate(0,i,i.length,0),o=x.CGWindowListCreateDescriptionFromArray(n);if(0===o)return t;if(_.CFArrayGetCount(o)>0){const e=_.CFArrayGetValueAtIndex(o,0),i=_.CFStringCreateWithCString(0,"kCGWindowBounds",134217984),n=_.CFDictionaryGetValue(e,i),s=new V;x.CGRectMakeWithDictionaryRepresentation(n,s.ref()),t.x=s.origin.x,t.y=s.origin.y,t.width=s.size.width,t.height=s.size.height,_.CFRelease(i)}_.CFRelease(o),_.CFRelease(n)}catch(e){console.error(e)}return console.log("getWindowBounds",JSON.stringify(t)),t},t.macOSVersion=A;let O=!1;t.requestScreenCaptureAccess=function(){if(x&&_)try{const e=A().split(".").map((e=>parseInt(e,10)));if(e[0]<10||10===e[0]&&e[1]<15)return;const t=new V;t.origin.x=0,t.origin.y=0,t.size.width=1,t.size.height=1;const i=x.CGWindowListCreateImage(t,1,0,0);if(_.CFRelease(i),O){const e="security",t="Privacy_ScreenCapture";u.shell.openExternal(`x-apple.systempreferences:com.apple.preference.${e}${t?`?${t}`:""}`)}else O=!0}catch(e){console.error(e)}}},196:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=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 t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TCIC=void 0;const o=i(555),s=i(376);let r=null;t.TCIC={initialize(e){return n(this,void 0,void 0,(function*(){const t=e.onClose;e.onClose=()=>{t&&t(),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=t.TCIC},376:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.crashReportUUID=t.tcicSdkVersion=void 0;const n=i(425);t.tcicSdkVersion="1.3.5.182",t.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:"browser"===process.type}),n.configureScope((e=>{e.setTag("extra.sdk",t.tcicSdkVersion),e.setTag("extra.uuid",t.crashReportUUID)}))},741:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TIWCacheManager=void 0;const o=i(933),s=n(i(747)),r=n(i(622)),a=n(i(605)),c=n(i(211)),d=n(i(138));class l{static EnableCache(e){if(l._enabled=e,l._timer&&(clearTimeout(l._timer),l._timer=null),l._enabled&&l._config&&l._serverConfig){const e=()=>{l.RefreshServerConfig().catch((e=>{console.error(e)})),l._timer=setTimeout(e,1e3*this._serverConfig.interval)};e()}}static SetCallback(e){l._cacheCallback=e}static SetConfig(e){return new Promise(((t,i)=>{l._config=e;const n=l.GetConfigDir(),o=l.GetZipDir(),r=l.GetResourceDir(),a=l.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=l.GetConfigPath(),h=l.GetZipPath();let u=null;s.default.existsSync(c)&&(u=l.LoadServerConfigFromLocalFile(c),l.IsBundleResourceNew(e.configPath,u)&&(l.RemoveDirSync(r),s.default.promises.unlink(c).then(),s.default.existsSync(h)&&s.default.promises.unlink(h).then(),u=null)),u?(console.info("TIWCacheManager use cache files"),l._serverConfig=u,l.EnableCache(!0),t()):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=l.LoadServerConfigFromLocalFile(c);s.default.promises.copyFile(e.resourcePath,h).then((()=>{console.info("TIWCacheManager update resource file");try{l.RemoveDirSync(r),new d.default(h).extractAllTo(r,!0),l._serverConfig=n,l.EnableCache(!0),t()}catch(e){s.default.promises.unlink(c).then(),s.default.promises.unlink(h).then(),console.error("TIWCacheManager resource unzip failed",e),i(e)}})).catch((()=>{i(`TIWCacheManager copyFile file error: ${e.resourcePath}`)}))})).catch((()=>{i(`TIWCacheManager resource file not found: ${e.configPath}`)})):i(`TIWCacheManager resource file not found: ${e.resourcePath}`):i(`TIWCacheManager config file not found: ${e.configPath}`)}))}static RefreshServerConfig(){if(!l._config.configUrl)return Promise.reject("缺少配置文件URL");if(l._isRefreshing)return Promise.reject("上次刷新未完成");l._isRefreshing=!0;const e=l.GetConfigPath(!0),t=l._config.configUrl;return l.HttpRequest(t,null,null,e).then((()=>{const t=l.LoadServerConfigFromLocalFile(e),i=l.GetResourceInfo(t);if(!i)return Promise.reject("新配置缺少可用资源信息");const n=l.GetResourceInfo(l._serverConfig);if(n&&i&&n.version===i.version&&i.devBuildTime>=n.devBuildTime)return Promise.reject(`新配置版本低于老配置版本: ${i.version} < ${n.version}`);console.log("TIWCacheManager new config fetched",t);const o=l.GetZipPath(!0);return l.HttpRequest(i.url,null,null,o).then((()=>{const i=l.GetResourceDir();l.RemoveDirSync(i),new d.default(o).extractAllTo(i,!0);const n=l.GetConfigPath();s.default.unlinkSync(n),s.default.renameSync(e,n);const r=l.GetZipPath();if(s.default.unlinkSync(r),s.default.renameSync(o,r),l._serverConfig=t,console.log("TIWCacheManager resource prepare done"),l._cacheCallback){const e=l._serverConfig.forceUpdate;l._cacheCallback.onTIWCacheUpdateResourceCompleted(e)}return Promise.resolve()})).catch((e=>{s.default.unlinkSync(o),console.error("TIWCacheManager resource fetch failed",e)}))})).catch((t=>{s.default.unlinkSync(e),console.error("TIWCacheManager config fetch failed",t)})).finally((()=>{l._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:l.TIWCacheSchemeHttp,privileges:l.TIWCacheSchemePrivileges},{scheme:l.TIWCacheSchemeHttps,privileges:l.TIWCacheSchemePrivileges}]),!0)}static GetResourcePath(e){if(l._enabled&&l._config&&l._config.resourceDir){const t=l.GetResourceInfo(l._serverConfig);if(t){let i="";do{const n=new URL(e),o=`${n.origin}${n.pathname}`;if(t.files&&t.files.hasOwnProperty(o)){const e=t.files[o];i=e.toLowerCase().startsWith("http")?e:r.default.join(l.GetResourceDir(),e);break}if(!i&&t.regexes)for(const e in t.regexes){let n=t.regexes[e];const s=o.match(e);if(s&&s.length>0){for(let e=1;e<=s.length;++e){const t=new RegExp(`\\$${e}`,"g");n=n.replace(t,s[e])}i=r.default.join(l.GetResourceDir(),n);break}}if(!i&&t.documents)for(const e in t.documents){const n=t.documents[e],a=o.match(e);if(a&&a.length>=3){const e=a[1],t=a[2],c=l.GetDocumentDir();i=o.replace(e,c),s.default.existsSync(i)||l.DownloadDocumentCategory(r.default.join(c,t,n),`${e}/${t}/${n}`);break}}}while(0);return s.default.existsSync(i)?console.log("TIWCacheManager GetResourcePath",e,i):i="",i}}return""}static EnableWebContentsCache(e,t){if(t){const t=(e,t)=>{l.TIWCacheFileMap.has(e.url)?(t({path:l.TIWCacheFileMap.get(e.url)}),l.TIWCacheFileMap.delete(e.url)):t({statusCode:404})};e.session.protocol.registerFileProtocol(l.TIWCacheSchemeHttp,t),e.session.protocol.registerFileProtocol(l.TIWCacheSchemeHttps,t),e.session.webRequest.onBeforeRequest(((e,t)=>{let i=e.url;const n=i.indexOf("://"),o=i.substring(0,n).toLowerCase(),s=i.substring(n);if(o===l.TIWCacheSchemeHttp||o===l.TIWCacheSchemeHttps){if(l.TIWCacheFileMap.has(i))return void t({cancel:!1});i=o===l.TIWCacheSchemeHttp?`http${s}`:`https${s}`}else if("http"!==o&&"https"!==o)return void t({cancel:!1});const r=l.GetResourcePath(i);""===r?t({cancel:!1}):r.startsWith("http")?t({cancel:!1,redirectURL:r}):(i="https"===o||o===l.TIWCacheSchemeHttps?l.TIWCacheSchemeHttps+s:l.TIWCacheSchemeHttp+s,l.TIWCacheFileMap.set(i,r),i===e.url?t({cancel:!1}):t({cancel:!1,redirectURL:i}))}))}else e.session.protocol.unregisterProtocol(l.TIWCacheSchemeHttp),e.session.protocol.unregisterProtocol(l.TIWCacheSchemeHttps),e.session.webRequest.onBeforeSendHeaders(null)}static HttpRequest(e,t,i,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=i?JSON.stringify(i):null,l=d?"POST":"GET";t||(t={}),d&&(t.hasOwnProperty("Content-Type")||(t["Content-Type"]="application/json"),t.hasOwnProperty("Content-Length")||(t["Content-Length"]=d.length.toString()));const h={method:l,headers:t},u=o.request(e,h,(t=>{if(200!==t.statusCode){const i=new Error(`Failed to get '${e}' (${t.statusCode})`);return console.error(i),void a(i)}if(c)t.pipe(c);else{let e="";t.on("data",(t=>{e+=t.toString()})),t.on("end",(()=>{r(e)}))}}));i&&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 t=s.default.readFileSync(e,"utf8");return JSON.parse(t)}static GetResourceInfo(e){const t=`${l._config.sdkAppId}`,i=`${l._config.schoolId}`;let n=e.resources.find((e=>-1!==t.search(e.sdkAppId)&&-1!==i.search(e.schoolId)));return n||(n=e.resources.find((e=>"0"===e.sdkAppId&&"0"===e.schoolId))),n}static GetConfigPath(e){return r.default.join(l.GetConfigDir(),`${e?(+new Date).toString():""}tiwcache.json`)}static GetZipPath(e){return r.default.join(l.GetZipDir(),`${e?(+new Date).toString():""}tiwresource.zip`)}static GetConfigDir(){return r.default.join(l._config.resourceDir,"tiwcache")}static GetLogDir(){return r.default.join(l._config.resourceDir,"tiwcache")}static GetZipDir(){return r.default.join(l._config.resourceDir,"tiwcache")}static GetResourceDir(){return r.default.join(l._config.resourceDir,"tiwcache","resource")}static GetDocumentDir(){return r.default.join(l._config.resourceDir,"tiwcache","document")}static IsBundleResourceNew(e,t){const i=l.LoadServerConfigFromLocalFile(e),n=l.GetResourceInfo(i),o=l.GetResourceInfo(t);return n&&o&&n.devBuildTime>o.devBuildTime}static DownloadDocumentCategory(e,t){if(s.default.existsSync(e))return l.DownloadDocumentFiles(e,t);if(l._documentState.get(t))return Promise.reject("下载中");l._documentState.set(t,!0),console.log("TIWCacheManager document downloading",t);const i=r.default.normalize(e.substring(0,e.lastIndexOf(r.default.sep)+1));return s.default.mkdirSync(i),l.HttpRequest(t,null,null,e).then((()=>(console.log("TIWCacheManager document downloaded",t,e),l.ClearExpiredDocuments(),l.DownloadDocumentFiles(e,t)))).finally((()=>{l._documentState.set(t,!1)}))}static DownloadDocumentFiles(e,t,i=0){let n=l._documentInfo.get(e);if(!n){if(n=l.LoadDocumentInfoFromLocalFile(e,t),!n)return Promise.reject("课件文件列表解析失败");n.files.sort(((e,t)=>e.priority-t.priority)),console.log("TIWCacheManager document info",t,n),l._documentInfo.set(e,n)}if(i>=n.files.length)return Promise.resolve();const o=n.files[i];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",t,i),l.HttpRequest(o.url,null,null,o.path).then((()=>(console.log("TIWCacheManager document file downloaded",t,i,o),l.DownloadDocumentFiles(e,t,i+1))))}return l.DownloadDocumentFiles(e,t,i+1)}static LoadDocumentInfoFromLocalFile(e,t){const i=s.default.readFileSync(e,"utf-8"),n=JSON.parse(i);n.path=e,n.url=t;const o=e.substring(0,e.lastIndexOf(r.default.sep)+1),a=t.substring(0,t.lastIndexOf("/")+1);return n.files.forEach((e=>{e.path=r.default.join(o,e.name),e.url=`${a}/${e.name}`})),n}static RemoveDirSync(e,t){if(!s.default.existsSync(e))return!0;let i=!0;return s.default.readdirSync(e).forEach((n=>{const o=r.default.join(e,n),a=s.default.statSync(o);!t||t(a)?a.isDirectory()?l.RemoveDirSync(o)||(i=!1):s.default.unlinkSync(o):a.isDirectory()&&l.RemoveDirSync(o,t)||(i=!1)})),!!i&&(s.default.rmdirSync(e),!0)}static ClearExpiredDocuments(){const e=new Date;l.RemoveDirSync(l.GetDocumentDir(),(t=>!t.isDirectory()||new Date(t.atime.getTime()+2592e5)<e))}}t.TIWCacheManager=l,l.TIWCacheSchemeHttp="tiw-cache",l.TIWCacheSchemeHttps="tiw-caches",l.TIWCacheSchemePrivileges={standard:!0,secure:!0,bypassCSP:!0,allowServiceWorkers:!0,supportFetchAPI:!0,corsEnabled:!0,stream:!1},l.TIWCacheFileMap=new Map,l._enabled=!1,l._timer=null,l._isRefreshing=!1,l._documentState=new Map,l._documentInfo=new Map,l._cacheCallback=null},450:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.httpRequest=void 0;const o=n(i(211)),s=n(i(605)),r=n(i(747));t.httpRequest=function(e,t,i,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=i?JSON.stringify(i):null,l=d?"POST":"GET";t||(t={}),d&&(t.hasOwnProperty("Content-Type")||(t["Content-Type"]="application/json"),t.hasOwnProperty("Content-Length")||(t["Content-Length"]=d.length.toString()));const h={method:l,headers:t},u=a.request(e,h,(t=>{if(200!==t.statusCode){const i=new Error(`Failed to get '${e}' (${t.statusCode})`);return console.error(i),void s(i)}if(c)t.pipe(c);else{let e="";t.on("data",(t=>{e+=t.toString()})),t.on("end",(()=>{o(e)}))}}));i&&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,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&n(t,e,i);return o(t,e),t},r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=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 t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isWin7=t.getDesktopBounds=t.getWindowBounds=t.setThickFrame=t.setShowTaskbarOnMultipleDisplays=t.isShowTaskbarOnMultipleDisplays=t.setTaskbarAutoHiddenInTabletEnabled=t.isTaskbarAutoHiddenInTabletEnabled=t.setTaskbarAutoHiddenInDesktopEnabled=t.isTaskbarAutoHiddenInDesktopEnabled=t.getPrimaryDisplaySize=t.getMaxTouches=t.getDesktopPath=void 0;const c=a(i(124)),d=a(i(747)),l=s(i(87)),h=a(i(622)),u=a(i(728)),w=a(i(451)),f=a(i(26)),p=u.default.types.bool,S=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,T=b,D=b,I=w.default({left:m,top:m,right:m,bottom:m}),B=u.default.refType(I),V=w.default({cbSize:M,hWnd:D,uCallbackMessage:g,uEdge:g,rc:I,lParam:C}),P=u.default.refType(V);let E=null,k=null;if("win32"===process.platform)try{E=c.default.Library("user32",{SendNotifyMessageA:[p,[D,g,W,"string"]],GetSystemMetrics:[S,[S]],FindWindowA:[D,["string",m]],GetWindowLongA:[m,[D,S]],SetWindowLongA:[m,[D,S,m]],GetWindowRect:[p,[D,B]],EnumDisplayMonitors:[p,[T,m,"pointer",C]]}),k=c.default.Library("shell32",{SHAppBarMessage:[g,[g,P]]})}catch(e){console.error(e)}const x=function(e){return new Promise(((t,i)=>{const n={};f.default.list(e).on("data",(e=>{n[e.key]=e.data})).on("finish",(()=>{t(n)})).on("error",(e=>{i(e)}))}))},_=function(e){return new Promise(((t,i)=>{f.default.putValue(e,(e=>{e&&i(e),t()}))}))},A=function(){E&&E.SendNotifyMessageA(65535,26,0,"TraySettings")};t.getDesktopPath=function(){return r(this,void 0,void 0,(function*(){let e=h.default.join(l.homedir(),"Desktop"),t=d.default.existsSync(e);if("win32"===process.platform&&!t){const i="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",[n,o]=yield x(i).then((e=>[null,e])).catch((e=>[e,null]));if(!n&&o)try{t=!0,e=o[i].values.Desktop.value}catch(e){}}return t?e:""}))},t.getMaxTouches=function(){if(E){const e=95;return E.GetSystemMetrics(e)}return 0},t.getPrimaryDisplaySize=function(){if(E){const e=0,t=1;return{width:E.GetSystemMetrics(e),height:E.GetSystemMetrics(t)}}return null},t.isTaskbarAutoHiddenInDesktopEnabled=function(){return r(this,void 0,void 0,(function*(){if(k){const e=new V;return e.cbSize=V.size,1===k.SHAppBarMessage(4,e.ref())}return!1}))},t.setTaskbarAutoHiddenInDesktopEnabled=function(e){return r(this,void 0,void 0,(function*(){if(E&&k){const t=new V;return t.cbSize=V.size,t.hWnd=E.FindWindowA("Shell_TrayWnd",0),t.lParam=e?1:0,k.SHAppBarMessage(10,t.ref()),!0}return!1}))},t.isTaskbarAutoHiddenInTabletEnabled=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[t,i]=yield x(e).then((e=>[null,e])).catch((e=>[e,null]));if(!t&&i)try{return!!i[e].values.TaskbarAutoHideInTabletMode.value}catch(e){}}return!1}))},t.setTaskbarAutoHiddenInTabletEnabled=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const t={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{TaskbarAutoHideInTabletMode:{value:e?1:0,type:"REG_DWORD"}}};return yield _(t),A(),!0}catch(e){}return!1}))},t.isShowTaskbarOnMultipleDisplays=function(){return r(this,void 0,void 0,(function*(){if("win32"===process.platform){const e="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",[t,i]=yield x(e).then((e=>[null,e])).catch((e=>[e,null]));if(!t&&i)try{return!!i[e].values.MMTaskbarEnabled.value}catch(e){}}return!1}))},t.setShowTaskbarOnMultipleDisplays=function(e){return r(this,void 0,void 0,(function*(){if("win32"===process.platform)try{const t={"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced":{MMTaskbarEnabled:{value:e?1:0,type:"REG_DWORD"}}};return yield _(t),A(),!0}catch(e){}return!1}))},t.setThickFrame=function(e,t){return r(this,void 0,void 0,(function*(){if(E){const i=parseInt(e.getMediaSourceId().split(":")[1],10),n=E.GetWindowLongA(i,-16),o=t?262144|n:-262145&n;return E.SetWindowLongA(i,-16,o),!0}return!1}))},t.getWindowBounds=function(e){const t={x:0,y:0,width:0,height:0};if(E){const i=new I;E.GetWindowRect(e,i.ref())&&(t.x=i.left,t.y=i.top,t.width=i.right-i.left,t.height=i.bottom-i.top)}return t};const O=new Map;t.getDesktopBounds=function(e){let t=O.get(e);if(t)return t;if(t={x:0,y:0,width:0,height:0},E){let i=0;const n=e,o=c.default.Callback(p,[v,T,B,C],((e,o,s,r)=>{if(i+=1,i===n){const e=s.deref();return t.x=e.left,t.y=e.top,t.width=e.right-e.left,t.height=e.bottom-e.top,!1}return!0}));E.EnumDisplayMonitors(0,0,o,0)}return O.set(e,t),t},t.isWin7=function(){const e=l.release().split(".");if(e.length>=3){const t=parseInt(e[0],10),i=parseInt(e[1],10);return!(t>=10||6===t&&i>=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")}},t={};return function i(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),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]}),
|
|
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{a(o.next(e))}catch(e){r(e)}}function d(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,d)}a((o=o.apply(e,n||[])).next())}))},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const a=r(t(933)),c=d(t(747)),l=d(t(622)),u=d(t(881)),p=d(t(104)),w=r(t(795)),C=r(t(280)),h=t(376);let S=0,T="";const f="TStateScreenShareBoardUndo",v="TStateScreenShareBoardRedo";window.TRTCCloud=p.default,window.TRTCDefine=w,window.Electron={getPlatform:()=>process.platform,hasScreenCapturePermission:()=>a.ipcRenderer.invoke("hasScreenCapturePermission"),openSystemPreferences:()=>a.ipcRenderer.invoke("openSystemPreferences"),getExcludeSelectWindows:()=>a.ipcRenderer.invoke("getExcludeSelectWindows"),getClientInfo:()=>({sdkVersion:h.tcicSdkVersion,crashReportUUID:h.crashReportUUID}),getSystemInfo:e=>a.ipcRenderer.invoke("getSystemInfo",e),sendCustomMessage(e){a.ipcRenderer.send("onRecvCustomMessage",e)},reloadWindow(e,n){a.ipcRenderer.send("onReloadWindow",e,n)},onPageFinished(e){a.ipcRenderer.send("onPageFinished",e)},closeWindow(){if(window.TCIC){const e=window.TCIC.SDK.instance.getState(window.TCIC.TMainState.Class_Status),n=m(e);n!==T&&a.ipcRenderer.send(n)}a.ipcRenderer.send("onCloseWindow",0)},minimizeWindow(){a.ipcRenderer.send("onMinimizeWindow",0)},maximizeWindow(){a.ipcRenderer.send("onMaximizeWindow",0)},openUrl(e){a.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),a.ipcRenderer.invoke("startScreenShare",e)}))},stopScreenShare:()=>a.ipcRenderer.invoke("stopScreenShare"),callMethod(e){a.ipcRenderer.send("callMethod",e),"board"===e.module&&"setToolType"===e.method&&(S=e.params[0])},saveSnapshot(e,n,t){n=n.replace(/^data:image\/\w+;base64,/,"");const o=Buffer.from(n,"base64");return new Promise(((i,r)=>s(this,void 0,void 0,(function*(){const s=yield a.ipcRenderer.invoke("getDesktopPath");s?c.default.writeFile(s+l.default.sep+t,o,(o=>{o?r({snapId:e,module:"electron",errcode:-5,errmsg:o.message}):i({snapId:e,snapName:t,totalSlices:1,totalSize:n.length,sliceIndex:0,sliceSize:n.length})})):r({snapId:e,module:"electron",errcode:-5,errmsg:"failed to get desktop path"})}))))},checkDNSParsing:e=>new Promise((n=>{const t=Date.now();u.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.x,y:t.y,width:t.width,height:t.height};return a.ipcRenderer.invoke("loadVideo",{bounds:o,url:n})},playVideo:()=>a.ipcRenderer.invoke("playVideo"),pauseVideo:()=>a.ipcRenderer.invoke("pauseVideo"),stopVideo:()=>a.ipcRenderer.invoke("stopVideo"),seekVideo:e=>a.ipcRenderer.invoke("seekVideo",e),setVideoVolume:e=>a.ipcRenderer.invoke("setVideoVolume",e),setVideoBounds:e=>a.ipcRenderer.invoke("setVideoBounds",{left:e.left,top:e.top,width:e.width,height:e.height}),downloadMusic:e=>a.ipcRenderer.invoke("downloadMusic",e)};const m=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)=>{a.ipcRenderer.on("init",((n,t)=>{console.log("init",t),window.TCIC&&(window.TCIC.SDK.instance.registerState(f,"屏幕共享白板撤销状态",!1),window.TCIC.SDK.instance.registerState(v,"屏幕共享白板重做状态",!1),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Layout,(e=>{a.ipcRenderer.send("onClassLayoutChanged",e)})),window.TCIC.SDK.instance.subscribeState(window.TCIC.TMainState.Class_Status,(e=>{T=m(e),a.ipcRenderer.send(T)})),window.TCIC.SDK.instance.on(window.TCIC.TMainEvent.Start_Class,(()=>{})),window.TCIC.SDK.instance.on(window.TCIC.TMainEvent.Stop_Class,(()=>{}))),e(t)})),a.ipcRenderer.on("onScreenShareSnapshot",((e,n)=>{window.screenShareSnapshotCallback&&window.screenShareSnapshotCallback(n)})),a.ipcRenderer.on("leaveClass",(e=>{window.TCIC?window.TCIC.SDK.instance.leaveClass():window.Electron.closeWindow()})),a.ipcRenderer.on("sendCustomMessage",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.notify(window.TCIC.TMainEvent.Recv_Custom_Msg,n)})),a.ipcRenderer.on("onBoardCanRedoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(v,n)})),a.ipcRenderer.on("onBoardCanUndoChange",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(f,n)})),a.ipcRenderer.on("onVideoTimeUpdate",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Update,n)})),a.ipcRenderer.on("onVideoTimeSeeked",((e,n)=>{window.TCIC&&window.TCIC.SDK.instance.setState(window.TCIC.TMainState.Vod_Time_Seeked,n)}))})).then((e=>{setTimeout((()=>{!function(e){const n="touchstart",t=()=>{window.removeEventListener(n,t,!0),a.ipcRenderer.send("enableTouchScreenOptimize");const e=["touchstart","touchmove","touchend","mousedown","mousemove","mouseup"];a.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.3.5.182",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:"browser"===process.type}),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")},747:e=>{e.exports=require("fs")},622:e=>{e.exports=require("path")},104:e=>{e.exports=require("tcic-trtc-electron-sdk")},795:e=>{e.exports=require("tcic-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/dist/video.html
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<style>
|
|
6
|
+
* {
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
}
|
|
10
|
+
html, body, div, video {
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
background: black;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<div>
|
|
20
|
+
<video id="video"></video>
|
|
21
|
+
</div>
|
|
22
|
+
</body>
|
|
23
|
+
<script src="./videoRenderer.bundle.js"></script>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={933:e=>{e.exports=require("electron")}},i={};function t(n){var o=i[n];if(void 0!==o)return o.exports;var d=i[n]={exports:{}};return e[n](d,d.exports,t),d.exports}(()=>{const e=t(933);class i{constructor(){this._videoElement=document.getElementById("video"),this._videoElement.addEventListener("timeupdate",(()=>{this.onVideoTimeUpdate()})),this._videoElement.addEventListener("durationchange",(()=>{this.onVideoTimeUpdate()})),this._videoElement.addEventListener("seeked",(()=>{this.onVideoTimeSeeked()})),this._videoElement.addEventListener("canplay",(()=>{e.ipcRenderer.send("canplay",{width:this._videoElement.videoWidth,height:this._videoElement.videoHeight}),this.onVideoTimeUpdate()}))}static get instance(){return null===this._instance&&(this._instance=new i),this._instance}loadVideo(e){this._videoElement.src=e}playVideo(){this._videoElement.play()}pauseVideo(){this._videoElement.pause()}stopVideo(){this._videoElement.stop()}seekVideo(e){this._videoElement.currentTime=e}setVideoVolume(e){this._videoElement.volume=e}setVideoBounds(e){this._videoElement.style.left=e.left,this._videoElement.style.top=e.top,this._videoElement.style.width=e.width,this._videoElement.style.height=e.height}onVideoTimeUpdate(){const i=this._videoElement.duration,t=this._videoElement.currentTime;i&&e.ipcRenderer.send("onVideoTimeUpdate",{duration:Math.floor(i),currentTime:Math.floor(t)})}onVideoTimeSeeked(){const i=this._videoElement.duration,t=this._videoElement.currentTime;i&&e.ipcRenderer.send("onVideoTimeSeeked",{duration:Math.floor(i),currentTime:Math.floor(t)})}}i._instance=null,e.ipcRenderer.on("loadVideo",((e,t)=>{i.instance.loadVideo(t)})),e.ipcRenderer.on("playVideo",(e=>{i.instance.playVideo()})),e.ipcRenderer.on("pauseVideo",(e=>{i.instance.pauseVideo()})),e.ipcRenderer.on("stopVideo",(e=>{i.instance.stopVideo()})),e.ipcRenderer.on("seekVideo",((e,t)=>{i.instance.seekVideo(t)})),e.ipcRenderer.on("setVideoVolume",((e,t)=>{i.instance.setVideoVolume(t)})),e.ipcRenderer.on("setVideoBounds",((e,t)=>{i.instance.setVideoBounds(t)}))})()})();
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tcic-electron-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.182",
|
|
4
4
|
"description": "腾讯云课堂aPaaS",
|
|
5
5
|
"main": "./dist/main.bundle.js",
|
|
6
6
|
"author": "Tencent",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "webpack --config webpack.prod.js",
|
|
10
|
+
"build-dev": "webpack --config webpack.dev.js",
|
|
10
11
|
"start": "webpack --config webpack.dev.js && electron ./demo",
|
|
11
12
|
"start-local": "webpack --config webpack.dev.js && electron ./demo --local",
|
|
12
13
|
"version": "node scripts/setVersion.js",
|
|
@@ -23,6 +24,8 @@
|
|
|
23
24
|
"adm-zip": "^0.5.5",
|
|
24
25
|
"electron-store": "^8.0.0",
|
|
25
26
|
"ffi-napi": "^4.0.3",
|
|
27
|
+
"i18next": "^21.2.0",
|
|
28
|
+
"i18next-resources-to-backend": "^1.0.0",
|
|
26
29
|
"node-machine-id": "^1.1.12",
|
|
27
30
|
"ref-array-napi": "^1.2.2",
|
|
28
31
|
"ref-napi": "^3.0.2",
|