{"version":3,"sources":["webpack://mfModules.[name]/./src/mobile.notifications.overlay/NotificationsFilterOverlay.js","webpack://mfModules.[name]/./src/mobile.notifications.overlay/list.js","webpack://mfModules.[name]/./src/mobile.notifications.overlay/mobile.notifications.overlay.js"],"names":["NotificationsFilterOverlay","Overlay","require","util","mfExtend","options","self","this","call","extend","className","on","mainMenu","closeNavigationDrawers","$crossWikiUnreadFilter","hide","$notifReadState","find","$el","append","parseHTML","addClass","defaults","prototype","heading","mw","msg","preRender","message","escaped","module","exports","View","promisedView","echo","markAllReadButton","onCountChange","onNotificationListRendered","wrapperWidget","maxNotificationCount","config","get","echoApi","api","EchoApi","unreadCounter","dm","UnreadNotificationCounter","modelManager","ModelManager","type","controller","Controller","markAsReadHandler","toggle","manager","hasLocalUnread","$moreOptions","maxPrioritizedActions","ui","NotificationsWrapper","$overlay","count","getUnreadCounter","getCappedNotificationCount","numNotifications","getLocalUnread","length","markLocalNotificationsRead","then","notify","populate","updateSeenTime","make","$element","m","defaultOverlay","list","define","deprecate","cappedCount","badge","setCount","markAsSeen"],"mappings":"8NAAA,IAGCA,EAHGC,EAAUC,EAAS,mCACtBC,EAAOD,EAAS,gCACLA,EAAS,mCA4CrBE,CA/BAJ,EAA6B,SAAWK,GACvC,IAAIC,EAAOC,KAEXN,EAAQO,KACPD,KACAJ,EAAKM,QAEJC,UAAW,gFACTL,IAIJE,KAAKI,GAAI,OAAQ,WAChBN,EAAQO,SAASC,2BAElBR,EAAQS,uBAAuBH,GAAI,QAAS,WAC3CL,EAAKS,SAGNV,EAAQW,gBAAgBC,KAAM,wBAAyBN,GAAI,QAAS,WACnEL,EAAKS,SAGNR,KAAKW,IAAID,KAAM,oBAAqBE,OACnCZ,KAAKa,UAAW,SACdC,SAAU,2CACVF,OAAQd,EAAQW,iBAClBX,EAAQS,yBAI4Bb,GAQrCqB,SAAUnB,EAAKM,UAAYR,EAAQsB,UAAUD,UAC5CE,QAASC,GAAGC,IAAK,gDAQlBC,UAAW,WACVpB,K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AAS,iDAC1B2E,EAAO3E,EAAS,8CAChBF,EAA6BE,EAAS,oEAevCyE,EAAEG,OAAQ,gCACTD,SAGDF,EAAEG,OAAQ,0DAA2D9E,GACrE2E,EAAEI,UAAW,oDAbb,SAA+B1E,GAC9B,OAAOuE,EAAgB,SAAWI,GACjC3E,EAAQ4E,MAAMC,SAAUF,IACtB,WACF3E,EAAQ4E,MAAME","file":"mobile.notifications.overlay.js","sourcesContent":["var Overlay = require( '../mobile.startup/Overlay' ),\n\tutil = require( '../mobile.startup/util' ),\n\tmfExtend = require( '../mobile.startup/mfExtend' ),\n\tNotificationsFilterOverlay;\n\n/**\n * Overlay for notifications filter\n *\n * @class NotificationsFilterOverlay\n * @extends Overlay\n * @param {Object} options\n * @param {jQuery.Object} options.$notifReadState - notification read status widgets\n * @param {jQuery.Object} options.$crossWikiUnreadFilter - notification unread filter\n *\n */\nNotificationsFilterOverlay = function ( options ) {\n\tvar self = this;\n\n\tOverlay.call(\n\t\tthis,\n\t\tutil.extend( {\n\t\t\t// FIXME: notification-overlay class to be generalized\n\t\t\tclassName: 'overlay notifications-filter-overlay notifications-overlay navigation-drawer'\n\t\t}, options )\n\t);\n\n\t// Initialize\n\tthis.on( 'hide', function () {\n\t\toptions.mainMenu.closeNavigationDrawers();\n\t} );\n\toptions.$crossWikiUnreadFilter.on( 'click', function () {\n\t\tself.hide();\n\t} );\n\n\toptions.$notifReadState.find( '.oo-ui-buttonElement' ).on( 'click', function () {\n\t\tself.hide();\n\t} );\n\n\tthis.$el.find( '.overlay-content' ).append(\n\t\tthis.parseHTML( '<div>' )\n\t\t\t.addClass( 'notifications-filter-overlay-read-state' )\n\t\t\t.append( options.$notifReadState ),\n\t\toptions.$crossWikiUnreadFilter\n\t);\n};\n\nmfExtend( NotificationsFilterOverlay, Overlay, {\n\t/**\n\t * @memberof NotificationsFilterOverlay\n\t * @instance\n\t * @mixes Overlay#defaults\n\t * @property {Object} defaults Default options hash.\n\t * @property {string} defaults.heading Heading text.\n\t */\n\tdefaults: util.extend( {}, Overlay.prototype.defaults, {\n\t\theading: mw.msg( 'mobile-frontend-notifications-filter-title' )\n\t} ),\n\n\t/**\n\t * @inheritdoc\n\t * @memberof NotificationsFilterOverlay\n\t * @instance\n\t */\n\tpreRender: function () {\n\t\tthis.options.heading = '<strong>' + mw.message( 'mobile-frontend-notifications-filter-title' ).escaped() + '</strong>';\n\t}\n} );\n\nmodule.exports = NotificationsFilterOverlay;\n","const\n\tutil = require( '../mobile.startup/util' ),\n\tView = require( '../mobile.startup/View' ),\n\tpromisedView = require( '../mobile.startup/promisedView' );\n\n/**\n * This callback is displayed as a global member.\n * @callback countChangeCallback\n * @param {number} count a capped (0-99 or 99+) count\n */\n\n/**\n * List of notifications\n *\n * @param {mw.echo} echo class\n * @param {OO.ui.ButtonWidget} markAllReadButton - a button that will be associated with the\n *  read status of the notifications list.\n * @param {countChangeCallback} onCountChange callback.\n * @param {Function} onNotificationListRendered a function that is called when the\n *   notifications list has fully rendered (taking no arguments)\n * @return {View}\n */\nfunction notificationsList( echo, markAllReadButton, onCountChange, onNotificationListRendered ) {\n\tvar wrapperWidget,\n\t\tmaxNotificationCount = mw.config.get( 'wgEchoMaxNotificationCount' ),\n\t\techoApi = new echo.api.EchoApi(),\n\t\tunreadCounter = new echo.dm.UnreadNotificationCounter( echoApi, 'all', maxNotificationCount ),\n\t\tmodelManager = new echo.dm.ModelManager( unreadCounter, { type: [ 'message', 'alert' ] } ),\n\t\tcontroller = new echo.Controller(\n\t\t\techoApi,\n\t\t\tmodelManager,\n\t\t\t{\n\t\t\t\ttype: [ 'message', 'alert' ]\n\t\t\t}\n\t\t),\n\t\tmarkAsReadHandler = function () {\n\t\t\tmarkAllReadButton.toggle(\n\t\t\t\tcontroller.manager.hasLocalUnread()\n\t\t\t);\n\t\t},\n\t\t// Create a container which will be revealed when \"more options\" (...)\n\t\t// is clicked on a notification. Hidden by default.\n\t\t$moreOptions = util.parseHTML( '<div>' )\n\t\t\t.addClass( 'notifications-overlay-overlay position-fixed' );\n\n\techo.config.maxPrioritizedActions = 1;\n\n\twrapperWidget = new echo.ui.NotificationsWrapper( controller, modelManager, {\n\t\t$overlay: $moreOptions\n\t} );\n\n\t// Mark all read\n\tmarkAllReadButton.toggle( false );\n\n\t// Events\n\tunreadCounter.on( 'countChange', function ( count ) {\n\t\tonCountChange(\n\t\t\tcontroller.manager.getUnreadCounter().getCappedNotificationCount( count )\n\t\t);\n\t\tmarkAsReadHandler();\n\t} );\n\tmarkAllReadButton.on( 'click', function () {\n\t\tvar numNotifications = controller.manager.getLocalUnread().length;\n\n\t\tcontroller.markLocalNotificationsRead()\n\t\t\t.then( function () {\n\t\t\t\tmw.notify( mw.msg( 'echo-mark-all-as-read-confirmation', numNotifications ) );\n\t\t\t\tmarkAllReadButton.toggle( false );\n\t\t\t}, function () {\n\t\t\t\tmarkAllReadButton.toggle( false );\n\t\t\t} );\n\t} );\n\n\treturn promisedView(\n\t\t// Populate notifications\n\t\twrapperWidget.populate().then( function () {\n\t\t\tcontroller.updateSeenTime();\n\t\t\tonNotificationListRendered();\n\t\t\tmarkAsReadHandler();\n\t\t\t// Connect event here as we know that everything loaded correctly\n\t\t\tmodelManager.on( 'update', markAsReadHandler );\n\t\t\treturn View.make( {}, [ wrapperWidget.$element, $moreOptions ] );\n\t\t} )\n\t);\n}\n\nmodule.exports = notificationsList;\n","var m = require( './../mobile.startup/moduleLoaderSingleton' ),\n\tdefaultOverlay = require( './../mobile.startup/notifications/overlay' ),\n\tlist = require( './list' ),\n\tNotificationsFilterOverlay = require( './NotificationsFilterOverlay' );\n\n/**\n * @deprecated\n * @param {Object} options\n * @return {Overlay}\n */\nfunction NotificationsOverlay( options ) {\n\treturn defaultOverlay( function ( cappedCount ) {\n\t\toptions.badge.setCount( cappedCount );\n\t}, function () {\n\t\toptions.badge.markAsSeen();\n\t} );\n}\n\nm.define( 'mobile.notifications.overlay', {\n\tlist\n} );\n\nm.define( 'mobile.notifications.overlay/NotificationsFilterOverlay', NotificationsFilterOverlay );\nm.deprecate( 'mobile.notifications.overlay/NotificationsOverlay', NotificationsOverlay );\n"],"sourceRoot":""}