mix-rails-core 0.23.1 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/images/blank.gif +0 -0
  3. data/app/assets/images/jqzoom/advertise.jpg +0 -0
  4. data/app/assets/images/jqzoom/zoomloader.gif +0 -0
  5. data/app/assets/images/loadinfo.net.gif +0 -0
  6. data/app/assets/javascripts/angular-google-maps.js +531 -0
  7. data/app/assets/javascripts/angular-ui.min.js +7 -0
  8. data/app/assets/javascripts/angular.min.js +161 -0
  9. data/app/assets/javascripts/gmaps.js +1909 -0
  10. data/app/assets/javascripts/jquery-gmaps-latlon-picker.js +231 -0
  11. data/app/assets/javascripts/jquery.jqzoom.js +1 -0
  12. data/app/assets/javascripts/jquery.krioImageLoader.js +47 -0
  13. data/app/assets/javascripts/jquery.lazyload.js +227 -0
  14. data/app/assets/javascripts/jquery.maskedinput.js +290 -0
  15. data/app/assets/javascripts/jquery.meio.mask.min.js +1 -0
  16. data/app/assets/javascripts/jquery.ui.addresspicker.js +194 -0
  17. data/app/assets/javascripts/jquery/jquery.jqzoom-core.js +733 -0
  18. data/app/assets/javascripts/multizoom.js +388 -0
  19. data/app/assets/stylesheets/angular-ui.min.css +1 -0
  20. data/app/assets/stylesheets/jquery-gmaps-latlon-picker.css +2 -0
  21. data/app/assets/stylesheets/jquery.jqzoom.css +3 -0
  22. data/app/assets/stylesheets/jquery/jquery.jqzoom.css.erb +120 -0
  23. data/app/assets/stylesheets/multizoom.css +48 -0
  24. data/app/helpers/core_helper.rb +4 -0
  25. data/app/inputs/cell_input.rb +5 -0
  26. data/app/inputs/cep_input.rb +5 -0
  27. data/app/inputs/phone_input.rb +5 -0
  28. data/app/inputs/state_input.rb +5 -0
  29. data/app/models/attachment.rb +4 -1
  30. data/app/models/category.rb +4 -1
  31. data/app/models/ckeditor/asset.rb +7 -0
  32. data/app/models/ckeditor/attachment_file.rb +7 -0
  33. data/app/models/ckeditor/picture.rb +7 -0
  34. data/app/uploaders/ckeditor_attachment_file_uploader.rb +36 -0
  35. data/app/uploaders/ckeditor_picture_uploader.rb +47 -0
  36. data/app/views/admix/categories/_form_config.haml +3 -0
  37. data/config/initializers/ckeditor.rb +21 -0
  38. data/config/initializers/defaults_rails.rb +10 -1
  39. data/config/locales/core.pt-BR.yml +25 -2
  40. data/config/routes.rb +2 -0
  41. data/db/migrate/20130226152256_create_ckeditor_assets.rb +26 -0
  42. data/lib/mix-rails-core.rb +3 -0
  43. data/lib/mix-rails-core/version.rb +2 -2
  44. metadata +73 -120
  45. data/app/assets/javascripts/jquery/jquery.maskedinput-1.3.min.js +0 -7
  46. data/app/models/admix/categories_datagrid.rb +0 -14
  47. data/app/views/admix/categories/_form_fields.haml +0 -1
