// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/html dojo/Deferred dojo/topic dojo/Evented dojo/on dijit/Tooltip dojo/aspect dojo/json dojo/query dojo/request/xhr dojo/promise/all dijit/registry ./utils jimu/tokenUtils ./dijit/Message ./DataSourceManager ./portalUrlUtils ./portalUtils".split(" "),function(F,f,n,q,l,m,G,H,I,t,y,J,z,u,v,k,C,A,D,E,K){var w=null,B=F(G,{constructor:function(){this.loaded=[];this.missedActions=[];this.activeWidget=null;this.widgetsUri={};window.isBuilder?
(m.subscribe("app/mapLoaded",f.hitch(this,this._onMapLoaded)),m.subscribe("app/mapChanged",f.hitch(this,this._onMapChanged))):(m.subscribe("mapLoaded",f.hitch(this,this._onMapLoaded)),m.subscribe("mapChanged",f.hitch(this,this._onMapChanged)));window.isBuilder?(m.subscribe("app/sceneViewLoaded",f.hitch(this,this._onSceneViewLoaded)),m.subscribe("app/sceneViewChanged",f.hitch(this,this._onSceneViewChanged))):(m.subscribe("sceneViewLoaded",f.hitch(this,this._onSceneViewLoaded)),m.subscribe("sceneViewChanged",
f.hitch(this,this._onSceneViewChanged)));window.isBuilder?(m.subscribe("app/appConfigLoaded",f.hitch(this,this._onAppConfigLoaded)),m.subscribe("app/appConfigChanged",f.hitch(this,this._onAppConfigChanged))):(m.subscribe("appConfigLoaded",f.hitch(this,this._onAppConfigLoaded)),m.subscribe("appConfigChanged",f.hitch(this,this._onAppConfigChanged)));m.subscribe("userSignIn",f.hitch(this,this._onUserSignIn));m.subscribe("userSignOut",f.hitch(this,this._onUserSignOut));m.subscribe("builder/actionTriggered",
f.hitch(this,this._onActionTriggered));m.subscribe("/dnd/move/start",f.hitch(this,this._onMoveStart))},loadWidget:function(a){var b=new l,c;a=f.clone(a);(c=this.getWidgetById(a.id))?b.resolve(c):this.getWidgetUri(a).then(f.hitch(this,function(d){a.uri=d;u([this.loadWidgetClass(a),this.loadWidgetManifest(a)]).then(f.hitch(this,function(e){var g=e[0],h=e[1];this.loadWidgetResources(h).then(f.hitch(this,function(p){try{var r=this.createWidget(h,g,p);q.setAttr(r.domNode,"data-widget-name",h.name);console.log("widget ["+
h.uri+"] created.")}catch(x){console.log("create ["+h.uri+"] error:"+x.stack),new A({message:window.jimuNls.widgetManager.createWidgetError+": "+h.uri}),v.byId(h.id)&&v.byId(h.id).destroy(),b.reject(x)}setTimeout(f.hitch(this,function(){b.resolve(r);this.emit("widget-created",r);m.publish("widgetCreated",r)}),50)}),function(p){b.reject(p)})}),function(e){b.reject(e)})}));return b},loadWidgetClass:function(a){var b=new l;var c=a.isRemote?a.uri+".js":a.uri;require(k.getRequireConfig(),[c],f.hitch(this,
function(d){b.resolve(d)}));k.checkError(a.uri,b);return b},loadWidgetResources:function(a){var b=new l,c=[];var d=f.clone(a);a=this.tryLoadWidgetConfig(d);var e=this._tryLoadResource(d,"i18n");var g=this._tryLoadResource(d,"style");d=this._tryLoadResource(d,"template");c.push(a);c.push(e);c.push(d);c.push(g);u(c).then(f.hitch(this,function(h){var p={};p.config=h[0];p.i18n=h[1];p.template=h[2];p.style=h[3];b.resolve(p)}),function(h){b.reject(h)});return b},getWidgetUri:function(a){if(this.widgetsUri[a.id])return this.widgetsUri[a.id];
var b=a.itemId?K.getPortal(window.portalUrl).getItemById(a.itemId).then(function(c){return E.isOnline(window.portalUrl)&&!E.isOnline(c.url)?(new l).reject("Not allow.",a.itemId):k.widgetJson.getUriFromItem(c)}):k.getUriInfo(a.uri).isRemote?(new l).reject("Not allow.",a.uri):(new l).resolve(a.uri);return this.widgetsUri[a.id]=b},loadWidgetManifest:function(a){var b=new l;return this.getWidgetUri(a).then(f.hitch(this,function(c){a.uri=c;if(a.manifest)return b.resolve(a),b;c=k.getUriInfo(c).folderUrl+
"manifest.json";return z(c,{handleAs:"json",headers:{"X-Requested-With":null}}).then(f.hitch(this,function(d){if(d.error&&d.error.code)return b.reject(d.error);d.category="widget";f.mixin(d,k.getUriInfo(a.uri));return k.manifest.addI18NLabel(d).then(f.hitch(this,function(){this._processManifest(d);k.widgetJson.addManifest2WidgetJson(a,d);b.resolve(a);return b}))}))}),function(c){b.reject(c)})},getWidgetMarginBox:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return{};if(a._marginBox)return a._marginBox;
var b={left:-9999,top:-9999,relativeTo:a.position.relativeTo};a._isTestSizeFlag=!0;a.setPosition(b);this.openWidget(a);a._marginBox=a.getMarginBox();this.closeWidget(a);"undefined"!==typeof a._isTestSizeFlag&&delete a._isTestSizeFlag;return a._marginBox},_processManifest:function(a){k.manifest.addManifestProperies(a);k.manifest.processManifestLabel(a,window.dojoConfig.locale)},createWidget:function(a,b,c){if(this.getWidgetById(a.id))return this.getWidgetById(a.id);c.config&&c.i18n&&(c.config=k.replacePlaceHolder(c.config,
c.i18n));a.rawConfig=a.config;a.config=c.config||{};this.appConfig._appData&&this._mergeAgolConfig(a);a.nls=c.i18n||{};c.template&&(a.templateString=c.template);a["class"]="jimu-widget";a.label||(a.label=a.name);this.map&&(a.map=this.map);a.appConfig=this.appConfig;c={};for(var d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);c.widgetManager=this;a=new b(c);a.clazz=b;t.after(a,"startup",f.hitch(this,this._postWidgetStartup,a));t.before(a,"destroy",f.hitch(this,this._onDestroyWidget,a));a.domNode.addEventListener(this._getActiveEventName(),
f.hitch(this,this._onClickWidget,a),{capture:!0});this.loaded.push(a);return a},getAllWidgets:function(){return this.loaded},destroyAllWidgets:function(){var a=n.map(this.loaded,function(b){return b.id});n.forEach(a,function(b){this.destroyWidget(b)},this);this.loaded=[]},loadWidgetSettingPage:function(a){var b=new l;a=f.clone(a);a.id+="_setting";u([this.loadWidgetSettingClass(a)]).then(f.hitch(this,function(c){var d=c[0];this.loadWidgetSettingPageResources(a).then(f.hitch(this,function(e){var g=
{nls:e.i18n,appConfig:this.appConfig,"class":"jimu-widget-setting"};null!==e.template&&(g.templateString=e.template);"HTML3D"===window.appInfo.appType?g.sceneView=this.sceneView:g.map=this.map;for(var h in a)a.hasOwnProperty(h)&&(g[h]=a[h]);try{var p=new d(g);q.setAttr(p.domNode,"data-widget-name-setting",g.name);t.before(p,"destroy",f.hitch(this,this._onDestroyWidgetSetting,p));b.resolve(p)}catch(r){new A({message:window.jimuNls.widgetManager.createWidgetSettingPageError+":"+a.uri}),v.byId(g.id)&&
v.byId(g.id).destroy(),b.reject(r)}}),function(e){console.log(e)})}),function(c){b.reject(c)});return b},loadWidgetSettingClass:function(a){var b=new l;var c=a.isRemote?a.folderUrl+"setting/Setting.js":a.amdFolder+"setting/Setting";require(k.getRequireConfig(),[c],f.hitch(this,function(d){b.resolve(d)}));k.checkError(a.folderUrl+"setting/Setting.js",b);return b},loadWidgetSettingPageResources:function(a){var b=new l,c=[];a=f.clone(a);var d=this._tryLoadResource(a,"settingI18n");var e=this._tryLoadResource(a,
"settingTemplate");a=this._tryLoadResource(a,"settingStyle");c.push(d);c.push(e);c.push(a);u(c).then(f.hitch(this,function(g){var h={};h.i18n=g[0]||{};h.template=g[1];h.style=g[2];b.resolve(h)}),function(g){console.log(g)});return b},getWidgetById:function(a){var b;n.some(this.loaded,function(c){if(c.id===a)return b=c,!0},this);return b},getWidgetByLabel:function(a){var b;n.some(this.loaded,function(c){if(c.label===a)return b=c,!0},this);return b},getWidgetsByName:function(a){var b=[];n.some(this.loaded,
function(c){c.name===a&&b.push(c)},this);return b},changeWindowStateTo:function(a,b){"normal"===b?this.normalizeWidget(a):"minimized"===b?this.minimizeWidget(a):"maximized"===b?this.maximizeWidget(a):console.log("error state: "+b)},closeWidget:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;if("closed"!==a.state){this.activeWidget&&this.activeWidget.id===a.id&&(this.activeWidget.onDeActive(),this.activeWidget=null);q.setStyle(a.domNode,"display","none");a.setState("closed");
try{a.onClose()}catch(b){console.log(console.error("fail to close widget "+a.name+". "+b.stack))}}this.appConfig.mode||this._removeDataSourceUsage(a)},openWidget:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;if(!a.started)try{a.started=!0,a.startup()}catch(b){console.error("fail to startup widget "+a.name+". "+b.stack)}if("closed"===a.state){q.setStyle(a.domNode,"display","");a.setState("opened");try{a.onOpen()}catch(b){console.error("fail to open widget "+a.name+". "+b.stack)}!a._isTestSizeFlag&&
k.isAutoFocusFirstNodeWidget(a)&&k.focusFirstFocusNode(a.domNode);this.appConfig.mode||this._addDataSourceUsage(a)}},activateWidget:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;"opened"===a.state&&this._activeWidget(a)},maximizeWidget:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;"closed"===a.state&&this.openWidget(a);a.setWindowState("maximized");try{a.onMaximize()}catch(b){console.log(console.error("fail to maximize widget "+a.name+". "+b.stack))}},
minimizeWidget:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;"closed"===a.state&&this.openWidget(a);a.setWindowState("minimized");try{a.onMinimize()}catch(b){console.log(console.error("fail to minimize widget "+a.name+". "+b.stack))}},normalizeWidget:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;"closed"===a.state&&this.openWidget(a);a.setWindowState("normal");try{a.onNormalize()}catch(b){console.log(console.error("fail to normalize widget "+a.name+
". "+b.stack))}},destroyWidget:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;this._removeWidget(a);try{a.destroy()}catch(b){console.log(console.error("fail to destroy widget "+a.name+". "+b.stack))}},tryLoadWidgetConfig:function(a){return this._tryLoadWidgetConfig(a).then(f.hitch(this,function(b){return this._upgradeWidgetConfig(a,b).then(function(c){return a.config=c})}))},triggerWidgetOpen:function(a){function b(g){var h=t.after(g,"onOpen",function(){h.remove();c.resolve(g)})}
var c=new l,d=this.getWidgetById(a);if(d){if("closed"!==d.state)return c.resolve(d),c;b(d)}else var e=m.subscribe("widgetCreated",f.hitch(this,function(g){g.id===a&&(e.remove(),c.resolve(g))}));m.publish("openWidget",a);return c},_tryLoadWidgetConfig:function(a){var b=new l;if(a.config&&f.isObject(a.config))return b.resolve(a.config),b;if(a.config){if(require.cache["url:"+a.config])return b.resolve(y.parse(require.cache["url:"+a.config])),b;b=k.processUrlInAppConfig(a.config);b=b.split("/");b[b.length-
1]=encodeURIComponent(b[b.length-1]);b=b.join("/");return z(b,{handleAs:"json",headers:{"X-Requested-With":null}})}return this._tryLoadResource(a,"config").then(function(c){a.isDefaultConfig=!0;return c})},_upgradeWidgetConfig:function(a,b){var c=new l,d=a.manifest.version,e=a.version,g;if(d===e)return c.resolve(b),c;if(!1===a.hasVersionManager)return a.version=d,c.resolve(b),c;require(k.getRequireConfig(),[a.amdFolder+(a.isRemote?"VersionManager.js":"VersionManager")],f.hitch(this,function(h){h=
new h;var p=h.getVersionIndex(e),r=h.getVersionIndex(d);if(p>r)c.reject("Bad widget version number, "+a.name+","+e);else try{g=h.upgrade(b,e,d),a.version=d,c.resolve(g)}catch(x){console.log("Read widget ["+a.name+"] old config error,"+x.stack),c.resolve(b)}}));return c},loadWidgetStyle:function(a){var b=this._getStyleIdFromWidgetJson(a,!1),c=new l;return q.byId(b)?(c.resolve("load"),c):k.loadStyleLink(b,a.styleFile,"theme_"+this.appConfig.theme.name+"_style_common")},loadWidgetSettingStyle:function(a){var b=
this._getStyleIdFromWidgetJson(a,!0),c=new l;return q.byId(b)?(c.resolve("load"),c):k.loadStyleLink(b,a.settingStyleFile)},loadWidgetConfig:function(a){a=require(k.getRequireConfig()).toUrl(a.configFile);if(require.cache["url:"+a]){var b=new l;b.resolve(y.parse(require.cache["url:"+a]));return b}return z(a,{handleAs:"json",headers:{"X-Requested-With":null}})},loadWidgetI18n:function(a){var b=new l;require(k.getRequireConfig(),["dojo/i18n!"+a.i18nFile],function(c){b.resolve(c)});return b},loadWidgetSettingI18n:function(a){var b=
new l;require(k.getRequireConfig(),["dojo/i18n!"+a.settingI18nFile],function(c){b.resolve(c)});return b},loadWidgetTemplate:function(a){var b=new l;require(k.getRequireConfig(),["dojo/text!"+a.templateFile],function(c){b.resolve(c)});k.checkError(a.templateFile,b);return b},loadWidgetSettingTemplate:function(a){var b=new l;require(k.getRequireConfig(),["dojo/text!"+a.settingTemplateFile],function(c){b.resolve(c)});k.checkError(a.settingTemplateFile,b);return b},removeWidgetStyle:function(a){this._removeStyle(this._getStyleIdFromWidgetJson(a,
!1))},removeWidgetSettingStyle:function(a){this._removeStyle(this._getStyleIdFromWidgetJson(a,!0))},_removeStyle:function(a){if(q.byId(a)){var b=q.attr(a,"data-import-styles");if(b)for(var c=0;c<parseInt(b,10);c++)q.destroy(a+"_import_"+c);q.destroy(a)}},_getStyleIdFromWidgetJson:function(a,b){return this._replaceId("widget/style/"+(a.itemId?a.itemId:a.uri)+(b?"/setting":""))},getControllerWidgets:function(){return n.filter(this.loaded,function(a){return a.isController})},getOffPanelWidgets:function(){return n.filter(this.loaded,
function(a){return!a.inPanel})},getOnScreenOffPanelWidgets:function(){return n.filter(this.loaded,function(a){return a.isOnScreen&&!a.inPanel})},closeOtherWidgetsInTheSameGroup:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;for(var b=0;b<this.loaded.length;b++)this.loaded[b].gid===a.gid&&this.loaded[b].id!==a.id&&this.closeWidget(this.loaded[b])},closeAllWidgetsInGroup:function(a){for(var b=0;b<this.loaded.length;b++)this.loaded[b].gid===a&&this.closeWidget(this.loaded[b])},
_addDataSourceUsage:function(a){n.forEach(this._getUsedDataSourceIdFromWidget(a),function(b){D.getInstance().addDataSourceUsage(b,a.id)})},_removeDataSourceUsage:function(a){n.forEach(this._getUsedDataSourceIdFromWidget(a),function(b){D.getInstance().removeDataSourceUsage(b,a.id)})},_getUsedDataSourceIdFromWidget:function(a){if((a=this.appConfig.getConfigElementById(a.id))&&a.config){var b=y.stringify(a.config);return n.filter(Object.keys(this.appConfig.dataSource.dataSources),function(c){return-1<
b.indexOf(c)},this)}},_mergeAgolConfig:function(a){var b=this.appConfig._appData.values,c="widgets["+a.id+"]",d;for(d in b){var e=d.replace(/\//g,"_").indexOf(c+"_config");0<=e&&k.template.setConfigValue(a,d.replace(/\//g,"_").substr(e,d.length).replace(c,"widget"),b[d])}},_onUserSignIn:function(a){n.forEach(this.loaded,function(b){b.onSignIn(a)},this)},_onUserSignOut:function(){n.forEach(this.loaded,function(a){a.onSignOut()},this)},_activeWidget:function(a){if(this.activeWidget){if(this.activeWidget.id===
a.id){!1===this.activeWidget.inPanel&&this.activeWidget.moveTopOnActive&&q.setStyle(this.activeWidget.domNode,"zIndex",101);return}"active"===this.activeWidget.state&&(this.activeWidget.setState("opened"),!1===this.activeWidget.inPanel&&q.setStyle(a.domNode,"zIndex","zIndex"in a.position?a.position.zIndex:"auto"),this.activeWidget.onDeActive())}this.activeWidget=a;"opened"===this.activeWidget.state&&(this.activeWidget.setState("active"),!1===this.activeWidget.inPanel&&this.activeWidget.moveTopOnActive&&
q.setStyle(this.activeWidget.domNode,"zIndex",101),this.activeWidget.onActive(),m.publish("widgetActived",a))},_onClickWidget:function(a,b){var c=J(".jimu-widget",a.domNode);if(0<c.length)for(var d=0;d<c.length;d++)if(b.target===c[d]||q.isDescendant(b.target,c[d]))return;this._activeWidget(a)},_onMoveStart:function(a){n.forEach(this.loaded,function(b){b.domNode===a.node&&this._activeWidget(b)},this)},_onAppConfigLoaded:function(a){this.appConfig=a=f.clone(a);C.setPortalUrl(a.portalUrl)},_onMapLoaded:function(a){this.map=
a},_onMapChanged:function(a){this.map=a},_onSceneViewLoaded:function(a){this.sceneView=a},_onSceneViewChanged:function(a){this.sceneView=a},_onAppConfigChanged:function(a,b,c,d){var e=f.clone(a);this.appConfig=e;n.forEach(this.loaded,function(g){g&&(g.onAppConfigChanged(e,b,c,d),"widgetChange"===b&&this._onConfigChanged(c.id,c.config,d))},this)},_onConfigChanged:function(a,b){if(a=this.getWidgetById(a))a.onConfigChanged(b),f.mixin(a.config,b)},_onActionTriggered:function(a){if("map"!==a.elementId&&
"app"!==a.elementId){var b=this.getWidgetById(a.elementId);if(b)b.onAction(a.action,a.data);else this.missedActions.push({id:a.elementId,action:{name:a.action,data:a.data}});n.forEach(this.getControllerWidgets(),function(c){if(c.widgetIsControlled(a.elementId))c.onAction(a.action,{widgetId:a.elementId,data:a.data})},this)}},_resetFirstFocusNode:function(a){if(window.isMoveFocusWhenInit){var b=this.getWidgetsByName("Splash")[0];if(b&&"none"!==q.getStyle(b.domNode,"display"))window.isMoveFocusWhenInit=
!1,a&&"Splash"===a.name||b.domNode.focus();else if(window.currentMsgPopup&&window.currentMsgPopup.firstFocusNode)window.isMoveFocusWhenInit=!1,window.currentMsgPopup.focusedNodeBeforeOpen=k.getFirstSkipLink(),window.currentMsgPopup.firstFocusNode.focus();else if(window.isMoveFocusWhenInit)window.isMoveFocusWhenInit=!1,k.isInNavMode()&&k.focusOnFirstSkipLink();else return!1;return!0}},_postWidgetStartup:function(a){a.started=!0;k.setVerticalCenter(a.domNode);t.after(a,"resize",f.hitch(this,k.setVerticalCenter,
a.domNode));k.initTabIndexAndOrder(a);k.initWidgetCancelEvent(a);var b=a.position||a.panel&&a.panel.position;b&&"browser"===b.relativeTo&&H(a.domNode,"focus",f.hitch(this,function(){this._resetFirstFocusNode()}));this.openWidget(a);if(b=C.getPortalCredential(this.appConfig.portalUrl))a.onSignIn(b);else a.onSignOut();this._triggerMissedAction(a);a.inPanel||k.addTooltipByDomNode(I,a.domNode,a.label)},_triggerMissedAction:function(a){this.missedActions.forEach(function(b){if(b.id===a.id)a.onAction(b.action.name,
b.action.data)})},_remove:function(a){delete this.widgetsUri[a];return n.some(this.loaded,function(b,c){if(b.id===a)return this.loaded.splice(c,1),!0},this)},_tryLoadResource:function(a,b){var c=new l,d=function(){if("config"===b)var g=this.loadWidgetConfig(a);else if("style"===b)g=this.loadWidgetStyle(a);else if("i18n"===b)g=this.loadWidgetI18n(a);else if("template"===b)g=this.loadWidgetTemplate(a);else if("settingTemplate"===b)g=this.loadWidgetSettingTemplate(a);else if("settingStyle"===b)g=this.loadWidgetSettingStyle(a);
else if("settingI18n"===b)g=this.loadWidgetSettingI18n(a);else return c;g.then(function(h){c.resolve(h)},function(h){console.error("Load widget resource error. resource:",b);console.error(h);new A({message:window.jimuNls.widgetManager.loadWidgetResourceError+": "+a.uri});c.reject(h)})};if("config"===b){var e=a.amdFolder+"config.json";a.configFile=e;e="hasConfig"}else if("style"===b)e=a.amdFolder+"css/style.css",a.styleFile=e,e="hasStyle";else if("i18n"===b)e=a.amdFolder+"nls/strings.js",a.i18nFile=
a.isRemote?e:a.amdFolder+"nls/strings",e="hasLocale";else if("template"===b)e=a.amdFolder+"Widget.html",a.templateFile=e,e="hasUIFile";else if("settingTemplate"===b)e=a.amdFolder+"setting/Setting.html",a.settingTemplateFile=e,e="hasSettingUIFile";else if("settingI18n"===b)e=a.amdFolder+"setting/nls/strings.js",a.settingI18nFile=a.isRemote?e:a.amdFolder+"setting/nls/strings",e="hasSettingLocale";else if("settingStyle"===b)e=a.amdFolder+"setting/css/style.css",a.settingStyleFile=e,e="hasSettingStyle";
else return c;a[e]?d.apply(this):c.resolve(null);return c},_replaceId:function(a){return a.replace(/\//g,"_").replace(/\./g,"_")},_onDestroyWidget:function(a){"closed"!==a.state&&this.closeWidget(a);this._removeWidget(a);this.emit("widget-destroyed",a.id);m.publish("widgetDestroyed",a.id);console.log("destroy widget ["+a.uri+"].")},_onDestroyWidgetSetting:function(a){this.removeWidgetSettingStyle(a)},_removeWidget:function(a){if("string"===typeof a&&(a=this.getWidgetById(a),!a))return;this.activeWidget&&
this.activeWidget.id===a.id&&(this.activeWidget=null);this._remove(a.id);0===this.getWidgetsByName(a.name).length&&this.removeWidgetStyle(a)},_getActiveEventName:function(){var a="PointerEvent"in window?"pointer":"MSPointerEvent"in window?"MSPointer":!1,b=a&&"MS"===a.slice(0,2);return a?a+(b?"Down":"down"):"mousedown"}});B.getInstance=function(a){null===w&&(w=new B(a),window._widgetManager=w);return w};return B});