// 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
require({cache:{"url:widgets/BasemapGallery/BasemapItem.html":'\x3cdiv class\x3d\'basemap-item\'\x3e\r\n  \x3cdiv data-dojo-attach-point\x3d"bgElement" class\x3d\'bg\'\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"thumbnailElement" class\x3d\'bg__thumbnail\'\x3e\x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"deleteIcon" class\x3d\'bg__delete-icon\'\x3e\x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"editIcon" class\x3d\'bg__detail-icon\'\x3e\x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"selectIcon" class\x3d\'bg__selected-icon\'\x3e\x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"warnElement" class\x3d"bg__warning-icon"\r\n    style\x3d"display:none;" title\x3d"${nls.invalidBasemapUrl2}"\x3e\x3c/div\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv data-dojo-attach-point\x3d"titleElement" class\x3d\'basemap-item__title jimu-ellipsis\'\x3e\x3c/div\x3e\r\n\x3c/div\x3e'}});
define("dojo/_base/declare dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/text!./BasemapItem.html dojo/Evented dojo/_base/lang dojo/_base/html dojo/on esri/SpatialReference jimu/utils ./utils".split(" "),function(b,k,l,m,n,p,c,a,e,q,f,r){b=b([k,l,m,p],{basemap:null,folderUrl:null,nls:null,templateString:n,mode:0,_promise:null,_loaded:!1,postCreate:function(){this.inherited(arguments);this.basemap&&(this._createItem(),this._loaded=!0);1===this.mode?a.addClass(this.domNode,
"edit-mode"):2===this.mode&&a.addClass(this.domNode,"select-mode")},toggleSelect:function(){this._loaded&&a.toggleClass(this.domNode,"selected")},isSelected:function(){return a.hasClass(this.domNode,"selected")},updateItem:function(g){this.basemap=g;a.setStyle(this.thumbnailElement,"backgroundImage","url("+this.basemap.thumbnailUrl+")");this.titleElement.title=f.stripHTML(this.basemap.title);this.titleElement.innerHTML=this.titleElement.title},_createItem:function(){this.own(e(this.deleteIcon,"click",
c.hitch(this,function(){this.emit("delete",this)})));this.own(e(this.editIcon,"click",c.hitch(this,function(){this.emit("edit",this)})));2===this.mode?this.own(e(this.domNode,"click",c.hitch(this,function(){this.toggleSelect();this.emit("selected",this.isSelected())}))):this.own(e(this.selectIcon,"click",c.hitch(this,function(){this.toggleSelect();this.emit("selected",this.isSelected())})));var g=this.folderUrl+"images/default.jpg";if(/data:image/.test(this.basemap.thumbnailUrl))a.setStyle(this.thumbnailElement,
"backgroundImage","url("+this.basemap.thumbnailUrl+")");else{if(this.basemap.thumbnailUrl)if(0===this.basemap.thumbnailUrl.indexOf("//")){var d=this.basemap.thumbnailUrl;0===this.mode&&(d+=r.getToken(this.appConfig.portalUrl))}else d=f.processUrlInWidgetConfig(this.basemap.thumbnailUrl,this.folderUrl);else this.basemap.thumbnailUrl=g,d=this.basemap.thumbnailUrl;0!==this.mode?f.getBase64Data(d).then(c.hitch(this,function(h){this.basemap.thumbnailUrl=h?h:g;a.setStyle(this.thumbnailElement,"backgroundImage",
"url("+this.basemap.thumbnailUrl+")")})):a.setStyle(this.thumbnailElement,"backgroundImage","url("+d+")")}this.titleElement.title=f.stripHTML(this.basemap.title);this.titleElement.innerHTML=this.titleElement.title;this.spatialReference.equals(new q(+this.basemap.spatialReference.wkid))||(a.setStyle(this.thumbnailElement,"border","1px solid red"),a.setStyle(this.warnElement,"display",""))}});b.MODE_READONLY=0;b.MODE_EDIT=1;b.MODE_SELECT=2;return b});