// 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/Evented dojo/_base/declare dojo/_base/lang dojo/_base/html dojo/_base/array dojo/on esri/SpatialReference jimu/BaseWidget dijit/_TemplatedMixin ./utils libs/Sortable".split(" "),function(k,l,e,f,g,m,h,n,p,c,q){return l([n,p,k],{baseClass:"dojoDndSource dojoDndTarget dojoDndContainer bookmarker-nodes",templateString:"\x3cdiv\x3e\x3c/div\x3e",nls:null,postCreate:function(){this.inherited(arguments);this.drawerHandle=f.create("div",{"class":"drawer-handle"},this.domNode);this.bookMarkerContainer=
f.create("div",{"class":"webmap"},this.domNode)},startup:function(){this.inherited(arguments);this.config.syncMode&&(!1===this.config.syncMode.webmap&&!1===this.config.syncMode.custom?f.addClass(this.domNode,"hide"):f.removeClass(this.domNode,"hide"));this.sortableBookMarkerNodes=q.create(this.bookMarkerContainer,{sort:!1,disabled:!0,animation:100})},refresh:function(){c.empty(this.bookmarks);this.bookmarks=[];this.config.syncMode&&!0===this.config.syncMode.webmap&&(this.bookmarks=c.readBookmarksInWebmap(this.map));
var b=e.clone(this.config.bookmarks2D);g.forEach(b,function(a){a&&!0===this.config.syncMode.custom&&this.bookmarks.push(a)},this);c.updateBookmarks(this.bookmarks);this.displayBookmarks(this.bookmarks)},_onBookmarkClick:function(b){require(["esri/geometry/Extent"],e.hitch(this,function(a){if(!1!==b.isSaveExtent){var d=b.extent;d.spatialReference?new h(d.spatialReference):new h({wkid:4326});this.map.setExtent(new a(d))}c.layerInfosRestoreState(b.isSaveLayers,b.layerOptions)}))},filter:function(b){c.filter(b,
this.bookmarks)},displayBookmarks:function(b){c.empty(b,this.bookMarkerContainer);g.forEach(b,function(a){if(a){var d={editBtn:!1,changeImgBtn:!0,layerInfosIcon:c.isWithLayerInfos(a)};d=c.createBookMarkNode(a,this.nls,this.folderUrl,d,{editBtn:!1,deleteBtn:!1,renameBtn:!1,changeImgBtn:!1});a.itemNode=d;this.own(m(d,"thumbnail-click",e.hitch(this,e.partial(this._onBookmarkClick,a))))}},this);b.forEach(e.hitch(this,function(a){a&&a.itemNode&&a.itemNode.domNode&&f.place(a.itemNode.domNode,this.bookMarkerContainer,
"last")}))}})});