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zD,OAAKuD,EAAQA,QACLA,EAAQA,QAAS,CACvBC,MAAAA,KAGFD,EAAQC,MAAQA,EACTD,EACR,CDiDSE,CAAkBjB,QAAQkB,QAASlI,GAC3C,GDzED0E,OAAOyD,YAAyC,OAA3BlC,EAAkC,CACtDhG,KAAMxB,EACN2J,SAAU,6CACVC,MZfyC,IYgBzCjC,QAAAA,EACAkC,SP+Jc,SAAiCtI,GAC/C,MAAO,CACNS,GAAIV,EAAwBC,GAC5BuI,cAAc,EACdC,QAAQ,EAEV,EOpKCC,KAAM,WVXDrI,GAAGgE,OAAOC,IAAK,8BACnBqE,UAAUC,YACVvI,GAAGgE,OAAOC,IAAK,iBACdzF,IAEDA,GAAa,EACbwB,GAAGuC,MAAO9D,EAAgB,CAAE+D,OAAQ,aUOrC,GACG,I","sources":["/w/extensions/Popups/./src/canSaveToUserPreferences.js","/w/extensions/Popups/./src/ui/pointer-mask.svg","/w/extensions/Popups/webpack/bootstrap","/w/extensions/Popups/./src/ext.popups.referencePreviews/constants.js","/w/extensions/Popups/./src/ext.popups.referencePreviews/isReferencePreviewsEnabled.js","/w/extensions/Popups/./src/ext.popups.referencePreviews/referencePreviews.js","/w/extensions/Popups/./src/ui/templates/templateUtil.js","/w/extensions/Popups/./src/ui/templates/popup/popup.js","/w/extensions/Popups/./src/ext.popups.referencePreviews/createReferencePreview.js","/w/extensions/Popups/./src/constants.js","/w/extensions/Popups/./src/bracketedPixelRatio.js","/w/extensions/Popups/./src/ui/renderer.js","/w/extensions/Popups/./src/ext.popups.referencePreviews/setUserConfigFlags.js","/w/extensions/Popups/./src/preview/model.js","/w/extensions/Popups/./src/userSettings.js","/w/extensions/Popups/./src/ext.popups.referencePreviews/index.js","/w/extensions/Popups/./src/ext.popups.referencePreviews/createReferenceGateway.js","/w/extensions/Popups/./src/gateway/index.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","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\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export const TYPE_REFERENCE = 'reference';\nexport const FETCH_DELAY_REFERENCE_TYPE = 150; // ms.\n","import { TYPE_REFERENCE } from './constants.js';\n\n/**\n * @module isReferencePreviewsEnabled\n */\nconst canSaveToUserPreferences = require( '../canSaveToUserPreferences.js' );\n\n/**\n * Given the global state of the application, creates a function that gets\n * whether or not the user should have Reference Previews enabled.\n *\n * @param {mw.User} user The `mw.user` singleton instance\n * @param {Object} userSettings An object returned by `userSettings.js`\n * @param {mw.Map} config\n *\n * @return {boolean|null} Null when there is no way the popup type can be enabled at run-time.\n */\nexport default function isReferencePreviewsEnabled( user, userSettings, config ) {\n\t// TODO: This and the final `mw.user.options` check are currently redundant. Only this here\n\t// should be removed when the wgPopupsReferencePreviews feature flag is not needed any more.\n\tif ( !config.get( 'wgPopupsReferencePreviews' ) ) {\n\t\treturn null;\n\t}\n\n\t// T265872: Unavailable when in conflict with (one of the) reference tooltips gadgets.\n\tif ( config.get( 'wgPopupsConflictsWithRefTooltipsGadget' ) ||\n\t\tconfig.get( 'wgPopupsConflictsWithNavPopupGadget' ) ||\n\t\t// T243822: Temporarily disabled in the mobile skin\n\t\tconfig.get( 'skin' ) === 'minerva'\n\t) {\n\t\treturn null;\n\t}\n\n\t// For anonymous users, the code loads always, but the feature can be toggled at run-time via\n\t// local storage.\n\tif ( !canSaveToUserPreferences( user ) ) {\n\t\treturn userSettings.isPreviewTypeEnabled( TYPE_REFERENCE );\n\t}\n\n\t// Registered users never can enable popup types at run-time.\n\treturn user.options.get( 'popups-reference-previews' ) === '1' ? true : null;\n}\n","let isTracking = false;\n\nexport const LOGGING_SCHEMA = 'event.ReferencePreviewsPopups';\n\n/**\n * Run once the preview is initialized.\n */\nexport function initReferencePreviewsInstrumentation() {\n\tif ( mw.config.get( 'wgPopupsReferencePreviews' ) &&\n\t\tnavigator.sendBeacon &&\n\t\tmw.config.get( 'wgIsArticle' ) &&\n\t\t!isTracking\n\t) {\n\t\tisTracking = true;\n\t\tmw.track( LOGGING_SCHEMA, { action: 'pageview' } );\n\t}\n}\n\nexport function isTrackingEnabled() {\n\treturn isTracking;\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