text: /*! angular-dashboard-framework 0.7.0 (2015-02-27) */
  "use strict";angular.module("adf",["adf.provider","ui.bootstrap","ui.sortable"]).value("adfTemplatePath","../src/templates/").value("rowTemplate",'<adf-dashboard-row row="row" collapsible="collapsible" ng-repeat="row in column.rows" edit-mode="editMode" sortable-options="sortableOptions"></adf-dashboard-row>').value("columnTemplate",'<adf-dashboard-column column="column" collapsible="collapsible" ng-repeat="column in row.columns" edit-mode="editMode" sortable-options="sortableOptions"></adf-dashboard-column>').value("adfVersion","0.7.0"),angular.module("adf").directive("adfDashboardColumn",["$compile","adfTemplatePath","rowTemplate",function(a,b,c){return{restrict:"E",replace:!0,scope:{column:"=",editMode:"=",sortableOptions:"=",collapsible:"="},templateUrl:b+"dashboard-column.html",link:function(b,d){angular.isDefined(b.column.rows)&&angular.isArray(b.column.rows)&&a(c)(b,function(a){d.append(a)})}}}]),angular.module("adf").directive("adfDashboard",["$rootScope","$log","$modal","dashboard","adfTemplatePath",function(a,b,c,d,e){function f(a,b){if(a.widgets&&a.widgets.length>0)for(var c=a.widgets.shift();c;)b.widgets.push(c),c=a.widgets.shift()}function g(a,b,c){return c=c||0,angular.isDefined(a.rows)&&angular.forEach(a.rows,function(a){angular.forEach(a.columns,function(a){a.widgets||(a.widgets=[]),angular.isDefined(b[c])&&(angular.isDefined(a.rows)||(f(b[c],a),c++)),c=g(a,b,c)})}),c}function h(a,b){return b=b||[],angular.isDefined(a.rows)&&angular.forEach(a.rows,function(a){angular.forEach(a.columns,function(a){b.push(a),h(a,b)})}),b}function i(a,b){var c=h(a),d=0;for(a.rows=angular.copy(b.rows);d<c.length;)d=g(a,c,d)}function j(a){var b={},c=d.widgets[a].config;return c&&(b=angular.copy(c)),b}return{replace:!0,restrict:"EA",transclude:!1,scope:{structure:"@",name:"@",collapsible:"@",editable:"@",adfModel:"=",adfWidgetFilter:"="},controller:["$scope",function(f){f.sortableOptions={connectWith:".column",handle:".glyphicon-move",cursor:"move",tolerance:"pointer",placeholder:"placeholder",forcePlaceholderSize:!0,opacity:.4};var g={},h={},k={},l={},m=f.name;f.$watch("adfModel",function(a,c){null!==c&&(g=f.adfModel,k=f.adfWidgetFilter,g&&g.rows||(l=f.structure,h=d.structures[l],h?(g?g.rows=angular.copy(h).rows:g=angular.copy(h),g.structure=l):b.error("could not find structure "+l)),g?(g.title||(g.title="Dashboard"),f.model=g):b.error("could not find or create model"))},!0),f.editMode=!1,f.editClass="",f.toggleEditMode=function(){f.editMode=!f.editMode,f.editMode&&(f.modelCopy=angular.copy(f.adfModel,{})),f.editMode||a.$broadcast("adfDashboardChanged",m,g)},f.cancelEditMode=function(){f.editMode=!1,f.modelCopy=angular.copy(f.modelCopy,f.adfModel)},f.editDashboardDialog=function(){var a=f.$new();a.copy={title:g.title},a.structures=d.structures;var h=c.open({scope:a,templateUrl:e+"dashboard-edit.html"});f.changeStructure=function(a,c){b.info("change structure to "+a),i(g,c)},a.closeDialog=function(){g.title=a.copy.title,h.close(),a.$destroy()}},f.addWidgetDialog=function(){var a,b=f.$new();angular.isFunction(k)?(a={},angular.forEach(d.widgets,function(b,c){k(b,c)&&(a[c]=b)})):a=d.widgets,b.widgets=a;var g={scope:b,templateUrl:e+"widget-add.html"},h=c.open(g);b.addWidget=function(a){var c={type:a,config:j(a)};b.model.rows[0].columns[0].widgets.unshift(c),h.close(),b.$destroy()},b.closeDialog=function(){h.close(),b.$destroy()}}}],compile:function(a,b){angular.isDefined(b.editable)||(b.editable=!0)},link:function(a,b,c){a.name=c.name,a.structure=c.structure,a.editable=c.editable},templateUrl:e+"dashboard.html"}}]),angular.module("adf.provider",[]).provider("dashboard",function(){var a={},b="",c={},d='<div class="alert alert-danger">{}</div>',e='      <div class="progress progress-striped active">\n        <div class="progress-bar" role="progressbar" style="width: 100%">\n          <span class="sr-only">loading ...</span>\n        </div>\n      </div>';this.widget=function(b,c){var d=angular.extend({reload:!1},c);if(d.edit){var e={reload:!0};angular.extend(e,d.edit),d.edit=e}return a[b]=d,this},this.widgetsPath=function(a){return b=a,this},this.structure=function(a,b){return c[a]=b,this},this.messageTemplate=function(a){return d=a,this},this.loadingTemplate=function(a){return e=a,this},this.$get=function(){return{widgets:a,widgetsPath:b,structures:c,messageTemplate:d,loadingTemplate:e}}}),angular.module("adf").directive("adfDashboardRow",["$compile","adfTemplatePath","columnTemplate",function(a,b,c){return{restrict:"E",replace:!0,scope:{row:"=",editMode:"=",sortableOptions:"=",collapsible:"="},templateUrl:b+"dashboard-row.html",link:function(b,d){angular.isDefined(b.row.columns)&&angular.isArray(b.row.columns)&&a(c)(b,function(a){d.append(a)})}}}]),angular.module("adf").directive("adfWidgetContent",["$log","$q","$sce","$http","$templateCache","$compile","$controller","$injector","dashboard",function(a,b,c,d,e,f,g,h,i){function j(a){return a.replace("{widgetsPath}",i.widgetsPath)}function k(a){var f=b.defer();if(a.template)f.resolve(a.template);else if(a.templateUrl){var g=e.get(a.templateUrl);if(g)f.resolve(g);else{var h=c.getTrustedResourceUrl(j(a.templateUrl));d.get(h).success(function(b){e.put(a.templateUrl,b),f.resolve(b)}).error(function(){f.reject("could not load template")})}}return f.promise}function l(c,d,e){var j=c.model,l=c.content;d.html(i.loadingTemplate);var m=c.$new();j.config||(j.config={}),m.config=j.config;var n={$scope:m,widget:j,config:j.config},o={};return o.$tpl=k(l),l.resolve&&angular.forEach(l.resolve,function(a,b){o[b]=angular.isString(a)?h.get(a):h.invoke(a,a,n)}),b.all(o).then(function(a){angular.extend(a,n);var b=a.$tpl;if(d.html(b),l.controller){var c=g(l.controller,a);l.controllerAs&&(m[l.controllerAs]=c),d.children().data("$ngControllerController",c)}f(d.contents())(m)},function(b){var c="Could not resolve all promises";b&&(c+=": "+b),a.warn(c),d.html(i.messageTemplate.replace(/{}/g,c))}),e&&e.$destroy(),m}return{replace:!0,restrict:"EA",transclude:!1,scope:{model:"=",content:"="},link:function(a,b){var c=l(a,b,null);a.$on("widgetConfigChanged",function(){c=l(a,b,c)}),a.$on("widgetReload",function(){c=l(a,b,c)})}}}]),angular.module("adf").directive("adfWidget",["$log","$modal","dashboard","adfTemplatePath",function(a,b,c,d){function e(a){switch(angular.isDefined(a)?a.toLowerCase():null){case"true":case"yes":case"1":return!0;case"false":case"no":case"0":case null:return!1;default:return Boolean(a)}}function f(b){var d=b.definition;if(d){var f=c.widgets[d.type];if(f){d.title||(d.title=f.title),b.editMode=b.editMode,b.widget=angular.copy(f);var g=d.config;g?angular.isString(g)&&(g=angular.fromJson(g)):g={},b.config=g,b.collapsible=e(b.collapsible),b.isCollapsed=!1}else a.warn("could not find widget "+d.type)}else a.debug("definition not specified, widget was probably removed")}function g(c,e){var f=c.definition;f?(c.close=function(){var a=c.col;if(a){var b=a.widgets.indexOf(f);b>=0&&a.widgets.splice(b,1)}e.remove()},c.reload=function(){c.$broadcast("widgetReload")},c.edit=function(){var a=c.$new(),e={scope:a,templateUrl:d+"widget-edit.html"},f=b.open(e);a.closeDialog=function(){f.close(),a.$destroy();var b=c.widget;b.edit&&b.edit.reload&&c.$broadcast("widgetConfigChanged")}}):a.debug("widget not found")}return{replace:!0,restrict:"EA",transclude:!1,templateUrl:d+"widget.html",scope:{definition:"=",col:"=column",editMode:"=",collapsible:"="},compile:function(){return{pre:f,post:g}}}}]),angular.module("adf").run(["$templateCache",function(a){a.put("../src/templates/dashboard-column.html",'<div class="column" ng-class="column.styleClass" ui-sortable="sortableOptions" ng-model="column.widgets"><div class="widgets" ng-repeat="definition in column.widgets"><adf-widget definition="definition" column="column" edit-mode="editMode" collapsible="collapsible"></div></div>'),a.put("../src/templates/dashboard-edit.html",'<div class="modal-header"><button type="button" class="close" ng-click="closeDialog()" aria-hidden="true">&times;</button><h4 class="modal-title">Edit Dashboard</h4></div><div class="modal-body"><form role="form"><div class="form-group"><label for="dashboardTitle">Title</label><input type="text" class="form-control" id="dashboardTitle" ng-model="copy.title" required></div><div class="form-group"><label>Structure</label><div class="radio" ng-repeat="(key, structure) in structures"><label><input type="radio" value="{{key}}" ng-model="model.structure" ng-change="changeStructure(key, structure)"> {{key}}</label></div></div></form></div><div class="modal-footer"><button type="button" class="btn btn-primary" ng-click="closeDialog()">Close</button></div>'),a.put("../src/templates/dashboard-row.html",'<div class="row" ng-class="row.styleClass"></div>'),a.put("../src/templates/dashboard.html",'<div class="dashboard-container"><h1>{{model.title}} <span style="font-size: 16px" class="pull-right"><a href="" ng-if="editMode" title="add new widget" ng-click="addWidgetDialog()"><i class="glyphicon glyphicon-plus-sign"></i></a> <a href="" ng-if="editMode" title="edit dashboard" ng-click="editDashboardDialog()"><i class="glyphicon glyphicon-cog"></i></a> <a href="" ng-if="editable" title="{{editMode ? \'save changes\' : \'enable edit mode\'}}" ng-click="toggleEditMode()"><i class="glyphicon" x-ng-class="{\'glyphicon-edit\' : !editMode, \'glyphicon-save\' : editMode}"></i></a> <a href="" ng-if="editMode" title="undo changes" ng-click="cancelEditMode()"><i class="glyphicon glyphicon-repeat adf-flip"></i></a></span></h1><div class="dashboard" x-ng-class="{\'edit\' : editMode}"><adf-dashboard-row row="row" collapsible="collapsible" ng-repeat="row in model.rows" edit-mode="editMode" sortable-options="sortableOptions"></adf-dashboard-row></div></div>'),a.put("../src/templates/widget-add.html",'<div class="modal-header"><button type="button" class="close" ng-click="closeDialog()" aria-hidden="true">&times;</button><h4 class="modal-title">Add new widget</h4></div><div class="modal-body"><div style="display: inline-block"><dl class="dl-horizontal"><dt ng-repeat-start="(key, widget) in widgets"><a href="" ng-click="addWidget(key)">{{widget.title}}</a></dt><dd ng-repeat-end ng-if="widget.description">{{widget.description}}</dd></dl></div></div><div class="modal-footer"><button type="button" class="btn btn-primary" ng-click="closeDialog()">Close</button></div>'),a.put("../src/templates/widget-edit.html",'<div class="modal-header"><button type="button" class="close" ng-click="closeDialog()" aria-hidden="true">&times;</button><h4 class="modal-title">{{widget.title}}</h4></div><div class="modal-body"><form role="form"><div class="form-group"><label for="widgetTitle">Title</label><input type="text" class="form-control" id="widgetTitle" ng-model="definition.title" placeholder="Enter title" required></div></form><div ng-if="widget.edit"><adf-widget-content model="definition" content="widget.edit"></div></div><div class="modal-footer"><button type="button" class="btn btn-primary" ng-click="closeDialog()">Close</button></div>'),a.put("../src/templates/widget.html",'<div class="widget panel panel-default"><div class="panel-heading clearfix"><h3 class="panel-title">{{definition.title}} <span class="pull-right"><a href="" title="reload widget content" ng-if="widget.reload" ng-click="reload()"><i class="glyphicon glyphicon-refresh"></i></a> <a href="" title="change widget location" ng-if="editMode"><i class="glyphicon glyphicon-move"></i></a> <a href="" title="collapse widget" ng-show="collapsible && !isCollapsed" ng-click="isCollapsed = !isCollapsed"><i class="glyphicon glyphicon-minus"></i></a> <a href="" title="expand widget" ng-show="collapsible && isCollapsed" ng-click="isCollapsed = !isCollapsed"><i class="glyphicon glyphicon-plus"></i></a> <a href="" title="edit widget configuration" ng-click="edit()" ng-if="editMode"><i class="glyphicon glyphicon-cog"></i></a> <a href="" title="remove widget" ng-click="close()" ng-if="editMode"><i class="glyphicon glyphicon-remove"></i></a></span></h3></div><div class="panel-body" collapse="isCollapsed"><adf-widget-content model="definition" content="widget"></div></div>')}]);