!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DisableDevtool=t()}(this,function(){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};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 i,r=!0,u=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){u=!0,i=e},f:function(){try{r||null==o.return||o.return()}finally{if(u)throw i}}}}var d=!1,t={};function v(e){t[e]=!1}function z(){for(var e in t)if(t[e])return d=!0;return d=!1}function h(){return(new Date).getTime()}function B(e){var t=h();return e(),h()-t}function W(n,o){function e(t){return function(){n&&n();var e=t.apply(void 0,arguments);return o&&o(),e}}var t=window.alert,i=window.confirm,r=window.prompt;try{window.alert=e(t),window.confirm=e(i),window.prompt=e(r)}catch(e){}}var p={iframe:!1,pc:!1,qqBrowser:!1,firefox:!1,macos:!1,edge:!1,oldEdge:!1,ie:!1,iosChrome:!1,iosEdge:!1,chrome:!1,seoBot:!1};function U(){function e(e){return-1!==t.indexOf(e)}var t=navigator.userAgent.toLowerCase(),n=!!window.top&&window!==window.top,o=!/(iphone|ipad|ipod|ios|android)/i.test(t),i=e("qqbrowser"),r=e("firefox"),u=e("macintosh"),c=e("edge"),a=c&&!e("chrome"),l=a||e("trident")||e("msie"),f=e("crios"),s=e("edgios"),d=e("chrome")||f,v=/(googlebot|baiduspider|bingbot|applebot|petalbot|yandexbot|bytespider|chrome\-lighthouse)/i.test(t);Object.assign(p,{iframe:n,pc:o,qqBrowser:i,firefox:r,macos:u,edge:c,oldEdge:a,ie:l,iosChrome:f,iosEdge:s,chrome:d,seoBot:v})}function H(){for(var e=function(){for(var e={},t=0;t<500;t++)e["".concat(t)]="".concat(t);return e}(),t=[],n=0;n<50;n++)t.push(e);return t}var K="",V=!1;function F(){var e=b.ignore;if(e){if("function"==typeof e)return e();if(0!==e.length){var t=location.href;if(K===t)return V;K=t;var n,o=!1,i=s(e);try{for(i.s();!(n=i.n()).done;){var r=n.value;if("string"==typeof r){if(-1!==t.indexOf(r)){o=!0;break}}else if(r.test(t)){o=!0;break}}}catch(e){i.e(e)}finally{i.f()}return V=o}}}var M=0,X=0,N=[],$=0;function G(i){function e(){l=!0}function t(){l=!1}var n,o,r,u,c,a,l=!1;function f(){(a[u]===r?o:n)()}W(e,t),n=t,o=e,void 0!==(a=document).hidden?(r="hidden",c="visibilitychange",u="visibilityState"):void 0!==a.mozHidden?(r="mozHidden",c="mozvisibilitychange",u="mozVisibilityState"):void 0!==a.msHidden?(r="msHidden",c="msvisibilitychange",u="msVisibilityState"):void 0!==a.webkitHidden&&(r="webkitHidden",c="webkitvisibilitychange",u="webkitVisibilityState"),a.removeEventListener(c,f,!1),a.addEventListener(c,f,!1),M=window.setInterval(function(){if(!(i.isSuspend||l||F())){var e,t,n=s(N);try{for(n.s();!(e=n.n()).done;){var o=e.value;v(o.type),o.detect($++)}}catch(e){n.e(e)}finally{n.f()}T(),"function"==typeof b.ondevtoolclose&&(t=d,!z()&&t&&b.ondevtoolclose())}},b.interval),X=setTimeout(function(){p.pc||y()},b.stopIntervalTime)}function y(){window.clearInterval(M)}function Y(){if(y(),b.url)window.location.href=b.url;else{try{window.opener=null,window.open("","_self"),window.close(),window.history.back()}catch(e){console.log(e)}setTimeout(function(){window.location.href="https://theajack.github.io/disable-devtool/404.html?h=".concat(encodeURIComponent(location.host))},500)}}var b={md5:"",ondevtoolopen:Y,ondevtoolclose:null,url:"",tkName:"ddtk",interval:200,disableMenu:!0,stopIntervalTime:5e3,clearIntervalWhenDevOpenTrigger:!1,detectors:"all",clearLog:!0,disableSelect:!1,disableCopy:!1,disableCut:!1,disablePaste:!1,ignore:null,disableIframeParents:!0,seo:!0},J=["detectors","ondevtoolclose","ignore"];function Q(e){var t,n=0>5]|=128<>>9<<4)]=t;for(var n=1732584193,o=-271733879,i=-1732584194,r=271733878,u=0;u>5]|=(e.charCodeAt(o/S)&n)<>2]>>i%4*8+4&15)+n.charAt(t[i>>2]>>i%4*8&15);return o}function k(e,t,n,o,i,r){return E((t=E(E(t,e),E(o,r)))<>>32-i,n)}function P(e,t,n,o,i,r,u){return k(t&n|~t&o,e,t,i,r,u)}function x(e,t,n,o,i,r,u){return k(t&o|n&~o,e,t,i,r,u)}function j(e,t,n,o,i,r,u){return k(t^n^o,e,t,i,r,u)}function I(e,t,n,o,i,r,u){return k(n^(t|~o),e,t,i,r,u)}function E(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}(C=_=_||{})[C.Unknown=-1]="Unknown",C[C.RegToString=0]="RegToString",C[C.DefineId=1]="DefineId",C[C.Size=2]="Size",C[C.DateToString=3]="DateToString",C[C.FuncToString=4]="FuncToString",C[C.Debugger=5]="Debugger",C[C.Performance=6]="Performance",C[C.DebugLib=7]="DebugLib";var _,A=function(){function n(e){var t=e.type,e=e.enabled,e=void 0===e||e;o(this,n),this.type=_.Unknown,this.enabled=!0,this.type=t,this.enabled=e,this.enabled&&(t=this,N.push(t),this.init())}return u(n,[{key:"onDevToolOpen",value:function(){var e;console.warn("You ar not allow to use DEVTOOL! 【type = ".concat(this.type,"】")),b.clearIntervalWhenDevOpenTrigger&&y(),window.clearTimeout(X),b.ondevtoolopen(this.type,Y),e=this.type,t[e]=!0}},{key:"init",value:function(){}}]),n}(),C=function(){n(t,A);var e=l(t);function t(){return o(this,t),e.call(this,{type:_.RegToString,enabled:p.qqBrowser||p.firefox})}return u(t,[{key:"init",value:function(){var t=this;this.lastTime=0,this.reg=/./,w(this.reg),this.reg.toString=function(){var e;return p.qqBrowser?(e=(new Date).getTime(),t.lastTime&&e-t.lastTime<100?t.onDevToolOpen():t.lastTime=e):p.firefox&&t.onDevToolOpen(),""}}},{key:"detect",value:function(){w(this.reg)}}]),t}(),oe=function(){n(t,A);var e=l(t);function t(){return o(this,t),e.call(this,{type:_.DefineId})}return u(t,[{key:"init",value:function(){var e=this;this.div=document.createElement("div"),this.div.__defineGetter__("id",function(){e.onDevToolOpen()}),Object.defineProperty(this.div,"id",{get:function(){e.onDevToolOpen()}})}},{key:"detect",value:function(){w(this.div)}}]),t}(),ie=function(){n(t,A);var e=l(t);function t(){return o(this,t),e.call(this,{type:_.Size,enabled:!p.iframe&&!p.edge})}return u(t,[{key:"init",value:function(){var e=this;this.checkWindowSizeUneven(),window.addEventListener("resize",function(){setTimeout(function(){e.checkWindowSizeUneven()},100)},!0)}},{key:"detect",value:function(){}},{key:"checkWindowSizeUneven",value:function(){var e=function(){if(re(window.devicePixelRatio))return window.devicePixelRatio;var e=window.screen;return!(re(e)||!e.deviceXDPI||!e.logicalXDPI)&&e.deviceXDPI/e.logicalXDPI}();if(!1!==e){var t=20010*this.maxPrintTime&&this.onDevToolOpen()}}]),t}(),fe=function(){n(t,A);var e=l(t);function t(){return o(this,t),e.call(this,{type:_.DebugLib})}return u(t,[{key:"init",value:function(){}},{key:"detect",value:function(){var e;(!0===(null==(e=null==(e=window.eruda)?void 0:e._devTools)?void 0:e._isShow)||window._vcOrigConsole&&window.document.querySelector("#__vconsole.vc-toggle"))&&this.onDevToolOpen()}}]),t}(),se=(e(R={},_.RegToString,C),e(R,_.DefineId,oe),e(R,_.Size,ie),e(R,_.DateToString,ue),e(R,_.FuncToString,ce),e(R,_.Debugger,ae),e(R,_.Performance,le),e(R,_.DebugLib,fe),R);var L=Object.assign(function(e){if(U(),Z=p.ie?(w=function(){return m.log.apply(m,arguments)},g=function(){return m.table.apply(m,arguments)},function(){return m.clear()}):(w=m.log,g=m.table,m.clear),Q(e),!(b.md5&&ne(function(e){var t=window.location.search,n=window.location.hash;if(""!==(t=""===t&&""!==n?"?".concat(n.split("?")[1]):t)&&void 0!==t){n=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),e=t.substr(1).match(n);if(null!=e)return unescape(e[2])}return""}(b.tkName))===b.md5||b.seo&&p.seoBot)){L.isRunning=!0,G(L);var t=L,n=(ee=function(){return t.isSuspend},window.top),o=window.parent;if(O(window),b.disableIframeParents&&n&&o&&n!==window){for(;o!==n;)O(o),o=o.parent;O(n)}("all"===b.detectors?Object.keys(se):b.detectors).forEach(function(e){new se[e]})}},{isRunning:!1,isSuspend:!1,md5:ne,version:"0.3.4",DetectorType:_,isDevToolOpened:z});C=function(){if(!window||!window.document)return null;var n=document.querySelector("[disable-devtool-auto]");if(!n)return null;var o=["disable-menu","disable-select","disable-copy","disable-cut","disable-paste","clear-log"],i=["interval"],r={};return["md5","url","tk-name","detectors"].concat(o,i).forEach(function(e){var t=n.getAttribute(e);null!==t&&(-1!==i.indexOf(e)?t=parseInt(t):-1!==o.indexOf(e)?t="false"!==t:"detector"===e&&"all"!==t&&(t=t.split(" ")),r[function(e){if(-1===e.indexOf("-"))return e;var t=!1;return e.split("").map(function(e){return"-"===e?(t=!0,""):t?(t=!1,e.toUpperCase()):e}).join("")}(e)]=t)}),r}();return C&&L(C),L});