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C3C,GAAMyJ,EAAN,CAGA,IACIkQ,EADE1f,EAAO6F,EAAgB1F,KAAM4G,GAAGhB,OAAQyJ,GAG9C,OAASxP,GACR,KAAK2E,EAAaE,UACjB6a,EAAU2C,EACV,MACD,KAAK1d,EAAaI,eACjB2a,EAAUkE,EACV,MACD,QACC,OAGF,IAAM4C,EAAUpgB,EAAGjG,MACbsmB,EAAUrgB,EAAG/G,QAEbyX,EAAW,CAChBiB,MAAOnB,EAAMmB,MACbP,MAAOZ,EAAMY,MACbM,QAASlB,EAAMkB,QACflN,MAAO4b,EAAQ5b,QACfC,OAAQ2b,EAAQ3b,SAChB2J,OAAQgS,EAAQhS,SAChBkD,YAAavX,KAAKumB,iBAClBzO,YAAawO,EAAQ7b,QACrBsN,aAAcuO,EAAQ5b,SACtB+H,UAAW6T,EAAQ7T,aAGpBtG,EAAa6T,UAAW3Q,EAASrP,KAAM2W,EAAU4I,EAASU,EAAepgB,EA/BzE,CAgCD,IACCyN,GAAI,gBAAiB4Y,GAAmB,WACxBE,EAAkBpmB,KAAM4G,GAAGhB,SAG1CuG,EAAagU,SAEf,IACC7S,GAAI,QAAS4Y,GAAmB,WAChC,IAAM7W,EAAU+W,EAAkBpmB,KAAM4G,GAAGhB,QACtCyJ,GACC7K,EAAaE,YAAcgB,EAAgB1F,KAAM4G,GAAGhB,OAAQyJ,IAChElD,EAAakU,UAAWrgB,KAG3B,GA5DD,MAFC4G,GAAG4f,IAAIC,KAAM,mDA+Dd,CAjIC,GAmIFvnB,OAAO8iB,MAAQA,EACf9iB,OAAOqmB,WAAaA,C","sources":["/w/extensions/Popups/./node_modules/redux-thunk/dist/redux-thunk.min.js","/w/extensions/Popups/./node_modules/redux/dist/redux.min.js","/w/extensions/Popups/./src/ui/pointer-mask.svg","/w/extensions/Popups/webpack/bootstrap","/w/extensions/Popups/webpack/runtime/compat get default export","/w/extensions/Popups/webpack/runtime/define property getters","/w/extensions/Popups/webpack/runtime/global","/w/extensions/Popups/webpack/runtime/hasOwnProperty shorthand","/w/extensions/Popups/webpack/runtime/make namespace object","/w/extensions/Popups/webpack/runtime/node module decorator","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","/w/extensions/Popups/./src/constants.js","/w/extensions/Popups/./src/bracketedPixelRatio.js","/w/extensions/Popups/./src/preview/model.js","/w/extensions/Popups/./src/formatter.js","/w/extensions/Popups/./src/gateway/mediawiki.js","/w/extensions/Popups/./src/gateway/rest.js","/w/extensions/Popups/./src/gateway/restFormatters.js","/w/extensions/Popups/./src/userSettings.js","/w/extensions/Popups/./src/ui/templates/templateUtil.js","/w/extensions/Popups/./src/ui/settingsDialogRenderer.js","/w/extensions/Popups/./src/ui/settingsDialog.js","/w/extensions/Popups/./src/ui/templates/settingsDialog/settingsDialog.js","/w/extensions/Popups/./src/changeListener.js","/w/extensions/Popups/./src/title.js","/w/extensions/Popups/./src/wait.js","/w/extensions/Popups/./src/ui/thumbnail.js","/w/extensions/Popups/./src/ui/templates/popup/popup.js","/w/extensions/Popups/./src/ui/templates/preview/preview.js","/w/extensions/Popups/./src/ui/templates/referencePreview/referencePreview.js","/w/extensions/Popups/./src/ui/templates/pagePreview/pagePreview.js","/w/extensions/Popups/./src/ui/renderer.js","/w/extensions/Popups/./src/changeListeners/syncUserSettings.js","/w/extensions/Popups/./src/changeListeners/index.js","/w/extensions/Popups/./src/changeListeners/footerLink.js","/w/extensions/Popups/./src/changeListeners/linkTitle.js","/w/extensions/Popups/./src/changeListeners/pageviews.js","/w/extensions/Popups/./src/changeListeners/render.js","/w/extensions/Popups/./src/changeListeners/settings.js","/w/extensions/Popups/./src/changeListeners/statsv.js","/w/extensions/Popups/./src/actionTypes.js","/w/extensions/Popups/./src/actions.js","/w/extensions/Popups/./src/reducers/nextState.js","/w/extensions/Popups/./src/reducers/index.js","/w/extensions/Popups/./src/reducers/pageviews.js","/w/extensions/Popups/./src/reducers/preview.js","/w/extensions/Popups/./src/reducers/settings.js","/w/extensions/Popups/./src/reducers/statsv.js","/w/extensions/Popups/./src/index.js","/w/extensions/Popups/./src/setUserConfigFlags.js","/w/extensions/Popups/./src/experiments.js","/w/extensions/Popups/./src/gateway/page.js","/w/extensions/Popups/./src/gateway/reference.js","/w/extensions/Popups/./src/isReferencePreviewsEnabled.js","/w/extensions/Popups/./src/instrumentation/statsv.js","/w/extensions/Popups/./src/isPagePreviewsEnabled.js","/w/extensions/Popups/./src/previewBehavior.js","/w/extensions/Popups/./src/integrations/mwpopups.js"],"sourcesContent":["!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define([],e):\"object\"==typeof exports?exports.ReduxThunk=e():t.ReduxThunk=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p=\"\",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e){\"use strict\";function n(t){return function(e){var n=e.dispatch,o=e.getState;return function(e){return function(r){return\"function\"==typeof r?r(n,o,t):e(r)}}}}e.__esModule=!0;var o=n();o.withExtraArgument=n,e.default=o}])});","!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?t(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],t):t(e.Redux={})}(this,function(e){\"use strict\";var t=function(e){var t,r=e.Symbol;return\"function\"==typeof r?r.observable?t=r.observable:(t=r(\"observable\"),r.observable=t):t=\"@@observable\",t}(\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof module?module:Function(\"return this\")()),r=function(){return Math.random().toString(36).substring(7).split(\"\").join(\".\")},n={INIT:\"@@redux/INIT\"+r(),REPLACE:\"@@redux/REPLACE\"+r(),PROBE_UNKNOWN_ACTION:function(){return\"@@redux/PROBE_UNKNOWN_ACTION\"+r()}};function o(e,t){var r=t&&t.type;return\"Given \"+(r&&'action \"'+r+'\"'||\"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 i(e,t){return function(){return t(e.apply(this,arguments))}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];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))}})}e.createStore=function e(r,o,i){var u;if(\"function\"==typeof o&&\"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 o&&void 0===i&&(i=o,o=void 0),void 0!==i){if(\"function\"!=typeof i)throw Error(\"Expected the enhancer to be a function.\");return i(e)(r,o)}if(\"function\"!=typeof r)throw Error(\"Expected the reducer to be a function.\");var a=r,c=o,f=[],s=f,d=!1;function l(){s===f&&(s=f.slice())}function p(){if(d)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 c}function h(e){if(\"function\"!=typeof e)throw Error(\"Expected the listener to be a function.\");if(d)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 l(),s.push(e),function(){if(t){if(d)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,l();var r=s.indexOf(e);s.splice(r,1)}}}function y(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(d)throw Error(\"Reducers may not dispatch actions.\");try{d=!0,c=a(c,e)}finally{d=!1}for(var t=f=s,r=0;t.length>r;r++)(0,t[r])();return e}return y({type:n.INIT}),(u={dispatch:y,subscribe:h,getState:p,replaceReducer:function(e){if(\"function\"!=typeof e)throw Error(\"Expected the nextReducer to be a function.\");a=e,y({type:n.REPLACE})}})[t]=function(){var e,r=h;return(e={subscribe:function(e){if(\"object\"!=typeof e||null===e)throw new TypeError(\"Expected the observer to be an object.\");function t(){e.next&&e.next(p())}return t(),{unsubscribe:r(t)}}})[t]=function(){return this},e},u},e.combineReducers=function(e){for(var t=Object.keys(e),r={},i=0;t.length>i;i++){var u=t[i];\"function\"==typeof e[u]&&(r[u]=e[u])}var a,c=Object.keys(r);try{!function(e){Object.keys(e).forEach(function(t){var r=e[t];if(void 0===r(void 0,{type:n.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===r(void 0,{type:n.PROBE_UNKNOWN_ACTION()}))throw Error('Reducer \"'+t+\"\\\" returned undefined when probed with a random type. Don't try to handle \"+n.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.')})}(r)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var n=!1,i={},u=0;c.length>u;u++){var f=c[u],s=e[f],d=(0,r[f])(s,t);if(void 0===d){var l=o(f,t);throw Error(l)}i[f]=d,n=n||d!==s}return n?i:e}},e.bindActionCreators=function(e,t){if(\"function\"==typeof e)return i(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 r=Object.keys(e),n={},o=0;r.length>o;o++){var u=r[o],a=e[u];\"function\"==typeof a&&(n[u]=i(a,t))}return n},e.applyMiddleware=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw Error(\"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.\")},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=t.map(function(e){return e(o)});return function(e){for(var t=1;arguments.length>t;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);\"function\"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){u(e,t,r[t])})}return e}({},r,{dispatch:n=a.apply(void 0,i)(r.dispatch)})}}},e.compose=a,e.__DO_NOT_USE__ActionTypes=n,Object.defineProperty(e,\"__esModule\",{value:!0})});\n","module.exports = \"\"","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = function(module) {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import bracketedPixelRatio from './bracketedPixelRatio';\n\nconst bpr = bracketedPixelRatio();\n\nexport default {\n\tBRACKETED_DEVICE_PIXEL_RATIO: bpr,\n\t// See https://phabricator.wikimedia.org/T272169: requesting a larger thumbnail to avoid bluriness\n\tTHUMBNAIL_SIZE: 320 * Math.max( bpr, 1.5 ),\n\tEXTRACT_LENGTH: 525\n};\n","/**\n * @module bracketedPixelRatio\n */\n\n/**\n * Normalizes a user's device pixel ratio to either 1, 1.5, or 2.\n *\n * This is important when the server resizes images on the fly in order to\n * reduce the work it has to do for device pixel ratios that deviate from a\n * set of common ratios.\n *\n * Adapted from mediawiki/core /resources/src/jquery/jquery.hidpi.js\n *\n * @param {number} [dpr=window.devicePixelRatio]\n * @return {number} The bracketed device pixel ratio\n */\nexport default function ( dpr = window.devicePixelRatio ) {\n\tif ( !dpr ) {\n\t\t// Probably legacy browser so assume 1\n\t\treturn 1;\n\t}\n\n\tif ( dpr > 1.5 ) {\n\t\treturn 2;\n\t}\n\n\tif ( dpr > 1 ) {\n\t\treturn 1.5;\n\t}\n\n\treturn 1;\n}\n","/**\n * @module preview/model\n */\n\n/**\n * Page Preview types as defined in Schema:Popups\n * https://meta.wikimedia.org/wiki/Schema:Popups\n *\n * @constant {Object}\n */\nconst previewTypes = {\n\t/** Empty preview used in error situations */\n\tTYPE_GENERIC: 'generic',\n\t/** Standard page preview with or without thumbnail */\n\tTYPE_PAGE: 'page',\n\t/** Disambiguation page preview */\n\tTYPE_DISAMBIGUATION: 'disambiguation',\n\t/** Reference preview */\n\tTYPE_REFERENCE: 'reference'\n};\n\nexport { previewTypes };\n\n/**\n * Preview Model\n *\n * @typedef {Object} PreviewModel\n * @property {string} url The canonical URL of the page being previewed\n * @property {string} type One of the previewTypes.TYPE_… constants.\n *\n * @global\n */\n\n/**\n * @typedef {Object} PagePreviewModel\n * @extends PreviewModel\n * @property {string} title\n * @property {Array|undefined} extract `undefined` if the extract isn't\n * viable, e.g. if it's empty after having ellipsis and parentheticals\n * removed; this can be used to present default or error states\n * @property {string} languageCode\n * @property {string} languageDirection Either \"ltr\" or \"rtl\", or an empty string if undefined.\n * @property {{source: string, width: number, height: number}|undefined} thumbnail\n * @property {number} pageId Currently not used by any known popup type.\n *\n * @global\n */\n\n/**\n * @typedef {Object} ReferencePreviewModel\n * @extends PreviewModel\n * @property {string} extract An HTML snippet, not necessarily with a single top-level node\n * @property {string} referenceType A type identifier, e.g. \"web\"\n * @property {string} sourceElementId ID of the parent element that triggered the preview\n *\n * @global\n */\n\n/**\n * Creates a page preview model.\n *\n * @param {string} title\n * @param {string} url The canonical URL of the page being previewed\n * @param {string} languageCode\n * @param {string} languageDirection Either \"ltr\" or \"rtl\"\n * @param {Array|undefined|null} extract\n * @param {string} type\n * @param {{source: string, width: number, height: number}|undefined} [thumbnail]\n * @param {number} [pageId]\n * @return {PagePreviewModel}\n */\nexport function createModel(\n\ttitle,\n\turl,\n\tlanguageCode,\n\tlanguageDirection,\n\textract,\n\ttype,\n\tthumbnail,\n\tpageId\n) {\n\tconst processedExtract = processExtract( extract ),\n\t\tpreviewType = getPagePreviewType( type, processedExtract );\n\n\treturn {\n\t\ttitle,\n\t\turl,\n\t\tlanguageCode,\n\t\tlanguageDirection,\n\t\textract: processedExtract,\n\t\ttype: previewType,\n\t\tthumbnail,\n\t\tpageId\n\t};\n}\n\n/**\n * Creates an empty page preview model.\n *\n * @param {string} title\n * @param {string} url\n * @return {PagePreviewModel}\n */\nexport function createNullModel( title, url ) {\n\treturn createModel( title, url, '', '', [], '' );\n}\n\n/**\n * Determines the applicable popup type based on title and link element.\n *\n * @param {HTMLAnchorElement} el\n * @param {mw.Map} config\n * @param {mw.Title} title\n * @return {string|null} One of the previewTypes.TYPE_… constants\n */\nexport function getPreviewType( el, config, title ) {\n\tif ( !isSelfLink( title, config ) ) {\n\t\treturn previewTypes.TYPE_PAGE;\n\t}\n\n\t// The other selector can potentially pick up self-links with a class=\"reference\"\n\t// parent, but no fragment\n\tif ( title.getFragment() &&\n\t\tconfig.get( 'wgPopupsReferencePreviews' ) &&\n\t\t// eslint-disable-next-line no-jquery/no-class-state\n\t\t$( el ).parent().hasClass( 'reference' )\n\t) {\n\t\treturn previewTypes.TYPE_REFERENCE;\n\t}\n\n\treturn null;\n}\n\n/**\n * @param {mw.Title} title\n * @param {mw.Map} config\n * @return {boolean} True when the link points to the current page.\n */\nfunction isSelfLink( title, config ) {\n\treturn title.getNamespaceId() === config.get( 'wgNamespaceNumber' ) &&\n\t\ttitle.getMainText() === config.get( 'wgTitle' );\n}\n\n/**\n * Processes the extract returned by the TextExtracts MediaWiki API query\n * module.\n *\n * If the extract is `undefined`, `null`, or empty, then `undefined` is\n * returned.\n *\n * @param {Array|undefined|null} extract\n * @return {Array|undefined} Array when extract is an not empty array, undefined\n * otherwise\n */\nfunction processExtract( extract ) {\n\tif ( extract === undefined || extract === null || extract.length === 0 ) {\n\t\treturn undefined;\n\t}\n\treturn extract;\n}\n\n/**\n * Determines the page preview type based on whether or not:\n * a. Is the preview empty.\n * b. The preview type matches one of previewTypes.\n * c. Assume standard page preview if both above are false\n *\n * @param {string} type\n * @param {Array|undefined} [processedExtract]\n * @return {string} One of the previewTypes.TYPE_… constants.\n */\n\nfunction getPagePreviewType( type, processedExtract ) {\n\tif ( processedExtract === undefined ) {\n\t\treturn previewTypes.TYPE_GENERIC;\n\t}\n\n\tswitch ( type ) {\n\t\tcase previewTypes.TYPE_GENERIC:\n\t\tcase previewTypes.TYPE_DISAMBIGUATION:\n\t\tcase previewTypes.TYPE_PAGE:\n\t\t\treturn type;\n\t\tdefault:\n\t\t\t/**\n\t\t\t * Assume type=\"page\" if extract exists & not one of previewTypes.\n\t\t\t * Note:\n\t\t\t * - Restbase response includes \"type\" prop but other gateways don't.\n\t\t\t * - event-logging Schema:Popups requires type=\"page\" but restbase\n\t\t\t * provides type=\"standard\". Model must conform to event-logging schema.\n\t\t\t */\n\t\t\treturn previewTypes.TYPE_PAGE;\n\t}\n}\n","/**\n * Improves the plain text extracts\n *\n * @param {string} plainTextExtract\n * @param {string} title\n * @return {Array}\n */\nexport function formatPlainTextExtract( plainTextExtract, title ) {\n\tlet extract = plainTextExtract;\n\tif ( plainTextExtract === undefined ) {\n\t\treturn [];\n\t}\n\n\t// After cleaning the extract it may have been blanked\n\tif ( extract.length === 0 ) {\n\t\treturn [];\n\t}\n\n\textract = makeTitleInExtractBold( extract, title );\n\treturn extract;\n}\n\n/**\n * Converts the extract into a list of elements, which correspond to fragments\n * of the extract. Fragments that match the title verbatim are wrapped in a\n * `` element.\n *\n * Using the bolded elements of the extract of the page directly is covered by\n * [T141651](https://phabricator.wikimedia.org/T141651).\n *\n * Extracted from `mw.popups.renderer.article.getProcessedElements`.\n *\n * @param {string} extract\n * @param {string} title\n * @return {Array} A set of HTML Elements\n */\nfunction makeTitleInExtractBold( extract, title ) {\n\tconst elements = [],\n\t\tboldIdentifier = ``,\n\t\tsnip = ``;\n\n\ttitle = title.replace( /\\s+/g, ' ' ).trim(); // Remove extra white spaces\n\tconst escapedTitle = mw.util.escapeRegExp( title );\n\tconst regExp = new RegExp( `(^|\\\\s)(${escapedTitle})(|$)`, 'i' );\n\n\t// Remove text in parentheses along with the parentheses\n\textract = extract.replace( /\\s+/, ' ' ); // Remove extra white spaces\n\n\t// Make title bold in the extract text\n\t// As the extract is html escaped there can be no such string in it\n\t// Also, the title is escaped of RegExp elements thus can't have \"*\"\n\textract = extract.replace(\n\t\tregExp,\n\t\t`$1${snip}${boldIdentifier}$2${snip}$3`\n\t);\n\textract = extract.split( snip );\n\n\textract.forEach( ( part ) => {\n\t\tif ( part.indexOf( boldIdentifier ) === 0 ) {\n\t\t\telements.push( $( '' )\n\t\t\t\t.text( part.slice( boldIdentifier.length ) ) );\n\t\t} else {\n\t\t\telements.push( document.createTextNode( part ) );\n\t\t}\n\t} );\n\n\treturn elements;\n}\n","/**\n * @module gateway/mediawiki\n */\n\nimport { createModel } from '../preview/model';\nimport * as formatter from '../formatter';\n\n// Public and private cache lifetime (5 minutes)\n//\n// FIXME: Move this to src/constants.js.\nconst CACHE_LIFETIME = 300;\n\n/**\n * @typedef {Gateway} MediaWikiGateway\n * @property {function(Object): Object} extractPageFromResponse\n * @property {function(Object): Object} formatPlainTextExtract\n */\n\n/**\n * Creates an instance of the MediaWiki API gateway.\n *\n * @param {mw.Api} api\n * @param {Object} config Configuration that affects the major behavior of the\n * gateway.\n * @param {number} config.THUMBNAIL_SIZE The length of the major dimension of\n * the thumbnail.\n * @param {number} config.EXTRACT_LENGTH The maximum length, in characters,\n * of the extract.\n * @param {string} config.acceptLanguage The accepted language sent in the\n * header\n * @return {MediaWikiGateway}\n */\nexport default function createMediaWikiApiGateway( api, config ) {\n\tfunction fetch( title ) {\n\t\treturn api.get( {\n\t\t\taction: 'query',\n\t\t\tprop: 'info|extracts|pageimages|revisions|info',\n\t\t\tformatversion: 2,\n\t\t\tredirects: true,\n\t\t\texintro: mw.config.get( 'wgPopupsTextExtractsIntroOnly', true ),\n\t\t\texchars: config.EXTRACT_LENGTH,\n\n\t\t\t// There is an added geometric limit on .mwe-popups-extract\n\t\t\t// so that text does not overflow from the card.\n\t\t\texplaintext: true,\n\t\t\texsectionformat: 'plain',\n\n\t\t\tpiprop: 'thumbnail',\n\t\t\tpithumbsize: config.THUMBNAIL_SIZE,\n\t\t\tpilicense: 'any',\n\t\t\trvprop: 'timestamp',\n\t\t\tinprop: 'url',\n\t\t\ttitles: title,\n\t\t\tsmaxage: CACHE_LIFETIME,\n\t\t\tmaxage: CACHE_LIFETIME,\n\t\t\tuselang: 'content'\n\t\t}, {\n\t\t\theaders: {\n\t\t\t\t'X-Analytics': 'preview=1',\n\t\t\t\t'Accept-Language': config.acceptLanguage\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * @param {mw.Title} title\n\t * @return {AbortPromise}\n\t */\n\tfunction fetchPreviewForTitle( title ) {\n\t\tconst xhr = fetch( title.getPrefixedDb() );\n\t\treturn xhr.then( ( data ) => {\n\t\t\tconst page = extractPageFromResponse( data );\n\t\t\tconst plainTextExtract = formatPlainTextExtract( page );\n\t\t\treturn convertPageToModel( plainTextExtract );\n\t\t} ).promise( {\n\t\t\tabort() {\n\t\t\t\txhr.abort();\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn {\n\t\tfetch,\n\t\textractPageFromResponse,\n\t\tconvertPageToModel,\n\t\tfetchPreviewForTitle,\n\t\tformatPlainTextExtract\n\t};\n}\n\n/**\n * Extracts page data from the API response.\n *\n * @method\n * @name MediaWikiGateway#extractPageFromResponse\n * @param {Object} data The response\n * @throws {Error} If the response is empty or doesn't contain data about the\n * page\n * @return {Object}\n */\nfunction extractPageFromResponse( data ) {\n\tif (\n\t\tdata.query &&\n\t\tdata.query.pages &&\n\t\tdata.query.pages.length\n\t) {\n\t\treturn data.query.pages[ 0 ];\n\t}\n\n\tthrow new Error( 'API response `query.pages` is empty.' );\n}\n\n/**\n * Make plain text nicer by applying formatter.\n *\n * @method\n * @name MediaWikiGateway#formatPlainTextExtract\n * @param {Object} data The response\n * @return {Object}\n */\nfunction formatPlainTextExtract( data ) {\n\tconst result = $.extend( {}, data );\n\tresult.extract = formatter.formatPlainTextExtract( data.extract, data.title );\n\treturn result;\n}\n\n/**\n * Converts the API response to a preview model.\n *\n * @method\n * @name MediaWikiGateway#convertPageToModel\n * @param {Object} page\n * @return {PagePreviewModel}\n */\nfunction convertPageToModel( page ) {\n\treturn createModel(\n\t\tpage.title,\n\t\tpage.canonicalurl,\n\t\tpage.pagelanguagehtmlcode,\n\t\tpage.pagelanguagedir,\n\t\tpage.extract,\n\t\tpage.type,\n\t\tpage.thumbnail,\n\t\tpage.pageid\n\t);\n}\n","/**\n * @module gateway/rest\n */\n\nimport { createModel } from '../preview/model';\n\nconst RESTBASE_PROFILE = 'https://www.mediawiki.org/wiki/Specs/Summary/1.2.0';\n\n/** @typedef {function(JQuery.AjaxSettings=): JQuery.jqXHR} Ajax */\n\n/**\n * Creates an instance of the RESTBase gateway.\n *\n * This gateway differs from the {@link MediaWikiGateway MediaWiki gateway} in\n * that it fetches page data from [the RESTBase page summary endpoint][0].\n *\n * [0]: https://en.wikipedia.org/api/rest_v1/#!/Page_content/get_page_summary_title\n *\n * @param {Ajax} ajax A function with the same signature as `jQuery.ajax`\n * @param {Object} config Configuration that affects the major behavior of the\n * gateway.\n * @param {Function} extractParser A function that takes response and returns\n * parsed extract\n * @return {Gateway}\n */\nexport default function createRESTBaseGateway( ajax, config, extractParser ) {\n\t/**\n\t * Fetches page data from [the RESTBase page summary endpoint][0].\n\t *\n\t * [0]: https://en.wikipedia.org/api/rest_v1/#!/Page_content/get_page_summary_title\n\t *\n\t * @method\n\t * @name RESTBaseGateway#fetch\n\t * @param {string} title\n\t * @return {JQuery.jqXHR}\n\t */\n\tfunction fetch( title ) {\n\t\tconst endpoint = config.endpoint;\n\n\t\treturn ajax( {\n\t\t\turl: endpoint + encodeURIComponent( title ),\n\t\t\theaders: {\n\t\t\t\tAccept: `application/json; charset=utf-8; profile=\"${RESTBASE_PROFILE}\"`,\n\t\t\t\t'Accept-Language': config.acceptLanguage\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * @param {mw.Title} title\n\t * @return {AbortPromise}\n\t */\n\tfunction fetchPreviewForTitle( title ) {\n\t\tconst titleText = title.getPrefixedDb(),\n\t\t\txhr = fetch( titleText );\n\t\treturn xhr.then( ( page ) => {\n\t\t\t// Endpoint response may be empty or simply missing a title.\n\t\t\tpage = page || {};\n\t\t\tpage.title = page.title || titleText;\n\t\t\t// And extract may be omitted if empty string\n\t\t\tpage.extract = page.extract || '';\n\t\t\treturn convertPageToModel(\n\t\t\t\tpage, config.THUMBNAIL_SIZE, extractParser\n\t\t\t);\n\t\t} ).catch( ( jqXHR, textStatus, errorThrown ) => {\n\t\t\t// The client will choose how to handle these errors which may include\n\t\t\t// those due to HTTP 4xx and 5xx status. The rejection typing matches\n\t\t\t// fetch failures.\n\t\t\treturn $.Deferred().reject( 'http', {\n\t\t\t\txhr: jqXHR,\n\t\t\t\ttextStatus,\n\t\t\t\texception: errorThrown\n\t\t\t} );\n\t\t} ).promise( { abort() { xhr.abort(); } } );\n\t}\n\n\treturn {\n\t\tfetch,\n\t\tconvertPageToModel,\n\t\tfetchPreviewForTitle\n\t};\n}\n\n/**\n * Checks whether the `originalImage` property contains an image\n * format that's safe to render.\n * https://www.mediawiki.org/wiki/Help:Images#Supported_media_types_for_images\n *\n * @param {string} filename\n *\n * @return {boolean}\n */\nfunction isSafeImgFormat( filename ) {\n\tconst safeImage = new RegExp( /\\.(jpg|jpeg|png|gif)$/i );\n\treturn safeImage.test( filename );\n}\n\n/**\n * Resizes the thumbnail to the requested width, preserving its aspect ratio.\n *\n * The requested width is limited to that of the original image unless the image\n * is an SVG, which can be scaled infinitely.\n *\n * This function is only intended to mangle the pretty thumbnail URLs used on\n * Wikimedia Commons. Once [an official thumb API](https://phabricator.wikimedia.org/T66214)\n * is fully specified and implemented, this function can be made more general.\n *\n * @param {Object} thumbnail The thumbnail image\n * @param {Object} original The original image\n * @param {number} thumbSize The requested size\n * @return {{source: string, width: number, height: number}|undefined}\n */\nfunction generateThumbnailData( thumbnail, original, thumbSize ) {\n\tconst parts = thumbnail.source.split( '/' ),\n\t\tlastPart = parts[ parts.length - 1 ],\n\t\toriginalIsSafe = isSafeImgFormat( original.source ) || undefined;\n\n\t// The last part, the thumbnail's full filename, is in the following form:\n\t// ${width}px-${filename}.${extension}. Splitting the thumbnail's filename\n\t// makes this function resilient to the thumbnail not having the same\n\t// extension as the original image, which is definitely the case for SVG's\n\t// where the thumbnail's extension is .svg.png.\n\tconst filenamePxIndex = lastPart.indexOf( 'px-' );\n\tif ( filenamePxIndex === -1 ) {\n\t\t// The thumbnail size is not customizable. Presumably, RESTBase requested a\n\t\t// width greater than the original and so MediaWiki returned the original's\n\t\t// URL instead of a thumbnail compatible URL. An original URL does not have\n\t\t// a \"thumb\" path, e.g.:\n\t\t//\n\t\t// https://upload.wikimedia.org/wikipedia/commons/a/aa/Red_Giant_Earth_warm.jpg\n\t\t//\n\t\t// Instead of:\n\t\t//\n\t\t// https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Red_Giant_Earth_warm.jpg/512px-Red_Giant_Earth_warm.jpg\n\t\t//\n\t\t// Use the original if it's a supported image format.\n\t\treturn originalIsSafe && original;\n\t}\n\tconst filename = lastPart.slice( filenamePxIndex + 3 );\n\n\t// Scale the thumbnail's largest dimension.\n\tlet width, height;\n\tif ( thumbnail.width > thumbnail.height ) {\n\t\twidth = thumbSize;\n\t\theight = Math.floor( ( thumbSize / thumbnail.width ) * thumbnail.height );\n\t} else {\n\t\twidth = Math.floor( ( thumbSize / thumbnail.height ) * thumbnail.width );\n\t\theight = thumbSize;\n\t}\n\n\t// If the image isn't an SVG, then it shouldn't be scaled past its original\n\t// dimensions.\n\tif ( width >= original.width && filename.indexOf( '.svg' ) === -1 ) {\n\t\t// if the image format is not supported, it shouldn't be rendered.\n\t\treturn originalIsSafe && original;\n\t}\n\n\tparts[ parts.length - 1 ] = `${width}px-${filename}`;\n\n\treturn {\n\t\tsource: parts.join( '/' ),\n\t\twidth,\n\t\theight\n\t};\n}\n\n/**\n * Converts the API response to a preview model.\n *\n * @method\n * @name RESTBaseGateway#convertPageToModel\n * @param {Object} page\n * @param {number} thumbSize\n * @param {Function} extractParser\n * @return {PagePreviewModel}\n */\nexport function convertPageToModel( page, thumbSize, extractParser ) {\n\treturn createModel(\n\t\tpage.title,\n\t\tnew mw.Title( page.title ).getUrl(),\n\t\tpage.lang,\n\t\tpage.dir,\n\t\textractParser( page ),\n\t\tpage.type,\n\t\tpage.thumbnail ?\n\t\t\tgenerateThumbnailData(\n\t\t\t\tpage.thumbnail, page.originalimage, thumbSize\n\t\t\t) : undefined,\n\t\tpage.pageid\n\t);\n}\n","import * as formatter from '../formatter';\n\n/**\n * Prepare extract\n *\n * @param {Object} page Rest response\n * @return {Array} An array of DOM Elements\n */\nexport function parseHTMLResponse( page ) {\n\tconst extract = page.extract_html;\n\n\treturn extract.length === 0 ? [] : $.parseHTML( extract );\n}\n\n/**\n * Prepare extract\n *\n * @param {Object} page Rest response\n * @return {Array} An array of DOM Elements\n */\nexport function parsePlainTextResponse( page ) {\n\treturn formatter.formatPlainTextExtract( page.extract, page.title );\n}\n","/**\n * @module userSettings\n */\n\n/**\n * @interface UserSettings\n *\n * @global\n */\n\nconst PAGE_PREVIEWS_ENABLED_KEY = 'mwe-popups-enabled',\n\tREFERENCE_PREVIEWS_ENABLED_KEY = 'mwe-popups-referencePreviews-enabled',\n\tREFERENCE_PREVIEWS_LOGGING_SCHEMA = 'event.ReferencePreviewsPopups';\n\n/**\n * Creates an object whose methods encapsulate all interactions with the UA's\n * storage.\n *\n * @param {mw.storage} storage The `mw.storage` singleton instance\n *\n * @return {UserSettings}\n */\nexport default function createUserSettings( storage ) {\n\treturn {\n\t\t/**\n\t\t * Gets whether the user has previously enabled Page Previews.\n\t\t *\n\t\t * N.B. that if the user hasn't previously enabled or disabled Page\n\t\t * Previews, i.e. userSettings.storePagePreviewsEnabled(true), then they are treated as\n\t\t * if they have enabled them.\n\t\t *\n\t\t * @method\n\t\t * @name UserSettings#isPagePreviewsEnabled\n\t\t * @return {boolean}\n\t\t */\n\t\tisPagePreviewsEnabled() {\n\t\t\treturn storage.get( PAGE_PREVIEWS_ENABLED_KEY ) !== '0';\n\t\t},\n\n\t\t/**\n\t\t * Permanently persists (typically in localStorage) whether the user has enabled Page\n\t\t * Previews.\n\t\t *\n\t\t * @method\n\t\t * @name UserSettings#storePagePreviewsEnabled\n\t\t * @param {boolean} enabled\n\t\t */\n\t\tstorePagePreviewsEnabled( enabled ) {\n\t\t\tif ( enabled ) {\n\t\t\t\tstorage.remove( PAGE_PREVIEWS_ENABLED_KEY );\n\t\t\t} else {\n\t\t\t\tstorage.set( PAGE_PREVIEWS_ENABLED_KEY, '0' );\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * @method\n\t\t * @name UserSettings#isReferencePreviewsEnabled\n\t\t * @return {boolean}\n\t\t */\n\t\tisReferencePreviewsEnabled() {\n\t\t\treturn storage.get( REFERENCE_PREVIEWS_ENABLED_KEY ) !== '0';\n\t\t},\n\n\t\t/**\n\t\t * @method\n\t\t * @name UserSettings#storeReferencePreviewsEnabled\n\t\t * @param {boolean} enabled\n\t\t */\n\t\tstoreReferencePreviewsEnabled( enabled ) {\n\t\t\tif ( enabled ) {\n\t\t\t\tstorage.remove( REFERENCE_PREVIEWS_ENABLED_KEY );\n\t\t\t} else {\n\t\t\t\tstorage.set( REFERENCE_PREVIEWS_ENABLED_KEY, '0' );\n\t\t\t}\n\n\t\t\tmw.track( REFERENCE_PREVIEWS_LOGGING_SCHEMA, {\n\t\t\t\taction: enabled ? 'anonymousEnabled' : 'anonymousDisabled'\n\t\t\t} );\n\t\t}\n\t};\n}\n","/**\n * @module templateUtil\n */\n\n/**\n * @param {string} str\n * @return {string} The string with any HTML entities escaped.\n */\nexport function escapeHTML( str ) {\n\treturn mw.html.escape( str );\n}\n\nconst templates = {};\n/**\n * @param {string} html markup of the template\n * @return {Element} a cloned root element of the template\n */\nexport function createNodeFromTemplate( html ) {\n\tif ( !templates[ html ] ) {\n\t\t// TODO: use element when IE11 dies\n\t\tconst div = document.createElement( 'div' );\n\t\tdiv.innerHTML = html;\n\t\ttemplates[ html ] = div.firstElementChild;\n\t}\n\n\treturn templates[ html ].cloneNode( true );\n}\n","/**\n * @module settingsDialogRenderer\n */\n\nimport { createSettingsDialog } from './settingsDialog';\n\n/**\n * Creates a render function that will create the settings dialog and return\n * a set of methods to operate on it\n *\n * @param {boolean} referencePreviewsAvaliable\n * @return {Function} render function\n */\nexport default function createSettingsDialogRenderer( referencePreviewsAvaliable ) {\n\t/**\n\t * Cached settings dialog\n\t *\n\t * @type {JQuery}\n\t */\n\tlet $dialog,\n\t\t/**\n\t\t * Cached settings overlay\n\t\t *\n\t\t * @type {JQuery}\n\t\t */\n\t\t$overlay;\n\n\t/**\n\t * Renders the relevant form and labels in the settings dialog\n\t *\n\t * @param {Object} boundActions\n\t * @return {Object} object with methods to affect the rendered UI\n\t */\n\treturn ( boundActions ) => {\n\t\tif ( !$dialog ) {\n\t\t\t$dialog = createSettingsDialog( referencePreviewsAvaliable );\n\t\t\t$overlay = $( '
' ).addClass( 'mwe-popups-overlay' );\n\n\t\t\t// Setup event bindings\n\n\t\t\t$dialog.find( '.save' ).on( 'click', () => {\n\t\t\t\tconst enabled = {};\n\t\t\t\t$dialog.find( 'input' ).each( ( index, el ) => {\n\t\t\t\t\tenabled[ el.value ] = $( el ).is( ':checked' );\n\t\t\t\t} );\n\t\t\t\tboundActions.saveSettings( enabled );\n\t\t\t} );\n\t\t\t$dialog.find( '.close, .okay' ).on( 'click', boundActions.hideSettings );\n\t\t}\n\n\t\treturn {\n\t\t\t/**\n\t\t\t * Append the dialog and overlay to a DOM element\n\t\t\t *\n\t\t\t * @param {HTMLElement} el\n\t\t\t */\n\t\t\tappendTo( el ) {\n\t\t\t\t$overlay.appendTo( el );\n\t\t\t\t$dialog.appendTo( $overlay );\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Show the settings element and position it correctly\n\t\t\t */\n\t\t\tshow() {\n\t\t\t\t$overlay.show();\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Hide the settings dialog.\n\t\t\t */\n\t\t\thide() {\n\t\t\t\t$overlay.hide();\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Toggle the help dialog on or off\n\t\t\t *\n\t\t\t * @param {boolean} visible if you want to show or hide the help dialog\n\t\t\t */\n\t\t\ttoggleHelp( visible ) {\n\t\t\t\ttoggleHelp( $dialog, visible );\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Update the form depending on the enabled flag\n\t\t\t *\n\t\t\t * @param {Object} enabled Mapping preview type identifiers to boolean flags\n\t\t\t */\n\t\t\tsetEnabled( enabled ) {\n\t\t\t\tObject.keys( enabled ).forEach( ( type ) => {\n\t\t\t\t\t$dialog.find( '#mwe-popups-settings-' + type )\n\t\t\t\t\t\t.prop( 'checked', enabled[ type ] );\n\t\t\t\t} );\n\t\t\t}\n\t\t};\n\t};\n}\n\n/**\n * Toggles the visibility between a form and the help\n *\n * @param {JQuery.Object} $el element that contains form and help\n * @param {boolean} visible if the help should be visible, or the form\n */\nfunction toggleHelp( $el, visible ) {\n\t// eslint-disable-next-line no-jquery/no-global-selector\n\tconst $dialog = $( '#mwe-popups-settings' ),\n\t\tformSelectors = 'main, .save, .close',\n\t\thelpSelectors = '.mwe-popups-settings-help, .okay';\n\n\tif ( visible ) {\n\t\t$dialog.find( formSelectors ).hide();\n\t\t$dialog.find( helpSelectors ).show();\n\t} else {\n\t\t$dialog.find( formSelectors ).show();\n\t\t$dialog.find( helpSelectors ).hide();\n\t}\n}\n","/**\n * @module settingsDialog\n */\n\nimport { renderSettingsDialog } from './templates/settingsDialog/settingsDialog';\nimport { previewTypes } from '../preview/model';\n\n/**\n * Create the settings dialog shown to anonymous users.\n *\n * @param {boolean} referencePreviewsAvaliable\n * @return {JQuery} settings dialog\n */\nexport function createSettingsDialog( referencePreviewsAvaliable ) {\n\tconst choices = [\n\t\t{\n\t\t\tid: previewTypes.TYPE_PAGE,\n\t\t\tname: mw.msg( 'popups-settings-option-page' ),\n\t\t\tdescription: mw.msg( 'popups-settings-option-page-description' )\n\t\t},\n\t\t{\n\t\t\tid: previewTypes.TYPE_REFERENCE,\n\t\t\tname: mw.msg( 'popups-settings-option-reference' ),\n\t\t\tdescription: mw.msg( 'popups-settings-option-reference-description' )\n\t\t}\n\t];\n\n\t// TODO: Remove when not in Beta any more\n\tif ( !referencePreviewsAvaliable ) {\n\t\t// Anonymous users can't access reference previews as long as they are in beta\n\t\tchoices.splice( 1, 1 );\n\t}\n\n\treturn renderSettingsDialog( {\n\t\theading: mw.msg( 'popups-settings-title' ),\n\t\tcloseLabel: mw.msg( 'popups-settings-cancel' ),\n\t\tsaveLabel: mw.msg( 'popups-settings-save' ),\n\t\thelpText: mw.msg( 'popups-settings-help' ),\n\t\tokLabel: mw.msg( 'popups-settings-help-ok' ),\n\t\tchoices\n\t} );\n}\n","/**\n * @module settingsDialog\n */\n\nimport { escapeHTML } from '../templateUtil';\n\n/**\n * @typedef {Object} SettingsModel\n * @property {string} heading\n * @property {string} closeLabel\n * @property {string} saveLabel\n * @property {string} helpText\n * @property {string} okLabel\n * @property {SettingsChoiceModel[]} [choices]\n *\n * @global\n */\n\n/**\n * @typedef {Object} SettingsChoiceModel\n * @property {string} id Portion of the elements' IDs and value of the input.\n * @property {string} name\n * @property {string} [description]\n * @property {boolean} [isChecked] Whether the setting is checked.\n *\n * @global\n */\n\n/**\n * @param {SettingsChoiceModel[]} [choices]\n * @return {SettingsChoiceModel}\n */\nfunction escapeChoices( choices = [] ) {\n\treturn choices.map(\n\t\t( { id, name, description, isChecked } ) =>\n\t\t\t( {\n\t\t\t\tid: escapeHTML( id ),\n\t\t\t\tname: escapeHTML( name ),\n\t\t\t\tdescription: description ? escapeHTML( description ) : '',\n\t\t\t\tisChecked\n\t\t\t} )\n\t);\n}\n\n/**\n * @param {SettingsModel} model\n * @return {JQuery}\n */\nexport function renderSettingsDialog( model ) {\n\tconst heading = escapeHTML( model.heading ),\n\t\tsaveLabel = escapeHTML( model.saveLabel ),\n\t\tcloseLabel = escapeHTML( model.closeLabel ),\n\t\thelpText = escapeHTML( model.helpText ),\n\t\tokLabel = escapeHTML( model.okLabel ),\n\t\tchoices = escapeChoices( model.choices );\n\treturn $( $.parseHTML( `\n\t\t\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t
${closeLabel}
\n\t\t\t\t
\n\t\t\t\t
${heading}
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
${helpText}
\n\t\t\t
\n\t\t\n\t`.trim() ) );\n}\n","/**\n * @module changeListener\n */\n\n/**\n * @typedef {Function} ext.popups.ChangeListener\n * @param {Object} oldState The previous state\n * @param {Object} newState The current state\n */\n\n/**\n * Registers a change listener, which is bound to the\n * [store](http://redux.js.org/docs/api/Store.html).\n *\n * A change listener is a function that is only invoked when the state in the\n * [store](http://redux.js.org/docs/api/Store.html) changes. N.B. that there\n * may not be a 1:1 correspondence with actions being dispatched to the store\n * and the state in the store changing.\n *\n * See [Store#subscribe](http://redux.js.org/docs/api/Store.html#subscribe)\n * for more information about what change listeners may and may not do.\n *\n * @param {Redux.Store} store\n * @param {ext.popups.ChangeListener} callback\n * @return {void}\n */\nexport default function registerChangeListener( store, callback ) {\n\t// This function is based on the example in [the documentation for\n\t// Store#subscribe](http://redux.js.org/docs/api/Store.html#subscribe),\n\t// which was written by Dan Abramov.\n\n\tlet previousState;\n\n\tstore.subscribe( () => {\n\t\tconst state = store.getState();\n\n\t\tif ( previousState !== state ) {\n\t\t\tcallback( previousState, state );\n\t\t\tpreviousState = state;\n\t\t}\n\t} );\n}\n","/**\n * @module title\n */\n\n/**\n * Fast, native check if we are parsing a self-link, with the only difference beeing the hash.\n *\n * @param {HTMLAnchorElement} el\n * @return {boolean}\n */\nfunction isOwnPageAnchorLink( el ) {\n\treturn el.hash &&\n\t\t// Note: The protocol is ignored for the sake of simplicity.\n\t\t// Can't compare username and password because they aren't readable from `location`.\n\t\tel.host === location.host &&\n\t\tel.pathname === location.pathname &&\n\t\tel.search === location.search;\n}\n\n/**\n * Gets the title of a local page from an href given some configuration.\n *\n * @param {string} href\n * @param {mw.Map} config\n * @return {string|undefined}\n */\nexport function getTitle( href, config ) {\n\t// Skip every URI that mw.Uri cannot parse\n\tlet linkHref;\n\ttry {\n\t\tlinkHref = new mw.Uri( href );\n\t} catch ( e ) {\n\t\treturn undefined;\n\t}\n\n\t// External links\n\tif ( linkHref.host !== location.hostname ) {\n\t\treturn undefined;\n\t}\n\n\tconst queryLength = Object.keys( linkHref.query ).length;\n\tlet title;\n\n\t// No query params (pretty URL)\n\tif ( !queryLength ) {\n\t\tconst pattern = mw.util.escapeRegExp( config.get( 'wgArticlePath' ) ).replace( '\\\\$1', '([^?#]+)' ),\n\t\t\tmatches = new RegExp( pattern ).exec( linkHref.path );\n\n\t\t// We can't be sure decodeURIComponent() is able to parse every possible match\n\t\ttry {\n\t\t\ttitle = matches && decodeURIComponent( matches[ 1 ] );\n\t\t} catch ( e ) {\n\t\t\t// Will return undefined below\n\t\t}\n\t} else if ( queryLength === 1 && 'title' in linkHref.query ) {\n\t\t// URL is not pretty, but only has a `title` parameter\n\t\ttitle = linkHref.query.title;\n\t}\n\n\treturn title ? `${title}${linkHref.fragment ? `#${linkHref.fragment}` : ''}` : undefined;\n}\n\n/**\n * Given a page title it will return the mediawiki.Title if it is an eligible\n * link for showing page previews, null otherwise\n *\n * @param {string|undefined} title page title to check if it should show preview\n * @param {number[]} contentNamespaces contentNamespaces as specified in\n * wgContentNamespaces\n * @return {mw.Title|null}\n */\nexport function isValid( title, contentNamespaces ) {\n\tif ( !title ) {\n\t\treturn null;\n\t}\n\n\t// Is title in a content namespace?\n\tconst mwTitle = mw.Title.newFromText( title );\n\tif ( mwTitle && contentNamespaces.indexOf( mwTitle.namespace ) >= 0 ) {\n\t\treturn mwTitle;\n\t}\n\n\treturn null;\n}\n\n/**\n * Return an mw.Title from an HTMLAnchorElement if valid for page previews. Convenience\n * method\n *\n * @param {HTMLAnchorElement} el\n * @param {mw.Map} config\n * @return {mw.Title|null}\n */\nexport function fromElement( el, config ) {\n\tif ( isOwnPageAnchorLink( el ) ) {\n\t\t// No need to check the namespace. A self-link can't point to different one.\n\t\ttry {\n\t\t\treturn mw.Title.newFromText( config.get( 'wgPageName' ) + decodeURIComponent( el.hash ) );\n\t\t} catch ( e ) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn isValid(\n\t\tgetTitle( el.href, config ),\n\t\tconfig.get( 'wgContentNamespaces' )\n\t);\n}\n","/**\n * @module wait\n */\n\n/**\n * Sugar around `window.setTimeout`.\n *\n * @example\n * import wait from './wait';\n *\n * wait( 150 )\n * .then( () => {\n * // Continue processing...\n * } );\n *\n * @param {number} delay The number of milliseconds to wait\n * @return {jQuery.Promise}\n */\nexport default function wait( delay ) {\n\tconst deferred = $.Deferred();\n\tsetTimeout( () => deferred.resolve(), delay );\n\treturn deferred.promise();\n}\n","/**\n * @module thumbnail\n */\n\nimport constants from '../constants';\n\nexport const SIZES = {\n\tportraitImage: {\n\t\th: 250, // Exact height\n\t\tw: 203 // Max width\n\t},\n\tlandscapeImage: {\n\t\th: 200, // Max height\n\t\tw: 320 // Exact Width\n\t}\n};\n\n/**\n * @typedef {Object} ext.popups.Thumbnail\n * @property {JQuery} el\n * @property {boolean} isTall Whether or not the thumbnail is portrait\n * @property {number} width\n * @property {number} height\n * @property {boolean} isNarrow whether the thumbnail is portrait and also\n * thinner than the default portrait thumbnail width\n * (as defined in SIZES.portraitImage.w)\n * @property {number} offset in pixels between the thumbnail width and the\n * standard portrait thumbnail width (as defined in SIZES.portraitImage.w)\n */\n\n/**\n * Creates a thumbnail from the representation of a thumbnail returned by the\n * PageImages MediaWiki API query module.\n *\n * If there's no thumbnail, the thumbnail is too small, or the thumbnail's URL\n * contains characters that could be used to perform an\n * [XSS attack via CSS](https://www.owasp.org/index.php/Testing_for_CSS_Injection_(OTG-CLIENT-005)),\n * then `null` is returned.\n *\n * Extracted from `mw.popups.renderer.article.createThumbnail`.\n *\n * @param {Object} rawThumbnail\n * @param {boolean} useCSSClipPath\n * @return {ext.popups.Thumbnail|null}\n */\nexport function createThumbnail( rawThumbnail, useCSSClipPath ) {\n\tconst devicePixelRatio = constants.BRACKETED_DEVICE_PIXEL_RATIO;\n\n\tif ( !rawThumbnail ) {\n\t\treturn null;\n\t}\n\n\tconst thumbWidth = rawThumbnail.width / devicePixelRatio;\n\tconst thumbHeight = rawThumbnail.height / devicePixelRatio;\n\t// For images less than 320 wide, try to display a 250 high vertical slice instead\n\tconst tall = rawThumbnail.height > rawThumbnail.width || thumbWidth < SIZES.landscapeImage.w;\n\n\tif (\n\t\t// Image too small for portrait display\n\t\t( tall && thumbHeight < SIZES.portraitImage.h &&\n\t\t\trawThumbnail.height < SIZES.portraitImage.h ) ||\n\t\t// These characters in URL that could inject CSS and thus JS\n\t\t(\n\t\t\trawThumbnail.source.indexOf( '\\\\' ) > -1 ||\n\t\t\trawThumbnail.source.indexOf( '\\'' ) > -1 ||\n\t\t\trawThumbnail.source.indexOf( '\"' ) > -1\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst aspectRatio = thumbWidth / thumbHeight;\n\tconst isSquare = aspectRatio > 0.7 && aspectRatio < 1.3;\n\n\tlet x, y, width, height;\n\tif ( tall ) {\n\t\tx = ( thumbWidth > SIZES.portraitImage.w ) ?\n\t\t\t( ( thumbWidth - SIZES.portraitImage.w ) / -2 ) :\n\t\t\t( SIZES.portraitImage.w - thumbWidth );\n\t\ty = ( thumbHeight > SIZES.portraitImage.h ) ?\n\t\t\t( ( thumbHeight - SIZES.portraitImage.h ) / -2 ) : 0;\n\t\twidth = SIZES.portraitImage.w;\n\t\theight = SIZES.portraitImage.h;\n\n\t\t// Special handling for thin tall images\n\t\t// https://phabricator.wikimedia.org/T192928#4312088\n\t\tif ( thumbWidth < width ) {\n\t\t\tx = 0;\n\t\t\twidth = thumbWidth;\n\t\t}\n\t} else {\n\t\tx = 0;\n\t\ty = ( thumbHeight > SIZES.landscapeImage.h ) ?\n\t\t\t( ( thumbHeight - SIZES.landscapeImage.h ) / -2 ) : 0;\n\t\twidth = SIZES.landscapeImage.w;\n\t\theight = ( thumbHeight > SIZES.landscapeImage.h ) ?\n\t\t\tSIZES.landscapeImage.h : thumbHeight;\n\t}\n\n\tconst isNarrow = tall && thumbWidth < SIZES.portraitImage.w;\n\tconst el = useCSSClipPath ? createThumbnailImg( rawThumbnail.source ) : createThumbnailSVG(\n\t\ttall ? 'mwe-popups-is-tall' : 'mwe-popups-is-not-tall',\n\t\trawThumbnail.source,\n\t\tx,\n\t\ty,\n\t\tthumbWidth,\n\t\tthumbHeight,\n\t\twidth,\n\t\theight\n\t);\n\n\treturn {\n\t\tel,\n\t\tisTall: tall || isSquare,\n\t\tisNarrow,\n\t\toffset: isNarrow ? SIZES.portraitImage.w - thumbWidth : 0,\n\t\twidth: thumbWidth,\n\t\theight: thumbHeight\n\t};\n}\n\nfunction createThumbnailImg( url ) {\n\tconst img = document.createElement( 'img' );\n\timg.className = 'mwe-popups-thumbnail';\n\timg.src = url;\n\treturn img;\n}\n\n/**\n * Creates the SVG image element that represents the thumbnail.\n *\n * This function is distinct from `createThumbnail` as it abstracts away some\n * browser issues that are uncovered when manipulating elements across\n * namespaces.\n *\n * @param {string} className\n * @param {string} url\n * @param {number} x\n * @param {number} y\n * @param {number} thumbnailWidth\n * @param {number} thumbnailHeight\n * @param {number} width\n * @param {number} height\n * @return {JQuery}\n */\n\nexport function createThumbnailSVG(\n\tclassName, url, x, y, thumbnailWidth, thumbnailHeight, width, height\n) {\n\tconst nsSvg = 'http://www.w3.org/2000/svg',\n\t\tnsXlink = 'http://www.w3.org/1999/xlink';\n\n\t// We want to visually separate the image from the summary\n\t// Given we use an SVG mask, we cannot rely on border to do this\n\t// and instead must insert a polyline element to visually separate\n\tconst line = document.createElementNS( nsSvg, 'polyline' );\n\tconst isTall = className.indexOf( 'not-tall' ) === -1;\n\tconst points = isTall ? [ 0, 0, 0, height ] :\n\t\t[ 0, height - 1, width, height - 1 ];\n\n\tline.setAttribute( 'stroke', 'rgba(0,0,0,0.1)' );\n\tline.setAttribute( 'points', points.join( ' ' ) );\n\tline.setAttribute( 'stroke-width', 1 );\n\n\tconst $thumbnailSVGImage = $( document.createElementNS( nsSvg, 'image' ) );\n\t$thumbnailSVGImage[ 0 ].setAttributeNS( nsXlink, 'href', url );\n\t// The following classes are used here:\n\t// * mwe-popups-is-not-tall\n\t// * mwe-popups-is-tall\n\t$thumbnailSVGImage\n\t\t.addClass( className )\n\t\t.attr( {\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth: thumbnailWidth,\n\t\t\theight: thumbnailHeight\n\t\t} );\n\n\tconst $thumbnail = $( document.createElementNS( nsSvg, 'svg' ) )\n\t\t.attr( {\n\t\t\txmlns: nsSvg,\n\t\t\twidth,\n\t\t\theight\n\t\t} )\n\t\t.append( $thumbnailSVGImage );\n\n\t$thumbnail.append( line );\n\treturn $thumbnail;\n}\n","/**\n * @module popup\n */\n\nimport { createNodeFromTemplate } from '../templateUtil';\n\nconst templateHTML = `\n\t\n`;\n/**\n * @param {ext.popups.previewTypes} type\n * @param {Element} element The contents of the popup.\n * @return {JQuery}\n */\n\nexport function renderPopup( type, container ) {\n\tconst element = createNodeFromTemplate( templateHTML );\n\t// The following classes are used here:\n\t// * mwe-popups-type-reference\n\t// * mwe-popups-type-unknown\n\t// * mwe-popups-type-generic\n\t// * mwe-popups-type-disambiguation\n\telement.className = `mwe-popups mwe-popups-type-${type}`;\n\tcontainer.className = 'mwe-popups-container';\n\telement.appendChild( container );\n\treturn $( element );\n}\n","/**\n * @module preview\n */\n\nimport { renderPopup } from '../popup/popup';\nimport { createNodeFromTemplate, escapeHTML } from '../templateUtil';\n\nconst templateHTML = `\n\t
\n\t`;\n\n/**\n * @param {ext.popups.PagePreviewModel} model\n * @param {ext.popups.Thumbnail|null} thumbnail\n * @param {boolean} withCSSClipPath\n * @param {string} linkTitle\n * @return {JQuery}\n */\nexport function renderPagePreview(\n\tmodel, thumbnail, withCSSClipPath, linkTitle\n) {\n\tconst $el = renderPopup( model.type, createNodeFromTemplate( templateHTML ) );\n\n\t$el.find( '.mwe-popups-discreet, .mwe-popups-extract' )\n\t\t.attr( 'href', model.url );\n\n\t$el.find( '.mwe-popups-extract' )\n\t\t.attr( 'dir', model.languageDirection )\n\t\t.attr( 'lang', model.languageCode );\n\n\t$el.find( '.mwe-popups-settings-icon' )\n\t\t.attr( 'title', linkTitle );\n\n\tif ( thumbnail ) {\n\t\t$el.find( '.mwe-popups-discreet' ).append( thumbnail.el );\n\t} else {\n\t\t$el.find( '.mwe-popups-discreet' ).remove();\n\t}\n\n\tconst $extract = $el.find( '.mwe-popups-extract' );\n\tif ( model.extract ) {\n\t\t$extract.append( model.extract );\n\t\tconst extractWidth = getExtractWidth( thumbnail );\n\t\tif ( !withCSSClipPath ) {\n\t\t\t$extract.css( 'width', extractWidth );\n\t\t\t$el.find( 'footer' ).css( 'width', extractWidth );\n\t\t}\n\t}\n\n\treturn $el;\n}\n\nexport { defaultExtractWidth }; // for testing\n\n/**\n * Calculates width of extract based on the associated thumbnail\n *\n * @param {ext.popups.Thumbnail|null} thumbnail model\n * @return {string} representing the css width attribute to be\n * used for the extract\n */\nexport function getExtractWidth( thumbnail ) {\n\treturn thumbnail && thumbnail.isNarrow ? `${defaultExtractWidth + thumbnail.offset}px` : '';\n}\n","/**\n * @module renderer\n */\n\nimport wait from '../wait';\nimport pointerMaskSVG from './pointer-mask.svg';\nimport { SIZES, createThumbnail } from './thumbnail';\nimport { previewTypes } from '../preview/model';\nimport { renderPreview } from './templates/preview/preview';\nimport { renderReferencePreview } from './templates/referencePreview/referencePreview';\nimport { renderPagePreview } from './templates/pagePreview/pagePreview';\n\nconst landscapePopupWidth = 450,\n\tportraitPopupWidth = 320,\n\tpointerSize = 8, // Height of the pointer.\n\tmaxLinkWidthForCenteredPointer = 28; // Link with roughly < 4 chars.\n\nexport { pointerSize, landscapePopupWidth, portraitPopupWidth }; // for use in storybook\n\n/**\n * @typedef {Object} ext.popups.Measures\n * @property {number} pageX\n * @property {number} pageY\n * @property {number} clientY\n * @property {ClientRectList} clientRects list of rectangles defined by\n * four edges\n * @property {Object} offset\n * @property {number} width\n * @property {number} height\n * @property {number} scrollTop\n * @property {number} windowWidth\n * @property {number} windowHeight\n */\n\n/**\n * Extracted from `mw.popups.createSVGMasks`. This is just an SVG mask to point\n * or \"point\" at the link that's hovered over. The \"pointer\" appears to be cut\n * out of the image itself:\n * _______ link\n * | | _/\\_____ _/\\____ <-- Pointer pointing at link\n * | :-] | + |xxxxxxx = | :-] |\n * |_______| |xxxxxxx |_______|\n * :\n * Thumbnail Pointer Page preview\n * image clip-path bubble w/ pointer\n *\n * SVG masks are used in place of CSS masks for browser support issues (see\n * https://caniuse.com/#feat=css-masks).\n *\n * @private\n * @param {Object} container DOM object to which pointer masks are appended\n * @return {void}\n */\nexport function createPointerMasks( container ) {\n\t$( '
' )\n\t\t.attr( 'id', 'mwe-popups-svg' )\n\t\t.html( pointerMaskSVG )\n\t\t.appendTo( container );\n}\n\n/**\n * Initializes the renderer.\n *\n * @return {void}\n */\nexport function init() {\n\tif ( !supportsCSSClipPath() ) {\n\t\tcreatePointerMasks( document.body );\n\t}\n}\n\n/**\n * The model of how a view is rendered, which is constructed from a response\n * from the gateway.\n *\n * TODO: Rename `isTall` to `isPortrait`.\n *\n * @typedef {Object} ext.popups.Preview\n * @property {JQuery} el\n * @property {boolean} hasThumbnail\n * @property {Object} thumbnail\n * @property {boolean} isTall Sugar around\n * `preview.hasThumbnail && thumbnail.isTall`\n */\n\n/**\n * Renders a preview given data from the {@link gateway Gateway}.\n * The preview is rendered and added to the DOM but will remain hidden until\n * the `show` method is called.\n *\n * Previews are rendered at:\n *\n * # The position of the mouse when the user dwells on the link with their\n * mouse.\n * # The centermost point of the link when the user dwells on the link with\n * their keyboard or other assistive device.\n *\n * Since the content of the preview doesn't change but its position might, we\n * distinguish between \"rendering\" - generating HTML from a MediaWiki API\n * response - and \"showing/hiding\" - positioning the layout and changing its\n * orientation, if necessary.\n *\n * @param {ext.popups.PreviewModel} model\n * @return {ext.popups.Preview}\n */\nexport function render( model ) {\n\tconst preview = createPreviewWithType( model );\n\n\treturn {\n\t\t/**\n\t\t * Shows the preview given an event representing the user's interaction\n\t\t * with the active link, e.g. an instance of\n\t\t * [MouseEvent](https://developer.mozilla.org/en/docs/Web/API/MouseEvent).\n\t\t *\n\t\t * See `show` for more detail.\n\t\t *\n\t\t * @param {Event} event\n\t\t * @param {Object} boundActions The\n\t\t * [bound action creators](http://redux.js.org/docs/api/bindActionCreators.html)\n\t\t * that were (likely) created in [boot.js](./boot.js).\n\t\t * @param {string} token The unique token representing the link interaction\n\t\t * that resulted in showing the preview\n\t\t * @return {JQuery.Promise}\n\t\t */\n\t\tshow( event, boundActions, token ) {\n\t\t\treturn show(\n\t\t\t\tpreview, event, $( event.target ), boundActions, token,\n\t\t\t\tdocument.body, document.documentElement.getAttribute( 'dir' )\n\t\t\t);\n\t\t},\n\n\t\t/**\n\t\t * Hides the preview.\n\t\t *\n\t\t * See `hide` for more detail.\n\t\t *\n\t\t * @return {JQuery.Promise}\n\t\t */\n\t\thide() {\n\t\t\treturn hide( preview );\n\t\t}\n\t};\n}\n/**\n * Creates an instance of a Preview based on\n * the type property of the PreviewModel\n *\n * @param {ext.popups.PreviewModel} model\n * @return {ext.popups.Preview}\n */\nexport function createPreviewWithType( model ) {\n\tswitch ( model.type ) {\n\t\tcase previewTypes.TYPE_PAGE:\n\t\t\treturn createPagePreview( model );\n\t\tcase previewTypes.TYPE_DISAMBIGUATION:\n\t\t\treturn createDisambiguationPreview( model );\n\t\tcase previewTypes.TYPE_REFERENCE:\n\t\t\treturn createReferencePreview( model );\n\t\tdefault:\n\t\t\treturn createEmptyPreview( model );\n\t}\n}\n\nfunction supportsCSSClipPath() {\n\t/* eslint-disable compat/compat */\n\treturn window.CSS &&\n\t\ttypeof CSS.supports === 'function' &&\n\t\tCSS.supports( 'clip-path', 'polygon(1px 1px)' );\n\t/* eslint-enable compat/compat */\n}\n\n/**\n * Creates an instance of the DTO backing a preview.\n *\n * @param {ext.popups.PagePreviewModel} model\n * @return {ext.popups.Preview}\n */\nfunction createPagePreview( model ) {\n\tconst thumbnail = createThumbnail( model.thumbnail, supportsCSSClipPath() ),\n\t\thasThumbnail = thumbnail !== null,\n\t\twithCSSClipPath = supportsCSSClipPath(),\n\t\tlinkTitle = mw.msg( 'popups-settings-icon-gear-title' );\n\n\treturn {\n\t\tel: renderPagePreview( model, thumbnail, withCSSClipPath, linkTitle ),\n\t\thasThumbnail,\n\t\tthumbnail,\n\t\tisTall: hasThumbnail && thumbnail.isTall\n\t};\n}\n\n/**\n * Creates an instance of the DTO backing a preview. In this case the DTO\n * represents a generic preview, which covers the following scenarios:\n *\n * * The page doesn't exist, i.e. the user hovered over a redlink or a\n * redirect to a page that doesn't exist.\n * * The page doesn't have a viable extract.\n *\n * @param {ext.popups.PagePreviewModel} model\n * @return {ext.popups.Preview}\n */\nfunction createEmptyPreview( model ) {\n\tconst showTitle = false,\n\t\textractMsg = mw.msg( 'popups-preview-no-preview' ),\n\t\tlinkMsg = mw.msg( 'popups-preview-footer-read' );\n\n\treturn {\n\t\tel: renderPreview( model, showTitle, extractMsg, linkMsg ),\n\t\thasThumbnail: false,\n\t\tisTall: false\n\t};\n}\n\n/**\n * Creates an instance of the disambiguation preview.\n *\n * @param {ext.popups.PagePreviewModel} model\n * @return {ext.popups.Preview}\n */\nfunction createDisambiguationPreview( model ) {\n\tconst showTitle = true,\n\t\textractMsg = mw.msg( 'popups-preview-disambiguation' ),\n\t\tlinkMsg = mw.msg( 'popups-preview-disambiguation-link' );\n\n\treturn {\n\t\tel: renderPreview( model, showTitle, extractMsg, linkMsg ),\n\t\thasThumbnail: false,\n\t\tisTall: false\n\t};\n}\n\n/**\n * @param {ext.popups.ReferencePreviewModel} model\n * @return {ext.popups.Preview}\n */\nfunction createReferencePreview( model ) {\n\treturn {\n\t\tel: renderReferencePreview( model ),\n\t\thasThumbnail: false,\n\t\tisTall: false\n\t};\n}\n\n/**\n * Shows the preview.\n *\n * Extracted from `mw.popups.render.openPopup`.\n *\n * TODO: From the perspective of the client, there's no need to distinguish\n * between rendering and showing a preview. Merge #render and Preview#show.\n *\n * @param {ext.popups.Preview} preview\n * @param {ext.popups.Measures} measures\n * @param {JQuery} $link event target\n * @param {ext.popups.PreviewBehavior} behavior\n * @param {string} token\n * @param {Object} container DOM object to which pointer masks are appended\n * @param {string} dir 'ltr' if left-to-right, 'rtl' if right-to-left.\n * @return {JQuery.Promise} A promise that resolves when the promise has\n * faded in.\n */\nexport function show(\n\tpreview, measures, $link, behavior, token, container, dir\n) {\n\tconst layout = createLayout(\n\t\tpreview.isTall,\n\t\tmeasures,\n\t\tpointerSize,\n\t\tdir\n\t);\n\n\tpreview.el.appendTo( container );\n\n\tlayoutPreview(\n\t\tpreview, layout, getClasses( preview, layout ),\n\t\tSIZES.landscapeImage.h, pointerSize, measures.windowHeight\n\t);\n\n\tpreview.el.show();\n\n\t// Trigger fading effect for reference previews after the popup has been rendered\n\tif ( preview.el.hasClass( 'mwe-popups-type-reference' ) ) {\n\t\tpreview.el.find( '.mwe-popups-scroll' ).first().trigger( 'scroll' );\n\t}\n\n\treturn wait( 200 )\n\t\t.then( () => {\n\t\t\tbindBehavior( preview, behavior );\n\t\t\tbehavior.previewShow( token );\n\t\t} );\n}\n\n/**\n * Binds the behavior to the interactive elements of the preview.\n *\n * @param {ext.popups.Preview} preview\n * @param {ext.popups.PreviewBehavior} behavior\n * @return {void}\n */\nexport function bindBehavior( preview, behavior ) {\n\tpreview.el.on( 'mouseenter', behavior.previewDwell )\n\t\t.on( 'mouseleave', behavior.previewAbandon );\n\n\tpreview.el.click( behavior.click );\n\n\tpreview.el.find( '.mwe-popups-settings-icon' )\n\t\t.attr( 'href', behavior.settingsUrl )\n\t\t.click( ( event ) => {\n\t\t\tevent.stopPropagation();\n\n\t\t\tbehavior.showSettings( event );\n\t\t} );\n}\n\n/**\n * Extracted from `mw.popups.render.closePopup`.\n *\n * @param {ext.popups.Preview} preview\n * @return {JQuery.Promise} A promise that resolves when the preview has\n * faded out.\n */\nexport function hide( preview ) {\n\t// FIXME: This method clearly needs access to the layout of the preview.\n\tconst fadeInClass = ( preview.el.hasClass( 'mwe-popups-fade-in-up' ) ) ?\n\t\t'mwe-popups-fade-in-up' :\n\t\t'mwe-popups-fade-in-down';\n\n\tconst fadeOutClass = ( fadeInClass === 'mwe-popups-fade-in-up' ) ?\n\t\t'mwe-popups-fade-out-down' :\n\t\t'mwe-popups-fade-out-up';\n\n\t// Classes documented above\n\t// eslint-disable-next-line mediawiki/class-doc\n\tpreview.el\n\t\t.removeClass( fadeInClass )\n\t\t.addClass( fadeOutClass );\n\n\treturn wait( 150 ).then( () => {\n\t\tpreview.el.remove();\n\t} );\n}\n\n/**\n * Represents the layout of a preview, which consists of a position (`offset`)\n * and whether or not the preview should be flipped horizontally or\n * vertically (`flippedX` and `flippedY` respectively).\n *\n * @typedef {Object} ext.popups.PreviewLayout\n * @property {Object} offset\n * @property {number} offset.top\n * @property {number} offset.left\n * @property {boolean} flippedX\n * @property {boolean} flippedY\n * @property {string} dir 'ltr' if left-to-right, 'rtl' if right-to-left.\n */\n\n/**\n * @param {boolean} isPreviewTall\n * @param {ext.popups.Measures} measures\n * @param {number} pointerSpaceSize Space reserved for the pointer\n * @param {string} dir 'ltr' if left-to-right, 'rtl' if right-to-left.\n * @return {ext.popups.PreviewLayout}\n */\nexport function createLayout(\n\tisPreviewTall, measures, pointerSpaceSize, dir\n) {\n\tlet flippedX = false,\n\t\tflippedY = false,\n\t\toffsetTop = measures.pageY ?\n\t\t\t// If it was a mouse event, position according to mouse\n\t\t\t// Since client rectangles are relative to the viewport,\n\t\t\t// take scroll position into account.\n\t\t\tgetClosestYPosition(\n\t\t\t\tmeasures.pageY - measures.scrollTop,\n\t\t\t\tmeasures.clientRects,\n\t\t\t\tfalse\n\t\t\t) + measures.scrollTop + pointerSpaceSize :\n\t\t\t// Position according to link position or size\n\t\t\tmeasures.offset.top + measures.height + pointerSize,\n\t\toffsetLeft;\n\tconst clientTop = measures.clientY ? measures.clientY : offsetTop;\n\n\tif ( measures.pageX ) {\n\t\tif ( measures.width > maxLinkWidthForCenteredPointer ) {\n\t\t\t// For wider links, position the popup's pointer at the\n\t\t\t// mouse pointer's location. (x-axis)\n\t\t\toffsetLeft = measures.pageX;\n\t\t} else {\n\t\t\t// For smaller links, position the popup's pointer at\n\t\t\t// the link's center. (x-axis)\n\t\t\toffsetLeft = measures.offset.left + measures.width / 2;\n\t\t}\n\t} else {\n\t\toffsetLeft = measures.offset.left;\n\t}\n\n\t// X Flip\n\tif ( offsetLeft > ( measures.windowWidth / 2 ) ) {\n\t\toffsetLeft += ( !measures.pageX ) ? measures.width : 0;\n\t\toffsetLeft -= !isPreviewTall ?\n\t\t\tportraitPopupWidth :\n\t\t\tlandscapePopupWidth;\n\t\tflippedX = true;\n\t}\n\n\tif ( measures.pageX ) {\n\t\toffsetLeft += ( flippedX ) ? 18 : -18;\n\t}\n\n\t// Y Flip\n\tif ( clientTop > ( measures.windowHeight / 2 ) ) {\n\t\tflippedY = true;\n\n\t\t// Mirror the positioning of the preview when there's no \"Y flip\": rest\n\t\t// the pointer on the edge of the link's bounding rectangle. In this case\n\t\t// the edge is the top-most.\n\t\toffsetTop = measures.offset.top;\n\n\t\t// Change the Y position to the top of the link\n\t\tif ( measures.pageY ) {\n\t\t\t// Since client rectangles are relative to the viewport,\n\t\t\t// take scroll position into account.\n\t\t\toffsetTop = getClosestYPosition(\n\t\t\t\tmeasures.pageY - measures.scrollTop,\n\t\t\t\tmeasures.clientRects,\n\t\t\t\ttrue\n\t\t\t) + measures.scrollTop;\n\t\t}\n\n\t\toffsetTop -= pointerSpaceSize;\n\t}\n\n\treturn {\n\t\toffset: {\n\t\t\ttop: offsetTop,\n\t\t\tleft: offsetLeft\n\t\t},\n\t\tflippedX: dir === 'rtl' ? !flippedX : flippedX,\n\t\tflippedY,\n\t\tdir\n\t};\n}\n\n/**\n * is there a pointer on the image of the preview?\n *\n * @param {ext.popups.Preview} preview\n * @param {ext.popups.PreviewLayout} layout\n * @return {boolean}\n */\nexport function hasPointerOnImage( preview, layout ) {\n\tif ( ( !preview.hasThumbnail || preview.isTall && !layout.flippedX ) &&\n\t\t!layout.flippedY ) {\n\t\treturn false;\n\t}\n\tif ( preview.hasThumbnail ) {\n\t\tif (\n\t\t\t( !preview.isTall && !layout.flippedY ) ||\n\t\t\t( preview.isTall && layout.flippedX )\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Generates a list of declarative CSS classes that represent the layout of\n * the preview.\n *\n * @param {ext.popups.Preview} preview\n * @param {ext.popups.PreviewLayout} layout\n * @return {string[]}\n */\nexport function getClasses( preview, layout ) {\n\tconst classes = [];\n\n\tif ( layout.flippedY ) {\n\t\tclasses.push( 'mwe-popups-fade-in-down' );\n\t} else {\n\t\tclasses.push( 'mwe-popups-fade-in-up' );\n\t}\n\n\tif ( layout.flippedY && layout.flippedX ) {\n\t\tclasses.push( 'flipped-x-y' );\n\t} else if ( layout.flippedY ) {\n\t\tclasses.push( 'flipped-y' );\n\t} else if ( layout.flippedX ) {\n\t\tclasses.push( 'flipped-x' );\n\t}\n\n\tclasses.push(\n\t\thasPointerOnImage( preview, layout ) ?\n\t\t\t'mwe-popups-image-pointer' : 'mwe-popups-no-image-pointer'\n\t);\n\n\tif ( preview.isTall ) {\n\t\tclasses.push( 'mwe-popups-is-tall' );\n\t} else {\n\t\tclasses.push( 'mwe-popups-is-not-tall' );\n\t}\n\n\treturn classes;\n}\n\n/**\n * Lays out the preview given the layout.\n *\n * If the thumbnail is landscape and isn't the full height of the thumbnail\n * container, then pull the extract up to keep whitespace consistent across\n * previews.\n *\n * @param {ext.popups.Preview} preview\n * @param {ext.popups.PreviewLayout} layout\n * @param {string[]} classes class names used for layout out the preview\n * @param {number} predefinedLandscapeImageHeight landscape image height\n * @param {number} pointerSpaceSize\n * @param {number} windowHeight\n * @return {void}\n */\nexport function layoutPreview(\n\tpreview, layout, classes, predefinedLandscapeImageHeight, pointerSpaceSize, windowHeight\n) {\n\tconst popup = preview.el,\n\t\tisTall = preview.isTall,\n\t\thasThumbnail = preview.hasThumbnail,\n\t\tthumbnail = preview.thumbnail,\n\t\tflippedY = layout.flippedY;\n\n\tif (\n\t\t!flippedY && !isTall && hasThumbnail &&\n\t\t\tthumbnail.height < predefinedLandscapeImageHeight && !supportsCSSClipPath()\n\t) {\n\t\tpopup.find( '.mwe-popups-extract' ).css(\n\t\t\t'margin-top',\n\t\t\tthumbnail.height - pointerSpaceSize\n\t\t);\n\t}\n\n\t// The following classes are used here:\n\t// * flipped-x\n\t// * flipped-x-y\n\t// * flipped-y\n\t// * mwe-popups-fade-in-down\n\t// * mwe-popups-fade-in-up\n\t// * mwe-popups-image-pointer\n\t// * mwe-popups-is-not-tall\n\t// * mwe-popups-is-tall\n\t// * mwe-popups-no-image-pointer\n\tpopup.addClass( classes );\n\n\tpopup.css( {\n\t\tleft: `${layout.offset.left}px`,\n\t\ttop: flippedY ? 'auto' : layout.offset.top,\n\t\tbottom: flippedY ? `${windowHeight - layout.offset.top}px` : 'auto'\n\t} );\n\n\tif ( hasThumbnail && !supportsCSSClipPath() ) {\n\t\tsetThumbnailClipPath( preview, layout );\n\t}\n}\n\n/**\n * Sets the thumbnail SVG clip-path.\n *\n * If the preview should be oriented differently, then the pointer is updated,\n * e.g. if the preview should be flipped vertically, then the pointer is\n * removed.\n *\n * Note: SVG clip-paths are supported everywhere but clip-paths as CSS\n * properties are not (https://caniuse.com/#feat=css-clip-path). For this\n * reason, RTL flipping is handled in JavaScript instead of CSS.\n *\n * @param {ext.popups.Preview} preview\n * @param {ext.popups.PreviewLayout} layout\n * @return {void}\n */\nexport function setThumbnailClipPath(\n\t{ el, isTall, thumbnail }, { flippedY, flippedX, dir }\n) {\n\tconst maskID = getThumbnailClipPathID( isTall, flippedY, flippedX );\n\tif ( maskID ) {\n\t\t// CSS matrix transform entries:\n\t\t// ⎡ sx c tx ⎤\n\t\t// ⎣ sy d ty ⎦\n\t\tconst matrix = {\n\t\t\tscaleX: 1,\n\t\t\t// moving the mask horizontally if the image is less than the maximum width\n\t\t\ttranslateX: isTall ? Math.min( thumbnail.width - SIZES.portraitImage.w, 0 ) : 0\n\t\t};\n\n\t\tif ( dir === 'rtl' ) {\n\t\t\t// flipping the mask horizontally\n\t\t\tmatrix.scaleX = -1;\n\t\t\t// moving the mask horizontally to the max width of the thumbnail\n\t\t\tmatrix.translateX = isTall ? SIZES.portraitImage.w : SIZES.landscapeImage.w;\n\t\t}\n\n\t\t// Transform the clip-path not the image it is applied to.\n\t\tconst mask = document.getElementById( maskID );\n\t\tmask.setAttribute(\n\t\t\t'transform',\n\t\t\t`matrix(${matrix.scaleX} 0 0 1 ${matrix.translateX} 0)`\n\t\t);\n\n\t\tel.find( 'image' )[ 0 ]\n\t\t\t.setAttribute( 'clip-path', `url(#${maskID})` );\n\t}\n}\n\n/**\n * Gets the thumbnail SVG clip-path element ID as specified in pointer-mask.svg.\n *\n * @param {boolean} isTall Sugar around\n * `preview.hasThumbnail && thumbnail.isTall`\n * @param {boolean} flippedY\n * @param {boolean} flippedX\n * @return {string|undefined}\n */\nexport function getThumbnailClipPathID( isTall, flippedY, flippedX ) {\n\t// Clip-paths are only needed when the pointer is in a corner that is covered by the thumbnail.\n\t// This is only the case in 4 of 8 situations:\n\tif ( !isTall && !flippedY ) {\n\t\t// 1. Landscape thumbnails cover the upper half of the popup. This is only the case when the\n\t\t// pointer is not flipped to the bottom.\n\t\treturn flippedX ? 'mwe-popups-mask-flip' : 'mwe-popups-mask';\n\t} else if ( isTall && flippedX ) {\n\t\t// 2. Tall thumbnails cover the right half of the popup. This is only the case when the\n\t\t// pointer is flipped to the right.\n\t\treturn flippedY ? 'mwe-popups-landscape-mask-flip' : 'mwe-popups-landscape-mask';\n\t}\n\n\t// The 4 combinations not covered above don't need a clip-path.\n\treturn undefined;\n}\n\n/**\n * Given the rectangular box(es) find the 'y' boundary of the closest\n * rectangle to the point 'y'. The point 'y' is the location of the mouse\n * on the 'y' axis and the rectangular box(es) are the borders of the\n * element over which the mouse is located. There will be more than one\n * rectangle in case the element spans multiple lines.\n *\n * In the majority of cases the mouse pointer will be inside a rectangle.\n * However, some browsers (i.e. Chrome) trigger a hover action even when\n * the mouse pointer is just outside a bounding rectangle. That's why\n * we need to look at all rectangles and not just the rectangle that\n * encloses the point.\n *\n * @private\n * @param {number} y the point for which the closest location is being\n * looked for\n * @param {ClientRectList} rects list of rectangles defined by four edges\n * @param {boolean} [isTop] should the resulting rectangle's top 'y'\n * boundary be returned. By default the bottom 'y' value is returned.\n * @return {number}\n */\nexport function getClosestYPosition( y, rects, isTop ) {\n\tlet minY = null, result;\n\n\tArray.prototype.slice.call( rects ).forEach( ( rect ) => {\n\t\tconst deltaY = Math.abs( y - rect.top + y - rect.bottom );\n\n\t\tif ( minY === null || minY > deltaY ) {\n\t\t\tminY = deltaY;\n\t\t\t// Make sure the resulting point is at or outside the rectangle\n\t\t\t// boundaries.\n\t\t\tresult = ( isTop ) ? Math.floor( rect.top ) : Math.ceil( rect.bottom );\n\t\t}\n\t} );\n\n\treturn result;\n}\n","/**\n * @module changeListeners/syncUserSettings\n */\n\nimport { previewTypes } from '../preview/model';\n\n/**\n * Creates an instance of the user settings sync change listener.\n *\n * This change listener syncs certain parts of the state tree to user\n * settings when they change.\n *\n * Used for:\n *\n * * Enabled state: If the previews are enabled or disabled.\n * * Preview count: When the user dwells on a link for long enough that\n * a preview is shown, then their preview count will be incremented (see\n * `reducers/eventLogging.js`, and is persisted to local storage.\n *\n * @param {ext.popups.UserSettings} userSettings\n * @return {ext.popups.ChangeListener}\n */\nexport default function syncUserSettings( userSettings ) {\n\treturn ( oldState, newState ) => {\n\t\tsyncIfChanged(\n\t\t\toldState, newState, 'eventLogging.previewCount',\n\t\t\tuserSettings.storePreviewCount\n\t\t);\n\t\tsyncIfChanged(\n\t\t\toldState, newState, 'preview.enabled.' + previewTypes.TYPE_PAGE,\n\t\t\tuserSettings.storePagePreviewsEnabled\n\t\t);\n\t\tsyncIfChanged(\n\t\t\toldState, newState, 'preview.enabled.' + previewTypes.TYPE_REFERENCE,\n\t\t\tuserSettings.storeReferencePreviewsEnabled\n\t\t);\n\t};\n}\n\n/**\n * Given a state tree, reducer and property, safely return the value of the\n * property if the reducer and property exist\n *\n * @param {Object} state tree\n * @param {string} path dot-separated path in the state tree\n * @return {*}\n */\nfunction get( state, path ) {\n\treturn path.split( '.' ).reduce(\n\t\t( element, key ) => element && element[ key ],\n\t\tstate\n\t);\n}\n\n/**\n * Calls a sync function if the property prop on the property reducer on\n * the state trees has changed value.\n *\n * @param {Object} oldState\n * @param {Object} newState\n * @param {string} path dot-separated path in the state tree\n * @param {Function} sync function to be called with the newest value if\n * changed\n * @return {void}\n */\nfunction syncIfChanged( oldState, newState, path, sync ) {\n\tconst current = get( newState, path );\n\tif ( oldState && ( get( oldState, path ) !== current ) ) {\n\t\tsync( current );\n\t}\n}\n","import footerLink from './footerLink';\nimport linkTitle from './linkTitle';\nimport pageviews from './pageviews';\nimport render from './render';\nimport settings from './settings';\nimport statsv from './statsv';\nimport syncUserSettings from './syncUserSettings';\n\nexport default {\n\tfooterLink,\n\tlinkTitle,\n\tpageviews,\n\trender,\n\tsettings,\n\tstatsv,\n\tsyncUserSettings\n};\n","/**\n * @module changeListeners/footerLink\n */\n\n/**\n * Creates the link element and appends it to the footer element.\n *\n * The following elements are considered to be the footer element (highest\n * priority to lowest):\n *\n * # `#footer-places`\n * # `#f-list`\n * # The parent element of `#footer li`, which is either an `ol` or `ul`.\n *\n * @return {JQuery} The link element\n */\nfunction createFooterLink() {\n\tconst $link = $( '