text: ﻿(function () {/**
   * almond 0.2.6 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
   * Available via the MIT or new BSD license.
   * see: http://github.com/jrburke/almond for details
   */
  //Going sloppy to avoid 'use strict' string cost, but strict practices should
  //be followed.
  /*jslint sloppy: true */
  /*global setTimeout: false */
  
  var requirejs, require, define;
  (function (undef) {
      var main, req, makeMap, handlers,
          defined = {},
          waiting = {},
          config = {},
          defining = {},
          hasOwn = Object.prototype.hasOwnProperty,
          aps = [].slice;
  
      function hasProp(obj, prop) {
          return hasOwn.call(obj, prop);
      }
  
      /**
       * Given a relative module name, like ./something, normalize it to
       * a real name that can be mapped to a path.
       * @param {String} name the relative name
       * @param {String} baseName a real name that the name arg is relative
       * to.
       * @returns {String} normalized name
       */
      function normalize(name, baseName) {
          var nameParts, nameSegment, mapValue, foundMap,
              foundI, foundStarMap, starI, i, j, part,
              baseParts = baseName && baseName.split("/"),
              map = config.map,
              starMap = (map && map['*']) || {};
  
          //Adjust any relative paths.
          if (name && name.charAt(0) === ".") {
              //If have a base name, try to normalize against it,
              //otherwise, assume it is a top-level require that will
              //be relative to baseUrl in the end.
              if (baseName) {
                  //Convert baseName to array, and lop off the last part,
                  //so that . matches that "directory" and not name of the baseName's
                  //module. For instance, baseName of "one/two/three", maps to
                  //"one/two/three.js", but we want the directory, "one/two" for
                  //this normalization.
                  baseParts = baseParts.slice(0, baseParts.length - 1);
  
                  name = baseParts.concat(name.split("/"));
  
                  //start trimDots
                  for (i = 0; i < name.length; i += 1) {
                      part = name[i];
                      if (part === ".") {
                          name.splice(i, 1);
                          i -= 1;
                      } else if (part === "..") {
                          if (i === 1 && (name[2] === '..' || name[0] === '..')) {
                              //End of the line. Keep at least one non-dot
                              //path segment at the front so it can be mapped
                              //correctly to disk. Otherwise, there is likely
                              //no path mapping for a path starting with '..'.
                              //This can still fail, but catches the most reasonable
                              //uses of ..
                              break;
                          } else if (i > 0) {
                              name.splice(i - 1, 2);
                              i -= 2;
                          }
                      }
                  }
                  //end trimDots
  
                  name = name.join("/");
              } else if (name.indexOf('./') === 0) {
                  // No baseName, so this is ID is resolved relative
                  // to baseUrl, pull off the leading dot.
                  name = name.substring(2);
              }
          }
  
          //Apply map config if available.
          if ((baseParts || starMap) && map) {
              nameParts = name.split('/');
  
              for (i = nameParts.length; i > 0; i -= 1) {
                  nameSegment = nameParts.slice(0, i).join("/");
  
                  if (baseParts) {
                      //Find the longest baseName segment match in the config.
                      //So, do joins on the biggest to smallest lengths of baseParts.
                      for (j = baseParts.length; j > 0; j -= 1) {
                          mapValue = map[baseParts.slice(0, j).join('/')];
  
                          //baseName segment has  config, find if it has one for
                          //this name.
                          if (mapValue) {
                              mapValue = mapValue[nameSegment];
                              if (mapValue) {
                                  //Match, update name to the new value.
                                  foundMap = mapValue;
                                  foundI = i;
                                  break;
                              }
                          }
                      }
                  }
  
                  if (foundMap) {
                      break;
                  }
  
                  //Check for a star map match, but just hold on to it,
                  //if there is a shorter segment match later in a matching
                  //config, then favor over this star map.
                  if (!foundStarMap && starMap && starMap[nameSegment]) {
                      foundStarMap = starMap[nameSegment];
                      starI = i;
                  }
              }
  
              if (!foundMap && foundStarMap) {
                  foundMap = foundStarMap;
                  foundI = starI;
              }
  
              if (foundMap) {
                  nameParts.splice(0, foundI, foundMap);
                  name = nameParts.join('/');
              }
          }
  
          return name;
      }
  
      function makeRequire(relName, forceSync) {
          return function () {
              //A version of a require function that passes a moduleName
              //value for items that may need to
              //look up paths relative to the moduleName
              return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
          };
      }
  
      function makeNormalize(relName) {
          return function (name) {
              return normalize(name, relName);
          };
      }
  
      function makeLoad(depName) {
          return function (value) {
              defined[depName] = value;
          };
      }
  
      function callDep(name) {
          if (hasProp(waiting, name)) {
              var args = waiting[name];
              delete waiting[name];
              defining[name] = true;
              main.apply(undef, args);
          }
  
          if (!hasProp(defined, name) && !hasProp(defining, name)) {
              throw new Error('No ' + name);
          }
          return defined[name];
      }
  
      //Turns a plugin!resource to [plugin, resource]
      //with the plugin being undefined if the name
      //did not have a plugin prefix.
      function splitPrefix(name) {
          var prefix,
              index = name ? name.indexOf('!') : -1;
          if (index > -1) {
              prefix = name.substring(0, index);
              name = name.substring(index + 1, name.length);
          }
          return [prefix, name];
      }
  
      function onResourceLoad(name, defined, deps){
          if(requirejs.onResourceLoad && name){
              requirejs.onResourceLoad({defined:defined}, {id:name}, deps);
          }
      }
  
      /**
       * Makes a name map, normalizing the name, and using a plugin
       * for normalization if necessary. Grabs a ref to plugin
       * too, as an optimization.
       */
      makeMap = function (name, relName) {
          var plugin,
              parts = splitPrefix(name),
              prefix = parts[0];
  
          name = parts[1];
  
          if (prefix) {
              prefix = normalize(prefix, relName);
              plugin = callDep(prefix);
          }
  
          //Normalize according
          if (prefix) {
              if (plugin && plugin.normalize) {
                  name = plugin.normalize(name, makeNormalize(relName));
              } else {
                  name = normalize(name, relName);
              }
          } else {
              name = normalize(name, relName);
              parts = splitPrefix(name);
              prefix = parts[0];
              name = parts[1];
              if (prefix) {
                  plugin = callDep(prefix);
              }
          }
  
          //Using ridiculous property names for space reasons
          return {
              f: prefix ? prefix + '!' + name : name, //fullName
              n: name,
              pr: prefix,
              p: plugin
          };
      };
  
      function makeConfig(name) {
          return function () {
              return (config && config.config && config.config[name]) || {};
          };
      }
  
      handlers = {
          require: function (name) {
              return makeRequire(name);
          },
          exports: function (name) {
              var e = defined[name];
              if (typeof e !== 'undefined') {
                  return e;
              } else {
                  return (defined[name] = {});
              }
          },
          module: function (name) {
              return {
                  id: name,
                  uri: '',
                  exports: defined[name],
                  config: makeConfig(name)
              };
          }
      };
  
      main = function (name, deps, callback, relName) {
          var cjsModule, depName, ret, map, i,
              args = [],
              usingExports;
  
          //Use name if no relName
          relName = relName || name;
  
          //Call the callback to define the module, if necessary.
          if (typeof callback === 'function') {
  
              //Pull out the defined dependencies and pass the ordered
              //values to the callback.
              //Default to [require, exports, module] if no deps
              deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
              for (i = 0; i < deps.length; i += 1) {
                  map = makeMap(deps[i], relName);
                  depName = map.f;
  
                  //Fast path CommonJS standard dependencies.
                  if (depName === "require") {
                      args[i] = handlers.require(name);
                  } else if (depName === "exports") {
                      //CommonJS module spec 1.1
                      args[i] = handlers.exports(name);
                      usingExports = true;
                  } else if (depName === "module") {
                      //CommonJS module spec 1.1
                      cjsModule = args[i] = handlers.module(name);
                  } else if (hasProp(defined, depName) ||
                             hasProp(waiting, depName) ||
                             hasProp(defining, depName)) {
                      args[i] = callDep(depName);
                  } else if (map.p) {
                      map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
                      args[i] = defined[depName];
                  } else {
                      throw new Error(name + ' missing ' + depName);
                  }
              }
  
              ret = callback.apply(defined[name], args);
  
              if (name) {
                  //If setting exports via "module" is in play,
                  //favor that over return value and exports. After that,
                  //favor a non-undefined return value over exports use.
                  if (cjsModule && cjsModule.exports !== undef &&
                          cjsModule.exports !== defined[name]) {
                      defined[name] = cjsModule.exports;
                  } else if (ret !== undef || !usingExports) {
                      //Use the return value from the function.
                      defined[name] = ret;
                  }
              }
          } else if (name) {
              //May just be an object definition for the module. Only
              //worry about defining if have a module name.
              defined[name] = callback;
          }
  
          onResourceLoad(name, defined, args);
      };
  
      requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
          if (typeof deps === "string") {
              if (handlers[deps]) {
                  //callback in this case is really relName
                  return handlers[deps](callback);
              }
              //Just return the module wanted. In this scenario, the
              //deps arg is the module name, and second arg (if passed)
              //is just the relName.
              //Normalize module name, if it contains . or ..
              return callDep(makeMap(deps, callback).f);
          } else if (!deps.splice) {
              //deps is a config object, not an array.
              config = deps;
              if (callback.splice) {
                  //callback is an array, which means it is a dependency list.
                  //Adjust args if there are dependencies
                  deps = callback;
                  callback = relName;
                  relName = null;
              } else {
                  deps = undef;
              }
          }
  
          //Support require(['a'])
          callback = callback || function () {};
  
          //If relName is a function, it is an errback handler,
          //so remove it.
          if (typeof relName === 'function') {
              relName = forceSync;
              forceSync = alt;
          }
  
          //Simulate async callback;
          if (forceSync) {
              main(undef, deps, callback, relName);
          } else {
              //Using a non-zero value because of concern for what old browsers
              //do, and latest browsers "upgrade" to 4 if lower value is used:
              //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
              //If want a value immediately, use require('id') instead -- something
              //that works in almond on the global level, but not guaranteed and
              //unlikely to work in other AMD implementations.
              setTimeout(function () {
                  main(undef, deps, callback, relName);
              }, 4);
          }
  
          return req;
      };
  
      /**
       * Just drops the config on the floor, but returns req in case
       * the config return value is used.
       */
      req.config = function (cfg) {
          config = cfg;
          if (config.deps) {
              req(config.deps, config.callback);
          }
          return req;
      };
  
      /**
       * Expose module registry for debugging and tooling
       */
      requirejs._defined = defined;
  
      define = function (name, deps, callback) {
  
          //This module may not have dependencies
          if (!deps.splice) {
              //deps is not an array, so probably means
              //an object literal or factory function for
              //the value. Adjust args.
              callback = deps;
              deps = [];
          }
  
          if (!hasProp(defined, name) && !hasProp(waiting, name)) {
              waiting[name] = [name, deps, callback];
          }
      };
  
      define.amd = {
          jQuery: true
      };
  }());
  
  define("../Scripts/almond-custom", function(){});
  
  define('durandal/system',["require","jquery"],function(e,t){function n(e){var t="[object "+e+"]";r["is"+e]=function(e){return s.call(e)==t}}var r,a=!1,i=Object.keys,o=Object.prototype.hasOwnProperty,s=Object.prototype.toString,l=!1,c=Array.isArray,u=Array.prototype.slice;if(Function.prototype.bind&&("object"==typeof console||"function"==typeof console)&&"object"==typeof console.log)try{["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(e){console[e]=this.call(console[e],console)},Function.prototype.bind)}catch(d){l=!0}e.on&&e.on("moduleLoaded",function(e,t){r.setModuleId(e,t)}),"undefined"!=typeof requirejs&&(requirejs.onResourceLoad=function(e,t){r.setModuleId(e.defined[t.id],t.id)});var f=function(){},v=function(){try{if("undefined"!=typeof console&&"function"==typeof console.log)if(window.opera)for(var e=0;e<arguments.length;)console.log("Item "+(e+1)+": "+arguments[e]),e++;else 1==u.call(arguments).length&&"string"==typeof u.call(arguments)[0]?console.log(u.call(arguments).toString()):console.log.apply(console,u.call(arguments));else Function.prototype.bind&&!l||"undefined"==typeof console||"object"!=typeof console.log||Function.prototype.call.call(console.log,console,u.call(arguments))}catch(t){}},g=function(e){if(e instanceof Error)throw e;throw new Error(e)};r={version:"2.0.1",noop:f,getModuleId:function(e){return e?"function"==typeof e?e.prototype.__moduleId__:"string"==typeof e?null:e.__moduleId__:null},setModuleId:function(e,t){return e?"function"==typeof e?(e.prototype.__moduleId__=t,void 0):("string"!=typeof e&&(e.__moduleId__=t),void 0):void 0},resolveObject:function(e){return r.isFunction(e)?new e:e},debug:function(e){return 1==arguments.length&&(a=e,a?(this.log=v,this.error=g,this.log("Debug:Enabled")):(this.log("Debug:Disabled"),this.log=f,this.error=f)),a},log:f,error:f,assert:function(e,t){e||r.error(new Error(t||"Assert:Failed"))},defer:function(e){return t.Deferred(e)},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=0|16*Math.random(),n="x"==e?t:8|3&t;return n.toString(16)})},acquire:function(){var t,n=arguments[0],a=!1;return r.isArray(n)?(t=n,a=!0):t=u.call(arguments,0),this.defer(function(n){e(t,function(){var e=arguments;setTimeout(function(){e.length>1||a?n.resolve(u.call(e,0)):n.resolve(e[0])},1)},function(e){n.reject(e)})}).promise()},extend:function(e){for(var t=u.call(arguments,1),n=0;n<t.length;n++){var r=t[n];if(r)for(var a in r)e[a]=r[a]}return e},wait:function(e){return r.defer(function(t){setTimeout(t.resolve,e)}).promise()}},r.keys=i||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)o.call(e,n)&&(t[t.length]=n);return t},r.isElement=function(e){return!(!e||1!==e.nodeType)},r.isArray=c||function(e){return"[object Array]"==s.call(e)},r.isObject=function(e){return e===Object(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isPromise=function(e){return e&&r.isFunction(e.then)};for(var h=["Arguments","Function","String","Number","Date","RegExp"],p=0;p<h.length;p++)n(h[p]);return r});
  define('durandal/viewEngine',["durandal/system","jquery"],function(e,t){var n;return n=t.parseHTML?function(e){return t.parseHTML(e)}:function(e){return t(e).get()},{viewExtension:".html",viewPlugin:"text",isViewUrl:function(e){return-1!==e.indexOf(this.viewExtension,e.length-this.viewExtension.length)},convertViewUrlToViewId:function(e){return e.substring(0,e.length-this.viewExtension.length)},convertViewIdToRequirePath:function(e){return this.viewPlugin+"!"+e+this.viewExtension},parseMarkup:n,processMarkup:function(e){var t=this.parseMarkup(e);return this.ensureSingleElement(t)},ensureSingleElement:function(e){if(1==e.length)return e[0];for(var n=[],r=0;r<e.length;r++){var a=e[r];if(8!=a.nodeType){if(3==a.nodeType){var i=/\S/.test(a.nodeValue);if(!i)continue}n.push(a)}}return n.length>1?t(n).wrapAll('<div class="durandal-wrapper"></div>').parent().get(0):n[0]},createView:function(t){var n=this,r=this.convertViewIdToRequirePath(t);return e.defer(function(a){e.acquire(r).then(function(e){var r=n.processMarkup(e);r.setAttribute("data-view",t),a.resolve(r)}).fail(function(e){n.createFallbackView(t,r,e).then(function(e){e.setAttribute("data-view",t),a.resolve(e)})})}).promise()},createFallbackView:function(t,n){var r=this,a='View Not Found. Searched for "'+t+'" via path "'+n+'".';return e.defer(function(e){e.resolve(r.processMarkup('<div class="durandal-view-404">'+a+"</div>"))}).promise()}}});
  define('durandal/viewLocator',["durandal/system","durandal/viewEngine"],function(e,t){function n(e,t){for(var n=0;n<e.length;n++){var r=e[n],a=r.getAttribute("data-view");if(a==t)return r}}function r(e){return(e+"").replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g,"\\$1")}return{useConvention:function(e,t,n){e=e||"viewmodels",t=t||"views",n=n||t;var a=new RegExp(r(e),"gi");this.convertModuleIdToViewId=function(e){return e.replace(a,t)},this.translateViewIdToArea=function(e,t){return t&&"partial"!=t?n+"/"+t+"/"+e:n+"/"+e}},locateViewForObject:function(t,n,r){var a;if(t.getView&&(a=t.getView()))return this.locateView(a,n,r);if(t.viewUrl)return this.locateView(t.viewUrl,n,r);var i=e.getModuleId(t);return i?this.locateView(this.convertModuleIdToViewId(i),n,r):this.locateView(this.determineFallbackViewId(t),n,r)},convertModuleIdToViewId:function(e){return e},determineFallbackViewId:function(e){var t=/function (.{1,})\(/,n=t.exec(e.constructor.toString()),r=n&&n.length>1?n[1]:"";return"views/"+r},translateViewIdToArea:function(e){return e},locateView:function(r,a,i){if("string"==typeof r){var o;if(o=t.isViewUrl(r)?t.convertViewUrlToViewId(r):r,a&&(o=this.translateViewIdToArea(o,a)),i){var s=n(i,o);if(s)return e.defer(function(e){e.resolve(s)}).promise()}return t.createView(o)}return e.defer(function(e){e.resolve(r)}).promise()}}});
  define('durandal/binder',["durandal/system","knockout"],function(e,t){function r(t){return void 0===t?{applyBindings:!0}:e.isBoolean(t)?{applyBindings:t}:(void 0===t.applyBindings&&(t.applyBindings=!0),t)}function n(n,c,u,d){if(!c||!u)return a.throwOnErrors?e.error(i):e.log(i,c,d),void 0;if(!c.getAttribute)return a.throwOnErrors?e.error(o):e.log(o,c,d),void 0;var f=c.getAttribute("data-view");try{var v;return n&&n.binding&&(v=n.binding(c)),v=r(v),a.binding(d,c,v),v.applyBindings?(e.log("Binding",f,d),t.applyBindings(u,c)):n&&t.utils.domData.set(c,l,{$data:n}),a.bindingComplete(d,c,v),n&&n.bindingComplete&&n.bindingComplete(c),t.utils.domData.set(c,s,v),v}catch(h){h.message=h.message+";\nView: "+f+";\nModuleId: "+e.getModuleId(d),a.throwOnErrors?e.error(h):e.log(h.message)}}var a,i="Insufficient Information to Bind",o="Unexpected View Type",s="durandal-binding-instruction",l="__ko_bindingContext__";return a={binding:e.noop,bindingComplete:e.noop,throwOnErrors:!1,getBindingInstruction:function(e){return t.utils.domData.get(e,s)},bindContext:function(e,t,r){return r&&e&&(e=e.createChildContext(r)),n(r,t,e,r||(e?e.$data:null))},bind:function(e,t){return n(e,t,e,e)}}});
  define('durandal/activator',["durandal/system","knockout"],function(e,t){function r(e){return void 0==e&&(e={}),e.closeOnDeactivate||(e.closeOnDeactivate=c.defaults.closeOnDeactivate),e.beforeActivate||(e.beforeActivate=c.defaults.beforeActivate),e.afterDeactivate||(e.afterDeactivate=c.defaults.afterDeactivate),e.affirmations||(e.affirmations=c.defaults.affirmations),e.interpretResponse||(e.interpretResponse=c.defaults.interpretResponse),e.areSameItem||(e.areSameItem=c.defaults.areSameItem),e}function n(t,r,n){return e.isArray(n)?t[r].apply(t,n):t[r](n)}function a(t,r,n,a,i){if(t&&t.deactivate){e.log("Deactivating",t);var o;try{o=t.deactivate(r)}catch(s){return e.error(s),a.resolve(!1),void 0}o&&o.then?o.then(function(){n.afterDeactivate(t,r,i),a.resolve(!0)},function(t){e.log(t),a.resolve(!1)}):(n.afterDeactivate(t,r,i),a.resolve(!0))}else t&&n.afterDeactivate(t,r,i),a.resolve(!0)}function i(t,r,a,i){if(t)if(t.activate){e.log("Activating",t);var o;try{o=n(t,"activate",i)}catch(s){return e.error(s),a(!1),void 0}o&&o.then?o.then(function(){r(t),a(!0)},function(t){e.log(t),a(!1)}):(r(t),a(!0))}else r(t),a(!0);else a(!0)}function o(t,r,n){return n.lifecycleData=null,e.defer(function(a){if(t&&t.canDeactivate){var i;try{i=t.canDeactivate(r)}catch(o){return e.error(o),a.resolve(!1),void 0}i.then?i.then(function(e){n.lifecycleData=e,a.resolve(n.interpretResponse(e))},function(t){e.error(t),a.resolve(!1)}):(n.lifecycleData=i,a.resolve(n.interpretResponse(i)))}else a.resolve(!0)}).promise()}function s(t,r,a,i){return a.lifecycleData=null,e.defer(function(o){if(t==r())return o.resolve(!0),void 0;if(t&&t.canActivate){var s;try{s=n(t,"canActivate",i)}catch(l){return e.error(l),o.resolve(!1),void 0}s.then?s.then(function(e){a.lifecycleData=e,o.resolve(a.interpretResponse(e))},function(t){e.error(t),o.resolve(!1)}):(a.lifecycleData=s,o.resolve(a.interpretResponse(s)))}else o.resolve(!0)}).promise()}function l(n,l){var c,u=t.observable(null);l=r(l);var d=t.computed({read:function(){return u()},write:function(e){d.viaSetter=!0,d.activateItem(e)}});return d.__activator__=!0,d.settings=l,l.activator=d,d.isActivating=t.observable(!1),d.canDeactivateItem=function(e,t){return o(e,t,l)},d.deactivateItem=function(t,r){return e.defer(function(e){d.canDeactivateItem(t,r).then(function(n){n?a(t,r,l,e,u):(d.notifySubscribers(),e.resolve(!1))})}).promise()},d.canActivateItem=function(e,t){return s(e,u,l,t)},d.activateItem=function(t,r){var n=d.viaSetter;return d.viaSetter=!1,e.defer(function(o){if(d.isActivating())return o.resolve(!1),void 0;d.isActivating(!0);var s=u();return l.areSameItem(s,t,c,r)?(d.isActivating(!1),o.resolve(!0),void 0):(d.canDeactivateItem(s,l.closeOnDeactivate).then(function(f){f?d.canActivateItem(t,r).then(function(f){f?e.defer(function(e){a(s,l.closeOnDeactivate,l,e)}).promise().then(function(){t=l.beforeActivate(t,r),i(t,u,function(e){c=r,d.isActivating(!1),o.resolve(e)},r)}):(n&&d.notifySubscribers(),d.isActivating(!1),o.resolve(!1))}):(n&&d.notifySubscribers(),d.isActivating(!1),o.resolve(!1))}),void 0)}).promise()},d.canActivate=function(){var e;return n?(e=n,n=!1):e=d(),d.canActivateItem(e)},d.activate=function(){var e;return n?(e=n,n=!1):e=d(),d.activateItem(e)},d.canDeactivate=function(e){return d.canDeactivateItem(d(),e)},d.deactivate=function(e){return d.deactivateItem(d(),e)},d.includeIn=function(e){e.canActivate=function(){return d.canActivate()},e.activate=function(){return d.activate()},e.canDeactivate=function(e){return d.canDeactivate(e)},e.deactivate=function(e){return d.deactivate(e)}},l.includeIn?d.includeIn(l.includeIn):n&&d.activate(),d.forItems=function(t){l.closeOnDeactivate=!1,l.determineNextItemToActivate=function(e,t){var r=t-1;return-1==r&&e.length>1?e[1]:r>-1&&r<e.length-1?e[r]:null},l.beforeActivate=function(e){var r=d();if(e){var n=t.indexOf(e);-1==n?t.push(e):e=t()[n]}else e=l.determineNextItemToActivate(t,r?t.indexOf(r):0);return e},l.afterDeactivate=function(e,r){r&&t.remove(e)};var r=d.canDeactivate;d.canDeactivate=function(n){return n?e.defer(function(e){function r(){for(var t=0;t<i.length;t++)if(!i[t])return e.resolve(!1),void 0;e.resolve(!0)}for(var a=t(),i=[],o=0;o<a.length;o++)d.canDeactivateItem(a[o],n).then(function(e){i.push(e),i.length==a.length&&r()})}).promise():r()};var n=d.deactivate;return d.deactivate=function(r){return r?e.defer(function(e){function n(n){d.deactivateItem(n,r).then(function(){i++,t.remove(n),i==o&&e.resolve()})}for(var a=t(),i=0,o=a.length,s=0;o>s;s++)n(a[s])}).promise():n()},d},d}var c,u={closeOnDeactivate:!0,affirmations:["yes","ok","true"],interpretResponse:function(r){return e.isObject(r)&&(r=r.can||!1),e.isString(r)?-1!==t.utils.arrayIndexOf(this.affirmations,r.toLowerCase()):r},areSameItem:function(e,t){return e==t},beforeActivate:function(e){return e},afterDeactivate:function(e,t,r){t&&r&&r(null)}};return c={defaults:u,create:l,isActivator:function(e){return e&&e.__activator__}}});
  define('durandal/composition',["durandal/system","durandal/viewLocator","durandal/binder","durandal/viewEngine","durandal/activator","jquery","knockout"],function(e,t,r,n,a,i,o){function s(e){for(var t=[],r={childElements:t,activeView:null},n=o.virtualElements.firstChild(e);n;)1==n.nodeType&&(t.push(n),n.getAttribute(x)&&(r.activeView=n)),n=o.virtualElements.nextSibling(n);return r.activeView||(r.activeView=t[0]),r}function l(){A--,0===A&&setTimeout(function(){for(var t=k.length;t--;)try{k[t]()}catch(r){e.error(r)}k=[]},1)}function c(e){delete e.activeView,delete e.viewElements}function u(t,r,n){if(n)r();else if(t.activate&&t.model&&t.model.activate){var a;try{a=e.isArray(t.activationData)?t.model.activate.apply(t.model,t.activationData):t.model.activate(t.activationData),a&&a.then?a.then(r,function(t){e.error(t),r()}):a||void 0===a?r():(l(),c(t))}catch(i){e.error(i)}}else r()}function d(){var t=this;if(t.activeView&&t.activeView.removeAttribute(x),t.child)try{t.model&&t.model.attached&&(t.composingNewView||t.alwaysTriggerAttach)&&t.model.attached(t.child,t.parent,t),t.attached&&t.attached(t.child,t.parent,t),t.child.setAttribute(x,!0),t.composingNewView&&t.model&&t.model.detached&&o.utils.domNodeDisposal.addDisposeCallback(t.child,function(){try{t.model.detached(t.child,t.parent,t)}catch(r){e.error(r)}})}catch(r){e.error(r)}t.triggerAttach=e.noop}function f(t){if(e.isString(t.transition)){if(t.activeView){if(t.activeView==t.child)return!1;if(!t.child)return!0;if(t.skipTransitionOnSameViewId){var r=t.activeView.getAttribute("data-view"),n=t.child.getAttribute("data-view");return r!=n}}return!0}return!1}function v(e){for(var t=0,r=e.length,n=[];r>t;t++){var a=e[t].cloneNode(!0);n.push(a)}return n}function g(e){var t=v(e.parts),r=w.getParts(t,null,!0),n=w.getParts(e.child);for(var a in r)i(n[a]).replaceWith(r[a])}function h(t){var r,n,a=o.virtualElements.childNodes(t.parent);if(!e.isArray(a)){var i=[];for(r=0,n=a.length;n>r;r++)i[r]=a[r];a=i}for(r=1,n=a.length;n>r;r++)o.removeNode(a[r])}function p(e){o.utils.domData.set(e,E,e.style.display),e.style.display="none"}function m(e){e.style.display=o.utils.domData.get(e,E)}function b(e){var t=e.getAttribute("data-bind");if(!t)return!1;for(var r=0,n=C.length;n>r;r++)if(t.indexOf(C[r])>-1)return!0;return!1}var w,y={},x="data-active-view",k=[],A=0,I="durandal-composition-data",S="data-part",P=["model","view","transition","area","strategy","activationData"],E="durandal-visibility-data",C=["compose:"],T={complete:function(e){k.push(e)}};return w={composeBindings:C,convertTransitionToModuleId:function(e){return"transitions/"+e},defaultTransitionName:null,current:T,addBindingHandler:function(e,t,r){var n,a,i="composition-handler-"+e;t=t||o.bindingHandlers[e],r=r||function(){return void 0},a=o.bindingHandlers[e]={init:function(e,n,a,s,l){if(A>0){var c={trigger:o.observable(null)};w.current.complete(function(){t.init&&t.init(e,n,a,s,l),t.update&&(o.utils.domData.set(e,i,t),c.trigger("trigger"))}),o.utils.domData.set(e,i,c)}else o.utils.domData.set(e,i,t),t.init&&t.init(e,n,a,s,l);return r(e,n,a,s,l)},update:function(e,t,r,n,a){var s=o.utils.domData.get(e,i);return s.update?s.update(e,t,r,n,a):(s.trigger&&s.trigger(),void 0)}};for(n in t)"init"!==n&&"update"!==n&&(a[n]=t[n])},getParts:function(e,t,r){if(t=t||{},!e)return t;void 0===e.length&&(e=[e]);for(var n=0,a=e.length;a>n;n++){var i=e[n];if(i.getAttribute){if(!r&&b(i))continue;var o=i.getAttribute(S);o&&(t[o]=i),!r&&i.hasChildNodes()&&w.getParts(i.childNodes,t)}}return t},cloneNodes:v,finalize:function(t){if(void 0===t.transition&&(t.transition=this.defaultTransitionName),t.child||t.activeView)if(f(t)){var n=this.convertTransitionToModuleId(t.transition);e.acquire(n).then(function(e){t.transition=e,e(t).then(function(){if(t.cacheViews){if(t.activeView){var e=r.getBindingInstruction(t.activeView);e&&void 0!=e.cacheViews&&!e.cacheViews&&o.removeNode(t.activeView)}}else t.child?h(t):o.virtualElements.emptyNode(t.parent);t.triggerAttach(),l(),c(t)})}).fail(function(t){e.error("Failed to load transition ("+n+"). Details: "+t.message)})}else{if(t.child!=t.activeView){if(t.cacheViews&&t.activeView){var a=r.getBindingInstruction(t.activeView);!a||void 0!=a.cacheViews&&!a.cacheViews?o.removeNode(t.activeView):p(t.activeView)}t.child?(t.cacheViews||h(t),m(t.child)):t.cacheViews||o.virtualElements.emptyNode(t.parent)}t.triggerAttach(),l(),c(t)}else t.cacheViews||o.virtualElements.emptyNode(t.parent),t.triggerAttach(),l(),c(t)},bindAndShow:function(e,t,a){t.child=e,t.composingNewView=t.cacheViews?-1==o.utils.arrayIndexOf(t.viewElements,e):!0,u(t,function(){if(t.binding&&t.binding(t.child,t.parent,t),t.preserveContext&&t.bindingContext)t.composingNewView&&(t.parts&&g(t),p(e),o.virtualElements.prepend(t.parent,e),r.bindContext(t.bindingContext,e,t.model));else if(e){var a=t.model||y,i=o.dataFor(e);if(i!=a){if(!t.composingNewView)return o.removeNode(e),n.createView(e.getAttribute("data-view")).then(function(e){w.bindAndShow(e,t,!0)}),void 0;t.parts&&g(t),p(e),o.virtualElements.prepend(t.parent,e),r.bind(a,e)}}w.finalize(t)},a)},defaultStrategy:function(e){return t.locateViewForObject(e.model,e.area,e.viewElements)},getSettings:function(t){var r,i=t(),s=o.utils.unwrapObservable(i)||{},l=a.isActivator(i);if(e.isString(s))return s=n.isViewUrl(s)?{view:s}:{model:s,activate:!0};if(r=e.getModuleId(s))return s={model:s,activate:!0};!l&&s.model&&(l=a.isActivator(s.model));for(var c in s)s[c]=-1!=o.utils.arrayIndexOf(P,c)?o.utils.unwrapObservable(s[c]):s[c];return l?s.activate=!1:void 0===s.activate&&(s.activate=!0),s},executeStrategy:function(e){e.strategy(e).then(function(t){w.bindAndShow(t,e)})},inject:function(r){return r.model?r.view?(t.locateView(r.view,r.area,r.viewElements).then(function(e){w.bindAndShow(e,r)}),void 0):(r.strategy||(r.strategy=this.defaultStrategy),e.isString(r.strategy)?e.acquire(r.strategy).then(function(e){r.strategy=e,w.executeStrategy(r)}).fail(function(t){e.error("Failed to load view strategy ("+r.strategy+"). Details: "+t.message)}):this.executeStrategy(r),void 0):(this.bindAndShow(null,r),void 0)},compose:function(r,n,a,i){A++,i||(n=w.getSettings(function(){return n},r)),n.compositionComplete&&k.push(function(){n.compositionComplete(n.child,n.parent,n)}),k.push(function(){n.composingNewView&&n.model&&n.model.compositionComplete&&n.model.compositionComplete(n.child,n.parent,n)});var o=s(r);n.activeView=o.activeView,n.parent=r,n.triggerAttach=d,n.bindingContext=a,n.cacheViews&&!n.viewElements&&(n.viewElements=o.childElements),n.model?e.isString(n.model)?e.acquire(n.model).then(function(t){n.model=e.resolveObject(t),w.inject(n)}).fail(function(t){e.error("Failed to load composed module ("+n.model+"). Details: "+t.message)}):w.inject(n):n.view?(n.area=n.area||"partial",n.preserveContext=!0,t.locateView(n.view,n.area,n.viewElements).then(function(e){w.bindAndShow(e,n)})):this.bindAndShow(null,n)}},o.bindingHandlers.compose={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t,r,a,i){var s=w.getSettings(t,e);if(s.mode){var l=o.utils.domData.get(e,I);if(!l){var c=o.virtualElements.childNodes(e);l={},"inline"===s.mode?l.view=n.ensureSingleElement(c):"templated"===s.mode&&(l.parts=v(c)),o.virtualElements.emptyNode(e),o.utils.domData.set(e,I,l)}"inline"===s.mode?s.view=l.view.cloneNode(!0):"templated"===s.mode&&(s.parts=l.parts),s.preserveContext=!0}w.compose(e,s,i,!0)}},o.virtualElements.allowedBindings.compose=!0,w});
  define('durandal/events',["durandal/system"],function(e){var t=/\s+/,r=function(){},n=function(e,t){this.owner=e,this.events=t};return n.prototype.then=function(e,t){return this.callback=e||this.callback,this.context=t||this.context,this.callback?(this.owner.on(this.events,this.callback,this.context),this):this},n.prototype.on=n.prototype.then,n.prototype.off=function(){return this.owner.off(this.events,this.callback,this.context),this},r.prototype.on=function(e,r,a){var i,o,s;if(r){for(i=this.callbacks||(this.callbacks={}),e=e.split(t);o=e.shift();)s=i[o]||(i[o]=[]),s.push(r,a);return this}return new n(this,e)},r.prototype.off=function(r,n,a){var i,o,s,l;if(!(o=this.callbacks))return this;if(!(r||n||a))return delete this.callbacks,this;for(r=r?r.split(t):e.keys(o);i=r.shift();)if((s=o[i])&&(n||a))for(l=s.length-2;l>=0;l-=2)n&&s[l]!==n||a&&s[l+1]!==a||s.splice(l,2);else delete o[i];return this},r.prototype.trigger=function(e){var r,n,a,i,o,s,l,c;if(!(n=this.callbacks))return this;for(c=[],e=e.split(t),i=1,o=arguments.length;o>i;i++)c[i-1]=arguments[i];for(;r=e.shift();){if((l=n.all)&&(l=l.slice()),(a=n[r])&&(a=a.slice()),a)for(i=0,o=a.length;o>i;i+=2)a[i].apply(a[i+1]||this,c);if(l)for(s=[r].concat(c),i=0,o=l.length;o>i;i+=2)l[i].apply(l[i+1]||this,s)}return this},r.prototype.proxy=function(e){var t=this;return function(r){t.trigger(e,r)}},r.includeIn=function(e){e.on=r.prototype.on,e.off=r.prototype.off,e.trigger=r.prototype.trigger,e.proxy=r.prototype.proxy},r});
  define('durandal/app',["durandal/system","durandal/viewEngine","durandal/composition","durandal/events","jquery"],function(e,t,r,n,a){function i(){return e.defer(function(t){return 0==s.length?(t.resolve(),void 0):(e.acquire(s).then(function(r){for(var n=0;n<r.length;n++){var a=r[n];if(a.install){var i=l[n];e.isObject(i)||(i={}),a.install(i),e.log("Plugin:Installed "+s[n])}else e.log("Plugin:Loaded "+s[n])}t.resolve()}).fail(function(t){e.error("Failed to load plugin(s). Details: "+t.message)}),void 0)}).promise()}var o,s=[],l=[];return o={title:"Application",configurePlugins:function(t,r){var n=e.keys(t);r=r||"plugins/",-1===r.indexOf("/",r.length-1)&&(r+="/");for(var a=0;a<n.length;a++){var i=n[a];s.push(r+i),l.push(t[i])}},start:function(){return e.log("Application:Starting"),this.title&&(document.title=this.title),e.defer(function(t){a(function(){i().then(function(){t.resolve(),e.log("Application:Started")})})}).promise()},setRoot:function(n,a,i){var o,s={activate:!0,transition:a};o=!i||e.isString(i)?document.getElementById(i||"applicationHost"):i,e.isString(n)?t.isViewUrl(n)?s.view=n:s.model=n:s.model=n,r.compose(o,s)}},n.includeIn(o),o});
  define('plugins/history',["durandal/system","jquery"],function(e,t){function n(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}var r=/^[#\/]|\s+$/g,a=/^\/+|\/+$/g,i=/msie [\w.]+/,o=/\/$/,s={interval:50,active:!1};return"undefined"!=typeof window&&(s.location=window.location,s.history=window.history),s.getHash=function(e){var t=(e||s).location.href.match(/#(.*)$/);return t?t[1]:""},s.getFragment=function(e,t){if(null==e)if(s._hasPushState||!s._wantsHashChange||t){e=s.location.pathname+s.location.search;var n=s.root.replace(o,"");e.indexOf(n)||(e=e.substr(n.length))}else e=s.getHash();return e.replace(r,"")},s.activate=function(n){s.active&&e.error("History has already been activated."),s.active=!0,s.options=e.extend({},{root:"/"},s.options,n),s.root=s.options.root,s._wantsHashChange=s.options.hashChange!==!1,s._wantsPushState=!!s.options.pushState,s._hasPushState=!!(s.options.pushState&&s.history&&s.history.pushState);var o=s.getFragment(),l=document.documentMode,c=i.exec(navigator.userAgent.toLowerCase())&&(!l||7>=l);s.root=("/"+s.root+"/").replace(a,"/"),c&&s._wantsHashChange&&(s.iframe=t('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,s.navigate(o,!1)),s._hasPushState?t(window).on("popstate",s.checkUrl):s._wantsHashChange&&"onhashchange"in window&&!c?t(window).on("hashchange",s.checkUrl):s._wantsHashChange&&(s._checkUrlInterval=setInterval(s.checkUrl,s.interval)),s.fragment=o;var u=s.location,d=u.pathname.replace(/[^\/]$/,"$&/")===s.root;if(s._wantsHashChange&&s._wantsPushState){if(!s._hasPushState&&!d)return s.fragment=s.getFragment(null,!0),s.location.replace(s.root+s.location.search+"#"+s.fragment),!0;s._hasPushState&&d&&u.hash&&(this.fragment=s.getHash().replace(r,""),this.history.replaceState({},document.title,s.root+s.fragment+u.search))}return s.options.silent?void 0:s.loadUrl()},s.deactivate=function(){t(window).off("popstate",s.checkUrl).off("hashchange",s.checkUrl),clearInterval(s._checkUrlInterval),s.active=!1},s.checkUrl=function(){var e=s.getFragment();return e===s.fragment&&s.iframe&&(e=s.getFragment(s.getHash(s.iframe))),e===s.fragment?!1:(s.iframe&&s.navigate(e,!1),s.loadUrl(),void 0)},s.loadUrl=function(e){var t=s.fragment=s.getFragment(e);return s.options.routeHandler?s.options.routeHandler(t):!1},s.navigate=function(t,r){if(!s.active)return!1;if(void 0===r?r={trigger:!0}:e.isBoolean(r)&&(r={trigger:r}),t=s.getFragment(t||""),s.fragment!==t){s.fragment=t;var a=s.root+t;if(""===t&&"/"!==a&&(a=a.slice(0,-1)),s._hasPushState)s.history[r.replace?"replaceState":"pushState"]({},document.title,a);else{if(!s._wantsHashChange)return s.location.assign(a);n(s.location,t,r.replace),s.iframe&&t!==s.getFragment(s.getHash(s.iframe))&&(r.replace||s.iframe.document.open().close(),n(s.iframe.location,t,r.replace))}return r.trigger?s.loadUrl(t):void 0}},s.navigateBack=function(){s.history.back()},s});
  define('plugins/router',["durandal/system","durandal/app","durandal/activator","durandal/events","durandal/composition","plugins/history","knockout","jquery"],function(e,t,r,n,a,i,o,s){function l(e){return e=e.replace(m,"\\$&").replace(g,"(?:$1)?").replace(h,function(e,t){return t?e:"([^/]+)"}).replace(p,"(.*?)"),new RegExp("^"+e+"$")}function c(e){var t=e.indexOf(":"),r=t>0?t-1:e.length;return e.substring(0,r)}function u(e,t){return-1!==e.indexOf(t,e.length-t.length)}function d(e,t){if(!e||!t)return!1;if(e.length!=t.length)return!1;for(var r=0,n=e.length;n>r;r++)if(e[r]!=t[r])return!1;return!0}var f,v,g=/\((.*?)\)/g,h=/(\(\?)?:\w+/g,p=/\*\w+/g,m=/[\-{}\[\]+?.,\\\^$|#\s]/g,b=/\/$/,w=function(){function a(e){return e.router&&e.router.parent==D}function s(e){T&&T.config.isActive&&T.config.isActive(e)}function g(t,r){e.log("Navigation Complete",t,r);var n=e.getModuleId(E);n&&D.trigger("router:navigation:from:"+n),E=t,s(!1),T=r,s(!0);var i=e.getModuleId(E);i&&D.trigger("router:navigation:to:"+i),a(t)||D.updateDocumentTitle(t,r),v.explicitNavigation=!1,v.navigatingBack=!1,D.trigger("router:navigation:complete",t,r,D)}function h(t,r){e.log("Navigation Cancelled"),D.activeInstruction(T),T&&D.navigate(T.fragment,!1),U(!1),v.explicitNavigation=!1,v.navigatingBack=!1,D.trigger("router:navigation:cancelled",t,r,D)}function p(t){e.log("Navigation Redirecting"),U(!1),v.explicitNavigation=!1,v.navigatingBack=!1,D.navigate(t,{trigger:!0,replace:!0})}function m(t,r,n){v.navigatingBack=!v.explicitNavigation&&E!=n.fragment,D.trigger("router:route:activating",r,n,D),t.activateItem(r,n.params).then(function(e){if(e){var i=E;if(g(r,n),a(r)){var o=n.fragment;n.queryString&&(o+="?"+n.queryString),r.router.loadUrl(o)}i==r&&(D.attached(),D.compositionComplete())}else t.settings.lifecycleData&&t.settings.lifecycleData.redirect?p(t.settings.lifecycleData.redirect):h(r,n);f&&(f.resolve(),f=null)}).fail(function(t){e.error(t)})}function y(t,r,n){var a=D.guardRoute(r,n);a?a.then?a.then(function(a){a?e.isString(a)?p(a):m(t,r,n):h(r,n)}):e.isString(a)?p(a):m(t,r,n):h(r,n)}function x(e,t,r){D.guardRoute?y(e,t,r):m(e,t,r)}function k(e){return T&&T.config.moduleId==e.config.moduleId&&E&&(E.canReuseForRoute&&E.canReuseForRoute.apply(E,e.params)||!E.canReuseForRoute&&E.router&&E.router.loadUrl)}function A(){if(!U()){var t=_.shift();_=[],t&&(U(!0),D.activeInstruction(t),k(t)?x(r.create(),E,t):e.acquire(t.config.moduleId).then(function(r){var n=e.resolveObject(r);x(N,n,t)}).fail(function(r){e.error("Failed to load routed module ("+t.config.moduleId+"). Details: "+r.message)}))}}function I(e){_.unshift(e),A()}function S(e,t,r){for(var n=e.exec(t).slice(1),a=0;a<n.length;a++){var i=n[a];n[a]=i?decodeURIComponent(i):null}var o=D.parseQueryString(r);return o&&n.push(o),{params:n,queryParams:o}}function P(t){D.trigger("router:route:before-config",t,D),e.isRegExp(t)?t.routePattern=t.route:(t.title=t.title||D.convertRouteToTitle(t.route),t.moduleId=t.moduleId||D.convertRouteToModuleId(t.route),t.hash=t.hash||D.convertRouteToHash(t.route),t.routePattern=l(t.route)),t.isActive=t.isActive||o.observable(!1),D.trigger("router:route:after-config",t,D),D.routes.push(t),D.route(t.routePattern,function(e,r){var n=S(t.routePattern,e,r);I({fragment:e,queryString:r,config:t,params:n.params,queryParams:n.queryParams})})}function C(t){if(e.isArray(t.route))for(var r=t.isActive||o.observable(!1),n=0,a=t.route.length;a>n;n++){var i=e.extend({},t);i.route=t.route[n],i.isActive=r,n>0&&delete i.nav,P(i)}else P(t);return D}var E,T,_=[],U=o.observable(!1),N=r.create(),D={handlers:[],routes:[],navigationModel:o.observableArray([]),activeItem:N,isNavigating:o.computed(function(){var e=N(),t=U(),r=e&&e.router&&e.router!=D&&e.router.isNavigating()?!0:!1;return t||r}),activeInstruction:o.observable(null),__router__:!0};return n.includeIn(D),N.settings.areSameItem=function(e,t,r,n){return e==t?d(r,n):!1},D.parseQueryString=function(e){var t,r;if(!e)return null;if(r=e.split("&"),0==r.length)return null;t={};for(var n=0;n<r.length;n++){var a=r[n];if(""!==a){var i=a.split("=");t[i[0]]=i[1]&&decodeURIComponent(i[1].replace(/\+/g," "))}}return t},D.route=function(e,t){D.handlers.push({routePattern:e,callback:t})},D.loadUrl=function(t){var r=D.handlers,n=null,a=t,o=t.indexOf("?");if(-1!=o&&(a=t.substring(0,o),n=t.substr(o+1)),D.relativeToParentRouter){var s=this.parent.activeInstruction();a=s.params.join("/"),a&&"/"==a.charAt(0)&&(a=a.substr(1)),a||(a=""),a=a.replace("//","/").replace("//","/")}a=a.replace(b,"");for(var l=0;l<r.length;l++){var c=r[l];if(c.routePattern.test(a))return c.callback(a,n),!0}return e.log("Route Not Found"),D.trigger("router:route:not-found",t,D),T&&i.navigate(T.fragment,{trigger:!1,replace:!0}),v.explicitNavigation=!1,v.navigatingBack=!1,!1},D.updateDocumentTitle=function(e,r){r.config.title?document.title=t.title?r.config.title+" | "+t.title:r.config.title:t.title&&(document.title=t.title)},D.navigate=function(e,t){return e&&-1!=e.indexOf("://")?(window.location.href=e,!0):(v.explicitNavigation=!0,i.navigate(e,t))},D.navigateBack=function(){i.navigateBack()},D.attached=function(){D.trigger("router:navigation:attached",E,T,D)},D.compositionComplete=function(){U(!1),D.trigger("router:navigation:composition-complete",E,T,D),A()},D.convertRouteToHash=function(e){if(D.relativeToParentRouter){var t=D.parent.activeInstruction(),r=t.config.hash+"/"+e;return i._hasPushState&&(r="/"+r),r=r.replace("//","/").replace("//","/")}return i._hasPushState?e:"#"+e},D.convertRouteToModuleId=function(e){return c(e)},D.convertRouteToTitle=function(e){var t=c(e);return t.substring(0,1).toUpperCase()+t.substring(1)},D.map=function(t,r){if(e.isArray(t)){for(var n=0;n<t.length;n++)D.map(t[n]);return D}return e.isString(t)||e.isRegExp(t)?(r?e.isString(r)&&(r={moduleId:r}):r={},r.route=t):r=t,C(r)},D.buildNavigationModel=function(t){for(var r=[],n=D.routes,a=t||100,i=0;i<n.length;i++){var o=n[i];o.nav&&(e.isNumber(o.nav)||(o.nav=++a),r.push(o))}return r.sort(function(e,t){return e.nav-t.nav}),D.navigationModel(r),D},D.mapUnknownRoutes=function(t,r){var n="*catchall",a=l(n);return D.route(a,function(o,s){var l=S(a,o,s),c={fragment:o,queryString:s,config:{route:n,routePattern:a},params:l.params,queryParams:l.queryParams};if(t)if(e.isString(t))c.config.moduleId=t,r&&i.navigate(r,{trigger:!1,replace:!0});else if(e.isFunction(t)){var u=t(c);if(u&&u.then)return u.then(function(){D.trigger("router:route:before-config",c.config,D),D.trigger("router:route:after-config",c.config,D),I(c)}),void 0}else c.config=t,c.config.route=n,c.config.routePattern=a;else c.config.moduleId=o;D.trigger("router:route:before-config",c.config,D),D.trigger("router:route:after-config",c.config,D),I(c)}),D},D.reset=function(){return T=E=void 0,D.handlers=[],D.routes=[],D.off(),delete D.options,D},D.makeRelative=function(t){return e.isString(t)&&(t={moduleId:t,route:t}),t.moduleId&&!u(t.moduleId,"/")&&(t.moduleId+="/"),t.route&&!u(t.route,"/")&&(t.route+="/"),t.fromParent&&(D.relativeToParentRouter=!0),D.on("router:route:before-config").then(function(e){t.moduleId&&(e.moduleId=t.moduleId+e.moduleId),t.route&&(e.route=""===e.route?t.route.substring(0,t.route.length-1):t.route+e.route)}),D},D.createChildRouter=function(){var e=w();return e.parent=D,e},D};return v=w(),v.explicitNavigation=!1,v.navigatingBack=!1,v.targetIsThisWindow=function(e){var t=s(e.target).attr("target");return!t||t===window.name||"_self"===t||"top"===t&&window===window.top?!0:!1},v.activate=function(t){return e.defer(function(r){if(f=r,v.options=e.extend({routeHandler:v.loadUrl},v.options,t),i.activate(v.options),i._hasPushState)for(var n=v.routes,a=n.length;a--;){var o=n[a];o.hash=o.hash.replace("#","")}s(document).delegate("a","click",function(e){if(i._hasPushState){if(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&v.targetIsThisWindow(e)){var t=s(this).attr("href");null==t||"#"===t.charAt(0)||/^[a-z]+:/i.test(t)||(v.explicitNavigation=!0,e.preventDefault(),i.navigate(t))}}else v.explicitNavigation=!0}),i.options.silent&&f&&(f.resolve(),f=null)}).promise()},v.deactivate=function(){i.deactivate()},v.install=function(){o.bindingHandlers.router={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t,r,n,i){var s=o.utils.unwrapObservable(t())||{};if(s.__router__)s={model:s.activeItem(),attached:s.attached,compositionComplete:s.compositionComplete,activate:!1};else{var l=o.utils.unwrapObservable(s.router||n.router)||v;s.model=l.activeItem(),s.attached=l.attached,s.compositionComplete=l.compositionComplete,s.activate=!1}a.compose(e,s,i)}},o.virtualElements.allowedBindings.router=!0},v});
  define('services/routeconfig',[],function(){var e={lookupUrl:"durandalauth/lookups",saveChangesUrl:"durandalauth/savechanges",publicArticlesUrl:"durandalauth/publicarticles",privateArticlesUrl:"durandalauth/privatearticles",categoriesUrl:"durandalauth/categories",addExternalLoginUrl:"/api/account/addexternallogin",changePasswordUrl:"/api/account/changepassword",loginUrl:"/token",logoutUrl:"/api/account/logout",registerUrl:"/api/account/register",registerExternalUrl:"/api/account/registerexternal",removeLoginUrl:"/api/account/removelogin",setPasswordUrl:"/api/account/setpassword",siteUrl:"/",userInfoUrl:"/api/account/userinfo",getUsersUrl:"/api/account/getusers",forgotPassword:"/api/account/forgotpassword",resendMailRoute:"/api/account/resendconfirmationemail",resetPassword:"/api/account/resetpassword",deleteaccount:"/api/account/deleteaccount"};return e});
  define('services/utils',[],function(){function e(e){return decodeURI((RegExp(e+"="+"(.+?)(&|$)").exec(location.href)||[,null])[1])}function t(e){1===e.nodeType&&$(e).addClass("animated fadeInLeft")}function n(e){1===e.nodeType&&($(e).addClass("animated fadeOutLeft"),setTimeout(function(){$(e).remove()},500))}function r(){return moment.utc().format()}function a(e){try{var t=e.entityErrors[0];return"Validation Error: "+t.errorMessage}catch(n){return"Save validation error"}}function i(e){try{var t=e.entityAspect.getValidationErrors(),n=t.map(function(e){return e.errorMessage});return n.length?n.join("; "):"no validation errors"}catch(r){return"not an entity"}}function o(){var e=["xs","sm","md","lg"];$el=$("<div>"),$el.appendTo($("body"));for(var t=e.length-1;t>=0;t--){var n=e[t];if($el.addClass("hidden-"+n),$el.is(":hidden"))return $el.remove(),n}}function s(e){var t=e.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof t[1]&&t[1].length>0&&t[1].toLowerCase()!==location.protocol?!0:"string"==typeof t[2]&&t[2].length>0&&t[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host?!0:!1}return{getUrlParameter:e,addItemAnimation:t,removeItemAnimation:n,getCurrentDate:r,getSaveValidationErrorMessage:a,getEntityValidationErrorMessage:i,findBootstrapEnvironment:o,isExternal:s}});
  define('services/logger',["durandal/system"],function(e){function t(e,t,n,r){a(e,t,n,r,"info")}function n(e,t,n,r){a(e,t,n,r,"error")}function r(e,t,n,r){a(e,t,n,r,"success")}function a(t,n,r,a,i){r=r?"["+r+"] ":"",n?e.log(r,t,n):e.log(r,t),a&&("error"===i?Stashy.Notify({title:"<i class='fa fa-warning'></i>   Something failed",content:t,titleSize:4,style:"error",contentType:"inline",animDuration:"fast",closeArea:"element",activeDuration:5e3}).toast("right","bottom",!0):"success"===i?Stashy.Notify({title:"<i class='fa fa-smile-o'></i>   Success !!",content:t,titleSize:4,style:"success",contentType:"inline",animDuration:"fast",closeArea:"element",activeDuration:5e3}).toast("right","bottom",!0):Stashy.Notify({title:"<i class='fa fa-info'></i>   Info message",content:t,titleSize:4,style:"info",contentType:"inline",animDuration:"fast",closeArea:"element",activeDuration:5e3}).toast("right","bottom",!0))}function i(e){var t="We sent you a message for confirm your account. If you didn't receive it check your spam folder or <a id='sendConfirmationMail' class='btn btn-danger'>click here</a> in order to resend it",n="The route you are trying to access is restricted to confirmed accounts. Check you email account to find a mail we sent you and confirm it. If you didn't receive it check your spam folder or <a id='sendConfirmationMail' class='btn btn-danger'>click here</a> in order to resend it";Stashy.Notify({title:"<i class='fa fa-warning'></i>   Your account is not confirmed",content:e?n:t,titleSize:4,style:"error",contentType:"inline",animDuration:"fast",closeArea:"element"}).bar("bottom")}var o={log:t,logError:n,logSuccess:r,showAccountWarning:i};return o});
  define('services/appsecurity',["durandal/system","durandal/app","plugins/router","services/routeconfig","services/utils","services/logger"],function(e,t,n,r,a,i){function o(e,t){return"/api/account/externalLogins?returnUrl="+encodeURIComponent(e)+"&generateState="+(t?"true":"false")}function s(e,t){return"/api/account/manageinfo?returnUrl="+encodeURIComponent(e)+"&generateState="+(t?"true":"false")}function l(){var e=sessionStorage.accessToken||localStorage.accessToken;return e?{Authorization:"Bearer "+e}:{}}function c(){return 0===window.location.hash.indexOf("#")?d(window.location.hash.substr(1)):{}}function d(e){var t,n,r,a,i,o,s,l={};if(null===e)return l;t=e.split("&");for(var c=0;c<t.length;c++)n=t[c],r=n.indexOf("="),-1===r?(a=n,i=null):(a=n.substr(0,r),i=n.substr(r+1)),o=decodeURIComponent(a),s=decodeURIComponent(i),l[o]=s;return l}function u(){localStorage.removeItem("accessToken"),sessionStorage.removeItem("accessToken")}function f(e,t){t?localStorage.accessToken=e:sessionStorage.accessToken=e}function h(e){var t;"undefined"!=typeof e.access_token&&(t=sessionStorage.state,sessionStorage.removeItem("state"),(null===t||e.state!==t)&&(e.error="invalid_state"))}function v(){window.location.hash="",history&&"undefined"!=typeof history.pushState&&history.pushState("",document.title,location.pathname)}function p(){for(var e={},t=0;t<sessionStorage.length;t++)e[sessionStorage.key(t)]=sessionStorage[sessionStorage.key(t)];localStorage.sessionStorageBackup=JSON.stringify(e),sessionStorage.clear()}function g(){var e,t=localStorage.sessionStorageBackup;if(t){e=JSON.parse(t);for(var n in e)sessionStorage[n]=e[n];localStorage.removeItem("sessionStorageBackup")}}function m(e,t,n){this.name=ko.observable(e),this.roles=ko.observableArray(t),this.isEmailConfirmed=ko.observable(n)}function b(){$(document).off("click","#sendConfirmationMail"),$(document).on("click","#sendConfirmationMail",function(){w().then(function(e,t){i.logSuccess("Email sent. Please check your inbox and confirm your account",t,null,!0)}).fail(function(e,t,n){i.logError(n,t,null,!0)})})}function w(){return $.ajax(r.resendMailRoute,{type:"POST",headers:l()})}return{userInfo:ko.observable(),setAuthInfo:function(e,t,n,r,a){var i=this;r&&f(r,a),"string"==typeof t&&(t=t.split(",")),i.userInfo(new m(e,t,n)),0==n&&i.showConfirmationWarning(!1)},showConfirmationWarning:function(e){i.showAccountWarning(e),b()},clearAuthInfo:function(){var e=this;u(),e.userInfo(void 0)},isUserInRole:function(e){var t=this,n=!1;return $.each(e,function(e,r){-1!==t.userInfo().roles.indexOf(r)&&(n=!0)}),n},getSecurityHeaders:l,archiveSessionStorageToLocalStorage:p,returnUrl:r.siteUrl,addExternalLogin:function(e){return $.ajax(r.addExternalLoginUrl,{type:"POST",data:e,headers:l()})},changePassword:function(e){return $.ajax(r.changePasswordUrl,{type:"POST",data:e,headers:l()})},getExternalLogins:function(e,t){return $.ajax(o(e,t),{cache:!1,headers:l()})},getManageInfo:function(e,t){return $.ajax(s(e,t),{cache:!1,headers:l()})},getUserInfo:function(e){var t;return t="undefined"!=typeof e?{Authorization:"Bearer "+e}:l(),$.ajax(r.userInfoUrl,{cache:!1,headers:t})},login:function(e){return $.ajax(r.loginUrl,{type:"POST",data:e})},logout:function(){return $.ajax(r.logoutUrl,{type:"POST",headers:l()})},register:function(e){return $.ajax(r.registerUrl,{type:"POST",data:e})},registerExternal:function(e,t){return $.ajax(r.registerExternalUrl,{type:"POST",data:t,headers:{Authorization:"Bearer "+e}})},removeLogin:function(e){return $.ajax(r.removeLoginUrl,{type:"POST",data:e,headers:l()})},setPassword:function(e){return $.ajax(r.setPasswordUrl,{type:"POST",data:e,headers:l()})},getUsers:function(){return $.ajax(r.getUsersUrl,{type:"GET",headers:l()})},forgotPassword:function(e){return $.ajax(r.forgotPassword,{type:"POST",data:e,cache:!1,headers:l()})},resetPassword:function(e){return $.ajax(r.resetPassword,{type:"POST",data:e,cache:!1,headers:l()})},deleteAccount:function(){return $.ajax(r.deleteaccount,{type:"POST",cache:!1,headers:l()})},initializeAuth:function(){var t=this;return e.defer(function(e){var n,r,a,i=c();g(),h(i),sessionStorage.associatingExternalLogin?(sessionStorage.removeItem("associatingExternalLogin"),"undefined"!=typeof i.error?(n=null,r=i.error,v()):"undefined"!=typeof i.access_token?(n=i.access_token,r=null,v()):(n=null,r=null,v()),t.getUserInfo().done(function(a){a.userName&&(t.setAuthInfo(a.userName,a.roles,a.isEmailConfirmed),sessionStorage.redirectTo="account/manage?externalAccessToken="+n+"&externalError="+r),e.resolve(!0)}).fail(function(){e.resolve(!0)})):"undefined"!=typeof i.error?(v(),sessionStorage.redirectTo="account/externalloginfailure",e.resolve(!0)):"undefined"!=typeof i.access_token?(v(),t.getUserInfo(i.access_token).done(function(n){"undefined"!=typeof n.userName&&"undefined"!=typeof n.hasRegistered&&"undefined"!=typeof n.loginProvider?n.hasRegistered?(t.setAuthInfo(n.userName,n.roles,n.isEmailConfirmed,i.access_token,!1),e.resolve(!0)):"undefined"!=typeof sessionStorage.loginUrl?(a=sessionStorage.loginUrl,sessionStorage.removeItem("loginUrl"),sessionStorage.redirectTo="account/externalloginconfirmation?userName="+n.userName+"&loginProvider="+n.loginProvider+"&access_token="+i.access_token+"&loginUrl="+encodeURIComponent(a)+"&state="+i.state,e.resolve(!0)):e.resolve(!0):e.resolve(!0)}).fail(function(){e.resolve(!0)})):sessionStorage.accessToken||localStorage.accessToken?t.getUserInfo().done(function(n){n.userName&&t.setAuthInfo(n.userName,n.roles,n.isEmailConfirmed),e.resolve(!0)}).fail(function(){e.resolve(!0)}):e.resolve(!0)}).promise()}}});
  requirejs.config({baseUrl:"/App",paths:{text:"../Scripts/text",durandal:"../Scripts/durandal",plugins:"../Scripts/durandal/plugins",transitions:"../Scripts/durandal/transitions"}}),define("jquery",[],function(){return jQuery}),define("knockout",ko),define('main',["durandal/app","durandal/viewLocator","durandal/system","services/appsecurity"],function(e,t,n,r){n.debug(!0),e.title="Durandal Auth",e.configurePlugins({router:!0,dialog:!0,widget:{kinds:["expander"]}}),e.start().then(function(){t.useConvention();var n=new Stashy.Loader("body");$(document).ajaxStart(function(){n.on("fixed","-5px","#FFF","prepend")}).ajaxComplete(function(){n.off()}),ko.validation.init({decorateElement:!0,errorElementClass:"has-error",registerExtenders:!0,messagesOnModified:!0,insertMessages:!0,parseInputAttributes:!0,messageTemplate:null}),marked.setOptions({highlight:function(e){return hljs.highlightAuto(e).value},sanitize:!0,breaks:!0}),$(document).on("keyup",".auto-height-textarea",function(){$(this).css("height","auto"),$(this).height(this.scrollHeight)}),r.initializeAuth().then(function(){e.setRoot("viewmodels/shell")})})});
  define('model/modelBuilder',["services/appsecurity","services/utils"],function(e,t){function n(e){r(e),a(e),i(e)}function r(n){var r=function(){this.articleId=ko.observable(breeze.core.getUuid()),this.imageUrl=ko.observable("/Content/icons/no_photo.png"),this.createdBy=ko.observable("undefined"!=typeof e.userInfo()?e.userInfo().userName:""),this.updatedBy=ko.observable("undefined"!=typeof e.userInfo()?e.userInfo().userName:""),this.isPublished=ko.observable(!1);var n=t.getCurrentDate();this.createdDate=ko.observable(n),this.updatedDate=ko.observable(n)};r.prototype.addTag=function(e){var t=this.entityAspect.entityManager.createEntity("Tag",{name:e,articleId:this.articleId()});return this.tags.push(t),t},r.prototype.deleteTag=function(e){o(e,"Tag"),this.throwIfNotOwnerOf(e),e.entityAspect.setDeleted()},r.prototype.throwIfNotOwnerOf=function(e){if(!e.articleId||e.articleId()!==this.articleId())throw new Error("Object is not associated with current Article")};var a=function(e){s(e),l(e),e.splitTags=ko.computed(function(){var t=[];return ko.utils.arrayForEach(e.tags(),function(e){t.push(e.name())}),t.join(",")}),e.formattedCreatedDate=ko.computed(function(){return moment(e.createdDate()).format("MMM Do YY")}),e.unsavedChanges=ko.observable(e.entityAspect.entityState.isAddedModifiedOrDeleted())};n.registerEntityTypeCtor("Article",r,a)}function a(e){var t=function(){this.categoryId=ko.observable(breeze.core.getUuid())};e.registerEntityTypeCtor("Category",t)}function i(e){var t=function(){this.tagId=ko.observable(breeze.core.getUuid())};e.registerEntityTypeCtor("Tag",t)}function o(e,t){if(!e.entityType||e.entityType.shortName!==t)throw new Error("Object must be an entity of type "+t)}function s(e){var t,n,r,a,i,o,s,l,d=e.entityType;if(d){for(t=0;t<d.dataProperties.length;t+=1){for(n=d.dataProperties[t],r=n.name,a=e[r],i=[],o=0;o<n.validators.length;o+=1)s=n.validators[o],l={propertyName:r,validator:function(e){var t=this.innerValidator.validate(e,{displayName:this.propertyName});return this.message=t?t.errorMessage:"",null===t},message:"",innerValidator:s},i.push(l);a.extend({validation:i})}for(t=0;t<d.foreignKeyProperties.length;t+=1){for(n=d.foreignKeyProperties[t],r=n.name,a=e[r],i=[],o=0;o<n.validators.length;o+=1)s=n.validators[o],l={propertyName:r,validator:function(e){var t=this.innerValidator.validate(e,{displayName:this.propertyName});return this.message=t?t.errorMessage:"",null===t},message:"",innerValidator:s},i.push(l);a.extend({validation:i}),n.isNullable||a.extend({notEqual:c})}}}function l(e){var t=ko.observable(!1),n=function(){var n=e.entityAspect.getValidationErrors().length>0;t()===n?t.valueHasMutated():t(n)};n(),e.entityAspect.validationErrorsChanged.subscribe(n),e.hasValidationErrors=t}var c=0,d={extendMetadata:n};return d});
  define('services/entitymanagerprovider',["durandal/app","services/routeconfig","services/appsecurity"],function(e,t,n){function r(){return new l}function a(){return s.fetchMetadata().then(function(){c.modelBuilder&&c.modelBuilder(s.metadataStore);var e=breeze.EntityQuery.from(t.lookupUrl);return s.executeQuery(e)}).fail(function(e){console.log(e)})}breeze.NamingConvention.camelCase.setAsDefault();var i=breeze.config.getAdapterInstance("ajax");i.defaultSettings={headers:n.getSecurityHeaders()};var o="/breeze",s=new breeze.EntityManager(o),l=function(){var t=function(){var t;this.manager=function(){return t||(t=s.createEmptyCopy(),t.importEntities(s.exportEntities()),t.hasChangesChanged.subscribe(function(){e.trigger("hasChanges")})),t}};return t}(),c={prepare:a,create:r};return c});
  define('services/errorhandler',["services/logger","durandal/system","services/utils"],function(e,t,n){function r(e){return $.extend(e,new a(e))}var a=function(){var r=function(r){this.handleError=function(a){throw a.entityErrors&&(a.message=n.getSaveValidationErrorMessage(a)),e.logError(a.message,null,t.getModuleId(r),!0),a},this.log=function(n,a){e.log(n,null,t.getModuleId(r),a)},this.handlevalidationerrors=function(t){var n,r;try{n=$.parseJSON(t.responseText)}catch(a){n=null}if(n&&n.message){if(n.modelState)for(var i in n.modelState)if(r=n.modelState[i],r.length)for(var o=0;o<r.length;o++)e.logError(r[o],null,r,!0);0===r.length&&e.logError(n.message,null,n,!0)}},this.handleauthenticationerrors=function(t){if(""!=t.responseText){var n=$.parseJSON(t.responseText);n&&n.error_description?e.logError(n.error_description,null,t,!0):n.message&&e.logError(n.message,null,t,!0)}}};return r}();return{includeIn:r}});
  define('services/repository',[],function(){function e(e,n,r,a){return new t(e,n,r,a)}var t=function(){var e=function(e,t,n,r){function a(t){return e.manager().executeQuery(t.using(r||breeze.FetchStrategy.FromServer)).then(function(e){return e.results})}function i(t){return e.manager().executeQueryLocally(t)}function o(){return s().metadataStore}function s(){return e.manager()}function l(e,t){if(!e.entityType||e.entityType.shortName!==t)throw new Error("Object must be an entity of type "+t)}var c;t&&(c=o().getEntityType(t),c.setProperties({defaultResourceName:n}),o().setEntityTypeForResourceName(n,t)),this.withId=function(e){if(!t)throw new Error("Repository must be created with an entity type specified");return s().fetchEntityByKey(t,e,!0).then(function(e){if(!e.entity)throw new Error("Entity not found!");return e.entity})},this.find=function(e){var t=breeze.EntityQuery.from(n).where(e);return a(t)},this.findInCache=function(e){var t=breeze.EntityQuery.from(n).where(e);return i(t)},this.all=function(){var e=breeze.EntityQuery.from(n);return a(e)},this.create=function(e){var n=s().createEntity(t,e);return n},this.delete=function(e){l(e,t),e.entityAspect.setDeleted(e)}};return e}();return{create:e,getCtor:t}});
  define('services/privatearticlerepository',["services/repository"],function(e){function t(e,t,r,a){return new n(e,t,r,a)}var n=function(){var t=function(t,n,r,a){function i(e){return t.manager().executeQuery(e.using(a||breeze.FetchStrategy.FromServer)).then(function(e){return e.results})}e.getCtor.call(this,t,n,r,a),this.all=function(){var e=breeze.EntityQuery.from(r).orderBy("createdDate desc").expand("Tags");return i(e)}};return t.prototype=e.create(),t}();return{create:t}});
  define('services/publicarticlerepository',["services/repository"],function(e){function t(e,t,r,a){return new n(e,t,r,a)}var n=function(){var t=function(t,n,r,a){function i(e){return t.manager().executeQuery(e.using(a||breeze.FetchStrategy.FromServer)).then(function(e){return e.results})}e.getCtor.call(this,t,n,r,a),this.find=function(e,t,n){var a=breeze.EntityQuery.from(r).where(e).orderBy("createdDate desc").expand("Category,Tags").skip(t*n).take(n);return i(a)}};return t.prototype=e.create(),t}();return{create:t}});
  define('services/unitofwork',["services/entitymanagerprovider","services/repository","services/privatearticlerepository","services/publicarticlerepository","durandal/app","services/routeconfig"],function(e,t,n,r,a,i){function o(){return new u}function s(e){return c[e]||(c[e]=new d),c[e]}function l(){for(key in c)0==c[key].referenceCount&&delete c[key]}var c={},u=function(){var o=function(){var o=e.create();this.hasChanges=function(){return o.manager().hasChanges()},this.commit=function(){var e=new breeze.SaveOptions({resourceName:i.saveChangesUrl});return o.manager().saveChanges(null,e).then(function(e){a.trigger("saved",e.entities)})},this.rollback=function(){o.manager().rejectChanges()},this.privatearticles=n.create(o,"Article",i.privateArticlesUrl),this.publicarticles=r.create(o,"Article",i.publicArticlesUrl),this.categories=t.create(o,"Category",i.categoriesUrl,breeze.FetchStrategy.FromLocalCache)};return o}(),d=function(){var e=function(){var e=null;this.referenceCount=0,this.value=function(){return null===e&&(e=new u),this.referenceCount++,e},this.clear=function(){e=null,this.referenceCount=0,l()}};return e.prototype.release=function(){this.referenceCount--,0===this.referenceCount&&this.clear()},e}();return{create:o,get:s}});
  define('viewmodels/account/externalloginconfirmation',["services/appsecurity","plugins/router","services/errorhandler","services/utils"],function(e,t,r,n){var a=ko.observable(),i=ko.observable().extend({required:!0}),o=ko.observable().extend({required:!0,email:!0}),s=ko.observable(),l=ko.observable(),c=ko.observable(),u={loginProvider:a,userName:i,email:o,activate:function(){var e=this;return ga("send","pageview",{page:window.location.href,title:document.title}),e.loginProvider(n.getUrlParameter("loginProvider")),e.userName(n.getUrlParameter("userName")),s=n.getUrlParameter("access_token"),l=decodeURIComponent(n.getUrlParameter("loginUrl")),c=n.getUrlParameter("state"),!0},confirmexternalaccount:function(){var t=this;return 0!=this.errors().length?(this.errors.showAllMessages(),void 0):(e.registerExternal(s,{userName:t.userName(),email:t.email()}).done(function(){sessionStorage.state=c,sessionStorage.redirectTo="account/manage",e.archiveSessionStorageToLocalStorage(),window.location=l}).fail(t.handlevalidationerrors),void 0)}};return r.includeIn(u),u.errors=ko.validation.group(u),u});
  define('viewmodels/account/externalloginfailure',["plugins/router"],function(e){return{convertRouteToHash:e.convertRouteToHash,activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})}}});
  define('viewmodels/account/forgotpassword',["services/appsecurity","plugins/router","services/errorhandler","services/logger"],function(e,t,r,n){var a=ko.observable().extend({required:!0,email:!0}),i={email:a,activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})},forgotPassword:function(){var t=this;return 0!=this.errors().length?(this.errors.showAllMessages(),void 0):(e.forgotPassword({eMail:t.email()}).done(function(e){n.log("Take a look to your inbox for instructions about how to reset your password",e,null,!0),t.email(""),t.errors.showAllMessages(!1)}).fail(t.handlevalidationerrors),void 0)}};return r.includeIn(i),i.errors=ko.validation.group(i),i});
  define('viewmodels/account/login',["services/appsecurity","plugins/router","services/errorhandler","services/utils","services/logger"],function(e,t,r,n,a){function i(t,r){var n=this;n.name=ko.observable(t.name),n.login=function(){sessionStorage.state=t.state,sessionStorage.loginUrl=t.url,sessionStorage.redirectTo=r?r:"account/manage",e.archiveSessionStorageToLocalStorage(),window.location=t.url},n.socialIcon=function(e){var t="";switch(e.name().toLowerCase()){case"facebook":t="fa fa-facebook-square";break;case"twitter":t="fa fa-twitter-square";break;case"google":t="fa fa-google-plus-square";break;case"microsoft":t="fa fa-envelope";break;default:t="fa fa-check-square"}return t}}var o=ko.observable().extend({required:!0}),s=ko.observable().extend({required:!0,minLength:6}),l=ko.observable(!1),c=ko.observable(null);ko.observable(!1);var u={convertRouteToHash:t.convertRouteToHash,username:o,password:s,rememberMe:l,returnUrl:c,appsecurity:e,externalLoginProviders:ko.observableArray(),activate:function(t){var r=this;return ga("send","pageview",{page:window.location.href,title:document.title}),t&&t.returnUrl&&r.returnUrl(t.returnUrl),e.getExternalLogins(e.returnUrl,!0).then(function(e){if("object"==typeof e){r.externalLoginProviders.removeAll();for(var t=0;t<e.length;t++)r.externalLoginProviders.push(new i(e[t],r.returnUrl()?r.returnUrl():null))}}).fail(r.handleauthenticationerrors)},login:function(){var r=this;return 0!=this.errors().length?(this.errors.showAllMessages(),void 0):(e.login({grant_type:"password",username:r.username(),password:r.password()}).done(function(i){if(i.userName&&i.access_token){e.setAuthInfo(i.userName,i.roles,"true"==i.emailConfirmed?!0:!1,i.access_token,r.rememberMe());var o=breeze.config.getAdapterInstance("ajax");if(o.defaultSettings={headers:e.getSecurityHeaders()},r.username(""),r.password(""),r.rememberMe(!1),r.errors.showAllMessages(!1),r.returnUrl()&&n.isExternal(r.returnUrl()))return a.logError("Can�t redirect to external urls",r.returnUrl(),null,!0),!1;r.returnUrl()?t.navigate(r.returnUrl()):t.navigate("account/manage")}}).fail(r.handleauthenticationerrors),void 0)},logout:function(){e.logout()}};return r.includeIn(u),u.errors=ko.validation.group(u),u});
  define('viewmodels/account/manage',["durandal/system","services/appsecurity","services/errorhandler","services/logger","services/utils","durandal/app","plugins/router"],function(e,t,r,n,a,i){function o(e){var r=this;r.name=ko.observable(e.name),r.login=function(){sessionStorage.state=e.state,sessionStorage.associatingExternalLogin=!0,t.archiveSessionStorageToLocalStorage(),window.location=e.url},r.socialIcon=function(e){var t="";switch(e.name().toLowerCase()){case"facebook":t="fa fa-facebook-square";break;case"twitter":t="fa fa-twitter-square";break;case"google":t="fa fa-google-plus-square";break;case"microsoft":t="fa fa-envelope";break;default:t="fa fa-check-square"}return t}}function s(e){function a(){i.oldPassword(null),i.newPassword(null),i.confirmPassword(null),i.changing(!1),i.validationErrors.showAllMessages(!1)}var i=this;i.name=ko.observable(e),i.oldPassword=ko.observable("").extend({required:!0}),i.newPassword=ko.observable("").extend({required:!0}),i.confirmPassword=ko.observable("").extend({required:!0,equal:i.newPassword}),i.changing=ko.observable(!1),i.validationErrors=ko.validation.group([i.oldPassword,i.newPassword,i.confirmPassword]),r.includeIn(i),i.change=function(){return i.validationErrors().length>0?(i.validationErrors.showAllMessages(),void 0):(i.changing(!0),t.changePassword({oldPassword:i.oldPassword(),newPassword:i.newPassword(),confirmPassword:i.confirmPassword()}).done(function(){i.changing(!1),a(),n.logSuccess("Password changed",null,null,!0)}).fail(i.handlevalidationerrors).fail(function(){i.changing(!1)}),void 0)}}function l(e,a){var i=this,o=ko.observable(e.providerKey);i.loginProvider=ko.observable(e.loginProvider),i.removing=ko.observable(!1),r.includeIn(i),i.remove=function(){var e=this;e.removing(!0),t.removeLogin({loginProvider:e.loginProvider(),providerKey:o()}).done(function(){e.removing(!1),a.remove(e),n.logSuccess("Login removed succesfully",null,null,!0)}).fail(e.handlevalidationerrors).fail(function(){e.removing(!1)})}}function c(e,a,i){var o=this;o.newPassword=ko.observable("").extend({required:!0}),o.confirmPassword=ko.observable("").extend({required:!0,equal:o.newPassword}),o.setting=ko.observable(!1),o.validationErrors=ko.validation.group([o.newPassword,o.confirmPassword]),o.set=function(){var o=this;return o.validationErrors().length>0?(o.validationErrors.showAllMessages(),void 0):(o.setting(!0),r.includeIn(o),t.setPassword({newPassword:o.newPassword(),confirmPassword:o.confirmPassword()}).done(function(){o.setting(!1),e.push(new l({loginProvider:a(),providerKey:i()},e)),n.logSuccess("Password set successfully",null,null,!0)}).fail(o.handlevalidationerrors).fail(function(){o.setting(!1)}),void 0)}}var u,d,f=ko.observable(),h=ko.observableArray(),g=ko.observableArray(),v=ko.observable(),p=ko.computed(function(){for(var e=h(),t=0;t<e.length;t++)if(e[t].loginProvider()===v())return!0;return!1}),m=ko.computed(function(){return g().length>0}),m=ko.computed(function(){return g().length>0}),b=ko.computed(function(){return h().length>1}),w={userName:f,localLoginProvider:v,addExternalLogin:function(r,a){var i=this;return e.defer(function(e){"null"!==a||null===r?(n.logError("External login error",null,null,!0),e.resolve()):t.addExternalLogin({externalAccessToken:r}).done(function(){e.resolve()}).fail(function(t){i.handleauthenticationerrors(t),e.resolve()})})},userLogins:h,hasLocalPassword:p,externalLoginProviders:g,loading:ko.observable(!0),message:ko.observable(),changePassword:new s(f()),setPassword:new c(h,v,f),hasExternalLogin:m,canRemoveLogin:b,initialize:function(){var e=this;t.getManageInfo(t.returnUrl,!0).done(function(t){if("undefined"!=typeof t.localLoginProvider&&"undefined"!=typeof t.userName&&"undefined"!=typeof t.logins&&"undefined"!=typeof t.externalLoginProviders){e.userName(t.userName),e.localLoginProvider(t.localLoginProvider),e.userLogins.removeAll();for(var r=0;r<t.logins.length;r++)e.userLogins.push(new l(t.logins[r],e.userLogins));e.externalLoginProviders.removeAll();for(var r=0;r<t.externalLoginProviders.length;r++)e.externalLoginProviders.push(new o(t.externalLoginProviders[r]))}else n.logError("Error retrieving user account information",null,null,!0);e.loading(!1)}).fail(e.handlevalidationerrors).fail(function(){e.loading(!1)})},activate:function(){var e=this;return ga("send","pageview",{page:window.location.href,title:document.title}),u=a.getUrlParameter("externalAccessToken"),d=a.getUrlParameter("externalError"),"null"===u&&"null"===d?e.initialize():(e.addExternalLogin(u,d).done(function(){return e.initialize()}),void 0)},deleteAccount:function(){var e=this;return i.showMessage("The account will be removed permanently","Are you sure?",["Yes","No"]).then(function(r){"Yes"===r&&t.deleteAccount().done(function(){t.logout().done(function(){t.clearAuthInfo(),window.location="/account/login"}).fail(e.handlevalidationerrors)}).fail(e.handlevalidationerrors)})}};return r.includeIn(w),w});
  define('viewmodels/account/register',["services/appsecurity","plugins/router","services/errorhandler"],function(e,t,r){var n=ko.observable().extend({required:!0}),a=ko.observable().extend({required:!0,email:!0}),i=ko.observable().extend({required:!0,minLength:6}),o=ko.observable().extend({required:!0,minLength:6,equal:i}),s={username:n,email:a,password:i,confirmpassword:o,activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})},register:function(){var r=this;return 0!=this.errors().length?(this.errors.showAllMessages(),void 0):(e.register({userName:r.username(),eMail:r.email(),password:r.password(),confirmPassword:r.confirmpassword()}).done(function(){e.login({grant_type:"password",username:r.username(),password:r.password()}).done(function(n){n.userName&&n.access_token&&(e.setAuthInfo(n.userName,n.roles,!1,n.access_token,r.rememberMe),r.username(""),r.email(""),r.password(""),r.confirmpassword(""),r.errors.showAllMessages(!1)),t.navigate("account/manage")}).fail(r.handleauthenticationerrors)}).fail(r.handlevalidationerrors),void 0)}};return r.includeIn(s),s.errors=ko.validation.group(s),s});
  define('viewmodels/account/registrationcomplete',["plugins/router"],function(e){return{router:e}});
  define('viewmodels/account/resetpassword',["services/appsecurity","plugins/router","services/errorhandler","services/logger"],function(e,t,r,n){var a=ko.observable().extend({required:!0,email:!0}),i=ko.observable().extend({required:!0,minLength:6}),o=ko.observable().extend({required:!0,minLength:6,equal:i}),s=ko.observable().extend({required:!0}),l={email:a,password:i,confirmpassword:o,code:s,activate:function(e){var t=this;t.email(decodeURIComponent(e.email)),t.code(decodeURIComponent(e.code)),ga("send","pageview",{page:window.location.href,title:document.title})},resetPassword:function(){var r=this;return 0!=this.errors().length?(this.errors.showAllMessages(),void 0):(e.resetPassword({eMail:r.email(),password:r.password(),confirmPassword:r.confirmpassword(),code:r.code()}).done(function(e){n.logSuccess("Your password was changed succesfully. Try to log in to your account",e,null,!0),t.navigate("account/login")}).fail(r.handlevalidationerrors),void 0)}};return r.includeIn(l),l.errors=ko.validation.group(l),l});
  define('viewmodels/admin/panel',["services/appsecurity"],function(e){var t={userprofiles:ko.observableArray(),activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})},attached:function(){var t=this;e.getUsers().then(function(e){t.userprofiles(e)})}};return t});
  define('viewmodels/header',["plugins/router","services/appsecurity","services/errorhandler","services/utils"],function(e,t,r){var n={router:e,appsecurity:t,logout:function(){var r=this;t.logout().done(function(){t.clearAuthInfo(),window.location=e.activeInstruction().config.authorize?"/account/login":"/home/index"}).fail(r.handlevalidationerrors)}};return r.includeIn(n),n});
  define('viewmodels/home/about',[],function(){return{activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})}}});
  define('viewmodels/home/articles',["services/unitofwork","services/errorhandler","plugins/router"],function(e,t,r){function n(e,t){var r=breeze.Predicate.create("isPublished","==",!0);if(e){var n=breeze.Predicate.create("title",breeze.FilterQueryOp.Contains,e).or(breeze.Predicate.create("description",breeze.FilterQueryOp.Contains,e));r=r.and(n)}return t&&(r=r.and(breeze.Predicate.create("categoryId","==",t))),r}var e=e.create(),a={convertRouteToHash:r.convertRouteToHash,search:ko.observable(""),selectedCategory:ko.observable(""),page:ko.observable(0),count:ko.observable(10),categories:ko.observableArray(),articles:ko.observableArray(),activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})},attached:function(){var t=this;Stashy.OffCanvas("#articles .st-offcanvas",{closeOnClickOutside:!1}).layout(),$("#articles .st-offcanvas").animate({opacity:1},500);var r=e.publicarticles.find(n(t.search(),t.selectedCategory()),t.page(),t.count()).then(function(e){t.articles(e)}),a=e.categories.all().then(function(e){t.categories(e)});return Q.all([r,a]).fail(t.handleError)},evaluateKey:function(){return"keypress"==event.type&&13==event.keyCode&&this.searchArticles(!1),!0},changeSelectedCategory:function(e,t){t.selectedCategory(e.categoryId()),t.searchArticles(!1)},removeSelectedCategory:function(){this.selectedCategory(""),this.searchArticles(!1)},loadMoreArticles:function(){this.page(this.page()+1),this.searchArticles(!0)},searchArticles:function(t){var r=this;t||r.page(0),e.publicarticles.find(n(r.search(),r.selectedCategory()),r.page(),r.count()).then(function(e){t?ko.utils.arrayForEach(e,function(e){r.articles.push(e)}):r.articles(e),e.length<r.count()?$("#btn-loadmore").addClass("disabled"):$("#btn-loadmore").removeClass("disabled")})}};return t.includeIn(a),a});
  define('viewmodels/home/help',["plugins/router"],function(e){return{convertRouteToHash:e.convertRouteToHash,activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})}}});
  define('viewmodels/home/index',["plugins/router"],function(e){return{convertRouteToHash:e.convertRouteToHash,activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})}}});
  define('viewmodels/notfound',["plugins/router"],function(e){return{convertRouteToHash:e.convertRouteToHash,activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})}}});
  define('viewmodels/shell',["plugins/router","services/appsecurity","services/errorhandler","services/entitymanagerprovider","model/modelBuilder"],function(e,t,r,n,a){n.modelBuilder=a.extendMetadata;var o={attached:function(){$(document).find("footer").show()},activate:function(){var r=this;return n.prepare().then(function(){return e.makeRelative({moduleId:"viewmodels"}),e.guardRoute=function(e,r){if(sessionStorage.redirectTo){var n=sessionStorage.redirectTo;return sessionStorage.removeItem("redirectTo"),n}return r.config.authorize?"undefined"!=typeof t.userInfo()?t.isUserInRole(r.config.authorize)?r.config.confirmed?t.userInfo().isEmailConfirmed()?!0:(t.showConfirmationWarning(!0),"/account/login?returnUrl="+encodeURIComponent(r.fragment)):!0:"/account/login?returnUrl="+encodeURIComponent(r.fragment):"/account/login?returnUrl="+encodeURIComponent(r.fragment):!0},e.map([{route:["","home/index"],moduleId:"home/index",title:"Home",nav:!0,hash:"#home/index"},{route:"home/articles",moduleId:"home/articles",title:"Articles",nav:!0,hash:"#home/articles"},{route:"home/help",moduleId:"home/help",title:"Help",nav:!0,hash:"#home/help"},{route:"home/about",moduleId:"home/about",title:"About",nav:!0,hash:"#home/about"},{route:"notfound",moduleId:"notfound",title:"Not found",nav:!1},{route:"admin/panel",moduleId:"admin/panel",title:"Admin Panel",nav:!1,hash:"#admin/panel",authorize:["Administrator"]},{route:"account/login",moduleId:"account/login",title:"Login",nav:!1,hash:"#account/login"},{route:"account/externalloginconfirmation",moduleId:"account/externalloginconfirmation",title:"External login confirmation",nav:!1,hash:"#account/externalloginconfirmation"},{route:"account/externalloginfailure",moduleId:"account/externalloginfailure",title:"External login failure",nav:!1,hash:"#account/externalloginfailure"},{route:"account/register",moduleId:"account/register",title:"Register",nav:!1,hash:"#account/register"},{route:"account/manage",moduleId:"account/manage",title:"Manage account",nav:!1,hash:"#account/manage",authorize:["User","Administrator"]},{route:"account/registrationcomplete",moduleId:"account/registrationcomplete",title:"Registration complete",nav:!1,hash:"#account/registrationcomplete"},{route:"account/forgotpassword",moduleId:"account/forgotpassword",title:"Forgot password",nav:!1,hash:"#account/forgotpassword"},{route:"account/resetpassword",moduleId:"account/resetpassword",title:"Reset password",nav:!1,hash:"#account/resetpassword"},{route:"user/dashboard",moduleId:"user/dashboard",title:"Dashboard",nav:!1,hash:"#user/dashboard",authorize:["User"],confirmed:!0},{route:":createdby/:categorycode/:articlecode",moduleId:"user/article",title:"Article",nav:!1}]).buildNavigationModel().mapUnknownRoutes("notfound","notfound").activate({pushState:!0})}).fail(r.handlevalidationerrors)}};return r.includeIn(o),o});
  define('viewmodels/user/article',["services/unitofwork","plugins/router"],function(e,t){var r,n={article:ko.observable(),activate:function(n,a,o){var i=this;r=n+"/"+a+"/"+o;var s=e.get(r),l=s.value();return ga("send","pageview",{page:window.location.href,title:document.title}),l.publicarticles.find(breeze.Predicate.create("urlCodeReference","==",o).and("category.urlCodeReference","==",a).and("createdBy","==",n),0,1).then(function(e){void 0!=e[0]?i.article(e[0]):t.navigate("notfound")})},deactivate:function(){e.get(r).release()}};return n});
  define('viewmodels/user/dashboard',["services/unitofwork","services/errorhandler","services/logger","services/utils"],function(e,t,r,n){function a(e,t){for(var r=0;r<t().length;r++)if(e==t()[r].name())return t()[r]}function o(e){$("#tags").tagsInput({onAddTag:function(t){e().addTag(t)},onRemoveTag:function(t){e().deleteTag(a(t,e().tags))},defaultText:"New tag"})}var e=e.create(),i={categories:ko.observableArray(),selectedArticle:ko.observable(),articles:ko.observableArray(),updating:ko.observable(!1),preview:ko.observable(!1),activate:function(){ga("send","pageview",{page:window.location.href,title:document.title})},attached:function(){var t=this;Stashy.FocalPoint("#dashboard img").on(),$("#dashboard #edited-article").on("hide.bs.modal",function(){t.selectedArticle().entityAspect.hasValidationErrors&&(ko.validation.group(t.selectedArticle()),t.selectedArticle().errors.showAllMessages()),t.selectedArticle().unsavedChanges(t.selectedArticle().entityAspect.entityState.isAddedModifiedOrDeleted())}),Stashy.ShowMeMore("#dashboard-articles .row",{linkClass:"btn btn-primary",linkText:"Show more articles",howMany:4}).on(),$("#dashboard #edited-article").on("shown.bs.modal",function(){$("#dashboard #edited-article .zen-mode").zenForm({trigger:"#dashboard #edited-article .go-zen"}),$("#dashboard #edited-article .zen-mode").keyup()}),$("#dashboard #edited-article").on("zf-destroyed",function(){$("#dashboard #edited-article .zen-mode").trigger("change")});var r=e.privatearticles.all().then(function(e){t.articles(e)}),n=e.categories.all().then(function(e){t.categories(e)});Q.all([r,n]).fail(t.handleError)},newArticle:function(){var t=this,r=e.privatearticles.create({categoryId:this.categories()[0].categoryId()});this.articles.unshift(r),this.selectedArticle(r),o(t.selectedArticle),this.updating(!1),$("#edited-article").modal("show")},editArticle:function(e){var t=this;this.selectedArticle(e),o(t.selectedArticle),this.updating(!0),$("#edited-article").modal("show")},saveArticles:function(){var t=this;return e.hasChanges()?(e.commit().then(function(){r.logSuccess("Article saved succesfully",null,null,!0),ko.utils.arrayForEach(t.articles(),function(e){e.unsavedChanges(e.entityAspect.entityState.isAddedModifiedOrDeleted())})}).fail(this.handleError),!0):!0},deleteArticle:function(t,n,a){var o=this;ko.utils.arrayForEach(t.tags(),function(){t.deleteTag(t.tags()[0])}),e.privatearticles.delete(t),e.commit().then(function(){n.articles.remove(t),r.logSuccess("Article removed succesfully",null,null,!0),a&&$("#edited-article").modal("hide")}).fail(o.handleError)},closeModal:function(){$("#edited-article").modal("hide")},changePreview:function(e,t){t.preview()?t.preview(!1):t.preview(!0)},convertMarkdown:function(e){e.html(marked(e.markdown()))},utils:n};return t.includeIn(i),i});
  define('text',{load: function(id){throw new Error("Dynamic load not allowed: " + id);}});
  
  define('text!views/account/externalloginconfirmation.html',[],function () { return '<div id="externalloginconfirmation">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1 class="text-center">External login confirmation   <small>confirm your internal user name and mail for this site</small></h1>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-lg-offset-2 col-lg-7">\r\n                <div class="alert alert-success">\r\n                    <button type="button" class="close" data-dismiss="alert">x</button>\r\n                    <strong>You\'ve successfully</strong> authenticated with <span data-bind="text: loginProvider"></span>.\r\n                    Please enter a user name and email for this site and click confirm button to finish\r\n                    logging in.\r\n                </div>\r\n                <form data-bind="submit: confirmexternalaccount">            \r\n                    <div class="page-header">\r\n                        <h4>Associate your <span data-bind="text: loginProvider"></span> account</h4>\r\n                    </div>    \r\n                    <div class="form-group" data-bind="validationElement: userName">\r\n                        <label class="control-label" for="UserName">User name</label>        \r\n                        <input class="form-control" type="text" data-bind="value: userName" placeholder="User name">        \r\n                    </div>\r\n                    <div class="form-group" data-bind="validationElement: email">\r\n                        <label class="control-label" for="Email">Email</label>    \r\n                        <input class="form-control" type="text" data-bind="value: email" placeholder="Email">    \r\n                    </div>\r\n                    <div class="panel-footer">\r\n                        <button type="submit" class="btn btn-primary" >Confirm account</button>    \r\n                    </div>\r\n                </form>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</div>';});
  
  
  define('text!views/account/externalloginfailure.html',[],function () { return '<div id="externalloginfailure">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1>External login failure</h1>\r\n        </div>\r\n        <div class="alert alert-danger">\r\n            <button type="button" class="close" data-dismiss="alert">x</button>\r\n            <strong>Could not authenticate </strong>using your credentials. Try later and if the problem persists <a data-bind="attr: { href: convertRouteToHash(\'/home/about\') }">contact us</a>\r\n        </div>\r\n    </div>\r\n</div>\r\n';});
  
  
  define('text!views/account/forgotpassword.html',[],function () { return '<div id="forgotpassword">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1 class="text-center">Enter your mail   <small>... and we will send you an email with the instructions for resetting your password</small></h1>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-sm-offset-3">\r\n                <form data-bind="submit : forgotPassword" class="form-inline">\r\n                    <div class="form-group" data-bind="validationElement: email">                        \r\n                        <input class="form-control" type="text" data-bind="value: email" placeholder="Email">                        \r\n                    </div>\r\n                    <button type="submit" class="btn btn-primary">Start the process</button>\r\n                    <button type="reset" class="btn btn-default">Clean fields</button>\r\n                </form>\r\n            </div>\r\n        </div>\r\n        <hr />\r\n    </div>\r\n</div>';});
  
  
  define('text!views/account/login.html',[],function () { return '<div id="login">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1>Login to your account   <small>use your site credentials or any of the external providers allowed</small></h1>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-lg-6">\r\n                <form class="form-horizontal">\r\n                    <div class="page-header">\r\n                        <h4>Sign in with your credentials</h4>\r\n                    </div>\r\n                    <div class="form-group" data-bind="validationElement: username">\r\n                        <label class="control-label col-lg-4" for="username">Username</label>\r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="text" data-bind="value: username" placeholder="User name">\r\n                        </div>\r\n                    </div>\r\n                    <div class="form-group" data-bind="validationElement: password">\r\n                        <label class="control-label col-lg-4" for="email">Password</label>\r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="password" data-bind="value: password" placeholder="Password">\r\n                        </div>\r\n                    </div>\r\n                    <div class="checkbox col-lg-offset-4">\r\n                        <label class="checkbox">\r\n                            <input type="checkbox" data-bind="checked: rememberMe">Remember me\r\n                        </label>\r\n                    </div>\r\n                    <div class="col-lg-offset-4 mart2">\r\n                        <button type="submit" class="btn btn-primary" data-bind="click: login">Sign in</button>\r\n                        <button type="reset" class="btn btn-default">Reset</button>\r\n                        <hr />\r\n                        <a href="#" class="btn btn-default" data-bind="attr: { href: convertRouteToHash(\'/account/register\') }">Register</a>\r\n                        <a href="#" class="btn btn-default" data-bind="attr: { href: convertRouteToHash(\'/account/forgotpassword\') }">Forgot your password?</a>\r\n                        <hr/>\r\n                    </div>\r\n                </form>                      \r\n            </div>\r\n    \r\n            <div class="col-offset-1 col-lg-5">\r\n                <div class="page-header">\r\n                    <h4>... or you can sign in using another service</h4>\r\n                </div>\r\n                <div class="list-group" data-bind="foreach: externalLoginProviders">\r\n                    <a class="list-group-item lead" href="#" data-bind="click: login, attr: { \'data-provider\': name,  title: \'Log in using your \' + name() + \' account\'}">\r\n                        <i data-bind="css: socialIcon($data)"></i>\r\n                        <span data-bind="text: name"></span>\r\n                    </a>\r\n                </div>\r\n            </div>    \r\n        </div>\r\n    </div>\r\n</div>';});
  
  
  define('text!views/account/manage.html',[],function () { return '<div id="manage">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1>Manage your account   <small>change passwords and manage your external accounts</small></h1>\r\n        </div>\r\n        <div class="row">\r\n            <section class="col-md-6">\r\n                <div data-bind="visible : hasLocalPassword()">\r\n                    <div data-bind="with: changePassword">\r\n                        <form role="form">\r\n                            <h2>Change your password</h2>\r\n                            <hr />\r\n                            <div class="form-group" data-bind="validationElement: oldPassword">\r\n                                <label for="ChangePasswordOldPassword" class="control-label">Old password</label>\r\n                                <input type="password" id="ChangePasswordOldPassword" class="form-control" data-bind="value: oldPassword" />                                \r\n                            </div>\r\n                            <div class="form-group" data-bind="validationElement: newPassword">\r\n                                <label for="ChangePasswordNewPassword" class="control-label">New password</label>\r\n                                <input type="password" id="ChangePasswordNewPassword" class="form-control" data-bind="value: newPassword" />\r\n                            </div>\r\n                            <div class="form-group" data-bind="validationElement: confirmPassword">\r\n                                <label for="ChangePasswordConfirmPassword" class="control-label">Confirm new password</label>\r\n                                <input type="password" id="ChangePasswordConfirmPassword" class="form-control" data-bind="value: confirmPassword" />\r\n                            </div>\r\n                            <div class="form-group">\r\n                                <button type="submit" class="btn btn-primary" data-bind="click: change, disable: changing">Cambiar contraseña</button>\r\n                                <button type="reset" class="btn btn-default">Reset</button>\r\n                            </div>\r\n                        </form>\r\n                    </div>\r\n                </div>\r\n                <div data-bind="visible : !hasLocalPassword()">\r\n                    <div data-bind="with: setPassword">\r\n                        <p class="lead">You don´t have any local password for this site. Add a local account by entering a password in this form and you won´t need any external login anymore</p>\r\n                        <form class="form-horizontal" role="form">\r\n                            <h2>Create local account</h2>\r\n                            <hr />\r\n                            <div class="form-group" data-bind="validationElement: newPassword">\r\n                                <label for="SetPasswordNewPassword" class="control-label">New password</label>\r\n                                <input type="password" id="SetPasswordNewPassword" class="form-control" data-bind="value: newPassword" />                                \r\n                            </div>\r\n                            <div class="form-group" data-bind="validationElement: confirmPassword">\r\n                                <label for="SetPasswordConfirmPassword" class="control-label">Confirm new password</label>\r\n                                <input type="password" id="SetPasswordConfirmPassword" class="form-control" data-bind="value: confirmPassword" />                                \r\n                            </div>\r\n                            <div class="form-group">\r\n                               <button type="submit" class="btn btn-primary" data-bind="click: set, disable: setting">Create local account</button>                               \r\n                                <button type="reset" class="btn btn-default">Reset</button>\r\n                            </div>\r\n                        </form>\r\n                    </div>\r\n                </div>\r\n                <div>\r\n                    <h2>Danger Area</h2>\r\n                    <hr />\r\n                    <p>Click the following button if you want to delete your account. Be careful because this action is permanent.</p>\r\n                    <a href="#" class="btn btn-danger" data-bind="click:deleteAccount">Delete the account</a>\r\n                </div>\r\n                <hr />\r\n          </section>\r\n            <section class="col-md-5 col-md-offset-1">\r\n                <div data-bind="if: userLogins().length > 0">\r\n                    <h2>Registered external accounts</h2>\r\n                    <table class="table">\r\n                        <tbody data-bind="foreach: userLogins">\r\n                            <tr>\r\n                                <td class="lead" data-bind="text: loginProvider"></td>\r\n                                <td>\r\n                                    <div data-bind="if: $parent.canRemoveLogin">\r\n                                        <form>\r\n                                            <div>\r\n                                                <button type="submit" class="btn btn-danger pull-right" data-bind="attr: { title: \'Remove this \' + loginProvider() + \' credential from your account\' }, click: remove, disable: removing"><i class="fa fa-trash-o"></i>   Remove</button>\r\n                                            </div>\r\n                                        </form>\r\n                                    </div>\r\n                                    <span data-bind="if: !$parent.canRemoveLogin()">&nbsp;</span>\r\n                                </td>\r\n                            </tr>\r\n                        </tbody>\r\n                    </table>\r\n                </div>\r\n                <h2>Add a new external account</h2>\r\n                <hr />\r\n                <div data-bind="visible: !hasExternalLogin()">\r\n                    <p class="lead">\r\n                        There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=313242">this article</a>\r\n                        for details on setting up this ASP.NET application to support logging in via external services.\r\n                    </p>\r\n                </div>\r\n                <div data-bind="visible: hasExternalLogin">\r\n                    <div class="list-group" data-bind="foreach: externalLoginProviders">\r\n                        <a href="#" class="list-group-item lead" data-bind="click: login, attr: { \'data-provider\': name,  title: \'Log in using your \' + name() + \' account\'}">\r\n                            <i data-bind="css: socialIcon($data)"></i>\r\n                            <span data-bind="text: name"></span>\r\n                        </a>\r\n                    </div>\r\n                </div>                \r\n            </section>\r\n        </div>\r\n    </div>\r\n</div>';});
  
  
  define('text!views/account/register.html',[],function () { return '<div id="register">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1 class="text-center">Register now   <small>create a new account in this site</small></h1>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-lg-offset-3 col-lg-6">        \r\n                <form data-bind="submit : register" class="form-horizontal">\r\n                    <div class="form-group" data-bind="validationElement: username">\r\n                         <label class="control-label col-lg-4" for="username">Username</label>                        \r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="text"  data-bind="value: username" placeholder="User name">      \r\n                        </div>\r\n                    </div>\r\n                    <div class="form-group" data-bind="validationElement: email">\r\n                         <label class="control-label col-lg-4" for="username">Email</label>                     \r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="text"  data-bind="value: email" placeholder="Email"> \r\n                        </div>\r\n                    </div>                   \r\n                    <div class="form-group" data-bind="validationElement: password">\r\n                         <label class="control-label col-lg-4" for="email">Password</label>\r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="password"  data-bind="value: password" placeholder="Password">  \r\n                        </div>\r\n                    </div>  \r\n                    <div class="form-group" data-bind="validationElement: confirmpassword">\r\n                         <label class="control-label col-lg-4" for="email">Confirm Password</label>\r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="password"  data-bind="value: confirmpassword" placeholder="Confirm Password">  \r\n                        </div>\r\n                    </div>  \r\n                    <div class="col-lg-offset-4">\r\n                        <button type="submit" class="btn btn-primary">Register</button>\r\n                        <button type="reset" class="btn btn-default">Reset</button>\r\n                    </div>    \r\n                </form>                      \r\n            </div>          \r\n        </div>\r\n        <hr/>\r\n    </div>\r\n </div>';});
  
  
  define('text!views/account/registrationcomplete.html',[],function () { return '<div id="registrationcomplete">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1>Your account was succesfully confirmed!!</h1>\r\n        </div>\r\n        <h3><a href="#" data-bind="attr: { href: router.convertRouteToHash(\'/account/login\') }" class="lead">Sign in</a> with your credentials and start using your account ... or you can:</h3>\r\n        <ul class="list-unstyled mart2">\r\n            <li><a href="#" data-bind="attr: { href: router.convertRouteToHash(\'/\') }" class="lead">Go to the home page</a></li>\r\n            <li><a href="#" data-bind="attr: { href: router.convertRouteToHash(\'/home/articles\') }" class="lead">Read articles in this site</a></li>\r\n            <li><a href="#" data-bind="attr: { href: router.convertRouteToHash(\'/user/dashboard\') }" class="lead">Go to your dashboard</a></li>\r\n            <li><a href="#" data-bind="attr: { href: router.convertRouteToHash(\'/account/manage\') }" class="lead">Manage your account</a></li>\r\n        </ul>\r\n    </div>\r\n</div>';});
  
  
  define('text!views/account/resetpassword.html',[],function () { return '<div id="resetpassword">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1 class="text-center">Enter your mail and password   <small>... and you will reset your password to a new one</small></h1>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-lg-offset-3 col-lg-6">\r\n                <form data-bind="submit : resetPassword" class="form-horizontal">\r\n                    <div class="form-group" data-bind="validationElement: email">\r\n                        <label class="control-label col-lg-4" for="username">Email</label>\r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="text" data-bind="value: email" placeholder="Email">\r\n                        </div>\r\n                    </div>\r\n                    <div class="form-group" data-bind="validationElement: password">\r\n                        <label class="control-label col-lg-4" for="email">Password</label>\r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="password" data-bind="value: password" placeholder="Password">\r\n                        </div>\r\n                    </div>\r\n                    <div class="form-group" data-bind="validationElement: confirmpassword">\r\n                        <label class="control-label col-lg-4" for="email">Confirm Password</label>\r\n                        <div class="col-lg-8">\r\n                            <input class="form-control" type="password" data-bind="value: confirmpassword" placeholder="Confirm Password">\r\n                        </div>\r\n                    </div>\r\n                    <div class="col-lg-offset-4">\r\n                        <button type="submit" class="btn btn-primary">Reset the password</button>\r\n                        <button type="reset" class="btn btn-default">Clean fields</button>\r\n                    </div>\r\n                </form>\r\n            </div>\r\n        </div>\r\n        <hr />\r\n    </div>\r\n</div>';});
  
  
  define('text!views/admin/panel.html',[],function () { return '<div id="panel">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1>Admin Panel   <small>supersecret information :)</small></h1>\r\n        </div>\r\n        <h4>Check the list of the registered users on this site</h4>\r\n        <div class="row mart5" data-bind="foreach : userprofiles">\r\n            <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">\r\n                <div class="row">\r\n                    <div class="col-xs-3">\r\n                        <a class="thumbnail">\r\n                            <img src="/Content/icons/icon_user.png" />\r\n                        </a>\r\n                    </div>\r\n                    <div class="col-xs-9 h-vcenter-parent">\r\n                        <div class="h-vcenter-child">\r\n                            <h4 data-bind="text: userName"></h4>\r\n                        </div>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n        </div>\r\n        <hr/>\r\n    </div>\r\n</div>\r\n';});
  
  
  define('text!views/header.html',[],function () { return '<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">\r\n    <div class="navbar-header">\r\n        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">\r\n            <span class="icon-bar"></span>\r\n            <span class="icon-bar"></span>\r\n            <span class="icon-bar"></span>\r\n        </button>\r\n        <a data-bind="attr: { href: router.convertRouteToHash(\'/\' + router.navigationModel()[0].hash) }" class="navbar-brand"><i class="fa fa-home"></i>    DurandalAuth</a>\r\n    </div>\r\n    <div class="collapse navbar-collapse navbar-main-collapse" style="height: 0px;">\r\n        <ul class="nav navbar-nav" data-bind="foreach: router.navigationModel">\r\n            <li data-bind="css: { active: isActive }">\r\n                <a data-bind="attr: { href: $parent.router.convertRouteToHash(\'/\' + hash) }, text: title"></a>\r\n            </li>\r\n        </ul>\r\n        <ul class="nav navbar-nav navbar-right" data-bind="if: typeof(appsecurity.userInfo()) == \'undefined\'">\r\n            <li>\r\n                <a data-bind="attr: { href: router.convertRouteToHash(\'/account/login\') }"><i class="fa fa-lock"></i>&nbsp; Login</a>\r\n            </li>\r\n        </ul>\r\n        <ul class="nav navbar-nav navbar-right" data-bind="if: !(typeof(appsecurity.userInfo()) == \'undefined\')">\r\n            <li class="dropdown">\r\n                <a href="#" class="dropdown-toggle" data-toggle="dropdown">\r\n                    <i class="fa fa-user"></i>&nbsp; Hi <span data-bind="text: appsecurity.userInfo().name"></span>\r\n                    <b class="caret"></b>\r\n                </a>\r\n                <ul class="dropdown-menu">\r\n                    <li role="presentation" class="dropdown-header">Options</li>\r\n                    <li><a data-bind="attr: { href: router.convertRouteToHash(\'/account/manage\') }"><i class="fa fa-user-md"></i>  Manage your account</a></li>\r\n                    <li data-bind="visible: appsecurity.isUserInRole([\'User\'])"><a data-bind="    attr: { href: router.convertRouteToHash(\'/user/dashboard\') }"><i class="fa fa-dashboard"></i>  Dashboard</a></li>\r\n                    <li data-bind="visible: appsecurity.isUserInRole([\'Administrator\'])" class="divider"></li>\r\n                    <li data-bind="if: appsecurity.isUserInRole([\'Administrator\'])"  role="presentation" class="dropdown-header">Administration</li>\r\n                    <li data-bind="if: appsecurity.isUserInRole([\'Administrator\'])"><a data-bind="    attr: { href: router.convertRouteToHash(\'/admin/panel\') }"><i class="fa fa-users"></i>  Admin Panel</a></li>\r\n                    <li class="divider"></li>\r\n                    <li><a href="#" data-bind="click: logout"><i class="fa fa-lock"></i>   Logout</a></li>\r\n                </ul>\r\n            </li>\r\n        </ul>\r\n        <ul class="nav navbar-nav navbar-right visible-xs visible-sm">\r\n            <li class="dropdown">\r\n                <a href="#" class="dropdown-toggle" data-toggle="dropdown">\r\n                    <i class="fa fa-share-square"></i>   Share\r\n                    <b class="caret"></b>\r\n                </a>\r\n                <ul class="dropdown-menu">\r\n                    <li role="presentation" class="dropdown-header">Share this site on your favourite network</li>\r\n                    <li>\r\n                        <a href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]=https://durandalauth.azurewebsites.net&p[images][0]=&p[title]=DurandalAuth%202.0&p[summary]=ASP.NET%20Identity%20token%20authentication%20using%20Durandal" target="_blank">\r\n                            <i class="fa fa-facebook-square"></i>   Share on Facebook\r\n                        </a>\r\n                    </li>\r\n                    <li>\r\n                        <a href="http://twitter.com/home?status=DurandalAuth%202.0,%20ASP.NET%20Identity%20token%20authentication%20using%20Durandal%0A%0Ahttps://durandalauth.azurewebsites.net" target="_blank">\r\n                            <i class="fa fa-twitter-square"></i>   Share on Twitter\r\n                        </a>\r\n                    </li>\r\n                    <li>\r\n                        <a href="http://www.linkedin.com/shareArticle?mini=true&url=https://durandalauth.azurewebsites.net&title=DurandalAuth%202.0&summary=ASP.NET%20Identity%20token%20authentication%20using%20Durandal&source=" target="_blank">\r\n                            <i class="fa fa-linkedin-square"></i>   Share on LinkedIn\r\n                        </a>\r\n                    </li>\r\n                    <li>\r\n                        <a href="https://plus.google.com/share?url=https://durandalauth.azurewebsites.net" target="_blank">\r\n                            <i class="fa fa-google-plus-square"></i>   Share on Google plus\r\n                        </a>\r\n                    </li>\r\n                </ul>\r\n            </li>\r\n        </ul>\r\n        <ul id="sharebar" class="nav navbar-nav navbar-right visible-md visible-lg">\r\n            <li>\r\n                <a href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]=https://durandalauth.azurewebsites.net&p[images][0]=&p[title]=DurandalAuth%202.0&p[summary]=ASP.NET%20Identity%20token%20authentication%20using%20Durandal" target="_blank">\r\n                    <i class="fa fa-facebook-square"></i>\r\n                </a>\r\n            </li>\r\n            <li>\r\n                <a href="http://twitter.com/home?status=DurandalAuth%202.0,%20ASP.NET%20Identity%20token%20authentication%20using%20Durandal%0A%0Ahttps://durandalauth.azurewebsites.net" target="_blank">\r\n                    <i class="fa fa-twitter-square"></i>\r\n                </a>\r\n            </li>\r\n            <li>\r\n                <a href="http://www.linkedin.com/shareArticle?mini=true&url=https://durandalauth.azurewebsites.net&title=DurandalAuth%202.0&summary=ASP.NET%20Identity%20token%20authentication%20using%20Durandal&source=" target="_blank">\r\n                    <i class="fa fa-linkedin-square"></i>\r\n                </a>\r\n            </li>\r\n            <li>\r\n                <a href="https://plus.google.com/share?url=https://durandalauth.azurewebsites.net" target="_blank">\r\n                    <i class="fa fa-google-plus-square"></i>\r\n                </a>\r\n            </li>\r\n        </ul>         \r\n    </div>\r\n</nav>';});
  
  
  define('text!views/home/about.html',[],function () { return '<div id="about">\r\n    <div class="row">\r\n        <div class="col-lg-6">\r\n            <div class="about-content well">\r\n                <h1><i class="fa fa-user"></i>    Who am I?</h1>\r\n                <p class="lead">My name is Yago and I am a developer who \r\n\t\t\t\tis passionate about web design and programming.</p>     \r\n            </div>                                                \r\n            <div class="about-content well" style="margin-top:-5px;">\r\n                <h1><i class="fa fa-eye"></i>    What I like to do?</h1>\r\n                <p class="lead">I like to learn and explore new technologies and development environments. I also like to take a look at new and amazing projects to see how they evolve.</p>                      \r\n            </div>                        \r\n        </div>\r\n        <div class="col-lg-6">\r\n            <div class="about-content well">\r\n                <h1><i class="fa fa-comments"></i>    How can you contact me?</h1>\r\n                <ul class="list-unstyled">\r\n                    <li><a href="https://github.com/yagopv" target="_blank"><i class="fa fa-github"></i>    Github</a></li>\r\n                    <li><a href="https://twitter.com/yperezva" target="_blank"><i class="fa fa-twitter"></i>    Twitter</a></li>\r\n                    <li><a href="https://www.facebook.com/yago.perezvazquez" target="_blank"><i class="fa fa-facebook" ></i>    Facebook</a></li>           \r\n                    <li><a href="http://es.linkedin.com/pub/yago-p%C3%A9rez-v%C3%A1zquez/45/453/381" target="_blank"><i class="fa fa-linkedin"></i>    LinkedIn</a></li>\r\n                </ul>                                            \r\n            </div>        \r\n            <div class="about-content well" style="margin-top:-5px;">\r\n                <h1><i class="fa fa-cloud"></i>    Where I am?</h1>\r\n                <p class="lead">In a galaxy far, far away...</p>                \r\n            </div>                    \r\n        </div>            \r\n    </div>\r\n</div>';});
  
  
  define('text!views/home/articles.html',[],function () { return '<div id="articles">\r\n    <div class="st-offcanvas">\r\n        <div class="st-offcanvas-menu">\r\n            <div class="input-group mart5">\r\n                <input type="text" class="form-control" data-bind="value: search, eventType: { \'change\': function () { searchArticles(false); }, \'keypress\': evaluateKey }" placeholder="Search for articles">\r\n                <span class="input-group-btn">\r\n                    <button class="btn btn-default" data-bind="click: function () { searchArticles(false); }" type="button"><i class="fa fa-search"></i></button>\r\n                </span>\r\n            </div>\r\n            <div class="panel panel-default mart5">\r\n                <div class="panel-heading">Select any Category</div>\r\n                <div class="list-group">\r\n                    <a href="#" class="list-group-item" data-bind="text: \'All\', click: removeSelectedCategory"></a>\r\n                    <!-- ko  foreach : categories -->\r\n                        <a href="#" class="list-group-item" data-bind="text: name, click: function () { $parent.changeSelectedCategory($data, $parent) } "></a>\r\n                    <!-- /ko -->                    \r\n                </div>\r\n            </div>\r\n        </div>\r\n        <div class="st-offcanvas-main">\r\n            <div class="row offcanvas-buttons well">\r\n                <a href="#" class="showmenubutton"><i class="fa fa-th"></i></a>\r\n            </div>\r\n\r\n            <div data-bind="if: articles().length === 0" class="mart5">\r\n                <h1>No articles found</h1>\r\n                <p class="lead">Change filter criteria to find articles</p>\r\n            </div>\r\n\r\n            <div data-bind="if: articles().length > 0" class="mart5">\r\n                <!-- Articles List -->\r\n\r\n                <div data-bind="foreach: articles">\r\n                    <div class="row mart2">\r\n                        <div class="hidden-xs col-sm-3 col-md-2 col-lg-2">\r\n                            <div class="st-image">\r\n                                <div class="st-image-container">\r\n                                    <a href="#" class="thumbnail">\r\n                                        <img data-bind="attr: { src: imageUrl }" />\r\n                                    </a>\r\n                                </div>\r\n                            </div>\r\n                        </div>\r\n                        <div class="col-xs-12 col-sm-9 col-md-10 col-lg-10">\r\n                            <h2 class="mart0" data-bind="text: title"></h2>\r\n                            <div class="mart2">\r\n                                <span class="label label-info" data-bind="text: formattedCreatedDate"></span>\r\n                                <span class="label label-info" data-bind="text: createdBy"></span>\r\n                            </div>\r\n                            <p class="mart2" data-bind="text: description"></p>\r\n                            <div class="mart2">\r\n                                <a class="btn btn-primary" data-bind="attr: { href: $parent.convertRouteToHash(\'/\' + createdBy() + \'/\' + category().urlCodeReference() + \'/\' + urlCodeReference()).toLowerCase(), title : title }"><i class="fa fa-eye" ></i>   View article</a>\r\n                            </div>\r\n                        </div>\r\n                    </div>\r\n                    <hr class="mart5" />\r\n                </div>\r\n\r\n                <!-- Articles List End -->\r\n                <a href="#" id="btn-loadmore" class="btn btn-primary mart2" data-bind="click: loadMoreArticles"><i class="fa fa-plus-circle"></i>   Load more articles</a>\r\n            </div>\r\n            <hr class="mart2" />\r\n        </div>\r\n    </div>\r\n</div>';});
  
  
  define('text!views/home/help.html',[],function () { return '<div id="help">\r\n    <div class="container">\r\n        <div class="row">\r\n            <div class="col-lg-12">\r\n                <div class="page-header">\r\n                    <h2 class="text-primary"><i class="fa fa-question-circle"></i>   How is this site working?</h2>\r\n                </div>\r\n                <p>\r\n                    This site simulates a community-managed article repository. People with accounts can write articles in their\r\n                    dashboards and make them public on the web.\r\n                </p>\r\n                <p>\r\n                    The main objective of this sample application is to provide a way to authenticate and authorize users similar to\r\n                    the default ASP MVC 5 SPA template but configured for being used with <span class="text-success">Durandal</span>.\r\n                    You will find <span class="text-success">OAuth bearer token authentication</span> built-in for local and external providers among another useful features.\r\n                </p>\r\n                <hr />\r\n                <p>\r\n                    The first thing you can do in this site is creating a new account using the\r\n                    <a href="#" data-bind="attr: { href: convertRouteToHash(\'account/login\') }">\r\n                        membership system or the oAuth providers\r\n                    </a>.\r\n                </p>\r\n                <p>\r\n                    After logged in, the <span class="text-success">User</span>\r\n                    role will be assigned to your new user that will allow access to the <a href="#" data-bind="attr: { href: convertRouteToHash(\'user/dashboard\') }">user dashboard</a>.\r\n                    Once there, you can start writing articles.\r\n                </p>\r\n                <p>\r\n                    While writing on your dashboard, remember to set the article as a public article if you want to make it visible for the rest of the community.\r\n                </p>\r\n                <p>\r\n                    Administrator users can access the <a href="#" data-bind="attr: { href: convertRouteToHash(\'admin/panel\') }">admin panel view</a>, but not the dashboard\r\n                    because they have assigned the <span class="text-success">Administrator</span> role. but not the\r\n                    <span class="text-success"> User one</span>.\r\n                </p>\r\n                <p>\r\n                    For accesing the <a href="#" data-bind="attr: { href: convertRouteToHash(\'admin/panel\') }">admin panel view</a>, try to log in with the\r\n                    following user and password, <span class="text-success">admin/admin1234</span>. Once there, you will be able to check a list with the registered users\r\n                    on this site.\r\n                </p>\r\n            </div>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-lg-12">\r\n                <div class="page-header">\r\n                    <h2 class="text-primary"><i class="fa fa-plus-circle"></i>   Add you own Entities</h2>\r\n                </div>\r\n                <p>\r\n                    One of the first things you would like to do with this sample template is creating your own entities and your own domain model.\r\n                    You can remove all the sample entities and add you own ones following this steps.\r\n                </p>\r\n                <ul>\r\n                    <li>\r\n                        <h3><span class="text-primary">Domain Layer</span></h3>\r\n                        <ul>\r\n                            <li>\r\n                                <p>First step should be adding the new entity to the <span class="text-success">Model</span> folder.</p>\r\n                                <p>\r\n                                    It´s important to remember the <span class="text-success">[DataContract]</span> and <span class="text-success">[DataMember]</span>\r\n                                    attributes. Fields not decorated with <span class="text-success">[DataMember]</span> won´t be managed by Breeze and won´t be propagated to the client application.\r\n                                </p>\r\n                            </li>\r\n                            <li>\r\n                                <p>\r\n                                    Optionally you can add a extended repository contract like <span class="text-success">IMyNewEntityRepository.cs</span>\r\n                                    in the <span class="text-success">Repositories</span> folder.\r\n                                </p>\r\n                                <p>This new repository will inherit from <span class="text-success">IRepository.cs</span> and should content specific methods for the new entity.</p>\r\n                                <p>You should do this only if need more functionality that the included in <span class="text-success">IRepository.cs</span>.</p>\r\n                            </li>\r\n                        </ul>\r\n                    </li>\r\n                    <li>\r\n                        <h3><span class="text-primary">Data Layer</span></h3>\r\n                        <ul>\r\n                            <li>\r\n                                <p>Add the newly created entity to the <span class="text-success">DurandalAuthDbContext.cs</span> class.</p>\r\n                            </li>\r\n                            <li>\r\n                                <p>\r\n                                    If you decided to create a new repository contract in the <span class="text-success">Domain layer</span>, you need to\r\n                                    implement it in the <span class="text-success">Data layer</span>.\r\n                                </p>\r\n                                <p>\r\n                                    Create a new <span class="text-success">MyNewEntityRepository.cs</span> class under the <span class="text-success">Repositories</span> folder\r\n                                    implementing <span class="text-success">IMyNewEntityRepository.cs</span> interface.\r\n                                </p>\r\n                            </li>\r\n                            <li>\r\n                                <p>Add the new repository to the <span class="text-success">UnitOfWork.cs</span>.</p>\r\n                            </li>\r\n                        </ul>\r\n                    </li>\r\n                    <li>\r\n                        <h3><span class="text-primary">Web Layer</span></h3>\r\n                        <ul>\r\n                            <li>\r\n                                <p>\r\n                                    Add methods to the <span class="text-success">DurandalAuthController.cs</span> class in order to retrieve the new entity data.\r\n                                    If you prefer to not use <span class="text-success">Breeze</span>, create a new Api Controller for the resource and call it from\r\n                                    the client using standard AJAX calls.\r\n                                </p>\r\n                            </li>\r\n                            <li>\r\n                                <p>Under the Durandal App folder:</p>\r\n                                <ol>\r\n                                    <li>\r\n                                        <p>Add new initialization methods and constructors for the breeze entities using the <span class="text-success">model/modelBuilder.js</span> module.</p>\r\n                                    </li>\r\n                                    <li>\r\n                                        <p>\r\n                                            Add a new breeze resource in the <span class="text-success">services/unitofwork.js</span> module using the base\r\n                                            <span class="text-success">repository.js</span> module or a new one you can create extending that one. Samples for\r\n                                            extending <span class="text-success">repository.js</span> are <span class="text-success">privatearticlesrepository.js</span> and\r\n                                            <span class="text-success">publicarticlesrepository.js</span>.\r\n                                        </p>\r\n                                    </li>\r\n                                </ol>\r\n                            </li>\r\n                            <li>\r\n                                <p>\r\n                                    Perhaps you would like to add some bussiness rules for the new entity. This sort of things can be accomplished in several ways\r\n                                    like using data attributes. Another way breeze specific is using Breeze delegates. Under the <span class="text-success">Helpers</span> folder you have\r\n                                    the <span class="text-success">BreezeValidator.cs</span> class implementing the <span class="text-success">IBreezeValidator.cs</span> on the Domain layer.\r\n                                    The Breeze delegates are asigned in the <span class="text-success">UnitOfWork.cs</span> class under the <span class="text-success">Data Layer</span>.\r\n                                </p>\r\n                            </li>\r\n                            <li>\r\n                                <p>\r\n                                    If you create new interfaces for repositories, remember to add them to the <span class="text-success">IoC.cs</span> container under the\r\n                                    <span class="text-success">DependencyResolution folder</span>.\r\n                                </p>\r\n                            </li>\r\n                        </ul>\r\n                    </li>\r\n                </ul>\r\n                <div class="well well-danger mart2">\r\n                    <h3>Important !!</h3>\r\n                    <p>\r\n                        The authorization system in the client can always be hacked!\r\n                        Always authenticate and authorize the request in the server when retrieving the necessary data for your views.\r\n                    </p>\r\n                </div>\r\n            </div>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-lg-12">\r\n                <div class="page-header">\r\n                    <h2 class="text-primary"><i class="fa fa-lock"></i>   OAuth bearer token authentication using OWIN</h2>\r\n                </div>\r\n                <p>\r\n                    The DurandalAuth authentication system is based in <span class="text-success"> OAuth with bearer tokens and OWIN </span>.\r\n                    A picked up code from the new ASP MVC 5 SPA application template and adapted it for being used with Durandal.\r\n                    If you are familiar with that template you will understand DurandalAuth.\r\n                </p>\r\n                <p>\r\n                    For learning about bearer token authentication I recommend reading <a href="http://blogs.msdn.com/b/webdev/archive/2013/09/20/understanding-security-features-in-spa-template.aspx" target="_blank">this blog post</a>\r\n                    about the new SPA template included in Visual Studio 2013. The ideas implemented in DurandalAuth are pretty much the same.\r\n                </p>\r\n                <p>\r\n                    The OAuth flows in DurandalAuth are <a href="http://tools.ietf.org/html/rfc6749#section-4.3" target="_blank">Resource Owner Password Credentials Grant</a>\r\n                    for local authentication and <a href="http://tools.ietf.org/html/rfc6749#section-4.2" target="_blank">Implicit Grant</a> for external authentication services.\r\n                </p>\r\n                <p>\r\n                    The use of bearer tokens implies you should be using HTTPS protocol to avoid the token to be intercepted. By default DurandalAuth is configured for redirecting all\r\n                    the requests to HTTPS via the <span class="text-success">RequireHttpsAttribute</span> present in ASP MVC and another one created for the Web API 2 and which you can find on the\r\n                    <span class="text-success"> Filters</span> folder.\r\n                </p>\r\n                <p>\r\n                    When you authenticate successfully and get the access token, this bearer token will be sent with each authenticated AJAX request to the server.\r\n                    You can check the request <span class="text-success">Authorize header</span> using your favourite tool and will find it.\r\n                </p>\r\n                <div class="well mart2">\r\n                    <h3>About token expiration</h3>\r\n                    <p>\r\n                        When checking the Remember Me checkbox in the login view, the token will be stored in the localstorage for subsequent sessions.\r\n                        By default DurandalAuth has configured a token expiration of 14 days since the user is authenticated. It means that when the 14 are completed,\r\n                        the token will become invalid and the user must authenticate again.\r\n                        The token expiration duration is configured in <span class="text-success">Startup.Auth.cs</span> so use your preferred timeframe.\r\n                    </p>\r\n                    <p>\r\n                        When authenticating with external services, the token is stored in sessionstorage so the user must authenticate again in a new session. It´s easy to\r\n                        change this behaviour:\r\n                    </p>\r\n                    <pre>\r\nif (data.hasRegistered) {\r\n    // Change persistent (last parameter) to true for storing the authentication token in local storage when\r\n    // login with external services\r\n    self.setAuthInfo(data.userName, data.roles, fragment.access_token, false);\r\n    dfd.resolve(true);\r\n}\r\n                    </pre>\r\n                </div>\r\n            </div>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-lg-12">\r\n                <div class="page-header">\r\n                    <h2 class="text-primary"><i class="fa fa-exchange"></i>   Theming with BootStrap</h2>\r\n                </div>\r\n                <p>I choose Bootstrap for theming DurandalAuth. I think is easy to understand, mature and widely used.</p>\r\n                <p>\r\n                    The theme applied by default is called WhitePlum, a beautiful purple theme,  but  you can use your own one replacing\r\n                    in <span class="text-success">BundleConfig.cs</span> the <span class="text-success">bootstrap-whiteplum.css</span> file with your own theme.\r\n                    Be aware about the Bootstrap nuget package is included so you can use bootstrap.css file in the <span class="text-success">Content</span> folder and\r\n                    the default theme will be applied.\r\n                </p>\r\n            </div>\r\n        </div>\r\n        <div class="row">\r\n            <div class="col-lg-12">\r\n                <div class="page-header">\r\n                    <h2 class="text-primary"><i class="fa fa-search"></i>   About SEO Optimization</h2>\r\n                </div>\r\n                <p>The template is ready to be SEO crawlable. DurandalAuth implements the <a href="https://developers.google.com/webmasters/ajax-crawling/docs/getting-started" target="_blank"> google ajax crawling scheme</a> for pages without hash fragments. You need the default pushstate option enabled.</p>\r\n                <p>I created a interface (Helpers/ISnapshot.cs) that needs to be implemented in order to work.</p>\r\n                <p>The default implementation uses <a href="https://github.com/yagopv/azurecrawler" target="_blank"> a new project I created called AzureCrawler</a>.</p>\r\n                <p>This new project is a Worker Role ready to be deployed to Windows Azure and serving a REST Web API via OWIN. The Web API executes a phantomjs process when receiving requests and returns html snapshots. Moreover, AzureCrawler can save the snapshot to Azure Storage and keep it there with the expiration date you choose, so next time the page is requested for any bot, the stored snapshot will be served.</p>\r\n                <p>I created AzureCrawler like a separate project but it´s easy to bring all the concepts from AzureCrawler to your own project if you want to keep it in the same solution. Another option is creating your own implementation of ISnapshot.cs</p>\r\n                <p>Another included feature, very useful for SEO, is the dynamic generation of sitemaps. <a href="/sitemap" target="_blank">Click here</a> for browsing to the sitemap of this site.</p>\r\n                <p>Include your own urls in the <span class="text-success">SitemapController</span> and change the <span class="text-success">robots.txt</span> for pointing to your own domain.</p>\r\n            </div>\r\n        </div>\r\n        <hr />\r\n        <div class="row">\r\n            <div class="col-lg-12">\r\n                <div class="page-header">\r\n                    <h2 class="text-primary"><i class="fa fa-question"></i>   Need more information</h2>\r\n                </div>\r\n            </div>\r\n            <p>Write me an email or <a href="#" data-bind="attr: { href: convertRouteToHash(\'home/about\') }">contact with me</a>.</p>\r\n        </div>\r\n        <hr/>\r\n    </div>\r\n</div>';});
  
  
  define('text!views/home/index.html',[],function () { return '<div id="index">\r\n\r\n    <div id="featured" class="jumbotron">\r\n        <div class="container">\r\n            <h1>Welcome to the DurandalAuth 2 template</h1>\r\n            <p>A way to authenticate users using Durandal and token authentication with the new ASP.NET Identity membership</p>\r\n            <p><a href="https://github.com/yagopv/durandalauth" target="_blank" class=" btn btn-primary btn-lg" role="button">Visit the project repo on Github</a></p>\r\n        </div>\r\n    </div>\r\n\r\n    <div class="container">\r\n        <div class="row mart5">\r\n            <div class="col-sm-4 text-center">\r\n                <img src="/Content/icons/icon_data.png" alt="Breeze!!" width="200" />\r\n                <h2>Breeze for data management</h2>\r\n                <p class="lead">Client-side data management uses the excellent Breeze JS framework</p>\r\n            </div>\r\n            <div class="col-sm-4 text-center">\r\n                <img src="/Content/icons/icon_cloud.png" alt="ASP MVC and Web API" width="200" />\r\n                <h2>ASP MVC and Web API</h2>\r\n                <p class="lead">ASP MVC and Web API on the server-side</p>\r\n            </div>\r\n            <div class="col-sm-4 text-center">\r\n                <img src="/Content/icons/icon_library.png" alt="Patterns!!" width="200" />\r\n                <h2>Unit of Work and Repositories</h2>\r\n                <p class="lead">You will find an implementation of this pattern both server (Entity Framework) and client side (Breeze)</p>\r\n            </div>\r\n            <div class="col-sm-4 text-center">\r\n                <img src="/Content/icons/icon_seo.png" alt="SEO ready!!" width="200" />\r\n                <h2>SEO Optimization</h2>\r\n                <p class="lead">The template is ready to be SEO crawlable using a <a href="https://github.com/yagopv/azurecrawler" target="_blank">headless browser</a></p>\r\n            </div>\r\n            <div class="col-sm-4 text-center">\r\n                <img src="/Content/icons/icon_lock.png" alt="ASP.NET Identity!!" width="200" />\r\n                <h2>ASP.NET Identity</h2>\r\n                <p class="lead">ASP.NET Identity system and token authentication ready</p>\r\n            </div>\r\n            <div class="col-sm-4 text-center">\r\n                <img src="/Content/icons/icon_angles.png" alt="Bootstrap!!" width="200" />\r\n                <h2>... and of course</h2>\r\n                <p class="lead">My favorite tool ... Bootstrap for styling this site</p>\r\n            </div>\r\n        </div>\r\n    </div>\r\n\r\n    <hr class="container" />\r\n\r\n    <div class="container">\r\n        <div class="row mart5">\r\n            <div class="col-lg-4 text-center">\r\n                <img src="/Content/icons/icon_question.png" alt="Why this project?" width="150" />\r\n                <h2>Why this project?</h2>\r\n                <p class="lead">\r\n                    Because I couldn\'t find any proper way of working with this technology stack and this kind of authentication ... so\r\n                    I tried to write it myself.\r\n                </p>\r\n            </div>\r\n            <div class="col-lg-4 text-center">\r\n                <img src="/Content/icons/icon_social.png" alt="Collaborate" width="150" />\r\n                <h2>Collaborate</h2>\r\n                <p class="lead">\r\n                    If you find bugs or want to improve the sample project template, feel free to contact me, create\r\n                    a pull request, or\r\n                    whatever you want.\r\n                </p>\r\n            </div>\r\n            <div class="col-lg-4 text-center">\r\n                <img src="/Content/icons/icon_project.png" alt="Project" width="150" />\r\n                <h2>Visit the project site ...</h2>\r\n                <p class="lead">... <a href="https://github.com/yagopv/durandalauth" target="_blank"> on Github</a> and check the code if you want.</p>\r\n            </div>\r\n        </div>\r\n        <hr />\r\n    </div>\r\n</div>';});
  
  
  define('text!views/notfound.html',[],function () { return '<div id="notfound">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1>Oooooops!!   <small>couldn´t find what you are looking for</small></h1>\r\n        </div>\r\n        <h3>There isn´t any page on this site with the url you provided, perhaps you are trying to get the ...</h3>\r\n        <ul class="list-unstyled mart2">\r\n            <li><a href="#" data-bind="attr: { href: convertRouteToHash(\'/\') }" class="lead">The home page</a></li>\r\n            <li><a href="#" data-bind="attr: { href: convertRouteToHash(\'/home/articles\') }" class="lead">Articles in this site</a></li>\r\n            <li><a href="#" data-bind="attr: { href: convertRouteToHash(\'/user/dashboard\') }" class="lead">Your dashboard</a></li>\r\n            <li><a href="#" data-bind="attr: { href: convertRouteToHash(\'/account/manage\') }" class="lead">Managing your account</a></li>\r\n        </ul>        \r\n    </div>\r\n</div>';});
  
  
  define('text!views/shell.html',[],function () { return '<div>\r\n    <header data-bind="compose : \'viewmodels/header\'"></header>\r\n    <div class="page-host" data-bind="router: { transition:\'entrance\', cacheViews:true }"></div>\r\n</div>\r\n\r\n<div class="st-sticky-push"></div>';});
  
  
  define('text!views/user/article.html',[],function () { return '<div id="#article">\r\n    <div class="container" data-bind="with: article">\r\n        <div class="row">\r\n            <div class="hidden-xs col-sm-3 col-md-2 col-lg-2">\r\n                <div class="st-image">\r\n                    <div class="st-image-container">\r\n                        <a href="#" class="thumbnail">\r\n                            <img data-bind="attr: { src: imageUrl }" />\r\n                        </a>                        \r\n                    </div>\r\n                </div>\r\n            </div>\r\n            <div class="col-xs-12 col-sm-9 col-md-10 col-lg-10">\r\n                <div class="page-header">\r\n                    <h1 class="mart0" data-bind="text: title"></h1>       \r\n                </div>                \r\n                <span class="label label-info" data-bind="text: formattedCreatedDate"></span>\r\n                <span class="label label-info" data-bind="text: createdBy"></span>\r\n            </div>            \r\n        </div>\r\n\r\n        <div class="row col-sm-12 mart2" data-bind="foreach: tags">\r\n            <span class="label label-primary" data-bind="text: name"></span>\r\n        </div>\r\n\r\n        <div class="row col-sm-12">\r\n            <p class="mart2 prewrap lead" data-bind="text: description"></p>\r\n        </div>\r\n\r\n        <div class="row col-sm-12 mart2 prewrap" data-bind="html: html"></div>\r\n\r\n    </div>\r\n</div>\r\n';});
  
  
  define('text!views/user/dashboard.html',[],function () { return '<div id="dashboard">\r\n    <div class="container">\r\n        <div class="page-header">\r\n            <h1>Dashboard</h1>\r\n        </div>\r\n        <p class="lead">Write, update and delete your personal articles</p>\r\n\r\n        <a href="#" class="btn btn-primary" data-bind="click : newArticle"><i class="fa fa-plus-circle"></i>   New Article</a>\r\n\r\n        <a href="#" class="btn btn-success" data-bind="click: saveArticles"><i class="fa fa-save"></i>   Save all changes</a>\r\n\r\n        <!-- Articles List -->\r\n\r\n        <div id="dashboard-articles" data-bind="foreach : { data : articles, afterAdd : utils.addItemAnimation, beforeRemove : utils.removeItemAnimation }" class="mart5">\r\n            <div class="row">\r\n                <div class="hidden-xs col-sm-3 col-md-2 col-lg-2">\r\n                    <div class="st-image">\r\n                        <div class="st-image-container">\r\n                            <a class="thumbnail">\r\n                                <img data-bind="attr: { src: imageUrl }" alt="Article Logo"/>\r\n                            </a>                            \r\n                        </div>\r\n                    </div>                    \r\n                </div>\r\n                <div class="col-xs-12 col-sm-9 col-md-10 col-lg-10">\r\n                    <h2 class="mart0" data-bind="text : title"></h2>\r\n                    <div class="mart2">\r\n                        <span class="label label-info" data-bind="text: formattedCreatedDate"></span>\r\n                        <span class="label label-success" data-bind="visible: isPublished">Published</span>\r\n                        <span class="label label-warning" data-bind="visible: !isPublished()">Pending</span>\r\n                        <span class="label label-danger" data-bind="visible: unsavedChanges">Unsaved changes</span>\r\n                        <span class="label label-danger" data-bind="visible: hasValidationErrors">Article with validation errors</span>\r\n                    </div>\r\n                    <p  class="mart2" data-bind="text : description"></p>\r\n                    <div data-bind="foreach: tags" class="mart2">\r\n                        <span class="label label-primary" data-bind="text: name"></span>\r\n                    </div>\r\n                    <div class="mart2">\r\n                        <a href="#" class="btn btn-primary" data-bind="click: function () { $parent.editArticle(this, $parent) }"><i class="fa fa-pencil"></i>   Edit</a>\r\n                        <a href="#" class="btn btn-danger" data-bind="click: function () { $parent.deleteArticle(this, $parent, false) }"><i class="fa fa-trash-o"></i>   Delete</a>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n            <hr />\r\n        </div>\r\n\r\n        <!-- Articles List End -->\r\n\r\n        <!-- Edited Article -->\r\n\r\n        <div class="modal fade" id="edited-article"  data-bind="with: selectedArticle">\r\n          <div class="modal-dialog">\r\n                <div class="modal-content">\r\n                    <div class="modal-header">\r\n                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" data-bind="click: $parent.closeModal">&times;</button>\r\n                        <h1 class="modal-title" data-bind="text: title() == \'\' ? \'New article\' : title"></h1>\r\n                    </div>\r\n                    <div class="modal-body">\r\n                        <div class="form-group" data-bind="validationElement: imageUrl">\r\n                            <div class="page-header">\r\n                                <h2><i class="fa fa-picture-o"></i>   Logo  <small>enter logo for the article</small></h2>                                        \r\n                            </div>\r\n                            <div class="row">\r\n                                <div class="col-xs-3 col-sm-4 col-md-3 col-lg-2">\r\n                                    <div class="st-image">\r\n                                        <div class="st-image-container">\r\n                                            <a href="#" class="thumbnail">\r\n                                                <img id="selected-article-img" data-bind="attr: { src: imageUrl }" alt="Url for the image representing the Article" />                                \r\n                                            </a>\r\n                                        </div>\r\n                                    </div>\r\n                                </div>\r\n                                <div class="col-xs-9 col-sm-8 col-md-9 col-lg-10">                                    \r\n                                    <input class="form-control mart2" type="text"  data-bind="value: imageUrl" placeholder="Url for the image representing the Article">                        \r\n                                    <span class="help-block">Enter the image url you would like to use as the main image for this article</span>\r\n                                </div>                                                        \r\n                            </div>\r\n                        </div>\r\n                        <div class="page-header">\r\n                            <h2><i class="fa fa-list-ul"></i>   Main info   <small>enter some info about the article</small></h2>\r\n                        </div>\r\n                        <div class="form-group" data-bind="validationElement: title">\r\n                             <label class="control-label" for="username">Title</label>                        \r\n                             <input class="form-control" type="text"  data-bind="value: title" placeholder="Title">      \r\n                        </div>\r\n                        <div class="form-group" data-bind="validationElement: description">\r\n                             <label class="control-label" for="username">Brief description</label>                     \r\n                             <textarea rows="4" cols="60" class="form-control" data-bind="value: description" placeholder="Description"></textarea> \r\n                        </div>\r\n                        <div class="form-group" data-bind="validationElement: categoryId">\r\n                            <label class="control-label" for="email">Categorize the article</label>\r\n                            &nbsp;&nbsp;<select data-bind="options: $parent.categories, optionsText: \'name\', optionsValue: \'categoryId\', value: categoryId, optionsCaption: \'Choose...\'"></select>\r\n                        </div>\r\n                        <div class="checkbox">\r\n                            <label>\r\n                                <input type="checkbox" data-bind="checked: isPublished"> <span>Publish</span>\r\n                            </label>\r\n                        </div>\r\n                        <div class="page-header">\r\n                            <h2><i class="fa fa-pencil"></i>   Content   <small>write your article. Markdown is allowed</small></h2>\r\n                        </div>\r\n                        <div class="form-group" data-bind="validationElement: markdown">\r\n                            <div>\r\n                                <a href="#" class="btn btn-primary"  data-bind="click: function () { $parent.changePreview(this, $parent) }"><i class="fa fa-eye"></i>  Change Edit/Preview</a>\r\n                                <a href="#" class="btn btn-primary go-zen"><i class="fa fa-pencil"></i>  Edit in Zen Mode with no distraction</a>\r\n                            </div>                        \r\n                            <div class="form-group mart2">                                \r\n                                <textarea rows="10" cols="60" class="form-control auto-height-textarea zen-mode" data-bind="value: markdown, visible: !$parent.preview(), eventType: { \'change\': $parent.convertMarkdown }" placeholder="Enter content here using markdown"></textarea>\r\n                            </div>\r\n                            <div class="mart5" data-bind="html: html, visible: $parent.preview"></div>\r\n                            <p class="text-right"><abbr title="Markdown is allowed within the textarea. Click preview for watch html result">markdown</abbr></p>\r\n                        </div>\r\n                        <div class="page-header">\r\n                            <h2><i class="fa fa-tags"></i>   Tags   <small>start tagging your article</small></h2>\r\n                        </div>\r\n                        <div class="form-group">\r\n                             <input id="tags" class="form-control" type="text"  data-bind="value: splitTags">      \r\n                        </div>\r\n                    </div>\r\n                    <div class="modal-footer">\r\n                        <button type="button" class="btn btn-default" data-dismiss="modal" data-bind="click: $parent.closeModal">Close</button>                        \r\n                    </div>\r\n                </div>\r\n            </div>\r\n        </div>\r\n\r\n        <!-- End Edited Article -->\r\n\r\n    </div>\r\n</div>\r\n';});
  
  define('plugins/dialog',["durandal/system","durandal/app","durandal/composition","durandal/activator","durandal/viewEngine","jquery","knockout"],function(e,t,n,r,a,i,o){function s(t){return e.defer(function(n){e.isString(t)?e.acquire(t).then(function(t){n.resolve(e.resolveObject(t))}).fail(function(n){e.error("Failed to load dialog module ("+t+"). Details: "+n.message)}):n.resolve(t)}).promise()}var l,c={},u=0,d=function(e,t,n){this.message=e,this.title=t||d.defaultTitle,this.options=n||d.defaultOptions};return d.prototype.selectOption=function(e){l.close(this,e)},d.prototype.getView=function(){return a.processMarkup(d.defaultViewMarkup)},d.setViewUrl=function(e){delete d.prototype.getView,d.prototype.viewUrl=e},d.defaultTitle=t.title||"Application",d.defaultOptions=["Ok"],d.defaultViewMarkup=['<div data-view="plugins/messageBox" class="messageBox">','<div class="modal-header">','<h3 data-bind="text: title"></h3>',"</div>",'<div class="modal-body">','<p class="message" data-bind="text: message"></p>',"</div>",'<div class="modal-footer" data-bind="foreach: options">','<button class="btn" data-bind="click: function () { $parent.selectOption($data); }, text: $data, css: { \'btn-primary\': $index() == 0, autofocus: $index() == 0 }"></button>',"</div>","</div>"].join("\n"),l={MessageBox:d,currentZIndex:1050,getNextZIndex:function(){return++this.currentZIndex},isOpen:function(){return u>0},getContext:function(e){return c[e||"default"]},addContext:function(e,t){t.name=e,c[e]=t;var n="show"+e.substr(0,1).toUpperCase()+e.substr(1);this[n]=function(t,n){return this.show(t,n,e)}},createCompositionSettings:function(e,t){var n={model:e,activate:!1,transition:!1};return t.attached&&(n.attached=t.attached),t.compositionComplete&&(n.compositionComplete=t.compositionComplete),n},getDialog:function(e){return e?e.__dialog__:void 0},close:function(e){var t=this.getDialog(e);if(t){var n=Array.prototype.slice.call(arguments,1);t.close.apply(t,n)}},show:function(t,a,i){var o=this,l=c[i||"default"];return e.defer(function(e){s(t).then(function(t){var i=r.create();i.activateItem(t,a).then(function(r){if(r){var a=t.__dialog__={owner:t,context:l,activator:i,close:function(){var n=arguments;i.deactivateItem(t,!0).then(function(r){r&&(u--,l.removeHost(a),delete t.__dialog__,0===n.length?e.resolve():1===n.length?e.resolve(n[0]):e.resolve.apply(e,n))})}};a.settings=o.createCompositionSettings(t,l),l.addHost(a),u++,n.compose(a.host,a.settings)}else e.resolve(!1)})})}).promise()},showMessage:function(t,n,r){return e.isString(this.MessageBox)?l.show(this.MessageBox,[t,n||d.defaultTitle,r||d.defaultOptions]):l.show(new this.MessageBox(t,n,r))},install:function(e){t.showDialog=function(e,t,n){return l.show(e,t,n)},t.showMessage=function(e,t,n){return l.showMessage(e,t,n)},e.messageBox&&(l.MessageBox=e.messageBox),e.messageBoxView&&(l.MessageBox.prototype.getView=function(){return e.messageBoxView})}},l.addContext("default",{blockoutOpacity:.2,removeDelay:200,addHost:function(e){var t=i("body"),n=i('<div class="modalBlockout"></div>').css({"z-index":l.getNextZIndex(),opacity:this.blockoutOpacity}).appendTo(t),r=i('<div class="modalHost"></div>').css({"z-index":l.getNextZIndex()}).appendTo(t);if(e.host=r.get(0),e.blockout=n.get(0),!l.isOpen()){e.oldBodyMarginRight=t.css("margin-right"),e.oldInlineMarginRight=t.get(0).style.marginRight;var a=i("html"),o=t.outerWidth(!0),s=a.scrollTop();i("html").css("overflow-y","hidden");var c=i("body").outerWidth(!0);t.css("margin-right",c-o+parseInt(e.oldBodyMarginRight,10)+"px"),a.scrollTop(s)}},removeHost:function(e){if(i(e.host).css("opacity",0),i(e.blockout).css("opacity",0),setTimeout(function(){o.removeNode(e.host),o.removeNode(e.blockout)},this.removeDelay),!l.isOpen()){var t=i("html"),n=t.scrollTop();t.css("overflow-y","").scrollTop(n),e.oldInlineMarginRight?i("body").css("margin-right",e.oldBodyMarginRight):i("body").css("margin-right","")}},attached:function(e){i(e).css("visibility","hidden")},compositionComplete:function(e,t,n){var r=l.getDialog(n.model),a=i(e),o=a.find("img").filter(function(){var e=i(this);return!(this.style.width&&this.style.height||e.attr("width")&&e.attr("height"))});a.data("predefinedWidth",a.get(0).style.width);var s=function(){setTimeout(function(){a.data("predefinedWidth")||a.css({width:""});var e=a.outerWidth(!1),t=a.outerHeight(!1),n=i(window).height(),o=Math.min(t,n);a.css({"margin-top":(-o/2).toString()+"px","margin-left":(-e/2).toString()+"px"}),a.data("predefinedWidth")||a.outerWidth(e),t>n?a.css("overflow-y","auto"):a.css("overflow-y",""),i(r.host).css("opacity",1),a.css("visibility","visible"),a.find(".autofocus").first().focus()},1)};s(),o.load(s),a.hasClass("autoclose")&&i(r.blockout).click(function(){r.close()})}}),l});
  define('plugins/http',["jquery","knockout"],function(e,t){return{callbackParam:"callback",get:function(t,n){return e.ajax(t,{data:n})},jsonp:function(t,n,r){return-1==t.indexOf("=?")&&(r=r||this.callbackParam,t+=-1==t.indexOf("?")?"?":"&",t+=r+"=?"),e.ajax({url:t,dataType:"jsonp",data:n})},post:function(n,r){return e.ajax({url:n,data:t.toJSON(r),type:"POST",contentType:"application/json",dataType:"json"})}}});
  define('plugins/observable',["durandal/system","durandal/binder","knockout"],function(e,t,n){function r(e){var t=e[0];return"_"===t||"$"===t}function a(t){return!(!t||void 0===t.nodeType||!e.isNumber(t.nodeType))}function i(e){if(!e||a(e)||e.ko===n||e.jquery)return!1;var t=f.call(e);return-1==v.indexOf(t)&&!(e===!0||e===!1)}function o(e,t){var n=e.__observable__,r=!0;if(!n||!n.__full__){n=n||(e.__observable__={}),n.__full__=!0,h.forEach(function(n){e[n]=function(){r=!1;var e=b[n].apply(t,arguments);return r=!0,e}}),g.forEach(function(n){e[n]=function(){r&&t.valueWillMutate();var a=m[n].apply(e,arguments);return r&&t.valueHasMutated(),a}}),p.forEach(function(n){e[n]=function(){for(var a=0,i=arguments.length;i>a;a++)s(arguments[a]);r&&t.valueWillMutate();var o=m[n].apply(e,arguments);return r&&t.valueHasMutated(),o}}),e.splice=function(){for(var n=2,a=arguments.length;a>n;n++)s(arguments[n]);r&&t.valueWillMutate();var i=m.splice.apply(e,arguments);return r&&t.valueHasMutated(),i};for(var a=0,i=e.length;i>a;a++)s(e[a])}}function s(t){var a,s;if(i(t)&&(a=t.__observable__,!a||!a.__full__)){if(a=a||(t.__observable__={}),a.__full__=!0,e.isArray(t)){var l=n.observableArray(t);o(t,l)}else for(var u in t)r(u)||a[u]||(s=t[u],e.isFunction(s)||c(t,u,s));w&&e.log("Converted",t)}}function l(e,t,n){var r;e(t),r=e.peek(),n?r?r.destroyAll||o(r,e):(r=[],e(r),o(r,e)):s(r)}function c(t,r,a){var i,c,u=t.__observable__||(t.__observable__={});if(void 0===a&&(a=t[r]),e.isArray(a))i=n.observableArray(a),o(a,i),c=!0;else if("function"==typeof a){if(!n.isObservable(a))return null;i=a}else e.isPromise(a)?(i=n.observable(),a.then(function(t){if(e.isArray(t)){var r=n.observableArray(t);o(t,r),t=r}i(t)})):(i=n.observable(a),s(a));return Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get:i,set:n.isWriteableObservable(i)?function(t){t&&e.isPromise(t)?t.then(function(t){l(i,t,e.isArray(t))}):l(i,t,c)}:void 0}),u[r]=i,i}function u(t,r,a){var i,o={owner:t,deferEvaluation:!0};return"function"==typeof a?o.read=a:("value"in a&&e.error('For defineProperty, you must not specify a "value" for the property. You must provide a "get" function.'),"function"!=typeof a.get&&e.error('For defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".'),o.read=a.get,o.write=a.set),i=n.computed(o),t[r]=i,c(t,r,i)}var d,f=Object.prototype.toString,v=["[object Function]","[object String]","[object Boolean]","[object Number]","[object Date]","[object RegExp]"],h=["remove","removeAll","destroy","destroyAll","replace"],g=["pop","reverse","sort","shift","splice"],p=["push","unshift"],m=Array.prototype,b=n.observableArray.fn,w=!1;return d=function(e,t){var r,a,i;return e?(r=e.__observable__,r&&(a=r[t])?a:(i=e[t],n.isObservable(i)?i:c(e,t,i))):null},d.defineProperty=u,d.convertProperty=c,d.convertObject=s,d.install=function(e){var n=t.binding;t.binding=function(e,t,r){r.applyBindings&&!r.skipConversion&&s(e),n(e,t)},w=e.logConversion},d});
  define('plugins/serializer',["durandal/system"],function(e){return{typeAttribute:"type",space:void 0,replacer:function(e,t){if(e){var r=e[0];if("_"===r||"$"===r)return void 0}return t},serialize:function(t,r){return r=void 0===r?{}:r,(e.isString(r)||e.isNumber(r))&&(r={space:r}),JSON.stringify(t,r.replacer||this.replacer,r.space||this.space)},getTypeId:function(e){return e?e[this.typeAttribute]:void 0},typeMap:{},registerType:function(){var t=arguments[0];if(1==arguments.length){var r=t[this.typeAttribute]||e.getModuleId(t);this.typeMap[r]=t}else this.typeMap[t]=arguments[1]},reviver:function(e,t,r,n){var a=r(t);if(a){var i=n(a);if(i)return i.fromJSON?i.fromJSON(t):new i(t)}return t},deserialize:function(e,t){var r=this;t=t||{};var n=t.getTypeId||function(e){return r.getTypeId(e)},a=t.getConstructor||function(e){return r.typeMap[e]},i=t.reviver||function(e,t){return r.reviver(e,t,n,a)};return JSON.parse(e,i)}}});
  define('plugins/widget',["durandal/system","durandal/composition","jquery","knockout"],function(e,t,n,r){function a(e,n){var a=r.utils.domData.get(e,l);a||(a={parts:t.cloneNodes(r.virtualElements.childNodes(e))},r.virtualElements.emptyNode(e),r.utils.domData.set(e,l,a)),n.parts=a.parts}var i={},o={},s=["model","view","kind"],l="durandal-widget-data",c={getSettings:function(t){var n=r.utils.unwrapObservable(t())||{};if(e.isString(n))return{kind:n};for(var a in n)n[a]=-1!=r.utils.arrayIndexOf(s,a)?r.utils.unwrapObservable(n[a]):n[a];return n},registerKind:function(e){r.bindingHandlers[e]={init:function(){return{controlsDescendantBindings:!0}},update:function(t,n,r,i,o){var s=c.getSettings(n);s.kind=e,a(t,s),c.create(t,s,o,!0)}},r.virtualElements.allowedBindings[e]=!0,t.composeBindings.push(e+":")},mapKind:function(e,t,n){t&&(o[e]=t),n&&(i[e]=n)},mapKindToModuleId:function(e){return i[e]||c.convertKindToModulePath(e)},convertKindToModulePath:function(e){return"widgets/"+e+"/viewmodel"},mapKindToViewId:function(e){return o[e]||c.convertKindToViewPath(e)},convertKindToViewPath:function(e){return"widgets/"+e+"/view"},createCompositionSettings:function(e,t){return t.model||(t.model=this.mapKindToModuleId(t.kind)),t.view||(t.view=this.mapKindToViewId(t.kind)),t.preserveContext=!0,t.activate=!0,t.activationData=t,t.mode="templated",t},create:function(e,n,r,a){a||(n=c.getSettings(function(){return n},e));var i=c.createCompositionSettings(e,n);t.compose(e,i,r)},install:function(e){if(e.bindingName=e.bindingName||"widget",e.kinds)for(var n=e.kinds,i=0;i<n.length;i++)c.registerKind(n[i]);r.bindingHandlers[e.bindingName]={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t,n,r,i){var o=c.getSettings(t);a(e,o),c.create(e,o,i,!0)}},t.composeBindings.push(e.bindingName+":"),r.virtualElements.allowedBindings[e.bindingName]=!0}};return c});
  define('transitions/entrance',["durandal/system","durandal/composition","jquery"],function(e,t,n){var r=100,a={marginRight:0,marginLeft:0,opacity:1},i={marginLeft:"",marginRight:"",opacity:"",display:""},o=function(t){return e.defer(function(e){function o(){e.resolve()}function s(){t.keepScrollPosition||n(document).scrollTop(0)}function l(){s(),t.triggerAttach();var e={marginLeft:u?"0":"20px",marginRight:u?"0":"-20px",opacity:0,display:"block"},r=n(t.child);r.css(e),r.animate(a,{duration:c,easing:"swing",always:function(){r.css(i),o()}})}if(t.child){var c=t.duration||500,u=!!t.fadeOnly;t.activeView?n(t.activeView).fadeOut({duration:r,always:l}):l()}else n(t.activeView).fadeOut(r,o)}).promise()};return o});
  
  require(["main"]);
  }());