// 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/lang dojo/_base/array dojo/_base/html dojox/html/entities jimu/utils ./ItemNode libs/storejs/store jimu/LayerInfos/LayerInfos".split(" "),function(k,g,r,t,n,p,l,q){var h={_uID:0,getUID:function(){return h._uID++},findBookMark:function(a,c){var b=-1,d=null;g.some(c,function(e,f){if(parseInt(e._uID,10)===parseInt(a._uID,10))return b=f,d=e,!0},this);return-1!==b?{bookmark:d,idx:b}:null},findBookMarkByUID:function(a,c){var b=-1,d=null;g.some(c,function(e,f){if(parseInt(e._uID,10)===
parseInt(a,10))return b=f,d=e,!0},this);return-1!==b?{bookmark:d,idx:b}:null},findNextBookMarkByIdx:function(a,c){var b=null;a+1<=c.length-1&&(b=c[a+1]);return b},findBookMarkByNameAndExtent:function(a,c){var b=-1,d=null;g.some(c,function(e,f){if(e.name===a.name&&e.extent&&a.extent&&e.extent.xmax===a.extent.xmax&&e.extent.xmin===a.extent.xmin&&e.extent.ymax===a.extent.ymax&&e.extent.ymin===a.extent.ymin)return b=f,d=e,!0},this);return-1!==b?{bookmark:d,idx:b}:null},isBookmarksDataEmpty:function(a){return Array.isArray(a)&&
0===a.length?!0:!1},empty:function(a,c){var b=a;g.forEach(a,function(d){d&&d.itemNode&&d.itemNode.destroy()},this);a=[];a=b;c&&r.empty(c)},createBookMarkNode:function(a,c,b,d,e){b=a.thumbnail||"undefined"!==typeof a.thumbnail&&""!==a.thumbnail?n.processUrlInWidgetConfig(a.thumbnail,b):n.processUrlInWidgetConfig("images/thumbnail_default.png",b);var f=h.getUID();a._uID=f;return new p({dataId:f,img:b,label:a.displayName||a.name,display:d,nls:c,a11y:e})},cloneBookmarksDataWithOutDom:function(a){var c=
[];if("undefined"===typeof a)return c;a.forEach(k.hitch(this,function(b){b.itemNode&&b.itemNode.domNode&&(b=k.clone(b),delete b.itemNode,c.push(b))}));return c},readBookmarksInWebmap:function(a){var c=[];if(!a.itemInfo||!a.itemInfo.itemData||!a.itemInfo.itemData.bookmarks)return c;g.forEach(a.itemInfo.itemData.bookmarks,function(b){b=k.mixin({},b);b.isInWebmap=!0;b.name=t.decode(b.name);c.push(b)},this);return c},filterBookmarkFromTarget:function(a,c){for(var b=[],d=0,e=a.length;d<e;d++){var f=a[d];
h.findBookmarkByNameOrExtent(f,c)||b.push(f)}return b},findBookmarkByNameOrExtent:function(a,c){var b=-1,d=null;g.some(c,function(e,f){if((e.displayName||e.name)===(a.displayName||a.name)||e.extent&&a.extent&&e.extent.xmax===a.extent.xmax&&e.extent.xmin===a.extent.xmin&&e.extent.ymax===a.extent.ymax&&e.extent.ymin===a.extent.ymin)return b=f,d=e,!0},this);return-1!==b?{bookmark:d,idx:b}:null},filter:function(a,c){c.forEach(function(b){"undefined"!==typeof a&&""!==a?-1!==(b.displayName||b.name).indexOf(a)?
p.show(b):p.hide(b):p.show(b)})},getKeysKey:function(){return this.appConfig.map["3D"]?this.name+".3D":this.name+".2D"},getAutoRenameBeforeAdd:function(a,c,b){var d=0,e=new RegExp(/\((\d+)\){1}$/g);g.forEach(c,function(f){f&&"undefined"!==typeof f.name&&-1!==f.name.indexOf(a)&&("undefined"===typeof b||!0===b&&a.length===f.name.length)&&(f=e.exec(f.displayName),null===f&&0===d?d=1:f&&"undefined"!==typeof f[1]&&f[1]>=d&&(d=parseInt(f[1],10)+1))});return 0===d?a:a+"("+d+")"},processDuplicateName:function(a){for(var c=
[],b={},d=a.length-1;0<=d;d--){var e=a[d];if(!e||"undefined"===typeof e.name)return;var f=e.name;f in b?b[f]++:b[f]=0;if(0<b[f]){var m=f+"("+b[f]+")";m in b?(b[m]++,b[f]++):b[m]=0;e.displayName=0<b[m]?f+"("+b[f]+")":m;e._autoRename=!0}else e.displayName=f;c.push(e)}a=c},toogleCheckboxChecked:function(a){a&&a.setValue&&a.setValue(!a.checked)},setCheckboxWithoutEvent:function(a,c){a&&a.check&&a.uncheck&&(!0===c?a.check(!0):a.uncheck(!0))},layerInfosRestoreState:function(a,c){var b=q.getInstanceSync(),
d={};if(c&&a){for(var e in c)if(c.hasOwnProperty(e)){a=c[e];var f=!1;f="undefined"===typeof a.visible?a.selected:a.visible;d[e]={visible:f}}b.restoreState({layerOptions:d})}},getlayerInfos:function(){var a={},c=q.getInstanceSync();c&&c.traversal&&c.traversal(k.hitch(this,function(b){a[b.id]={visible:b.isVisible()}}));return a},isWithLayerInfos:function(a){return a.layerOptions&&!1!==a.isSaveLayers?!0:!1},stringifyBookmarks:function(a){var c=[];g.forEach(a,function(b){b=k.mixin({},b);b.itemNode&&delete b.itemNode;
c.push(b)},this);return c},parseBookmarks:function(a){return k.clone(a)},getKey:function(a){return"Bookmark.2D."+encodeURIComponent(n.getAppIdFromUrl())+"."+a},isConfigBefore5_3:function(a){return"undefined"===typeof a.syncMode||!0===a.needToUpdateFlag?!0:!1},getUpdateCacheKey:function(a){return"bookmark_cache_updated_"+encodeURIComponent(h.getKey(a))},setUpdateCacheKey:function(a){l.set(h.getUpdateCacheKey(a),!0)},isCacheKeyUpdatedy:function(a){return l.get(h.getUpdateCacheKey(a))},setDefaultConfigForUpdate:function(a){a.needToUpdateFlag=
!0;a.layout={cards:!0,list:!1,defaultMode:"cards"};a.editable=!0;Array.isArray(a.bookmarks2D)&&0<a.bookmarks2D.length?a.syncMode={webmap:!1,custom:!0}:a.syncMode={webmap:!0,custom:!0}},completeUpdateConfig:function(a){a.needToUpdateFlag&&delete a.needToUpdateFlag},updateBookmarks:function(a){for(var c=0;c<a.length;c++)"undefined"===typeof a[c]&&(a.splice(c,1),c--);var b=/\/widgets\/Bookmark\/images\/thumbnail_default.png$/;g.forEach(a,function(d){"undefined"===typeof d.isSaveExtent&&(d.isSaveExtent=
!0);d.thumbnail&&b.test(d.thumbnail)&&delete d.thumbnail},this)},getLayoutRecorderKey:function(){return"bookMarkLayout_"+encodeURIComponent(n.getAppIdFromUrl())},cleanLayoutRecorder:function(a){l.remove(h.getLayoutRecorderKey(a))},setLastLayout:function(a){l.set(h.getLayoutRecorderKey(),a)},getLastLayout:function(){return l.get(h.getLayoutRecorderKey())},oldBookmarksBackup:'[{"displayName":"Greater Manchester or Greater Lincolnshire HAHAHAHA","name":"Greater Manchester or Greater Lincolnshire HAHAHAHA","extent":{"type":"extent","xmin":8997982.70263581,"ymin":2110475.6293307655,"xmax":14672667.682525788,"ymax":6024051.4775307495,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"Peterborough and Cambridgeshire HEHEHEHEHEH","name":"Peterborough and Cambridgeshire HEHEHEHEHEH","extent":{"type":"extent","xmin":9055621.33977054,"ymin":445965.34674161975,"xmax":14730306.319660518,"ymax":4359541.194941604,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"mentougou biejing china","name":"mentougou biejing china","extent":{"type":"extent","xmin":9502343.119353313,"ymin":3151483.465165457,"xmax":15177028.09924329,"ymax":7065059.313365442,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"\u51e4\u51f0\u7f6e\u5730\u4e09\u5143\u6865\u5317\u4eac\u4e2d\u56fd\u4e16\u754c\u592a\u9633\u7cfb\u5b87\u5b99","name":"\u51e4\u51f0\u7f6e\u5730\u4e09\u5143\u6865\u5317\u4eac\u4e2d\u56fd\u4e16\u754c\u592a\u9633\u7cfb\u5b87\u5b99","extent":{"type":"extent","xmin":-22698739.91955998,"ymin":-13654303.392799985,"xmax":22698739.91955998,"ymax":17654303.39279999,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"\u77ed\u4e2d\u6587","name":"\u77ed\u4e2d\u6587","extent":{"type":"extent","xmin":-22698739.91955998,"ymin":-13654303.392799985,"xmax":22698739.91955998,"ymax":17654303.39279999,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"short","name":"short","extent":{"type":"extent","xmin":-22698739.91955998,"ymin":-13654303.392799985,"xmax":22698739.91955998,"ymax":17654303.39279999,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"\u4e2d\u6587 English","name":"\u4e2d\u6587 English","extent":{"type":"extent","xmin":-22698739.91955998,"ymin":-13654303.392799985,"xmax":22698739.91955998,"ymax":17654303.39279999,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"Underneath the icons","name":"Underneath the icons","extent":{"type":"extent","xmin":-22698739.91955998,"ymin":-13654303.392799985,"xmax":22698739.91955998,"ymax":17654303.39279999,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"\u4e2d\u6587\u4e2d\u6587 \u5475\u5475","name":"\u4e2d\u6587\u4e2d\u6587 \u5475\u5475","extent":{"type":"extent","xmin":-22698739.91955998,"ymin":-13654303.392799985,"xmax":22698739.91955998,"ymax":17654303.39279999,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false},{"displayName":"eee RTL","name":"eee RTL","extent":{"type":"extent","xmin":-22698739.91955998,"ymin":-13654303.392799985,"xmax":22698739.91955998,"ymax":17654303.39279999,"spatialReference":{"wkid":102100}},"thumbnail":"","isInWebmap":false}]',
_testUpdateOldConfig:function(){return{bookmarks2D:[{extent:{spatialReference:{wkid:102100},xmax:-1656069.6628128502,xmin:-1.0861390956860503E7,ymax:1.510258315961978E7,ymin:-1119447.7364922247},name:"bm1",isInWebmap:!0,displayName:"bm1"},{extent:{spatialReference:{wkid:102100},xmax:-1656069.6628128502,xmin:-1.0861390956860503E7,ymax:1.510258315961978E7,ymin:-1119447.7364922247},name:"bm1",isInWebmap:!0,displayName:"bm1(1)"},{extent:{spatialReference:{wkid:102100},xmax:-3197863.7584074493,xmin:-1.3112899816301128E7,
ymax:1.1466459916526379E7,ymin:-4859686.568575533},name:"bm2",isInWebmap:!0,displayName:"bm2"},{extent:{spatialReference:{wkid:102100},xmax:-3767577.3201611056,xmin:-1.430429896767071E7,ymax:1.5120033300894285E7,ymin:-4622246.062418217},name:"Untitled",isInWebmap:!0,displayName:"Untitled"},{extent:{spatialReference:{wkid:102100},xmax:-4334684.982862408,xmin:-1.6556089386187213E7,ymax:1.6750523655935397E7,ymin:-5666212.383958025},name:"Untitled",isInWebmap:!0,displayName:"Untitled(1)"}],bookmarks3D:[],
flyTime:3E3}},_testSetOldCache:function(a){var c=[];g.forEach(a,function(b){var d="Bookmark.2D."+b.displayName;c.push(d);b=k.mixin({},b);b.itemNode&&delete b.itemNode;b._uID&&delete b._uID;try{l.set(d,b)}catch(e){alert("store error\x3d\x3d\x3e")}},this);l.set("Bookmark.2D",c)},_testSetOldCacheBookmark:function(){return JSON.parse('[{"extent":{"spatialReference":{"wkid":102100,"latestWkid":3857},"xmax":-8273877.24778316,"xmin":-14295892.084200885,"ymax":6466269.8495007465,"ymin":2983187.344602761},"name":"bm1","isInWebmap":true,"displayName":"bm1"},{"extent":{"spatialReference":{"wkid":102100,"latestWkid":3857},"xmax":-8004818.908219411,"xmin":-11015826.326428276,"ymax":5527011.645932751,"ymin":3785470.393483758},"name":"bm1","isInWebmap":true,"displayName":"bm1(1)"},{"extent":{"spatialReference":{"wkid":102100,"latestWkid":3857},"xmax":-12874774.854323175,"xmin":-13627526.708875552,"ymax":4655629.523482032,"ymin":4220244.210369689},"name":"bm2","isInWebmap":true,"displayName":"bm2"},{"extent":{"spatialReference":{"wkid":102100,"latestWkid":3857},"xmax":-11618761.605541585,"xmin":-14629769.023750449,"ymax":6691911.956998556,"ymin":4950370.704549563},"name":"bm3","isInWebmap":true,"displayName":"bm3"},{"extent":{"spatialReference":{"wkid":102100,"latestWkid":3857},"xmax":-4317189.3003047705,"xmin":-16361218.973140221,"ymax":10449906.504800193,"ymin":3483741.495004222},"name":"bm4","isInWebmap":true,"displayName":"bm4"},{"name":"add-inRT-1","displayName":"add-inRT-1","extent":{"xmin":-14714155.502977258,"ymin":2694561.125798012,"xmax":-7855613.8290067855,"ymax":6754896.068305495,"spatialReference":{"wkid":102100,"latestWkid":3857}}},{"name":"add-inRT-2","displayName":"add-inRT-2","extent":{"xmin":-14714155.502977258,"ymin":2694561.125798012,"xmax":-7855613.8290067855,"ymax":6754896.068305495,"spatialReference":{"wkid":102100,"latestWkid":3857}}}]')}};
return h});