// 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/Evented dojo/on dojo/_base/lang dojo/_base/html jimu/dijit/Popup jimu/dijit/DataSource jimu/dijit/LoadingIndicator esri/request".split(" "),function(f,g,e,c,h,k,l,m,n){return f([k,g],{width:830,height:560,titleLabel:window.jimuNls.frameworkDatasource.setDataSource,dijitArgs:null,postCreate:function(){this.inherited(arguments);h.addClass(this.domNode,"jimu-dijit-data-source-popup");this._initFls();this._initLoading()},_initFls:function(){this.sourceDijit=new l(this.dijitArgs);
this.sourceDijit.placeAt(this.contentContainerNode);this.sourceDijit.startup();this.own(e(this.sourceDijit,"ok",c.hitch(this,function(d){if(0!==d.length){var a=d[0];if(a.definition)try{a.definition.name=a.name,a.definition.url=a.url,this.emit("ok",a)}catch(b){console.error(b)}else a.url?(this.loading.show(),n({url:a.url,content:{f:"json"},handleAs:"json",callbackParamName:"callback"}).then(c.hitch(this,function(b){if(this.domNode){this.loading.hide();a.definition=b;try{a.definition.name=a.name,a.definition.url=
a.url,this.emit("ok",a)}catch(p){console.error(p)}}}),c.hitch(this,function(b){console.error(b);this.domNode&&this.loading.hide()}))):this.emit("ok",a)}})));this.own(e(this.sourceDijit,"cancel",c.hitch(this,function(){try{this.emit("cancel")}catch(d){console.error(d)}})))},_initLoading:function(){this.loading=new m({hidden:!0});this.loading.placeAt(this.domNode);this.loading.startup()}})});