unpoly-rails 0.34.0 → 0.34.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of unpoly-rails might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 513b5201d93ee8e087b990e708f6c0c3fae07d59
4
- data.tar.gz: 0034f1a7a0e17e1f43d2a33d9783a831fc338880
3
+ metadata.gz: 505f1dc4951381eef94608e19f55ac8c2385f71a
4
+ data.tar.gz: dd2e7d98e406b7691f2bafa27839cd49af17bc38
5
5
  SHA512:
6
- metadata.gz: 8a75fc96dee7eac045e62627ea82aec8509106d45e29a3d884fad95257be227aecaa42ed6983a6142fc45aa9b633f017b6ffd77bd73111a5b434c5ea00d6d676
7
- data.tar.gz: 1815f021f9da6e10e087a5c68eacf7c7f841787af52175afa88ad599b29ef3c6de45762a9a6572c3f773ac2b097e4e9566cf757198276f85d5846cb1064602fc
6
+ metadata.gz: 17047a6458a2b9b2230b6eebad590d51d73ddbd48c826253220b20dc72e8c0c3875b885cf525cdc558ae613bef944998cc2979e868e86075d8de8b5a4bb46886
7
+ data.tar.gz: 0724b3beb05adbb628b0f889616e5c9bb5525413e2fe11a2e69db9ed7b55b34d7b1a5818cb96b7221252335cc94ddc13e6c0edcbbbbd2b627a66ffbda7a6ddcd
data/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ All notable changes to this project will be documented in this file.
6
6
  This project mostly adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
 
9
+ 0.34.1
10
+ ------
11
+
12
+ ### Compatible changes
13
+
14
+ - Elements with [`up-show-for`](/up-show-for) and [`up-hide-for`](/up-hide-for) attributes
15
+ can now be inserted dynamically after its controlling [`up-switch`](/up-switch) field has been
16
+ compiled.
17
+ - Unpoly no longer strips a trailing slash in the current URL during startup
18
+
19
+
9
20
  0.34.0
10
21
  ------
11
22
 
