UNPKG

@cinc101/electron-capture

Version:

Electron multi-screen screenshot plugin with annotation and multi-language support.

1 lines 39.5 kB
module.exports = "<!-- capture.html -->\r\n<!doctype html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\"/>\r\n <title>Capture Screen Area</title>\r\n <style>\r\n .panels {\r\n display: flex;\r\n column-gap: 16px;\r\n }\r\n .color-block {\r\n width: 16px;\r\n height: 16px;\r\n cursor: pointer;\r\n box-sizing: border-box;\r\n position: relative;\r\n }\r\n\r\n .color-block::after {\r\n content: '';\r\n display: none;\r\n position: absolute;\r\n width: 8px;\r\n height: 8px;\r\n background: #fff;\r\n top: 4px;\r\n left: 4px;\r\n }\r\n\r\n .color-block:hover::after {\r\n display: block;\r\n }\r\n\r\n .color-block.selected::after {\r\n display: block;\r\n }\r\n\r\n .line-dot {\r\n border-radius: 50%;\r\n background: gray;\r\n cursor: pointer;\r\n }\r\n\r\n .line-dot.selected, .line-dot:hover {\r\n background-color: #00b400;\r\n }\r\n\r\n #screenshot-editor-toolbar button {\r\n background: none;\r\n border: none;\r\n cursor: pointer;\r\n width: 20px;\r\n height: 20px;\r\n box-sizing: content-box;\r\n margin-right: 15px;\r\n }\r\n\r\n #screenshot-editor-toolbar button img {\r\n width: 20px;\r\n height: 20px;\r\n }\r\n\r\n #screenshot-editor-toolbar button[disabled] {\r\n cursor: not-allowed;\r\n }\r\n\r\n #screenshot-editor-toolbar button[disabled] img {\r\n filter: grayscale(100%) brightness(1.4);\r\n }\r\n </style>\r\n</head>\r\n<body>\r\n<div\r\n id=\"overlay\"\r\n style=\"\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100vw;\r\n height: 100vh;\r\n box-sizing: border-box;\r\n background-color: transparent;\r\n \"\r\n></div>\r\n<div id=\"draw-config-panel\" style=\"\r\n position: absolute;\r\n display: none;\r\n background: #fff;\r\n border: 1px solid #ccc;\r\n border-radius: 4px;\r\n padding: 8px;\r\n z-index: 99999;\r\n font-size: 12px;\r\n box-shadow: 0 2px 10px rgba(0,0,0,0.15);\r\n\">\r\n <div class=\"panels\">\r\n <div id=\"lineWidthOptions\" style=\"display: flex; gap: 10px; align-items: center;\">\r\n <div class=\"line-dot\" data-width=\"2\" style=\"width: 7px; height: 7px;\"></div>\r\n <div class=\"line-dot\" data-width=\"4\" style=\"width: 10px; height: 10px;\"></div>\r\n <div class=\"line-dot\" data-width=\"6\" style=\"width: 13px; height: 13px;\"></div>\r\n </div>\r\n <div id=\"colorOptions\" style=\"display: flex; gap: 6px;\">\r\n <div class=\"color-block\" data-color=\"#ff4d4f\" style=\"background: #ff4d4f;\"></div>\r\n <div class=\"color-block\" data-color=\"#fadb14\" style=\"background: #fadb14;\"></div>\r\n <div class=\"color-block\" data-color=\"#1890ff\" style=\"background: #1890ff;\"></div>\r\n <div class=\"color-block\" data-color=\"#52c41a\" style=\"background: #52c41a;\"></div>\r\n <div class=\"color-block\" data-color=\"#000000\" style=\"background: #000000;\"></div>\r\n </div>\r\n </div>\r\n</div>\r\n<script>var CaptureApp;(()=>{\"use strict\";var t={819:t=>{t.exports=require(\"electron\")}},e={};function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:\"undefined\"!=typeof Symbol&&t[Symbol.iterator]||t[\"@@iterator\"];if(null!=n){var i,o,a,c,l=[],r=!0,d=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;r=!1}else for(;!(r=(i=a.call(n)).done)&&(l.push(i.value),l.length!==e);r=!0);}catch(t){d=!0,o=t}finally{try{if(!r&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(d)throw o}}return l}}(t,e)||o(t,e)||function(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}function i(t,e){var n=\"undefined\"!=typeof Symbol&&t[Symbol.iterator]||t[\"@@iterator\"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&\"number\"==typeof t.length){n&&(t=n);var i=0,a=function(){};return{s:a,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:a}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var c,l=!0,r=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){r=!0,c=t},f:function(){try{l||null==n.return||n.return()}finally{if(r)throw c}}}}function o(t,e){if(t){if(\"string\"==typeof t)return a(t,e);var n={}.toString.call(t).slice(8,-1);return\"Object\"===n&&t.constructor&&(n=t.constructor.name),\"Map\"===n||\"Set\"===n?Array.from(t):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var c,l,r,d,s,u,h=function n(i){var o=e[i];if(void 0!==o)return o.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}(819).ipcRenderer,p=function(t){return\"screenshot-plugin/\".concat(t)},m=\"zh\",y={zh:{rect:\"方框\",ellipse:\"椭圆\",arrow:\"箭头\",pen:\"画笔\",mosaic:\"马赛克\",text:\"文字\",undo:\"撤销\",download:\"下载\",cancel:\"退出\",confirm:\"完成\",fontSizeSmall:\"\",fontSizeMedium:\"\",fontSizeLarge:\"\"},en:{rect:\"Rectangle\",ellipse:\"Ellipse\",arrow:\"Arrow\",pen:\"Pen\",mosaic:\"Mosaic\",text:\"Text\",undo:\"Undo\",download:\"Download\",cancel:\"Cancel\",confirm:\"Confirm\",fontSizeSmall:\"Small\",fontSizeMedium:\"Medium\",fontSizeLarge:\"Large\"}},g=null,f=null,v=!1,w=!1,b=null,x=0,I=0,M=null,S=0,C=0,D=!1,z=[],T=!1,k=0,N=0,W=[],P={strokeColor:\"#ff4d4f\",lineWidth:2,fontSize:18},A=!1,Y=!1,L=null,Z=!1,E=0,H=0,R=null,j=null,B=\"#07c160\";window.onload=function(){console.log(\"1111\"),v=!0,dt(),st(),h.send(p(\"capture-window-ready\"))};var J=ot(\"div\",\"screenshot-editor-toolbar\",{position:\"absolute\",zIndex:99999,background:\"#fff\",borderRadius:\"6px\",padding:\"10px 0 10px 15px\",boxShadow:\"0 2px 10px rgba(0,0,0,0.2)\",display:\"none\",color:\"#333\",fontFamily:\"sans-serif\",height:\"20px\",minWidth:\"320px\",whiteSpace:\"nowrap\",overflow:\"visible\"});document.body.appendChild(J);var _=ot(\"div\",\"text-config-panel\",{position:\"absolute\",zIndex:99999,background:\"#fff\",border:\"1px solid #ccc\",padding:\"6px 10px\",borderRadius:\"4px\",display:\"none\",fontSize:\"14px\"});document.body.appendChild(_),st();var G=document.getElementById(\"overlay\"),X=null,O=ot(\"canvas\",null,{position:\"fixed\",border:\"none\",zIndex:9999,pointerEvents:\"none\",display:\"block\"});O.width=150,O.height=190,document.body.appendChild(O);var Q=O.getContext(\"2d\"),V=document.querySelectorAll(\"#colorOptions .color-block\");V.forEach((function(t){t.addEventListener(\"click\",(function(){V.forEach((function(t){return t.classList.remove(\"selected\")})),t.classList.add(\"selected\"),P.strokeColor=t.dataset.color}))}));var U=document.querySelectorAll(\"#lineWidthOptions .line-dot\");function F(){var t=document.getElementById(\"draw-config-panel\");t&&(t.style.display=\"none\")}function q(){h.send(p(\"screenshot-window-unlock\")),R&&(R.remove(),R=null,j=null),g&&(g.remove(),g=null,f=null),window._markupContainer&&(window._markupContainer.remove(),window._markupContainer=null),W=[],(z=[]).push(JSON.parse(JSON.stringify(W))),s&&(s.remove(),s=null),O&&(O.style.display=\"none\"),J.style.display=\"none\",window._captureMaskCanvas&&(window._captureMaskCanvas.remove(),window._captureMaskCanvas=null,window._captureMaskCtx=null),h.send(p(\"capture-cancel\")),A=!1,Y=!1,Z=!1,L=\"\",P={strokeColor:\"red\",lineWidth:2},c=0,l=0,r=0,d=0,window._captureTempData=null,document.body.style.backgroundImage=\"none\"}function K(t){var e=window._captureMaskCanvas,n=window._captureMaskCtx;e&&n&&(e.width=window.innerWidth,e.height=window.innerHeight,n.clearRect(0,0,e.width,e.height),n.fillStyle=\"rgba(0, 0, 0, 0.2)\",n.fillRect(0,0,e.width,e.height),n.globalCompositeOperation=\"destination-out\",n.fillStyle=\"rgba(0, 0, 0, 1)\",n.fillRect(t.x,t.y,t.width,t.height),n.globalCompositeOperation=\"source-over\",n.strokeStyle=B||\"#409EFF\",n.lineWidth=2,n.strokeRect(t.x+1,t.y+1,t.width-2,t.height-2))}function $(){var t=window._markupContainer;if(t){t.innerHTML=\"\";var e,o=i(W);try{var a=function(){var o=e.value,a=ot(\"div\",null,{position:\"absolute\",left:\"\".concat(o.x,\"px\"),top:\"\".concat(o.y,\"px\"),cursor:\"move\",pointerEvents:\"auto\"});if(a.className=\"markup-item\",a.setAttribute(\"draggable\",\"false\"),a.dataset.index=W.indexOf(o),a.addEventListener(\"mousedown\",(function(t){t.stopPropagation();var e=a.getBoundingClientRect();(t.clientX<=e.left+6||t.clientX>=e.right-6||t.clientY<=e.top+6||t.clientY>=e.bottom-6)&&(M=a,S=t.clientX-a.offsetLeft,C=t.clientY-a.offsetTop,D=!0)})),\"rect\"===o.mode)a.style.left=\"\".concat(o.x,\"px\"),a.style.top=\"\".concat(o.y,\"px\"),a.style.width=\"\".concat(o.w,\"px\"),a.style.height=\"\".concat(o.h,\"px\"),a.style.border=\"\".concat(o.width,\"px solid \").concat(o.color),a.style.background=\"transparent\",a.style.pointerEvents=\"none\",a.style.boxSizing=\"border-box\",a.style.cursor=\"default\";else if(\"ellipse\"===o.mode)a.style.width=\"\".concat(o.w,\"px\"),a.style.height=\"\".concat(o.h,\"px\"),a.style.border=\"\".concat(o.width,\"px solid \").concat(o.color),a.style.borderRadius=\"50%\",a.style.background=\"transparent\",a.style.pointerEvents=\"none\",a.style.boxSizing=\"border-box\",a.style.cursor=\"default\";else if(\"text\"===o.mode)a.textContent=o.text,a.style.font=\"\".concat(o.fontWeight||\"400\",\" \").concat(o.fontSize,\"px sans-serif\"),a.style.color=o.color,a.style.background=\"transparent\",a.style.padding=\"2px 4px\";else if(\"arrow\"===o.mode){var c=document.createElement(\"canvas\");c.width=window.innerWidth,c.height=window.innerHeight,c.style.cssText=\"\\n position: absolute;\\n left: 0;\\n top: 0;\\n pointer-events: none;\\n z-index: 9986;\\n \";var l=c.getContext(\"2d\");l.strokeStyle=o.color,l.lineWidth=o.width,at(l,o.x1,o.y1,o.x2,o.y2,o.color,o.width),t.appendChild(c)}else if(\"pen\"===o.mode){var r=document.createElement(\"canvas\");r.width=window.innerWidth,r.height=window.innerHeight,r.style.cssText=\"\\n position: absolute;\\n left: 0;\\n top: 0;\\n pointer-events: none;\\n z-index: 9986;\\n \";var d=r.getContext(\"2d\");if(d.strokeStyle=o.color,d.lineWidth=o.width,d.beginPath(),o.path&&o.path.length>0){d.moveTo(o.path[0].x,o.path[0].y);for(var s=1;s<o.path.length;s++)d.lineTo(o.path[s].x,o.path[s].y)}d.stroke(),t.appendChild(r)}else if(\"mosaic\"===o.mode){var u=document.createElement(\"canvas\");u.width=window.innerWidth,u.height=window.innerHeight,u.style.cssText=\"\\n position: absolute;\\n left: 0;\\n top: 0;\\n pointer-events: none;\\n z-index: 9986;\\n \";var h=u.getContext(\"2d\"),p=window._captureHiddenCtx,m=4*o.width;if(o.path&&p){var y,g=i(o.path);try{for(g.s();!(y=g.n()).done;){var f=y.value,v=n(p.getImageData(f.x,f.y,1,1).data,3),w=v[0],b=v[1],x=v[2];h.fillStyle=\"rgb(\".concat(w,\", \").concat(b,\", \").concat(x,\")\"),h.fillRect(f.x-m/2,f.y-m/2,m,m)}}catch(t){g.e(t)}finally{g.f()}}t.appendChild(u)}t.appendChild(a)};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}}function tt(){var t=document.getElementById(\"undoBtn\");t&&(t.disabled=0===W.length)}function et(t,e){var n=J.getBoundingClientRect(),i=t.offsetHeight||50,o=n.bottom+6,a=n.top-i-6,c=o+i>window.innerHeight?a:o,l=e.offsetLeft,r=n.left+l;t.style.left=\"\".concat(r,\"px\"),t.style.top=\"\".concat(c,\"px\")}function nt(){var t,e=null===(t=s)||void 0===t?void 0:t.getBoundingClientRect();return e?{x:Math.round(e.left),y:Math.round(e.top),width:Math.round(e.width),height:Math.round(e.height)}:null}function it(t,e,n,i){var o=J.offsetWidth||200,a=J.offsetHeight||40,c=t+n/2,l=e+i+10;l+a>window.innerHeight&&(l=e-a-10);var r=window.innerWidth-o-10,d=!0;c-o/2<10?(c=10,d=!1):c+o/2>window.innerWidth-10&&(c=r,d=!1),J.style.left=\"\".concat(c,\"px\"),J.style.top=\"\".concat(l,\"px\"),J.style.transform=d?\"translateX(-50%)\":\"none\"}function ot(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return e&&(i.id=e),Object.assign(i.style,n),i}function at(t,e,n,i,o,a,c){var l=10+1.5*c,r=Math.atan2(o-n,i-e),d=Math.PI/9,s=i-.5*l*Math.cos(r),u=o-.5*l*Math.sin(r);t.beginPath(),t.moveTo(e,n),t.lineTo(s,u),t.strokeStyle=a,t.lineWidth=c,t.stroke(),t.beginPath(),t.moveTo(i,o),t.lineTo(i-l*Math.cos(r-d),o-l*Math.sin(r-d)),t.lineTo(i-l*Math.cos(r+d),o-l*Math.sin(r+d)),t.closePath(),t.fillStyle=a,t.fill()}function ct(t){var e=5*t,n=document.createElement(\"canvas\");n.width=e,n.height=e;var i=n.getContext(\"2d\");return i.clearRect(0,0,e,e),i.beginPath(),i.arc(e/2,e/2,e/2-2,0,2*Math.PI),i.strokeStyle=\"rgba(0, 0, 0, 0.7)\",i.lineWidth=2,i.stroke(),n.toDataURL(\"image/png\")}function lt(){var t=(window._captureTempData||{}).cropRegion,e=window._captureHiddenCanvas;if(!e||!t)return console.warn(\"缺少截图源或区域\"),null;var o=document.createElement(\"canvas\");o.width=t.width,o.height=t.height;var a=o.getContext(\"2d\");return a.drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),window._markupContainer&&window._markupContainer.querySelectorAll(\".markup-item\").forEach((function(e){var o=parseInt(e.dataset.index,10),c=W[o];if(c){var l=c.x-t.x,r=c.y-t.y;if(a.save(),\"rect\"===c.mode)a.strokeStyle=c.color,a.lineWidth=c.width,a.strokeRect(l,r,c.w,c.h);else if(\"ellipse\"===c.mode)a.strokeStyle=c.color,a.lineWidth=c.width,a.beginPath(),a.ellipse(l+c.w/2,r+c.h/2,c.w/2,c.h/2,0,0,2*Math.PI),a.stroke();else if(\"text\"===c.mode)a.font=\"\".concat(c.fontWeight||\"400\",\" \").concat(c.fontSize,\"px sans-serif\"),a.fillStyle=c.color,a.fillText(c.text,l,r+c.fontSize);else if(\"arrow\"===c.mode)a.strokeStyle=c.color,a.lineWidth=c.width,at(a,c.x1-t.x,c.y1-t.y,c.x2-t.x,c.y2-t.y,c.color,c.width);else if(\"pen\"===c.mode){if(a.strokeStyle=c.color,a.lineWidth=c.width,a.beginPath(),c.path&&c.path.length>0){a.moveTo(c.path[0].x-t.x,c.path[0].y-t.y);for(var d=1;d<c.path.length;d++)a.lineTo(c.path[d].x-t.x,c.path[d].y-t.y)}a.stroke()}else if(\"mosaic\"===c.mode){var s=window._captureHiddenCtx,u=4*c.width;if(c.path&&s){var h,p=i(c.path);try{for(p.s();!(h=p.n()).done;){var m=h.value,y=n(s.getImageData(m.x,m.y,1,1).data,3),g=y[0],f=y[1],v=y[2];a.fillStyle=\"rgb(\".concat(g,\", \").concat(f,\", \").concat(v,\")\"),a.fillRect(m.x-t.x-u/2,m.y-t.y-u/2,u,u)}}catch(t){p.e(t)}finally{p.f()}}}a.restore()}})),o.toDataURL(\"image/png\")}function rt(){window._captureMaskCanvas&&(window._captureMaskCanvas.remove(),window._captureMaskCanvas=null,window._captureMaskCtx=null),J.style.display=\"none\";var t=(window._captureTempData||{}).cropRegion;if(window._captureHiddenCanvas&&t){var e=lt();e&&(q(),setTimeout((function(){h.send(p(\"capture-done\"),e)}),0))}else console.warn(\"缺少截图源或区域\")}function dt(){J.innerHTML='\\n <button data-action=\"rect\" title=\"'.concat(y[m].rect,'\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZD0iTTQxNiA0NDhIOTZhMzIuMDkgMzIuMDkgMCAwMS0zMi0zMlY5NmEzMi4wOSAzMi4wOSAwIDAxMzItMzJoMzIwYTMyLjA5IDMyLjA5IDAgMDEzMiAzMnYzMjBhMzIuMDkgMzIuMDkgMCAwMS0zMiAzMnoiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMzIiLz48L3N2Zz4=\",'\" /></button>\\n <button data-action=\"ellipse\" title=\"').concat(y[m].ellipse,'\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZD0iTTQ0OCAyNTZjMC0xMDYtODYtMTkyLTE5Mi0xOTJTNjQgMTUwIDY0IDI1NnM4NiAxOTIgMTkyIDE5MiAxOTItODYgMTkyLTE5MnoiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMzIiLz48L3N2Zz4=\",'\" /></button>\\n <button data-action=\"arrow\" title=\"').concat(y[m].arrow,'\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSI0OCIgZD0iTTExMiAyNDRsMTQ0LTE0NCAxNDQgMTQ0TTI1NiAxMjB2MjkyIi8+PC9zdmc+\",'\" /></button>\\n <button data-action=\"pen\" title=\"').concat(y[m].pen,'\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIzMiIgZD0iTTM2NC4xMyAxMjUuMjVMODcgNDAzbC0yMyA0NSA0NC45OS0yMyAyNzcuNzYtMjc3LjEzLTIyLjYyLTIyLjYyek00MjAuNjkgNjguNjlsLTIyLjYyIDIyLjYyIDIyLjYyIDIyLjYzIDIyLjYyLTIyLjYzYTE2IDE2IDAgMDAwLTIyLjYyaDBhMTYgMTYgMCAwMC0yMi42MiAweiIvPjwvc3ZnPg==\",'\" /></button>\\n <button data-action=\"mosaic\" title=\"').concat(y[m].mosaic,'\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PGNpcmNsZSBjeD0iMjU2IiBjeT0iMTg0IiByPSIxMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIi8+PGNpcmNsZSBjeD0iMzQ0IiBjeT0iMzI4IiByPSIxMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIi8+PGNpcmNsZSBjeD0iMTY4IiBjeT0iMzI4IiByPSIxMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIi8+PC9zdmc+\",'\" /></button>\\n <button data-action=\"text\" title=\"').concat(y[m].text,'\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIzMiIgZD0iTTMyIDQxNS41bDEyMC0zMjAgMTIwIDMyME0yMzAgMzAzLjVINzRNMzI2IDIzOS41YzEyLjE5LTI4LjY5IDQxLTQ4IDc0LTQ4aDBjNDYgMCA4MCAzMiA4MCA4MHYxNDQiLz48cGF0aCBkPSJNMzIwIDM1OC41YzAgMzYgMjYuODYgNTggNjAgNTggNTQgMCAxMDAtMjcgMTAwLTEwNnYtMTVjLTIwIDAtNTggMS05MiA1LTMyLjc3IDMuODYtNjggMTktNjggNTh6IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIi8+PC9zdmc+\",'\" /></button>\\n <button data-action=\"undo\" id=\"undoBtn\" title=\"').concat(y[m].undo,'\" disabled><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIzMiIgZD0iTTExMiAxNjBsLTY0IDY0IDY0IDY0Ii8+PHBhdGggZD0iTTY0IDIyNGgyOTRjNTguNzYgMCAxMDYgNDkuMzMgMTA2IDEwOHYyMCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIzMiIvPjwvc3ZnPg==\",'\" /></button>\\n <button data-action=\"download\" title=\"').concat(y[m].download,'\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHBhdGggZD0iTTMzNiAxNzZoNDBhNDAgNDAgMCAwMTQwIDQwdjIwOGE0MCA0MCAwIDAxLTQwIDQwSDEzNmE0MCA0MCAwIDAxLTQwLTQwVjIxNmE0MCA0MCAwIDAxNDAtNDBoNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMzIiLz48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjMyIiBkPSJNMTc2IDI3Mmw4MCA4MCA4MC04ME0yNTYgNDh2Mjg4Ii8+PC9zdmc+\",'\" /></button>\\n <button data-action=\"cancel\" title=\"').concat(y[m].cancel,'\" style=\"color: red;\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpb25pY29uIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+DQogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmY0ZDRmIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMzIiDQogICAgICAgICAgZD0iTTQxNiA0MTZMOTYgOTZNNDE2IDk2TDk2IDQxNiIvPg0KPC9zdmc+\",'\" /></button>\\n <button data-action=\"confirm\" title=\"').concat(y[m].confirm,'\"><img src=\"').concat(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj4NCiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImdyZWVuIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMzIiDQogICAgICAgICAgZD0iTTQzMiAxNDRMMTc2IDQzMmwtOTYtOTYiLz4NCjwvc3ZnPg0K\",'\" /></button>\\n ')}function st(){var t=y[m];_.innerHTML='\\n <div style=\"display: flex; column-gap: 10px; align-items: center\">\\n <label style=\"margin-right: 12px;\">\\n <select id=\"textFontSize\">\\n <option value=\"14\">'.concat(t.fontSizeSmall,'</option>\\n <option value=\"18\">').concat(t.fontSizeMedium,'</option>\\n <option value=\"24\">').concat(t.fontSizeLarge,'</option>\\n </select>\\n </label>\\n <div id=\"colorOptions\" style=\"display: flex; gap: 6px;\">\\n <div class=\"color-block\" data-color=\"#ff4d4f\" style=\"background: #ff4d4f;\"></div>\\n <div class=\"color-block\" data-color=\"#fadb14\" style=\"background: #fadb14;\"></div>\\n <div class=\"color-block\" data-color=\"#1890ff\" style=\"background: #1890ff;\"></div>\\n <div class=\"color-block\" data-color=\"#52c41a\" style=\"background: #52c41a;\"></div>\\n <div class=\"color-block\" data-color=\"#000000\" style=\"background: #000000;\"></div>\\n </div>\\n </div>\\n '),document.getElementById(\"textFontSize\").value=P.fontSize,document.getElementById(\"textFontSize\").addEventListener(\"change\",(function(t){P.fontSize=parseInt(t.target.value,10)}))}U.forEach((function(t){t.addEventListener(\"click\",(function(){if(U.forEach((function(t){return t.classList.remove(\"selected\")})),t.classList.add(\"selected\"),P.lineWidth=parseInt(t.dataset.width,10),\"mosaic\"===L){var e=ct(P.lineWidth);document.body.style.cursor=\"url(\".concat(e,\") \").concat(2*P.lineWidth,\" \").concat(2*P.lineWidth,\", auto\"),s&&(s.style.cursor=\"url(\".concat(e,\") \").concat(2*P.lineWidth,\" \").concat(2*P.lineWidth,\", auto\"))}}))})),h.on(p(\"set-main-color\"),(function(t,e){\"string\"==typeof e&&(B=e)})),h.on(p(\"set-lang\"),(function(t,e){y[e]&&(m=e,dt(),st())})),h.on(p(\"set-window-index\"),(function(t,e){X=e})),h.on(p(\"set-crop-limit\"),(function(t,e){window._captureTempData=window._captureTempData||{},window._captureTempData.cropRegionLimit=e})),h.on(p(\"highlight-border\"),(function(t,e){X===e?(G.style.border=\"2px solid \".concat(B),G.style.background=\"rgba(0, 0, 0, 0.2)\"):(G.style.border=\"none\",G.style.background=\"rgba(0, 0, 0, 0.4)\")})),h.on(p(\"screenshot-lock-state\"),(function(t,e){var n=e.locked,i=e.isSelf;w=n&&!i})),h.on(p(\"display-screenshot\"),(function(t,e,n,i){R&&(R.remove(),R=null,j=null),g&&(g.remove(),g=null,f=null),window._markupContainer&&(window._markupContainer.remove(),window._markupContainer=null),u=i;var o=new Image;o.src=e,s&&(document.body.removeChild(s),s=null),J.style.display=\"none\",F(),c=l=r=d=0,o.onload=function(){document.body.style.backgroundImage=\"url(\".concat(e,\")\"),document.body.style.backgroundSize=\"cover\",document.body.style.userSelect=\"none\",document.body.style.backgroundColor=\"transparent\";var t=document.createElement(\"canvas\");t.width=o.width,t.height=o.height;var n=t.getContext(\"2d\");n.imageSmoothingEnabled=!1,n.webkitImageSmoothingEnabled=!1,n.mozImageSmoothingEnabled=!1,n.msImageSmoothingEnabled=!1,n.drawImage(o,0,0),window._captureHiddenCanvas=t,window._captureHiddenCtx=n;var i=ot(\"canvas\",\"maskCanvas\",{position:\"fixed\",left:\"0\",top:\"0\",pointerEvents:\"none\",zIndex:9980,backgroundColor:\"transparent\"});document.body.appendChild(i),window._captureMaskCanvas=i,window._captureMaskCtx=i.getContext(\"2d\")}})),document.addEventListener(\"mousedown\",(function(t){var e,n,o;if(v&&0===t.button){var a,u=i(document.querySelectorAll(\".markup-item\"));try{for(u.s();!(a=u.n()).done;){var h=a.value,p=h.getBoundingClientRect();if(t.clientX>=p.left&&t.clientX<=p.right&&t.clientY>=p.top&&t.clientY<=p.bottom&&(Math.abs(t.clientX-p.left)<=6||Math.abs(t.clientX-p.right)<=6||Math.abs(t.clientY-p.top)<=6||Math.abs(t.clientY-p.bottom)<=6))return M=h,S=t.clientX-h.offsetLeft,C=t.clientY-h.offsetTop,D=!0,void t.preventDefault()}}catch(t){u.e(t)}finally{u.f()}if(t.target.classList.contains(\"markup-item\"))return M=t.target,S=t.clientX-M.offsetLeft,C=t.clientY-M.offsetTop,D=!0,void t.preventDefault();var m=null===(e=s)||void 0===e||null===(n=e.getBoundingClientRect)||void 0===n?void 0:n.call(e),y=m&&t.clientX>=m.left&&t.clientX<=m.right&&t.clientY>=m.top&&t.clientY<=m.bottom;if(Y&&y&&!L&&0===W.length&&0===t.button)return T=!0,k=t.clientX-m.left,void(N=t.clientY-m.top);if(!t.target.closest(\"#screenshot-editor-toolbar\")&&!t.target.closest(\"#text-config-panel\")&&!(b&&b.contains(t.target)||D)){var g=null===(o=window._captureTempData)||void 0===o?void 0:o.cropRegion,f=t.clientX,x=t.clientY;if(\"text\"===L&&Y&&0===t.button){if(!(f>=g.x&&f<=g.x+g.width&&x>=g.y&&x<=g.y+g.height))return;var I=P.fontSize,R=P.strokeColor,_=ot(\"input\",null,{position:\"fixed\",left:\"\".concat(f,\"px\"),top:\"\".concat(x,\"px\"),zIndex:99999,border:\"1px solid red\",backgroundColor:\"transparent\",outline:\"none\",padding:\"2px 4px\",borderRadius:\"4px\",caretColor:R,fontWeight:\"bold\",font:\"\".concat(P.fontWeight||\"400\",\" \").concat(I,\"px sans-serif\"),color:R});return _.type=\"text\",document.body.appendChild(_),setTimeout((function(){_.focus()}),0),b=_,_.addEventListener(\"keydown\",(function(t){if(\"Enter\"===t.key){var e=_.value.trim();if(\"\"!==e){var n={mode:\"text\",x:parseInt(_.style.left,10),y:parseInt(_.style.top,10),text:e,color:_.style.color,fontSize:I,fontWeight:P.fontWeight||\"400\"};W.push(n),tt(),z.push(JSON.parse(JSON.stringify(W))),j.font=\"\".concat(n.fontWeight||\"400\",\" \").concat(n.fontSize,\"px sans-serif\"),j.fillStyle=n.color,$()}_.remove(),b=null}})),void _.addEventListener(\"blur\",(function(){if(!_.value.trim())return _.remove(),void(b=null);var t=_.value.trim(),e={mode:\"text\",x:parseInt(_.style.left,10),y:parseInt(_.style.top,10),text:t,color:_.style.color,fontSize:P.fontSize,fontWeight:P.fontWeight||\"400\"};W.push(e),tt(),z.push(JSON.parse(JSON.stringify(W))),j.font=\"\".concat(e.fontWeight||\"400\",\" \").concat(e.fontSize,\"px sans-serif\"),j.fillStyle=e.color,$(),_.remove(),b=null}))}if([\"rect\",\"ellipse\",\"arrow\",\"pen\",\"mosaic\"].includes(L)&&Y){var G,X=null===(G=window._captureTempData)||void 0===G?void 0:G.cropRegion;if(f>=X.x&&f<=X.x+X.width&&x>=X.y&&x<=X.y+X.height){Z=!0;var O=P.lineWidth/2;E=f+O,H=x+O,\"pen\"!==L&&\"mosaic\"!==L||(window._currentPenPath=[{x:f,y:x}])}}else if(!Y||0!==t.button){if(w&&0===t.button)return t.preventDefault(),void t.stopPropagation();if(L&&Y){var Q,V=null===(Q=window._captureTempData)||void 0===Q?void 0:Q.cropRegion;t.clientX>=V.x&&t.clientX<=V.x+V.width&&t.clientY>=V.y&&t.clientY<=V.y+V.height&&(Z=!0,E=t.clientX,H=t.clientY)}else{if(!window._captureMaskCanvas){var U=ot(\"canvas\",\"maskCanvas\",{position:\"fixed\",left:\"0\",top:\"0\",pointerEvents:\"none\",zIndex:9980,backgroundColor:\"transparent\"});document.body.appendChild(U),window._captureMaskCanvas=U,window._captureMaskCtx=U.getContext(\"2d\")}var q;s&&(document.body.removeChild(s),s=null),0===t.button&&(J.style.display=\"none\",F()),0===t.button&&(A=!0,c=t.clientX,l=t.clientY,r=t.clientX,d=t.clientY,q=l,s=ot(\"div\",\"selectionBox\",{position:\"absolute\",left:\"\".concat(c,\"px\"),top:\"\".concat(q,\"px\"),border:\"2px solid \".concat(B),background:\"rgba(255, 255, 255, 0)\",zIndex:9982,boxSizing:\"border-box\",pointerEvents:\"none\",width:\"1px\",height:\"1px\"}),document.body.appendChild(s))}}}}})),window.addEventListener(\"mousemove\",(function(t){var e;if(v){var o,a=!1,u=i(document.querySelectorAll(\".markup-item\"));try{for(u.s();!(o=u.n()).done;){var m=o.value.getBoundingClientRect();if(t.clientX>=m.left&&t.clientX<=m.right&&t.clientY>=m.top&&t.clientY<=m.bottom&&(Math.abs(t.clientX-m.left)<=6||Math.abs(t.clientX-m.right)<=6||Math.abs(t.clientY-m.top)<=6||Math.abs(t.clientY-m.bottom)<=6)){document.body.style.cursor=\"move\",a=!0;break}}}catch(t){u.e(t)}finally{u.f()}if(a||\"mosaic\"===L||(document.body.style.cursor=\"default\"),M){var y,w=null===(y=window._captureTempData)||void 0===y?void 0:y.cropRegion;if(!w)return;var b=t.clientX-S,D=t.clientY-C,z=M.offsetWidth,R=M.offsetHeight;return b=Math.max(w.x,Math.min(w.x+w.width-z,b)),D=Math.max(w.y,Math.min(w.y+w.height-R,D)),M.style.left=\"\".concat(b,\"px\"),void(M.style.top=\"\".concat(D,\"px\"))}if(Y&&s&&(t.target.classList.contains(\"markup-item\")?s.style.cursor=\"default\":!L&&0===W.length&&s.contains(t.target)?s.style.cursor=\"move\":s.style.cursor=\"default\"),T&&s){var j,J=(null===(j=window._captureTempData)||void 0===j?void 0:j.cropRegionLimit)||{x:0,y:0,width:window.innerWidth,height:window.innerHeight},_=s.offsetWidth,G=s.offsetHeight,X=t.clientX-k,V=t.clientY-N;X=Math.max(J.x,Math.min(J.x+J.width-_,X)),V=Math.max(J.y,Math.min(J.y+J.height-G,V)),s.style.left=\"\".concat(X,\"px\"),s.style.top=\"\".concat(V,\"px\"),s.style.opacity=\"0.8\",s.style.boxShadow=\"0 0 0 1px rgba(0,0,0,0.15)\",window._captureTempData.cropRegion={x:X,y:V,width:_,height:G},K(window._captureTempData.cropRegion),it(X,V,_,G)}var U={x:t.screenX,y:t.screenY};h.send(p(\"check-display\"),U);var F=window._captureHiddenCanvas,q=window._captureHiddenCtx;if(x=t.clientX,I=t.clientY,F&&q){var $=50,tt=150;O.width=tt,O.height=190,O.style.width=\"\".concat(O.width,\"px\"),O.style.height=\"\".concat(O.height,\"px\");var et=Math.floor(t.clientX),ot=Math.floor(t.clientY),ct=q.getImageData(et-25,ot-25,$,$),lt=document.createElement(\"canvas\");lt.width=$,lt.height=$,lt.getContext(\"2d\").putImageData(ct,0,0),Q.clearRect(0,0,O.width,O.height),Q.imageSmoothingEnabled=!1,Q.drawImage(lt,0,0,$,$,0,0,tt,tt),Q.strokeStyle=B,Q.lineWidth=1,Q.strokeRect(0,0,tt,tt),Q.beginPath(),Q.moveTo(75,0),Q.lineTo(75,tt),Q.moveTo(0,75),Q.lineTo(tt,75),Q.strokeStyle=B,Q.stroke();var rt=window.innerWidth,dt=window.innerHeight,st=t.clientX+20,ut=t.clientY+20;st+O.width>rt&&(st=t.clientX-O.width-20),ut+O.height>dt&&(ut=t.clientY-O.height-20),O.style.left=\"\".concat(st,\"px\"),O.style.top=\"\".concat(ut,\"px\");var ht=function(t,e,i){var o=t.canvas;if(e<0||i<0||e>=o.width||i>=o.height)return{r:0,g:0,b:0,rgb:\"rgb(0, 0, 0)\",hex:\"#000000\"};var a=n(t.getImageData(e,i,1,1).data,3),c=a[0],l=a[1],r=a[2],d=function(t){return t>=253?255:t};c=d(c),l=d(l),r=d(r);var s=function(t){return t.toString(16).padStart(2,\"0\")},u=\"#\".concat(s(c)).concat(s(l)).concat(s(r));return{r:c,g:l,b:r,rgb:\"rgb(\".concat(c,\", \").concat(l,\", \").concat(r,\")\"),hex:u}}(q,et,ot),pt=ht.r,mt=ht.g,yt=ht.b;Q.font=\"14px sans-serif\";var gt=\"x: \".concat(et,\", y: \").concat(ot),ft=\"rgb(\".concat(pt,\", \").concat(mt,\", \").concat(yt,\")\"),vt=Q.measureText(gt).width,wt=Q.measureText(ft).width;Q.fillStyle=\"#000\",Q.fillRect(0,152,vt+8,16),Q.fillStyle=\"#fff\",Q.fillText(gt,4,164),Q.fillStyle=\"#000\",Q.fillRect(0,170,wt+8,16),Q.fillStyle=\"#fff\",Q.fillText(ft,4,182)}if(Z&&L&&f){var bt,xt=null===(bt=window._captureTempData)||void 0===bt?void 0:bt.cropRegion,It=Math.min(Math.max(x,xt.x),xt.x+xt.width),Mt=Math.min(Math.max(I,xt.y),xt.y+xt.height),St=Math.min(E,It),Ct=Math.min(H,Mt),Dt=Math.abs(It-E),zt=Math.abs(Mt-H);if(f.clearRect(0,0,g.width,g.height),f.strokeStyle=P.strokeColor,f.lineWidth=P.lineWidth,\"rect\"===L)f.strokeRect(St,Ct,Dt,zt);else if(\"ellipse\"===L)f.beginPath(),f.ellipse(St+Dt/2,Ct+zt/2,Dt/2,zt/2,0,0,2*Math.PI),f.stroke();else if(\"arrow\"===L)at(f,E,H,It,Mt,P.strokeColor,P.lineWidth);else if(\"pen\"===L){var Tt,kt=null===(Tt=window._captureTempData)||void 0===Tt?void 0:Tt.cropRegion,Nt=Math.min(Math.max(x,kt.x),kt.x+kt.width),Wt=Math.min(Math.max(I,kt.y),kt.y+kt.height);window._currentPenPath.push({x:Nt,y:Wt}),f.clearRect(0,0,g.width,g.height),f.strokeStyle=P.strokeColor,f.lineWidth=P.lineWidth,f.beginPath();var Pt=window._currentPenPath;f.moveTo(Pt[0].x,Pt[0].y);for(var At=1;At<Pt.length;At++)f.lineTo(Pt[At].x,Pt[At].y);f.stroke()}else if(\"mosaic\"===L){for(var Yt,Lt=null===(Yt=window._captureTempData)||void 0===Yt?void 0:Yt.cropRegion,Zt=Math.min(Math.max(x,Lt.x),Lt.x+Lt.width),Et=Math.min(Math.max(I,Lt.y),Lt.y+Lt.height),Ht=window._currentPenPath[window._currentPenPath.length-1],Rt=Zt-Ht.x,jt=Et-Ht.y,Bt=Math.sqrt(Rt*Rt+jt*jt),Jt=2*P.lineWidth,_t=Math.floor(Bt/Jt),Gt=1;Gt<=_t;Gt++){var Xt=Ht.x+Rt*Gt/_t,Ot=Ht.y+jt*Gt/_t;window._currentPenPath.push({x:Xt,y:Ot})}window._currentPenPath.push({x:Zt,y:Et}),f.clearRect(0,0,g.width,g.height);var Qt=4*P.lineWidth,Vt=window._captureHiddenCtx;if(!Vt)return;var Ut,Ft=i(window._currentPenPath);try{for(Ft.s();!(Ut=Ft.n()).done;){var qt=Ut.value,Kt=n(Vt.getImageData(qt.x,qt.y,1,1).data,3),$t=Kt[0],te=Kt[1],ee=Kt[2];f.fillStyle=\"rgb(\".concat($t,\", \").concat(te,\", \").concat(ee,\")\"),f.fillRect(qt.x-Qt/2,qt.y-Qt/2,Qt,Qt)}}catch(t){Ft.e(t)}finally{Ft.f()}}}if(A&&1===t.buttons){var ne=(null===(e=window._captureTempData)||void 0===e?void 0:e.cropRegionLimit)||{x:0,y:0,width:window.innerWidth,height:window.innerHeight};r=Math.min(Math.max(t.clientX,ne.x),ne.x+ne.width),d=Math.min(Math.max(t.clientY,ne.y),ne.y+ne.height);var ie=Math.min(c,r),oe=Math.min(l,d),ae=Math.abs(r-c),ce=Math.abs(d-l);s.style.left=\"\".concat(ie,\"px\"),s.style.top=\"\".concat(oe,\"px\"),s.style.width=\"\".concat(ae,\"px\"),s.style.height=\"\".concat(ce,\"px\"),K(nt())}}})),window.addEventListener(\"mouseup\",(function(t){if(v&&0===t.button){if(T=!1,M){var e=parseInt(M.dataset.index,10);isNaN(e)||(W[e].x=parseInt(M.style.left,10),W[e].y=parseInt(M.style.top,10)),M=null,D=!1,z.push(JSON.parse(JSON.stringify(W))),tt()}if(Z){var n;Z=!1;var i=null===(n=window._captureTempData)||void 0===n?void 0:n.cropRegion,o=P.lineWidth/2,a=Math.min(Math.max(t.clientX,i.x+1),i.x+i.width-1),m=Math.min(Math.max(t.clientY,i.y+1),i.y+i.height-1),y=Math.min(E,a)-o,w=Math.min(H,m)-o,b=Math.abs(a-E)+2*o,x=Math.abs(m-H)+2*o;return\"pen\"===L?(W.push({mode:\"pen\",path:window._currentPenPath||[],color:P.strokeColor,width:P.lineWidth}),window._currentPenPath=null):\"arrow\"===L?W.push({mode:\"arrow\",x1:E,y1:H,x2:a,y2:m,color:P.strokeColor,width:P.lineWidth}):\"mosaic\"===L?(W.push({mode:\"mosaic\",path:window._currentPenPath||[],width:P.lineWidth}),window._currentPenPath=null):W.push({mode:L,x:y,y:w,w:b,h:x,color:P.strokeColor,width:P.lineWidth}),tt(),$(),f&&f.clearRect(0,0,g.width,g.height),z.push(JSON.parse(JSON.stringify(W))),void tt()}if(A){A=!1,O.style.display=\"none\";var I=nt();if(c===r&&l===d);else{window._captureTempData={cropRegion:I,thumbnailSize:u,currentWindowIndex:X};var S=Math.min(c,r),C=Math.min(l,d),k=Math.abs(r-c),N=Math.abs(d-l);if(!R){(R=ot(\"canvas\",null,{position:\"fixed\",left:\"0\",top:\"0\",pointerEvents:\"none\",zIndex:9985})).id=\"markupCanvas\",R.width=window.innerWidth,R.height=window.innerHeight,document.body.appendChild(R),j=R.getContext(\"2d\");var B=document.createElement(\"div\");B.id=\"markup-container\",B.style.cssText=\"\\n position: fixed;\\n left: 0;\\n top: 0;\\n width: 100%;\\n height: 100%;\\n z-index: 9986;\\n pointer-events: none;\\n \",document.body.appendChild(B),window._markupContainer=B,g||((g=ot(\"canvas\",\"previewCanvas\",{position:\"fixed\",left:\"0\",top:\"0\",pointerEvents:\"none\",zIndex:9986})).width=window.innerWidth,g.height=window.innerHeight,document.body.appendChild(g),f=g.getContext(\"2d\"))}J.style.display=\"block\",it(S,C,k,N),Y=!0,s.style.opacity=\"\",s.style.boxShadow=\"\",h.send(p(\"screenshot-window-lock\"),X)}}}})),document.addEventListener(\"contextmenu\",(function(t){if(t.preventDefault(),Y){if(W.length>0)return;if(L)return;return Y=!1,s&&(s.remove(),s=null),window._captureMaskCanvas&&(window._captureMaskCanvas.remove(),window._captureMaskCanvas=null,window._captureMaskCtx=null),j&&j.clearRect(0,0,R.width,R.height),J.style.display=\"none\",F(),O.style.display=\"block\",void h.send(p(\"screenshot-window-unlock\"))}q()})),document.addEventListener(\"keydown\",(function(t){\"Escape\"===t.key&&q()})),J.addEventListener(\"click\",(function(t){var e=t.target.closest(\"button[data-action]\");if(e){var n=e.dataset.action;if(\"cancel\"===n&&q(),\"confirm\"===n&&rt(),\"text\"===n){var i=document.getElementById(\"text-config-panel\");if(\"text\"===L)L=null,i.style.display=\"none\",$();else{L=\"text\",F(),et(i,e),i.style.display=\"block\";var o=i.querySelectorAll(\".color-block\");o.forEach((function(t){t.addEventListener(\"click\",(function(){o.forEach((function(t){return t.classList.remove(\"selected\")})),t.classList.add(\"selected\"),P.strokeColor=t.dataset.color}))})),s&&(s.style.cursor=\"default\"),document.getElementById(\"textFontSize\").value=P.fontSize,document.getElementById(\"textFontSize\").addEventListener(\"change\",(function(t){P.fontSize=parseInt(t.target.value,10)}))}}if([\"rect\",\"ellipse\",\"arrow\",\"pen\",\"mosaic\"].includes(n))if(document.getElementById(\"text-config-panel\").style.display=\"none\",L===n)L=null,F(),$();else if(L=n,function(t){var e=document.getElementById(\"draw-config-panel\");et(e,t),e.style.display=\"block\";var n=document.getElementById(\"colorOptions\");n&&(n.style.display=\"mosaic\"===L?\"none\":\"flex\"),document.querySelectorAll(\"#colorOptions .color-block\").forEach((function(t){t.classList.toggle(\"selected\",t.dataset.color.toLowerCase()===P.strokeColor.toLowerCase())})),document.querySelectorAll(\"#lineWidthOptions .line-dot\").forEach((function(t){t.classList.toggle(\"selected\",parseInt(t.dataset.width)===P.lineWidth)}))}(e),\"mosaic\"===L){var a=ct(P.lineWidth);document.body.style.cursor=\"url(\".concat(a,\") \").concat(2*P.lineWidth,\" \").concat(2*P.lineWidth,\", auto\"),s&&(s.style.cursor=\"url(\".concat(a,\") \").concat(2*P.lineWidth,\" \").concat(2*P.lineWidth,\", auto\"))}else document.body.style.cursor=\"default\",s&&(s.style.cursor=\"default\");if(\"undo\"===n&&z.length>0){z.pop();var c=z[z.length-1]||[];W=JSON.parse(JSON.stringify(c)),$(),tt()}if(\"download\"===n){var l=lt();l&&h.invoke(p(\"save-capture-image\"),{base64Data:l,windowIndex:X}).then((function(t){t?q():console.log(\"用户取消保存,保持截图状态\")}))}}})),document.addEventListener(\"dblclick\",(function(t){var e;if(v&&Y){var n=null===(e=window._captureTempData)||void 0===e?void 0:e.cropRegion;if(n){var i=t.clientX,o=t.clientY;i>=n.x&&i<=n.x+n.width&&o>=n.y&&o<=n.y+n.height&&rt()}}})),CaptureApp={}})();</script></body>\r\n</html>\r\n";