mediawiki-extensions-Popups/resources/dist/index.js
Clare Ming 4908f82c01 Add title attribute to settings gear icon
Add message, description, extension for title. Update createPagePreview, renderPagePreview methods to add title attribute to settings gear icon. Add test for title attribute. Increase maxSize, maxAssetSize, maxEntrypointSize. Add compiled js files.

Bug: T274887
Change-Id: Ibb29deb3418569d8283b954b4b22074423e78bda
2021-04-02 13:30:07 -06:00

2 lines
43 KiB
JavaScript

!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/index.js")}({"./node_modules/redux-thunk/dist/redux-thunk.min.js":function(e,t,n){e.exports=function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t){"use strict";function n(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(r){return"function"==typeof r?r(n,i,e):t(r)}}}}t.__esModule=!0;var i=n();i.withExtraArgument=n,t.default=i}])},"./node_modules/redux/dist/redux.min.js":function(e,t,n){(function(e,n){!function(t){"use strict";var i=function(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n),r=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+r(),REPLACE:"@@redux/REPLACE"+r(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+r()}};function a(e,t){var n=t&&t.type;return"Given "+(n&&'action "'+n+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function s(e,t){return function(){return t(e.apply(this,arguments))}}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}t.createStore=function e(t,n,r){var a;if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error("Expected the enhancer to be a function.");return r(e)(t,n)}if("function"!=typeof t)throw Error("Expected the reducer to be a function.");var s=t,u=n,c=[],p=c,l=!1;function d(){p===c&&(p=c.slice())}function f(){if(l)throw Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return u}function w(e){if("function"!=typeof e)throw Error("Expected the listener to be a function.");if(l)throw Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return d(),p.push(e),function(){if(t){if(l)throw Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,d();var n=p.indexOf(e);p.splice(n,1)}}}function g(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw Error("Reducers may not dispatch actions.");try{l=!0,u=s(u,e)}finally{l=!1}for(var t=c=p,n=0;t.length>n;n++)(0,t[n])();return e}return g({type:o.INIT}),(a={dispatch:g,subscribe:w,getState:f,replaceReducer:function(e){if("function"!=typeof e)throw Error("Expected the nextReducer to be a function.");s=e,g({type:o.REPLACE})}})[i]=function(){var e,t=w;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(f())}return n(),{unsubscribe:t(n)}}})[i]=function(){return this},e},a},t.combineReducers=function(e){for(var t=Object.keys(e),n={},i=0;t.length>i;i++){var r=t[i];"function"==typeof e[r]&&(n[r]=e[r])}var s,u=Object.keys(n);try{!function(e){Object.keys(e).forEach(function(t){var n=e[t];if(void 0===n(void 0,{type:o.INIT}))throw Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:o.PROBE_UNKNOWN_ACTION()}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+o.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}(n)}catch(e){s=e}return function(e,t){if(void 0===e&&(e={}),s)throw s;for(var i=!1,r={},o=0;u.length>o;o++){var c=u[o],p=e[c],l=(0,n[c])(p,t);if(void 0===l){var d=a(c,t);throw Error(d)}r[c]=l,i=i||l!==p}return i?r:e}},t.bindActionCreators=function(e,t){if("function"==typeof e)return s(e,t);if("object"!=typeof e||null===e)throw Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),i={},r=0;n.length>r;r++){var o=n[r],a=e[o];"function"==typeof a&&(i[o]=s(a,t))}return i},t.applyMiddleware=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},r={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},o=t.map(function(e){return e(r)});return function(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){u(e,t,n[t])})}return e}({},n,{dispatch:i=c.apply(void 0,o)(n.dispatch)})}}},t.compose=c,t.__DO_NOT_USE__ActionTypes=o,Object.defineProperty(t,"__esModule",{value:!0})}(t)}).call(this,n("./node_modules/webpack/buildin/global.js"),n("./node_modules/webpack/buildin/module.js")(e))},"./node_modules/webpack/buildin/global.js":function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},"./node_modules/webpack/buildin/module.js":function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},"./src/counts.js":function(e,t){t.getEditCountBucket=function(e){var t;return 0===e?t="0":e>=1&&e<=4?t="1-4":e>=5&&e<=99?t="5-99":e>=100&&e<=999?t="100-999":e>=1e3&&(t="1000+"),"".concat(t," edits")},t.getPreviewCountBucket=function(e){var t;return 0===e?t="0":e>=1&&e<=4?t="1-4":e>=5&&e<=20?t="5-20":e>=21&&(t="21+"),void 0!==t?"".concat(t," previews"):"unknown"}},"./src/index.js":function(e,t,n){"use strict";n.r(t);var i={};n.r(i),n.d(i,"boot",function(){return he}),n.d(i,"fetch",function(){return ve}),n.d(i,"linkDwell",function(){return Ee}),n.d(i,"abandon",function(){return Te}),n.d(i,"linkClick",function(){return be}),n.d(i,"previewDwell",function(){return ye}),n.d(i,"previewShow",function(){return _e}),n.d(i,"pageviewLogged",function(){return Pe}),n.d(i,"showSettings",function(){return Se}),n.d(i,"hideSettings",function(){return xe}),n.d(i,"saveSettings",function(){return Ie}),n.d(i,"eventLogged",function(){return ke}),n.d(i,"statsvLogged",function(){return Ce});var r=n("./node_modules/redux/dist/redux.min.js"),o=n("./node_modules/redux-thunk/dist/redux-thunk.min.js"),a=n.n(o),s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.devicePixelRatio;return e?e>1.5?2:e>1?1.5:1:1}(),u={BRACKETED_DEVICE_PIXEL_RATIO:s,THUMBNAIL_SIZE:320*Math.max(s,1.5),EXTRACT_LENGTH:525},c={TYPE_GENERIC:"generic",TYPE_PAGE:"page",TYPE_DISAMBIGUATION:"disambiguation",TYPE_REFERENCE:"reference"};function p(e,t,n,i,r,o,a,s){var u=function(e){if(null==e||0===e.length)return;return e}(r);return{title:e,url:t,languageCode:n,languageDirection:i,extract:u,type:function(e,t){if(void 0===t)return c.TYPE_GENERIC;switch(e){case c.TYPE_GENERIC:case c.TYPE_DISAMBIGUATION:case c.TYPE_PAGE:return e;default:return c.TYPE_PAGE}}(o,u),thumbnail:a,pageId:s}}function l(e,t){return p(e,t,"","",[],"")}function d(e,t,n){return function(e,t){return e.getNamespaceId()===t.get("wgNamespaceNumber")&&e.getMainText()===t.get("wgTitle")}(n,t)?n.getFragment()&&t.get("wgPopupsReferencePreviews")&&$(e).parent().hasClass("reference")?c.TYPE_REFERENCE:null:c.TYPE_PAGE}function f(e,t){var n=e;return void 0===e?[]:0===n.length?[]:n=function(e,t){var n=[],i="<bi-".concat(Math.random(),">"),r="<snip-".concat(Math.random(),">");t=t.replace(/\s+/g," ").trim();var o=mw.util.escapeRegExp(t),a=new RegExp("(^|\\s)(".concat(o,")(|$)"),"i");return(e=(e=(e=e.replace(/\s+/," ")).replace(a,"$1".concat(r).concat(i,"$2").concat(r,"$3"))).split(r)).forEach(function(e){0===e.indexOf(i)?n.push($("<b>").text(e.substring(i.length))):n.push(document.createTextNode(e))}),n}(n,t)}var w=300;function g(e){if(e.query&&e.query.pages&&e.query.pages.length)return e.query.pages[0];throw new Error("API response `query.pages` is empty.")}function m(e){var t=$.extend({},e);return t.extract=f(e.extract,e.title),t}function h(e){return p(e.title,e.canonicalurl,e.pagelanguagehtmlcode,e.pagelanguagedir,e.extract,e.type,e.thumbnail,e.pageid)}var v="https://www.mediawiki.org/wiki/Specs/Summary/1.2.0";function E(e,t,n){function i(n){var i=t.endpoint;return e({url:i+encodeURIComponent(n),headers:{Accept:'application/json; charset=utf-8; profile="'.concat(v,'"'),"Accept-Language":t.acceptLanguage}})}return{fetch:i,convertPageToModel:b,fetchPreviewForTitle:function(e){var r=e.getPrefixedDb(),o=i(r);return o.then(function(e){return e&&e.title||(e=$.extend(!0,e||{},{title:r})),void 0===e.extract&&(e.extract=""),b(e,t.THUMBNAIL_SIZE,n)}).catch(function(e,t,n){return $.Deferred().reject("http",{xhr:e,textStatus:t,exception:n})}).promise({abort:function(){o.abort()}})}}}function T(e,t,n){var i=e.source.split("/"),r=i[i.length-1],o=function(e){return new RegExp(/\.(jpg|jpeg|png|gif)$/i).test(e)}(t.source)||void 0,a=r.indexOf("px-");if(-1===a)return o&&t;var s,u,c=r.substr(a+3);return e.width>e.height?(s=n,u=Math.floor(n/e.width*e.height)):(s=Math.floor(n/e.height*e.width),u=n),s>=t.width&&-1===c.indexOf(".svg")?o&&t:(i[i.length-1]="".concat(s,"px-").concat(c),{source:i.join("/"),width:s,height:u})}function b(e,t,n){return p(e.title,new mw.Title(e.title).getUrl(),e.lang,e.dir,n(e),e.type,e.thumbnail?T(e.thumbnail,e.originalimage,t):void 0,e.pageid)}function y(e){var t=e.extract_html;return 0===t.length?[]:$.parseHTML(t)}function _(e){return f(e.extract,e.title)}function P(e){var t=$.extend({},u,{acceptLanguage:e.get("wgPageContentLanguage")}),n=$.extend({},t,{endpoint:e.get("wgPopupsRestGatewayEndpoint")});switch(e.get("wgPopupsGateway")){case"mwApiPlain":return function(e,t){function n(n){return e.get({action:"query",prop:"info|extracts|pageimages|revisions|info",formatversion:2,redirects:!0,exintro:mw.config.get("wgPopupsTextExtractsIntroOnly",!0),exchars:t.EXTRACT_LENGTH,explaintext:!0,exsectionformat:"plain",piprop:"thumbnail",pithumbsize:t.THUMBNAIL_SIZE,pilicense:"any",rvprop:"timestamp",inprop:"url",titles:n,smaxage:w,maxage:w,uselang:"content"},{headers:{"X-Analytics":"preview=1","Accept-Language":t.acceptLanguage}})}return{fetch:n,extractPageFromResponse:g,convertPageToModel:h,fetchPreviewForTitle:function(e){var t=n(e.getPrefixedDb());return t.then(function(e){return h(m(g(e)))}).promise({abort:function(){t.abort()}})},formatPlainTextExtract:m}}(new mw.Api,t);case"restbasePlain":return E($.ajax,n,_);case"restbaseHTML":return E($.ajax,n,y);default:throw new Error("Unknown gateway")}}function S(){function e(e){var t=["book","journal","news","note","web"],n=null;return e.find("cite[class]").each(function(e,i){for(var r=i.className.split(/\s+/),o=r.length;o--;)if(-1!==t.indexOf(r[o]))return n=r[o],!1}),n}return{fetchPreviewForTitle:function(t,n){var i=t.getFragment().replace(/ /g,"_"),r=function(e){var t="#".concat($.escapeSelector(e));return $("".concat(t," .mw-reference-text, ").concat(t," .reference-text"))}(i);if(!r.length||!r.text().trim()&&!r.children().length)return $.Deferred().reject("Footnote not found",{textStatus:"abort",xhr:{readyState:0}}).promise({abort:function(){}});var o={url:"#".concat(i),extract:r.html(),type:c.TYPE_REFERENCE,referenceType:e(r),sourceElementId:n&&n.parentNode&&n.parentNode.id};return $.Deferred().resolve(o).promise({abort:function(){}})}}}var x="mwe-popups-enabled",I="ext.popups.core.previewCount";function k(e){return mw.html.escape(e)}var C={};function N(e){if(!C[e]){var t=document.createElement("div");t.innerHTML=e,C[e]=t.firstElementChild}return C[e].cloneNode(!0)}function A(e){var t=k(e.heading),n=k(e.saveLabel),i=k(e.closeLabel),r=k(e.helpText),o=k(e.okLabel),a=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(e){var t=e.id,n=e.name,i=e.description,r=e.isChecked;return{id:k(t),name:k(n),description:i?k(i):"",isChecked:r}})}(e.choices);return $($.parseHTML("\n\t\t<section id='mwe-popups-settings'>\n\t\t\t<header>\n\t\t\t\t<div>\n\t\t\t\t\t<div class='mw-ui-icon mw-ui-icon-element mw-ui-icon-popups-close close'>".concat(i,"</div>\n\t\t\t\t</div>\n\t\t\t\t<h1>").concat(t,"</h1>\n\t\t\t\t<div>\n\t\t\t\t\t<button class='save mw-ui-button mw-ui-progressive'>").concat(n,"</button>\n\t\t\t\t\t<button class='okay mw-ui-button mw-ui-progressive' style='display:none;'>").concat(o,"</button>\n\t\t\t\t</div>\n\t\t\t</header>\n\t\t\t<main id='mwe-popups-settings-form'>\n\t\t\t\t<form>\n\t\t\t\t\t").concat(a.map(function(e){var t=e.id,n=e.name,i=e.description,r=e.isChecked;return"\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tname='mwe-popups-setting'\n\t\t\t\t\t\t\t".concat(r?"checked":"","\n\t\t\t\t\t\t\tvalue='").concat(t,"'\n\t\t\t\t\t\t\ttype='radio'\n\t\t\t\t\t\t\tid='mwe-popups-settings-").concat(t,"'>\n\t\t\t\t\t\t<label for='mwe-popups-settings-").concat(t,"'>\n\t\t\t\t\t\t\t<span>").concat(n,"</span>\n\t\t\t\t\t\t\t").concat(i,"\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</p>")}).join(""),"\n\t\t\t\t</form>\n\t\t\t</main>\n\t\t\t<div class='mwe-popups-settings-help' style='display:none;'>\n\t\t\t\t<div class=\"mw-ui-icon mw-ui-icon-element mw-ui-icon-footer\"></div>\n\t\t\t\t<p>").concat(r,"</p>\n\t\t\t</div>\n\t\t</section>\n\t").trim()))}function O(e){var t,n;return function(i){var r,o,a;return t||(r=L(),o=e.get("wgPopupsReferencePreviewsBeta"),a=[{id:"simple",name:mw.msg("popups-settings-option-simple"),description:mw.msg(o?"popups-settings-option-simple-description":"popups-settings-option-unified-description"),isChecked:!0},{id:"advanced",name:mw.msg("popups-settings-option-advanced"),description:mw.msg("popups-settings-option-advanced-description")},{id:"off",name:mw.msg("popups-settings-option-off")}],r||a.splice(1,1),t=A({heading:mw.msg(o?"popups-settings-title":"popups-settings-unified-title"),closeLabel:mw.msg("popups-settings-cancel"),saveLabel:mw.msg("popups-settings-save"),helpText:mw.msg("popups-settings-help"),okLabel:mw.msg("popups-settings-help-ok"),choices:a}),n=$("<div>").addClass("mwe-popups-overlay"),t.find(".save").on("click",function(){var e="simple"===t.find("input[name=mwe-popups-setting]:checked, #mwe-popups-settings").val();i.saveSettings(e)}),t.find(".close, .okay").on("click",i.hideSettings)),{appendTo:function(e){n.appendTo(e),t.appendTo(n)},show:function(){n.show()},hide:function(){n.hide()},toggleHelp:function(e){!function(e,t){var n=$("#mwe-popups-settings");t?(n.find("main, .save, .close").hide(),n.find(".mwe-popups-settings-help, .okay").show()):(n.find("main, .save, .close").show(),n.find(".mwe-popups-settings-help, .okay").hide())}(0,e)},setEnabled:function(e){var n="off";e?n="simple":L()&&(n="advanced"),t.find("#mwe-popups-settings-".concat(n)).prop("checked",!0)}}}}function L(){return"undefined"!=typeof pg&&void 0!==pg.fn.disablePopups}function D(e,t){var n;e.subscribe(function(){var i=n;i!==(n=e.getState())&&t(i,n)})}function R(e,t){if(function(e){return e.hash&&e.host===location.host&&e.pathname===location.pathname&&e.search===location.search}(e))try{return mw.Title.newFromText(t.get("wgPageName")+decodeURIComponent(e.hash))}catch(e){return null}return function(e,t){if(!e)return null;var n=mw.Title.newFromText(e);return n&&t.indexOf(n.namespace)>=0?n:null}(function(e,t){var n;try{n=new mw.Uri(e)}catch(e){return}if(n.host===location.hostname){var i,r=Object.keys(n.query).length;if(r)1===r&&"title"in n.query&&(i=n.query.title);else{var o=mw.util.escapeRegExp(t.get("wgArticlePath")).replace("\\$1","([^?#]+)"),a=new RegExp(o).exec(n.path);try{i=a&&decodeURIComponent(a[1])}catch(e){}}return i?"".concat(i).concat(n.fragment?"#".concat(n.fragment):""):void 0}}(e.href,t),t.get("wgContentNamespaces"))}function H(e){var t=$.Deferred();return setTimeout(function(){return t.resolve()},e),t.promise()}var G=n("./src/ui/pointer-mask.svg"),j=n.n(G),W={portraitImage:{h:250,w:203},landscapeImage:{h:200,w:320}};function B(e,t){var n=u.BRACKETED_DEVICE_PIXEL_RATIO;if(!e)return null;var i,r,o,a,s=e.width<e.height,c=e.width/n,p=e.height/n;if(!s&&c<W.landscapeImage.w||s&&p<W.portraitImage.h||e.source.indexOf("\\")>-1||e.source.indexOf("'")>-1||e.source.indexOf('"')>-1)return null;s?(i=c>W.portraitImage.w?(c-W.portraitImage.w)/-2:W.portraitImage.w-c,r=p>W.portraitImage.h?(p-W.portraitImage.h)/-2:0,o=W.portraitImage.w,a=W.portraitImage.h,c<o&&(i=0,o=c)):(i=0,r=p>W.landscapeImage.h?(p-W.landscapeImage.h)/-2:0,o=W.landscapeImage.w,a=p>W.landscapeImage.h?W.landscapeImage.h:p);var l,d,f=s&&c<W.portraitImage.w;return{el:t?(l=e.source,(d=document.createElement("img")).className="mwe-popups-thumbnail",d.src=l,d):function(e,t,n,i,r,o,a,s){var u="http://www.w3.org/2000/svg",c=document.createElementNS(u,"polyline"),p=-1===e.indexOf("not-tall")?[0,0,0,s]:[0,s-1,a,s-1];c.setAttribute("stroke","rgba(0,0,0,0.1)"),c.setAttribute("points",p.join(" ")),c.setAttribute("stroke-width",1);var l=$(document.createElementNS(u,"image"));l[0].setAttributeNS("http://www.w3.org/1999/xlink","href",t),l.addClass(e).attr({x:n,y:i,width:r,height:o});var d=$(document.createElementNS(u,"svg")).attr({xmlns:u,width:a,height:s}).append(l);return d.append(c),d}(s?"mwe-popups-is-tall":"mwe-popups-is-not-tall",e.source,i,r,c,p,o,a),isTall:s,isNarrow:f,offset:f?W.portraitImage.w-c:0,width:c,height:p}}var F='\n\t<div class="mwe-popups" aria-hidden></div>\n';function M(e,t){var n=N(F);return n.className="mwe-popups mwe-popups-type-".concat(e),t.className="mwe-popups-container",n.appendChild(t),$(n)}var Y='\n\t<div class="mwe-popups-container">\n\t\t<div class="mw-ui-icon mw-ui-icon-element"></div>\n\t\t<strong class="mwe-popups-title"></strong>\n\t\t<a class="mwe-popups-extract">\n\t\t\t<span class="mwe-popups-message"></span>\n\t\t</a>\n\t\t<footer>\n\t\t\t<a class="mwe-popups-read-link"></a>\n\t\t</footer>\n\t</div>\n';function U(e,t,n,i){var r=M(e.type,N(Y));return r.find(".mw-ui-icon ").addClass("mw-ui-icon-preview-".concat(e.type)),r.find(".mwe-popups-extract").attr("href",e.url),r.find(".mwe-popups-message").html(k(n)),r.find(".mwe-popups-read-link").html(k(i)).attr("href",e.url),t?r.find(".mwe-popups-title").html(k(e.title)):r.find(".mwe-popups-title").remove(),r}var V='\n<div class="mwe-popups-container">\n <div class="mwe-popups-extract">\n <div class="mwe-popups-scroll">\n <strong class="mwe-popups-title">\n <span class="mw-ui-icon mw-ui-icon-element"></span>\n <span class="mwe-popups-title-placeholder"></span>\n </strong>\n <div class="mw-parser-output"></div>\n </div>\n <div class="mwe-popups-fade"></div>\n </div>\n\t<footer>\n\t\t<div class="mwe-popups-settings"></div>\n\t</footer>\n</div>',X="event.ReferencePreviewsPopups",K=!1;function q(e){var t=e.referenceType||"generic",n=mw.message("popups-refpreview-".concat(t));n.exists()||(n=mw.message("popups-refpreview-reference"));var i=M(e.type,N(V));return i.find(".mwe-popups-title-placeholder").replaceWith(k(n.text())),i.find(".mwe-popups-title .mw-ui-icon").addClass("mw-ui-icon-reference-".concat(t)),i.find(".mw-parser-output").html(e.extract),i.find('.mwe-popups-extract a[href][class~="external"]:not([target])').each(function(e,t){t.target="_blank",t.rel="".concat(t.rel?"".concat(t.rel," "):"","noopener")}),i.find(".mw-collapsible").replaceWith($("<div>").addClass("mwe-collapsible-placeholder").append($("<span>").addClass("mw-ui-icon mw-ui-icon-element mw-ui-icon-infoFilled"),$("<div>").addClass("mwe-collapsible-placeholder-label").text(mw.msg("popups-refpreview-collapsible-placeholder")))),i.find("table.sortable").removeClass("sortable jquery-tablesorter").find(".headerSort").removeClass("headerSort").attr({tabindex:null,title:null}),!0!==mw.config.get("wgPopupsReferencePreviewsBetaFeature")?i.find(".mwe-popups-settings").append($("<a>").addClass("mwe-popups-settings-icon").append($("<span>").addClass("mw-ui-icon mw-ui-icon-element mw-ui-icon-small mw-ui-icon-settings"))):i.find(".mwe-popups-container").addClass("footer-empty"),K&&i.find(".mw-parser-output").on("click","a",function(){mw.track(X,{action:"clickedReferencePreviewsContentLink"})}),i.find(".mwe-popups-scroll").on("scroll",function(e){var t=e.target,n=t.scrollTop>=t.scrollHeight-t.clientHeight-1;if(K&&(t.isOpenRecorded||(mw.track(X,{action:"poppedOpen",scrollbarsPresent:t.scrollHeight>t.clientHeight}),t.isOpenRecorded=!0),t.scrollTop>0&&!t.isScrollRecorded&&(mw.track(X,{action:"scrolled"}),t.isScrollRecorded=!0)),n||!t.isScrolling){var i=$(t).parent(),r=t.scrollWidth>t.clientWidth,o=t.offsetHeight-t.clientHeight,a=t.scrollHeight>t.clientHeight,s=t.offsetWidth-t.clientWidth;i.find(".mwe-popups-fade").css({bottom:r?"".concat(o,"px"):0,right:a?"".concat(s,"px"):0}),t.isScrolling=!n,i.toggleClass("mwe-popups-fade-out",t.isScrolling)}}),i}$(function(){mw.config.get("wgPopupsReferencePreviews")&&navigator.sendBeacon&&mw.config.get("wgIsArticle")&&!K&&(K=!0,mw.track(X,{action:"pageview"}))});var z=215,Z='\n<div>\n <a class="mwe-popups-discreet"></a>\n <a class="mwe-popups-extract"></a>\n <footer>\n <a class="mwe-popups-settings-icon">\n <span class="mw-ui-icon mw-ui-icon-element mw-ui-icon-small mw-ui-icon-settings"></span>\n </a>\n </footer>\n</div>\n\t';function J(e,t,n,i){var r=M(e.type,N(Z));r.find(".mwe-popups-discreet, .mwe-popups-extract").attr("href",e.url),r.find(".mwe-popups-extract").attr("dir",e.languageDirection).attr("lang",e.languageCode),r.find(".mwe-popups-settings-icon").attr("title",i),t?r.find(".mwe-popups-discreet").append(t.el):r.find(".mwe-popups-discreet").remove();var o=r.find(".mwe-popups-extract");if(e.extract){o.append(e.extract);var a=function(e){return e&&e.isNarrow?"".concat(z+e.offset,"px"):""}(t);n||(o.css("width",a),r.find("footer").css("width",a))}return r}var Q=450,ee=320,te=8,ne=28;function ie(){var e;oe()||(e=document.body,$("<div>").attr("id","mwe-popups-svg").html(j.a).appendTo(e))}function re(e){var t=function(e){switch(e.type){case c.TYPE_PAGE:return function(e){var t=B(e.thumbnail,oe()),n=null!==t,i=oe(),r=mw.msg("popups-settings-icon-gear-title");return{el:J(e,t,i,r),hasThumbnail:n,thumbnail:t,isTall:n&&t.isTall}}(e);case c.TYPE_DISAMBIGUATION:return function(e){var t=mw.msg("popups-preview-disambiguation"),n=mw.msg("popups-preview-disambiguation-link");return{el:U(e,!0,t,n),hasThumbnail:!1,isTall:!1}}(e);case c.TYPE_REFERENCE:return function(e){return{el:q(e),hasThumbnail:!1,isTall:!1}}(e);default:return function(e){var t=mw.msg("popups-preview-no-preview"),n=mw.msg("popups-preview-footer-read");return{el:U(e,!1,t,n),hasThumbnail:!1,isTall:!1}}(e)}}(e);return{show:function(e,n,i){return function(e,t,n,i,r,o,a){var s=function(e,t,n,i){var r,o=!1,a=!1,s=t.pageY?ae(t.pageY-t.scrollTop,t.clientRects,!1)+t.scrollTop+n:t.offset.top+t.height+te,u=t.clientY?t.clientY:s;r=t.pageX?t.width>ne?t.pageX:t.offset.left+t.width/2:t.offset.left;r>t.windowWidth/2&&(r+=t.pageX?0:t.width,r-=e?Q:ee,o=!0);t.pageX&&(r+=o?18:-18);u>t.windowHeight/2&&(a=!0,s=t.offset.top,t.pageY&&(s=ae(t.pageY-t.scrollTop,t.clientRects,!0)+t.scrollTop),s-=n);return{offset:{top:s,left:r},flippedX:"rtl"===i?!o:o,flippedY:a,dir:i}}(e.isTall,t,te,a);e.el.appendTo(o),function(e,t,n,i,r,o){var a=e.el,s=e.isTall,u=e.hasThumbnail,c=e.thumbnail,p=t.flippedY;!p&&!s&&u&&c.height<i&&!oe()&&a.find(".mwe-popups-extract").css("margin-top",c.height-r),a.addClass(n.join(" ")),a.css({left:"".concat(t.offset.left,"px"),top:p?"auto":t.offset.top,bottom:p?"".concat(o-t.offset.top,"px"):"auto"}),u&&!oe()&&function(e,t){var n=e.el,i=e.isTall,r=e.thumbnail,o=t.flippedY,a=t.flippedX,s=t.dir,u=function(e,t,n){return e||t?e&&n?t?"mwe-popups-landscape-mask-flip":"mwe-popups-landscape-mask":void 0:n?"mwe-popups-mask-flip":"mwe-popups-mask"}(i,o,a);if(u){var c={scaleX:1,translateX:i?Math.min(r.width-W.portraitImage.w,0):0};"rtl"===s&&(c.scaleX=-1,c.translateX=i?W.portraitImage.w:W.landscapeImage.w);var p=document.getElementById(u);p.setAttribute("transform","matrix(".concat(c.scaleX," 0 0 1 ").concat(c.translateX," 0)")),n.find("image")[0].setAttribute("clip-path","url(#".concat(u,")"))}}(e,t)}(e,s,function(e,t){var n=[];return t.flippedY?n.push("mwe-popups-fade-in-down"):n.push("mwe-popups-fade-in-up"),t.flippedY&&t.flippedX?n.push("flipped-x-y"):t.flippedY?n.push("flipped-y"):t.flippedX&&n.push("flipped-x"),e.hasThumbnail&&(!e.isTall||t.flippedX)||t.flippedY||n.push("mwe-popups-no-image-pointer"),!e.hasThumbnail||e.isTall||t.flippedY||n.push("mwe-popups-image-pointer"),e.isTall?n.push("mwe-popups-is-tall"):n.push("mwe-popups-is-not-tall"),n}(e,s),W.landscapeImage.h,te,t.windowHeight),e.el.show(),e.el.hasClass("mwe-popups-type-reference")&&e.el.find(".mwe-popups-scroll").first().trigger("scroll");return H(200).then(function(){!function(e,t){e.el.on("mouseenter",t.previewDwell).on("mouseleave",t.previewAbandon),e.el.click(t.click),e.el.find(".mwe-popups-settings-icon").attr("href",t.settingsUrl).click(function(e){e.stopPropagation(),t.showSettings(e)})}(e,i),i.previewShow(r)})}(t,e,$(e.target),n,i,document.body,document.documentElement.getAttribute("dir"))},hide:function(){return function(e){var t=e.el.hasClass("mwe-popups-fade-in-up")?"mwe-popups-fade-in-up":"mwe-popups-fade-in-down",n="mwe-popups-fade-in-up"===t?"mwe-popups-fade-out-down":"mwe-popups-fade-out-up";return e.el.removeClass(t).addClass(n),H(150).then(function(){e.el.remove()})}(t)}}}function oe(){return window.CSS&&"function"==typeof CSS.supports&&CSS.supports("clip-path","polygon(1px 1px)")}function ae(e,t,n){var i,r=null;return Array.prototype.slice.call(t).forEach(function(t){var o=Math.abs(e-t.top+e-t.bottom);(null===r||r>o)&&(r=o,i=n?Math.floor(t.top):Math.ceil(t.bottom))}),i}function se(e,t,n){return e[t]&&e[t][n]}function ue(e,t,n,i,r){var o=se(t,n,i);e&&se(e,n,i)!==o&&r(o)}var ce={footerLink:function(e){var t;return function(n,i){void 0===t&&(t=function(){var e=$("<li>").append($("<a>").attr("href","#").text(mw.message("popups-settings-enable").text()));e.hide();var t=$("#footer-places, #f-list");return 0===t.length&&(t=$("#footer li").parent()),t.append(e),e}()).on("click",function(t){t.preventDefault(),e.showSettings()}),i.settings.shouldShowFooterLink?t.show():t.hide()}},eventLogging:function(e,t,n){return function(i,r){var o=r.eventLogging,a=o.event;a&&(a=$.extend(!0,{},o.baseData,a,{timestamp:n()}),t("event.Popups",a),e.eventLogged(a))}},linkTitle:function(){var e;return function(t,n){var i,r=t&&t.preview.activeLink;n.preview.enabled&&(r&&t.preview.activeLink!==n.preview.activeLink&&(i=t.preview.activeLink,$(i).attr("title",e),e=void 0),n.preview.activeLink&&function(t){var n=$(t);e||(e=n.attr("title"),n.attr("title",""))}(n.preview.activeLink))}},pageviews:function(e,t){return function(n,i){var r;i.pageviews&&i.pageviews.pageview&&i.pageviews.page&&(r=i.pageviews.page,t("event.VirtualPageView",$.extend({},{source_page_id:r.id,source_namespace:r.namespaceId,source_title:r.title,source_url:r.url},i.pageviews.pageview)),e.pageviewLogged())}},render:function(e){var t;return function(n,i){i.preview.shouldShow&&!t?(t=re(i.preview.fetchResponse)).show(i.preview.measures,e,i.preview.activeToken):!i.preview.shouldShow&&t&&(t.hide(),t=void 0)}},settings:function(e,t){var n;return function(i,r){i&&(!1===i.settings.shouldShow&&!0===r.settings.shouldShow?(n||(n=t(e)).appendTo(document.body),n.setEnabled(r.preview.enabled),n.show()):!0===i.settings.shouldShow&&!1===r.settings.shouldShow&&n.hide(),i.settings.showHelp!==r.settings.showHelp&&n.toggleHelp(r.settings.showHelp))}},statsv:function(e,t){return function(n,i){var r=i.statsv;r.action&&(t(r.action,r.data),e.statsvLogged())}},syncUserSettings:function(e){return function(t,n){ue(t,n,"eventLogging","previewCount",e.setPreviewCount),ue(t,n,"preview","enabled",e.setIsEnabled)}}},pe={BOOT:"BOOT",LINK_DWELL:"LINK_DWELL",ABANDON_START:"ABANDON_START",ABANDON_END:"ABANDON_END",LINK_CLICK:"LINK_CLICK",FETCH_START:"FETCH_START",FETCH_END:"FETCH_END",FETCH_COMPLETE:"FETCH_COMPLETE",FETCH_FAILED:"FETCH_FAILED",FETCH_ABORTED:"FETCH_ABORTED",PAGEVIEW_LOGGED:"PAGEVIEW_LOGGED",PREVIEW_DWELL:"PREVIEW_DWELL",PREVIEW_SHOW:"PREVIEW_SHOW",PREVIEW_CLICK:"PREVIEW_CLICK",PREVIEW_SEEN:"PREVIEW_SEEN",SETTINGS_SHOW:"SETTINGS_SHOW",SETTINGS_HIDE:"SETTINGS_HIDE",SETTINGS_CHANGE:"SETTINGS_CHANGE",EVENT_LOGGED:"EVENT_LOGGED",STATSV_LOGGED:"STATSV_LOGGED"},le=150,de=1e3,fe=350+le,we=150,ge=300;function me(e){return e.timestamp=mw.now(),e}function he(e,t,n,i,r){var o=i.get("wgUserEditCount"),a=n.getPreviewCount();return{type:pe.BOOT,isEnabled:e,isNavPopupsEnabled:i.get("wgPopupsConflictsWithNavPopupGadget"),sessionToken:t.sessionId(),pageToken:t.getPageviewToken(),page:{url:r,title:i.get("wgTitle"),namespaceId:i.get("wgNamespaceNumber"),id:i.get("wgArticleId")},user:{isAnon:t.isAnon(),editCount:o,previewCount:a}}}function ve(e,t,n,i,r){var o=t.getPrefixedDb(),a=t.namespace;return function(s){var u=e.fetchPreviewForTitle(t,n);s(me({type:pe.FETCH_START,el:n,title:o,namespaceId:a,promise:u}));var p=u.then(function(e){return s(me({type:pe.FETCH_END,el:n})),e}).catch(function(e,t){var r=new Error(e),o=t&&t.textStatus&&"abort"===t.textStatus?pe.FETCH_ABORTED:pe.FETCH_FAILED;throw r.data=t,s({type:o,el:n,token:i}),r});return $.when(p,H(function(e){switch(e){case c.TYPE_PAGE:return fe-le;case c.TYPE_REFERENCE:return we;default:return 0}}(r))).then(function(e){s({type:pe.FETCH_COMPLETE,el:n,result:e,token:i})}).catch(function(e){var r=e.data,a=!0;r&&r.xhr&&0===r.xhr.readyState&&(a=!("error"===r.textStatus&&""===r.exception||"abort"===r.textStatus));a&&s({type:pe.FETCH_COMPLETE,el:n,result:l(o,t.getUrl()),token:i})})}}function Ee(e,t,n,i,r,o){var a=r(),s=e.getPrefixedDb(),u=e.namespace;return function(r,c){var p=H(le),l=me({type:pe.LINK_DWELL,el:t,measures:n,token:a,title:s,namespaceId:u,promise:p});function d(){return c().preview.activeToken===a}return r(l),d()?p.then(function(){if(c().preview.enabled&&d())return r(ve(i,e,t,a,o))}):$.Deferred().resolve().promise()}}function Te(){return function(e,t){var n=t().preview,i=n.activeToken,r=n.promise;return i?(e(me({type:pe.ABANDON_START,token:i})),"abort"in r&&r.abort(),H(ge).then(function(){e({type:pe.ABANDON_END,token:i})})):$.Deferred().resolve().promise()}}function be(e){return me({type:pe.LINK_CLICK,el:e})}function ye(){return{type:pe.PREVIEW_DWELL}}function _e(e){return function(t,n){return t(me({type:pe.PREVIEW_SHOW,token:e})),H(de).then(function(){var i=n().preview,r=i&&i.fetchResponse,o=i&&i.activeToken,a=r&&[c.TYPE_PAGE,c.TYPE_DISAMBIGUATION].indexOf(r.type)>-1;o&&o===e&&r&&a&&t({type:pe.PREVIEW_SEEN,title:r.title,pageId:r.pageId,namespace:0})})}}function Pe(){return{type:pe.PAGEVIEW_LOGGED}}function Se(){return{type:pe.SETTINGS_SHOW}}function xe(){return{type:pe.SETTINGS_HIDE}}function Ie(e){return function(t,n){t({type:pe.SETTINGS_CHANGE,wasEnabled:n().preview.enabled,enabled:e})}}function ke(e){return{type:pe.EVENT_LOGGED,event:e}}function Ce(){return{type:pe.STATSV_LOGGED}}function Ne(e,t){var n={},i=Object.prototype.hasOwnProperty;for(var r in e)i.call(e,r)&&!i.call(t,r)&&(n[r]=e[r]);for(var o in t)i.call(t,o)&&(n[o]=t[o]);return n}var Ae=n("./src/counts.js");function Oe(e,t){return t.linkInteractionToken=e.token,t.pageTitleHover=e.title,t.namespaceIdHover=e.namespaceId,void 0!==e.timeToPreviewShow&&(t.previewType=e.previewType,t.perceivedWait=e.timeToPreviewShow),t}function Le(e){var t={totalInteractionTime:Math.round(e.finished-e.started)};if(!e.finalized)return t.action=e.timeToPreviewShow?"dismissed":"dwelledButAbandoned",Oe(e,t)}var De={eventLogging:function(e,t){var n,i,r,o;if(void 0===e&&(e={previewCount:void 0,baseData:{},interaction:void 0,event:void 0}),-1!==[pe.FETCH_COMPLETE,pe.ABANDON_END,pe.PREVIEW_SHOW].indexOf(t.type)&&(!e.interaction||t.token!==e.interaction.token))return e;if(!e.interaction&&t.type!==pe.BOOT&&t.type!==pe.LINK_DWELL&&t.type!==pe.EVENT_LOGGED&&t.type!==pe.SETTINGS_CHANGE)return e;switch(t.type){case pe.BOOT:return Ne(e,{previewCount:t.user.previewCount,baseData:(r=t,o={pageTitleSource:r.page.title,namespaceIdSource:r.page.namespaceId,pageIdSource:r.page.id,isAnon:r.user.isAnon,popupEnabled:r.isEnabled,pageToken:r.pageToken,sessionToken:r.sessionToken,previewCountBucket:Ae.getPreviewCountBucket(r.user.previewCount),hovercardsSuppressedByGadget:r.isNavPopupsEnabled},r.user.isAnon||(o.editCountBucket=Ae.getEditCountBucket(r.user.editCount)),o),event:{action:"pageLoaded"}});case pe.EVENT_LOGGED:return i=Ne(e,{event:void 0}),t.event.linkInteractionToken&&e.interaction&&t.event.linkInteractionToken===e.interaction.token&&(i.interaction=void 0),i;case pe.FETCH_COMPLETE:return Ne(e,{interaction:Ne(e.interaction,{previewType:t.result.type})});case pe.PREVIEW_SHOW:return Ne(e,{previewCount:n=e.previewCount+1,baseData:Ne(e.baseData,{previewCountBucket:Ae.getPreviewCountBucket(n)}),interaction:Ne(e.interaction,{timeToPreviewShow:Math.round(t.timestamp-e.interaction.started)})});case pe.LINK_DWELL:return e.interaction&&t.el===e.interaction.link?Ne(e,{interaction:Ne(e.interaction,{isUserDwelling:!0})}):Ne(e,{interaction:{link:t.el,title:t.title,namespaceId:t.namespaceId,token:t.token,started:t.timestamp,isUserDwelling:!0},event:e.interaction?Le(e.interaction):void 0});case pe.PREVIEW_DWELL:return Ne(e,{interaction:Ne(e.interaction,{isUserDwelling:!0})});case pe.LINK_CLICK:return Ne(e,{interaction:Ne(e.interaction,{finalized:!0}),event:Oe(e.interaction,{action:"opened",totalInteractionTime:Math.round(t.timestamp-e.interaction.started)})});case pe.ABANDON_START:return Ne(e,{interaction:Ne(e.interaction,{finished:t.timestamp,isUserDwelling:!1})});case pe.ABANDON_END:return e.interaction.isUserDwelling?e:Ne(e,{interaction:void 0,event:Le(e.interaction)});case pe.SETTINGS_SHOW:return Ne(e,{event:Oe(e.interaction,{action:"tapped settings cog"})});case pe.SETTINGS_CHANGE:return t.wasEnabled&&!t.enabled?Ne(e,{event:{action:"disabled",popupEnabled:!1}}):e;default:return e}},pageviews:function(e,t){switch(void 0===e&&(e={pageview:void 0}),t.type){case pe.BOOT:return Ne(e,{page:t.page});case pe.PAGEVIEW_LOGGED:return Ne(e,{pageview:void 0});case pe.PREVIEW_SEEN:return Ne(e,{pageview:{page_title:t.title,page_id:t.pageId,page_namespace:t.namespace}});default:return e}},preview:function(e,t){switch(void 0===e&&(e={enabled:void 0,activeLink:void 0,measures:void 0,activeToken:"",shouldShow:!1,isUserDwelling:!1,wasClicked:!1}),t.type){case pe.BOOT:return Ne(e,{enabled:t.isEnabled});case pe.SETTINGS_CHANGE:return Ne(e,{enabled:t.enabled});case pe.LINK_DWELL:return t.el!==e.activeLink?Ne(e,{activeLink:t.el,measures:t.measures,activeToken:t.token,shouldShow:!1,isUserDwelling:!0,promise:t.promise}):Ne(e,{isUserDwelling:!0});case pe.FETCH_ABORTED:case pe.ABANDON_END:return t.token!==e.activeToken||e.isUserDwelling?e:Ne(e,{activeLink:void 0,activeToken:void 0,measures:void 0,fetchResponse:void 0,shouldShow:!1});case pe.PREVIEW_DWELL:return Ne(e,{isUserDwelling:!0});case pe.ABANDON_START:return Ne(e,{isUserDwelling:!1,wasClicked:!1});case pe.FETCH_START:return Ne(e,{fetchResponse:void 0,promise:t.promise});case pe.FETCH_COMPLETE:if(t.token===e.activeToken)return Ne(e,{fetchResponse:t.result,shouldShow:e.isUserDwelling});default:return e}},settings:function(e,t){switch(void 0===e&&(e={shouldShow:!1,showHelp:!1,shouldShowFooterLink:!1}),t.type){case pe.SETTINGS_SHOW:return Ne(e,{shouldShow:!0,showHelp:!1});case pe.SETTINGS_HIDE:return Ne(e,{shouldShow:!1,showHelp:!1});case pe.SETTINGS_CHANGE:return t.wasEnabled===t.enabled?Ne(e,{shouldShow:!1}):Ne(e,{shouldShow:!t.enabled,showHelp:!t.enabled,shouldShowFooterLink:!t.enabled});case pe.BOOT:return Ne(e,{shouldShowFooterLink:t.user.isAnon&&!t.isEnabled});default:return e}},statsv:function(e,t){switch(e=e||{},t.type){case pe.FETCH_START:return Ne(e,{fetchStartedAt:t.timestamp});case pe.FETCH_END:return Ne(e,{action:"timing.PagePreviewsApiResponse",data:t.timestamp-e.fetchStartedAt});case pe.FETCH_FAILED:return Ne(e,{action:"counter.PagePreviewsApiFailure",data:1});case pe.LINK_DWELL:return Ne(e,{linkDwellStartedAt:t.timestamp});case pe.PREVIEW_SHOW:return Ne(e,{action:"timing.PagePreviewsPreviewShow",data:t.timestamp-e.linkDwellStartedAt});case pe.STATSV_LOGGED:return Ne(e,{action:null,data:null});default:return e}}};function Re(e){var t,n,i,r=e;return r.source_title=mw.Title.newFromText(e.source_title).getPrefixedDb(),r.page_title=mw.Title.newFromText(e.page_title).getPrefixedDb(),r.source_url=(t=e.source_url,n=1e3,i="",t.split("").every(function(e){return encodeURIComponent(i+e).length<n&&(i+=e)}),i),r}var He=function(e,t,n,i){return e.get("wgPopupsVirtualPageViews")?function(e,r){var o,a=(o=e.slice(e.indexOf(".")+1))[0].toUpperCase()+o.slice(1);return t(["ext.eventLogging"]).then(function(){var e=n(),t=e.prepare(a,Re(r)),o=e.makeBeaconUrl(t);i(o)})}:function(){}};var Ge=1,je=2,We=4,Be=8;var Fe=[".extiw",".image",".new",".internal",".external",".mw-cite-backlink a",".oo-ui-buttonedElement-button",".ve-ce-surface a",".cancelLink a"];function $e(){return window.performance&&window.performance.now?Math.round(window.performance.now()):null}!function(){var e,t;e=mw.config,t=parseInt(e.get("wgPopupsFlags"),10),e.set("wgPopupsConflictsWithNavPopupGadget",!!(t&Ge)),e.set("wgPopupsConflictsWithRefTooltipsGadget",!!(t&je)),e.set("wgPopupsReferencePreviews",!!(t&We)),e.set("wgPopupsReferencePreviewsBeta",!!(t&Be));var n,o,s,u=r.compose,p=mw.user.generateRandomSessionId,l=P(mw.config),f=S(),w=(s=mw.storage,{getIsEnabled:function(){return"0"!==s.get(x)},setIsEnabled:function(e){s.set(x,e?"1":"0")},hasIsEnabled:function(){var e=s.get(x);return!1!==Boolean(e)},getPreviewCount:function(){var e=s.get(I);if(!1===e)return-1;if(null===e)return 0;var t=parseInt(e,10);return isNaN(t)&&(t=0,this.setPreviewCount(t)),t},setPreviewCount:function(e){s.set(I,e.toString())}}),g=O(mw.config),m=(o=mw.experiments,{weightedBoolean:function(e,t,n){return"true"===o.getBucket({enabled:!0,name:e,buckets:{true:t,false:1-t}},n)}}),h=function(e,t,n){return function(e,t,n){var i=t.get("wgPopupsStatsvSamplingRate",0);return n.weightedBoolean("ext.Popups.statsv",i,e.sessionId())}(e,t,n)?mw.track:function(){}}(mw.user,mw.config,m),v=He(mw.config,mw.loader.using,function(){return mw.eventLog},(n=window.navigator).sendBeacon?n.sendBeacon.bind(n):function(e){document.createElement("img").src=e}),E=function(e,t,n){return function(e,t,n){return!0===t.get("debug")||t.get("wgPopupsEventLogging")&&n.navigator&&"function"==typeof n.navigator.sendBeacon}(0,t,n)?mw.track:function(){}}(mw.user,mw.config,window),T=function(e,t,n){return!n.get("wgPopupsConflictsWithNavPopupGadget")&&(!e.isAnon()||!t.hasIsEnabled()||t.getIsEnabled())}(mw.user,w,mw.config);!0===mw.config.get("debug")&&(u=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||u);var b=r.createStore(r.combineReducers(De),u(r.applyMiddleware(a.a))),y=r.bindActionCreators(i,b.dispatch),_=function(e,t){var n,i=function(){};e.isAnon()?i=function(e){e.preventDefault(),t.showSettings()}:n=mw.Title.newFromText("Special:Preferences#mw-prefsection-rendering").getUrl();return{settingsUrl:n,showSettings:i,previewDwell:t.previewDwell,previewAbandon:t.abandon,previewShow:t.previewShow,click:t.linkClick}}(mw.user,y);!function(e,t,n,i,r,o,a,s,u){D(e,ce.footerLink(t)),D(e,ce.linkTitle()),D(e,ce.render(r)),D(e,ce.statsv(t,o)),D(e,ce.syncUserSettings(n)),D(e,ce.settings(t,i)),D(e,ce.eventLogging(t,a,u)),D(e,ce.pageviews(t,s))}(b,y,w,g,_,h,E,v,$e),y.boot(T,mw.user,w,mw.config,window.location.href),mw.popups=function(e){return{isEnabled:function(){return e.getState().preview.enabled}}}(b);var k=[];if(mw.user.isAnon()||"1"===mw.user.options.get("popups")){var C=Fe.join(", ");k.push("#mw-content-text a[href][title]:not(".concat(C,")"))}if(function(e){return e.get("wgPopupsReferencePreviews")&&!e.get("wgPopupsConflictsWithRefTooltipsGadget")&&"minerva"!==e.get("skin")}(mw.config)&&k.push('#mw-content-text .reference a[ href*="#" ]'),k.length){var N=k.join(", ");ie(),$(document).on("mouseover keyup",N,function(e){var t=R(this,mw.config);if(t){var n,i=d(this,mw.config,t);switch(i){case c.TYPE_PAGE:n=l;break;case c.TYPE_REFERENCE:n=f;break;default:return}var r=$(this),o=$(window),a={pageX:e.pageX,pageY:e.pageY,clientY:e.clientY,width:r.width(),height:r.height(),offset:r.offset(),clientRects:this.getClientRects(),windowWidth:o.width(),windowHeight:o.height(),scrollTop:o.scrollTop()};y.linkDwell(t,this,a,n,p,i)}}).on("mouseout blur",N,function(){R(this,mw.config)&&y.abandon()}).on("click",N,function(){var e=R(this,mw.config);e&&c.TYPE_PAGE===d(this,mw.config,e)&&y.linkClick(this)})}else mw.log.error("ext.popups should not even be loaded!")}(),window.Redux=r,window.ReduxThunk=o},"./src/ui/pointer-mask.svg":function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"><defs><clipPath id="mwe-popups-mask"><path d="M0 8h10l8-8 8 8h974v992H0z"></path></clipPath><clipPath id="mwe-popups-mask-flip"><path d="M0 8h294l8-8 8 8h690v992H0z"></path></clipPath><clipPath id="mwe-popups-landscape-mask"><path d="M0 8h174l8-8 8 8h810v992H0z"></path></clipPath><clipPath id="mwe-popups-landscape-mask-flip"><path d="M0 0h1000v242H190l-8 8-8-8H0z"></path></clipPath></defs></svg>'}});
//# sourceMappingURL=index.js.map.json