mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-24 07:34:11 +00:00
09c2c52945
We added reference preview as a checkbox the the anonymous user settings. To handle both popup types (pages and references), we changed the usage of preview.enabled. We pass on all types as a map inside preview.enabled. The footer link to edit the settings will appear for anonymous users if at least one type is disabled. Bug: T277639 Change-Id: I860a1b35ac7749d8d0884575f6acb7186ad8e4d0
2 lines
44 KiB
JavaScript
2 lines
44 KiB
JavaScript
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.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,r=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,r,e):t(i)}}}}t.__esModule=!0;var r=n();r.withExtraArgument=n,t.default=r}])},"./node_modules/redux/dist/redux.min.js":function(e,t,n){(function(e,n){!function(t){"use strict";var r=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),i=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+i(),REPLACE:"@@redux/REPLACE"+i(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+i()}};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,i){var a;if("function"==typeof n&&"function"==typeof i||"function"==typeof i&&"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===i&&(i=n,n=void 0),void 0!==i){if("function"!=typeof i)throw Error("Expected the enhancer to be a function.");return i(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})}})[r]=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)}}})[r]=function(){return this},e},a},t.combineReducers=function(e){for(var t=Object.keys(e),n={},r=0;t.length>r;r++){var i=t[r];"function"==typeof e[i]&&(n[i]=e[i])}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 r=!1,i={},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)}i[c]=l,r=r||l!==p}return r?i: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),r={},i=0;n.length>i;i++){var o=n[i],a=e[o];"function"==typeof a&&(r[o]=s(a,t))}return r},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),r=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},i={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},o=t.map(function(e){return e(i)});return function(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){u(e,t,n[t])})}return e}({},n,{dispatch:r=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 r={};n.r(r),n.d(r,"boot",function(){return Ee}),n.d(r,"fetch",function(){return Te}),n.d(r,"linkDwell",function(){return be}),n.d(r,"abandon",function(){return ye}),n.d(r,"linkClick",function(){return Pe}),n.d(r,"previewDwell",function(){return _e}),n.d(r,"previewShow",function(){return Se}),n.d(r,"pageviewLogged",function(){return xe}),n.d(r,"showSettings",function(){return ke}),n.d(r,"hideSettings",function(){return Ie}),n.d(r,"saveSettings",function(){return Ce}),n.d(r,"eventLogged",function(){return Ne}),n.d(r,"statsvLogged",function(){return Ae});var i=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,r,i,o,a,s){var u=function(e){if(null==e||0===e.length)return;return e}(i);return{title:e,url:t,languageCode:n,languageDirection:r,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=[],r="<bi-".concat(Math.random(),">"),i="<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(i).concat(r,"$2").concat(i,"$3"))).split(i)).forEach(function(e){0===e.indexOf(r)?n.push($("<b>").text(e.substring(r.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 r(n){var r=t.endpoint;return e({url:r+encodeURIComponent(n),headers:{Accept:'application/json; charset=utf-8; profile="'.concat(v,'"'),"Accept-Language":t.acceptLanguage}})}return{fetch:r,convertPageToModel:b,fetchPreviewForTitle:function(e){var i=e.getPrefixedDb(),o=r(i);return o.then(function(e){return(e=e||{}).title=e.title||i,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 r=e.source.split("/"),i=r[r.length-1],o=function(e){return new RegExp(/\.(jpg|jpeg|png|gif)$/i).test(e)}(t.source)||void 0,a=i.indexOf("px-");if(-1===a)return o&&t;var s,u,c=i.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:(r[r.length-1]="".concat(s,"px-").concat(c),{source:r.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 P(e){return f(e.extract,e.title)}function _(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,P);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,r){for(var i=r.className.split(/\s+/),o=i.length;o--;)if(-1!==t.indexOf(i[o]))return n=i[o],!1}),n}return{fetchPreviewForTitle:function(t,n){var r=t.getFragment().replace(/ /g,"_"),i=function(e){var t="#".concat($.escapeSelector(e));return $("".concat(t," .mw-reference-text, ").concat(t," .reference-text"))}(r);if(!i.length||!i.text().trim()&&!i.children().length)return $.Deferred().reject("Footnote not found",{textStatus:"abort",xhr:{readyState:0}}).promise({abort:function(){}});var o={url:"#".concat(r),extract:i.html(),type:c.TYPE_REFERENCE,referenceType:e(i),sourceElementId:n&&n.parentNode&&n.parentNode.id};return $.Deferred().resolve(o).promise({abort:function(){}})}}}var x="mwe-popups-enabled",k="mwe-popups-referencePreviews-enabled",I="event.ReferencePreviewsPopups",C="ext.popups.core.previewCount";function N(e){return mw.html.escape(e)}var A={};function O(e){if(!A[e]){var t=document.createElement("div");t.innerHTML=e,A[e]=t.firstElementChild}return A[e].cloneNode(!0)}function R(e){var t=N(e.heading),n=N(e.saveLabel),r=N(e.closeLabel),i=N(e.helpText),o=N(e.okLabel),a=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(e){var t=e.id,n=e.name,r=e.description,i=e.isChecked;return{id:N(t),name:N(n),description:r?N(r):"",isChecked:i}})}(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(r,"</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,r=e.description,i=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\t".concat(i?"checked":"","\n\t\t\t\t\t\t\tvalue='").concat(t,"'\n\t\t\t\t\t\t\ttype='checkbox'\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(r,"\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(i,"</p>\n\t\t\t</div>\n\t\t</section>\n\t").trim()))}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e){var t,n;return function(r){var i,o;return t||(i=e.get("wgPopupsReferencePreviewsBetaFeature"),o=[{id:c.TYPE_PAGE,name:mw.msg("popups-settings-option-simple"),description:mw.msg("popups-settings-option-simple-description")},{id:c.TYPE_REFERENCE,name:mw.msg("popups-settings-option-reference"),description:mw.msg("popups-settings-option-reference-description")}],i&&o.splice(1,1),t=R({heading:mw.msg("popups-settings-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:o}),n=$("<div>").addClass("mwe-popups-overlay"),t.find(".save").on("click",function(){var n,i=t.find("#mwe-popups-settings-"+c.TYPE_PAGE),o=t.find("#mwe-popups-settings-"+c.TYPE_REFERENCE);r.saveSettings((L(n={},c.TYPE_PAGE,i.is(":checked")),L(n,c.TYPE_REFERENCE,e.get("wgPopupsReferencePreviewsBetaFeature")?null:o.is(":checked")),n))}),t.find(".close, .okay").on("click",r.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,n){t.find("#mwe-popups-settings-"+e).prop("checked",n)}}}}function G(e,t){var n;e.subscribe(function(){var r=e.getState();n!==r&&(t(n,r),n=r)})}function H(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 r,i=Object.keys(n.query).length;if(i)1===i&&"title"in n.query&&(r=n.query.title);else{var o=mw.util.escapeRegExp(t.get("wgArticlePath")).replace("\\$1","([^?#]+)"),a=new RegExp(o).exec(n.path);try{r=a&&decodeURIComponent(a[1])}catch(e){}}return r?"".concat(r).concat(n.fragment?"#".concat(n.fragment):""):void 0}}(e.href,t),t.get("wgContentNamespaces"))}function j(e){var t=$.Deferred();return setTimeout(function(){return t.resolve()},e),t.promise()}var F=n("./src/ui/pointer-mask.svg"),Y=n.n(F),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 r,i,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?(r=c>W.portraitImage.w?(c-W.portraitImage.w)/-2:W.portraitImage.w-c,i=p>W.portraitImage.h?(p-W.portraitImage.h)/-2:0,o=W.portraitImage.w,a=W.portraitImage.h,c<o&&(r=0,o=c)):(r=0,i=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,r,i,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:r,width:i,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,r,i,c,p,o,a),isTall:s,isNarrow:f,offset:f?W.portraitImage.w-c:0,width:c,height:p}}var V='\n\t<div class="mwe-popups" aria-hidden></div>\n';function M(e,t){var n=O(V);return n.className="mwe-popups mwe-popups-type-".concat(e),t.className="mwe-popups-container",n.appendChild(t),$(n)}var U='\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 X(e,t,n,r){var i=M(e.type,O(U));return i.find(".mw-ui-icon ").addClass("mw-ui-icon-preview-".concat(e.type)),i.find(".mwe-popups-extract").attr("href",e.url),i.find(".mwe-popups-message").html(N(n)),i.find(".mwe-popups-read-link").html(N(r)).attr("href",e.url),t?i.find(".mwe-popups-title").html(N(e.title)):i.find(".mwe-popups-title").remove(),i}var K='\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>',q="event.ReferencePreviewsPopups",z=!1;function Z(e){var t=e.referenceType||"generic",n=mw.message("popups-refpreview-".concat(t));n.exists()||(n=mw.message("popups-refpreview-reference"));var r=M(e.type,O(K));return r.find(".mwe-popups-title-placeholder").replaceWith(N(n.text())),r.find(".mwe-popups-title .mw-ui-icon").addClass("mw-ui-icon-reference-".concat(t)),r.find(".mw-parser-output").html(e.extract),r.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")}),r.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")))),r.find("table.sortable").removeClass("sortable jquery-tablesorter").find(".headerSort").removeClass("headerSort").attr({tabindex:null,title:null}),!0!==mw.config.get("wgPopupsReferencePreviewsBetaFeature")?r.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"))):r.find(".mwe-popups-container").addClass("footer-empty"),z&&r.find(".mw-parser-output").on("click","a",function(){mw.track(q,{action:"clickedReferencePreviewsContentLink"})}),r.find(".mwe-popups-scroll").on("scroll",function(e){var t=e.target,n=t.scrollTop>=t.scrollHeight-t.clientHeight-1;if(z&&(t.isOpenRecorded||(mw.track(q,{action:"poppedOpen",scrollbarsPresent:t.scrollHeight>t.clientHeight}),t.isOpenRecorded=!0),t.scrollTop>0&&!t.isScrollRecorded&&(mw.track(q,{action:"scrolled"}),t.isScrollRecorded=!0)),n||!t.isScrolling){var r=$(t).parent(),i=t.scrollWidth>t.clientWidth,o=t.offsetHeight-t.clientHeight,a=t.scrollHeight>t.clientHeight,s=t.offsetWidth-t.clientWidth;r.find(".mwe-popups-fade").css({bottom:i?"".concat(o,"px"):0,right:a?"".concat(s,"px"):0}),t.isScrolling=!n,r.toggleClass("mwe-popups-fade-out",t.isScrolling)}}),r}$(function(){mw.config.get("wgPopupsReferencePreviews")&&navigator.sendBeacon&&mw.config.get("wgIsArticle")&&!z&&(z=!0,mw.track(q,{action:"pageview"}))});var J=215,Q='\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 ee(e,t,n,r){var i=M(e.type,O(Q));i.find(".mwe-popups-discreet, .mwe-popups-extract").attr("href",e.url),i.find(".mwe-popups-extract").attr("dir",e.languageDirection).attr("lang",e.languageCode),i.find(".mwe-popups-settings-icon").attr("title",r),t?i.find(".mwe-popups-discreet").append(t.el):i.find(".mwe-popups-discreet").remove();var o=i.find(".mwe-popups-extract");if(e.extract){o.append(e.extract);var a=function(e){return e&&e.isNarrow?"".concat(J+e.offset,"px"):""}(t);n||(o.css("width",a),i.find("footer").css("width",a))}return i}var te=450,ne=320,re=8,ie=28;function oe(){var e;se()||(e=document.body,$("<div>").attr("id","mwe-popups-svg").html(Y.a).appendTo(e))}function ae(e){var t=function(e){switch(e.type){case c.TYPE_PAGE:return function(e){var t=B(e.thumbnail,se()),n=null!==t,r=se(),i=mw.msg("popups-settings-icon-gear-title");return{el:ee(e,t,r,i),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:X(e,!0,t,n),hasThumbnail:!1,isTall:!1}}(e);case c.TYPE_REFERENCE:return function(e){return{el:Z(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:X(e,!1,t,n),hasThumbnail:!1,isTall:!1}}(e)}}(e);return{show:function(e,n,r){return function(e,t,n,r,i,o,a){var s=function(e,t,n,r){var i,o=!1,a=!1,s=t.pageY?ue(t.pageY-t.scrollTop,t.clientRects,!1)+t.scrollTop+n:t.offset.top+t.height+re,u=t.clientY?t.clientY:s;i=t.pageX?t.width>ie?t.pageX:t.offset.left+t.width/2:t.offset.left;i>t.windowWidth/2&&(i+=t.pageX?0:t.width,i-=e?te:ne,o=!0);t.pageX&&(i+=o?18:-18);u>t.windowHeight/2&&(a=!0,s=t.offset.top,t.pageY&&(s=ue(t.pageY-t.scrollTop,t.clientRects,!0)+t.scrollTop),s-=n);return{offset:{top:s,left:i},flippedX:"rtl"===r?!o:o,flippedY:a,dir:r}}(e.isTall,t,re,a);e.el.appendTo(o),function(e,t,n,r,i,o){var a=e.el,s=e.isTall,u=e.hasThumbnail,c=e.thumbnail,p=t.flippedY;!p&&!s&&u&&c.height<r&&!se()&&a.find(".mwe-popups-extract").css("margin-top",c.height-i),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&&!se()&&function(e,t){var n=e.el,r=e.isTall,i=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"}(r,o,a);if(u){var c={scaleX:1,translateX:r?Math.min(i.width-W.portraitImage.w,0):0};"rtl"===s&&(c.scaleX=-1,c.translateX=r?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,re,t.windowHeight),e.el.show(),e.el.hasClass("mwe-popups-type-reference")&&e.el.find(".mwe-popups-scroll").first().trigger("scroll");return j(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,r),r.previewShow(i)})}(t,e,$(e.target),n,r,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),j(150).then(function(){e.el.remove()})}(t)}}}function se(){return window.CSS&&"function"==typeof CSS.supports&&CSS.supports("clip-path","polygon(1px 1px)")}function ue(e,t,n){var r,i=null;return Array.prototype.slice.call(t).forEach(function(t){var o=Math.abs(e-t.top+e-t.bottom);(null===i||i>o)&&(i=o,r=n?Math.floor(t.top):Math.ceil(t.bottom))}),r}function ce(e,t){return t.split(".").reduce(function(e,t){return e&&e[t]},e)}function pe(e,t,n,r){var i=ce(t,n);e&&ce(e,n)!==i&&r(i)}var le={footerLink:function(e){var t;return function(n,r){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()}),r.settings.shouldShowFooterLink?t.show():t.hide()}},eventLogging:function(e,t,n){return function(r,i){var o=i.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 r,i=t&&t.preview.activeLink;n.preview.enabled[n.preview.previewType]&&(i&&t.preview.activeLink!==n.preview.activeLink&&(r=t.preview.activeLink,$(r).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,r){var i;r.pageviews&&r.pageviews.pageview&&r.pageviews.page&&(i=r.pageviews.page,t("event.VirtualPageView",$.extend({},{source_page_id:i.id,source_namespace:i.namespaceId,source_title:i.title,source_url:i.url},r.pageviews.pageview)),e.pageviewLogged())}},render:function(e){var t;return function(n,r){r.preview.shouldShow&&!t?(t=ae(r.preview.fetchResponse)).show(r.preview.measures,e,r.preview.activeToken):!r.preview.shouldShow&&t&&(t.hide(),t=void 0)}},settings:function(e,t){var n;return function(r,i){r&&(!1===r.settings.shouldShow&&!0===i.settings.shouldShow?(n||(n=t(e)).appendTo(document.body),n.setEnabled(c.TYPE_PAGE,i.preview.enabled[c.TYPE_PAGE]),n.setEnabled(c.TYPE_REFERENCE,i.preview.enabled[c.TYPE_REFERENCE]),n.show()):!0===r.settings.shouldShow&&!1===i.settings.shouldShow&&n.hide(),r.settings.showHelp!==i.settings.showHelp&&n.toggleHelp(i.settings.showHelp))}},statsv:function(e,t){return function(n,r){var i=r.statsv;i.action&&(t(i.action,i.data),e.statsvLogged())}},syncUserSettings:function(e){return function(t,n){pe(t,n,"eventLogging.previewCount",e.storePreviewCount),pe(t,n,"preview.enabled."+c.TYPE_PAGE,e.storePagePreviewsEnabled),pe(t,n,"preview.enabled."+c.TYPE_REFERENCE,e.storeReferencePreviewsEnabled)}}},de={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"},fe=150,we=1e3,ge=350+fe,me=150,he=300;function ve(e){return e.timestamp=mw.now(),e}function Ee(e,t,n,r,i){var o=r.get("wgUserEditCount"),a=n.getPreviewCount();return{type:de.BOOT,initiallyEnabled:e,isNavPopupsEnabled:r.get("wgPopupsConflictsWithNavPopupGadget"),sessionToken:t.sessionId(),pageToken:t.getPageviewToken(),page:{url:i,title:r.get("wgTitle"),namespaceId:r.get("wgNamespaceNumber"),id:r.get("wgArticleId")},user:{isAnon:t.isAnon(),editCount:o,previewCount:a}}}function Te(e,t,n,r,i){var o=t.getPrefixedDb(),a=t.namespace;return function(s){var u=e.fetchPreviewForTitle(t,n);s(ve({type:de.FETCH_START,el:n,title:o,namespaceId:a,promise:u}));var p=u.then(function(e){return s(ve({type:de.FETCH_END,el:n})),e}).catch(function(e,t){var i=new Error(e),o=t&&t.textStatus&&"abort"===t.textStatus?de.FETCH_ABORTED:de.FETCH_FAILED;throw i.data=t,s({type:o,el:n,token:r}),i});return $.when(p,j(function(e){switch(e){case c.TYPE_PAGE:return ge-fe;case c.TYPE_REFERENCE:return me;default:return 0}}(i))).then(function(e){s({type:de.FETCH_COMPLETE,el:n,result:e,token:r})}).catch(function(e){var i=e.data,a=!0;i&&i.xhr&&0===i.xhr.readyState&&(a=!("error"===i.textStatus&&""===i.exception||"abort"===i.textStatus));a&&s({type:de.FETCH_COMPLETE,el:n,result:l(o,t.getUrl()),token:r})})}}function be(e,t,n,r,i,o){var a=i(),s=e.getPrefixedDb(),u=e.namespace;return function(i,c){var p=j(fe),l=ve({type:de.LINK_DWELL,el:t,previewType:o,measures:n,token:a,title:s,namespaceId:u,promise:p});function d(){return c().preview.activeToken===a}return i(l),d()?p.then(function(){if(c().preview.enabled[o]&&d())return i(Te(r,e,t,a,o))}):$.Deferred().resolve().promise()}}function ye(){return function(e,t){var n=t().preview,r=n.activeToken,i=n.promise;return r?(e(ve({type:de.ABANDON_START,token:r})),"abort"in i&&i.abort(),j(he).then(function(){e({type:de.ABANDON_END,token:r})})):$.Deferred().resolve().promise()}}function Pe(e){return ve({type:de.LINK_CLICK,el:e})}function _e(){return{type:de.PREVIEW_DWELL}}function Se(e){return function(t,n){return t(ve({type:de.PREVIEW_SHOW,token:e})),j(we).then(function(){var r=n().preview,i=r&&r.fetchResponse,o=r&&r.activeToken,a=i&&[c.TYPE_PAGE,c.TYPE_DISAMBIGUATION].indexOf(i.type)>-1;o&&o===e&&i&&a&&t({type:de.PREVIEW_SEEN,title:i.title,pageId:i.pageId,namespace:0})})}}function xe(){return{type:de.PAGEVIEW_LOGGED}}function ke(){return{type:de.SETTINGS_SHOW}}function Ie(){return{type:de.SETTINGS_HIDE}}function Ce(e){return function(t,n){t({type:de.SETTINGS_CHANGE,oldValue:n().preview.enabled,newValue:e})}}function Ne(e){return{type:de.EVENT_LOGGED,event:e}}function Ae(){return{type:de.STATSV_LOGGED}}function Oe(e,t){var n,r={},i=Object.prototype.hasOwnProperty;for(var o in e)i.call(e,o)&&!i.call(t,o)&&(r[o]=e[o]);for(var a in t)if(i.call(t,a))if((n=t[a])&&n.constructor===Object){var s=e[a]?Oe({},e[a]):{};r[a]=Oe(s,t[a])}else r[a]=t[a];return r}var Re=n("./src/counts.js");function Le(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 De(e){var t={totalInteractionTime:Math.round(e.finished-e.started)};if(!e.finalized)return t.action=e.timeToPreviewShow?"dismissed":"dwelledButAbandoned",Le(e,t)}var Ge={eventLogging:function(e,t){var n,r,i,o;if(void 0===e&&(e={previewCount:void 0,baseData:{},interaction:void 0,event:void 0}),-1!==[de.FETCH_COMPLETE,de.ABANDON_END,de.PREVIEW_SHOW].indexOf(t.type)&&(!e.interaction||t.token!==e.interaction.token))return e;if(!e.interaction&&t.type!==de.BOOT&&t.type!==de.LINK_DWELL&&t.type!==de.EVENT_LOGGED&&t.type!==de.SETTINGS_CHANGE)return e;switch(t.type){case de.BOOT:return Oe(e,{previewCount:t.user.previewCount,baseData:(i=t,o={pageTitleSource:i.page.title,namespaceIdSource:i.page.namespaceId,pageIdSource:i.page.id,isAnon:i.user.isAnon,popupEnabled:i.initiallyEnabled[c.TYPE_PAGE],pageToken:i.pageToken,sessionToken:i.sessionToken,previewCountBucket:Re.getPreviewCountBucket(i.user.previewCount),hovercardsSuppressedByGadget:i.isNavPopupsEnabled},i.user.isAnon||(o.editCountBucket=Re.getEditCountBucket(i.user.editCount)),o),event:{action:"pageLoaded"}});case de.EVENT_LOGGED:return r=Oe(e,{event:void 0}),t.event.linkInteractionToken&&e.interaction&&t.event.linkInteractionToken===e.interaction.token&&(r.interaction=void 0),r;case de.FETCH_COMPLETE:return Oe(e,{interaction:{previewType:t.result.type}});case de.PREVIEW_SHOW:return Oe(e,{previewCount:n=e.previewCount+1,baseData:{previewCountBucket:Re.getPreviewCountBucket(n)},interaction:{timeToPreviewShow:Math.round(t.timestamp-e.interaction.started)}});case de.LINK_DWELL:return e.interaction&&t.el===e.interaction.link?Oe(e,{interaction:{isUserDwelling:!0}}):Oe(e,{interaction:{link:t.el,title:t.title,namespaceId:t.namespaceId,token:t.token,started:t.timestamp,isUserDwelling:!0},event:e.interaction?De(e.interaction):void 0});case de.PREVIEW_DWELL:return Oe(e,{interaction:{isUserDwelling:!0}});case de.LINK_CLICK:return Oe(e,{interaction:{finalized:!0},event:Le(e.interaction,{action:"opened",totalInteractionTime:Math.round(t.timestamp-e.interaction.started)})});case de.ABANDON_START:return Oe(e,{interaction:{finished:t.timestamp,isUserDwelling:!1}});case de.ABANDON_END:return e.interaction.isUserDwelling?e:Oe(e,{interaction:void 0,event:De(e.interaction)});case de.SETTINGS_SHOW:return Oe(e,{event:Le(e.interaction,{action:"tapped settings cog"})});case de.SETTINGS_CHANGE:return t.oldValue[c.TYPE_PAGE]&&!t.newValue[c.TYPE_PAGE]?Oe(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 de.BOOT:return Oe(e,{page:t.page});case de.PAGEVIEW_LOGGED:return Oe(e,{pageview:void 0});case de.PREVIEW_SEEN:return Oe(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:{},activeLink:void 0,previewType:void 0,measures:void 0,activeToken:"",shouldShow:!1,isUserDwelling:!1,wasClicked:!1}),t.type){case de.BOOT:return Oe(e,{enabled:t.initiallyEnabled});case de.SETTINGS_CHANGE:return Oe(e,{enabled:t.newValue});case de.LINK_DWELL:return t.el!==e.activeLink?Oe(e,{activeLink:t.el,previewType:t.previewType,measures:t.measures,activeToken:t.token,shouldShow:!1,isUserDwelling:!0,promise:t.promise}):Oe(e,{isUserDwelling:!0});case de.FETCH_ABORTED:case de.ABANDON_END:return t.token!==e.activeToken||e.isUserDwelling?e:Oe(e,{activeLink:void 0,previewType:void 0,activeToken:void 0,measures:void 0,fetchResponse:void 0,shouldShow:!1});case de.PREVIEW_DWELL:return Oe(e,{isUserDwelling:!0});case de.ABANDON_START:return Oe(e,{isUserDwelling:!1,wasClicked:!1});case de.FETCH_START:return Oe(e,{fetchResponse:void 0,promise:t.promise});case de.FETCH_COMPLETE:if(t.token===e.activeToken)return Oe(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 de.SETTINGS_SHOW:return Oe(e,{shouldShow:!0,showHelp:!1});case de.SETTINGS_HIDE:return Oe(e,{shouldShow:!1,showHelp:!1});case de.SETTINGS_CHANGE:var n=Object.keys(t.newValue).every(function(e){return t.oldValue[e]===t.newValue[e]}),r=Object.keys(t.newValue).some(function(e){return t.oldValue[e]&&!t.newValue[e]}),i=Object.keys(t.newValue).some(function(e){return!1===t.newValue[e]});return Oe(e,n?{shouldShow:!1}:{shouldShow:r,showHelp:r,shouldShowFooterLink:i});case de.BOOT:var o=Object.keys(t.initiallyEnabled).some(function(e){return!1===t.initiallyEnabled[e]});return Oe(e,{shouldShowFooterLink:t.user.isAnon&&o});default:return e}},statsv:function(e,t){switch(e=e||{},t.type){case de.FETCH_START:return Oe(e,{fetchStartedAt:t.timestamp});case de.FETCH_END:return Oe(e,{action:"timing.PagePreviewsApiResponse",data:t.timestamp-e.fetchStartedAt});case de.FETCH_FAILED:return Oe(e,{action:"counter.PagePreviewsApiFailure",data:1});case de.LINK_DWELL:return Oe(e,{linkDwellStartedAt:t.timestamp});case de.PREVIEW_SHOW:return Oe(e,{action:"timing.PagePreviewsPreviewShow",data:t.timestamp-e.linkDwellStartedAt});case de.STATSV_LOGGED:return Oe(e,{action:null,data:null});default:return e}}};function He(e){var t,n,r,i=e;return i.source_title=mw.Title.newFromText(e.source_title).getPrefixedDb(),i.page_title=mw.Title.newFromText(e.page_title).getPrefixedDb(),i.source_url=(t=e.source_url,n=1e3,r="",t.split("").every(function(e){return encodeURIComponent(r+e).length<n&&(r+=e)}),r),i}var je=function(e,t,n,r){return e.get("wgPopupsVirtualPageViews")?function(e,i){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,He(i)),o=e.makeBeaconUrl(t);r(o)})}:function(){}};var Fe=1,Ye=2,We=4,Be=8;function Ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $e=[".extiw",".image",".new",".internal",".external",".mw-cite-backlink a",".oo-ui-buttonedElement-button",".ve-ce-surface a",".cancelLink a"];function Me(){return window.performance&&window.performance.now?Math.round(window.performance.now()):null}!function(){var e,t,n;t=mw.config,n=parseInt(t.get("wgPopupsFlags"),10),t.set("wgPopupsConflictsWithNavPopupGadget",!!(n&Fe)),t.set("wgPopupsConflictsWithRefTooltipsGadget",!!(n&Ye)),t.set("wgPopupsReferencePreviews",!!(n&We)),t.set("wgPopupsReferencePreviewsBetaFeature",!!(n&Be));var o,s,u,p=i.compose,l=mw.user.generateRandomSessionId,f=_(mw.config),w=S(),g=(u=mw.storage,{isPagePreviewsEnabled:function(){return"0"!==u.get(x)},storePagePreviewsEnabled:function(e){e?u.remove(x):u.set(x,"0")},isReferencePreviewsEnabled:function(){return"0"!==u.get(k)},storeReferencePreviewsEnabled:function(e){e?u.remove(k):u.set(k,"0"),mw.track(I,{action:e?"anonymousEnabled":"anonymousDisabled"})},getPreviewCount:function(){var e=u.get(C);if(!1===e)return-1;if(null===e)return 0;var t=parseInt(e,10);return isNaN(t)&&(t=0,this.storePreviewCount(t)),t},storePreviewCount:function(e){u.set(C,e.toString())}}),m=D(mw.config),h=(s=mw.experiments,{weightedBoolean:function(e,t,n){return"true"===s.getBucket({enabled:!0,name:e,buckets:{true:t,false:1-t}},n)}}),v=function(e,t,n){return function(e,t,n){var r=t.get("wgPopupsStatsvSamplingRate",0);return n.weightedBoolean("ext.Popups.statsv",r,e.sessionId())}(e,t,n)?mw.track:function(){}}(mw.user,mw.config,h),E=je(mw.config,mw.loader.using,function(){return mw.eventLog},(o=window.navigator).sendBeacon?o.sendBeacon.bind(o):function(e){document.createElement("img").src=e}),T=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),b=(Ve(e={},c.TYPE_PAGE,function(e,t,n){return n.get("wgPopupsConflictsWithNavPopupGadget")?null:e.isAnon()?t.isPagePreviewsEnabled():"1"===mw.user.options.get("popups")||null}(mw.user,g,mw.config)),Ve(e,c.TYPE_REFERENCE,function(e,t,n){return n.get("wgPopupsReferencePreviews")?n.get("wgPopupsConflictsWithRefTooltipsGadget")||"minerva"===n.get("skin")?null:e.isAnon()?t.isReferencePreviewsEnabled():"1"===mw.user.options.get("popupsreferencepreviews")||null:null}(mw.user,g,mw.config)),e);!0===mw.config.get("debug")&&(p=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||p);var y=i.createStore(i.combineReducers(Ge),p(i.applyMiddleware(a.a))),P=i.bindActionCreators(r,y.dispatch),N=function(e,t){var n,r=function(){};e.isAnon()?r=function(e){e.preventDefault(),t.showSettings()}:n=mw.Title.newFromText("Special:Preferences#mw-prefsection-rendering").getUrl();return{settingsUrl:n,showSettings:r,previewDwell:t.previewDwell,previewAbandon:t.abandon,previewShow:t.previewShow,click:t.linkClick}}(mw.user,P);!function(e,t,n,r,i,o,a,s,u){G(e,le.footerLink(t)),G(e,le.linkTitle()),G(e,le.render(i)),G(e,le.statsv(t,o)),G(e,le.syncUserSettings(n)),G(e,le.settings(t,r)),G(e,le.eventLogging(t,a,u)),G(e,le.pageviews(t,s))}(y,P,g,m,N,v,T,E,Me),P.boot(b,mw.user,g,mw.config,window.location.href),mw.popups=function(e){return{isEnabled:function(){return e.getState().preview.enabled[c.TYPE_PAGE]}}}(y);var A=[];if(null!==b[c.TYPE_PAGE]){var O=$e.join(", ");A.push("#mw-content-text a[href][title]:not(".concat(O,")"))}if(null!==b[c.TYPE_REFERENCE]&&A.push('#mw-content-text .reference a[ href*="#" ]'),A.length){var R=A.join(", ");oe(),$(document).on("mouseover keyup",R,function(e){var t=H(this,mw.config);if(t){var n,r=d(this,mw.config,t);switch(r){case c.TYPE_PAGE:n=f;break;case c.TYPE_REFERENCE:n=w;break;default:return}var i=$(this),o=$(window),a={pageX:e.pageX,pageY:e.pageY,clientY:e.clientY,width:i.width(),height:i.height(),offset:i.offset(),clientRects:this.getClientRects(),windowWidth:o.width(),windowHeight:o.height(),scrollTop:o.scrollTop()};P.linkDwell(t,this,a,n,l,r)}}).on("mouseout blur",R,function(){H(this,mw.config)&&P.abandon()}).on("click",R,function(){var e=H(this,mw.config);e&&c.TYPE_PAGE===d(this,mw.config,e)&&P.linkClick(this)})}else mw.log.error("ext.popups should not even be loaded!")}(),window.Redux=i,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
|