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OAAO0nB,WAAaA,C","sources":["/w/extensions/Popups/./src/canSaveToUserPreferences.js","/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/./src/constants.js","/w/extensions/Popups/./src/bracketedPixelRatio.js","/w/extensions/Popups/./src/wait.js","/w/extensions/Popups/./src/ui/thumbnail.js","/w/extensions/Popups/./src/ui/templates/templateUtil.js","/w/extensions/Popups/./src/ui/templates/popup/popup.js","/w/extensions/Popups/./src/ui/templates/preview/preview.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","/w/extensions/Popups/./src/ui/templates/pagePreview/pagePreview.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/iterableToArray.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","/w/extensions/Popups/./src/ui/renderer.js","/w/extensions/Popups/./src/preview/model.js","/w/extensions/Popups/./src/formatter.js","/w/extensions/Popups/./src/gateway/index.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/gateway/page.js","/w/extensions/Popups/./src/ext.popups.referencePreviews/constants.js","/w/extensions/Popups/./src/userSettings.js","/w/extensions/Popups/./src/previewBehavior.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/isPagePreviewsEnabled.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/./node_modules/@babel/runtime/helpers/esm/slicedToArray.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","/w/extensions/Popups/./src/reducers/nextState.js","/w/extensions/Popups/./node_modules/@babel/runtime/helpers/esm/defineProperty.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/title.js","/w/extensions/Popups/./src/setUserConfigFlags.js","/w/extensions/Popups/./src/experiments.js","/w/extensions/Popups/./src/instrumentation/statsv.js","/w/extensions/Popups/./src/integrations/mwpopups.js"],"sourcesContent":["/**\n * Can the current user save to user preferences?\n *\n * @param {User} user\n * @return {boolean}\n */\nconst canSaveToUserPreferences = ( user ) => {\n\treturn !user.isAnon() && user.isNamed();\n};\n\nmodule.exports = canSaveToUserPreferences;\n","!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 = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (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 = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (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 = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","import bracketedPixelRatio from './bracketedPixelRatio';\n\nconst bpr = bracketedPixelRatio();\n\n// See the following for context around this value.\n//\n// * https://phabricator.wikimedia.org/T161284\n// * https://phabricator.wikimedia.org/T70861#3129780\nexport const FETCH_START_DELAY = 150; // ms.\n// The delay after which a FETCH_COMPLETE action should be dispatched.\n//\n// If the API endpoint responds faster than 350 ms (or, say, the API\n// response is served from the UA's cache), then we introduce a delay of\n// 350 ms - t to make the preview delay consistent to the user. The total\n// delay from start to finish is 500 ms.\nexport const FETCH_COMPLETE_TARGET_DELAY = 350 + FETCH_START_DELAY; // ms.\n// The minimum time a preview must be open before we judge it\n// has been seen.\n// See https://phabricator.wikimedia.org/T184793\nexport const PREVIEW_SEEN_DURATION = 1000; // ms\nexport const ABANDON_END_DELAY = 300;\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 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 {Promise}\n */\nexport default function wait( delay ) {\n\treturn new Promise( ( resolve ) => {\n\t\tsetTimeout( () => {\n\t\t\tresolve();\n\t\t}, delay );\n\t} );\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 * Sets multiple attributes on a node.\n *\n * @param {HTMLElement} node\n * @param {Record} attrs\n */\nconst addAttributes = ( node, attrs ) => {\n\tObject.keys( attrs ).forEach( ( key ) => {\n\t\tnode.setAttribute( key, attrs[ key ] );\n\t} );\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 {HTMLElement}\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\tthumbnailSVGImage.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\tthumbnailSVGImage.classList.add( className );\n\taddAttributes(\n\t\tthumbnailSVGImage,\n\t\t{\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth: thumbnailWidth,\n\t\t\theight: thumbnailHeight\n\t\t}\n\t);\n\n\tconst thumbnail = document.createElementNS( nsSvg, 'svg' );\n\taddAttributes(\n\t\tthumbnail, {\n\t\t\txmlns: nsSvg,\n\t\t\twidth,\n\t\t\theight\n\t\t}\n\t);\n\tthumbnail.appendChild( thumbnailSVGImage );\n\tthumbnail.appendChild( line );\n\treturn thumbnail;\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 {HTMLElement} 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 popup\n */\n\nimport { createNodeFromTemplate } from '../templateUtil';\n\nconst templateHTML = `\n\t\n`;\n/**\n * @param {ext.popups.previewTypes} type\n * @param {HTMLElement} element The contents of the popup.\n * @return {HTMLElement}\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`;\n\n/**\n * Render generic and disambiguation previews\n *\n * @param {ext.popups.PagePreviewModel} model\n * @param {string|null} message\n * @param {string} linkMsg\n * @return {jQuery}\n */\nexport function renderPreview(\n\tmodel, message, linkMsg\n) {\n\tconst popup = renderPopup( model.type, createNodeFromTemplate( templateHTML ) );\n\n\t// The following classes are used here:\n\t// * popups-icon--preview-unknown\n\t// * popups-icon--preview-generic\n\t// * popups-icon--preview-disambiguation\n\tpopup.querySelector( '.popups-icon' ).classList.add( `popups-icon--preview-${ model.type }` );\n\tpopup.querySelector( '.mwe-popups-extract' ).setAttribute( 'href', model.url );\n\tconst messageElement = popup.querySelector( '.mwe-popups-message' );\n\tif ( message ) {\n\t\tmessageElement.innerHTML = escapeHTML( message );\n\t} else {\n\t\tmessageElement.remove();\n\t}\n\tconst readLink = popup.querySelector( '.mwe-popups-read-link' );\n\treadLink.innerHTML = escapeHTML( linkMsg );\n\treadLink.setAttribute( 'href', model.url );\n\tconst title = popup.querySelector( '.mwe-popups-title' );\n\ttitle.innerHTML += escapeHTML( model.title );\n\treturn popup;\n}\n","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","/**\n * @module pagePreview\n */\n\nimport { renderPopup } from '../popup/popup';\nimport { escapeHTML, createNodeFromTemplate } from '../templateUtil';\n\nconst defaultExtractWidth = 215;\nconst templateHTML = `\n
\n \n \n \n
\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 {HTMLElement}\n */\nexport function renderPagePreview(\n\tmodel, thumbnail, withCSSClipPath, linkTitle\n) {\n\tconst el = renderPopup( model.type, createNodeFromTemplate( templateHTML ) );\n\n\tconst linkDiscreet = el.querySelector( '.mwe-popups-discreet' );\n\tconst extract = el.querySelector( '.mwe-popups-extract' );\n\textract.setAttribute( 'href', model.url );\n\tlinkDiscreet.setAttribute( 'href', model.url );\n\textract.setAttribute( 'dir', model.languageDirection );\n\textract.setAttribute( 'lang', model.languageCode );\n\n\tel.querySelector( '.mwe-popups-settings-button' )\n\t\t.setAttribute( 'title', linkTitle );\n\n\t// Set label on settings icon button\n\tconst labelText = escapeHTML( mw.msg( 'popups-settings-icon-gear-title' ) );\n\tconst label = el.querySelector( '.mwe-popups-settings-button-label' );\n\tlabel.textContent = labelText;\n\n\tif ( thumbnail ) {\n\t\tel.querySelector( '.mwe-popups-discreet' ).appendChild( thumbnail.el );\n\t} else {\n\t\tlinkDiscreet.remove();\n\t}\n\n\tif ( model.extract ) {\n\t\tif ( typeof model.extract === 'string' ) {\n\t\t\textract.innerHTML = model.extract;\n\t\t} else {\n\t\t\textract.append( ...model.extract );\n\t\t}\n\t\tconst extractWidth = getExtractWidth( thumbnail );\n\t\tif ( !withCSSClipPath ) {\n\t\t\textract.style.width = extractWidth;\n\t\t\tel.querySelector( 'footer' ).style.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","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","/**\n * @module renderer\n */\n\nimport wait from '../wait';\nimport pointerMaskSVG from './pointer-mask.svg';\nimport { SIZES, createThumbnail } from './thumbnail';\nimport { renderPreview } from './templates/preview/preview';\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 */\nexport function createPointerMasks( container ) {\n\tconst node = document.createElement( 'div' );\n\tnode.setAttribute( 'id', 'mwe-popups-svg' );\n\tnode.innerHTML = pointerMaskSVG;\n\tcontainer.appendChild( node );\n}\n\n/**\n * Initializes the renderer.\n *\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\nlet renderers = {};\nconst renderersMeta = {};\n\n/**\n * @param {string} type\n * @param {function( ext.popups.PreviewModel ): ext.popups.Preview} [previewFn]\n * @param {boolean} [doNotRequireSummary] does this type require a summary to be renderable?\n *\n */\nexport function registerPreviewUI( type, previewFn, doNotRequireSummary ) {\n\trenderers[ type ] = previewFn || createPagePreview;\n\trenderersMeta[ type ] = {\n\t\trequireSummary: !doNotRequireSummary\n\t};\n}\n\n/**\n * Check whether this render type requires a summary to be rendered.\n *\n * @param {string} type of preview\n * @return {boolean}\n */\nexport function requiresSummary( type ) {\n\tconst meta = renderersMeta[ type ] || { requireSummary: true };\n\treturn meta.requireSummary;\n}\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\tconst fn = renderers[ model.type ] || createEmptyPreview;\n\treturn fn( model );\n}\n\nfunction supportsCSSClipPath() {\n\treturn window.CSS &&\n\t\ttypeof CSS.supports === 'function' &&\n\t\tCSS.supports( 'clip-path', 'polygon(1px 1px)' );\n\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 */\nexport function 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 */\nexport function createEmptyPreview( model ) {\n\tmodel.title = mw.msg( 'popups-preview-no-preview' );\n\tconst linkMsg = mw.msg( 'popups-preview-footer-read' );\n\n\treturn {\n\t\tel: renderPreview( model, null, 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 */\nexport function createDisambiguationPreview( model ) {\n\tconst extractMsg = mw.msg( 'popups-preview-disambiguation' );\n\tconst linkMsg = mw.msg( 'popups-preview-disambiguation-link' );\n\n\treturn {\n\t\tel: renderPreview( model, extractMsg, linkMsg ),\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 {HTMLElement} _link event target (unused)\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\tcontainer.appendChild( preview.el );\n\n\tlayoutPreview(\n\t\tpreview, layout, getClasses( preview, layout ),\n\t\tSIZES.landscapeImage.h, pointerSize, measures.windowHeight\n\t);\n\n\tpreview.el.style.display = 'block';\n\n\t// Trigger fading effect for reference previews after the popup has been rendered\n\tif ( preview.el.classList.contains( 'mwe-popups-type-reference' ) ) {\n\t\tpreview.el.querySelector( '.mwe-popups-scroll' ).dispatchEvent( new Event( '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 */\nexport function bindBehavior( preview, behavior ) {\n\tpreview.el.addEventListener( 'mouseenter', behavior.previewDwell );\n\tpreview.el.addEventListener( 'mouseleave', behavior.previewAbandon );\n\n\tpreview.el.addEventListener( 'click', behavior.click );\n\n\tconst button = preview.el.querySelector( 'a.mwe-popups-settings-button' );\n\tif ( button ) {\n\t\tbutton.href = behavior.settingsUrl;\n\t\tbutton.addEventListener( 'click', ( event ) => {\n\t\t\tevent.stopPropagation();\n\n\t\t\tbehavior.showSettings( event );\n\t\t} );\n\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.classList.contains( '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.classList.remove( fadeInClass );\n\t// eslint-disable-next-line mediawiki/class-doc\n\tpreview.el.classList.add( 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 */\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\tconst popupExtract = popup.querySelector( '.mwe-popups-extract' );\n\t\tpopupExtract.style.marginTop = `${ ( thumbnail.height - pointerSpaceSize ) }px`;\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.classList.add.apply( popup.classList, classes );\n\n\tpopup.style.left = `${ layout.offset.left }px`;\n\tpopup.style.top = flippedY ? 'auto' : `${ layout.offset.top }px`;\n\tpopup.style.bottom = flippedY ? `${ windowHeight - layout.offset.top }px` : 'auto';\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 */\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.querySelector( 'image' )\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\nexport const test = {\n\t/** For testing only */\n\treset: () => {\n\t\trenderers = {};\n\t}\n};\n","/**\n * @module preview/model\n */\n\nimport { requiresSummary } from '../ui/renderer';\n\nconst selectors = [];\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};\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 * @param {HTMLElement} element\n * @param {string} selector\n * @return {boolean}\n */\nconst elementMatchesSelector = ( element, selector ) => {\n\treturn element.matches( selector );\n};\n\n/**\n * Recursively checks the element and its parents.\n *\n * @param {HTMLElement} element\n * @return {HTMLElement|null}\n */\nexport function findNearestEligibleTarget( element ) {\n\tconst selector = selectors.join( ', ' );\n\treturn element.closest( selector );\n}\n\n/**\n * @typedef {Object} PreviewType\n * @property {string} name identifier for preview type\n * @property {string} selector a CSS selector\n * @type {PreviewType[]}\n */\nconst registeredPreviewTypes = [];\n\n/**\n * Determines the applicable popup type based on title and link element.\n *\n * @param {HTMLAnchorElement} el\n * @return {string|null} One of the previewTypes.TYPE_… constants\n */\nexport function getPreviewType( el ) {\n\tconst candidates = registeredPreviewTypes.filter(\n\t\t( type ) => elementMatchesSelector( el, type.selector )\n\t);\n\n\t// If the filter returned some possibilities, use the last registered one.\n\tif ( candidates.length > 0 ) {\n\t\treturn candidates[ candidates.length - 1 ].name;\n\t}\n\n\treturn null;\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\t// If the preview type requires a summary to display and no extract was\n\t// found show the generic (error) preview.\n\tif ( processedExtract === undefined && requiresSummary( type ) ) {\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\nconst dwellDelay = {};\n\n/**\n * Determines the delay before showing the preview when dwelling a link.\n *\n * @param {string} type\n * @return {number}\n */\nexport function getDwellDelay( type ) {\n\treturn dwellDelay[ type ] || 0;\n}\n\n/***\n * Set the delay before showing the preview when dwelling a link.\n *\n * @param {string} type\n * @param {number} delay\n */\nexport function setDwellTime( type, delay ) {\n\tdwellDelay[ type ] = delay;\n}\n\n/**\n * Allows extensions to register their own page previews.\n *\n * @stable\n * @param {string} type\n * @param {string} selector A valid CSS selector to associate preview with\n * @param {number} [delay] optional delay between hovering and displaying preview.\n * If not defined, delay will be zero.\n */\nexport function registerModel( type, selector, delay ) {\n\tselectors.push( selector );\n\tregisteredPreviewTypes.push( {\n\t\tname: type,\n\t\tselector\n\t} );\n\tif ( delay ) {\n\t\tsetDwellTime( type, delay );\n\t}\n}\n\nexport const test = {\n\t/** For testing only */\n\treset: () => {\n\t\twhile ( registeredPreviewTypes.length ) {\n\t\t\tregisteredPreviewTypes.pop();\n\t\t}\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\t// eslint-disable-next-line security/detect-non-literal-regexp\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\tconst highlightNode = document.createElement( 'b' );\n\t\t\thighlightNode.textContent = part.slice( boldIdentifier.length );\n\t\t\telements.push( highlightNode );\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\n */\n\n/**\n * The interface implemented by all preview gateways.\n *\n * @typedef Gateway\n * @property {function(string): JQuery.jqXHR} fetch\n * @property {FetchPreviewForTitle} fetchPreviewForTitle\n * @property {ConvertPageToModel} convertPageToModel\n */\n\n/**\n * A Promise, usually for a long running or costly task such as an HTTP request,\n * that is abortable.\n *\n * @template T\n * @typedef {Promise} AbortPromise\n * @property {function(): void} abort\n */\n\n/**\n * @stable this function is available to 3rd parties. Any breaking changes must\n * go through the MediaWiki deprecation process.\n * @param {Promise|jQuery.Promise} promise\n * @param {function(): void} [abort]\n * @return {AbortPromise}\n */\nexport function abortablePromise( promise, abort = () => {} ) {\n\t// JQuery provided.\n\tif ( promise.promise ) {\n\t\treturn promise.promise( {\n\t\t\tabort\n\t\t} );\n\t}\n\tpromise.abort = abort;\n\treturn promise;\n}\n\n/**\n * Fetches a preview for a page or reference.\n *\n * If the underlying request is successful and contains data for the requested title,\n * then the resulting promise will resolve. If not, then it will reject.\n *\n * @typedef {function(mw.Title, HTMLAnchorElement): AbortPromise} FetchPreviewForTitle\n */\n\n/**\n * Converts the API response to a preview model. Exposed for testing only.\n *\n * @typedef {function(Object, ...any): PagePreviewModel} ConvertPageToModel\n */\n\nconst gatewayMap = {};\n\n/**\n * @param {string} type Type of preview we are handling\n * @return {Gateway|undefined}\n */\nexport function getGatewayForPreviewType( type ) {\n\treturn gatewayMap[ type ];\n}\n\n/**\n * Register a gateway for a given preview type.\n *\n * @param {string} type preview type\n * @param {Gateway} gateway\n */\nexport function registerGatewayForPreviewType( type, gateway ) {\n\tgatewayMap[ type ] = gateway;\n}\n","/**\n * @module gateway/mediawiki\n */\n\nimport { createModel } from '../preview/model';\nimport * as formatter from '../formatter';\nimport { abortablePromise } from './index.js';\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 abortablePromise( 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} ), () => xhr.abort() );\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 = Object.assign( {}, 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';\nimport { abortablePromise } from './index.js';\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 abortablePromise( 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 Promise.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} ), () => 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\tconst extractNode = document.createElement( 'div' );\n\textractNode.innerHTML = extract;\n\treturn extract.length === 0 ? [] : extractNode.childNodes;\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 gateway/page\n */\n\nimport constants from '../constants';\nimport createMediaWikiApiGateway from './mediawiki';\nimport createRESTBaseGateway from './rest';\nimport * as formatters from './restFormatters';\nimport { abortablePromise } from './index.js';\n\n/**\n * @param {Object} options\n * @return {Promise}\n */\nfunction ajax( options ) {\n\tconst controller = new AbortController();\n\tconst signal = controller.signal;\n\n\treturn abortablePromise(\n\t\tfetch( options.url, {\n\t\t\theaders: options.headers,\n\t\t\tsignal\n\t\t} ).then( ( resp ) => resp.json() ),\n\t\t() => {\n\t\t\tcontroller.abort();\n\t\t}\n\t);\n}\n\n/**\n * Creates a page preview gateway with sensible values for the dependencies.\n *\n * @param {mw.Map} config\n * @return {Gateway}\n */\nexport default function createPagePreviewGateway( config ) {\n\tconst gatewayConfig = Object.assign( {}, constants, {\n\t\tacceptLanguage: config.get( 'wgPageContentLanguage' )\n\t} );\n\tconst restConfig = Object.assign( {}, gatewayConfig, {\n\t\tendpoint: config.get( 'wgPopupsRestGatewayEndpoint' )\n\t} );\n\tswitch ( config.get( 'wgPopupsGateway' ) ) {\n\t\tcase 'mwApiPlain':\n\t\t\treturn createMediaWikiApiGateway( new mw.Api(), gatewayConfig );\n\t\tcase 'restbasePlain':\n\t\t\treturn createRESTBaseGateway(\n\t\t\t\tajax, restConfig, formatters.parsePlainTextResponse );\n\t\tcase 'restbaseHTML':\n\t\t\treturn createRESTBaseGateway(\n\t\t\t\tajax, restConfig, formatters.parseHTMLResponse );\n\t\tdefault:\n\t\t\tthrow new Error( 'Unknown gateway' );\n\t}\n}\n","export const TYPE_REFERENCE = 'reference';\nexport const FETCH_DELAY_REFERENCE_TYPE = 150; // ms.\n","import { previewTypes } from './preview/model';\nimport { TYPE_REFERENCE } from './ext.popups.referencePreviews/constants.js';\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\tmigrateOldPreferences() {\n\t\t\tconst isDisabled = !!storage.get( PAGE_PREVIEWS_ENABLED_KEY );\n\t\t\tif ( isDisabled ) {\n\t\t\t\tstorage.remove( PAGE_PREVIEWS_ENABLED_KEY );\n\t\t\t\tthis.storePreviewTypeEnabled( previewTypes.TYPE_PAGE, false );\n\t\t\t}\n\t\t\tconst isRefsDisabled = !!storage.get( REFERENCE_PREVIEWS_ENABLED_KEY );\n\t\t\tif ( isRefsDisabled ) {\n\t\t\t\tstorage.remove( REFERENCE_PREVIEWS_ENABLED_KEY );\n\t\t\t\tthis.storePreviewTypeEnabled( TYPE_REFERENCE, false );\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Check whether the preview type is enabled.\n\t\t *\n\t\t * @method\n\t\t * @param {string} previewType\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tisPreviewTypeEnabled( previewType ) {\n\t\t\tconst storageKey = `mwe-popups-${ previewType }-enabled`;\n\t\t\tconst value = storage.get( storageKey );\n\t\t\treturn value === null;\n\t\t},\n\n\t\t/**\n\t\t * Permanently persists (typically in localStorage) whether the user has enabled\n\t\t * the preview type.\n\t\t *\n\t\t * @method\n\t\t * @name UserSettings#storePreviewTypeEnabled\n\t\t * @param {string} previewType\n\t\t * @param {boolean} enabled\n\t\t */\n\t\tstorePreviewTypeEnabled( previewType, enabled ) {\n\t\t\tif ( previewType === TYPE_REFERENCE ) {\n\t\t\t\tmw.track( REFERENCE_PREVIEWS_LOGGING_SCHEMA, {\n\t\t\t\t\taction: enabled ? 'anonymousEnabled' : 'anonymousDisabled'\n\t\t\t\t} );\n\t\t\t}\n\t\t\tconst storageKey = `mwe-popups-${ previewType }-enabled`;\n\t\t\tif ( enabled ) {\n\t\t\t\tstorage.remove( storageKey );\n\t\t\t} else {\n\t\t\t\tstorage.set( storageKey, '0' );\n\t\t\t}\n\t\t}\n\t};\n}\n","/**\n * @module previewBehaviour\n */\nconst canSaveToUserPreferences = require( './canSaveToUserPreferences.js' );\n\n/**\n * A collection of event handlers specific to how the user interacts with all\n * previews. The event handlers are are agnostic to how/when they are bound\n * //but not to what they are bound//, i.e. the showSettings event handler is\n * written to be bound to either an `` or `