From 47cc4141b805a83cd234df58ff931bfa95f7b904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E5=BF=86?= Date: Thu, 2 Nov 2023 22:30:37 +0800 Subject: [PATCH] Improve: Make functions more robust --- static/wikimirror.js | 8 +- static/wikimirror.tsc.js | 378 ++++++++++++++++----------------------- 2 files changed, 157 insertions(+), 229 deletions(-) diff --git a/static/wikimirror.js b/static/wikimirror.js index cdfb761..1948d7b 100644 --- a/static/wikimirror.js +++ b/static/wikimirror.js @@ -11,7 +11,7 @@ var _objectHasOwn=function(e,t){if(null==e)throw new TypeError("Cannot convert u * @license GPL v3 * @link */ -!(function(){var e={domain:"example.org",modules:{all:{ajaxLogin:{enable:!0,parameter:"init"},confirmLogout:{enable:!0},darkMode:{enable:!0,parameter:"normal"},floatTOC:{enable:!0},showRedirect:{enable:!0},viewOnOtherWikis:{enable:!0}},body:{displayAnonHide:{enable:!0,parameter:!1}},dom:{},mw:{collapsibleSidebar:{enable:!0},scrollUpButton:{enable:!0},diffLink:{enable:!0},disableAnonEdit:{enable:!0,isStatic:!0}},standard:{}},regexps:{noDarkmode:/developer|techblog/,xtools_api:/xtools\.(wmcloud|wmflabs)\.org\/api\//i}},t=(function(){function e(t){var n=t.domain,r=t.modules,a=t.regexps;_classCallCheck(this,e),_defineProperty(this,"DOMAIN",void 0),_defineProperty(this,"DOMAIN_REGEX",void 0),_defineProperty(this,"DOMAIN_SPLIT",void 0),_defineProperty(this,"MODULES",void 0),_defineProperty(this,"REGEXPS",void 0),_defineProperty(this,"messages",void 0),_defineProperty(this,"textCache",void 0),_defineProperty(this,"textNodeObserver",void 0),_defineProperty(this,"windowManager",void 0),_defineProperty(this,"wpSaveClickListener",void 0),this.DOMAIN=n,this.DOMAIN_REGEX=n.replace(/\./g,"\\.");var i=n.split(".");this.DOMAIN_SPLIT=[i.shift(),i.join(".")],this.MODULES=r,this.REGEXPS=a,this.messages=e.initMessages(),this.textCache=new Map}var t,n,r,a,i,o,u;return _createClass(e,[{key:"getRealText",value:function(t,n){var r=this;if(!n&&this.textCache.has(t))return this.textCache.get(t);var a,i=new RegExp(this.DOMAIN_REGEX,"gi"),o=new RegExp("(wiki(?:books|data|functions|news|pedia|quote|source|versity|voyage)|wiktionary|mediawiki|planet|wikimediafoundation)\\.".concat(this.DOMAIN_REGEX),"gi"),u=new RegExp("latex-(png|svg)\\.".concat(this.DOMAIN_REGEX),"gi"),s=new RegExp("\\\\\\.wikipedia\\\\\\.\\(\\?:".concat(this.DOMAIN_SPLIT[0],"\\\\\\.\\)\\?").concat(this.DOMAIN_SPLIT[1].replace(/\./g,"\\.")),"g"),l=/background(-image)?:url\(('|")?(https?:)?\/\/upload\.wikimedia\.org/gi,c= +!(function(){var e={domain:"example.org",modules:{all:{ajaxLogin:{enable:!0,parameter:"init"},confirmLogout:{enable:!0},darkMode:{enable:!0,parameter:"normal"},floatTOC:{enable:!0},showRedirect:{enable:!0},viewOnOtherWikis:{enable:!0}},body:{displayAnonHide:{enable:!0,parameter:!1}},dom:{},mw:{collapsibleSidebar:{enable:!0},scrollUpButton:{enable:!0},diffLink:{enable:!0},disableAnonEdit:{enable:!0,isStatic:!0}},standard:{}},regexps:{noDarkmode:/developer|techblog/,xtools_api:/xtools\.(wmcloud|wmflabs)\.org\/api\//i}},t=(function(){function e(t){var n=t.domain,r=t.modules,a=t.regexps;_classCallCheck(this,e),_defineProperty(this,"DOMAIN",void 0),_defineProperty(this,"DOMAIN_REGEX",void 0),_defineProperty(this,"DOMAIN_SPLIT",void 0),_defineProperty(this,"MODULES",void 0),_defineProperty(this,"REGEXPS",void 0),_defineProperty(this,"messages",void 0),_defineProperty(this,"textCache",void 0),_defineProperty(this,"textNodeObserver",void 0),_defineProperty(this,"windowManager",void 0),_defineProperty(this,"diffLinkClickListener",void 0),_defineProperty(this,"wpSaveClickListener",void 0),this.DOMAIN=n,this.DOMAIN_REGEX=n.replace(/\./g,"\\.");var i=n.split(".");this.DOMAIN_SPLIT=[i.shift(),i.join(".")],this.MODULES=r,this.REGEXPS=a,this.messages=e.initMessages(),this.textCache=new Map}var t,n,r,a,i,o;return _createClass(e,[{key:"getRealText",value:function(t,n){var r=this;if(!n&&this.textCache.has(t))return this.textCache.get(t);var a,i=new RegExp(this.DOMAIN_REGEX,"gi"),o=new RegExp("(wiki(?:books|data|functions|news|pedia|quote|source|versity|voyage)|wiktionary|mediawiki|planet|wikimediafoundation)\\.".concat(this.DOMAIN_REGEX),"gi"),u=new RegExp("latex-(png|svg)\\.".concat(this.DOMAIN_REGEX),"gi"),s=new RegExp("\\\\\\.wikipedia\\\\\\.\\(\\?:".concat(this.DOMAIN_SPLIT[0],"\\\\\\.\\)\\?").concat(this.DOMAIN_SPLIT[1].replace(/\./g,"\\.")),"g"),l=/background(-image)?:url\(('|")?(https?:)?\/\/upload\.wikimedia\.org/gi,c= /** * emoji-regex 10.3.0 * @@ -19,7 +19,7 @@ var _objectHasOwn=function(e,t){if(null==e)throw new TypeError("Cannot convert u * @link */ /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uD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73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g, -d=function(t){if(t instanceof Element||t instanceof NodeList||t instanceof Text){var n=function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var i=n.value;i instanceof Text&&r.push(i),e(i.childNodes,r)}}catch(e){a.e(e)}finally{a.f()}return r},a=function(e,t){var n,r=_createForOfIteratorHelper(e);try{for(r.s();!(n=r.n()).done;){var a=n.value,i=a.nodeValue;null!=i&&i.trim()&&t(a,i)}}catch(e){r.e(e)}finally{r.f()}},o=(function(e){if(e instanceof Text)return[e];var t=e instanceof Element?[e]:e;return n(t)})(t);a(o,(function(t,n){var a=(function(t){return(e.hasClass("mw-special-AbuseFilter")||e.hasClass("mw-special-EditWatchlist")||e.hasClass("mw-special-Search"))&&!e.hasClass("action-history")||((t.match(i)||t.match(s))&&(t=r.getRealText(t)),t.match(l)&&e.hasClass("action-view")&&(t=t.replace(l,"background$1:url($2$3//upload.".concat(r.DOMAIN)))),t})(n);a!==n&&requestAnimationFrame((function(){t.nodeValue=a}))}));var u="WIKIMIRROR-EMOJI";if(a(o,(function(e,t){var n=t.match(c);if(n){var r,a=function(e,t){var n=e.parentNode,r=e.nodeValue;if(r&&n){var a=r.indexOf(t);if(-1!==a){var i=document.createElement(u);i.className="mw-no-invert";var o=document.createRange();o.setStart(e,a),o.setEnd(e,a+t.length),o.surroundContents(i)}}},i=function e(t){if(t){var n=t.nextSibling,r=t.nodeValue,i=null==r?void 0:r.match(c);i&&requestAnimationFrame((function(){a(t,i[0])})),e(n)}},o=_createForOfIteratorHelper(n);try{var s=function(){var t,n=r.value,o=[e.nodeName,null===(t=e.parentNode)||void 0===t?void 0:t.nodeName];if(-1!==o.indexOf("INPUT")||-1!==o.indexOf("TEXTAREA")||-1!==o.indexOf(u))return 1;requestAnimationFrame((function(){a(e,n)})),i(e)};for(o.s();!(r=o.n()).done;)s()}catch(e){o.e(e)}finally{o.f()}}})),!r.textNodeObserver){r.textNodeObserver=new MutationObserver((function(e){var t,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var r,a,i=t.value;if(-1===[null===(r=i.previousSibling)||void 0===r||null===(r=r.nextSibling)||void 0===r?void 0:r.nodeName,null===(a=i.addedNodes[0])||void 0===a?void 0:a.nodeName,i.target.nodeName].indexOf(u)&&!(i.addedNodes.length>=3&&i.addedNodes[1]instanceof Element&&"gadget-space"===i.addedNodes[1].className)){var o,s=_createForOfIteratorHelper(i.addedNodes);try{for(s.s();!(o=s.n()).done;){var l=o.value;D(l)}}catch(e){s.e(e)}finally{s.f()}}}}catch(e){n.e(e)}finally{n.f()}})),r.textNodeObserver.observe(document.body,{childList:!0,subtree:!0})}}},D=function(e){var t;if(d(e),e instanceof Element){var n,a=_createForOfIteratorHelper([].concat(_toConsumableArray(e.querySelectorAll('a[href*="//archive."]')),_toConsumableArray(e.querySelectorAll('a[href*="//pageviews."]')),_toConsumableArray(e.querySelectorAll('a[href*="//xtools."]'))));try{for(a.s();!(n=a.n()).done;){var o=n.value,u=o.href;u.match(i)&&(o.href=r.getRealText(u)),r.REGEXPS.xtools_api.test(u)&&(o.href=u.replace(r.REGEXPS.xtools_api,"xtools-api.".concat(r.DOMAIN,"/")))}}catch(e){a.e(e)}finally{a.f()}var s,l=_createForOfIteratorHelper([].concat(_toConsumableArray(e.querySelectorAll('input[name="clientUrl"]')),_toConsumableArray(e.querySelectorAll('input[name="intendedWikitext"]'))));try{for(l.s();!(s=l.n()).done;){var c=s.value,D=c.value;D.match(i)&&(c.value=r.getRealText(D))}}catch(e){l.e(e)}finally{l.f()}var h,f=_createForOfIteratorHelper(e.querySelectorAll(".mm-submenu a"));try{for(f.s();!(h=f.n()).done;){var m=h.value,p=new URL(m.href,location.origin);m.href="".concat(p.origin).concat(r.getRealText(p.pathname)).concat(p.search)}}catch(e){f.e(e)}finally{f.f()}var g=e.querySelector("#ca-fileExporter a");if(g){var v,w=g.href,F=null===(v=w.match(/clientUrl=(\S+?)&/))||void 0===v?void 0:v[1];F&&(g.href=w.replace(F,r.getRealText(F)))}var y=null!==(t=e.querySelector("#footer-places-statslink a"))&&void 0!==t?t:e.querySelector("#statslink a");y&&(y.href=r.getRealText(y.href))}},h=document.querySelector("#wpTextbox1");n&&(D(t),h&&(null!==(a=window.wikEd)&&void 0!==a&&a.useWikEd&&wikEd.UpdateTextarea(),t="function"==typeof jQuery?jQuery("#wpTextbox1").val():h.value));var f,m=t;if("string"==typeof t&&!t.trim()||"string"!=typeof t)return this.textCache.set(m,t),t;(this.textCache.has(m)?t=this.textCache.get(m):(t=t.replace(new RegExp("phab\\.".concat(this.DOMAIN),"gi"),"phab.wmfusercontent.org").replace(new RegExp("wma\\.".concat(this.DOMAIN_REGEX),"gi"),"wma.wmcloud.org").replace(u,"wikimedia.org/api/rest_v1/media/math/render/$1").replace(o,"$1.org").replace(i,"wikimedia.org").replace(s,"\\.wikipedia\\.org").replace(/r-e-p-l-a-c-e\.org/g,this.DOMAIN),this.textCache.set(m,t)),n&&h)&&("function"==typeof jQuery?jQuery("#wpTextbox1").val(t):h.value=t,null!==(f=window.wikEd)&&void 0!==f&&f.useWikEd&&wikEd.UpdateFrame());return t}},{key:"init",value:(u=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var n,r,a,i,o=this;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=function(t){for(var n=0,r=Object.entries(t);n1&&void 0!==arguments[1]&&arguments[1],n=e.clipboardData,r=e.target;if(n){var a=getSelection();if(a){var i=a.getRangeAt(0),u=i.toString().trim();if(u){var s=document.createElement("div");s.append(i.cloneContents()),u=s.innerHTML}var l=a.toString();if(new RegExp(o.DOMAIN_REGEX,"gi").test(u+l)&&(e.preventDefault(),u&&n.setData("text/html",o.getRealText(u)),n.setData("text/plain",o.getRealText(l)),t&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement))){var c=r.value;r.value=c.replace(l,"")}}}},i=function(e){var t,n=e.clipboardData,r=e.target;if(n&&(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)){var a=n.getData("text/html");if(a.trim()||(a=n.getData("text/plain")),new RegExp(o.DOMAIN_REGEX,"gi").test(a)){e.preventDefault(),a=o.getRealText(a);var i=document.createElement("div");i.innerHTML=a,a=(null!==(t=i.textContent)&&void 0!==t?t:"").trim();var u=r.selectionEnd,s=r.selectionStart,l=r.value,c=l.slice(0,Math.max(0,null!=s?s:0))+a+l.slice(Math.max(0,null!=u?u:0));r.value=c;var d=(null!=s?s:0)+a.length;r.setSelectionRange(d,d)}}},e.addEventListener({target:document,type:"copy",listener:a}),e.addEventListener({target:document,type:"cut",listener:function(e){a(e,!0)}}),e.addEventListener({target:document,type:"paste",listener:i}),u=!1,mw.hook("codeEditor.configure").add((function(t){var n;if(!u){u=!0;var r=document.querySelector("#wpSave");r&&(null===(n=o.wpSaveClickListener)||void 0===n||n.remove(),o.wpSaveClickListener=e.addEventListener({target:r,type:"click",listener:function(e){e.preventDefault(),t.setValue(o.getRealText(t.getValue())),o.wpSaveClickListener.remove(),r.click()}}))}})),mw.hook("wikipage.content").add((function(t){("mw-content-text"===t.attr("id")||t.hasClass("mw-changeslist"))&&o.diffLink({diffId:e.getConf("wgDiffNewId"),oldId:e.getConf("wgDiffOldId"),revisionId:e.getConf("wgRevisionId")})})),t.next=15,e.domReady();case 15:n(o.MODULES.all),console.log("WikiMirror load succeeded.");case 17:case"end":return t.stop()}}),t)})))).catch((function(){var e,t;o.setCss(null!==(e=null===(t=document.querySelector("noscript"))||void 0===t?void 0:t.innerHTML.replace(/<\/?style>/g,""))&&void 0!==e?e:"","css"),console.log("WikiMirror dependencies load failed.")})),t.abrupt("return",!0);case 17:case"end":return t.stop()}}),t,this)}))),function(){return u.apply(this,arguments)})},{key:"collapsibleSidebar",value:(o=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var n;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.hasClass("rtl")&&-1===["bo","dz"].indexOf(e.getConf("wgContentLanguage"))&&e.hasClass("skin-vector-legacy")){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,mw.loader.using("mediawiki.storage");case 4:n="WikiMirror CollapsibleSidebar.js load",e.setJs("//zh.wikipedia.".concat(this.DOMAIN,"/wiki/MediaWiki:Gadget-CollapsibleSidebar.js?action=raw&ctype=text/javascript"),"defer").then((function(){console.log("".concat(n," succeeded."))})).catch((function(){console.log("".concat(n," failed."))}));case 6:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"scrollUpButton",value:function(){var t="WikiMirror ScrollUpButton.js load";e.setJs("//zh.wikipedia.".concat(this.DOMAIN,"/wiki/MediaWiki:Gadget-scrollUpButton.js?action=raw&ctype=text/javascript"),"async").then((function(){console.log("".concat(t," succeeded."))})).catch((function(){console.log("".concat(t," failed."))}))}},{key:"ajaxLogin",value:(i=_asyncToGenerator(_regeneratorRuntime().mark((function t(n){var r,a,i,o,u,s,l,c,d,D,h,f,m,p,g,v,w,F,y,_,b,k,E,C,x,A,z,B,S,O,R,T,L,j,M,N,I,U,P,H=this,q=arguments;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=(a=q.length>1&&void 0!==q[1]?q[1]:{}).username,o=a.password,!new RegExp("^\\S+?\\.m\\.".concat(this.DOMAIN_REGEX)).test(location.host)){t.next=3;break}return t.abrupt("return");case 3:if(u=function(e){return H.messages.ajaxLogin[e]||e},s=-1!==location.host.indexOf("wikitech")?"lastLoginWikitech":"lastLogin","init"!==n){t.next=22;break}if(!e.getConf("wgUserName")){t.next=8;break}return t.abrupt("return");case 8:c=_toConsumableArray(document.querySelectorAll('#ca-cb-login>a,#topbar>a[href*="UserLogin"],#pt-login>a,#pt-login-private>a,#pt-login-2>a,#pt-login-private-2>a,.vector-user-menu-login>a')),(d=null===(l=document.querySelector(".minerva-icon--logIn"))||void 0===l?void 0:l.parentElement)&&c.push(d),D=e.getCookie("".concat(s,"UserName")),h=e.getCookie("".concat(s,"Password")),f=[],m=function(t,n){return e.addEventListener({target:t,type:n,listener:function(t){e.checkA11yConfirmKey(t)&&(t.preventDefault(),H.ajaxLogin())}})},p=_createForOfIteratorHelper(c);try{for(p.s();!(g=p.n()).done;)v=g.value,f.push(m(v,"click"),m(v,"keydown"))}catch(e){p.e(e)}finally{p.f()}if("deleted"!==h&&!e.getConf("wgUserName")&&D&&h){t.next=19;break}return t.abrupt("return");case 19:if(w=function(){H.showNotice(u("Starting automatic login"),{autoHide:!0,tag:"login"}),H.ajaxLogin(void 0,{username:D,password:e.inflateRaw(h)})},"1"===e.getCookie("".concat(s,"Use2FA"))){F=_createForOfIteratorHelper(f);try{for(F.s();!(y=F.n()).done;)y.value.remove()}catch(e){F.e(e)}finally{F.f()}_=function(t){e.checkA11yConfirmKey(t)&&(t.preventDefault(),w())},b=_createForOfIteratorHelper(c);try{for(b.s();!(k=b.n()).done;)E=k.value,e.addEventListener({target:E,type:"click",listener:_}),e.addEventListener({target:E,type:"keydown",listener:_})}catch(e){b.e(e)}finally{b.f()}}else w();return t.abrupt("return");case 22:return t.next=24,mw.loader.using(["mediawiki.api","oojs-ui-core","oojs-ui-windows","oojs-ui.styles.icons-interactions","oojs-ui.styles.icons-user"]);case 24:if(this.windowManager||(this.windowManager=new OO.ui.WindowManager,this.windowManager.$element.appendTo(document.body)),C=new OO.ui.MessageDialog,x=new OO.ui.TextInputWidget({icon:"userAvatar",placeholder:u("Username"),validate:"non-empty",value:null!==(r=e.getCookie("".concat(s,"UserName")))&&void 0!==r?r:""}),A=new OO.ui.TextInputWidget({icon:"key",placeholder:u("Password"),type:"password",validate:"non-empty"}),z=new OO.ui.CheckboxInputWidget({selected:!0}),B=new OO.ui.FieldLayout(z,{align:"inline",label:u("Cross wiki automatic login")}),S=new OO.ui.CheckboxInputWidget,O=new OO.ui.FieldLayout(S,{align:"inline",help:u("SelectedOrNot"),label:u("Keep me logged in")}),R=jQuery("