(function(){"use strict";var e=['<div class="u8-visitplanninglegend">','<div class="u8-visitplanninglegend-legenditems">',"{{each pins}}",'<div class="u8-visitplanninglegend-legenditem">','<div class="u8-visitplanninglegend-image">{{Image({ source: image, isSprite: false })}}</div>',"{{Label({ text: label })}}","</div>","{{/each}}","{{if infoAreas.length > 0}}","<hr />","{{/if}}","{{each infoAreas}}",'<div class="u8-visitplanninglegend-legenditem">','<div class="u8-visitplanninglegend-image">{{Image({ source: image, decorator: "s" })}}</div>',"{{Label({ text: label })}}","</div>","{{/each}}","</div>","</div>"].join("");u8.Crm.Widgets.VisitPlanningLegend=function(e,i){this.Widget(e,$.extend({},u8.Crm.Widgets.VisitPlanningLegend.defaults,i));this._isCreated=false;this._create()};u8.Crm.Widgets.VisitPlanningLegend.makeClass({name:"VisitPlanningLegend",deriveFrom:u8.Base.Widgets.Widget,events:["Create"]});u8.Crm.Widgets.VisitPlanningLegend.defaults={};$.extend(u8.Crm.Widgets.VisitPlanningLegend.prototype,{_create:function(){this._createViewModel();var e=this;this._createView(function(){u8.tools.createdWhenReady(e)})},_createViewModel:function(){var e=new u8.Base.Geolocation.MapTheme,n=u8.services.schema;var t=[{label:"TXT_VisitPlanning_34",image:e.getType("route-intermediate").image},{label:"TXT_VisitPlanning_36",image:e.getType("pin-visit").image},{label:"TXT_VisitPlanning_37",image:e.getType("pin-visit-inactive").image},{label:"TXT_VisitPlanning_35",image:e.getType("pin").image}];var a=(this.model.customerInfoAreas||[]).map(function(e){var t=n.getInfoArea(e.infoAreaId);return{label:t.labelPlural,image:i(e.infoAreaId)}});this._viewModel={pins:t,infoAreas:a}},_createView:function(i){this.$(this.element).utml({template:e,itemOptions:{parent:this},data:this._viewModel},i)}});u8.Crm.Widgets.VisitPlanningLegend.openInPopup=function(e,i){if(!e){e={}}var n=$.extend({title:$t("TXT_VisitPlanning_33"),sizing:"fit",position:"center-top",modal:true,autoClose:true},e.popupOptions);var t=e.widgetOptions||{};u8.Base.Widgets.Popup.openWidgetPopup({type:"VisitPlanningLegend",popupOptions:n,widgetOptions:t},i)};function i(e){var i="INFOAREA_"+e.toUpperCase();if(i in u8.session.images){return i}return"u8-img-infoarea-"+e.toLowerCase()}})();