mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () { mw.libs.ve.targetLoader.addPlugin( function () { ve.init.mw.HCaptchaSaveErrorHandler = function () {}; OO.inheritClass( ve.init.mw.HCaptchaSaveErrorHandler, ve.init.mw.SaveErrorHandler ); ve.init.mw.HCaptchaSaveErrorHandler.static.name = 'confirmEditHCaptcha'; ve.init.mw.HCaptchaSaveErrorHandler.static.getReadyPromise = function () { var onLoadFn = 'onHcaptchaLoadCallback' + Date.now(), deferred, scriptURL, params; if ( !this.readyPromise ) { deferred = $.Deferred(); scriptURL = new mw.Uri( require( './config.json' ).hCaptchaScriptURL ); params = { onload: onLoadFn, render: 'explicit' }; scriptURL.query = $.extend( scriptURL.query, params ); this.readyPromise = deferred.promise(); window[ onLoadFn ] = deferred.resolve; mw.loader.load( scriptURL.toString() ); } return this.readyPromise; }; ve.init.mw.HCaptchaSaveErrorHandler.static.matchFunction = function ( data ) { var captchaData = ve.getProp( data, 'visualeditoredit', 'edit', 'captcha' ); return !!( captchaData && captchaData.type === 'hcaptcha' ); }; ve.init.mw.HCaptchaSaveErrorHandler.static.process = function ( data, target ) { var self = this, siteKey = require( './config.json' ).hCaptchaSiteKey, $container = $( '