{"version":3,"sources":["webpack://mfModules.[name]/./src/mobile.editor.overlay/BlockMessageDetails.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/EditorGateway.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/EditorOverlayBase.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/SourceEditorOverlay.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/VisualEditorOverlay.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/blockMessageDrawer.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/identifyLeadParagraph.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/mobile.editor.overlay.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/parseBlockInfo.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/saveFailureMessage.js","webpack://mfModules.[name]/./src/mobile.editor.overlay/setPreferredEditor.js","webpack://mfModules.[name]/./src/mobile.startup/MessageBox.js"],"names":["Button","require","View","Icon","util","BlockMessageDetails","createDetailsAnchorHref","blockId","render","mw","getUrl","wpTarget","createDetailsAnchorLabel","msg","createTitle","msgKey","user","isAnon","this","partial","createBody","anonOnly","noCreateAccount","seeMoreLink","reasonHeader","creatorHeader","options","get","expiryHeader","cta","config","progressive","wiki","label","href","Title","quiet","tagName","additionalClassNames","track","events","click","drawer","$el","find","prepend","getButtonConfig","name","parsedReason","then","htmlReason","html","template","module","exports","actionParams","EditorGateway","api","title","sectionId","oldId","content","isNewPage","undefined","fromModified","hasChanged","prototype","getBlockInfo","pageObj","blockedError","actions","edit","Array","isArray","some","error","indexOf","code","data","blockinfo","getContent","self","resolve","Deferred","text","prop","rvprop","titles","intestactions","intestactionsdetail","rvstartid","rvsection","resp","revision","reject","query","pages","missing","revisions","timestamp","originalContent","setContent","save","apiOptions","result","action","errorformat","errorlang","errorsuselocal","formatversion","summary","captchaid","captchaId","captchaword","captchaWord","basetimestamp","starttimestamp","section","postWithToken","newrevid","abortPreview","_pending","abort","getPreview","sectionLine","extend","sectionpreview","disableeditsection","pst","mobileformat","useskin","disabletoc","post","parse","sections","anchor","line","id","promise","Overlay","parseBlockInfo","headers","PageGateway","icons","mfExtend","blockMessageDrawer","MessageBox","mwUser","EditVeTool","toolGroup","classes","super","call","EditorOverlayBase","params","onBeforeExit","bind","className","isBorderBox","placeholder","summaryRequestMsg","pageGateway","editCount","isNewEditor","sessionId","overlayManager","OO","inheritClass","ui","Tool","static","icon","group","onSelect","onUpdateState","defaults","hasToolbar","continueMsg","closeMsg","summaryMsg","captchaMsg","captchaTryAgainMsg","switchMsg","confirmMsg","licenseMsg","log","editor_interface","editor","editing_session_id","logFeatureUse","confirmSave","window","confirm","onSaveComplete","newRevId","saved","invalidatePage","showSaveCompleteMsg","hook","fire","revision_id","setTimeout","location","hash","notify","type","onSaveFailure","errors","captcha","message","badtoken","assertanonfailed","assertuserfailed","assertnameduserfailed","spamblacklist","pagedeleted","editconflict","reportError","errorNotice","heading","$errorNoticeContainer","hideErrorNotice","empty","onStageChanges","showHidden","scrollTo","onSaveBegin","confirmAborted","preRender","formHeader","editSwitcher","editingMsg","readOnly","disabled","cancel","saveHeader","previewingMsg","savingHeader","postRender","apply","show","allowCloseWindow","confirmCloseWindow","test","namespace","onClickBack","onClickSubmit","onClickContinue","onClickAnonymous","exit","switching","windowManager","getWindowManager","addWindows","widgets","AbandonEditDialog","openWindow","closed","mechanism","onExit","target","edited","release","createAnonWarning","$actions","$","addClass","$anonWarning","append","returnto","returnTo","warning","queryParams","signupParams","signupQueryParams","anonymousEditorActions","block","map","createAnonTalkWarning","clone","getOptionsForSwitch","switched","currentPageHTMLParser","fakeScroll","titleObj","contentLang","contentDir","getLoadingPromise","dataPromise","handleCaptcha","details","$input","captchaShown","val","attr","mime","detach","url","question","Section","saveFailureMessage","fakeToolbar","toast","setPreferredEditor","VisualEditorOverlay","SourceEditorOverlay","isFirefox","navigator","userAgent","visualEditorConfig","gateway","isVisualEditorEnabled","templatePartials","arguments","_resizeEditor","ns","namespaces","onInputWikitextEditor","_hidePreview","showAnonWarning","loader","using","switchToolbar","switchWindow","toolFactory","ToolFactory","toolGroupFactory","ToolGroupFactory","register","libs","ve","MWEditModeVisualTool","MWEditModeSourceTool","Toolbar","on","mode","canSwitch","allowSwitchingToVisualMode","fullRestbaseUrl","allowLossySwitching","_switchToVisualEditor","WindowManager","SwitchConfirmDialog","$element","appendTo","document","body","destroy","setup","include","emit","spinner","hideSpinner","$preview","$content","$anonTalkWarning","hide","$anonHiddenButtons","one","docEl","documentElement","scrollTop","blockScroll","addEventListener","removeEventListener","_loadContent","hideSpinnerAndShowPreview","getDocument","showSpinner","mainpage","parsedText","parsedSectionLine","parseHTML","el","removeClass","container","$scrollContainer","Element","getClosestScrollableContainer","length","css","height","wikitext","feature","targetLoader","addPlugin","loadModules","newOverlay","requestPageData","targetName","modified","replaceCurrent","remove","uri","Uri","mfnotify","search","getQueryString","reload","showOnPageReload","router","identifyLeadParagraph","getSingleton","surfaceReady","appendChild","origDataPromise","getPrefixedDb","sessionStore","init","MobileArticleTarget","trackingName","targetFactory","create","once","getSurface","getModel","load","visualeditor","editHeader","destroyTarget","targetInit","afterSurfaceReady","scrollToLeadParagraph","editLead","editLeadView","readLead","offset","initialCursorOffset","$window","surface","getMode","getView","$attachedRootNode","getLeadSectionElement","top","setLinearSelection","Range","getRange","start","getSelection","getSelectionBoundingRect","padding","overlay","switchToEditor","switchToSourceEditor","setReadOnly","navigateTo","path","useReplaceState","hasBeenModified","Drawer","props","blockDrawer","onBeforeHide","onShow","$drawer","drawerTop","creatorTop","buttonsTop","$seeMore","$container","children","$body","isNonLeadParagraph","node","cloneNode","$node","hasClass","textContent","isNotEmptyNode","$paragraphs","i","p","m","define","blockInfo","blockpartial","blocknocreate","blockanononly","creator","blockedby","expiry","duration","reason","blockid","jqueryMsgParse","parser","jqueryMsg","ast","wikiTextToAst","emitter","e","blockedbyid","makeTitle","blockexpiry","blockexpiryformatted","escaped","blockexpiryrelative","blockreason","escape","Api","contentmodel","catch","readonlyreason","storage","set","saveOption","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Ae,EACfzB,KAAM+Y,EACNkB,aAAc,aACXpc,MAAM,SAAWuD,GACpB,OAAOA,EAAO6B,MAAMjD,QACjBka,OAAO,WACV,OAAOjB,EAAgBF,IAAY1d,GAAG0C,KAAKgc,OAAQhB,QAGpDR,EAAUQ,OAAS1d,GAAGwM,QAAS,+CAAgD+R,UAC/ErB,EAAU3a,aAAe5C,EAAK+E,WAAWD,QAASyY,EAAUQ,QAASzV,WAG/DiV,I,kEC9DRta,EAAOC,QAAU,SAA6BwB,GAK7C,IAAID,EAAOC,GAAQA,EAAKiI,QAAUjI,EAAKiI,OAAO,IAAMjI,EAAKiI,OAAO,GAAGlI,KAEnE,MAAc,iBAATA,EACGpE,GAAGI,IAAK,yCAGF,aAATgE,EACGC,EAAKiI,OAAO,GAAG5J,KAAO,OAAS2B,EAAKiI,OAAO,GAAGjI,KAAKya,eAGtDza,EAAKiI,QAAUjI,EAAKiI,OAAO,GACxBjI,EAAKiI,OAAO,GAAG5J,KAKhB,K,kECtBRE,EAAOC,QAAU,SAA6BqI,GACvClL,GAAGO,KAAKC,SAKbR,GAAG+e,QAAQC,IAAK,kBAAmB9T,IAJnC,IAAIlL,GAAG2e,KAAMM,WAAY,gBAAiB/T,GAAS1I,MAAM,WACxDxC,GAAGO,KAAKU,QAAQ+d,IAAK,gBAAiB9T,Q,qDCRzC,IACCzL,EAAOD,EAAS,gCAChBG,EAAOH,EAAS,gCAOjB,SAASiJ,IACRhJ,EAAK6O,MAAO7N,KAAMuS,WAPPxT,EAAS,mCAUrB+I,CAAUE,EAAYhJ,EAAM,CAM3Byf,gBAAgB,EAWhB5U,SAAU,GAKV3H,SAAUhD,EAAKgD,SAAL,2HAQXC,EAAOC,QAAU4F,I","file":"mobile.editor.overlay.js","sourcesContent":["'use strict';\nconst Button = require( '../mobile.startup/Button' ),\n\tView = require( '../mobile.startup/View' ),\n\tIcon = require( '../mobile.startup/Icon' ),\n\tutil = require( '../mobile.startup/util' );\n\n/**\n * @extends View\n */\nclass BlockMessageDetails extends View {\n\t/** @inheritdoc */\n\tget isTemplateMode() {\n\t\treturn true;\n\t}\n\t/**\n\t * @inheritdoc\n\t */\n\tget defaults() {\n\t\treturn {\n\t\t\tcreateDetailsAnchorHref: function () {\n\t\t\t\treturn function ( blockId, render ) {\n\t\t\t\t\treturn mw.util.getUrl( 'Special:BlockList', { wpTarget: '#' + render( blockId ) } );\n\t\t\t\t};\n\t\t\t},\n\t\t\tcreateDetailsAnchorLabel: function () {\n\t\t\t\treturn mw.msg( 'mobile-frontend-editor-blocked-drawer-help' );\n\t\t\t},\n\t\t\tcreateTitle: function () {\n\t\t\t\tlet msgKey = 'mobile-frontend-editor-blocked-drawer-title';\n\t\t\t\tif ( mw.user.isAnon() ) {\n\t\t\t\t\tmsgKey += '-ip';\n\t\t\t\t}\n\t\t\t\tif ( this.partial ) {\n\t\t\t\t\tmsgKey += '-partial';\n\t\t\t\t}\n\t\t\t\t// The following messages can be passed here:\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-title\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-title-partial\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-title-ip\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-title-ip-partial\n\t\t\t\treturn mw.msg( msgKey );\n\t\t\t},\n\t\t\tcreateBody: function () {\n\t\t\t\tlet msgKey = '';\n\t\t\t\tif ( mw.user.isAnon() && this.anonOnly ) {\n\t\t\t\t\tmsgKey = 'mobile-frontend-editor-blocked-drawer-body';\n\t\t\t\t\tif ( this.noCreateAccount ) {\n\t\t\t\t\t\tmsgKey += '-login';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmsgKey += '-login-createaccount';\n\t\t\t\t\t}\n\t\t\t\t\tif ( this.partial ) {\n\t\t\t\t\t\tmsgKey += '-partial';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( this.partial ) {\n\t\t\t\t\t\tmsgKey = 'mobile-frontend-editor-blocked-drawer-body-partial';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// The following messages can be passed here:\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-body-partial\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-body-login\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-body-login-partial\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-body-login-createaccount\n\t\t\t\t// * mobile-frontend-editor-blocked-drawer-body-login-createaccount-partial\n\t\t\t\treturn msgKey ? mw.msg( msgKey ) : msgKey;\n\t\t\t},\n\t\t\tseeMoreLink: mw.msg( 'mobile-frontend-editor-blocked-drawer-body-link' ),\n\t\t\treasonHeader: mw.msg( 'mobile-frontend-editor-blocked-drawer-reason-header' ),\n\t\t\tcreatorHeader: function () {\n\t\t\t\t// The gender is the subject (the blockee) not the object (the blocker).\n\t\t\t\treturn mw.msg( 'mobile-frontend-editor-blocked-drawer-creator-header',\n\t\t\t\t\tmw.user.options.get( 'gender' ) );\n\t\t\t},\n\t\t\texpiryHeader: mw.msg( 'mobile-frontend-editor-blocked-drawer-expiry-header' )\n\t\t};\n\t}\n\t/**\n\t * Configure the call to action depending on the type of block.\n\t *\n\t * @return {Object} Configuration options\n\t */\n\tgetButtonConfig() {\n\t\tlet cta = true;\n\t\tconst config = {\n\t\t\t\tprogressive: true\n\t\t\t},\n\t\t\twiki = mw.config.get( 'wgDBname' );\n\n\t\tif ( mw.user.isAnon() && this.options.anonOnly ) {\n\t\t\t// The user can avoid the block by logging in\n\t\t\tconfig.label = mw.msg( 'mobile-frontend-editor-blocked-drawer-action-login' );\n\t\t\tconfig.href = new mw.Title( 'Special:UserLogin' ).getUrl();\n\t\t} else if ( this.options.partial ) {\n\t\t\t// The user can avoid the block by editing a different page\n\t\t\tconfig.label = mw.msg( 'mobile-frontend-editor-blocked-drawer-action-randompage' );\n\t\t\tconfig.href = new mw.Title( 'Special:Random' ).getUrl();\n\t\t\tconfig.quiet = true;\n\t\t} else {\n\t\t\t// The user cannot avoid the block\n\t\t\tconfig.tagName = 'button';\n\t\t\tconfig.label = mw.msg( 'mobile-frontend-editor-blocked-drawer-action-ok' );\n\t\t\tconfig.additionalClassNames = 'cancel';\n\t\t\tcta = false;\n\t\t}\n\n\t\tif ( cta && mw.config.get( 'wgMFTrackBlockNotices' ) ) {\n\t\t\tmw.track( 'counter.MediaWiki.BlockNotices.' + wiki + '.MobileFrontend.ctaShown', 1 );\n\t\t\tconfig.events = {\n\t\t\t\tclick: function () {\n\t\t\t\t\tmw.track( 'counter.MediaWiki.BlockNotices.' + wiki + '.MobileFrontend.ctaClicked', 1 );\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\treturn config;\n\t}\n\t/**\n\t * @inheritdoc\n\t */\n\tpostRender() {\n\t\tconst drawer = this;\n\t\tthis.$el.find( '.block-message-buttons' ).prepend(\n\t\t\tnew Button( this.getButtonConfig() ).$el\n\t\t);\n\t\tthis.$el.find( '.block-message-icon' ).prepend(\n\t\t\t( new Icon( {\n\t\t\t\tname: 'block-destructive',\n\t\t\t\tadditionalClassNames: 'mw-ui-icon-flush-top'\n\t\t\t} ) ).$el\n\t\t);\n\t\tthis.options.parsedReason.then( function ( htmlReason ) {\n\t\t\tdrawer.$el.find( '.block-message-reason div' ).html( htmlReason );\n\t\t} );\n\t}\n\t/**\n\t * @inheritdoc\n\t */\n\tget template() {\n\t\treturn util.template( `\n<div class=\"block-message block-message-container\">\n  <div class=\"block-message-icon\"></div>\n  <div class=\"block-message-info\">\n    <div class=\"block-message-item block-message-title\">\n      <h5>{{ createTitle }}</h5>\n    </div>\n    <div class=\"block-message-data\">\n      <div class=\"block-message-item\">\n        <p>\n          {{ createBody }}\n          <a class =\"block-message-see-more\" href=\"#\">{{ seeMoreLink }}</a>\n        </p>\n      </div>\n      <div class=\"block-message-item block-message-creator\">\n        {{#creator.name}}\n          <p>\n            {{ creatorHeader }}\n            <strong>\n              {{#creator.url}}\n                <a href=\"{{ creator.url }}\">{{ creator.name }}</a>\n              {{/creator.url}}\n              {{^creator.url}}\n                {{ creator.name }}\n              {{/creator.url}}\n            </strong>\n          </p>\n        {{/creator.name}}\n      </div>\n      {{#duration}}\n        <div class=\"block-message-item\">\n          <p>\n            {{ expiryHeader }}\n            <strong>{{ duration }}</strong>\n          </p>\n        </div>\n      {{/duration}}\n      {{#blockId}}\n        <div class=\"block-message-item\">\n          <a href=\"{{#createDetailsAnchorHref}}{{ blockId }}{{/createDetailsAnchorHref}}\">\n            {{ createDetailsAnchorLabel }}\n          </a>\n        </div>\n      {{/blockId}}\n    </div>\n  </div>\n  {{#reason}}\n    <div class=\"block-message-item block-message-reason\">\n      <h5>{{ reasonHeader }}</h5>\n      <div><p>{{{ reason }}}</p></div>\n    </div>\n  {{/reason}}\n  <div class=\"block-message-buttons\">\n  </div>\n</div>` );\n\t}\n}\n\nmodule.exports = BlockMessageDetails;\n","var util = require( '../mobile.startup/util' ),\n\tactionParams = require( '../mobile.startup/actionParams' );\n\n/**\n * API that helps save and retrieve page content\n *\n * @class EditorGateway\n *\n * @param {Object} options Configuration options\n * @param {mw.Api} options.api an Api to use.\n * @param {string} options.title the title to edit\n * @param {string|null} options.sectionId the id of the section to operate edits on.\n * @param {number} [options.oldId] revision to operate on. If absent defaults to latest.\n * @param {boolean} [options.isNewPage] whether the page being created is new\n * @param {boolean} [options.fromModified] whether the page was loaded in a modified state\n */\nfunction EditorGateway( options ) {\n\tthis.api = options.api;\n\tthis.title = options.title;\n\tthis.sectionId = options.sectionId;\n\tthis.oldId = options.oldId;\n\t// return an empty section for new pages\n\tthis.content = options.isNewPage ? '' : undefined;\n\tthis.fromModified = options.fromModified;\n\tthis.hasChanged = options.fromModified;\n}\n\nEditorGateway.prototype = {\n\n\t/**\n\t * Get the block (if there is one) from the result.\n\t *\n\t * @memberof EditorGateway\n\t * @param {Object} pageObj Page object\n\t * @return {Object|null}\n\t */\n\tgetBlockInfo: function ( pageObj ) {\n\t\tvar blockedError;\n\n\t\tif ( pageObj.actions &&\n\t\t\tpageObj.actions.edit &&\n\t\t\tArray.isArray( pageObj.actions.edit )\n\t\t) {\n\t\t\tpageObj.actions.edit.some( function ( error ) {\n\t\t\t\tif ( [ 'blocked', 'autoblocked' ].indexOf( error.code ) !== -1 ) {\n\t\t\t\t\tblockedError = error;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t} );\n\n\t\t\tif ( blockedError && blockedError.data && blockedError.data.blockinfo ) {\n\t\t\t\treturn blockedError.data.blockinfo;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\t/**\n\t * Get the content of a page.\n\t *\n\t * @memberof EditorGateway\n\t * @instance\n\t * @return {jQuery.Promise}\n\t */\n\tgetContent: function () {\n\t\tvar options,\n\t\t\tself = this;\n\n\t\tfunction resolve() {\n\t\t\treturn util.Deferred().resolve( {\n\t\t\t\ttext: self.content || '',\n\t\t\t\tblockinfo: self.blockinfo\n\t\t\t} );\n\t\t}\n\n\t\tif ( this.content !== undefined ) {\n\t\t\treturn resolve();\n\t\t} else {\n\t\t\toptions = actionParams( {\n\t\t\t\tprop: [ 'revisions', 'info' ],\n\t\t\t\trvprop: [ 'content', 'timestamp' ],\n\t\t\t\ttitles: self.title,\n\t\t\t\t// get block information for this user\n\t\t\t\tintestactions: 'edit',\n\t\t\t\tintestactionsdetail: 'full'\n\t\t\t} );\n\t\t\t// Load text of old revision if desired\n\t\t\tif ( this.oldId ) {\n\t\t\t\toptions.rvstartid = this.oldId;\n\t\t\t}\n\t\t\t// See T52136 - passing rvsection will fail with non wikitext\n\t\t\tif ( this.sectionId ) {\n\t\t\t\toptions.rvsection = this.sectionId;\n\t\t\t}\n\t\t\treturn this.api.get( options ).then( function ( resp ) {\n\t\t\t\tvar revision, pageObj;\n\n\t\t\t\tif ( resp.error ) {\n\t\t\t\t\treturn util.Deferred().reject( resp.error.code );\n\t\t\t\t}\n\n\t\t\t\tpageObj = resp.query.pages[0];\n\t\t\t\t// page might not exist and caller might not have known.\n\t\t\t\tif ( pageObj.missing !== undefined ) {\n\t\t\t\t\tself.content = '';\n\t\t\t\t} else {\n\t\t\t\t\trevision = pageObj.revisions[0];\n\t\t\t\t\tself.content = revision.content;\n\t\t\t\t\tself.timestamp = revision.timestamp;\n\t\t\t\t}\n\n\t\t\t\t// save content a second time to be able to check for changes\n\t\t\t\tself.originalContent = self.content;\n\t\t\t\tself.blockinfo = self.getBlockInfo( pageObj );\n\n\t\t\t\treturn resolve();\n\t\t\t} );\n\t\t}\n\t},\n\n\t/**\n\t * Mark content as modified and set changes to be submitted when #save\n\t * is invoked.\n\t *\n\t * @memberof EditorGateway\n\t * @instance\n\t * @param {string} content New section content.\n\t */\n\tsetContent: function ( content ) {\n\t\tif ( this.originalContent !== content || this.fromModified ) {\n\t\t\tthis.hasChanged = true;\n\t\t} else {\n\t\t\tthis.hasChanged = false;\n\t\t}\n\t\tthis.content = content;\n\t},\n\n\t/**\n\t * Save the new content of the section, previously set using #setContent.\n\t *\n\t * @memberof EditorGateway\n\t * @instance\n\t * @param {Object} options Configuration options\n\t * @param {string} [options.summary] Optional summary for the edit.\n\t * @param {string} [options.captchaId] If CAPTCHA was requested, ID of the\n\t * captcha.\n\t * @param {string} [options.captchaWord] If CAPTCHA was requested, term\n\t * displayed in the CAPTCHA.\n\t * @return {jQuery.Deferred} On failure callback is passed an object with\n\t * `type` and `details` properties. `type` is a string describing the type\n\t * of error, `details` can be any object (usually error message).\n\t */\n\tsave: function ( options ) {\n\t\tvar self = this,\n\t\t\tresult = util.Deferred();\n\n\t\toptions = options || {};\n\n\t\t/**\n\t\t * Save content. Make an API request.\n\t\t *\n\t\t * @return {jQuery.Deferred}\n\t\t */\n\t\tfunction saveContent() {\n\t\t\tvar apiOptions = {\n\t\t\t\taction: 'edit',\n\t\t\t\terrorformat: 'html',\n\t\t\t\terrorlang: mw.config.get( 'wgUserLanguage' ),\n\t\t\t\terrorsuselocal: 1,\n\t\t\t\tformatversion: 2,\n\t\t\t\ttitle: self.title,\n\t\t\t\tsummary: options.summary,\n\t\t\t\tcaptchaid: options.captchaId,\n\t\t\t\tcaptchaword: options.captchaWord,\n\t\t\t\tbasetimestamp: self.timestamp,\n\t\t\t\tstarttimestamp: self.timestamp\n\t\t\t};\n\n\t\t\tif ( self.content !== undefined ) {\n\t\t\t\tapiOptions.text = self.content;\n\t\t\t}\n\n\t\t\tif ( self.sectionId ) {\n\t\t\t\tapiOptions.section = self.sectionId;\n\t\t\t}\n\n\t\t\tself.api.postWithToken( 'csrf', apiOptions ).then( function ( data ) {\n\t\t\t\tif ( data && data.edit && data.edit.result === 'Success' ) {\n\t\t\t\t\tself.hasChanged = false;\n\t\t\t\t\tresult.resolve( data.edit.newrevid );\n\t\t\t\t} else {\n\t\t\t\t\tresult.reject( data );\n\t\t\t\t}\n\t\t\t}, function ( code, data ) {\n\t\t\t\tresult.reject( data );\n\t\t\t} );\n\t\t\treturn result;\n\t\t}\n\n\t\treturn saveContent();\n\t},\n\n\t/**\n\t * Abort any pending previews.\n\t *\n\t * @memberof EditorGateway\n\t * @instance\n\t */\n\tabortPreview: function () {\n\t\tif ( this._pending ) {\n\t\t\tthis._pending.abort();\n\t\t}\n\t},\n\n\t/**\n\t * Get page preview from the API and abort any existing previews.\n\t *\n\t * @memberof EditorGateway\n\t * @instance\n\t * @param {Object} options API query parameters\n\t * @return {jQuery.Deferred}\n\t */\n\tgetPreview: function ( options ) {\n\t\tvar\n\t\t\tsectionLine = '',\n\t\t\tsectionId = '',\n\t\t\tself = this;\n\n\t\tutil.extend( options, {\n\t\t\taction: 'parse',\n\t\t\t// Enable section preview mode to avoid errors (T51218)\n\t\t\tsectionpreview: true,\n\t\t\t// Hide section edit links\n\t\t\tdisableeditsection: true,\n\t\t\t// needed for pre-save transform to work (T55692)\n\t\t\tpst: true,\n\t\t\t// Output mobile HTML (T56243)\n\t\t\tmobileformat: true,\n\t\t\tuseskin: mw.config.get( 'skin' ),\n\t\t\tdisabletoc: true,\n\t\t\ttitle: this.title,\n\t\t\tprop: [ 'text', 'sections' ]\n\t\t} );\n\n\t\tthis.abortPreview();\n\t\tthis._pending = this.api.post( options );\n\n\t\treturn this._pending.then( function ( resp ) {\n\t\t\tif ( resp && resp.parse && resp.parse.text ) {\n\t\t\t\t// When editing section 0 or the whole page, there is no section name, so skip\n\t\t\t\tif ( self.sectionId && self.sectionId !== '0' &&\n\t\t\t\t\tresp.parse.sections !== undefined &&\n\t\t\t\t\tresp.parse.sections[0] !== undefined\n\t\t\t\t) {\n\t\t\t\t\tif ( resp.parse.sections[0].anchor !== undefined ) {\n\t\t\t\t\t\tsectionId = resp.parse.sections[0].anchor;\n\t\t\t\t\t}\n\t\t\t\t\tif ( resp.parse.sections[0].line !== undefined ) {\n\t\t\t\t\t\tsectionLine = resp.parse.sections[0].line;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\ttext: resp.parse.text['*'],\n\t\t\t\t\tid: sectionId,\n\t\t\t\t\tline: sectionLine\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn util.Deferred().reject();\n\t\t\t}\n\t\t} ).promise( {\n\t\t\tabort: function () { self._pending.abort(); }\n\t\t} );\n\t}\n};\n\nmodule.exports = EditorGateway;\n","/* global $ */\nvar Overlay = require( '../mobile.startup/Overlay' ),\n\tutil = require( '../mobile.startup/util' ),\n\tparseBlockInfo = require( './parseBlockInfo' ),\n\theaders = require( '../mobile.startup/headers' ),\n\tPageGateway = require( '../mobile.startup/PageGateway' ),\n\ticons = require( '../mobile.startup/icons' ),\n\tButton = require( '../mobile.startup/Button' ),\n\tIcon = require( '../mobile.startup/Icon' ),\n\tmfExtend = require( '../mobile.startup/mfExtend' ),\n\tblockMessageDrawer = require( './blockMessageDrawer' ),\n\tMessageBox = require( '../mobile.startup/MessageBox' ),\n\tmwUser = mw.user;\n\n/**\n * 'Edit' button\n *\n * @param {OO.ui.ToolGroup} toolGroup\n * @param {Object} config\n */\nfunction EditVeTool( toolGroup, config ) {\n\tconfig = config || {};\n\tconfig.classes = [ 'visual-editor' ];\n\tEditVeTool.super.call( this, toolGroup, config );\n}\nOO.inheritClass( EditVeTool, OO.ui.Tool );\n\nEditVeTool.static.name = 'editVe';\nEditVeTool.static.icon = 'edit';\nEditVeTool.static.group = 'editorSwitcher';\nEditVeTool.static.title = mw.msg( 'mobile-frontend-editor-switch-visual-editor' );\n/**\n * click handler\n *\n * @memberof EditVeTool\n * @instance\n */\nEditVeTool.prototype.onSelect = function () {\n\t// will be overridden later\n};\n/**\n * Toolbar update state handler.\n *\n * @memberof EditVeTool\n * @instance\n */\nEditVeTool.prototype.onUpdateState = function () {\n\t// do nothing\n};\n\n/**\n * Base class for SourceEditorOverlay and VisualEditorOverlay\n *\n * @class EditorOverlayBase\n * @extends Overlay\n * @uses Icon\n * @uses user\n * @param {Object} params Configuration options\n * @param {number|null} params.editCount of user\n * @param {boolean} params.editSwitcher whether possible to switch mode in header\n * @param {boolean} params.hasToolbar whether the editor has a toolbar\n */\nfunction EditorOverlayBase( params ) {\n\tvar\n\t\toptions = util.extend(\n\t\t\ttrue,\n\t\t\t{\n\t\t\t\tonBeforeExit: this.onBeforeExit.bind( this ),\n\t\t\t\tclassName: 'overlay editor-overlay',\n\t\t\t\tisBorderBox: false\n\t\t\t},\n\t\t\tparams,\n\t\t\t{\n\t\t\t\tevents: util.extend(\n\t\t\t\t\t{\n\t\t\t\t\t\t'click .back': 'onClickBack',\n\t\t\t\t\t\t'click .continue': 'onClickContinue',\n\t\t\t\t\t\t'click .submit': 'onClickSubmit',\n\t\t\t\t\t\t'click .anonymous': 'onClickAnonymous'\n\t\t\t\t\t},\n\t\t\t\t\tparams.events\n\t\t\t\t)\n\t\t\t}\n\t\t);\n\n\tif ( options.isNewPage ) {\n\t\toptions.placeholder = mw.msg( 'mobile-frontend-editor-placeholder-new-page', mwUser );\n\t}\n\t// change the message to request a summary when not in article namespace\n\tif ( mw.config.get( 'wgNamespaceNumber' ) !== 0 ) {\n\t\toptions.summaryRequestMsg = mw.msg( 'mobile-frontend-editor-summary' );\n\t}\n\tthis.pageGateway = new PageGateway( options.api );\n\tthis.editCount = options.editCount;\n\tthis.isNewPage = options.isNewPage;\n\tthis.isNewEditor = options.editCount === 0;\n\tthis.sectionId = options.sectionId;\n\tthis.sessionId = options.sessionId;\n\tthis.overlayManager = options.overlayManager;\n\n\tOverlay.call( this, options );\n}\n\nmfExtend( EditorOverlayBase, Overlay, {\n\t/**\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @mixes Overlay#defaults\n\t * @property {Object} defaults Default options hash.\n\t * @property {OverlayManager} defaults.overlayManager instance\n\t * @property {mw.Api} defaults.api to interact with\n\t * @property {boolean} defaults.hasToolbar Whether the editor has a toolbar or not. When\n\t *  disabled a header will be show instead.\n\t * @property {string} defaults.continueMsg Caption for the next button on edit form\n\t * which takes you to the screen that shows a preview and license information.\n\t * @property {string} defaults.closeMsg Caption for a button that takes you back to editing\n\t * from edit preview screen.\n\t * @property {string} defaults.summaryRequestMsg Header above edit summary input field\n\t * asking the user to summarize the changes they made to the page.\n\t * @property {string} defaults.summaryMsg A placeholder with examples for the summary input\n\t * field asking user what they changed.\n\t * @property {string} defaults.placeholder Placeholder text for empty sections.\n\t * @property {string} defaults.captchaMsg Placeholder for captcha input field.\n\t * @property {string} defaults.captchaTryAgainMsg A message shown when user enters\n\t * wrong CAPTCHA and a new one is displayed.\n\t * @property {string} defaults.switchMsg Label for button that allows the user\n\t * to switch between two different editing interfaces.\n\t * @property {string} defaults.licenseMsg Text and link of the license,\n\t * under which this contribution will be released to inform the user.\n\t */\n\tdefaults: util.extend( {}, Overlay.prototype.defaults, {\n\t\thasToolbar: false,\n\t\tcontinueMsg: mw.msg( 'mobile-frontend-editor-continue' ),\n\t\tcloseMsg: mw.msg( 'mobile-frontend-editor-keep-editing' ),\n\t\tsummaryRequestMsg: mw.msg( 'mobile-frontend-editor-summary-request' ),\n\t\tsummaryMsg: mw.msg( 'mobile-frontend-editor-summary-placeholder' ),\n\t\tplaceholder: mw.msg( 'mobile-frontend-editor-placeholder' ),\n\t\tcaptchaMsg: mw.msg( 'mobile-frontend-account-create-captcha-placeholder' ),\n\t\tcaptchaTryAgainMsg: mw.msg( 'mobile-frontend-editor-captcha-try-again' ),\n\t\tswitchMsg: mw.msg( 'mobile-frontend-editor-switch-editor' ),\n\t\tconfirmMsg: mw.msg( 'mobile-frontend-editor-cancel-confirm' ),\n\t\tlicenseMsg: undefined\n\t} ),\n\t/**\n\t * @inheritdoc\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\ttemplate: util.template( `\n<div class=\"overlay-header-container header-container position-fixed\"></div>\n\n<div class=\"overlay-content\">\n\t<div class=\"panels\">\n\t\t<div class=\"save-panel panel hideable hidden\">\n\t\t\t<div id=\"error-notice-container\"></div>\n\t\t\t<h2 class=\"summary-request\">{{{summaryRequestMsg}}}</h2>\n\t\t\t<textarea rows=\"2\" class=\"mw-ui-input summary\" placeholder=\"{{summaryMsg}}\"></textarea>\n\t\t\t{{#licenseMsg}}<div class=\"license\">{{{licenseMsg}}}</div>{{/licenseMsg}}\n\t\t</div>\n\t\t<div class=\"captcha-panel panel hideable hidden\">\n\t\t\t<div class=\"captcha-box\">\n\t\t\t\t<img id=\"image\" src=\"\">\n\t\t\t\t<div id=\"question\"></div>\n\t\t\t\t<input class=\"captcha-word mw-ui-input\" placeholder=\"{{captchaMsg}}\" />\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t{{>content}}\n</div>\n<div class=\"overlay-footer-container position-fixed\">\n\t{{>footer}}\n</div>\n\t` ),\n\t/**\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\tsectionId: '',\n\t/**\n\t * Logs an event to http://meta.wikimedia.org/wiki/Schema:EditAttemptStep\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @param {Object} data\n\t */\n\tlog: function ( data ) {\n\t\tmw.track( 'mf.schemaEditAttemptStep', util.extend( data, {\n\t\t\t// eslint-disable-next-line camelcase\n\t\t\teditor_interface: this.editor,\n\t\t\t// eslint-disable-next-line camelcase\n\t\t\tediting_session_id: this.sessionId\n\t\t} ) );\n\t},\n\t/**\n\t * Logs an event to http://meta.wikimedia.org/wiki/Schema:VisualEditorFeatureUse\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @param {Object} data\n\t */\n\tlogFeatureUse: function ( data ) {\n\t\tmw.track( 'mf.schemaVisualEditorFeatureUse', util.extend( data, {\n\t\t\t// eslint-disable-next-line camelcase\n\t\t\teditor_interface: this.editor,\n\t\t\t// eslint-disable-next-line camelcase\n\t\t\tediting_session_id: this.sessionId\n\t\t} ) );\n\t},\n\n\t/**\n\t * If this is a new article, require confirmation before saving.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @return {boolean} The user confirmed saving\n\t */\n\tconfirmSave: function () {\n\t\tif ( this.isNewPage &&\n\t\t\t// TODO: Replace with an OOUI dialog\n\t\t\t// eslint-disable-next-line no-alert\n\t\t\t!window.confirm( mw.msg( 'mobile-frontend-editor-new-page-confirm', mwUser ) )\n\t\t) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t},\n\t/**\n\t * Executed when page save is complete. Updates urls and shows toast message.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @param {number|null} newRevId ID of the newly created revision, or null if it was a null\n\t *  edit.\n\t */\n\tonSaveComplete: function ( newRevId ) {\n\t\tvar msg,\n\t\t\ttitle = this.options.title,\n\t\t\tself = this;\n\n\t\tthis.saved = true;\n\n\t\t// FIXME: use generic method for following 3 lines\n\t\tthis.pageGateway.invalidatePage( title );\n\n\t\tif ( this.isNewPage ) {\n\t\t\tmsg = mw.msg( 'mobile-frontend-editor-success-new-page' );\n\t\t} else if ( this.isNewEditor ) {\n\t\t\tmsg = mw.msg( 'mobile-frontend-editor-success-landmark-1' );\n\t\t} else {\n\t\t\tmsg = mw.msg( 'mobile-frontend-editor-success' );\n\t\t}\n\n\t\tif ( !mw.config.get( 'wgPostEditConfirmationDisabled' ) ) {\n\t\t\tthis.showSaveCompleteMsg( msg );\n\t\t}\n\n\t\t/**\n\t\t * Fired after an edit was successfully saved, like postEdit in MediaWiki core.\n\t\t *\n\t\t * @event postEditMobile\n\t\t * @member mw.hook\n\t\t * @param {Object} data\n\t\t * @param {number|null} data.newRevId (since MW 1.37) ID of the newly created revision,\n\t\t *  or null if it was a null edit.\n\t\t */\n\t\tmw.hook( 'postEditMobile' ).fire( { newRevId: newRevId } );\n\n\t\t// Ensure we don't lose this event when logging\n\t\tthis.log( {\n\t\t\taction: 'saveSuccess',\n\t\t\t// eslint-disable-next-line camelcase\n\t\t\trevision_id: newRevId\n\t\t} );\n\t\tsetTimeout( function () {\n\t\t\t// Wait for any other teardown navigation to happen (e.g. router.back())\n\t\t\t// before setting our final location.\n\t\t\tif ( self.sectionId ) {\n\t\t\t\t// Ideally we'd want to do this via replaceState (see T189173)\n\t\t\t\t// eslint-disable-next-line no-restricted-properties\n\t\t\t\twindow.location.hash = '#' + self.sectionId;\n\t\t\t} else {\n\t\t\t\t// Cancel the hash fragment\n\t\t\t\t// otherwise clicking back after a save will take you back to the editor.\n\t\t\t\t// We avoid calling the hide method of the overlay here as this can be asynchronous\n\t\t\t\t// and may conflict with the window.reload call below.\n\t\t\t\t// eslint-disable-next-line no-restricted-properties\n\t\t\t\twindow.location.hash = '#';\n\t\t\t}\n\t\t} );\n\t},\n\t/**\n\t * Show a save-complete message to the user\n\t *\n\t * @inheritdoc\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t * @param {string} msg Message\n\t */\n\tshowSaveCompleteMsg: function ( msg ) {\n\t\tmw.notify( msg, { type: 'success' } );\n\t},\n\t/**\n\t * Executed when page save fails. Handles logging the error. Subclasses\n\t * should display error messages as appropriate.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @param {Object} data API response\n\t */\n\tonSaveFailure: function ( data ) {\n\t\tvar code = data && data.errors && data.errors[0] && data.errors[0].code,\n\t\t\t// Compare to ve.init.mw.ArticleTargetEvents.js in VisualEditor.\n\t\t\ttypeMap = {\n\t\t\t\tbadtoken: 'userBadToken',\n\t\t\t\tassertanonfailed: 'userNewUser',\n\t\t\t\tassertuserfailed: 'userNewUser',\n\t\t\t\tassertnameduserfailed: 'userNewUser',\n\t\t\t\t'abusefilter-disallowed': 'extensionAbuseFilter',\n\t\t\t\t'abusefilter-warning': 'extensionAbuseFilter',\n\t\t\t\tcaptcha: 'extensionCaptcha',\n\t\t\t\t// FIXME: This language is non-inclusive and we would love to change it,\n\t\t\t\t// but this relates to an error code provided by software.\n\t\t\t\t// This is blocked on T254649\n\t\t\t\tspamblacklist: 'extensionSpamBlacklist',\n\t\t\t\t// FIXME: This language is non-inclusive and we would love to change it,\n\t\t\t\t// but this relates to an error code provided by software.\n\t\t\t\t// Removal of this line is blocked on T254650.\n\t\t\t\t'titleblacklist-forbidden': 'extensionTitleBlacklist',\n\t\t\t\tpagedeleted: 'editPageDeleted',\n\t\t\t\teditconflict: 'editConflict'\n\t\t\t};\n\n\t\tif ( data.edit && data.edit.captcha ) {\n\t\t\tcode = 'captcha';\n\t\t}\n\n\t\tthis.log( {\n\t\t\taction: 'saveFailure',\n\t\t\tmessage: code,\n\t\t\ttype: typeMap[code] || 'responseUnknown'\n\t\t} );\n\t},\n\t/**\n\t * Report load errors back to the user. Silently record the error using EventLogging.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @param {string} text Text (HTML) of message to display to user\n\t */\n\treportError: function ( text ) {\n\t\tvar errorNotice = new MessageBox( {\n\t\t\tclassName: 'mw-message-box-error',\n\t\t\tmsg: text,\n\t\t\theading: mw.msg( 'mobile-frontend-editor-error' )\n\t\t} );\n\t\tthis.$errorNoticeContainer.html( errorNotice.$el );\n\t},\n\thideErrorNotice: function () {\n\t\tthis.$errorNoticeContainer.empty();\n\t},\n\t/**\n\t * Prepares the penultimate screen before saving.\n\t * Expects to be overridden by child class.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\tonStageChanges: function () {\n\t\tthis.showHidden( '.save-header, .save-panel' );\n\t\tthis.hideErrorNotice();\n\t\tthis.log( {\n\t\t\taction: 'saveIntent'\n\t\t} );\n\t\t// Scroll to the top of the page, so that the summary input is visible\n\t\t// (even if overlay was scrolled down when editing) and weird iOS header\n\t\t// problems are avoided (header position not updating to the top of the\n\t\t// screen, instead staying lower until a subsequent scroll event).\n\t\twindow.scrollTo( 0, 1 );\n\t},\n\t/**\n\t * Executed when the editor clicks the save button. Expects to be overridden by child\n\t * class. Checks if the save needs to be confirmed.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\tonSaveBegin: function () {\n\t\tthis.confirmAborted = false;\n\t\tthis.hideErrorNotice();\n\t\t// Ask for confirmation in some cases\n\t\tif ( !this.confirmSave() ) {\n\t\t\tthis.confirmAborted = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.log( {\n\t\t\taction: 'saveAttempt'\n\t\t} );\n\t},\n\t/**\n\t * @inheritdoc\n\t */\n\tpreRender: function () {\n\t\tconst options = this.options;\n\n\t\tthis.options.headers = [\n\t\t\theaders.formHeader(\n\t\t\t\tutil.template( `\n{{^hasToolbar}}\n<div class=\"overlay-title\">\n\t<h2>{{{editingMsg}}}</h2>\n</div>\n{{/hasToolbar}}\n{{#hasToolbar}}<div class=\"toolbar\"></div>{{/hasToolbar}}\n{{#editSwitcher}}\n\t<div class=\"switcher-container\">\n\t</div>\n{{/editSwitcher}}\n\t\t\t\t` ).render( {\n\t\t\t\t\thasToolbar: options.hasToolbar,\n\t\t\t\t\teditSwitcher: options.editSwitcher,\n\t\t\t\t\teditingMsg: options.editingMsg\n\t\t\t\t} ),\n\t\t\t\toptions.readOnly ? [] : [\n\t\t\t\t\tnew Icon( {\n\t\t\t\t\t\ttagName: 'button',\n\t\t\t\t\t\tname: 'next-invert',\n\t\t\t\t\t\tadditionalClassNames: 'continue',\n\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\ttitle: options.continueMsg\n\t\t\t\t\t} )\n\t\t\t\t],\n\t\t\t\ticons.cancel(),\n\t\t\t\t'initial-header'\n\t\t\t),\n\t\t\theaders.saveHeader( options.previewingMsg, 'save-header hidden' ),\n\t\t\theaders.savingHeader( mw.msg( 'mobile-frontend-editor-wait' ) )\n\t\t];\n\t},\n\t/**\n\t * @inheritdoc\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\tpostRender: function () {\n\t\tthis.$errorNoticeContainer = this.$el.find( '#error-notice-container' );\n\n\t\tOverlay.prototype.postRender.apply( this );\n\n\t\tthis.showHidden( '.initial-header' );\n\t},\n\tshow: function () {\n\t\tvar self = this;\n\t\tthis.allowCloseWindow = mw.confirmCloseWindow( {\n\t\t\t// Returns true if content has changed\n\t\t\ttest: function () {\n\t\t\t\t// Check if content has changed\n\t\t\t\treturn self.hasChanged();\n\t\t\t},\n\n\t\t\t// Message to show the user, if content has changed\n\t\t\tmessage: mw.msg( 'mobile-frontend-editor-cancel-confirm' ),\n\t\t\t// Event namespace\n\t\t\tnamespace: 'editwarning'\n\t\t} );\n\n\t\tthis.saved = false;\n\t\tOverlay.prototype.show.call( this );\n\n\t\t// Inform other interested code that the editor has loaded\n\t\tmw.hook( 'mobileFrontend.editorOpened' ).fire( this.editor );\n\t},\n\t/**\n\t * Back button click handler\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\tonClickBack: function () {},\n\t/**\n\t * Submit button click handler\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\tonClickSubmit: function () {\n\t\tthis.onSaveBegin();\n\t},\n\t/**\n\t * Continue button click handler\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\tonClickContinue: function () {\n\t\tthis.onStageChanges();\n\t},\n\t/**\n\t * \"Edit without logging in\" button click handler\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\tonClickAnonymous: function () {},\n\t/**\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @param {Function} exit Callback to exit the overlay\n\t * @param {Function} cancel Callback to cancel exiting the overlay\n\t */\n\tonBeforeExit: function ( exit, cancel ) {\n\t\tvar self = this;\n\t\tif ( this.hasChanged() && !this.switching ) {\n\t\t\tif ( !this.windowManager ) {\n\t\t\t\tthis.windowManager = OO.ui.getWindowManager();\n\t\t\t\tthis.windowManager.addWindows( [ new mw.widgets.AbandonEditDialog() ] );\n\t\t\t}\n\t\t\tthis.windowManager.openWindow( 'abandonedit' )\n\t\t\t\t.closed.then( function ( data ) {\n\t\t\t\t\tif ( data && data.action === 'discard' ) {\n\t\t\t\t\t\t// log abandonment\n\t\t\t\t\t\tself.log( {\n\t\t\t\t\t\t\taction: 'abort',\n\t\t\t\t\t\t\tmechanism: 'cancel',\n\t\t\t\t\t\t\ttype: 'abandon'\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tself.onExit();\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\tcancel();\n\t\t\treturn;\n\t\t}\n\t\tif ( !this.switching && !this.saved ) {\n\t\t\t// log leaving without changes\n\t\t\tthis.log( {\n\t\t\t\taction: 'abort',\n\t\t\t\tmechanism: 'cancel',\n\t\t\t\t// if this is VE, hasChanged will be false because the Surface has\n\t\t\t\t// already been destroyed (which is good because it stops us\n\t\t\t\t// double-showing the abandon changes dialog above)... but we can\n\t\t\t\t// test whether there *were* changes for logging purposes by\n\t\t\t\t// examining the target:\n\t\t\t\ttype: ( this.target && this.target.edited ) ? 'abandon' : 'nochange'\n\t\t\t} );\n\t\t}\n\t\tthis.onExit();\n\t\texit();\n\t},\n\tonExit: function () {\n\t\t// May not be set if overlay has not been previously shown\n\t\tif ( this.allowCloseWindow ) {\n\t\t\tthis.allowCloseWindow.release();\n\t\t}\n\t\tmw.hook( 'mobileFrontend.editorClosed' ).fire();\n\t},\n\t/**\n\t * Sets additional values used for anonymous editing warning.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @param {Object} options\n\t * @return {jQuery.Element}\n\t */\n\tcreateAnonWarning: function ( options ) {\n\t\tvar $actions = $( '<div>' ).addClass( 'actions' ),\n\t\t\t$anonWarning = $( '<div>' ).addClass( 'anonwarning content' ).append(\n\t\t\t\tnew MessageBox( {\n\t\t\t\t\tclassName: 'mw-message-box-notice anon-msg',\n\t\t\t\t\tmsg: mw.msg( 'mobile-frontend-editor-anonwarning' )\n\t\t\t\t} ).$el,\n\t\t\t\t$actions\n\t\t\t),\n\t\t\tparams = util.extend( {\n\t\t\t\treturnto: options.returnTo || (\n\t\t\t\t\t// use wgPageName as this includes the namespace if outside Main\n\t\t\t\t\tmw.config.get( 'wgPageName' ) + '#/editor/' + ( options.sectionId || 'all' )\n\t\t\t\t),\n\t\t\t\twarning: 'mobile-frontend-edit-login-action'\n\t\t\t}, options.queryParams ),\n\t\t\tsignupParams = util.extend( {\n\t\t\t\ttype: 'signup',\n\t\t\t\twarning: 'mobile-frontend-edit-signup-action'\n\t\t\t}, options.signupQueryParams ),\n\t\t\tanonymousEditorActions = [\n\t\t\t\tnew Button( {\n\t\t\t\t\tlabel: mw.msg( 'mobile-frontend-editor-anon' ),\n\t\t\t\t\tblock: true,\n\t\t\t\t\tadditionalClassNames: 'anonymous progressive',\n\t\t\t\t\tprogressive: true\n\t\t\t\t} ),\n\t\t\t\tnew Button( {\n\t\t\t\t\tblock: true,\n\t\t\t\t\thref: mw.util.getUrl( 'Special:UserLogin', params ),\n\t\t\t\t\tlabel: mw.msg( 'mobile-frontend-watchlist-cta-button-login' )\n\t\t\t\t} ),\n\t\t\t\tnew Button( {\n\t\t\t\t\tblock: true,\n\t\t\t\t\thref: mw.util.getUrl( 'Special:UserLogin', util.extend( params, signupParams ) ),\n\t\t\t\t\tlabel: mw.msg( 'mobile-frontend-watchlist-cta-button-signup' )\n\t\t\t\t} )\n\t\t\t];\n\n\t\t$actions.append(\n\t\t\tanonymousEditorActions.map( function ( action ) {\n\t\t\t\treturn action.$el;\n\t\t\t} )\n\t\t);\n\n\t\treturn $anonWarning;\n\t},\n\t/**\n\t * Creates and returns a copy of the anon talk message warning\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @return {jQuery.Element}\n\t */\n\tcreateAnonTalkWarning: function () {\n\t\treturn $( '.minerva-anon-talk-message' ).clone();\n\t},\n\t/**\n\t * Get an options object not containing any defaults or editor\n\t * specific options, so that it can be used to construct a\n\t * different editor for switching.\n\t *\n\t * @return {Object} Options\n\t */\n\tgetOptionsForSwitch: function () {\n\t\t// Only preserve options that would be passed in editor.js#setupEditor\n\t\t// and skip over defaults.\n\t\treturn {\n\t\t\tswitched: true,\n\t\t\toverlayManager: this.options.overlayManager,\n\t\t\tcurrentPageHTMLParser: this.options.currentPageHTMLParser,\n\t\t\tfakeScroll: this.options.fakeScroll,\n\t\t\tapi: this.options.api,\n\t\t\tlicenseMsg: this.options.licenseMsg,\n\t\t\ttitle: this.options.title,\n\t\t\ttitleObj: this.options.titleObj,\n\t\t\tisAnon: this.options.isAnon,\n\t\t\tisNewPage: this.options.isNewPage,\n\t\t\teditCount: this.options.editCount,\n\t\t\toldId: this.options.oldId,\n\t\t\tcontentLang: this.options.contentLang,\n\t\t\tcontentDir: this.options.contentDir,\n\t\t\tsessionId: this.options.sessionId,\n\t\t\tsectionId: this.options.sectionId\n\t\t};\n\t},\n\n\t/**\n\t * Checks whether the state of the thing being edited as changed. Expects to be\n\t * implemented by child class.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t */\n\thasChanged: function () {},\n\t/**\n\t * Get a promise that is resolved when the editor data has loaded,\n\t * or rejected when we're refusing to load the editor because the user is blocked.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @return {jQuery.Promise}\n\t */\n\tgetLoadingPromise: function () {\n\t\treturn this.dataPromise.then( function ( result ) {\n\t\t\t// check if user is blocked\n\t\t\tif ( result && result.blockinfo ) {\n\t\t\t\tvar block = parseBlockInfo( result.blockinfo ),\n\t\t\t\t\tmessage = blockMessageDrawer( block );\n\t\t\t\treturn util.Deferred().reject( message );\n\t\t\t}\n\t\t\treturn result;\n\t\t} );\n\t},\n\t/**\n\t * Handles a failed save due to a CAPTCHA provided by ConfirmEdit extension.\n\t *\n\t * @memberof EditorOverlayBase\n\t * @instance\n\t * @param {Object} details Details returned from the api.\n\t */\n\thandleCaptcha: function ( details ) {\n\t\tvar self = this,\n\t\t\t$input = this.$el.find( '.captcha-word' );\n\n\t\tif ( this.captchaShown ) {\n\t\t\t$input.val( '' );\n\t\t\t$input.attr( 'placeholder', this.options.captchaTryAgainMsg );\n\t\t\tsetTimeout( function () {\n\t\t\t\t$input.attr( 'placeholder', self.options.captchaMsg );\n\t\t\t}, 2000 );\n\t\t}\n\n\t\t// handle different mime types different\n\t\tif ( details.mime.indexOf( 'image/' ) === 0 ) {\n\t\t\t// image based CAPTCHA's like provided by FancyCaptcha, ReCaptcha or similar\n\t\t\tthis.$el.find( '.captcha-panel#question' ).detach();\n\t\t\tthis.$el.find( '.captcha-panel img' ).attr( 'src', details.url );\n\t\t} else {\n\t\t\t// not image based CAPTCHA.\n\t\t\tthis.$el.find( '.captcha-panel #image' ).detach();\n\t\t\tif ( details.mime.indexOf( 'text/html' ) === 0 ) {\n\t\t\t\t// handle mime type of HTML as HTML content (display as-is).\n\t\t\t\t// QuestyCaptcha now have default MIME type \"text/html\": see T147606\n\t\t\t\tthis.$el.find( '.captcha-panel #question' ).html( details.question );\n\t\t\t} else {\n\t\t\t\t// handle mime types\n\t\t\t\t// (other than image based ones and HTML based ones)\n\t\t\t\t// as plain text by default.\n\t\t\t\t// e.g. MathCaptcha (solve a math formula) or\n\t\t\t\t// SimpleCaptcha (simple math formula)\n\t\t\t\tthis.$el.find( '.captcha-panel #question' ).text( details.question );\n\t\t\t}\n\t\t}\n\n\t\tthis.showHidden( '.save-header, .captcha-panel' );\n\t\tthis.captchaShown = true;\n\t}\n} );\n\nmodule.exports = EditorOverlayBase;\n","var EditorOverlayBase = require( './EditorOverlayBase' ),\n\tutil = require( '../mobile.startup/util' ),\n\ticons = require( '../mobile.startup/icons' ),\n\tSection = require( '../mobile.startup/Section' ),\n\tsaveFailureMessage = require( './saveFailureMessage' ),\n\tEditorGateway = require( './EditorGateway' ),\n\tfakeToolbar = require( '../mobile.init/fakeToolbar' ),\n\tmfExtend = require( '../mobile.startup/mfExtend' ),\n\ttoast = require( '../mobile.startup/showOnPageReload' ),\n\tsetPreferredEditor = require( './setPreferredEditor' ),\n\tVisualEditorOverlay = require( './VisualEditorOverlay' );\n\n/**\n * Overlay that shows an editor\n *\n * @class SourceEditorOverlay\n * @uses Section\n * @uses EditorGateway\n * @uses VisualEditorOverlay\n * @extends EditorOverlayBase\n *\n * @param {Object} options Configuration options\n * @param {Object} [options.visualEditorConfig] falls back to wgVisualEditorConfig if not defined\n * @param {jQuery.Promise} [dataPromise] Optional promise for loading content\n */\nfunction SourceEditorOverlay( options, dataPromise ) {\n\tthis.isFirefox = /firefox/i.test( window.navigator.userAgent );\n\tthis.visualEditorConfig = options.visualEditorConfig ||\n\t\tmw.config.get( 'wgVisualEditorConfig' ) || {};\n\tthis.gateway = new EditorGateway( {\n\t\tapi: options.api,\n\t\ttitle: options.title,\n\t\tsectionId: options.sectionId,\n\t\toldId: options.oldId,\n\t\tisNewPage: options.isNewPage,\n\t\tfromModified: !!dataPromise\n\t} );\n\tthis.readOnly = !!options.oldId; // If old revision, readOnly mode\n\tthis.dataPromise = dataPromise || this.gateway.getContent();\n\tif ( this.isVisualEditorEnabled() ) {\n\t\toptions.editSwitcher = true;\n\t}\n\tif ( this.readOnly ) {\n\t\toptions.readOnly = true;\n\t\toptions.editingMsg = mw.msg( 'mobile-frontend-editor-viewing-source-page', options.title );\n\t} else {\n\t\toptions.editingMsg = mw.msg( 'mobile-frontend-editor-editing-page', options.title );\n\t}\n\toptions.previewingMsg = mw.msg( 'mobile-frontend-editor-previewing-page', options.title );\n\tEditorOverlayBase.call(\n\t\tthis,\n\t\tutil.extend( true,\n\t\t\t{ events: { 'input .wikitext-editor': 'onInputWikitextEditor' } },\n\t\t\toptions\n\t\t)\n\t);\n}\n\nmfExtend( SourceEditorOverlay, EditorOverlayBase, {\n\t/**\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\ttemplatePartials: util.extend( {}, EditorOverlayBase.prototype.templatePartials, {\n\t\tcontent: util.template( `\n<div lang=\"{{contentLang}}\" dir=\"{{contentDir}}\" class=\"editor-container content\">\n\t<textarea class=\"wikitext-editor\" id=\"wikitext-editor\" cols=\"40\" rows=\"10\" placeholder=\"{{placeholder}}\"></textarea>\n\t<div class=\"preview\"></div>\n</div>\n\t\t` )\n\t} ),\n\t/**\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\teditor: 'wikitext',\n\t/**\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tsectionLine: '',\n\n\t/**\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tshow: function () {\n\t\tEditorOverlayBase.prototype.show.apply( this, arguments );\n\t\t// Ensure we do this after showing the overlay, otherwise it doesn't work.\n\t\tthis._resizeEditor();\n\t},\n\t/**\n\t * Check whether VisualEditor is enabled or not.\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @return {boolean}\n\t */\n\tisVisualEditorEnabled: function () {\n\t\tvar config = this.visualEditorConfig,\n\t\t\tns = config.namespaces;\n\n\t\treturn ns &&\n\t\t\tns.indexOf(\n\t\t\t\tmw.config.get( 'wgNamespaceNumber' )\n\t\t\t) > -1 &&\n\t\t\tmw.config.get( 'wgTranslatePageTranslation' ) !== 'translation' &&\n\t\t\tmw.config.get( 'wgPageContentModel' ) === 'wikitext';\n\t},\n\t/**\n\t * Wikitext Editor input handler\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tonInputWikitextEditor: function () {\n\t\tthis.gateway.setContent( this.$el.find( '.wikitext-editor' ).val() );\n\t\tthis.$el.find( '.continue, .submit' ).prop( 'disabled', false );\n\t},\n\t/**\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tonClickBack: function () {\n\t\tEditorOverlayBase.prototype.onClickBack.apply( this, arguments );\n\t\tthis._hidePreview();\n\t},\n\t/**\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tpostRender: function () {\n\t\tvar self = this,\n\t\t\tconfig = this.visualEditorConfig,\n\t\t\toptions = this.options,\n\t\t\tshowAnonWarning = options.isAnon && !options.switched;\n\n\t\t// log edit attempt\n\t\tthis.log( { action: 'ready' } );\n\t\tthis.log( { action: 'loaded' } );\n\n\t\tif ( this.isVisualEditorEnabled() ) {\n\t\t\tmw.loader.using( 'ext.visualEditor.switching' ).then( function () {\n\t\t\t\tvar switchToolbar, windowManager, switchWindow,\n\t\t\t\t\ttoolFactory = new OO.ui.ToolFactory(),\n\t\t\t\t\ttoolGroupFactory = new OO.ui.ToolGroupFactory();\n\n\t\t\t\ttoolFactory.register( mw.libs.ve.MWEditModeVisualTool );\n\t\t\t\ttoolFactory.register( mw.libs.ve.MWEditModeSourceTool );\n\t\t\t\tswitchToolbar = new OO.ui.Toolbar( toolFactory, toolGroupFactory, {\n\t\t\t\t\tclasses: [ 'editor-switcher' ]\n\t\t\t\t} );\n\n\t\t\t\tswitchToolbar.on( 'switchEditor', function ( mode ) {\n\t\t\t\t\t// NOTE: Should be just config.allowSwitchingToVisualMode, but we need to\n\t\t\t\t\t// preserve compatibility for a bit.\n\t\t\t\t\tvar canSwitch = config.allowSwitchingToVisualMode ||\n\t\t\t\t\t\tconfig.fullRestbaseUrl ||\n\t\t\t\t\t\tconfig.allowLossySwitching;\n\n\t\t\t\t\tif ( mode === 'visual' ) {\n\t\t\t\t\t\tif ( !self.gateway.hasChanged ) {\n\t\t\t\t\t\t\tself._switchToVisualEditor();\n\t\t\t\t\t\t} else if ( canSwitch ) {\n\t\t\t\t\t\t\t// Pass wikitext if there are changes.\n\t\t\t\t\t\t\tself._switchToVisualEditor( self.gateway.content );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twindowManager = new OO.ui.WindowManager();\n\t\t\t\t\t\t\tswitchWindow = new mw.libs.ve.SwitchConfirmDialog();\n\t\t\t\t\t\t\twindowManager.$element.appendTo( document.body );\n\t\t\t\t\t\t\twindowManager.addWindows( [ switchWindow ] );\n\t\t\t\t\t\t\twindowManager.openWindow( switchWindow, { mode: 'simple' } )\n\t\t\t\t\t\t\t\t.closed.then( function ( data ) {\n\t\t\t\t\t\t\t\t\tif ( data && data.action === 'discard' ) {\n\t\t\t\t\t\t\t\t\t\tself._switchToVisualEditor();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\twindowManager.destroy();\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tswitchToolbar.setup( [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'editMode',\n\t\t\t\t\t\ttype: 'list',\n\t\t\t\t\t\ticon: 'edit',\n\t\t\t\t\t\ttitle: mw.msg( 'visualeditor-mweditmode-tooltip' ),\n\t\t\t\t\t\tinclude: [ 'editModeVisual', 'editModeSource' ]\n\t\t\t\t\t}\n\t\t\t\t] );\n\n\t\t\t\tself.$el.find( '.switcher-container' ).html( switchToolbar.$element );\n\t\t\t\tswitchToolbar.emit( 'updateState' );\n\t\t\t} );\n\t\t}\n\n\t\tEditorOverlayBase.prototype.postRender.apply( this );\n\n\t\t// This spinner is still used when displaying save/preview panel\n\t\tthis.$el.find( '.overlay-content' ).append( icons.spinner().$el );\n\t\tthis.hideSpinner();\n\n\t\tthis.$preview = this.$el.find( '.preview' );\n\t\tthis.$content = this.$el.find( '.wikitext-editor' );\n\t\t// The following classes can be used here:\n\t\t// * mw-editfont-monospace\n\t\t// * mw-editfont-sans-serif\n\t\t// * mw-editfont-serif\n\t\tthis.$content.addClass( 'mw-editfont-' + mw.user.options.get( 'editfont' ) );\n\t\tif ( showAnonWarning ) {\n\t\t\tthis.$anonWarning = this.createAnonWarning( options );\n\t\t\tthis.$anonTalkWarning = this.createAnonTalkWarning();\n\t\t\tthis.$el.find( '.editor-container' ).append( [ this.$anonTalkWarning, this.$anonWarning ] );\n\t\t\tthis.$content.hide();\n\t\t\t// the user has to click login, signup or edit without login,\n\t\t\t// disable \"Next\" button on top right\n\t\t\tthis.$anonHiddenButtons = this.$el.find( '.overlay-header .continue, .editor-switcher' ).hide();\n\t\t}\n\t\t// make license links open in separate tabs\n\t\tthis.$el.find( '.license a' ).attr( 'target', '_blank' );\n\n\t\t// If in readOnly mode, make textarea readonly\n\t\tif ( this.readOnly ) {\n\t\t\tthis.$content.prop( 'readonly', true );\n\t\t}\n\n\t\tthis.$content\n\t\t\t.on( 'input', this._resizeEditor.bind( this ) )\n\t\t\t.one( 'input', function () {\n\t\t\t\tself.log( { action: 'firstChange' } );\n\t\t\t} );\n\n\t\tif ( this.isFirefox ) {\n\t\t\tthis.$content.on( 'mousedown', function () {\n\t\t\t\t// Support: Firefox Mobile\n\t\t\t\t// Firefox scrolls back to the top of the page *every time*\n\t\t\t\t// you tap on the textarea. This makes things slightly\n\t\t\t\t// more usable by restoring your scroll offset every time\n\t\t\t\t// the page scrolls for the next 1000ms.\n\t\t\t\t// The page will still flicker every time the user touches\n\t\t\t\t// to place the cursor, but this is better than completely\n\t\t\t\t// losing your scroll offset. (T214880)\n\t\t\t\tvar docEl = document.documentElement,\n\t\t\t\t\tscrollTop = docEl.scrollTop;\n\t\t\t\tfunction blockScroll() {\n\t\t\t\t\tdocEl.scrollTop = scrollTop;\n\t\t\t\t}\n\t\t\t\twindow.addEventListener( 'scroll', blockScroll );\n\t\t\t\tsetTimeout( function () {\n\t\t\t\t\twindow.removeEventListener( 'scroll', blockScroll );\n\t\t\t\t}, 1000 );\n\t\t\t} );\n\t\t}\n\n\t\tif ( !showAnonWarning ) {\n\t\t\tthis._loadContent();\n\t\t}\n\t},\n\n\t/**\n\t * Handles click on \"Edit without login\" in anonymous editing warning.\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @private\n\t */\n\tonClickAnonymous: function () {\n\t\tthis.$anonWarning.hide();\n\t\tthis.$anonTalkWarning.hide();\n\t\t// reenable \"Next\" button\n\t\tthis.$anonHiddenButtons.show();\n\t\tthis._loadContent();\n\t},\n\n\t/**\n\t * Prepares the preview interface and reveals the save screen of the overlay\n\t *\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tonStageChanges: function () {\n\t\tvar self = this,\n\t\t\tparams = {\n\t\t\t\ttext: this.getContent()\n\t\t\t};\n\n\t\tthis.scrollTop = util.getDocument().find( 'body' ).scrollTop();\n\t\tthis.$content.hide();\n\t\tthis.showSpinner();\n\n\t\tif ( mw.config.get( 'wgIsMainPage' ) ) {\n\t\t\tparams.mainpage = 1; // Setting it to 0 will have the same effect\n\t\t}\n\n\t\tfunction hideSpinnerAndShowPreview() {\n\t\t\tself.hideSpinner();\n\t\t\tself.$preview.show();\n\t\t\tmw.hook( 'wikipage.content' ).fire( self.$preview );\n\t\t}\n\n\t\tthis.gateway.getPreview( params ).then( function ( result ) {\n\t\t\tvar parsedText = result.text,\n\t\t\t\tparsedSectionLine = result.line;\n\n\t\t\tself.sectionId = result.id;\n\t\t\t// On desktop edit summaries strip tags. Mimic this behavior on mobile devices\n\t\t\tself.sectionLine = self.parseHTML( '<div>' ).html( parsedSectionLine ).text();\n\t\t\tnew Section( {\n\t\t\t\tel: self.$preview,\n\t\t\t\ttext: parsedText\n\t\t\t} ).$el.find( 'a' ).on( 'click', false );\n\n\t\t\thideSpinnerAndShowPreview();\n\t\t}, function () {\n\t\t\tself.$preview.addClass(\n\t\t\t\t'mw-message-box mw-message-box-error'\n\t\t\t).text( mw.msg( 'mobile-frontend-editor-error-preview' ) );\n\n\t\t\thideSpinnerAndShowPreview();\n\t\t} );\n\n\t\tEditorOverlayBase.prototype.onStageChanges.apply( this, arguments );\n\t},\n\n\t/**\n\t * Hides the preview and reverts back to initial screen.\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @private\n\t */\n\t_hidePreview: function () {\n\t\tthis.gateway.abortPreview();\n\t\tthis.hideSpinner();\n\t\tthis.$preview.removeClass(\n\t\t\t'mw-message-box-error'\n\t\t).hide();\n\t\tthis.$content.show();\n\t\twindow.scrollTo( 0, this.scrollTop );\n\t\tthis.showHidden( '.initial-header' );\n\t},\n\n\t/**\n\t * Resize the editor textarea, maintaining scroll position in iOS\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\t_resizeEditor: function () {\n\t\tvar scrollTop, container, $scrollContainer;\n\n\t\tif ( !this.$scrollContainer ) {\n\t\t\tcontainer = OO.ui.Element.static\n\t\t\t\t.getClosestScrollableContainer( this.$content[ 0 ] );\n\t\t\t// The scroll container will be either within the view\n\t\t\t// or the document element itself.\n\t\t\t$scrollContainer = this.$el.find( container ).length ?\n\t\t\t\tthis.$el.find( container ) : util.getDocument();\n\t\t\tthis.$scrollContainer = $scrollContainer;\n\t\t\tthis.$content.css( 'padding-bottom', this.$scrollContainer.height() * 0.6 );\n\t\t} else {\n\t\t\t$scrollContainer = this.$scrollContainer;\n\t\t}\n\n\t\t// Only do this if scroll container exists\n\t\tif ( this.$content.prop( 'scrollHeight' ) && $scrollContainer.length ) {\n\t\t\tscrollTop = $scrollContainer.scrollTop();\n\t\t\tthis.$content\n\t\t\t\t.css( 'height', 'auto' )\n\t\t\t\t// can't reuse prop( 'scrollHeight' ) because we need the current value\n\t\t\t\t.css( 'height', ( this.$content.prop( 'scrollHeight' ) + 2 ) + 'px' );\n\t\t\t$scrollContainer.scrollTop( scrollTop );\n\t\t}\n\t},\n\n\t/**\n\t * Set content to the user input field.\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @param {string} content The content to set.\n\t */\n\tsetContent: function ( content ) {\n\t\tthis.$content\n\t\t\t.show()\n\t\t\t.val( content );\n\t\tthis._resizeEditor();\n\t},\n\n\t/**\n\t * Returns the content of the user input field.\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @return {string}\n\t */\n\tgetContent: function () {\n\t\treturn this.$content.val();\n\t},\n\n\t/**\n\t * Requests content from the API and reveals it in UI.\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @private\n\t */\n\t_loadContent: function () {\n\t\tvar self = this;\n\n\t\tthis.$content.hide();\n\n\t\tthis.getLoadingPromise()\n\t\t\t.then( function ( result ) {\n\t\t\t\tvar content = result.text;\n\n\t\t\t\tself.setContent( content );\n\n\t\t\t\tif ( self.gateway.fromModified ) {\n\t\t\t\t\t// Trigger intial EditorGateway#setContent and update save button\n\t\t\t\t\tself.onInputWikitextEditor();\n\t\t\t\t}\n\t\t\t} );\n\t},\n\n\t/**\n\t * Loads a {VisualEditorOverlay} and replaces the existing SourceEditorOverlay with it\n\t * based on the current option values.\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @private\n\t * @param {string} [wikitext] Wikitext to pass to VE\n\t */\n\t_switchToVisualEditor: function ( wikitext ) {\n\t\tvar self = this;\n\t\tthis.log( {\n\t\t\taction: 'abort',\n\t\t\ttype: 'switchnochange',\n\t\t\tmechanism: 'navigate'\n\t\t} );\n\t\tthis.logFeatureUse( {\n\t\t\tfeature: 'editor-switch',\n\t\t\taction: 'visual-mobile'\n\t\t} );\n\n\t\t// Save a user setting indicating that this user prefers using the VisualEditor\n\t\tsetPreferredEditor( 'VisualEditor' );\n\n\t\tthis.$el.addClass( 'switching' );\n\t\tthis.$el.find( '.overlay-header-container' ).hide();\n\t\tthis.$el.append( fakeToolbar() );\n\t\tthis.$content.prop( 'readonly', true );\n\n\t\tmw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {\n\t\t\tmw.libs.ve.targetLoader.addPlugin( 'mobile.editor.ve' );\n\t\t\treturn mw.libs.ve.targetLoader.loadModules( 'visual' );\n\t\t} ).then(\n\t\t\tfunction () {\n\t\t\t\tvar newOverlay, options = self.getOptionsForSwitch();\n\t\t\t\toptions.SourceEditorOverlay = SourceEditorOverlay;\n\t\t\t\tif ( wikitext ) {\n\t\t\t\t\toptions.dataPromise = mw.libs.ve.targetLoader.requestPageData( 'visual', mw.config.get( 'wgRelevantPageName' ), {\n\t\t\t\t\t\tsection: options.sectionId,\n\t\t\t\t\t\toldId: options.oldId || mw.config.get( 'wgRevisionId' ),\n\t\t\t\t\t\ttargetName: 'mobile',\n\t\t\t\t\t\tmodified: true,\n\t\t\t\t\t\twikitext: wikitext\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tdelete options.dataPromise;\n\t\t\t\t}\n\t\t\t\tnewOverlay = new VisualEditorOverlay( options );\n\t\t\t\tnewOverlay.getLoadingPromise().then( function () {\n\t\t\t\t\tself.switching = true;\n\t\t\t\t\tself.overlayManager.replaceCurrent( newOverlay );\n\t\t\t\t\tself.switching = false;\n\t\t\t\t} );\n\t\t\t},\n\t\t\tfunction () {\n\t\t\t\tself.$el.removeClass( 'switching' );\n\t\t\t\tself.$el.find( '.overlay-header-container' ).show();\n\t\t\t\tself.$el.find( '.ve-mobile-fakeToolbar-container' ).remove();\n\t\t\t\tself.$content.prop( 'readonly', false );\n\t\t\t\t// FIXME: We should show an error notification, but right now toast\n\t\t\t\t// notifications are not dismissible when shown within the editor.\n\t\t\t}\n\t\t);\n\t},\n\n\t/**\n\t * Executed when the editor clicks the save/publish button. Handles logging and submitting\n\t * the save action to the editor API.\n\t *\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tonSaveBegin: function () {\n\t\tvar self = this,\n\t\t\toptions = {\n\t\t\t\tsummary: this.$el.find( '.summary' ).val()\n\t\t\t};\n\n\t\tif ( self.sectionLine !== '' ) {\n\t\t\toptions.summary = '/* ' + self.sectionLine + ' */' + options.summary;\n\t\t}\n\t\tEditorOverlayBase.prototype.onSaveBegin.apply( this, arguments );\n\t\tif ( this.confirmAborted ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( this.captchaId ) {\n\t\t\toptions.captchaId = this.captchaId;\n\t\t\toptions.captchaWord = this.$el.find( '.captcha-word' ).val();\n\t\t}\n\n\t\tthis.showHidden( '.saving-header' );\n\n\t\tthis.gateway.save( options )\n\t\t\t.then( function ( newRevId ) {\n\t\t\t\tvar title = self.options.title;\n\t\t\t\t// Special case behaviour of main page\n\t\t\t\tif ( mw.config.get( 'wgIsMainPage' ) ) {\n\t\t\t\t\t// FIXME: Blocked on T189173\n\t\t\t\t\t// eslint-disable-next-line no-restricted-properties\n\t\t\t\t\twindow.location = mw.util.getUrl( title );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tself.onSaveComplete( newRevId );\n\t\t\t}, function ( data ) {\n\t\t\t\tself.onSaveFailure( data );\n\t\t\t} );\n\t},\n\n\t/**\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @param {number|null} newRevId ID of the newly created revision, or null if it was a null\n\t *  edit.\n\t */\n\tonSaveComplete: function ( newRevId ) {\n\t\tEditorOverlayBase.prototype.onSaveComplete.apply( this, arguments );\n\n\t\t// The parent class changes the location hash in a setTimeout, so wait\n\t\t// for that to happen before reloading.\n\t\tsetTimeout( function () {\n\t\t\tif ( newRevId ) {\n\t\t\t\t// Set a notify parameter similar to venotify in VisualEditor.\n\t\t\t\tvar uri = new mw.Uri( location.href );\n\t\t\t\turi.query.mfnotify = this.isNewPage ? 'created' : 'saved';\n\t\t\t\t// eslint-disable-next-line no-restricted-properties\n\t\t\t\twindow.location.search = uri.getQueryString();\n\t\t\t} else {\n\t\t\t\t// Null edit; do not add notify parameter.\n\t\t\t\t// Note the \"#\" may be in the URL.\n\t\t\t\t// If so, using window.location alone will not reload the page\n\t\t\t\t// we need to forcefully refresh\n\t\t\t\t// eslint-disable-next-line no-restricted-properties\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t} );\n\t},\n\n\t/**\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tshowSaveCompleteMsg: function ( msg ) {\n\t\ttoast.showOnPageReload( msg, { type: 'success' } );\n\t},\n\n\t/**\n\t * Executed when page save fails. Handles error display and bookkeeping,\n\t * passes logging duties to the parent.\n\t *\n\t * @inheritdoc\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t */\n\tonSaveFailure: function ( data ) {\n\t\tvar msg, noRetry;\n\n\t\tif ( data.edit && data.edit.captcha ) {\n\t\t\tthis.captchaId = data.edit.captcha.id;\n\t\t\tthis.handleCaptcha( data.edit.captcha );\n\t\t} else {\n\t\t\tmsg = saveFailureMessage( data );\n\t\t\tthis.reportError( msg );\n\t\t\tthis.showHidden( '.save-header, .save-panel' );\n\n\t\t\t// Some errors may be temporary, but for others we know for sure that the save will\n\t\t\t// never succeed, so don't confuse the user by giving them the option to retry.\n\t\t\tnoRetry = data.errors && data.errors.some( function ( error ) {\n\t\t\t\treturn error.code === 'abusefilter-disallowed';\n\t\t\t} );\n\n\t\t\tif ( noRetry ) {\n\t\t\t\t// disable continue and save buttons, reenabled when user changes content\n\t\t\t\tthis.$el.find( '.continue, .submit' ).prop( 'disabled', true );\n\t\t\t}\n\t\t}\n\n\t\tEditorOverlayBase.prototype.onSaveFailure.apply( this, arguments );\n\t},\n\n\t/**\n\t * Checks whether the existing content has changed.\n\t *\n\t * @memberof SourceEditorOverlay\n\t * @instance\n\t * @return {boolean}\n\t */\n\thasChanged: function () {\n\t\treturn this.gateway.hasChanged;\n\t}\n} );\n\nmodule.exports = SourceEditorOverlay;\n","/* global ve, $ */\nvar EditorOverlayBase = require( './EditorOverlayBase' ),\n\tEditorGateway = require( './EditorGateway' ),\n\tfakeToolbar = require( '../mobile.init/fakeToolbar' ),\n\tmfExtend = require( '../mobile.startup/mfExtend' ),\n\trouter = mw.loader.require( 'mediawiki.router' ),\n\tidentifyLeadParagraph = require( './identifyLeadParagraph' ),\n\tsetPreferredEditor = require( './setPreferredEditor' ),\n\tutil = require( '../mobile.startup/util' ),\n\tOverlayManager = require( '../mobile.startup/OverlayManager' ),\n\toverlayManager = OverlayManager.getSingleton();\n\n/**\n * Overlay for VisualEditor view\n *\n * @class VisualEditorOverlay\n * @extends EditorOverlayBase\n *\n * @param {Object} options Configuration options\n * @param {SourceEditorOverlay} options.SourceEditorOverlay Class to use for standard\n *  Wikitext editor. It must be passed in explicitly to avoid a cyclic\n *  dependency between VisualEditorOverlay and SourceEditorOverlay\n */\nfunction VisualEditorOverlay( options ) {\n\tvar surfaceReady = util.Deferred();\n\n\tEditorOverlayBase.call( this,\n\t\tutil.extend( {\n\t\t\teditSwitcher: false,\n\t\t\thasToolbar: true,\n\t\t\tonBeforeExit: this.onBeforeExit.bind( this ),\n\t\t\tisBorderBox: false,\n\t\t\tclassName: 'overlay editor-overlay editor-overlay-ve'\n\t\t}, options )\n\t);\n\tthis.SourceEditorOverlay = options.SourceEditorOverlay;\n\tthis.isNewPage = options.isNewPage;\n\tthis.fromModified = options.dataPromise && options.switched;\n\n\t// VE surfaces must be attached to the DOM while initializing, and measurable\n\tthis.$el.addClass( 'editor-overlay-ve-initializing' );\n\toverlayManager.container.appendChild( this.$el[ 0 ] );\n\n\t// Gateway present for a few utility purposes; the VE articletarget\n\t// handles the actual API calls separately\n\tthis.gateway = new EditorGateway( {\n\t\tapi: options.api,\n\t\ttitle: options.title,\n\t\tsectionId: options.sectionId,\n\t\toldId: options.oldId,\n\t\tisNewPage: options.isNewPage\n\t} );\n\n\tthis.origDataPromise = this.options.dataPromise || mw.libs.ve.targetLoader.requestPageData(\n\t\t'visual',\n\t\toptions.titleObj.getPrefixedDb(),\n\t\t{\n\t\t\tsessionStore: true,\n\t\t\tsection: options.sectionId || null,\n\t\t\toldId: options.oldId || undefined,\n\t\t\ttargetName: ve.init.mw.MobileArticleTarget.static.trackingName\n\t\t}\n\t);\n\n\tthis.target = ve.init.mw.targetFactory.create( 'article', this, {\n\t\t$element: this.$el,\n\t\t// string or null, but not undefined\n\t\tsection: this.options.sectionId || null\n\t} );\n\tthis.target.once( 'surfaceReady', function () {\n\t\tsurfaceReady.resolve();\n\n\t\tthis.target.getSurface().getModel().getDocument().once( 'transact', function () {\n\t\t\tthis.log( { action: 'firstChange' } );\n\t\t}.bind( this ) );\n\t}.bind( this ) );\n\n\tthis.target.load( this.origDataPromise );\n\n\t// Overlay is only shown after this is resolved. It must be resolved\n\t// with the API response regardless of what we are waiting for.\n\tthis.dataPromise = this.origDataPromise.then( function ( data ) {\n\t\treturn surfaceReady.then( function () {\n\t\t\tthis.$el.removeClass( 'editor-overlay-ve-initializing' );\n\t\t\treturn data && data.visualeditor;\n\t\t}.bind( this ) );\n\t}.bind( this ) );\n}\n\nmfExtend( VisualEditorOverlay, EditorOverlayBase, {\n\t/**\n\t * @inheritdoc\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\ttemplatePartials: util.extend( {}, EditorOverlayBase.prototype.templatePartials, {\n\t\teditHeader: util.template( `\n<div class=\"overlay-header header initial-header hideable hidden\">\n\t<div class=\"toolbar\"></div>\n</div>\n\t\t` ),\n\t\tcontent: util.template( `\n<div class=\"surface\" lang=\"{{contentLang}}\" dir=\"{{contentDir}}\">\n</div>\n\t\t` )\n\t} ),\n\t/**\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\teditor: 'visualeditor',\n\t/**\n\t * Destroy the existing VisualEditor target.\n\t *\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\tdestroyTarget: function () {\n\t\tif ( this.target ) {\n\t\t\tthis.target.destroy();\n\t\t\tthis.target = null;\n\t\t}\n\t},\n\t/**\n\t * @inheritdoc\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\tshow: function () {\n\t\tvar\n\t\t\toptions = this.options,\n\t\t\tshowAnonWarning = options.isAnon && !options.switched;\n\n\t\tEditorOverlayBase.prototype.show.apply( this, arguments );\n\n\t\t// log edit attempt\n\t\tthis.log( { action: 'ready' } );\n\t\tthis.log( { action: 'loaded' } );\n\n\t\tif ( !showAnonWarning ) {\n\t\t\tthis.targetInit();\n\t\t} else {\n\t\t\tthis.$anonWarning = this.createAnonWarning( this.options );\n\t\t\tthis.$anonTalkWarning = this.createAnonTalkWarning();\n\t\t\tthis.$el.append( [ this.$anonTalkWarning, this.$anonWarning ] );\n\t\t\tthis.$el.find( '.overlay-content' ).hide();\n\t\t}\n\n\t\tthis.emit( 'editor-loaded' );\n\t},\n\t/**\n\t * Initialize the target after it has been made visible\n\t */\n\ttargetInit: function () {\n\t\t// Note this.target will not be set if an error occurred and/or destroyTarget was called.\n\t\tif ( this.target ) {\n\t\t\tthis.target.afterSurfaceReady();\n\t\t\tthis.scrollToLeadParagraph();\n\t\t}\n\t},\n\t/**\n\t * Scroll so that the lead paragraph in edit mode shows at the same place on the screen\n\t * as the lead paragraph in read mode.\n\t *\n\t * Their normal position is different because of (most importantly) the lead paragraph\n\t * transformation to move it before the infobox, and also invisible templates and slugs\n\t * caused by the presence of hatnote templates (both only shown in edit mode).\n\t */\n\tscrollToLeadParagraph: function () {\n\t\tvar editLead, editLeadView, readLead, offset, initialCursorOffset,\n\t\t\tcurrentPageHTMLParser = this.options.currentPageHTMLParser,\n\t\t\tfakeScroll = this.options.fakeScroll,\n\t\t\t$window = $( window ),\n\t\t\tsection = this.target.section,\n\t\t\tsurface = this.target.getSurface(),\n\t\t\tmode = surface.getMode();\n\n\t\tif ( ( section === null || section === '0' ) && mode === 'visual' ) {\n\t\t\teditLead = identifyLeadParagraph( surface.getView().$attachedRootNode );\n\t\t\tif ( currentPageHTMLParser.getLeadSectionElement() ) {\n\t\t\t\treadLead = identifyLeadParagraph( currentPageHTMLParser.getLeadSectionElement() );\n\t\t\t}\n\n\t\t\tif ( editLead && readLead ) {\n\t\t\t\toffset = $( editLead ).offset().top - ( $( readLead ).offset().top - fakeScroll );\n\t\t\t\t// Set a model range to match\n\t\t\t\teditLeadView = $( editLead ).data( 'view' );\n\t\t\t\tif ( editLeadView ) {\n\t\t\t\t\tsurface.getModel().setLinearSelection(\n\t\t\t\t\t\tnew ve.Range( editLeadView.getModel().getRange().start )\n\t\t\t\t\t);\n\t\t\t\t\tinitialCursorOffset =\n\t\t\t\t\t\tsurface.getView().getSelection().getSelectionBoundingRect().top;\n\t\t\t\t\t// Ensure the surface is tall enough to scroll the cursor into view\n\t\t\t\t\tsurface.$element.css( 'min-height', $window.height() + initialCursorOffset - surface.padding.top );\n\t\t\t\t}\n\t\t\t\t$window.scrollTop( offset );\n\t\t\t}\n\t\t}\n\t},\n\t/**\n\t * @inheritdoc\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\tonBeforeExit: function ( exit, cancel ) {\n\t\tvar overlay = this;\n\t\tEditorOverlayBase.prototype.onBeforeExit.call( this, function () {\n\t\t\t// If this function is called, the parent method has decided that we should exit\n\t\t\texit();\n\t\t\t// VE-specific cleanup\n\t\t\toverlay.destroyTarget();\n\t\t}, cancel );\n\t},\n\t/**\n\t * @inheritdoc\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\tonClickBack: function () {\n\t\tEditorOverlayBase.prototype.onClickBack.apply( this, arguments );\n\t\tthis.switchToEditor();\n\t},\n\t/**\n\t * @inheritdoc\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\tonClickAnonymous: function () {\n\t\tvar self = this;\n\t\tthis.$anonWarning.hide();\n\t\tthis.$anonTalkWarning.hide();\n\t\tself.$el.find( '.overlay-content' ).show();\n\t\tthis.targetInit();\n\t},\n\t/**\n\t * Reveal the editing interface.\n\t *\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\tswitchToEditor: function () {\n\t\tthis.showHidden( '.initial-header' );\n\t},\n\t/**\n\t * Loads an {SourceEditorOverlay} and replaces the existing {VisualEditorOverlay}\n\t *\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t * @param {jQuery.Promise} [dataPromise] Optional promise for loading content\n\t */\n\tswitchToSourceEditor: function ( dataPromise ) {\n\t\tvar self = this,\n\t\t\tSourceEditorOverlay = this.SourceEditorOverlay,\n\t\t\tnewOverlay,\n\t\t\toptions = this.getOptionsForSwitch();\n\t\tthis.log( {\n\t\t\taction: 'abort',\n\t\t\ttype: 'switchnochange',\n\t\t\tmechanism: 'navigate'\n\t\t} );\n\t\tthis.logFeatureUse( {\n\t\t\tfeature: 'editor-switch',\n\t\t\taction: 'source-mobile'\n\t\t} );\n\n\t\t// Save a user setting indicating that this user prefers using the SourceEditor\n\t\tsetPreferredEditor( 'SourceEditor' );\n\n\t\tthis.$el.addClass( 'switching' );\n\t\tthis.$el.find( '.overlay-header-container' ).hide();\n\t\tthis.$el.append( fakeToolbar() );\n\t\tthis.target.getSurface().setReadOnly( true );\n\n\t\tif ( dataPromise ) {\n\t\t\t// If switching with edits we can't stay in section editing, as a VE edit\n\t\t\t// can always affect the whole document (e.g. references)\n\t\t\toptions.sectionId = null;\n\t\t\trouter.navigateTo( document.title, {\n\t\t\t\tpath: '#/editor/all',\n\t\t\t\tuseReplaceState: true\n\t\t\t} );\n\t\t}\n\t\tnewOverlay = new SourceEditorOverlay( options, dataPromise );\n\t\tnewOverlay.getLoadingPromise().then( function () {\n\t\t\tself.switching = true;\n\t\t\tself.overlayManager.replaceCurrent( newOverlay );\n\t\t\tself.switching = false;\n\t\t} );\n\t},\n\t/**\n\t * @inheritdoc\n\t * @memberof VisualEditorOverlay\n\t * @instance\n\t */\n\thasChanged: function () {\n\t\tif ( this.saved ) {\n\t\t\t// If we just saved, there's not really any changes, and the\n\t\t\t// target is going to be destroyed in one tick\n\t\t\treturn false;\n\t\t}\n\t\treturn this.fromModified || (\n\t\t\tthis.target &&\n\t\t\tthis.target.getSurface() &&\n\t\t\tthis.target.getSurface().getModel().hasBeenModified()\n\t\t);\n\t}\n} );\n\nmodule.exports = VisualEditorOverlay;\n","const\n\tDrawer = require( '../mobile.startup/Drawer' ),\n\tBlockMessageDetails = require( './BlockMessageDetails' );\n\n/**\n * @typedef {Object} BlockMessageOptions\n * @property {number} blockId representing the block\n * @property {boolean} partial is this a partial block?\n * @property {Object} creator\n * @property {string} creator.name of the blocker\n * @property {string} creator.url associated with the block\n * @property {string} reason for block\n * @property {string} [duration] of block e.g. \"1 week\"\n * @property {string} [expiry] of block, wrapped in parentheses\n *  e.g. \"(1st September 2019)\"\n */\n\n/**\n * This creates the drawer at the bottom of the screen that appears when a\n * blocked user tries to edit.\n *\n * @param {BlockMessageOptions} props\n * @return {Drawer}\n */\nmodule.exports = function blockMessageDrawer( props ) {\n\tconst blockDrawer = new Drawer( {\n\t\tclassName: 'drawer block-message',\n\t\tonBeforeHide: function ( drawer ) {\n\t\t\tdrawer.$el.remove();\n\t\t},\n\t\tonShow: function () {\n\t\t\tconst $drawer = blockDrawer.$el.find( '.drawer.block-message' ),\n\t\t\t\tdrawerTop = $drawer.offset().top - 100,\n\t\t\t\tcreatorTop = blockDrawer.$el.find( '.block-message-creator' ).offset().top - 100,\n\t\t\t\tbuttonsTop = blockDrawer.$el.find( '.block-message-buttons' ).offset().top - 100,\n\t\t\t\t$seeMore = blockDrawer.$el.find( '.block-message-see-more' ),\n\t\t\t\twiki = mw.config.get( 'wgDBname' );\n\n\t\t\t$drawer.css( 'top', drawerTop + ( buttonsTop - creatorTop ) );\n\t\t\t$seeMore.on(\n\t\t\t\t'click',\n\t\t\t\tfunction () {\n\t\t\t\t\tconst $container = blockDrawer.$el.find( '.block-message-container' );\n\t\t\t\t\t$drawer.css( 'top', 0 );\n\t\t\t\t\t$container.css( 'overflow-y', 'auto' );\n\t\t\t\t\t$container.css( 'height', buttonsTop - $container.offset().top );\n\t\t\t\t\t$seeMore.hide();\n\n\t\t\t\t\tif ( mw.config.get( 'wgMFTrackBlockNotices' ) ) {\n\t\t\t\t\t\tmw.track( 'counter.MediaWiki.BlockNotices.' + wiki + '.MobileFrontend.reasonShown', 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( mw.config.get( 'wgMFTrackBlockNotices' ) ) {\n\t\t\t\tmw.track( 'counter.MediaWiki.BlockNotices.' + wiki + '.MobileFrontend.shown', 1 );\n\t\t\t}\n\t\t},\n\t\tchildren: [\n\t\t\t( new BlockMessageDetails( props ) ).$el\n\t\t]\n\t} );\n\treturn blockDrawer;\n};\n","/* global $ */\n/**\n * Find first paragraph that has text content, i.e. paragraphs that are not empty.\n * Keep in sync with MoveLeadParagraphTransform::identifyLeadParagraph().\n *\n * @param {jQuery} $body Where to search for paragraphs\n * @return {Node|null} The lead paragraph\n */\nmodule.exports = function identifyLeadParagraph( $body ) {\n\t// Keep in sync with MoveLeadParagraphTransform::isNotEmptyNode()\n\tfunction isNotEmptyNode( node ) {\n\t\t// Ignore VE whitespace characters\n\t\treturn !/^[\\s↵➞]*$/.test( node.textContent );\n\t}\n\n\t// Keep in sync with MoveLeadParagraphTransform::isNonLeadParagraph()\n\tfunction isNonLeadParagraph( node ) {\n\t\tnode = node.cloneNode( true );\n\t\tvar $node = $( node );\n\t\t// The paragraph itself can be an invisible template (T293834)\n\t\tif ( $node.hasClass( 've-ce-focusableNode-invisible' ) ) {\n\t\t\treturn true;\n\t\t}\n\t\t// Ignore non-content nodes, TemplateStyles and coordinates\n\t\t$node.find( '.ve-ce-branchNode-inlineSlug, .ve-ce-focusableNode-invisible, style, span#coordinates' ).remove();\n\t\tif ( isNotEmptyNode( node ) ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tvar $paragraphs = $body.children( 'p' );\n\tfor ( var i = 0; i < $paragraphs.length; i++ ) {\n\t\tvar p = $paragraphs[ i ];\n\t\tif ( !isNonLeadParagraph( p ) ) {\n\t\t\treturn p;\n\t\t}\n\t}\n\treturn null;\n};\n","var m = require( './../mobile.startup/moduleLoaderSingleton' ),\n\tSourceEditorOverlay = require( './SourceEditorOverlay' ),\n\tVisualEditorOverlay = require( './VisualEditorOverlay' );\n\n// Exposed for MobileFrontend mobile.init usage.\nm.define( 'mobile.editor.overlay/SourceEditorOverlay', SourceEditorOverlay );\nm.define( 'mobile.editor.overlay/VisualEditorOverlay', VisualEditorOverlay );\n","var util = require( '../mobile.startup/util' );\n\n/**\n * @param {string} blockinfo\n * @return {Object}\n */\nmodule.exports = function parseBlockInfo( blockinfo ) {\n\tconst blockInfo = {\n\t\tpartial: blockinfo.blockpartial || false,\n\t\tnoCreateAccount: blockinfo.blocknocreate || false,\n\t\tanonOnly: blockinfo.blockanononly === undefined ? true : blockinfo.blockanononly,\n\t\tcreator: {\n\t\t\tname: blockinfo.blockedby,\n\t\t\turl: null\n\t\t},\n\t\texpiry: null,\n\t\tduration: null,\n\t\treason: '',\n\t\tblockId: blockinfo.blockid\n\t};\n\n\t// Workaround to parse a message parameter for mw.message, see T96885\n\tfunction jqueryMsgParse( wikitext ) {\n\t\t// eslint-disable-next-line new-cap\n\t\tconst parser = new mw.jqueryMsg.parser();\n\t\ttry {\n\t\t\tconst ast = parser.wikiTextToAst( wikitext );\n\t\t\treturn parser.emitter.emit( ast ).html();\n\t\t} catch ( e ) {\n\t\t\t// Ignore error as it's probably the parser error. Usually this is because we\n\t\t\t// can't parse templates.\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// URL only useful if block creator is a local user\n\tif ( blockinfo.blockedbyid === 0 ) {\n\t\tblockInfo.creator.url = '';\n\t} else {\n\t\tblockInfo.creator.url = mw.Title.makeTitle(\n\t\t\tmw.config.get( 'wgNamespaceIds' ).user,\n\t\t\tblockInfo.creator.name\n\t\t).getUrl();\n\t}\n\n\tif ( [ 'infinite', 'indefinite', 'infinity', 'never' ].indexOf( blockinfo.blockexpiry ) === -1 ) {\n\t\tblockInfo.expiry = mw.message( 'parentheses', blockinfo.blockexpiryformatted ).escaped();\n\t\tblockInfo.duration = blockinfo.blockexpiryrelative;\n\t}\n\n\tconst reason = blockinfo.blockreason;\n\tif ( reason ) {\n\t\tblockInfo.reason = jqueryMsgParse( reason ) || mw.html.escape( reason );\n\t\tblockInfo.parsedReason = ( new mw.Api() ).get( {\n\t\t\taction: 'parse',\n\t\t\tformatversion: 2,\n\t\t\ttext: reason,\n\t\t\tcontentmodel: 'wikitext'\n\t\t} ).then( function ( result ) {\n\t\t\treturn result.parse.text;\n\t\t} ).catch( function () {\n\t\t\treturn jqueryMsgParse( reason ) || mw.html.escape( reason );\n\t\t} );\n\t} else {\n\t\tblockInfo.reason = mw.message( 'mobile-frontend-editor-generic-block-reason' ).escaped();\n\t\tblockInfo.parsedReason = util.Deferred().resolve( blockInfo.reason ).promise();\n\t}\n\n\treturn blockInfo;\n};\n","/**\n * Build a save failure message from the API response\n *\n * @param {Object} data API response\n * @return {string} message HTML text describing the failure for display to the user\n */\nmodule.exports = function saveFailureMessage( data ) {\n\t// In most cases, return the error message from the API directly.\n\t// Handle a few exceptions where it is unsuitable for end-users\n\t// (some error messages are seemingly intended for tool developers).\n\n\tvar code = data && data.errors && data.errors[0] && data.errors[0].code;\n\n\tif ( code === 'editconflict' ) {\n\t\treturn mw.msg( 'mobile-frontend-editor-error-conflict' );\n\t}\n\n\tif ( code === 'readonly' ) {\n\t\treturn data.errors[0].html + '<br>' + data.errors[0].data.readonlyreason;\n\t}\n\n\tif ( data.errors && data.errors[0] ) {\n\t\treturn data.errors[0].html;\n\t}\n\n\t// This probably indicates a connection problem and a \"fake\" response\n\t// generated by mediawiki.Api. TODO Give a better error message here.\n\treturn '';\n};\n","/**\n * Store the user's preferred editor\n *\n * @param {string} editor 'VisualEditor' or 'SourceEditor'\n */\nmodule.exports = function setPreferredEditor( editor ) {\n\tif ( !mw.user.isAnon() ) {\n\t\tnew mw.Api().saveOption( 'mobile-editor', editor ).then( function () {\n\t\t\tmw.user.options.set( 'mobile-editor', editor );\n\t\t} );\n\t} else {\n\t\tmw.storage.set( 'preferredEditor', editor );\n\t}\n};\n","var\n\tView = require( './View' ),\n\tutil = require( './util' ),\n\tmfExtend = require( './mfExtend' );\n\n/**\n * @class MessageBox\n * @extends View\n */\nfunction MessageBox() {\n\tView.apply( this, arguments );\n}\n\nmfExtend( MessageBox, View, {\n\t/**\n\t * @inheritdoc\n\t * @memberof MessageBox\n\t * @instance\n\t */\n\tisTemplateMode: true,\n\t/**\n\t * @memberof MessageBox\n\t * @instance\n\t * @mixes View#defaults\n\t * @property {Object} defaults Default options hash.\n\t * @property {string} [defaults.heading] heading to show along with message (text)\n\t * @property {string} defaults.msg message to show (html)\n\t * @property {string} defaults.className either mw-message-box-error,\n\t *   mw-message-box-notice or mw-message-box-warning\n\t */\n\tdefaults: {},\n\t/**\n\t * @memberof MessageBox\n\t * @instance\n\t */\n\ttemplate: util.template( `\n<div class=\"{{className}} mw-message-box\">\n\t{{#heading}}<h2>{{heading}}</h2>{{/heading}}\n\t{{{msg}}}\n</div>\n\t` )\n} );\n\nmodule.exports = MessageBox;\n"],"sourceRoot":""}