@@ -20,7 +31,7 @@ This project mostly adheres to [Semantic Versioning](http://semver.org/).
20
31
  - New experimental function [`up.layout.revealHash()`](/up.layout.revealHash).
21
32
  - The optional server protocol is now [documented](/up.protocol).
22
33
  The protocol is already implemented by the [`unpoly-rails`](https://rubygems.org/gems/unpoly-rails) Ruby gem.
23
- - New experimental property [`up.protocol.config`](/up.protocol.config)
34
+ - New experimental property [`up.protocol.config`](/up.protocol.config).
24
35
  - [`up.browser.isSupported()`](/up.browser.isSupported) has been promoted from experimental to stable API
25
36
 
26
37
 
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ module Unpoly
11
11
  SPROCKETS_SOURCES = %w(lib/assets/javascripts lib/assets/stylesheets)
12
12
  SPROCKETS_OUTPUT_FOLDER = 'dist'
13
13
  NPM_MANIFEST = 'package.json'
14
- VISIBLE_TASKS = %w(publish:build publish:commit publish:release)
14
+ VISIBLE_TASKS = %w(publish:build publish:commit publish:release publish:all)
15
15
  end
16
16
  end
17
17
 
data/dist/unpoly.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  (function() {
7
7
  this.up = {
8
- version: "0.34.0",
8
+ version: "0.34.1",
9
9
  renamedModule: function(oldName, newName) {
10
10
  return typeof Object.defineProperty === "function" ? Object.defineProperty(up, oldName, {
11
11
  get: function() {
@@ -107,7 +107,7 @@ that might save you from loading something like [Underscore.js](http://underscor
107
107
  if (pathname[0] !== '/') {
108
108
  pathname = "/" + pathname;
109
109
  }
110
- if ((options != null ? options.stripTrailingSlash : void 0) !== false) {
110
+ if ((options != null ? options.stripTrailingSlash : void 0) === true) {
111
111
  pathname = pathname.replace(/\/$/, '');
112
112
  }
113
113
  normalized += pathname;
@@ -4518,10 +4518,10 @@ Going back behavior .... configure.
4518
4518
  previousUrl = void 0;
4519
4519
  return nextPreviousUrl = void 0;
4520
4520
  };
4521
- normalizeUrl = function(url) {
4522
- return u.normalizeUrl(url, {
4523
- hash: true
4524
- });
4521
+ normalizeUrl = function(url, normalizeOptions) {
4522
+ normalizeOptions || (normalizeOptions = {});
4523
+ normalizeOptions.hash = true;
4524
+ return u.normalizeUrl(url, normalizeOptions);
4525
4525
  };
4526
4526
 
4527
4527
  /**
@@ -4530,11 +4530,15 @@ Going back behavior .... configure.
4530
4530
  @function up.history.url
4531
4531
  @experimental
4532
4532
  */
4533
- currentUrl = function() {
4534
- return normalizeUrl(up.browser.url());
4533
+ currentUrl = function(normalizeOptions) {
4534
+ return normalizeUrl(up.browser.url(), normalizeOptions);
4535
4535
  };
4536
4536
  isCurrentUrl = function(url) {
4537
- return normalizeUrl(url) === currentUrl();
4537
+ var normalizeOptions;
4538
+ normalizeOptions = {
4539
+ stripTrailingSlash: true
4540
+ };
4541
+ return normalizeUrl(url, normalizeOptions) === currentUrl(normalizeOptions);
4538
4542
  };
4539
4543
 
4540
4544
  /**
@@ -4741,6 +4745,7 @@ Going back behavior .... configure.
4741
4745
  push: push,
4742
4746
  replace: replace,
4743
4747
  url: currentUrl,
4748
+ isUrl: isCurrentUrl,
4744
4749
  previousUrl: function() {
4745
4750
  return previousUrl;
4746
4751
  },
@@ -5553,7 +5558,7 @@ is built from these functions. You can use them to extend Unpoly from your
5553
5558
 
5554
5559
  The current and new elements must both match the given CSS selector.
5555
5560
 
5556
- The UJS variant of this is the [`a[up-target]`](/a-up-target) selector.
5561
+ The unobtrusive variant of this is the [`a[up-target]`](/a-up-target) selector.
5557
5562
 
5558
5563
  \#\#\# Example
5559
5564
 
@@ -8019,7 +8024,7 @@ Linking to fragments
8019
8024
  In a traditional web application, the entire page is destroyed and re-created when the
8020
8025
  user follows a link:
8021
8026
 
8022
- ![Traditional page flow](/images/tutorial/fragment_flow_vanilla.svg){:width="620px" class="picture has_border is_sepia has_padding"}
8027
+ ![Traditional page flow](/images/tutorial/fragment_flow_vanilla.svg){:width="620" class="picture has_border is_sepia has_padding"}
8023
8028
 
8024
8029
  This makes for an unfriendly experience:
8025
8030
 
@@ -8036,7 +8041,7 @@ attribute. The value of this attribute is a CSS selector that indicates which pa
8036
8041
  fragment to update. The server **still renders full HTML pages**, but we only use
8037
8042
  the targeted ragments and discard the rest:
8038
8043
 
8039
- ![Unpoly page flow](/images/tutorial/fragment_flow_unpoly.svg){:width="620px" class="picture has_border is_sepia has_padding"}
8044
+ ![Unpoly page flow](/images/tutorial/fragment_flow_unpoly.svg){:width="620" class="picture has_border is_sepia has_padding"}
8040
8045
 
8041
8046
  With this model, following links feel smooth. All transient DOM changes outside the updated fragment are preserved.
8042
8047
  Pages also load much faster since the DOM, CSS and Javascript environments do not need to be
@@ -8124,7 +8129,7 @@ new page is loading.
8124
8129
  var $link = $('a:first'); // select link with jQuery
8125
8130
  up.follow($link);
8126
8131
 
8127
- The UJS variant of this are the [`a[up-target]`](/a-up-target) and [`a[up-follow]`](/a-up-follow) selectors.
8132
+ The unobtrusive variant of this are the [`a[up-target]`](/a-up-target) and [`a[up-follow]`](/a-up-follow) selectors.
8128
8133
 
8129
8134
  @function up.follow
8130
8135
  @param {Element|jQuery|String} linkOrSelector
@@ -8622,7 +8627,7 @@ open dialogs with sub-forms, etc. all without losing form state.
8622
8627
  var slice = [].slice;
8623
8628
 
8624
8629
  up.form = (function($) {
8625
- var autosubmit, config, currentValuesForSwitch, observe, observeField, reset, resolveValidateTarget, submit, switchTargets, u, validate;
8630
+ var autosubmit, config, findSwitcherForTarget, observe, observeField, reset, resolveValidateTarget, submit, switchTarget, switchTargets, switcherValues, u, validate;
8626
8631
  u = up.util;
8627
8632
 
8628
8633
  /**
@@ -8663,7 +8668,7 @@ open dialogs with sub-forms, etc. all without losing form state.
8663
8668
  The response is parsed for a CSS selector and the matching elements will
8664
8669
  replace corresponding elements on the current page.
8665
8670
 
8666
- The UJS variant of this is the [`form[up-target]`](/form-up-target) selector.
8671
+ The unobtrusive variant of this is the [`form[up-target]`](/form-up-target) selector.
8667
8672
  See the documentation for [`form[up-target]`](/form-up-target) for more
8668
8673
  information on how AJAX form submissions work in Unpoly.
8669
8674
 
@@ -8775,7 +8780,7 @@ open dialogs with sub-forms, etc. all without losing form state.
8775
8780
 
8776
8781
  This is useful for observing text fields while the user is typing.
8777
8782
 
8778
- The UJS variant of this is the [`up-observe`](/up-observe) attribute.
8783
+ The unobtrusive variant of this is the [`up-observe`](/up-observe) attribute.
8779
8784
 
8780
8785
  \#\#\# Example
8781
8786
 
@@ -8857,7 +8862,6 @@ open dialogs with sub-forms, etc. all without losing form state.
8857
8862
  callback = null;
8858
8863
  rawCallback = u.option(callbackArg, u.presentAttr($fields, 'up-observe'));
8859
8864
  if (u.isString(rawCallback)) {
8860
- console.debug("**** RAW CALLBACK IS %o", rawCallback);
8861
8865
  callback = function(value, $field) {
8862
8866
  return eval(rawCallback);
8863
8867
  };
@@ -8917,7 +8921,7 @@ open dialogs with sub-forms, etc. all without losing form state.
8917
8921
  The changed form field will be assigned a CSS class [`up-active`](/up-active)
8918
8922
  while the autosubmitted form is processing.
8919
8923
 
8920
- The UJS variant of this is the [`up-autosubmit`](/up-autosubmit) attribute.
8924
+ The unobtrusive variant of this is the [`up-autosubmit`](/up-autosubmit) attribute.
8921
8925
 
8922
8926
  @function up.autosubmit
8923
8927
  @param {String|Element|jQuery} selectorOrElement
@@ -8964,7 +8968,7 @@ open dialogs with sub-forms, etc. all without losing form state.
8964
8968
  HTTP header. Upon seeing this header, the server is expected to validate (but not save)
8965
8969
  the form submission and render a new copy of the form with validation errors.
8966
8970
 
8967
- The UJS variant of this is the [`[up-validate]`](/up-validate) selector.
8971
+ The unobtrusive variant of this is the [`[up-validate]`](/up-validate) selector.
8968
8972
  See the documentation for [`[up-validate]`](/up-validate) for more information
8969
8973
  on how server-side validation works in Unpoly.
8970
8974
 
@@ -8995,33 +8999,7 @@ open dialogs with sub-forms, etc. all without losing form state.
8995
8999
  promise = up.submit($form, options);
8996
9000
  return promise;
8997
9001
  };
8998
- currentValuesForSwitch = function($field) {
8999
- var $checkedButton, value, values;
9000
- values = void 0;
9001
- if ($field.is('input[type=checkbox]')) {
9002
- if ($field.is(':checked')) {
9003
- values = [':checked', ':present', $field.val()];
9004
- } else {
9005
- values = [':unchecked', ':blank'];
9006
- }
9007
- } else if ($field.is('input[type=radio]')) {
9008
- $checkedButton = $field.closest('form, body').find("input[type='radio'][name='" + ($field.attr('name')) + "']:checked");
9009
- if ($checkedButton.length) {
9010
- values = [':checked', ':present', $checkedButton.val()];
9011
- } else {
9012
- values = [':unchecked', ':blank'];
9013
- }
9014
- } else {
9015
- value = $field.val();
9016
- if (u.isPresent(value)) {
9017
- values = [':present', value];
9018
- } else {
9019
- values = [':blank'];
9020
- }
9021
- }
9022
- return values;
9023
- };
9024
- currentValuesForSwitch = function($field) {
9002
+ switcherValues = function($field) {
9025
9003
  var $checkedButton, meta, value, values;
9026
9004
  if ($field.is('input[type=checkbox]')) {
9027
9005
  if ($field.is(':checked')) {
@@ -9071,28 +9049,55 @@ open dialogs with sub-forms, etc. all without losing form state.
9071
9049
  @internal
9072
9050
  */
9073
9051
  switchTargets = function(fieldOrSelector, options) {
9074
- var $field, fieldValues, targets;
9075
- $field = $(fieldOrSelector);
9052
+ var $switcher, fieldValues, targetSelector;
9053
+ $switcher = $(fieldOrSelector);
9076
9054
  options = u.options(options);
9077
- targets = u.option(options.target, $field.attr('up-switch'));
9078
- u.isPresent(targets) || up.fail("No switch target given for %o", $field.get(0));
9079
- fieldValues = currentValuesForSwitch($field);
9080
- return $(targets).each(function() {
9081
- var $target, hideValues, show, showValues;
9082
- $target = $(this);
9083
- if (hideValues = $target.attr('up-hide-for')) {
9084
- hideValues = hideValues.split(' ');
9085
- show = u.intersect(fieldValues, hideValues).length === 0;
9055
+ targetSelector = u.option(options.target, $switcher.attr('up-switch'));
9056
+ u.isPresent(targetSelector) || up.fail("No switch target given for %o", $switcher.get(0));
9057
+ fieldValues = switcherValues($switcher);
9058
+ return $(targetSelector).each(function() {
9059
+ return switchTarget($(this), fieldValues);
9060
+ });
9061
+ };
9062
+
9063
+ /**
9064
+ @internal
9065
+ */
9066
+ switchTarget = function(target, fieldValues) {
9067
+ var $target, hideValues, show, showValues;
9068
+ $target = $(target);
9069
+ fieldValues || (fieldValues = switcherValues(findSwitcherForTarget($target)));
9070
+ if (hideValues = $target.attr('up-hide-for')) {
9071
+ hideValues = hideValues.split(' ');
9072
+ show = u.intersect(fieldValues, hideValues).length === 0;
9073
+ } else {
9074
+ if (showValues = $target.attr('up-show-for')) {
9075
+ showValues = showValues.split(' ');
9086
9076
  } else {
9087
- if (showValues = $target.attr('up-show-for')) {
9088
- showValues = showValues.split(' ');
9089
- } else {
9090
- showValues = [':present', ':checked'];
9091
- }
9092
- show = u.intersect(fieldValues, showValues).length > 0;
9077
+ showValues = [':present', ':checked'];
9093
9078
  }
9094
- return $target.toggle(show);
9079
+ show = u.intersect(fieldValues, showValues).length > 0;
9080
+ }
9081
+ $target.toggle(show);
9082
+ return $target.addClass('up-switched');
9083
+ };
9084
+
9085
+ /**
9086
+ @internal
9087
+ */
9088
+ findSwitcherForTarget = function($target) {
9089
+ var $switchers, switcher;
9090
+ $switchers = $('[up-switch]');
9091
+ switcher = u.detect($switchers, function(switcher) {
9092
+ var target;
9093
+ target = $(switcher).attr('up-switch');
9094
+ return $target.is(target);
9095
9095
  });
9096
+ if (switcher) {
9097
+ return $(switcher);
9098
+ } else {
9099
+ return u.fail('Could not find [up-switch] field for %o', $element.get(0));
9100
+ }
9096
9101
  };
9097
9102
 
9098
9103
  /**
@@ -9429,6 +9434,9 @@ open dialogs with sub-forms, etc. all without losing form state.
9429
9434
  up.compiler('[up-switch]', function($field) {
9430
9435
  return switchTargets($field);
9431
9436
  });
9437
+ up.compiler('[up-show-for]:not(.up-switched), [up-hide-for]:not(.up-switched)', function($element) {
9438
+ return switchTarget($element);
9439
+ });
9432
9440
 
9433
9441
  /**
9434
9442
  Observes this field or form and runs a callback when a value changes.
@@ -10982,7 +10990,7 @@ The tooltip element is appended to the end of `<body>`.
10982
10990
  u = up.util;
10983
10991
 
10984
10992
  /**
10985
- Sets default options for future tooltips.
10993
+ Configures defaults for future tooltips.
10986
10994
 
10987
10995
  @property up.tooltip.config
10988
10996
  @param {String} [config.position]
@@ -11075,8 +11083,14 @@ The tooltip element is appended to the end of `<body>`.
11075
11083
  /**
11076
11084
  Opens a tooltip over the given element.
11077
11085
 
11086
+ The unobtrusive variant of this is the [`[up-tooltip]`](/up-tooltip) selector.
11087
+
11088
+ \#\#\# Examples
11089
+
11090
+ In order to attach a tooltip to a `<span class="help">?</span>`:
11091
+
11078
11092
  up.tooltip.attach('.help', {
11079
- html: 'Enter multiple words or phrases'
11093
+ text: 'Enter multiple words or phrases'
11080
11094
  });
11081
11095
 
11082
11096
  @function up.tooltip.attach
@@ -11095,7 +11109,7 @@ The tooltip element is appended to the end of `<body>`.
11095
11109
  The position of the tooltip.
11096
11110
  Can be `'top'`, `'right'`, `'bottom'` or `'left'`.
11097
11111
  @param {String} [options.animation]
11098
- The animation to use when opening the tooltip.
11112
+ The [animation](/up.motion) to use when opening the tooltip.
11099
11113
  @return {Promise}
11100
11114
  A promise that will be resolved when the tooltip's opening animation has finished.
11101
11115
  @stable
@@ -11142,6 +11156,7 @@ The tooltip element is appended to the end of `<body>`.
11142
11156
 
11143
11157
  /**
11144
11158
  Closes a currently shown tooltip.
11159
+
11145
11160
  Does nothing if no tooltip is currently shown.
11146
11161
 
11147
11162
  @function up.tooltip.close
@@ -11191,7 +11206,9 @@ The tooltip element is appended to the end of `<body>`.
11191
11206
  };
11192
11207
 
11193
11208
  /**
11194
- Displays a tooltip with text content when hovering the mouse over this element:
11209
+ Displays a tooltip with text content when hovering the mouse over this element.
11210
+
11211
+ \#\#\# Example
11195
11212
 
11196
11213
  <a href="/decks" up-tooltip="Show all decks">Decks</a>
11197
11214
 
@@ -11312,7 +11329,9 @@ Once the response is received the URL will change to `/bar` and the `up-active`
11312
11329
  SELECTOR_SECTION = 'a, [up-href]';
11313
11330
  normalizeUrl = function(url) {
11314
11331
  if (u.isPresent(url)) {
11315
- return u.normalizeUrl(url);
11332
+ return u.normalizeUrl(url, {
11333
+ stripTrailingSlash: true
11334
+ });
11316
11335
  }
11317
11336
  };
11318
11337
  sectionUrls = function($section) {
data/dist/unpoly.min.js CHANGED
@@ -1,3 +1,3 @@
1
- (function(){this.up={version:"0.34.0",renamedModule:function(t,e){return"function"==typeof Object.defineProperty?Object.defineProperty(up,t,{get:function(){return up.log.warn("up."+t+" has been renamed to up."+e),up[e]}}):void 0}}}).call(this),function(){var t=[].slice,e={}.hasOwnProperty,n=function(t,e){return function(){return t.apply(e,arguments)}};up.util=function(r){var o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,E,$,P,T,x,D,C,O,F,R,U,L,H,M,N,j,_,I,K,W,z,q,Q,B,J,V,X,G,Y,Z,tt,et,nt,rt,ot,it,ut,at,st,lt,ct,pt,ft,dt,ht,mt,vt,gt,yt,bt,wt,kt,St,At,Et,$t,Pt,Tt,xt,Dt,Ct,Ot,Ft,Rt,Ut,Lt,Ht,Mt,Nt,jt,_t,It,Kt,Wt,zt,qt,Qt,Bt,Jt,Vt,Xt,Gt,Yt,Zt,te,ee,ne,re,oe,ie,ue,ae,se,le,ce,pe,fe,de;return Et=r.noop,bt=function(e){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?n:(r=!0,n=e.apply(null,o))}},lt=function(t,e){return e=e.toString(),(""===e||"80"===e)&&"http:"===t||"443"===e&&"https:"===t},Pt=function(t,e){var n,r,o;return n=Lt(t),r=n.protocol+"//"+n.hostname,lt(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=e?e.stripTrailingSlash:void 0)!==!1&&(o=o.replace(/\/$/,"")),r+=o,(null!=e?e.hash:void 0)===!0&&(r+=n.hash),(null!=e?e.search:void 0)!==!1&&(r+=n.search),r},Lt=function(t){var e;return e=null,ct(t)?(e=r("<a>").attr({href:t}).get(0),q(e.hostname)&&(e.href=e.href)):e=se(t),e},$t=function(t){return t?t.toUpperCase():"GET"},o=function(t){var e,n,o,i,u,a,s,l,c,p,f,d,h,m,v,g;for(v=t.split(/[ >]/),o=null,f=c=0,h=v.length;c<h;f=++c){for(a=v[f],u=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",i=[],p=null,d=0,m=u.length;d<m;d++)switch(s=u[d],s[0]){case".":i.push(s.substr(1));break;case"#":p=s.substr(1);break;default:g=s}l="<"+g,i.length&&(l+=' class="'+i.join(" ")+'"'),p&&(l+=' id="'+p+'"'),l+=">",e=r(l),n&&e.appendTo(n),0===f&&(o=e),n=e}return o},S=function(t,e){var n;return n=document.createElement(t),ut(e)&&(n.innerHTML=e),n},i=function(t,e){var n;return null==e&&(e=document.body),n=o(t),n.addClass("up-placeholder"),n.appendTo(e),n},Zt=function(t){var e,n,o,i,u,a,s,l,c;if(e=r(t),l=void 0,up.puts("Creating selector from element %o",e.get(0)),c=Nt(e.attr("up-id")))l="[up-id='"+c+"']";else if(i=Nt(e.attr("id")))l="#"+i;else if(s=Nt(e.attr("name")))l="[name='"+s+"']";else if(n=Nt(At(e)))for(l="",o=0,a=n.length;o<a;o++)u=n[o],l+="."+u;else l=e.prop("tagName").toLowerCase();return l},At=function(t){var e,n;return e=t.attr("class")||"",n=e.split(" "),Yt(n,function(t){return ut(t)&&!t.match(/^up-/)})},A=function(t){var e,n,r,o,i,u,a,s,l,c,p,f;return l=function(t){return"<"+t+"(?: [^>]*)?>"},u=function(t){return"</"+t+">"},e="(?:.|\\s)*?",i=function(t){return"("+t+")"},f=new RegExp(l("title")+i(e)+u("title"),"i"),o=new RegExp(l("body")+i(e)+u("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),n=S("body",r[1]),s.appendChild(n),(p=t.match(f))&&(a=S("head"),s.appendChild(a),c=S("title",p[1]),a.appendChild(c)),s):S("div",t)},d=function(){var n,r,o,i,u,a,s;for(a=arguments[0],u=2<=arguments.length?t.call(arguments,1):[],n=0,o=u.length;n<o;n++){i=u[n];for(r in i)e.call(i,r)&&(s=i[r],a[r]=s)}return a},f=Object.assign||d,ae=r.trim,x=function(t,e){var n,r,o,i,u;for(u=[],r=n=0,i=t.length;n<i;r=++n)o=t[r],u.push(e(o,r));return u},vt=x,ie=function(t,e){var n,r,o,i;for(i=[],r=n=0,o=t-1;0<=o?n<=o:n>=o;r=0<=o?++n:--n)i.push(e(r));return i},rt=function(t){return null===t},ft=function(t){return void 0===t},B=function(t){return!ft(t)},nt=function(t){return ft(t)||rt(t)},Z=function(t){return!nt(t)},q=function(t){return nt(t)||it(t)&&0===Object.keys(t).length||0===t.length},Nt=function(t,e){return null==e&&(e=ut),e(t)?t:void 0},ut=function(t){return!q(t)},Y=function(t){return"function"==typeof t},ct=function(t){return"string"==typeof t},ot=function(t){return"number"==typeof t},tt=function(t){return"object"==typeof t&&!!t},it=function(t){return tt(t)||"function"==typeof t},V=function(t){return!(!t||1!==t.nodeType)},et=function(t){return t instanceof jQuery},at=function(t){return it(t)&&Y(t.then)},Q=function(t){return at(t)&&Y(t.resolve)},z=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},G=function(t){return up.browser.canFormData()&&t instanceof FormData},ue=function(t){return Array.prototype.slice.call(t)},w=function(t){return z(t)?t.slice():tt(t)?f({},t):void 0},se=function(t){return et(t)?t.get(0):t},wt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],f.apply(null,[{}].concat(t.call(e)))},Ut=function(t,e){var n,r,o,i;if(o=t?w(t):{},e)for(r in e)n=e[r],i=o[r],Z(i)?it(n)&&it(i)&&(o[r]=Ut(i,n)):o[r]=n;return o},Rt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],P(e,Z)},P=function(t,e){var n,r,o,i;for(i=void 0,r=0,o=t.length;r<o;r++)if(n=t[r],e(n)){i=n;break}return i},c=function(t,e){var n,r,o,i;for(i=!1,r=0,o=t.length;r<o;r++)if(n=t[r],e(n)){i=!0;break}return i},l=function(t,e){var n,r,o,i;for(i=!0,r=0,o=t.length;r<o;r++)if(n=t[r],!e(n)){i=!1;break}return i},g=function(t){return Yt(t,Z)},le=function(t){var e;return e={},Yt(t,function(t){return!e.hasOwnProperty(t)&&(e[t]=!0)})},Yt=function(t,e){var n;return n=[],x(t,function(t){if(e(t))return n.push(t)}),n},Kt=function(t,e){return Yt(t,function(t){return!e(t)})},W=function(t,e){return Yt(t,function(t){return b(e,t)})},jt=function(){var e,n,r,o;return e=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,i;for(i=[],t=0,o=r.length;t<o;t++)n=r[t],i.push(e.attr(n));return i}(),P(o,ut)},ne=function(t,e){return t>0?setTimeout(e,t):void e()},St=function(t){return setTimeout(t,0)},mt=function(t){return t[t.length-1]},v=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},Gt=bt(function(){var t,e,n;return t=r("<div>"),t.attr("up-viewport",""),t.css({position:"absolute",top:"0",left:"0",width:"100px",height:"100px",overflowY:"scroll"}),t.appendTo(document.body),e=t.get(0),n=e.offsetWidth-e.clientWidth,t.remove(),n}),T=function(){var t,e,n,o,i,u;return e=document.body,t=r(e),u=document.documentElement,n=t.css("overflow-y"),i="scroll"===n,o="hidden"===n,i||!o&&u.scrollHeight>u.clientHeight},Dt=function(e){var n;return n=void 0,function(){var r;return r=1<=arguments.length?t.call(arguments,0):[],null!=e&&(n=e.apply(null,r)),e=void 0,n}},oe=function(t,e,n){var o,i,u;return o=r(t),u=o.css(Object.keys(e)),o.css(e),i=function(){return o.css(u)},n?(n(),i()):Dt(i)},j=function(t){var e,n;return n=t.css(["transform","-webkit-transform"]),q(n)||"none"===n.transform?(e=function(){return t.css(n)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):e=function(){},e},_=function(t){return t=se(t),t.offsetHeight},E=function(t,e,n){var o,i,a,s,l,c,p;return o=r(t),n=Ut(n,{duration:300,delay:0,easing:"ease"}),0===n.duration?(o.css(e),Vt()):(i=r.Deferred(),c=Object.keys(e),l={"transition-property":c.join(", "),"transition-duration":n.duration+"ms","transition-delay":n.delay+"ms","transition-timing-function":n.easing},a=o.css(Object.keys(l)),s=function(t){var e;if(e=t.originalEvent.propertyName,b(c,e))return i.resolve()},o.on("transitionend",s),i.then(function(){var t;if(o.removeClass("up-animating"),o.off("transitionend",s),o.removeData(u),p(),o.css({transition:"none"}),t=!("none"===a["transition-property"]||"all"===a["transition-property"]&&"0"===a["transition-duration"][0]))return _(o),o.css(a)}),o.addClass("up-animating"),p=j(o),o.css(l),o.data(u,i),o.css(e),i)},u="up-animation-deferred",H=function(t){return r(t).each(function(){var t;if(t=Ht(this,u))return t.resolve()})},gt=function(t){var e,n;return e=r(t),n=e.css(["margin-top","margin-right","margin-bottom","margin-left"]),{top:parseFloat(n["margin-top"]),right:parseFloat(n["margin-right"]),bottom:parseFloat(n["margin-bottom"]),left:parseFloat(n["margin-left"])}},yt=function(t,e){var n,o,i,u,a,s;return e=Ut(e,{relative:!1,inner:!1,includeMargin:!1}),e.relative?e.relative===!0?u=t.position():(n=r(e.relative),a=t.offset(),n.is(document)?u=a:(i=n.offset(),u={left:a.left-i.left,top:a.top-i.top})):u=t.offset(),o={left:u.left,top:u.top},e.inner?(o.width=t.width(),o.height=t.height()):(o.width=t.outerWidth(),o.height=t.outerHeight()),e.includeMargin&&(s=gt(t),o.left-=s.left,o.top-=s.top,o.height+=s.top+s.bottom,o.width+=s.left+s.right),o},k=function(t,e){var n,r,o,i,u;for(i=t.get(0).attributes,u=[],r=0,o=i.length;r<o;r++)n=i[r],n.specified?u.push(e.attr(n.name,n.value)):u.push(void 0);return u},L=function(t,e){return t.find(e).addBack(e)},C=function(t){return 27===t.keyCode},b=function(t,e){return t.indexOf(e)>=0},m=function(t,e){var n;switch(n=t.attr(e)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},Ct=function(){var e,n,r,o,i,u;for(o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],e={},n=0,r=i.length;n<r;n++)u=i[n],o.hasOwnProperty(u)&&(e[u]=o[u]);return e},F=function(){var e,n,r,o,i,u;for(o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],e=w(o),n=0,r=i.length;n<r;n++)u=i[n],delete e[u];return e},dt=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},ht=function(t){var e;return e=ft(t.button)||0===t.button,e&&dt(t)},Vt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.Deferred(),n.resolve.apply(n,e),n},Xt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],Vt.apply(null,e).promise()},Wt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.Deferred(),n.reject.apply(n,e),n.promise()},st=function(t){return at(t)&&"resolved"===("function"==typeof t.state?t.state():void 0)},st=function(t){return at(t)&&"resolved"===("function"==typeof t.state?t.state():void 0)},ce=function(){return r.Deferred()},pe=function(){return ce().promise()},Tt=function(){return r()},Jt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.when.apply(r,[Vt()].concat(t.call(e))),n.resolve=bt(function(){return x(e,function(t){return t.resolve()})}),n},ee=function(t,e){var n,r,o;r=[];for(n in e)o=e[n],nt(t.attr(n))?r.push(t.attr(n,o)):r.push(void 0);return r},zt=function(t,e){var n;if(n=t.indexOf(e),n>=0)return t.splice(n,1),e},kt=function(t){var e,n,o,i,u,a,s;for(u={},s=[],n=[],o=0,i=t.length;o<i;o++)a=t[o],ct(a)?s.push(a):n.push(a);return u.parsed=n,s.length&&(e=s.join(", "),u.parsed.push(e)),u.select=function(){return u.find(void 0)},u.find=function(t){var e,n,o,i,a,s;for(n=Tt(),a=u.parsed,o=0,i=a.length;o<i;o++)s=a[o],e=t?t.find(s):r(s),n=n.add(e);return n},u.findWithSelf=function(t){var e;return e=u.find(t),u.doesMatch(t)&&(e=e.add(t)),e},u.doesMatch=function(t){var e;return e=r(t),c(u.parsed,function(t){return e.is(t)})},u.seekUp=function(t){var e,n,o;for(o=r(t),e=o,n=void 0;e.length;){if(u.doesMatch(e)){n=e;break}e=e.parent()}return n||Tt()},u},O=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],Y(n)?n.apply(null,e):n},h=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m;return null==e&&(e={}),h=void 0,p=function(){return O(e.size)},o=function(){return O(e.expiry)},f=function(t){return e.key?e.key(t):t.toString()},u=function(){return 0!==p()&&0!==o()},r=function(){return h={}},r(),l=function(){var n;if(n=1<=arguments.length?t.call(arguments,0):[],e.logPrefix)return n[0]="["+e.logPrefix+"] "+n[0],up.puts.apply(up,n)},s=function(){return Object.keys(h)},c=function(){var t,e,n,r;if(r=w(s()),t=p(),t&&r.length>=t&&(e=null,n=null,x(r,function(t){var r,o;if(r=h[t],o=r.timestamp,!n||n>o)return e=t,n=o}),e))return delete h[e]},n=function(t,e){var n;if(n=i(t,{silent:!0}),B(n))return d(e,n)},m=function(){return(new Date).valueOf()},d=function(t,e){var n;if(u())return c(),n=f(t),h[n]={timestamp:m(),value:e}},zt=function(t){var e;return e=f(t),delete h[e]},a=function(t){var e,n;return e=o(),!e||(n=m()-t.timestamp,n<e)},i=function(t,e){var n,r;return null==e&&(e={}),r=f(t),(n=h[r])?a(n)?(e.silent||l("Cache hit for '%s'",t),n.value):(e.silent||l("Discarding stale cache entry for '%s'",t),void zt(t)):void(e.silent||l("Cache miss for '%s'",t))},{alias:n,get:i,set:d,remove:zt,clear:r,keys:s}},y=function(t){var e;return e=Ft(t),Object.preventExtensions(e),e},Ft=function(t){var e;return null==t&&(t={}),e={},e.reset=function(){var n;return n=t,Y(n)&&(n=n()),f(e,n)},e.reset(),e},fe=function(t){var e,n;return t=se(t),e=t.parentNode,n=ue(t.childNodes),x(n,function(n){return e.insertBefore(n,t)}),e.removeChild(t)},xt=function(t){var e,n;for(e=void 0;(t=t.parent())&&t.length;)if(n=t.css("position"),"absolute"===n||"relative"===n||t.is("body")){e=t;break}return e},X=function(t){var e,n;for(e=r(t);;){if(n=e.css("position"),"fixed"===n)return!0;if(e=e.parent(),0===e.length||e.is(document))return!1}},M=function(t,e){var n,o,i,u;return n=r(t),o=xt(n),i=n.position(),u=o.offset(),n.css({position:"absolute",left:i.left-u.left,top:i.top-u.top+e.scrollTop(),right:"",bottom:""})},qt=function(t){var e,n,r,o,i,u,a;if(G(t))return up.fail("Cannot convert FormData into an array");for(u=Qt(t),e=[],a=u.split("&"),n=0,r=a.length;n<r;n++)i=a[n],ut(i)&&(o=i.split("="),e.push({name:decodeURIComponent(o[0]),value:decodeURIComponent(o[1])}));return e},Qt=function(t){var e;return G(t)?up.fail("Cannot convert FormData into a query string"):ut(t)?(e=r.param(t),e=e.replace(/\+/g,"%20")):""},Bt=function(t){var e,n;return e=r(t),n=e.find("input[type=file]").length,n&&up.browser.canFormData()?new FormData(e.get(0)):e.serializeArray()},p=function(t,e,n){var r;return G(t)?t.append(e,n):z(t)?t.push({name:e,value:n}):it(t)?t[e]=n:(ct(t)||nt(t))&&(r=Qt([{name:e,value:n}]),t=ut(t)?[t,r].join("&"):r),t},U=function(){var e,n,r,o,i,u;throw e=1<=arguments.length?t.call(arguments,0):[],z(e[0])?(r=e[0],u=e[1]||{}):(r=e,u={}),(o=up.log).error.apply(o,r),de().then(function(){return up.toast.open(r,u)}),n=(i=up.browser).sprintf.apply(i,r),new Error(n)},s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},D=function(t){return t.replace(/[&<>"]/g,function(t){return s[t]})},Mt=function(t,e){var n;return n=t[e],delete t[e],n},Ht=function(t,e){var n,o;return n=r(t),o=n.data(e),n.removeData(e),o},R=function(t){var e;return e=mt(t),tt(e)&&!et(e)?t.pop():{}},Ot=function(t){var e;return e=r(t).css("opacity"),Z(e)?parseFloat(e):void 0},de=bt(function(){var t;return r.isReady?Xt():(t=r.Deferred(),r(function(){return t.resolve()}),t.promise())}),K=function(t){return t},J=function(t){return t=se(t),!jQuery.contains(document.documentElement,t)},_t=function(e){var n,o;return n=r.Deferred(),o=function(){var r,o;return r=1<=arguments.length?t.call(arguments,0):[],o=e.apply(null,r),at(o)?o.then(function(){return n.resolve(o)}):n.resolve(o),o},o.promise=n.promise(),o},a=function(){function e(){this.asap=n(this.asap,this),this.poke=n(this.poke,this),this.allTasks=n(this.allTasks,this),this.promise=n(this.promise,this),this.reset=n(this.reset,this),this.reset()}return e.prototype.reset=function(){return this.queue=[],this.currentTask=void 0},e.prototype.promise=function(){var t;return t=vt(this.allTasks(),function(t){return t.promise}),r.when.apply(r,t)},e.prototype.allTasks=function(){var t;return t=[],this.currentTask&&t.push(this.currentTask),t=t.concat(this.queue)},e.prototype.poke=function(){var t;if(!this.currentTask&&(this.currentTask=this.queue.shift()))return t=this.currentTask(),t.always(function(t){return function(){return t.currentTask=void 0,t.poke()}}(this))},e.prototype.asap=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],this.queue=vt(e,_t),this.poke()},e}(),re=function(t){var e;return e=r(t),e.is("[type=checkbox], [type=radio]")&&!e.is(":checked")?void 0:e.val()},te=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],function(){return vt(e,function(t){return t()})}},It=function(t){var e,n;return e=r.Deferred(),n=ne(t,function(){return e.resolve()}),e.cancel=function(){return clearTimeout(n)},e},I=function(t){var e,n,r,o;return e=yt(t),r=v(),n=e.left+.5*e.width,o=.5*r.width,n<o?"left":"right"},$=function(t,e){var n;return n=r("<div></div>"),n.insertAfter(t),t.detach(),n.replaceWith(e),t},N=function(t){var e,n,r,o;for(e=[],n=0,r=t.length;n<r;n++)o=t[n],z(o)?e=e.concat(o):e.push(o);return e},pt=function(t){return!!t},{isDetached:J,requestDataAsArray:qt,requestDataAsQuery:Qt,appendRequestData:p,requestDataFromForm:Bt,offsetParent:xt,fixedToAbsolute:M,isFixed:X,presentAttr:jt,createElement:S,parseUrl:Lt,normalizeUrl:Pt,normalizeMethod:$t,createElementFromHtml:A,$createElementFromSelector:o,$createPlaceholder:i,selectorForElement:Zt,assign:f,assignPolyfill:d,copy:w,merge:wt,options:Ut,option:Rt,fail:U,each:x,map:vt,times:ie,any:c,all:l,detect:P,select:Yt,reject:Kt,intersect:W,compact:g,uniq:le,last:mt,isNull:rt,isDefined:B,isUndefined:ft,isGiven:Z,isMissing:nt,isPresent:ut,isBlank:q,presence:Nt,isObject:it,isFunction:Y,isString:ct,isNumber:ot,isElement:V,isJQuery:et,isPromise:at,isResolvedPromise:st,isDeferred:Q,isHash:tt,isArray:z,isFormData:G,isUnmodifiedKeyEvent:dt,isUnmodifiedMouseEvent:ht,nullJQuery:Tt,unJQuery:se,setTimer:ne,nextFrame:St,measure:yt,temporaryCss:oe,cssAnimate:E,finishCssAnimate:H,forceCompositing:j,forceRepaint:_,escapePressed:C,copyAttributes:k,findWithSelf:L,contains:b,toArray:ue,castedAttr:m,clientSize:v,only:Ct,except:F,trim:ae,unresolvableDeferred:ce,unresolvablePromise:pe,resolvedPromise:Xt,rejectedPromise:Wt,resolvedDeferred:Vt,resolvableWhen:Jt,setMissingAttrs:ee,remove:zt,memoize:bt,scrollbarWidth:Gt,documentHasVerticalScrollbar:T,config:y,openConfig:Ft,cache:h,unwrapElement:fe,multiSelector:kt,error:U,pluckData:Ht,pluckKey:Mt,extractOptions:R,isDetached:J,noop:Et,opacity:Ot,whenReady:de,identity:K,escapeHtml:D,DivertibleChain:a,submittedValue:re,sequence:te,promiseTimer:It,previewable:_t,evalOption:O,horizontalScreenHalf:I,detachWith:$,flatten:N,isTruthy:pt}}($),up.fail=up.util.fail}.call(this),function(){up.protocol=function(){var t,e,n,r,o,i;return i=up.util,n=function(e){return e.getResponseHeader(t.locationHeader)},o=function(e){return e.getResponseHeader(t.titleHeader)},r=function(e){return e.getResponseHeader(t.methodHeader)},e=i.memoize(function(){var e;return e=up.browser.popCookie(t.methodCookie),(e||"get").toLowerCase()}),t=i.config({targetHeader:"X-Up-Target",locationHeader:"X-Up-Location",validateHeader:"X-Up-Validate",titleHeader:"X-Up-Title",methodHeader:"X-Up-Method",methodCookie:"_up_method",methodParam:"_method"}),{config:t,locationFromXhr:n,titleFromXhr:o,methodFromXhr:r,initialRequestMethod:e}}(jQuery)}.call(this),function(){var slice=[].slice;up.browser=function($){var CONSOLE_PLACEHOLDERS,canCssTransition,canFormData,canInputEvent,canLogSubstitution,canPushState,hash,installPolyfills,isIE8OrWorse,isIE9OrWorse,isRecentJQuery,isSupported,loadPage,popCookie,puts,sessionStorage,setLocationHref,sprintf,sprintfWithFormattedArgs,stringifyArg,submitForm,u,url,whenConfirmed;return u=up.util,loadPage=function(t,e){var n,r,o,i,a;return null==e&&(e={}),i=u.option(e.method,"get").toLowerCase(),"get"===i?(a=u.requestDataAsQuery(e.data),a&&(t=t+"?"+a),setLocationHref(t)):(n=$("<form method='post' action='"+t+"' class='up-page-loader'></form>"),r=function(t){var e;return e=$('<input type="hidden">'),e.attr(t),e.appendTo(n)},r({name:up.protocol.config.methodParam,value:i}),(o=up.rails.csrfField())&&r(o),u.each(u.requestDataAsArray(e.data),r),n.hide().appendTo("body"),submitForm(n))},submitForm=function(t){return t.submit()},setLocationHref=function(t){return location.href=t},puts=function(){var t,e,n;return n=arguments[0],t=2<=arguments.length?slice.call(arguments,1):[],canLogSubstitution()?console[n].apply(console,t):(e=sprintf.apply(null,t),console[n](e))},CONSOLE_PLACEHOLDERS=/\%[odisf]/g,stringifyArg=function(t){var e,n,r,o,i,a,s,l,c;if(a=200,r="",u.isString(t))l=t.replace(/[\n\r\t ]+/g," "),l=l.replace(/^[\n\r\t ]+/,""),l=l.replace(/[\n\r\t ]$/,""),l='"'+l+'"',r='"';else if(u.isUndefined(t))l="undefined";else if(u.isNumber(t)||u.isFunction(t))l=t.toString();else if(u.isArray(t))l="["+u.map(t,stringifyArg).join(", ")+"]",r="]";else if(u.isJQuery(t))l="$("+u.map(t,stringifyArg).join(", ")+")",r=")";else if(u.isElement(t)){for(e=$(t),l="<"+t.tagName.toLowerCase(),s=["id","name","class"],o=0,i=s.length;o<i;o++)n=s[o],(c=e.attr(n))&&(l+=" "+n+'="'+c+'"');l+=">",r=">"}else l=JSON.stringify(t);return l.length>a&&(l=l.substr(0,a)+" \u2026",l+=r),l},sprintf=function(){var t,e;return e=arguments[0],t=2<=arguments.length?slice.call(arguments,1):[],sprintfWithFormattedArgs.apply(null,[u.identity,e].concat(slice.call(t)))},sprintfWithFormattedArgs=function(){var t,e,n,r;return e=arguments[0],r=arguments[1],t=3<=arguments.length?slice.call(arguments,2):[],u.isBlank(r)?"":(n=0,r.replace(CONSOLE_PLACEHOLDERS,function(){var r;return r=t[n],r=e(stringifyArg(r)),n+=1,r}))},url=function(){return location.href},isIE8OrWorse=u.memoize(function(){return u.isUndefined(document.addEventListener)}),isIE9OrWorse=u.memoize(function(){return isIE8OrWorse()||navigator.appVersion.indexOf("MSIE 9.")!==-1}),canPushState=u.memoize(function(){return u.isDefined(history.pushState)&&"get"===up.protocol.initialRequestMethod()}),canCssTransition=u.memoize(function(){return"transition"in document.documentElement.style}),canInputEvent=u.memoize(function(){return"oninput"in document.createElement("input")}),canFormData=u.memoize(function(){return!!window.FormData}),canLogSubstitution=u.memoize(function(){return!isIE9OrWorse()}),isRecentJQuery=u.memoize(function(){var t,e,n,r;return r=$.fn.jquery,n=r.split("."),t=parseInt(n[0]),e=parseInt(n[1]),t>=2||1===t&&e>=9}),popCookie=function(t){var e,n;return n=null!=(e=document.cookie.match(new RegExp(t+"=(\\w+)")))?e[1]:void 0,u.isPresent(n)&&(document.cookie=t+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},whenConfirmed=function(t){return t.preload||u.isBlank(t.confirm)||window.confirm(t.confirm)?u.resolvedPromise():u.unresolvablePromise()},isSupported=function(){return!isIE8OrWorse()&&isRecentJQuery()},installPolyfills=function(){var t,e,n,r;for(null==window.console&&(window.console={}),r=["debug","info","warn","error","group","groupCollapsed","groupEnd"],t=0,e=r.length;t<e;t++)n=r[t],null==console[n]&&(console[n]=function(){var t;return t=1<=arguments.length?slice.call(arguments,0):[],puts.apply(null,["log"].concat(slice.call(t)))});return null!=console.log?console.log:console.log=u.noop},sessionStorage=u.memoize(function(){return window.sessionStorage||{getItem:u.noop,setItem:u.noop,removeItem:u.noop}}),hash=function(t){return t||(t=location.hash),t||(t=""),"#"===t[0]&&(t=t.substr(1)),u.presence(t)},{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),url:url,loadPage:loadPage,whenConfirmed:whenConfirmed,canPushState:canPushState,canCssTransition:canCssTransition,canInputEvent:canInputEvent,canFormData:canFormData,canLogSubstitution:canLogSubstitution,isSupported:isSupported,installPolyfills:installPolyfills,puts:puts,sprintf:sprintf,sprintfWithFormattedArgs:sprintfWithFormattedArgs,sessionStorage:sessionStorage,popCookie:popCookie,hash:hash}}(jQuery)}.call(this),function(){var slice=[].slice;up.bus=function($){var boot,consumeAction,emit,emitReset,forgetUpDescription,haltEvent,live,liveUpDescriptions,logEmission,nextUpDescriptionNumber,nobodyPrevents,onEscape,rememberUpDescription,restoreSnapshot,snapshot,u,unbind,upDescriptionNumber,upDescriptionToJqueryDescription,upListenerToJqueryListener,whenEmitted;return u=up.util,liveUpDescriptions={},nextUpDescriptionNumber=0,upListenerToJqueryListener=function(t){return function(e){var n;return n=e.$element||$(this),t.apply(n.get(0),[e,n,up.syntax.data(n)])}},upDescriptionToJqueryDescription=function(t,e){var n,r,o;return n=u.copy(t),o=n.pop(),r=void 0,e?(r=upListenerToJqueryListener(o),o._asJqueryListener=r,o._descriptionNumber=++nextUpDescriptionNumber):(r=o._asJqueryListener,r||up.fail("up.off: The event listener %o was never registered through up.on")),n.push(r),n},live=function(){var t,e,n;return n=1<=arguments.length?slice.call(arguments,0):[],up.browser.isSupported()?(t=upDescriptionToJqueryDescription(n,!0),rememberUpDescription(n),(e=$(document)).on.apply(e,t),function(){return unbind.apply(null,n)}):function(){}},unbind=function(){var t,e,n;return n=1<=arguments.length?slice.call(arguments,0):[],t=upDescriptionToJqueryDescription(n,!1),forgetUpDescription(n),(e=$(document)).off.apply(e,t)},rememberUpDescription=function(t){var e;return e=upDescriptionNumber(t),liveUpDescriptions[e]=t},forgetUpDescription=function(t){var e;return e=upDescriptionNumber(t),delete liveUpDescriptions[e]},upDescriptionNumber=function(t){return u.last(t)._descriptionNumber},emit=function(t,e){var n,r;return null==e&&(e={}),r=$.Event(t,e),(n=e.$element)?delete e.$element:n=$(document),logEmission(t,e),n.trigger(r),r},logEmission=function(t,e){var n,r,o;return e.hasOwnProperty("message")?(n=e.message,delete e.message,n!==!1&&(u.isArray(n)?(o=n,n=o[0],r=2<=o.length?slice.call(o,1):[]):r=[],n)?u.isPresent(e)?up.puts.apply(up,[n+" (%s (%o))"].concat(slice.call(r),[t],[e])):up.puts.apply(up,[n+" (%s)"].concat(slice.call(r),[t])):void 0):u.isPresent(e)?up.puts("Emitted event %s (%o)",t,e):up.puts("Emitted event %s",t)},nobodyPrevents=function(){var t,e;return t=1<=arguments.length?slice.call(arguments,0):[],e=emit.apply(null,t),!e.isDefaultPrevented()||(up.puts("An observer prevented the event %s",t[0]),!1)},whenEmitted=function(){var t,e;return t=1<=arguments.length?slice.call(arguments,0):[],e=$.Deferred(),nobodyPrevents.apply(null,t)&&e.resolve(),e.promise()},onEscape=function(t){return live("keydown","body",function(e){if(u.escapePressed(e))return t(e)})},haltEvent=function(t){return t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault()},consumeAction=function(t){if(haltEvent(t),"up:action:consumed"!==t.type)return emit("up:action:consumed",{$element:$(t.target),message:!1})},snapshot=function(){var t,e,n,r;for(r=[],e=0,n=liveUpDescriptions.length;e<n;e++)t=liveUpDescriptions[e],r.push(t.isDefault=!0);return r},restoreSnapshot=function(){var t,e,n,r,o;for(e=u.reject(liveUpDescriptions,function(t){return t.isDefault}),o=[],n=0,r=e.length;n<r;n++)t=e[n],o.push(unbind.apply(null,t));return o},emitReset=function(){return emit("up:framework:reset",{message:"Resetting framework"})},boot=function(){if(up.browser.isSupported())return up.browser.installPolyfills(),emit("up:framework:boot",{message:"Booting framework"}),emit("up:framework:booted",{message:"Framework booted"}),u.nextFrame(function(){return u.whenReady().then(function(){return emit("up:app:boot",{message:"Booting user application"}),emit("up:app:booted",{message:"User application booted"})})})},live("up:framework:booted",snapshot),live("up:framework:reset",restoreSnapshot),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),on:live,off:unbind,emit:emit,nobodyPrevents:nobodyPrevents,whenEmitted:whenEmitted,onEscape:onEscape,emitReset:emitReset,haltEvent:haltEvent,consumeAction:consumeAction,boot:boot}}(jQuery),up.on=up.bus.on,up.off=up.bus.off,up.emit=up.bus.emit,up.reset=up.bus.emitReset,up.boot=up.bus.boot}.call(this),function(){var t=[].slice;up.log=function(){var e,n,r,o,i,u,a,s,l,c,p,f,d,h,m;return h=up.util,n=up.browser,e="up.log.enabled",r=h.config({prefix:"[UP] ",enabled:"true"===n.sessionStorage().getItem(e),collapse:!1}),f=function(){return r.reset()},l=function(t){return""+r.prefix+t},o=function(){var e,o;if(o=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],r.enabled&&o)return n.puts.apply(n,["debug",l(o)].concat(t.call(e)))},p=function(){var e,o;if(o=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],r.enabled&&o)return n.puts.apply(n,["log",l(o)].concat(t.call(e)))},m=function(){var e,r;if(r=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],r)return n.puts.apply(n,["warn",l(r)].concat(t.call(e)))},s=function(){var e,o,i,u;if(i=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],o=e.pop(),!r.enabled||!i)return o();u=r.collapse?"groupCollapsed":"group",n.puts.apply(n,[u,l(i)].concat(t.call(e)));try{return o()}finally{i&&n.puts("groupEnd")}},a=function(){var e,r;if(r=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],r)return n.puts.apply(n,["error",l(r)].concat(t.call(e)))},c=function(){var t;return t=" __ _____ ___ ___ / /_ __\n"+("/ // / _ \\/ _ \\/ _ \\/ / // / "+up.version+"\n")+"\\___/_//_/ .__/\\___/_/\\_. / \n / / / /\n\n",t+=r.enabled?"Call `up.log.disable()` to disable logging for this session.":"Call `up.log.enable()` to enable logging for this session.",n.puts("log",t)},up.on("up:framework:boot",c),up.on("up:framework:reset",f),d=function(t){return n.sessionStorage().setItem(e,t.toString()),r.enabled=t},u=function(){return d(!0)},i=function(){return d(!1)},{puts:p,debug:o,error:a,warn:m,group:s,config:r,enable:u,disable:i}}(jQuery),up.puts=up.log.puts}.call(this),function(){var t=[].slice;up.toast=function(e){var n,r,o,i,u,a,s,l,c,p;return p=up.util,o=up.browser,n=function(t){return"<span class='up-toast-variable'>"+p.escapeHtml(t)+"</span>"},c=p.config({$toast:null}),l=function(){return i(),c.reset()},a=function(e){return p.isArray(e)?(e[0]=p.escapeHtml(e[0]),e=o.sprintfWithFormattedArgs.apply(o,[n].concat(t.call(e)))):e=p.escapeHtml(e),e},u=function(){return!!c.$toast},r=function(t,n,r){var o;return o=e('<span class="up-toast-action"></span>').text(n),o.on("click",r),o.appendTo(t)},s=function(t,n){var o,u,s,l;return null==n&&(n={}),i(),s=e('<div class="up-toast"></div>').prependTo("body"),u=e('<div class="up-toast-message"></div>').appendTo(s),o=e('<div class="up-toast-actions"></div>').appendTo(s),t=a(t),u.html(t),(l=n.action||n.inspect)&&r(o,l.label,l.callback),r(o,"Close",i),c.$toast=s},i=function(){if(u())return c.$toast.remove(),c.$toast=null},up.on("up:framework:reset",l),{open:s,close:i,reset:l,isOpen:u}}(jQuery)}.call(this),function(){var t=[].slice;up.syntax=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y;return y=up.util,n="up-destructible",r="up-destructors",c=[],m=[],l=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[c].concat(t.call(e)))},h=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[m].concat(t.call(e)))},u=function(){var e,n,r,o;return o=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n=e.pop(),r=y.options(e[0],{priority:0}),"first"===r.priority?r.priority=Number.POSITIVE_INFINITY:"last"===r.priority&&(r.priority=Number.NEGATIVE_INFINITY),{selector:o,callback:n,priority:r.priority,batch:r.batch,keep:r.keep}},d=function(){var e,n,r,o,i;if(i=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()){for(r=u.apply(null,e),n=0;(o=i[n])&&o.priority>=r.priority;)n+=1;return i.splice(n,0,r)}},i=function(t,e,n){var r,i,u,a,s,l,c;for(up.puts(t.isDefault?void 0:"Compiling '%s' on %o",t.selector,n),t.keep&&(c=y.isString(t.keep)?t.keep:"",e.attr("up-keep",c)),l=t.callback.apply(n,[e,p(e)]),a=f(l),s=[],i=0,u=a.length;i<u;i++)r=a[i],s.push(o(e,r));return s},f=function(t){return y.isFunction(t)?[t]:y.isArray(t)&&y.all(t,y.isFunction)?t:[]},o=function(t,e){var o;return t.addClass(n),o=t.data(r)||[],o.push(e),t.data(r,o)},s=function(t,n){var r;return n=y.options(n),r=e(n.skip),up.log.group("Compiling fragment %o",t.get(0),function(){var n,o,u,a,s,p;for(s=[m,c],p=[],o=0,u=s.length;o<u;o++)a=s[o],p.push(function(){var o,u,s;for(s=[],o=0,u=a.length;o<u;o++)l=a[o],n=y.findWithSelf(t,l.selector),n=n.filter(function(){var t;return t=e(this),y.all(r,function(e){return 0===t.closest(e).length})}),n.length?s.push(up.log.group(l.isDefault?void 0:"Compiling '%s' on %d element(s)",l.selector,n.length,function(){return l.batch?i(l,n,n.get()):n.each(function(){return i(l,e(this),this)})})):s.push(void 0);return s}());return p})},a=function(t){return y.findWithSelf(t,"."+n).each(function(){var t,o,i,u,a;if(t=e(this),i=t.data(r)){for(u=0,a=i.length;u<a;u++)(o=i[u])();return t.removeData(r),t.removeClass(n)}})},p=function(t){var n,r;return n=e(t),r=n.attr("up-data"),y.isString(r)&&""!==y.trim(r)?JSON.parse(r):{}},g=function(){var t;return t=function(t){return t.isDefault=!0},y.each(c,t),y.each(m,t)},v=function(){var t;return t=function(t){return t.isDefault},c=y.select(c,t),m=y.select(m,t)},up.on("up:framework:booted",g),up.on("up:framework:reset",v),{compiler:l,macro:h,compile:s,clean:a,data:p}}(jQuery),up.compiler=up.syntax.compiler,up.macro=up.syntax.macro}.call(this),function(){up.history=function(t){var e,n,r,o,i,u,a,s,l,c,p,f,d,h,m,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,u=void 0,h=function(){return n.reset(),c=void 0,u=void 0},a=function(t){return v.normalizeUrl(t,{hash:!0})},r=function(){return a(up.browser.url())},o=function(t){return a(t)===r()},s=function(t){return u&&(c=u,u=void 0),u=t},d=function(t){return i("replaceState",t)},p=function(t,e){if(e=v.options(e,{
2
- force:!1}),t=a(t),(e.force||!o(t))&&up.bus.nobodyPrevents("up:history:push",{url:t,message:"Adding history entry for "+t}))return i("pushState",t),up.emit("up:history:pushed",{url:t,message:"Advanced to location "+t})},i=function(t,n){var o;return up.browser.canPushState()?(o=e(),window.history[t](o,"",n),s(r())):up.fail("This browser doesn't support history."+t)},e=function(){return{fromUp:!0}},m=function(t){var e;return(null!=t?t.fromUp:void 0)?(e=r(),up.log.group("Restoring URL %s",e,function(){var t,o;return t=n.popTargets.join(", "),o=up.replace(t,e,{history:!1,title:!0,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll}),o.then(function(){return e=r(),up.emit("up:history:restored",{url:e,message:"Restored location "+e})})})):up.puts("Ignoring a state not pushed by Unpoly (%o)",t)},l=function(t){var e;return s(r()),up.layout.saveScroll({url:c}),e=t.originalEvent.state,m(e)},up.browser.canPushState()&&(f=function(){return t(window).on("popstate",l),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(t){if(v.isPresent(c))return v.setMissingAttrs(t,{"up-href":c,"up-restore-scroll":""}),t.removeAttr("up-back"),up.link.makeFollowable(t)}),up.on("up:framework:reset",h),{config:n,push:p,replace:d,url:r,previousUrl:function(){return c},normalizeUrl:a}}(jQuery)}.call(this),function(){var slice=[].slice;up.layout=function($){var SCROLL_PROMISE_KEY,anchoredRight,config,finishScrolling,firstHashTarget,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,revealHash,revealOrRestoreScroll,saveScroll,scroll,scrollTops,u,viewportOf,viewportSelector,viewports,viewportsWithin;return u=up.util,config=u.config({duration:0,viewports:[document,".up-modal-viewport","[up-viewport]"],fixedTop:["[up-fixed~=top]"],fixedBottom:["[up-fixed~=bottom]"],anchoredRight:["[up-anchored~=right]","[up-fixed~=top]","[up-fixed~=bottom]","[up-fixed~=right]"],snap:50,substance:150,easing:"swing"}),lastScrollTops=u.cache({size:30,key:up.history.normalizeUrl}),reset=function(){return config.reset(),lastScrollTops.clear()},SCROLL_PROMISE_KEY="up-scroll-promise",scroll=function(t,e,n){var r,o,i,a,s;return r=$(t),n=u.options(n),i=u.option(n.duration,config.duration),a=u.option(n.easing,config.easing),finishScrolling(r),i>0?(o=$.Deferred(),r.data(SCROLL_PROMISE_KEY,o),o.then(function(){return r.removeData(SCROLL_PROMISE_KEY),r.finish()}),s={scrollTop:e},r.get(0)===document&&(r=$("html, body")),r.animate(s,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(e),u.resolvedDeferred())},finishScrolling=function(t){return $(t).each(function(){var t;if(t=$(this).data(SCROLL_PROMISE_KEY))return t.resolve()})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var t,e,n,r;return n=function(t,e){var n,r;return n=$(t),r=n.css(e),u.isPresent(r)||up.fail("Fixed element %o must have a CSS attribute %s",n.get(0),e),parseFloat(r)+n.height()},e=function(){var t,e,o,i;for(o=$(config.fixedTop.join(", ")),i=[],t=0,e=o.length;t<e;t++)r=o[t],i.push(n(r,"top"));return i}(),t=function(){var t,e,o,i;for(o=$(config.fixedBottom.join(", ")),i=[],t=0,e=o.length;t<e;t++)r=o[t],i.push(n(r,"bottom"));return i}(),{top:Math.max.apply(Math,[0].concat(slice.call(e))),bottom:Math.max.apply(Math,[0].concat(slice.call(t)))}},reveal=function(t,e){var n,r,o,i,a,s,l,c,p,f,d,h,m,v;return n=$(t),up.puts("Revealing fragment %o",t.get(0)),e=u.options(e),r=e.viewport?$(e.viewport):viewportOf(n),h=u.option(e.snap,config.snap),v=r.is(document),m=v?u.clientSize().height:r.outerHeight(),p=r.scrollTop(),s=p,c=void 0,l=void 0,v?(l=measureObstruction(),c=0):(l={top:0,bottom:0},c=p),f=function(){return s+l.top},d=function(){return s+m-l.bottom-1},o=u.measure(n,{relative:r,includeMargin:!0}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(s+=a-d()),(i<f()||e.top)&&(s=i-l.top),s<h&&o.top<.5*m&&(s=0),s!==p?scroll(r,s,e):u.resolvedDeferred()},revealHash=function(){var t,e;return(e=up.browser.hash())?(t=firstHashTarget(e))?reveal(t):u.rejectedPromise():u.resolvedPromise()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(t,e){var n,r;return null==e&&(e={}),n=$(t),r=viewportSelector().seekUp(n),0===r.length&&e.strict!==!1&&up.fail("Could not find viewport for %o",n),r},viewportsWithin=function(t){var e;return e=$(t),viewportSelector().findWithSelf(e)},viewports=function(){return viewportSelector().select()},scrollTops=function(){var t,e,n,r,o,i,u;for(i={},o=config.viewports,e=0,r=o.length;e<r;e++)u=o[e],t=$(u),t.length&&(n=u,u===document&&(n="document"),i[n]=t.scrollTop());return i},fixedChildren=function(t){var e,n;return null==t&&(t=void 0),t||(t=document.body),n=$(t),e=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(e=e.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(e=e.add(n.find(config.fixedBottom.join(", ")))),e},saveScroll=function(t){var e,n;return null==t&&(t={}),n=u.option(t.url,up.history.url()),e=u.option(t.tops,scrollTops()),up.puts("Saving scroll positions for URL %s (%o)",n,e),lastScrollTops.set(n,e)},restoreScroll=function(t){var e,n,r,o,i;return null==t&&(t={}),i=up.history.url(),r=void 0,t.around?(n=viewportsWithin(t.around),e=viewportOf(t.around),r=e.add(n)):r=viewports(),o=lastScrollTops.get(i),up.log.group("Restoring scroll positions for URL %s to %o",i,o,function(){var t,e,n,i;for(e in o)i=o[e],n="document"===e?document:e,t=r.filter(n),scroll(t,i,{duration:0});return u.resolvedDeferred()})},revealOrRestoreScroll=function(t,e){var n,r,o,i;return n=$(t),e.restoreScroll?restoreScroll({around:n}):e.reveal?(i={},e.source&&(o=u.parseUrl(e.source),(r=firstHashTarget(o.hash))&&(n=r,i.top=!0)),reveal(n,i)):u.resolvedDeferred()},firstHashTarget=function(t){if(t=up.browser.hash(t))return up.first("[id='"+t+"'], a[name='"+t+"']")},up.on("up:app:booted",revealHash),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,revealHash:revealHash,firstHashTarget:firstHashTarget,scroll:scroll,finishScrolling:finishScrolling,config:config,viewportOf:viewportOf,viewportsWithin:viewportsWithin,viewports:viewports,scrollTops:scrollTops,saveScroll:saveScroll,restoreScroll:restoreScroll,revealOrRestoreScroll:revealOrRestoreScroll,anchoredRight:anchoredRight,fixedChildren:fixedChildren}}(jQuery),up.scroll=up.layout.scroll,up.reveal=up.layout.reveal,up.revealHash=up.layout.revealHash}.call(this),function(){up.dom=function($){var autofocus,bestMatchingSteps,bestPreflightSelector,config,destroy,emitFragmentInserted,emitFragmentKept,extract,filterScripts,findKeepPlan,first,firstInLayer,firstInPriority,hello,isRealElement,layerOf,matchesLayer,parseResponse,processResponse,reload,replace,reset,resolveSelector,setSource,shouldExtractTitle,source,swapBody,swapElements,transferKeepableElements,u,updateHistoryAndTitle;return u=up.util,config=u.config({fallbacks:["body"],fallbackTransition:"none",runInlineScripts:!0,runLinkedScripts:!1}),reset=function(){return config.reset()},setSource=function(t,e){var n;return n=$(t),u.isPresent(e)&&(e=u.normalizeUrl(e)),n.attr("up-source",e)},source=function(t){var e;return e=$(t).closest("[up-source]"),u.presence(e.attr("up-source"))||up.browser.url()},resolveSelector=function(t,e){var n,r;return u.isString(t)?(r=t,u.contains(r,"&")&&(u.isPresent(e)?(n=u.selectorForElement(e),r=r.replace(/\&/,n)):up.fail("Found origin reference (%s) in selector %s, but no origin was given","&",r))):r=u.selectorForElement(t),r},replace=function(t,e,n){var r,o,i,a,s,l,c,p;return n=u.options(n),up.browser.canPushState()||n.history===!1?(n.inspectResponse=function(){return up.browser.loadPage(e,u.only(n,"method","data"))},c=u.merge(n,{humanizedTarget:"target"}),o=u.merge(n,{humanizedTarget:"failure target",provideTarget:void 0}),p=bestPreflightSelector(t,c),r=bestPreflightSelector(n.failTarget,o),l={url:e,method:n.method,data:n.data,target:p,failTarget:r,cache:n.cache,preload:n.preload,headers:n.headers,timeout:n.timeout},a=function(t,n,r){return processResponse(!0,p,e,l,r,c)},i=function(t,n,i){var a,s;return s=function(){return u.rejectedPromise(t,n,i)},t.responseText?(a=processResponse(!1,r,e,l,t,o),a.then(s,s)):s()},s=up.ajax(l),s=s.then(a,i)):(n.preload||up.browser.loadPage(e,u.only(n,"method","data")),u.unresolvablePromise())},processResponse=function(t,e,n,r,o,i){var a,s,l,c,p;return i.method=u.normalizeMethod(u.option(up.protocol.methodFromXhr(o),i.method)),a="GET"===i.method,(p=up.protocol.locationFromXhr(o))?(n=p,t&&up.proxy.isCachable(r)&&(s={url:n,method:up.protocol.methodFromXhr(o),target:e},up.proxy.alias(r,s))):a&&(l=u.requestDataAsQuery(i.data))&&(n=n+"?"+l),t?a?(i.history===!1||u.isString(i.history)||(i.history=n),i.source===!1||u.isString(i.source)||(i.source=n)):(u.isString(i.history)||(i.history=!1),u.isString(i.source)||(i.source="keep")):(i.transition=i.failTransition,i.failTransition=void 0,a?(i.history!==!1&&(i.history=n),i.source!==!1&&(i.source=n)):(i.source="keep",i.history=!1)),shouldExtractTitle(i)&&(c=up.protocol.titleFromXhr(o))&&(i.title=c),i.preload?u.resolvedPromise():extract(e,o.responseText,i)},shouldExtractTitle=function(t){return!(t.title===!1||u.isString(t.title)||t.history===!1&&t.title!==!0)},extract=function(t,e,n){return up.log.group("Extracting %s from %d bytes of HTML",t,null!=e?e.length:void 0,function(){var r,o,i,a,s,l,c;for(n=u.options(n,{historyMethod:"push",requireMatch:!0,keep:!0,layer:"auto"}),n.saveScroll!==!1&&up.layout.saveScroll(),"function"==typeof n.provideTarget&&n.provideTarget(),a=parseResponse(e),o=bestMatchingSteps(t,a,n),shouldExtractTitle(n)&&(s=a.title())&&(n.title=s),updateHistoryAndTitle(n),c=[],r=0,i=o.length;r<i;r++)l=o[r],up.log.group("Updating %s",l.selector,function(){var t;return filterScripts(l.$new,n),t=swapElements(l.$old,l.$new,l.pseudoClass,l.transition,n),c.push(t),n.reveal=!1});return $.when.apply($,c)})},bestPreflightSelector=function(t,e){var n;return n=new up.dom.ExtractCascade(t,e),n.bestPreflightSelector()},bestMatchingSteps=function(t,e,n){var r;return n=u.merge(n,{response:e}),r=new up.dom.ExtractCascade(t,n),r.bestMatchingSteps()},filterScripts=function(t,e){var n,r,o,i,a,s,l,c,p,f;for(c=u.option(e.runInlineScripts,config.runInlineScripts),p=u.option(e.runLinkedScripts,config.runLinkedScripts),r=u.findWithSelf(t,"script"),l=[],o=0,s=r.length;o<s;o++)f=r[o],n=$(f),a=u.isPresent(n.attr("src")),i=!a,a&&p||i&&c?l.push(void 0):l.push(n.remove());return l},parseResponse=function(t){var e;return e=u.createElementFromHtml(t),{title:function(){var t;return null!=(t=e.querySelector("title"))?t.textContent:void 0},first:function(t){var n;if(n=$.find(t,e)[0])return $(n)}}},updateHistoryAndTitle=function(t){if(t=u.options(t,{historyMethod:"push"}),t.history&&up.history[t.historyMethod](t.history),u.isString(t.title))return document.title=t.title},swapElements=function(t,e,n,r,o){var i,a,s,l;return r||(r="none"),"keep"===o.source&&(o=u.merge(o,{source:source(t)})),up.motion.finish(t),n?(i=e.contents().wrapAll('<div class="up-insertion"></div>').parent(),"before"===n?t.prepend(i):t.append(i),hello(i.children(),o),s=up.layout.revealOrRestoreScroll(i,o),s=s.then(function(){return up.animate(i,r,o)}),s=s.then(function(){return u.unwrapElement(i)})):(a=findKeepPlan(t,e,o))?(emitFragmentKept(a),s=u.resolvedPromise()):(l=function(){return o.keepPlans=transferKeepableElements(t,e,o),t.is("body")?(swapBody(t,e),r=!1):e.insertBefore(t),o.source!==!1&&setSource(e,o.source),autofocus(e),hello(e,o),up.morph(t,e,r,o)},s=destroy(t,{animation:l})),s},swapBody=function(t,e){return t.replaceWith(e)},transferKeepableElements=function(t,e,n){var r,o,i,a,s,l,c,p;if(a=[],n.keep)for(p=t.find("[up-keep]"),i=0,l=p.length;i<l;i++)s=p[i],r=$(s),(c=findKeepPlan(r,e,u.merge(n,{descendantsOnly:!0})))&&(o=r.clone(),up.util.detachWith(r,o),c.$newElement.replaceWith(r),a.push(c));return a},findKeepPlan=function(t,e,n){var r,o,i,a,s;if(n.keep&&(r=t,(a=u.castedAttr(r,"up-keep"))&&(u.isString(a)||(a="&"),a=resolveSelector(a,r),o=n.descendantsOnly?e.find(a):u.findWithSelf(e,a),o=o.first(),o.length&&o.is("[up-keep]")&&(s={$element:r,$newElement:o,newData:up.syntax.data(o)},i=u.merge(s,{message:["Keeping element %o",r.get(0)]}),up.bus.nobodyPrevents("up:fragment:keep",i)))))return s},hello=function(t,e){var n,r,o,i,a,s;for(n=$(t),e=u.options(e,{keepPlans:[]}),o=[],s=e.keepPlans,r=0,i=s.length;r<i;r++)a=s[r],emitFragmentKept(a),o.push(a.$element);return up.syntax.compile(n,{skip:o}),emitFragmentInserted(n,e),n},emitFragmentInserted=function(t,e){var n;return n=$(t),up.emit("up:fragment:inserted",{$element:n,message:["Inserted fragment %o",n.get(0)],origin:e.origin})},emitFragmentKept=function(t){var e;return e=u.merge(t,{message:["Kept fragment %o",t.$element.get(0)]}),up.emit("up:fragment:kept",e)},autofocus=function(t){var e,n;if(n="[autofocus]:last",e=u.findWithSelf(t,n),e.length&&e.get(0)!==document.activeElement)return e.focus()},isRealElement=function(t){var e;return e=".up-ghost, .up-destroying",0===t.closest(e).length},first=function(t,e){var n;return e=u.options(e,{layer:"auto"}),n=resolveSelector(t,e.origin),"auto"===e.layer?firstInPriority(n,e.origin):firstInLayer(n,e.layer)},firstInPriority=function(t,e){var n,r,o,i,a,s;for(i=["popup","modal","page"],n=void 0,u.isPresent(e)&&(s=layerOf(e),u.remove(i,s),i.unshift(s)),r=0,a=i.length;r<a&&(o=i[r],!(n=firstInLayer(t,o)));r++);return n},firstInLayer=function(t,e){var n,r,o,i,u,a;for(r=$(t),o=void 0,u=0,a=r.length;u<a;u++)if(i=r[u],n=$(i),isRealElement(n)&&matchesLayer(n,e)){o=n;break}return o},layerOf=function(t){var e;return e=$(t),up.popup.contains(e)?"popup":up.modal.contains(e)?"modal":"page"},matchesLayer=function(t,e){return layerOf(t)===e},destroy=function(t,e){var n,r,o,i,a;return n=$(t),n.is(".up-placeholder, .up-tooltip, .up-modal, .up-popup")||(i=["Destroying fragment %o",n.get(0)],a=["Destroyed fragment %o",n.get(0)]),0===n.length?u.resolvedDeferred():up.bus.nobodyPrevents("up:fragment:destroy",{$element:n,message:i})?(e=u.options(e,{animation:!1}),r=up.motion.animateOptions(e),n.addClass("up-destroying"),updateHistoryAndTitle(e),o=u.presence(e.animation,u.isDeferred)||up.motion.animate(n,e.animation,r),o.then(function(){return up.syntax.clean(n),up.emit("up:fragment:destroyed",{$element:n,message:a}),n.remove()}),o):$.Deferred()},reload=function(t,e){var n;return e=u.options(e,{cache:!1}),n=e.url||source(t),replace(t,n,e)},up.on("up:app:boot",function(){var t;return t=$(document.body),setSource(t,up.browser.url()),hello(t)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),replace:replace,reload:reload,destroy:destroy,extract:extract,first:first,source:source,resolveSelector:resolveSelector,hello:hello,config:config}}(jQuery),up.replace=up.dom.replace,up.extract=up.dom.extract,up.reload=up.dom.reload,up.destroy=up.dom.destroy,up.first=up.dom.first,up.hello=up.dom.hello,up.renamedModule("flow","dom")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};t=up.util,up.dom.ExtractCascade=function(){function n(n,r){this.oldPlanNotFound=e(this.oldPlanNotFound,this),this.matchingPlanNotFound=e(this.matchingPlanNotFound,this),this.bestMatchingSteps=e(this.bestMatchingSteps,this),this.bestPreflightSelector=e(this.bestPreflightSelector,this),this.detectPlan=e(this.detectPlan,this),this.matchingPlan=e(this.matchingPlan,this),this.newPlan=e(this.newPlan,this),this.oldPlan=e(this.oldPlan,this),this.options=t.options(r,{humanizedTarget:"selector",layer:"auto"}),this.candidates=this.buildCandidates(n),this.plans=t.map(this.candidates,function(e){return function(n,r){var o;return o=t.copy(e.options),r>0&&(o.transition=up.dom.config.fallbackTransition),new up.dom.ExtractPlan(n,o)}}(this))}return n.prototype.buildCandidates=function(e){var n;return n=[e,this.options.fallback,up.dom.config.fallbacks],n=t.flatten(n),n=t.select(n,t.isTruthy),(this.options.fallback===!1||this.options.provideTarget)&&(n=[n[0]]),n},n.prototype.oldPlan=function(){return this.detectPlan("oldExists")},n.prototype.newPlan=function(){return this.detectPlan("newExists")},n.prototype.matchingPlan=function(){return this.detectPlan("matchExists")},n.prototype.detectPlan=function(e){return t.detect(this.plans,function(t){return t[e]()})},n.prototype.bestPreflightSelector=function(){var t;return this.options.provideTarget?this.plans[0].selector:(t=this.oldPlan())?t.selector:this.oldPlanNotFound()},n.prototype.bestMatchingSteps=function(){var t;return(t=this.matchingPlan())?t.steps:this.matchingPlanNotFound()},n.prototype.matchingPlanNotFound=function(){var t,e;return this.newPlan()?this.oldPlanNotFound():(e=this.oldPlan()?"Could not find "+this.options.humanizedTarget+" in response":"Could not match "+this.options.humanizedTarget+" in current page and response",this.response&&this.options.inspectResponse&&(t={label:"Open response",callback:this.options.inspectResponse}),up.fail([e+" (tried %o)",this.candidates],{action:t}))},n.prototype.oldPlanNotFound=function(){var t;return t=this.options.layer,"auto"===t&&(t="page, modal or popup"),up.fail("Could not find "+this.options.humanizedTarget+" in current "+t+" (tried %o)",this.candidates)},n}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};t=up.util,up.dom.ExtractPlan=function(){function n(t,n){this.parseSteps=e(this.parseSteps,this),this.matchExists=e(this.matchExists,this),this.newExists=e(this.newExists,this),this.oldExists=e(this.oldExists,this),this.findNew=e(this.findNew,this),this.findOld=e(this.findOld,this),this.origin=n.origin,this.selector=up.dom.resolveSelector(t,n.origin),this.transition=n.transition||n.animation||"none",this.response=n.response,this.steps=this.parseSteps()}return n.prototype.findOld=function(){return t.each(this.steps,function(t){return t.$old=up.dom.first(t.selector,this.options)})},n.prototype.findNew=function(){return t.each(this.steps,function(t){return function(e){return e.$new=t.response.first(e.selector)}}(this))},n.prototype.oldExists=function(){return this.findOld(),t.all(this.steps,function(t){return t.$old})},n.prototype.newExists=function(){return this.findNew(),t.all(this.steps,function(t){return t.$new})},n.prototype.matchExists=function(){return this.oldExists()&&this.newExists()},n.prototype.parseSteps=function(){var e,n,r;return r=t.isString(this.transition)?this.transition.split(e):[this.transition],e=/\ *,\ */,n=this.selector.split(e),t.map(n,function(e,n){var o,i,u,a;return o=e.match(/^(.+?)(?:\:(before|after))?$/),o||up.fail('Could not parse selector literal "%s"',e),u=o[1],"html"===u&&(u="body"),i=o[2],a=r[n]||t.last(r),{selector:u,pseudoClass:i,transition:a}})},n}()}.call(this),function(){var t=[].slice;up.motion=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,E,$,P,T,x,D;return x=up.util,a={},c={},P={},p={},l=x.config({duration:300,delay:0,easing:"ease",enabled:!0}),k=function(){return h(),a=x.copy(c),P=x.copy(p),l.reset()},v=function(){return l.enabled&&up.browser.canCssTransition()},o=function(t,n,r){var u;return u=e(t),h(u),r=i(r),g(n)?b():x.isFunction(n)?s(n(u,r),n):x.isString(n)?o(u,d(n),r):x.isHash(n)?v()?x.cssAnimate(u,n,r):(u.css(n),x.resolvedDeferred()):up.fail("Unknown animation type for %o",n)},i=function(){var e,n,r,o,i;return n=1<=arguments.length?t.call(arguments,0):[],i=n.shift()||{},e=x.isJQuery(n[0])?n.shift():x.nullJQuery(),o=x.isObject(n[0])?n.shift():{},r={},r.easing=x.option(i.easing,x.presentAttr(e,"up-easing"),o.easing,l.easing),r.duration=Number(x.option(i.duration,x.presentAttr(e,"up-duration"),o.duration,l.duration)),r.delay=Number(x.option(i.delay,x.presentAttr(e,"up-delay"),o.delay,l.delay)),r},d=function(t){return a[t]||up.fail("Unknown animation %o",t)},r="up-ghosting-deferred",n="up-ghosting",D=function(t,e,o,i){var u,a,s,l,c,p,f,d;return o.copy===!1||t.is(".up-ghost")||e.is(".up-ghost")?i(t,e):(p=void 0,l=void 0,f=void 0,c=void 0,a=up.layout.viewportOf(t),u=t.add(e),x.temporaryCss(e,{display:"none"},function(){return p=w(t,a),f=a.scrollTop()}),x.temporaryCss(t,{display:"none"},function(){return up.layout.revealOrRestoreScroll(e,o),l=w(e,a),c=a.scrollTop()}),p.moveTop(c-f),t.hide(),d=x.temporaryCss(e,{opacity:"0"}),s=i(p.$ghost,l.$ghost),u.data(r,s),u.addClass(n),s.then(function(){return u.removeData(r),u.removeClass(n),d(),p.$bounds.remove(),l.$bounds.remove()}),s)},h=function(t){var r,o,i;if(null==t&&(t=".up-animating"),v())return o=e(t),r=x.findWithSelf(o,".up-animating"),x.finishCssAnimate(r),i=x.findWithSelf(o,"."+n),m(i)},m=function(t){return t.each(function(){var t,n;if(t=e(this),n=x.pluckData(t,r))return n.resolve()})},s=function(t,e){return x.isDeferred(t)?t:up.fail("Did not return a promise with .then and .resolve methods: %o",e)},y=function(t,n,r,u){var l,c,p;return u=x.options(u),p=v()&&!g(r),c=e(t),l=e(n),up.log.group(p?"Morphing %o to %o (using %s, %o)":void 0,c.get(0),l.get(0),r,u,function(){var t,e,n,d;return e=x.only(u,"reveal","restoreScroll","source"),e=x.assign(e,i(u)),h(c),h(l),p?(f(c),f(l),(t=a[r])?(A(c,l,e),o(l,t,e)):(d=x.presence(r,x.isFunction)||P[r])?D(c,l,e,function(t,n){var o;return o=d(t,n,e),s(o,r)}):x.isString(r)&&r.indexOf("/")>=0?(n=r.split("/"),d=function(t,e,r){return S(o(t,n[0],r),o(e,n[1],r))},y(c,l,d,e)):up.fail("Unknown transition %o",r)):A(c,l,e)})},f=function(t){var e;if(0===t.parents("body").length)return e=t.get(0),up.fail("Can't morph a <%s> element (%o)",e.tagName,e)},A=function(t,e,n){return t.hide(),up.layout.revealOrRestoreScroll(e,n)},w=function(t,n){var r,o,i,u,a,s,l,c,p;for(u=x.measure(t,{relative:!0,inner:!0}),i=t.clone(),i.find("script").remove(),i.css({position:"static"===t.css("position")?"static":"relative",top:"auto",right:"auto",bottom:"auto",left:"auto",width:"100%",height:"100%"}),i.addClass("up-ghost"),r=e('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(u),p=u.top,c=function(t){if(0!==t)return p+=t,r.css({top:p})},i.appendTo(r),r.insertBefore(t),c(t.offset().top-i.offset().top),o=up.layout.fixedChildren(i),s=0,l=o.length;s<l;s++)a=o[s],x.fixedToAbsolute(a,n);return{$ghost:i,$bounds:r,moveTop:c}},$=function(t,e){return P[t]=e},u=function(t,e){return a[t]=e},E=function(){return c=x.copy(a),p=x.copy(P)},S=x.resolvableWhen,b=x.resolvedDeferred,g=function(t){return t===!1||"none"===t||x.isMissing(t)||x.isResolvedPromise(t)},u("none",b),u("fade-in",function(t,e){return t.css({opacity:0}),o(t,{opacity:1},e)}),u("fade-out",function(t,e){return t.css({opacity:1}),o(t,{opacity:0},e)}),T=function(t,e){return{transform:"translate("+t+"px, "+e+"px)"}},u("move-to-top",function(t,e){var n,r;return n=x.measure(t),r=n.top+n.height,t.css(T(0,0)),o(t,T(0,-r),e)}),u("move-from-top",function(t,e){var n,r;return n=x.measure(t),r=n.top+n.height,t.css(T(0,-r)),o(t,T(0,0),e)}),u("move-to-bottom",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().height-n.top,t.css(T(0,0)),o(t,T(0,r),e)}),u("move-from-bottom",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().height-n.top,t.css(T(0,r)),o(t,T(0,0),e)}),u("move-to-left",function(t,e){var n,r;return n=x.measure(t),r=n.left+n.width,t.css(T(0,0)),o(t,T(-r,0),e)}),u("move-from-left",function(t,e){var n,r;return n=x.measure(t),r=n.left+n.width,t.css(T(-r,0)),o(t,T(0,0),e)}),u("move-to-right",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().width-n.left,t.css(T(0,0)),o(t,T(r,0),e)}),u("move-from-right",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().width-n.left,t.css(T(r,0)),o(t,T(0,0),e)}),u("roll-down",function(t,e){var n,r,i;return r=t.height(),i=x.temporaryCss(t,{height:"0px",overflow:"hidden"}),n=o(t,{height:r+"px"},e),n.then(i),n}),$("none",b),$("move-left",function(t,e,n){return S(o(t,"move-to-left",n),o(e,"move-from-right",n))}),$("move-right",function(t,e,n){return S(o(t,"move-to-right",n),o(e,"move-from-left",n))}),$("move-up",function(t,e,n){return S(o(t,"move-to-top",n),o(e,"move-from-bottom",n))}),$("move-down",function(t,e,n){return S(o(t,"move-to-bottom",n),o(e,"move-from-top",n))}),$("cross-fade",function(t,e,n){return S(o(t,"fade-out",n),o(e,"fade-in",n))}),up.on("up:framework:booted",E),up.on("up:framework:reset",k),{morph:y,animate:o,animateOptions:i,finish:h,transition:$,animation:u,config:l,isEnabled:v,none:b,when:S,prependCopy:w,isNone:g}}(jQuery),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){var t=[].slice;up.proxy=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,E,$,P,T,x,D,C,O,F,R,U,L;return L=up.util,n=void 0,$=void 0,F=void 0,S=void 0,R=void 0,T=[],p=L.config({slowDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5,maxRequests:4,wrapMethods:["PATCH","PUT","DELETE"],safeMethods:["GET","OPTIONS","HEAD"]}),u=function(t){return k(t),[t.url,t.method,L.requestDataAsQuery(t.data),t.target].join("|")},i=L.cache({size:function(){return p.cacheSize},expiry:function(){return p.cacheExpiry},key:u}),f=function(t){var e,n,r,o,u,a,s;if(t=k(t),h(t))for(n=[t],"html"!==t.target&&(a=L.merge(t,{target:"html"}),n.push(a),"body"!==t.target&&(u=L.merge(t,{target:"body"}),n.push(u))),r=0,o=n.length;r<o;r++)if(e=n[r],s=i.get(e))return s},a=function(){return clearTimeout($),$=null},s=function(){return clearTimeout(F),F=null},D=function(){return n=null,a(),s(),S=0,p.reset(),i.clear(),R=!1,T=[]},D(),k=function(t){return t._normalized||(t.method=L.normalizeMethod(t.method),t.url&&(t.url=L.normalizeUrl(t.url)),t.target||(t.target="body"),t._normalized=!0),t},r=function(){var e,n,r,o,i,u,a;return e=1<=arguments.length?t.call(arguments,0):[],o=L.extractOptions(e),L.isGiven(e[0])&&(o.url=e[0]),n=o.cache===!0,r=o.cache===!1,a=L.only(o,"url","method","data","target","headers","timeout","_normalized"),a=k(a),i=!0,m(a)||n?(u=f(a))&&!r?(up.puts("Re-using cached response for %s %s",a.method,a.url),i="pending"===u.state()):(u=b(a),O(a,u),u.fail(function(){return x(a)})):(c(),u=b(a)),i&&!o.preload&&(w(),u.always(y)),u},h=function(t){return!L.isFormData(t.data)},v=function(){return 0===S},d=function(){return S>0},w=function(){var t,e;if(e=v(),S+=1,e)return t=function(){if(d())return up.emit("up:proxy:slow",{message:"Proxy is busy"}),R=!0},F=L.setTimer(p.slowDelay,t)},y=function(){if(S-=1,v()&&R)return up.emit("up:proxy:recover",{message:"Proxy is idle"}),R=!1},b=function(t){return S<p.maxRequests?g(t):P(t)},P=function(t){var n,r;return up.puts("Queuing request for %s %s",t.method,t.url),n=e.Deferred(),r={deferred:n,request:t},T.push(r),n.promise()},g=function(t){var n;return up.emit("up:proxy:load",L.merge(t,{message:["Loading %s %s",t.method,t.url]})),t=L.copy(t),t.headers||(t.headers={}),t.headers[up.protocol.config.targetHeader]=t.target,L.contains(p.wrapMethods,t.method)&&(t.data=L.appendRequestData(t.data,up.protocol.config.methodParam,t.method),t.method="POST"),L.isFormData(t.data)&&(t.contentType=!1,t.processData=!1),n=e.ajax(t),n.done(function(e,n,r){return C(t,r)}),n.fail(function(e){return C(t,e)}),n},C=function(t,e){var n;return up.emit("up:proxy:received",L.merge(t,{message:["Server responded with %s %s (%d bytes)",e.status,e.statusText,null!=(n=e.responseText)?n.length:void 0]})),A()},A=function(){var e,n;(e=T.shift())&&(n=g(e.request),n.done(function(){var n,r;return n=1<=arguments.length?t.call(arguments,0):[],(r=e.deferred).resolve.apply(r,n)}),n.fail(function(){var n,r;return n=1<=arguments.length?t.call(arguments,0):[],(r=e.deferred).reject.apply(r,n)}))},o=i.alias,O=i.set,x=i.remove,c=i.clear,m=function(t){return k(t),L.contains(p.safeMethods,t.method)},l=function(t){var e,r;if(r=parseInt(L.presentAttr(t,"up-delay"))||p.preloadDelay,!t.is(n))return n=t,a(),e=function(){return E(t),n=null},U(e,r)},U=function(t,e){return $=setTimeout(t,e)},E=function(t,n){var r,o;return r=e(t),n=L.options(n),o=up.link.followMethod(r,n),m({method:o})?up.log.group("Preloading link %o",r,function(){return n.preload=!0,up.follow(r,n)}):(up.puts("Won't preload %o due to unsafe method %s",r,o),L.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(t,e){if(!up.link.childClicked(t,e))return l(e)}),up.on("up:framework:reset",D),{preload:E,ajax:r,get:f,alias:o,clear:c,remove:x,isIdle:v,isBusy:d,isCachable:h,config:p}}(jQuery),up.ajax=up.proxy.ajax}.call(this),function(){up.link=function($){var allowDefault,childClicked,follow,followMethod,followVariantSelectors,isFollowable,makeFollowable,onAction,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(t,e){var n;return e=u.options(e),n=u.option(e.target,"body"),up.replace(n,t,e)},follow=function(t,e){var n,r,o;return n=$(t),e=u.options(e),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(e.target,n.attr("up-target")),e.failTarget=u.option(e.failTarget,n.attr("up-fail-target")),e.fallback=u.option(e.fallback,n.attr("up-fallback")),e.transition=u.option(e.transition,u.castedAttr(n,"up-transition"),"none"),e.failTransition=u.option(e.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),e.history=u.option(e.history,u.castedAttr(n,"up-history")),e.reveal=u.option(e.reveal,u.castedAttr(n,"up-reveal"),!0),e.cache=u.option(e.cache,u.castedAttr(n,"up-cache")),e.restoreScroll=u.option(e.restoreScroll,u.castedAttr(n,"up-restore-scroll")),e.method=followMethod(n,e),e.origin=u.option(e.origin,n),e.layer=u.option(e.layer,n.attr("up-layer"),"auto"),e.confirm=u.option(e.confirm,n.attr("up-confirm")),e=u.merge(e,up.motion.animateOptions(e,n)),up.browser.whenConfirmed(e).then(function(){return up.replace(r,o,e)})},followMethod=function(t,e){var n;return n=$(t),e=u.options(e),u.option(e.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},childClicked=function(t,e){var n,r;return n=$(t.target),r=n.closest("a, [up-href]"),r.length&&e.find(r).length},shouldProcessLinkEvent=function(t,e){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,e)},followVariantSelectors=[],allowDefault=function(){},onAction=function(t,e){var n;return followVariantSelectors.push(t),n=function(t){return up.feedback.start(t,function(){return e(t)})},up.on("click","a"+t+", [up-href]"+t,function(t,e){return shouldProcessLinkEvent(t,e)?e.is("[up-instant]")?up.bus.haltEvent(t):(up.bus.consumeAction(t),n(e)):allowDefault(t)}),up.on("mousedown","a"+t+"[up-instant], [up-href]"+t+"[up-instant]",function(t,e){if(shouldProcessLinkEvent(t,e))return up.bus.consumeAction(t),n(e)})},isFollowable=function(t){var e;return e=$(t),u.any(followVariantSelectors,function(t){return e.is(t)})},makeFollowable=function(t){var e;if(e=$(t),!isFollowable(e))return e.attr("up-follow","")},onAction("[up-target]",function(t){return follow(t)}),onAction("[up-follow]",function(t){return follow(t)}),up.macro("[up-dash]",{priority:"last"},function(t){var e,n;return n=u.castedAttr(t,"up-dash"),t.removeAttr("up-dash"),e={"up-preload":"","up-instant":""},n===!0?makeFollowable(t):e["up-target"]=n,u.setMissingAttrs(t,e)}),up.macro("[up-expand]",{priority:"last"},function(t){var e,n,r,o,i,a,s,l,c,p;if(e=t.find("a, [up-href]"),(c=t.attr("up-expand"))&&(e=e.filter(c)),i=e.get(0)){for(p=/^up-/,s={},s["up-href"]=$(i).attr("href"),l=i.attributes,r=0,o=l.length;r<o;r++)n=l[r],a=n.name,a.match(p)&&(s[a]=n.value);return u.setMissingAttrs(t,s),t.removeAttr("up-expand"),makeFollowable(t)}}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,isFollowable:isFollowable,shouldProcessLinkEvent:shouldProcessLinkEvent,childClicked:childClicked,followMethod:followMethod,onAction:onAction}}(jQuery),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){var slice=[].slice;up.form=function($){var autosubmit,config,currentValuesForSwitch,observe,observeField,reset,resolveValidateTarget,submit,switchTargets,u,validate;return u=up.util,config=u.config({validateTargets:["[up-fieldset]:has(&)","fieldset:has(&)","label:has(&)","form:has(&)"],fields:[":input"],observeDelay:0}),reset=function(){return config.reset()},submit=function(t,e){var n,r,o,i,a,s,l;return n=$(t).closest("form"),e=u.options(e),s=u.option(e.target,n.attr("up-target"),"body"),l=u.option(e.url,n.attr("action"),up.browser.url()),e.failTarget=u.option(e.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),e.fallback=u.option(e.fallback,n.attr("up-fallback")),e.history=u.option(e.history,u.castedAttr(n,"up-history"),!0),e.transition=u.option(e.transition,u.castedAttr(n,"up-transition"),"none"),e.failTransition=u.option(e.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),e.method=u.option(e.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),
3
- e.headers=u.option(e.headers,{}),e.reveal=u.option(e.reveal,u.castedAttr(n,"up-reveal"),!0),e.cache=u.option(e.cache,u.castedAttr(n,"up-cache")),e.restoreScroll=u.option(e.restoreScroll,u.castedAttr(n,"up-restore-scroll")),e.origin=u.option(e.origin,n),e.layer=u.option(e.layer,n.attr("up-layer"),"auto"),e.data=up.util.requestDataFromForm(n),e=u.merge(e,up.motion.animateOptions(e,n)),i=n.find("input[type=file]").length,r=!i||u.isFormData(e.data),o=up.browser.canPushState()||e.history===!1,e.validate&&(e.headers||(e.headers={}),e.transition=!1,e.failTransition=!1,e.headers[up.protocol.config.validateHeader]=e.validate,!r)?u.unresolvablePromise():(up.feedback.start(n),r&&o?(a=up.replace(s,l,e),a.always(function(){return up.feedback.stop(n)}),a):(n.get(0).submit(),u.unresolvablePromise()))},observe=function(){var $element,$fields,callback,callbackArg,delay,destructors,extraArgs,options,rawCallback,selectorOrElement;return selectorOrElement=arguments[0],extraArgs=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===extraArgs.length?callbackArg=extraArgs[0]:extraArgs.length>1&&(options=u.options(extraArgs[0]),callbackArg=extraArgs[1]),$element=$(selectorOrElement),$fields=u.multiSelector(config.fields).findWithSelf($element),callback=null,rawCallback=u.option(callbackArg,u.presentAttr($fields,"up-observe")),u.isString(rawCallback)?(console.debug("**** RAW CALLBACK IS %o",rawCallback),callback=function(value,$field){return eval(rawCallback)}):callback=rawCallback||up.fail("up.observe: No change callback given"),delay=u.option($fields.attr("up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),destructors=u.map($fields,function(t){return observeField($(t),delay,callback)}),u.sequence.apply(u,destructors)},observeField=function(t,e,n){var r,o,i,a,s,l;return a=u.submittedValue(t),l=void 0,i=u.resolvedPromise(),s=function(e){var r;return a=e,r=n.apply(t.get(0),[e,t]),i=u.isPromise(r)?r:r},o=function(){var n,r;if(r=u.submittedValue(t),a!==r)return n=function(){return s(r)},null!=l&&l.cancel(),l=u.promiseTimer(e),$.when(l,i).then(n)},r="input change",up.browser.canInputEvent()||(r+=" keypress paste cut click propertychange"),t.on(r,o),function(){return t.off(r,o),null!=l?l.cancel():void 0}},autosubmit=function(t,e){return observe(t,e,function(t,e){var n;return n=e.closest("form"),up.feedback.start(e,function(){return submit(n)})})},resolveValidateTarget=function(t,e){var n;return n=u.option(e.target,t.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.dom.resolveSelector(n,e.origin),t.closest(r).length}))),u.isBlank(n)&&up.fail("Could not find default validation target for %o (tried ancestors %o)",t.get(0),config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(t,e){var n,r,o;return n=$(t),e=u.options(e),e.origin=n,e.target=resolveValidateTarget(n,e),e.failTarget=e.target,e.history=!1,e.headers=u.option(e.headers,{}),e.validate=n.attr("name")||"__none__",e=u.merge(e,up.motion.animateOptions(e,n)),r=n.closest("form"),o=up.submit(r,e)},currentValuesForSwitch=function(t){var e,n,r;return r=void 0,t.is("input[type=checkbox]")?r=t.is(":checked")?[":checked",":present",t.val()]:[":unchecked",":blank"]:t.is("input[type=radio]")?(e=t.closest("form, body").find("input[type='radio'][name='"+t.attr("name")+"']:checked"),r=e.length?[":checked",":present",e.val()]:[":unchecked",":blank"]):(n=t.val(),r=u.isPresent(n)?[":present",n]:[":blank"]),r},currentValuesForSwitch=function(t){var e,n,r,o;return t.is("input[type=checkbox]")?t.is(":checked")?(r=t.val(),n=":checked"):n=":unchecked":t.is("input[type=radio]")?(e=t.closest("form, body").find("input[type='radio'][name='"+t.attr("name")+"']:checked"),e.length?(n=":checked",r=e.val()):n=":unchecked"):r=t.val(),o=[],u.isPresent(r)?(o.push(r),o.push(":present")):o.push(":blank"),u.isPresent(n)&&o.push(n),o},switchTargets=function(t,e){var n,r,o;return n=$(t),e=u.options(e),o=u.option(e.target,n.attr("up-switch")),u.isPresent(o)||up.fail("No switch target given for %o",n.get(0)),r=currentValuesForSwitch(n),$(o).each(function(){var t,e,n,o;return t=$(this),(e=t.attr("up-hide-for"))?(e=e.split(" "),n=0===u.intersect(r,e).length):(o=(o=t.attr("up-show-for"))?o.split(" "):[":present",":checked"],n=u.intersect(r,o).length>0),t.toggle(n)})},up.on("submit","form[up-target]",function(t,e){return up.bus.consumeAction(t),submit(e)}),up.on("change","[up-validate]",function(t,e){return validate(e)}),up.on("change","[up-switch]",function(t,e){return switchTargets(e)}),up.compiler("[up-switch]",function(t){return switchTargets(t)}),up.compiler("[up-observe]",function(t){return observe(t)}),up.compiler("[up-autosubmit]",function(t){return autosubmit(t)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),config:config,submit:submit,observe:observe,validate:validate,switchTargets:switchTargets,autosubmit:autosubmit}}(jQuery),up.submit=up.form.submit,up.observe=up.form.observe,up.autosubmit=up.form.autosubmit,up.validate=up.form.validate}.call(this),function(){up.popup=function($){var align,attachAsap,attachNow,autoclose,chain,closeAsap,closeNow,config,contains,createFrame,discardHistory,isOpen,reset,state,u;return u=up.util,config=u.config({openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:150,closeDuration:100,openEasing:null,closeEasing:null,position:"bottom-right",history:!1}),state=u.config({phase:"closed",$anchor:null,$popup:null,position:null,sticky:null,url:null,coveredUrl:null,coveredTitle:null}),chain=new u.DivertibleChain,reset=function(){var t;return null!=(t=state.$popup)&&t.remove(),state.reset(),chain.reset(),config.reset()},align=function(){var t,e,n;switch(t={},n=u.measure(state.$popup),u.isFixed(state.$anchor)?(e=state.$anchor.get(0).getBoundingClientRect(),t.position="fixed"):e=u.measure(state.$anchor),state.position){case"bottom-right":t.top=e.top+e.height,t.left=e.left+e.width-n.width;break;case"bottom-left":t.top=e.top+e.height,t.left=e.left;break;case"top-right":t.top=e.top-n.height,t.left=e.left+e.width-n.width;break;case"top-left":t.top=e.top-n.height,t.left=e.left;break;default:up.fail("Unknown position option '%s'",state.position)}return state.$popup.attr("up-position",state.position),state.$popup.css(t)},discardHistory=function(){return state.coveredTitle=null,state.coveredUrl=null},createFrame=function(t){var e;return e=u.$createElementFromSelector(".up-popup"),u.$createPlaceholder(t,e),e.appendTo(document.body),state.$popup=e},isOpen=function(){return"opened"===state.phase||"opening"===state.phase},attachAsap=function(t,e){var n;return n=function(){return attachNow(t,e)},isOpen()?chain.asap(closeNow,n):chain.asap(n),chain.promise()},attachNow=function(t,e){var n,r,o,i,a,s;return n=$(t),n.length||up.fail("Cannot attach popup to non-existing element %o",t),e=u.options(e),s=u.option(u.pluckKey(e,"url"),n.attr("up-href"),n.attr("href")),o=u.option(u.pluckKey(e,"html")),a=u.option(u.pluckKey(e,"target"),n.attr("up-popup"),"body"),i=u.option(e.position,n.attr("up-position"),config.position),e.animation=u.option(e.animation,n.attr("up-animation"),config.openAnimation),e.sticky=u.option(e.sticky,u.castedAttr(n,"up-sticky"),config.sticky),e.history=!!up.browser.canPushState()&&u.option(e.history,u.castedAttr(n,"up-history"),config.history),e.confirm=u.option(e.confirm,n.attr("up-confirm")),e.method=up.link.followMethod(n,e),e.layer="popup",r=up.motion.animateOptions(e,n,{duration:config.openDuration,easing:config.openEasing}),up.browser.whenConfirmed(e).then(function(){return up.bus.whenEmitted("up:popup:open",{url:s,message:"Opening popup"}).then(function(){var t,l;return state.phase="opening",state.$anchor=n,state.position=i,e.history&&(state.coveredUrl=up.browser.url(),state.coveredTitle=document.title),state.sticky=e.sticky,e.provideTarget=function(){return createFrame(a)},t=u.merge(e,{animation:!1}),l=o?up.extract(a,o,t):up.replace(a,s,t),l=l.then(function(){return align(),up.animate(state.$popup,e.animation,r)}),l=l.then(function(){return state.phase="opened",up.emit("up:popup:opened",{message:"Popup opened"})})})})},closeAsap=function(t){return isOpen()&&chain.asap(function(){return closeNow(t)}),chain.promise()},closeNow=function(t){var e;return isOpen()?(t=u.options(t,{animation:config.closeAnimation,history:state.coveredUrl,title:state.coveredTitle}),e=up.motion.animateOptions(t,{duration:config.closeDuration,easing:config.closeEasing}),u.assign(t,e),up.bus.whenEmitted("up:popup:close",{message:"Closing popup",$element:state.$popup}).then(function(){return state.phase="closing",state.url=null,state.coveredUrl=null,state.coveredTitle=null,up.destroy(state.$popup,t).then(function(){return state.phase="closed",state.$popup=null,state.$anchor=null,state.sticky=null,up.emit("up:popup:closed",{message:"Popup closed"})})})):u.resolvedPromise()},autoclose=function(){if(!state.sticky)return discardHistory(),closeAsap()},contains=function(t){var e;return e=$(t),e.closest(".up-popup").length>0},up.link.onAction("[up-popup]",function(t){return t.is(".up-current")?closeAsap():attachAsap(t)}),up.on("click up:action:consumed",function(t){var e;if(e=$(t.target),!e.closest(".up-popup, [up-popup]").length)return closeAsap()}),up.on("up:fragment:inserted",function(t,e){var n;if(contains(e)){if(n=e.attr("up-source"))return state.url=n}else if(contains(t.origin))return autoclose()}),up.bus.onEscape(closeAsap),up.on("click",".up-popup [up-close]",function(t){return closeAsap(),up.bus.consumeAction(t)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),attach:attachAsap,close:closeAsap,url:function(){return state.url},coveredUrl:function(){return state.coveredUrl},config:config,contains:contains,isOpen:isOpen}}(jQuery)}.call(this),function(){up.modal=function($){var animate,autoclose,chain,closeAsap,closeNow,config,contains,createFrame,discardHistory,extractAsap,flavor,flavorDefault,flavorOverrides,flavors,followAsap,isOpen,markAsAnimating,openAsap,openNow,reset,shiftElements,state,templateHtml,u,unshiftElements,visitAsap;return u=up.util,config=u.config({maxWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:null,closeDuration:null,openEasing:null,closeEasing:null,backdropOpenAnimation:"fade-in",backdropCloseAnimation:"fade-out",closeLabel:"\xd7",closable:!0,sticky:!1,flavor:"default",position:null,template:function(t){return'<div class="up-modal">\n <div class="up-modal-backdrop"></div>\n <div class="up-modal-viewport">\n <div class="up-modal-dialog">\n <div class="up-modal-content"></div>\n <div class="up-modal-close" up-close>'+t.closeLabel+"</div>\n </div>\n </div>\n</div>"}}),flavors=u.openConfig({"default":{}}),state=u.config(function(){return{phase:"closed",$anchor:null,$modal:null,sticky:null,closable:null,flavor:null,url:null,coveredUrl:null,coveredTitle:null,position:null,unshifters:[]}}),chain=new u.DivertibleChain,reset=function(){var t;return null!=(t=state.$modal)&&t.remove(),unshiftElements(),state.reset(),chain.reset(),config.reset(),flavors.reset()},templateHtml=function(){var t;return t=flavorDefault("template"),u.evalOption(t,{closeLabel:flavorDefault("closeLabel")})},discardHistory=function(){return state.coveredTitle=null,state.coveredUrl=null},createFrame=function(t,e){var n,r,o;return o=$(templateHtml()),o.attr("up-flavor",state.flavor),u.isPresent(state.position)&&o.attr("up-position",state.position),r=o.find(".up-modal-dialog"),u.isPresent(e.width)&&r.css("width",e.width),u.isPresent(e.maxWidth)&&r.css("max-width",e.maxWidth),u.isPresent(e.height)&&r.css("height",e.height),state.closable||o.find(".up-modal-close").remove(),n=o.find(".up-modal-content"),u.$createPlaceholder(t,n),o.appendTo(document.body),state.$modal=o},shiftElements=function(){var t,e,n,r,o;if(u.documentHasVerticalScrollbar())return t=$("body"),r=u.scrollbarWidth(),e=parseFloat(t.css("padding-right")),n=r+e,o=u.temporaryCss(t,{"padding-right":n+"px","overflow-y":"hidden"}),state.unshifters.push(o),up.layout.anchoredRight().each(function(){var t,e,n,o;return t=$(this),e=parseFloat(t.css("right")),n=r+e,o=u.temporaryCss(t,{right:n}),state.unshifters.push(o)})},unshiftElements=function(){var t,e;for(t=[];e=state.unshifters.pop();)t.push(e());return t},isOpen=function(){return"opened"===state.phase||"opening"===state.phase},followAsap=function(t,e){return e=u.options(e),e.$link=$(t),openAsap(e)},visitAsap=function(t,e){return e=u.options(e),e.url=t,openAsap(e)},extractAsap=function(t,e,n){return n=u.options(n),n.html=e,n.history=u.option(n.history,!1),n.target=t,openAsap(n)},openAsap=function(t){var e;return e=function(){return openNow(t)},isOpen()?chain.asap(closeNow,e):chain.asap(e),chain.promise()},openNow=function(t){var e,n,r,o,i;return t=u.options(t),e=u.option(u.pluckKey(t,"$link"),u.nullJQuery()),i=u.option(u.pluckKey(t,"url"),e.attr("up-href"),e.attr("href")),r=u.option(u.pluckKey(t,"html")),o=u.option(u.pluckKey(t,"target"),e.attr("up-modal"),"body"),t.flavor=u.option(t.flavor,e.attr("up-flavor"),config.flavor),t.position=u.option(t.position,e.attr("up-position"),flavorDefault("position",t.flavor)),t.position=u.evalOption(t.position,{$link:e}),t.width=u.option(t.width,e.attr("up-width"),flavorDefault("width",t.flavor)),t.maxWidth=u.option(t.maxWidth,e.attr("up-max-width"),flavorDefault("maxWidth",t.flavor)),t.height=u.option(t.height,e.attr("up-height"),flavorDefault("height")),t.animation=u.option(t.animation,e.attr("up-animation"),flavorDefault("openAnimation",t.flavor)),t.animation=u.evalOption(t.animation,{position:t.position}),t.backdropAnimation=u.option(t.backdropAnimation,e.attr("up-backdrop-animation"),flavorDefault("backdropOpenAnimation",t.flavor)),t.backdropAnimation=u.evalOption(t.backdropAnimation,{position:t.position}),t.sticky=u.option(t.sticky,u.castedAttr(e,"up-sticky"),flavorDefault("sticky",t.flavor)),t.closable=u.option(t.closable,u.castedAttr(e,"up-closable"),flavorDefault("closable",t.flavor)),t.confirm=u.option(t.confirm,e.attr("up-confirm")),t.method=up.link.followMethod(e,t),t.layer="modal",n=up.motion.animateOptions(t,e,{duration:flavorDefault("openDuration",t.flavor),easing:flavorDefault("openEasing",t.flavor)}),t.history=u.option(t.history,u.castedAttr(e,"up-history"),flavorDefault("history",t.flavor)),up.browser.canPushState()||(t.history=!1),up.browser.whenConfirmed(t).then(function(){return up.bus.whenEmitted("up:modal:open",{url:i,message:"Opening modal"}).then(function(){var e,a;return state.phase="opening",state.flavor=t.flavor,state.sticky=t.sticky,state.closable=t.closable,state.position=t.position,t.history&&(state.coveredUrl=up.browser.url(),state.coveredTitle=document.title),t.provideTarget=function(){return createFrame(o,t)},e=u.merge(t,{animation:!1}),a=r?up.extract(o,r,e):up.replace(o,i,e),a=a.then(function(){return shiftElements(),animate(t.animation,t.backdropAnimation,n)}),a=a.then(function(){return state.phase="opened",up.emit("up:modal:opened",{message:"Modal opened"})})})})},closeAsap=function(t){return isOpen()&&chain.asap(function(){return closeNow(t)}),chain.promise()},closeNow=function(t){var e,n,r,o;return isOpen()?(t=u.options(t),o=u.option(t.animation,flavorDefault("closeAnimation")),o=u.evalOption(o,{position:state.position}),n=u.option(t.backdropAnimation,flavorDefault("backdropCloseAnimation")),n=u.evalOption(n,{position:state.position}),e=up.motion.animateOptions(t,{duration:flavorDefault("closeDuration"),easing:flavorDefault("closeEasing")}),r=u.options(u.except(t,"animation","duration","easing","delay"),{history:state.coveredUrl,title:state.coveredTitle}),up.bus.whenEmitted("up:modal:close",{$element:state.$modal,message:"Closing modal"}).then(function(){var t;return state.phase="closing",state.url=null,state.coveredUrl=null,state.coveredTitle=null,t=animate(o,n,e),t=t.then(function(){return up.destroy(state.$modal,r)}),t=t.then(function(){return unshiftElements(),state.phase="closed",state.$modal=null,state.flavor=null,state.sticky=null,state.closable=null,state.position=null,up.emit("up:modal:closed",{message:"Modal closed"})})})):u.resolvedPromise()},markAsAnimating=function(t){return null==t&&(t=!0),state.$modal.toggleClass("up-modal-animating",t)},animate=function(t,e,n){var r;return up.motion.isNone(t)?u.resolvedPromise():(markAsAnimating(),r=$.when(up.animate(state.$modal.find(".up-modal-viewport"),t,n),up.animate(state.$modal.find(".up-modal-backdrop"),e,n)),r=r.then(function(){return markAsAnimating(!1)}))},autoclose=function(){if(!state.sticky)return discardHistory(),closeAsap()},contains=function(t){var e;return e=$(t),e.closest(".up-modal").length>0},flavor=function(t,e){return null==e&&(e={}),up.log.warn("The up.modal.flavor function is deprecated. Use the up.modal.flavors property instead."),u.assign(flavorOverrides(t),e)},flavorOverrides=function(t){return flavors[t]||(flavors[t]={})},flavorDefault=function(t,e){var n;return null==e&&(e=state.flavor),e&&(n=flavorOverrides(e)[t]),u.isMissing(n)&&(n=config[t]),n},up.link.onAction("[up-modal]",function(t){return followAsap(t)}),up.on("click",function(t){var e;if(state.closable)return e=$(t.target),e.closest(".up-modal-dialog").length||e.closest("[up-modal]").length?void 0:(up.bus.consumeAction(t),closeAsap())}),up.on("up:fragment:inserted",function(t,e){var n;if(contains(e)){if(n=e.attr("up-source"))return state.url=n}else if(contains(t.origin)&&!up.popup.contains(e))return autoclose()}),up.bus.onEscape(function(){if(state.closable)return closeAsap()}),up.on("click",".up-modal [up-close]",function(t){return closeAsap(),up.bus.consumeAction(t)}),up.macro("[up-drawer]",function(t){var e;return e=t.attr("up-drawer"),t.attr({"up-modal":e,"up-flavor":"drawer"})}),flavors.drawer={openAnimation:function(t){switch(t.position){case"left":return"move-from-left";case"right":return"move-from-right"}},closeAnimation:function(t){switch(t.position){case"left":return"move-to-left";case"right":return"move-to-right"}},position:function(t){return u.isPresent(t.$link)?u.horizontalScreenHalf(t.$link):"left"}},up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visitAsap,follow:followAsap,extract:extractAsap,close:closeAsap,url:function(){return state.url},coveredUrl:function(){return state.coveredUrl},config:config,flavors:flavors,contains:contains,isOpen:isOpen,flavor:flavor}}(jQuery)}.call(this),function(){up.tooltip=function(t){var e,n,r,o,i,u,a,s,l,c,p,f;return f=up.util,a=f.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:100,closeDuration:50,openEasing:null,closeEasing:null}),p=f.config({phase:"closed",$anchor:null,$tooltip:null,position:null}),o=new f.DivertibleChain,c=function(){var t;return null!=(t=p.$tooltip)&&t.remove(),p.reset(),o.reset(),a.reset()},e=function(){var t,e,n;switch(t={},n=f.measure(p.$tooltip),f.isFixed(p.$anchor)?(e=p.$anchor.get(0).getBoundingClientRect(),t.position="fixed"):e=f.measure(p.$anchor),p.position){case"top":t.top=e.top-n.height,t.left=e.left+.5*(e.width-n.width);break;case"left":t.top=e.top+.5*(e.height-n.height),t.left=e.left-n.width;break;case"right":t.top=e.top+.5*(e.height-n.height),t.left=e.left+e.width;break;case"bottom":t.top=e.top+e.height,t.left=e.left+.5*(e.width-n.width);break;default:up.fail("Unknown position option '%s'",p.position)}return p.$tooltip.attr("up-position",p.position),p.$tooltip.css(t)},s=function(t){var e;return e=f.$createElementFromSelector(".up-tooltip"),f.isGiven(t.text)?e.text(t.text):e.html(t.html),e.appendTo(document.body),p.$tooltip=e},n=function(t,e){var n;return null==e&&(e={}),n=function(){return r(t,e)},l()?o.asap(u,n):o.asap(n),o.promise()},r=function(n,r){var o,i,u,l,c,d;return o=t(n),r=f.options(r),l=f.option(r.html,o.attr("up-tooltip-html")),d=f.option(r.text,o.attr("up-tooltip")),c=f.option(r.position,o.attr("up-position"),a.position),u=f.option(r.animation,f.castedAttr(o,"up-animation"),a.openAnimation),i=up.motion.animateOptions(r,o,{duration:a.openDuration,easing:a.openEasing}),p.phase="opening",p.$anchor=o,s({text:d,html:l}),p.position=c,e(),up.animate(p.$tooltip,u,i).then(function(){return p.phase="opened"})},i=function(t){return l()&&o.asap(function(){return u(t)}),o.promise()},u=function(t){var e;return l()?(t=f.options(t,{animation:a.closeAnimation}),e=up.motion.animateOptions(t,{duration:a.closeDuration,easing:a.closeEasing}),f.assign(t,e),p.phase="closing",up.destroy(p.$tooltip,t).then(function(){return p.phase="closed",p.$tooltip=null,p.$anchor=null})):f.resolvedPromise()},l=function(){return"opening"===p.phase||"opened"===p.phase},up.compiler("[up-tooltip], [up-tooltip-html]",function(t){return t.on("mouseenter",function(){return n(t)}),t.on("mouseleave",function(){return i()})}),up.on("click up:action:consumed",function(){return i()}),up.on("up:framework:reset",c),up.bus.onEscape(function(){return i()}),{config:a,attach:n,isOpen:l,close:i}}(jQuery)}.call(this),function(){up.feedback=function(t){var e,n,r,o,i,u,a,s,l,c,p,f,d;return f=up.util,r=f.config({currentClasses:["up-current"]}),s=function(){return r.reset()},o=function(){var t;return t=r.currentClasses,t=t.concat(["up-current"]),t=f.uniq(t),t.join(" ")},e="up-active",n="a, [up-href]",a=function(t){if(f.isPresent(t))return f.normalizeUrl(t)},l=function(t){var e,n,r,o,i,u,s,l,c,p;for(l=[],u=["href","up-href","up-alias"],n=0,o=u.length;n<o;n++)if(e=u[n],c=f.presentAttr(t,e))for(p="up-alias"===e?c.split(" "):[c],r=0,i=p.length;r<i;r++)s=p[r],"#"!==s&&(s=a(s),l.push(s));return l},d=function(t){var e,n,r,o;return t=f.compact(t),r=function(t){return"*"===t.substr(-1)?n(t.slice(0,-1)):e(t)},e=function(e){return f.contains(t,e)},n=function(e){return f.detect(t,function(t){return 0===t.indexOf(e)})},o=function(t){return f.detect(t,r)},{matchesAny:o}},u=function(){var e,r;return e=d([a(up.browser.url()),a(up.modal.url()),a(up.modal.coveredUrl()),a(up.popup.url()),a(up.popup.coveredUrl())]),r=o(),f.each(t(n),function(n){var o,i;return o=t(n),i=l(o),e.matchesAny(i)?o.addClass(r):o.hasClass(r)&&0===o.closest(".up-destroying").length?o.removeClass(r):void 0})},i=function(e){var r;return r=t(e),r.is(n)&&(r=f.presence(r.parent(n))||r),r},c=function(t,n){var r,o;if(r=i(t),r.addClass(e),n)return o=n(),f.isPromise(o)?o.always(function(){return p(r)}):up.warn("Expected block to return a promise, but got %o",o),o},p=function(t){var n;return n=i(t),n.removeClass(e)},up.on("up:fragment:inserted",function(){return u()}),up.on("up:fragment:destroyed",function(t,e){if(e.is(".up-modal, .up-popup"))return u()}),up.on("up:framework:reset",s),{config:r,start:c,stop:p}}(jQuery),up.renamedModule("navigation","feedback")}.call(this),function(){up.rails=function(t){var e,n,r,o;return r=up.util,o=function(t){return t.is("[up-follow], [up-target], [up-modal], [up-popup]")},n=function(){return r.isGiven(t.rails)},r.each(["method","confirm"],function(t){var e,i;return e="data-"+t,i="up-"+t,up.compiler("["+e+"]",function(t){var u;if(n()&&o(t))return u={},u[i]=t.attr(e),r.setMissingAttrs(t,u),t.removeAttr(e)})}),e=function(){if(n())return{name:t.rails.csrfParam(),value:t.rails.csrfToken()}},{csrfField:e,isRails:n}}(jQuery)}.call(this),function(){up.boot()}.call(this);
1
+ (function(){this.up={version:"0.34.1",renamedModule:function(t,e){return"function"==typeof Object.defineProperty?Object.defineProperty(up,t,{get:function(){return up.log.warn("up."+t+" has been renamed to up."+e),up[e]}}):void 0}}}).call(this),function(){var t=[].slice,e={}.hasOwnProperty,n=function(t,e){return function(){return t.apply(e,arguments)}};up.util=function(r){var o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,T,$,E,P,x,D,C,O,F,R,U,L,H,M,N,j,_,I,K,W,z,q,Q,J,B,V,X,G,Y,Z,tt,et,nt,rt,ot,it,ut,at,st,lt,ct,pt,ft,dt,ht,mt,vt,gt,yt,bt,wt,kt,St,At,Tt,$t,Et,Pt,xt,Dt,Ct,Ot,Ft,Rt,Ut,Lt,Ht,Mt,Nt,jt,_t,It,Kt,Wt,zt,qt,Qt,Jt,Bt,Vt,Xt,Gt,Yt,Zt,te,ee,ne,re,oe,ie,ue,ae,se,le,ce,pe,fe,de;return Tt=r.noop,bt=function(e){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?n:(r=!0,n=e.apply(null,o))}},lt=function(t,e){return e=e.toString(),(""===e||"80"===e)&&"http:"===t||"443"===e&&"https:"===t},Et=function(t,e){var n,r,o;return n=Lt(t),r=n.protocol+"//"+n.hostname,lt(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=e?e.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=e?e.hash:void 0)===!0&&(r+=n.hash),(null!=e?e.search:void 0)!==!1&&(r+=n.search),r},Lt=function(t){var e;return e=null,ct(t)?(e=r("<a>").attr({href:t}).get(0),q(e.hostname)&&(e.href=e.href)):e=se(t),e},$t=function(t){return t?t.toUpperCase():"GET"},o=function(t){var e,n,o,i,u,a,s,l,c,p,f,d,h,m,v,g;for(v=t.split(/[ >]/),o=null,f=c=0,h=v.length;h>c;f=++c){for(a=v[f],u=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",i=[],p=null,d=0,m=u.length;m>d;d++)switch(s=u[d],s[0]){case".":i.push(s.substr(1));break;case"#":p=s.substr(1);break;default:g=s}l="<"+g,i.length&&(l+=' class="'+i.join(" ")+'"'),p&&(l+=' id="'+p+'"'),l+=">",e=r(l),n&&e.appendTo(n),0===f&&(o=e),n=e}return o},S=function(t,e){var n;return n=document.createElement(t),ut(e)&&(n.innerHTML=e),n},i=function(t,e){var n;return null==e&&(e=document.body),n=o(t),n.addClass("up-placeholder"),n.appendTo(e),n},Zt=function(t){var e,n,o,i,u,a,s,l,c;if(e=r(t),l=void 0,up.puts("Creating selector from element %o",e.get(0)),c=Nt(e.attr("up-id")))l="[up-id='"+c+"']";else if(i=Nt(e.attr("id")))l="#"+i;else if(s=Nt(e.attr("name")))l="[name='"+s+"']";else if(n=Nt(At(e)))for(l="",o=0,a=n.length;a>o;o++)u=n[o],l+="."+u;else l=e.prop("tagName").toLowerCase();return l},At=function(t){var e,n;return e=t.attr("class")||"",n=e.split(" "),Yt(n,function(t){return ut(t)&&!t.match(/^up-/)})},A=function(t){var e,n,r,o,i,u,a,s,l,c,p,f;return l=function(t){return"<"+t+"(?: [^>]*)?>"},u=function(t){return"</"+t+">"},e="(?:.|\\s)*?",i=function(t){return"("+t+")"},f=new RegExp(l("title")+i(e)+u("title"),"i"),o=new RegExp(l("body")+i(e)+u("body"),"i"),(r=t.match(o))?(s=document.createElement("html"),n=S("body",r[1]),s.appendChild(n),(p=t.match(f))&&(a=S("head"),s.appendChild(a),c=S("title",p[1]),a.appendChild(c)),s):S("div",t)},d=function(){var n,r,o,i,u,a,s;for(a=arguments[0],u=2<=arguments.length?t.call(arguments,1):[],n=0,o=u.length;o>n;n++){i=u[n];for(r in i)e.call(i,r)&&(s=i[r],a[r]=s)}return a},f=Object.assign||d,ae=r.trim,x=function(t,e){var n,r,o,i,u;for(u=[],r=n=0,i=t.length;i>n;r=++n)o=t[r],u.push(e(o,r));return u},vt=x,ie=function(t,e){var n,r,o,i;for(i=[],r=n=0,o=t-1;o>=0?o>=n:n>=o;r=o>=0?++n:--n)i.push(e(r));return i},rt=function(t){return null===t},ft=function(t){return void 0===t},J=function(t){return!ft(t)},nt=function(t){return ft(t)||rt(t)},Z=function(t){return!nt(t)},q=function(t){return nt(t)||it(t)&&0===Object.keys(t).length||0===t.length},Nt=function(t,e){return null==e&&(e=ut),e(t)?t:void 0},ut=function(t){return!q(t)},Y=function(t){return"function"==typeof t},ct=function(t){return"string"==typeof t},ot=function(t){return"number"==typeof t},tt=function(t){return"object"==typeof t&&!!t},it=function(t){return tt(t)||"function"==typeof t},V=function(t){return!(!t||1!==t.nodeType)},et=function(t){return t instanceof jQuery},at=function(t){return it(t)&&Y(t.then)},Q=function(t){return at(t)&&Y(t.resolve)},z=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},G=function(t){return up.browser.canFormData()&&t instanceof FormData},ue=function(t){return Array.prototype.slice.call(t)},w=function(t){return z(t)?t.slice():tt(t)?f({},t):void 0},se=function(t){return et(t)?t.get(0):t},wt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],f.apply(null,[{}].concat(t.call(e)))},Ut=function(t,e){var n,r,o,i;if(o=t?w(t):{},e)for(r in e)n=e[r],i=o[r],Z(i)?it(n)&&it(i)&&(o[r]=Ut(i,n)):o[r]=n;return o},Rt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],E(e,Z)},E=function(t,e){var n,r,o,i;for(i=void 0,r=0,o=t.length;o>r;r++)if(n=t[r],e(n)){i=n;break}return i},c=function(t,e){var n,r,o,i;for(i=!1,r=0,o=t.length;o>r;r++)if(n=t[r],e(n)){i=!0;break}return i},l=function(t,e){var n,r,o,i;for(i=!0,r=0,o=t.length;o>r;r++)if(n=t[r],!e(n)){i=!1;break}return i},g=function(t){return Yt(t,Z)},le=function(t){var e;return e={},Yt(t,function(t){return e.hasOwnProperty(t)?!1:e[t]=!0})},Yt=function(t,e){var n;return n=[],x(t,function(t){return e(t)?n.push(t):void 0}),n},Kt=function(t,e){return Yt(t,function(t){return!e(t)})},W=function(t,e){return Yt(t,function(t){return b(e,t)})},jt=function(){var e,n,r,o;return e=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,i;for(i=[],t=0,o=r.length;o>t;t++)n=r[t],i.push(e.attr(n));return i}(),E(o,ut)},ne=function(t,e){return t>0?setTimeout(e,t):void e()},St=function(t){return setTimeout(t,0)},mt=function(t){return t[t.length-1]},v=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},Gt=bt(function(){var t,e,n;return t=r("<div>"),t.attr("up-viewport",""),t.css({position:"absolute",top:"0",left:"0",width:"100px",height:"100px",overflowY:"scroll"}),t.appendTo(document.body),e=t.get(0),n=e.offsetWidth-e.clientWidth,t.remove(),n}),P=function(){var t,e,n,o,i,u;return e=document.body,t=r(e),u=document.documentElement,n=t.css("overflow-y"),i="scroll"===n,o="hidden"===n,i||!o&&u.scrollHeight>u.clientHeight},Dt=function(e){var n;return n=void 0,function(){var r;return r=1<=arguments.length?t.call(arguments,0):[],null!=e&&(n=e.apply(null,r)),e=void 0,n}},oe=function(t,e,n){var o,i,u;return o=r(t),u=o.css(Object.keys(e)),o.css(e),i=function(){return o.css(u)},n?(n(),i()):Dt(i)},j=function(t){var e,n;return n=t.css(["transform","-webkit-transform"]),q(n)||"none"===n.transform?(e=function(){return t.css(n)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):e=function(){},e},_=function(t){return t=se(t),t.offsetHeight},T=function(t,e,n){var o,i,a,s,l,c,p;return o=r(t),n=Ut(n,{duration:300,delay:0,easing:"ease"}),0===n.duration?(o.css(e),Vt()):(i=r.Deferred(),c=Object.keys(e),l={"transition-property":c.join(", "),"transition-duration":n.duration+"ms","transition-delay":n.delay+"ms","transition-timing-function":n.easing},a=o.css(Object.keys(l)),s=function(t){var e;return e=t.originalEvent.propertyName,b(c,e)?i.resolve():void 0},o.on("transitionend",s),i.then(function(){var t;return o.removeClass("up-animating"),o.off("transitionend",s),o.removeData(u),p(),o.css({transition:"none"}),t=!("none"===a["transition-property"]||"all"===a["transition-property"]&&"0"===a["transition-duration"][0]),t?(_(o),o.css(a)):void 0}),o.addClass("up-animating"),p=j(o),o.css(l),o.data(u,i),o.css(e),i)},u="up-animation-deferred",H=function(t){return r(t).each(function(){var t;return(t=Ht(this,u))?t.resolve():void 0})},gt=function(t){var e,n;return e=r(t),n=e.css(["margin-top","margin-right","margin-bottom","margin-left"]),{top:parseFloat(n["margin-top"]),right:parseFloat(n["margin-right"]),bottom:parseFloat(n["margin-bottom"]),left:parseFloat(n["margin-left"])}},yt=function(t,e){var n,o,i,u,a,s;return e=Ut(e,{relative:!1,inner:!1,includeMargin:!1}),e.relative?e.relative===!0?u=t.position():(n=r(e.relative),a=t.offset(),n.is(document)?u=a:(i=n.offset(),u={left:a.left-i.left,top:a.top-i.top})):u=t.offset(),o={left:u.left,top:u.top},e.inner?(o.width=t.width(),o.height=t.height()):(o.width=t.outerWidth(),o.height=t.outerHeight()),e.includeMargin&&(s=gt(t),o.left-=s.left,o.top-=s.top,o.height+=s.top+s.bottom,o.width+=s.left+s.right),o},k=function(t,e){var n,r,o,i,u;for(i=t.get(0).attributes,u=[],r=0,o=i.length;o>r;r++)n=i[r],n.specified?u.push(e.attr(n.name,n.value)):u.push(void 0);return u},L=function(t,e){return t.find(e).addBack(e)},C=function(t){return 27===t.keyCode},b=function(t,e){return t.indexOf(e)>=0},m=function(t,e){var n;switch(n=t.attr(e)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},Ct=function(){var e,n,r,o,i,u;for(o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],e={},n=0,r=i.length;r>n;n++)u=i[n],o.hasOwnProperty(u)&&(e[u]=o[u]);return e},F=function(){var e,n,r,o,i,u;for(o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],e=w(o),n=0,r=i.length;r>n;n++)u=i[n],delete e[u];return e},dt=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},ht=function(t){var e;return e=ft(t.button)||0===t.button,e&&dt(t)},Vt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.Deferred(),n.resolve.apply(n,e),n},Xt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],Vt.apply(null,e).promise()},Wt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.Deferred(),n.reject.apply(n,e),n.promise()},st=function(t){return at(t)&&"resolved"===("function"==typeof t.state?t.state():void 0)},st=function(t){return at(t)&&"resolved"===("function"==typeof t.state?t.state():void 0)},ce=function(){return r.Deferred()},pe=function(){return ce().promise()},Pt=function(){return r()},Bt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.when.apply(r,[Vt()].concat(t.call(e))),n.resolve=bt(function(){return x(e,function(t){return t.resolve()})}),n},ee=function(t,e){var n,r,o;r=[];for(n in e)o=e[n],nt(t.attr(n))?r.push(t.attr(n,o)):r.push(void 0);return r},zt=function(t,e){var n;return n=t.indexOf(e),n>=0?(t.splice(n,1),e):void 0},kt=function(t){var e,n,o,i,u,a,s;for(u={},s=[],n=[],o=0,i=t.length;i>o;o++)a=t[o],ct(a)?s.push(a):n.push(a);return u.parsed=n,s.length&&(e=s.join(", "),u.parsed.push(e)),u.select=function(){return u.find(void 0)},u.find=function(t){var e,n,o,i,a,s;for(n=Pt(),a=u.parsed,o=0,i=a.length;i>o;o++)s=a[o],e=t?t.find(s):r(s),n=n.add(e);return n},u.findWithSelf=function(t){var e;return e=u.find(t),u.doesMatch(t)&&(e=e.add(t)),e},u.doesMatch=function(t){var e;return e=r(t),c(u.parsed,function(t){return e.is(t)})},u.seekUp=function(t){var e,n,o;for(o=r(t),e=o,n=void 0;e.length;){if(u.doesMatch(e)){n=e;break}e=e.parent()}return n||Pt()},u},O=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],Y(n)?n.apply(null,e):n},h=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m;return null==e&&(e={}),h=void 0,p=function(){return O(e.size)},o=function(){return O(e.expiry)},f=function(t){return e.key?e.key(t):t.toString()},u=function(){return 0!==p()&&0!==o()},r=function(){return h={}},r(),l=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],e.logPrefix?(n[0]="["+e.logPrefix+"] "+n[0],up.puts.apply(up,n)):void 0},s=function(){return Object.keys(h)},c=function(){var t,e,n,r;return r=w(s()),t=p(),t&&r.length>=t&&(e=null,n=null,x(r,function(t){var r,o;return r=h[t],o=r.timestamp,!n||n>o?(e=t,n=o):void 0}),e)?delete h[e]:void 0},n=function(t,e){var n;return n=i(t,{silent:!0}),J(n)?d(e,n):void 0},m=function(){return(new Date).valueOf()},d=function(t,e){var n;return u()?(c(),n=f(t),h[n]={timestamp:m(),value:e}):void 0},zt=function(t){var e;return e=f(t),delete h[e]},a=function(t){var e,n;return e=o(),e?(n=m()-t.timestamp,e>n):!0},i=function(t,e){var n,r;return null==e&&(e={}),r=f(t),(n=h[r])?a(n)?(e.silent||l("Cache hit for '%s'",t),n.value):(e.silent||l("Discarding stale cache entry for '%s'",t),void zt(t)):void(e.silent||l("Cache miss for '%s'",t))},{alias:n,get:i,set:d,remove:zt,clear:r,keys:s}},y=function(t){var e;return e=Ft(t),Object.preventExtensions(e),e},Ft=function(t){var e;return null==t&&(t={}),e={},e.reset=function(){var n;return n=t,Y(n)&&(n=n()),f(e,n)},e.reset(),e},fe=function(t){var e,n;return t=se(t),e=t.parentNode,n=ue(t.childNodes),x(n,function(n){return e.insertBefore(n,t)}),e.removeChild(t)},xt=function(t){var e,n;for(e=void 0;(t=t.parent())&&t.length;)if(n=t.css("position"),"absolute"===n||"relative"===n||t.is("body")){e=t;break}return e},X=function(t){var e,n;for(e=r(t);;){if(n=e.css("position"),"fixed"===n)return!0;if(e=e.parent(),0===e.length||e.is(document))return!1}},M=function(t,e){var n,o,i,u;return n=r(t),o=xt(n),i=n.position(),u=o.offset(),n.css({position:"absolute",left:i.left-u.left,top:i.top-u.top+e.scrollTop(),right:"",bottom:""})},qt=function(t){var e,n,r,o,i,u,a;if(G(t))return up.fail("Cannot convert FormData into an array");for(u=Qt(t),e=[],a=u.split("&"),n=0,r=a.length;r>n;n++)i=a[n],ut(i)&&(o=i.split("="),e.push({name:decodeURIComponent(o[0]),value:decodeURIComponent(o[1])}));return e},Qt=function(t){var e;return G(t)?up.fail("Cannot convert FormData into a query string"):ut(t)?(e=r.param(t),e=e.replace(/\+/g,"%20")):""},Jt=function(t){var e,n;return e=r(t),n=e.find("input[type=file]").length,n&&up.browser.canFormData()?new FormData(e.get(0)):e.serializeArray()},p=function(t,e,n){var r;return G(t)?t.append(e,n):z(t)?t.push({name:e,value:n}):it(t)?t[e]=n:(ct(t)||nt(t))&&(r=Qt([{name:e,value:n}]),t=ut(t)?[t,r].join("&"):r),t},U=function(){var e,n,r,o,i,u;throw e=1<=arguments.length?t.call(arguments,0):[],z(e[0])?(r=e[0],u=e[1]||{}):(r=e,u={}),(o=up.log).error.apply(o,r),de().then(function(){return up.toast.open(r,u)}),n=(i=up.browser).sprintf.apply(i,r),new Error(n)},s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},D=function(t){return t.replace(/[&<>"]/g,function(t){return s[t]})},Mt=function(t,e){var n;return n=t[e],delete t[e],n},Ht=function(t,e){var n,o;return n=r(t),o=n.data(e),n.removeData(e),o},R=function(t){var e;return e=mt(t),tt(e)&&!et(e)?t.pop():{}},Ot=function(t){var e;return e=r(t).css("opacity"),Z(e)?parseFloat(e):void 0},de=bt(function(){var t;return r.isReady?Xt():(t=r.Deferred(),r(function(){return t.resolve()}),t.promise())}),K=function(t){return t},B=function(t){return t=se(t),!jQuery.contains(document.documentElement,t)},_t=function(e){var n,o;return n=r.Deferred(),o=function(){var r,o;return r=1<=arguments.length?t.call(arguments,0):[],o=e.apply(null,r),at(o)?o.then(function(){return n.resolve(o)}):n.resolve(o),o},o.promise=n.promise(),o},a=function(){function e(){this.asap=n(this.asap,this),this.poke=n(this.poke,this),this.allTasks=n(this.allTasks,this),this.promise=n(this.promise,this),this.reset=n(this.reset,this),this.reset()}return e.prototype.reset=function(){return this.queue=[],this.currentTask=void 0},e.prototype.promise=function(){var t;return t=vt(this.allTasks(),function(t){return t.promise}),r.when.apply(r,t)},e.prototype.allTasks=function(){var t;return t=[],this.currentTask&&t.push(this.currentTask),t=t.concat(this.queue)},e.prototype.poke=function(){var t;return!this.currentTask&&(this.currentTask=this.queue.shift())?(t=this.currentTask(),t.always(function(t){return function(){return t.currentTask=void 0,t.poke()}}(this))):void 0},e.prototype.asap=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],this.queue=vt(e,_t),this.poke()},e}(),re=function(t){var e;return e=r(t),e.is("[type=checkbox], [type=radio]")&&!e.is(":checked")?void 0:e.val()},te=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],function(){return vt(e,function(t){return t()})}},It=function(t){var e,n;return e=r.Deferred(),n=ne(t,function(){return e.resolve()}),e.cancel=function(){return clearTimeout(n)},e},I=function(t){var e,n,r,o;return e=yt(t),r=v(),n=e.left+.5*e.width,o=.5*r.width,o>n?"left":"right"},$=function(t,e){var n;return n=r("<div></div>"),n.insertAfter(t),t.detach(),n.replaceWith(e),t},N=function(t){var e,n,r,o;for(e=[],n=0,r=t.length;r>n;n++)o=t[n],z(o)?e=e.concat(o):e.push(o);return e},pt=function(t){return!!t},{isDetached:B,requestDataAsArray:qt,requestDataAsQuery:Qt,appendRequestData:p,requestDataFromForm:Jt,offsetParent:xt,fixedToAbsolute:M,isFixed:X,presentAttr:jt,createElement:S,parseUrl:Lt,normalizeUrl:Et,normalizeMethod:$t,createElementFromHtml:A,$createElementFromSelector:o,$createPlaceholder:i,selectorForElement:Zt,assign:f,assignPolyfill:d,copy:w,merge:wt,options:Ut,option:Rt,fail:U,each:x,map:vt,times:ie,any:c,all:l,detect:E,select:Yt,reject:Kt,intersect:W,compact:g,uniq:le,last:mt,isNull:rt,isDefined:J,isUndefined:ft,isGiven:Z,isMissing:nt,isPresent:ut,isBlank:q,presence:Nt,isObject:it,isFunction:Y,isString:ct,isNumber:ot,isElement:V,isJQuery:et,isPromise:at,isResolvedPromise:st,isDeferred:Q,isHash:tt,isArray:z,isFormData:G,isUnmodifiedKeyEvent:dt,isUnmodifiedMouseEvent:ht,nullJQuery:Pt,unJQuery:se,setTimer:ne,nextFrame:St,measure:yt,temporaryCss:oe,cssAnimate:T,finishCssAnimate:H,forceCompositing:j,forceRepaint:_,escapePressed:C,copyAttributes:k,findWithSelf:L,contains:b,toArray:ue,castedAttr:m,clientSize:v,only:Ct,except:F,trim:ae,unresolvableDeferred:ce,unresolvablePromise:pe,resolvedPromise:Xt,rejectedPromise:Wt,resolvedDeferred:Vt,resolvableWhen:Bt,setMissingAttrs:ee,remove:zt,memoize:bt,scrollbarWidth:Gt,documentHasVerticalScrollbar:P,config:y,openConfig:Ft,cache:h,unwrapElement:fe,multiSelector:kt,error:U,pluckData:Ht,pluckKey:Mt,extractOptions:R,isDetached:B,noop:Tt,opacity:Ot,whenReady:de,identity:K,escapeHtml:D,DivertibleChain:a,submittedValue:re,sequence:te,promiseTimer:It,previewable:_t,evalOption:O,horizontalScreenHalf:I,detachWith:$,flatten:N,isTruthy:pt}}($),up.fail=up.util.fail}.call(this),function(){up.protocol=function(t){var e,n,r,o,i,u;return u=up.util,r=function(t){return t.getResponseHeader(e.locationHeader)},i=function(t){return t.getResponseHeader(e.titleHeader)},o=function(t){return t.getResponseHeader(e.methodHeader)},n=u.memoize(function(){var t;return t=up.browser.popCookie(e.methodCookie),(t||"get").toLowerCase()}),e=u.config({targetHeader:"X-Up-Target",locationHeader:"X-Up-Location",validateHeader:"X-Up-Validate",titleHeader:"X-Up-Title",methodHeader:"X-Up-Method",methodCookie:"_up_method",methodParam:"_method"}),{config:e,locationFromXhr:r,titleFromXhr:i,methodFromXhr:o,initialRequestMethod:n}}(jQuery)}.call(this),function(){var slice=[].slice;up.browser=function($){var CONSOLE_PLACEHOLDERS,canCssTransition,canFormData,canInputEvent,canLogSubstitution,canPushState,hash,installPolyfills,isIE8OrWorse,isIE9OrWorse,isRecentJQuery,isSupported,loadPage,popCookie,puts,sessionStorage,setLocationHref,sprintf,sprintfWithFormattedArgs,stringifyArg,submitForm,u,url,whenConfirmed;return u=up.util,loadPage=function(t,e){var n,r,o,i,a;return null==e&&(e={}),i=u.option(e.method,"get").toLowerCase(),"get"===i?(a=u.requestDataAsQuery(e.data),a&&(t=t+"?"+a),setLocationHref(t)):(n=$("<form method='post' action='"+t+"' class='up-page-loader'></form>"),r=function(t){var e;return e=$('<input type="hidden">'),e.attr(t),e.appendTo(n)},r({name:up.protocol.config.methodParam,value:i}),(o=up.rails.csrfField())&&r(o),u.each(u.requestDataAsArray(e.data),r),n.hide().appendTo("body"),submitForm(n))},submitForm=function(t){return t.submit()},setLocationHref=function(t){return location.href=t},puts=function(){var t,e,n;return n=arguments[0],t=2<=arguments.length?slice.call(arguments,1):[],canLogSubstitution()?console[n].apply(console,t):(e=sprintf.apply(null,t),console[n](e))},CONSOLE_PLACEHOLDERS=/\%[odisf]/g,stringifyArg=function(t){var e,n,r,o,i,a,s,l,c;if(a=200,r="",u.isString(t))l=t.replace(/[\n\r\t ]+/g," "),l=l.replace(/^[\n\r\t ]+/,""),l=l.replace(/[\n\r\t ]$/,""),l='"'+l+'"',r='"';else if(u.isUndefined(t))l="undefined";else if(u.isNumber(t)||u.isFunction(t))l=t.toString();else if(u.isArray(t))l="["+u.map(t,stringifyArg).join(", ")+"]",r="]";else if(u.isJQuery(t))l="$("+u.map(t,stringifyArg).join(", ")+")",r=")";else if(u.isElement(t)){for(e=$(t),l="<"+t.tagName.toLowerCase(),s=["id","name","class"],o=0,i=s.length;i>o;o++)n=s[o],(c=e.attr(n))&&(l+=" "+n+'="'+c+'"');l+=">",r=">"}else l=JSON.stringify(t);return l.length>a&&(l=l.substr(0,a)+" \u2026",l+=r),l},sprintf=function(){var t,e;return e=arguments[0],t=2<=arguments.length?slice.call(arguments,1):[],sprintfWithFormattedArgs.apply(null,[u.identity,e].concat(slice.call(t)))},sprintfWithFormattedArgs=function(){var t,e,n,r;return e=arguments[0],r=arguments[1],t=3<=arguments.length?slice.call(arguments,2):[],u.isBlank(r)?"":(n=0,r.replace(CONSOLE_PLACEHOLDERS,function(){var r;return r=t[n],r=e(stringifyArg(r)),n+=1,r}))},url=function(){return location.href},isIE8OrWorse=u.memoize(function(){return u.isUndefined(document.addEventListener)}),isIE9OrWorse=u.memoize(function(){return isIE8OrWorse()||-1!==navigator.appVersion.indexOf("MSIE 9.")}),canPushState=u.memoize(function(){return u.isDefined(history.pushState)&&"get"===up.protocol.initialRequestMethod()}),canCssTransition=u.memoize(function(){return"transition"in document.documentElement.style}),canInputEvent=u.memoize(function(){return"oninput"in document.createElement("input")}),canFormData=u.memoize(function(){return!!window.FormData}),canLogSubstitution=u.memoize(function(){return!isIE9OrWorse()}),isRecentJQuery=u.memoize(function(){var t,e,n,r;return r=$.fn.jquery,n=r.split("."),t=parseInt(n[0]),e=parseInt(n[1]),t>=2||1===t&&e>=9}),popCookie=function(t){var e,n;return n=null!=(e=document.cookie.match(new RegExp(t+"=(\\w+)")))?e[1]:void 0,u.isPresent(n)&&(document.cookie=t+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},whenConfirmed=function(t){return t.preload||u.isBlank(t.confirm)||window.confirm(t.confirm)?u.resolvedPromise():u.unresolvablePromise()},isSupported=function(){return!isIE8OrWorse()&&isRecentJQuery()},installPolyfills=function(){var t,e,n,r;for(null==window.console&&(window.console={}),r=["debug","info","warn","error","group","groupCollapsed","groupEnd"],t=0,e=r.length;e>t;t++)n=r[t],null==console[n]&&(console[n]=function(){var t;return t=1<=arguments.length?slice.call(arguments,0):[],puts.apply(null,["log"].concat(slice.call(t)))});return null!=console.log?console.log:console.log=u.noop},sessionStorage=u.memoize(function(){return window.sessionStorage||{getItem:u.noop,setItem:u.noop,removeItem:u.noop}}),hash=function(t){return t||(t=location.hash),t||(t=""),"#"===t[0]&&(t=t.substr(1)),u.presence(t)},{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),url:url,loadPage:loadPage,whenConfirmed:whenConfirmed,canPushState:canPushState,canCssTransition:canCssTransition,canInputEvent:canInputEvent,canFormData:canFormData,canLogSubstitution:canLogSubstitution,isSupported:isSupported,installPolyfills:installPolyfills,puts:puts,sprintf:sprintf,sprintfWithFormattedArgs:sprintfWithFormattedArgs,sessionStorage:sessionStorage,popCookie:popCookie,hash:hash}}(jQuery)}.call(this),function(){var slice=[].slice;up.bus=function($){var boot,consumeAction,emit,emitReset,forgetUpDescription,haltEvent,live,liveUpDescriptions,logEmission,nextUpDescriptionNumber,nobodyPrevents,onEscape,rememberUpDescription,restoreSnapshot,snapshot,u,unbind,upDescriptionNumber,upDescriptionToJqueryDescription,upListenerToJqueryListener,whenEmitted;return u=up.util,liveUpDescriptions={},nextUpDescriptionNumber=0,upListenerToJqueryListener=function(t){return function(e){var n;return n=e.$element||$(this),t.apply(n.get(0),[e,n,up.syntax.data(n)])}},upDescriptionToJqueryDescription=function(t,e){var n,r,o;return n=u.copy(t),o=n.pop(),r=void 0,e?(r=upListenerToJqueryListener(o),o._asJqueryListener=r,o._descriptionNumber=++nextUpDescriptionNumber):(r=o._asJqueryListener,r||up.fail("up.off: The event listener %o was never registered through up.on")),n.push(r),n},live=function(){var t,e,n;return n=1<=arguments.length?slice.call(arguments,0):[],up.browser.isSupported()?(t=upDescriptionToJqueryDescription(n,!0),rememberUpDescription(n),(e=$(document)).on.apply(e,t),function(){return unbind.apply(null,n)}):function(){}},unbind=function(){var t,e,n;return n=1<=arguments.length?slice.call(arguments,0):[],t=upDescriptionToJqueryDescription(n,!1),forgetUpDescription(n),(e=$(document)).off.apply(e,t)},rememberUpDescription=function(t){var e;return e=upDescriptionNumber(t),liveUpDescriptions[e]=t},forgetUpDescription=function(t){var e;return e=upDescriptionNumber(t),delete liveUpDescriptions[e]},upDescriptionNumber=function(t){return u.last(t)._descriptionNumber},emit=function(t,e){var n,r;return null==e&&(e={}),r=$.Event(t,e),(n=e.$element)?delete e.$element:n=$(document),logEmission(t,e),n.trigger(r),r},logEmission=function(t,e){var n,r,o;return e.hasOwnProperty("message")?(n=e.message,delete e.message,n!==!1&&(u.isArray(n)?(o=n,n=o[0],r=2<=o.length?slice.call(o,1):[]):r=[],n)?u.isPresent(e)?up.puts.apply(up,[n+" (%s (%o))"].concat(slice.call(r),[t],[e])):up.puts.apply(up,[n+" (%s)"].concat(slice.call(r),[t])):void 0):u.isPresent(e)?up.puts("Emitted event %s (%o)",t,e):up.puts("Emitted event %s",t)},nobodyPrevents=function(){var t,e;return t=1<=arguments.length?slice.call(arguments,0):[],e=emit.apply(null,t),e.isDefaultPrevented()?(up.puts("An observer prevented the event %s",t[0]),!1):!0},whenEmitted=function(){var t,e;return t=1<=arguments.length?slice.call(arguments,0):[],e=$.Deferred(),nobodyPrevents.apply(null,t)&&e.resolve(),e.promise()},onEscape=function(t){return live("keydown","body",function(e){return u.escapePressed(e)?t(e):void 0})},haltEvent=function(t){return t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault()},consumeAction=function(t){return haltEvent(t),"up:action:consumed"!==t.type?emit("up:action:consumed",{$element:$(t.target),message:!1}):void 0},snapshot=function(){var t,e,n,r;for(r=[],e=0,n=liveUpDescriptions.length;n>e;e++)t=liveUpDescriptions[e],r.push(t.isDefault=!0);return r},restoreSnapshot=function(){var t,e,n,r,o;for(e=u.reject(liveUpDescriptions,function(t){return t.isDefault}),o=[],n=0,r=e.length;r>n;n++)t=e[n],o.push(unbind.apply(null,t));return o},emitReset=function(){return emit("up:framework:reset",{message:"Resetting framework"})},boot=function(){return up.browser.isSupported()?(up.browser.installPolyfills(),emit("up:framework:boot",{message:"Booting framework"}),emit("up:framework:booted",{message:"Framework booted"}),u.nextFrame(function(){return u.whenReady().then(function(){return emit("up:app:boot",{message:"Booting user application"}),emit("up:app:booted",{message:"User application booted"})})})):void 0},live("up:framework:booted",snapshot),live("up:framework:reset",restoreSnapshot),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),on:live,off:unbind,emit:emit,nobodyPrevents:nobodyPrevents,whenEmitted:whenEmitted,onEscape:onEscape,emitReset:emitReset,haltEvent:haltEvent,consumeAction:consumeAction,boot:boot}}(jQuery),up.on=up.bus.on,up.off=up.bus.off,up.emit=up.bus.emit,up.reset=up.bus.emitReset,up.boot=up.bus.boot}.call(this),function(){var t=[].slice;up.log=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v;return m=up.util,r=up.browser,n="up.log.enabled",o=m.config({prefix:"[UP] ",enabled:"true"===r.sessionStorage().getItem(n),collapse:!1}),d=function(){return o.reset()},c=function(t){return""+o.prefix+t},i=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],o.enabled&&n?r.puts.apply(r,["debug",c(n)].concat(t.call(e))):void 0},f=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],o.enabled&&n?r.puts.apply(r,["log",c(n)].concat(t.call(e))):void 0},v=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n?r.puts.apply(r,["warn",c(n)].concat(t.call(e))):void 0},l=function(){var e,n,i,u;if(i=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n=e.pop(),!o.enabled||!i)return n();u=o.collapse?"groupCollapsed":"group",r.puts.apply(r,[u,c(i)].concat(t.call(e)));try{return n()}finally{i&&r.puts("groupEnd")}},s=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n?r.puts.apply(r,["error",c(n)].concat(t.call(e))):void 0},p=function(){var t;return t=" __ _____ ___ ___ / /_ __\n"+("/ // / _ \\/ _ \\/ _ \\/ / // / "+up.version+"\n")+"\\___/_//_/ .__/\\___/_/\\_. / \n / / / /\n\n",t+=o.enabled?"Call `up.log.disable()` to disable logging for this session.":"Call `up.log.enable()` to enable logging for this session.",r.puts("log",t)},up.on("up:framework:boot",p),up.on("up:framework:reset",d),h=function(t){return r.sessionStorage().setItem(n,t.toString()),o.enabled=t},a=function(){return h(!0)},u=function(){return h(!1)},{puts:f,debug:i,error:s,warn:v,group:l,config:o,enable:a,disable:u}}(jQuery),up.puts=up.log.puts}.call(this),function(){var t=[].slice;up.toast=function(e){var n,r,o,i,u,a,s,l,c,p;return p=up.util,o=up.browser,n=function(t){return"<span class='up-toast-variable'>"+p.escapeHtml(t)+"</span>"},c=p.config({$toast:null}),l=function(){return i(),c.reset()},a=function(e){return p.isArray(e)?(e[0]=p.escapeHtml(e[0]),e=o.sprintfWithFormattedArgs.apply(o,[n].concat(t.call(e)))):e=p.escapeHtml(e),e},u=function(){return!!c.$toast},r=function(t,n,r){var o;return o=e('<span class="up-toast-action"></span>').text(n),o.on("click",r),o.appendTo(t)},s=function(t,n){var o,u,s,l;return null==n&&(n={}),i(),s=e('<div class="up-toast"></div>').prependTo("body"),u=e('<div class="up-toast-message"></div>').appendTo(s),o=e('<div class="up-toast-actions"></div>').appendTo(s),t=a(t),u.html(t),(l=n.action||n.inspect)&&r(o,l.label,l.callback),r(o,"Close",i),c.$toast=s},i=function(){return u()?(c.$toast.remove(),c.$toast=null):void 0},up.on("up:framework:reset",l),{open:s,close:i,reset:l,isOpen:u}}(jQuery)}.call(this),function(){var t=[].slice;up.syntax=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y;return y=up.util,n="up-destructible",r="up-destructors",c=[],m=[],l=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[c].concat(t.call(e)))},h=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[m].concat(t.call(e)))},u=function(){var e,n,r,o;return o=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n=e.pop(),r=y.options(e[0],{priority:0}),"first"===r.priority?r.priority=Number.POSITIVE_INFINITY:"last"===r.priority&&(r.priority=Number.NEGATIVE_INFINITY),{selector:o,callback:n,priority:r.priority,batch:r.batch,keep:r.keep}},d=function(){var e,n,r,o,i;if(i=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()){for(r=u.apply(null,e),n=0;(o=i[n])&&o.priority>=r.priority;)n+=1;return i.splice(n,0,r)}},i=function(t,e,n){var r,i,u,a,s,l,c;for(up.puts(t.isDefault?void 0:"Compiling '%s' on %o",t.selector,n),t.keep&&(c=y.isString(t.keep)?t.keep:"",e.attr("up-keep",c)),l=t.callback.apply(n,[e,p(e)]),a=f(l),s=[],i=0,u=a.length;u>i;i++)r=a[i],s.push(o(e,r));return s},f=function(t){return y.isFunction(t)?[t]:y.isArray(t)&&y.all(t,y.isFunction)?t:[]},o=function(t,e){var o;return t.addClass(n),o=t.data(r)||[],o.push(e),t.data(r,o)},s=function(t,n){var r;return n=y.options(n),r=e(n.skip),up.log.group("Compiling fragment %o",t.get(0),function(){var n,o,u,a,s,p;for(s=[m,c],p=[],o=0,u=s.length;u>o;o++)a=s[o],p.push(function(){var o,u,s;for(s=[],o=0,u=a.length;u>o;o++)l=a[o],n=y.findWithSelf(t,l.selector),n=n.filter(function(){var t;return t=e(this),y.all(r,function(e){return 0===t.closest(e).length})}),n.length?s.push(up.log.group(l.isDefault?void 0:"Compiling '%s' on %d element(s)",l.selector,n.length,function(){return l.batch?i(l,n,n.get()):n.each(function(){return i(l,e(this),this)})})):s.push(void 0);return s}());return p})},a=function(t){return y.findWithSelf(t,"."+n).each(function(){var t,o,i,u,a;if(t=e(this),i=t.data(r)){for(u=0,a=i.length;a>u;u++)(o=i[u])();return t.removeData(r),t.removeClass(n)}})},p=function(t){var n,r;return n=e(t),r=n.attr("up-data"),y.isString(r)&&""!==y.trim(r)?JSON.parse(r):{}},g=function(){var t;return t=function(t){return t.isDefault=!0},y.each(c,t),y.each(m,t)},v=function(){var t;return t=function(t){return t.isDefault},c=y.select(c,t),m=y.select(m,t)},up.on("up:framework:booted",g),up.on("up:framework:reset",v),{compiler:l,macro:h,compile:s,clean:a,data:p}}(jQuery),up.compiler=up.syntax.compiler,up.macro=up.syntax.macro}.call(this),function(){up.history=function(t){var e,n,r,o,i,u,a,s,l,c,p,f,d,h,m,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,u=void 0,h=function(){return n.reset(),c=void 0,u=void 0},a=function(t,e){return e||(e={}),e.hash=!0,v.normalizeUrl(t,e)},r=function(t){return a(up.browser.url(),t)},o=function(t){var e;return e={stripTrailingSlash:!0
2
+ },a(t,e)===r(e)},s=function(t){return u&&(c=u,u=void 0),u=t},d=function(t){return i("replaceState",t)},p=function(t,e){return e=v.options(e,{force:!1}),t=a(t),!e.force&&o(t)||!up.bus.nobodyPrevents("up:history:push",{url:t,message:"Adding history entry for "+t})?void 0:(i("pushState",t),up.emit("up:history:pushed",{url:t,message:"Advanced to location "+t}))},i=function(t,n){var o;return up.browser.canPushState()?(o=e(),window.history[t](o,"",n),s(r())):up.fail("This browser doesn't support history."+t)},e=function(){return{fromUp:!0}},m=function(t){var e;return(null!=t?t.fromUp:void 0)?(e=r(),up.log.group("Restoring URL %s",e,function(){var t,o;return t=n.popTargets.join(", "),o=up.replace(t,e,{history:!1,title:!0,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll}),o.then(function(){return e=r(),up.emit("up:history:restored",{url:e,message:"Restored location "+e})})})):up.puts("Ignoring a state not pushed by Unpoly (%o)",t)},l=function(t){var e;return s(r()),up.layout.saveScroll({url:c}),e=t.originalEvent.state,m(e)},up.browser.canPushState()&&(f=function(){return t(window).on("popstate",l),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(t){return v.isPresent(c)?(v.setMissingAttrs(t,{"up-href":c,"up-restore-scroll":""}),t.removeAttr("up-back"),up.link.makeFollowable(t)):void 0}),up.on("up:framework:reset",h),{config:n,push:p,replace:d,url:r,isUrl:o,previousUrl:function(){return c},normalizeUrl:a}}(jQuery)}.call(this),function(){var slice=[].slice;up.layout=function($){var SCROLL_PROMISE_KEY,anchoredRight,config,finishScrolling,firstHashTarget,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,revealHash,revealOrRestoreScroll,saveScroll,scroll,scrollTops,u,viewportOf,viewportSelector,viewports,viewportsWithin;return u=up.util,config=u.config({duration:0,viewports:[document,".up-modal-viewport","[up-viewport]"],fixedTop:["[up-fixed~=top]"],fixedBottom:["[up-fixed~=bottom]"],anchoredRight:["[up-anchored~=right]","[up-fixed~=top]","[up-fixed~=bottom]","[up-fixed~=right]"],snap:50,substance:150,easing:"swing"}),lastScrollTops=u.cache({size:30,key:up.history.normalizeUrl}),reset=function(){return config.reset(),lastScrollTops.clear()},SCROLL_PROMISE_KEY="up-scroll-promise",scroll=function(t,e,n){var r,o,i,a,s;return r=$(t),n=u.options(n),i=u.option(n.duration,config.duration),a=u.option(n.easing,config.easing),finishScrolling(r),i>0?(o=$.Deferred(),r.data(SCROLL_PROMISE_KEY,o),o.then(function(){return r.removeData(SCROLL_PROMISE_KEY),r.finish()}),s={scrollTop:e},r.get(0)===document&&(r=$("html, body")),r.animate(s,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(e),u.resolvedDeferred())},finishScrolling=function(t){return $(t).each(function(){var t;return(t=$(this).data(SCROLL_PROMISE_KEY))?t.resolve():void 0})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var t,e,n,r;return n=function(t,e){var n,r;return n=$(t),r=n.css(e),u.isPresent(r)||up.fail("Fixed element %o must have a CSS attribute %s",n.get(0),e),parseFloat(r)+n.height()},e=function(){var t,e,o,i;for(o=$(config.fixedTop.join(", ")),i=[],t=0,e=o.length;e>t;t++)r=o[t],i.push(n(r,"top"));return i}(),t=function(){var t,e,o,i;for(o=$(config.fixedBottom.join(", ")),i=[],t=0,e=o.length;e>t;t++)r=o[t],i.push(n(r,"bottom"));return i}(),{top:Math.max.apply(Math,[0].concat(slice.call(e))),bottom:Math.max.apply(Math,[0].concat(slice.call(t)))}},reveal=function(t,e){var n,r,o,i,a,s,l,c,p,f,d,h,m,v;return n=$(t),up.puts("Revealing fragment %o",t.get(0)),e=u.options(e),r=e.viewport?$(e.viewport):viewportOf(n),h=u.option(e.snap,config.snap),v=r.is(document),m=v?u.clientSize().height:r.outerHeight(),p=r.scrollTop(),s=p,c=void 0,l=void 0,v?(l=measureObstruction(),c=0):(l={top:0,bottom:0},c=p),f=function(){return s+l.top},d=function(){return s+m-l.bottom-1},o=u.measure(n,{relative:r,includeMargin:!0}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(s+=a-d()),(i<f()||e.top)&&(s=i-l.top),h>s&&o.top<.5*m&&(s=0),s!==p?scroll(r,s,e):u.resolvedDeferred()},revealHash=function(){var t,e;return(e=up.browser.hash())?(t=firstHashTarget(e))?reveal(t):u.rejectedPromise():u.resolvedPromise()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(t,e){var n,r;return null==e&&(e={}),n=$(t),r=viewportSelector().seekUp(n),0===r.length&&e.strict!==!1&&up.fail("Could not find viewport for %o",n),r},viewportsWithin=function(t){var e;return e=$(t),viewportSelector().findWithSelf(e)},viewports=function(){return viewportSelector().select()},scrollTops=function(){var t,e,n,r,o,i,u;for(i={},o=config.viewports,e=0,r=o.length;r>e;e++)u=o[e],t=$(u),t.length&&(n=u,u===document&&(n="document"),i[n]=t.scrollTop());return i},fixedChildren=function(t){var e,n;return null==t&&(t=void 0),t||(t=document.body),n=$(t),e=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(e=e.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(e=e.add(n.find(config.fixedBottom.join(", ")))),e},saveScroll=function(t){var e,n;return null==t&&(t={}),n=u.option(t.url,up.history.url()),e=u.option(t.tops,scrollTops()),up.puts("Saving scroll positions for URL %s (%o)",n,e),lastScrollTops.set(n,e)},restoreScroll=function(t){var e,n,r,o,i;return null==t&&(t={}),i=up.history.url(),r=void 0,t.around?(n=viewportsWithin(t.around),e=viewportOf(t.around),r=e.add(n)):r=viewports(),o=lastScrollTops.get(i),up.log.group("Restoring scroll positions for URL %s to %o",i,o,function(){var t,e,n,i;for(e in o)i=o[e],n="document"===e?document:e,t=r.filter(n),scroll(t,i,{duration:0});return u.resolvedDeferred()})},revealOrRestoreScroll=function(t,e){var n,r,o,i;return n=$(t),e.restoreScroll?restoreScroll({around:n}):e.reveal?(i={},e.source&&(o=u.parseUrl(e.source),(r=firstHashTarget(o.hash))&&(n=r,i.top=!0)),reveal(n,i)):u.resolvedDeferred()},firstHashTarget=function(t){return(t=up.browser.hash(t))?up.first("[id='"+t+"'], a[name='"+t+"']"):void 0},up.on("up:app:booted",revealHash),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,revealHash:revealHash,firstHashTarget:firstHashTarget,scroll:scroll,finishScrolling:finishScrolling,config:config,viewportOf:viewportOf,viewportsWithin:viewportsWithin,viewports:viewports,scrollTops:scrollTops,saveScroll:saveScroll,restoreScroll:restoreScroll,revealOrRestoreScroll:revealOrRestoreScroll,anchoredRight:anchoredRight,fixedChildren:fixedChildren}}(jQuery),up.scroll=up.layout.scroll,up.reveal=up.layout.reveal,up.revealHash=up.layout.revealHash}.call(this),function(){up.dom=function($){var autofocus,bestMatchingSteps,bestPreflightSelector,config,destroy,emitFragmentInserted,emitFragmentKept,extract,filterScripts,findKeepPlan,first,firstInLayer,firstInPriority,hello,isRealElement,layerOf,matchesLayer,parseResponse,processResponse,reload,replace,reset,resolveSelector,setSource,shouldExtractTitle,source,swapBody,swapElements,transferKeepableElements,u,updateHistoryAndTitle;return u=up.util,config=u.config({fallbacks:["body"],fallbackTransition:"none",runInlineScripts:!0,runLinkedScripts:!1}),reset=function(){return config.reset()},setSource=function(t,e){var n;return n=$(t),u.isPresent(e)&&(e=u.normalizeUrl(e)),n.attr("up-source",e)},source=function(t){var e;return e=$(t).closest("[up-source]"),u.presence(e.attr("up-source"))||up.browser.url()},resolveSelector=function(t,e){var n,r;return u.isString(t)?(r=t,u.contains(r,"&")&&(u.isPresent(e)?(n=u.selectorForElement(e),r=r.replace(/\&/,n)):up.fail("Found origin reference (%s) in selector %s, but no origin was given","&",r))):r=u.selectorForElement(t),r},replace=function(t,e,n){var r,o,i,a,s,l,c,p;return n=u.options(n),up.browser.canPushState()||n.history===!1?(n.inspectResponse=function(){return up.browser.loadPage(e,u.only(n,"method","data"))},c=u.merge(n,{humanizedTarget:"target"}),o=u.merge(n,{humanizedTarget:"failure target",provideTarget:void 0}),p=bestPreflightSelector(t,c),r=bestPreflightSelector(n.failTarget,o),l={url:e,method:n.method,data:n.data,target:p,failTarget:r,cache:n.cache,preload:n.preload,headers:n.headers,timeout:n.timeout},a=function(t,n,r){return processResponse(!0,p,e,l,r,c)},i=function(t,n,i){var a,s;return s=function(){return u.rejectedPromise(t,n,i)},t.responseText?(a=processResponse(!1,r,e,l,t,o),a.then(s,s)):s()},s=up.ajax(l),s=s.then(a,i)):(n.preload||up.browser.loadPage(e,u.only(n,"method","data")),u.unresolvablePromise())},processResponse=function(t,e,n,r,o,i){var a,s,l,c,p;return i.method=u.normalizeMethod(u.option(up.protocol.methodFromXhr(o),i.method)),a="GET"===i.method,(p=up.protocol.locationFromXhr(o))?(n=p,t&&up.proxy.isCachable(r)&&(s={url:n,method:up.protocol.methodFromXhr(o),target:e},up.proxy.alias(r,s))):a&&(l=u.requestDataAsQuery(i.data))&&(n=n+"?"+l),t?a?(i.history===!1||u.isString(i.history)||(i.history=n),i.source===!1||u.isString(i.source)||(i.source=n)):(u.isString(i.history)||(i.history=!1),u.isString(i.source)||(i.source="keep")):(i.transition=i.failTransition,i.failTransition=void 0,a?(i.history!==!1&&(i.history=n),i.source!==!1&&(i.source=n)):(i.source="keep",i.history=!1)),shouldExtractTitle(i)&&(c=up.protocol.titleFromXhr(o))&&(i.title=c),i.preload?u.resolvedPromise():extract(e,o.responseText,i)},shouldExtractTitle=function(t){return!(t.title===!1||u.isString(t.title)||t.history===!1&&t.title!==!0)},extract=function(t,e,n){return up.log.group("Extracting %s from %d bytes of HTML",t,null!=e?e.length:void 0,function(){var r,o,i,a,s,l,c;for(n=u.options(n,{historyMethod:"push",requireMatch:!0,keep:!0,layer:"auto"}),n.saveScroll!==!1&&up.layout.saveScroll(),"function"==typeof n.provideTarget&&n.provideTarget(),a=parseResponse(e),o=bestMatchingSteps(t,a,n),shouldExtractTitle(n)&&(s=a.title())&&(n.title=s),updateHistoryAndTitle(n),c=[],r=0,i=o.length;i>r;r++)l=o[r],up.log.group("Updating %s",l.selector,function(){var t;return filterScripts(l.$new,n),t=swapElements(l.$old,l.$new,l.pseudoClass,l.transition,n),c.push(t),n.reveal=!1});return $.when.apply($,c)})},bestPreflightSelector=function(t,e){var n;return n=new up.dom.ExtractCascade(t,e),n.bestPreflightSelector()},bestMatchingSteps=function(t,e,n){var r;return n=u.merge(n,{response:e}),r=new up.dom.ExtractCascade(t,n),r.bestMatchingSteps()},filterScripts=function(t,e){var n,r,o,i,a,s,l,c,p,f;for(c=u.option(e.runInlineScripts,config.runInlineScripts),p=u.option(e.runLinkedScripts,config.runLinkedScripts),r=u.findWithSelf(t,"script"),l=[],o=0,s=r.length;s>o;o++)f=r[o],n=$(f),a=u.isPresent(n.attr("src")),i=!a,a&&p||i&&c?l.push(void 0):l.push(n.remove());return l},parseResponse=function(t){var e;return e=u.createElementFromHtml(t),{title:function(){var t;return null!=(t=e.querySelector("title"))?t.textContent:void 0},first:function(t){var n;return(n=$.find(t,e)[0])?$(n):void 0}}},updateHistoryAndTitle=function(t){return t=u.options(t,{historyMethod:"push"}),t.history&&up.history[t.historyMethod](t.history),u.isString(t.title)?document.title=t.title:void 0},swapElements=function(t,e,n,r,o){var i,a,s,l;return r||(r="none"),"keep"===o.source&&(o=u.merge(o,{source:source(t)})),up.motion.finish(t),n?(i=e.contents().wrapAll('<div class="up-insertion"></div>').parent(),"before"===n?t.prepend(i):t.append(i),hello(i.children(),o),s=up.layout.revealOrRestoreScroll(i,o),s=s.then(function(){return up.animate(i,r,o)}),s=s.then(function(){return u.unwrapElement(i)})):(a=findKeepPlan(t,e,o))?(emitFragmentKept(a),s=u.resolvedPromise()):(l=function(){return o.keepPlans=transferKeepableElements(t,e,o),t.is("body")?(swapBody(t,e),r=!1):e.insertBefore(t),o.source!==!1&&setSource(e,o.source),autofocus(e),hello(e,o),up.morph(t,e,r,o)},s=destroy(t,{animation:l})),s},swapBody=function(t,e){return t.replaceWith(e)},transferKeepableElements=function(t,e,n){var r,o,i,a,s,l,c,p;if(a=[],n.keep)for(p=t.find("[up-keep]"),i=0,l=p.length;l>i;i++)s=p[i],r=$(s),(c=findKeepPlan(r,e,u.merge(n,{descendantsOnly:!0})))&&(o=r.clone(),up.util.detachWith(r,o),c.$newElement.replaceWith(r),a.push(c));return a},findKeepPlan=function(t,e,n){var r,o,i,a,s;return n.keep&&(r=t,(a=u.castedAttr(r,"up-keep"))&&(u.isString(a)||(a="&"),a=resolveSelector(a,r),o=n.descendantsOnly?e.find(a):u.findWithSelf(e,a),o=o.first(),o.length&&o.is("[up-keep]")&&(s={$element:r,$newElement:o,newData:up.syntax.data(o)},i=u.merge(s,{message:["Keeping element %o",r.get(0)]}),up.bus.nobodyPrevents("up:fragment:keep",i))))?s:void 0},hello=function(t,e){var n,r,o,i,a,s;for(n=$(t),e=u.options(e,{keepPlans:[]}),o=[],s=e.keepPlans,r=0,i=s.length;i>r;r++)a=s[r],emitFragmentKept(a),o.push(a.$element);return up.syntax.compile(n,{skip:o}),emitFragmentInserted(n,e),n},emitFragmentInserted=function(t,e){var n;return n=$(t),up.emit("up:fragment:inserted",{$element:n,message:["Inserted fragment %o",n.get(0)],origin:e.origin})},emitFragmentKept=function(t){var e;return e=u.merge(t,{message:["Kept fragment %o",t.$element.get(0)]}),up.emit("up:fragment:kept",e)},autofocus=function(t){var e,n;return n="[autofocus]:last",e=u.findWithSelf(t,n),e.length&&e.get(0)!==document.activeElement?e.focus():void 0},isRealElement=function(t){var e;return e=".up-ghost, .up-destroying",0===t.closest(e).length},first=function(t,e){var n;return e=u.options(e,{layer:"auto"}),n=resolveSelector(t,e.origin),"auto"===e.layer?firstInPriority(n,e.origin):firstInLayer(n,e.layer)},firstInPriority=function(t,e){var n,r,o,i,a,s;for(i=["popup","modal","page"],n=void 0,u.isPresent(e)&&(s=layerOf(e),u.remove(i,s),i.unshift(s)),r=0,a=i.length;a>r&&(o=i[r],!(n=firstInLayer(t,o)));r++);return n},firstInLayer=function(t,e){var n,r,o,i,u,a;for(r=$(t),o=void 0,u=0,a=r.length;a>u;u++)if(i=r[u],n=$(i),isRealElement(n)&&matchesLayer(n,e)){o=n;break}return o},layerOf=function(t){var e;return e=$(t),up.popup.contains(e)?"popup":up.modal.contains(e)?"modal":"page"},matchesLayer=function(t,e){return layerOf(t)===e},destroy=function(t,e){var n,r,o,i,a;return n=$(t),n.is(".up-placeholder, .up-tooltip, .up-modal, .up-popup")||(i=["Destroying fragment %o",n.get(0)],a=["Destroyed fragment %o",n.get(0)]),0===n.length?u.resolvedDeferred():up.bus.nobodyPrevents("up:fragment:destroy",{$element:n,message:i})?(e=u.options(e,{animation:!1}),r=up.motion.animateOptions(e),n.addClass("up-destroying"),updateHistoryAndTitle(e),o=u.presence(e.animation,u.isDeferred)||up.motion.animate(n,e.animation,r),o.then(function(){return up.syntax.clean(n),up.emit("up:fragment:destroyed",{$element:n,message:a}),n.remove()}),o):$.Deferred()},reload=function(t,e){var n;return e=u.options(e,{cache:!1}),n=e.url||source(t),replace(t,n,e)},up.on("up:app:boot",function(){var t;return t=$(document.body),setSource(t,up.browser.url()),hello(t)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),replace:replace,reload:reload,destroy:destroy,extract:extract,first:first,source:source,resolveSelector:resolveSelector,hello:hello,config:config}}(jQuery),up.replace=up.dom.replace,up.extract=up.dom.extract,up.reload=up.dom.reload,up.destroy=up.dom.destroy,up.first=up.dom.first,up.hello=up.dom.hello,up.renamedModule("flow","dom")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};t=up.util,up.dom.ExtractCascade=function(){function n(n,r){this.oldPlanNotFound=e(this.oldPlanNotFound,this),this.matchingPlanNotFound=e(this.matchingPlanNotFound,this),this.bestMatchingSteps=e(this.bestMatchingSteps,this),this.bestPreflightSelector=e(this.bestPreflightSelector,this),this.detectPlan=e(this.detectPlan,this),this.matchingPlan=e(this.matchingPlan,this),this.newPlan=e(this.newPlan,this),this.oldPlan=e(this.oldPlan,this),this.options=t.options(r,{humanizedTarget:"selector",layer:"auto"}),this.candidates=this.buildCandidates(n),this.plans=t.map(this.candidates,function(e){return function(n,r){var o;return o=t.copy(e.options),r>0&&(o.transition=up.dom.config.fallbackTransition),new up.dom.ExtractPlan(n,o)}}(this))}return n.prototype.buildCandidates=function(e){var n;return n=[e,this.options.fallback,up.dom.config.fallbacks],n=t.flatten(n),n=t.select(n,t.isTruthy),(this.options.fallback===!1||this.options.provideTarget)&&(n=[n[0]]),n},n.prototype.oldPlan=function(){return this.detectPlan("oldExists")},n.prototype.newPlan=function(){return this.detectPlan("newExists")},n.prototype.matchingPlan=function(){return this.detectPlan("matchExists")},n.prototype.detectPlan=function(e){return t.detect(this.plans,function(t){return t[e]()})},n.prototype.bestPreflightSelector=function(){var t;return this.options.provideTarget?this.plans[0].selector:(t=this.oldPlan())?t.selector:this.oldPlanNotFound()},n.prototype.bestMatchingSteps=function(){var t;return(t=this.matchingPlan())?t.steps:this.matchingPlanNotFound()},n.prototype.matchingPlanNotFound=function(){var t,e;return this.newPlan()?this.oldPlanNotFound():(e=this.oldPlan()?"Could not find "+this.options.humanizedTarget+" in response":"Could not match "+this.options.humanizedTarget+" in current page and response",this.response&&this.options.inspectResponse&&(t={label:"Open response",callback:this.options.inspectResponse}),up.fail([e+" (tried %o)",this.candidates],{action:t}))},n.prototype.oldPlanNotFound=function(){var t;return t=this.options.layer,"auto"===t&&(t="page, modal or popup"),up.fail("Could not find "+this.options.humanizedTarget+" in current "+t+" (tried %o)",this.candidates)},n}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};t=up.util,up.dom.ExtractPlan=function(){function n(t,n){this.parseSteps=e(this.parseSteps,this),this.matchExists=e(this.matchExists,this),this.newExists=e(this.newExists,this),this.oldExists=e(this.oldExists,this),this.findNew=e(this.findNew,this),this.findOld=e(this.findOld,this),this.origin=n.origin,this.selector=up.dom.resolveSelector(t,n.origin),this.transition=n.transition||n.animation||"none",this.response=n.response,this.steps=this.parseSteps()}return n.prototype.findOld=function(){return t.each(this.steps,function(t){return t.$old=up.dom.first(t.selector,this.options)})},n.prototype.findNew=function(){return t.each(this.steps,function(t){return function(e){return e.$new=t.response.first(e.selector)}}(this))},n.prototype.oldExists=function(){return this.findOld(),t.all(this.steps,function(t){return t.$old})},n.prototype.newExists=function(){return this.findNew(),t.all(this.steps,function(t){return t.$new})},n.prototype.matchExists=function(){return this.oldExists()&&this.newExists()},n.prototype.parseSteps=function(){var e,n,r;return r=t.isString(this.transition)?this.transition.split(e):[this.transition],e=/\ *,\ */,n=this.selector.split(e),t.map(n,function(e,n){var o,i,u,a;return o=e.match(/^(.+?)(?:\:(before|after))?$/),o||up.fail('Could not parse selector literal "%s"',e),u=o[1],"html"===u&&(u="body"),i=o[2],a=r[n]||t.last(r),{selector:u,pseudoClass:i,transition:a}})},n}()}.call(this),function(){var t=[].slice;up.motion=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,T,$,E,P,x,D;return x=up.util,a={},c={},E={},p={},l=x.config({duration:300,delay:0,easing:"ease",enabled:!0}),k=function(){return h(),a=x.copy(c),E=x.copy(p),l.reset()},v=function(){return l.enabled&&up.browser.canCssTransition()},o=function(t,n,r){var u;return u=e(t),h(u),r=i(r),g(n)?b():x.isFunction(n)?s(n(u,r),n):x.isString(n)?o(u,d(n),r):x.isHash(n)?v()?x.cssAnimate(u,n,r):(u.css(n),x.resolvedDeferred()):up.fail("Unknown animation type for %o",n)},i=function(){var e,n,r,o,i;return n=1<=arguments.length?t.call(arguments,0):[],i=n.shift()||{},e=x.isJQuery(n[0])?n.shift():x.nullJQuery(),o=x.isObject(n[0])?n.shift():{},r={},r.easing=x.option(i.easing,x.presentAttr(e,"up-easing"),o.easing,l.easing),r.duration=Number(x.option(i.duration,x.presentAttr(e,"up-duration"),o.duration,l.duration)),r.delay=Number(x.option(i.delay,x.presentAttr(e,"up-delay"),o.delay,l.delay)),r},d=function(t){return a[t]||up.fail("Unknown animation %o",t)},r="up-ghosting-deferred",n="up-ghosting",D=function(t,e,o,i){var u,a,s,l,c,p,f,d;return o.copy===!1||t.is(".up-ghost")||e.is(".up-ghost")?i(t,e):(p=void 0,l=void 0,f=void 0,c=void 0,a=up.layout.viewportOf(t),u=t.add(e),x.temporaryCss(e,{display:"none"},function(){return p=w(t,a),f=a.scrollTop()}),x.temporaryCss(t,{display:"none"},function(){return up.layout.revealOrRestoreScroll(e,o),l=w(e,a),c=a.scrollTop()}),p.moveTop(c-f),t.hide(),d=x.temporaryCss(e,{opacity:"0"}),s=i(p.$ghost,l.$ghost),u.data(r,s),u.addClass(n),s.then(function(){return u.removeData(r),u.removeClass(n),d(),p.$bounds.remove(),l.$bounds.remove()}),s)},h=function(t){var r,o,i;return null==t&&(t=".up-animating"),v()?(o=e(t),r=x.findWithSelf(o,".up-animating"),x.finishCssAnimate(r),i=x.findWithSelf(o,"."+n),m(i)):void 0},m=function(t){return t.each(function(){var t,n;return t=e(this),(n=x.pluckData(t,r))?n.resolve():void 0})},s=function(t,e){return x.isDeferred(t)?t:up.fail("Did not return a promise with .then and .resolve methods: %o",e)},y=function(t,n,r,u){var l,c,p;return u=x.options(u),p=v()&&!g(r),c=e(t),l=e(n),up.log.group(p?"Morphing %o to %o (using %s, %o)":void 0,c.get(0),l.get(0),r,u,function(){var t,e,n,d;return e=x.only(u,"reveal","restoreScroll","source"),e=x.assign(e,i(u)),h(c),h(l),p?(f(c),f(l),(t=a[r])?(A(c,l,e),o(l,t,e)):(d=x.presence(r,x.isFunction)||E[r])?D(c,l,e,function(t,n){var o;return o=d(t,n,e),s(o,r)}):x.isString(r)&&r.indexOf("/")>=0?(n=r.split("/"),d=function(t,e,r){return S(o(t,n[0],r),o(e,n[1],r))},y(c,l,d,e)):up.fail("Unknown transition %o",r)):A(c,l,e)})},f=function(t){var e;return 0===t.parents("body").length?(e=t.get(0),up.fail("Can't morph a <%s> element (%o)",e.tagName,e)):void 0},A=function(t,e,n){return t.hide(),up.layout.revealOrRestoreScroll(e,n)},w=function(t,n){var r,o,i,u,a,s,l,c,p;for(u=x.measure(t,{relative:!0,inner:!0}),i=t.clone(),i.find("script").remove(),i.css({position:"static"===t.css("position")?"static":"relative",top:"auto",right:"auto",bottom:"auto",left:"auto",width:"100%",height:"100%"}),i.addClass("up-ghost"),r=e('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(u),p=u.top,c=function(t){return 0!==t?(p+=t,r.css({top:p})):void 0},i.appendTo(r),r.insertBefore(t),c(t.offset().top-i.offset().top),o=up.layout.fixedChildren(i),s=0,l=o.length;l>s;s++)a=o[s],x.fixedToAbsolute(a,n);return{$ghost:i,$bounds:r,moveTop:c}},$=function(t,e){return E[t]=e},u=function(t,e){return a[t]=e},T=function(){return c=x.copy(a),p=x.copy(E)},S=x.resolvableWhen,b=x.resolvedDeferred,g=function(t){return t===!1||"none"===t||x.isMissing(t)||x.isResolvedPromise(t)},u("none",b),u("fade-in",function(t,e){return t.css({opacity:0}),o(t,{opacity:1},e)}),u("fade-out",function(t,e){return t.css({opacity:1}),o(t,{opacity:0},e)}),P=function(t,e){return{transform:"translate("+t+"px, "+e+"px)"}},u("move-to-top",function(t,e){var n,r;return n=x.measure(t),r=n.top+n.height,t.css(P(0,0)),o(t,P(0,-r),e)}),u("move-from-top",function(t,e){var n,r;return n=x.measure(t),r=n.top+n.height,t.css(P(0,-r)),o(t,P(0,0),e)}),u("move-to-bottom",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().height-n.top,t.css(P(0,0)),o(t,P(0,r),e)}),u("move-from-bottom",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().height-n.top,t.css(P(0,r)),o(t,P(0,0),e)}),u("move-to-left",function(t,e){var n,r;return n=x.measure(t),r=n.left+n.width,t.css(P(0,0)),o(t,P(-r,0),e)}),u("move-from-left",function(t,e){var n,r;return n=x.measure(t),r=n.left+n.width,t.css(P(-r,0)),o(t,P(0,0),e)}),u("move-to-right",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().width-n.left,t.css(P(0,0)),o(t,P(r,0),e)}),u("move-from-right",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().width-n.left,t.css(P(r,0)),o(t,P(0,0),e)}),u("roll-down",function(t,e){var n,r,i;return r=t.height(),i=x.temporaryCss(t,{height:"0px",overflow:"hidden"}),n=o(t,{height:r+"px"},e),n.then(i),n}),$("none",b),$("move-left",function(t,e,n){return S(o(t,"move-to-left",n),o(e,"move-from-right",n))}),$("move-right",function(t,e,n){return S(o(t,"move-to-right",n),o(e,"move-from-left",n))}),$("move-up",function(t,e,n){return S(o(t,"move-to-top",n),o(e,"move-from-bottom",n))}),$("move-down",function(t,e,n){return S(o(t,"move-to-bottom",n),o(e,"move-from-top",n))}),$("cross-fade",function(t,e,n){return S(o(t,"fade-out",n),o(e,"fade-in",n))}),up.on("up:framework:booted",T),up.on("up:framework:reset",k),{morph:y,animate:o,animateOptions:i,finish:h,transition:$,animation:u,config:l,isEnabled:v,none:b,when:S,prependCopy:w,isNone:g}}(jQuery),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){var t=[].slice;up.proxy=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,T,$,E,P,x,D,C,O,F,R,U,L;return L=up.util,n=void 0,$=void 0,F=void 0,S=void 0,R=void 0,P=[],p=L.config({slowDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5,maxRequests:4,wrapMethods:["PATCH","PUT","DELETE"],safeMethods:["GET","OPTIONS","HEAD"]}),u=function(t){return k(t),[t.url,t.method,L.requestDataAsQuery(t.data),t.target].join("|")},i=L.cache({size:function(){return p.cacheSize},expiry:function(){return p.cacheExpiry},key:u}),f=function(t){var e,n,r,o,u,a,s;if(t=k(t),h(t))for(n=[t],"html"!==t.target&&(a=L.merge(t,{target:"html"}),n.push(a),"body"!==t.target&&(u=L.merge(t,{target:"body"}),n.push(u))),r=0,o=n.length;o>r;r++)if(e=n[r],s=i.get(e))return s},a=function(){return clearTimeout($),$=null},s=function(){return clearTimeout(F),F=null},D=function(){return n=null,a(),s(),S=0,p.reset(),i.clear(),R=!1,P=[]},D(),k=function(t){return t._normalized||(t.method=L.normalizeMethod(t.method),t.url&&(t.url=L.normalizeUrl(t.url)),t.target||(t.target="body"),t._normalized=!0),t},r=function(){var e,n,r,o,i,u,a;return e=1<=arguments.length?t.call(arguments,0):[],o=L.extractOptions(e),L.isGiven(e[0])&&(o.url=e[0]),n=o.cache===!0,r=o.cache===!1,a=L.only(o,"url","method","data","target","headers","timeout","_normalized"),a=k(a),i=!0,m(a)||n?(u=f(a))&&!r?(up.puts("Re-using cached response for %s %s",a.method,a.url),i="pending"===u.state()):(u=b(a),O(a,u),u.fail(function(){return x(a)})):(c(),u=b(a)),i&&!o.preload&&(w(),u.always(y)),u},h=function(t){return!L.isFormData(t.data)},v=function(){return 0===S},d=function(){return S>0},w=function(){var t,e;return e=v(),S+=1,e?(t=function(){return d()?(up.emit("up:proxy:slow",{message:"Proxy is busy"}),R=!0):void 0},F=L.setTimer(p.slowDelay,t)):void 0},y=function(){return S-=1,v()&&R?(up.emit("up:proxy:recover",{message:"Proxy is idle"}),R=!1):void 0},b=function(t){return S<p.maxRequests?g(t):E(t)},E=function(t){var n,r;return up.puts("Queuing request for %s %s",t.method,t.url),n=e.Deferred(),r={deferred:n,request:t},P.push(r),n.promise()},g=function(t){var n;return up.emit("up:proxy:load",L.merge(t,{message:["Loading %s %s",t.method,t.url]})),t=L.copy(t),t.headers||(t.headers={}),t.headers[up.protocol.config.targetHeader]=t.target,L.contains(p.wrapMethods,t.method)&&(t.data=L.appendRequestData(t.data,up.protocol.config.methodParam,t.method),t.method="POST"),L.isFormData(t.data)&&(t.contentType=!1,t.processData=!1),n=e.ajax(t),n.done(function(e,n,r){return C(t,r)}),n.fail(function(e,n,r){return C(t,e)}),n},C=function(t,e){var n;return up.emit("up:proxy:received",L.merge(t,{message:["Server responded with %s %s (%d bytes)",e.status,e.statusText,null!=(n=e.responseText)?n.length:void 0]})),A()},A=function(){var e,n;(e=P.shift())&&(n=g(e.request),n.done(function(){var n,r;return n=1<=arguments.length?t.call(arguments,0):[],(r=e.deferred).resolve.apply(r,n)}),n.fail(function(){var n,r;return n=1<=arguments.length?t.call(arguments,0):[],(r=e.deferred).reject.apply(r,n)}))},o=i.alias,O=i.set,x=i.remove,c=i.clear,m=function(t){return k(t),L.contains(p.safeMethods,t.method)},l=function(t){var e,r;return r=parseInt(L.presentAttr(t,"up-delay"))||p.preloadDelay,t.is(n)?void 0:(n=t,a(),e=function(){return T(t),n=null},U(e,r))},U=function(t,e){return $=setTimeout(t,e)},T=function(t,n){var r,o;return r=e(t),n=L.options(n),o=up.link.followMethod(r,n),m({method:o})?up.log.group("Preloading link %o",r,function(){return n.preload=!0,up.follow(r,n)}):(up.puts("Won't preload %o due to unsafe method %s",r,o),L.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(t,e){return up.link.childClicked(t,e)?void 0:l(e)}),up.on("up:framework:reset",D),{preload:T,ajax:r,get:f,alias:o,clear:c,remove:x,isIdle:v,isBusy:d,isCachable:h,config:p}}(jQuery),up.ajax=up.proxy.ajax}.call(this),function(){up.link=function($){var allowDefault,childClicked,follow,followMethod,followVariantSelectors,isFollowable,makeFollowable,onAction,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(t,e){var n;return e=u.options(e),n=u.option(e.target,"body"),up.replace(n,t,e)},follow=function(t,e){var n,r,o;return n=$(t),e=u.options(e),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(e.target,n.attr("up-target")),e.failTarget=u.option(e.failTarget,n.attr("up-fail-target")),e.fallback=u.option(e.fallback,n.attr("up-fallback")),e.transition=u.option(e.transition,u.castedAttr(n,"up-transition"),"none"),e.failTransition=u.option(e.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),e.history=u.option(e.history,u.castedAttr(n,"up-history")),e.reveal=u.option(e.reveal,u.castedAttr(n,"up-reveal"),!0),e.cache=u.option(e.cache,u.castedAttr(n,"up-cache")),e.restoreScroll=u.option(e.restoreScroll,u.castedAttr(n,"up-restore-scroll")),e.method=followMethod(n,e),e.origin=u.option(e.origin,n),e.layer=u.option(e.layer,n.attr("up-layer"),"auto"),e.confirm=u.option(e.confirm,n.attr("up-confirm")),e=u.merge(e,up.motion.animateOptions(e,n)),up.browser.whenConfirmed(e).then(function(){return up.replace(r,o,e)})},followMethod=function(t,e){var n;return n=$(t),e=u.options(e),u.option(e.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},childClicked=function(t,e){var n,r;return n=$(t.target),r=n.closest("a, [up-href]"),r.length&&e.find(r).length},shouldProcessLinkEvent=function(t,e){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,e)},followVariantSelectors=[],allowDefault=function(t){},onAction=function(t,e){var n;return followVariantSelectors.push(t),n=function(t){return up.feedback.start(t,function(){return e(t)})},up.on("click","a"+t+", [up-href]"+t,function(t,e){return shouldProcessLinkEvent(t,e)?e.is("[up-instant]")?up.bus.haltEvent(t):(up.bus.consumeAction(t),n(e)):allowDefault(t)}),up.on("mousedown","a"+t+"[up-instant], [up-href]"+t+"[up-instant]",function(t,e){return shouldProcessLinkEvent(t,e)?(up.bus.consumeAction(t),n(e)):void 0})},isFollowable=function(t){var e;return e=$(t),u.any(followVariantSelectors,function(t){return e.is(t)})},makeFollowable=function(t){var e;return e=$(t),isFollowable(e)?void 0:e.attr("up-follow","")},onAction("[up-target]",function(t){return follow(t)}),onAction("[up-follow]",function(t){return follow(t)}),up.macro("[up-dash]",{priority:"last"},function(t){var e,n;return n=u.castedAttr(t,"up-dash"),t.removeAttr("up-dash"),e={"up-preload":"","up-instant":""},n===!0?makeFollowable(t):e["up-target"]=n,u.setMissingAttrs(t,e)}),up.macro("[up-expand]",{priority:"last"},function(t){var e,n,r,o,i,a,s,l,c,p;if(e=t.find("a, [up-href]"),(c=t.attr("up-expand"))&&(e=e.filter(c)),i=e.get(0)){for(p=/^up-/,s={},s["up-href"]=$(i).attr("href"),l=i.attributes,r=0,o=l.length;o>r;r++)n=l[r],a=n.name,a.match(p)&&(s[a]=n.value);return u.setMissingAttrs(t,s),t.removeAttr("up-expand"),makeFollowable(t)}}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,isFollowable:isFollowable,shouldProcessLinkEvent:shouldProcessLinkEvent,childClicked:childClicked,followMethod:followMethod,onAction:onAction}}(jQuery),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){var slice=[].slice;up.form=function($){var autosubmit,config,findSwitcherForTarget,observe,observeField,reset,resolveValidateTarget,submit,switchTarget,switchTargets,switcherValues,u,validate;return u=up.util,config=u.config({validateTargets:["[up-fieldset]:has(&)","fieldset:has(&)","label:has(&)","form:has(&)"],fields:[":input"],observeDelay:0}),reset=function(){return config.reset()},submit=function(t,e){var n,r,o,i,a,s,l;return n=$(t).closest("form"),e=u.options(e),s=u.option(e.target,n.attr("up-target"),"body"),l=u.option(e.url,n.attr("action"),up.browser.url()),e.failTarget=u.option(e.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),e.fallback=u.option(e.fallback,n.attr("up-fallback")),e.history=u.option(e.history,u.castedAttr(n,"up-history"),!0),
3
+ e.transition=u.option(e.transition,u.castedAttr(n,"up-transition"),"none"),e.failTransition=u.option(e.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),e.method=u.option(e.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),e.headers=u.option(e.headers,{}),e.reveal=u.option(e.reveal,u.castedAttr(n,"up-reveal"),!0),e.cache=u.option(e.cache,u.castedAttr(n,"up-cache")),e.restoreScroll=u.option(e.restoreScroll,u.castedAttr(n,"up-restore-scroll")),e.origin=u.option(e.origin,n),e.layer=u.option(e.layer,n.attr("up-layer"),"auto"),e.data=up.util.requestDataFromForm(n),e=u.merge(e,up.motion.animateOptions(e,n)),i=n.find("input[type=file]").length,r=!i||u.isFormData(e.data),o=up.browser.canPushState()||e.history===!1,e.validate&&(e.headers||(e.headers={}),e.transition=!1,e.failTransition=!1,e.headers[up.protocol.config.validateHeader]=e.validate,!r)?u.unresolvablePromise():(up.feedback.start(n),r&&o?(a=up.replace(s,l,e),a.always(function(){return up.feedback.stop(n)}),a):(n.get(0).submit(),u.unresolvablePromise()))},observe=function(){var $element,$fields,callback,callbackArg,delay,destructors,extraArgs,options,rawCallback,selectorOrElement;return selectorOrElement=arguments[0],extraArgs=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===extraArgs.length?callbackArg=extraArgs[0]:extraArgs.length>1&&(options=u.options(extraArgs[0]),callbackArg=extraArgs[1]),$element=$(selectorOrElement),$fields=u.multiSelector(config.fields).findWithSelf($element),callback=null,rawCallback=u.option(callbackArg,u.presentAttr($fields,"up-observe")),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||up.fail("up.observe: No change callback given"),delay=u.option($fields.attr("up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),destructors=u.map($fields,function(t){return observeField($(t),delay,callback)}),u.sequence.apply(u,destructors)},observeField=function(t,e,n){var r,o,i,a,s,l;return a=u.submittedValue(t),l=void 0,i=u.resolvedPromise(),s=function(e){var r;return a=e,r=n.apply(t.get(0),[e,t]),i=u.isPromise(r)?r:r},o=function(){var n,r;return r=u.submittedValue(t),a!==r?(n=function(){return s(r)},null!=l&&l.cancel(),l=u.promiseTimer(e),$.when(l,i).then(n)):void 0},r="input change",up.browser.canInputEvent()||(r+=" keypress paste cut click propertychange"),t.on(r,o),function(){return t.off(r,o),null!=l?l.cancel():void 0}},autosubmit=function(t,e){return observe(t,e,function(t,e){var n;return n=e.closest("form"),up.feedback.start(e,function(){return submit(n)})})},resolveValidateTarget=function(t,e){var n;return n=u.option(e.target,t.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.dom.resolveSelector(n,e.origin),t.closest(r).length}))),u.isBlank(n)&&up.fail("Could not find default validation target for %o (tried ancestors %o)",t.get(0),config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(t,e){var n,r,o;return n=$(t),e=u.options(e),e.origin=n,e.target=resolveValidateTarget(n,e),e.failTarget=e.target,e.history=!1,e.headers=u.option(e.headers,{}),e.validate=n.attr("name")||"__none__",e=u.merge(e,up.motion.animateOptions(e,n)),r=n.closest("form"),o=up.submit(r,e)},switcherValues=function(t){var e,n,r,o;return t.is("input[type=checkbox]")?t.is(":checked")?(r=t.val(),n=":checked"):n=":unchecked":t.is("input[type=radio]")?(e=t.closest("form, body").find("input[type='radio'][name='"+t.attr("name")+"']:checked"),e.length?(n=":checked",r=e.val()):n=":unchecked"):r=t.val(),o=[],u.isPresent(r)?(o.push(r),o.push(":present")):o.push(":blank"),u.isPresent(n)&&o.push(n),o},switchTargets=function(t,e){var n,r,o;return n=$(t),e=u.options(e),o=u.option(e.target,n.attr("up-switch")),u.isPresent(o)||up.fail("No switch target given for %o",n.get(0)),r=switcherValues(n),$(o).each(function(){return switchTarget($(this),r)})},switchTarget=function(t,e){var n,r,o,i;return n=$(t),e||(e=switcherValues(findSwitcherForTarget(n))),(r=n.attr("up-hide-for"))?(r=r.split(" "),o=0===u.intersect(e,r).length):(i=(i=n.attr("up-show-for"))?i.split(" "):[":present",":checked"],o=u.intersect(e,i).length>0),n.toggle(o),n.addClass("up-switched")},findSwitcherForTarget=function(t){var e,n;return e=$("[up-switch]"),n=u.detect(e,function(e){var n;return n=$(e).attr("up-switch"),t.is(n)}),n?$(n):u.fail("Could not find [up-switch] field for %o",$element.get(0))},up.on("submit","form[up-target]",function(t,e){return up.bus.consumeAction(t),submit(e)}),up.on("change","[up-validate]",function(t,e){return validate(e)}),up.on("change","[up-switch]",function(t,e){return switchTargets(e)}),up.compiler("[up-switch]",function(t){return switchTargets(t)}),up.compiler("[up-show-for]:not(.up-switched), [up-hide-for]:not(.up-switched)",function(t){return switchTarget(t)}),up.compiler("[up-observe]",function(t){return observe(t)}),up.compiler("[up-autosubmit]",function(t){return autosubmit(t)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),config:config,submit:submit,observe:observe,validate:validate,switchTargets:switchTargets,autosubmit:autosubmit}}(jQuery),up.submit=up.form.submit,up.observe=up.form.observe,up.autosubmit=up.form.autosubmit,up.validate=up.form.validate}.call(this),function(){up.popup=function($){var align,attachAsap,attachNow,autoclose,chain,closeAsap,closeNow,config,contains,createFrame,discardHistory,isOpen,reset,state,u;return u=up.util,config=u.config({openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:150,closeDuration:100,openEasing:null,closeEasing:null,position:"bottom-right",history:!1}),state=u.config({phase:"closed",$anchor:null,$popup:null,position:null,sticky:null,url:null,coveredUrl:null,coveredTitle:null}),chain=new u.DivertibleChain,reset=function(){var t;return null!=(t=state.$popup)&&t.remove(),state.reset(),chain.reset(),config.reset()},align=function(){var t,e,n;switch(t={},n=u.measure(state.$popup),u.isFixed(state.$anchor)?(e=state.$anchor.get(0).getBoundingClientRect(),t.position="fixed"):e=u.measure(state.$anchor),state.position){case"bottom-right":t.top=e.top+e.height,t.left=e.left+e.width-n.width;break;case"bottom-left":t.top=e.top+e.height,t.left=e.left;break;case"top-right":t.top=e.top-n.height,t.left=e.left+e.width-n.width;break;case"top-left":t.top=e.top-n.height,t.left=e.left;break;default:up.fail("Unknown position option '%s'",state.position)}return state.$popup.attr("up-position",state.position),state.$popup.css(t)},discardHistory=function(){return state.coveredTitle=null,state.coveredUrl=null},createFrame=function(t){var e;return e=u.$createElementFromSelector(".up-popup"),u.$createPlaceholder(t,e),e.appendTo(document.body),state.$popup=e},isOpen=function(){return"opened"===state.phase||"opening"===state.phase},attachAsap=function(t,e){var n;return n=function(){return attachNow(t,e)},isOpen()?chain.asap(closeNow,n):chain.asap(n),chain.promise()},attachNow=function(t,e){var n,r,o,i,a,s;return n=$(t),n.length||up.fail("Cannot attach popup to non-existing element %o",t),e=u.options(e),s=u.option(u.pluckKey(e,"url"),n.attr("up-href"),n.attr("href")),o=u.option(u.pluckKey(e,"html")),a=u.option(u.pluckKey(e,"target"),n.attr("up-popup"),"body"),i=u.option(e.position,n.attr("up-position"),config.position),e.animation=u.option(e.animation,n.attr("up-animation"),config.openAnimation),e.sticky=u.option(e.sticky,u.castedAttr(n,"up-sticky"),config.sticky),e.history=up.browser.canPushState()?u.option(e.history,u.castedAttr(n,"up-history"),config.history):!1,e.confirm=u.option(e.confirm,n.attr("up-confirm")),e.method=up.link.followMethod(n,e),e.layer="popup",r=up.motion.animateOptions(e,n,{duration:config.openDuration,easing:config.openEasing}),up.browser.whenConfirmed(e).then(function(){return up.bus.whenEmitted("up:popup:open",{url:s,message:"Opening popup"}).then(function(){var t,l;return state.phase="opening",state.$anchor=n,state.position=i,e.history&&(state.coveredUrl=up.browser.url(),state.coveredTitle=document.title),state.sticky=e.sticky,e.provideTarget=function(){return createFrame(a)},t=u.merge(e,{animation:!1}),l=o?up.extract(a,o,t):up.replace(a,s,t),l=l.then(function(){return align(),up.animate(state.$popup,e.animation,r)}),l=l.then(function(){return state.phase="opened",up.emit("up:popup:opened",{message:"Popup opened"})})})})},closeAsap=function(t){return isOpen()&&chain.asap(function(){return closeNow(t)}),chain.promise()},closeNow=function(t){var e;return isOpen()?(t=u.options(t,{animation:config.closeAnimation,history:state.coveredUrl,title:state.coveredTitle}),e=up.motion.animateOptions(t,{duration:config.closeDuration,easing:config.closeEasing}),u.assign(t,e),up.bus.whenEmitted("up:popup:close",{message:"Closing popup",$element:state.$popup}).then(function(){return state.phase="closing",state.url=null,state.coveredUrl=null,state.coveredTitle=null,up.destroy(state.$popup,t).then(function(){return state.phase="closed",state.$popup=null,state.$anchor=null,state.sticky=null,up.emit("up:popup:closed",{message:"Popup closed"})})})):u.resolvedPromise()},autoclose=function(){return state.sticky?void 0:(discardHistory(),closeAsap())},contains=function(t){var e;return e=$(t),e.closest(".up-popup").length>0},up.link.onAction("[up-popup]",function(t){return t.is(".up-current")?closeAsap():attachAsap(t)}),up.on("click up:action:consumed",function(t){var e;return e=$(t.target),e.closest(".up-popup, [up-popup]").length?void 0:closeAsap()}),up.on("up:fragment:inserted",function(t,e){var n;if(contains(e)){if(n=e.attr("up-source"))return state.url=n}else if(contains(t.origin))return autoclose()}),up.bus.onEscape(closeAsap),up.on("click",".up-popup [up-close]",function(t,e){return closeAsap(),up.bus.consumeAction(t)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),attach:attachAsap,close:closeAsap,url:function(){return state.url},coveredUrl:function(){return state.coveredUrl},config:config,contains:contains,isOpen:isOpen}}(jQuery)}.call(this),function(){up.modal=function($){var animate,autoclose,chain,closeAsap,closeNow,config,contains,createFrame,discardHistory,extractAsap,flavor,flavorDefault,flavorOverrides,flavors,followAsap,isOpen,markAsAnimating,openAsap,openNow,reset,shiftElements,state,templateHtml,u,unshiftElements,visitAsap;return u=up.util,config=u.config({maxWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:null,closeDuration:null,openEasing:null,closeEasing:null,backdropOpenAnimation:"fade-in",backdropCloseAnimation:"fade-out",closeLabel:"\xd7",closable:!0,sticky:!1,flavor:"default",position:null,template:function(t){return'<div class="up-modal">\n <div class="up-modal-backdrop"></div>\n <div class="up-modal-viewport">\n <div class="up-modal-dialog">\n <div class="up-modal-content"></div>\n <div class="up-modal-close" up-close>'+t.closeLabel+"</div>\n </div>\n </div>\n</div>"}}),flavors=u.openConfig({"default":{}}),state=u.config(function(){return{phase:"closed",$anchor:null,$modal:null,sticky:null,closable:null,flavor:null,url:null,coveredUrl:null,coveredTitle:null,position:null,unshifters:[]}}),chain=new u.DivertibleChain,reset=function(){var t;return null!=(t=state.$modal)&&t.remove(),unshiftElements(),state.reset(),chain.reset(),config.reset(),flavors.reset()},templateHtml=function(){var t;return t=flavorDefault("template"),u.evalOption(t,{closeLabel:flavorDefault("closeLabel")})},discardHistory=function(){return state.coveredTitle=null,state.coveredUrl=null},createFrame=function(t,e){var n,r,o;return o=$(templateHtml()),o.attr("up-flavor",state.flavor),u.isPresent(state.position)&&o.attr("up-position",state.position),r=o.find(".up-modal-dialog"),u.isPresent(e.width)&&r.css("width",e.width),u.isPresent(e.maxWidth)&&r.css("max-width",e.maxWidth),u.isPresent(e.height)&&r.css("height",e.height),state.closable||o.find(".up-modal-close").remove(),n=o.find(".up-modal-content"),u.$createPlaceholder(t,n),o.appendTo(document.body),state.$modal=o},shiftElements=function(){var t,e,n,r,o;return u.documentHasVerticalScrollbar()?(t=$("body"),r=u.scrollbarWidth(),e=parseFloat(t.css("padding-right")),n=r+e,o=u.temporaryCss(t,{"padding-right":n+"px","overflow-y":"hidden"}),state.unshifters.push(o),up.layout.anchoredRight().each(function(){var t,e,n,o;return t=$(this),e=parseFloat(t.css("right")),n=r+e,o=u.temporaryCss(t,{right:n}),state.unshifters.push(o)})):void 0},unshiftElements=function(){var t,e;for(t=[];e=state.unshifters.pop();)t.push(e());return t},isOpen=function(){return"opened"===state.phase||"opening"===state.phase},followAsap=function(t,e){return e=u.options(e),e.$link=$(t),openAsap(e)},visitAsap=function(t,e){return e=u.options(e),e.url=t,openAsap(e)},extractAsap=function(t,e,n){return n=u.options(n),n.html=e,n.history=u.option(n.history,!1),n.target=t,openAsap(n)},openAsap=function(t){var e;return e=function(){return openNow(t)},isOpen()?chain.asap(closeNow,e):chain.asap(e),chain.promise()},openNow=function(t){var e,n,r,o,i;return t=u.options(t),e=u.option(u.pluckKey(t,"$link"),u.nullJQuery()),i=u.option(u.pluckKey(t,"url"),e.attr("up-href"),e.attr("href")),r=u.option(u.pluckKey(t,"html")),o=u.option(u.pluckKey(t,"target"),e.attr("up-modal"),"body"),t.flavor=u.option(t.flavor,e.attr("up-flavor"),config.flavor),t.position=u.option(t.position,e.attr("up-position"),flavorDefault("position",t.flavor)),t.position=u.evalOption(t.position,{$link:e}),t.width=u.option(t.width,e.attr("up-width"),flavorDefault("width",t.flavor)),t.maxWidth=u.option(t.maxWidth,e.attr("up-max-width"),flavorDefault("maxWidth",t.flavor)),t.height=u.option(t.height,e.attr("up-height"),flavorDefault("height")),t.animation=u.option(t.animation,e.attr("up-animation"),flavorDefault("openAnimation",t.flavor)),t.animation=u.evalOption(t.animation,{position:t.position}),t.backdropAnimation=u.option(t.backdropAnimation,e.attr("up-backdrop-animation"),flavorDefault("backdropOpenAnimation",t.flavor)),t.backdropAnimation=u.evalOption(t.backdropAnimation,{position:t.position}),t.sticky=u.option(t.sticky,u.castedAttr(e,"up-sticky"),flavorDefault("sticky",t.flavor)),t.closable=u.option(t.closable,u.castedAttr(e,"up-closable"),flavorDefault("closable",t.flavor)),t.confirm=u.option(t.confirm,e.attr("up-confirm")),t.method=up.link.followMethod(e,t),t.layer="modal",n=up.motion.animateOptions(t,e,{duration:flavorDefault("openDuration",t.flavor),easing:flavorDefault("openEasing",t.flavor)}),t.history=u.option(t.history,u.castedAttr(e,"up-history"),flavorDefault("history",t.flavor)),up.browser.canPushState()||(t.history=!1),up.browser.whenConfirmed(t).then(function(){return up.bus.whenEmitted("up:modal:open",{url:i,message:"Opening modal"}).then(function(){var e,a;return state.phase="opening",state.flavor=t.flavor,state.sticky=t.sticky,state.closable=t.closable,state.position=t.position,t.history&&(state.coveredUrl=up.browser.url(),state.coveredTitle=document.title),t.provideTarget=function(){return createFrame(o,t)},e=u.merge(t,{animation:!1}),a=r?up.extract(o,r,e):up.replace(o,i,e),a=a.then(function(){return shiftElements(),animate(t.animation,t.backdropAnimation,n)}),a=a.then(function(){return state.phase="opened",up.emit("up:modal:opened",{message:"Modal opened"})})})})},closeAsap=function(t){return isOpen()&&chain.asap(function(){return closeNow(t)}),chain.promise()},closeNow=function(t){var e,n,r,o;return isOpen()?(t=u.options(t),o=u.option(t.animation,flavorDefault("closeAnimation")),o=u.evalOption(o,{position:state.position}),n=u.option(t.backdropAnimation,flavorDefault("backdropCloseAnimation")),n=u.evalOption(n,{position:state.position}),e=up.motion.animateOptions(t,{duration:flavorDefault("closeDuration"),easing:flavorDefault("closeEasing")}),r=u.options(u.except(t,"animation","duration","easing","delay"),{history:state.coveredUrl,title:state.coveredTitle}),up.bus.whenEmitted("up:modal:close",{$element:state.$modal,message:"Closing modal"}).then(function(){var t;return state.phase="closing",state.url=null,state.coveredUrl=null,state.coveredTitle=null,t=animate(o,n,e),t=t.then(function(){return up.destroy(state.$modal,r)}),t=t.then(function(){return unshiftElements(),state.phase="closed",state.$modal=null,state.flavor=null,state.sticky=null,state.closable=null,state.position=null,up.emit("up:modal:closed",{message:"Modal closed"})})})):u.resolvedPromise()},markAsAnimating=function(t){return null==t&&(t=!0),state.$modal.toggleClass("up-modal-animating",t)},animate=function(t,e,n){var r;return up.motion.isNone(t)?u.resolvedPromise():(markAsAnimating(),r=$.when(up.animate(state.$modal.find(".up-modal-viewport"),t,n),up.animate(state.$modal.find(".up-modal-backdrop"),e,n)),r=r.then(function(){return markAsAnimating(!1)}))},autoclose=function(){return state.sticky?void 0:(discardHistory(),closeAsap())},contains=function(t){var e;return e=$(t),e.closest(".up-modal").length>0},flavor=function(t,e){return null==e&&(e={}),up.log.warn("The up.modal.flavor function is deprecated. Use the up.modal.flavors property instead."),u.assign(flavorOverrides(t),e)},flavorOverrides=function(t){return flavors[t]||(flavors[t]={})},flavorDefault=function(t,e){var n;return null==e&&(e=state.flavor),e&&(n=flavorOverrides(e)[t]),u.isMissing(n)&&(n=config[t]),n},up.link.onAction("[up-modal]",function(t){return followAsap(t)}),up.on("click",function(t){var e;if(state.closable)return e=$(t.target),e.closest(".up-modal-dialog").length||e.closest("[up-modal]").length?void 0:(up.bus.consumeAction(t),closeAsap())}),up.on("up:fragment:inserted",function(t,e){var n;if(contains(e)){if(n=e.attr("up-source"))return state.url=n}else if(contains(t.origin)&&!up.popup.contains(e))return autoclose()}),up.bus.onEscape(function(){return state.closable?closeAsap():void 0}),up.on("click",".up-modal [up-close]",function(t,e){return closeAsap(),up.bus.consumeAction(t)}),up.macro("[up-drawer]",function(t){var e;return e=t.attr("up-drawer"),t.attr({"up-modal":e,"up-flavor":"drawer"})}),flavors.drawer={openAnimation:function(t){switch(t.position){case"left":return"move-from-left";case"right":return"move-from-right"}},closeAnimation:function(t){switch(t.position){case"left":return"move-to-left";case"right":return"move-to-right"}},position:function(t){return u.isPresent(t.$link)?u.horizontalScreenHalf(t.$link):"left"}},up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visitAsap,follow:followAsap,extract:extractAsap,close:closeAsap,url:function(){return state.url},coveredUrl:function(){return state.coveredUrl},config:config,flavors:flavors,contains:contains,isOpen:isOpen,flavor:flavor}}(jQuery)}.call(this),function(){up.tooltip=function(t){var e,n,r,o,i,u,a,s,l,c,p,f;return f=up.util,a=f.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:100,closeDuration:50,openEasing:null,closeEasing:null}),p=f.config({phase:"closed",$anchor:null,$tooltip:null,position:null}),o=new f.DivertibleChain,c=function(){var t;return null!=(t=p.$tooltip)&&t.remove(),p.reset(),o.reset(),a.reset()},e=function(){var t,e,n;switch(t={},n=f.measure(p.$tooltip),f.isFixed(p.$anchor)?(e=p.$anchor.get(0).getBoundingClientRect(),t.position="fixed"):e=f.measure(p.$anchor),p.position){case"top":t.top=e.top-n.height,t.left=e.left+.5*(e.width-n.width);break;case"left":t.top=e.top+.5*(e.height-n.height),t.left=e.left-n.width;break;case"right":t.top=e.top+.5*(e.height-n.height),t.left=e.left+e.width;break;case"bottom":t.top=e.top+e.height,t.left=e.left+.5*(e.width-n.width);break;default:up.fail("Unknown position option '%s'",p.position)}return p.$tooltip.attr("up-position",p.position),p.$tooltip.css(t)},s=function(t){var e;return e=f.$createElementFromSelector(".up-tooltip"),f.isGiven(t.text)?e.text(t.text):e.html(t.html),e.appendTo(document.body),p.$tooltip=e},n=function(t,e){var n;return null==e&&(e={}),n=function(){return r(t,e)},l()?o.asap(u,n):o.asap(n),o.promise()},r=function(n,r){var o,i,u,l,c,d;return o=t(n),r=f.options(r),l=f.option(r.html,o.attr("up-tooltip-html")),d=f.option(r.text,o.attr("up-tooltip")),c=f.option(r.position,o.attr("up-position"),a.position),u=f.option(r.animation,f.castedAttr(o,"up-animation"),a.openAnimation),i=up.motion.animateOptions(r,o,{duration:a.openDuration,easing:a.openEasing}),p.phase="opening",p.$anchor=o,s({text:d,html:l}),p.position=c,e(),up.animate(p.$tooltip,u,i).then(function(){return p.phase="opened"})},i=function(t){return l()&&o.asap(function(){return u(t)}),o.promise()},u=function(t){var e;return l()?(t=f.options(t,{animation:a.closeAnimation}),e=up.motion.animateOptions(t,{duration:a.closeDuration,easing:a.closeEasing}),f.assign(t,e),p.phase="closing",up.destroy(p.$tooltip,t).then(function(){return p.phase="closed",p.$tooltip=null,p.$anchor=null})):f.resolvedPromise()},l=function(){return"opening"===p.phase||"opened"===p.phase},up.compiler("[up-tooltip], [up-tooltip-html]",function(t){return t.on("mouseenter",function(){return n(t)}),t.on("mouseleave",function(){return i()})}),up.on("click up:action:consumed",function(t){return i()}),up.on("up:framework:reset",c),up.bus.onEscape(function(){return i()}),{config:a,attach:n,isOpen:l,close:i}}(jQuery)}.call(this),function(){up.feedback=function(t){var e,n,r,o,i,u,a,s,l,c,p,f,d;return f=up.util,r=f.config({currentClasses:["up-current"]}),s=function(){return r.reset()},o=function(){var t;return t=r.currentClasses,t=t.concat(["up-current"]),t=f.uniq(t),t.join(" ")},e="up-active",n="a, [up-href]",a=function(t){return f.isPresent(t)?f.normalizeUrl(t,{stripTrailingSlash:!0}):void 0},l=function(t){var e,n,r,o,i,u,s,l,c,p;for(l=[],u=["href","up-href","up-alias"],n=0,o=u.length;o>n;n++)if(e=u[n],c=f.presentAttr(t,e))for(p="up-alias"===e?c.split(" "):[c],r=0,i=p.length;i>r;r++)s=p[r],"#"!==s&&(s=a(s),l.push(s));return l},d=function(t){var e,n,r,o;return t=f.compact(t),r=function(t){return"*"===t.substr(-1)?n(t.slice(0,-1)):e(t)},e=function(e){return f.contains(t,e)},n=function(e){return f.detect(t,function(t){return 0===t.indexOf(e)})},o=function(t){return f.detect(t,r)},{matchesAny:o}},u=function(){var e,r;return e=d([a(up.browser.url()),a(up.modal.url()),a(up.modal.coveredUrl()),a(up.popup.url()),a(up.popup.coveredUrl())]),r=o(),f.each(t(n),function(n){var o,i;return o=t(n),i=l(o),e.matchesAny(i)?o.addClass(r):o.hasClass(r)&&0===o.closest(".up-destroying").length?o.removeClass(r):void 0})},i=function(e){var r;return r=t(e),r.is(n)&&(r=f.presence(r.parent(n))||r),r},c=function(t,n){var r,o;return r=i(t),r.addClass(e),n?(o=n(),f.isPromise(o)?o.always(function(){return p(r)}):up.warn("Expected block to return a promise, but got %o",o),o):void 0},p=function(t){var n;return n=i(t),n.removeClass(e)},up.on("up:fragment:inserted",function(){return u()}),up.on("up:fragment:destroyed",function(t,e){return e.is(".up-modal, .up-popup")?u():void 0}),up.on("up:framework:reset",s),{config:r,start:c,stop:p}}(jQuery),up.renamedModule("navigation","feedback")}.call(this),function(){up.rails=function(t){var e,n,r,o;return r=up.util,o=function(t){return t.is("[up-follow], [up-target], [up-modal], [up-popup]")},n=function(){return r.isGiven(t.rails)},r.each(["method","confirm"],function(t){var e,i;return e="data-"+t,i="up-"+t,up.compiler("["+e+"]",function(t){var u;return n()&&o(t)?(u={},u[i]=t.attr(e),r.setMissingAttrs(t,u),t.removeAttr(e)):void 0})}),e=function(){return n()?{name:t.rails.csrfParam(),value:t.rails.csrfToken()}:void 0},{csrfField:e,isRails:n}}(jQuery)}.call(this),function(){up.boot()}.call(this);
@@ -92,7 +92,7 @@ up.dom = (($) ->
92
92
 
93
93
  The current and new elements must both match the given CSS selector.
94
94
 
95
- The UJS variant of this is the [`a[up-target]`](/a-up-target) selector.
95
+ The unobtrusive variant of this is the [`a[up-target]`](/a-up-target) selector.
96
96
 
97
97
  \#\#\# Example
98
98
 
@@ -63,7 +63,8 @@ up.feedback = (($) ->
63
63
  SELECTOR_SECTION = 'a, [up-href]'
64
64
 
65
65
  normalizeUrl = (url) ->
66
- u.normalizeUrl(url) if u.isPresent(url)
66
+ if u.isPresent(url)
67
+ u.normalizeUrl(url, stripTrailingSlash: true)
67
68
 
68
69
  sectionUrls = ($section) ->
69
70
  urls = []
@@ -49,7 +49,7 @@ up.form = (($) ->
49
49
  The response is parsed for a CSS selector and the matching elements will
50
50
  replace corresponding elements on the current page.
51
51
 
52
- The UJS variant of this is the [`form[up-target]`](/form-up-target) selector.
52
+ The unobtrusive variant of this is the [`form[up-target]`](/form-up-target) selector.
53
53
  See the documentation for [`form[up-target]`](/form-up-target) for more
54
54
  information on how AJAX form submissions work in Unpoly.
55
55
 
@@ -165,7 +165,7 @@ up.form = (($) ->
165
165
 
166
166
  This is useful for observing text fields while the user is typing.
167
167
 
168
- The UJS variant of this is the [`up-observe`](/up-observe) attribute.
168
+ The unobtrusive variant of this is the [`up-observe`](/up-observe) attribute.
169
169
 
170
170
  \#\#\# Example
171
171
 
@@ -246,8 +246,6 @@ up.form = (($) ->
246
246
  callback = null
247
247
  rawCallback = u.option(callbackArg, u.presentAttr($fields, 'up-observe'))
248
248
  if u.isString(rawCallback)
249
- console.debug("**** RAW CALLBACK IS %o", rawCallback)
250
- # rawCallback = 'true'
251
249
  callback = (value, $field) -> eval(rawCallback)
252
250
  else
253
251
  callback = rawCallback or up.fail('up.observe: No change callback given')
@@ -305,7 +303,7 @@ up.form = (($) ->
305
303
  The changed form field will be assigned a CSS class [`up-active`](/up-active)
306
304
  while the autosubmitted form is processing.
307
305
 
308
- The UJS variant of this is the [`up-autosubmit`](/up-autosubmit) attribute.
306
+ The unobtrusive variant of this is the [`up-autosubmit`](/up-autosubmit) attribute.
309
307
 
310
308
  @function up.autosubmit
311
309
  @param {String|Element|jQuery} selectorOrElement
@@ -343,7 +341,7 @@ up.form = (($) ->
343
341
  HTTP header. Upon seeing this header, the server is expected to validate (but not save)
344
342
  the form submission and render a new copy of the form with validation errors.
345
343
 
346
- The UJS variant of this is the [`[up-validate]`](/up-validate) selector.
344
+ The unobtrusive variant of this is the [`[up-validate]`](/up-validate) selector.
347
345
  See the documentation for [`[up-validate]`](/up-validate) for more information
348
346
  on how server-side validation works in Unpoly.
349
347
 
@@ -375,28 +373,7 @@ up.form = (($) ->
375
373
  promise = up.submit($form, options)
376
374
  promise
377
375
 
378
- currentValuesForSwitch = ($field) ->
379
- values = undefined
380
- if $field.is('input[type=checkbox]')
381
- if $field.is(':checked')
382
- values = [':checked', ':present', $field.val()]
383
- else
384
- values = [':unchecked', ':blank']
385
- else if $field.is('input[type=radio]')
386
- $checkedButton = $field.closest('form, body').find("input[type='radio'][name='#{$field.attr('name')}']:checked")
387
- if $checkedButton.length
388
- values = [':checked', ':present', $checkedButton.val()]
389
- else
390
- values = [':unchecked', ':blank']
391
- else
392
- value = $field.val()
393
- if u.isPresent(value)
394
- values = [':present', value]
395
- else
396
- values = [':blank']
397
- values
398
-
399
- currentValuesForSwitch = ($field) ->
376
+ switcherValues = ($field) ->
400
377
  if $field.is('input[type=checkbox]')
401
378
  if $field.is(':checked')
402
379
  value = $field.val()
@@ -439,26 +416,47 @@ up.form = (($) ->
439
416
  @internal
440
417
  ###
441
418
  switchTargets = (fieldOrSelector, options) ->
442
- $field = $(fieldOrSelector)
419
+ $switcher = $(fieldOrSelector)
443
420
  options = u.options(options)
444
- targets = u.option(options.target, $field.attr('up-switch'))
445
- u.isPresent(targets) or up.fail("No switch target given for %o", $field.get(0))
446
- fieldValues = currentValuesForSwitch($field)
447
- $(targets).each ->
448
- $target = $(this)
449
- if hideValues = $target.attr('up-hide-for')
450
- hideValues = hideValues.split(' ')
451
- show = u.intersect(fieldValues, hideValues).length == 0
421
+ targetSelector = u.option(options.target, $switcher.attr('up-switch'))
422
+ u.isPresent(targetSelector) or up.fail("No switch target given for %o", $switcher.get(0))
423
+ fieldValues = switcherValues($switcher)
424
+ $(targetSelector).each ->
425
+ switchTarget($(this), fieldValues)
426
+
427
+ ###*
428
+ @internal
429
+ ###
430
+ switchTarget = (target, fieldValues) ->
431
+ $target = $(target)
432
+ fieldValues ||= switcherValues(findSwitcherForTarget($target))
433
+ if hideValues = $target.attr('up-hide-for')
434
+ hideValues = hideValues.split(' ')
435
+ show = u.intersect(fieldValues, hideValues).length == 0
436
+ else
437
+ if showValues = $target.attr('up-show-for')
438
+ showValues = showValues.split(' ')
452
439
  else
453
- if showValues = $target.attr('up-show-for')
454
- showValues = showValues.split(' ')
455
- else
456
- # If the target has neither up-show-for or up-hide-for attributes,
457
- # assume the user wants the target to be visible whenever anything
458
- # is checked or entered.
459
- showValues = [':present', ':checked']
460
- show = u.intersect(fieldValues, showValues).length > 0
461
- $target.toggle(show)
440
+ # If the target has neither up-show-for or up-hide-for attributes,
441
+ # assume the user wants the target to be visible whenever anything
442
+ # is checked or entered.
443
+ showValues = [':present', ':checked']
444
+ show = u.intersect(fieldValues, showValues).length > 0
445
+ $target.toggle(show)
446
+ $target.addClass('up-switched')
447
+
448
+ ###*
449
+ @internal
450
+ ###
451
+ findSwitcherForTarget = ($target) ->
452
+ $switchers = $('[up-switch]')
453
+ switcher = u.detect $switchers, (switcher) ->
454
+ target = $(switcher).attr('up-switch')
455
+ $target.is(target)
456
+ if switcher
457
+ $(switcher)
458
+ else
459
+ u.fail('Could not find [up-switch] field for %o', $element.get(0))
462
460
 
463
461
  ###*
464
462
  Forms with an `up-target` attribute are [submitted via AJAX](/up.submit)
@@ -793,6 +791,10 @@ up.form = (($) ->
793
791
  up.compiler '[up-switch]', ($field) ->
794
792
  switchTargets($field)
795
793
 
794
+ up.compiler '[up-show-for]:not(.up-switched), [up-hide-for]:not(.up-switched)', ($element) ->
795
+ switchTarget($element)
796
+
797
+
796
798
  ###*
797
799
  Observes this field or form and runs a callback when a value changes.
798
800