bitsnote-assets 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +15 -0
- data/Rakefile +32 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/fonts/ionic/ionicons.eot +0 -0
- data/app/assets/fonts/ionic/ionicons.svg +1899 -0
- data/app/assets/fonts/ionic/ionicons.ttf +0 -0
- data/app/assets/fonts/ionic/ionicons.woff +0 -0
- data/app/assets/javascripts/angular/angular-animate.js +1689 -0
- data/app/assets/javascripts/angular/angular-animate.min.js +28 -0
- data/app/assets/javascripts/angular/angular-cookies.js +206 -0
- data/app/assets/javascripts/angular/angular-cookies.min.js +8 -0
- data/app/assets/javascripts/angular/angular-loader.js +415 -0
- data/app/assets/javascripts/angular/angular-loader.min.js +9 -0
- data/app/assets/javascripts/angular/angular-mocks.js +2175 -0
- data/app/assets/javascripts/angular/angular-resource.js +621 -0
- data/app/assets/javascripts/angular/angular-resource.min.js +13 -0
- data/app/assets/javascripts/angular/angular-route.js +925 -0
- data/app/assets/javascripts/angular/angular-route.min.js +14 -0
- data/app/assets/javascripts/angular/angular-sanitize.js +647 -0
- data/app/assets/javascripts/angular/angular-sanitize.min.js +15 -0
- data/app/assets/javascripts/angular/angular-scenario.js +33954 -0
- data/app/assets/javascripts/angular/angular-touch.js +584 -0
- data/app/assets/javascripts/angular/angular-touch.min.js +13 -0
- data/app/assets/javascripts/angular/angular.js +21954 -0
- data/app/assets/javascripts/angular/angular.min.js +215 -0
- data/app/assets/javascripts/angular-ui/angular-ui-router.js +3223 -0
- data/app/assets/javascripts/angular-ui/angular-ui-router.min.js +7 -0
- data/app/assets/javascripts/bootstrap/bootstrap.js +2114 -0
- data/app/assets/javascripts/bootstrap/bootstrap.min.js +6 -0
- data/app/assets/javascripts/ionic/ionic-angular.js +8317 -0
- data/app/assets/javascripts/ionic/ionic-angular.min.js +17 -0
- data/app/assets/javascripts/ionic/ionic.bundle.js +43371 -0
- data/app/assets/javascripts/ionic/ionic.bundle.min.js +341 -0
- data/app/assets/javascripts/ionic/ionic.js +7850 -0
- data/app/assets/javascripts/ionic/ionic.min.js +17 -0
- data/app/assets/javascripts/jquery-ui/jquery-ui.js +16375 -0
- data/app/assets/javascripts/jquery-ui/jquery-ui.min.js +13 -0
- data/app/assets/stylesheets/angular/angular-csp.css +24 -0
- data/app/assets/stylesheets/bootstrap/bootstrap-theme.css +442 -0
- data/app/assets/stylesheets/bootstrap/bootstrap-theme.min.css +5 -0
- data/app/assets/stylesheets/bootstrap/bootstrap.css +6203 -0
- data/app/assets/stylesheets/bootstrap/bootstrap.min.css +5 -0
- data/app/assets/stylesheets/ionic/ionic.css +7651 -0
- data/app/assets/stylesheets/ionic/ionic.min.css +18 -0
- data/lib/bitsnote-assets/version.rb +3 -0
- data/lib/bitsnote-assets.rb +101 -0
- data/lib/tasks/bitsnote-assets_tasks.rake +4 -0
- data/test/bitsnote_assets_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/main.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/assets/stylesheets/main.css +4 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/main_controller.rb +4 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/main_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +18 -0
- data/test/dummy/app/views/main/index.html.erb +2 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +82 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +9 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +16 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +587 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/controllers/main_controller_test.rb +9 -0
- data/test/dummy/test/helpers/main_helper_test.rb +4 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/25fca4643219052b0d5c66cf2c71f72f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/386e9196dd0f9efdce6f92ce93a6d107 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3f9170db678c4e1fdfa51752e5ec8e39 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/489af12e680adec109e506328fdc1368 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/50b9a4dd63d203039ce5b560ff2c33d7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/64f399e2eee4409012ebcc8ea938419a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6d98f39010827cad999334e769f03398 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/91056193051f3741ee35672c43f02cc2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/babe75ab5fc2c1762e161e6eaae5c30b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bf21891f6ce2dc468abfcb9bb75c6a1e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d34631840b4592db0d749b96ab27a620 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e36b8fcf5914a3a6bf058abfe7367b19 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/eb199fcd85e4107f4eb5d71939ea330c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ee10c355250f9cd7adb9593445676545 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f6eeb33602682bd6ff6d1f177f6b142d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/test_helper.rb +15 -0
- metadata +263 -0
@@ -0,0 +1,215 @@
|
|
1
|
+
/*
|
2
|
+
AngularJS v1.2.23
|
3
|
+
(c) 2010-2014 Google, Inc. http://angularjs.org
|
4
|
+
License: MIT
|
5
|
+
*/
|
6
|
+
(function(Q,X,t){'use strict';function x(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.23/"+(b?b+"/":"")+a;for(c=1;c<arguments.length;c++)a=a+(1==c?"?":"&")+"p"+(c-1)+"="+encodeURIComponent("function"==typeof arguments[c]?arguments[c].toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof arguments[c]?"undefined":"string"!=typeof arguments[c]?JSON.stringify(arguments[c]):arguments[c]);return Error(a)}}function fb(b){if(null==b||Fa(b))return!1;
|
7
|
+
var a=b.length;return 1===b.nodeType&&a?!0:z(b)||H(b)||0===a||"number"===typeof a&&0<a&&a-1 in b}function r(b,a,c){var d;if(b)if(P(b))for(d in b)"prototype"==d||("length"==d||"name"==d||b.hasOwnProperty&&!b.hasOwnProperty(d))||a.call(c,b[d],d);else if(H(b)||fb(b))for(d=0;d<b.length;d++)a.call(c,b[d],d);else if(b.forEach&&b.forEach!==r)b.forEach(a,c);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function Zb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function Tc(b,
|
8
|
+
a,c){for(var d=Zb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function $b(b){return function(a,c){b(c,a)}}function gb(){for(var b=la.length,a;b;){b--;a=la[b].charCodeAt(0);if(57==a)return la[b]="A",la.join("");if(90==a)la[b]="0";else return la[b]=String.fromCharCode(a+1),la.join("")}la.unshift("0");return la.join("")}function ac(b,a){a?b.$$hashKey=a:delete b.$$hashKey}function B(b){var a=b.$$hashKey;r(arguments,function(a){a!==b&&r(a,function(a,c){b[c]=a})});ac(b,a);return b}function Z(b){return parseInt(b,
|
9
|
+
10)}function bc(b,a){return B(new (B(function(){},{prototype:b})),a)}function y(){}function Ga(b){return b}function $(b){return function(){return b}}function D(b){return"undefined"===typeof b}function A(b){return"undefined"!==typeof b}function T(b){return null!=b&&"object"===typeof b}function z(b){return"string"===typeof b}function Ab(b){return"number"===typeof b}function sa(b){return"[object Date]"===ya.call(b)}function P(b){return"function"===typeof b}function hb(b){return"[object RegExp]"===ya.call(b)}
|
10
|
+
function Fa(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function Uc(b){return!(!b||!(b.nodeName||b.prop&&b.attr&&b.find))}function Vc(b,a,c){var d=[];r(b,function(b,f,g){d.push(a.call(c,b,f,g))});return d}function Qa(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 Ra(b,a){var c=Qa(b,a);0<=c&&b.splice(c,1);return a}function Ha(b,a,c,d){if(Fa(b)||b&&b.$evalAsync&&b.$watch)throw Sa("cpws");if(a){if(b===a)throw Sa("cpi");c=c||[];
|
11
|
+
d=d||[];if(T(b)){var e=Qa(c,b);if(-1!==e)return d[e];c.push(b);d.push(a)}if(H(b))for(var f=a.length=0;f<b.length;f++)e=Ha(b[f],null,c,d),T(b[f])&&(c.push(b[f]),d.push(e)),a.push(e);else{var g=a.$$hashKey;H(a)?a.length=0:r(a,function(b,c){delete a[c]});for(f in b)e=Ha(b[f],null,c,d),T(b[f])&&(c.push(b[f]),d.push(e)),a[f]=e;ac(a,g)}}else if(a=b)H(b)?a=Ha(b,[],c,d):sa(b)?a=new Date(b.getTime()):hb(b)?(a=RegExp(b.source,b.toString().match(/[^\/]*$/)[0]),a.lastIndex=b.lastIndex):T(b)&&(a=Ha(b,{},c,d));
|
12
|
+
return a}function ga(b,a){if(H(b)){a=a||[];for(var c=0;c<b.length;c++)a[c]=b[c]}else if(T(b))for(c in a=a||{},b)!ib.call(b,c)||"$"===c.charAt(0)&&"$"===c.charAt(1)||(a[c]=b[c]);return a||b}function za(b,a){if(b===a)return!0;if(null===b||null===a)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&"object"==c)if(H(b)){if(!H(a))return!1;if((c=b.length)==a.length){for(d=0;d<c;d++)if(!za(b[d],a[d]))return!1;return!0}}else{if(sa(b))return sa(a)?isNaN(b.getTime())&&isNaN(a.getTime())||b.getTime()===
|
13
|
+
a.getTime():!1;if(hb(b)&&hb(a))return b.toString()==a.toString();if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||Fa(b)||Fa(a)||H(a))return!1;c={};for(d in b)if("$"!==d.charAt(0)&&!P(b[d])){if(!za(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c.hasOwnProperty(d)&&"$"!==d.charAt(0)&&a[d]!==t&&!P(a[d]))return!1;return!0}return!1}function Bb(b,a){var c=2<arguments.length?Aa.call(arguments,2):[];return!P(a)||a instanceof RegExp?a:c.length?function(){return arguments.length?a.apply(b,c.concat(Aa.call(arguments,
|
14
|
+
0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}}function Wc(b,a){var c=a;"string"===typeof b&&"$"===b.charAt(0)?c=t:Fa(a)?c="$WINDOW":a&&X===a?c="$DOCUMENT":a&&(a.$evalAsync&&a.$watch)&&(c="$SCOPE");return c}function ta(b,a){return"undefined"===typeof b?t:JSON.stringify(b,Wc,a?" ":null)}function cc(b){return z(b)?JSON.parse(b):b}function Ta(b){"function"===typeof b?b=!0:b&&0!==b.length?(b=N(""+b),b=!("f"==b||"0"==b||"false"==b||"no"==b||"n"==b||"[]"==b)):b=!1;
|
15
|
+
return b}function ha(b){b=u(b).clone();try{b.empty()}catch(a){}var c=u("<div>").append(b).html();try{return 3===b[0].nodeType?N(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+N(b)})}catch(d){return N(c)}}function dc(b){try{return decodeURIComponent(b)}catch(a){}}function ec(b){var a={},c,d;r((b||"").split("&"),function(b){b&&(c=b.replace(/\+/g,"%20").split("="),d=dc(c[0]),A(d)&&(b=A(c[1])?dc(c[1]):!0,ib.call(a,d)?H(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function Cb(b){var a=
|
16
|
+
[];r(b,function(b,d){H(b)?r(b,function(b){a.push(Ba(d,!0)+(!0===b?"":"="+Ba(b,!0)))}):a.push(Ba(d,!0)+(!0===b?"":"="+Ba(b,!0)))});return a.length?a.join("&"):""}function jb(b){return Ba(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Ba(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function Xc(b,a){function c(a){a&&d.push(a)}var d=[b],e,f,g=["ng:app","ng-app","x-ng-app",
|
17
|
+
"data-ng-app"],k=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;r(g,function(a){g[a]=!0;c(X.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(r(b.querySelectorAll("."+a),c),r(b.querySelectorAll("."+a+"\\:"),c),r(b.querySelectorAll("["+a+"]"),c))});r(d,function(a){if(!e){var b=k.exec(" "+a.className+" ");b?(e=a,f=(b[2]||"").replace(/\s+/g,",")):r(a.attributes,function(b){!e&&g[b.name]&&(e=a,f=b.value)})}});e&&a(e,f?[f]:[])}function fc(b,a){var c=function(){b=u(b);if(b.injector()){var c=b[0]===X?
|
18
|
+
"document":ha(b);throw Sa("btstrpd",c.replace(/</,"<").replace(/>/,">"));}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");c=gc(a);c.invoke(["$rootScope","$rootElement","$compile","$injector","$animate",function(a,b,c,d,e){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(Q&&!d.test(Q.name))return c();Q.name=Q.name.replace(d,"");Ua.resumeBootstrap=function(b){r(b,function(b){a.push(b)});c()}}function kb(b,a){a=
|
19
|
+
a||"_";return b.replace(Yc,function(b,d){return(d?a:"")+b.toLowerCase()})}function Db(b,a,c){if(!b)throw Sa("areq",a||"?",c||"required");return b}function Va(b,a,c){c&&H(b)&&(b=b[b.length-1]);Db(P(b),a,"not a function, got "+(b&&"object"===typeof b?b.constructor.name||"Object":typeof b));return b}function Ca(b,a){if("hasOwnProperty"===b)throw Sa("badname",a);}function hc(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,f=a.length,g=0;g<f;g++)d=a[g],b&&(b=(e=b)[d]);return!c&&P(b)?Bb(e,b):b}function Eb(b){var a=
|
20
|
+
b[0];b=b[b.length-1];if(a===b)return u(a);var c=[a];do{a=a.nextSibling;if(!a)break;c.push(a)}while(a!==b);return u(c)}function Zc(b){var a=x("$injector"),c=x("ng");b=b.angular||(b.angular={});b.$$minErr=b.$$minErr||x;return b.module||(b.module=function(){var b={};return function(e,f,g){if("hasOwnProperty"===e)throw c("badname","module");f&&b.hasOwnProperty(e)&&(b[e]=null);return b[e]||(b[e]=function(){function b(a,d,e){return function(){c[e||"push"]([a,d,arguments]);return n}}if(!f)throw a("nomod",
|
21
|
+
e);var c=[],d=[],l=b("$injector","invoke"),n={_invokeQueue:c,_runBlocks:d,requires:f,name:e,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:b("$provide","value"),constant:b("$provide","constant","unshift"),animation:b("$animateProvider","register"),filter:b("$filterProvider","register"),controller:b("$controllerProvider","register"),directive:b("$compileProvider","directive"),config:l,run:function(a){d.push(a);return this}};g&&l(g);return n}())}}())}
|
22
|
+
function $c(b){B(b,{bootstrap:fc,copy:Ha,extend:B,equals:za,element:u,forEach:r,injector:gc,noop:y,bind:Bb,toJson:ta,fromJson:cc,identity:Ga,isUndefined:D,isDefined:A,isString:z,isFunction:P,isObject:T,isNumber:Ab,isElement:Uc,isArray:H,version:ad,isDate:sa,lowercase:N,uppercase:Ia,callbacks:{counter:0},$$minErr:x,$$csp:Wa});Xa=Zc(Q);try{Xa("ngLocale")}catch(a){Xa("ngLocale",[]).provider("$locale",bd)}Xa("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:cd});a.provider("$compile",
|
23
|
+
ic).directive({a:dd,input:jc,textarea:jc,form:ed,script:fd,select:gd,style:hd,option:id,ngBind:jd,ngBindHtml:kd,ngBindTemplate:ld,ngClass:md,ngClassEven:nd,ngClassOdd:od,ngCloak:pd,ngController:qd,ngForm:rd,ngHide:sd,ngIf:td,ngInclude:ud,ngInit:vd,ngNonBindable:wd,ngPluralize:xd,ngRepeat:yd,ngShow:zd,ngStyle:Ad,ngSwitch:Bd,ngSwitchWhen:Cd,ngSwitchDefault:Dd,ngOptions:Ed,ngTransclude:Fd,ngModel:Gd,ngList:Hd,ngChange:Id,required:kc,ngRequired:kc,ngValue:Jd}).directive({ngInclude:Kd}).directive(Fb).directive(lc);
|
24
|
+
a.provider({$anchorScroll:Ld,$animate:Md,$browser:Nd,$cacheFactory:Od,$controller:Pd,$document:Qd,$exceptionHandler:Rd,$filter:mc,$interpolate:Sd,$interval:Td,$http:Ud,$httpBackend:Vd,$location:Wd,$log:Xd,$parse:Yd,$rootScope:Zd,$q:$d,$sce:ae,$sceDelegate:be,$sniffer:ce,$templateCache:de,$timeout:ee,$window:fe,$$rAF:ge,$$asyncCallback:he})}])}function Ya(b){return b.replace(ie,function(a,b,d,e){return e?d.toUpperCase():d}).replace(je,"Moz$1")}function Gb(b,a,c,d){function e(b){var e=c&&b?[this.filter(b)]:
|
25
|
+
[this],m=a,h,l,n,p,q,s;if(!d||null!=b)for(;e.length;)for(h=e.shift(),l=0,n=h.length;l<n;l++)for(p=u(h[l]),m?p.triggerHandler("$destroy"):m=!m,q=0,p=(s=p.children()).length;q<p;q++)e.push(Da(s[q]));return f.apply(this,arguments)}var f=Da.fn[b],f=f.$original||f;e.$original=f;Da.fn[b]=e}function S(b){if(b instanceof S)return b;z(b)&&(b=aa(b));if(!(this instanceof S)){if(z(b)&&"<"!=b.charAt(0))throw Hb("nosel");return new S(b)}if(z(b)){var a=b;b=X;var c;if(c=ke.exec(a))b=[b.createElement(c[1])];else{var d=
|
26
|
+
b,e;b=d.createDocumentFragment();c=[];if(Ib.test(a)){d=b.appendChild(d.createElement("div"));e=(le.exec(a)||["",""])[1].toLowerCase();e=ba[e]||ba._default;d.innerHTML="<div> </div>"+e[1]+a.replace(me,"<$1></$2>")+e[2];d.removeChild(d.firstChild);for(a=e[0];a--;)d=d.lastChild;a=0;for(e=d.childNodes.length;a<e;++a)c.push(d.childNodes[a]);d=b.firstChild;d.textContent=""}else c.push(d.createTextNode(a));b.textContent="";b.innerHTML="";b=c}Jb(this,b);u(X.createDocumentFragment()).append(this)}else Jb(this,
|
27
|
+
b)}function Kb(b){return b.cloneNode(!0)}function Ja(b){Lb(b);var a=0;for(b=b.childNodes||[];a<b.length;a++)Ja(b[a])}function nc(b,a,c,d){if(A(d))throw Hb("offargs");var e=ma(b,"events");ma(b,"handle")&&(D(a)?r(e,function(a,c){Za(b,c,a);delete e[c]}):r(a.split(" "),function(a){D(c)?(Za(b,a,e[a]),delete e[a]):Ra(e[a]||[],c)}))}function Lb(b,a){var c=b.ng339,d=$a[c];d&&(a?delete $a[c].data[a]:(d.handle&&(d.events.$destroy&&d.handle({},"$destroy"),nc(b)),delete $a[c],b.ng339=t))}function ma(b,a,c){var d=
|
28
|
+
b.ng339,d=$a[d||-1];if(A(c))d||(b.ng339=d=++ne,d=$a[d]={}),d[a]=c;else return d&&d[a]}function Mb(b,a,c){var d=ma(b,"data"),e=A(c),f=!e&&A(a),g=f&&!T(a);d||g||ma(b,"data",d={});if(e)d[a]=c;else if(f){if(g)return d&&d[a];B(d,a)}else return d}function Nb(b,a){return b.getAttribute?-1<(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" "):!1}function lb(b,a){a&&b.setAttribute&&r(a.split(" "),function(a){b.setAttribute("class",aa((" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g,
|
29
|
+
" ").replace(" "+aa(a)+" "," ")))})}function mb(b,a){if(a&&b.setAttribute){var c=(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");r(a.split(" "),function(a){a=aa(a);-1===c.indexOf(" "+a+" ")&&(c+=a+" ")});b.setAttribute("class",aa(c))}}function Jb(b,a){if(a){a=a.nodeName||!A(a.length)||Fa(a)?[a]:a;for(var c=0;c<a.length;c++)b.push(a[c])}}function oc(b,a){return nb(b,"$"+(a||"ngController")+"Controller")}function nb(b,a,c){9==b.nodeType&&(b=b.documentElement);for(a=H(a)?a:[a];b;){for(var d=
|
30
|
+
0,e=a.length;d<e;d++)if((c=u.data(b,a[d]))!==t)return c;b=b.parentNode||11===b.nodeType&&b.host}}function pc(b){for(var a=0,c=b.childNodes;a<c.length;a++)Ja(c[a]);for(;b.firstChild;)b.removeChild(b.firstChild)}function qc(b,a){var c=ob[a.toLowerCase()];return c&&rc[b.nodeName]&&c}function oe(b,a){var c=function(c,e){c.preventDefault||(c.preventDefault=function(){c.returnValue=!1});c.stopPropagation||(c.stopPropagation=function(){c.cancelBubble=!0});c.target||(c.target=c.srcElement||X);if(D(c.defaultPrevented)){var f=
|
31
|
+
c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;f.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented||!1===c.returnValue};var g=ga(a[e||c.type]||[]);r(g,function(a){a.call(b,c)});8>=R?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function Ka(b,a){var c=typeof b,d;"function"==c||"object"==c&&null!==b?"function"==typeof(d=
|
32
|
+
b.$$hashKey)?d=b.$$hashKey():d===t&&(d=b.$$hashKey=(a||gb)()):d=b;return c+":"+d}function ab(b,a){if(a){var c=0;this.nextUid=function(){return++c}}r(b,this.put,this)}function sc(b){var a,c;"function"===typeof b?(a=b.$inject)||(a=[],b.length&&(c=b.toString().replace(pe,""),c=c.match(qe),r(c[1].split(re),function(b){b.replace(se,function(b,c,d){a.push(d)})})),b.$inject=a):H(b)?(c=b.length-1,Va(b[c],"fn"),a=b.slice(0,c)):Va(b,"fn",!0);return a}function gc(b){function a(a){return function(b,c){if(T(b))r(b,
|
33
|
+
$b(a));else return a(b,c)}}function c(a,b){Ca(a,"service");if(P(b)||H(b))b=n.instantiate(b);if(!b.$get)throw bb("pget",a);return l[a+k]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[],c,d,f,k;r(a,function(a){if(!h.get(a)){h.put(a,!0);try{if(z(a))for(c=Xa(a),b=b.concat(e(c.requires)).concat(c._runBlocks),d=c._invokeQueue,f=0,k=d.length;f<k;f++){var g=d[f],m=n.get(g[0]);m[g[1]].apply(m,g[2])}else P(a)?b.push(n.invoke(a)):H(a)?b.push(n.invoke(a)):Va(a,"module")}catch(l){throw H(a)&&(a=
|
34
|
+
a[a.length-1]),l.message&&(l.stack&&-1==l.stack.indexOf(l.message))&&(l=l.message+"\n"+l.stack),bb("modulerr",a,l.stack||l.message||l);}}});return b}function f(a,b){function c(d){if(a.hasOwnProperty(d)){if(a[d]===g)throw bb("cdep",d+" <- "+m.join(" <- "));return a[d]}try{return m.unshift(d),a[d]=g,a[d]=b(d)}catch(e){throw a[d]===g&&delete a[d],e;}finally{m.shift()}}function d(a,b,e){var f=[],k=sc(a),g,m,h;m=0;for(g=k.length;m<g;m++){h=k[m];if("string"!==typeof h)throw bb("itkn",h);f.push(e&&e.hasOwnProperty(h)?
|
35
|
+
e[h]:c(h))}H(a)&&(a=a[g]);return a.apply(b,f)}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(H(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return T(e)||P(e)?e:c},get:c,annotate:sc,has:function(b){return l.hasOwnProperty(b+k)||a.hasOwnProperty(b)}}}var g={},k="Provider",m=[],h=new ab([],!0),l={$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,$(b))}),constant:a(function(a,
|
36
|
+
b){Ca(a,"constant");l[a]=b;p[a]=b}),decorator:function(a,b){var c=n.get(a+k),d=c.$get;c.$get=function(){var a=q.invoke(d,c);return q.invoke(b,null,{$delegate:a})}}}},n=l.$injector=f(l,function(){throw bb("unpr",m.join(" <- "));}),p={},q=p.$injector=f(p,function(a){a=n.get(a+k);return q.invoke(a.$get,a)});r(e(b),function(a){q.invoke(a||y)});return q}function Ld(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;
|
37
|
+
r(a,function(a){b||"a"!==N(a.nodeName)||(b=a)});return b}function f(){var b=c.hash(),d;b?(d=g.getElementById(b))?d.scrollIntoView():(d=e(g.getElementsByName(b)))?d.scrollIntoView():"top"===b&&a.scrollTo(0,0):a.scrollTo(0,0)}var g=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(f)});return f}]}function he(){this.$get=["$$rAF","$timeout",function(b,a){return b.supported?function(a){return b(a)}:function(b){return a(b,0,!1)}}]}function te(b,a,c,d){function e(a){try{a.apply(null,
|
38
|
+
Aa.call(arguments,1))}finally{if(s--,0===s)for(;L.length;)try{L.pop()()}catch(b){c.error(b)}}}function f(a,b){(function ca(){r(v,function(a){a()});C=b(ca,a)})()}function g(){w=null;O!=k.url()&&(O=k.url(),r(da,function(a){a(k.url())}))}var k=this,m=a[0],h=b.location,l=b.history,n=b.setTimeout,p=b.clearTimeout,q={};k.isMock=!1;var s=0,L=[];k.$$completeOutstandingRequest=e;k.$$incOutstandingRequestCount=function(){s++};k.notifyWhenNoOutstandingRequests=function(a){r(v,function(a){a()});0===s?a():L.push(a)};
|
39
|
+
var v=[],C;k.addPollFn=function(a){D(C)&&f(100,n);v.push(a);return a};var O=h.href,I=a.find("base"),w=null;k.url=function(a,c){h!==b.location&&(h=b.location);l!==b.history&&(l=b.history);if(a){if(O!=a)return O=a,d.history?c?l.replaceState(null,"",a):(l.pushState(null,"",a),I.attr("href",I.attr("href"))):(w=a,c?h.replace(a):h.href=a),k}else return w||h.href.replace(/%27/g,"'")};var da=[],K=!1;k.onUrlChange=function(a){if(!K){if(d.history)u(b).on("popstate",g);if(d.hashchange)u(b).on("hashchange",g);
|
40
|
+
else k.addPollFn(g);K=!0}da.push(a);return a};k.baseHref=function(){var a=I.attr("href");return a?a.replace(/^(https?\:)?\/\/[^\/]*/,""):""};var W={},ea="",J=k.baseHref();k.cookies=function(a,b){var d,e,f,k;if(a)b===t?m.cookie=escape(a)+"=;path="+J+";expires=Thu, 01 Jan 1970 00:00:00 GMT":z(b)&&(d=(m.cookie=escape(a)+"="+escape(b)+";path="+J).length+1,4096<d&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"));else{if(m.cookie!==ea)for(ea=m.cookie,
|
41
|
+
d=ea.split("; "),W={},f=0;f<d.length;f++)e=d[f],k=e.indexOf("="),0<k&&(a=unescape(e.substring(0,k)),W[a]===t&&(W[a]=unescape(e.substring(k+1))));return W}};k.defer=function(a,b){var c;s++;c=n(function(){delete q[c];e(a)},b||0);q[c]=!0;return c};k.defer.cancel=function(a){return q[a]?(delete q[a],p(a),e(y),!0):!1}}function Nd(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new te(b,d,a,c)}]}function Od(){this.$get=function(){function b(b,d){function e(a){a!=n&&(p?p==a&&
|
42
|
+
(p=a.n):p=a,f(a.n,a.p),f(a,n),n=a,n.n=null)}function f(a,b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(b in a)throw x("$cacheFactory")("iid",b);var g=0,k=B({},d,{id:b}),m={},h=d&&d.capacity||Number.MAX_VALUE,l={},n=null,p=null;return a[b]={put:function(a,b){if(h<Number.MAX_VALUE){var c=l[a]||(l[a]={key:a});e(c)}if(!D(b))return a in m||g++,m[a]=b,g>h&&this.remove(p.key),b},get:function(a){if(h<Number.MAX_VALUE){var b=l[a];if(!b)return;e(b)}return m[a]},remove:function(a){if(h<Number.MAX_VALUE){var b=l[a];if(!b)return;
|
43
|
+
b==n&&(n=b.p);b==p&&(p=b.n);f(b.n,b.p);delete l[a]}delete m[a];g--},removeAll:function(){m={};g=0;l={};n=p=null},destroy:function(){l=k=m=null;delete a[b]},info:function(){return B({},k,{size:g})}}}var a={};b.info=function(){var b={};r(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}function de(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function ic(b,a){var c={},d="Directive",e=/^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/,f=/(([\d\w_\-]+)(?:\:([^;]+))?;?)/,
|
44
|
+
g=/^(on[a-z]+|formaction)$/;this.directive=function m(a,e){Ca(a,"directive");z(a)?(Db(e,"directiveFactory"),c.hasOwnProperty(a)||(c[a]=[],b.factory(a+d,["$injector","$exceptionHandler",function(b,d){var e=[];r(c[a],function(c,f){try{var g=b.invoke(c);P(g)?g={compile:$(g)}:!g.compile&&g.link&&(g.compile=$(g.link));g.priority=g.priority||0;g.index=f;g.name=g.name||a;g.require=g.require||g.controller&&g.name;g.restrict=g.restrict||"A";e.push(g)}catch(m){d(m)}});return e}])),c[a].push(e)):r(a,$b(m));
|
45
|
+
return this};this.aHrefSanitizationWhitelist=function(b){return A(b)?(a.aHrefSanitizationWhitelist(b),this):a.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(b){return A(b)?(a.imgSrcSanitizationWhitelist(b),this):a.imgSrcSanitizationWhitelist()};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(a,b,l,n,p,q,s,L,v,C,O,I){function w(a,b,c,d,e){a instanceof
|
46
|
+
u||(a=u(a));r(a,function(b,c){3==b.nodeType&&b.nodeValue.match(/\S+/)&&(a[c]=u(b).wrap("<span></span>").parent()[0])});var f=K(a,b,a,c,d,e);da(a,"ng-scope");return function(b,c,d,e){Db(b,"scope");var g=c?La.clone.call(a):a;r(d,function(a,b){g.data("$"+b+"Controller",a)});d=0;for(var m=g.length;d<m;d++){var h=g[d].nodeType;1!==h&&9!==h||g.eq(d).data("$scope",b)}c&&c(g,b);f&&f(b,g,g,e);return g}}function da(a,b){try{a.addClass(b)}catch(c){}}function K(a,b,c,d,e,f){function g(a,c,d,e){var f,h,l,q,n,
|
47
|
+
p,s;f=c.length;var M=Array(f);for(q=0;q<f;q++)M[q]=c[q];p=q=0;for(n=m.length;q<n;p++)h=M[p],c=m[q++],f=m[q++],c?(c.scope?(l=a.$new(),u.data(h,"$scope",l)):l=a,s=c.transcludeOnThisElement?W(a,c.transclude,e):!c.templateOnThisElement&&e?e:!e&&b?W(a,b):null,c(f,l,h,d,s)):f&&f(a,h.childNodes,t,e)}for(var m=[],h,l,q,n,p=0;p<a.length;p++)h=new Ob,l=ea(a[p],[],h,0===p?d:t,e),(f=l.length?F(l,a[p],h,b,c,null,[],[],f):null)&&f.scope&&da(h.$$element,"ng-scope"),h=f&&f.terminal||!(q=a[p].childNodes)||!q.length?
|
48
|
+
null:K(q,f?(f.transcludeOnThisElement||!f.templateOnThisElement)&&f.transclude:b),m.push(f,h),n=n||f||h,f=null;return n?g:null}function W(a,b,c){return function(d,e,f){var g=!1;d||(d=a.$new(),g=d.$$transcluded=!0);e=b(d,e,f,c);if(g)e.on("$destroy",function(){d.$destroy()});return e}}function ea(a,b,c,d,g){var h=c.$attr,m;switch(a.nodeType){case 1:ca(b,na(Ma(a).toLowerCase()),"E",d,g);for(var l,q,n,p=a.attributes,s=0,L=p&&p.length;s<L;s++){var C=!1,O=!1;l=p[s];if(!R||8<=R||l.specified){m=l.name;q=
|
49
|
+
aa(l.value);l=na(m);if(n=V.test(l))m=kb(l.substr(6),"-");var v=l.replace(/(Start|End)$/,"");l===v+"Start"&&(C=m,O=m.substr(0,m.length-5)+"end",m=m.substr(0,m.length-6));l=na(m.toLowerCase());h[l]=m;if(n||!c.hasOwnProperty(l))c[l]=q,qc(a,l)&&(c[l]=!0);Q(a,b,q,l);ca(b,l,"A",d,g,C,O)}}a=a.className;if(z(a)&&""!==a)for(;m=f.exec(a);)l=na(m[2]),ca(b,l,"C",d,g)&&(c[l]=aa(m[3])),a=a.substr(m.index+m[0].length);break;case 3:x(b,a.nodeValue);break;case 8:try{if(m=e.exec(a.nodeValue))l=na(m[1]),ca(b,l,"M",
|
50
|
+
d,g)&&(c[l]=aa(m[2]))}catch(w){}}b.sort(D);return b}function J(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ia("uterdir",b,c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return u(d)}function E(a,b,c){return function(d,e,f,g,m){e=J(e[0],b,c);return a(d,e,f,g,m)}}function F(a,c,d,e,f,g,m,n,p){function L(a,b,c,d){if(a){c&&(a=E(a,c,d));a.require=G.require;a.directiveName=oa;if(K===G||G.$$isolateScope)a=
|
51
|
+
tc(a,{isolateScope:!0});m.push(a)}if(b){c&&(b=E(b,c,d));b.require=G.require;b.directiveName=oa;if(K===G||G.$$isolateScope)b=tc(b,{isolateScope:!0});n.push(b)}}function C(a,b,c,d){var e,f="data",g=!1;if(z(b)){for(;"^"==(e=b.charAt(0))||"?"==e;)b=b.substr(1),"^"==e&&(f="inheritedData"),g=g||"?"==e;e=null;d&&"data"===f&&(e=d[b]);e=e||c[f]("$"+b+"Controller");if(!e&&!g)throw ia("ctreq",b,a);}else H(b)&&(e=[],r(b,function(b){e.push(C(a,b,c,d))}));return e}function O(a,e,f,g,p){function L(a,b){var c;2>
|
52
|
+
arguments.length&&(b=a,a=t);Ea&&(c=ea);return p(a,b,c)}var v,M,w,I,E,J,ea={},qb;v=c===f?d:ga(d,new Ob(u(f),d.$attr));M=v.$$element;if(K){var Na=/^\s*([@=&])(\??)\s*(\w*)\s*$/;J=e.$new(!0);!F||F!==K&&F!==K.$$originalDirective?M.data("$isolateScopeNoTemplate",J):M.data("$isolateScope",J);da(M,"ng-isolate-scope");r(K.scope,function(a,c){var d=a.match(Na)||[],f=d[3]||c,g="?"==d[2],d=d[1],m,l,n,p;J.$$isolateBindings[c]=d+f;switch(d){case "@":v.$observe(f,function(a){J[c]=a});v.$$observers[f].$$scope=e;
|
53
|
+
v[f]&&(J[c]=b(v[f])(e));break;case "=":if(g&&!v[f])break;l=q(v[f]);p=l.literal?za:function(a,b){return a===b||a!==a&&b!==b};n=l.assign||function(){m=J[c]=l(e);throw ia("nonassign",v[f],K.name);};m=J[c]=l(e);J.$watch(function(){var a=l(e);p(a,J[c])||(p(a,m)?n(e,a=J[c]):J[c]=a);return m=a},null,l.literal);break;case "&":l=q(v[f]);J[c]=function(a){return l(e,a)};break;default:throw ia("iscp",K.name,c,a);}})}qb=p&&L;W&&r(W,function(a){var b={$scope:a===K||a.$$isolateScope?J:e,$element:M,$attrs:v,$transclude:qb},
|
54
|
+
c;E=a.controller;"@"==E&&(E=v[a.name]);c=s(E,b);ea[a.name]=c;Ea||M.data("$"+a.name+"Controller",c);a.controllerAs&&(b.$scope[a.controllerAs]=c)});g=0;for(w=m.length;g<w;g++)try{I=m[g],I(I.isolateScope?J:e,M,v,I.require&&C(I.directiveName,I.require,M,ea),qb)}catch(ca){l(ca,ha(M))}g=e;K&&(K.template||null===K.templateUrl)&&(g=J);a&&a(g,f.childNodes,t,p);for(g=n.length-1;0<=g;g--)try{I=n[g],I(I.isolateScope?J:e,M,v,I.require&&C(I.directiveName,I.require,M,ea),qb)}catch(pb){l(pb,ha(M))}}p=p||{};for(var v=
|
55
|
+
-Number.MAX_VALUE,I,W=p.controllerDirectives,K=p.newIsolateScopeDirective,F=p.templateDirective,ca=p.nonTlbTranscludeDirective,D=!1,B=!1,Ea=p.hasElementTranscludeDirective,x=d.$$element=u(c),G,oa,U,S=e,R,Q=0,pa=a.length;Q<pa;Q++){G=a[Q];var V=G.$$start,Y=G.$$end;V&&(x=J(c,V,Y));U=t;if(v>G.priority)break;if(U=G.scope)I=I||G,G.templateUrl||(N("new/isolated scope",K,G,x),T(U)&&(K=G));oa=G.name;!G.templateUrl&&G.controller&&(U=G.controller,W=W||{},N("'"+oa+"' controller",W[oa],G,x),W[oa]=G);if(U=G.transclude)D=
|
56
|
+
!0,G.$$tlb||(N("transclusion",ca,G,x),ca=G),"element"==U?(Ea=!0,v=G.priority,U=x,x=d.$$element=u(X.createComment(" "+oa+": "+d[oa]+" ")),c=x[0],Na(f,Aa.call(U,0),c),S=w(U,e,v,g&&g.name,{nonTlbTranscludeDirective:ca})):(U=u(Kb(c)).contents(),x.empty(),S=w(U,e));if(G.template)if(B=!0,N("template",F,G,x),F=G,U=P(G.template)?G.template(x,d):G.template,U=Z(U),G.replace){g=G;U=Ib.test(U)?u(aa(U)):[];c=U[0];if(1!=U.length||1!==c.nodeType)throw ia("tplrt",oa,"");Na(f,x,c);pa={$attr:{}};U=ea(c,[],pa);var $=
|
57
|
+
a.splice(Q+1,a.length-(Q+1));K&&pb(U);a=a.concat(U).concat($);A(d,pa);pa=a.length}else x.html(U);if(G.templateUrl)B=!0,N("template",F,G,x),F=G,G.replace&&(g=G),O=y(a.splice(Q,a.length-Q),x,d,f,D&&S,m,n,{controllerDirectives:W,newIsolateScopeDirective:K,templateDirective:F,nonTlbTranscludeDirective:ca}),pa=a.length;else if(G.compile)try{R=G.compile(x,d,S),P(R)?L(null,R,V,Y):R&&L(R.pre,R.post,V,Y)}catch(ba){l(ba,ha(x))}G.terminal&&(O.terminal=!0,v=Math.max(v,G.priority))}O.scope=I&&!0===I.scope;O.transcludeOnThisElement=
|
58
|
+
D;O.templateOnThisElement=B;O.transclude=S;p.hasElementTranscludeDirective=Ea;return O}function pb(a){for(var b=0,c=a.length;b<c;b++)a[b]=bc(a[b],{$$isolateScope:!0})}function ca(b,e,f,g,h,q,n){if(e===h)return null;h=null;if(c.hasOwnProperty(e)){var p;e=a.get(e+d);for(var s=0,v=e.length;s<v;s++)try{p=e[s],(g===t||g>p.priority)&&-1!=p.restrict.indexOf(f)&&(q&&(p=bc(p,{$$start:q,$$end:n})),b.push(p),h=p)}catch(L){l(L)}}return h}function A(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;r(a,function(d,e){"$"!=
|
59
|
+
e.charAt(0)&&(b[e]&&b[e]!==d&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});r(b,function(b,f){"class"==f?(da(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==f?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==f.charAt(0)||a.hasOwnProperty(f)||(a[f]=b,d[f]=c[f])})}function y(a,b,c,d,e,f,g,m){var h=[],l,q,s=b[0],v=a.shift(),L=B({},v,{templateUrl:null,transclude:null,replace:null,$$originalDirective:v}),O=P(v.templateUrl)?v.templateUrl(b,c):v.templateUrl;
|
60
|
+
b.empty();n.get(C.getTrustedResourceUrl(O),{cache:p}).success(function(n){var p,C;n=Z(n);if(v.replace){n=Ib.test(n)?u(aa(n)):[];p=n[0];if(1!=n.length||1!==p.nodeType)throw ia("tplrt",v.name,O);n={$attr:{}};Na(d,b,p);var w=ea(p,[],n);T(v.scope)&&pb(w);a=w.concat(a);A(c,n)}else p=s,b.html(n);a.unshift(L);l=F(a,p,c,e,b,v,f,g,m);r(d,function(a,c){a==p&&(d[c]=b[0])});for(q=K(b[0].childNodes,e);h.length;){n=h.shift();C=h.shift();var I=h.shift(),E=h.shift(),w=b[0];if(C!==s){var J=C.className;m.hasElementTranscludeDirective&&
|
61
|
+
v.replace||(w=Kb(p));Na(I,u(C),w);da(u(w),J)}C=l.transcludeOnThisElement?W(n,l.transclude,E):E;l(q,n,w,d,C)}h=null}).error(function(a,b,c,d){throw ia("tpload",d.url);});return function(a,b,c,d,e){a=e;h?(h.push(b),h.push(c),h.push(d),h.push(a)):(l.transcludeOnThisElement&&(a=W(b,l.transclude,e)),l(q,b,c,d,a))}}function D(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function N(a,b,c,d){if(b)throw ia("multidir",b.name,c.name,a,ha(d));}function x(a,
|
62
|
+
c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){var b=a.parent().length;b&&da(a.parent(),"ng-binding");return function(a,c){var e=c.parent(),f=e.data("$binding")||[];f.push(d);e.data("$binding",f);b||da(e,"ng-binding");a.$watch(d,function(a){c[0].nodeValue=a})}}})}function S(a,b){if("srcdoc"==b)return C.HTML;var c=Ma(a);if("xlinkHref"==b||"FORM"==c&&"action"==b||"IMG"!=c&&("src"==b||"ngSrc"==b))return C.RESOURCE_URL}function Q(a,c,d,e){var f=b(d,!0);if(f){if("multiple"===e&&"SELECT"===
|
63
|
+
Ma(a))throw ia("selmulti",ha(a));c.push({priority:100,compile:function(){return{pre:function(c,d,m){d=m.$$observers||(m.$$observers={});if(g.test(e))throw ia("nodomevents");if(f=b(m[e],!0,S(a,e)))m[e]=f(c),(d[e]||(d[e]=[])).$$inter=!0,(m.$$observers&&m.$$observers[e].$$scope||c).$watch(f,function(a,b){"class"===e&&a!=b?m.$updateClass(a,b):m.$set(e,a)})}}}})}}function Na(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,m;if(a)for(g=0,m=a.length;g<m;g++)if(a[g]==d){a[g++]=c;m=g+e-1;for(var h=a.length;g<
|
64
|
+
h;g++,m++)m<h?a[g]=a[m]:delete a[g];a.length-=e-1;break}f&&f.replaceChild(c,d);a=X.createDocumentFragment();a.appendChild(d);c[u.expando]=d[u.expando];d=1;for(e=b.length;d<e;d++)f=b[d],u(f).remove(),a.appendChild(f),delete b[d];b[0]=c;b.length=1}function tc(a,b){return B(function(){return a.apply(null,arguments)},a,b)}var Ob=function(a,b){this.$$element=a;this.$attr=b||{}};Ob.prototype={$normalize:na,$addClass:function(a){a&&0<a.length&&O.addClass(this.$$element,a)},$removeClass:function(a){a&&0<
|
65
|
+
a.length&&O.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=uc(a,b),d=uc(b,a);0===c.length?O.removeClass(this.$$element,d):0===d.length?O.addClass(this.$$element,c):O.setClass(this.$$element,c,d)},$set:function(a,b,c,d){var e=qc(this.$$element[0],a);e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=kb(a,"-"));e=Ma(this.$$element);if("A"===e&&"href"===a||"IMG"===e&&"src"===a)this[a]=b=I(b,"src"===a);!1!==c&&(null===b||b===t?this.$$element.removeAttr(d):
|
66
|
+
this.$$element.attr(d,b));(c=this.$$observers)&&r(c[a],function(a){try{a(b)}catch(c){l(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);L.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var pa=b.startSymbol(),Ea=b.endSymbol(),Z="{{"==pa||"}}"==Ea?Ga:function(a){return a.replace(/\{\{/g,pa).replace(/}}/g,Ea)},V=/^ngAttr[A-Z]/;return w}]}function na(b){return Ya(b.replace(ue,""))}function uc(b,a){var c="",d=b.split(/\s+/),e=a.split(/\s+/),
|
67
|
+
f=0;a:for(;f<d.length;f++){for(var g=d[f],k=0;k<e.length;k++)if(g==e[k])continue a;c+=(0<c.length?" ":"")+g}return c}function Pd(){var b={},a=/^(\S+)(\s+as\s+(\w+))?$/;this.register=function(a,d){Ca(a,"controller");T(a)?B(b,a):b[a]=d};this.$get=["$injector","$window",function(c,d){return function(e,f){var g,k,m;z(e)&&(g=e.match(a),k=g[1],m=g[3],e=b.hasOwnProperty(k)?b[k]:hc(f.$scope,k,!0)||hc(d,k,!0),Va(e,k,!0));g=c.instantiate(e,f);if(m){if(!f||"object"!==typeof f.$scope)throw x("$controller")("noscp",
|
68
|
+
k||e.name,m);f.$scope[m]=g}return g}}]}function Qd(){this.$get=["$window",function(b){return u(b.document)}]}function Rd(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function vc(b){var a={},c,d,e;if(!b)return a;r(b.split("\n"),function(b){e=b.indexOf(":");c=N(aa(b.substr(0,e)));d=aa(b.substr(e+1));c&&(a[c]=a[c]?a[c]+", "+d:d)});return a}function wc(b){var a=T(b)?b:t;return function(c){a||(a=vc(b));return c?a[N(c)]||null:a}}function xc(b,a,c){if(P(c))return c(b,
|
69
|
+
a);r(c,function(c){b=c(b,a)});return b}function Ud(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d={"Content-Type":"application/json;charset=utf-8"},e=this.defaults={transformResponse:[function(d){z(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=cc(d)));return d}],transformRequest:[function(a){return T(a)&&"[object File]"!==ya.call(a)&&"[object Blob]"!==ya.call(a)?ta(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ga(d),put:ga(d),patch:ga(d)},xsrfCookieName:"XSRF-TOKEN",
|
70
|
+
xsrfHeaderName:"X-XSRF-TOKEN"},f=this.interceptors=[],g=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,d,n,p){function q(a){function b(a){var d=B({},a,{data:xc(a.data,a.headers,c.transformResponse)});return 200<=a.status&&300>a.status?d:n.reject(d)}var c={method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse},d=function(a){var b=e.headers,c=B({},a.headers),d,f,b=B({},b.common,b[N(a.method)]);
|
71
|
+
a:for(d in b){a=N(d);for(f in c)if(N(f)===a)continue a;c[d]=b[d]}(function(a){var b;r(a,function(c,d){P(c)&&(b=c(),null!=b?a[d]=b:delete a[d])})})(c);return c}(a);B(c,a);c.headers=d;c.method=Ia(c.method);var f=[function(a){d=a.headers;var c=xc(a.data,wc(d),a.transformRequest);D(c)&&r(d,function(a,b){"content-type"===N(b)&&delete d[b]});D(a.withCredentials)&&!D(e.withCredentials)&&(a.withCredentials=e.withCredentials);return s(a,c,d).then(b,b)},t],g=n.when(c);for(r(C,function(a){(a.request||a.requestError)&&
|
72
|
+
f.unshift(a.request,a.requestError);(a.response||a.responseError)&&f.push(a.response,a.responseError)});f.length;){a=f.shift();var m=f.shift(),g=g.then(a,m)}g.success=function(a){g.then(function(b){a(b.data,b.status,b.headers,c)});return g};g.error=function(a){g.then(null,function(b){a(b.data,b.status,b.headers,c)});return g};return g}function s(c,f,g){function h(a,b,c,e){E&&(200<=a&&300>a?E.put(u,[a,b,vc(c),e]):E.remove(u));p(b,a,c,e);d.$$phase||d.$apply()}function p(a,b,d,e){b=Math.max(b,0);(200<=
|
73
|
+
b&&300>b?C.resolve:C.reject)({data:a,status:b,headers:wc(d),config:c,statusText:e})}function s(){var a=Qa(q.pendingRequests,c);-1!==a&&q.pendingRequests.splice(a,1)}var C=n.defer(),r=C.promise,E,F,u=L(c.url,c.params);q.pendingRequests.push(c);r.then(s,s);!c.cache&&!e.cache||(!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method)||(E=T(c.cache)?c.cache:T(e.cache)?e.cache:v);if(E)if(F=E.get(u),A(F)){if(F&&P(F.then))return F.then(s,s),F;H(F)?p(F[1],F[0],ga(F[2]),F[3]):p(F,200,{},"OK")}else E.put(u,r);D(F)&&
|
74
|
+
((F=Pb(c.url)?b.cookies()[c.xsrfCookieName||e.xsrfCookieName]:t)&&(g[c.xsrfHeaderName||e.xsrfHeaderName]=F),a(c.method,u,f,h,g,c.timeout,c.withCredentials,c.responseType));return r}function L(a,b){if(!b)return a;var c=[];Tc(b,function(a,b){null===a||D(a)||(H(a)||(a=[a]),r(a,function(a){T(a)&&(sa(a)?a=a.toISOString():T(a)&&(a=ta(a)));c.push(Ba(b)+"="+Ba(a))}))});0<c.length&&(a+=(-1==a.indexOf("?")?"?":"&")+c.join("&"));return a}var v=c("$http"),C=[];r(f,function(a){C.unshift(z(a)?p.get(a):p.invoke(a))});
|
75
|
+
r(g,function(a,b){var c=z(a)?p.get(a):p.invoke(a);C.splice(b,0,{response:function(a){return c(n.when(a))},responseError:function(a){return c(n.reject(a))}})});q.pendingRequests=[];(function(a){r(arguments,function(a){q[a]=function(b,c){return q(B(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){r(arguments,function(a){q[a]=function(b,c,d){return q(B(d||{},{method:a,url:b,data:c}))}})})("post","put");q.defaults=e;return q}]}function ve(b){if(8>=R&&(!b.match(/^(get|post|head|put|delete|options)$/i)||
|
76
|
+
!Q.XMLHttpRequest))return new Q.ActiveXObject("Microsoft.XMLHTTP");if(Q.XMLHttpRequest)return new Q.XMLHttpRequest;throw x("$httpBackend")("noxhr");}function Vd(){this.$get=["$browser","$window","$document",function(b,a,c){return we(b,ve,b.defer,a.angular.callbacks,c[0])}]}function we(b,a,c,d,e){function f(a,b,c){var f=e.createElement("script"),g=null;f.type="text/javascript";f.src=a;f.async=!0;g=function(a){Za(f,"load",g);Za(f,"error",g);e.body.removeChild(f);f=null;var k=-1,s="unknown";a&&("load"!==
|
77
|
+
a.type||d[b].called||(a={type:"error"}),s=a.type,k="error"===a.type?404:200);c&&c(k,s)};rb(f,"load",g);rb(f,"error",g);8>=R&&(f.onreadystatechange=function(){z(f.readyState)&&/loaded|complete/.test(f.readyState)&&(f.onreadystatechange=null,g({type:"load"}))});e.body.appendChild(f);return g}var g=-1;return function(e,m,h,l,n,p,q,s){function L(){C=g;I&&I();w&&w.abort()}function v(a,d,e,f,g){K&&c.cancel(K);I=w=null;0===d&&(d=e?200:"file"==ua(m).protocol?404:0);a(1223===d?204:d,e,f,g||"");b.$$completeOutstandingRequest(y)}
|
78
|
+
var C;b.$$incOutstandingRequestCount();m=m||b.url();if("jsonp"==N(e)){var O="_"+(d.counter++).toString(36);d[O]=function(a){d[O].data=a;d[O].called=!0};var I=f(m.replace("JSON_CALLBACK","angular.callbacks."+O),O,function(a,b){v(l,a,d[O].data,"",b);d[O]=y})}else{var w=a(e);w.open(e,m,!0);r(n,function(a,b){A(a)&&w.setRequestHeader(b,a)});w.onreadystatechange=function(){if(w&&4==w.readyState){var a=null,b=null,c="";C!==g&&(a=w.getAllResponseHeaders(),b="response"in w?w.response:w.responseText);C===g&&
|
79
|
+
10>R||(c=w.statusText);v(l,C||w.status,b,a,c)}};q&&(w.withCredentials=!0);if(s)try{w.responseType=s}catch(da){if("json"!==s)throw da;}w.send(h||null)}if(0<p)var K=c(L,p);else p&&P(p.then)&&p.then(L)}}function Sd(){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","$exceptionHandler","$sce",function(c,d,e){function f(f,h,l){for(var n,p,q=0,s=[],L=f.length,v=!1,C=[];q<L;)-1!=(n=f.indexOf(b,q))&&-1!=(p=f.indexOf(a,
|
80
|
+
n+g))?(q!=n&&s.push(f.substring(q,n)),s.push(q=c(v=f.substring(n+g,p))),q.exp=v,q=p+k,v=!0):(q!=L&&s.push(f.substring(q)),q=L);(L=s.length)||(s.push(""),L=1);if(l&&1<s.length)throw yc("noconcat",f);if(!h||v)return C.length=L,q=function(a){try{for(var b=0,c=L,g;b<c;b++){if("function"==typeof(g=s[b]))if(g=g(a),g=l?e.getTrusted(l,g):e.valueOf(g),null==g)g="";else switch(typeof g){case "string":break;case "number":g=""+g;break;default:g=ta(g)}C[b]=g}return C.join("")}catch(k){a=yc("interr",f,k.toString()),
|
81
|
+
d(a)}},q.exp=f,q.parts=s,q}var g=b.length,k=a.length;f.startSymbol=function(){return b};f.endSymbol=function(){return a};return f}]}function Td(){this.$get=["$rootScope","$window","$q",function(b,a,c){function d(d,g,k,m){var h=a.setInterval,l=a.clearInterval,n=c.defer(),p=n.promise,q=0,s=A(m)&&!m;k=A(k)?k:0;p.then(null,null,d);p.$$intervalId=h(function(){n.notify(q++);0<k&&q>=k&&(n.resolve(q),l(p.$$intervalId),delete e[p.$$intervalId]);s||b.$apply()},g);e[p.$$intervalId]=n;return p}var e={};d.cancel=
|
82
|
+
function(b){return b&&b.$$intervalId in e?(e[b.$$intervalId].reject("canceled"),a.clearInterval(b.$$intervalId),delete e[b.$$intervalId],!0):!1};return d}]}function bd(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,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(" "),
|
83
|
+
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(" "),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 1===b?"one":"other"}}}}function Qb(b){b=b.split("/");for(var a=b.length;a--;)b[a]=
|
84
|
+
jb(b[a]);return b.join("/")}function zc(b,a,c){b=ua(b,c);a.$$protocol=b.protocol;a.$$host=b.hostname;a.$$port=Z(b.port)||xe[b.protocol]||null}function Ac(b,a,c){var d="/"!==b.charAt(0);d&&(b="/"+b);b=ua(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?b.pathname.substring(1):b.pathname);a.$$search=ec(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function qa(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function cb(b){var a=
|
85
|
+
b.indexOf("#");return-1==a?b:b.substr(0,a)}function Rb(b){return b.substr(0,cb(b).lastIndexOf("/")+1)}function Bc(b,a){this.$$html5=!0;a=a||"";var c=Rb(b);zc(b,this,b);this.$$parse=function(a){var e=qa(c,a);if(!z(e))throw Sb("ipthprfx",a,c);Ac(e,this,b);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Cb(this.$$search),b=this.$$hash?"#"+jb(this.$$hash):"";this.$$url=Qb(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$rewrite=function(d){var e;
|
86
|
+
if((e=qa(b,d))!==t)return d=e,(e=qa(a,e))!==t?c+(qa("/",e)||e):b+d;if((e=qa(c,d))!==t)return c+e;if(c==d+"/")return c}}function Tb(b,a){var c=Rb(b);zc(b,this,b);this.$$parse=function(d){var e=qa(b,d)||qa(c,d),e="#"==e.charAt(0)?qa(a,e):this.$$html5?e:"";if(!z(e))throw Sb("ihshprfx",d,a);Ac(e,this,b);d=this.$$path;var f=/^\/[A-Z]:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));f.exec(e)||(d=(e=f.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Cb(this.$$search),e=this.$$hash?
|
87
|
+
"#"+jb(this.$$hash):"";this.$$url=Qb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$rewrite=function(a){if(cb(b)==cb(a))return a}}function Ub(b,a){this.$$html5=!0;Tb.apply(this,arguments);var c=Rb(b);this.$$rewrite=function(d){var e;if(b==cb(d))return d;if(e=qa(c,d))return b+a+e;if(c===d+"/")return c};this.$$compose=function(){var c=Cb(this.$$search),e=this.$$hash?"#"+jb(this.$$hash):"";this.$$url=Qb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+a+this.$$url}}function sb(b){return function(){return this[b]}}
|
88
|
+
function Cc(b,a){return function(c){if(D(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Wd(){var b="",a=!1;this.hashPrefix=function(a){return A(a)?(b=a,this):b};this.html5Mode=function(b){return A(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,f){function g(a){c.$broadcast("$locationChangeSuccess",k.absUrl(),a)}var k,m,h=d.baseHref(),l=d.url(),n;a?(n=l.substring(0,l.indexOf("/",l.indexOf("//")+2))+(h||"/"),m=e.history?Bc:Ub):(n=
|
89
|
+
cb(l),m=Tb);k=new m(n,"#"+b);k.$$parse(k.$$rewrite(l));var p=/^\s*(javascript|mailto):/i;f.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var e=u(a.target);"a"!==N(e[0].nodeName);)if(e[0]===f[0]||!(e=e.parent())[0])return;var g=e.prop("href");T(g)&&"[object SVGAnimatedString]"===g.toString()&&(g=ua(g.animVal).href);if(!p.test(g)){if(m===Ub){var h=e.attr("href")||e.attr("xlink:href");if(h&&0>h.indexOf("://"))if(g="#"+b,"/"==h[0])g=n+g+h;else if("#"==h[0])g=n+g+(k.path()||"/")+h;
|
90
|
+
else{var l=k.path().split("/"),h=h.split("/");2!==l.length||l[1]||(l.length=1);for(var q=0;q<h.length;q++)"."!=h[q]&&(".."==h[q]?l.pop():h[q].length&&l.push(h[q]));g=n+g+l.join("/")}}l=k.$$rewrite(g);g&&(!e.attr("target")&&l&&!a.isDefaultPrevented())&&(a.preventDefault(),l!=d.url()&&(k.$$parse(l),c.$apply(),Q.angular["ff-684208-preventDefault"]=!0))}}});k.absUrl()!=l&&d.url(k.absUrl(),!0);d.onUrlChange(function(a){k.absUrl()!=a&&(c.$evalAsync(function(){var b=k.absUrl();k.$$parse(a);c.$broadcast("$locationChangeStart",
|
91
|
+
a,b).defaultPrevented?(k.$$parse(b),d.url(b)):g(b)}),c.$$phase||c.$digest())});var q=0;c.$watch(function(){var a=d.url(),b=k.$$replace;q&&a==k.absUrl()||(q++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",k.absUrl(),a).defaultPrevented?k.$$parse(a):(d.url(k.absUrl(),b),g(a))}));k.$$replace=!1;return q});return k}]}function Xd(){var b=!0,a=this;this.debugEnabled=function(a){return A(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&
|
92
|
+
-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||y;a=!1;try{a=!!e.apply}catch(m){}return a?function(){var a=[];r(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function ja(b,
|
93
|
+
a){if("__defineGetter__"===b||"__defineSetter__"===b||"__lookupGetter__"===b||"__lookupSetter__"===b||"__proto__"===b)throw ka("isecfld",a);return b}function Oa(b,a){if(b){if(b.constructor===b)throw ka("isecfn",a);if(b.document&&b.location&&b.alert&&b.setInterval)throw ka("isecwindow",a);if(b.children&&(b.nodeName||b.prop&&b.attr&&b.find))throw ka("isecdom",a);if(b===Object)throw ka("isecobj",a);}return b}function tb(b,a,c,d,e){e=e||{};a=a.split(".");for(var f,g=0;1<a.length;g++){f=ja(a.shift(),d);
|
94
|
+
var k=b[f];k||(k={},b[f]=k);b=k;b.then&&e.unwrapPromises&&(va(d),"$$v"in b||function(a){a.then(function(b){a.$$v=b})}(b),b.$$v===t&&(b.$$v={}),b=b.$$v)}f=ja(a.shift(),d);Oa(b,d);Oa(b[f],d);return b[f]=c}function Dc(b,a,c,d,e,f,g){ja(b,f);ja(a,f);ja(c,f);ja(d,f);ja(e,f);return g.unwrapPromises?function(g,m){var h=m&&m.hasOwnProperty(b)?m:g,l;if(null==h)return h;(h=h[b])&&h.then&&(va(f),"$$v"in h||(l=h,l.$$v=t,l.then(function(a){l.$$v=a})),h=h.$$v);if(!a)return h;if(null==h)return t;(h=h[a])&&h.then&&
|
95
|
+
(va(f),"$$v"in h||(l=h,l.$$v=t,l.then(function(a){l.$$v=a})),h=h.$$v);if(!c)return h;if(null==h)return t;(h=h[c])&&h.then&&(va(f),"$$v"in h||(l=h,l.$$v=t,l.then(function(a){l.$$v=a})),h=h.$$v);if(!d)return h;if(null==h)return t;(h=h[d])&&h.then&&(va(f),"$$v"in h||(l=h,l.$$v=t,l.then(function(a){l.$$v=a})),h=h.$$v);if(!e)return h;if(null==h)return t;(h=h[e])&&h.then&&(va(f),"$$v"in h||(l=h,l.$$v=t,l.then(function(a){l.$$v=a})),h=h.$$v);return h}:function(f,g){var h=g&&g.hasOwnProperty(b)?g:f;if(null==
|
96
|
+
h)return h;h=h[b];if(!a)return h;if(null==h)return t;h=h[a];if(!c)return h;if(null==h)return t;h=h[c];if(!d)return h;if(null==h)return t;h=h[d];return e?null==h?t:h=h[e]:h}}function Ec(b,a,c){if(Vb.hasOwnProperty(b))return Vb[b];var d=b.split("."),e=d.length,f;if(a.csp)f=6>e?Dc(d[0],d[1],d[2],d[3],d[4],c,a):function(b,f){var g=0,k;do k=Dc(d[g++],d[g++],d[g++],d[g++],d[g++],c,a)(b,f),f=t,b=k;while(g<e);return k};else{var g="var p;\n";r(d,function(b,d){ja(b,c);g+="if(s == null) return undefined;\ns="+
|
97
|
+
(d?"s":'((k&&k.hasOwnProperty("'+b+'"))?k:s)')+'["'+b+'"];\n'+(a.unwrapPromises?'if (s && s.then) {\n pw("'+c.replace(/(["\r\n])/g,"\\$1")+'");\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':"")});var g=g+"return s;",k=new Function("s","k","pw",g);k.toString=$(g);f=a.unwrapPromises?function(a,b){return k(a,b,va)}:k}"hasOwnProperty"!==b&&(Vb[b]=f);return f}function Yd(){var b={},a={csp:!1,unwrapPromises:!1,logPromiseWarnings:!0};this.unwrapPromises=
|
98
|
+
function(b){return A(b)?(a.unwrapPromises=!!b,this):a.unwrapPromises};this.logPromiseWarnings=function(b){return A(b)?(a.logPromiseWarnings=b,this):a.logPromiseWarnings};this.$get=["$filter","$sniffer","$log",function(c,d,e){a.csp=d.csp;va=function(b){a.logPromiseWarnings&&!Fc.hasOwnProperty(b)&&(Fc[b]=!0,e.warn("[$parse] Promise found in the expression `"+b+"`. Automatic unwrapping of promises in Angular expressions is deprecated."))};return function(d){var e;switch(typeof d){case "string":if(b.hasOwnProperty(d))return b[d];
|
99
|
+
e=new Wb(a);e=(new db(e,c,a)).parse(d);"hasOwnProperty"!==d&&(b[d]=e);return e;case "function":return d;default:return y}}}]}function $d(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return ye(function(a){b.$evalAsync(a)},a)}]}function ye(b,a){function c(a){return a}function d(a){return g(a)}var e=function(){var g=[],h,l;return l={resolve:function(a){if(g){var c=g;g=t;h=f(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],h.then(a[0],a[1],a[2])})}},reject:function(a){l.resolve(k(a))},
|
100
|
+
notify:function(a){if(g){var c=g;g.length&&b(function(){for(var b,d=0,e=c.length;d<e;d++)b=c[d],b[2](a)})}},promise:{then:function(b,f,k){var l=e(),L=function(d){try{l.resolve((P(b)?b:c)(d))}catch(e){l.reject(e),a(e)}},v=function(b){try{l.resolve((P(f)?f:d)(b))}catch(c){l.reject(c),a(c)}},C=function(b){try{l.notify((P(k)?k:c)(b))}catch(d){a(d)}};g?g.push([L,v,C]):h.then(L,v,C);return l.promise},"catch":function(a){return this.then(null,a)},"finally":function(a){function b(a,c){var d=e();c?d.resolve(a):
|
101
|
+
d.reject(a);return d.promise}function d(e,f){var g=null;try{g=(a||c)()}catch(k){return b(k,!1)}return g&&P(g.then)?g.then(function(){return b(e,f)},function(a){return b(a,!1)}):b(e,f)}return this.then(function(a){return d(a,!0)},function(a){return d(a,!1)})}}}},f=function(a){return a&&P(a.then)?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},g=function(a){var b=e();b.reject(a);return b.promise},k=function(c){return{then:function(f,g){var k=e();b(function(){try{k.resolve((P(g)?
|
102
|
+
g:d)(c))}catch(b){k.reject(b),a(b)}});return k.promise}}};return{defer:e,reject:g,when:function(k,h,l,n){var p=e(),q,s=function(b){try{return(P(h)?h:c)(b)}catch(d){return a(d),g(d)}},L=function(b){try{return(P(l)?l:d)(b)}catch(c){return a(c),g(c)}},v=function(b){try{return(P(n)?n:c)(b)}catch(d){a(d)}};b(function(){f(k).then(function(a){q||(q=!0,p.resolve(f(a).then(s,L,v)))},function(a){q||(q=!0,p.resolve(L(a)))},function(a){q||p.notify(v(a))})});return p.promise},all:function(a){var b=e(),c=0,d=H(a)?
|
103
|
+
[]:{};r(a,function(a,e){c++;f(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||b.reject(a)})});0===c&&b.resolve(d);return b.promise}}}function ge(){this.$get=["$window","$timeout",function(b,a){var c=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame,d=b.cancelAnimationFrame||b.webkitCancelAnimationFrame||b.mozCancelAnimationFrame||b.webkitCancelRequestAnimationFrame,e=!!c,f=e?function(a){var b=c(a);return function(){d(b)}}:
|
104
|
+
function(b){var c=a(b,16.66,!1);return function(){a.cancel(c)}};f.supported=e;return f}]}function Zd(){var b=10,a=x("$rootScope"),c=null;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse","$browser",function(d,e,f,g){function k(){this.$id=gb();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.$$postDigestQueue=
|
105
|
+
[];this.$$listeners={};this.$$listenerCount={};this.$$isolateBindings={}}function m(b){if(p.$$phase)throw a("inprog",p.$$phase);p.$$phase=b}function h(a,b){var c=f(a);Va(c,b);return c}function l(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&delete a.$$listenerCount[c];while(a=a.$parent)}function n(){}k.prototype={constructor:k,$new:function(a){a?(a=new k,a.$root=this.$root,a.$$asyncQueue=this.$$asyncQueue,a.$$postDigestQueue=this.$$postDigestQueue):(this.$$childScopeClass||(this.$$childScopeClass=
|
106
|
+
function(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$id=gb();this.$$childScopeClass=null},this.$$childScopeClass.prototype=this),a=new this.$$childScopeClass);a["this"]=a;a.$parent=this;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,d){var e=h(a,"watch"),f=this.$$watchers,g={fn:b,last:n,get:e,exp:a,
|
107
|
+
eq:!!d};c=null;if(!P(b)){var k=h(b||y,"listener");g.fn=function(a,b,c){k(c)}}if("string"==typeof a&&e.constant){var m=g.fn;g.fn=function(a,b,c){m.call(this,a,b,c);Ra(f,g)}}f||(f=this.$$watchers=[]);f.unshift(g);return function(){Ra(f,g);c=null}},$watchCollection:function(a,b){var c=this,d,e,g,k=1<b.length,h=0,m=f(a),l=[],p={},n=!0,r=0;return this.$watch(function(){d=m(c);var a,b,f;if(T(d))if(fb(d))for(e!==l&&(e=l,r=e.length=0,h++),a=d.length,r!==a&&(h++,e.length=r=a),b=0;b<a;b++)f=e[b]!==e[b]&&d[b]!==
|
108
|
+
d[b],f||e[b]===d[b]||(h++,e[b]=d[b]);else{e!==p&&(e=p={},r=0,h++);a=0;for(b in d)d.hasOwnProperty(b)&&(a++,e.hasOwnProperty(b)?(f=e[b]!==e[b]&&d[b]!==d[b],f||e[b]===d[b]||(h++,e[b]=d[b])):(r++,e[b]=d[b],h++));if(r>a)for(b in h++,e)e.hasOwnProperty(b)&&!d.hasOwnProperty(b)&&(r--,delete e[b])}else e!==d&&(e=d,h++);return h},function(){n?(n=!1,b(d,d,c)):b(d,g,c);if(k)if(T(d))if(fb(d)){g=Array(d.length);for(var a=0;a<d.length;a++)g[a]=d[a]}else for(a in g={},d)ib.call(d,a)&&(g[a]=d[a]);else g=d})},$digest:function(){var d,
|
109
|
+
f,g,k,h=this.$$asyncQueue,l=this.$$postDigestQueue,r,w,t=b,K,W=[],u,J,E;m("$digest");c=null;do{w=!1;for(K=this;h.length;){try{E=h.shift(),E.scope.$eval(E.expression)}catch(F){p.$$phase=null,e(F)}c=null}a:do{if(k=K.$$watchers)for(r=k.length;r--;)try{if(d=k[r])if((f=d.get(K))!==(g=d.last)&&!(d.eq?za(f,g):"number"===typeof f&&"number"===typeof g&&isNaN(f)&&isNaN(g)))w=!0,c=d,d.last=d.eq?Ha(f,null):f,d.fn(f,g===n?f:g,K),5>t&&(u=4-t,W[u]||(W[u]=[]),J=P(d.exp)?"fn: "+(d.exp.name||d.exp.toString()):d.exp,
|
110
|
+
J+="; newVal: "+ta(f)+"; oldVal: "+ta(g),W[u].push(J));else if(d===c){w=!1;break a}}catch(A){p.$$phase=null,e(A)}if(!(k=K.$$childHead||K!==this&&K.$$nextSibling))for(;K!==this&&!(k=K.$$nextSibling);)K=K.$parent}while(K=k);if((w||h.length)&&!t--)throw p.$$phase=null,a("infdig",b,ta(W));}while(w||h.length);for(p.$$phase=null;l.length;)try{l.shift()()}catch(x){e(x)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this!==p&&(r(this.$$listenerCount,
|
111
|
+
Bb(null,l,this)),a.$$childHead==this&&(a.$$childHead=this.$$nextSibling),a.$$childTail==this&&(a.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=null,this.$$listeners={},this.$$watchers=this.$$asyncQueue=this.$$postDigestQueue=[],this.$destroy=this.$digest=this.$apply=y,this.$on=
|
112
|
+
this.$watch=function(){return y})}},$eval:function(a,b){return f(a)(this,b)},$evalAsync:function(a){p.$$phase||p.$$asyncQueue.length||g.defer(function(){p.$$asyncQueue.length&&p.$digest()});this.$$asyncQueue.push({scope:this,expression:a})},$$postDigest:function(a){this.$$postDigestQueue.push(a)},$apply:function(a){try{return m("$apply"),this.$eval(a)}catch(b){e(b)}finally{p.$$phase=null;try{p.$digest()}catch(c){throw e(c),c;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=
|
113
|
+
c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){c[Qa(c,b)]=null;l(e,1,a)}},$emit:function(a,b){var c=[],d,f=this,g=!1,k={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){k.defaultPrevented=!0},defaultPrevented:!1},h=[k].concat(Aa.call(arguments,1)),m,l;do{d=f.$$listeners[a]||c;k.currentScope=f;m=0;for(l=d.length;m<l;m++)if(d[m])try{d[m].apply(null,h)}catch(p){e(p)}else d.splice(m,
|
114
|
+
1),m--,l--;if(g)break;f=f.$parent}while(f);return k},$broadcast:function(a,b){for(var c=this,d=this,f={name:a,targetScope:this,preventDefault:function(){f.defaultPrevented=!0},defaultPrevented:!1},g=[f].concat(Aa.call(arguments,1)),k,h;c=d;){f.currentScope=c;d=c.$$listeners[a]||[];k=0;for(h=d.length;k<h;k++)if(d[k])try{d[k].apply(null,g)}catch(m){e(m)}else d.splice(k,1),k--,h--;if(!(d=c.$$listenerCount[a]&&c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}return f}};
|
115
|
+
var p=new k;return p}]}function cd(){var b=/^\s*(https?|ftp|mailto|tel|file):/,a=/^\s*((https?|ftp|file):|data:image\/)/;this.aHrefSanitizationWhitelist=function(a){return A(a)?(b=a,this):b};this.imgSrcSanitizationWhitelist=function(b){return A(b)?(a=b,this):a};this.$get=function(){return function(c,d){var e=d?a:b,f;if(!R||8<=R)if(f=ua(c).href,""!==f&&!f.match(e))return"unsafe:"+f;return c}}}function ze(b){if("self"===b)return b;if(z(b)){if(-1<b.indexOf("***"))throw wa("iwcard",b);b=b.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,
|
116
|
+
"\\$1").replace(/\x08/g,"\\x08").replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return RegExp("^"+b+"$")}if(hb(b))return RegExp("^"+b.source+"$");throw wa("imatcher");}function Gc(b){var a=[];A(b)&&r(b,function(b){a.push(ze(b))});return a}function be(){this.SCE_CONTEXTS=fa;var b=["self"],a=[];this.resourceUrlWhitelist=function(a){arguments.length&&(b=Gc(a));return b};this.resourceUrlBlacklist=function(b){arguments.length&&(a=Gc(b));return a};this.$get=["$injector",function(c){function d(a){var b=
|
117
|
+
function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var e=function(a){throw wa("unsafe");};c.has("$sanitize")&&(e=c.get("$sanitize"));var f=d(),g={};g[fa.HTML]=d(f);g[fa.CSS]=d(f);g[fa.URL]=d(f);g[fa.JS]=d(f);g[fa.RESOURCE_URL]=d(g[fa.URL]);return{trustAs:function(a,b){var c=g.hasOwnProperty(a)?g[a]:null;if(!c)throw wa("icontext",
|
118
|
+
a,b);if(null===b||b===t||""===b)return b;if("string"!==typeof b)throw wa("itype",a);return new c(b)},getTrusted:function(c,d){if(null===d||d===t||""===d)return d;var f=g.hasOwnProperty(c)?g[c]:null;if(f&&d instanceof f)return d.$$unwrapTrustedValue();if(c===fa.RESOURCE_URL){var f=ua(d.toString()),l,n,p=!1;l=0;for(n=b.length;l<n;l++)if("self"===b[l]?Pb(f):b[l].exec(f.href)){p=!0;break}if(p)for(l=0,n=a.length;l<n;l++)if("self"===a[l]?Pb(f):a[l].exec(f.href)){p=!1;break}if(p)return d;throw wa("insecurl",
|
119
|
+
d.toString());}if(c===fa.HTML)return e(d);throw wa("unsafe");},valueOf:function(a){return a instanceof f?a.$$unwrapTrustedValue():a}}}]}function ae(){var b=!0;this.enabled=function(a){arguments.length&&(b=!!a);return b};this.$get=["$parse","$sniffer","$sceDelegate",function(a,c,d){if(b&&c.msie&&8>c.msieDocumentMode)throw wa("iequirks");var e=ga(fa);e.isEnabled=function(){return b};e.trustAs=d.trustAs;e.getTrusted=d.getTrusted;e.valueOf=d.valueOf;b||(e.trustAs=e.getTrusted=function(a,b){return b},
|
120
|
+
e.valueOf=Ga);e.parseAs=function(b,c){var d=a(c);return d.literal&&d.constant?d:function(a,c){return e.getTrusted(b,d(a,c))}};var f=e.parseAs,g=e.getTrusted,k=e.trustAs;r(fa,function(a,b){var c=N(b);e[Ya("parse_as_"+c)]=function(b){return f(a,b)};e[Ya("get_trusted_"+c)]=function(b){return g(a,b)};e[Ya("trust_as_"+c)]=function(b){return k(a,b)}});return e}]}function ce(){this.$get=["$window","$document",function(b,a){var c={},d=Z((/android (\d+)/.exec(N((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||
|
121
|
+
{}).userAgent),f=a[0]||{},g=f.documentMode,k,m=/^(Moz|webkit|O|ms)(?=[A-Z])/,h=f.body&&f.body.style,l=!1,n=!1;if(h){for(var p in h)if(l=m.exec(p)){k=l[0];k=k.substr(0,1).toUpperCase()+k.substr(1);break}k||(k="WebkitOpacity"in h&&"webkit");l=!!("transition"in h||k+"Transition"in h);n=!!("animation"in h||k+"Animation"in h);!d||l&&n||(l=z(f.body.style.webkitTransition),n=z(f.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hashchange:"onhashchange"in b&&(!g||7<
|
122
|
+
g),hasEvent:function(a){if("input"==a&&9==R)return!1;if(D(c[a])){var b=f.createElement("div");c[a]="on"+a in b}return c[a]},csp:Wa(),vendorPrefix:k,transitions:l,animations:n,android:d,msie:R,msieDocumentMode:g}}]}function ee(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,k,m){var h=c.defer(),l=h.promise,n=A(m)&&!m;k=a.defer(function(){try{h.resolve(e())}catch(a){h.reject(a),d(a)}finally{delete f[l.$$timeoutId]}n||b.$apply()},k);l.$$timeoutId=k;f[k]=h;
|
123
|
+
return l}var f={};e.cancel=function(b){return b&&b.$$timeoutId in f?(f[b.$$timeoutId].reject("canceled"),delete f[b.$$timeoutId],a.defer.cancel(b.$$timeoutId)):!1};return e}]}function ua(b,a){var c=b;R&&(V.setAttribute("href",c),c=V.href);V.setAttribute("href",c);return{href:V.href,protocol:V.protocol?V.protocol.replace(/:$/,""):"",host:V.host,search:V.search?V.search.replace(/^\?/,""):"",hash:V.hash?V.hash.replace(/^#/,""):"",hostname:V.hostname,port:V.port,pathname:"/"===V.pathname.charAt(0)?V.pathname:
|
124
|
+
"/"+V.pathname}}function Pb(b){b=z(b)?ua(b):b;return b.protocol===Hc.protocol&&b.host===Hc.host}function fe(){this.$get=$(Q)}function mc(b){function a(d,e){if(T(d)){var f={};r(d,function(b,c){f[c]=a(c,b)});return f}return b.factory(d+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+c)}}];a("currency",Ic);a("date",Jc);a("filter",Ae);a("json",Be);a("limitTo",Ce);a("lowercase",De);a("number",Kc);a("orderBy",Lc);a("uppercase",Ee)}function Ae(){return function(b,
|
125
|
+
a,c){if(!H(b))return b;var d=typeof c,e=[];e.check=function(a){for(var b=0;b<e.length;b++)if(!e[b](a))return!1;return!0};"function"!==d&&(c="boolean"===d&&c?function(a,b){return Ua.equals(a,b)}:function(a,b){if(a&&b&&"object"===typeof a&&"object"===typeof b){for(var d in a)if("$"!==d.charAt(0)&&ib.call(a,d)&&c(a[d],b[d]))return!0;return!1}b=(""+b).toLowerCase();return-1<(""+a).toLowerCase().indexOf(b)});var f=function(a,b){if("string"==typeof b&&"!"===b.charAt(0))return!f(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return c(a,
|
126
|
+
b);case "object":switch(typeof b){case "object":return c(a,b);default:for(var d in a)if("$"!==d.charAt(0)&&f(a[d],b))return!0}return!1;case "array":for(d=0;d<a.length;d++)if(f(a[d],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var g in a)(function(b){"undefined"!==typeof a[b]&&e.push(function(c){return f("$"==b?c:c&&c[b],a[b])})})(g);break;case "function":e.push(a);break;default:return b}d=[];for(g=0;g<b.length;g++){var k=
|
127
|
+
b[g];e.check(k)&&d.push(k)}return d}}function Ic(b){var a=b.NUMBER_FORMATS;return function(b,d){D(d)&&(d=a.CURRENCY_SYM);return Mc(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Kc(b){var a=b.NUMBER_FORMATS;return function(b,d){return Mc(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Mc(b,a,c,d,e){if(null==b||!isFinite(b)||T(b))return"";var f=0>b;b=Math.abs(b);var g=b+"",k="",m=[],h=!1;if(-1!==g.indexOf("e")){var l=g.match(/([\d\.]+)e(-?)(\d+)/);l&&"-"==l[2]&&
|
128
|
+
l[3]>e+1?(g="0",b=0):(k=g,h=!0)}if(h)0<e&&(-1<b&&1>b)&&(k=b.toFixed(e));else{g=(g.split(Nc)[1]||"").length;D(e)&&(e=Math.min(Math.max(a.minFrac,g),a.maxFrac));b=+(Math.round(+(b.toString()+"e"+e)).toString()+"e"+-e);b=(""+b).split(Nc);g=b[0];b=b[1]||"";var l=0,n=a.lgSize,p=a.gSize;if(g.length>=n+p)for(l=g.length-n,h=0;h<l;h++)0===(l-h)%p&&0!==h&&(k+=c),k+=g.charAt(h);for(h=l;h<g.length;h++)0===(g.length-h)%n&&0!==h&&(k+=c),k+=g.charAt(h);for(;b.length<e;)b+="0";e&&"0"!==e&&(k+=d+b.substr(0,e))}m.push(f?
|
129
|
+
a.negPre:a.posPre);m.push(k);m.push(f?a.negSuf:a.posSuf);return m.join("")}function Xb(b,a,c){var d="";0>b&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function Y(b,a,c,d){c=c||0;return function(e){e=e["get"+b]();if(0<c||e>-c)e+=c;0===e&&-12==c&&(e=12);return Xb(e,a,d)}}function ub(b,a){return function(c,d){var e=c["get"+b](),f=Ia(a?"SHORT"+b:b);return d[f][e]}}function Jc(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var f=0,g=0,k=b[8]?a.setUTCFullYear:
|
130
|
+
a.setFullYear,m=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=Z(b[9]+b[10]),g=Z(b[9]+b[11]));k.call(a,Z(b[1]),Z(b[2])-1,Z(b[3]));f=Z(b[4]||0)-f;g=Z(b[5]||0)-g;k=Z(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));m.call(a,f,g,k,b)}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 f="",g=[],k,m;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;z(c)&&(c=Fe.test(c)?Z(c):a(c));Ab(c)&&(c=new Date(c));if(!sa(c))return c;
|
131
|
+
for(;e;)(m=Ge.exec(e))?(g=g.concat(Aa.call(m,1)),e=g.pop()):(g.push(e),e=null);r(g,function(a){k=He[a];f+=k?k(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return f}}function Be(){return function(b){return ta(b,!0)}}function Ce(){return function(b,a){if(!H(b)&&!z(b))return b;a=Infinity===Math.abs(Number(a))?Number(a):Z(a);if(z(b))return a?0<=a?b.slice(0,a):b.slice(a,b.length):"";var c=[],d,e;a>b.length?a=b.length:a<-b.length&&(a=-b.length);0<a?(d=0,e=a):(d=b.length+a,e=b.length);
|
132
|
+
for(;d<e;d++)c.push(b[d]);return c}}function Lc(b){return function(a,c,d){function e(a,b){return Ta(b)?function(b,c){return a(c,b)}:a}function f(a,b){var c=typeof a,d=typeof b;return c==d?(sa(a)&&sa(b)&&(a=a.valueOf(),b=b.valueOf()),"string"==c&&(a=a.toLowerCase(),b=b.toLowerCase()),a===b?0:a<b?-1:1):c<d?-1:1}if(!H(a)||!c)return a;c=H(c)?c:[c];c=Vc(c,function(a){var c=!1,d=a||Ga;if(z(a)){if("+"==a.charAt(0)||"-"==a.charAt(0))c="-"==a.charAt(0),a=a.substring(1);d=b(a);if(d.constant){var g=d();return e(function(a,
|
133
|
+
b){return f(a[g],b[g])},c)}}return e(function(a,b){return f(d(a),d(b))},c)});for(var g=[],k=0;k<a.length;k++)g.push(a[k]);return g.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(0!==e)return e}return 0},d))}}function xa(b){P(b)&&(b={link:b});b.restrict=b.restrict||"AC";return $(b)}function Oc(b,a,c,d){function e(a,c){c=c?"-"+kb(c,"-"):"";d.removeClass(b,(a?vb:wb)+c);d.addClass(b,(a?wb:vb)+c)}var f=this,g=b.parent().controller("form")||xb,k=0,m=f.$error={},h=[];f.$name=a.name||
|
134
|
+
a.ngForm;f.$dirty=!1;f.$pristine=!0;f.$valid=!0;f.$invalid=!1;g.$addControl(f);b.addClass(Pa);e(!0);f.$addControl=function(a){Ca(a.$name,"input");h.push(a);a.$name&&(f[a.$name]=a)};f.$removeControl=function(a){a.$name&&f[a.$name]===a&&delete f[a.$name];r(m,function(b,c){f.$setValidity(c,!0,a)});Ra(h,a)};f.$setValidity=function(a,b,c){var d=m[a];if(b)d&&(Ra(d,c),d.length||(k--,k||(e(b),f.$valid=!0,f.$invalid=!1),m[a]=!1,e(!0,a),g.$setValidity(a,!0,f)));else{k||e(b);if(d){if(-1!=Qa(d,c))return}else m[a]=
|
135
|
+
d=[],k++,e(!1,a),g.$setValidity(a,!1,f);d.push(c);f.$valid=!1;f.$invalid=!0}};f.$setDirty=function(){d.removeClass(b,Pa);d.addClass(b,yb);f.$dirty=!0;f.$pristine=!1;g.$setDirty()};f.$setPristine=function(){d.removeClass(b,yb);d.addClass(b,Pa);f.$dirty=!1;f.$pristine=!0;r(h,function(a){a.$setPristine()})}}function ra(b,a,c,d){b.$setValidity(a,c);return c?d:t}function Pc(b,a){var c,d;if(a)for(c=0;c<a.length;++c)if(d=a[c],b[d])return!0;return!1}function Ie(b,a,c,d,e){T(e)&&(b.$$hasNativeValidators=!0,
|
136
|
+
b.$parsers.push(function(f){if(b.$error[a]||Pc(e,d)||!Pc(e,c))return f;b.$setValidity(a,!1)}))}function zb(b,a,c,d,e,f){var g=a.prop(Je),k=a[0].placeholder,m={},h=N(a[0].type);d.$$validityState=g;if(!e.android){var l=!1;a.on("compositionstart",function(a){l=!0});a.on("compositionend",function(){l=!1;n()})}var n=function(e){if(!l){var f=a.val();if(R&&"input"===(e||m).type&&a[0].placeholder!==k)k=a[0].placeholder;else if("password"!==h&&Ta(c.ngTrim||"T")&&(f=aa(f)),e=g&&d.$$hasNativeValidators,d.$viewValue!==
|
137
|
+
f||""===f&&e)b.$$phase?d.$setViewValue(f):b.$apply(function(){d.$setViewValue(f)})}};if(e.hasEvent("input"))a.on("input",n);else{var p,q=function(){p||(p=f.defer(function(){n();p=null}))};a.on("keydown",function(a){a=a.keyCode;91===a||(15<a&&19>a||37<=a&&40>=a)||q()});if(e.hasEvent("paste"))a.on("paste cut",q)}a.on("change",n);d.$render=function(){a.val(d.$isEmpty(d.$viewValue)?"":d.$viewValue)};var s=c.ngPattern;s&&((e=s.match(/^\/(.*)\/([gim]*)$/))?(s=RegExp(e[1],e[2]),e=function(a){return ra(d,
|
138
|
+
"pattern",d.$isEmpty(a)||s.test(a),a)}):e=function(c){var e=b.$eval(s);if(!e||!e.test)throw x("ngPattern")("noregexp",s,e,ha(a));return ra(d,"pattern",d.$isEmpty(c)||e.test(c),c)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var r=Z(c.ngMinlength);e=function(a){return ra(d,"minlength",d.$isEmpty(a)||a.length>=r,a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var v=Z(c.ngMaxlength);e=function(a){return ra(d,"maxlength",d.$isEmpty(a)||a.length<=v,a)};d.$parsers.push(e);
|
139
|
+
d.$formatters.push(e)}}function Yb(b,a){b="ngClass"+b;return["$animate",function(c){function d(a,b){var c=[],d=0;a:for(;d<a.length;d++){for(var e=a[d],l=0;l<b.length;l++)if(e==b[l])continue a;c.push(e)}return c}function e(a){if(!H(a)){if(z(a))return a.split(" ");if(T(a)){var b=[];r(a,function(a,c){a&&(b=b.concat(c.split(" ")))});return b}}return a}return{restrict:"AC",link:function(f,g,k){function m(a,b){var c=g.data("$classCounts")||{},d=[];r(a,function(a){if(0<b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<
|
140
|
+
b)&&d.push(a)});g.data("$classCounts",c);return d.join(" ")}function h(b){if(!0===a||f.$index%2===a){var h=e(b||[]);if(!l){var q=m(h,1);k.$addClass(q)}else if(!za(b,l)){var s=e(l),q=d(h,s),h=d(s,h),h=m(h,-1),q=m(q,1);0===q.length?c.removeClass(g,h):0===h.length?c.addClass(g,q):c.setClass(g,q,h)}}l=ga(b)}var l;f.$watch(k[b],h,!0);k.$observe("class",function(a){h(f.$eval(k[b]))});"ngClass"!==b&&f.$watch("$index",function(c,d){var g=c&1;if(g!==(d&1)){var h=e(f.$eval(k[b]));g===a?(g=m(h,1),k.$addClass(g)):
|
141
|
+
(g=m(h,-1),k.$removeClass(g))}})}}}]}var Je="validity",N=function(b){return z(b)?b.toLowerCase():b},ib=Object.prototype.hasOwnProperty,Ia=function(b){return z(b)?b.toUpperCase():b},R,u,Da,Aa=[].slice,Ke=[].push,ya=Object.prototype.toString,Sa=x("ng"),Ua=Q.angular||(Q.angular={}),Xa,Ma,la=["0","0","0"];R=Z((/msie (\d+)/.exec(N(navigator.userAgent))||[])[1]);isNaN(R)&&(R=Z((/trident\/.*; rv:(\d+)/.exec(N(navigator.userAgent))||[])[1]));y.$inject=[];Ga.$inject=[];var H=function(){return P(Array.isArray)?
|
142
|
+
Array.isArray:function(b){return"[object Array]"===ya.call(b)}}(),aa=function(){return String.prototype.trim?function(b){return z(b)?b.trim():b}:function(b){return z(b)?b.replace(/^\s\s*/,"").replace(/\s\s*$/,""):b}}();Ma=9>R?function(b){b=b.nodeName?b:b[0];return b.scopeName&&"HTML"!=b.scopeName?Ia(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var Wa=function(){if(A(Wa.isActive_))return Wa.isActive_;var b=!(!X.querySelector("[ng-csp]")&&!X.querySelector("[data-ng-csp]"));
|
143
|
+
if(!b)try{new Function("")}catch(a){b=!0}return Wa.isActive_=b},Yc=/[A-Z]/g,ad={full:"1.2.23",major:1,minor:2,dot:23,codeName:"superficial-malady"};S.expando="ng339";var $a=S.cache={},ne=1,rb=Q.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},Za=Q.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)};S._data=function(b){return this.cache[b[this.expando]]||{}};var ie=/([\:\-\_]+(.))/g,
|
144
|
+
je=/^moz([A-Z])/,Hb=x("jqLite"),ke=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Ib=/<|&#?\w+;/,le=/<([\w:]+)/,me=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ba={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ba.optgroup=ba.option;ba.tbody=ba.tfoot=ba.colgroup=ba.caption=ba.thead;ba.th=
|
145
|
+
ba.td;var La=S.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===X.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),S(Q).on("load",a))},toString:function(){var b=[];r(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?u(this[b]):u(this[this.length+b])},length:0,push:Ke,sort:[].sort,splice:[].splice},ob={};r("multiple selected checked disabled readOnly required open".split(" "),function(b){ob[N(b)]=b});var rc={};r("input select option textarea button form details".split(" "),
|
146
|
+
function(b){rc[Ia(b)]=!0});r({data:Mb,removeData:Lb},function(b,a){S[a]=b});r({data:Mb,inheritedData:nb,scope:function(b){return u.data(b,"$scope")||nb(b.parentNode||b,["$isolateScope","$scope"])},isolateScope:function(b){return u.data(b,"$isolateScope")||u.data(b,"$isolateScopeNoTemplate")},controller:oc,injector:function(b){return nb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Nb,css:function(b,a,c){a=Ya(a);if(A(c))b.style[a]=c;else{var d;8>=R&&(d=b.currentStyle&&b.currentStyle[a],
|
147
|
+
""===d&&(d="auto"));d=d||b.style[a];8>=R&&(d=""===d?t:d);return d}},attr:function(b,a,c){var d=N(a);if(ob[d])if(A(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||y).specified?d:t;else if(A(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?t:b},prop:function(b,a,c){if(A(c))b[a]=c;else return b[a]},text:function(){function b(b,d){var e=a[b.nodeType];if(D(d))return e?b[e]:"";b[e]=d}var a=[];9>R?(a[1]=
|
148
|
+
"innerText",a[3]="nodeValue"):a[1]=a[3]="textContent";b.$dv="";return b}(),val:function(b,a){if(D(a)){if("SELECT"===Ma(b)&&b.multiple){var c=[];r(b.options,function(a){a.selected&&c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(D(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)Ja(d[c]);b.innerHTML=a},empty:pc},function(b,a){S.prototype[a]=function(a,d){var e,f,g=this.length;if(b!==pc&&(2==b.length&&b!==Nb&&b!==oc?a:d)===t){if(T(a)){for(e=
|
149
|
+
0;e<g;e++)if(b===Mb)b(this[e],a);else for(f in a)b(this[e],f,a[f]);return this}e=b.$dv;g=e===t?Math.min(g,1):g;for(f=0;f<g;f++){var k=b(this[f],a,d);e=e?e+k:k}return e}for(e=0;e<g;e++)b(this[e],a,d);return this}});r({removeData:Lb,dealoc:Ja,on:function a(c,d,e,f){if(A(f))throw Hb("onargs");var g=ma(c,"events"),k=ma(c,"handle");g||ma(c,"events",g={});k||ma(c,"handle",k=oe(c,g));r(d.split(" "),function(d){var f=g[d];if(!f){if("mouseenter"==d||"mouseleave"==d){var l=X.body.contains||X.body.compareDocumentPosition?
|
150
|
+
function(a,c){var d=9===a.nodeType?a.documentElement:a,e=c&&c.parentNode;return a===e||!!(e&&1===e.nodeType&&(d.contains?d.contains(e):a.compareDocumentPosition&&a.compareDocumentPosition(e)&16))}:function(a,c){if(c)for(;c=c.parentNode;)if(c===a)return!0;return!1};g[d]=[];a(c,{mouseleave:"mouseout",mouseenter:"mouseover"}[d],function(a){var c=a.relatedTarget;c&&(c===this||l(this,c))||k(a,d)})}else rb(c,d,k),g[d]=[];f=g[d]}f.push(e)})},off:nc,one:function(a,c,d){a=u(a);a.on(c,function f(){a.off(c,
|
151
|
+
d);a.off(c,f)});a.on(c,d)},replaceWith:function(a,c){var d,e=a.parentNode;Ja(a);r(new S(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];r(a.childNodes,function(a){1===a.nodeType&&c.push(a)});return c},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,c){r(new S(c),function(c){1!==a.nodeType&&11!==a.nodeType||a.appendChild(c)})},prepend:function(a,c){if(1===a.nodeType){var d=a.firstChild;r(new S(c),function(c){a.insertBefore(c,
|
152
|
+
d)})}},wrap:function(a,c){c=u(c)[0];var d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){Ja(a);var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;r(new S(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:mb,removeClass:lb,toggleClass:function(a,c,d){c&&r(c.split(" "),function(c){var f=d;D(f)&&(f=!Nb(a,c));(f?mb:lb)(a,c)})},parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;
|
153
|
+
for(a=a.nextSibling;null!=a&&1!==a.nodeType;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName?a.getElementsByTagName(c):[]},clone:Kb,triggerHandler:function(a,c,d){var e,f;e=c.type||c;var g=(ma(a,"events")||{})[e];g&&(e={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopPropagation:y,type:e,target:a},c.type&&(e=B(e,c)),c=ga(g),f=d?[e].concat(d):[e],r(c,function(c){c.apply(a,f)}))}},function(a,c){S.prototype[c]=
|
154
|
+
function(c,e,f){for(var g,k=0;k<this.length;k++)D(g)?(g=a(this[k],c,e,f),A(g)&&(g=u(g))):Jb(g,a(this[k],c,e,f));return A(g)?g:this};S.prototype.bind=S.prototype.on;S.prototype.unbind=S.prototype.off});ab.prototype={put:function(a,c){this[Ka(a,this.nextUid)]=c},get:function(a){return this[Ka(a,this.nextUid)]},remove:function(a){var c=this[a=Ka(a,this.nextUid)];delete this[a];return c}};var qe=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,re=/,/,se=/^\s*(_?)(\S+?)\1\s*$/,pe=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
|
155
|
+
bb=x("$injector"),Le=x("$animate"),Md=["$provide",function(a){this.$$selectors={};this.register=function(c,d){var e=c+"-animation";if(c&&"."!=c.charAt(0))throw Le("notcsel",c);this.$$selectors[c.substr(1)]=e;a.factory(e,d)};this.classNameFilter=function(a){1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?a:null);return this.$$classNameFilter};this.$get=["$timeout","$$asyncCallback",function(a,d){return{enter:function(a,c,g,k){g?g.after(a):(c&&c[0]||(c=g.parent()),c.append(a));k&&
|
156
|
+
d(k)},leave:function(a,c){a.remove();c&&d(c)},move:function(a,c,d,k){this.enter(a,c,d,k)},addClass:function(a,c,g){c=z(c)?c:H(c)?c.join(" "):"";r(a,function(a){mb(a,c)});g&&d(g)},removeClass:function(a,c,g){c=z(c)?c:H(c)?c.join(" "):"";r(a,function(a){lb(a,c)});g&&d(g)},setClass:function(a,c,g,k){r(a,function(a){mb(a,c);lb(a,g)});k&&d(k)},enabled:y}}]}],ia=x("$compile");ic.$inject=["$provide","$$sanitizeUriProvider"];var ue=/^(x[\:\-_]|data[\:\-_])/i,yc=x("$interpolate"),Me=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
|
157
|
+
xe={http:80,https:443,ftp:21},Sb=x("$location");Ub.prototype=Tb.prototype=Bc.prototype={$$html5:!1,$$replace:!1,absUrl:sb("$$absUrl"),url:function(a,c){if(D(a))return this.$$url;var d=Me.exec(a);d[1]&&this.path(decodeURIComponent(d[1]));(d[2]||d[1])&&this.search(d[3]||"");this.hash(d[5]||"",c);return this},protocol:sb("$$protocol"),host:sb("$$host"),port:sb("$$port"),path:Cc("$$path",function(a){return"/"==a.charAt(0)?a:"/"+a}),search:function(a,c){switch(arguments.length){case 0:return this.$$search;
|
158
|
+
case 1:if(z(a))this.$$search=ec(a);else if(T(a))r(a,function(c,e){null==c&&delete a[e]}),this.$$search=a;else throw Sb("isrcharg");break;default:D(c)||null===c?delete this.$$search[a]:this.$$search[a]=c}this.$$compose();return this},hash:Cc("$$hash",Ga),replace:function(){this.$$replace=!0;return this}};var ka=x("$parse"),Fc={},va,Ne=Function.prototype.call,Oe=Function.prototype.apply,Qc=Function.prototype.bind,eb={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},
|
159
|
+
undefined:y,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return A(d)?A(e)?d+e:d:A(e)?e:t},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(A(d)?d:0)-(A(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)},"=":y,"===":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,
|
160
|
+
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)}},Pe={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Wb=function(a){this.options=a};Wb.prototype=
|
161
|
+
{constructor:Wb,lex:function(a){this.text=a;this.index=0;this.ch=t;this.lastCh=":";for(this.tokens=[];this.index<this.text.length;){this.ch=this.text.charAt(this.index);if(this.is("\"'"))this.readString(this.ch);else if(this.isNumber(this.ch)||this.is(".")&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(this.ch))this.readIdent();else if(this.is("(){}[].,;:?"))this.tokens.push({index:this.index,text:this.ch}),this.index++;else if(this.isWhitespace(this.ch)){this.index++;continue}else{a=
|
162
|
+
this.ch+this.peek();var c=a+this.peek(2),d=eb[this.ch],e=eb[a],f=eb[c];f?(this.tokens.push({index:this.index,text:c,fn:f}),this.index+=3):e?(this.tokens.push({index:this.index,text:a,fn:e}),this.index+=2):d?(this.tokens.push({index:this.index,text:this.ch,fn:d}),this.index+=1):this.throwError("Unexpected next character ",this.index,this.index+1)}this.lastCh=this.ch}return this.tokens},is:function(a){return-1!==a.indexOf(this.ch)},was:function(a){return-1!==a.indexOf(this.lastCh)},peek:function(a){a=
|
163
|
+
a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=d||this.index;c=A(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw ka("lexerr",a,c,this.text);
|
164
|
+
},readNumber:function(){for(var a="",c=this.index;this.index<this.text.length;){var d=N(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var e=this.peek();if("e"==d&&this.isExpOperator(e))a+=d;else if(this.isExpOperator(d)&&e&&this.isNumber(e)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||e&&this.isNumber(e)||"e"!=a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}a*=1;this.tokens.push({index:c,text:a,literal:!0,constant:!0,fn:function(){return a}})},
|
165
|
+
readIdent:function(){for(var a=this,c="",d=this.index,e,f,g,k;this.index<this.text.length;){k=this.text.charAt(this.index);if("."===k||this.isIdent(k)||this.isNumber(k))"."===k&&(e=this.index),c+=k;else break;this.index++}if(e)for(f=this.index;f<this.text.length;){k=this.text.charAt(f);if("("===k){g=c.substr(e-d+1);c=c.substr(0,e-d);this.index=f;break}if(this.isWhitespace(k))f++;else break}d={index:d,text:c};if(eb.hasOwnProperty(c))d.fn=eb[c],d.literal=!0,d.constant=!0;else{var m=Ec(c,this.options,
|
166
|
+
this.text);d.fn=B(function(a,c){return m(a,c)},{assign:function(d,e){return tb(d,c,e,a.text,a.options)}})}this.tokens.push(d);g&&(this.tokens.push({index:e,text:"."}),this.tokens.push({index:e+1,text:g}))},readString:function(a){var c=this.index;this.index++;for(var d="",e=a,f=!1;this.index<this.text.length;){var g=this.text.charAt(this.index),e=e+g;if(f)"u"===g?(f=this.text.substring(this.index+1,this.index+5),f.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+f+"]"),this.index+=
|
167
|
+
4,d+=String.fromCharCode(parseInt(f,16))):d+=Pe[g]||g,f=!1;else if("\\"===g)f=!0;else{if(g===a){this.index++;this.tokens.push({index:c,text:e,string:d,literal:!0,constant:!0,fn:function(){return d}});return}d+=g}this.index++}this.throwError("Unterminated quote",c)}};var db=function(a,c,d){this.lexer=a;this.$filter=c;this.options=d};db.ZERO=B(function(){return 0},{constant:!0});db.prototype={constructor:db,parse:function(a){this.text=a;this.tokens=this.lexer.lex(a);a=this.statements();0!==this.tokens.length&&
|
168
|
+
this.throwError("is an unexpected token",this.tokens[0]);a.literal=!!a.literal;a.constant=!!a.constant;return a},primary:function(){var a;if(this.expect("("))a=this.filterChain(),this.consume(")");else if(this.expect("["))a=this.arrayDeclaration();else if(this.expect("{"))a=this.object();else{var c=this.expect();(a=c.fn)||this.throwError("not a primary expression",c);a.literal=!!c.literal;a.constant=!!c.constant}for(var d;c=this.expect("(","[",".");)"("===c.text?(a=this.functionCall(a,d),d=null):
|
169
|
+
"["===c.text?(d=a,a=this.objectIndex(a)):"."===c.text?(d=a,a=this.fieldAccess(a)):this.throwError("IMPOSSIBLE");return a},throwError:function(a,c){throw ka("syntax",c.text,a,c.index+1,this.text,this.text.substring(c.index));},peekToken:function(){if(0===this.tokens.length)throw ka("ueoe",this.text);return this.tokens[0]},peek:function(a,c,d,e){if(0<this.tokens.length){var f=this.tokens[0],g=f.text;if(g===a||g===c||g===d||g===e||!(a||c||d||e))return f}return!1},expect:function(a,c,d,e){return(a=this.peek(a,
|
170
|
+
c,d,e))?(this.tokens.shift(),a):!1},consume:function(a){this.expect(a)||this.throwError("is unexpected, expecting ["+a+"]",this.peek())},unaryFn:function(a,c){return B(function(d,e){return a(d,e,c)},{constant:c.constant})},ternaryFn:function(a,c,d){return B(function(e,f){return a(e,f)?c(e,f):d(e,f)},{constant:a.constant&&c.constant&&d.constant})},binaryFn:function(a,c,d){return B(function(e,f){return c(e,f,a,d)},{constant:a.constant&&d.constant})},statements:function(){for(var a=[];;)if(0<this.tokens.length&&
|
171
|
+
!this.peek("}",")",";","]")&&a.push(this.filterChain()),!this.expect(";"))return 1===a.length?a[0]:function(c,d){for(var e,f=0;f<a.length;f++){var g=a[f];g&&(e=g(c,d))}return e}},filterChain:function(){for(var a=this.expression(),c;;)if(c=this.expect("|"))a=this.binaryFn(a,c.fn,this.filter());else return a},filter:function(){for(var a=this.expect(),c=this.$filter(a.text),d=[];;)if(a=this.expect(":"))d.push(this.expression());else{var e=function(a,e,k){k=[k];for(var m=0;m<d.length;m++)k.push(d[m](a,
|
172
|
+
e));return c.apply(a,k)};return function(){return e}}},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary(),c,d;return(d=this.expect("="))?(a.assign||this.throwError("implies assignment but ["+this.text.substring(0,d.index)+"] can not be assigned to",d),c=this.ternary(),function(d,f){return a.assign(d,c(d,f),f)}):a},ternary:function(){var a=this.logicalOR(),c,d;if(this.expect("?")){c=this.assignment();if(d=this.expect(":"))return this.ternaryFn(a,c,this.assignment());
|
173
|
+
this.throwError("expected :",d)}else return a},logicalOR:function(){for(var a=this.logicalAND(),c;;)if(c=this.expect("||"))a=this.binaryFn(a,c.fn,this.logicalAND());else return a},logicalAND:function(){var a=this.equality(),c;if(c=this.expect("&&"))a=this.binaryFn(a,c.fn,this.logicalAND());return a},equality:function(){var a=this.relational(),c;if(c=this.expect("==","!=","===","!=="))a=this.binaryFn(a,c.fn,this.equality());return a},relational:function(){var a=this.additive(),c;if(c=this.expect("<",
|
174
|
+
">","<=",">="))a=this.binaryFn(a,c.fn,this.relational());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.fn,this.multiplicative());return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*","/","%");)a=this.binaryFn(a,c.fn,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(db.ZERO,a.fn,this.unary()):(a=this.expect("!"))?this.unaryFn(a.fn,this.unary()):
|
175
|
+
this.primary()},fieldAccess:function(a){var c=this,d=this.expect().text,e=Ec(d,this.options,this.text);return B(function(c,d,k){return e(k||a(c,d))},{assign:function(e,g,k){(k=a(e,k))||a.assign(e,k={});return tb(k,d,g,c.text,c.options)}})},objectIndex:function(a){var c=this,d=this.expression();this.consume("]");return B(function(e,f){var g=a(e,f),k=d(e,f),m;ja(k,c.text);if(!g)return t;(g=Oa(g[k],c.text))&&(g.then&&c.options.unwrapPromises)&&(m=g,"$$v"in g||(m.$$v=t,m.then(function(a){m.$$v=a})),g=
|
176
|
+
g.$$v);return g},{assign:function(e,f,g){var k=ja(d(e,g),c.text);(g=Oa(a(e,g),c.text))||a.assign(e,g={});return g[k]=f}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this;return function(f,g){for(var k=[],m=c?c(f,g):f,h=0;h<d.length;h++)k.push(d[h](f,g));h=a(f,g,m)||y;Oa(m,e.text);var l=e.text;if(h){if(h.constructor===h)throw ka("isecfn",l);if(h===Ne||h===Oe||Qc&&h===Qc)throw ka("isecff",l);}k=h.apply?
|
177
|
+
h.apply(m,k):h(k[0],k[1],k[2],k[3],k[4]);return Oa(k,e.text)}},arrayDeclaration:function(){var a=[],c=!0;if("]"!==this.peekToken().text){do{if(this.peek("]"))break;var d=this.expression();a.push(d);d.constant||(c=!1)}while(this.expect(","))}this.consume("]");return B(function(c,d){for(var g=[],k=0;k<a.length;k++)g.push(a[k](c,d));return g},{literal:!0,constant:c})},object:function(){var a=[],c=!0;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;var d=this.expect(),d=d.string||d.text;this.consume(":");
|
178
|
+
var e=this.expression();a.push({key:d,value:e});e.constant||(c=!1)}while(this.expect(","))}this.consume("}");return B(function(c,d){for(var e={},m=0;m<a.length;m++){var h=a[m];e[h.key]=h.value(c,d)}return e},{literal:!0,constant:c})}};var Vb={},wa=x("$sce"),fa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},V=X.createElement("a"),Hc=ua(Q.location.href,!0);mc.$inject=["$provide"];Ic.$inject=["$locale"];Kc.$inject=["$locale"];var Nc=".",He={yyyy:Y("FullYear",4),yy:Y("FullYear",
|
179
|
+
2,0,!0),y:Y("FullYear",1),MMMM:ub("Month"),MMM:ub("Month",!0),MM:Y("Month",2,1),M:Y("Month",1,1),dd:Y("Date",2),d:Y("Date",1),HH:Y("Hours",2),H:Y("Hours",1),hh:Y("Hours",2,-12),h:Y("Hours",1,-12),mm:Y("Minutes",2),m:Y("Minutes",1),ss:Y("Seconds",2),s:Y("Seconds",1),sss:Y("Milliseconds",3),EEEE:ub("Day"),EEE:ub("Day",!0),a:function(a,c){return 12>a.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();return a=(0<=a?"+":"")+(Xb(Math[0<a?"floor":"ceil"](a/60),2)+Xb(Math.abs(a%60),
|
180
|
+
2))}},Ge=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,Fe=/^\-?\d+$/;Jc.$inject=["$locale"];var De=$(N),Ee=$(Ia);Lc.$inject=["$parse"];var dd=$({restrict:"E",compile:function(a,c){8>=R&&(c.href||c.name||c.$set("href",""),a.append(X.createComment("IE fix")));if(!c.href&&!c.xlinkHref&&!c.name)return function(a,c){var f="[object SVGAnimatedString]"===ya.call(c.prop("href"))?"xlink:href":"href";c.on("click",function(a){c.attr(f)||a.preventDefault()})}}}),Fb={};r(ob,function(a,
|
181
|
+
c){if("multiple"!=a){var d=na("ng-"+c);Fb[d]=function(){return{priority:100,link:function(a,f,g){a.$watch(g[d],function(a){g.$set(c,!!a)})}}}}});r(["src","srcset","href"],function(a){var c=na("ng-"+a);Fb[c]=function(){return{priority:99,link:function(d,e,f){var g=a,k=a;"href"===a&&"[object SVGAnimatedString]"===ya.call(e.prop("href"))&&(k="xlinkHref",f.$attr[k]="xlink:href",g=null);f.$observe(c,function(c){c?(f.$set(k,c),R&&g&&e.prop(g,f[k])):"href"===a&&f.$set(k,null)})}}}});var xb={$addControl:y,
|
182
|
+
$removeControl:y,$setValidity:y,$setDirty:y,$setPristine:y};Oc.$inject=["$element","$attrs","$scope","$animate"];var Rc=function(a){return["$timeout",function(c){return{name:"form",restrict:a?"EAC":"E",controller:Oc,compile:function(){return{pre:function(a,e,f,g){if(!f.action){var k=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};rb(e[0],"submit",k);e.on("$destroy",function(){c(function(){Za(e[0],"submit",k)},0,!1)})}var m=e.parent().controller("form"),h=f.name||f.ngForm;h&&tb(a,
|
183
|
+
h,g,h);if(m)e.on("$destroy",function(){m.$removeControl(g);h&&tb(a,h,t,h);B(g,xb)})}}}}}]},ed=Rc(),rd=Rc(!0),Qe=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,Re=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,Se=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,Sc={text:zb,number:function(a,c,d,e,f,g){zb(a,c,d,e,f,g);e.$parsers.push(function(a){var c=e.$isEmpty(a);if(c||Se.test(a))return e.$setValidity("number",!0),""===
|
184
|
+
a?null:c?a:parseFloat(a);e.$setValidity("number",!1);return t});Ie(e,"number",Te,null,e.$$validityState);e.$formatters.push(function(a){return e.$isEmpty(a)?"":""+a});d.min&&(a=function(a){var c=parseFloat(d.min);return ra(e,"min",e.$isEmpty(a)||a>=c,a)},e.$parsers.push(a),e.$formatters.push(a));d.max&&(a=function(a){var c=parseFloat(d.max);return ra(e,"max",e.$isEmpty(a)||a<=c,a)},e.$parsers.push(a),e.$formatters.push(a));e.$formatters.push(function(a){return ra(e,"number",e.$isEmpty(a)||Ab(a),a)})},
|
185
|
+
url:function(a,c,d,e,f,g){zb(a,c,d,e,f,g);a=function(a){return ra(e,"url",e.$isEmpty(a)||Qe.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,f,g){zb(a,c,d,e,f,g);a=function(a){return ra(e,"email",e.$isEmpty(a)||Re.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){D(d.name)&&c.attr("name",gb());c.on("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",
|
186
|
+
e.$render)},checkbox:function(a,c,d,e){var f=d.ngTrueValue,g=d.ngFalseValue;z(f)||(f=!0);z(g)||(g=!1);c.on("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return a!==f};e.$formatters.push(function(a){return a===f});e.$parsers.push(function(a){return a?f:g})},hidden:y,button:y,submit:y,reset:y,file:y},Te=["badInput"],jc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,
|
187
|
+
e,f,g){g&&(Sc[N(f.type)]||Sc.text)(d,e,f,g,c,a)}}}],wb="ng-valid",vb="ng-invalid",Pa="ng-pristine",yb="ng-dirty",Ue=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate",function(a,c,d,e,f,g){function k(a,c){c=c?"-"+kb(c,"-"):"";g.removeClass(e,(a?vb:wb)+c);g.addClass(e,(a?wb:vb)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var m=f(d.ngModel),
|
188
|
+
h=m.assign;if(!h)throw x("ngModel")("nonassign",d.ngModel,ha(e));this.$render=y;this.$isEmpty=function(a){return D(a)||""===a||null===a||a!==a};var l=e.inheritedData("$formController")||xb,n=0,p=this.$error={};e.addClass(Pa);k(!0);this.$setValidity=function(a,c){p[a]!==!c&&(c?(p[a]&&n--,n||(k(!0),this.$valid=!0,this.$invalid=!1)):(k(!1),this.$invalid=!0,this.$valid=!1,n++),p[a]=!c,k(c,a),l.$setValidity(a,c,this))};this.$setPristine=function(){this.$dirty=!1;this.$pristine=!0;g.removeClass(e,yb);g.addClass(e,
|
189
|
+
Pa)};this.$setViewValue=function(d){this.$viewValue=d;this.$pristine&&(this.$dirty=!0,this.$pristine=!1,g.removeClass(e,Pa),g.addClass(e,yb),l.$setDirty());r(this.$parsers,function(a){d=a(d)});this.$modelValue!==d&&(this.$modelValue=d,h(a,d),r(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}}))};var q=this;a.$watch(function(){var c=m(a);if(q.$modelValue!==c){var d=q.$formatters,e=d.length;for(q.$modelValue=c;e--;)c=d[e](c);q.$viewValue!==c&&(q.$viewValue=c,q.$render())}return c})}],Gd=
|
190
|
+
function(){return{require:["ngModel","^?form"],controller:Ue,link:function(a,c,d,e){var f=e[0],g=e[1]||xb;g.$addControl(f);a.$on("$destroy",function(){g.$removeControl(f)})}}},Id=$({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),kc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var f=function(a){if(d.required&&e.$isEmpty(a))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(f);
|
191
|
+
e.$parsers.unshift(f);d.$observe("required",function(){f(e.$viewValue)})}}}},Hd=function(){return{require:"ngModel",link:function(a,c,d,e){var f=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){if(!D(a)){var c=[];a&&r(a.split(f),function(a){a&&c.push(aa(a))});return c}});e.$formatters.push(function(a){return H(a)?a.join(", "):t});e.$isEmpty=function(a){return!a||!a.length}}}},Ve=/^(true|false|\d+)$/,Jd=function(){return{priority:100,compile:function(a,c){return Ve.test(c.ngValue)?
|
192
|
+
function(a,c,f){f.$set("value",a.$eval(f.ngValue))}:function(a,c,f){a.$watch(f.ngValue,function(a){f.$set("value",a)})}}}},jd=xa({compile:function(a){a.addClass("ng-binding");return function(a,d,e){d.data("$binding",e.ngBind);a.$watch(e.ngBind,function(a){d.text(a==t?"":a)})}}}),ld=["$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)})}}],kd=["$sce","$parse",function(a,c){return{compile:function(d){d.addClass("ng-binding");
|
193
|
+
return function(d,f,g){f.data("$binding",g.ngBindHtml);var k=c(g.ngBindHtml);d.$watch(function(){return(k(d)||"").toString()},function(c){f.html(a.getTrustedHtml(k(d))||"")})}}}}],md=Yb("",!0),od=Yb("Odd",0),nd=Yb("Even",1),pd=xa({compile:function(a,c){c.$set("ngCloak",t);a.removeClass("ng-cloak")}}),qd=[function(){return{scope:!0,controller:"@",priority:500}}],lc={};r("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),
|
194
|
+
function(a){var c=na("ng-"+a);lc[c]=["$parse",function(d){return{compile:function(e,f){var g=d(f[c]);return function(c,d){d.on(N(a),function(a){c.$apply(function(){g(c,{$event:a})})})}}}}]});var td=["$animate",function(a){return{transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,f,g){var k,m,h;c.$watch(e.ngIf,function(f){Ta(f)?m||(m=c.$new(),g(m,function(c){c[c.length++]=X.createComment(" end ngIf: "+e.ngIf+" ");k={clone:c};a.enter(c,d.parent(),d)})):(h&&(h.remove(),
|
195
|
+
h=null),m&&(m.$destroy(),m=null),k&&(h=Eb(k.clone),a.leave(h,function(){h=null}),k=null))})}}}],ud=["$http","$templateCache","$anchorScroll","$animate","$sce",function(a,c,d,e,f){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Ua.noop,compile:function(g,k){var m=k.ngInclude||k.src,h=k.onload||"",l=k.autoscroll;return function(g,k,q,r,L){var v=0,t,u,I,w=function(){u&&(u.remove(),u=null);t&&(t.$destroy(),t=null);I&&(e.leave(I,function(){u=null}),u=I,I=null)};g.$watch(f.parseAsResourceUrl(m),
|
196
|
+
function(f){var m=function(){!A(l)||l&&!g.$eval(l)||d()},q=++v;f?(a.get(f,{cache:c}).success(function(a){if(q===v){var c=g.$new();r.template=a;a=L(c,function(a){w();e.enter(a,null,k,m)});t=c;I=a;t.$emit("$includeContentLoaded");g.$eval(h)}}).error(function(){q===v&&w()}),g.$emit("$includeContentRequested")):(w(),r.template=null)})}}}}],Kd=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(c,d,e,f){d.html(f.template);a(d.contents())(c)}}}],vd=xa({priority:450,
|
197
|
+
compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),wd=xa({terminal:!0,priority:1E3}),xd=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,f,g){var k=g.count,m=g.$attr.when&&f.attr(g.$attr.when),h=g.offset||0,l=e.$eval(m)||{},n={},p=c.startSymbol(),q=c.endSymbol(),s=/^when(Minus)?(.+)$/;r(g,function(a,c){s.test(c)&&(l[N(c.replace("when","").replace("Minus","-"))]=f.attr(g.$attr[c]))});r(l,function(a,e){n[e]=c(a.replace(d,p+k+"-"+h+q))});e.$watch(function(){var c=
|
198
|
+
parseFloat(e.$eval(k));if(isNaN(c))return"";c in l||(c=a.pluralCat(c-h));return n[c](e,f,!0)},function(a){f.text(a)})}}}],yd=["$parse","$animate",function(a,c){var d=x("ngRepeat");return{transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,link:function(e,f,g,k,m){var h=g.ngRepeat,l=h.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),n,p,q,s,t,v,C={$id:Ka};if(!l)throw d("iexp",h);g=l[1];k=l[2];(l=l[3])?(n=a(l),p=function(a,c,d){v&&(C[v]=a);C[t]=c;C.$index=d;return n(e,
|
199
|
+
C)}):(q=function(a,c){return Ka(c)},s=function(a){return a});l=g.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!l)throw d("iidexp",g);t=l[3]||l[1];v=l[2];var A={};e.$watchCollection(k,function(a){var g,k,l=f[0],n,C={},J,E,F,x,z,y,H=[];if(fb(a))z=a,n=p||q;else{n=p||s;z=[];for(F in a)a.hasOwnProperty(F)&&"$"!=F.charAt(0)&&z.push(F);z.sort()}J=z.length;k=H.length=z.length;for(g=0;g<k;g++)if(F=a===z?g:z[g],x=a[F],x=n(F,x,g),Ca(x,"`track by` id"),A.hasOwnProperty(x))y=A[x],delete A[x],C[x]=
|
200
|
+
y,H[g]=y;else{if(C.hasOwnProperty(x))throw r(H,function(a){a&&a.scope&&(A[a.id]=a)}),d("dupes",h,x);H[g]={id:x};C[x]=!1}for(F in A)A.hasOwnProperty(F)&&(y=A[F],g=Eb(y.clone),c.leave(g),r(g,function(a){a.$$NG_REMOVED=!0}),y.scope.$destroy());g=0;for(k=z.length;g<k;g++){F=a===z?g:z[g];x=a[F];y=H[g];H[g-1]&&(l=H[g-1].clone[H[g-1].clone.length-1]);if(y.scope){E=y.scope;n=l;do n=n.nextSibling;while(n&&n.$$NG_REMOVED);y.clone[0]!=n&&c.move(Eb(y.clone),null,u(l));l=y.clone[y.clone.length-1]}else E=e.$new();
|
201
|
+
E[t]=x;v&&(E[v]=F);E.$index=g;E.$first=0===g;E.$last=g===J-1;E.$middle=!(E.$first||E.$last);E.$odd=!(E.$even=0===(g&1));y.scope||m(E,function(a){a[a.length++]=X.createComment(" end ngRepeat: "+h+" ");c.enter(a,null,u(l));l=a;y.scope=E;y.clone=a;C[y.id]=y})}A=C})}}}],zd=["$animate",function(a){return function(c,d,e){c.$watch(e.ngShow,function(c){a[Ta(c)?"removeClass":"addClass"](d,"ng-hide")})}}],sd=["$animate",function(a){return function(c,d,e){c.$watch(e.ngHide,function(c){a[Ta(c)?"addClass":"removeClass"](d,
|
202
|
+
"ng-hide")})}}],Ad=xa(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&r(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Bd=["$animate",function(a){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(c,d,e,f){var g=[],k=[],m=[],h=[];c.$watch(e.ngSwitch||e.on,function(d){var n,p;n=0;for(p=m.length;n<p;++n)m[n].remove();n=m.length=0;for(p=h.length;n<p;++n){var q=k[n];h[n].$destroy();m[n]=q;a.leave(q,function(){m.splice(n,1)})}k.length=0;h.length=
|
203
|
+
0;if(g=f.cases["!"+d]||f.cases["?"])c.$eval(e.change),r(g,function(d){var e=c.$new();h.push(e);d.transclude(e,function(c){var e=d.element;k.push(c);a.enter(c,e.parent(),e)})})})}}}],Cd=xa({transclude:"element",priority:800,require:"^ngSwitch",link:function(a,c,d,e,f){e.cases["!"+d.ngSwitchWhen]=e.cases["!"+d.ngSwitchWhen]||[];e.cases["!"+d.ngSwitchWhen].push({transclude:f,element:c})}}),Dd=xa({transclude:"element",priority:800,require:"^ngSwitch",link:function(a,c,d,e,f){e.cases["?"]=e.cases["?"]||
|
204
|
+
[];e.cases["?"].push({transclude:f,element:c})}}),Fd=xa({link:function(a,c,d,e,f){if(!f)throw x("ngTransclude")("orphan",ha(c));f(function(a){c.empty();c.append(a)})}}),fd=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){"text/ng-template"==d.type&&a.put(d.id,c[0].text)}}}],We=x("ngOptions"),Ed=$({terminal:!0}),gd=["$compile","$parse",function(a,c){var d=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
|
205
|
+
e={$setViewValue:y};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var m=this,h={},l=e,n;m.databound=d.ngModel;m.init=function(a,c,d){l=a;n=d};m.addOption=function(c){Ca(c,'"option value"');h[c]=!0;l.$viewValue==c&&(a.val(c),n.parent()&&n.remove())};m.removeOption=function(a){this.hasOption(a)&&(delete h[a],l.$viewValue==a&&this.renderUnknownOption(a))};m.renderUnknownOption=function(c){c="? "+Ka(c)+" ?";n.val(c);a.prepend(n);a.val(c);n.prop("selected",
|
206
|
+
!0)};m.hasOption=function(a){return h.hasOwnProperty(a)};c.$on("$destroy",function(){m.renderUnknownOption=y})}],link:function(e,g,k,m){function h(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(z.parent()&&z.remove(),c.val(a),""===a&&v.prop("selected",!0)):D(a)&&v?c.val(""):e.renderUnknownOption(a)};c.on("change",function(){a.$apply(function(){z.parent()&&z.remove();d.$setViewValue(c.val())})})}function l(a,c,d){var e;d.$render=function(){var a=new ab(d.$viewValue);r(c.find("option"),
|
207
|
+
function(c){c.selected=A(a.get(c.value))})};a.$watch(function(){za(e,d.$viewValue)||(e=ga(d.$viewValue),d.$render())});c.on("change",function(){a.$apply(function(){var a=[];r(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function n(e,f,g){function k(){var a={"":[]},c=[""],d,h,s,t,w;s=g.$modelValue;t=v(e)||[];var E=n?Zb(t):t,I,M,B;M={};B=!1;if(q)if(h=g.$modelValue,u&&H(h))for(B=new ab([]),d={},w=0;w<h.length;w++)d[m]=h[w],B.put(u(e,d),h[w]);else B=new ab(h);w=B;
|
208
|
+
var D,J;for(B=0;I=E.length,B<I;B++){h=B;if(n){h=E[B];if("$"===h.charAt(0))continue;M[n]=h}M[m]=t[h];d=p(e,M)||"";(h=a[d])||(h=a[d]=[],c.push(d));q?d=A(w.remove(u?u(e,M):r(e,M))):(u?(d={},d[m]=s,d=u(e,d)===u(e,M)):d=s===r(e,M),w=w||d);D=l(e,M);D=A(D)?D:"";h.push({id:u?u(e,M):n?E[B]:B,label:D,selected:d})}q||(x||null===s?a[""].unshift({id:"",label:"",selected:!w}):w||a[""].unshift({id:"?",label:"",selected:!0}));M=0;for(E=c.length;M<E;M++){d=c[M];h=a[d];z.length<=M?(s={element:y.clone().attr("label",
|
209
|
+
d),label:h.label},t=[s],z.push(t),f.append(s.element)):(t=z[M],s=t[0],s.label!=d&&s.element.attr("label",s.label=d));D=null;B=0;for(I=h.length;B<I;B++)d=h[B],(w=t[B+1])?(D=w.element,w.label!==d.label&&D.text(w.label=d.label),w.id!==d.id&&D.val(w.id=d.id),D[0].selected!==d.selected&&(D.prop("selected",w.selected=d.selected),R&&D.prop("selected",w.selected))):(""===d.id&&x?J=x:(J=C.clone()).val(d.id).prop("selected",d.selected).attr("selected",d.selected).text(d.label),t.push({element:J,label:d.label,
|
210
|
+
id:d.id,selected:d.selected}),D?D.after(J):s.element.append(J),D=J);for(B++;t.length>B;)t.pop().element.remove()}for(;z.length>M;)z.pop()[0].element.remove()}var h;if(!(h=s.match(d)))throw We("iexp",s,ha(f));var l=c(h[2]||h[1]),m=h[4]||h[6],n=h[5],p=c(h[3]||""),r=c(h[2]?h[1]:m),v=c(h[7]),u=h[8]?c(h[8]):null,z=[[{element:f,label:""}]];x&&(a(x)(e),x.removeClass("ng-scope"),x.remove());f.empty();f.on("change",function(){e.$apply(function(){var a,c=v(e)||[],d={},h,l,p,s,w,x,y;if(q)for(l=[],s=0,x=z.length;s<
|
211
|
+
x;s++)for(a=z[s],p=1,w=a.length;p<w;p++){if((h=a[p].element)[0].selected){h=h.val();n&&(d[n]=h);if(u)for(y=0;y<c.length&&(d[m]=c[y],u(e,d)!=h);y++);else d[m]=c[h];l.push(r(e,d))}}else if(h=f.val(),"?"==h)l=t;else if(""===h)l=null;else if(u)for(y=0;y<c.length;y++){if(d[m]=c[y],u(e,d)==h){l=r(e,d);break}}else d[m]=c[h],n&&(d[n]=h),l=r(e,d);g.$setViewValue(l);k()})});g.$render=k;e.$watchCollection(v,k);q&&e.$watchCollection(function(){return g.$modelValue},k)}if(m[1]){var p=m[0];m=m[1];var q=k.multiple,
|
212
|
+
s=k.ngOptions,x=!1,v,C=u(X.createElement("option")),y=u(X.createElement("optgroup")),z=C.clone();k=0;for(var w=g.children(),B=w.length;k<B;k++)if(""===w[k].value){v=x=w.eq(k);break}p.init(m,x,z);q&&(m.$isEmpty=function(a){return!a||0===a.length});s?n(e,g,m):q?l(e,g,m):h(e,g,m,p)}}}}],id=["$interpolate",function(a){var c={addOption:y,removeOption:y};return{restrict:"E",priority:100,compile:function(d,e){if(D(e.value)){var f=a(d.text(),!0);f||e.$set("value",d.text())}return function(a,d,e){var h=d.parent(),
|
213
|
+
l=h.data("$selectController")||h.parent().data("$selectController");l&&l.databound?d.prop("selected",!1):l=c;f?a.$watch(f,function(a,c){e.$set("value",a);a!==c&&l.removeOption(c);l.addOption(a)}):l.addOption(e.value);d.on("$destroy",function(){l.removeOption(e.value)})}}}}],hd=$({restrict:"E",terminal:!0});Q.angular.bootstrap?console.log("WARNING: Tried to load angular more than once."):((Da=Q.jQuery)&&Da.fn.on?(u=Da,B(Da.fn,{scope:La.scope,isolateScope:La.isolateScope,controller:La.controller,injector:La.injector,
|
214
|
+
inheritedData:La.inheritedData}),Gb("remove",!0,!0,!1),Gb("empty",!1,!1,!1),Gb("html",!1,!1,!0)):u=S,Ua.element=u,$c(Ua),u(X).ready(function(){Xc(X,fc)}))})(window,document);!window.angular.$$csp()&&window.angular.element(document).find("head").prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}.ng-hide-add-active,.ng-hide-remove{display:block!important;}</style>');
|
215
|
+
//# sourceMappingURL=angular.min.js.map
|
@@ -0,0 +1,3223 @@
|
|
1
|
+
/**
|
2
|
+
* State-based routing for AngularJS
|
3
|
+
* @version v0.2.10
|
4
|
+
* @link http://angular-ui.github.com/
|
5
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
6
|
+
*/
|
7
|
+
|
8
|
+
/* commonjs package manager support (eg componentjs) */
|
9
|
+
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){
|
10
|
+
module.exports = 'ui.router';
|
11
|
+
}
|
12
|
+
|
13
|
+
(function (window, angular, undefined) {
|
14
|
+
/*jshint globalstrict:true*/
|
15
|
+
/*global angular:false*/
|
16
|
+
'use strict';
|
17
|
+
|
18
|
+
var isDefined = angular.isDefined,
|
19
|
+
isFunction = angular.isFunction,
|
20
|
+
isString = angular.isString,
|
21
|
+
isObject = angular.isObject,
|
22
|
+
isArray = angular.isArray,
|
23
|
+
forEach = angular.forEach,
|
24
|
+
extend = angular.extend,
|
25
|
+
copy = angular.copy;
|
26
|
+
|
27
|
+
function inherit(parent, extra) {
|
28
|
+
return extend(new (extend(function() {}, { prototype: parent }))(), extra);
|
29
|
+
}
|
30
|
+
|
31
|
+
function merge(dst) {
|
32
|
+
forEach(arguments, function(obj) {
|
33
|
+
if (obj !== dst) {
|
34
|
+
forEach(obj, function(value, key) {
|
35
|
+
if (!dst.hasOwnProperty(key)) dst[key] = value;
|
36
|
+
});
|
37
|
+
}
|
38
|
+
});
|
39
|
+
return dst;
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Finds the common ancestor path between two states.
|
44
|
+
*
|
45
|
+
* @param {Object} first The first state.
|
46
|
+
* @param {Object} second The second state.
|
47
|
+
* @return {Array} Returns an array of state names in descending order, not including the root.
|
48
|
+
*/
|
49
|
+
function ancestors(first, second) {
|
50
|
+
var path = [];
|
51
|
+
|
52
|
+
for (var n in first.path) {
|
53
|
+
if (first.path[n] !== second.path[n]) break;
|
54
|
+
path.push(first.path[n]);
|
55
|
+
}
|
56
|
+
return path;
|
57
|
+
}
|
58
|
+
|
59
|
+
/**
|
60
|
+
* IE8-safe wrapper for `Object.keys()`.
|
61
|
+
*
|
62
|
+
* @param {Object} object A JavaScript object.
|
63
|
+
* @return {Array} Returns the keys of the object as an array.
|
64
|
+
*/
|
65
|
+
function keys(object) {
|
66
|
+
if (Object.keys) {
|
67
|
+
return Object.keys(object);
|
68
|
+
}
|
69
|
+
var result = [];
|
70
|
+
|
71
|
+
angular.forEach(object, function(val, key) {
|
72
|
+
result.push(key);
|
73
|
+
});
|
74
|
+
return result;
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
* IE8-safe wrapper for `Array.prototype.indexOf()`.
|
79
|
+
*
|
80
|
+
* @param {Array} array A JavaScript array.
|
81
|
+
* @param {*} value A value to search the array for.
|
82
|
+
* @return {Number} Returns the array index value of `value`, or `-1` if not present.
|
83
|
+
*/
|
84
|
+
function arraySearch(array, value) {
|
85
|
+
if (Array.prototype.indexOf) {
|
86
|
+
return array.indexOf(value, Number(arguments[2]) || 0);
|
87
|
+
}
|
88
|
+
var len = array.length >>> 0, from = Number(arguments[2]) || 0;
|
89
|
+
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
|
90
|
+
|
91
|
+
if (from < 0) from += len;
|
92
|
+
|
93
|
+
for (; from < len; from++) {
|
94
|
+
if (from in array && array[from] === value) return from;
|
95
|
+
}
|
96
|
+
return -1;
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Merges a set of parameters with all parameters inherited between the common parents of the
|
101
|
+
* current state and a given destination state.
|
102
|
+
*
|
103
|
+
* @param {Object} currentParams The value of the current state parameters ($stateParams).
|
104
|
+
* @param {Object} newParams The set of parameters which will be composited with inherited params.
|
105
|
+
* @param {Object} $current Internal definition of object representing the current state.
|
106
|
+
* @param {Object} $to Internal definition of object representing state to transition to.
|
107
|
+
*/
|
108
|
+
function inheritParams(currentParams, newParams, $current, $to) {
|
109
|
+
var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];
|
110
|
+
|
111
|
+
for (var i in parents) {
|
112
|
+
if (!parents[i].params || !parents[i].params.length) continue;
|
113
|
+
parentParams = parents[i].params;
|
114
|
+
|
115
|
+
for (var j in parentParams) {
|
116
|
+
if (arraySearch(inheritList, parentParams[j]) >= 0) continue;
|
117
|
+
inheritList.push(parentParams[j]);
|
118
|
+
inherited[parentParams[j]] = currentParams[parentParams[j]];
|
119
|
+
}
|
120
|
+
}
|
121
|
+
return extend({}, inherited, newParams);
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Normalizes a set of values to string or `null`, filtering them by a list of keys.
|
126
|
+
*
|
127
|
+
* @param {Array} keys The list of keys to normalize/return.
|
128
|
+
* @param {Object} values An object hash of values to normalize.
|
129
|
+
* @return {Object} Returns an object hash of normalized string values.
|
130
|
+
*/
|
131
|
+
function normalize(keys, values) {
|
132
|
+
var normalized = {};
|
133
|
+
|
134
|
+
forEach(keys, function (name) {
|
135
|
+
var value = values[name];
|
136
|
+
normalized[name] = (value != null) ? String(value) : null;
|
137
|
+
});
|
138
|
+
return normalized;
|
139
|
+
}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
|
143
|
+
*
|
144
|
+
* @param {Object} a The first object.
|
145
|
+
* @param {Object} b The second object.
|
146
|
+
* @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,
|
147
|
+
* it defaults to the list of keys in `a`.
|
148
|
+
* @return {Boolean} Returns `true` if the keys match, otherwise `false`.
|
149
|
+
*/
|
150
|
+
function equalForKeys(a, b, keys) {
|
151
|
+
if (!keys) {
|
152
|
+
keys = [];
|
153
|
+
for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
|
154
|
+
}
|
155
|
+
|
156
|
+
for (var i=0; i<keys.length; i++) {
|
157
|
+
var k = keys[i];
|
158
|
+
if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized
|
159
|
+
}
|
160
|
+
return true;
|
161
|
+
}
|
162
|
+
|
163
|
+
/**
|
164
|
+
* Returns the subset of an object, based on a list of keys.
|
165
|
+
*
|
166
|
+
* @param {Array} keys
|
167
|
+
* @param {Object} values
|
168
|
+
* @return {Boolean} Returns a subset of `values`.
|
169
|
+
*/
|
170
|
+
function filterByKeys(keys, values) {
|
171
|
+
var filtered = {};
|
172
|
+
|
173
|
+
forEach(keys, function (name) {
|
174
|
+
filtered[name] = values[name];
|
175
|
+
});
|
176
|
+
return filtered;
|
177
|
+
}
|
178
|
+
/**
|
179
|
+
* @ngdoc overview
|
180
|
+
* @name ui.router.util
|
181
|
+
*
|
182
|
+
* @description
|
183
|
+
* # ui.router.util sub-module
|
184
|
+
*
|
185
|
+
* This module is a dependency of other sub-modules. Do not include this module as a dependency
|
186
|
+
* in your angular app (use {@link ui.router} module instead).
|
187
|
+
*
|
188
|
+
*/
|
189
|
+
angular.module('ui.router.util', ['ng']);
|
190
|
+
|
191
|
+
/**
|
192
|
+
* @ngdoc overview
|
193
|
+
* @name ui.router.router
|
194
|
+
*
|
195
|
+
* @requires ui.router.util
|
196
|
+
*
|
197
|
+
* @description
|
198
|
+
* # ui.router.router sub-module
|
199
|
+
*
|
200
|
+
* This module is a dependency of other sub-modules. Do not include this module as a dependency
|
201
|
+
* in your angular app (use {@link ui.router} module instead).
|
202
|
+
*/
|
203
|
+
angular.module('ui.router.router', ['ui.router.util']);
|
204
|
+
|
205
|
+
/**
|
206
|
+
* @ngdoc overview
|
207
|
+
* @name ui.router.state
|
208
|
+
*
|
209
|
+
* @requires ui.router.router
|
210
|
+
* @requires ui.router.util
|
211
|
+
*
|
212
|
+
* @description
|
213
|
+
* # ui.router.state sub-module
|
214
|
+
*
|
215
|
+
* This module is a dependency of the main ui.router module. Do not include this module as a dependency
|
216
|
+
* in your angular app (use {@link ui.router} module instead).
|
217
|
+
*
|
218
|
+
*/
|
219
|
+
angular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);
|
220
|
+
|
221
|
+
/**
|
222
|
+
* @ngdoc overview
|
223
|
+
* @name ui.router
|
224
|
+
*
|
225
|
+
* @requires ui.router.state
|
226
|
+
*
|
227
|
+
* @description
|
228
|
+
* # ui.router
|
229
|
+
*
|
230
|
+
* ## The main module for ui.router
|
231
|
+
* There are several sub-modules included with the ui.router module, however only this module is needed
|
232
|
+
* as a dependency within your angular app. The other modules are for organization purposes.
|
233
|
+
*
|
234
|
+
* The modules are:
|
235
|
+
* * ui.router - the main "umbrella" module
|
236
|
+
* * ui.router.router -
|
237
|
+
*
|
238
|
+
* *You'll need to include **only** this module as the dependency within your angular app.*
|
239
|
+
*
|
240
|
+
* <pre>
|
241
|
+
* <!doctype html>
|
242
|
+
* <html ng-app="myApp">
|
243
|
+
* <head>
|
244
|
+
* <script src="js/angular.js"></script>
|
245
|
+
* <!-- Include the ui-router script -->
|
246
|
+
* <script src="js/angular-ui-router.min.js"></script>
|
247
|
+
* <script>
|
248
|
+
* // ...and add 'ui.router' as a dependency
|
249
|
+
* var myApp = angular.module('myApp', ['ui.router']);
|
250
|
+
* </script>
|
251
|
+
* </head>
|
252
|
+
* <body>
|
253
|
+
* </body>
|
254
|
+
* </html>
|
255
|
+
* </pre>
|
256
|
+
*/
|
257
|
+
angular.module('ui.router', ['ui.router.state']);
|
258
|
+
|
259
|
+
angular.module('ui.router.compat', ['ui.router']);
|
260
|
+
|
261
|
+
/**
|
262
|
+
* @ngdoc object
|
263
|
+
* @name ui.router.util.$resolve
|
264
|
+
*
|
265
|
+
* @requires $q
|
266
|
+
* @requires $injector
|
267
|
+
*
|
268
|
+
* @description
|
269
|
+
* Manages resolution of (acyclic) graphs of promises.
|
270
|
+
*/
|
271
|
+
$Resolve.$inject = ['$q', '$injector'];
|
272
|
+
function $Resolve( $q, $injector) {
|
273
|
+
|
274
|
+
var VISIT_IN_PROGRESS = 1,
|
275
|
+
VISIT_DONE = 2,
|
276
|
+
NOTHING = {},
|
277
|
+
NO_DEPENDENCIES = [],
|
278
|
+
NO_LOCALS = NOTHING,
|
279
|
+
NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });
|
280
|
+
|
281
|
+
|
282
|
+
/**
|
283
|
+
* @ngdoc function
|
284
|
+
* @name ui.router.util.$resolve#study
|
285
|
+
* @methodOf ui.router.util.$resolve
|
286
|
+
*
|
287
|
+
* @description
|
288
|
+
* Studies a set of invocables that are likely to be used multiple times.
|
289
|
+
* <pre>
|
290
|
+
* $resolve.study(invocables)(locals, parent, self)
|
291
|
+
* </pre>
|
292
|
+
* is equivalent to
|
293
|
+
* <pre>
|
294
|
+
* $resolve.resolve(invocables, locals, parent, self)
|
295
|
+
* </pre>
|
296
|
+
* but the former is more efficient (in fact `resolve` just calls `study`
|
297
|
+
* internally).
|
298
|
+
*
|
299
|
+
* @param {object} invocables Invocable objects
|
300
|
+
* @return {function} a function to pass in locals, parent and self
|
301
|
+
*/
|
302
|
+
this.study = function (invocables) {
|
303
|
+
if (!isObject(invocables)) throw new Error("'invocables' must be an object");
|
304
|
+
|
305
|
+
// Perform a topological sort of invocables to build an ordered plan
|
306
|
+
var plan = [], cycle = [], visited = {};
|
307
|
+
function visit(value, key) {
|
308
|
+
if (visited[key] === VISIT_DONE) return;
|
309
|
+
|
310
|
+
cycle.push(key);
|
311
|
+
if (visited[key] === VISIT_IN_PROGRESS) {
|
312
|
+
cycle.splice(0, cycle.indexOf(key));
|
313
|
+
throw new Error("Cyclic dependency: " + cycle.join(" -> "));
|
314
|
+
}
|
315
|
+
visited[key] = VISIT_IN_PROGRESS;
|
316
|
+
|
317
|
+
if (isString(value)) {
|
318
|
+
plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);
|
319
|
+
} else {
|
320
|
+
var params = $injector.annotate(value);
|
321
|
+
forEach(params, function (param) {
|
322
|
+
if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);
|
323
|
+
});
|
324
|
+
plan.push(key, value, params);
|
325
|
+
}
|
326
|
+
|
327
|
+
cycle.pop();
|
328
|
+
visited[key] = VISIT_DONE;
|
329
|
+
}
|
330
|
+
forEach(invocables, visit);
|
331
|
+
invocables = cycle = visited = null; // plan is all that's required
|
332
|
+
|
333
|
+
function isResolve(value) {
|
334
|
+
return isObject(value) && value.then && value.$$promises;
|
335
|
+
}
|
336
|
+
|
337
|
+
return function (locals, parent, self) {
|
338
|
+
if (isResolve(locals) && self === undefined) {
|
339
|
+
self = parent; parent = locals; locals = null;
|
340
|
+
}
|
341
|
+
if (!locals) locals = NO_LOCALS;
|
342
|
+
else if (!isObject(locals)) {
|
343
|
+
throw new Error("'locals' must be an object");
|
344
|
+
}
|
345
|
+
if (!parent) parent = NO_PARENT;
|
346
|
+
else if (!isResolve(parent)) {
|
347
|
+
throw new Error("'parent' must be a promise returned by $resolve.resolve()");
|
348
|
+
}
|
349
|
+
|
350
|
+
// To complete the overall resolution, we have to wait for the parent
|
351
|
+
// promise and for the promise for each invokable in our plan.
|
352
|
+
var resolution = $q.defer(),
|
353
|
+
result = resolution.promise,
|
354
|
+
promises = result.$$promises = {},
|
355
|
+
values = extend({}, locals),
|
356
|
+
wait = 1 + plan.length/3,
|
357
|
+
merged = false;
|
358
|
+
|
359
|
+
function done() {
|
360
|
+
// Merge parent values we haven't got yet and publish our own $$values
|
361
|
+
if (!--wait) {
|
362
|
+
if (!merged) merge(values, parent.$$values);
|
363
|
+
result.$$values = values;
|
364
|
+
result.$$promises = true; // keep for isResolve()
|
365
|
+
resolution.resolve(values);
|
366
|
+
}
|
367
|
+
}
|
368
|
+
|
369
|
+
function fail(reason) {
|
370
|
+
result.$$failure = reason;
|
371
|
+
resolution.reject(reason);
|
372
|
+
}
|
373
|
+
|
374
|
+
// Short-circuit if parent has already failed
|
375
|
+
if (isDefined(parent.$$failure)) {
|
376
|
+
fail(parent.$$failure);
|
377
|
+
return result;
|
378
|
+
}
|
379
|
+
|
380
|
+
// Merge parent values if the parent has already resolved, or merge
|
381
|
+
// parent promises and wait if the parent resolve is still in progress.
|
382
|
+
if (parent.$$values) {
|
383
|
+
merged = merge(values, parent.$$values);
|
384
|
+
done();
|
385
|
+
} else {
|
386
|
+
extend(promises, parent.$$promises);
|
387
|
+
parent.then(done, fail);
|
388
|
+
}
|
389
|
+
|
390
|
+
// Process each invocable in the plan, but ignore any where a local of the same name exists.
|
391
|
+
for (var i=0, ii=plan.length; i<ii; i+=3) {
|
392
|
+
if (locals.hasOwnProperty(plan[i])) done();
|
393
|
+
else invoke(plan[i], plan[i+1], plan[i+2]);
|
394
|
+
}
|
395
|
+
|
396
|
+
function invoke(key, invocable, params) {
|
397
|
+
// Create a deferred for this invocation. Failures will propagate to the resolution as well.
|
398
|
+
var invocation = $q.defer(), waitParams = 0;
|
399
|
+
function onfailure(reason) {
|
400
|
+
invocation.reject(reason);
|
401
|
+
fail(reason);
|
402
|
+
}
|
403
|
+
// Wait for any parameter that we have a promise for (either from parent or from this
|
404
|
+
// resolve; in that case study() will have made sure it's ordered before us in the plan).
|
405
|
+
forEach(params, function (dep) {
|
406
|
+
if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {
|
407
|
+
waitParams++;
|
408
|
+
promises[dep].then(function (result) {
|
409
|
+
values[dep] = result;
|
410
|
+
if (!(--waitParams)) proceed();
|
411
|
+
}, onfailure);
|
412
|
+
}
|
413
|
+
});
|
414
|
+
if (!waitParams) proceed();
|
415
|
+
function proceed() {
|
416
|
+
if (isDefined(result.$$failure)) return;
|
417
|
+
try {
|
418
|
+
invocation.resolve($injector.invoke(invocable, self, values));
|
419
|
+
invocation.promise.then(function (result) {
|
420
|
+
values[key] = result;
|
421
|
+
done();
|
422
|
+
}, onfailure);
|
423
|
+
} catch (e) {
|
424
|
+
onfailure(e);
|
425
|
+
}
|
426
|
+
}
|
427
|
+
// Publish promise synchronously; invocations further down in the plan may depend on it.
|
428
|
+
promises[key] = invocation.promise;
|
429
|
+
}
|
430
|
+
|
431
|
+
return result;
|
432
|
+
};
|
433
|
+
};
|
434
|
+
|
435
|
+
/**
|
436
|
+
* @ngdoc function
|
437
|
+
* @name ui.router.util.$resolve#resolve
|
438
|
+
* @methodOf ui.router.util.$resolve
|
439
|
+
*
|
440
|
+
* @description
|
441
|
+
* Resolves a set of invocables. An invocable is a function to be invoked via
|
442
|
+
* `$injector.invoke()`, and can have an arbitrary number of dependencies.
|
443
|
+
* An invocable can either return a value directly,
|
444
|
+
* or a `$q` promise. If a promise is returned it will be resolved and the
|
445
|
+
* resulting value will be used instead. Dependencies of invocables are resolved
|
446
|
+
* (in this order of precedence)
|
447
|
+
*
|
448
|
+
* - from the specified `locals`
|
449
|
+
* - from another invocable that is part of this `$resolve` call
|
450
|
+
* - from an invocable that is inherited from a `parent` call to `$resolve`
|
451
|
+
* (or recursively
|
452
|
+
* - from any ancestor `$resolve` of that parent).
|
453
|
+
*
|
454
|
+
* The return value of `$resolve` is a promise for an object that contains
|
455
|
+
* (in this order of precedence)
|
456
|
+
*
|
457
|
+
* - any `locals` (if specified)
|
458
|
+
* - the resolved return values of all injectables
|
459
|
+
* - any values inherited from a `parent` call to `$resolve` (if specified)
|
460
|
+
*
|
461
|
+
* The promise will resolve after the `parent` promise (if any) and all promises
|
462
|
+
* returned by injectables have been resolved. If any invocable
|
463
|
+
* (or `$injector.invoke`) throws an exception, or if a promise returned by an
|
464
|
+
* invocable is rejected, the `$resolve` promise is immediately rejected with the
|
465
|
+
* same error. A rejection of a `parent` promise (if specified) will likewise be
|
466
|
+
* propagated immediately. Once the `$resolve` promise has been rejected, no
|
467
|
+
* further invocables will be called.
|
468
|
+
*
|
469
|
+
* Cyclic dependencies between invocables are not permitted and will caues `$resolve`
|
470
|
+
* to throw an error. As a special case, an injectable can depend on a parameter
|
471
|
+
* with the same name as the injectable, which will be fulfilled from the `parent`
|
472
|
+
* injectable of the same name. This allows inherited values to be decorated.
|
473
|
+
* Note that in this case any other injectable in the same `$resolve` with the same
|
474
|
+
* dependency would see the decorated value, not the inherited value.
|
475
|
+
*
|
476
|
+
* Note that missing dependencies -- unlike cyclic dependencies -- will cause an
|
477
|
+
* (asynchronous) rejection of the `$resolve` promise rather than a (synchronous)
|
478
|
+
* exception.
|
479
|
+
*
|
480
|
+
* Invocables are invoked eagerly as soon as all dependencies are available.
|
481
|
+
* This is true even for dependencies inherited from a `parent` call to `$resolve`.
|
482
|
+
*
|
483
|
+
* As a special case, an invocable can be a string, in which case it is taken to
|
484
|
+
* be a service name to be passed to `$injector.get()`. This is supported primarily
|
485
|
+
* for backwards-compatibility with the `resolve` property of `$routeProvider`
|
486
|
+
* routes.
|
487
|
+
*
|
488
|
+
* @param {object} invocables functions to invoke or
|
489
|
+
* `$injector` services to fetch.
|
490
|
+
* @param {object} locals values to make available to the injectables
|
491
|
+
* @param {object} parent a promise returned by another call to `$resolve`.
|
492
|
+
* @param {object} self the `this` for the invoked methods
|
493
|
+
* @return {object} Promise for an object that contains the resolved return value
|
494
|
+
* of all invocables, as well as any inherited and local values.
|
495
|
+
*/
|
496
|
+
this.resolve = function (invocables, locals, parent, self) {
|
497
|
+
return this.study(invocables)(locals, parent, self);
|
498
|
+
};
|
499
|
+
}
|
500
|
+
|
501
|
+
angular.module('ui.router.util').service('$resolve', $Resolve);
|
502
|
+
|
503
|
+
|
504
|
+
/**
|
505
|
+
* @ngdoc object
|
506
|
+
* @name ui.router.util.$templateFactory
|
507
|
+
*
|
508
|
+
* @requires $http
|
509
|
+
* @requires $templateCache
|
510
|
+
* @requires $injector
|
511
|
+
*
|
512
|
+
* @description
|
513
|
+
* Service. Manages loading of templates.
|
514
|
+
*/
|
515
|
+
$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];
|
516
|
+
function $TemplateFactory( $http, $templateCache, $injector) {
|
517
|
+
|
518
|
+
/**
|
519
|
+
* @ngdoc function
|
520
|
+
* @name ui.router.util.$templateFactory#fromConfig
|
521
|
+
* @methodOf ui.router.util.$templateFactory
|
522
|
+
*
|
523
|
+
* @description
|
524
|
+
* Creates a template from a configuration object.
|
525
|
+
*
|
526
|
+
* @param {object} config Configuration object for which to load a template.
|
527
|
+
* The following properties are search in the specified order, and the first one
|
528
|
+
* that is defined is used to create the template:
|
529
|
+
*
|
530
|
+
* @param {string|object} config.template html string template or function to
|
531
|
+
* load via {@link ui.router.util.$templateFactory#fromString fromString}.
|
532
|
+
* @param {string|object} config.templateUrl url to load or a function returning
|
533
|
+
* the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.
|
534
|
+
* @param {Function} config.templateProvider function to invoke via
|
535
|
+
* {@link ui.router.util.$templateFactory#fromProvider fromProvider}.
|
536
|
+
* @param {object} params Parameters to pass to the template function.
|
537
|
+
* @param {object} locals Locals to pass to `invoke` if the template is loaded
|
538
|
+
* via a `templateProvider`. Defaults to `{ params: params }`.
|
539
|
+
*
|
540
|
+
* @return {string|object} The template html as a string, or a promise for
|
541
|
+
* that string,or `null` if no template is configured.
|
542
|
+
*/
|
543
|
+
this.fromConfig = function (config, params, locals) {
|
544
|
+
return (
|
545
|
+
isDefined(config.template) ? this.fromString(config.template, params) :
|
546
|
+
isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :
|
547
|
+
isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :
|
548
|
+
null
|
549
|
+
);
|
550
|
+
};
|
551
|
+
|
552
|
+
/**
|
553
|
+
* @ngdoc function
|
554
|
+
* @name ui.router.util.$templateFactory#fromString
|
555
|
+
* @methodOf ui.router.util.$templateFactory
|
556
|
+
*
|
557
|
+
* @description
|
558
|
+
* Creates a template from a string or a function returning a string.
|
559
|
+
*
|
560
|
+
* @param {string|object} template html template as a string or function that
|
561
|
+
* returns an html template as a string.
|
562
|
+
* @param {object} params Parameters to pass to the template function.
|
563
|
+
*
|
564
|
+
* @return {string|object} The template html as a string, or a promise for that
|
565
|
+
* string.
|
566
|
+
*/
|
567
|
+
this.fromString = function (template, params) {
|
568
|
+
return isFunction(template) ? template(params) : template;
|
569
|
+
};
|
570
|
+
|
571
|
+
/**
|
572
|
+
* @ngdoc function
|
573
|
+
* @name ui.router.util.$templateFactory#fromUrl
|
574
|
+
* @methodOf ui.router.util.$templateFactory
|
575
|
+
*
|
576
|
+
* @description
|
577
|
+
* Loads a template from the a URL via `$http` and `$templateCache`.
|
578
|
+
*
|
579
|
+
* @param {string|Function} url url of the template to load, or a function
|
580
|
+
* that returns a url.
|
581
|
+
* @param {Object} params Parameters to pass to the url function.
|
582
|
+
* @return {string|Promise.<string>} The template html as a string, or a promise
|
583
|
+
* for that string.
|
584
|
+
*/
|
585
|
+
this.fromUrl = function (url, params) {
|
586
|
+
if (isFunction(url)) url = url(params);
|
587
|
+
if (url == null) return null;
|
588
|
+
else return $http
|
589
|
+
.get(url, { cache: $templateCache })
|
590
|
+
.then(function(response) { return response.data; });
|
591
|
+
};
|
592
|
+
|
593
|
+
/**
|
594
|
+
* @ngdoc function
|
595
|
+
* @name ui.router.util.$templateFactory#fromUrl
|
596
|
+
* @methodOf ui.router.util.$templateFactory
|
597
|
+
*
|
598
|
+
* @description
|
599
|
+
* Creates a template by invoking an injectable provider function.
|
600
|
+
*
|
601
|
+
* @param {Function} provider Function to invoke via `$injector.invoke`
|
602
|
+
* @param {Object} params Parameters for the template.
|
603
|
+
* @param {Object} locals Locals to pass to `invoke`. Defaults to
|
604
|
+
* `{ params: params }`.
|
605
|
+
* @return {string|Promise.<string>} The template html as a string, or a promise
|
606
|
+
* for that string.
|
607
|
+
*/
|
608
|
+
this.fromProvider = function (provider, params, locals) {
|
609
|
+
return $injector.invoke(provider, null, locals || { params: params });
|
610
|
+
};
|
611
|
+
}
|
612
|
+
|
613
|
+
angular.module('ui.router.util').service('$templateFactory', $TemplateFactory);
|
614
|
+
|
615
|
+
/**
|
616
|
+
* @ngdoc object
|
617
|
+
* @name ui.router.util.type:UrlMatcher
|
618
|
+
*
|
619
|
+
* @description
|
620
|
+
* Matches URLs against patterns and extracts named parameters from the path or the search
|
621
|
+
* part of the URL. A URL pattern consists of a path pattern, optionally followed by '?' and a list
|
622
|
+
* of search parameters. Multiple search parameter names are separated by '&'. Search parameters
|
623
|
+
* do not influence whether or not a URL is matched, but their values are passed through into
|
624
|
+
* the matched parameters returned by {@link ui.router.util.type:UrlMatcher#methods_exec exec}.
|
625
|
+
*
|
626
|
+
* Path parameter placeholders can be specified using simple colon/catch-all syntax or curly brace
|
627
|
+
* syntax, which optionally allows a regular expression for the parameter to be specified:
|
628
|
+
*
|
629
|
+
* * `':'` name - colon placeholder
|
630
|
+
* * `'*'` name - catch-all placeholder
|
631
|
+
* * `'{' name '}'` - curly placeholder
|
632
|
+
* * `'{' name ':' regexp '}'` - curly placeholder with regexp. Should the regexp itself contain
|
633
|
+
* curly braces, they must be in matched pairs or escaped with a backslash.
|
634
|
+
*
|
635
|
+
* Parameter names may contain only word characters (latin letters, digits, and underscore) and
|
636
|
+
* must be unique within the pattern (across both path and search parameters). For colon
|
637
|
+
* placeholders or curly placeholders without an explicit regexp, a path parameter matches any
|
638
|
+
* number of characters other than '/'. For catch-all placeholders the path parameter matches
|
639
|
+
* any number of characters.
|
640
|
+
*
|
641
|
+
* Examples:
|
642
|
+
*
|
643
|
+
* * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for
|
644
|
+
* trailing slashes, and patterns have to match the entire path, not just a prefix.
|
645
|
+
* * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or
|
646
|
+
* '/user/bob/details'. The second path segment will be captured as the parameter 'id'.
|
647
|
+
* * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.
|
648
|
+
* * `'/user/{id:[^/]*}'` - Same as the previous example.
|
649
|
+
* * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id
|
650
|
+
* parameter consists of 1 to 8 hex digits.
|
651
|
+
* * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the
|
652
|
+
* path into the parameter 'path'.
|
653
|
+
* * `'/files/*path'` - ditto.
|
654
|
+
*
|
655
|
+
* @param {string} pattern the pattern to compile into a matcher.
|
656
|
+
*
|
657
|
+
* @property {string} prefix A static prefix of this pattern. The matcher guarantees that any
|
658
|
+
* URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns
|
659
|
+
* non-null) will start with this prefix.
|
660
|
+
*
|
661
|
+
* @property {string} source The pattern that was passed into the contructor
|
662
|
+
*
|
663
|
+
* @property {string} sourcePath The path portion of the source property
|
664
|
+
*
|
665
|
+
* @property {string} sourceSearch The search portion of the source property
|
666
|
+
*
|
667
|
+
* @property {string} regex The constructed regex that will be used to match against the url when
|
668
|
+
* it is time to determine which url will match.
|
669
|
+
*
|
670
|
+
* @returns {Object} New UrlMatcher object
|
671
|
+
*/
|
672
|
+
function UrlMatcher(pattern) {
|
673
|
+
|
674
|
+
// Find all placeholders and create a compiled pattern, using either classic or curly syntax:
|
675
|
+
// '*' name
|
676
|
+
// ':' name
|
677
|
+
// '{' name '}'
|
678
|
+
// '{' name ':' regexp '}'
|
679
|
+
// The regular expression is somewhat complicated due to the need to allow curly braces
|
680
|
+
// inside the regular expression. The placeholder regexp breaks down as follows:
|
681
|
+
// ([:*])(\w+) classic placeholder ($1 / $2)
|
682
|
+
// \{(\w+)(?:\:( ... ))?\} curly brace placeholder ($3) with optional regexp ... ($4)
|
683
|
+
// (?: ... | ... | ... )+ the regexp consists of any number of atoms, an atom being either
|
684
|
+
// [^{}\\]+ - anything other than curly braces or backslash
|
685
|
+
// \\. - a backslash escape
|
686
|
+
// \{(?:[^{}\\]+|\\.)*\} - a matched set of curly braces containing other atoms
|
687
|
+
var placeholder = /([:*])(\w+)|\{(\w+)(?:\:((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,
|
688
|
+
names = {}, compiled = '^', last = 0, m,
|
689
|
+
segments = this.segments = [],
|
690
|
+
params = this.params = [];
|
691
|
+
|
692
|
+
function addParameter(id) {
|
693
|
+
if (!/^\w+(-+\w+)*$/.test(id)) throw new Error("Invalid parameter name '" + id + "' in pattern '" + pattern + "'");
|
694
|
+
if (names[id]) throw new Error("Duplicate parameter name '" + id + "' in pattern '" + pattern + "'");
|
695
|
+
names[id] = true;
|
696
|
+
params.push(id);
|
697
|
+
}
|
698
|
+
|
699
|
+
function quoteRegExp(string) {
|
700
|
+
return string.replace(/[\\\[\]\^$*+?.()|{}]/g, "\\$&");
|
701
|
+
}
|
702
|
+
|
703
|
+
this.source = pattern;
|
704
|
+
|
705
|
+
// Split into static segments separated by path parameter placeholders.
|
706
|
+
// The number of segments is always 1 more than the number of parameters.
|
707
|
+
var id, regexp, segment;
|
708
|
+
while ((m = placeholder.exec(pattern))) {
|
709
|
+
id = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null
|
710
|
+
regexp = m[4] || (m[1] == '*' ? '.*' : '[^/]*');
|
711
|
+
segment = pattern.substring(last, m.index);
|
712
|
+
if (segment.indexOf('?') >= 0) break; // we're into the search part
|
713
|
+
compiled += quoteRegExp(segment) + '(' + regexp + ')';
|
714
|
+
addParameter(id);
|
715
|
+
segments.push(segment);
|
716
|
+
last = placeholder.lastIndex;
|
717
|
+
}
|
718
|
+
segment = pattern.substring(last);
|
719
|
+
|
720
|
+
// Find any search parameter names and remove them from the last segment
|
721
|
+
var i = segment.indexOf('?');
|
722
|
+
if (i >= 0) {
|
723
|
+
var search = this.sourceSearch = segment.substring(i);
|
724
|
+
segment = segment.substring(0, i);
|
725
|
+
this.sourcePath = pattern.substring(0, last+i);
|
726
|
+
|
727
|
+
// Allow parameters to be separated by '?' as well as '&' to make concat() easier
|
728
|
+
forEach(search.substring(1).split(/[&?]/), addParameter);
|
729
|
+
} else {
|
730
|
+
this.sourcePath = pattern;
|
731
|
+
this.sourceSearch = '';
|
732
|
+
}
|
733
|
+
|
734
|
+
compiled += quoteRegExp(segment) + '$';
|
735
|
+
segments.push(segment);
|
736
|
+
this.regexp = new RegExp(compiled);
|
737
|
+
this.prefix = segments[0];
|
738
|
+
}
|
739
|
+
|
740
|
+
/**
|
741
|
+
* @ngdoc function
|
742
|
+
* @name ui.router.util.type:UrlMatcher#concat
|
743
|
+
* @methodOf ui.router.util.type:UrlMatcher
|
744
|
+
*
|
745
|
+
* @description
|
746
|
+
* Returns a new matcher for a pattern constructed by appending the path part and adding the
|
747
|
+
* search parameters of the specified pattern to this pattern. The current pattern is not
|
748
|
+
* modified. This can be understood as creating a pattern for URLs that are relative to (or
|
749
|
+
* suffixes of) the current pattern.
|
750
|
+
*
|
751
|
+
* @example
|
752
|
+
* The following two matchers are equivalent:
|
753
|
+
* ```
|
754
|
+
* new UrlMatcher('/user/{id}?q').concat('/details?date');
|
755
|
+
* new UrlMatcher('/user/{id}/details?q&date');
|
756
|
+
* ```
|
757
|
+
*
|
758
|
+
* @param {string} pattern The pattern to append.
|
759
|
+
* @returns {ui.router.util.type:UrlMatcher} A matcher for the concatenated pattern.
|
760
|
+
*/
|
761
|
+
UrlMatcher.prototype.concat = function (pattern) {
|
762
|
+
// Because order of search parameters is irrelevant, we can add our own search
|
763
|
+
// parameters to the end of the new pattern. Parse the new pattern by itself
|
764
|
+
// and then join the bits together, but it's much easier to do this on a string level.
|
765
|
+
return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch);
|
766
|
+
};
|
767
|
+
|
768
|
+
UrlMatcher.prototype.toString = function () {
|
769
|
+
return this.source;
|
770
|
+
};
|
771
|
+
|
772
|
+
/**
|
773
|
+
* @ngdoc function
|
774
|
+
* @name ui.router.util.type:UrlMatcher#exec
|
775
|
+
* @methodOf ui.router.util.type:UrlMatcher
|
776
|
+
*
|
777
|
+
* @description
|
778
|
+
* Tests the specified path against this matcher, and returns an object containing the captured
|
779
|
+
* parameter values, or null if the path does not match. The returned object contains the values
|
780
|
+
* of any search parameters that are mentioned in the pattern, but their value may be null if
|
781
|
+
* they are not present in `searchParams`. This means that search parameters are always treated
|
782
|
+
* as optional.
|
783
|
+
*
|
784
|
+
* @example
|
785
|
+
* ```
|
786
|
+
* new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { x:'1', q:'hello' });
|
787
|
+
* // returns { id:'bob', q:'hello', r:null }
|
788
|
+
* ```
|
789
|
+
*
|
790
|
+
* @param {string} path The URL path to match, e.g. `$location.path()`.
|
791
|
+
* @param {Object} searchParams URL search parameters, e.g. `$location.search()`.
|
792
|
+
* @returns {Object} The captured parameter values.
|
793
|
+
*/
|
794
|
+
UrlMatcher.prototype.exec = function (path, searchParams) {
|
795
|
+
var m = this.regexp.exec(path);
|
796
|
+
if (!m) return null;
|
797
|
+
|
798
|
+
var params = this.params, nTotal = params.length,
|
799
|
+
nPath = this.segments.length-1,
|
800
|
+
values = {}, i;
|
801
|
+
|
802
|
+
if (nPath !== m.length - 1) throw new Error("Unbalanced capture group in route '" + this.source + "'");
|
803
|
+
|
804
|
+
for (i=0; i<nPath; i++) values[params[i]] = m[i+1];
|
805
|
+
for (/**/; i<nTotal; i++) values[params[i]] = searchParams[params[i]];
|
806
|
+
|
807
|
+
return values;
|
808
|
+
};
|
809
|
+
|
810
|
+
/**
|
811
|
+
* @ngdoc function
|
812
|
+
* @name ui.router.util.type:UrlMatcher#parameters
|
813
|
+
* @methodOf ui.router.util.type:UrlMatcher
|
814
|
+
*
|
815
|
+
* @description
|
816
|
+
* Returns the names of all path and search parameters of this pattern in an unspecified order.
|
817
|
+
*
|
818
|
+
* @returns {Array.<string>} An array of parameter names. Must be treated as read-only. If the
|
819
|
+
* pattern has no parameters, an empty array is returned.
|
820
|
+
*/
|
821
|
+
UrlMatcher.prototype.parameters = function () {
|
822
|
+
return this.params;
|
823
|
+
};
|
824
|
+
|
825
|
+
/**
|
826
|
+
* @ngdoc function
|
827
|
+
* @name ui.router.util.type:UrlMatcher#format
|
828
|
+
* @methodOf ui.router.util.type:UrlMatcher
|
829
|
+
*
|
830
|
+
* @description
|
831
|
+
* Creates a URL that matches this pattern by substituting the specified values
|
832
|
+
* for the path and search parameters. Null values for path parameters are
|
833
|
+
* treated as empty strings.
|
834
|
+
*
|
835
|
+
* @example
|
836
|
+
* ```
|
837
|
+
* new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });
|
838
|
+
* // returns '/user/bob?q=yes'
|
839
|
+
* ```
|
840
|
+
*
|
841
|
+
* @param {Object} values the values to substitute for the parameters in this pattern.
|
842
|
+
* @returns {string} the formatted URL (path and optionally search part).
|
843
|
+
*/
|
844
|
+
UrlMatcher.prototype.format = function (values) {
|
845
|
+
var segments = this.segments, params = this.params;
|
846
|
+
if (!values) return segments.join('');
|
847
|
+
|
848
|
+
var nPath = segments.length-1, nTotal = params.length,
|
849
|
+
result = segments[0], i, search, value;
|
850
|
+
|
851
|
+
for (i=0; i<nPath; i++) {
|
852
|
+
value = values[params[i]];
|
853
|
+
// TODO: Maybe we should throw on null here? It's not really good style to use '' and null interchangeabley
|
854
|
+
if (value != null) result += encodeURIComponent(value);
|
855
|
+
result += segments[i+1];
|
856
|
+
}
|
857
|
+
for (/**/; i<nTotal; i++) {
|
858
|
+
value = values[params[i]];
|
859
|
+
if (value != null) {
|
860
|
+
result += (search ? '&' : '?') + params[i] + '=' + encodeURIComponent(value);
|
861
|
+
search = true;
|
862
|
+
}
|
863
|
+
}
|
864
|
+
|
865
|
+
return result;
|
866
|
+
};
|
867
|
+
|
868
|
+
|
869
|
+
|
870
|
+
/**
|
871
|
+
* @ngdoc object
|
872
|
+
* @name ui.router.util.$urlMatcherFactory
|
873
|
+
*
|
874
|
+
* @description
|
875
|
+
* Factory for {@link ui.router.util.type:UrlMatcher} instances. The factory is also available to providers
|
876
|
+
* under the name `$urlMatcherFactoryProvider`.
|
877
|
+
*/
|
878
|
+
function $UrlMatcherFactory() {
|
879
|
+
|
880
|
+
/**
|
881
|
+
* @ngdoc function
|
882
|
+
* @name ui.router.util.$urlMatcherFactory#compile
|
883
|
+
* @methodOf ui.router.util.$urlMatcherFactory
|
884
|
+
*
|
885
|
+
* @description
|
886
|
+
* Creates a {@link ui.router.util.type:UrlMatcher} for the specified pattern.
|
887
|
+
*
|
888
|
+
* @param {string} pattern The URL pattern.
|
889
|
+
* @returns {ui.router.util.type:UrlMatcher} The UrlMatcher.
|
890
|
+
*/
|
891
|
+
this.compile = function (pattern) {
|
892
|
+
return new UrlMatcher(pattern);
|
893
|
+
};
|
894
|
+
|
895
|
+
/**
|
896
|
+
* @ngdoc function
|
897
|
+
* @name ui.router.util.$urlMatcherFactory#isMatcher
|
898
|
+
* @methodOf ui.router.util.$urlMatcherFactory
|
899
|
+
*
|
900
|
+
* @description
|
901
|
+
* Returns true if the specified object is a UrlMatcher, or false otherwise.
|
902
|
+
*
|
903
|
+
* @param {Object} object The object to perform the type check against.
|
904
|
+
* @returns {Boolean} Returns `true` if the object has the following functions: `exec`, `format`, and `concat`.
|
905
|
+
*/
|
906
|
+
this.isMatcher = function (o) {
|
907
|
+
return isObject(o) && isFunction(o.exec) && isFunction(o.format) && isFunction(o.concat);
|
908
|
+
};
|
909
|
+
|
910
|
+
/* No need to document $get, since it returns this */
|
911
|
+
this.$get = function () {
|
912
|
+
return this;
|
913
|
+
};
|
914
|
+
}
|
915
|
+
|
916
|
+
// Register as a provider so it's available to other providers
|
917
|
+
angular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory);
|
918
|
+
|
919
|
+
/**
|
920
|
+
* @ngdoc object
|
921
|
+
* @name ui.router.router.$urlRouterProvider
|
922
|
+
*
|
923
|
+
* @requires ui.router.util.$urlMatcherFactoryProvider
|
924
|
+
*
|
925
|
+
* @description
|
926
|
+
* `$urlRouterProvider` has the responsibility of watching `$location`.
|
927
|
+
* When `$location` changes it runs through a list of rules one by one until a
|
928
|
+
* match is found. `$urlRouterProvider` is used behind the scenes anytime you specify
|
929
|
+
* a url in a state configuration. All urls are compiled into a UrlMatcher object.
|
930
|
+
*
|
931
|
+
* There are several methods on `$urlRouterProvider` that make it useful to use directly
|
932
|
+
* in your module config.
|
933
|
+
*/
|
934
|
+
$UrlRouterProvider.$inject = ['$urlMatcherFactoryProvider'];
|
935
|
+
function $UrlRouterProvider( $urlMatcherFactory) {
|
936
|
+
var rules = [],
|
937
|
+
otherwise = null;
|
938
|
+
|
939
|
+
// Returns a string that is a prefix of all strings matching the RegExp
|
940
|
+
function regExpPrefix(re) {
|
941
|
+
var prefix = /^\^((?:\\[^a-zA-Z0-9]|[^\\\[\]\^$*+?.()|{}]+)*)/.exec(re.source);
|
942
|
+
return (prefix != null) ? prefix[1].replace(/\\(.)/g, "$1") : '';
|
943
|
+
}
|
944
|
+
|
945
|
+
// Interpolates matched values into a String.replace()-style pattern
|
946
|
+
function interpolate(pattern, match) {
|
947
|
+
return pattern.replace(/\$(\$|\d{1,2})/, function (m, what) {
|
948
|
+
return match[what === '$' ? 0 : Number(what)];
|
949
|
+
});
|
950
|
+
}
|
951
|
+
|
952
|
+
/**
|
953
|
+
* @ngdoc function
|
954
|
+
* @name ui.router.router.$urlRouterProvider#rule
|
955
|
+
* @methodOf ui.router.router.$urlRouterProvider
|
956
|
+
*
|
957
|
+
* @description
|
958
|
+
* Defines rules that are used by `$urlRouterProvider to find matches for
|
959
|
+
* specific URLs.
|
960
|
+
*
|
961
|
+
* @example
|
962
|
+
* <pre>
|
963
|
+
* var app = angular.module('app', ['ui.router.router']);
|
964
|
+
*
|
965
|
+
* app.config(function ($urlRouterProvider) {
|
966
|
+
* // Here's an example of how you might allow case insensitive urls
|
967
|
+
* $urlRouterProvider.rule(function ($injector, $location) {
|
968
|
+
* var path = $location.path(),
|
969
|
+
* normalized = path.toLowerCase();
|
970
|
+
*
|
971
|
+
* if (path !== normalized) {
|
972
|
+
* return normalized;
|
973
|
+
* }
|
974
|
+
* });
|
975
|
+
* });
|
976
|
+
* </pre>
|
977
|
+
*
|
978
|
+
* @param {object} rule Handler function that takes `$injector` and `$location`
|
979
|
+
* services as arguments. You can use them to return a valid path as a string.
|
980
|
+
*
|
981
|
+
* @return {object} $urlRouterProvider - $urlRouterProvider instance
|
982
|
+
*/
|
983
|
+
this.rule =
|
984
|
+
function (rule) {
|
985
|
+
if (!isFunction(rule)) throw new Error("'rule' must be a function");
|
986
|
+
rules.push(rule);
|
987
|
+
return this;
|
988
|
+
};
|
989
|
+
|
990
|
+
/**
|
991
|
+
* @ngdoc object
|
992
|
+
* @name ui.router.router.$urlRouterProvider#otherwise
|
993
|
+
* @methodOf ui.router.router.$urlRouterProvider
|
994
|
+
*
|
995
|
+
* @description
|
996
|
+
* Defines a path that is used when an invalied route is requested.
|
997
|
+
*
|
998
|
+
* @example
|
999
|
+
* <pre>
|
1000
|
+
* var app = angular.module('app', ['ui.router.router']);
|
1001
|
+
*
|
1002
|
+
* app.config(function ($urlRouterProvider) {
|
1003
|
+
* // if the path doesn't match any of the urls you configured
|
1004
|
+
* // otherwise will take care of routing the user to the
|
1005
|
+
* // specified url
|
1006
|
+
* $urlRouterProvider.otherwise('/index');
|
1007
|
+
*
|
1008
|
+
* // Example of using function rule as param
|
1009
|
+
* $urlRouterProvider.otherwise(function ($injector, $location) {
|
1010
|
+
* ...
|
1011
|
+
* });
|
1012
|
+
* });
|
1013
|
+
* </pre>
|
1014
|
+
*
|
1015
|
+
* @param {string|object} rule The url path you want to redirect to or a function
|
1016
|
+
* rule that returns the url path. The function version is passed two params:
|
1017
|
+
* `$injector` and `$location` services.
|
1018
|
+
*
|
1019
|
+
* @return {object} $urlRouterProvider - $urlRouterProvider instance
|
1020
|
+
*/
|
1021
|
+
this.otherwise =
|
1022
|
+
function (rule) {
|
1023
|
+
if (isString(rule)) {
|
1024
|
+
var redirect = rule;
|
1025
|
+
rule = function () { return redirect; };
|
1026
|
+
}
|
1027
|
+
else if (!isFunction(rule)) throw new Error("'rule' must be a function");
|
1028
|
+
otherwise = rule;
|
1029
|
+
return this;
|
1030
|
+
};
|
1031
|
+
|
1032
|
+
|
1033
|
+
function handleIfMatch($injector, handler, match) {
|
1034
|
+
if (!match) return false;
|
1035
|
+
var result = $injector.invoke(handler, handler, { $match: match });
|
1036
|
+
return isDefined(result) ? result : true;
|
1037
|
+
}
|
1038
|
+
|
1039
|
+
/**
|
1040
|
+
* @ngdoc function
|
1041
|
+
* @name ui.router.router.$urlRouterProvider#when
|
1042
|
+
* @methodOf ui.router.router.$urlRouterProvider
|
1043
|
+
*
|
1044
|
+
* @description
|
1045
|
+
* Registers a handler for a given url matching. if handle is a string, it is
|
1046
|
+
* treated as a redirect, and is interpolated according to the syyntax of match
|
1047
|
+
* (i.e. like String.replace() for RegExp, or like a UrlMatcher pattern otherwise).
|
1048
|
+
*
|
1049
|
+
* If the handler is a function, it is injectable. It gets invoked if `$location`
|
1050
|
+
* matches. You have the option of inject the match object as `$match`.
|
1051
|
+
*
|
1052
|
+
* The handler can return
|
1053
|
+
*
|
1054
|
+
* - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`
|
1055
|
+
* will continue trying to find another one that matches.
|
1056
|
+
* - **string** which is treated as a redirect and passed to `$location.url()`
|
1057
|
+
* - **void** or any **truthy** value tells `$urlRouter` that the url was handled.
|
1058
|
+
*
|
1059
|
+
* @example
|
1060
|
+
* <pre>
|
1061
|
+
* var app = angular.module('app', ['ui.router.router']);
|
1062
|
+
*
|
1063
|
+
* app.config(function ($urlRouterProvider) {
|
1064
|
+
* $urlRouterProvider.when($state.url, function ($match, $stateParams) {
|
1065
|
+
* if ($state.$current.navigable !== state ||
|
1066
|
+
* !equalForKeys($match, $stateParams) {
|
1067
|
+
* $state.transitionTo(state, $match, false);
|
1068
|
+
* }
|
1069
|
+
* });
|
1070
|
+
* });
|
1071
|
+
* </pre>
|
1072
|
+
*
|
1073
|
+
* @param {string|object} what The incoming path that you want to redirect.
|
1074
|
+
* @param {string|object} handler The path you want to redirect your user to.
|
1075
|
+
*/
|
1076
|
+
this.when =
|
1077
|
+
function (what, handler) {
|
1078
|
+
var redirect, handlerIsString = isString(handler);
|
1079
|
+
if (isString(what)) what = $urlMatcherFactory.compile(what);
|
1080
|
+
|
1081
|
+
if (!handlerIsString && !isFunction(handler) && !isArray(handler))
|
1082
|
+
throw new Error("invalid 'handler' in when()");
|
1083
|
+
|
1084
|
+
var strategies = {
|
1085
|
+
matcher: function (what, handler) {
|
1086
|
+
if (handlerIsString) {
|
1087
|
+
redirect = $urlMatcherFactory.compile(handler);
|
1088
|
+
handler = ['$match', function ($match) { return redirect.format($match); }];
|
1089
|
+
}
|
1090
|
+
return extend(function ($injector, $location) {
|
1091
|
+
return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));
|
1092
|
+
}, {
|
1093
|
+
prefix: isString(what.prefix) ? what.prefix : ''
|
1094
|
+
});
|
1095
|
+
},
|
1096
|
+
regex: function (what, handler) {
|
1097
|
+
if (what.global || what.sticky) throw new Error("when() RegExp must not be global or sticky");
|
1098
|
+
|
1099
|
+
if (handlerIsString) {
|
1100
|
+
redirect = handler;
|
1101
|
+
handler = ['$match', function ($match) { return interpolate(redirect, $match); }];
|
1102
|
+
}
|
1103
|
+
return extend(function ($injector, $location) {
|
1104
|
+
return handleIfMatch($injector, handler, what.exec($location.path()));
|
1105
|
+
}, {
|
1106
|
+
prefix: regExpPrefix(what)
|
1107
|
+
});
|
1108
|
+
}
|
1109
|
+
};
|
1110
|
+
|
1111
|
+
var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };
|
1112
|
+
|
1113
|
+
for (var n in check) {
|
1114
|
+
if (check[n]) {
|
1115
|
+
return this.rule(strategies[n](what, handler));
|
1116
|
+
}
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
throw new Error("invalid 'what' in when()");
|
1120
|
+
};
|
1121
|
+
|
1122
|
+
/**
|
1123
|
+
* @ngdoc object
|
1124
|
+
* @name ui.router.router.$urlRouter
|
1125
|
+
*
|
1126
|
+
* @requires $location
|
1127
|
+
* @requires $rootScope
|
1128
|
+
* @requires $injector
|
1129
|
+
*
|
1130
|
+
* @description
|
1131
|
+
*
|
1132
|
+
*/
|
1133
|
+
this.$get =
|
1134
|
+
[ '$location', '$rootScope', '$injector',
|
1135
|
+
function ($location, $rootScope, $injector) {
|
1136
|
+
// TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree
|
1137
|
+
function update(evt) {
|
1138
|
+
if (evt && evt.defaultPrevented) return;
|
1139
|
+
function check(rule) {
|
1140
|
+
var handled = rule($injector, $location);
|
1141
|
+
if (handled) {
|
1142
|
+
if (isString(handled)) $location.replace().url(handled);
|
1143
|
+
return true;
|
1144
|
+
}
|
1145
|
+
return false;
|
1146
|
+
}
|
1147
|
+
var n=rules.length, i;
|
1148
|
+
for (i=0; i<n; i++) {
|
1149
|
+
if (check(rules[i])) return;
|
1150
|
+
}
|
1151
|
+
// always check otherwise last to allow dynamic updates to the set of rules
|
1152
|
+
if (otherwise) check(otherwise);
|
1153
|
+
}
|
1154
|
+
|
1155
|
+
$rootScope.$on('$locationChangeSuccess', update);
|
1156
|
+
|
1157
|
+
return {
|
1158
|
+
/**
|
1159
|
+
* @ngdoc function
|
1160
|
+
* @name ui.router.router.$urlRouter#sync
|
1161
|
+
* @methodOf ui.router.router.$urlRouter
|
1162
|
+
*
|
1163
|
+
* @description
|
1164
|
+
* Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.
|
1165
|
+
* This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event,
|
1166
|
+
* perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed
|
1167
|
+
* with the transition by calling `$urlRouter.sync()`.
|
1168
|
+
*
|
1169
|
+
* @example
|
1170
|
+
* <pre>
|
1171
|
+
* angular.module('app', ['ui.router']);
|
1172
|
+
* .run(function($rootScope, $urlRouter) {
|
1173
|
+
* $rootScope.$on('$locationChangeSuccess', function(evt) {
|
1174
|
+
* // Halt state change from even starting
|
1175
|
+
* evt.preventDefault();
|
1176
|
+
* // Perform custom logic
|
1177
|
+
* var meetsRequirement = ...
|
1178
|
+
* // Continue with the update and state transition if logic allows
|
1179
|
+
* if (meetsRequirement) $urlRouter.sync();
|
1180
|
+
* });
|
1181
|
+
* });
|
1182
|
+
* </pre>
|
1183
|
+
*/
|
1184
|
+
sync: function () {
|
1185
|
+
update();
|
1186
|
+
}
|
1187
|
+
};
|
1188
|
+
}];
|
1189
|
+
}
|
1190
|
+
|
1191
|
+
angular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);
|
1192
|
+
|
1193
|
+
/**
|
1194
|
+
* @ngdoc object
|
1195
|
+
* @name ui.router.state.$stateProvider
|
1196
|
+
*
|
1197
|
+
* @requires ui.router.router.$urlRouterProvider
|
1198
|
+
* @requires ui.router.util.$urlMatcherFactoryProvider
|
1199
|
+
* @requires $locationProvider
|
1200
|
+
*
|
1201
|
+
* @description
|
1202
|
+
* The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely
|
1203
|
+
* on state.
|
1204
|
+
*
|
1205
|
+
* A state corresponds to a "place" in the application in terms of the overall UI and
|
1206
|
+
* navigation. A state describes (via the controller / template / view properties) what
|
1207
|
+
* the UI looks like and does at that place.
|
1208
|
+
*
|
1209
|
+
* States often have things in common, and the primary way of factoring out these
|
1210
|
+
* commonalities in this model is via the state hierarchy, i.e. parent/child states aka
|
1211
|
+
* nested states.
|
1212
|
+
*
|
1213
|
+
* The `$stateProvider` provides interfaces to declare these states for your app.
|
1214
|
+
*/
|
1215
|
+
$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider', '$locationProvider'];
|
1216
|
+
function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $locationProvider) {
|
1217
|
+
|
1218
|
+
var root, states = {}, $state, queue = {}, abstractKey = 'abstract';
|
1219
|
+
|
1220
|
+
// Builds state properties from definition passed to registerState()
|
1221
|
+
var stateBuilder = {
|
1222
|
+
|
1223
|
+
// Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.
|
1224
|
+
// state.children = [];
|
1225
|
+
// if (parent) parent.children.push(state);
|
1226
|
+
parent: function(state) {
|
1227
|
+
if (isDefined(state.parent) && state.parent) return findState(state.parent);
|
1228
|
+
// regex matches any valid composite state name
|
1229
|
+
// would match "contact.list" but not "contacts"
|
1230
|
+
var compositeName = /^(.+)\.[^.]+$/.exec(state.name);
|
1231
|
+
return compositeName ? findState(compositeName[1]) : root;
|
1232
|
+
},
|
1233
|
+
|
1234
|
+
// inherit 'data' from parent and override by own values (if any)
|
1235
|
+
data: function(state) {
|
1236
|
+
if (state.parent && state.parent.data) {
|
1237
|
+
state.data = state.self.data = extend({}, state.parent.data, state.data);
|
1238
|
+
}
|
1239
|
+
return state.data;
|
1240
|
+
},
|
1241
|
+
|
1242
|
+
// Build a URLMatcher if necessary, either via a relative or absolute URL
|
1243
|
+
url: function(state) {
|
1244
|
+
var url = state.url;
|
1245
|
+
|
1246
|
+
if (isString(url)) {
|
1247
|
+
if (url.charAt(0) == '^') {
|
1248
|
+
return $urlMatcherFactory.compile(url.substring(1));
|
1249
|
+
}
|
1250
|
+
return (state.parent.navigable || root).url.concat(url);
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
if ($urlMatcherFactory.isMatcher(url) || url == null) {
|
1254
|
+
return url;
|
1255
|
+
}
|
1256
|
+
throw new Error("Invalid url '" + url + "' in state '" + state + "'");
|
1257
|
+
},
|
1258
|
+
|
1259
|
+
// Keep track of the closest ancestor state that has a URL (i.e. is navigable)
|
1260
|
+
navigable: function(state) {
|
1261
|
+
return state.url ? state : (state.parent ? state.parent.navigable : null);
|
1262
|
+
},
|
1263
|
+
|
1264
|
+
// Derive parameters for this state and ensure they're a super-set of parent's parameters
|
1265
|
+
params: function(state) {
|
1266
|
+
if (!state.params) {
|
1267
|
+
return state.url ? state.url.parameters() : state.parent.params;
|
1268
|
+
}
|
1269
|
+
if (!isArray(state.params)) throw new Error("Invalid params in state '" + state + "'");
|
1270
|
+
if (state.url) throw new Error("Both params and url specicified in state '" + state + "'");
|
1271
|
+
return state.params;
|
1272
|
+
},
|
1273
|
+
|
1274
|
+
// If there is no explicit multi-view configuration, make one up so we don't have
|
1275
|
+
// to handle both cases in the view directive later. Note that having an explicit
|
1276
|
+
// 'views' property will mean the default unnamed view properties are ignored. This
|
1277
|
+
// is also a good time to resolve view names to absolute names, so everything is a
|
1278
|
+
// straight lookup at link time.
|
1279
|
+
views: function(state) {
|
1280
|
+
var views = {};
|
1281
|
+
|
1282
|
+
forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {
|
1283
|
+
if (name.indexOf('@') < 0) name += '@' + state.parent.name;
|
1284
|
+
views[name] = view;
|
1285
|
+
});
|
1286
|
+
return views;
|
1287
|
+
},
|
1288
|
+
|
1289
|
+
ownParams: function(state) {
|
1290
|
+
if (!state.parent) {
|
1291
|
+
return state.params;
|
1292
|
+
}
|
1293
|
+
var paramNames = {}; forEach(state.params, function (p) { paramNames[p] = true; });
|
1294
|
+
|
1295
|
+
forEach(state.parent.params, function (p) {
|
1296
|
+
if (!paramNames[p]) {
|
1297
|
+
throw new Error("Missing required parameter '" + p + "' in state '" + state.name + "'");
|
1298
|
+
}
|
1299
|
+
paramNames[p] = false;
|
1300
|
+
});
|
1301
|
+
var ownParams = [];
|
1302
|
+
|
1303
|
+
forEach(paramNames, function (own, p) {
|
1304
|
+
if (own) ownParams.push(p);
|
1305
|
+
});
|
1306
|
+
return ownParams;
|
1307
|
+
},
|
1308
|
+
|
1309
|
+
// Keep a full path from the root down to this state as this is needed for state activation.
|
1310
|
+
path: function(state) {
|
1311
|
+
return state.parent ? state.parent.path.concat(state) : []; // exclude root from path
|
1312
|
+
},
|
1313
|
+
|
1314
|
+
// Speed up $state.contains() as it's used a lot
|
1315
|
+
includes: function(state) {
|
1316
|
+
var includes = state.parent ? extend({}, state.parent.includes) : {};
|
1317
|
+
includes[state.name] = true;
|
1318
|
+
return includes;
|
1319
|
+
},
|
1320
|
+
|
1321
|
+
$delegates: {}
|
1322
|
+
};
|
1323
|
+
|
1324
|
+
function isRelative(stateName) {
|
1325
|
+
return stateName.indexOf(".") === 0 || stateName.indexOf("^") === 0;
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
function findState(stateOrName, base) {
|
1329
|
+
var isStr = isString(stateOrName),
|
1330
|
+
name = isStr ? stateOrName : stateOrName.name,
|
1331
|
+
path = isRelative(name);
|
1332
|
+
|
1333
|
+
if (path) {
|
1334
|
+
if (!base) throw new Error("No reference point given for path '" + name + "'");
|
1335
|
+
var rel = name.split("."), i = 0, pathLength = rel.length, current = base;
|
1336
|
+
|
1337
|
+
for (; i < pathLength; i++) {
|
1338
|
+
if (rel[i] === "" && i === 0) {
|
1339
|
+
current = base;
|
1340
|
+
continue;
|
1341
|
+
}
|
1342
|
+
if (rel[i] === "^") {
|
1343
|
+
if (!current.parent) throw new Error("Path '" + name + "' not valid for state '" + base.name + "'");
|
1344
|
+
current = current.parent;
|
1345
|
+
continue;
|
1346
|
+
}
|
1347
|
+
break;
|
1348
|
+
}
|
1349
|
+
rel = rel.slice(i).join(".");
|
1350
|
+
name = current.name + (current.name && rel ? "." : "") + rel;
|
1351
|
+
}
|
1352
|
+
var state = states[name];
|
1353
|
+
|
1354
|
+
if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {
|
1355
|
+
return state;
|
1356
|
+
}
|
1357
|
+
return undefined;
|
1358
|
+
}
|
1359
|
+
|
1360
|
+
function queueState(parentName, state) {
|
1361
|
+
if (!queue[parentName]) {
|
1362
|
+
queue[parentName] = [];
|
1363
|
+
}
|
1364
|
+
queue[parentName].push(state);
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
function registerState(state) {
|
1368
|
+
// Wrap a new object around the state so we can store our private details easily.
|
1369
|
+
state = inherit(state, {
|
1370
|
+
self: state,
|
1371
|
+
resolve: state.resolve || {},
|
1372
|
+
toString: function() { return this.name; }
|
1373
|
+
});
|
1374
|
+
|
1375
|
+
var name = state.name;
|
1376
|
+
if (!isString(name) || name.indexOf('@') >= 0) throw new Error("State must have a valid name");
|
1377
|
+
if (states.hasOwnProperty(name)) throw new Error("State '" + name + "'' is already defined");
|
1378
|
+
|
1379
|
+
// Get parent name
|
1380
|
+
var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))
|
1381
|
+
: (isString(state.parent)) ? state.parent
|
1382
|
+
: '';
|
1383
|
+
|
1384
|
+
// If parent is not registered yet, add state to queue and register later
|
1385
|
+
if (parentName && !states[parentName]) {
|
1386
|
+
return queueState(parentName, state.self);
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
for (var key in stateBuilder) {
|
1390
|
+
if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);
|
1391
|
+
}
|
1392
|
+
states[name] = state;
|
1393
|
+
|
1394
|
+
// Register the state in the global state list and with $urlRouter if necessary.
|
1395
|
+
if (!state[abstractKey] && state.url) {
|
1396
|
+
$urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {
|
1397
|
+
if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {
|
1398
|
+
$state.transitionTo(state, $match, { location: false });
|
1399
|
+
}
|
1400
|
+
}]);
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
// Register any queued children
|
1404
|
+
if (queue[name]) {
|
1405
|
+
for (var i = 0; i < queue[name].length; i++) {
|
1406
|
+
registerState(queue[name][i]);
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
|
1410
|
+
return state;
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
// Checks text to see if it looks like a glob.
|
1414
|
+
function isGlob (text) {
|
1415
|
+
return text.indexOf('*') > -1;
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
// Returns true if glob matches current $state name.
|
1419
|
+
function doesStateMatchGlob (glob) {
|
1420
|
+
var globSegments = glob.split('.'),
|
1421
|
+
segments = $state.$current.name.split('.');
|
1422
|
+
|
1423
|
+
//match greedy starts
|
1424
|
+
if (globSegments[0] === '**') {
|
1425
|
+
segments = segments.slice(segments.indexOf(globSegments[1]));
|
1426
|
+
segments.unshift('**');
|
1427
|
+
}
|
1428
|
+
//match greedy ends
|
1429
|
+
if (globSegments[globSegments.length - 1] === '**') {
|
1430
|
+
segments.splice(segments.indexOf(globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);
|
1431
|
+
segments.push('**');
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
if (globSegments.length != segments.length) {
|
1435
|
+
return false;
|
1436
|
+
}
|
1437
|
+
|
1438
|
+
//match single stars
|
1439
|
+
for (var i = 0, l = globSegments.length; i < l; i++) {
|
1440
|
+
if (globSegments[i] === '*') {
|
1441
|
+
segments[i] = '*';
|
1442
|
+
}
|
1443
|
+
}
|
1444
|
+
|
1445
|
+
return segments.join('') === globSegments.join('');
|
1446
|
+
}
|
1447
|
+
|
1448
|
+
|
1449
|
+
// Implicit root state that is always active
|
1450
|
+
root = registerState({
|
1451
|
+
name: '',
|
1452
|
+
url: '^',
|
1453
|
+
views: null,
|
1454
|
+
'abstract': true
|
1455
|
+
});
|
1456
|
+
root.navigable = null;
|
1457
|
+
|
1458
|
+
|
1459
|
+
/**
|
1460
|
+
* @ngdoc function
|
1461
|
+
* @name ui.router.state.$stateProvider#decorator
|
1462
|
+
* @methodOf ui.router.state.$stateProvider
|
1463
|
+
*
|
1464
|
+
* @description
|
1465
|
+
* Allows you to extend (carefully) or override (at your own peril) the
|
1466
|
+
* `stateBuilder` object used internally by `$stateProvider`. This can be used
|
1467
|
+
* to add custom functionality to ui-router, for example inferring templateUrl
|
1468
|
+
* based on the state name.
|
1469
|
+
*
|
1470
|
+
* When passing only a name, it returns the current (original or decorated) builder
|
1471
|
+
* function that matches `name`.
|
1472
|
+
*
|
1473
|
+
* The builder functions that can be decorated are listed below. Though not all
|
1474
|
+
* necessarily have a good use case for decoration, that is up to you to decide.
|
1475
|
+
*
|
1476
|
+
* In addition, users can attach custom decorators, which will generate new
|
1477
|
+
* properties within the state's internal definition. There is currently no clear
|
1478
|
+
* use-case for this beyond accessing internal states (i.e. $state.$current),
|
1479
|
+
* however, expect this to become increasingly relevant as we introduce additional
|
1480
|
+
* meta-programming features.
|
1481
|
+
*
|
1482
|
+
* **Warning**: Decorators should not be interdependent because the order of
|
1483
|
+
* execution of the builder functions in non-deterministic. Builder functions
|
1484
|
+
* should only be dependent on the state definition object and super function.
|
1485
|
+
*
|
1486
|
+
*
|
1487
|
+
* Existing builder functions and current return values:
|
1488
|
+
*
|
1489
|
+
* - **parent** `{object}` - returns the parent state object.
|
1490
|
+
* - **data** `{object}` - returns state data, including any inherited data that is not
|
1491
|
+
* overridden by own values (if any).
|
1492
|
+
* - **url** `{object}` - returns a {link ui.router.util.type:UrlMatcher} or null.
|
1493
|
+
* - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is
|
1494
|
+
* navigable).
|
1495
|
+
* - **params** `{object}` - returns an array of state params that are ensured to
|
1496
|
+
* be a super-set of parent's params.
|
1497
|
+
* - **views** `{object}` - returns a views object where each key is an absolute view
|
1498
|
+
* name (i.e. "viewName@stateName") and each value is the config object
|
1499
|
+
* (template, controller) for the view. Even when you don't use the views object
|
1500
|
+
* explicitly on a state config, one is still created for you internally.
|
1501
|
+
* So by decorating this builder function you have access to decorating template
|
1502
|
+
* and controller properties.
|
1503
|
+
* - **ownParams** `{object}` - returns an array of params that belong to the state,
|
1504
|
+
* not including any params defined by ancestor states.
|
1505
|
+
* - **path** `{string}` - returns the full path from the root down to this state.
|
1506
|
+
* Needed for state activation.
|
1507
|
+
* - **includes** `{object}` - returns an object that includes every state that
|
1508
|
+
* would pass a '$state.includes()' test.
|
1509
|
+
*
|
1510
|
+
* @example
|
1511
|
+
* <pre>
|
1512
|
+
* // Override the internal 'views' builder with a function that takes the state
|
1513
|
+
* // definition, and a reference to the internal function being overridden:
|
1514
|
+
* $stateProvider.decorator('views', function ($state, parent) {
|
1515
|
+
* var result = {},
|
1516
|
+
* views = parent(state);
|
1517
|
+
*
|
1518
|
+
* angular.forEach(view, function (config, name) {
|
1519
|
+
* var autoName = (state.name + '.' + name).replace('.', '/');
|
1520
|
+
* config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
|
1521
|
+
* result[name] = config;
|
1522
|
+
* });
|
1523
|
+
* return result;
|
1524
|
+
* });
|
1525
|
+
*
|
1526
|
+
* $stateProvider.state('home', {
|
1527
|
+
* views: {
|
1528
|
+
* 'contact.list': { controller: 'ListController' },
|
1529
|
+
* 'contact.item': { controller: 'ItemController' }
|
1530
|
+
* }
|
1531
|
+
* });
|
1532
|
+
*
|
1533
|
+
* // ...
|
1534
|
+
*
|
1535
|
+
* $state.go('home');
|
1536
|
+
* // Auto-populates list and item views with /partials/home/contact/list.html,
|
1537
|
+
* // and /partials/home/contact/item.html, respectively.
|
1538
|
+
* </pre>
|
1539
|
+
*
|
1540
|
+
* @param {string} name The name of the builder function to decorate.
|
1541
|
+
* @param {object} func A function that is responsible for decorating the original
|
1542
|
+
* builder function. The function receives two parameters:
|
1543
|
+
*
|
1544
|
+
* - `{object}` - state - The state config object.
|
1545
|
+
* - `{object}` - super - The original builder function.
|
1546
|
+
*
|
1547
|
+
* @return {object} $stateProvider - $stateProvider instance
|
1548
|
+
*/
|
1549
|
+
this.decorator = decorator;
|
1550
|
+
function decorator(name, func) {
|
1551
|
+
/*jshint validthis: true */
|
1552
|
+
if (isString(name) && !isDefined(func)) {
|
1553
|
+
return stateBuilder[name];
|
1554
|
+
}
|
1555
|
+
if (!isFunction(func) || !isString(name)) {
|
1556
|
+
return this;
|
1557
|
+
}
|
1558
|
+
if (stateBuilder[name] && !stateBuilder.$delegates[name]) {
|
1559
|
+
stateBuilder.$delegates[name] = stateBuilder[name];
|
1560
|
+
}
|
1561
|
+
stateBuilder[name] = func;
|
1562
|
+
return this;
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
/**
|
1566
|
+
* @ngdoc function
|
1567
|
+
* @name ui.router.state.$stateProvider#state
|
1568
|
+
* @methodOf ui.router.state.$stateProvider
|
1569
|
+
*
|
1570
|
+
* @description
|
1571
|
+
* Registers a state configuration under a given state name. The stateConfig object
|
1572
|
+
* has the following acceptable properties.
|
1573
|
+
*
|
1574
|
+
* <a id='template'></a>
|
1575
|
+
*
|
1576
|
+
* - **`template`** - {string|function=} - html template as a string or a function that returns
|
1577
|
+
* an html template as a string which should be used by the uiView directives. This property
|
1578
|
+
* takes precedence over templateUrl.
|
1579
|
+
*
|
1580
|
+
* If `template` is a function, it will be called with the following parameters:
|
1581
|
+
*
|
1582
|
+
* - {array.<object>} - state parameters extracted from the current $location.path() by
|
1583
|
+
* applying the current state
|
1584
|
+
*
|
1585
|
+
* <a id='templateUrl'></a>
|
1586
|
+
*
|
1587
|
+
* - **`templateUrl`** - {string|function=} - path or function that returns a path to an html
|
1588
|
+
* template that should be used by uiView.
|
1589
|
+
*
|
1590
|
+
* If `templateUrl` is a function, it will be called with the following parameters:
|
1591
|
+
*
|
1592
|
+
* - {array.<object>} - state parameters extracted from the current $location.path() by
|
1593
|
+
* applying the current state
|
1594
|
+
*
|
1595
|
+
* <a id='templateProvider'></a>
|
1596
|
+
*
|
1597
|
+
* - **`templateProvider`** - {function=} - Provider function that returns HTML content
|
1598
|
+
* string.
|
1599
|
+
*
|
1600
|
+
* <a id='controller'></a>
|
1601
|
+
*
|
1602
|
+
* - **`controller`** - {string|function=} - Controller fn that should be associated with newly
|
1603
|
+
* related scope or the name of a registered controller if passed as a string.
|
1604
|
+
*
|
1605
|
+
* <a id='controllerProvider'></a>
|
1606
|
+
*
|
1607
|
+
* - **`controllerProvider`** - {function=} - Injectable provider function that returns
|
1608
|
+
* the actual controller or string.
|
1609
|
+
*
|
1610
|
+
* <a id='controllerAs'></a>
|
1611
|
+
*
|
1612
|
+
* - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be
|
1613
|
+
* published to scope under the controllerAs name.
|
1614
|
+
*
|
1615
|
+
* <a id='resolve'></a>
|
1616
|
+
*
|
1617
|
+
* - **`resolve`** - {object.<string, function>=} - An optional map of dependencies which
|
1618
|
+
* should be injected into the controller. If any of these dependencies are promises,
|
1619
|
+
* the router will wait for them all to be resolved or one to be rejected before the
|
1620
|
+
* controller is instantiated. If all the promises are resolved successfully, the values
|
1621
|
+
* of the resolved promises are injected and $stateChangeSuccess event is fired. If any
|
1622
|
+
* of the promises are rejected the $stateChangeError event is fired. The map object is:
|
1623
|
+
*
|
1624
|
+
* - key - {string}: name of dependency to be injected into controller
|
1625
|
+
* - factory - {string|function}: If string then it is alias for service. Otherwise if function,
|
1626
|
+
* it is injected and return value it treated as dependency. If result is a promise, it is
|
1627
|
+
* resolved before its value is injected into controller.
|
1628
|
+
*
|
1629
|
+
* <a id='url'></a>
|
1630
|
+
*
|
1631
|
+
* - **`url`** - {string=} - A url with optional parameters. When a state is navigated or
|
1632
|
+
* transitioned to, the `$stateParams` service will be populated with any
|
1633
|
+
* parameters that were passed.
|
1634
|
+
*
|
1635
|
+
* <a id='params'></a>
|
1636
|
+
*
|
1637
|
+
* - **`params`** - {object=} - An array of parameter names or regular expressions. Only
|
1638
|
+
* use this within a state if you are not using url. Otherwise you can specify your
|
1639
|
+
* parameters within the url. When a state is navigated or transitioned to, the
|
1640
|
+
* $stateParams service will be populated with any parameters that were passed.
|
1641
|
+
*
|
1642
|
+
* <a id='views'></a>
|
1643
|
+
*
|
1644
|
+
* - **`views`** - {object=} - Use the views property to set up multiple views or to target views
|
1645
|
+
* manually/explicitly.
|
1646
|
+
*
|
1647
|
+
* <a id='abstract'></a>
|
1648
|
+
*
|
1649
|
+
* - **`abstract`** - {boolean=} - An abstract state will never be directly activated,
|
1650
|
+
* but can provide inherited properties to its common children states.
|
1651
|
+
*
|
1652
|
+
* <a id='onEnter'></a>
|
1653
|
+
*
|
1654
|
+
* - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way
|
1655
|
+
* to trigger an action or dispatch an event, such as opening a dialog.
|
1656
|
+
*
|
1657
|
+
* <a id='onExit'></a>
|
1658
|
+
*
|
1659
|
+
* - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to
|
1660
|
+
* trigger an action or dispatch an event, such as opening a dialog.
|
1661
|
+
*
|
1662
|
+
* <a id='reloadOnSearch'></a>
|
1663
|
+
*
|
1664
|
+
* - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state
|
1665
|
+
* just because a search/query parameter has changed (via $location.search() or $location.hash()).
|
1666
|
+
* Useful for when you'd like to modify $location.search() without triggering a reload.
|
1667
|
+
*
|
1668
|
+
* <a id='data'></a>
|
1669
|
+
*
|
1670
|
+
* - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.
|
1671
|
+
*
|
1672
|
+
* @example
|
1673
|
+
* <pre>
|
1674
|
+
* // Some state name examples
|
1675
|
+
*
|
1676
|
+
* // stateName can be a single top-level name (must be unique).
|
1677
|
+
* $stateProvider.state("home", {});
|
1678
|
+
*
|
1679
|
+
* // Or it can be a nested state name. This state is a child of the
|
1680
|
+
* // above "home" state.
|
1681
|
+
* $stateProvider.state("home.newest", {});
|
1682
|
+
*
|
1683
|
+
* // Nest states as deeply as needed.
|
1684
|
+
* $stateProvider.state("home.newest.abc.xyz.inception", {});
|
1685
|
+
*
|
1686
|
+
* // state() returns $stateProvider, so you can chain state declarations.
|
1687
|
+
* $stateProvider
|
1688
|
+
* .state("home", {})
|
1689
|
+
* .state("about", {})
|
1690
|
+
* .state("contacts", {});
|
1691
|
+
* </pre>
|
1692
|
+
*
|
1693
|
+
* @param {string} name A unique state name, e.g. "home", "about", "contacts".
|
1694
|
+
* To create a parent/child state use a dot, e.g. "about.sales", "home.newest".
|
1695
|
+
* @param {object} definition State configuration object.
|
1696
|
+
*/
|
1697
|
+
this.state = state;
|
1698
|
+
function state(name, definition) {
|
1699
|
+
/*jshint validthis: true */
|
1700
|
+
if (isObject(name)) definition = name;
|
1701
|
+
else definition.name = name;
|
1702
|
+
registerState(definition);
|
1703
|
+
return this;
|
1704
|
+
}
|
1705
|
+
|
1706
|
+
/**
|
1707
|
+
* @ngdoc object
|
1708
|
+
* @name ui.router.state.$state
|
1709
|
+
*
|
1710
|
+
* @requires $rootScope
|
1711
|
+
* @requires $q
|
1712
|
+
* @requires ui.router.state.$view
|
1713
|
+
* @requires $injector
|
1714
|
+
* @requires ui.router.util.$resolve
|
1715
|
+
* @requires ui.router.state.$stateParams
|
1716
|
+
*
|
1717
|
+
* @property {object} params A param object, e.g. {sectionId: section.id)}, that
|
1718
|
+
* you'd like to test against the current active state.
|
1719
|
+
* @property {object} current A reference to the state's config object. However
|
1720
|
+
* you passed it in. Useful for accessing custom data.
|
1721
|
+
* @property {object} transition Currently pending transition. A promise that'll
|
1722
|
+
* resolve or reject.
|
1723
|
+
*
|
1724
|
+
* @description
|
1725
|
+
* `$state` service is responsible for representing states as well as transitioning
|
1726
|
+
* between them. It also provides interfaces to ask for current state or even states
|
1727
|
+
* you're coming from.
|
1728
|
+
*/
|
1729
|
+
// $urlRouter is injected just to ensure it gets instantiated
|
1730
|
+
this.$get = $get;
|
1731
|
+
$get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$location', '$urlRouter', '$browser'];
|
1732
|
+
function $get( $rootScope, $q, $view, $injector, $resolve, $stateParams, $location, $urlRouter, $browser) {
|
1733
|
+
|
1734
|
+
var TransitionSuperseded = $q.reject(new Error('transition superseded'));
|
1735
|
+
var TransitionPrevented = $q.reject(new Error('transition prevented'));
|
1736
|
+
var TransitionAborted = $q.reject(new Error('transition aborted'));
|
1737
|
+
var TransitionFailed = $q.reject(new Error('transition failed'));
|
1738
|
+
var currentLocation = $location.url();
|
1739
|
+
var baseHref = $browser.baseHref();
|
1740
|
+
|
1741
|
+
function syncUrl() {
|
1742
|
+
if ($location.url() !== currentLocation) {
|
1743
|
+
$location.url(currentLocation);
|
1744
|
+
$location.replace();
|
1745
|
+
}
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
root.locals = { resolve: null, globals: { $stateParams: {} } };
|
1749
|
+
$state = {
|
1750
|
+
params: {},
|
1751
|
+
current: root.self,
|
1752
|
+
$current: root,
|
1753
|
+
transition: null
|
1754
|
+
};
|
1755
|
+
|
1756
|
+
/**
|
1757
|
+
* @ngdoc function
|
1758
|
+
* @name ui.router.state.$state#reload
|
1759
|
+
* @methodOf ui.router.state.$state
|
1760
|
+
*
|
1761
|
+
* @description
|
1762
|
+
* A method that force reloads the current state. All resolves are re-resolved, events are not re-fired,
|
1763
|
+
* and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon).
|
1764
|
+
*
|
1765
|
+
* @example
|
1766
|
+
* <pre>
|
1767
|
+
* var app angular.module('app', ['ui.router']);
|
1768
|
+
*
|
1769
|
+
* app.controller('ctrl', function ($scope, $state) {
|
1770
|
+
* $scope.reload = function(){
|
1771
|
+
* $state.reload();
|
1772
|
+
* }
|
1773
|
+
* });
|
1774
|
+
* </pre>
|
1775
|
+
*
|
1776
|
+
* `reload()` is just an alias for:
|
1777
|
+
* <pre>
|
1778
|
+
* $state.transitionTo($state.current, $stateParams, {
|
1779
|
+
* reload: true, inherit: false, notify: false
|
1780
|
+
* });
|
1781
|
+
* </pre>
|
1782
|
+
*/
|
1783
|
+
$state.reload = function reload() {
|
1784
|
+
$state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: false });
|
1785
|
+
};
|
1786
|
+
|
1787
|
+
/**
|
1788
|
+
* @ngdoc function
|
1789
|
+
* @name ui.router.state.$state#go
|
1790
|
+
* @methodOf ui.router.state.$state
|
1791
|
+
*
|
1792
|
+
* @description
|
1793
|
+
* Convenience method for transitioning to a new state. `$state.go` calls
|
1794
|
+
* `$state.transitionTo` internally but automatically sets options to
|
1795
|
+
* `{ location: true, inherit: true, relative: $state.$current, notify: true }`.
|
1796
|
+
* This allows you to easily use an absolute or relative to path and specify
|
1797
|
+
* only the parameters you'd like to update (while letting unspecified parameters
|
1798
|
+
* inherit from the currently active ancestor states).
|
1799
|
+
*
|
1800
|
+
* @example
|
1801
|
+
* <pre>
|
1802
|
+
* var app = angular.module('app', ['ui.router']);
|
1803
|
+
*
|
1804
|
+
* app.controller('ctrl', function ($scope, $state) {
|
1805
|
+
* $scope.changeState = function () {
|
1806
|
+
* $state.go('contact.detail');
|
1807
|
+
* };
|
1808
|
+
* });
|
1809
|
+
* </pre>
|
1810
|
+
* <img src='../ngdoc_assets/StateGoExamples.png'/>
|
1811
|
+
*
|
1812
|
+
* @param {string} to Absolute state name or relative state path. Some examples:
|
1813
|
+
*
|
1814
|
+
* - `$state.go('contact.detail')` - will go to the `contact.detail` state
|
1815
|
+
* - `$state.go('^')` - will go to a parent state
|
1816
|
+
* - `$state.go('^.sibling')` - will go to a sibling state
|
1817
|
+
* - `$state.go('.child.grandchild')` - will go to grandchild state
|
1818
|
+
*
|
1819
|
+
* @param {object=} params A map of the parameters that will be sent to the state,
|
1820
|
+
* will populate $stateParams. Any parameters that are not specified will be inherited from currently
|
1821
|
+
* defined parameters. This allows, for example, going to a sibling state that shares parameters
|
1822
|
+
* specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.
|
1823
|
+
* transitioning to a sibling will get you the parameters for all parents, transitioning to a child
|
1824
|
+
* will get you all current parameters, etc.
|
1825
|
+
* @param {object=} options Options object. The options are:
|
1826
|
+
*
|
1827
|
+
* - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`
|
1828
|
+
* will not. If string, must be `"replace"`, which will update url and also replace last history record.
|
1829
|
+
* - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.
|
1830
|
+
* - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'),
|
1831
|
+
* defines which state to be relative from.
|
1832
|
+
* - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.
|
1833
|
+
* - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params
|
1834
|
+
* have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd
|
1835
|
+
* use this when you want to force a reload when *everything* is the same, including search params.
|
1836
|
+
*
|
1837
|
+
* @returns {promise} A promise representing the state of the new transition.
|
1838
|
+
*
|
1839
|
+
* Possible success values:
|
1840
|
+
*
|
1841
|
+
* - $state.current
|
1842
|
+
*
|
1843
|
+
* <br/>Possible rejection values:
|
1844
|
+
*
|
1845
|
+
* - 'transition superseded' - when a newer transition has been started after this one
|
1846
|
+
* - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener
|
1847
|
+
* - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or
|
1848
|
+
* when a `$stateNotFound` `event.retry` promise errors.
|
1849
|
+
* - 'transition failed' - when a state has been unsuccessfully found after 2 tries.
|
1850
|
+
* - *resolve error* - when an error has occurred with a `resolve`
|
1851
|
+
*
|
1852
|
+
*/
|
1853
|
+
$state.go = function go(to, params, options) {
|
1854
|
+
return this.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));
|
1855
|
+
};
|
1856
|
+
|
1857
|
+
/**
|
1858
|
+
* @ngdoc function
|
1859
|
+
* @name ui.router.state.$state#transitionTo
|
1860
|
+
* @methodOf ui.router.state.$state
|
1861
|
+
*
|
1862
|
+
* @description
|
1863
|
+
* Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}
|
1864
|
+
* uses `transitionTo` internally. `$state.go` is recommended in most situations.
|
1865
|
+
*
|
1866
|
+
* @example
|
1867
|
+
* <pre>
|
1868
|
+
* var app = angular.module('app', ['ui.router']);
|
1869
|
+
*
|
1870
|
+
* app.controller('ctrl', function ($scope, $state) {
|
1871
|
+
* $scope.changeState = function () {
|
1872
|
+
* $state.transitionTo('contact.detail');
|
1873
|
+
* };
|
1874
|
+
* });
|
1875
|
+
* </pre>
|
1876
|
+
*
|
1877
|
+
* @param {string} to State name.
|
1878
|
+
* @param {object=} toParams A map of the parameters that will be sent to the state,
|
1879
|
+
* will populate $stateParams.
|
1880
|
+
* @param {object=} options Options object. The options are:
|
1881
|
+
*
|
1882
|
+
* - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`
|
1883
|
+
* will not. If string, must be `"replace"`, which will update url and also replace last history record.
|
1884
|
+
* - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.
|
1885
|
+
* - **`relative`** - {object=}, When transitioning with relative path (e.g '^'),
|
1886
|
+
* defines which state to be relative from.
|
1887
|
+
* - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.
|
1888
|
+
* - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params
|
1889
|
+
* have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd
|
1890
|
+
* use this when you want to force a reload when *everything* is the same, including search params.
|
1891
|
+
*
|
1892
|
+
* @returns {promise} A promise representing the state of the new transition. See
|
1893
|
+
* {@link ui.router.state.$state#methods_go $state.go}.
|
1894
|
+
*/
|
1895
|
+
$state.transitionTo = function transitionTo(to, toParams, options) {
|
1896
|
+
toParams = toParams || {};
|
1897
|
+
options = extend({
|
1898
|
+
location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false
|
1899
|
+
}, options || {});
|
1900
|
+
|
1901
|
+
var from = $state.$current, fromParams = $state.params, fromPath = from.path;
|
1902
|
+
var evt, toState = findState(to, options.relative);
|
1903
|
+
|
1904
|
+
if (!isDefined(toState)) {
|
1905
|
+
// Broadcast not found event and abort the transition if prevented
|
1906
|
+
var redirect = { to: to, toParams: toParams, options: options };
|
1907
|
+
|
1908
|
+
/**
|
1909
|
+
* @ngdoc event
|
1910
|
+
* @name ui.router.state.$state#$stateNotFound
|
1911
|
+
* @eventOf ui.router.state.$state
|
1912
|
+
* @eventType broadcast on root scope
|
1913
|
+
* @description
|
1914
|
+
* Fired when a requested state **cannot be found** using the provided state name during transition.
|
1915
|
+
* The event is broadcast allowing any handlers a single chance to deal with the error (usually by
|
1916
|
+
* lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,
|
1917
|
+
* you can see its three properties in the example. You can use `event.preventDefault()` to abort the
|
1918
|
+
* transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.
|
1919
|
+
*
|
1920
|
+
* @param {Object} event Event object.
|
1921
|
+
* @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.
|
1922
|
+
* @param {State} fromState Current state object.
|
1923
|
+
* @param {Object} fromParams Current state params.
|
1924
|
+
*
|
1925
|
+
* @example
|
1926
|
+
*
|
1927
|
+
* <pre>
|
1928
|
+
* // somewhere, assume lazy.state has not been defined
|
1929
|
+
* $state.go("lazy.state", {a:1, b:2}, {inherit:false});
|
1930
|
+
*
|
1931
|
+
* // somewhere else
|
1932
|
+
* $scope.$on('$stateNotFound',
|
1933
|
+
* function(event, unfoundState, fromState, fromParams){
|
1934
|
+
* console.log(unfoundState.to); // "lazy.state"
|
1935
|
+
* console.log(unfoundState.toParams); // {a:1, b:2}
|
1936
|
+
* console.log(unfoundState.options); // {inherit:false} + default options
|
1937
|
+
* })
|
1938
|
+
* </pre>
|
1939
|
+
*/
|
1940
|
+
evt = $rootScope.$broadcast('$stateNotFound', redirect, from.self, fromParams);
|
1941
|
+
if (evt.defaultPrevented) {
|
1942
|
+
syncUrl();
|
1943
|
+
return TransitionAborted;
|
1944
|
+
}
|
1945
|
+
|
1946
|
+
// Allow the handler to return a promise to defer state lookup retry
|
1947
|
+
if (evt.retry) {
|
1948
|
+
if (options.$retry) {
|
1949
|
+
syncUrl();
|
1950
|
+
return TransitionFailed;
|
1951
|
+
}
|
1952
|
+
var retryTransition = $state.transition = $q.when(evt.retry);
|
1953
|
+
retryTransition.then(function() {
|
1954
|
+
if (retryTransition !== $state.transition) return TransitionSuperseded;
|
1955
|
+
redirect.options.$retry = true;
|
1956
|
+
return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);
|
1957
|
+
}, function() {
|
1958
|
+
return TransitionAborted;
|
1959
|
+
});
|
1960
|
+
syncUrl();
|
1961
|
+
return retryTransition;
|
1962
|
+
}
|
1963
|
+
|
1964
|
+
// Always retry once if the $stateNotFound was not prevented
|
1965
|
+
// (handles either redirect changed or state lazy-definition)
|
1966
|
+
to = redirect.to;
|
1967
|
+
toParams = redirect.toParams;
|
1968
|
+
options = redirect.options;
|
1969
|
+
toState = findState(to, options.relative);
|
1970
|
+
if (!isDefined(toState)) {
|
1971
|
+
if (options.relative) throw new Error("Could not resolve '" + to + "' from state '" + options.relative + "'");
|
1972
|
+
throw new Error("No such state '" + to + "'");
|
1973
|
+
}
|
1974
|
+
}
|
1975
|
+
if (toState[abstractKey]) throw new Error("Cannot transition to abstract state '" + to + "'");
|
1976
|
+
if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);
|
1977
|
+
to = toState;
|
1978
|
+
|
1979
|
+
var toPath = to.path;
|
1980
|
+
|
1981
|
+
// Starting from the root of the path, keep all levels that haven't changed
|
1982
|
+
var keep, state, locals = root.locals, toLocals = [];
|
1983
|
+
for (keep = 0, state = toPath[keep];
|
1984
|
+
state && state === fromPath[keep] && equalForKeys(toParams, fromParams, state.ownParams) && !options.reload;
|
1985
|
+
keep++, state = toPath[keep]) {
|
1986
|
+
locals = toLocals[keep] = state.locals;
|
1987
|
+
}
|
1988
|
+
|
1989
|
+
// If we're going to the same state and all locals are kept, we've got nothing to do.
|
1990
|
+
// But clear 'transition', as we still want to cancel any other pending transitions.
|
1991
|
+
// TODO: We may not want to bump 'transition' if we're called from a location change that we've initiated ourselves,
|
1992
|
+
// because we might accidentally abort a legitimate transition initiated from code?
|
1993
|
+
if (shouldTriggerReload(to, from, locals, options) ) {
|
1994
|
+
if ( to.self.reloadOnSearch !== false )
|
1995
|
+
syncUrl();
|
1996
|
+
$state.transition = null;
|
1997
|
+
return $q.when($state.current);
|
1998
|
+
}
|
1999
|
+
|
2000
|
+
// Normalize/filter parameters before we pass them to event handlers etc.
|
2001
|
+
toParams = normalize(to.params, toParams || {});
|
2002
|
+
|
2003
|
+
// Broadcast start event and cancel the transition if requested
|
2004
|
+
if (options.notify) {
|
2005
|
+
/**
|
2006
|
+
* @ngdoc event
|
2007
|
+
* @name ui.router.state.$state#$stateChangeStart
|
2008
|
+
* @eventOf ui.router.state.$state
|
2009
|
+
* @eventType broadcast on root scope
|
2010
|
+
* @description
|
2011
|
+
* Fired when the state transition **begins**. You can use `event.preventDefault()`
|
2012
|
+
* to prevent the transition from happening and then the transition promise will be
|
2013
|
+
* rejected with a `'transition prevented'` value.
|
2014
|
+
*
|
2015
|
+
* @param {Object} event Event object.
|
2016
|
+
* @param {State} toState The state being transitioned to.
|
2017
|
+
* @param {Object} toParams The params supplied to the `toState`.
|
2018
|
+
* @param {State} fromState The current state, pre-transition.
|
2019
|
+
* @param {Object} fromParams The params supplied to the `fromState`.
|
2020
|
+
*
|
2021
|
+
* @example
|
2022
|
+
*
|
2023
|
+
* <pre>
|
2024
|
+
* $rootScope.$on('$stateChangeStart',
|
2025
|
+
* function(event, toState, toParams, fromState, fromParams){
|
2026
|
+
* event.preventDefault();
|
2027
|
+
* // transitionTo() promise will be rejected with
|
2028
|
+
* // a 'transition prevented' error
|
2029
|
+
* })
|
2030
|
+
* </pre>
|
2031
|
+
*/
|
2032
|
+
evt = $rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams);
|
2033
|
+
if (evt.defaultPrevented) {
|
2034
|
+
syncUrl();
|
2035
|
+
return TransitionPrevented;
|
2036
|
+
}
|
2037
|
+
}
|
2038
|
+
|
2039
|
+
// Resolve locals for the remaining states, but don't update any global state just
|
2040
|
+
// yet -- if anything fails to resolve the current state needs to remain untouched.
|
2041
|
+
// We also set up an inheritance chain for the locals here. This allows the view directive
|
2042
|
+
// to quickly look up the correct definition for each view in the current state. Even
|
2043
|
+
// though we create the locals object itself outside resolveState(), it is initially
|
2044
|
+
// empty and gets filled asynchronously. We need to keep track of the promise for the
|
2045
|
+
// (fully resolved) current locals, and pass this down the chain.
|
2046
|
+
var resolved = $q.when(locals);
|
2047
|
+
for (var l=keep; l<toPath.length; l++, state=toPath[l]) {
|
2048
|
+
locals = toLocals[l] = inherit(locals);
|
2049
|
+
resolved = resolveState(state, toParams, state===to, resolved, locals);
|
2050
|
+
}
|
2051
|
+
|
2052
|
+
// Once everything is resolved, we are ready to perform the actual transition
|
2053
|
+
// and return a promise for the new state. We also keep track of what the
|
2054
|
+
// current promise is, so that we can detect overlapping transitions and
|
2055
|
+
// keep only the outcome of the last transition.
|
2056
|
+
var transition = $state.transition = resolved.then(function () {
|
2057
|
+
var l, entering, exiting;
|
2058
|
+
|
2059
|
+
if ($state.transition !== transition) return TransitionSuperseded;
|
2060
|
+
|
2061
|
+
// Exit 'from' states not kept
|
2062
|
+
for (l=fromPath.length-1; l>=keep; l--) {
|
2063
|
+
exiting = fromPath[l];
|
2064
|
+
if (exiting.self.onExit) {
|
2065
|
+
$injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);
|
2066
|
+
}
|
2067
|
+
exiting.locals = null;
|
2068
|
+
}
|
2069
|
+
|
2070
|
+
// Enter 'to' states not kept
|
2071
|
+
for (l=keep; l<toPath.length; l++) {
|
2072
|
+
entering = toPath[l];
|
2073
|
+
entering.locals = toLocals[l];
|
2074
|
+
if (entering.self.onEnter) {
|
2075
|
+
$injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);
|
2076
|
+
}
|
2077
|
+
}
|
2078
|
+
|
2079
|
+
// Run it again, to catch any transitions in callbacks
|
2080
|
+
if ($state.transition !== transition) return TransitionSuperseded;
|
2081
|
+
|
2082
|
+
// Update globals in $state
|
2083
|
+
$state.$current = to;
|
2084
|
+
$state.current = to.self;
|
2085
|
+
$state.params = toParams;
|
2086
|
+
copy($state.params, $stateParams);
|
2087
|
+
$state.transition = null;
|
2088
|
+
|
2089
|
+
// Update $location
|
2090
|
+
var toNav = to.navigable;
|
2091
|
+
if (options.location && toNav) {
|
2092
|
+
$location.url(toNav.url.format(toNav.locals.globals.$stateParams));
|
2093
|
+
|
2094
|
+
if (options.location === 'replace') {
|
2095
|
+
$location.replace();
|
2096
|
+
}
|
2097
|
+
}
|
2098
|
+
|
2099
|
+
if (options.notify) {
|
2100
|
+
/**
|
2101
|
+
* @ngdoc event
|
2102
|
+
* @name ui.router.state.$state#$stateChangeSuccess
|
2103
|
+
* @eventOf ui.router.state.$state
|
2104
|
+
* @eventType broadcast on root scope
|
2105
|
+
* @description
|
2106
|
+
* Fired once the state transition is **complete**.
|
2107
|
+
*
|
2108
|
+
* @param {Object} event Event object.
|
2109
|
+
* @param {State} toState The state being transitioned to.
|
2110
|
+
* @param {Object} toParams The params supplied to the `toState`.
|
2111
|
+
* @param {State} fromState The current state, pre-transition.
|
2112
|
+
* @param {Object} fromParams The params supplied to the `fromState`.
|
2113
|
+
*/
|
2114
|
+
$rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);
|
2115
|
+
}
|
2116
|
+
currentLocation = $location.url();
|
2117
|
+
|
2118
|
+
return $state.current;
|
2119
|
+
}, function (error) {
|
2120
|
+
if ($state.transition !== transition) return TransitionSuperseded;
|
2121
|
+
|
2122
|
+
$state.transition = null;
|
2123
|
+
/**
|
2124
|
+
* @ngdoc event
|
2125
|
+
* @name ui.router.state.$state#$stateChangeError
|
2126
|
+
* @eventOf ui.router.state.$state
|
2127
|
+
* @eventType broadcast on root scope
|
2128
|
+
* @description
|
2129
|
+
* Fired when an **error occurs** during transition. It's important to note that if you
|
2130
|
+
* have any errors in your resolve functions (javascript errors, non-existent services, etc)
|
2131
|
+
* they will not throw traditionally. You must listen for this $stateChangeError event to
|
2132
|
+
* catch **ALL** errors.
|
2133
|
+
*
|
2134
|
+
* @param {Object} event Event object.
|
2135
|
+
* @param {State} toState The state being transitioned to.
|
2136
|
+
* @param {Object} toParams The params supplied to the `toState`.
|
2137
|
+
* @param {State} fromState The current state, pre-transition.
|
2138
|
+
* @param {Object} fromParams The params supplied to the `fromState`.
|
2139
|
+
* @param {Error} error The resolve error object.
|
2140
|
+
*/
|
2141
|
+
$rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);
|
2142
|
+
syncUrl();
|
2143
|
+
|
2144
|
+
return $q.reject(error);
|
2145
|
+
});
|
2146
|
+
|
2147
|
+
return transition;
|
2148
|
+
};
|
2149
|
+
|
2150
|
+
/**
|
2151
|
+
* @ngdoc function
|
2152
|
+
* @name ui.router.state.$state#is
|
2153
|
+
* @methodOf ui.router.state.$state
|
2154
|
+
*
|
2155
|
+
* @description
|
2156
|
+
* Similar to {@link ui.router.state.$state#methods_includes $state.includes},
|
2157
|
+
* but only checks for the full state name. If params is supplied then it will be
|
2158
|
+
* tested for strict equality against the current active params object, so all params
|
2159
|
+
* must match with none missing and no extras.
|
2160
|
+
*
|
2161
|
+
* @example
|
2162
|
+
* <pre>
|
2163
|
+
* $state.is('contact.details.item'); // returns true
|
2164
|
+
* $state.is(contactDetailItemStateObject); // returns true
|
2165
|
+
*
|
2166
|
+
* // everything else would return false
|
2167
|
+
* </pre>
|
2168
|
+
*
|
2169
|
+
* @param {string|object} stateName The state name or state object you'd like to check.
|
2170
|
+
* @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like
|
2171
|
+
* to test against the current active state.
|
2172
|
+
* @returns {boolean} Returns true if it is the state.
|
2173
|
+
*/
|
2174
|
+
$state.is = function is(stateOrName, params) {
|
2175
|
+
var state = findState(stateOrName);
|
2176
|
+
|
2177
|
+
if (!isDefined(state)) {
|
2178
|
+
return undefined;
|
2179
|
+
}
|
2180
|
+
|
2181
|
+
if ($state.$current !== state) {
|
2182
|
+
return false;
|
2183
|
+
}
|
2184
|
+
|
2185
|
+
return isDefined(params) && params !== null ? angular.equals($stateParams, params) : true;
|
2186
|
+
};
|
2187
|
+
|
2188
|
+
/**
|
2189
|
+
* @ngdoc function
|
2190
|
+
* @name ui.router.state.$state#includes
|
2191
|
+
* @methodOf ui.router.state.$state
|
2192
|
+
*
|
2193
|
+
* @description
|
2194
|
+
* A method to determine if the current active state is equal to or is the child of the
|
2195
|
+
* state stateName. If any params are passed then they will be tested for a match as well.
|
2196
|
+
* Not all the parameters need to be passed, just the ones you'd like to test for equality.
|
2197
|
+
*
|
2198
|
+
* @example
|
2199
|
+
* <pre>
|
2200
|
+
* $state.$current.name = 'contacts.details.item';
|
2201
|
+
*
|
2202
|
+
* $state.includes("contacts"); // returns true
|
2203
|
+
* $state.includes("contacts.details"); // returns true
|
2204
|
+
* $state.includes("contacts.details.item"); // returns true
|
2205
|
+
* $state.includes("contacts.list"); // returns false
|
2206
|
+
* $state.includes("about"); // returns false
|
2207
|
+
* </pre>
|
2208
|
+
*
|
2209
|
+
* @description
|
2210
|
+
* Basic globing patterns will also work.
|
2211
|
+
*
|
2212
|
+
* @example
|
2213
|
+
* <pre>
|
2214
|
+
* $state.$current.name = 'contacts.details.item.url';
|
2215
|
+
*
|
2216
|
+
* $state.includes("*.details.*.*"); // returns true
|
2217
|
+
* $state.includes("*.details.**"); // returns true
|
2218
|
+
* $state.includes("**.item.**"); // returns true
|
2219
|
+
* $state.includes("*.details.item.url"); // returns true
|
2220
|
+
* $state.includes("*.details.*.url"); // returns true
|
2221
|
+
* $state.includes("*.details.*"); // returns false
|
2222
|
+
* $state.includes("item.**"); // returns false
|
2223
|
+
* </pre>
|
2224
|
+
*
|
2225
|
+
* @param {string} stateOrName A partial name to be searched for within the current state name.
|
2226
|
+
* @param {object} params A param object, e.g. `{sectionId: section.id}`,
|
2227
|
+
* that you'd like to test against the current active state.
|
2228
|
+
* @returns {boolean} Returns true if it does include the state
|
2229
|
+
*/
|
2230
|
+
|
2231
|
+
$state.includes = function includes(stateOrName, params) {
|
2232
|
+
if (isString(stateOrName) && isGlob(stateOrName)) {
|
2233
|
+
if (doesStateMatchGlob(stateOrName)) {
|
2234
|
+
stateOrName = $state.$current.name;
|
2235
|
+
} else {
|
2236
|
+
return false;
|
2237
|
+
}
|
2238
|
+
}
|
2239
|
+
|
2240
|
+
var state = findState(stateOrName);
|
2241
|
+
if (!isDefined(state)) {
|
2242
|
+
return undefined;
|
2243
|
+
}
|
2244
|
+
|
2245
|
+
if (!isDefined($state.$current.includes[state.name])) {
|
2246
|
+
return false;
|
2247
|
+
}
|
2248
|
+
|
2249
|
+
var validParams = true;
|
2250
|
+
angular.forEach(params, function(value, key) {
|
2251
|
+
if (!isDefined($stateParams[key]) || $stateParams[key] !== value) {
|
2252
|
+
validParams = false;
|
2253
|
+
}
|
2254
|
+
});
|
2255
|
+
return validParams;
|
2256
|
+
};
|
2257
|
+
|
2258
|
+
|
2259
|
+
/**
|
2260
|
+
* @ngdoc function
|
2261
|
+
* @name ui.router.state.$state#href
|
2262
|
+
* @methodOf ui.router.state.$state
|
2263
|
+
*
|
2264
|
+
* @description
|
2265
|
+
* A url generation method that returns the compiled url for the given state populated with the given params.
|
2266
|
+
*
|
2267
|
+
* @example
|
2268
|
+
* <pre>
|
2269
|
+
* expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob");
|
2270
|
+
* </pre>
|
2271
|
+
*
|
2272
|
+
* @param {string|object} stateOrName The state name or state object you'd like to generate a url from.
|
2273
|
+
* @param {object=} params An object of parameter values to fill the state's required parameters.
|
2274
|
+
* @param {object=} options Options object. The options are:
|
2275
|
+
*
|
2276
|
+
* - **`lossy`** - {boolean=true} - If true, and if there is no url associated with the state provided in the
|
2277
|
+
* first parameter, then the constructed href url will be built from the first navigable ancestor (aka
|
2278
|
+
* ancestor with a valid url).
|
2279
|
+
* - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.
|
2280
|
+
* - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'),
|
2281
|
+
* defines which state to be relative from.
|
2282
|
+
* - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
|
2283
|
+
*
|
2284
|
+
* @returns {string} compiled state url
|
2285
|
+
*/
|
2286
|
+
$state.href = function href(stateOrName, params, options) {
|
2287
|
+
options = extend({ lossy: true, inherit: false, absolute: false, relative: $state.$current }, options || {});
|
2288
|
+
var state = findState(stateOrName, options.relative);
|
2289
|
+
if (!isDefined(state)) return null;
|
2290
|
+
|
2291
|
+
params = inheritParams($stateParams, params || {}, $state.$current, state);
|
2292
|
+
var nav = (state && options.lossy) ? state.navigable : state;
|
2293
|
+
var url = (nav && nav.url) ? nav.url.format(normalize(state.params, params || {})) : null;
|
2294
|
+
if (!$locationProvider.html5Mode() && url) {
|
2295
|
+
url = "#" + $locationProvider.hashPrefix() + url;
|
2296
|
+
}
|
2297
|
+
|
2298
|
+
if (baseHref !== '/') {
|
2299
|
+
if ($locationProvider.html5Mode()) {
|
2300
|
+
url = baseHref.slice(0, -1) + url;
|
2301
|
+
} else if (options.absolute){
|
2302
|
+
url = baseHref.slice(1) + url;
|
2303
|
+
}
|
2304
|
+
}
|
2305
|
+
|
2306
|
+
if (options.absolute && url) {
|
2307
|
+
url = $location.protocol() + '://' +
|
2308
|
+
$location.host() +
|
2309
|
+
($location.port() == 80 || $location.port() == 443 ? '' : ':' + $location.port()) +
|
2310
|
+
(!$locationProvider.html5Mode() && url ? '/' : '') +
|
2311
|
+
url;
|
2312
|
+
}
|
2313
|
+
return url;
|
2314
|
+
};
|
2315
|
+
|
2316
|
+
/**
|
2317
|
+
* @ngdoc function
|
2318
|
+
* @name ui.router.state.$state#get
|
2319
|
+
* @methodOf ui.router.state.$state
|
2320
|
+
*
|
2321
|
+
* @description
|
2322
|
+
* Returns the state configuration object for any specific state or all states.
|
2323
|
+
*
|
2324
|
+
* @param {string|object=} stateOrName If provided, will only get the config for
|
2325
|
+
* the requested state. If not provided, returns an array of ALL state configs.
|
2326
|
+
* @returns {object|array} State configuration object or array of all objects.
|
2327
|
+
*/
|
2328
|
+
$state.get = function (stateOrName, context) {
|
2329
|
+
if (!isDefined(stateOrName)) {
|
2330
|
+
var list = [];
|
2331
|
+
forEach(states, function(state) { list.push(state.self); });
|
2332
|
+
return list;
|
2333
|
+
}
|
2334
|
+
var state = findState(stateOrName, context);
|
2335
|
+
return (state && state.self) ? state.self : null;
|
2336
|
+
};
|
2337
|
+
|
2338
|
+
function resolveState(state, params, paramsAreFiltered, inherited, dst) {
|
2339
|
+
// Make a restricted $stateParams with only the parameters that apply to this state if
|
2340
|
+
// necessary. In addition to being available to the controller and onEnter/onExit callbacks,
|
2341
|
+
// we also need $stateParams to be available for any $injector calls we make during the
|
2342
|
+
// dependency resolution process.
|
2343
|
+
var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params, params);
|
2344
|
+
var locals = { $stateParams: $stateParams };
|
2345
|
+
|
2346
|
+
// Resolve 'global' dependencies for the state, i.e. those not specific to a view.
|
2347
|
+
// We're also including $stateParams in this; that way the parameters are restricted
|
2348
|
+
// to the set that should be visible to the state, and are independent of when we update
|
2349
|
+
// the global $state and $stateParams values.
|
2350
|
+
dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);
|
2351
|
+
var promises = [ dst.resolve.then(function (globals) {
|
2352
|
+
dst.globals = globals;
|
2353
|
+
}) ];
|
2354
|
+
if (inherited) promises.push(inherited);
|
2355
|
+
|
2356
|
+
// Resolve template and dependencies for all views.
|
2357
|
+
forEach(state.views, function (view, name) {
|
2358
|
+
var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});
|
2359
|
+
injectables.$template = [ function () {
|
2360
|
+
return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: false }) || '';
|
2361
|
+
}];
|
2362
|
+
|
2363
|
+
promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) {
|
2364
|
+
// References to the controller (only instantiated at link time)
|
2365
|
+
if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {
|
2366
|
+
var injectLocals = angular.extend({}, injectables, locals);
|
2367
|
+
result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);
|
2368
|
+
} else {
|
2369
|
+
result.$$controller = view.controller;
|
2370
|
+
}
|
2371
|
+
// Provide access to the state itself for internal use
|
2372
|
+
result.$$state = state;
|
2373
|
+
result.$$controllerAs = view.controllerAs;
|
2374
|
+
dst[name] = result;
|
2375
|
+
}));
|
2376
|
+
});
|
2377
|
+
|
2378
|
+
// Wait for all the promises and then return the activation object
|
2379
|
+
return $q.all(promises).then(function (values) {
|
2380
|
+
return dst;
|
2381
|
+
});
|
2382
|
+
}
|
2383
|
+
|
2384
|
+
return $state;
|
2385
|
+
}
|
2386
|
+
|
2387
|
+
function shouldTriggerReload(to, from, locals, options) {
|
2388
|
+
if ( to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false)) ) {
|
2389
|
+
return true;
|
2390
|
+
}
|
2391
|
+
}
|
2392
|
+
}
|
2393
|
+
|
2394
|
+
angular.module('ui.router.state')
|
2395
|
+
.value('$stateParams', {})
|
2396
|
+
.provider('$state', $StateProvider);
|
2397
|
+
|
2398
|
+
|
2399
|
+
$ViewProvider.$inject = [];
|
2400
|
+
function $ViewProvider() {
|
2401
|
+
|
2402
|
+
this.$get = $get;
|
2403
|
+
/**
|
2404
|
+
* @ngdoc object
|
2405
|
+
* @name ui.router.state.$view
|
2406
|
+
*
|
2407
|
+
* @requires ui.router.util.$templateFactory
|
2408
|
+
* @requires $rootScope
|
2409
|
+
*
|
2410
|
+
* @description
|
2411
|
+
*
|
2412
|
+
*/
|
2413
|
+
$get.$inject = ['$rootScope', '$templateFactory'];
|
2414
|
+
function $get( $rootScope, $templateFactory) {
|
2415
|
+
return {
|
2416
|
+
// $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })
|
2417
|
+
/**
|
2418
|
+
* @ngdoc function
|
2419
|
+
* @name ui.router.state.$view#load
|
2420
|
+
* @methodOf ui.router.state.$view
|
2421
|
+
*
|
2422
|
+
* @description
|
2423
|
+
*
|
2424
|
+
* @param {string} name name
|
2425
|
+
* @param {object} options option object.
|
2426
|
+
*/
|
2427
|
+
load: function load(name, options) {
|
2428
|
+
var result, defaults = {
|
2429
|
+
template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}
|
2430
|
+
};
|
2431
|
+
options = extend(defaults, options);
|
2432
|
+
|
2433
|
+
if (options.view) {
|
2434
|
+
result = $templateFactory.fromConfig(options.view, options.params, options.locals);
|
2435
|
+
}
|
2436
|
+
if (result && options.notify) {
|
2437
|
+
/**
|
2438
|
+
* @ngdoc event
|
2439
|
+
* @name ui.router.state.$state#$viewContentLoading
|
2440
|
+
* @eventOf ui.router.state.$view
|
2441
|
+
* @eventType broadcast on root scope
|
2442
|
+
* @description
|
2443
|
+
*
|
2444
|
+
* Fired once the view **begins loading**, *before* the DOM is rendered.
|
2445
|
+
*
|
2446
|
+
* @param {Object} event Event object.
|
2447
|
+
* @param {Object} viewConfig The view config properties (template, controller, etc).
|
2448
|
+
*
|
2449
|
+
* @example
|
2450
|
+
*
|
2451
|
+
* <pre>
|
2452
|
+
* $scope.$on('$viewContentLoading',
|
2453
|
+
* function(event, viewConfig){
|
2454
|
+
* // Access to all the view config properties.
|
2455
|
+
* // and one special property 'targetView'
|
2456
|
+
* // viewConfig.targetView
|
2457
|
+
* });
|
2458
|
+
* </pre>
|
2459
|
+
*/
|
2460
|
+
$rootScope.$broadcast('$viewContentLoading', options);
|
2461
|
+
}
|
2462
|
+
return result;
|
2463
|
+
}
|
2464
|
+
};
|
2465
|
+
}
|
2466
|
+
}
|
2467
|
+
|
2468
|
+
angular.module('ui.router.state').provider('$view', $ViewProvider);
|
2469
|
+
|
2470
|
+
/**
|
2471
|
+
* @ngdoc object
|
2472
|
+
* @name ui.router.state.$uiViewScrollProvider
|
2473
|
+
*
|
2474
|
+
* @description
|
2475
|
+
* Provider that returns the {@link ui.router.state.$uiViewScroll} service function.
|
2476
|
+
*/
|
2477
|
+
function $ViewScrollProvider() {
|
2478
|
+
|
2479
|
+
var useAnchorScroll = false;
|
2480
|
+
|
2481
|
+
/**
|
2482
|
+
* @ngdoc function
|
2483
|
+
* @name ui.router.state.$uiViewScrollProvider#useAnchorScroll
|
2484
|
+
* @methodOf ui.router.state.$uiViewScrollProvider
|
2485
|
+
*
|
2486
|
+
* @description
|
2487
|
+
* Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for
|
2488
|
+
* scrolling based on the url anchor.
|
2489
|
+
*/
|
2490
|
+
this.useAnchorScroll = function () {
|
2491
|
+
useAnchorScroll = true;
|
2492
|
+
};
|
2493
|
+
|
2494
|
+
/**
|
2495
|
+
* @ngdoc object
|
2496
|
+
* @name ui.router.state.$uiViewScroll
|
2497
|
+
*
|
2498
|
+
* @requires $anchorScroll
|
2499
|
+
* @requires $timeout
|
2500
|
+
*
|
2501
|
+
* @description
|
2502
|
+
* When called with a jqLite element, it scrolls the element into view (after a
|
2503
|
+
* `$timeout` so the DOM has time to refresh).
|
2504
|
+
*
|
2505
|
+
* If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,
|
2506
|
+
* this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.
|
2507
|
+
*/
|
2508
|
+
this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {
|
2509
|
+
if (useAnchorScroll) {
|
2510
|
+
return $anchorScroll;
|
2511
|
+
}
|
2512
|
+
|
2513
|
+
return function ($element) {
|
2514
|
+
$timeout(function () {
|
2515
|
+
$element[0].scrollIntoView();
|
2516
|
+
}, 0, false);
|
2517
|
+
};
|
2518
|
+
}];
|
2519
|
+
}
|
2520
|
+
|
2521
|
+
angular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);
|
2522
|
+
|
2523
|
+
/**
|
2524
|
+
* @ngdoc directive
|
2525
|
+
* @name ui.router.state.directive:ui-view
|
2526
|
+
*
|
2527
|
+
* @requires ui.router.state.$state
|
2528
|
+
* @requires $compile
|
2529
|
+
* @requires $controller
|
2530
|
+
* @requires $injector
|
2531
|
+
* @requires ui.router.state.$uiViewScroll
|
2532
|
+
* @requires $document
|
2533
|
+
*
|
2534
|
+
* @restrict ECA
|
2535
|
+
*
|
2536
|
+
* @description
|
2537
|
+
* The ui-view directive tells $state where to place your templates.
|
2538
|
+
*
|
2539
|
+
* @param {string=} ui-view A view name. The name should be unique amongst the other views in the
|
2540
|
+
* same state. You can have views of the same name that live in different states.
|
2541
|
+
*
|
2542
|
+
* @param {string=} autoscroll It allows you to set the scroll behavior of the browser window
|
2543
|
+
* when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll
|
2544
|
+
* service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
|
2545
|
+
* scroll ui-view elements into view when they are populated during a state activation.
|
2546
|
+
*
|
2547
|
+
* *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
|
2548
|
+
* functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
|
2549
|
+
*
|
2550
|
+
* @param {string=} onload Expression to evaluate whenever the view updates.
|
2551
|
+
*
|
2552
|
+
* @example
|
2553
|
+
* A view can be unnamed or named.
|
2554
|
+
* <pre>
|
2555
|
+
* <!-- Unnamed -->
|
2556
|
+
* <div ui-view></div>
|
2557
|
+
*
|
2558
|
+
* <!-- Named -->
|
2559
|
+
* <div ui-view="viewName"></div>
|
2560
|
+
* </pre>
|
2561
|
+
*
|
2562
|
+
* You can only have one unnamed view within any template (or root html). If you are only using a
|
2563
|
+
* single view and it is unnamed then you can populate it like so:
|
2564
|
+
* <pre>
|
2565
|
+
* <div ui-view></div>
|
2566
|
+
* $stateProvider.state("home", {
|
2567
|
+
* template: "<h1>HELLO!</h1>"
|
2568
|
+
* })
|
2569
|
+
* </pre>
|
2570
|
+
*
|
2571
|
+
* The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}
|
2572
|
+
* config property, by name, in this case an empty name:
|
2573
|
+
* <pre>
|
2574
|
+
* $stateProvider.state("home", {
|
2575
|
+
* views: {
|
2576
|
+
* "": {
|
2577
|
+
* template: "<h1>HELLO!</h1>"
|
2578
|
+
* }
|
2579
|
+
* }
|
2580
|
+
* })
|
2581
|
+
* </pre>
|
2582
|
+
*
|
2583
|
+
* But typically you'll only use the views property if you name your view or have more than one view
|
2584
|
+
* in the same template. There's not really a compelling reason to name a view if its the only one,
|
2585
|
+
* but you could if you wanted, like so:
|
2586
|
+
* <pre>
|
2587
|
+
* <div ui-view="main"></div>
|
2588
|
+
* </pre>
|
2589
|
+
* <pre>
|
2590
|
+
* $stateProvider.state("home", {
|
2591
|
+
* views: {
|
2592
|
+
* "main": {
|
2593
|
+
* template: "<h1>HELLO!</h1>"
|
2594
|
+
* }
|
2595
|
+
* }
|
2596
|
+
* })
|
2597
|
+
* </pre>
|
2598
|
+
*
|
2599
|
+
* Really though, you'll use views to set up multiple views:
|
2600
|
+
* <pre>
|
2601
|
+
* <div ui-view></div>
|
2602
|
+
* <div ui-view="chart"></div>
|
2603
|
+
* <div ui-view="data"></div>
|
2604
|
+
* </pre>
|
2605
|
+
*
|
2606
|
+
* <pre>
|
2607
|
+
* $stateProvider.state("home", {
|
2608
|
+
* views: {
|
2609
|
+
* "": {
|
2610
|
+
* template: "<h1>HELLO!</h1>"
|
2611
|
+
* },
|
2612
|
+
* "chart": {
|
2613
|
+
* template: "<chart_thing/>"
|
2614
|
+
* },
|
2615
|
+
* "data": {
|
2616
|
+
* template: "<data_thing/>"
|
2617
|
+
* }
|
2618
|
+
* }
|
2619
|
+
* })
|
2620
|
+
* </pre>
|
2621
|
+
*
|
2622
|
+
* Examples for `autoscroll`:
|
2623
|
+
*
|
2624
|
+
* <pre>
|
2625
|
+
* <!-- If autoscroll present with no expression,
|
2626
|
+
* then scroll ui-view into view -->
|
2627
|
+
* <ui-view autoscroll/>
|
2628
|
+
*
|
2629
|
+
* <!-- If autoscroll present with valid expression,
|
2630
|
+
* then scroll ui-view into view if expression evaluates to true -->
|
2631
|
+
* <ui-view autoscroll='true'/>
|
2632
|
+
* <ui-view autoscroll='false'/>
|
2633
|
+
* <ui-view autoscroll='scopeVariable'/>
|
2634
|
+
* </pre>
|
2635
|
+
*/
|
2636
|
+
$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll'];
|
2637
|
+
function $ViewDirective( $state, $injector, $uiViewScroll) {
|
2638
|
+
|
2639
|
+
function getService() {
|
2640
|
+
return ($injector.has) ? function(service) {
|
2641
|
+
return $injector.has(service) ? $injector.get(service) : null;
|
2642
|
+
} : function(service) {
|
2643
|
+
try {
|
2644
|
+
return $injector.get(service);
|
2645
|
+
} catch (e) {
|
2646
|
+
return null;
|
2647
|
+
}
|
2648
|
+
};
|
2649
|
+
}
|
2650
|
+
|
2651
|
+
var service = getService(),
|
2652
|
+
$animator = service('$animator'),
|
2653
|
+
$animate = service('$animate');
|
2654
|
+
|
2655
|
+
// Returns a set of DOM manipulation functions based on which Angular version
|
2656
|
+
// it should use
|
2657
|
+
function getRenderer(attrs, scope) {
|
2658
|
+
var statics = function() {
|
2659
|
+
return {
|
2660
|
+
enter: function (element, target, cb) { target.after(element); cb(); },
|
2661
|
+
leave: function (element, cb) { element.remove(); cb(); }
|
2662
|
+
};
|
2663
|
+
};
|
2664
|
+
|
2665
|
+
if ($animate) {
|
2666
|
+
return {
|
2667
|
+
enter: function(element, target, cb) { $animate.enter(element, null, target, cb); },
|
2668
|
+
leave: function(element, cb) { $animate.leave(element, cb); }
|
2669
|
+
};
|
2670
|
+
}
|
2671
|
+
|
2672
|
+
if ($animator) {
|
2673
|
+
var animate = $animator && $animator(scope, attrs);
|
2674
|
+
|
2675
|
+
return {
|
2676
|
+
enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },
|
2677
|
+
leave: function(element, cb) { animate.leave(element); cb(); }
|
2678
|
+
};
|
2679
|
+
}
|
2680
|
+
|
2681
|
+
return statics();
|
2682
|
+
}
|
2683
|
+
|
2684
|
+
var directive = {
|
2685
|
+
restrict: 'ECA',
|
2686
|
+
terminal: true,
|
2687
|
+
priority: 400,
|
2688
|
+
transclude: 'element',
|
2689
|
+
compile: function (tElement, tAttrs, $transclude) {
|
2690
|
+
return function (scope, $element, attrs) {
|
2691
|
+
var previousEl, currentEl, currentScope, latestLocals,
|
2692
|
+
onloadExp = attrs.onload || '',
|
2693
|
+
autoScrollExp = attrs.autoscroll,
|
2694
|
+
renderer = getRenderer(attrs, scope);
|
2695
|
+
|
2696
|
+
scope.$on('$stateChangeSuccess', function() {
|
2697
|
+
updateView(false);
|
2698
|
+
});
|
2699
|
+
scope.$on('$viewContentLoading', function() {
|
2700
|
+
updateView(false);
|
2701
|
+
});
|
2702
|
+
|
2703
|
+
updateView(true);
|
2704
|
+
|
2705
|
+
function cleanupLastView() {
|
2706
|
+
if (previousEl) {
|
2707
|
+
previousEl.remove();
|
2708
|
+
previousEl = null;
|
2709
|
+
}
|
2710
|
+
|
2711
|
+
if (currentScope) {
|
2712
|
+
currentScope.$destroy();
|
2713
|
+
currentScope = null;
|
2714
|
+
}
|
2715
|
+
|
2716
|
+
if (currentEl) {
|
2717
|
+
renderer.leave(currentEl, function() {
|
2718
|
+
previousEl = null;
|
2719
|
+
});
|
2720
|
+
|
2721
|
+
previousEl = currentEl;
|
2722
|
+
currentEl = null;
|
2723
|
+
}
|
2724
|
+
}
|
2725
|
+
|
2726
|
+
function updateView(firstTime) {
|
2727
|
+
var newScope = scope.$new(),
|
2728
|
+
name = currentEl && currentEl.data('$uiViewName'),
|
2729
|
+
previousLocals = name && $state.$current && $state.$current.locals[name];
|
2730
|
+
|
2731
|
+
if (!firstTime && previousLocals === latestLocals) return; // nothing to do
|
2732
|
+
|
2733
|
+
var clone = $transclude(newScope, function(clone) {
|
2734
|
+
renderer.enter(clone, $element, function onUiViewEnter() {
|
2735
|
+
if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {
|
2736
|
+
$uiViewScroll(clone);
|
2737
|
+
}
|
2738
|
+
});
|
2739
|
+
cleanupLastView();
|
2740
|
+
});
|
2741
|
+
|
2742
|
+
latestLocals = $state.$current.locals[clone.data('$uiViewName')];
|
2743
|
+
|
2744
|
+
currentEl = clone;
|
2745
|
+
currentScope = newScope;
|
2746
|
+
/**
|
2747
|
+
* @ngdoc event
|
2748
|
+
* @name ui.router.state.directive:ui-view#$viewContentLoaded
|
2749
|
+
* @eventOf ui.router.state.directive:ui-view
|
2750
|
+
* @eventType emits on ui-view directive scope
|
2751
|
+
* @description *
|
2752
|
+
* Fired once the view is **loaded**, *after* the DOM is rendered.
|
2753
|
+
*
|
2754
|
+
* @param {Object} event Event object.
|
2755
|
+
*/
|
2756
|
+
currentScope.$emit('$viewContentLoaded');
|
2757
|
+
currentScope.$eval(onloadExp);
|
2758
|
+
}
|
2759
|
+
};
|
2760
|
+
}
|
2761
|
+
};
|
2762
|
+
|
2763
|
+
return directive;
|
2764
|
+
}
|
2765
|
+
|
2766
|
+
$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state'];
|
2767
|
+
function $ViewDirectiveFill ($compile, $controller, $state) {
|
2768
|
+
return {
|
2769
|
+
restrict: 'ECA',
|
2770
|
+
priority: -400,
|
2771
|
+
compile: function (tElement) {
|
2772
|
+
var initial = tElement.html();
|
2773
|
+
return function (scope, $element, attrs) {
|
2774
|
+
var name = attrs.uiView || attrs.name || '',
|
2775
|
+
inherited = $element.inheritedData('$uiView');
|
2776
|
+
|
2777
|
+
if (name.indexOf('@') < 0) {
|
2778
|
+
name = name + '@' + (inherited ? inherited.state.name : '');
|
2779
|
+
}
|
2780
|
+
|
2781
|
+
$element.data('$uiViewName', name);
|
2782
|
+
|
2783
|
+
var current = $state.$current,
|
2784
|
+
locals = current && current.locals[name];
|
2785
|
+
|
2786
|
+
if (! locals) {
|
2787
|
+
return;
|
2788
|
+
}
|
2789
|
+
|
2790
|
+
$element.data('$uiView', { name: name, state: locals.$$state });
|
2791
|
+
$element.html(locals.$template ? locals.$template : initial);
|
2792
|
+
|
2793
|
+
var link = $compile($element.contents());
|
2794
|
+
|
2795
|
+
if (locals.$$controller) {
|
2796
|
+
locals.$scope = scope;
|
2797
|
+
var controller = $controller(locals.$$controller, locals);
|
2798
|
+
if (locals.$$controllerAs) {
|
2799
|
+
scope[locals.$$controllerAs] = controller;
|
2800
|
+
}
|
2801
|
+
$element.data('$ngControllerController', controller);
|
2802
|
+
$element.children().data('$ngControllerController', controller);
|
2803
|
+
}
|
2804
|
+
|
2805
|
+
link(scope);
|
2806
|
+
};
|
2807
|
+
}
|
2808
|
+
};
|
2809
|
+
}
|
2810
|
+
|
2811
|
+
angular.module('ui.router.state').directive('uiView', $ViewDirective);
|
2812
|
+
angular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);
|
2813
|
+
|
2814
|
+
function parseStateRef(ref) {
|
2815
|
+
var parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/);
|
2816
|
+
if (!parsed || parsed.length !== 4) throw new Error("Invalid state ref '" + ref + "'");
|
2817
|
+
return { state: parsed[1], paramExpr: parsed[3] || null };
|
2818
|
+
}
|
2819
|
+
|
2820
|
+
function stateContext(el) {
|
2821
|
+
var stateData = el.parent().inheritedData('$uiView');
|
2822
|
+
|
2823
|
+
if (stateData && stateData.state && stateData.state.name) {
|
2824
|
+
return stateData.state;
|
2825
|
+
}
|
2826
|
+
}
|
2827
|
+
|
2828
|
+
/**
|
2829
|
+
* @ngdoc directive
|
2830
|
+
* @name ui.router.state.directive:ui-sref
|
2831
|
+
*
|
2832
|
+
* @requires ui.router.state.$state
|
2833
|
+
* @requires $timeout
|
2834
|
+
*
|
2835
|
+
* @restrict A
|
2836
|
+
*
|
2837
|
+
* @description
|
2838
|
+
* A directive that binds a link (`<a>` tag) to a state. If the state has an associated
|
2839
|
+
* URL, the directive will automatically generate & update the `href` attribute via
|
2840
|
+
* the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking
|
2841
|
+
* the link will trigger a state transition with optional parameters.
|
2842
|
+
*
|
2843
|
+
* Also middle-clicking, right-clicking, and ctrl-clicking on the link will be
|
2844
|
+
* handled natively by the browser.
|
2845
|
+
*
|
2846
|
+
* You can also use relative state paths within ui-sref, just like the relative
|
2847
|
+
* paths passed to `$state.go()`. You just need to be aware that the path is relative
|
2848
|
+
* to the state that the link lives in, in other words the state that loaded the
|
2849
|
+
* template containing the link.
|
2850
|
+
*
|
2851
|
+
* You can specify options to pass to {@link ui.router.state.$state#go $state.go()}
|
2852
|
+
* using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,
|
2853
|
+
* and `reload`.
|
2854
|
+
*
|
2855
|
+
* @example
|
2856
|
+
* Here's an example of how you'd use ui-sref and how it would compile. If you have the
|
2857
|
+
* following template:
|
2858
|
+
* <pre>
|
2859
|
+
* <a ui-sref="home">Home</a> | <a ui-sref="about">About</a>
|
2860
|
+
*
|
2861
|
+
* <ul>
|
2862
|
+
* <li ng-repeat="contact in contacts">
|
2863
|
+
* <a ui-sref="contacts.detail({ id: contact.id })">{{ contact.name }}</a>
|
2864
|
+
* </li>
|
2865
|
+
* </ul>
|
2866
|
+
* </pre>
|
2867
|
+
*
|
2868
|
+
* Then the compiled html would be (assuming Html5Mode is off):
|
2869
|
+
* <pre>
|
2870
|
+
* <a href="#/home" ui-sref="home">Home</a> | <a href="#/about" ui-sref="about">About</a>
|
2871
|
+
*
|
2872
|
+
* <ul>
|
2873
|
+
* <li ng-repeat="contact in contacts">
|
2874
|
+
* <a href="#/contacts/1" ui-sref="contacts.detail({ id: contact.id })">Joe</a>
|
2875
|
+
* </li>
|
2876
|
+
* <li ng-repeat="contact in contacts">
|
2877
|
+
* <a href="#/contacts/2" ui-sref="contacts.detail({ id: contact.id })">Alice</a>
|
2878
|
+
* </li>
|
2879
|
+
* <li ng-repeat="contact in contacts">
|
2880
|
+
* <a href="#/contacts/3" ui-sref="contacts.detail({ id: contact.id })">Bob</a>
|
2881
|
+
* </li>
|
2882
|
+
* </ul>
|
2883
|
+
*
|
2884
|
+
* <a ui-sref="home" ui-sref-opts="{reload: true}">Home</a>
|
2885
|
+
* </pre>
|
2886
|
+
*
|
2887
|
+
* @param {string} ui-sref 'stateName' can be any valid absolute or relative state
|
2888
|
+
* @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}
|
2889
|
+
*/
|
2890
|
+
$StateRefDirective.$inject = ['$state', '$timeout'];
|
2891
|
+
function $StateRefDirective($state, $timeout) {
|
2892
|
+
var allowedOptions = ['location', 'inherit', 'reload'];
|
2893
|
+
|
2894
|
+
return {
|
2895
|
+
restrict: 'A',
|
2896
|
+
require: '?^uiSrefActive',
|
2897
|
+
link: function(scope, element, attrs, uiSrefActive) {
|
2898
|
+
var ref = parseStateRef(attrs.uiSref);
|
2899
|
+
var params = null, url = null, base = stateContext(element) || $state.$current;
|
2900
|
+
var isForm = element[0].nodeName === "FORM";
|
2901
|
+
var attr = isForm ? "action" : "href", nav = true;
|
2902
|
+
|
2903
|
+
var options = {
|
2904
|
+
relative: base
|
2905
|
+
};
|
2906
|
+
var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};
|
2907
|
+
angular.forEach(allowedOptions, function(option) {
|
2908
|
+
if (option in optionsOverride) {
|
2909
|
+
options[option] = optionsOverride[option];
|
2910
|
+
}
|
2911
|
+
});
|
2912
|
+
|
2913
|
+
var update = function(newVal) {
|
2914
|
+
if (newVal) params = newVal;
|
2915
|
+
if (!nav) return;
|
2916
|
+
|
2917
|
+
var newHref = $state.href(ref.state, params, options);
|
2918
|
+
|
2919
|
+
if (uiSrefActive) {
|
2920
|
+
uiSrefActive.$$setStateInfo(ref.state, params);
|
2921
|
+
}
|
2922
|
+
if (!newHref) {
|
2923
|
+
nav = false;
|
2924
|
+
return false;
|
2925
|
+
}
|
2926
|
+
element[0][attr] = newHref;
|
2927
|
+
};
|
2928
|
+
|
2929
|
+
if (ref.paramExpr) {
|
2930
|
+
scope.$watch(ref.paramExpr, function(newVal, oldVal) {
|
2931
|
+
if (newVal !== params) update(newVal);
|
2932
|
+
}, true);
|
2933
|
+
params = scope.$eval(ref.paramExpr);
|
2934
|
+
}
|
2935
|
+
update();
|
2936
|
+
|
2937
|
+
if (isForm) return;
|
2938
|
+
|
2939
|
+
element.bind("click", function(e) {
|
2940
|
+
var button = e.which || e.button;
|
2941
|
+
if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {
|
2942
|
+
// HACK: This is to allow ng-clicks to be processed before the transition is initiated:
|
2943
|
+
$timeout(function() {
|
2944
|
+
$state.go(ref.state, params, options);
|
2945
|
+
});
|
2946
|
+
e.preventDefault();
|
2947
|
+
}
|
2948
|
+
});
|
2949
|
+
}
|
2950
|
+
};
|
2951
|
+
}
|
2952
|
+
|
2953
|
+
/**
|
2954
|
+
* @ngdoc directive
|
2955
|
+
* @name ui.router.state.directive:ui-sref-active
|
2956
|
+
*
|
2957
|
+
* @requires ui.router.state.$state
|
2958
|
+
* @requires ui.router.state.$stateParams
|
2959
|
+
* @requires $interpolate
|
2960
|
+
*
|
2961
|
+
* @restrict A
|
2962
|
+
*
|
2963
|
+
* @description
|
2964
|
+
* A directive working alongside ui-sref to add classes to an element when the
|
2965
|
+
* related ui-sref directive's state is active, and removing them when it is inactive.
|
2966
|
+
* The primary use-case is to simplify the special appearance of navigation menus
|
2967
|
+
* relying on `ui-sref`, by having the "active" state's menu button appear different,
|
2968
|
+
* distinguishing it from the inactive menu items.
|
2969
|
+
*
|
2970
|
+
* @example
|
2971
|
+
* Given the following template:
|
2972
|
+
* <pre>
|
2973
|
+
* <ul>
|
2974
|
+
* <li ui-sref-active="active" class="item">
|
2975
|
+
* <a href ui-sref="app.user({user: 'bilbobaggins'})">@bilbobaggins</a>
|
2976
|
+
* </li>
|
2977
|
+
* </ul>
|
2978
|
+
* </pre>
|
2979
|
+
*
|
2980
|
+
* When the app state is "app.user", and contains the state parameter "user" with value "bilbobaggins",
|
2981
|
+
* the resulting HTML will appear as (note the 'active' class):
|
2982
|
+
* <pre>
|
2983
|
+
* <ul>
|
2984
|
+
* <li ui-sref-active="active" class="item active">
|
2985
|
+
* <a ui-sref="app.user({user: 'bilbobaggins'})" href="/users/bilbobaggins">@bilbobaggins</a>
|
2986
|
+
* </li>
|
2987
|
+
* </ul>
|
2988
|
+
* </pre>
|
2989
|
+
*
|
2990
|
+
* The class name is interpolated **once** during the directives link time (any further changes to the
|
2991
|
+
* interpolated value are ignored).
|
2992
|
+
*
|
2993
|
+
* Multiple classes may be specified in a space-separated format:
|
2994
|
+
* <pre>
|
2995
|
+
* <ul>
|
2996
|
+
* <li ui-sref-active='class1 class2 class3'>
|
2997
|
+
* <a ui-sref="app.user">link</a>
|
2998
|
+
* </li>
|
2999
|
+
* </ul>
|
3000
|
+
* </pre>
|
3001
|
+
*/
|
3002
|
+
$StateActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];
|
3003
|
+
function $StateActiveDirective($state, $stateParams, $interpolate) {
|
3004
|
+
return {
|
3005
|
+
restrict: "A",
|
3006
|
+
controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
|
3007
|
+
var state, params, activeClass;
|
3008
|
+
|
3009
|
+
// There probably isn't much point in $observing this
|
3010
|
+
activeClass = $interpolate($attrs.uiSrefActive || '', false)($scope);
|
3011
|
+
|
3012
|
+
// Allow uiSref to communicate with uiSrefActive
|
3013
|
+
this.$$setStateInfo = function(newState, newParams) {
|
3014
|
+
state = $state.get(newState, stateContext($element));
|
3015
|
+
params = newParams;
|
3016
|
+
update();
|
3017
|
+
};
|
3018
|
+
|
3019
|
+
$scope.$on('$stateChangeSuccess', update);
|
3020
|
+
|
3021
|
+
// Update route state
|
3022
|
+
function update() {
|
3023
|
+
if ($state.$current.self === state && matchesParams()) {
|
3024
|
+
$element.addClass(activeClass);
|
3025
|
+
} else {
|
3026
|
+
$element.removeClass(activeClass);
|
3027
|
+
}
|
3028
|
+
}
|
3029
|
+
|
3030
|
+
function matchesParams() {
|
3031
|
+
return !params || equalForKeys(params, $stateParams);
|
3032
|
+
}
|
3033
|
+
}]
|
3034
|
+
};
|
3035
|
+
}
|
3036
|
+
|
3037
|
+
angular.module('ui.router.state')
|
3038
|
+
.directive('uiSref', $StateRefDirective)
|
3039
|
+
.directive('uiSrefActive', $StateActiveDirective);
|
3040
|
+
|
3041
|
+
/**
|
3042
|
+
* @ngdoc filter
|
3043
|
+
* @name ui.router.state.filter:isState
|
3044
|
+
*
|
3045
|
+
* @requires ui.router.state.$state
|
3046
|
+
*
|
3047
|
+
* @description
|
3048
|
+
* Translates to {@link ui.router.state.$state#methods_is $state.is("stateName")}.
|
3049
|
+
*/
|
3050
|
+
$IsStateFilter.$inject = ['$state'];
|
3051
|
+
function $IsStateFilter($state) {
|
3052
|
+
return function(state) {
|
3053
|
+
return $state.is(state);
|
3054
|
+
};
|
3055
|
+
}
|
3056
|
+
|
3057
|
+
/**
|
3058
|
+
* @ngdoc filter
|
3059
|
+
* @name ui.router.state.filter:includedByState
|
3060
|
+
*
|
3061
|
+
* @requires ui.router.state.$state
|
3062
|
+
*
|
3063
|
+
* @description
|
3064
|
+
* Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.
|
3065
|
+
*/
|
3066
|
+
$IncludedByStateFilter.$inject = ['$state'];
|
3067
|
+
function $IncludedByStateFilter($state) {
|
3068
|
+
return function(state) {
|
3069
|
+
return $state.includes(state);
|
3070
|
+
};
|
3071
|
+
}
|
3072
|
+
|
3073
|
+
angular.module('ui.router.state')
|
3074
|
+
.filter('isState', $IsStateFilter)
|
3075
|
+
.filter('includedByState', $IncludedByStateFilter);
|
3076
|
+
|
3077
|
+
/*
|
3078
|
+
* @ngdoc object
|
3079
|
+
* @name ui.router.compat.$routeProvider
|
3080
|
+
*
|
3081
|
+
* @requires ui.router.state.$stateProvider
|
3082
|
+
* @requires ui.router.router.$urlRouterProvider
|
3083
|
+
*
|
3084
|
+
* @description
|
3085
|
+
* `$routeProvider` of the `ui.router.compat` module overwrites the existing
|
3086
|
+
* `routeProvider` from the core. This is done to provide compatibility between
|
3087
|
+
* the UI Router and the core router.
|
3088
|
+
*
|
3089
|
+
* It also provides a `when()` method to register routes that map to certain urls.
|
3090
|
+
* Behind the scenes it actually delegates either to
|
3091
|
+
* {@link ui.router.router.$urlRouterProvider $urlRouterProvider} or to the
|
3092
|
+
* {@link ui.router.state.$stateProvider $stateProvider} to postprocess the given
|
3093
|
+
* router definition object.
|
3094
|
+
*/
|
3095
|
+
$RouteProvider.$inject = ['$stateProvider', '$urlRouterProvider'];
|
3096
|
+
function $RouteProvider( $stateProvider, $urlRouterProvider) {
|
3097
|
+
|
3098
|
+
var routes = [];
|
3099
|
+
|
3100
|
+
onEnterRoute.$inject = ['$$state'];
|
3101
|
+
function onEnterRoute( $$state) {
|
3102
|
+
/*jshint validthis: true */
|
3103
|
+
this.locals = $$state.locals.globals;
|
3104
|
+
this.params = this.locals.$stateParams;
|
3105
|
+
}
|
3106
|
+
|
3107
|
+
function onExitRoute() {
|
3108
|
+
/*jshint validthis: true */
|
3109
|
+
this.locals = null;
|
3110
|
+
this.params = null;
|
3111
|
+
}
|
3112
|
+
|
3113
|
+
this.when = when;
|
3114
|
+
/*
|
3115
|
+
* @ngdoc function
|
3116
|
+
* @name ui.router.compat.$routeProvider#when
|
3117
|
+
* @methodOf ui.router.compat.$routeProvider
|
3118
|
+
*
|
3119
|
+
* @description
|
3120
|
+
* Registers a route with a given route definition object. The route definition
|
3121
|
+
* object has the same interface the angular core route definition object has.
|
3122
|
+
*
|
3123
|
+
* @example
|
3124
|
+
* <pre>
|
3125
|
+
* var app = angular.module('app', ['ui.router.compat']);
|
3126
|
+
*
|
3127
|
+
* app.config(function ($routeProvider) {
|
3128
|
+
* $routeProvider.when('home', {
|
3129
|
+
* controller: function () { ... },
|
3130
|
+
* templateUrl: 'path/to/template'
|
3131
|
+
* });
|
3132
|
+
* });
|
3133
|
+
* </pre>
|
3134
|
+
*
|
3135
|
+
* @param {string} url URL as string
|
3136
|
+
* @param {object} route Route definition object
|
3137
|
+
*
|
3138
|
+
* @return {object} $routeProvider - $routeProvider instance
|
3139
|
+
*/
|
3140
|
+
function when(url, route) {
|
3141
|
+
/*jshint validthis: true */
|
3142
|
+
if (route.redirectTo != null) {
|
3143
|
+
// Redirect, configure directly on $urlRouterProvider
|
3144
|
+
var redirect = route.redirectTo, handler;
|
3145
|
+
if (isString(redirect)) {
|
3146
|
+
handler = redirect; // leave $urlRouterProvider to handle
|
3147
|
+
} else if (isFunction(redirect)) {
|
3148
|
+
// Adapt to $urlRouterProvider API
|
3149
|
+
handler = function (params, $location) {
|
3150
|
+
return redirect(params, $location.path(), $location.search());
|
3151
|
+
};
|
3152
|
+
} else {
|
3153
|
+
throw new Error("Invalid 'redirectTo' in when()");
|
3154
|
+
}
|
3155
|
+
$urlRouterProvider.when(url, handler);
|
3156
|
+
} else {
|
3157
|
+
// Regular route, configure as state
|
3158
|
+
$stateProvider.state(inherit(route, {
|
3159
|
+
parent: null,
|
3160
|
+
name: 'route:' + encodeURIComponent(url),
|
3161
|
+
url: url,
|
3162
|
+
onEnter: onEnterRoute,
|
3163
|
+
onExit: onExitRoute
|
3164
|
+
}));
|
3165
|
+
}
|
3166
|
+
routes.push(route);
|
3167
|
+
return this;
|
3168
|
+
}
|
3169
|
+
|
3170
|
+
/*
|
3171
|
+
* @ngdoc object
|
3172
|
+
* @name ui.router.compat.$route
|
3173
|
+
*
|
3174
|
+
* @requires ui.router.state.$state
|
3175
|
+
* @requires $rootScope
|
3176
|
+
* @requires $routeParams
|
3177
|
+
*
|
3178
|
+
* @property {object} routes - Array of registered routes.
|
3179
|
+
* @property {object} params - Current route params as object.
|
3180
|
+
* @property {string} current - Name of the current route.
|
3181
|
+
*
|
3182
|
+
* @description
|
3183
|
+
* The `$route` service provides interfaces to access defined routes. It also let's
|
3184
|
+
* you access route params through `$routeParams` service, so you have fully
|
3185
|
+
* control over all the stuff you would actually get from angular's core `$route`
|
3186
|
+
* service.
|
3187
|
+
*/
|
3188
|
+
this.$get = $get;
|
3189
|
+
$get.$inject = ['$state', '$rootScope', '$routeParams'];
|
3190
|
+
function $get( $state, $rootScope, $routeParams) {
|
3191
|
+
|
3192
|
+
var $route = {
|
3193
|
+
routes: routes,
|
3194
|
+
params: $routeParams,
|
3195
|
+
current: undefined
|
3196
|
+
};
|
3197
|
+
|
3198
|
+
function stateAsRoute(state) {
|
3199
|
+
return (state.name !== '') ? state : undefined;
|
3200
|
+
}
|
3201
|
+
|
3202
|
+
$rootScope.$on('$stateChangeStart', function (ev, to, toParams, from, fromParams) {
|
3203
|
+
$rootScope.$broadcast('$routeChangeStart', stateAsRoute(to), stateAsRoute(from));
|
3204
|
+
});
|
3205
|
+
|
3206
|
+
$rootScope.$on('$stateChangeSuccess', function (ev, to, toParams, from, fromParams) {
|
3207
|
+
$route.current = stateAsRoute(to);
|
3208
|
+
$rootScope.$broadcast('$routeChangeSuccess', stateAsRoute(to), stateAsRoute(from));
|
3209
|
+
copy(toParams, $route.params);
|
3210
|
+
});
|
3211
|
+
|
3212
|
+
$rootScope.$on('$stateChangeError', function (ev, to, toParams, from, fromParams, error) {
|
3213
|
+
$rootScope.$broadcast('$routeChangeError', stateAsRoute(to), stateAsRoute(from), error);
|
3214
|
+
});
|
3215
|
+
|
3216
|
+
return $route;
|
3217
|
+
}
|
3218
|
+
}
|
3219
|
+
|
3220
|
+
angular.module('ui.router.compat')
|
3221
|
+
.provider('$route', $RouteProvider)
|
3222
|
+
.directive('ngView', $ViewDirective);
|
3223
|
+
})(window, window.angular);
|