@@ -0,0 +1,7 @@
1
+ /**
2
+ * AngularUI - The companion suite for AngularJS
3
+ * @version v0.4.0 - 2013-02-15
4
+ * @link http://angular-ui.github.com
5
+ * @license MIT License, http://www.opensource.org/licenses/MIT
6
+ */
7
+ angular.module("ui.config",[]).value("ui.config",{}),angular.module("ui.filters",["ui.config"]),angular.module("ui.directives",["ui.config"]),angular.module("ui",["ui.filters","ui.directives","ui.config"]),angular.module("ui.directives").directive("uiAnimate",["ui.config","$timeout",function(e,t){var n={};return angular.isString(e.animate)?n["class"]=e.animate:e.animate&&(n=e.animate),{restrict:"A",link:function(e,r,i){var s={};i.uiAnimate&&(s=e.$eval(i.uiAnimate),angular.isString(s)&&(s={"class":s})),s=angular.extend({"class":"ui-animate"},n,s),r.addClass(s["class"]),t(function(){r.removeClass(s["class"])},20,!1)}}}]),angular.module("ui.directives").directive("uiCalendar",["ui.config","$parse",function(e,t){return e.uiCalendar=e.uiCalendar||{},{require:"ngModel",restrict:"A",link:function(t,n,r,i){function a(){t.calendar=n.html("");var i=t.calendar.fullCalendar("getView");i&&(i=i.name);var o,u={defaultView:i,eventSources:s};r.uiCalendar?o=t.$eval(r.uiCalendar):o={},angular.extend(u,e.uiCalendar,o),t.calendar.fullCalendar(u)}var s=t.$eval(r.ngModel),o=0,u=function(){var e=t.$eval(r.equalsTracker);return o=0,angular.forEach(s,function(e,t){angular.isArray(e)&&(o+=e.length)}),angular.isNumber(e)?o+s.length+e:o+s.length};a(),t.$watch(u,function(e,t){a()})}}}]),angular.module("ui.directives").directive("uiCodemirror",["ui.config","$timeout",function(e,t){"use strict";var n=["cursorActivity","viewportChange","gutterClick","focus","blur","scroll","update"];return{restrict:"A",require:"ngModel",link:function(r,i,s,o){var u,a,f,l,c;if(i[0].type!=="textarea")throw new Error("uiCodemirror3 can only be applied to a textarea element");u=e.codemirror||{},a=angular.extend({},u,r.$eval(s.uiCodemirror)),f=function(e){return function(t,n){var i=t.getValue();i!==o.$viewValue&&(o.$setViewValue(i),r.$apply()),typeof e=="function"&&e(t,n)}},l=function(){c=CodeMirror.fromTextArea(i[0],a),c.on("change",f(a.onChange));for(var e=0,u=n.length,l;e<u;++e){l=a["on"+n[e].charAt(0).toUpperCase()+n[e].slice(1)];if(l===void 0)continue;if(typeof l!="function")continue;c.on(n[e],l)}o.$formatters.push(function(e){if(angular.isUndefined(e)||e===null)return"";if(angular.isObject(e)||angular.isArray(e))throw new Error("ui-codemirror cannot use an object or an array as a model");return e}),o.$render=function(){c.setValue(o.$viewValue)},s.uiRefresh&&r.$watch(s.uiRefresh,function(e,n){e!==n&&t(c.refresh)})},t(l)}}}]),angular.module("ui.directives").directive("uiCurrency",["ui.config","currencyFilter",function(e,t){var n={pos:"ui-currency-pos",neg:"ui-currency-neg",zero:"ui-currency-zero"};return e.currency&&angular.extend(n,e.currency),{restrict:"EAC",require:"ngModel",link:function(e,r,i,s){var o,u,a;o=angular.extend({},n,e.$eval(i.uiCurrency)),u=function(e){var n;return n=e*1,r.toggleClass(o.pos,n>0),r.toggleClass(o.neg,n<0),r.toggleClass(o.zero,n===0),e===""?r.text(""):r.text(t(n,o.symbol)),!0},s.$render=function(){a=s.$viewValue,r.val(a),u(a)}}}}]),angular.module("ui.directives").directive("uiDate",["ui.config",function(e){"use strict";var t;return t={},angular.isObject(e.date)&&angular.extend(t,e.date),{require:"?ngModel",link:function(t,n,r,i){var s=function(){return angular.extend({},e.date,t.$eval(r.uiDate))},o=function(){var e=s();if(i){var r=function(){t.$apply(function(){var e=n.datepicker("getDate");n.datepicker("setDate",n.val()),i.$setViewValue(e),n.blur()})};if(e.onSelect){var o=e.onSelect;e.onSelect=function(e,n){r(),t.$apply(function(){o(e,n)})}}else e.onSelect=r;n.bind("change",r),i.$render=function(){var e=i.$viewValue;if(angular.isDefined(e)&&e!==null&&!angular.isDate(e))throw new Error("ng-Model value must be a Date object - currently it is a "+typeof e+" - use ui-date-format to convert it from a string");n.datepicker("setDate",e)}}n.datepicker("destroy"),n.datepicker(e),i&&i.$render()};t.$watch(s,o,!0)}}}]).directive("uiDateFormat",["ui.config",function(e){var t={require:"ngModel",link:function(t,n,r,i){var s=r.uiDateFormat||e.dateFormat;s?(i.$formatters.push(function(e){if(angular.isString(e))return $.datepicker.parseDate(s,e)}),i.$parsers.push(function(e){if(e)return $.datepicker.formatDate(s,e)})):(i.$formatters.push(function(e){if(angular.isString(e))return new Date(e)}),i.$parsers.push(function(e){if(e)return e.toISOString()}))}};return t}]),angular.module("ui.directives").directive("uiEvent",["$parse",function(e){return function(t,n,r){var i=t.$eval(r.uiEvent);angular.forEach(i,function(r,i){var s=e(r);n.bind(i,function(e){var n=Array.prototype.slice.call(arguments);n=n.splice(1),t.$apply(function(){s(t,{$event:e,$params:n})})})})}}]),angular.module("ui.directives").directive("uiIf",[function(){return{transclude:"element",priority:1e3,terminal:!0,restrict:"A",compile:function(e,t,n){return function(e,t,r){var i,s;e.$watch(r.uiIf,function(r){i&&(i.remove(),i=undefined),s&&(s.$destroy(),s=undefined),r&&(s=e.$new(),n(s,function(e){i=e,t.after(e)}))})}}}}]),angular.module("ui.directives").directive("uiJq",["ui.config","$timeout",function(t,n){return{restrict:"A",compile:function(r,i){if(!angular.isFunction(r[i.uiJq]))throw new Error('ui-jq: The "'+i.uiJq+'" function does not exist');var s=t.jq&&t.jq[i.uiJq];return function(t,r,i){function u(){n(function(){r[i.uiJq].apply(r,o)},0,!1)}var o=[];i.uiOptions?(o=t.$eval("["+i.uiOptions+"]"),angular.isObject(s)&&angular.isObject(o[0])&&(o[0]=angular.extend({},s,o[0]))):s&&(o=[s]),i.ngModel&&r.is("select,input,textarea")&&r.on("change",function(){r.trigger("input")}),i.uiRefresh&&t.$watch(i.uiRefresh,function(e){u()}),u()}}}}]),angular.module("ui.directives").factory("keypressHelper",["$parse",function(t){var n={8:"backspace",9:"tab",13:"enter",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete"},r=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};return function(e,i,s,o){var u,a=[];u=i.$eval(o["ui"+r(e)]),angular.forEach(u,function(e,n){var r,i;i=t(e),angular.forEach(n.split(" "),function(e){r={expression:i,keys:{}},angular.forEach(e.split("-"),function(e){r.keys[e]=!0}),a.push(r)})}),s.bind(e,function(t){var r=t.metaKey||t.altKey,s=t.ctrlKey,o=t.shiftKey,u=t.keyCode;e==="keypress"&&!o&&u>=97&&u<=122&&(u-=32),angular.forEach(a,function(e){var u=e.keys[n[t.keyCode]]||e.keys[t.keyCode.toString()]||!1,a=e.keys.alt||!1,f=e.keys.ctrl||!1,l=e.keys.shift||!1;u&&a==r&&f==s&&l==o&&i.$apply(function(){e.expression(i,{$event:t})})})})}}]),angular.module("ui.directives").directive("uiKeydown",["keypressHelper",function(e){return{link:function(t,n,r){e("keydown",t,n,r)}}}]),angular.module("ui.directives").directive("uiKeypress",["keypressHelper",function(e){return{link:function(t,n,r){e("keypress",t,n,r)}}}]),angular.module("ui.directives").directive("uiKeyup",["keypressHelper",function(e){return{link:function(t,n,r){e("keyup",t,n,r)}}}]),function(){function t(e,t,n,r){angular.forEach(t.split(" "),function(t){var i={type:"map-"+t};google.maps.event.addListener(n,t,function(t){r.triggerHandler(angular.extend({},i,t)),e.$$phase||e.$apply()})})}function n(n,r){e.directive(n,[function(){return{restrict:"A",link:function(e,i,s){e.$watch(s[n],function(n){t(e,r,n,i)})}}}])}var e=angular.module("ui.directives");e.directive("uiMap",["ui.config","$parse",function(e,n){var r="bounds_changed center_changed click dblclick drag dragend dragstart heading_changed idle maptypeid_changed mousemove mouseout mouseover projection_changed resize rightclick tilesloaded tilt_changed zoom_changed",i=e.map||{};return{restrict:"A",link:function(e,s,o){var u=angular.extend({},i,e.$eval(o.uiOptions)),a=new google.maps.Map(s[0],u),f=n(o.uiMap);f.assign(e,a),t(e,r,a,s)}}}]),e.directive("uiMapInfoWindow",["ui.config","$parse","$compile",function(e,n,r){var i="closeclick content_change domready position_changed zindex_changed",s=e.mapInfoWindow||{};return{link:function(e,o,u){var a=angular.extend({},s,e.$eval(u.uiOptions));a.content=o[0];var f=n(u.uiMapInfoWindow),l=f(e);l||(l=new google.maps.InfoWindow(a),f.assign(e,l)),t(e,i,l,o),o.replaceWith("<div></div>");var c=l.open;l.open=function(n,i,s,u,a,f){r(o.contents())(e),c.call(l,n,i,s,u,a,f)}}}}]),n("uiMapMarker","animation_changed click clickable_changed cursor_changed dblclick drag dragend draggable_changed dragstart flat_changed icon_changed mousedown mouseout mouseover mouseup position_changed rightclick shadow_changed shape_changed title_changed visible_changed zindex_changed"),n("uiMapPolyline","click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapPolygon","click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapRectangle","bounds_changed click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapCircle","center_changed click dblclick mousedown mousemove mouseout mouseover mouseup radius_changed rightclick"),n("uiMapGroundOverlay","click dblclick")}(),angular.module("ui.directives").directive("uiMask",[function(){return{require:"ngModel",link:function(e,t,n,r){r.$render=function(){var i=r.$viewValue||"";t.val(i),t.mask(e.$eval(n.uiMask))},r.$parsers.push(function(e){var n=t.isMaskValid()||angular.isUndefined(t.isMaskValid())&&t.val().length>0;return r.$setValidity("mask",n),n?e:undefined}),t.bind("keyup",function(){e.$apply(function(){r.$setViewValue(t.mask())})})}}}]),angular.module("ui.directives").directive("uiReset",["ui.config",function(e){var t=null;return e.reset!==undefined&&(t=e.reset),{require:"ngModel",link:function(e,n,r,i){var s;s=angular.element('<a class="ui-reset" />'),n.wrap('<span class="ui-resetwrap" />').after(s),s.bind("click",function(n){n.preventDefault(),e.$apply(function(){r.uiReset?i.$setViewValue(e.$eval(r.uiReset)):i.$setViewValue(t),i.$render()})})}}}]),angular.module("ui.directives").directive("uiRoute",["$location","$parse",function(e,t){return{restrict:"AC",compile:function(n,r){var i;if(r.uiRoute)i="uiRoute";else if(r.ngHref)i="ngHref";else{if(!r.href)throw new Error("uiRoute missing a route or href property on "+n[0]);i="href"}return function(n,r,s){function a(t){(hash=t.indexOf("#"))>-1&&(t=t.substr(hash+1)),u=function(){o(n,e.path().indexOf(t)>-1)},u()}function f(t){(hash=t.indexOf("#"))>-1&&(t=t.substr(hash+1)),u=function(){var i=new RegExp("^"+t+"$",["i"]);o(n,i.test(e.path()))},u()}var o=t(s.ngModel||s.routeModel||"$uiRoute").assign,u=angular.noop;switch(i){case"uiRoute":s.uiRoute?f(s.uiRoute):s.$observe("uiRoute",f);break;case"ngHref":s.ngHref?a(s.ngHref):s.$observe("ngHref",a);break;case"href":a(s.href)}n.$on("$routeChangeSuccess",function(){u()})}}}}]),angular.module("ui.directives").directive("uiScrollfix",["$window",function(e){"use strict";return{link:function(t,n,r){var i=n.offset().top;r.uiScrollfix?r.uiScrollfix.charAt(0)==="-"?r.uiScrollfix=i-r.uiScrollfix.substr(1):r.uiScrollfix.charAt(0)==="+"&&(r.uiScrollfix=i+parseFloat(r.uiScrollfix.substr(1))):r.uiScrollfix=i,angular.element(e).on("scroll.ui-scrollfix",function(){var t;if(angular.isDefined(e.pageYOffset))t=e.pageYOffset;else{var i=document.compatMode&&document.compatMode!=="BackCompat"?document.documentElement:document.body;t=i.scrollTop}!n.hasClass("ui-scrollfix")&&t>r.uiScrollfix?n.addClass("ui-scrollfix"):n.hasClass("ui-scrollfix")&&t<r.uiScrollfix&&n.removeClass("ui-scrollfix")})}}}]),angular.module("ui.directives").directive("uiSelect2",["ui.config","$timeout",function(e,t){var n={};return e.select2&&angular.extend(n,e.select2),{require:"?ngModel",compile:function(e,r){var i,s,o,u=e.is("select"),a=r.multiple!==undefined;return e.is("select")&&(s=e.find("option[ng-repeat], option[data-ng-repeat]"),s.length&&(o=s.attr("ng-repeat")||s.attr("data-ng-repeat"),i=jQuery.trim(o.split("|")[0]).split(" ").pop())),function(e,r,s,o){var f=angular.extend({},n,e.$eval(s.uiSelect2));u?(delete f.multiple,delete f.initSelection):a&&(f.multiple=!0);if(o){o.$render=function(){u?r.select2("val",o.$modelValue):a?o.$modelValue?angular.isArray(o.$modelValue)?r.select2("data",o.$modelValue):r.select2("val",o.$modelValue):r.select2("data",[]):angular.isObject(o.$modelValue)?r.select2("data",o.$modelValue):r.select2("val",o.$modelValue)},i&&e.$watch(i,function(e,n,i){if(!e)return;t(function(){r.select2("val",o.$viewValue),r.trigger("change")})});if(!u){r.bind("change",function(){e.$apply(function(){o.$setViewValue(r.select2("data"))})});if(f.initSelection){var l=f.initSelection;f.initSelection=function(e,t){l(e,function(e){o.$setViewValue(e),t(e)})}}}}s.$observe("disabled",function(e){r.select2(e&&"disable"||"enable")}),s.ngMultiple&&e.$watch(s.ngMultiple,function(e){r.select2(f)}),r.val(e.$eval(s.ngModel)),t(function(){r.select2(f),!f.initSelection&&!u&&o.$setViewValue(r.select2("data"))})}}}}]),angular.module("ui.directives").directive("uiShow",[function(){return function(e,t,n){e.$watch(n.uiShow,function(e,n){e?t.addClass("ui-show"):t.removeClass("ui-show")})}}]).directive("uiHide",[function(){return function(e,t,n){e.$watch(n.uiHide,function(e,n){e?t.addClass("ui-hide"):t.removeClass("ui-hide")})}}]).directive("uiToggle",[function(){return function(e,t,n){e.$watch(n.uiToggle,function(e,n){e?t.removeClass("ui-hide").addClass("ui-show"):t.removeClass("ui-show").addClass("ui-hide")})}}]),angular.module("ui.directives").directive("uiSortable",["ui.config",function(e){return{require:"?ngModel",link:function(t,n,r,i){var s,o,u,a,f,l,c,h,p;f=angular.extend({},e.sortable,t.$eval(r.uiSortable)),i&&(i.$render=function(){n.sortable("refresh")},u=function(e,t){t.item.sortable={index:t.item.index()}},a=function(e,t){t.item.sortable.resort=i},s=function(e,t){t.item.sortable.relocate=!0,i.$modelValue.splice(t.item.index(),0,t.item.sortable.moved)},o=function(e,t){i.$modelValue.length===1?t.item.sortable.moved=i.$modelValue.splice(0,1)[0]:t.item.sortable.moved=i.$modelValue.splice(t.item.sortable.index,1)[0]},onStop=function(e,n){if(n.item.sortable.resort&&!n.item.sortable.relocate){var r,i;i=n.item.sortable.index,r=n.item.index(),i<r&&r--,n.item.sortable.resort.$modelValue.splice(r,0,n.item.sortable.resort.$modelValue.splice(i,1)[0])}(n.item.sortable.resort||n.item.sortable.relocate)&&t.$apply()},h=f.start,f.start=function(e,t){u(e,t),typeof h=="function"&&h(e,t)},_stop=f.stop,f.stop=function(e,t){onStop(e,t),typeof _stop=="function"&&_stop(e,t)},p=f.update,f.update=function(e,t){a(e,t),typeof p=="function"&&p(e,t)},l=f.receive,f.receive=function(e,t){s(e,t),typeof l=="function"&&l(e,t)},c=f.remove,f.remove=function(e,t){o(e,t),typeof c=="function"&&c(e,t)}),n.sortable(f)}}}]),angular.module("ui.directives").directive("uiTinymce",["ui.config",function(e){return e.tinymce=e.tinymce||{},{require:"ngModel",link:function(t,n,r,i){var s,o={onchange_callback:function(e){e.isDirty()&&(e.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply())},handle_event_callback:function(e){return this.isDirty()&&(this.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply()),!0},setup:function(e){e.onSetContent.add(function(e,r){e.isDirty()&&(e.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply())})}};r.uiTinymce?s=t.$eval(r.uiTinymce):s={},angular.extend(o,e.tinymce,s),setTimeout(function(){n.tinymce(o)})}}}]),angular.module("ui.directives").directive("uiValidate",function(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){var i,s,o={},u=e.$eval(n.uiValidate);if(!u)return;angular.isString(u)&&(u={validator:u}),angular.forEach(u,function(t,n){i=function(i){return e.$eval(t,{$value:i})?(r.$setValidity(n,!0),i):(r.$setValidity(n,!1),undefined)},o[n]=i,r.$formatters.push(i),r.$parsers.push(i)}),n.uiValidateWatch&&(s=e.$eval(n.uiValidateWatch),angular.isString(s)?e.$watch(s,function(){angular.forEach(o,function(e,t){e(r.$modelValue)})}):angular.forEach(s,function(t,n){e.$watch(t,function(){o[n](r.$modelValue)})}))}}}),angular.module("ui.filters").filter("format",function(){return function(e,t){if(!e)return e;var n=e.toString(),r;return t===undefined?n:!angular.isArray(t)&&!angular.isObject(t)?n.split("$0").join(t):(r=angular.isArray(t)&&"$"||":",angular.forEach(t,function(e,t){n=n.split(r+t).join(e)}),n)}}),angular.module("ui.filters").filter("highlight",function(){return function(e,t,n){return t||angular.isNumber(t)?(e=e.toString(),t=t.toString(),n?e.split(t).join('<span class="ui-match">'+t+"</span>"):e.replace(new RegExp(t,"gi"),'<span class="ui-match">$&</span>')):e}}),angular.module("ui.filters").filter("inflector",function(){function e(e){return e.replace(/^([a-z])|\s+([a-z])/g,function(e){return e.toUpperCase()})}function t(e,t){return e.replace(/[A-Z]/g,function(e){return t+e})}var n={humanize:function(n){return e(t(n," ").split("_").join(" "))},underscore:function(e){return e.substr(0,1).toLowerCase()+t(e.substr(1),"_").toLowerCase().split(" ").join("_")},variable:function(t){return t=t.substr(0,1).toLowerCase()+e(t.split("_").join(" ")).substr(1).split(" ").join(""),t}};return function(e,t,r){return t!==!1&&angular.isString(e)?(t=t||"humanize",n[t](e)):e}}),angular.module("ui.filters").filter("unique",function(){return function(e,t){if(t===!1)return e;if((t||angular.isUndefined(t))&&angular.isArray(e)){var n={},r=[],i=function(e){return angular.isObject(e)&&angular.isString(t)?e[t]:e};angular.forEach(e,function(e){var t,n=!1;for(var s=0;s<r.length;s++)if(angular.equals(i(r[s]),i(e))){n=!0;break}n||r.push(e)}),e=r}return e}});
@@ -0,0 +1,161 @@
1
+ /*
2
+ AngularJS v1.0.5
3
+ (c) 2010-2012 Google, Inc. http://angularjs.org
4
+ License: MIT
5
+ */
6
+ (function(X,Y,q){'use strict';function n(b,a,c){var d;if(b)if(H(b))for(d in b)d!="prototype"&&d!="length"&&d!="name"&&b.hasOwnProperty(d)&&a.call(c,b[d],d);else if(b.forEach&&b.forEach!==n)b.forEach(a,c);else if(!b||typeof b.length!=="number"?0:typeof b.hasOwnProperty!="function"&&typeof b.constructor!="function"||b instanceof L||ca&&b instanceof ca||xa.call(b)!=="[object Object]"||typeof b.callee==="function")for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],
7
+ d);return b}function mb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function fc(b,a,c){for(var d=mb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function nb(b){return function(a,c){b(c,a)}}function ya(){for(var b=aa.length,a;b;){b--;a=aa[b].charCodeAt(0);if(a==57)return aa[b]="A",aa.join("");if(a==90)aa[b]="0";else return aa[b]=String.fromCharCode(a+1),aa.join("")}aa.unshift("0");return aa.join("")}function v(b){n(arguments,function(a){a!==b&&n(a,function(a,d){b[d]=
8
+ a})});return b}function E(b){return parseInt(b,10)}function za(b,a){return v(new (v(function(){},{prototype:b})),a)}function C(){}function na(b){return b}function I(b){return function(){return b}}function w(b){return typeof b=="undefined"}function x(b){return typeof b!="undefined"}function M(b){return b!=null&&typeof b=="object"}function A(b){return typeof b=="string"}function Ra(b){return typeof b=="number"}function oa(b){return xa.apply(b)=="[object Date]"}function B(b){return xa.apply(b)=="[object Array]"}
9
+ function H(b){return typeof b=="function"}function pa(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function O(b){return A(b)?b.replace(/^\s*/,"").replace(/\s*$/,""):b}function gc(b){return b&&(b.nodeName||b.bind&&b.find)}function Sa(b,a,c){var d=[];n(b,function(b,g,h){d.push(a.call(c,b,g,h))});return d}function Aa(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function Ta(b,a){var c=Aa(b,a);c>=0&&b.splice(c,1);return a}function U(b,a){if(pa(b)||
10
+ b&&b.$evalAsync&&b.$watch)throw Error("Can't copy Window or Scope");if(a){if(b===a)throw Error("Can't copy equivalent objects or arrays");if(B(b))for(var c=a.length=0;c<b.length;c++)a.push(U(b[c]));else for(c in n(a,function(b,c){delete a[c]}),b)a[c]=U(b[c])}else(a=b)&&(B(b)?a=U(b,[]):oa(b)?a=new Date(b.getTime()):M(b)&&(a=U(b,{})));return a}function hc(b,a){var a=a||{},c;for(c in b)b.hasOwnProperty(c)&&c.substr(0,2)!=="$$"&&(a[c]=b[c]);return a}function ga(b,a){if(b===a)return!0;if(b===null||a===
11
+ null)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&c=="object")if(B(b)){if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ga(b[d],a[d]))return!1;return!0}}else if(oa(b))return oa(a)&&b.getTime()==a.getTime();else{if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||pa(b)||pa(a))return!1;c={};for(d in b)if(!(d.charAt(0)==="$"||H(b[d]))){if(!ga(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c[d]&&d.charAt(0)!=="$"&&a[d]!==q&&!H(a[d]))return!1;return!0}return!1}function Ua(b,a){var c=
12
+ arguments.length>2?ha.call(arguments,2):[];return H(a)&&!(a instanceof RegExp)?c.length?function(){return arguments.length?a.apply(b,c.concat(ha.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}:a}function ic(b,a){var c=a;/^\$+/.test(b)?c=q:pa(a)?c="$WINDOW":a&&Y===a?c="$DOCUMENT":a&&a.$evalAsync&&a.$watch&&(c="$SCOPE");return c}function da(b,a){return JSON.stringify(b,ic,a?" ":null)}function ob(b){return A(b)?JSON.parse(b):b}function Va(b){b&&b.length!==
13
+ 0?(b=y(""+b),b=!(b=="f"||b=="0"||b=="false"||b=="no"||b=="n"||b=="[]")):b=!1;return b}function qa(b){b=u(b).clone();try{b.html("")}catch(a){}var c=u("<div>").append(b).html();try{return b[0].nodeType===3?y(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+y(b)})}catch(d){return y(c)}}function Wa(b){var a={},c,d;n((b||"").split("&"),function(b){b&&(c=b.split("="),d=decodeURIComponent(c[0]),a[d]=x(c[1])?decodeURIComponent(c[1]):!0)});return a}function pb(b){var a=[];n(b,function(b,
14
+ d){a.push(Xa(d,!0)+(b===!0?"":"="+Xa(b,!0)))});return a.length?a.join("&"):""}function Ya(b){return Xa(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Xa(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(a?null:/%20/g,"+")}function jc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,h=["ng:app","ng-app","x-ng-app","data-ng-app"],f=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;n(h,function(a){h[a]=!0;c(Y.getElementById(a));
15
+ a=a.replace(":","\\:");b.querySelectorAll&&(n(b.querySelectorAll("."+a),c),n(b.querySelectorAll("."+a+"\\:"),c),n(b.querySelectorAll("["+a+"]"),c))});n(d,function(a){if(!e){var b=f.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):n(a.attributes,function(b){if(!e&&h[b.name])e=a,g=b.value})}});e&&a(e,g?[g]:[])}function qb(b,a){b=u(b);a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");var c=rb(a);c.invoke(["$rootScope","$rootElement","$compile","$injector",
16
+ function(a,b,c,h){a.$apply(function(){b.data("$injector",h);c(b)(a)})}]);return c}function Za(b,a){a=a||"_";return b.replace(kc,function(b,d){return(d?a:"")+b.toLowerCase()})}function $a(b,a,c){if(!b)throw Error("Argument '"+(a||"?")+"' is "+(c||"required"));return b}function ra(b,a,c){c&&B(b)&&(b=b[b.length-1]);$a(H(b),a,"not a function, got "+(b&&typeof b=="object"?b.constructor.name||"Object":typeof b));return b}function lc(b){function a(a,b,e){return a[b]||(a[b]=e())}return a(a(b,"angular",Object),
17
+ "module",function(){var b={};return function(d,e,g){e&&b.hasOwnProperty(d)&&(b[d]=null);return a(b,d,function(){function a(c,d,e){return function(){b[e||"push"]([c,d,arguments]);return k}}if(!e)throw Error("No module: "+d);var b=[],c=[],i=a("$injector","invoke"),k={_invokeQueue:b,_runBlocks:c,requires:e,name:d,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),filter:a("$filterProvider",
18
+ "register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:i,run:function(a){c.push(a);return this}};g&&i(g);return k})}})}function sb(b){return b.replace(mc,function(a,b,d,e){return e?d.toUpperCase():d}).replace(nc,"Moz$1")}function ab(b,a){function c(){var e;for(var b=[this],c=a,h,f,j,i,k,m;b.length;){h=b.shift();f=0;for(j=h.length;f<j;f++){i=u(h[f]);c?i.triggerHandler("$destroy"):c=!c;k=0;for(e=(m=i.children()).length,i=e;k<i;k++)b.push(ca(m[k]))}}return d.apply(this,
19
+ arguments)}var d=ca.fn[b],d=d.$original||d;c.$original=d;ca.fn[b]=c}function L(b){if(b instanceof L)return b;if(!(this instanceof L)){if(A(b)&&b.charAt(0)!="<")throw Error("selectors not implemented");return new L(b)}if(A(b)){var a=Y.createElement("div");a.innerHTML="<div>&#160;</div>"+b;a.removeChild(a.firstChild);bb(this,a.childNodes);this.remove()}else bb(this,b)}function cb(b){return b.cloneNode(!0)}function sa(b){tb(b);for(var a=0,b=b.childNodes||[];a<b.length;a++)sa(b[a])}function ub(b,a,c){var d=
20
+ ba(b,"events");ba(b,"handle")&&(w(a)?n(d,function(a,c){db(b,c,a);delete d[c]}):w(c)?(db(b,a,d[a]),delete d[a]):Ta(d[a],c))}function tb(b){var a=b[Ba],c=Ca[a];c&&(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),ub(b)),delete Ca[a],b[Ba]=q)}function ba(b,a,c){var d=b[Ba],d=Ca[d||-1];if(x(c))d||(b[Ba]=d=++oc,d=Ca[d]={}),d[a]=c;else return d&&d[a]}function vb(b,a,c){var d=ba(b,"data"),e=x(c),g=!e&&x(a),h=g&&!M(a);!d&&!h&&ba(b,"data",d={});if(e)d[a]=c;else if(g)if(h)return d&&d[a];else v(d,a);else return d}
21
+ function Da(b,a){return(" "+b.className+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" ")>-1}function wb(b,a){a&&n(a.split(" "),function(a){b.className=O((" "+b.className+" ").replace(/[\n\t]/g," ").replace(" "+O(a)+" "," "))})}function xb(b,a){a&&n(a.split(" "),function(a){if(!Da(b,a))b.className=O(b.className+" "+O(a))})}function bb(b,a){if(a)for(var a=!a.nodeName&&x(a.length)&&!pa(a)?a:[a],c=0;c<a.length;c++)b.push(a[c])}function yb(b,a){return Ea(b,"$"+(a||"ngController")+"Controller")}function Ea(b,
22
+ a,c){b=u(b);for(b[0].nodeType==9&&(b=b.find("html"));b.length;){if(c=b.data(a))return c;b=b.parent()}}function zb(b,a){var c=Fa[a.toLowerCase()];return c&&Ab[b.nodeName]&&c}function pc(b,a){var c=function(c,e){if(!c.preventDefault)c.preventDefault=function(){c.returnValue=!1};if(!c.stopPropagation)c.stopPropagation=function(){c.cancelBubble=!0};if(!c.target)c.target=c.srcElement||Y;if(w(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=
23
+ !1}c.isDefaultPrevented=function(){return c.defaultPrevented};n(a[e||c.type],function(a){a.call(b,c)});Z<=8?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function fa(b){var a=typeof b,c;if(a=="object"&&b!==null)if(typeof(c=b.$$hashKey)=="function")c=b.$$hashKey();else{if(c===q)c=b.$$hashKey=ya()}else c=b;return a+":"+c}function Ga(b){n(b,this.put,this)}function eb(){}function Bb(b){var a,
24
+ c;if(typeof b=="function"){if(!(a=b.$inject))a=[],c=b.toString().replace(qc,""),c=c.match(rc),n(c[1].split(sc),function(b){b.replace(tc,function(b,c,d){a.push(d)})}),b.$inject=a}else B(b)?(c=b.length-1,ra(b[c],"fn"),a=b.slice(0,c)):ra(b,"fn",!0);return a}function rb(b){function a(a){return function(b,c){if(M(b))n(b,nb(a));else return a(b,c)}}function c(a,b){if(H(b)||B(b))b=m.instantiate(b);if(!b.$get)throw Error("Provider "+a+" must define $get factory method.");return k[a+f]=b}function d(a,b){return c(a,
25
+ {$get:b})}function e(a){var b=[];n(a,function(a){if(!i.get(a))if(i.put(a,!0),A(a)){var c=ta(a);b=b.concat(e(c.requires)).concat(c._runBlocks);try{for(var d=c._invokeQueue,c=0,f=d.length;c<f;c++){var g=d[c],h=g[0]=="$injector"?m:m.get(g[0]);h[g[1]].apply(h,g[2])}}catch(j){throw j.message&&(j.message+=" from "+a),j;}}else if(H(a))try{b.push(m.invoke(a))}catch(o){throw o.message&&(o.message+=" from "+a),o;}else if(B(a))try{b.push(m.invoke(a))}catch(k){throw k.message&&(k.message+=" from "+String(a[a.length-
26
+ 1])),k;}else ra(a,"module")});return b}function g(a,b){function c(d){if(typeof d!=="string")throw Error("Service name expected");if(a.hasOwnProperty(d)){if(a[d]===h)throw Error("Circular dependency: "+j.join(" <- "));return a[d]}else try{return j.unshift(d),a[d]=h,a[d]=b(d)}finally{j.shift()}}function d(a,b,e){var f=[],i=Bb(a),g,h,j;h=0;for(g=i.length;h<g;h++)j=i[h],f.push(e&&e.hasOwnProperty(j)?e[j]:c(j));a.$inject||(a=a[g]);switch(b?-1:f.length){case 0:return a();case 1:return a(f[0]);case 2:return a(f[0],
27
+ f[1]);case 3:return a(f[0],f[1],f[2]);case 4:return a(f[0],f[1],f[2],f[3]);case 5:return a(f[0],f[1],f[2],f[3],f[4]);case 6:return a(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6]);case 8:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7]);case 9:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8]);case 10:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9]);default:return a.apply(b,f)}}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=
28
+ (B(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return M(e)?e:c},get:c,annotate:Bb}}var h={},f="Provider",j=[],i=new Ga,k={$provide:{provider:a(c),factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),value:a(function(a,b){return d(a,I(b))}),constant:a(function(a,b){k[a]=b;l[a]=b}),decorator:function(a,b){var c=m.get(a+f),d=c.$get;c.$get=function(){var a=t.invoke(d,c);return t.invoke(b,null,{$delegate:a})}}}},m=g(k,function(){throw Error("Unknown provider: "+
29
+ j.join(" <- "));}),l={},t=l.$injector=g(l,function(a){a=m.get(a+f);return t.invoke(a.$get,a)});n(e(b),function(a){t.invoke(a||C)});return t}function uc(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;n(a,function(a){!b&&y(a.nodeName)==="a"&&(b=a)});return b}function g(){var b=c.hash(),d;b?(d=h.getElementById(b))?d.scrollIntoView():(d=e(h.getElementsByName(b)))?d.scrollIntoView():b==="top"&&a.scrollTo(0,0):
30
+ a.scrollTo(0,0)}var h=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(g)});return g}]}function vc(b,a,c,d){function e(a){try{a.apply(null,ha.call(arguments,1))}finally{if(o--,o===0)for(;p.length;)try{p.pop()()}catch(b){c.error(b)}}}function g(a,b){(function R(){n(s,function(a){a()});J=b(R,a)})()}function h(){F!=f.url()&&(F=f.url(),n(V,function(a){a(f.url())}))}var f=this,j=a[0],i=b.location,k=b.history,m=b.setTimeout,l=b.clearTimeout,t={};f.isMock=!1;var o=0,p=[];f.$$completeOutstandingRequest=
31
+ e;f.$$incOutstandingRequestCount=function(){o++};f.notifyWhenNoOutstandingRequests=function(a){n(s,function(a){a()});o===0?a():p.push(a)};var s=[],J;f.addPollFn=function(a){w(J)&&g(100,m);s.push(a);return a};var F=i.href,z=a.find("base");f.url=function(a,b){if(a){if(F!=a)return F=a,d.history?b?k.replaceState(null,"",a):(k.pushState(null,"",a),z.attr("href",z.attr("href"))):b?i.replace(a):i.href=a,f}else return i.href.replace(/%27/g,"'")};var V=[],K=!1;f.onUrlChange=function(a){K||(d.history&&u(b).bind("popstate",
32
+ h),d.hashchange?u(b).bind("hashchange",h):f.addPollFn(h),K=!0);V.push(a);return a};f.baseHref=function(){var a=z.attr("href");return a?a.replace(/^https?\:\/\/[^\/]*/,""):""};var r={},$="",P=f.baseHref();f.cookies=function(a,b){var d,e,f,i;if(a)if(b===q)j.cookie=escape(a)+"=;path="+P+";expires=Thu, 01 Jan 1970 00:00:00 GMT";else{if(A(b))d=(j.cookie=escape(a)+"="+escape(b)+";path="+P).length+1,d>4096&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!")}else{if(j.cookie!==
33
+ $){$=j.cookie;d=$.split("; ");r={};for(f=0;f<d.length;f++)e=d[f],i=e.indexOf("="),i>0&&(r[unescape(e.substring(0,i))]=unescape(e.substring(i+1)))}return r}};f.defer=function(a,b){var c;o++;c=m(function(){delete t[c];e(a)},b||0);t[c]=!0;return c};f.defer.cancel=function(a){return t[a]?(delete t[a],l(a),e(C),!0):!1}}function wc(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new vc(b,d,a,c)}]}function xc(){this.$get=function(){function b(b,d){function e(a){if(a!=m){if(l){if(l==
34
+ a)l=a.n}else l=a;g(a.n,a.p);g(a,m);m=a;m.n=null}}function g(a,b){if(a!=b){if(a)a.p=b;if(b)b.n=a}}if(b in a)throw Error("cacheId "+b+" taken");var h=0,f=v({},d,{id:b}),j={},i=d&&d.capacity||Number.MAX_VALUE,k={},m=null,l=null;return a[b]={put:function(a,b){var c=k[a]||(k[a]={key:a});e(c);w(b)||(a in j||h++,j[a]=b,h>i&&this.remove(l.key))},get:function(a){var b=k[a];if(b)return e(b),j[a]},remove:function(a){var b=k[a];if(b){if(b==m)m=b.p;if(b==l)l=b.n;g(b.n,b.p);delete k[a];delete j[a];h--}},removeAll:function(){j=
35
+ {};h=0;k={};m=l=null},destroy:function(){k=f=j=null;delete a[b]},info:function(){return v({},f,{size:h})}}}var a={};b.info=function(){var b={};n(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}function yc(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function Cb(b){var a={},c="Directive",d=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,e=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,g="Template must have exactly one root element. was: ",h=/^\s*(https?|ftp|mailto):/;
36
+ this.directive=function j(d,e){A(d)?($a(e,"directive"),a.hasOwnProperty(d)||(a[d]=[],b.factory(d+c,["$injector","$exceptionHandler",function(b,c){var e=[];n(a[d],function(a){try{var g=b.invoke(a);if(H(g))g={compile:I(g)};else if(!g.compile&&g.link)g.compile=I(g.link);g.priority=g.priority||0;g.name=g.name||d;g.require=g.require||g.controller&&g.name;g.restrict=g.restrict||"A";e.push(g)}catch(h){c(h)}});return e}])),a[d].push(e)):n(d,nb(j));return this};this.urlSanitizationWhitelist=function(a){return x(a)?
37
+ (h=a,this):h};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document",function(b,i,k,m,l,t,o,p,s){function J(a,b,c){a instanceof u||(a=u(a));n(a,function(b,c){b.nodeType==3&&b.nodeValue.match(/\S+/)&&(a[c]=u(b).wrap("<span></span>").parent()[0])});var d=z(a,b,a,c);return function(b,c){$a(b,"scope");for(var e=c?va.clone.call(a):a,g=0,i=e.length;g<i;g++){var h=e[g];(h.nodeType==1||h.nodeType==9)&&e.eq(g).data("$scope",b)}F(e,
38
+ "ng-scope");c&&c(e,b);d&&d(b,e,e);return e}}function F(a,b){try{a.addClass(b)}catch(c){}}function z(a,b,c,d){function e(a,c,d,i){var h,j,k,o,l,m,t,s=[];l=0;for(m=c.length;l<m;l++)s.push(c[l]);t=l=0;for(m=g.length;l<m;t++)j=s[t],c=g[l++],h=g[l++],c?(c.scope?(k=a.$new(M(c.scope)),u(j).data("$scope",k)):k=a,(o=c.transclude)||!i&&b?c(h,k,j,d,function(b){return function(c){var d=a.$new();d.$$transcluded=!0;return b(d,c).bind("$destroy",Ua(d,d.$destroy))}}(o||b)):c(h,k,j,q,i)):h&&h(a,j.childNodes,q,i)}
39
+ for(var g=[],i,h,j,k=0;k<a.length;k++)h=new ia,i=V(a[k],[],h,d),h=(i=i.length?K(i,a[k],h,b,c):null)&&i.terminal||!a[k].childNodes.length?null:z(a[k].childNodes,i?i.transclude:b),g.push(i),g.push(h),j=j||i||h;return j?e:null}function V(a,b,c,i){var g=c.$attr,h;switch(a.nodeType){case 1:r(b,ea(fb(a).toLowerCase()),"E",i);var j,k,l;h=a.attributes;for(var o=0,m=h&&h.length;o<m;o++)if(j=h[o],j.specified)k=j.name,l=ea(k.toLowerCase()),g[l]=k,c[l]=j=O(Z&&k=="href"?decodeURIComponent(a.getAttribute(k,2)):
40
+ j.value),zb(a,l)&&(c[l]=!0),R(a,b,j,l),r(b,l,"A",i);a=a.className;if(A(a)&&a!=="")for(;h=e.exec(a);)l=ea(h[2]),r(b,l,"C",i)&&(c[l]=O(h[3])),a=a.substr(h.index+h[0].length);break;case 3:x(b,a.nodeValue);break;case 8:try{if(h=d.exec(a.nodeValue))l=ea(h[1]),r(b,l,"M",i)&&(c[l]=O(h[2]))}catch(t){}}b.sort(G);return b}function K(a,b,c,d,e){function i(a,b){if(a)a.require=r.require,m.push(a);if(b)b.require=r.require,s.push(b)}function h(a,b){var c,d="data",e=!1;if(A(a)){for(;(c=a.charAt(0))=="^"||c=="?";)a=
41
+ a.substr(1),c=="^"&&(d="inheritedData"),e=e||c=="?";c=b[d]("$"+a+"Controller");if(!c&&!e)throw Error("No controller: "+a);}else B(a)&&(c=[],n(a,function(a){c.push(h(a,b))}));return c}function j(a,d,e,i,g){var l,p,r,D,F;l=b===e?c:hc(c,new ia(u(e),c.$attr));p=l.$$element;if(K){var J=/^\s*([@=&])\s*(\w*)\s*$/,ja=d.$parent||d;n(K.scope,function(a,b){var c=a.match(J)||[],e=c[2]||b,c=c[1],i,g,h;d.$$isolateBindings[b]=c+e;switch(c){case "@":l.$observe(e,function(a){d[b]=a});l.$$observers[e].$$scope=ja;break;
42
+ case "=":g=t(l[e]);h=g.assign||function(){i=d[b]=g(ja);throw Error(Db+l[e]+" (directive: "+K.name+")");};i=d[b]=g(ja);d.$watch(function(){var a=g(ja);a!==d[b]&&(a!==i?i=d[b]=a:h(ja,a=i=d[b]));return a});break;case "&":g=t(l[e]);d[b]=function(a){return g(ja,a)};break;default:throw Error("Invalid isolate scope definition for directive "+K.name+": "+a);}})}x&&n(x,function(a){var b={$scope:d,$element:p,$attrs:l,$transclude:g};F=a.controller;F=="@"&&(F=l[a.name]);p.data("$"+a.name+"Controller",o(F,b))});
43
+ i=0;for(r=m.length;i<r;i++)try{D=m[i],D(d,p,l,D.require&&h(D.require,p))}catch(z){k(z,qa(p))}a&&a(d,e.childNodes,q,g);i=0;for(r=s.length;i<r;i++)try{D=s[i],D(d,p,l,D.require&&h(D.require,p))}catch(zc){k(zc,qa(p))}}for(var l=-Number.MAX_VALUE,m=[],s=[],p=null,K=null,z=null,D=c.$$element=u(b),r,G,S,ka,R=d,x,w,W,v=0,y=a.length;v<y;v++){r=a[v];S=q;if(l>r.priority)break;if(W=r.scope)ua("isolated scope",K,r,D),M(W)&&(F(D,"ng-isolate-scope"),K=r),F(D,"ng-scope"),p=p||r;G=r.name;if(W=r.controller)x=x||{},
44
+ ua("'"+G+"' controller",x[G],r,D),x[G]=r;if(W=r.transclude)ua("transclusion",ka,r,D),ka=r,l=r.priority,W=="element"?(S=u(b),D=c.$$element=u(Y.createComment(" "+G+": "+c[G]+" ")),b=D[0],C(e,u(S[0]),b),R=J(S,d,l)):(S=u(cb(b)).contents(),D.html(""),R=J(S,d));if(W=r.template)if(ua("template",z,r,D),z=r,W=Eb(W),r.replace){S=u("<div>"+O(W)+"</div>").contents();b=S[0];if(S.length!=1||b.nodeType!==1)throw Error(g+W);C(e,D,b);G={$attr:{}};a=a.concat(V(b,a.splice(v+1,a.length-(v+1)),G));$(c,G);y=a.length}else D.html(W);
45
+ if(r.templateUrl)ua("template",z,r,D),z=r,j=P(a.splice(v,a.length-v),j,D,c,e,r.replace,R),y=a.length;else if(r.compile)try{w=r.compile(D,c,R),H(w)?i(null,w):w&&i(w.pre,w.post)}catch(E){k(E,qa(D))}if(r.terminal)j.terminal=!0,l=Math.max(l,r.priority)}j.scope=p&&p.scope;j.transclude=ka&&R;return j}function r(d,e,i,g){var h=!1;if(a.hasOwnProperty(e))for(var l,e=b.get(e+c),o=0,m=e.length;o<m;o++)try{if(l=e[o],(g===q||g>l.priority)&&l.restrict.indexOf(i)!=-1)d.push(l),h=!0}catch(t){k(t)}return h}function $(a,
46
+ b){var c=b.$attr,d=a.$attr,e=a.$$element;n(a,function(d,e){e.charAt(0)!="$"&&(b[e]&&(d+=(e==="style"?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});n(b,function(b,i){i=="class"?(F(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):i=="style"?e.attr("style",e.attr("style")+";"+b):i.charAt(0)!="$"&&!a.hasOwnProperty(i)&&(a[i]=b,d[i]=c[i])})}function P(a,b,c,d,e,i,h){var j=[],k,o,t=c[0],s=a.shift(),p=v({},s,{controller:null,templateUrl:null,transclude:null,scope:null});c.html("");m.get(s.templateUrl,{cache:l}).success(function(l){var m,
47
+ s,l=Eb(l);if(i){s=u("<div>"+O(l)+"</div>").contents();m=s[0];if(s.length!=1||m.nodeType!==1)throw Error(g+l);l={$attr:{}};C(e,c,m);V(m,a,l);$(d,l)}else m=t,c.html(l);a.unshift(p);k=K(a,m,d,h);for(o=z(c.contents(),h);j.length;){var ia=j.pop(),l=j.pop();s=j.pop();var r=j.pop(),D=m;s!==t&&(D=cb(m),C(l,u(s),D));k(function(){b(o,r,D,e,ia)},r,D,e,ia)}j=null}).error(function(a,b,c,d){throw Error("Failed to load template: "+d.url);});return function(a,c,d,e,i){j?(j.push(c),j.push(d),j.push(e),j.push(i)):
48
+ k(function(){b(o,c,d,e,i)},c,d,e,i)}}function G(a,b){return b.priority-a.priority}function ua(a,b,c,d){if(b)throw Error("Multiple directives ["+b.name+", "+c.name+"] asking for "+a+" on: "+qa(d));}function x(a,b){var c=i(b,!0);c&&a.push({priority:0,compile:I(function(a,b){var d=b.parent(),e=d.data("$binding")||[];e.push(c);F(d.data("$binding",e),"ng-binding");a.$watch(c,function(a){b[0].nodeValue=a})})})}function R(a,b,c,d){var e=i(c,!0);e&&b.push({priority:100,compile:I(function(a,b,c){b=c.$$observers||
49
+ (c.$$observers={});d==="class"&&(e=i(c[d],!0));c[d]=q;(b[d]||(b[d]=[])).$$inter=!0;(c.$$observers&&c.$$observers[d].$$scope||a).$watch(e,function(a){c.$set(d,a)})})})}function C(a,b,c){var d=b[0],e=d.parentNode,i,g;if(a){i=0;for(g=a.length;i<g;i++)if(a[i]==d){a[i]=c;break}}e&&e.replaceChild(c,d);c[u.expando]=d[u.expando];b[0]=c}var ia=function(a,b){this.$$element=a;this.$attr=b||{}};ia.prototype={$normalize:ea,$set:function(a,b,c,d){var e=zb(this.$$element[0],a),i=this.$$observers;e&&(this.$$element.prop(a,
50
+ b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=Za(a,"-"));if(fb(this.$$element[0])==="A"&&a==="href")D.setAttribute("href",b),e=D.href,e.match(h)||(this[a]=b="unsafe:"+e);c!==!1&&(b===null||b===q?this.$$element.removeAttr(d):this.$$element.attr(d,b));i&&n(i[a],function(a){try{a(b)}catch(c){k(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);p.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var D=s[0].createElement("a"),
51
+ S=i.startSymbol(),ka=i.endSymbol(),Eb=S=="{{"||ka=="}}"?na:function(a){return a.replace(/\{\{/g,S).replace(/}}/g,ka)};return J}]}function ea(b){return sb(b.replace(Ac,""))}function Bc(){var b={};this.register=function(a,c){M(a)?v(b,a):b[a]=c};this.$get=["$injector","$window",function(a,c){return function(d,e){if(A(d)){var g=d,d=b.hasOwnProperty(g)?b[g]:gb(e.$scope,g,!0)||gb(c,g,!0);ra(d,g,!0)}return a.instantiate(d,e)}}]}function Cc(){this.$get=["$window",function(b){return u(b.document)}]}function Dc(){this.$get=
52
+ ["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function Ec(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):b};this.endSymbol=function(b){return b?(a=b,this):a};this.$get=["$parse",function(c){function d(d,f){for(var j,i,k=0,m=[],l=d.length,t=!1,o=[];k<l;)(j=d.indexOf(b,k))!=-1&&(i=d.indexOf(a,j+e))!=-1?(k!=j&&m.push(d.substring(k,j)),m.push(k=c(t=d.substring(j+e,i))),k.exp=t,k=i+g,t=!0):(k!=l&&m.push(d.substring(k)),k=l);if(!(l=m.length))m.push(""),l=1;
53
+ if(!f||t)return o.length=l,k=function(a){for(var b=0,c=l,d;b<c;b++){if(typeof(d=m[b])=="function")d=d(a),d==null||d==q?d="":typeof d!="string"&&(d=da(d));o[b]=d}return o.join("")},k.exp=d,k.parts=m,k}var e=b.length,g=a.length;d.startSymbol=function(){return b};d.endSymbol=function(){return a};return d}]}function Fb(b){for(var b=b.split("/"),a=b.length;a--;)b[a]=Ya(b[a]);return b.join("/")}function wa(b,a){var c=Gb.exec(b),c={protocol:c[1],host:c[3],port:E(c[5])||Hb[c[1]]||null,path:c[6]||"/",search:c[8],
54
+ hash:c[10]};if(a)a.$$protocol=c.protocol,a.$$host=c.host,a.$$port=c.port;return c}function la(b,a,c){return b+"://"+a+(c==Hb[b]?"":":"+c)}function Fc(b,a,c){var d=wa(b);return decodeURIComponent(d.path)!=a||w(d.hash)||d.hash.indexOf(c)!==0?b:la(d.protocol,d.host,d.port)+a.substr(0,a.lastIndexOf("/"))+d.hash.substr(c.length)}function Gc(b,a,c){var d=wa(b);if(decodeURIComponent(d.path)==a)return b;else{var e=d.search&&"?"+d.search||"",g=d.hash&&"#"+d.hash||"",h=a.substr(0,a.lastIndexOf("/")),f=d.path.substr(h.length);
55
+ if(d.path.indexOf(h)!==0)throw Error('Invalid url "'+b+'", missing path prefix "'+h+'" !');return la(d.protocol,d.host,d.port)+a+"#"+c+f+e+g}}function hb(b,a,c){a=a||"";this.$$parse=function(b){var c=wa(b,this);if(c.path.indexOf(a)!==0)throw Error('Invalid url "'+b+'", missing path prefix "'+a+'" !');this.$$path=decodeURIComponent(c.path.substr(a.length));this.$$search=Wa(c.search);this.$$hash=c.hash&&decodeURIComponent(c.hash)||"";this.$$compose()};this.$$compose=function(){var b=pb(this.$$search),
56
+ c=this.$$hash?"#"+Ya(this.$$hash):"";this.$$url=Fb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=la(this.$$protocol,this.$$host,this.$$port)+a+this.$$url};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Ha(b,a,c){var d;this.$$parse=function(b){var c=wa(b,this);if(c.hash&&c.hash.indexOf(a)!==0)throw Error('Invalid url "'+b+'", missing hash prefix "'+a+'" !');d=c.path+(c.search?"?"+c.search:"");c=Hc.exec((c.hash||"").substr(a.length));this.$$path=c[1]?(c[1].charAt(0)==
57
+ "/"?"":"/")+decodeURIComponent(c[1]):"";this.$$search=Wa(c[3]);this.$$hash=c[5]&&decodeURIComponent(c[5])||"";this.$$compose()};this.$$compose=function(){var b=pb(this.$$search),c=this.$$hash?"#"+Ya(this.$$hash):"";this.$$url=Fb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=la(this.$$protocol,this.$$host,this.$$port)+d+(this.$$url?"#"+a+this.$$url:"")};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Ib(b,a,c,d){Ha.apply(this,arguments);this.$$rewriteAppUrl=function(b){if(b.indexOf(c)==
58
+ 0)return c+d+"#"+a+b.substr(c.length)}}function Ia(b){return function(){return this[b]}}function Jb(b,a){return function(c){if(w(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Ic(){var b="",a=!1;this.hashPrefix=function(a){return x(a)?(b=a,this):b};this.html5Mode=function(b){return x(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function h(a){c.$broadcast("$locationChangeSuccess",f.absUrl(),a)}var f,j,i,k=d.url(),m=wa(k);a?(j=
59
+ d.baseHref()||"/",i=j.substr(0,j.lastIndexOf("/")),m=la(m.protocol,m.host,m.port)+i+"/",f=e.history?new hb(Fc(k,j,b),i,m):new Ib(Gc(k,j,b),b,m,j.substr(i.length+1))):(m=la(m.protocol,m.host,m.port)+(m.path||"")+(m.search?"?"+m.search:"")+"#"+b+"/",f=new Ha(k,b,m));g.bind("click",function(a){if(!a.ctrlKey&&!(a.metaKey||a.which==2)){for(var b=u(a.target);y(b[0].nodeName)!=="a";)if(b[0]===g[0]||!(b=b.parent())[0])return;var d=b.prop("href"),e=f.$$rewriteAppUrl(d);d&&!b.attr("target")&&e&&(f.$$parse(e),
60
+ c.$apply(),a.preventDefault(),X.angular["ff-684208-preventDefault"]=!0)}});f.absUrl()!=k&&d.url(f.absUrl(),!0);d.onUrlChange(function(a){f.absUrl()!=a&&(c.$evalAsync(function(){var b=f.absUrl();f.$$parse(a);h(b)}),c.$$phase||c.$digest())});var l=0;c.$watch(function(){var a=d.url(),b=f.$$replace;if(!l||a!=f.absUrl())l++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),h(a))});f.$$replace=!1;return l});return f}]}function Jc(){this.$get=
61
+ ["$window",function(b){function a(a){a instanceof Error&&(a.stack?a=a.message&&a.stack.indexOf(a.message)===-1?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function c(c){var e=b.console||{},g=e[c]||e.log||C;return g.apply?function(){var b=[];n(arguments,function(c){b.push(a(c))});return g.apply(e,b)}:function(a,b){g(a,b)}}return{log:c("log"),warn:c("warn"),info:c("info"),error:c("error")}}]}function Kc(b,a){function c(a){return a.indexOf(s)!=
62
+ -1}function d(){return o+1<b.length?b.charAt(o+1):!1}function e(a){return"0"<=a&&a<="9"}function g(a){return a==" "||a=="\r"||a=="\t"||a=="\n"||a=="\u000b"||a=="\u00a0"}function h(a){return"a"<=a&&a<="z"||"A"<=a&&a<="Z"||"_"==a||a=="$"}function f(a){return a=="-"||a=="+"||e(a)}function j(a,c,d){d=d||o;throw Error("Lexer Error: "+a+" at column"+(x(c)?"s "+c+"-"+o+" ["+b.substring(c,d)+"]":" "+d)+" in expression ["+b+"].");}function i(){for(var a="",c=o;o<b.length;){var i=y(b.charAt(o));if(i=="."||
63
+ e(i))a+=i;else{var g=d();if(i=="e"&&f(g))a+=i;else if(f(i)&&g&&e(g)&&a.charAt(a.length-1)=="e")a+=i;else if(f(i)&&(!g||!e(g))&&a.charAt(a.length-1)=="e")j("Invalid exponent");else break}o++}a*=1;l.push({index:c,text:a,json:!0,fn:function(){return a}})}function k(){for(var c="",d=o,f,i,j;o<b.length;){var k=b.charAt(o);if(k=="."||h(k)||e(k))k=="."&&(f=o),c+=k;else break;o++}if(f)for(i=o;i<b.length;){k=b.charAt(i);if(k=="("){j=c.substr(f-d+1);c=c.substr(0,f-d);o=i;break}if(g(k))i++;else break}d={index:d,
64
+ text:c};if(Ja.hasOwnProperty(c))d.fn=d.json=Ja[c];else{var m=Kb(c,a);d.fn=v(function(a,b){return m(a,b)},{assign:function(a,b){return Lb(a,c,b)}})}l.push(d);j&&(l.push({index:f,text:".",json:!1}),l.push({index:f+1,text:j,json:!1}))}function m(a){var c=o;o++;for(var d="",e=a,f=!1;o<b.length;){var i=b.charAt(o);e+=i;if(f)i=="u"?(i=b.substring(o+1,o+5),i.match(/[\da-f]{4}/i)||j("Invalid unicode escape [\\u"+i+"]"),o+=4,d+=String.fromCharCode(parseInt(i,16))):(f=Lc[i],d+=f?f:i),f=!1;else if(i=="\\")f=
65
+ !0;else if(i==a){o++;l.push({index:c,text:e,string:d,json:!0,fn:function(){return d}});return}else d+=i;o++}j("Unterminated quote",c)}for(var l=[],t,o=0,p=[],s,J=":";o<b.length;){s=b.charAt(o);if(c("\"'"))m(s);else if(e(s)||c(".")&&e(d()))i();else if(h(s)){if(k(),"{,".indexOf(J)!=-1&&p[0]=="{"&&(t=l[l.length-1]))t.json=t.text.indexOf(".")==-1}else if(c("(){}[].,;:"))l.push({index:o,text:s,json:":[,".indexOf(J)!=-1&&c("{[")||c("}]:,")}),c("{[")&&p.unshift(s),c("}]")&&p.shift(),o++;else if(g(s)){o++;
66
+ continue}else{var n=s+d(),z=Ja[s],V=Ja[n];V?(l.push({index:o,text:n,fn:V}),o+=2):z?(l.push({index:o,text:s,fn:z,json:"[,:".indexOf(J)!=-1&&c("+-")}),o+=1):j("Unexpected next character ",o,o+1)}J=s}return l}function Mc(b,a,c,d){function e(a,c){throw Error("Syntax Error: Token '"+c.text+"' "+a+" at column "+(c.index+1)+" of the expression ["+b+"] starting at ["+b.substring(c.index)+"].");}function g(){if(P.length===0)throw Error("Unexpected end of expression: "+b);return P[0]}function h(a,b,c,d){if(P.length>
67
+ 0){var e=P[0],f=e.text;if(f==a||f==b||f==c||f==d||!a&&!b&&!c&&!d)return e}return!1}function f(b,c,d,f){return(b=h(b,c,d,f))?(a&&!b.json&&e("is not valid json",b),P.shift(),b):!1}function j(a){f(a)||e("is unexpected, expecting ["+a+"]",h())}function i(a,b){return function(c,d){return a(c,d,b)}}function k(a,b,c){return function(d,e){return b(d,e,a,c)}}function m(){for(var a=[];;)if(P.length>0&&!h("}",")",";","]")&&a.push(w()),!f(";"))return a.length==1?a[0]:function(b,c){for(var d,e=0;e<a.length;e++){var f=
68
+ a[e];f&&(d=f(b,c))}return d}}function l(){for(var a=f(),b=c(a.text),d=[];;)if(a=f(":"))d.push(G());else{var e=function(a,c,e){for(var e=[e],f=0;f<d.length;f++)e.push(d[f](a,c));return b.apply(a,e)};return function(){return e}}}function t(){for(var a=o(),b;;)if(b=f("||"))a=k(a,b.fn,o());else return a}function o(){var a=p(),b;if(b=f("&&"))a=k(a,b.fn,o());return a}function p(){var a=s(),b;if(b=f("==","!="))a=k(a,b.fn,p());return a}function s(){var a;a=J();for(var b;b=f("+","-");)a=k(a,b.fn,J());if(b=
69
+ f("<",">","<=",">="))a=k(a,b.fn,s());return a}function J(){for(var a=n(),b;b=f("*","/","%");)a=k(a,b.fn,n());return a}function n(){var a;return f("+")?z():(a=f("-"))?k(r,a.fn,n()):(a=f("!"))?i(a.fn,n()):z()}function z(){var a;if(f("("))a=w(),j(")");else if(f("["))a=V();else if(f("{"))a=K();else{var b=f();(a=b.fn)||e("not a primary expression",b)}for(var c;b=f("(","[",".");)b.text==="("?(a=x(a,c),c=null):b.text==="["?(c=a,a=R(a)):b.text==="."?(c=a,a=u(a)):e("IMPOSSIBLE");return a}function V(){var a=
70
+ [];if(g().text!="]"){do a.push(G());while(f(","))}j("]");return function(b,c){for(var d=[],e=0;e<a.length;e++)d.push(a[e](b,c));return d}}function K(){var a=[];if(g().text!="}"){do{var b=f(),b=b.string||b.text;j(":");var c=G();a.push({key:b,value:c})}while(f(","))}j("}");return function(b,c){for(var d={},e=0;e<a.length;e++){var f=a[e],i=f.value(b,c);d[f.key]=i}return d}}var r=I(0),$,P=Kc(b,d),G=function(){var a=t(),c,d;return(d=f("="))?(a.assign||e("implies assignment but ["+b.substring(0,d.index)+
71
+ "] can not be assigned to",d),c=t(),function(b,d){return a.assign(b,c(b,d),d)}):a},x=function(a,b){var c=[];if(g().text!=")"){do c.push(G());while(f(","))}j(")");return function(d,e){for(var f=[],i=b?b(d,e):d,g=0;g<c.length;g++)f.push(c[g](d,e));g=a(d,e)||C;return g.apply?g.apply(i,f):g(f[0],f[1],f[2],f[3],f[4])}},u=function(a){var b=f().text,c=Kb(b,d);return v(function(b,d){return c(a(b,d),d)},{assign:function(c,d,e){return Lb(a(c,e),b,d)}})},R=function(a){var b=G();j("]");return v(function(c,d){var e=
72
+ a(c,d),f=b(c,d),i;if(!e)return q;if((e=e[f])&&e.then){i=e;if(!("$$v"in e))i.$$v=q,i.then(function(a){i.$$v=a});e=e.$$v}return e},{assign:function(c,d,e){return a(c,e)[b(c,e)]=d}})},w=function(){for(var a=G(),b;;)if(b=f("|"))a=k(a,b.fn,l());else return a};a?(G=t,x=u=R=w=function(){e("is not valid json",{text:b,index:0})},$=z()):$=m();P.length!==0&&e("is an unexpected token",P[0]);return $}function Lb(b,a,c){for(var a=a.split("."),d=0;a.length>1;d++){var e=a.shift(),g=b[e];g||(g={},b[e]=g);b=g}return b[a.shift()]=
73
+ c}function gb(b,a,c){if(!a)return b;for(var a=a.split("."),d,e=b,g=a.length,h=0;h<g;h++)d=a[h],b&&(b=(e=b)[d]);return!c&&H(b)?Ua(e,b):b}function Mb(b,a,c,d,e){return function(g,h){var f=h&&h.hasOwnProperty(b)?h:g,j;if(f===null||f===q)return f;if((f=f[b])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!a||f===null||f===q)return f;if((f=f[a])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!c||f===null||f===q)return f;if((f=f[c])&&f.then){if(!("$$v"in
74
+ f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!d||f===null||f===q)return f;if((f=f[d])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!e||f===null||f===q)return f;if((f=f[e])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}return f}}function Kb(b,a){if(ib.hasOwnProperty(b))return ib[b];var c=b.split("."),d=c.length,e;if(a)e=d<6?Mb(c[0],c[1],c[2],c[3],c[4]):function(a,b){var e=0,i;do i=Mb(c[e++],c[e++],c[e++],c[e++],c[e++])(a,b),b=q,
75
+ a=i;while(e<d);return i};else{var g="var l, fn, p;\n";n(c,function(a,b){g+="if(s === null || s === undefined) return s;\nl=s;\ns="+(b?"s":'((k&&k.hasOwnProperty("'+a+'"))?k:s)')+'["'+a+'"];\nif (s && s.then) {\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n'});g+="return s;";e=Function("s","k",g);e.toString=function(){return g}}return ib[b]=e}function Nc(){var b={};this.$get=["$filter","$sniffer",function(a,c){return function(d){switch(typeof d){case "string":return b.hasOwnProperty(d)?
76
+ b[d]:b[d]=Mc(d,!1,a,c.csp);case "function":return d;default:return C}}}]}function Oc(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return Pc(function(a){b.$evalAsync(a)},a)}]}function Pc(b,a){function c(a){return a}function d(a){return h(a)}var e=function(){var f=[],j,i;return i={resolve:function(a){if(f){var c=f;f=q;j=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],j.then(a[0],a[1])})}},reject:function(a){i.resolve(h(a))},promise:{then:function(b,i){var g=e(),h=
77
+ function(d){try{g.resolve((b||c)(d))}catch(e){a(e),g.reject(e)}},o=function(b){try{g.resolve((i||d)(b))}catch(c){a(c),g.reject(c)}};f?f.push([h,o]):j.then(h,o);return g.promise}}}},g=function(a){return a&&a.then?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},h=function(a){return{then:function(c,i){var g=e();b(function(){g.resolve((i||d)(a))});return g.promise}}};return{defer:e,reject:h,when:function(f,j,i){var k=e(),m,l=function(b){try{return(j||c)(b)}catch(d){return a(d),
78
+ h(d)}},t=function(b){try{return(i||d)(b)}catch(c){return a(c),h(c)}};b(function(){g(f).then(function(a){m||(m=!0,k.resolve(g(a).then(l,t)))},function(a){m||(m=!0,k.resolve(t(a)))})});return k.promise},all:function(a){var b=e(),c=a.length,d=[];c?n(a,function(a,e){g(a).then(function(a){e in d||(d[e]=a,--c||b.resolve(d))},function(a){e in d||b.reject(a)})}):b.resolve(d);return b.promise}}}function Qc(){var b={};this.when=function(a,c){b[a]=v({reloadOnSearch:!0},c);if(a){var d=a[a.length-1]=="/"?a.substr(0,
79
+ a.length-1):a+"/";b[d]={redirectTo:a}}return this};this.otherwise=function(a){this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache",function(a,c,d,e,g,h,f){function j(a,b){for(var b="^"+b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"$",c="",d=[],e={},f=/:(\w+)/g,i,g=0;(i=f.exec(b))!==null;)c+=b.slice(g,i.index),c+="([^\\/]*)",d.push(i[1]),g=f.lastIndex;c+=b.substr(g);var h=a.match(RegExp(c));h&&n(d,function(a,b){e[a]=h[b+1]});return h?
80
+ e:null}function i(){var b=k(),i=t.current;if(b&&i&&b.$route===i.$route&&ga(b.pathParams,i.pathParams)&&!b.reloadOnSearch&&!l)i.params=b.params,U(i.params,d),a.$broadcast("$routeUpdate",i);else if(b||i)l=!1,a.$broadcast("$routeChangeStart",b,i),(t.current=b)&&b.redirectTo&&(A(b.redirectTo)?c.path(m(b.redirectTo,b.params)).search(b.params).replace():c.url(b.redirectTo(b.pathParams,c.path(),c.search())).replace()),e.when(b).then(function(){if(b){var a=[],c=[],d;n(b.resolve||{},function(b,d){a.push(d);
81
+ c.push(A(b)?g.get(b):g.invoke(b))});if(!x(d=b.template))if(x(d=b.templateUrl))d=h.get(d,{cache:f}).then(function(a){return a.data});x(d)&&(a.push("$template"),c.push(d));return e.all(c).then(function(b){var c={};n(b,function(b,d){c[a[d]]=b});return c})}}).then(function(c){if(b==t.current){if(b)b.locals=c,U(b.params,d);a.$broadcast("$routeChangeSuccess",b,i)}},function(c){b==t.current&&a.$broadcast("$routeChangeError",b,i,c)})}function k(){var a,d;n(b,function(b,e){if(!d&&(a=j(c.path(),e)))d=za(b,
82
+ {params:v({},c.search(),a),pathParams:a}),d.$route=b});return d||b[null]&&za(b[null],{params:{},pathParams:{}})}function m(a,b){var c=[];n((a||"").split(":"),function(a,d){if(d==0)c.push(a);else{var e=a.match(/(\w+)(.*)/),f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var l=!1,t={routes:b,reload:function(){l=!0;a.$evalAsync(i)}};a.$on("$locationChangeSuccess",i);return t}]}function Rc(){this.$get=I({})}function Sc(){var b=10;this.digestTtl=function(a){arguments.length&&(b=a);
83
+ return b};this.$get=["$injector","$exceptionHandler","$parse",function(a,c,d){function e(){this.$id=ya();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;this.$$asyncQueue=[];this.$$listeners={};this.$$isolateBindings={}}function g(a){if(j.$$phase)throw Error(j.$$phase+" already in progress");j.$$phase=a}function h(a,b){var c=d(a);ra(c,b);return c}function f(){}e.prototype={$new:function(a){if(H(a))throw Error("API-CHANGE: Use $controller to instantiate controllers.");
84
+ a?(a=new e,a.$root=this.$root):(a=function(){},a.prototype=this,a=new a,a.$id=ya());a["this"]=a;a.$$listeners={};a.$parent=this;a.$$asyncQueue=[];a.$$watchers=a.$$nextSibling=a.$$childHead=a.$$childTail=null;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,c){var d=h(a,"watch"),e=this.$$watchers,g={fn:b,last:f,get:d,exp:a,eq:!!c};if(!H(b)){var j=h(b||C,"listener");g.fn=function(a,b,
85
+ c){j(c)}}if(!e)e=this.$$watchers=[];e.unshift(g);return function(){Ta(e,g)}},$digest:function(){var a,d,e,h,t,o,p,s=b,n,F=[],z,q;g("$digest");do{p=!1;n=this;do{for(t=n.$$asyncQueue;t.length;)try{n.$eval(t.shift())}catch(K){c(K)}if(h=n.$$watchers)for(o=h.length;o--;)try{if(a=h[o],(d=a.get(n))!==(e=a.last)&&!(a.eq?ga(d,e):typeof d=="number"&&typeof e=="number"&&isNaN(d)&&isNaN(e)))p=!0,a.last=a.eq?U(d):d,a.fn(d,e===f?d:e,n),s<5&&(z=4-s,F[z]||(F[z]=[]),q=H(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):
86
+ a.exp,q+="; newVal: "+da(d)+"; oldVal: "+da(e),F[z].push(q))}catch(r){c(r)}if(!(h=n.$$childHead||n!==this&&n.$$nextSibling))for(;n!==this&&!(h=n.$$nextSibling);)n=n.$parent}while(n=h);if(p&&!s--)throw j.$$phase=null,Error(b+" $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: "+da(F));}while(p||t.length);j.$$phase=null},$destroy:function(){if(!(j==this||this.$$destroyed)){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;if(a.$$childHead==this)a.$$childHead=
87
+ this.$$nextSibling;if(a.$$childTail==this)a.$$childTail=this.$$prevSibling;if(this.$$prevSibling)this.$$prevSibling.$$nextSibling=this.$$nextSibling;if(this.$$nextSibling)this.$$nextSibling.$$prevSibling=this.$$prevSibling;this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null}},$eval:function(a,b){return d(a)(this,b)},$evalAsync:function(a){this.$$asyncQueue.push(a)},$apply:function(a){try{return g("$apply"),this.$eval(a)}catch(b){c(b)}finally{j.$$phase=null;try{j.$digest()}catch(d){throw c(d),
88
+ d;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);return function(){c[Aa(c,b)]=null}},$emit:function(a,b){var d=[],e,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},j=[h].concat(ha.call(arguments,1)),n,q;do{e=f.$$listeners[a]||d;h.currentScope=f;n=0;for(q=e.length;n<q;n++)if(e[n])try{if(e[n].apply(null,j),g)return h}catch(z){c(z)}else e.splice(n,1),n--,q--;f=f.$parent}while(f);
89
+ return h},$broadcast:function(a,b){var d=this,e=this,f={name:a,targetScope:this,preventDefault:function(){f.defaultPrevented=!0},defaultPrevented:!1},g=[f].concat(ha.call(arguments,1)),h,j;do{d=e;f.currentScope=d;e=d.$$listeners[a]||[];h=0;for(j=e.length;h<j;h++)if(e[h])try{e[h].apply(null,g)}catch(n){c(n)}else e.splice(h,1),h--,j--;if(!(e=d.$$childHead||d!==this&&d.$$nextSibling))for(;d!==this&&!(e=d.$$nextSibling);)d=d.$parent}while(d=e);return f}};var j=new e;return j}]}function Tc(){this.$get=
90
+ ["$window",function(b){var a={},c=E((/android (\d+)/.exec(y(b.navigator.userAgent))||[])[1]);return{history:!(!b.history||!b.history.pushState||c<4),hashchange:"onhashchange"in b&&(!b.document.documentMode||b.document.documentMode>7),hasEvent:function(c){if(c=="input"&&Z==9)return!1;if(w(a[c])){var e=b.document.createElement("div");a[c]="on"+c in e}return a[c]},csp:!1}}]}function Uc(){this.$get=I(X)}function Nb(b){var a={},c,d,e;if(!b)return a;n(b.split("\n"),function(b){e=b.indexOf(":");c=y(O(b.substr(0,
91
+ e)));d=O(b.substr(e+1));c&&(a[c]?a[c]+=", "+d:a[c]=d)});return a}function Ob(b){var a=M(b)?b:q;return function(c){a||(a=Nb(b));return c?a[y(c)]||null:a}}function Pb(b,a,c){if(H(c))return c(b,a);n(c,function(c){b=c(b,a)});return b}function Vc(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d=this.defaults={transformResponse:[function(d){A(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=ob(d,!0)));return d}],transformRequest:[function(a){return M(a)&&xa.apply(a)!=="[object File]"?da(a):a}],
92
+ headers:{common:{Accept:"application/json, text/plain, */*","X-Requested-With":"XMLHttpRequest"},post:{"Content-Type":"application/json;charset=utf-8"},put:{"Content-Type":"application/json;charset=utf-8"}}},e=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,j,i,k){function m(a){function c(a){var b=v({},a,{data:Pb(a.data,a.headers,f)});return 200<=a.status&&a.status<300?b:i.reject(b)}a.method=ma(a.method);var e=a.transformRequest||
93
+ d.transformRequest,f=a.transformResponse||d.transformResponse,g=d.headers,g=v({"X-XSRF-TOKEN":b.cookies()["XSRF-TOKEN"]},g.common,g[y(a.method)],a.headers),e=Pb(a.data,Ob(g),e),j;w(a.data)&&delete g["Content-Type"];j=l(a,e,g);j=j.then(c,c);n(p,function(a){j=a(j)});j.success=function(b){j.then(function(c){b(c.data,c.status,c.headers,a)});return j};j.error=function(b){j.then(null,function(c){b(c.data,c.status,c.headers,a)});return j};return j}function l(b,c,d){function e(a,b,c){n&&(200<=a&&a<300?n.put(q,
94
+ [a,b,Nb(c)]):n.remove(q));f(b,a,c);j.$apply()}function f(a,c,d){c=Math.max(c,0);(200<=c&&c<300?k.resolve:k.reject)({data:a,status:c,headers:Ob(d),config:b})}function h(){var a=Aa(m.pendingRequests,b);a!==-1&&m.pendingRequests.splice(a,1)}var k=i.defer(),l=k.promise,n,p,q=t(b.url,b.params);m.pendingRequests.push(b);l.then(h,h);b.cache&&b.method=="GET"&&(n=M(b.cache)?b.cache:o);if(n)if(p=n.get(q))if(p.then)return p.then(h,h),p;else B(p)?f(p[1],p[0],U(p[2])):f(p,200,{});else n.put(q,l);p||a(b.method,
95
+ q,c,e,d,b.timeout,b.withCredentials);return l}function t(a,b){if(!b)return a;var c=[];fc(b,function(a,b){a==null||a==q||(M(a)&&(a=da(a)),c.push(encodeURIComponent(b)+"="+encodeURIComponent(a)))});return a+(a.indexOf("?")==-1?"?":"&")+c.join("&")}var o=c("$http"),p=[];n(e,function(a){p.push(A(a)?k.get(a):k.invoke(a))});m.pendingRequests=[];(function(a){n(arguments,function(a){m[a]=function(b,c){return m(v(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){n(arguments,function(a){m[a]=
96
+ function(b,c,d){return m(v(d||{},{method:a,url:b,data:c}))}})})("post","put");m.defaults=d;return m}]}function Wc(){this.$get=["$browser","$window","$document",function(b,a,c){return Xc(b,Yc,b.defer,a.angular.callbacks,c[0],a.location.protocol.replace(":",""))}]}function Xc(b,a,c,d,e,g){function h(a,b){var c=e.createElement("script"),d=function(){e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;Z?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=
97
+ d;e.body.appendChild(c)}return function(e,j,i,k,m,l,t){function o(a,c,d,e){c=(j.match(Gb)||["",g])[1]=="file"?d?200:404:c;a(c==1223?204:c,d,e);b.$$completeOutstandingRequest(C)}b.$$incOutstandingRequestCount();j=j||b.url();if(y(e)=="jsonp"){var p="_"+(d.counter++).toString(36);d[p]=function(a){d[p].data=a};h(j.replace("JSON_CALLBACK","angular.callbacks."+p),function(){d[p].data?o(k,200,d[p].data):o(k,-2);delete d[p]})}else{var s=new a;s.open(e,j,!0);n(m,function(a,b){a&&s.setRequestHeader(b,a)});
98
+ var q;s.onreadystatechange=function(){if(s.readyState==4){var a=s.getAllResponseHeaders(),b=["Cache-Control","Content-Language","Content-Type","Expires","Last-Modified","Pragma"];a||(a="",n(b,function(b){var c=s.getResponseHeader(b);c&&(a+=b+": "+c+"\n")}));o(k,q||s.status,s.responseText,a)}};if(t)s.withCredentials=!0;s.send(i||"");l>0&&c(function(){q=-1;s.abort()},l)}}}function Zc(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,
99
+ maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),SHORTMONTH:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),DAY:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),SHORTDAY:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),
100
+ AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return b===1?"one":"other"}}}}function $c(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,f,j){var i=c.defer(),k=i.promise,m=x(j)&&!j,f=a.defer(function(){try{i.resolve(e())}catch(a){i.reject(a),d(a)}m||b.$apply()},f),j=function(){delete g[k.$$timeoutId]};
101
+ k.$$timeoutId=f;g[f]=i;k.then(j,j);return k}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),a.defer.cancel(b.$$timeoutId)):!1};return e}]}function Qb(b){function a(a,e){return b.factory(a+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+c)}}];a("currency",Rb);a("date",Sb);a("filter",ad);a("json",bd);a("limitTo",cd);a("lowercase",dd);a("number",Tb);a("orderBy",Ub);a("uppercase",ed)}function ad(){return function(b,
102
+ a){if(!B(b))return b;var c=[];c.check=function(a){for(var b=0;b<c.length;b++)if(!c[b](a))return!1;return!0};var d=function(a,b){if(b.charAt(0)==="!")return!d(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return(""+a).toLowerCase().indexOf(b)>-1;case "object":for(var c in a)if(c.charAt(0)!=="$"&&d(a[c],b))return!0;return!1;case "array":for(c=0;c<a.length;c++)if(d(a[c],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a=
103
+ {$:a};case "object":for(var e in a)e=="$"?function(){var b=(""+a[e]).toLowerCase();b&&c.push(function(a){return d(a,b)})}():function(){var b=e,f=(""+a[e]).toLowerCase();f&&c.push(function(a){return d(gb(a,b),f)})}();break;case "function":c.push(a);break;default:return b}for(var g=[],h=0;h<b.length;h++){var f=b[h];c.check(f)&&g.push(f)}return g}}function Rb(b){var a=b.NUMBER_FORMATS;return function(b,d){if(w(d))d=a.CURRENCY_SYM;return Vb(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,
104
+ d)}}function Tb(b){var a=b.NUMBER_FORMATS;return function(b,d){return Vb(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Vb(b,a,c,d,e){if(isNaN(b)||!isFinite(b))return"";var g=b<0,b=Math.abs(b),h=b+"",f="",j=[],i=!1;if(h.indexOf("e")!==-1){var k=h.match(/([\d\.]+)e(-?)(\d+)/);k&&k[2]=="-"&&k[3]>e+1?h="0":(f=h,i=!0)}if(!i){h=(h.split(Wb)[1]||"").length;w(e)&&(e=Math.min(Math.max(a.minFrac,h),a.maxFrac));var h=Math.pow(10,e),b=Math.round(b*h)/h,b=(""+b).split(Wb),h=b[0],b=b[1]||"",i=0,k=a.lgSize,
105
+ m=a.gSize;if(h.length>=k+m)for(var i=h.length-k,l=0;l<i;l++)(i-l)%m===0&&l!==0&&(f+=c),f+=h.charAt(l);for(l=i;l<h.length;l++)(h.length-l)%k===0&&l!==0&&(f+=c),f+=h.charAt(l);for(;b.length<e;)b+="0";e&&e!=="0"&&(f+=d+b.substr(0,e))}j.push(g?a.negPre:a.posPre);j.push(f);j.push(g?a.negSuf:a.posSuf);return j.join("")}function jb(b,a,c){var d="";b<0&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function N(b,a,c,d){return function(e){e=e["get"+b]();if(c>0||e>-c)e+=
106
+ c;e===0&&c==-12&&(e=12);return jb(e,a,d)}}function Ka(b,a){return function(c,d){var e=c["get"+b](),g=ma(a?"SHORT"+b:b);return d[g][e]}}function Sb(b){function a(a){var b;if(b=a.match(c)){var a=new Date(0),g=0,h=0;b[9]&&(g=E(b[9]+b[10]),h=E(b[9]+b[11]));a.setUTCFullYear(E(b[1]),E(b[2])-1,E(b[3]));a.setUTCHours(E(b[4]||0)-g,E(b[5]||0)-h,E(b[6]||0),E(b[7]||0))}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var g=
107
+ "",h=[],f,j,e=e||"mediumDate",e=b.DATETIME_FORMATS[e]||e;A(c)&&(c=fd.test(c)?E(c):a(c));Ra(c)&&(c=new Date(c));if(!oa(c))return c;for(;e;)(j=gd.exec(e))?(h=h.concat(ha.call(j,1)),e=h.pop()):(h.push(e),e=null);n(h,function(a){f=hd[a];g+=f?f(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function bd(){return function(b){return da(b,!0)}}function cd(){return function(b,a){if(!(b instanceof Array))return b;var a=E(a),c=[],d,e;if(!b||!(b instanceof Array))return c;a>b.length?
108
+ a=b.length:a<-b.length&&(a=-b.length);a>0?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Ub(b){return function(a,c,d){function e(a,b){return Va(b)?function(b,c){return a(c,b)}:a}if(!B(a))return a;if(!c)return a;for(var c=B(c)?c:[c],c=Sa(c,function(a){var c=!1,d=a||na;if(A(a)){if(a.charAt(0)=="+"||a.charAt(0)=="-")c=a.charAt(0)=="-",a=a.substring(1);d=b(a)}return e(function(a,b){var c;c=d(a);var e=d(b),f=typeof c,g=typeof e;f==g?(f=="string"&&(c=c.toLowerCase()),f==
109
+ "string"&&(e=e.toLowerCase()),c=c===e?0:c<e?-1:1):c=f<g?-1:1;return c},c)}),g=[],h=0;h<a.length;h++)g.push(a[h]);return g.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(e!==0)return e}return 0},d))}}function Q(b){H(b)&&(b={link:b});b.restrict=b.restrict||"AC";return I(b)}function Xb(b,a){function c(a,c){c=c?"-"+Za(c,"-"):"";b.removeClass((a?La:Ma)+c).addClass((a?Ma:La)+c)}var d=this,e=b.parent().controller("form")||Na,g=0,h=d.$error={};d.$name=a.name;d.$dirty=!1;d.$pristine=!0;
110
+ d.$valid=!0;d.$invalid=!1;e.$addControl(d);b.addClass(Oa);c(!0);d.$addControl=function(a){a.$name&&!d.hasOwnProperty(a.$name)&&(d[a.$name]=a)};d.$removeControl=function(a){a.$name&&d[a.$name]===a&&delete d[a.$name];n(h,function(b,c){d.$setValidity(c,!0,a)})};d.$setValidity=function(a,b,i){var k=h[a];if(b){if(k&&(Ta(k,i),!k.length)){g--;if(!g)c(b),d.$valid=!0,d.$invalid=!1;h[a]=!1;c(!0,a);e.$setValidity(a,!0,d)}}else{g||c(b);if(k){if(Aa(k,i)!=-1)return}else h[a]=k=[],g++,c(!1,a),e.$setValidity(a,!1,
111
+ d);k.push(i);d.$valid=!1;d.$invalid=!0}};d.$setDirty=function(){b.removeClass(Oa).addClass(Yb);d.$dirty=!0;d.$pristine=!1;e.$setDirty()}}function T(b){return w(b)||b===""||b===null||b!==b}function Pa(b,a,c,d,e,g){var h=function(){var c=O(a.val());d.$viewValue!==c&&b.$apply(function(){d.$setViewValue(c)})};if(e.hasEvent("input"))a.bind("input",h);else{var f;a.bind("keydown",function(a){a=a.keyCode;a===91||15<a&&a<19||37<=a&&a<=40||f||(f=g.defer(function(){h();f=null}))});a.bind("change",h)}d.$render=
112
+ function(){a.val(T(d.$viewValue)?"":d.$viewValue)};var j=c.ngPattern,i=function(a,b){return T(b)||a.test(b)?(d.$setValidity("pattern",!0),b):(d.$setValidity("pattern",!1),q)};j&&(j.match(/^\/(.*)\/$/)?(j=RegExp(j.substr(1,j.length-2)),e=function(a){return i(j,a)}):e=function(a){var c=b.$eval(j);if(!c||!c.test)throw Error("Expected "+j+" to be a RegExp but was "+c);return i(c,a)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var k=E(c.ngMinlength),e=function(a){return!T(a)&&a.length<
113
+ k?(d.$setValidity("minlength",!1),q):(d.$setValidity("minlength",!0),a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var m=E(c.ngMaxlength),c=function(a){return!T(a)&&a.length>m?(d.$setValidity("maxlength",!1),q):(d.$setValidity("maxlength",!0),a)};d.$parsers.push(c);d.$formatters.push(c)}}function kb(b,a){b="ngClass"+b;return Q(function(c,d,e){function g(b){if(a===!0||c.$index%2===a)j&&b!==j&&h(j),f(b);j=b}function h(a){M(a)&&!B(a)&&(a=Sa(a,function(a,b){if(a)return b}));d.removeClass(B(a)?
114
+ a.join(" "):a)}function f(a){M(a)&&!B(a)&&(a=Sa(a,function(a,b){if(a)return b}));a&&d.addClass(B(a)?a.join(" "):a)}var j=q;c.$watch(e[b],g,!0);e.$observe("class",function(){var a=c.$eval(e[b]);g(a,a)});b!=="ngClass"&&c.$watch("$index",function(d,g){var j=d%2;j!==g%2&&(j==a?f(c.$eval(e[b])):h(c.$eval(e[b])))})})}var y=function(b){return A(b)?b.toLowerCase():b},ma=function(b){return A(b)?b.toUpperCase():b},Z=E((/msie (\d+)/.exec(y(navigator.userAgent))||[])[1]),u,ca,ha=[].slice,Qa=[].push,xa=Object.prototype.toString,
115
+ Zb=X.angular||(X.angular={}),ta,fb,aa=["0","0","0"];C.$inject=[];na.$inject=[];fb=Z<9?function(b){b=b.nodeName?b:b[0];return b.scopeName&&b.scopeName!="HTML"?ma(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var kc=/[A-Z]/g,id={full:"1.0.5",major:1,minor:0,dot:5,codeName:"flatulent-propulsion"},Ca=L.cache={},Ba=L.expando="ng-"+(new Date).getTime(),oc=1,$b=X.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+
116
+ a,c)},db=X.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)},mc=/([\:\-\_]+(.))/g,nc=/^moz([A-Z])/,va=L.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;this.bind("DOMContentLoaded",a);L(X).bind("load",a)},toString:function(){var b=[];n(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return b>=0?u(this[b]):u(this[this.length+b])},length:0,push:Qa,sort:[].sort,splice:[].splice},Fa={};n("multiple,selected,checked,disabled,readOnly,required".split(","),
117
+ function(b){Fa[y(b)]=b});var Ab={};n("input,select,option,textarea,button,form".split(","),function(b){Ab[ma(b)]=!0});n({data:vb,inheritedData:Ea,scope:function(b){return Ea(b,"$scope")},controller:yb,injector:function(b){return Ea(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Da,css:function(b,a,c){a=sb(a);if(x(c))b.style[a]=c;else{var d;Z<=8&&(d=b.currentStyle&&b.currentStyle[a],d===""&&(d="auto"));d=d||b.style[a];Z<=8&&(d=d===""?q:d);return d}},attr:function(b,a,c){var d=
118
+ y(a);if(Fa[d])if(x(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||C).specified?d:q;else if(x(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),b===null?q:b},prop:function(b,a,c){if(x(c))b[a]=c;else return b[a]},text:v(Z<9?function(b,a){if(b.nodeType==1){if(w(a))return b.innerText;b.innerText=a}else{if(w(a))return b.nodeValue;b.nodeValue=a}}:function(b,a){if(w(a))return b.textContent;b.textContent=a},{$dv:""}),
119
+ val:function(b,a){if(w(a))return b.value;b.value=a},html:function(b,a){if(w(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)sa(d[c]);b.innerHTML=a}},function(b,a){L.prototype[a]=function(a,d){var e,g;if((b.length==2&&b!==Da&&b!==yb?a:d)===q)if(M(a)){for(e=0;e<this.length;e++)if(b===vb)b(this[e],a);else for(g in a)b(this[e],g,a[g]);return this}else{if(this.length)return b(this[0],a,d)}else{for(e=0;e<this.length;e++)b(this[e],a,d);return this}return b.$dv}});n({removeData:tb,dealoc:sa,
120
+ bind:function a(c,d,e){var g=ba(c,"events"),h=ba(c,"handle");g||ba(c,"events",g={});h||ba(c,"handle",h=pc(c,g));n(d.split(" "),function(d){var j=g[d];if(!j){if(d=="mouseenter"||d=="mouseleave"){var i=0;g.mouseenter=[];g.mouseleave=[];a(c,"mouseover",function(a){i++;i==1&&h(a,"mouseenter")});a(c,"mouseout",function(a){i--;i==0&&h(a,"mouseleave")})}else $b(c,d,h),g[d]=[];j=g[d]}j.push(e)})},unbind:ub,replaceWith:function(a,c){var d,e=a.parentNode;sa(a);n(new L(c),function(c){d?e.insertBefore(c,d.nextSibling):
121
+ e.replaceChild(c,a);d=c})},children:function(a){var c=[];n(a.childNodes,function(a){a.nodeType===1&&c.push(a)});return c},contents:function(a){return a.childNodes||[]},append:function(a,c){n(new L(c),function(c){a.nodeType===1&&a.appendChild(c)})},prepend:function(a,c){if(a.nodeType===1){var d=a.firstChild;n(new L(c),function(c){d?a.insertBefore(c,d):(a.appendChild(c),d=c)})}},wrap:function(a,c){var c=u(c)[0],d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){sa(a);var c=a.parentNode;
122
+ c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;n(new L(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:xb,removeClass:wb,toggleClass:function(a,c,d){w(d)&&(d=!Da(a,c));(d?xb:wb)(a,c)},parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;for(a=a.nextSibling;a!=null&&a.nodeType!==1;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName(c)},clone:cb,triggerHandler:function(a,
123
+ c){var d=(ba(a,"events")||{})[c];n(d,function(c){c.call(a,null)})}},function(a,c){L.prototype[c]=function(c,e){for(var g,h=0;h<this.length;h++)g==q?(g=a(this[h],c,e),g!==q&&(g=u(g))):bb(g,a(this[h],c,e));return g==q?this:g}});Ga.prototype={put:function(a,c){this[fa(a)]=c},get:function(a){return this[fa(a)]},remove:function(a){var c=this[a=fa(a)];delete this[a];return c}};eb.prototype={push:function(a,c){var d=this[a=fa(a)];d?d.push(c):this[a]=[c]},shift:function(a){var c=this[a=fa(a)];if(c)return c.length==
124
+ 1?(delete this[a],c[0]):c.shift()},peek:function(a){if(a=this[fa(a)])return a[0]}};var rc=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,sc=/,/,tc=/^\s*(_?)(\S+?)\1\s*$/,qc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Db="Non-assignable model expression: ";Cb.$inject=["$provide"];var Ac=/^(x[\:\-_]|data[\:\-_])/i,Gb=/^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,ac=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,Hc=ac,Hb={http:80,https:443,ftp:21};hb.prototype={$$replace:!1,absUrl:Ia("$$absUrl"),
125
+ url:function(a,c){if(w(a))return this.$$url;var d=ac.exec(a);d[1]&&this.path(decodeURIComponent(d[1]));if(d[2]||d[1])this.search(d[3]||"");this.hash(d[5]||"",c);return this},protocol:Ia("$$protocol"),host:Ia("$$host"),port:Ia("$$port"),path:Jb("$$path",function(a){return a.charAt(0)=="/"?a:"/"+a}),search:function(a,c){if(w(a))return this.$$search;x(c)?c===null?delete this.$$search[a]:this.$$search[a]=c:this.$$search=A(a)?Wa(a):a;this.$$compose();return this},hash:Jb("$$hash",na),replace:function(){this.$$replace=
126
+ !0;return this}};Ha.prototype=za(hb.prototype);Ib.prototype=za(Ha.prototype);var Ja={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:C,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return x(d)?x(e)?d+e:d:x(e)?e:q},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(x(d)?d:0)-(x(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},
127
+ "=":C,"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Lc=
128
+ {n:"\n",f:"\u000c",r:"\r",t:"\t",v:"\u000b","'":"'",'"':'"'},ib={},Yc=X.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw Error("This browser does not support XMLHttpRequest.");};Qb.$inject=["$provide"];Rb.$inject=["$locale"];Tb.$inject=["$locale"];var Wb=".",hd={yyyy:N("FullYear",4),yy:N("FullYear",2,0,!0),y:N("FullYear",1),MMMM:Ka("Month"),
129
+ MMM:Ka("Month",!0),MM:N("Month",2,1),M:N("Month",1,1),dd:N("Date",2),d:N("Date",1),HH:N("Hours",2),H:N("Hours",1),hh:N("Hours",2,-12),h:N("Hours",1,-12),mm:N("Minutes",2),m:N("Minutes",1),ss:N("Seconds",2),s:N("Seconds",1),EEEE:Ka("Day"),EEE:Ka("Day",!0),a:function(a,c){return a.getHours()<12?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){var a=-1*a.getTimezoneOffset(),c=a>=0?"+":"";c+=jb(a/60,2)+jb(Math.abs(a%60),2);return c}},gd=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,
130
+ fd=/^\d+$/;Sb.$inject=["$locale"];var dd=I(y),ed=I(ma);Ub.$inject=["$parse"];var jd=I({restrict:"E",compile:function(a,c){Z<=8&&(!c.href&&!c.name&&c.$set("href",""),a.append(Y.createComment("IE fix")));return function(a,c){c.bind("click",function(a){c.attr("href")||a.preventDefault()})}}}),lb={};n(Fa,function(a,c){var d=ea("ng-"+c);lb[d]=function(){return{priority:100,compile:function(){return function(a,g,h){a.$watch(h[d],function(a){h.$set(c,!!a)})}}}}});n(["src","href"],function(a){var c=ea("ng-"+
131
+ a);lb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(a,c),Z&&e.prop(a,g[a]))})}}}});var Na={$addControl:C,$removeControl:C,$setValidity:C,$setDirty:C};Xb.$inject=["$element","$attrs","$scope"];var Qa=function(a){return["$timeout",function(c){var d={name:"form",restrict:"E",controller:Xb,compile:function(){return{pre:function(a,d,h,f){if(!h.action){var j=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};$b(d[0],"submit",j);d.bind("$destroy",
132
+ function(){c(function(){db(d[0],"submit",j)},0,!1)})}var i=d.parent().controller("form"),k=h.name||h.ngForm;k&&(a[k]=f);i&&d.bind("$destroy",function(){i.$removeControl(f);k&&(a[k]=q);v(f,Na)})}}}};return a?v(U(d),{restrict:"EAC"}):d}]},kd=Qa(),ld=Qa(!0),md=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,nd=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/,od=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,bc={text:Pa,number:function(a,c,d,e,g,h){Pa(a,c,d,e,g,h);e.$parsers.push(function(a){var c=
133
+ T(a);return c||od.test(a)?(e.$setValidity("number",!0),a===""?null:c?a:parseFloat(a)):(e.$setValidity("number",!1),q)});e.$formatters.push(function(a){return T(a)?"":""+a});if(d.min){var f=parseFloat(d.min),a=function(a){return!T(a)&&a<f?(e.$setValidity("min",!1),q):(e.$setValidity("min",!0),a)};e.$parsers.push(a);e.$formatters.push(a)}if(d.max){var j=parseFloat(d.max),d=function(a){return!T(a)&&a>j?(e.$setValidity("max",!1),q):(e.$setValidity("max",!0),a)};e.$parsers.push(d);e.$formatters.push(d)}e.$formatters.push(function(a){return T(a)||
134
+ Ra(a)?(e.$setValidity("number",!0),a):(e.$setValidity("number",!1),q)})},url:function(a,c,d,e,g,h){Pa(a,c,d,e,g,h);a=function(a){return T(a)||md.test(a)?(e.$setValidity("url",!0),a):(e.$setValidity("url",!1),q)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,h){Pa(a,c,d,e,g,h);a=function(a){return T(a)||nd.test(a)?(e.$setValidity("email",!0),a):(e.$setValidity("email",!1),q)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){w(d.name)&&c.attr("name",ya());c.bind("click",
135
+ function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var g=d.ngTrueValue,h=d.ngFalseValue;A(g)||(g=!0);A(h)||(h=!1);c.bind("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$formatters.push(function(a){return a===g});e.$parsers.push(function(a){return a?g:h})},hidden:C,button:C,submit:C,reset:C},
136
+ cc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,h){h&&(bc[y(g.type)]||bc.text)(d,e,g,h,c,a)}}}],Ma="ng-valid",La="ng-invalid",Oa="ng-pristine",Yb="ng-dirty",pd=["$scope","$exceptionHandler","$attrs","$element","$parse",function(a,c,d,e,g){function h(a,c){c=c?"-"+Za(c,"-"):"";e.removeClass((a?La:Ma)+c).addClass((a?Ma:La)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=
137
+ !0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var f=g(d.ngModel),j=f.assign;if(!j)throw Error(Db+d.ngModel+" ("+qa(e)+")");this.$render=C;var i=e.inheritedData("$formController")||Na,k=0,m=this.$error={};e.addClass(Oa);h(!0);this.$setValidity=function(a,c){if(m[a]!==!c){if(c){if(m[a]&&k--,!k)h(!0),this.$valid=!0,this.$invalid=!1}else h(!1),this.$invalid=!0,this.$valid=!1,k++;m[a]=!c;h(c,a);i.$setValidity(a,c,this)}};this.$setViewValue=function(d){this.$viewValue=d;if(this.$pristine)this.$dirty=
138
+ !0,this.$pristine=!1,e.removeClass(Oa).addClass(Yb),i.$setDirty();n(this.$parsers,function(a){d=a(d)});if(this.$modelValue!==d)this.$modelValue=d,j(a,d),n(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};var l=this;a.$watch(function(){var c=f(a);if(l.$modelValue!==c){var d=l.$formatters,e=d.length;for(l.$modelValue=c;e--;)c=d[e](c);if(l.$viewValue!==c)l.$viewValue=c,l.$render()}})}],qd=function(){return{require:["ngModel","^?form"],controller:pd,link:function(a,c,d,e){var g=e[0],h=
139
+ e[1]||Na;h.$addControl(g);c.bind("$destroy",function(){h.$removeControl(g)})}}},rd=I({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),dc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&(T(a)||a===!1))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);d.$observe("required",function(){g(e.$viewValue)})}}}},sd=function(){return{require:"ngModel",
140
+ link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){var c=[];a&&n(a.split(g),function(a){a&&c.push(O(a))});return c});e.$formatters.push(function(a){return B(a)?a.join(", "):q})}}},td=/^(true|false|\d+)$/,ud=function(){return{priority:100,compile:function(a,c){return td.test(c.ngValue)?function(a,c,g){g.$set("value",a.$eval(g.ngValue))}:function(a,c,g){a.$watch(g.ngValue,function(a){g.$set("value",a,!1)})}}}},vd=Q(function(a,c,d){c.addClass("ng-binding").data("$binding",
141
+ d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==q?"":a)})}),wd=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],xd=[function(){return function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBindHtmlUnsafe);a.$watch(d.ngBindHtmlUnsafe,function(a){c.html(a||"")})}}],yd=kb("",!0),zd=kb("Odd",0),Ad=kb("Even",1),Bd=Q({compile:function(a,c){c.$set("ngCloak",q);
142
+ a.removeClass("ng-cloak")}}),Cd=[function(){return{scope:!0,controller:"@"}}],Dd=["$sniffer",function(a){return{priority:1E3,compile:function(){a.csp=!0}}}],ec={};n("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave".split(" "),function(a){var c=ea("ng-"+a);ec[c]=["$parse",function(d){return function(e,g,h){var f=d(h[c]);g.bind(y(a),function(a){e.$apply(function(){f(e,{$event:a})})})}}]});var Ed=Q(function(a,c,d){c.bind("submit",function(){a.$apply(d.ngSubmit)})}),
143
+ Fd=["$http","$templateCache","$anchorScroll","$compile",function(a,c,d,e){return{restrict:"ECA",terminal:!0,compile:function(g,h){var f=h.ngInclude||h.src,j=h.onload||"",i=h.autoscroll;return function(g,h){var l=0,n,o=function(){n&&(n.$destroy(),n=null);h.html("")};g.$watch(f,function(f){var s=++l;f?a.get(f,{cache:c}).success(function(a){s===l&&(n&&n.$destroy(),n=g.$new(),h.html(a),e(h.contents())(n),x(i)&&(!i||g.$eval(i))&&d(),n.$emit("$includeContentLoaded"),g.$eval(j))}).error(function(){s===l&&
144
+ o()}):o()})}}}}],Gd=Q({compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),Hd=Q({terminal:!0,priority:1E3}),Id=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,h){var f=h.count,j=g.attr(h.$attr.when),i=h.offset||0,k=e.$eval(j),m={},l=c.startSymbol(),t=c.endSymbol();n(k,function(a,e){m[e]=c(a.replace(d,l+f+"-"+i+t))});e.$watch(function(){var c=parseFloat(e.$eval(f));return isNaN(c)?"":(k[c]||(c=a.pluralCat(c-i)),m[c](e,g,!0))},function(a){g.text(a)})}}}],
145
+ Jd=Q({transclude:"element",priority:1E3,terminal:!0,compile:function(a,c,d){return function(a,c,h){var f=h.ngRepeat,h=f.match(/^\s*(.+)\s+in\s+(.*)\s*$/),j,i,k;if(!h)throw Error("Expected ngRepeat in form of '_item_ in _collection_' but got '"+f+"'.");f=h[1];j=h[2];h=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!h)throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '"+f+"'.");i=h[3]||h[1];k=h[2];var m=new eb;a.$watch(function(a){var e,f,h=a.$eval(j),
146
+ n=c,q=new eb,x,z,u,w,r,v;if(B(h))r=h||[];else{r=[];for(u in h)h.hasOwnProperty(u)&&u.charAt(0)!="$"&&r.push(u);r.sort()}x=r.length;e=0;for(f=r.length;e<f;e++){u=h===r?e:r[e];w=h[u];if(v=m.shift(w)){z=v.scope;q.push(w,v);if(e!==v.index)v.index=e,n.after(v.element);n=v.element}else z=a.$new();z[i]=w;k&&(z[k]=u);z.$index=e;z.$first=e===0;z.$last=e===x-1;z.$middle=!(z.$first||z.$last);v||d(z,function(a){n.after(a);v={scope:z,element:n=a,index:e};q.push(w,v)})}for(u in m)if(m.hasOwnProperty(u))for(r=m[u];r.length;)w=
147
+ r.pop(),w.element.remove(),w.scope.$destroy();m=q})}}}),Kd=Q(function(a,c,d){a.$watch(d.ngShow,function(a){c.css("display",Va(a)?"":"none")})}),Ld=Q(function(a,c,d){a.$watch(d.ngHide,function(a){c.css("display",Va(a)?"none":"")})}),Md=Q(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&n(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Nd=I({restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(a,c,d,e){var g,h,f;a.$watch(d.ngSwitch||d.on,function(j){h&&
148
+ (f.$destroy(),h.remove(),h=f=null);if(g=e.cases["!"+j]||e.cases["?"])a.$eval(d.change),f=a.$new(),g(f,function(a){h=a;c.append(a)})})}}),Od=Q({transclude:"element",priority:500,require:"^ngSwitch",compile:function(a,c,d){return function(a,g,h,f){f.cases["!"+c.ngSwitchWhen]=d}}}),Pd=Q({transclude:"element",priority:500,require:"^ngSwitch",compile:function(a,c,d){return function(a,c,h,f){f.cases["?"]=d}}}),Qd=Q({controller:["$transclude","$element",function(a,c){a(function(a){c.append(a)})}]}),Rd=["$http",
149
+ "$templateCache","$route","$anchorScroll","$compile","$controller",function(a,c,d,e,g,h){return{restrict:"ECA",terminal:!0,link:function(a,c,i){function k(){var i=d.current&&d.current.locals,k=i&&i.$template;if(k){c.html(k);m&&(m.$destroy(),m=null);var k=g(c.contents()),n=d.current;m=n.scope=a.$new();if(n.controller)i.$scope=m,i=h(n.controller,i),c.children().data("$ngControllerController",i);k(m);m.$emit("$viewContentLoaded");m.$eval(l);e()}else c.html(""),m&&(m.$destroy(),m=null)}var m,l=i.onload||
150
+ "";a.$on("$routeChangeSuccess",k);k()}}}],Sd=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){d.type=="text/ng-template"&&a.put(d.id,c[0].text)}}}],Td=I({terminal:!0}),Ud=["$compile","$parse",function(a,c){var d=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,e={$setViewValue:C};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope",
151
+ "$attrs",function(a,c,d){var j=this,i={},k=e,m;j.databound=d.ngModel;j.init=function(a,c,d){k=a;m=d};j.addOption=function(c){i[c]=!0;k.$viewValue==c&&(a.val(c),m.parent()&&m.remove())};j.removeOption=function(a){this.hasOption(a)&&(delete i[a],k.$viewValue==a&&this.renderUnknownOption(a))};j.renderUnknownOption=function(c){c="? "+fa(c)+" ?";m.val(c);a.prepend(m);a.val(c);m.prop("selected",!0)};j.hasOption=function(a){return i.hasOwnProperty(a)};c.$on("$destroy",function(){j.renderUnknownOption=C})}],
152
+ link:function(e,h,f,j){function i(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(y.parent()&&y.remove(),c.val(a),a===""&&v.prop("selected",!0)):w(a)&&v?c.val(""):e.renderUnknownOption(a)};c.bind("change",function(){a.$apply(function(){y.parent()&&y.remove();d.$setViewValue(c.val())})})}function k(a,c,d){var e;d.$render=function(){var a=new Ga(d.$viewValue);n(c.find("option"),function(c){c.selected=x(a.get(c.value))})};a.$watch(function(){ga(e,d.$viewValue)||(e=U(d.$viewValue),d.$render())});
153
+ c.bind("change",function(){a.$apply(function(){var a=[];n(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function m(e,f,g){function h(){var a={"":[]},c=[""],d,i,p,u,v;p=g.$modelValue;u=t(e)||[];var w=l?mb(u):u,x,y,A;y={};v=!1;var B,E;if(o)v=new Ga(p);else if(p===null||s)a[""].push({selected:p===null,id:"",label:""}),v=!0;for(A=0;x=w.length,A<x;A++){y[k]=u[l?y[l]=w[A]:A];d=m(e,y)||"";if(!(i=a[d]))i=a[d]=[],c.push(d);o?d=v.remove(n(e,y))!=q:(d=p===n(e,y),v=v||d);B=
154
+ j(e,y);B=B===q?"":B;i.push({id:l?w[A]:A,label:B,selected:d})}!o&&!v&&a[""].unshift({id:"?",label:"",selected:!0});y=0;for(w=c.length;y<w;y++){d=c[y];i=a[d];if(r.length<=y)p={element:z.clone().attr("label",d),label:i.label},u=[p],r.push(u),f.append(p.element);else if(u=r[y],p=u[0],p.label!=d)p.element.attr("label",p.label=d);B=null;A=0;for(x=i.length;A<x;A++)if(d=i[A],v=u[A+1]){B=v.element;if(v.label!==d.label)B.text(v.label=d.label);if(v.id!==d.id)B.val(v.id=d.id);if(v.element.selected!==d.selected)B.prop("selected",
155
+ v.selected=d.selected)}else d.id===""&&s?E=s:(E=C.clone()).val(d.id).attr("selected",d.selected).text(d.label),u.push({element:E,label:d.label,id:d.id,selected:d.selected}),B?B.after(E):p.element.append(E),B=E;for(A++;u.length>A;)u.pop().element.remove()}for(;r.length>y;)r.pop()[0].element.remove()}var i;if(!(i=p.match(d)))throw Error("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+p+"'.");var j=c(i[2]||i[1]),k=i[4]||i[6],l=i[5],m=c(i[3]||""),
156
+ n=c(i[2]?i[1]:k),t=c(i[7]),r=[[{element:f,label:""}]];s&&(a(s)(e),s.removeClass("ng-scope"),s.remove());f.html("");f.bind("change",function(){e.$apply(function(){var a,c=t(e)||[],d={},h,i,j,m,p,s;if(o){i=[];m=0;for(s=r.length;m<s;m++){a=r[m];j=1;for(p=a.length;j<p;j++)if((h=a[j].element)[0].selected)h=h.val(),l&&(d[l]=h),d[k]=c[h],i.push(n(e,d))}}else h=f.val(),h=="?"?i=q:h==""?i=null:(d[k]=c[h],l&&(d[l]=h),i=n(e,d));g.$setViewValue(i)})});g.$render=h;e.$watch(h)}if(j[1]){for(var l=j[0],t=j[1],o=
157
+ f.multiple,p=f.ngOptions,s=!1,v,C=u(Y.createElement("option")),z=u(Y.createElement("optgroup")),y=C.clone(),j=0,A=h.children(),r=A.length;j<r;j++)if(A[j].value==""){v=s=A.eq(j);break}l.init(t,s,y);if(o&&(f.required||f.ngRequired)){var B=function(a){t.$setValidity("required",!f.required||a&&a.length);return a};t.$parsers.push(B);t.$formatters.unshift(B);f.$observe("required",function(){B(t.$viewValue)})}p?m(e,h,t):o?k(e,h,t):i(e,h,t,l)}}}}],Vd=["$interpolate",function(a){var c={addOption:C,removeOption:C};
158
+ return{restrict:"E",priority:100,compile:function(d,e){if(w(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var i=d.parent(),k=i.data("$selectController")||i.parent().data("$selectController");k&&k.databound?d.prop("selected",!1):k=c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&k.removeOption(c);k.addOption(a)}):k.addOption(e.value);d.bind("$destroy",function(){k.removeOption(e.value)})}}}}],Wd=I({restrict:"E",terminal:!0});(ca=X.jQuery)?(u=ca,v(ca.fn,{scope:va.scope,
159
+ controller:va.controller,injector:va.injector,inheritedData:va.inheritedData}),ab("remove",!0),ab("empty"),ab("html")):u=L;Zb.element=u;(function(a){v(a,{bootstrap:qb,copy:U,extend:v,equals:ga,element:u,forEach:n,injector:rb,noop:C,bind:Ua,toJson:da,fromJson:ob,identity:na,isUndefined:w,isDefined:x,isString:A,isFunction:H,isObject:M,isNumber:Ra,isElement:gc,isArray:B,version:id,isDate:oa,lowercase:y,uppercase:ma,callbacks:{counter:0}});ta=lc(X);try{ta("ngLocale")}catch(c){ta("ngLocale",[]).provider("$locale",
160
+ Zc)}ta("ng",["ngLocale"],["$provide",function(a){a.provider("$compile",Cb).directive({a:jd,input:cc,textarea:cc,form:kd,script:Sd,select:Ud,style:Wd,option:Vd,ngBind:vd,ngBindHtmlUnsafe:xd,ngBindTemplate:wd,ngClass:yd,ngClassEven:Ad,ngClassOdd:zd,ngCsp:Dd,ngCloak:Bd,ngController:Cd,ngForm:ld,ngHide:Ld,ngInclude:Fd,ngInit:Gd,ngNonBindable:Hd,ngPluralize:Id,ngRepeat:Jd,ngShow:Kd,ngSubmit:Ed,ngStyle:Md,ngSwitch:Nd,ngSwitchWhen:Od,ngSwitchDefault:Pd,ngOptions:Td,ngView:Rd,ngTransclude:Qd,ngModel:qd,ngList:sd,
161
+ ngChange:rd,required:dc,ngRequired:dc,ngValue:ud}).directive(lb).directive(ec);a.provider({$anchorScroll:uc,$browser:wc,$cacheFactory:xc,$controller:Bc,$document:Cc,$exceptionHandler:Dc,$filter:Qb,$interpolate:Ec,$http:Vc,$httpBackend:Wc,$location:Ic,$log:Jc,$parse:Nc,$route:Qc,$routeParams:Rc,$rootScope:Sc,$q:Oc,$sniffer:Tc,$templateCache:yc,$timeout:$c,$window:Uc})}])})(Zb);u(Y).ready(function(){jc(Y,qb)})})(window,document);angular.element(document).find("head").append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none;}ng\\:form{display:block;}</style>');
@@ -0,0 +1,1909 @@
1
+ /*!
2
+ * GMaps.js v0.3.1
3
+ * http://hpneo.github.com/gmaps/
4
+ *
5
+ * Copyright 2012, Gustavo Leon
6
+ * Released under the MIT License.
7
+ */
8
+
9
+ if(window.google && window.google.maps){
10
+
11
+ var GMaps = (function(global) {
12
+ "use strict";
13
+
14
+ var doc = document;
15
+ var getElementById = function(id, context) {
16
+ var ele
17
+ if('jQuery' in global && context){
18
+ ele = $("#"+id.replace('#', ''), context)[0]
19
+ } else {
20
+ ele = doc.getElementById(id.replace('#', ''));
21
+ };
22
+ return ele;
23
+ };
24
+
25
+ var GMaps = function(options) {
26
+ var self = this;
27
+
28
+ var events_that_hide_context_menu = ['bounds_changed', 'center_changed', 'click', 'dblclick', 'drag', 'dragend', 'dragstart', 'idle', 'maptypeid_changed', 'projection_changed', 'resize', 'tilesloaded', 'zoom_changed'];
29
+ var events_that_doesnt_hide_context_menu = ['mousemove', 'mouseout', 'mouseover'];
30
+
31
+ window.context_menu = {};
32
+
33
+ if (typeof(options.el) === 'string' || typeof(options.div) === 'string') {
34
+ this.el = getElementById(options.el || options.div, options.context);
35
+ } else {
36
+ this.el = options.el || options.div;
37
+ };
38
+
39
+ if (typeof(this.el) === 'undefined' || this.el === null) {
40
+ throw 'No element defined.';
41
+ }
42
+
43
+ this.el.style.width = options.width || this.el.scrollWidth || this.el.offsetWidth;
44
+ this.el.style.height = options.height || this.el.scrollHeight || this.el.offsetHeight;
45
+
46
+ this.controls = [];
47
+ this.overlays = [];
48
+ this.layers = []; // array with kml and ft layers, can be as many
49
+ this.singleLayers = {}; // object with the other layers, only one per layer
50
+ this.markers = [];
51
+ this.polylines = [];
52
+ this.routes = [];
53
+ this.polygons = [];
54
+ this.infoWindow = null;
55
+ this.overlay_el = null;
56
+ this.zoom = options.zoom || 15;
57
+ this.registered_events = {};
58
+
59
+ var markerClusterer = options.markerClusterer;
60
+
61
+ //'Hybrid', 'Roadmap', 'Satellite' or 'Terrain'
62
+ var mapType;
63
+
64
+ if (options.mapType) {
65
+ mapType = google.maps.MapTypeId[options.mapType.toUpperCase()];
66
+ }
67
+ else {
68
+ mapType = google.maps.MapTypeId.ROADMAP;
69
+ }
70
+
71
+ var map_center = new google.maps.LatLng(options.lat, options.lng);
72
+
73
+ delete options.el;
74
+ delete options.lat;
75
+ delete options.lng;
76
+ delete options.mapType;
77
+ delete options.width;
78
+ delete options.height;
79
+ delete options.markerClusterer;
80
+
81
+ var zoomControlOpt = options.zoomControlOpt || {
82
+ style: 'DEFAULT',
83
+ position: 'TOP_LEFT'
84
+ };
85
+
86
+ var zoomControl = options.zoomControl || true,
87
+ zoomControlStyle = zoomControlOpt.style || 'DEFAULT',
88
+ zoomControlPosition = zoomControlOpt.position || 'TOP_LEFT',
89
+ panControl = options.panControl || true,
90
+ mapTypeControl = options.mapTypeControl || true,
91
+ scaleControl = options.scaleControl || true,
92
+ streetViewControl = options.streetViewControl || true,
93
+ overviewMapControl = overviewMapControl || true;
94
+
95
+ var map_options = {};
96
+
97
+ var map_base_options = {
98
+ zoom: this.zoom,
99
+ center: map_center,
100
+ mapTypeId: mapType
101
+ };
102
+
103
+ var map_controls_options = {
104
+ panControl: panControl,
105
+ zoomControl: zoomControl,
106
+ zoomControlOptions: {
107
+ style: google.maps.ZoomControlStyle[zoomControlStyle], // DEFAULT LARGE SMALL
108
+ position: google.maps.ControlPosition[zoomControlPosition]
109
+ },
110
+ mapTypeControl: mapTypeControl,
111
+ scaleControl: scaleControl,
112
+ streetViewControl: streetViewControl,
113
+ overviewMapControl: overviewMapControl
114
+ }
115
+
116
+ if(options.disableDefaultUI != true)
117
+ map_base_options = extend_object(map_base_options, map_controls_options);
118
+
119
+ map_options = extend_object(map_base_options, options);
120
+
121
+ for(var i = 0; i < events_that_hide_context_menu.length; i++) {
122
+ delete map_options[events_that_hide_context_menu[i]];
123
+ }
124
+
125
+ for(var i = 0; i < events_that_doesnt_hide_context_menu.length; i++) {
126
+ delete map_options[events_that_doesnt_hide_context_menu[i]];
127
+ }
128
+
129
+ this.map = new google.maps.Map(this.el, map_options);
130
+
131
+ if(markerClusterer) {
132
+ this.markerClusterer = markerClusterer.apply(this, [this.map]);
133
+ }
134
+
135
+ // finds absolute position of an element
136
+ var findAbsolutePosition = function(obj) {
137
+ var curleft = 0;
138
+ var curtop = 0;
139
+ if (obj.offsetParent) {
140
+ do {
141
+ curleft += obj.offsetLeft;
142
+ curtop += obj.offsetTop;
143
+ } while (obj = obj.offsetParent);
144
+ }
145
+ return [curleft,curtop];
146
+ //returns an array
147
+ }
148
+
149
+
150
+ // Context menus
151
+ var buildContextMenuHTML = function(control, e) {
152
+ var html = '';
153
+ var options = window.context_menu[control];
154
+ for (var i in options){
155
+ if (options.hasOwnProperty(i)){
156
+ var option = options[i];
157
+ html += '<li><a id="' + control + '_' + i + '" href="#">' +
158
+ option.title + '</a></li>';
159
+ }
160
+ }
161
+
162
+ if(!getElementById('gmaps_context_menu')) return;
163
+
164
+ var context_menu_element = getElementById('gmaps_context_menu');
165
+ context_menu_element.innerHTML = html;
166
+
167
+ var context_menu_items = context_menu_element.getElementsByTagName('a');
168
+
169
+ var context_menu_items_count = context_menu_items.length;
170
+
171
+ for(var i = 0; i < context_menu_items_count; i++){
172
+ var context_menu_item = context_menu_items[i];
173
+
174
+ var assign_menu_item_action = function(ev){
175
+ ev.preventDefault();
176
+
177
+ options[this.id.replace(control + '_', '')].action.apply(self, [e]);
178
+ self.hideContextMenu();
179
+ };
180
+
181
+ google.maps.event.clearListeners(context_menu_item, 'click');
182
+ google.maps.event.addDomListenerOnce(context_menu_item, 'click', assign_menu_item_action, false);
183
+ }
184
+
185
+ var position = findAbsolutePosition.apply(this, [self.el]);
186
+ var left = position[0] + e.pixel.x - 15;
187
+ var top = position[1] + e.pixel.y- 15;
188
+
189
+ context_menu_element.style.left = left + "px";
190
+ context_menu_element.style.top = top + "px";
191
+
192
+ context_menu_element.style.display = 'block';
193
+ };
194
+
195
+ var buildContextMenu = function(control, e) {
196
+ if (control === 'marker') {
197
+ e.pixel = {};
198
+ var overlay = new google.maps.OverlayView();
199
+ overlay.setMap(self.map);
200
+ overlay.draw = function() {
201
+ var projection = overlay.getProjection();
202
+ var position = e.marker.getPosition();
203
+ e.pixel = projection.fromLatLngToContainerPixel(position);
204
+
205
+ buildContextMenuHTML(control, e);
206
+ };
207
+ }
208
+ else {
209
+ buildContextMenuHTML(control, e);
210
+ }
211
+ };
212
+
213
+ this.setContextMenu = function(options) {
214
+ window.context_menu[options.control] = {};
215
+
216
+ for (var i in options.options){
217
+ if (options.options.hasOwnProperty(i)){
218
+ var option = options.options[i];
219
+ window.context_menu[options.control][option.name] = {
220
+ title: option.title,
221
+ action: option.action
222
+ };
223
+ }
224
+ }
225
+
226
+ var ul = doc.createElement('ul');
227
+
228
+ ul.id = 'gmaps_context_menu';
229
+ ul.style.display = 'none';
230
+ ul.style.position = 'absolute';
231
+ ul.style.minWidth = '100px';
232
+ ul.style.background = 'white';
233
+ ul.style.listStyle = 'none';
234
+ ul.style.padding = '8px';
235
+ ul.style.boxShadow = '2px 2px 6px #ccc';
236
+
237
+ doc.body.appendChild(ul);
238
+
239
+ var context_menu_element = getElementById('gmaps_context_menu');
240
+
241
+ google.maps.event.addDomListener(context_menu_element, 'mouseout', function(ev) {
242
+ if(!ev.relatedTarget || !this.contains(ev.relatedTarget)){
243
+ window.setTimeout(function(){
244
+ context_menu_element.style.display = 'none';
245
+ }, 400);
246
+ }
247
+ }, false);
248
+ };
249
+
250
+ this.hideContextMenu = function() {
251
+ var context_menu_element = getElementById('gmaps_context_menu');
252
+ if(context_menu_element)
253
+ context_menu_element.style.display = 'none';
254
+ };
255
+
256
+ //Events
257
+
258
+ var setupListener = function(object, name) {
259
+ google.maps.event.addListener(object, name, function(e){
260
+ if(e == undefined) {
261
+ e = this;
262
+ }
263
+
264
+ options[name].apply(this, [e]);
265
+
266
+ self.hideContextMenu();
267
+ });
268
+ }
269
+
270
+ for (var ev = 0; ev < events_that_hide_context_menu.length; ev++) {
271
+ var name = events_that_hide_context_menu[ev];
272
+
273
+ if (name in options) {
274
+ setupListener(this.map, name);
275
+ }
276
+ }
277
+
278
+ for (var ev = 0; ev < events_that_doesnt_hide_context_menu.length; ev++) {
279
+ var name = events_that_doesnt_hide_context_menu[ev];
280
+
281
+ if (name in options) {
282
+ setupListener(this.map, name);
283
+ }
284
+ }
285
+
286
+ google.maps.event.addListener(this.map, 'rightclick', function(e) {
287
+ if (options.rightclick) {
288
+ options.rightclick.apply(this, [e]);
289
+ }
290
+
291
+ if(window.context_menu['map'] != undefined) {
292
+ buildContextMenu('map', e);
293
+ }
294
+ });
295
+
296
+ this.refresh = function() {
297
+ google.maps.event.trigger(this.map, 'resize');
298
+ };
299
+
300
+ this.fitZoom = function() {
301
+ var latLngs = [];
302
+ var markers_length = this.markers.length;
303
+
304
+ for(var i=0; i < markers_length; i++) {
305
+ latLngs.push(this.markers[i].getPosition());
306
+ }
307
+
308
+ this.fitLatLngBounds(latLngs);
309
+ };
310
+
311
+ this.fitLatLngBounds = function(latLngs) {
312
+ var total = latLngs.length;
313
+ var bounds = new google.maps.LatLngBounds();
314
+
315
+ for(var i=0; i < total; i++) {
316
+ bounds.extend(latLngs[i]);
317
+ }
318
+
319
+ this.map.fitBounds(bounds);
320
+ };
321
+
322
+ // Map methods
323
+ this.setCenter = function(lat, lng, callback) {
324
+ this.map.panTo(new google.maps.LatLng(lat, lng));
325
+ if (callback) {
326
+ callback();
327
+ }
328
+ };
329
+
330
+ this.getElement = function() {
331
+ return this.el;
332
+ };
333
+
334
+ this.zoomIn = function(value) {
335
+ value = value || 1;
336
+ this.zoom = this.map.getZoom() + value;
337
+ this.map.setZoom(this.zoom);
338
+ };
339
+
340
+ this.zoomOut = function(value) {
341
+ value = value || 1;
342
+ this.zoom = this.map.getZoom() - value;
343
+ this.map.setZoom(this.zoom);
344
+ };
345
+
346
+ var native_methods = [];
347
+
348
+ for(var method in this.map){
349
+ if(typeof(this.map[method]) == 'function' && !this[method]){
350
+ native_methods.push(method);
351
+ }
352
+ }
353
+
354
+ for(var i=0; i < native_methods.length; i++){
355
+ (function(gmaps, scope, method_name) {
356
+ gmaps[method_name] = function(){
357
+ return scope[method_name].apply(scope, arguments);
358
+ };
359
+ })(this, this.map, native_methods[i]);
360
+ }
361
+
362
+ this.createControl = function(options) {
363
+ var control = doc.createElement('div');
364
+
365
+ control.style.cursor = 'pointer';
366
+ control.style.fontFamily = 'Arial, sans-serif';
367
+ control.style.fontSize = '13px';
368
+ control.style.boxShadow = 'rgba(0, 0, 0, 0.398438) 0px 2px 4px';
369
+
370
+ for(var option in options.style)
371
+ control.style[option] = options.style[option];
372
+
373
+ if(options.id) {
374
+ control.id = options.id;
375
+ }
376
+
377
+ if(options.classes) {
378
+ control.className = options.classes;
379
+ }
380
+
381
+ if(options.content) {
382
+ control.innerHTML = options.content;
383
+ }
384
+
385
+ for (var ev in options.events) {
386
+ (function(object, name) {
387
+ google.maps.event.addDomListener(object, name, function(){
388
+ options.events[name].apply(this, [this]);
389
+ });
390
+ })(control, ev);
391
+ }
392
+
393
+ control.index = 1;
394
+
395
+ return control;
396
+ };
397
+
398
+ this.addControl = function(options) {
399
+ var position = google.maps.ControlPosition[options.position.toUpperCase()];
400
+
401
+ delete options.position;
402
+
403
+ var control = this.createControl(options);
404
+ this.controls.push(control);
405
+ this.map.controls[position].push(control);
406
+
407
+ return control;
408
+ };
409
+
410
+ // Markers
411
+ this.createMarker = function(options) {
412
+ if ((options.hasOwnProperty('lat') && options.hasOwnProperty('lng')) || options.position) {
413
+ var self = this;
414
+ var details = options.details;
415
+ var fences = options.fences;
416
+ var outside = options.outside;
417
+
418
+ var base_options = {
419
+ position: new google.maps.LatLng(options.lat, options.lng),
420
+ map: null
421
+ };
422
+
423
+ delete options.lat;
424
+ delete options.lng;
425
+ delete options.fences;
426
+ delete options.outside;
427
+
428
+ var marker_options = extend_object(base_options, options);
429
+
430
+ var marker = new google.maps.Marker(marker_options);
431
+
432
+ marker.fences = fences;
433
+
434
+ if (options.infoWindow) {
435
+ marker.infoWindow = new google.maps.InfoWindow(options.infoWindow);
436
+
437
+ var info_window_events = ['closeclick', 'content_changed', 'domready', 'position_changed', 'zindex_changed'];
438
+
439
+ for (var ev = 0; ev < info_window_events.length; ev++) {
440
+ (function(object, name) {
441
+ if (options.infoWindow[name]) {
442
+ google.maps.event.addListener(object, name, function(e){
443
+ options.infoWindow[name].apply(this, [e]);
444
+ });
445
+ }
446
+ })(marker.infoWindow, info_window_events[ev]);
447
+ }
448
+ }
449
+
450
+ var marker_events = ['animation_changed', 'clickable_changed', 'cursor_changed', 'draggable_changed', 'flat_changed', 'icon_changed', 'position_changed', 'shadow_changed', 'shape_changed', 'title_changed', 'visible_changed', 'zindex_changed'];
451
+
452
+ var marker_events_with_mouse = ['dblclick', 'drag', 'dragend', 'dragstart', 'mousedown', 'mouseout', 'mouseover', 'mouseup'];
453
+
454
+ for (var ev = 0; ev < marker_events.length; ev++) {
455
+ (function(object, name) {
456
+ if (options[name]) {
457
+ google.maps.event.addListener(object, name, function(){
458
+ options[name].apply(this, [this]);
459
+ });
460
+ }
461
+ })(marker, marker_events[ev]);
462
+ }
463
+
464
+ for (var ev = 0; ev < marker_events_with_mouse.length; ev++) {
465
+ (function(map, object, name) {
466
+ if (options[name]) {
467
+ google.maps.event.addListener(object, name, function(me){
468
+ if(!me.pixel){
469
+ me.pixel = map.getProjection().fromLatLngToPoint(me.latLng)
470
+ }
471
+
472
+ options[name].apply(this, [me]);
473
+ });
474
+ }
475
+ })(this.map, marker, marker_events_with_mouse[ev]);
476
+ }
477
+
478
+ google.maps.event.addListener(marker, 'click', function() {
479
+ this.details = details;
480
+
481
+ if (options.click) {
482
+ options.click.apply(this, [this]);
483
+ }
484
+
485
+ if (marker.infoWindow) {
486
+ self.hideInfoWindows();
487
+ marker.infoWindow.open(self.map, marker);
488
+ }
489
+ });
490
+
491
+ google.maps.event.addListener(marker, 'rightclick', function(e) {
492
+ e.marker = this;
493
+
494
+ if (options.rightclick) {
495
+ options.rightclick.apply(this, [e]);
496
+ }
497
+
498
+ if (window.context_menu['marker'] != undefined) {
499
+ buildContextMenu('marker', e);
500
+ }
501
+ });
502
+
503
+ if (marker.fences) {
504
+ google.maps.event.addListener(marker, 'dragend', function() {
505
+ self.checkMarkerGeofence(marker, function(m, f) {
506
+ outside(m, f);
507
+ });
508
+ });
509
+ }
510
+
511
+ return marker;
512
+ }
513
+ else {
514
+ throw 'No latitude or longitude defined.';
515
+ }
516
+ };
517
+
518
+ this.addMarker = function(options) {
519
+ var marker;
520
+ if(options.hasOwnProperty('gm_accessors_')) {
521
+ // Native google.maps.Marker object
522
+ marker = options;
523
+ }
524
+ else {
525
+ if ((options.hasOwnProperty('lat') && options.hasOwnProperty('lng')) || options.position) {
526
+ marker = this.createMarker(options);
527
+ }
528
+ else {
529
+ throw 'No latitude or longitude defined.';
530
+ }
531
+ }
532
+
533
+ marker.setMap(this.map);
534
+
535
+ if(this.markerClusterer) {
536
+ this.markerClusterer.addMarker(marker);
537
+ }
538
+
539
+ this.markers.push(marker);
540
+
541
+ GMaps.fire('marker_added', marker, this);
542
+
543
+ return marker;
544
+ };
545
+
546
+ this.addMarkers = function(array) {
547
+ for (var i=0, marker; marker=array[i]; i++) {
548
+ this.addMarker(marker);
549
+ }
550
+ return this.markers;
551
+ };
552
+
553
+ this.hideInfoWindows = function() {
554
+ for (var i=0, marker; marker=this.markers[i]; i++){
555
+ if (marker.infoWindow){
556
+ marker.infoWindow.close();
557
+ }
558
+ }
559
+ };
560
+
561
+ this.removeMarker = function(marker) {
562
+ for(var i = 0; i < this.markers.length; i++) {
563
+ if(this.markers[i] === marker) {
564
+ this.markers[i].setMap(null);
565
+ this.markers.splice(i, 1);
566
+
567
+ GMaps.fire('marker_removed', marker, this);
568
+
569
+ break;
570
+ }
571
+ }
572
+
573
+ return marker;
574
+ };
575
+
576
+ this.removeMarkers = function(collection) {
577
+ var collection = (collection || this.markers);
578
+
579
+ for(var i=0;i < this.markers.length; i++){
580
+ if(this.markers[i] === collection[i])
581
+ this.markers[i].setMap(null);
582
+ }
583
+
584
+ var new_markers = [];
585
+
586
+ for(var i=0;i < this.markers.length; i++){
587
+ if(this.markers[i].getMap() != null)
588
+ new_markers.push(this.markers[i]);
589
+ }
590
+
591
+ this.markers = new_markers;
592
+ };
593
+
594
+ // Overlays
595
+
596
+ this.drawOverlay = function(options) {
597
+ var overlay = new google.maps.OverlayView();
598
+ overlay.setMap(self.map);
599
+
600
+ var auto_show = true;
601
+
602
+ if(options.auto_show != null)
603
+ auto_show = options.auto_show;
604
+
605
+ overlay.onAdd = function() {
606
+ var el = doc.createElement('div');
607
+ el.style.borderStyle = "none";
608
+ el.style.borderWidth = "0px";
609
+ el.style.position = "absolute";
610
+ el.style.zIndex = 100;
611
+ el.innerHTML = options.content;
612
+
613
+ overlay.el = el;
614
+
615
+ var panes = this.getPanes();
616
+ if (!options.layer) {
617
+ options.layer = 'overlayLayer';
618
+ }
619
+ var overlayLayer = panes[options.layer];
620
+ overlayLayer.appendChild(el);
621
+
622
+ var stop_overlay_events = ['contextmenu', 'DOMMouseScroll', 'dblclick', 'mousedown'];
623
+
624
+ for (var ev = 0; ev < stop_overlay_events.length; ev++) {
625
+ (function(object, name) {
626
+ google.maps.event.addDomListener(object, name, function(e){
627
+ if(navigator.userAgent.toLowerCase().indexOf('msie') != -1 && document.all) {
628
+ e.cancelBubble = true;
629
+ e.returnValue = false;
630
+ }
631
+ else {
632
+ e.stopPropagation();
633
+ }
634
+ });
635
+ })(el, stop_overlay_events[ev]);
636
+ }
637
+
638
+ google.maps.event.trigger(this, 'ready');
639
+ };
640
+
641
+ overlay.draw = function() {
642
+ var projection = this.getProjection();
643
+ var pixel = projection.fromLatLngToDivPixel(new google.maps.LatLng(options.lat, options.lng));
644
+
645
+ options.horizontalOffset = options.horizontalOffset || 0;
646
+ options.verticalOffset = options.verticalOffset || 0;
647
+
648
+ var el = overlay.el;
649
+ var content = el.children[0];
650
+
651
+ var content_height = content.clientHeight;
652
+ var content_width = content.clientWidth;
653
+
654
+ switch (options.verticalAlign) {
655
+ case 'top':
656
+ el.style.top = (pixel.y - content_height + options.verticalOffset) + 'px';
657
+ break;
658
+ default:
659
+ case 'middle':
660
+ el.style.top = (pixel.y - (content_height / 2) + options.verticalOffset) + 'px';
661
+ break;
662
+ case 'bottom':
663
+ el.style.top = (pixel.y + options.verticalOffset) + 'px';
664
+ break;
665
+ }
666
+
667
+ switch (options.horizontalAlign) {
668
+ case 'left':
669
+ el.style.left = (pixel.x - content_width + options.horizontalOffset) + 'px';
670
+ break;
671
+ default:
672
+ case 'center':
673
+ el.style.left = (pixel.x - (content_width / 2) + options.horizontalOffset) + 'px';
674
+ break;
675
+ case 'right':
676
+ el.style.left = (pixel.x + options.horizontalOffset) + 'px';
677
+ break;
678
+ }
679
+
680
+ el.style.display = auto_show ? 'block' : 'none';
681
+
682
+ if(!auto_show){
683
+ options.show.apply(this, [el]);
684
+ }
685
+ };
686
+
687
+ overlay.onRemove = function() {
688
+ var el = overlay.el;
689
+
690
+ if(options.remove){
691
+ options.remove.apply(this, [el]);
692
+ }
693
+ else {
694
+ overlay.el.parentNode.removeChild(overlay.el);
695
+ overlay.el = null;
696
+ }
697
+ };
698
+
699
+ self.overlays.push(overlay);
700
+ return overlay;
701
+ };
702
+
703
+ this.removeOverlay = function(overlay) {
704
+ for(var i = 0; i < this.overlays.length; i++) {
705
+ if(this.overlays[i] === overlay) {
706
+ this.overlays[i].setMap(null);
707
+ this.overlays.splice(i, 1);
708
+
709
+ break;
710
+ }
711
+ }
712
+ };
713
+
714
+ this.removeOverlays = function() {
715
+ for (var i=0, item; item=self.overlays[i]; i++){
716
+ item.setMap(null);
717
+ }
718
+ self.overlays = [];
719
+ };
720
+
721
+ // Geometry
722
+
723
+ this.drawPolyline = function(options) {
724
+ var path = [];
725
+ var points = options.path;
726
+
727
+ if (points.length){
728
+ if (points[0][0] === undefined){
729
+ path = points;
730
+ }
731
+ else {
732
+ for (var i=0, latlng; latlng=points[i]; i++){
733
+ path.push(new google.maps.LatLng(latlng[0], latlng[1]));
734
+ }
735
+ }
736
+ }
737
+
738
+ var polyline_options = {
739
+ map: this.map,
740
+ path: path,
741
+ strokeColor: options.strokeColor,
742
+ strokeOpacity: options.strokeOpacity,
743
+ strokeWeight: options.strokeWeight,
744
+ geodesic: options.geodesic,
745
+ clickable: true,
746
+ editable: false,
747
+ visible: true
748
+ };
749
+
750
+ if(options.hasOwnProperty("clickable"))
751
+ polyline_options.clickable = options.clickable;
752
+
753
+ if(options.hasOwnProperty("editable"))
754
+ polyline_options.editable = options.editable;
755
+
756
+ if(options.hasOwnProperty("icons"))
757
+ polyline_options.icons = options.icons;
758
+
759
+ if(options.hasOwnProperty("zIndex"))
760
+ polyline_options.zIndex = options.zIndex;
761
+
762
+ var polyline = new google.maps.Polyline(polyline_options);
763
+
764
+ var polyline_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick'];
765
+
766
+ for (var ev = 0; ev < polyline_events.length; ev++) {
767
+ (function(object, name) {
768
+ if (options[name]) {
769
+ google.maps.event.addListener(object, name, function(e){
770
+ options[name].apply(this, [e]);
771
+ });
772
+ }
773
+ })(polyline, polyline_events[ev]);
774
+ }
775
+
776
+ this.polylines.push(polyline);
777
+
778
+ GMaps.fire('polyline_added', polyline, this);
779
+
780
+ return polyline;
781
+ };
782
+
783
+ this.removePolyline = function(polyline) {
784
+ for(var i = 0; i < this.polylines.length; i++) {
785
+ if(this.polylines[i] === polyline) {
786
+ this.polylines[i].setMap(null);
787
+ this.polylines.splice(i, 1);
788
+
789
+ GMaps.fire('polyline_removed', polyline, this);
790
+
791
+ break;
792
+ }
793
+ }
794
+ };
795
+
796
+ this.removePolylines = function() {
797
+ for (var i=0, item; item=self.polylines[i]; i++){
798
+ item.setMap(null);
799
+ }
800
+ self.polylines = [];
801
+ };
802
+
803
+ this.drawCircle = function(options) {
804
+ options = extend_object({
805
+ map: this.map,
806
+ center: new google.maps.LatLng(options.lat, options.lng)
807
+ }, options);
808
+
809
+ delete options.lat;
810
+ delete options.lng;
811
+ var polygon = new google.maps.Circle(options);
812
+
813
+ var polygon_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick'];
814
+
815
+ for (var ev = 0; ev < polygon_events.length; ev++) {
816
+ (function(object, name) {
817
+ if (options[name]) {
818
+ google.maps.event.addListener(object, name, function(e){
819
+ options[name].apply(this, [e]);
820
+ });
821
+ }
822
+ })(polygon, polygon_events[ev]);
823
+ }
824
+
825
+ this.polygons.push(polygon);
826
+
827
+ return polygon;
828
+ };
829
+
830
+ this.drawRectangle = function(options) {
831
+ options = extend_object({
832
+ map: this.map
833
+ }, options);
834
+
835
+ var latLngBounds = new google.maps.LatLngBounds(
836
+ new google.maps.LatLng(options.bounds[0][0], options.bounds[0][1]),
837
+ new google.maps.LatLng(options.bounds[1][0], options.bounds[1][1])
838
+ );
839
+
840
+ options.bounds = latLngBounds;
841
+
842
+ var polygon = new google.maps.Rectangle(options);
843
+
844
+ var polygon_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick'];
845
+
846
+ for (var ev = 0; ev < polygon_events.length; ev++) {
847
+ (function(object, name) {
848
+ if (options[name]) {
849
+ google.maps.event.addListener(object, name, function(e){
850
+ options[name].apply(this, [e]);
851
+ });
852
+ }
853
+ })(polygon, polygon_events[ev]);
854
+ }
855
+
856
+ this.polygons.push(polygon);
857
+
858
+ return polygon;
859
+ };
860
+
861
+ this.drawPolygon = function(options) {
862
+ var useGeoJSON = false;
863
+ if(options.hasOwnProperty("useGeoJSON"))
864
+ useGeoJSON = options.useGeoJSON;
865
+
866
+ delete options.useGeoJSON;
867
+
868
+ options = extend_object({
869
+ map: this.map
870
+ }, options);
871
+
872
+ if(useGeoJSON == false)
873
+ options.paths = [options.paths.slice(0)];
874
+
875
+ if(options.paths.length > 0) {
876
+ if(options.paths[0].length > 0) {
877
+ options.paths = array_flat(array_map(options.paths, arrayToLatLng, useGeoJSON));
878
+ }
879
+ }
880
+
881
+ var polygon = new google.maps.Polygon(options);
882
+
883
+ var polygon_events = ['click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'rightclick'];
884
+
885
+ for (var ev = 0; ev < polygon_events.length; ev++) {
886
+ (function(object, name) {
887
+ if (options[name]) {
888
+ google.maps.event.addListener(object, name, function(e){
889
+ options[name].apply(this, [e]);
890
+ });
891
+ }
892
+ })(polygon, polygon_events[ev]);
893
+ }
894
+
895
+ this.polygons.push(polygon);
896
+
897
+ GMaps.fire('polygon_added', polygon, this);
898
+
899
+ return polygon;
900
+ };
901
+
902
+ this.removePolygon = function(polygon) {
903
+ for(var i = 0; i < this.polygons.length; i++) {
904
+ if(this.polygons[i] === polygon) {
905
+ this.polygons[i].setMap(null);
906
+ this.polygons.splice(i, 1);
907
+
908
+ GMaps.fire('polygon_removed', polygon, this);
909
+
910
+ break;
911
+ }
912
+ }
913
+ };
914
+
915
+ this.removePolygons = function() {
916
+ for (var i=0, item; item=self.polygons[i]; i++){
917
+ item.setMap(null);
918
+ }
919
+ self.polygons = [];
920
+ };
921
+
922
+ // Fusion Tables
923
+
924
+ this.getFromFusionTables = function(options) {
925
+ var events = options.events;
926
+
927
+ delete options.events;
928
+
929
+ var fusion_tables_options = options;
930
+
931
+ var layer = new google.maps.FusionTablesLayer(fusion_tables_options);
932
+
933
+ for (var ev in events) {
934
+ (function(object, name) {
935
+ google.maps.event.addListener(object, name, function(e){
936
+ events[name].apply(this, [e]);
937
+ });
938
+ })(layer, ev);
939
+ }
940
+
941
+ this.layers.push(layer);
942
+
943
+ return layer;
944
+ };
945
+
946
+ this.loadFromFusionTables = function(options) {
947
+ var layer = this.getFromFusionTables(options);
948
+ layer.setMap(this.map);
949
+
950
+ return layer;
951
+ };
952
+
953
+ // KML
954
+
955
+ this.getFromKML = function(options) {
956
+ var url = options.url;
957
+ var events = options.events;
958
+
959
+ delete options.url;
960
+ delete options.events;
961
+
962
+ var kml_options = options;
963
+
964
+ var layer = new google.maps.KmlLayer(url, kml_options);
965
+
966
+ for (var ev in events) {
967
+ (function(object, name) {
968
+ google.maps.event.addListener(object, name, function(e){
969
+ events[name].apply(this, [e]);
970
+ });
971
+ })(layer, ev);
972
+ }
973
+
974
+ this.layers.push(layer);
975
+
976
+ return layer;
977
+ };
978
+
979
+ this.loadFromKML = function(options) {
980
+ var layer = this.getFromKML(options);
981
+ layer.setMap(this.map);
982
+
983
+ return layer;
984
+ };
985
+
986
+ // Routes
987
+
988
+ var travelMode, unitSystem;
989
+ this.getRoutes = function(options) {
990
+ switch (options.travelMode) {
991
+ case 'bicycling':
992
+ travelMode = google.maps.TravelMode.BICYCLING;
993
+ break;
994
+ case 'transit':
995
+ travelMode = google.maps.TravelMode.TRANSIT;
996
+ break;
997
+ case 'driving':
998
+ travelMode = google.maps.TravelMode.DRIVING;
999
+ break;
1000
+ // case 'walking':
1001
+ default:
1002
+ travelMode = google.maps.TravelMode.WALKING;
1003
+ break;
1004
+ }
1005
+
1006
+ if (options.unitSystem === 'imperial') {
1007
+ unitSystem = google.maps.UnitSystem.IMPERIAL;
1008
+ }
1009
+ else {
1010
+ unitSystem = google.maps.UnitSystem.METRIC;
1011
+ }
1012
+
1013
+ var base_options = {
1014
+ avoidHighways: false,
1015
+ avoidTolls: false,
1016
+ optimizeWaypoints: false,
1017
+ waypoints: []
1018
+ };
1019
+
1020
+ var request_options = extend_object(base_options, options);
1021
+
1022
+ request_options.origin = /string/.test(typeof options.origin) ? options.origin : new google.maps.LatLng(options.origin[0], options.origin[1]);
1023
+ request_options.destination = new google.maps.LatLng(options.destination[0], options.destination[1]);
1024
+ request_options.travelMode = travelMode;
1025
+ request_options.unitSystem = unitSystem;
1026
+
1027
+ delete request_options.callback;
1028
+
1029
+ var self = this;
1030
+ var service = new google.maps.DirectionsService();
1031
+
1032
+ service.route(request_options, function(result, status) {
1033
+ if (status === google.maps.DirectionsStatus.OK) {
1034
+ for (var r in result.routes) {
1035
+ if (result.routes.hasOwnProperty(r)) {
1036
+ self.routes.push(result.routes[r]);
1037
+ }
1038
+ }
1039
+ }
1040
+ if (options.callback) {
1041
+ options.callback(self.routes);
1042
+ }
1043
+ });
1044
+ };
1045
+
1046
+ this.removeRoutes = function() {
1047
+ this.routes = [];
1048
+ };
1049
+
1050
+ this.getElevations = function(options) {
1051
+ options = extend_object({
1052
+ locations: [],
1053
+ path : false,
1054
+ samples : 256
1055
+ }, options);
1056
+
1057
+ if(options.locations.length > 0) {
1058
+ if(options.locations[0].length > 0) {
1059
+ options.locations = array_flat(array_map([options.locations], arrayToLatLng, false));
1060
+ }
1061
+ }
1062
+
1063
+ var callback = options.callback;
1064
+ delete options.callback;
1065
+
1066
+ var service = new google.maps.ElevationService();
1067
+
1068
+ //location request
1069
+ if (!options.path) {
1070
+ delete options.path;
1071
+ delete options.samples;
1072
+ service.getElevationForLocations(options, function(result, status){
1073
+ if (callback && typeof(callback) === "function") {
1074
+ callback(result, status);
1075
+ }
1076
+ });
1077
+ //path request
1078
+ } else {
1079
+ var pathRequest = {
1080
+ path : options.locations,
1081
+ samples : options.samples
1082
+ };
1083
+
1084
+ service.getElevationAlongPath(pathRequest, function(result, status){
1085
+ if (callback && typeof(callback) === "function") {
1086
+ callback(result, status);
1087
+ }
1088
+ });
1089
+ }
1090
+ };
1091
+
1092
+ // Alias for the method "drawRoute"
1093
+ this.cleanRoute = this.removePolylines;
1094
+
1095
+ this.drawRoute = function(options) {
1096
+ var self = this;
1097
+ this.getRoutes({
1098
+ origin: options.origin,
1099
+ destination: options.destination,
1100
+ travelMode: options.travelMode,
1101
+ waypoints: options.waypoints,
1102
+ unitSystem: options.unitSystem,
1103
+ callback: function(e) {
1104
+ if (e.length > 0) {
1105
+ self.drawPolyline({
1106
+ path: e[e.length - 1].overview_path,
1107
+ strokeColor: options.strokeColor,
1108
+ strokeOpacity: options.strokeOpacity,
1109
+ strokeWeight: options.strokeWeight
1110
+ });
1111
+ if (options.callback) {
1112
+ options.callback(e[e.length - 1]);
1113
+ }
1114
+ }
1115
+ }
1116
+ });
1117
+ };
1118
+
1119
+ this.travelRoute = function(options) {
1120
+ if (options.origin && options.destination) {
1121
+ this.getRoutes({
1122
+ origin: options.origin,
1123
+ destination: options.destination,
1124
+ travelMode: options.travelMode,
1125
+ waypoints : options.waypoints,
1126
+ callback: function(e) {
1127
+ //start callback
1128
+ if (e.length > 0 && options.start) {
1129
+ options.start(e[e.length - 1]);
1130
+ }
1131
+
1132
+ //step callback
1133
+ if (e.length > 0 && options.step) {
1134
+ var route = e[e.length - 1];
1135
+ if (route.legs.length > 0) {
1136
+ var steps = route.legs[0].steps;
1137
+ for (var i=0, step; step=steps[i]; i++) {
1138
+ step.step_number = i;
1139
+ options.step(step, (route.legs[0].steps.length - 1));
1140
+ }
1141
+ }
1142
+ }
1143
+
1144
+ //end callback
1145
+ if (e.length > 0 && options.end) {
1146
+ options.end(e[e.length - 1]);
1147
+ }
1148
+ }
1149
+ });
1150
+ }
1151
+ else if (options.route) {
1152
+ if (options.route.legs.length > 0) {
1153
+ var steps = options.route.legs[0].steps;
1154
+ for (var i=0, step; step=steps[i]; i++) {
1155
+ step.step_number = i;
1156
+ options.step(step);
1157
+ }
1158
+ }
1159
+ }
1160
+ };
1161
+
1162
+ this.drawSteppedRoute = function(options) {
1163
+ if (options.origin && options.destination) {
1164
+ this.getRoutes({
1165
+ origin: options.origin,
1166
+ destination: options.destination,
1167
+ travelMode: options.travelMode,
1168
+ waypoints : options.waypoints,
1169
+ callback: function(e) {
1170
+ //start callback
1171
+ if (e.length > 0 && options.start) {
1172
+ options.start(e[e.length - 1]);
1173
+ }
1174
+
1175
+ //step callback
1176
+ if (e.length > 0 && options.step) {
1177
+ var route = e[e.length - 1];
1178
+ if (route.legs.length > 0) {
1179
+ var steps = route.legs[0].steps;
1180
+ for (var i=0, step; step=steps[i]; i++) {
1181
+ step.step_number = i;
1182
+ self.drawPolyline({
1183
+ path: step.path,
1184
+ strokeColor: options.strokeColor,
1185
+ strokeOpacity: options.strokeOpacity,
1186
+ strokeWeight: options.strokeWeight
1187
+ });
1188
+ options.step(step, (route.legs[0].steps.length - 1));
1189
+ }
1190
+ }
1191
+ }
1192
+
1193
+ //end callback
1194
+ if (e.length > 0 && options.end) {
1195
+ options.end(e[e.length - 1]);
1196
+ }
1197
+ }
1198
+ });
1199
+ }
1200
+ else if (options.route) {
1201
+ if (options.route.legs.length > 0) {
1202
+ var steps = options.route.legs[0].steps;
1203
+ for (var i=0, step; step=steps[i]; i++) {
1204
+ step.step_number = i;
1205
+ self.drawPolyline({
1206
+ path: step.path,
1207
+ strokeColor: options.strokeColor,
1208
+ strokeOpacity: options.strokeOpacity,
1209
+ strokeWeight: options.strokeWeight
1210
+ });
1211
+ options.step(step);
1212
+ }
1213
+ }
1214
+ }
1215
+ };
1216
+
1217
+ // Geofence
1218
+
1219
+ this.checkGeofence = function(lat, lng, fence) {
1220
+ return fence.containsLatLng(new google.maps.LatLng(lat, lng));
1221
+ };
1222
+
1223
+ this.checkMarkerGeofence = function(marker, outside_callback) {
1224
+ if (marker.fences) {
1225
+ for (var i=0, fence; fence=marker.fences[i]; i++) {
1226
+ var pos = marker.getPosition();
1227
+ if (!self.checkGeofence(pos.lat(), pos.lng(), fence)) {
1228
+ outside_callback(marker, fence);
1229
+ }
1230
+ }
1231
+ }
1232
+ };
1233
+
1234
+ // Layers
1235
+
1236
+ this.addLayer = function(layerName, options) {
1237
+ //var default_layers = ['weather', 'clouds', 'traffic', 'transit', 'bicycling', 'panoramio', 'places'];
1238
+ options = options || {};
1239
+ var layer;
1240
+
1241
+ switch(layerName) {
1242
+ case 'weather': this.singleLayers.weather = layer = new google.maps.weather.WeatherLayer();
1243
+ break;
1244
+ case 'clouds': this.singleLayers.clouds = layer = new google.maps.weather.CloudLayer();
1245
+ break;
1246
+ case 'traffic': this.singleLayers.traffic = layer = new google.maps.TrafficLayer();
1247
+ break;
1248
+ case 'transit': this.singleLayers.transit = layer = new google.maps.TransitLayer();
1249
+ break;
1250
+ case 'bicycling': this.singleLayers.bicycling = layer = new google.maps.BicyclingLayer();
1251
+ break;
1252
+ case 'panoramio':
1253
+ this.singleLayers.panoramio = layer = new google.maps.panoramio.PanoramioLayer();
1254
+ layer.setTag(options.filter);
1255
+ delete options.filter;
1256
+
1257
+ //click event
1258
+ if(options.click) {
1259
+ google.maps.event.addListener(layer, 'click', function(event) {
1260
+ options.click(event);
1261
+ delete options.click;
1262
+ });
1263
+ }
1264
+ break;
1265
+ case 'places':
1266
+ this.singleLayers.places = layer = new google.maps.places.PlacesService(this.map);
1267
+
1268
+ //search and nearbySearch callback, Both are the same
1269
+ if(options.search || options.nearbySearch) {
1270
+ var placeSearchRequest = {
1271
+ bounds : options.bounds || null,
1272
+ keyword : options.keyword || null,
1273
+ location : options.location || null,
1274
+ name : options.name || null,
1275
+ radius : options.radius || null,
1276
+ rankBy : options.rankBy || null,
1277
+ types : options.types || null
1278
+ };
1279
+
1280
+ if(options.search) {
1281
+ layer.search(placeSearchRequest, options.search);
1282
+ }
1283
+
1284
+ if(options.nearbySearch) {
1285
+ layer.nearbySearch(placeSearchRequest, options.nearbySearch);
1286
+ }
1287
+ }
1288
+
1289
+ //textSearch callback
1290
+ if(options.textSearch) {
1291
+ var textSearchRequest = {
1292
+ bounds : options.bounds || null,
1293
+ location : options.location || null,
1294
+ query : options.query || null,
1295
+ radius : options.radius || null
1296
+ };
1297
+
1298
+ layer.textSearch(textSearchRequest, options.textSearch);
1299
+ }
1300
+ break;
1301
+ }
1302
+
1303
+ if(layer !== undefined) {
1304
+ if(typeof layer.setOptions == 'function') {
1305
+ layer.setOptions(options);
1306
+ }
1307
+ if(typeof layer.setMap == 'function') {
1308
+ layer.setMap(this.map);
1309
+ }
1310
+
1311
+ return layer;
1312
+ }
1313
+ };
1314
+
1315
+ this.removeLayer = function(layerName) {
1316
+ if(this.singleLayers[layerName] !== undefined) {
1317
+ this.singleLayers[layerName].setMap(null);
1318
+ delete this.singleLayers[layerName];
1319
+ }
1320
+ };
1321
+
1322
+ // Static Maps
1323
+
1324
+ this.toImage = function(options) {
1325
+ var options = options || {};
1326
+ var static_map_options = {};
1327
+ static_map_options['size'] = options['size'] || [this.el.clientWidth, this.el.clientHeight];
1328
+ static_map_options['lat'] = this.getCenter().lat();
1329
+ static_map_options['lng'] = this.getCenter().lng();
1330
+
1331
+ if(this.markers.length > 0) {
1332
+ static_map_options['markers'] = [];
1333
+ for(var i=0; i < this.markers.length; i++) {
1334
+ static_map_options['markers'].push({
1335
+ lat: this.markers[i].getPosition().lat(),
1336
+ lng: this.markers[i].getPosition().lng()
1337
+ });
1338
+ }
1339
+ }
1340
+
1341
+ if(this.polylines.length > 0) {
1342
+ var polyline = this.polylines[0];
1343
+ static_map_options['polyline'] = {};
1344
+ static_map_options['polyline']['path'] = google.maps.geometry.encoding.encodePath(polyline.getPath());
1345
+ static_map_options['polyline']['strokeColor'] = polyline.strokeColor
1346
+ static_map_options['polyline']['strokeOpacity'] = polyline.strokeOpacity
1347
+ static_map_options['polyline']['strokeWeight'] = polyline.strokeWeight
1348
+ }
1349
+
1350
+ return GMaps.staticMapURL(static_map_options);
1351
+ };
1352
+
1353
+ // Map Types
1354
+
1355
+ this.addMapType = function(mapTypeId, options) {
1356
+ if(options.hasOwnProperty("getTileUrl") && typeof(options["getTileUrl"]) == "function") {
1357
+ options.tileSize = options.tileSize || new google.maps.Size(256, 256);
1358
+
1359
+ var mapType = new google.maps.ImageMapType(options);
1360
+
1361
+ this.map.mapTypes.set(mapTypeId, mapType);
1362
+ }
1363
+ else {
1364
+ throw "'getTileUrl' function required.";
1365
+ }
1366
+ };
1367
+
1368
+ this.addOverlayMapType = function(options) {
1369
+ if(options.hasOwnProperty("getTile") && typeof(options["getTile"]) == "function") {
1370
+ var overlayMapTypeIndex = options.index;
1371
+
1372
+ delete options.index;
1373
+
1374
+ this.map.overlayMapTypes.insertAt(overlayMapTypeIndex, options);
1375
+ }
1376
+ else {
1377
+ throw "'getTile' function required.";
1378
+ }
1379
+ };
1380
+
1381
+ this.removeOverlayMapType = function(overlayMapTypeIndex) {
1382
+ this.map.overlayMapTypes.removeAt(overlayMapTypeIndex);
1383
+ };
1384
+
1385
+ // Styles
1386
+
1387
+ this.addStyle = function(options) {
1388
+ var styledMapType = new google.maps.StyledMapType(options.styles, options.styledMapName);
1389
+
1390
+ this.map.mapTypes.set(options.mapTypeId, styledMapType);
1391
+ };
1392
+
1393
+ this.setStyle = function(mapTypeId) {
1394
+ this.map.setMapTypeId(mapTypeId);
1395
+ };
1396
+
1397
+ // StreetView
1398
+
1399
+ this.createPanorama = function(streetview_options) {
1400
+ if (!streetview_options.hasOwnProperty('lat') || !streetview_options.hasOwnProperty('lng')) {
1401
+ streetview_options.lat = this.getCenter().lat();
1402
+ streetview_options.lng = this.getCenter().lng();
1403
+ }
1404
+
1405
+ this.panorama = GMaps.createPanorama(streetview_options);
1406
+
1407
+ this.map.setStreetView(this.panorama);
1408
+
1409
+ return this.panorama;
1410
+ };
1411
+
1412
+ // Events
1413
+
1414
+ this.on = function(event_name, handler) {
1415
+ return GMaps.on(event_name, this, handler);
1416
+ };
1417
+
1418
+ this.off = function(event_name) {
1419
+ GMaps.off(event_name, this);
1420
+ };
1421
+ };
1422
+
1423
+ GMaps.createPanorama = function(options) {
1424
+ var el = getElementById(options.el, options.context);
1425
+
1426
+ options.position = new google.maps.LatLng(options.lat, options.lng);
1427
+
1428
+ delete options.el;
1429
+ delete options.context;
1430
+ delete options.lat;
1431
+ delete options.lng;
1432
+
1433
+ var streetview_events = ['closeclick', 'links_changed', 'pano_changed', 'position_changed', 'pov_changed', 'resize', 'visible_changed'];
1434
+
1435
+ var streetview_options = extend_object({visible : true}, options);
1436
+
1437
+ for(var i = 0; i < streetview_events.length; i++) {
1438
+ delete streetview_options[streetview_events[i]];
1439
+ }
1440
+
1441
+ var panorama = new google.maps.StreetViewPanorama(el, streetview_options);
1442
+
1443
+ for(var i = 0; i < streetview_events.length; i++) {
1444
+ (function(object, name) {
1445
+ if (options[name]) {
1446
+ google.maps.event.addListener(object, name, function(){
1447
+ options[name].apply(this);
1448
+ });
1449
+ }
1450
+ })(panorama, streetview_events[i]);
1451
+ }
1452
+
1453
+ return panorama;
1454
+ };
1455
+
1456
+ GMaps.Route = function(options) {
1457
+ this.map = options.map;
1458
+ this.route = options.route;
1459
+ this.step_count = 0;
1460
+ this.steps = this.route.legs[0].steps;
1461
+ this.steps_length = this.steps.length;
1462
+
1463
+ this.polyline = this.map.drawPolyline({
1464
+ path: new google.maps.MVCArray(),
1465
+ strokeColor: options.strokeColor,
1466
+ strokeOpacity: options.strokeOpacity,
1467
+ strokeWeight: options.strokeWeight
1468
+ }).getPath();
1469
+
1470
+ this.back = function() {
1471
+ if (this.step_count > 0) {
1472
+ this.step_count--;
1473
+ var path = this.route.legs[0].steps[this.step_count].path;
1474
+ for (var p in path){
1475
+ if (path.hasOwnProperty(p)){
1476
+ this.polyline.pop();
1477
+ }
1478
+ }
1479
+ }
1480
+ };
1481
+
1482
+ this.forward = function() {
1483
+ if (this.step_count < this.steps_length) {
1484
+ var path = this.route.legs[0].steps[this.step_count].path;
1485
+ for (var p in path){
1486
+ if (path.hasOwnProperty(p)){
1487
+ this.polyline.push(path[p]);
1488
+ }
1489
+ }
1490
+ this.step_count++;
1491
+ }
1492
+ };
1493
+ };
1494
+
1495
+ // Geolocation (Modern browsers only)
1496
+
1497
+ GMaps.geolocate = function(options) {
1498
+ var complete_callback = options.always || options.complete;
1499
+
1500
+ if (navigator.geolocation) {
1501
+ navigator.geolocation.getCurrentPosition(function(position) {
1502
+ options.success(position);
1503
+
1504
+ if (complete_callback) {
1505
+ complete_callback();
1506
+ }
1507
+ }, function(error) {
1508
+ options.error(error);
1509
+
1510
+ if (complete_callback) {
1511
+ complete_callback();
1512
+ }
1513
+ }, options.options);
1514
+ }
1515
+ else {
1516
+ options.not_supported();
1517
+
1518
+ if (complete_callback) {
1519
+ complete_callback();
1520
+ }
1521
+ }
1522
+ };
1523
+
1524
+ // Geocoding
1525
+
1526
+ GMaps.geocode = function(options) {
1527
+ this.geocoder = new google.maps.Geocoder();
1528
+ var callback = options.callback;
1529
+ if (options.hasOwnProperty('lat') && options.hasOwnProperty('lng')) {
1530
+ options.latLng = new google.maps.LatLng(options.lat, options.lng);
1531
+ }
1532
+
1533
+ delete options.lat;
1534
+ delete options.lng;
1535
+ delete options.callback;
1536
+ this.geocoder.geocode(options, function(results, status) {
1537
+ callback(results, status);
1538
+ });
1539
+ };
1540
+
1541
+ // Static maps
1542
+
1543
+ GMaps.staticMapURL = function(options){
1544
+ var parameters = [];
1545
+ var data;
1546
+
1547
+ var static_root = 'http://maps.googleapis.com/maps/api/staticmap';
1548
+ if (options.url){
1549
+ static_root = options.url;
1550
+ delete options.url;
1551
+ }
1552
+ static_root += '?';
1553
+
1554
+ var markers = options.markers;
1555
+ delete options.markers;
1556
+ if (!markers && options.marker){
1557
+ markers = [options.marker];
1558
+ delete options.marker;
1559
+ }
1560
+
1561
+ var polyline = options.polyline;
1562
+ delete options.polyline;
1563
+
1564
+ /** Map options **/
1565
+ if (options.center){
1566
+ parameters.push('center=' + options.center);
1567
+ delete options.center;
1568
+ }
1569
+ else if (options.address){
1570
+ parameters.push('center=' + options.address);
1571
+ delete options.address;
1572
+ }
1573
+ else if (options.lat){
1574
+ parameters.push(['center=', options.lat, ',', options.lng].join(''));
1575
+ delete options.lat;
1576
+ delete options.lng;
1577
+ }
1578
+ else if (options.visible){
1579
+ var visible = encodeURI(options.visible.join('|'));
1580
+ parameters.push('visible=' + visible);
1581
+ }
1582
+
1583
+ var size = options.size;
1584
+ if (size){
1585
+ if (size.join){
1586
+ size = size.join('x');
1587
+ }
1588
+ delete options.size;
1589
+ }
1590
+ else {
1591
+ size = '630x300';
1592
+ }
1593
+ parameters.push('size=' + size);
1594
+
1595
+ if (!options.zoom){
1596
+ options.zoom = 15;
1597
+ }
1598
+
1599
+ var sensor = options.hasOwnProperty('sensor') ? !!options.sensor : true;
1600
+ delete options.sensor;
1601
+ parameters.push('sensor=' + sensor);
1602
+
1603
+ for (var param in options){
1604
+ if (options.hasOwnProperty(param)){
1605
+ parameters.push(param + '=' + options[param]);
1606
+ }
1607
+ }
1608
+
1609
+ /** Markers **/
1610
+ if (markers){
1611
+ var marker, loc;
1612
+
1613
+ for (var i=0; data=markers[i]; i++){
1614
+ marker = [];
1615
+
1616
+ if (data.size && data.size !== 'normal'){
1617
+ marker.push('size:' + data.size);
1618
+ }
1619
+ else if (data.icon){
1620
+ marker.push('icon:' + encodeURI(data.icon));
1621
+ }
1622
+
1623
+ if (data.color){
1624
+ marker.push('color:' + data.color.replace('#', '0x'));
1625
+ }
1626
+
1627
+ if (data.label){
1628
+ marker.push('label:' + data.label[0].toUpperCase());
1629
+ }
1630
+
1631
+ loc = (data.address ? data.address : data.lat + ',' + data.lng);
1632
+
1633
+ if (marker.length || i === 0){
1634
+ marker.push(loc);
1635
+ marker = marker.join('|');
1636
+ parameters.push('markers=' + encodeURI(marker));
1637
+ }
1638
+ // New marker without styles
1639
+ else {
1640
+ marker = parameters.pop() + encodeURI('|' + loc);
1641
+ parameters.push(marker);
1642
+ }
1643
+ }
1644
+ }
1645
+
1646
+ /** Polylines **/
1647
+ function parseColor(color, opacity){
1648
+ if (color[0] === '#'){
1649
+ color = color.replace('#', '0x');
1650
+
1651
+ if (opacity){
1652
+ opacity = parseFloat(opacity);
1653
+ opacity = Math.min(1, Math.max(opacity, 0));
1654
+ if (opacity === 0){
1655
+ return '0x00000000';
1656
+ }
1657
+ opacity = (opacity * 255).toString(16);
1658
+ if (opacity.length === 1){
1659
+ opacity += opacity;
1660
+ }
1661
+
1662
+ color = color.slice(0,8) + opacity;
1663
+ }
1664
+ }
1665
+ return color;
1666
+ }
1667
+
1668
+ if (polyline){
1669
+ data = polyline;
1670
+ polyline = [];
1671
+
1672
+ if (data.strokeWeight){
1673
+ polyline.push('weight:' + parseInt(data.strokeWeight, 10));
1674
+ }
1675
+
1676
+ if (data.strokeColor){
1677
+ var color = parseColor(data.strokeColor, data.strokeOpacity);
1678
+ polyline.push('color:' + color);
1679
+ }
1680
+
1681
+ if (data.fillColor){
1682
+ var fillcolor = parseColor(data.fillColor, data.fillOpacity);
1683
+ polyline.push('fillcolor:' + fillcolor);
1684
+ }
1685
+
1686
+ var path = data.path;
1687
+ if (path.join){
1688
+ for (var j=0, pos; pos=path[j]; j++){
1689
+ polyline.push(pos.join(','));
1690
+ }
1691
+ }
1692
+ else {
1693
+ polyline.push('enc:' + path);
1694
+ }
1695
+
1696
+ polyline = polyline.join('|');
1697
+ parameters.push('path=' + encodeURI(polyline));
1698
+ }
1699
+
1700
+ parameters = parameters.join('&');
1701
+ return static_root + parameters;
1702
+ };
1703
+
1704
+ // Events
1705
+
1706
+ GMaps.custom_events = ['marker_added', 'marker_removed', 'polyline_added', 'polyline_removed', 'polygon_added', 'polygon_removed', 'geolocated', 'geolocation_failed'];
1707
+
1708
+ GMaps.on = function(event_name, object, handler) {
1709
+ if (GMaps.custom_events.indexOf(event_name) == -1) {
1710
+ return google.maps.event.addListener(object, event_name, handler);
1711
+ }
1712
+ else {
1713
+ var registered_event = {
1714
+ handler : handler,
1715
+ eventName : event_name
1716
+ };
1717
+
1718
+ object.registered_events[event_name] = object.registered_events[event_name] || [];
1719
+ object.registered_events[event_name].push(registered_event);
1720
+
1721
+ return registered_event;
1722
+ }
1723
+ };
1724
+
1725
+ GMaps.off = function(event_name, object) {
1726
+ if (GMaps.custom_events.indexOf(event_name) == -1) {
1727
+ google.maps.event.clearListeners(object, event_name);
1728
+ }
1729
+ else {
1730
+ object.registered_events[event_name] = [];
1731
+ }
1732
+ };
1733
+
1734
+ GMaps.fire = function(event_name, object, scope) {
1735
+ if (GMaps.custom_events.indexOf(event_name) == -1) {
1736
+ google.maps.event.trigger(object, event_name, Array.prototype.slice.apply(arguments).slice(2));
1737
+ }
1738
+ else {
1739
+ if(event_name in scope.registered_events) {
1740
+ var firing_events = scope.registered_events[event_name];
1741
+
1742
+ for(var i = 0; i < firing_events.length; i++) {
1743
+ (function(handler, scope, object) {
1744
+ handler.apply(scope, [object]);
1745
+ })(firing_events[i]['handler'], scope, object);
1746
+ }
1747
+ }
1748
+ }
1749
+ };
1750
+
1751
+ //==========================
1752
+ // Polygon containsLatLng
1753
+ // https://github.com/tparkin/Google-Maps-Point-in-Polygon
1754
+ // Poygon getBounds extension - google-maps-extensions
1755
+ // http://code.google.com/p/google-maps-extensions/source/browse/google.maps.Polygon.getBounds.js
1756
+ if (!google.maps.Polygon.prototype.getBounds) {
1757
+ google.maps.Polygon.prototype.getBounds = function(latLng) {
1758
+ var bounds = new google.maps.LatLngBounds();
1759
+ var paths = this.getPaths();
1760
+ var path;
1761
+
1762
+ for (var p = 0; p < paths.getLength(); p++) {
1763
+ path = paths.getAt(p);
1764
+ for (var i = 0; i < path.getLength(); i++) {
1765
+ bounds.extend(path.getAt(i));
1766
+ }
1767
+ }
1768
+
1769
+ return bounds;
1770
+ };
1771
+ }
1772
+
1773
+ if (!google.maps.Polygon.prototype.containsLatLng) {
1774
+ // Polygon containsLatLng - method to determine if a latLng is within a polygon
1775
+ google.maps.Polygon.prototype.containsLatLng = function(latLng) {
1776
+ // Exclude points outside of bounds as there is no way they are in the poly
1777
+ var bounds = this.getBounds();
1778
+
1779
+ if (bounds !== null && !bounds.contains(latLng)) {
1780
+ return false;
1781
+ }
1782
+
1783
+ // Raycast point in polygon method
1784
+ var inPoly = false;
1785
+
1786
+ var numPaths = this.getPaths().getLength();
1787
+ for (var p = 0; p < numPaths; p++) {
1788
+ var path = this.getPaths().getAt(p);
1789
+ var numPoints = path.getLength();
1790
+ var j = numPoints - 1;
1791
+
1792
+ for (var i = 0; i < numPoints; i++) {
1793
+ var vertex1 = path.getAt(i);
1794
+ var vertex2 = path.getAt(j);
1795
+
1796
+ if (vertex1.lng() < latLng.lng() && vertex2.lng() >= latLng.lng() || vertex2.lng() < latLng.lng() && vertex1.lng() >= latLng.lng()) {
1797
+ if (vertex1.lat() + (latLng.lng() - vertex1.lng()) / (vertex2.lng() - vertex1.lng()) * (vertex2.lat() - vertex1.lat()) < latLng.lat()) {
1798
+ inPoly = !inPoly;
1799
+ }
1800
+ }
1801
+
1802
+ j = i;
1803
+ }
1804
+ }
1805
+
1806
+ return inPoly;
1807
+ };
1808
+ }
1809
+
1810
+ google.maps.LatLngBounds.prototype.containsLatLng = function(latLng) {
1811
+ return this.contains(latLng);
1812
+ };
1813
+
1814
+ google.maps.Marker.prototype.setFences = function(fences) {
1815
+ this.fences = fences;
1816
+ };
1817
+
1818
+ google.maps.Marker.prototype.addFence = function(fence) {
1819
+ this.fences.push(fence);
1820
+ };
1821
+
1822
+ return GMaps;
1823
+ }(this));
1824
+
1825
+ var coordsToLatLngs = function(coords, useGeoJSON) {
1826
+ var first_coord = coords[0];
1827
+ var second_coord = coords[1];
1828
+
1829
+ if(useGeoJSON) {
1830
+ first_coord = coords[1];
1831
+ second_coord = coords[0];
1832
+ }
1833
+
1834
+ return new google.maps.LatLng(first_coord, second_coord);
1835
+ };
1836
+
1837
+ var arrayToLatLng = function(coords, useGeoJSON) {
1838
+ for(var i=0; i < coords.length; i++) {
1839
+ if(coords[i].length > 0 && typeof(coords[i][0]) != "number") {
1840
+ coords[i] = arrayToLatLng(coords[i], useGeoJSON);
1841
+ }
1842
+ else {
1843
+ coords[i] = coordsToLatLngs(coords[i], useGeoJSON);
1844
+ }
1845
+ }
1846
+
1847
+ return coords;
1848
+ };
1849
+
1850
+ var extend_object = function(obj, new_obj) {
1851
+ if(obj === new_obj) return obj;
1852
+
1853
+ for(var name in new_obj) {
1854
+ obj[name] = new_obj[name];
1855
+ }
1856
+
1857
+ return obj;
1858
+ };
1859
+
1860
+ var replace_object = function(obj, replace) {
1861
+ if(obj === replace) return obj;
1862
+
1863
+ for(var name in replace) {
1864
+ if(obj[name] != undefined)
1865
+ obj[name] = replace[name];
1866
+ }
1867
+
1868
+ return obj;
1869
+ };
1870
+
1871
+ var array_map = function(array, callback) {
1872
+ var original_callback_params = Array.prototype.slice.call(arguments, 2);
1873
+
1874
+ if (Array.prototype.map && array.map === Array.prototype.map) {
1875
+ return Array.prototype.map.call(array, function(item) {
1876
+ callback_params = original_callback_params;
1877
+ callback_params.splice(0, 0, item);
1878
+
1879
+ return callback.apply(this, callback_params);
1880
+ });
1881
+ }
1882
+ else {
1883
+ var array_return = [];
1884
+ var array_length = array.length;
1885
+
1886
+ for(var i = 0; i < array_length; i++) {
1887
+ callback_params = original_callback_params;
1888
+ callback_params = callback_params.splice(0, 0, array[i]);
1889
+ array_return.push(callback.apply(this, callback_params));
1890
+ }
1891
+
1892
+ return array_return;
1893
+ }
1894
+ };
1895
+
1896
+ var array_flat = function(array) {
1897
+ new_array = [];
1898
+
1899
+ for(var i=0; i < array.length; i++) {
1900
+ new_array = new_array.concat(array[i]);
1901
+ }
1902
+
1903
+ return new_array;
1904
+ };
1905
+ }
1906
+
1907
+ else {
1908
+ throw 'Google Maps API is required. Please register the following JavaScript library http://maps.google.com/maps/api/js?sensor=true.'
1909
+ }