unpoly-rails 0.23.0 → 0.24.0

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.

Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -0
  3. data/dist/unpoly-bootstrap3.js +1 -1
  4. data/dist/unpoly-bootstrap3.min.js +1 -1
  5. data/dist/unpoly.css +18 -8
  6. data/dist/unpoly.js +498 -265
  7. data/dist/unpoly.min.css +1 -1
  8. data/dist/unpoly.min.js +3 -3
  9. data/lib/assets/javascripts/unpoly-bootstrap3/modal-ext.js.coffee +5 -2
  10. data/lib/assets/javascripts/unpoly/flow.js.coffee +3 -1
  11. data/lib/assets/javascripts/unpoly/form.js.coffee +3 -6
  12. data/lib/assets/javascripts/unpoly/layout.js.coffee +1 -1
  13. data/lib/assets/javascripts/unpoly/link.js.coffee +4 -2
  14. data/lib/assets/javascripts/unpoly/log.js.coffee +2 -2
  15. data/lib/assets/javascripts/unpoly/modal.js.coffee +125 -36
  16. data/lib/assets/javascripts/unpoly/motion.js.coffee +75 -37
  17. data/lib/assets/javascripts/unpoly/navigation.js.coffee +38 -26
  18. data/lib/assets/javascripts/unpoly/proxy.js.coffee +77 -52
  19. data/lib/assets/javascripts/unpoly/syntax.js.coffee +1 -0
  20. data/lib/assets/javascripts/unpoly/tooltip.js.coffee +2 -0
  21. data/lib/assets/javascripts/unpoly/util.js.coffee +138 -46
  22. data/lib/assets/stylesheets/unpoly/link.css.sass +1 -1
  23. data/lib/assets/stylesheets/unpoly/modal.css.sass +28 -15
  24. data/lib/unpoly/rails/version.rb +1 -1
  25. data/spec_app/Gemfile.lock +7 -7
  26. data/spec_app/spec/javascripts/helpers/reset_up.js.coffee +2 -0
  27. data/spec_app/spec/javascripts/helpers/to_contain.js.coffee +5 -0
  28. data/spec_app/spec/javascripts/up/flow_spec.js.coffee +2 -2
  29. data/spec_app/spec/javascripts/up/history_spec.js.coffee +6 -4
  30. data/spec_app/spec/javascripts/up/link_spec.js.coffee +114 -5
  31. data/spec_app/spec/javascripts/up/modal_spec.js.coffee +28 -18
  32. data/spec_app/spec/javascripts/up/motion_spec.js.coffee +112 -7
  33. data/spec_app/spec/javascripts/up/navigation_spec.js.coffee +157 -121
  34. data/spec_app/spec/javascripts/up/popup_spec.js.coffee +1 -1
  35. data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +42 -3
  36. data/spec_app/spec/javascripts/up/syntax_spec.js.coffee +1 -2
  37. data/spec_app/spec/javascripts/up/util_spec.js.coffee +26 -1
  38. data/spec_app/vendor/assets/bower_components/jquery/.bower.json +1 -1
  39. metadata +3 -3
  40. data/spec_app/spec/javascripts/helpers/set_timer.js.coffee +0 -3
data/dist/unpoly.min.css CHANGED
@@ -1 +1 @@
1
- [up-close]{cursor:pointer}.up-error{background-color:#e10;color:white;padding:5px;font-family:arial, helvetica, sans-serif;font-weight:bold;font-size:14px;line-height:18px;position:fixed;left:0;top:0;max-width:100%;box-sizing:border-box;z-index:99999999}[up-href][up-follow],[up-href][up-target]{cursor:pointer}.up-modal{position:fixed;top:0;left:0;bottom:0;right:0;z-index:10000;background-color:rgba(90,90,90,0.4);overflow-x:hidden;overflow-y:scroll;text-align:center}.up-modal-dialog{z-index:1000;position:relative;box-sizing:border-box;margin:30px 10px;max-width:100%;display:inline-block;text-align:left}.up-modal-content{z-index:2000;padding:20px;background-color:#fff;box-shadow:0 0 10px 1px rgba(0,0,0,0.3)}.up-modal-close{z-index:3000;position:absolute;right:0;top:0;width:36px;text-align:center;line-height:36px;height:36px;font-size:34px;color:#666;cursor:pointer}.up-popup{z-index:20000;position:absolute;background-color:#fff;padding:15px;box-shadow:0 0 4px rgba(0,0,0,0.3)}.up-tooltip{position:absolute;z-index:30000;background-color:#111;color:white;padding:6px 9px;white-space:nowrap}.up-tooltip:after{content:"";position:absolute;display:block;width:0;height:0;border:8px solid transparent}.up-tooltip[up-position=top]{margin-top:-6px}.up-tooltip[up-position=top]:after{border-top-color:#111;bottom:-16px;left:50%;margin-left:-8px}.up-tooltip[up-position=left]{margin-left:-6px}.up-tooltip[up-position=left]:after{border-left-color:#111;right:-16px;top:50%;margin-top:-8px}.up-tooltip[up-position=right]{margin-left:6px}.up-tooltip[up-position=right]:after{border-right-color:#111;left:-16px;top:50%;margin-top:-8px}.up-tooltip[up-position=bottom]{margin-top:6px}.up-tooltip[up-position=bottom]:after{border-bottom-color:#111;top:-16px;left:50%;margin-left:-8px}
1
+ [up-close]{cursor:pointer}.up-error{background-color:#e10;color:white;padding:5px;font-family:arial, helvetica, sans-serif;font-weight:bold;font-size:14px;line-height:18px;position:fixed;left:0;top:0;max-width:100%;box-sizing:border-box;z-index:99999999}[up-href]{cursor:pointer}.up-modal-backdrop{z-index:10000;background-color:rgba(90,90,90,0.4);position:fixed;top:0;right:0;bottom:0;left:0}.up-modal-viewport{z-index:11000;position:fixed;top:0;left:0;bottom:0;right:0;overflow-x:hidden;overflow-y:hidden;text-align:center}.up-modal.up-modal-ready .up-modal-viewport{overflow-y:scroll}.up-modal-dialog{z-index:12000;position:relative;box-sizing:border-box;margin:30px 10px;max-width:100%;display:inline-block;text-align:left}.up-modal-content{z-index:13000;padding:20px;background-color:#fff;box-shadow:0 0 10px 1px rgba(0,0,0,0.3)}.up-modal-close{z-index:14000;position:absolute;right:0;top:0;width:36px;text-align:center;line-height:36px;height:36px;font-size:34px;color:#666;cursor:pointer}.up-popup{z-index:20000;position:absolute;background-color:#fff;padding:15px;box-shadow:0 0 4px rgba(0,0,0,0.3)}.up-tooltip{position:absolute;z-index:30000;background-color:#111;color:white;padding:6px 9px;white-space:nowrap}.up-tooltip:after{content:"";position:absolute;display:block;width:0;height:0;border:8px solid transparent}.up-tooltip[up-position=top]{margin-top:-6px}.up-tooltip[up-position=top]:after{border-top-color:#111;bottom:-16px;left:50%;margin-left:-8px}.up-tooltip[up-position=left]{margin-left:-6px}.up-tooltip[up-position=left]:after{border-left-color:#111;right:-16px;top:50%;margin-top:-8px}.up-tooltip[up-position=right]{margin-left:6px}.up-tooltip[up-position=right]:after{border-right-color:#111;left:-16px;top:50%;margin-top:-8px}.up-tooltip[up-position=bottom]{margin-top:6px}.up-tooltip[up-position=bottom]:after{border-bottom-color:#111;top:-16px;left:50%;margin-left:-8px}
data/dist/unpoly.min.js CHANGED
@@ -1,3 +1,3 @@
1
- (function(){window.up={}}).call(this),function(){var e=[].slice;up.util=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,S,x,$,D,T,P,E,C,A,F,U,O,R,M,j,K,z,L,I,q,W,N,H,_,Q,V,J,B,X,G,Y,Z,et,tt,nt,rt,ot,ut,it,at,st,lt,ct,pt,ft,dt,mt,ht,vt,gt,yt,bt,wt,kt,St,xt,$t,Dt,Tt,Pt,Et,Ct,At,Ft,Ut,Ot,Rt,Mt,jt,Kt,zt,Lt,It;return tt=function(t){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?e.call(arguments,0):[],r?n:(r=!0,n=t.apply(null,o))}},Q=function(e,t){return t=t.toString(),(""===t||"80"===t)&&"http:"===e||"443"===t&&"https:"===e},st=function(e,t){var n,r,o;return n=ht(e),r=n.protocol+"//"+n.hostname,Q(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=t?t.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=t?t.hash:void 0)===!0&&(r+=n.hash),(null!=t?t.search:void 0)!==!1&&(r+=n.search),r},ht=function(e){var n;return n=null,V(e)?(n=t("<a>").attr({href:e}).get(0),F(n.hostname)&&(n.href=n.href)):n=jt(e),n},at=function(e){return e?e.toUpperCase():"GET"},n=function(e){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;for(v=e.split(/[ >]/),o=null,f=c=0,m=v.length;m>c;f=++c){for(a=v[f],i=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",u=[],p=null,d=0,h=i.length;h>d;d++)switch(s=i[d],s[0]){case".":u.push(s.substr(1));break;case"#":p=s.substr(1);break;default:g=s}l="<"+g,u.length&&(l+=' class="'+u.join(" ")+'"'),p&&(l+=' id="'+p+'"'),l+=">",n=t(l),r&&n.appendTo(r),0===f&&(o=n),r=n}return o},v=function(e,t){var n;return n=document.createElement(e),H(t)&&(n.innerHTML=t),n},r=function(e,t){var r;return null==t&&(t=document.body),r=n(e),r.addClass("up-placeholder"),r.appendTo(t),r},Ct=function(e){var n,r,o,u,i,a,s,l,c;if(n=t(e),l=void 0,up.puts("Creating selector from element %o",n.get(0)),c=gt(n.attr("up-id")))l="[up-id='"+c+"']";else if(u=gt(n.attr("id")))l="#"+u;else if(s=gt(n.attr("name")))l="[name='"+s+"']";else if(r=gt(it(n)))for(l="",o=0,a=r.length;a>o;o++)i=r[o],l+="."+i;else l=n.prop("tagName").toLowerCase();return l},it=function(e){var t,n;return t=e.attr("class")||"",n=t.split(" "),Et(n,function(e){return H(e)&&!e.match(/^up-/)})},g=function(e){var t,n,r,o,u,i,a,s,l,c,p,f;return l=function(e){return"<"+e+"(?: [^>]*)?>"},i=function(e){return"</"+e+">"},t="(?:.|\\n)*?",u=function(e){return"("+e+")"},f=new RegExp(l("head")+t+l("title")+u(t)+i("title")+t+i("body"),"i"),o=new RegExp(l("body")+u(t)+i("body"),"i"),(r=e.match(o))?(s=document.createElement("html"),n=v("body",r[1]),s.appendChild(n),(p=e.match(f))&&(a=v("head"),s.appendChild(a),c=v("title",p[1]),a.appendChild(c)),s):v("div",e)},$=t.extend,Mt=t.trim,w=function(e,t){var n,r,o,u,i;for(i=[],r=n=0,u=e.length;u>n;r=++n)o=e[r],i.push(t(o,r));return i},Z=w,Ut=function(e,t){var n,r,o,u;for(u=[],r=n=0,o=e-1;o>=0?o>=n:n>=o;r=o>=0?++n:--n)u.push(t(r));return u},q=function(e){return null===e},J=function(e){return void 0===e},O=function(e){return!J(e)},I=function(e){return J(e)||q(e)},K=function(e){return!I(e)},F=function(e){return I(e)||N(e)&&0===Object.keys(e).length||0===e.length},gt=function(e,t){return null==t&&(t=H),t(e)?e:void 0},H=function(e){return!F(e)},j=function(e){return"function"==typeof e},V=function(e){return"string"==typeof e},W=function(e){return"number"==typeof e},z=function(e){return"object"==typeof e&&!!e},N=function(e){return z(e)||"function"==typeof e},R=function(e){return!(!e||1!==e.nodeType)},L=function(e){return e instanceof jQuery},_=function(e){return N(e)&&j(e.then)},U=function(e){return _(e)&&j(e.resolve)},A=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},M=function(e){return up.browser.canFormData()&&e instanceof FormData},Rt=function(e){return Array.prototype.slice.call(e)},m=function(e){return A(e)?e.slice():$({},e)},jt=function(e){return L(e)?e.get(0):e},nt=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],$.apply(null,[{}].concat(e.call(t)))},mt=function(e,t){var n,r,o,u;if(o=e?m(e):{},t)for(r in t)n=t[r],u=o[r],K(u)?N(n)&&N(u)&&(o[r]=mt(u,n)):o[r]=n;return o},dt=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],b(t,K)},b=function(e,t){var n,r,o,u;for(u=void 0,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=n;break}return u},i=function(e,t){var n,r,o,u;for(u=!1,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=!0;break}return u},u=function(e,t){var n,r,o,u;for(u=!0,r=0,o=e.length;o>r;r++)if(n=e[r],!t(n)){u=!1;break}return u},p=function(e){return Et(e,K)},Kt=function(e){var t;return t={},Et(e,function(e){return t.hasOwnProperty(e)?!1:t[e]=!0})},Et=function(e,t){var n;return n=[],w(e,function(e){return t(e)?n.push(e):void 0}),n},bt=function(e,t){return Et(e,function(e){return!t(e)})},C=function(e,t){return Et(e,function(e){return d(t,e)})},yt=function(){var t,n,r,o;return t=arguments[0],r=2<=arguments.length?e.call(arguments,1):[],o=function(){var e,o,u;for(u=[],e=0,o=r.length;o>e;e++)n=r[e],u.push(t.attr(n));return u}(),b(o,H)},ut=function(e){return setTimeout(e,0)},G=function(e){return e[e.length-1]},c=function(){var e;return e=document.documentElement,{width:e.clientWidth,height:e.clientHeight}},Pt=tt(function(){var e,n,r;return e=t("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),e.appendTo(document.body),n=e.get(0),r=n.offsetWidth-n.clientWidth,e.remove(),r}),pt=function(t){var n;return n=void 0,function(){var r;return r=1<=arguments.length?e.call(arguments,0):[],null!=t&&(n=t.apply(null,r)),t=void 0,n}},Ft=function(e,t,n){var r,o;return o=e.css(Object.keys(t)),e.css(t),r=function(){return e.css(o)},n?(n(),r()):pt(r)},E=function(e){var t,n;return n=e.css(["transform","-webkit-transform"]),F(n)||"none"===n.transform?(t=function(){return e.css(n)},e.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):t=function(){},t},y=function(e,n,r){var u,i,a,s,l,c;return u=t(e),r=mt(r,{duration:300,delay:0,easing:"ease"}),i=t.Deferred(),s={"transition-property":Object.keys(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},l=E(u),c=Ft(u,s),u.css(n),i.then(l),i.then(c),u.data(o,i),i.then(function(){return u.removeData(o)}),a=setTimeout(function(){return i.resolve()},r.duration+r.delay),i.then(function(){return clearTimeout(a)}),i},o="up-animation-deferred",T=function(e){return t(e).each(function(){var e;return(e=vt(this,o))?e.resolve():void 0})},et=function(e,n){var r,o,u,i,a,s;return n=mt(n,{relative:!1,inner:!1,full:!1}),n.relative?n.relative===!0?a=e.position():(r=t(n.relative),s=e.offset(),r.is(document)?a=s:(i=r.offset(),a={left:s.left-i.left,top:s.top-i.top})):a=e.offset(),u={left:a.left,top:a.top},n.inner?(u.width=e.width(),u.height=e.height()):(u.width=e.outerWidth(),u.height=e.outerHeight()),n.full&&(o=up.layout.viewportOf(e),u.right=o.width()-(u.left+u.width),u.bottom=o.height()-(u.top+u.height)),u},h=function(e,t){var n,r,o,u,i;for(u=e.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)n=u[r],i.push(n.specified?t.attr(n.name,n.value):void 0);return i},D=function(e,t){return e.find(t).addBack(t)},S=function(e){return 27===e.keyCode},d=function(e,t){return e.indexOf(t)>=0},l=function(e,t){var n;switch(n=e.attr(t)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},Y=function(e){return e.getResponseHeader("X-Up-Location")},Ot=function(e){return e.getResponseHeader("X-Up-Title")},rt=function(e){return e.getResponseHeader("X-Up-Method")},ft=function(){var t,n,r,o,u,i;for(o=arguments[0],u=2<=arguments.length?e.call(arguments,1):[],t={},n=0,r=u.length;r>n;n++)i=u[n],o.hasOwnProperty(i)&&(t[i]=o[i]);return t},x=function(){var t,n,r,o,u,i;for(o=arguments[0],u=2<=arguments.length?e.call(arguments,1):[],t=m(o),n=0,r=u.length;r>n;n++)i=u[n],delete t[i];return t},B=function(e){return!(e.metaKey||e.shiftKey||e.ctrlKey)},X=function(e){var t;return t=J(e.button)||0===e.button,t&&B(e)},Dt=function(){var e;return e=t.Deferred(),e.resolve(),e},Tt=function(){return Dt().promise()},zt=function(){return t.Deferred()},Lt=function(){return zt().promise()},lt=function(){return t()},$t=function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],r=t.when.apply(t,[Dt()].concat(e.call(n))),r.resolve=tt(function(){return w(n,function(e){return e.resolve()})}),r},At=function(e,t){var n,r,o;r=[];for(n in t)o=t[n],r.push(I(e.attr(n))?e.attr(n,o):void 0);return r},wt=function(e,t){var n;return n=e.indexOf(t),n>=0?(e.splice(n,1),t):void 0},ot=function(e){var n,r,o,u,a,s,l;for(a={},l=[],r=[],o=0,u=e.length;u>o;o++)s=e[o],V(s)?l.push(s):r.push(s);return a.parsed=r,l.length&&(n=l.join(", "),a.parsed.push(n)),a.select=function(){return a.find(void 0)},a.find=function(e){var n,r,o,u,i,s;for(r=lt(),i=a.parsed,o=0,u=i.length;u>o;o++)s=i[o],n=e?e.find(s):t(s),r=r.add(n);return r},a.findWithSelf=function(e){var t;return t=a.find(e),a.doesMatch(e)&&(t=t.add(e)),t},a.doesMatch=function(e){var n;return n=t(e),i(a.parsed,function(e){return n.is(e)})},a.seekUp=function(e){var n,r,o;for(o=t(e),n=o,r=void 0;n.length;){if(a.doesMatch(n)){r=n;break}n=n.parent()}return r||lt()},a},s=function(t){var n,r,o,u,i,a,s,l,c,p,f,d;return null==t&&(t={}),f=void 0,r=function(){return f={}},r(),s=function(){var n;return n=1<=arguments.length?e.call(arguments,0):[],t.log?(n[0]="["+t.log+"] "+n[0],up.puts.apply(up,n)):void 0},a=function(){return Object.keys(f)},l=function(){return I(t.size)?void 0:j(t.size)?t.size():W(t.size)?t.size:k("Invalid size config: %o",t.size)},o=function(){return I(t.expiry)?void 0:j(t.expiry)?t.expiry():W(t.expiry)?t.expiry:k("Invalid expiry config: %o",t.expiry)},c=function(e){return t.key?t.key(e):e.toString()},Mt=function(){var e,t,n,r;return r=m(a()),n=l(),n&&r.length>n&&(e=null,t=null,w(r,function(n){var r,o;return r=f[n],o=r.timestamp,!t||t>o?(e=n,t=o):void 0}),e)?delete f[e]:void 0},n=function(e,t){var n;return n=u(e,{silent:!0}),O(n)?p(t,n):void 0},d=function(){return(new Date).valueOf()},p=function(e,t){var n;return n=c(e),f[n]={timestamp:d(),value:t}},wt=function(e){var t;return t=c(e),delete f[t]},i=function(e){var t,n;return t=o(),t?(n=d()-e.timestamp,n<o()):!0},u=function(e,t){var n,r;return null==t&&(t={}),r=c(e),(n=f[r])?i(n)?(t.silent||s("Cache hit for '%s'",e),n.value):(t.silent||s("Discarding stale cache entry for '%s'",e),void wt(e)):void(t.silent||s("Cache miss for '%s'",e))},{alias:n,get:u,set:p,remove:wt,clear:r,keys:a}},f=function(e){var t;return null==e&&(e={}),t={},t.reset=function(){return $(t,e)},t.reset(),Object.preventExtensions(t),t},It=function(e){var t,n;return e=jt(e),t=e.parentNode,n=Rt(e.childNodes),w(n,function(n){return t.insertBefore(n,e)}),t.removeChild(e)},ct=function(e){var t,n;for(t=void 0;(e=e.parent())&&e.length;)if(n=e.css("position"),"absolute"===n||"relative"===n||e.is("body")){t=e;break}return t},P=function(e,n){var r,o,u,i;return r=t(e),o=ct(r),u=r.position(),i=o.offset(),r.css({position:"absolute",left:u.left-i.left,top:u.top-i.top+n.scrollTop(),right:"",bottom:""})},kt=function(e){var t,n,r,o,u,i,a;if(M(e))return up.error("Cannot convert FormData into an array");for(i=St(e),t=[],a=i.split("&"),n=0,r=a.length;r>n;n++)u=a[n],H(u)&&(o=u.split("="),t.push({name:decodeURIComponent(o[0]),value:decodeURIComponent(o[1])}));return t},St=function(e){var n;return M(e)?up.error("Cannot convert FormData into a query string"):H(e)?(n=t.param(e),n=n.replace(/\+/g,"%20")):""},xt=function(e){var n,r;return n=t(e),r=n.find("input[type=file]").length,r&&up.browser.canFormData()?new FormData(n.get(0)):n.serializeArray()},a=function(e,t,n){var r;return M(e)?e.append(t,n):A(e)?e.push({name:t,value:n}):N(e)?e[t]=n:(V(e)||I(e))&&(r=St([{name:t,value:n}]),e=H(e)?[e,r].join("&"):r),e},k=function(){var n,r,o,u,i;throw r=1<=arguments.length?e.call(arguments,0):[],(u=up.log).error.apply(u,r),o=(i=up.browser).sprintf.apply(i,r),n=gt(t(".up-error"))||t('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(o),new Error(o)},vt=function(e,n){var r,o;return r=t(e),o=r.data(n),r.removeData(n),o},{requestDataAsArray:kt,requestDataAsQuery:St,appendRequestData:a,requestDataFromForm:xt,offsetParent:ct,fixedToAbsolute:P,presentAttr:yt,createElement:v,parseUrl:ht,normalizeUrl:st,normalizeMethod:at,createElementFromHtml:g,$createElementFromSelector:n,$createPlaceholder:r,selectorForElement:Ct,extend:$,copy:m,merge:nt,options:mt,option:dt,error:k,each:w,map:Z,times:Ut,any:i,all:u,detect:b,select:Et,reject:bt,intersect:C,compact:p,uniq:Kt,last:G,isNull:q,isDefined:O,isUndefined:J,isGiven:K,isMissing:I,isPresent:H,isBlank:F,presence:gt,isObject:N,isFunction:j,isString:V,isElement:R,isJQuery:L,isPromise:_,isDeferred:U,isHash:z,isArray:A,isFormData:M,isUnmodifiedKeyEvent:B,isUnmodifiedMouseEvent:X,nullJQuery:lt,unJQuery:jt,nextFrame:ut,measure:et,temporaryCss:Ft,cssAnimate:y,finishCssAnimate:T,forceCompositing:E,escapePressed:S,copyAttributes:h,findWithSelf:D,contains:d,toArray:Rt,castedAttr:l,locationFromXhr:Y,titleFromXhr:Ot,methodFromXhr:rt,clientSize:c,only:ft,except:x,trim:Mt,unresolvableDeferred:zt,unresolvablePromise:Lt,resolvedPromise:Tt,resolvedDeferred:Dt,resolvableWhen:$t,setMissingAttrs:At,remove:wt,memoize:tt,scrollbarWidth:Pt,config:f,cache:s,unwrapElement:It,multiSelector:ot,error:k,pluckData:vt}}($),up.error=up.util.error}.call(this),function(){var e=[].slice;up.log=function(){var t,n,r,o,u,i;return o=function(e){return"\u1d1c\u1d18 "+e},t=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?(r=up.browser).puts.apply(r,["debug",o(n)].concat(e.call(t))):void 0},u=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?(r=up.browser).puts.apply(r,["log",o(n)].concat(e.call(t))):void 0},i=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?(r=up.browser).puts.apply(r,["warn",o(n)].concat(e.call(t))):void 0},r=function(){var t,n,r,u;if(r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n=t.pop(),!r)return n();(u=up.browser).puts.apply(u,["groupCollapsed",o(r)].concat(e.call(t)));try{return n()}finally{r&&console.groupEnd()}},n=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?(r=up.browser).puts.apply(r,["error",o(n)].concat(e.call(t))):void 0},{puts:u,debug:t,error:n,warn:i,group:r}}(jQuery),up.puts=up.log.puts}.call(this),function(){var e=[].slice;up.browser=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w;return b=up.util,h=function(e,n){var r,o,u,i,a;return null==n&&(n={}),i=b.option(n.method,"get").toLowerCase(),"get"===i?(a=b.requestDataAsQuery(n.data),a&&(e=e+"?"+a),location.href=e):(r=t("<form method='post' action='"+e+"'></form>"),o=function(e){var n;return n=t('<input type="hidden">'),n.attr(e.name,e.value),n.appendTo(r)},o({name:up.proxy.config.wrapMethodParam,value:i}),(u=up.rails.csrfField())&&o(u),b.each(b.requestDataAsArray(n.data),o),r.hide().appendTo("body"),r.submit())},g=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],b.isDefined(console[r])||(r="log"),i()?console[r].apply(console,t):(n=y.apply(null,t),console[r](n))},n=/\%[odisf]/g,y=function(){var t,r,o,u;return u=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],r=0,o=80,u.replace(n,function(){var e,n;return e=t[r],n=typeof e,"string"===n?(e=e.replace(/\s+/g," "),e.length>o&&(e=e.substr(0,o)+"\u2026"),e='"'+e+'"'):e="undefined"===n?"undefined":"number"===n||"function"===n?e.toString():JSON.stringify(e),e.length>o&&(e=e.substr(0,o)+" \u2026",("object"===n||"function"===n)&&(e+=" }")),r+=1,e})},w=function(){return location.href},p=b.memoize(function(){return b.isUndefined(document.addEventListener)}),f=b.memoize(function(){return p()||-1!==navigator.appVersion.indexOf("MSIE 9.")}),a=b.memoize(function(){return b.isDefined(history.pushState)&&"get"===l()}),r=b.memoize(function(){return"transition"in document.documentElement.style}),u=b.memoize(function(){return"oninput"in document.createElement("input")}),o=b.memoize(function(){return!!window.FormData}),i=b.memoize(function(){return!f()}),d=b.memoize(function(){var e,n,r,o;return o=t.fn.jquery,r=o.split("."),e=parseInt(r[0]),n=parseInt(r[1]),e>=2||1===e&&n>=9}),v=function(e){var t,n;return n=null!=(t=document.cookie.match(new RegExp(e+"=(\\w+)")))?t[1]:void 0,b.isPresent(n)&&(document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},s=function(e){return e.preload||b.isBlank(e.confirm)||window.confirm(e.confirm)?b.resolvedPromise():b.unresolvablePromise()},l=b.memoize(function(){return(v("_up_request_method")||"get").toLowerCase()}),m=function(){return!p()&&d()},c=function(){return console.group||(console.group=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],g.apply(null,["group"].concat(e.call(t)))}),console.groupCollapsed||(console.groupCollapsed=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],g.apply(null,["groupCollapsed"].concat(e.call(t)))}),console.groupEnd||(console.groupEnd=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],g.apply(null,["groupEnd"].concat(e.call(t)))})},{url:w,loadPage:h,confirm:s,canPushState:a,canCssTransition:r,canInputEvent:u,canFormData:o,canLogSubstitution:i,isSupported:m,installPolyfills:c,puts:g,sprintf:y}}(jQuery)}.call(this),function(){var slice=[].slice;up.bus=function($){var boot,emit,emitReset,forgetUpDescription,live,liveUpDescriptions,logEmission,nextUpDescriptionNumber,nobodyPrevents,onEscape,rememberUpDescription,restoreSnapshot,snapshot,u,unbind,upDescriptionNumber,upDescriptionToJqueryDescription,upListenerToJqueryListener;return u=up.util,liveUpDescriptions={},nextUpDescriptionNumber=0,upListenerToJqueryListener=function(e){return function(t){var n;return n=t.$element||$(this),e.apply(n.get(0),[t,n,up.syntax.data(n)])}},upDescriptionToJqueryDescription=function(e,t){var n,r,o;return n=u.copy(e),o=n.pop(),r=void 0,t?(r=upListenerToJqueryListener(o),o._asJqueryListener=r,o._descriptionNumber=++nextUpDescriptionNumber):(r=o._asJqueryListener,r||u.error("up.off: The event listener %o was never registered through up.on")),n.push(r),n},live=function(){var e,t,n;return n=1<=arguments.length?slice.call(arguments,0):[],up.browser.isSupported()?(e=upDescriptionToJqueryDescription(n,!0),rememberUpDescription(n),(t=$(document)).on.apply(t,e),function(){return unbind.apply(null,n)}):function(){}},unbind=function(){var e,t,n;return n=1<=arguments.length?slice.call(arguments,0):[],e=upDescriptionToJqueryDescription(n,!1),forgetUpDescription(n),(t=$(document)).off.apply(t,e)},rememberUpDescription=function(e){var t;return t=upDescriptionNumber(e),liveUpDescriptions[t]=e},forgetUpDescription=function(e){var t;return t=upDescriptionNumber(e),delete liveUpDescriptions[t]},upDescriptionNumber=function(e){return u.last(e)._descriptionNumber},emit=function(e,t){var n,r;return null==t&&(t={}),r=$.Event(e,t),(n=t.$element)?delete t.$element:n=$(document),logEmission(e,t),n.trigger(r),r},logEmission=function(e,t){var n,r,o;return t.hasOwnProperty("message")?(n=t.message,delete t.message,u.isArray(n)?(o=n,n=o[0],r=2<=o.length?slice.call(o,1):[]):r=[],n?u.isPresent(t)?up.puts.apply(up,[n+" (%s (%o))"].concat(slice.call(r),[e],[t])):up.puts.apply(up,[n+" (%s)"].concat(slice.call(r),[e])):void 0):u.isPresent(t)?up.puts("Emitted event %s (%o)",e,t):up.puts("Emitted event %s",e)},nobodyPrevents=function(){var e,t;return e=1<=arguments.length?slice.call(arguments,0):[],t=emit.apply(null,e),t.isDefaultPrevented()?(up.puts("An observer prevented the event %s",e[0]),!1):!0},onEscape=function(e){return live("keydown","body",function(t){return u.escapePressed(t)?e(t):void 0})},snapshot=function(){var e,t,n,r;for(r=[],t=0,n=liveUpDescriptions.length;n>t;t++)e=liveUpDescriptions[t],r.push(e.isDefault=!0);return r},restoreSnapshot=function(){var e,t,n,r,o;for(t=u.reject(liveUpDescriptions,function(e){return e.isDefault}),o=[],n=0,r=t.length;r>n;n++)e=t[n],o.push(unbind.apply(null,e));return o},emitReset=function(){return up.emit("up:framework:reset",{message:"Resetting framework"})},boot=function(){return up.browser.isSupported()?(up.browser.installPolyfills(),up.emit("up:framework:boot",{message:"Booting framework"})):void 0},live("up:framework:boot",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,onEscape:onEscape,emitReset:emitReset,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 e=[].slice;up.syntax=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,n="up-destroyable",r="up-destroyer",l=[],d=[],s=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],p.apply(null,[l].concat(e.call(t)))},f=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],p.apply(null,[d].concat(e.call(t)))},u=function(){var t,n,r,o;return o=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n=t.pop(),r=v.options(t[0],{priority:0}),{selector:o,callback:n,priority:r.priority,batch:r.batch,keep:r.keep}},p=function(){var t,n,r,o,i;if(i=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],up.browser.isSupported()){for(r=u.apply(null,t),n=0;(o=i[n])&&o.priority<=r.priority;)n+=1;return i.splice(n,0,r)}},o=function(e,t,o){var u,i;return up.puts(e.isDefault?void 0:"Compiling '%s' on %o",e.selector,o),e.keep&&(i=v.isString(e.keep)?e.keep:"",t.attr("up-keep",i)),u=e.callback.apply(o,[t,c(t)]),v.isFunction(u)?(t.addClass(n),t.data(r,u)):void 0},a=function(e,n){var r;return n=v.options(n),r=t(n.skip),up.log.group("Compiling fragment %o",e.get(0),function(){var n,u,i,a,c,p;for(c=[d,l],p=[],u=0,i=c.length;i>u;u++)a=c[u],p.push(function(){var u,i,l;for(l=[],u=0,i=a.length;i>u;u++)s=a[u],n=v.findWithSelf(e,s.selector),n=n.filter(function(){var e;return e=t(this),v.all(r,function(t){return 0===e.closest(t).length})}),l.push(n.length?up.log.group(s.isDefault?void 0:"Compiling '%s' on %d element(s)",s.selector,n.length,function(){return s.batch?o(s,n,n.get()):n.each(function(){return o(s,t(this),this)})}):void 0);return l}());return p})},i=function(e){return v.findWithSelf(e,"."+n).each(function(){var e,n;return e=t(this),(n=e.data(r))()})},c=function(e){var n,r;return n=t(e),r=n.attr("up-data"),v.isString(r)&&""!==v.trim(r)?JSON.parse(r):{}},h=function(){var e,t,n;for(n=[],e=0,t=l.length;t>e;e++)s=l[e],n.push(s.isDefault=!0);return n},m=function(){return l=v.select(l,function(e){return e.isDefault})},up.on("up:framework:boot",h),up.on("up:framework:reset",m),{compiler:s,macro:f,compile:a,clean:i,data:c}}(jQuery),up.compiler=up.syntax.compiler,up.macro=up.syntax.macro,up.ready=function(){return up.util.error("up.ready no longer exists. Please use up.hello instead.")},up.awaken=function(){return up.util.error("up.awaken no longer exists. Please use up.compiler instead.")}}.call(this),function(){up.history=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,i=void 0,m=function(){return n.reset(),c=void 0,i=void 0},a=function(e){return v.normalizeUrl(e,{hash:!0})},r=function(){return a(up.browser.url())},o=function(e){return a(e)===r()},s=function(e){return i&&(c=i,i=void 0),i=e},d=function(e,t){return u("replace",e,t)},p=function(e,t){return up.puts("Current location is now %s",e),u("push",e,t)},u=function(e,n,u){var i,a;return u=v.options(u,{force:!1}),u.force||!o(n)?up.browser.canPushState()?(i=e+"State",a=t(),window.history[i](a,"",n),s(r())):v.error("This browser doesn't support history.pushState"):void 0},t=function(){return{fromUp:!0}},h=function(e){var t;return(null!=e?e.fromUp:void 0)?(t=r(),up.log.group("Restoring URL %s",t,function(){var e;return e=n.popTargets.join(", "),up.replace(e,t,{history:!1,title:!0,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll})})):up.puts("Ignoring a state not pushed by Unpoly (%o)",e)},l=function(e){return up.log.group("History state popped to URL %s",r(),function(){var t;return s(r()),up.layout.saveScroll({url:c}),t=e.originalEvent.state,h(t)})},up.browser.canPushState()&&(f=function(){return e(window).on("popstate",l),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(e){return v.isPresent(c)?(v.setMissingAttrs(e,{"up-href":c,"up-restore-scroll":""}),e.removeAttr("up-back"),up.link.makeFollowable(e)):void 0}),up.on("up:framework:reset",m),{config:n,defaults:function(){return v.error("up.history.defaults(...) no longer exists. Set values on he up.history.config property instead.")},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,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,revealOrRestoreScroll,saveScroll,scroll,scrollTops,u,viewportOf,viewportSelector,viewports,viewportsWithin;return u=up.util,config=u.config({duration:0,viewports:[document,".up-modal","[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(e,t,n){var r,o,i,a,s;return r=$(e),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:t},r.get(0)===document&&(r=$("html, body")),r.animate(s,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(t),u.resolvedDeferred())},finishScrolling=function(e){return $(e).each(function(){var e;return(e=$(this).data(SCROLL_PROMISE_KEY))?e.resolve():void 0})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var e,t,n,r;return n=function(e,t){var n,r;return n=$(e),r=n.css(t),u.isPresent(r)||u.error("Fixed element %o must have a CSS attribute %s",n.get(0),t),parseInt(r)+n.height()},t=function(){var e,t,o,u;for(o=$(config.fixedTop.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"top"));return u}(),e=function(){var e,t,o,u;for(o=$(config.fixedBottom.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"bottom"));return u}(),{top:Math.max.apply(Math,[0].concat(slice.call(t))),bottom:Math.max.apply(Math,[0].concat(slice.call(e)))}},reveal=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m,h,v;return n=$(e),up.puts("Revealing fragment %o",e.get(0)),t=u.options(t),r=t.viewport?$(t.viewport):viewportOf(n),m=u.option(t.snap,config.snap),v=r.is(document),h=v?u.clientSize().height:r.height(),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+h-l.bottom-1},o=u.measure(n,{relative:r}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(s+=a-d()),(i<f()||t.top)&&(s=i-l.top),m>s&&(s=0),s!==p?scroll(r,s,t):u.resolvedDeferred()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(e,t){var n,r;return null==t&&(t={}),n=$(e),r=viewportSelector().seekUp(n),0===r.length&&t.strict!==!1&&u.error("Could not find viewport for %o",n),r},viewportsWithin=function(e){var t;return t=$(e),viewportSelector().findWithSelf(t)},viewports=function(){return viewportSelector().select()},scrollTops=function(){var e,t,n,r,o,u,i;for(u={},o=config.viewports,t=0,r=o.length;r>t;t++)i=o[t],e=$(i),e.length&&(n=i,i===document&&(n="document"),u[n]=e.scrollTop());return u},fixedChildren=function(e){var t,n;return null==e&&(e=void 0),e||(e=document.body),n=$(e),t=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(t=t.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(t=t.add(n.find(config.fixedBottom.join(", ")))),t},saveScroll=function(e){var t,n;return null==e&&(e={}),n=u.option(e.url,up.history.url()),t=u.option(e.tops,scrollTops()),up.puts("Saving scroll positions for URL %s (%o)",n,t),lastScrollTops.set(n,t)},restoreScroll=function(e){var t,n,r,o,i;return null==e&&(e={}),i=up.history.url(),r=void 0,e.around?(n=viewportsWithin(e.around),t=viewportOf(e.around),r=t.add(n)):r=viewports(),o=lastScrollTops.get(i),up.log.group("Restoring scroll positions for URL %s to %o",i,o,function(){var e,t,n,i;for(t in o)i=o[t],n="document"===t?document:t,e=r.filter(n),scroll(e,i,{duration:0});return u.resolvedDeferred()})},revealOrRestoreScroll=function(e,t){var n,r,o,i;return n=$(e),t.restoreScroll?restoreScroll({around:n}):t.reveal?(t.source&&(i=u.parseUrl(t.source),i.hash&&"#"!==i.hash&&(o=i.hash.substr(1),r=u.findWithSelf(n,"#"+o+", a[name='"+o+"']"),r.length&&(n=r))),reveal(n)):u.resolvedDeferred()},up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,scroll:scroll,finishScrolling:finishScrolling,config:config,defaults:function(){return u.error("up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.")},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}.call(this),function(){up.flow=function($){var autofocus,destroy,emitFragmentInserted,emitFragmentKept,extract,findKeepPlan,findOldFragment,first,hello,isRealElement,oldFragmentNotFound,parseImplantSteps,parseResponse,processResponse,reload,replace,resolveSelector,setSource,source,swapElements,transferKeepableElements,u,updateHistory;return u=up.util,setSource=function(e,t){var n;return n=$(e),u.isPresent(t)&&(t=u.normalizeUrl(t)),n.attr("up-source",t)},source=function(e){var t;return t=$(e).closest("[up-source]"),u.presence(t.attr("up-source"))||up.browser.url()},resolveSelector=function(e,t){var n,r;return u.isString(e)?(r=e,u.contains(r,"&")&&(t?(n=u.selectorForElement(t),r=r.replace(/\&/,n)):u.error("Found origin reference (%s) in selector %s, but options.origin is missing","&",r))):r=u.selectorForElement(e),r},replace=function(e,t,n){var r,o,i,a;return up.puts("Replacing %s from %s (%o)",e,t,n),n=u.options(n),a=resolveSelector(e,n.origin),r=u.option(n.failTarget,"body"),r=resolveSelector(r,n.origin),up.browser.canPushState()||n.history===!1?(i={url:t,method:n.method,data:n.data,target:a,failTarget:r,cache:n.cache,preload:n.preload,headers:n.headers},o=up.ajax(i),o.done(function(e,r,o){return processResponse(!0,a,t,i,o,n)}),o.fail(function(e){return processResponse(!1,r,t,i,e,n)}),o):(n.preload||up.browser.loadPage(t,u.only(n,"method","data")),u.unresolvablePromise())},processResponse=function(e,t,n,r,o,i){var a,s,l,c;return i.method=u.normalizeMethod(u.option(u.methodFromXhr(o),i.method)),i.title=u.option(u.titleFromXhr(o),i.title),i.title===!1||u.isString(i.title)||i.history===!1&&i.title!==!0||(i.title=u.titleFromXhr(o)),a="GET"===i.method,(c=u.locationFromXhr(o))?(n=c,e&&(s={url:n,method:u.methodFromXhr(o),target:t},up.proxy.alias(r,s))):a&&(l=u.requestDataAsQuery(i.data))&&(n=n+"?"+l),e?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)),i.preload?u.resolvedPromise():extract(t,o.responseText,i)},extract=function(e,t,n){return up.log.group("Extracting %s from %d bytes of HTML",e,null!=t?t.length:void 0,function(){var r,o,i,a,s,l,c,p;for(n=u.options(n,{historyMethod:"push",requireMatch:!0,keep:!0}),c=resolveSelector(e,n.origin),l=parseResponse(t,n),n.title||(n.title=l.title()),n.saveScroll!==!1&&up.layout.saveScroll(),"function"==typeof n.beforeSwap&&n.beforeSwap(),r=[],updateHistory(n),a=parseImplantSteps(c,n),o=0,i=a.length;i>o;o++)p=a[o],up.log.group("Updating %s",p.selector,function(){var e,t,o,u;return t=findOldFragment(p.selector,n),e=null!=(u=l.find(p.selector))?u.first():void 0,t&&e?(o=swapElements(t,e,p.pseudoClass,p.transition,n),r.push(o)):void 0});return"function"==typeof n.afterSwap&&n.afterSwap(),(s=up.motion).when.apply(s,r)})},findOldFragment=function(e,t){return first(".up-popup "+e)||first(".up-modal "+e)||first(e)||oldFragmentNotFound(e,t)
2
- },oldFragmentNotFound=function(e,t){var n;return t.requireMatch?(n="Could not find selector %s in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),u.error(n,e)):void 0},parseResponse=function(e,t){var n;return n=u.createElementFromHtml(e),{title:function(){var e;return null!=(e=n.querySelector("title"))?e.textContent:void 0},find:function(r){var o;return(o=$.find(r,n)[0])?$(o):t.requireMatch?u.error("Could not find selector %s in response %o",r,e):void 0}}},updateHistory=function(e){return e.title&&(document.title=e.title),e.history?up.history[e.historyMethod](e.history):void 0},swapElements=function(e,t,n,r,o){var i,a,s,l;return r||(r="none"),"keep"===o.source&&(o=u.merge(o,{source:source(e)})),up.motion.finish(e),n?(i=t.contents().wrap('<span class="up-insertion"></span>').parent(),"before"===n?e.prepend(i):e.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(e,t,o))?(emitFragmentKept(a),s=u.resolvedPromise()):(l=function(){return o.keepPlans=transferKeepableElements(e,t,o),t.insertBefore(e),o.source!==!1&&setSource(t,o.source),autofocus(t),hello(t,o),up.morph(e,t,r,o)},s=destroy(e,{animation:l})),s},transferKeepableElements=function(e,t,n){var r,o,i,a,s,l,c,p;if(a=[],n.keep)for(p=e.find("[up-keep]"),i=0,l=p.length;l>i;i++)s=p[i],r=$(s),(c=findKeepPlan(r,t,u.merge(n,{descendantsOnly:!0})))&&(o=r.clone(),r.replaceWith(o),c.$newElement.replaceWith(r),a.push(c));return a},findKeepPlan=function(e,t,n){var r,o,i,a,s;return n.keep&&(r=e,(s=u.castedAttr(r,"up-keep"))&&(u.isString(s)||(s="&"),s=resolveSelector(s,r),o=n.descendantsOnly?t.find(s):u.findWithSelf(t,s),o=o.first(),o.length&&o.is("[up-keep]")&&(i={$element:r,$newElement:o,newData:up.syntax.data(o)},a=u.merge(i,{message:["Keeping element %o",r.get(0)]}),up.bus.nobodyPrevents("up:fragment:keep",a))))?i:void 0},parseImplantSteps=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m;for(d=t.transition||t.animation||"none",n=/\ *,\ */,r=e.split(n),m=u.isString(m)?d.split(n):[d],l=[],o=i=0,a=r.length;a>i;o=++i)c=r[o],p=c.match(/^(.+?)(?:\:(before|after))?$/),p||u.error('Could not parse selector atom "%s"',c),e=p[1],"html"===e&&(e="body"),s=p[2],f=m[o]||u.last(m),l.push({selector:e,pseudoClass:s,transition:f});return l},hello=function(e,t){var n,r,o,i,a,s;for(n=$(e),t=u.options(t,{keepPlans:[]}),o=[],s=t.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,t),n},emitFragmentInserted=function(e,t){var n;return n=$(e),up.emit("up:fragment:inserted",{$element:n,message:["Inserted fragment %o",n.get(0)],origin:t.origin})},emitFragmentKept=function(e){var t;return t=u.merge(e,{message:["Kept fragment %o",e.$element.get(0)]}),up.emit("up:fragment:kept",t)},autofocus=function(e){var t,n;return n="[autofocus]:last",t=u.findWithSelf(e,n),t.length&&t.get(0)!==document.activeElement?t.focus():void 0},isRealElement=function(e){var t;return t=".up-ghost, .up-destroying",0===e.closest(t).length},first=function(e){var t,n,r,o,i,a;for(o=void 0,o=u.isString(e)?$(e).get():e,n=void 0,i=0,a=o.length;a>i;i++)if(r=o[i],t=$(r),isRealElement(t)){n=t;break}return n},destroy=function(e,t){var n,r,o,i,a;return n=$(e),n.is(".up-placeholder, .up-tooltip, .up-modal, .up-popup")||(i=["Destroying fragment %o",n.get(0)],a=["Destroyed fragment %o",n.get(0)]),up.bus.nobodyPrevents("up:fragment:destroy",{$element:n,message:i})?(t=u.options(t,{animation:!1}),r=up.motion.animateOptions(t),n.addClass("up-destroying"),u.isPresent(t.url)&&up.history.push(t.url),u.isPresent(t.title)&&(document.title=t.title),o=u.presence(t.animation,u.isDeferred)||up.motion.animate(n,t.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(e,t){var n;return t=u.options(t,{cache:!1}),n=t.url||source(e),replace(e,n,t)},up.on("ready",function(){var e;return e=$(document.body),setSource(e,up.browser.url()),hello(e)}),{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}}(jQuery),up.replace=up.flow.replace,up.extract=up.flow.extract,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.first=up.flow.first,up.hello=up.flow.hello}.call(this),function(){up.motion=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,S,x,$,D;return $=up.util,u={},s={},x={},l={},a=$.config({duration:300,delay:0,easing:"ease",enabled:!0}),y=function(){return u=$.copy(s),x=$.copy(l),a.reset()},m=function(){return a.enabled&&up.browser.canCssTransition()},n=function(t,o,u){var a;return a=e(t),f(a),u=r(u),"none"===o||o===!1?v():$.isFunction(o)?i(o(a,u),o):$.isString(o)?n(a,p(o),u):$.isHash(o)?m()?$.cssAnimate(a,o,u):(a.css(o),$.resolvedDeferred()):$.error("Unknown animation type for %o",o)},r=function(e,t){var n;return null==t&&(t=null),e=$.options(e),n={},n.easing=$.option(e.easing,null!=t?t.attr("up-easing"):void 0,a.easing),n.duration=Number($.option(e.duration,null!=t?t.attr("up-duration"):void 0,a.duration)),n.delay=Number($.option(e.delay,null!=t?t.attr("up-delay"):void 0,a.delay)),n},p=function(e){return u[e]||$.error("Unknown animation %o",e)},t="up-ghosting-deferred",D=function(e,n,r,o){var u,i,a,s,l,c,p;return l=void 0,a=void 0,c=void 0,s=void 0,u=up.layout.viewportOf(e),$.temporaryCss(n,{display:"none"},function(){return l=g(e,u),c=u.scrollTop()}),$.temporaryCss(e,{display:"none"},function(){return up.layout.revealOrRestoreScroll(n,r),a=g(n,u),s=u.scrollTop()}),l.moveTop(s-c),e.hide(),p=$.temporaryCss(n,{opacity:"0"}),i=o(l.$ghost,a.$ghost),e.data(t,i),n.data(t,i),i.then(function(){return e.removeData(t),n.removeData(t),p(),l.$bounds.remove(),a.$bounds.remove()}),i},f=function(t){var n;return n=e(t),$.finishCssAnimate(n),d(n)},d=function(n){return n.each(function(){var n,r;return n=e(this),(r=$.pluckData(n,t))?r.resolve():void 0})},i=function(e,t){return $.isDeferred(e)?e:$.error("Did not return a promise with .then and .resolve methods: %o",t)},h=function(t,o,a,s){var l,p;return"none"===a&&(a=!1),p=e(t),l=e(o),c(p,a),c(l,a),up.log.group(a?"Morphing %o to %o (using %s)":void 0,p.get(0),l.get(0),a,function(){var e,t,o,c;return t=$.only(s,"reveal","restoreScroll","source"),t=$.extend(t,r(s)),m()?(f(p),f(l),a?(e=u[a])?(w(p,l,t),n(l,e,t)):(c=$.presence(a,$.isFunction)||x[a])?D(p,l,t,function(e,n){var r;return r=c(e,n,t),i(r,a)}):$.isString(a)&&a.indexOf("/")>=0?(o=a.split("/"),c=function(e,t,r){return b(n(e,o[0],r),n(t,o[1],r))},h(p,l,c,t)):$.error("Unknown transition %o",a):w(p,l,t)):w(p,l,t)})},c=function(e,t){var n;return t&&0===e.parents("body").length?(n=e.get(0),$.error("Can't morph a <%s> element (%o)",n.tagName,n)):void 0},w=function(e,t,n){return e.hide(),up.layout.revealOrRestoreScroll(t,n)},g=function(t,n){var r,o,u,i,a,s,l,c,p;for(i=$.measure(t,{relative:!0,inner:!0}),u=t.clone(),u.find("script").remove(),u.css({position:"static"===t.css("position")?"static":"relative",top:"",right:"",bottom:"",left:"",width:"100%",height:"100%"}),u.addClass("up-ghost"),r=e('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(i),p=i.top,c=function(e){return 0!==e?(p+=e,r.css({top:p})):void 0},u.appendTo(r),r.insertBefore(t),c(t.offset().top-u.offset().top),o=up.layout.fixedChildren(u),s=0,l=o.length;l>s;s++)a=o[s],$.fixedToAbsolute(a,n);return{$ghost:u,$bounds:r,moveTop:c}},S=function(e,t){return x[e]=t},o=function(e,t){return u[e]=t},k=function(){return s=$.copy(u),l=$.copy(x)},b=$.resolvableWhen,v=$.resolvedDeferred,o("none",v),o("fade-in",function(e,t){return e.css({opacity:0}),n(e,{opacity:1},t)}),o("fade-out",function(e,t){return e.css({opacity:1}),n(e,{opacity:0},t)}),o("move-to-top",function(e,t){var r,o;return r=$.measure(e),o=r.top+r.height,e.css({"margin-top":"0px"}),n(e,{"margin-top":"-"+o+"px"},t)}),o("move-from-top",function(e,t){var r,o;return r=$.measure(e),o=r.top+r.height,e.css({"margin-top":"-"+o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-bottom",function(e,t){var r,o;return r=$.measure(e),o=$.clientSize().height-r.top,e.css({"margin-top":"0px"}),n(e,{"margin-top":o+"px"},t)}),o("move-from-bottom",function(e,t){var r,o;return r=$.measure(e),o=$.clientSize().height-r.top,e.css({"margin-top":o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-left",function(e,t){var r,o;return r=$.measure(e),o=r.left+r.width,e.css({"margin-left":"0px"}),n(e,{"margin-left":"-"+o+"px"},t)}),o("move-from-left",function(e,t){var r,o;return r=$.measure(e),o=r.left+r.width,e.css({"margin-left":"-"+o+"px"}),n(e,{"margin-left":"0px"},t)}),o("move-to-right",function(e,t){var r,o;return r=$.measure(e),o=$.clientSize().width-r.left,e.css({"margin-left":"0px"}),n(e,{"margin-left":o+"px"},t)}),o("move-from-right",function(e,t){var r,o;return r=$.measure(e),o=$.clientSize().width-r.left,e.css({"margin-left":o+"px"}),n(e,{"margin-left":"0px"},t)}),o("roll-down",function(e,t){var r,o;return r=e.height(),o=$.temporaryCss(e,{height:"0px",overflow:"hidden"}),n(e,{height:r+"px"},t).then(o)}),S("none",v),S("move-left",function(e,t,r){return b(n(e,"move-to-left",r),n(t,"move-from-right",r))}),S("move-right",function(e,t,r){return b(n(e,"move-to-right",r),n(t,"move-from-left",r))}),S("move-up",function(e,t,r){return b(n(e,"move-to-top",r),n(t,"move-from-bottom",r))}),S("move-down",function(e,t,r){return b(n(e,"move-to-bottom",r),n(t,"move-from-top",r))}),S("cross-fade",function(e,t,r){return b(n(e,"fade-out",r),n(t,"fade-in",r))}),up.on("up:framework:boot",k),up.on("up:framework:reset",y),{morph:h,animate:n,animateOptions:r,finish:f,transition:S,animation:o,config:a,isEnabled:m,defaults:function(){return $.error("up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.")},none:v,when:b,prependCopy: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 e=[].slice;up.proxy=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,S,x,$,D,T,P,E,C,A,F,U,O,R;return R=up.util,n=void 0,$=void 0,F=void 0,k=void 0,U=void 0,T=[],p=R.config({slowDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5,maxRequests:4,wrapMethods:["PATCH","PUT","DELETE"],wrapMethodParam:"_method",safeMethods:["GET","OPTIONS","HEAD"]}),i=function(e){return w(e),[e.url,e.method,e.data,e.target].join("|")},u=R.cache({size:function(){return p.cacheSize},expiry:function(){return p.cacheExpiry},key:i}),f=function(e){var t,n,r,o,i,a,s;for(e=w(e),n=[e],"html"!==e.target&&(a=R.merge(e,{target:"html"}),n.push(a),"body"!==e.target&&(i=R.merge(e,{target:"body"}),n.push(i))),r=0,o=n.length;o>r;r++)if(t=n[r],s=u.get(t))return s},A=u.set,P=u.remove,c=u.clear,s=function(){return clearTimeout($),$=null},a=function(){return clearTimeout(F),F=null},E=function(){return n=null,s(),a(),k=0,p.reset(),U=!1,u.clear(),T=[]},E(),o=u.alias,w=function(e){return e._normalized||(e.method=R.normalizeMethod(e.method),e.url&&(e.url=R.normalizeUrl(e.url)),e.target||(e.target="body"),e._normalized=!0),e},r=function(e){var t,n,r,o,u;return t=e.cache===!0,n=e.cache===!1,u=R.only(e,"url","method","data","target","headers","_normalized"),u=w(u),r=!0,m(u)||t?(o=f(u))&&!n?(up.puts("Re-using cached response for %s %s",u.method,u.url),r="pending"===o.state()):(o=y(u),A(u,o),o.fail(function(){return P(u)})):(c(),o=y(u)),r&&!e.preload&&(b(),o.always(g)),console.groupEnd(),o},h=function(){return 0===k},d=function(){return k>0},b=function(){var e,t;return t=h(),k+=1,t?(e=function(){return d()?(up.emit("up:proxy:slow",{message:"Proxy is busy"}),U=!0):void 0},p.slowDelay>0?F=setTimeout(e,p.slowDelay):e()):void 0},g=function(){return k-=1,h()&&U?(up.emit("up:proxy:recover",{message:"Proxy is idle"}),U=!1):void 0},y=function(e){return k<p.maxRequests?v(e):D(e)},D=function(e){var n,r;return up.puts("Queuing request for %s %s",e.method,e.url),n=t.Deferred(),r={deferred:n,request:e},T.push(r),n.promise()},v=function(e){var n;return up.emit("up:proxy:load",R.merge(e,{message:["Loading %s %s",e.method,e.url]})),e=R.copy(e),e.headers||(e.headers={}),e.headers["X-Up-Target"]=e.target,R.contains(p.wrapMethods,e.method)&&(e.data=R.appendRequestData(e.data,p.wrapMethodParam,e.method),e.method="POST"),R.isFormData(e.data)&&(e.contentType=!1,e.processData=!1),n=t.ajax(e),n.done(function(t,n,r){return C(e,r)}),n.fail(function(t){return C(e,t)}),n},C=function(e,t){var n;return up.emit("up:proxy:received",R.merge(e,{message:["Server responded with %s %s (%d bytes)",t.status,t.statusText,null!=(n=t.responseText)?n.length:void 0]})),S()},S=function(){var t,n;return(t=T.shift())?(n=v(t.request),n.done(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).resolve.apply(r,n)}),n.fail(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).reject.apply(r,n)})):void 0},m=function(e){return w(e),R.contains(p.safeMethods,e.method)},l=function(e){var t,r;return r=parseInt(R.presentAttr(e,"up-delay"))||p.preloadDelay,e.is(n)?void 0:(n=e,s(),t=function(){return x(e),n=null},O(t,r))},O=function(e,t){return $=setTimeout(e,t)},x=function(e,n){var r,o;return r=t(e),n=R.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),R.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(e,t){return up.link.childClicked(e,t)?void 0:l(t)}),up.on("up:framework:reset",E),{preload:x,ajax:r,get:f,alias:o,clear:c,remove:P,isIdle:h,isBusy:d,config:p,defaults:function(){return R.error("up.proxy.defaults(...) no longer exists. Set values on he up.proxy.config property instead.")}}}(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(e,t){var n;return t=u.options(t),n=u.option(t.target,"body"),up.replace(n,e,t)},follow=function(e,t){var n,r,o;return n=$(e),t=u.options(t),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(t.target,n.attr("up-target"),"body"),t.failTarget=u.option(t.failTarget,n.attr("up-fail-target"),"body"),t.transition=u.option(t.transition,u.castedAttr(n,"up-transition"),"none"),t.failTransition=u.option(t.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),t.history=u.option(t.history,u.castedAttr(n,"up-history")),t.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),t.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),t.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),t.method=followMethod(n,t),t.origin=u.option(t.origin,n),t.confirm=u.option(t.confirm,n.attr("up-confirm")),t=u.merge(t,up.motion.animateOptions(t,n)),up.browser.confirm(t).then(function(){return up.replace(r,o,t)})},followMethod=function(e,t){var n;return n=$(e),t=u.options(t),u.option(t.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},childClicked=function(e,t){var n,r;return n=$(e.target),r=n.closest("a, [up-href]"),r.length&&t.find(r).length},shouldProcessLinkEvent=function(e,t){return u.isUnmodifiedMouseEvent(e)&&!childClicked(e,t)},followVariantSelectors=[],allowDefault=function(){},onAction=function(e,t){return followVariantSelectors.push(e),up.on("click","a"+e+", [up-href]"+e,function(e,n){return shouldProcessLinkEvent(e,n)?n.is("[up-instant]")?e.preventDefault():(e.preventDefault(),t(n)):allowDefault(e)}),up.on("mousedown","a"+e+"[up-instant], [up-href]"+e+"[up-instant]",function(e,n){return shouldProcessLinkEvent(e,n)?(e.preventDefault(),t(n)):void 0})},isFollowable=function(e){return u.any(followVariantSelectors,function(t){return e.is(t)})},makeFollowable=function(e){var t;return t=$(e),isFollowable(t)?void 0:t.attr("up-follow","")},onAction("[up-target]",function(e){return follow(e)}),onAction("[up-follow]",function(e){return follow(e)}),up.macro("[up-dash]",function(e){var t,n;return n=u.castedAttr(e,"up-dash"),e.removeAttr("up-dash"),t={"up-preload":"","up-instant":""},n===!0?makeFollowable(e):t["up-target"]=n,u.setMissingAttrs(e,t)}),up.macro("[up-expand]",function(e){var t,n,r,o,i,a,s,l,c,p;if(t=e.find("a, [up-href]"),(c=e.attr("up-expand"))&&(t=t.filter(c)),i=t.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(e,s),e.removeAttr("up-expand"),makeFollowable(e)}}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,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,observeForm,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(e,t){var n,r,o,i,a,s,l;return n=$(e).closest("form"),t=u.options(t),s=u.option(t.target,n.attr("up-target"),"body"),l=u.option(t.url,n.attr("action"),up.browser.url()),t.failTarget=u.option(t.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),t.history=u.option(t.history,u.castedAttr(n,"up-history"),!0),t.transition=u.option(t.transition,u.castedAttr(n,"up-transition"),"none"),t.failTransition=u.option(t.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),t.method=u.option(t.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),t.headers=u.option(t.headers,{}),t.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),t.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),t.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),t.origin=u.option(t.origin,n),t.data=up.util.requestDataFromForm(n),t=u.merge(t,up.motion.animateOptions(t,n)),i=n.find("input[type=file]").length,r=!i||u.isFormData(t.data),o=up.browser.canPushState()||t.history===!1,t.validate&&(t.headers||(t.headers={}),t.headers["X-Up-Validate"]=t.validate,!r)?u.unresolvablePromise():(n.addClass("up-active"),r&&o?(a=up.replace(s,l,t),a.always(function(){return n.removeClass("up-active")}),a):(n.get(0).submit(),u.unresolvablePromise()))},observe=function(){var $element,args,callback,callbackArg,callbackPromise,callbackTimer,changeEvents,check,clearTimer,delay,knownValue,nextCallback,options,rawCallback,runNextCallback,selectorOrElement;return selectorOrElement=arguments[0],args=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===args.length&&(callbackArg=args[0]),args.length>1&&(options=u.options(args[0]),callbackArg=args[1]),$element=$(selectorOrElement),options=u.options(options),delay=u.option($element.attr("up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),callback=null,u.isGiven(options.change)&&u.error("up.observe now takes the change callback as the last argument"),rawCallback=u.option(u.presentAttr($element,"op-observe"),callbackArg),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||u.error("up.observe: No change callback given"),$element.is("form")?observeForm($element,options,callback):(knownValue=null,callbackTimer=null,callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var e;return nextCallback?(e=nextCallback(),nextCallback=null,e):void 0},check=function(){var e,t,n;return n=$element.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($element.get(0),[n,$element])},e=function(){return callbackPromise.then(function(){var e;return e=runNextCallback(),callbackPromise=u.isPromise(e)?e:u.resolvedPromise()})},0===delay?e():setTimeout(e,delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$element.on(changeEvents,check),check(),function(){return $element.off(changeEvents,check),clearTimer()})},observeForm=function(e,t,n){var r,o;return r=u.multiSelector(config.fields).find(e),o=u.map(r,function(e){return observe(e,n)}),function(){var e,t,n,r;for(r=[],t=0,n=o.length;n>t;t++)e=o[t],r.push(e());return r}},autosubmit=function(e,t){return observe(e,t,function(e,t){var n;return n=t.closest("form"),t.addClass("up-active"),submit(n).always(function(){return t.removeClass("up-active")})})},resolveValidateTarget=function(e,t){var n;return n=u.option(t.target,e.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.flow.resolveSelector(n,t.origin),e.closest(r).length}))),u.isBlank(n)&&u.error("Could not find default validation target for %o (tried ancestors %o)",e.get(0),config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(e,t){var n,r,o;return n=$(e),t=u.options(t),t.origin=n,t.target=resolveValidateTarget(n,t),t.failTarget=t.target,t.history=!1,t.headers=u.option(t.headers,{}),t.validate=n.attr("name")||"__none__",t=u.merge(t,up.motion.animateOptions(t,n)),r=n.closest("form"),o=up.submit(r,t)},currentValuesForSwitch=function(e){var t,n,r;return r=void 0,e.is("input[type=checkbox]")?r=e.is(":checked")?[":checked",":present",e.val()]:[":unchecked",":blank"]:e.is("input[type=radio]")?(t=e.closest("form, body").find("input[type='radio'][name='"+e.attr("name")+"']:checked"),r=t.length?[":checked",":present",t.val()]:[":unchecked",":blank"]):(n=e.val(),r=u.isPresent(n)?[":present",n]:[":blank"]),r},currentValuesForSwitch=function(e){var t,n,r,o;return e.is("input[type=checkbox]")?e.is(":checked")?(r=e.val(),n=":checked"):n=":unchecked":e.is("input[type=radio]")?(t=e.closest("form, body").find("input[type='radio'][name='"+e.attr("name")+"']:checked"),t.length?(n=":checked",r=t.val()):n=":unchecked"):r=e.val(),o=[],u.isPresent(r)?(o.push(r),o.push(":present")):o.push(":blank"),u.isPresent(n)&&o.push(n),o},switchTargets=function(e,t){var n,r,o;return n=$(e),t=u.options(t),o=u.option(t.target,n.attr("up-switch")),u.isPresent(o)||u.error("No switch target given for %o",n.get(0)),r=currentValuesForSwitch(n),$(o).each(function(){var e,t,n,o;return e=$(this),(t=e.attr("up-hide-for"))?(t=t.split(" "),n=0===u.intersect(r,t).length):(o=(o=e.attr("up-show-for"))?o.split(" "):[":present",":checked"],n=u.intersect(r,o).length>0),e.toggle(n)})},up.on("submit","form[up-target]",function(e,t){return e.preventDefault(),submit(t)}),up.on("change","[up-validate]",function(e,t){return validate(t)}),up.on("change","[up-switch]",function(e,t){return switchTargets(t)}),up.compiler("[up-switch]",function(e){return switchTargets(e)}),up.compiler("[up-observe]",function(e){return observe(e)}),up.compiler("[up-autosubmit]",function(e){return autosubmit(e)}),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}}(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 attach,autoclose,close,config,contains,coveredUrl,createFrame,currentUrl,discardHistory,ensureInViewport,isOpen,reset,setPosition,u;return u=up.util,currentUrl=void 0,coveredUrl=function(){return $(".up-popup").attr("up-covered-url")},config=u.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right",history:!1}),reset=function(){return close({animation:!1}),config.reset()},setPosition=function(e,t){var n,r,o;return o=u.measure(e,{full:!0}),r=function(){switch(t){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.top+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return u.error("Unknown position option '%s'",t)}}(),n=$(".up-popup"),n.attr("up-position",t),n.css(r),ensureInViewport(n)},ensureInViewport=function(e){var t,n,r,o,i,a,s;if(n=u.measure(e,{full:!0}),r=null,o=null,n.right<0&&(r=-n.right),n.bottom<0&&(o=-n.bottom),n.left<0&&(r=n.left),n.top<0&&(o=n.top),r&&((i=parseInt(e.css("left")))?e.css("left",i-r):(a=parseInt(e.css("right")))&&e.css("right",a+r)),o){if(s=parseInt(e.css("top")))return e.css("top",s-o);if(t=parseInt(e.css("bottom")))return e.css("bottom",t+o)}},discardHistory=function(){var e;return e=$(".up-popup"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createFrame=function(e,t){var n;return n=u.$createElementFromSelector(".up-popup"),t.sticky&&n.attr("up-sticky",""),n.attr("up-covered-url",up.browser.url()),n.attr("up-covered-title",document.title),u.$createPlaceholder(e,n),n.appendTo(document.body),n},isOpen=function(){return $(".up-popup").length>0},attach=function(e,t){var n,r,o,i;return n=$(e),n.length||u.error("Cannot attach popup to non-existing element %o",e),t=u.options(t),i=u.option(t.url,n.attr("href")),o=u.option(t.target,n.attr("up-popup"),"body"),t.position=u.option(t.position,n.attr("up-position"),config.position),t.animation=u.option(t.animation,n.attr("up-animation"),config.openAnimation),t.sticky=u.option(t.sticky,u.castedAttr(n,"up-sticky")),t.history=up.browser.canPushState()?u.option(t.history,u.castedAttr(n,"up-history"),config.history):!1,t.confirm=u.option(t.confirm,n.attr("up-confirm")),r=up.motion.animateOptions(t,n),up.browser.confirm(t).then(function(){var e,a;return up.bus.nobodyPrevents("up:popup:open",{url:i,message:"Opening popup"})?(a=isOpen(),a&&close({animation:!1}),t.beforeSwap=function(){return createFrame(o,t)},e=up.replace(o,i,u.merge(t,{animation:!1})),e=e.then(function(){return setPosition(n,t.position)}),a||(e=e.then(function(){return up.animate($(".up-popup"),t.animation,r)})),e=e.then(function(){return up.emit("up:popup:opened",{message:"Popup opened"})})):u.unresolvableDeferred()})},close=function(e){var t,n;return t=$(".up-popup"),t.length?up.bus.nobodyPrevents("up:popup:close",{$element:t})?(e=u.options(e,{animation:config.closeAnimation,url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,n=up.destroy(t,e),n.then(function(){return up.emit("up:popup:closed",{message:"Popup closed"})}),n):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-popup").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-popup").length>0},up.link.onAction("[up-popup]",function(e){return e.is(".up-current")?close():attach(e)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-popup").length||t.closest("[up-popup]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(contains(e.origin))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-popup").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),attach:attach,close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.popup.defaults(...) no longer exists. Set values on he up.popup.config property instead.")},contains:contains,open:function(){return up.error("up.popup.open no longer exists. Please use up.popup.attach instead.")},source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")},isOpen:isOpen}}(jQuery)}.call(this),function(){up.modal=function($){var autoclose,close,config,contains,coveredUrl,createFrame,currentUrl,discardHistory,follow,isOpen,open,reset,shiftElements,templateHtml,u,unshiftElements,unshifters,visit;return u=up.util,config=u.config({maxWidth:null,minWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"\xd7",template:function(e){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+e.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}}),currentUrl=void 0,coveredUrl=function(){return $(".up-modal").attr("up-covered-url")},reset=function(){return close({animation:!1}),currentUrl=void 0,config.reset()},templateHtml=function(){var e;return e=config.template,u.isFunction(e)?e(config):e},discardHistory=function(){var e;return e=$(".up-modal"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createFrame=function(e,t){var n,r,o;return shiftElements(),o=$(templateHtml()),t.sticky&&o.attr("up-sticky",""),o.attr("up-covered-url",up.browser.url()),o.attr("up-covered-title",document.title),r=o.find(".up-modal-dialog"),u.isPresent(t.width)&&r.css("width",t.width),u.isPresent(t.maxWidth)&&r.css("max-width",t.maxWidth),u.isPresent(t.height)&&r.css("height",t.height),n=o.find(".up-modal-content"),u.$createPlaceholder(e,n),o.appendTo(document.body),o},unshifters=[],shiftElements=function(){var e,t,n,r;return n=u.scrollbarWidth(),e=parseInt($("body").css("padding-right")),t=n+e,r=u.temporaryCss($("body"),{"padding-right":t+"px","overflow-y":"hidden"}),unshifters.push(r),up.layout.anchoredRight().each(function(){var e,t,r,o;return e=$(this),t=parseInt(e.css("right")),r=n+t,o=u.temporaryCss(e,{right:r}),unshifters.push(o)})},unshiftElements=function(){var e,t;for(e=[];t=unshifters.pop();)e.push(t());return e},isOpen=function(){return $(".up-modal").length>0},follow=function(e,t){return t=u.options(t),t.$link=$(e),open(t)},visit=function(e,t){return t=u.options(t),t.url=e,open(t)},open=function(e){var t,n,r,o;return e=u.options(e),t=u.option(e.$link,u.nullJQuery()),o=u.option(e.url,t.attr("up-href"),t.attr("href")),r=u.option(e.target,t.attr("up-modal"),"body"),e.width=u.option(e.width,t.attr("up-width"),config.width),e.maxWidth=u.option(e.maxWidth,t.attr("up-max-width"),config.maxWidth),e.height=u.option(e.height,t.attr("up-height"),config.height),e.animation=u.option(e.animation,t.attr("up-animation"),config.openAnimation),e.sticky=u.option(e.sticky,u.castedAttr(t,"up-sticky")),e.history=up.browser.canPushState()?u.option(e.history,u.castedAttr(t,"up-history"),config.history):!1,e.confirm=u.option(e.confirm,t.attr("up-confirm")),n=up.motion.animateOptions(e,t),up.browser.confirm(e).then(function(){var t,i;return up.bus.nobodyPrevents("up:modal:open",{url:o,message:"Opening modal"})?(i=isOpen(),i&&close({animation:!1}),e.beforeSwap=function(){return createFrame(r,e)},t=up.replace(r,o,u.merge(e,{animation:!1})),i||(t=t.then(function(){return up.animate($(".up-modal"),e.animation,n)})),t=t.then(function(){return up.emit("up:modal:opened",{message:"Modal opened"})})):u.unresolvablePromise()})},close=function(e){var t,n;return t=$(".up-modal"),t.length?up.bus.nobodyPrevents("up:modal:close",{$element:t,message:"Closing modal"})?(e=u.options(e,{animation:config.closeAnimation,url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,n=up.destroy(t,e),n=n.then(function(){return unshiftElements(),up.emit("up:modal:closed",{message:"Modal closed"})})):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-modal").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-modal").length>0},up.link.onAction("[up-modal]",function(e){return follow(e)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-modal-dialog").length||t.closest("[up-modal]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(!up.popup.contains(t)&&contains(e.origin))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-modal").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,open:function(){return up.error("up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.")},close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.modal.defaults(...) no longer exists. Set values on he up.modal.config property instead.")
3
- },contains:contains,source:function(){return up.error("up.modal.source no longer exists. Please use up.popup.url instead.")},isOpen:isOpen}}(jQuery)}.call(this),function(){up.tooltip=function(e){var t,n,r,o,u,i,a;return a=up.util,r=a.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out"}),u=function(){return r.reset()},i=function(e,t,n){var r,o,u;return o=a.measure(e),u=a.measure(t),r=function(){switch(n){case"top":return{left:o.left+.5*(o.width-u.width),top:o.top-u.height};case"left":return{left:o.left-u.width,top:o.top+.5*(o.height-u.height)};case"right":return{left:o.left+o.width,top:o.top+.5*(o.height-u.height)};case"bottom":return{left:o.left+.5*(o.width-u.width),top:o.top+o.height};default:return a.error("Unknown position option '%s'",n)}}(),t.attr("up-position",n),t.css(r)},o=function(e){var t;return t=a.$createElementFromSelector(".up-tooltip"),a.isGiven(e.text)?t.text(e.text):t.html(e.html),t.appendTo(document.body),t},t=function(t,u){var s,l,c,p,f,d,m;return null==u&&(u={}),s=e(t),f=a.option(u.html,s.attr("up-tooltip-html")),m=a.option(u.text,s.attr("up-tooltip")),d=a.option(u.position,s.attr("up-position"),r.position),p=a.option(u.animation,a.castedAttr(s,"up-animation"),r.openAnimation),c=up.motion.animateOptions(u,s),n(),l=o({text:m,html:f}),i(s,l,d),up.animate(l,p,c)},n=function(t){var n;return n=e(".up-tooltip"),n.length?(t=a.options(t,{animation:r.closeAnimation}),t=a.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[up-tooltip], [up-tooltip-html]",function(e){return e.on("mouseover",function(){return t(e)}),e.on("mouseout",function(){return n()})}),up.on("click","body",function(){return n()}),up.on("up:framework:reset",n),up.bus.onEscape(function(){return n()}),up.on("up:framework:reset",u),{attach:t,close:n,open:function(){return a.error("up.tooltip.open no longer exists. Use up.tooltip.attach instead.")}}}(jQuery)}.call(this),function(){up.navigation=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return h=up.util,i=h.config({currentClasses:["up-current"]}),p=function(){return i.reset()},a=function(){var e;return e=i.currentClasses,e=e.concat(["up-current"]),e=h.uniq(e),e.join(" ")},t="up-active",n=["a","[up-href]","[up-alias]"],o=n.join(", "),u=function(){var e,t,r;for(r=[],e=0,t=n.length;t>e;e++)m=n[e],r.push(m+"[up-instant]");return r}().join(", "),r="."+t,c=function(e){return h.isPresent(e)?h.normalizeUrl(e,{search:!1,stripTrailingSlash:!0}):void 0},d=function(e){var t,n,r,o,u,i,a,s,l,p;for(s=[],i=["href","up-href","up-alias"],n=0,o=i.length;o>n;n++)if(t=i[n],l=h.presentAttr(e,t))for(p="up-alias"===t?l.split(" "):[l],r=0,u=p.length;u>r;r++)a=p[r],"#"!==a&&(a=c(a),s.push(a));return s},g=function(e){var t,n,r,o;return e=h.compact(e),r=function(e){return"*"===e.substr(-1)?n(e.slice(0,-1)):t(e)},t=function(t){return h.contains(e,t)},n=function(t){return h.detect(e,function(e){return 0===e.indexOf(t)})},o=function(e){return h.detect(e,r)},{matchesAny:o}},l=function(){var t,n;return t=g([c(up.browser.url()),c(up.modal.url()),c(up.modal.coveredUrl()),c(up.popup.url()),c(up.popup.coveredUrl())]),n=a(),h.each(e(o),function(r){var o,u;return o=e(r),u=d(o),t.matchesAny(u)?o.addClass(n):o.hasClass(n)&&0===o.closest(".up-destroying").length?o.removeClass(n):void 0})},f=function(e){return v(),e=s(e),e.addClass(t)},s=function(e){return h.presence(e.parents(o))||e},v=function(){return e(r).removeClass(t)},up.on("click",o,function(e,t){return h.isUnmodifiedMouseEvent(e)&&!t.is("[up-instant]")?f(t):void 0}),up.on("mousedown",u,function(e,t){return h.isUnmodifiedMouseEvent(e)?f(t):void 0}),up.on("up:fragment:inserted",function(){return v(),l()}),up.on("up:fragment:destroyed",function(e,t){return t.is(".up-modal, .up-popup")?l():void 0}),up.on("up:framework:reset",p),{config:i,defaults:function(){return h.error("up.navigation.defaults(...) no longer exists. Set values on he up.navigation.config property instead.")}}}(jQuery)}.call(this),function(){up.rails=function(e){var t,n,r,o;return r=up.util,o=function(e){return e.is("[up-follow], [up-target], [up-modal], [up-popup]")},n=function(){return r.isGiven(e.rails)},r.each(["method","confirm"],function(e){var t,u;return t="data-"+e,u="up-"+e,up.compiler("["+t+"]",function(e){var i;return n()&&o(e)?(i={},i[u]=e.attr(t),r.setMissingAttrs(e,i),e.removeAttr(t)):void 0})}),t=function(){return n()?{name:e.rails.csrfParam(),value:e.rails.csrfToken()}:void 0},{csrfField:t,isRails:n}}(jQuery)}.call(this),function(){up.boot()}.call(this);
1
+ (function(){window.up={}}).call(this),function(){var e=[].slice;up.util=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,S,x,$,D,T,P,E,A,C,O,F,U,R,M,j,K,L,z,I,W,q,N,H,Q,_,V,J,B,X,G,Y,Z,et,tt,nt,rt,ot,ut,it,at,st,lt,ct,pt,ft,dt,mt,ht,vt,gt,yt,bt,wt,kt,St,xt,$t,Dt,Tt,Pt,Et,At,Ct,Ot,Ft,Ut,Rt,Mt,jt,Kt,Lt,zt,It,Wt,qt,Nt,Ht,Qt,_t;return ct=t.noop,ot=function(t){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?e.call(arguments,0):[],r?n:(r=!0,n=t.apply(null,o))}},B=function(e,t){return t=t.toString(),(""===t||"80"===t)&&"http:"===e||"443"===t&&"https:"===e},ft=function(e,t){var n,r,o;return n=bt(e),r=n.protocol+"//"+n.hostname,B(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=t?t.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=t?t.hash:void 0)===!0&&(r+=n.hash),(null!=t?t.search:void 0)!==!1&&(r+=n.search),r},bt=function(e){var n;return n=null,X(e)?(n=t("<a>").attr({href:e}).get(0),U(n.hostname)&&(n.href=n.href)):n=qt(e),n},pt=function(e){return e?e.toUpperCase():"GET"},n=function(e){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;for(v=e.split(/[ >]/),o=null,f=c=0,m=v.length;m>c;f=++c){for(a=v[f],i=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",u=[],p=null,d=0,h=i.length;h>d;d++)switch(s=i[d],s[0]){case".":u.push(s.substr(1));break;case"#":p=s.substr(1);break;default:g=s}l="<"+g,u.length&&(l+=' class="'+u.join(" ")+'"'),p&&(l+=' id="'+p+'"'),l+=">",n=t(l),r&&n.appendTo(r),0===f&&(o=n),r=n}return o},v=function(e,t){var n;return n=document.createElement(e),V(t)&&(n.innerHTML=t),n},r=function(e,t){var r;return null==t&&(t=document.body),r=n(e),r.addClass("up-placeholder"),r.appendTo(t),r},Rt=function(e){var n,r,o,u,i,a,s,l,c;if(n=t(e),l=void 0,up.puts("Creating selector from element %o",n.get(0)),c=St(n.attr("up-id")))l="[up-id='"+c+"']";else if(u=St(n.attr("id")))l="#"+u;else if(s=St(n.attr("name")))l="[name='"+s+"']";else if(r=St(lt(n)))for(l="",o=0,a=r.length;a>o;o++)i=r[o],l+="."+i;else l=n.prop("tagName").toLowerCase();return l},lt=function(e){var t,n;return t=e.attr("class")||"",n=t.split(" "),Ut(n,function(e){return V(e)&&!e.match(/^up-/)})},g=function(e){var t,n,r,o,u,i,a,s,l,c,p,f;return l=function(e){return"<"+e+"(?: [^>]*)?>"},i=function(e){return"</"+e+">"},t="(?:.|\\n)*?",u=function(e){return"("+e+")"},f=new RegExp(l("head")+t+l("title")+u(t)+i("title")+t+i("body"),"i"),o=new RegExp(l("body")+u(t)+i("body"),"i"),(r=e.match(o))?(s=document.createElement("html"),n=v("body",r[1]),s.appendChild(n),(p=e.match(f))&&(a=v("head"),s.appendChild(a),c=v("title",p[1]),a.appendChild(c)),s):v("div",e)},$=t.extend,Wt=t.trim,w=function(e,t){var n,r,o,u,i;for(i=[],r=n=0,u=e.length;u>n;r=++n)o=e[r],i.push(t(o,r));return i},nt=w,Lt=function(e,t){var n,r,o,u;for(u=[],r=n=0,o=e-1;o>=0?o>=n:n>=o;r=o>=0?++n:--n)u.push(t(r));return u},H=function(e){return null===e},G=function(e){return void 0===e},M=function(e){return!G(e)},N=function(e){return G(e)||H(e)},I=function(e){return!N(e)},U=function(e){return N(e)||_(e)&&0===Object.keys(e).length||0===e.length},St=function(e,t){return null==t&&(t=V),t(e)?e:void 0},V=function(e){return!U(e)},z=function(e){return"function"==typeof e},X=function(e){return"string"==typeof e},Q=function(e){return"number"==typeof e},W=function(e){return"object"==typeof e&&!!e},_=function(e){return W(e)||"function"==typeof e},K=function(e){return!(!e||1!==e.nodeType)},q=function(e){return e instanceof jQuery},J=function(e){return _(e)&&z(e.then)},R=function(e){return J(e)&&z(e.resolve)},F=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},L=function(e){return up.browser.canFormData()&&e instanceof FormData},It=function(e){return Array.prototype.slice.call(e)},m=function(e){return F(e)?e.slice():$({},e)},qt=function(e){return q(e)?e.get(0):e},ut=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],$.apply(null,[{}].concat(e.call(t)))},yt=function(e,t){var n,r,o,u;if(o=e?m(e):{},t)for(r in t)n=t[r],u=o[r],I(u)?_(n)&&_(u)&&(o[r]=yt(u,n)):o[r]=n;return o},gt=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],b(t,I)},b=function(e,t){var n,r,o,u;for(u=void 0,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=n;break}return u},i=function(e,t){var n,r,o,u;for(u=!1,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=!0;break}return u},u=function(e,t){var n,r,o,u;for(u=!0,r=0,o=e.length;o>r;r++)if(n=e[r],!t(n)){u=!1;break}return u},p=function(e){return Ut(e,I)},Nt=function(e){var t;return t={},Ut(e,function(e){return t.hasOwnProperty(e)?!1:t[e]=!0})},Ut=function(e,t){var n;return n=[],w(e,function(e){return t(e)?n.push(e):void 0}),n},$t=function(e,t){return Ut(e,function(e){return!t(e)})},O=function(e,t){return Ut(e,function(e){return d(t,e)})},xt=function(){var t,n,r,o;return t=arguments[0],r=2<=arguments.length?e.call(arguments,1):[],o=function(){var e,o,u;for(u=[],e=0,o=r.length;o>e;e++)n=r[e],u.push(t.attr(n));return u}(),b(o,V)},jt=function(e,t){return e>0?setTimeout(t,e):t()},st=function(e){return setTimeout(e,0)},et=function(e){return e[e.length-1]},c=function(){var e;return e=document.documentElement,{width:e.clientWidth,height:e.clientHeight}},Ft=ot(function(){var e,n,r;return e=t("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),e.appendTo(document.body),n=e.get(0),r=n.offsetWidth-n.clientWidth,e.remove(),r}),ht=function(t){var n;return n=void 0,function(){var r;return r=1<=arguments.length?e.call(arguments,0):[],null!=t&&(n=t.apply(null,r)),t=void 0,n}},Kt=function(e,t,n){var r,o;return o=e.css(Object.keys(t)),e.css(t),r=function(){return e.css(o)},n?(n(),r()):ht(r)},A=function(e){var t,n;return n=e.css(["transform","-webkit-transform"]),U(n)||"none"===n.transform?(t=function(){return e.css(n)},e.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):t=function(){},t},C=function(e){return e=qt(e),e.offsetHeight},y=function(e,n,r){var u,i,a,s,l,c,p;return u=t(e),r=yt(r,{duration:300,delay:0,easing:"ease"}),a=t.Deferred(),c={"transition-property":Object.keys(n).join(", "),"transition-duration":r.duration+"ms","transition-delay":r.delay+"ms","transition-timing-function":r.easing},l=u.css(Object.keys(c)),u.addClass("up-animating"),p=A(u),u.css(c),u.css(n),u.data(o,a),a.then(function(){var e;return u.removeData(o),p(),u.css({transition:"none"}),e=!("none"===l["transition-property"]||"all"===l["transition-property"]&&"0"===l["transition-duration"][0]),e?(C(u),u.css(l)):void 0}),i=r.duration+r.delay,s=jt(i,function(){return u.removeClass("up-animating"),j(u)?void 0:a.resolve()}),a.then(function(){return clearTimeout(s)}),a},o="up-animation-deferred",P=function(e){return t(e).each(function(){var e;return(e=wt(this,o))?e.resolve():void 0})},rt=function(e,n){var r,o,u,i,a,s;return n=yt(n,{relative:!1,inner:!1,full:!1}),n.relative?n.relative===!0?a=e.position():(r=t(n.relative),s=e.offset(),r.is(document)?a=s:(i=r.offset(),a={left:s.left-i.left,top:s.top-i.top})):a=e.offset(),u={left:a.left,top:a.top},n.inner?(u.width=e.width(),u.height=e.height()):(u.width=e.outerWidth(),u.height=e.outerHeight()),n.full&&(o=up.layout.viewportOf(e),u.right=o.width()-(u.left+u.width),u.bottom=o.height()-(u.top+u.height)),u},h=function(e,t){var n,r,o,u,i;for(u=e.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)n=u[r],i.push(n.specified?t.attr(n.name,n.value):void 0);return i},T=function(e,t){return e.find(t).addBack(t)},S=function(e){return 27===e.keyCode},d=function(e,t){return e.indexOf(t)>=0},l=function(e,t){var n;switch(n=e.attr(t)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},tt=function(e){return e.getResponseHeader("X-Up-Location")},zt=function(e){return e.getResponseHeader("X-Up-Title")},it=function(e){return e.getResponseHeader("X-Up-Method")},vt=function(){var t,n,r,o,u,i;for(o=arguments[0],u=2<=arguments.length?e.call(arguments,1):[],t={},n=0,r=u.length;r>n;n++)i=u[n],o.hasOwnProperty(i)&&(t[i]=o[i]);return t},x=function(){var t,n,r,o,u,i;for(o=arguments[0],u=2<=arguments.length?e.call(arguments,1):[],t=m(o),n=0,r=u.length;r>n;n++)i=u[n],delete t[i];return t},Y=function(e){return!(e.metaKey||e.shiftKey||e.ctrlKey)},Z=function(e){var t;return t=G(e.button)||0===e.button,t&&Y(e)},Ct=function(){var e;return e=t.Deferred(),e.resolve(),e},Ot=function(){return Ct().promise()},Ht=function(){return t.Deferred()},Qt=function(){return Ht().promise()},dt=function(){return t()},At=function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],r=t.when.apply(t,[Ct()].concat(e.call(n))),r.resolve=ot(function(){return w(n,function(e){return e.resolve()})}),r},Mt=function(e,t){var n,r,o;r=[];for(n in t)o=t[n],r.push(N(e.attr(n))?e.attr(n,o):void 0);return r},Dt=function(e,t){var n;return n=e.indexOf(t),n>=0?(e.splice(n,1),t):void 0},at=function(e){var n,r,o,u,a,s,l;for(a={},l=[],r=[],o=0,u=e.length;u>o;o++)s=e[o],X(s)?l.push(s):r.push(s);return a.parsed=r,l.length&&(n=l.join(", "),a.parsed.push(n)),a.select=function(){return a.find(void 0)},a.find=function(e){var n,r,o,u,i,s;for(r=dt(),i=a.parsed,o=0,u=i.length;u>o;o++)s=i[o],n=e?e.find(s):t(s),r=r.add(n);return r},a.findWithSelf=function(e){var t;return t=a.find(e),a.doesMatch(e)&&(t=t.add(e)),t},a.doesMatch=function(e){var n;return n=t(e),i(a.parsed,function(e){return n.is(e)})},a.seekUp=function(e){var n,r,o;for(o=t(e),n=o,r=void 0;n.length;){if(a.doesMatch(n)){r=n;break}n=n.parent()}return r||dt()},a},s=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,h,v,g;return null==t&&(t={}),v=void 0,d=function(e){return function(){var n;return n=t[e],Q(n)?n:z(n)?n():void 0}},p=d("size"),o=d("expiry"),f=function(e){return t.key?t.key(e):e.toString()},i=function(){return 0!==p()&&0!==o()},r=function(){return v={}},r(),l=function(){var n;return n=1<=arguments.length?e.call(arguments,0):[],t.logPrefix?(n[0]="["+t.logPrefix+"] "+n[0],up.puts.apply(up,n)):void 0},s=function(){return Object.keys(v)},c=function(){var e,t,n,r;return r=m(s()),e=p(),e&&r.length>=e&&(t=null,n=null,w(r,function(e){var r,o;return r=v[e],o=r.timestamp,!n||n>o?(t=e,n=o):void 0}),t)?delete v[t]:void 0},n=function(e,t){var n;return n=u(e,{silent:!0}),M(n)?h(t,n):void 0},g=function(){return(new Date).valueOf()},h=function(e,t){var n;return i()?(c(),n=f(e),v[n]={timestamp:g(),value:t}):void 0},Dt=function(e){var t;return t=f(e),delete v[t]},a=function(e){var t,n;return t=o(),t?(n=g()-e.timestamp,t>n):!0},u=function(e,t){var n,r;return null==t&&(t={}),r=f(e),(n=v[r])?a(n)?(t.silent||l("Cache hit for '%s'",e),n.value):(t.silent||l("Discarding stale cache entry for '%s'",e),void Dt(e)):void(t.silent||l("Cache miss for '%s'",e))},{alias:n,get:u,set:h,remove:Dt,clear:r,keys:s}},f=function(e){var t;return null==e&&(e={}),t={},t.reset=function(){return $(t,e)},t.reset(),Object.preventExtensions(t),t},_t=function(e){var t,n;return e=qt(e),t=e.parentNode,n=It(e.childNodes),w(n,function(n){return t.insertBefore(n,e)}),t.removeChild(e)},mt=function(e){var t,n;for(t=void 0;(e=e.parent())&&e.length;)if(n=e.css("position"),"absolute"===n||"relative"===n||e.is("body")){t=e;break}return t},E=function(e,n){var r,o,u,i;return r=t(e),o=mt(r),u=r.position(),i=o.offset(),r.css({position:"absolute",left:u.left-i.left,top:u.top-i.top+n.scrollTop(),right:"",bottom:""})},Tt=function(e){var t,n,r,o,u,i,a;if(L(e))return up.error("Cannot convert FormData into an array");for(i=Pt(e),t=[],a=i.split("&"),n=0,r=a.length;r>n;n++)u=a[n],V(u)&&(o=u.split("="),t.push({name:decodeURIComponent(o[0]),value:decodeURIComponent(o[1])}));return t},Pt=function(e){var n;return L(e)?up.error("Cannot convert FormData into a query string"):V(e)?(n=t.param(e),n=n.replace(/\+/g,"%20")):""},Et=function(e){var n,r;return n=t(e),r=n.find("input[type=file]").length,r&&up.browser.canFormData()?new FormData(n.get(0)):n.serializeArray()},a=function(e,t,n){var r;return L(e)?e.append(t,n):F(e)?e.push({name:t,value:n}):_(e)?e[t]=n:(X(e)||N(e))&&(r=Pt([{name:t,value:n}]),e=V(e)?[e,r].join("&"):r),e},k=function(){var n,r,o,u,i;throw r=1<=arguments.length?e.call(arguments,0):[],(u=up.log).error.apply(u,r),o=(i=up.browser).sprintf.apply(i,r),n=St(t(".up-error"))||t('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(o),new Error(o)},kt=function(e,t){var n;return n=e[t],delete e[t],n},wt=function(e,n){var r,o;return r=t(e),o=r.data(n),r.removeData(n),o},D=function(e){var t;return t=et(e),_(t)?e.pop():{}},j=function(e){return e=qt(e),!jQuery.contains(document.documentElement,e)},{isDetached:j,requestDataAsArray:Tt,requestDataAsQuery:Pt,appendRequestData:a,requestDataFromForm:Et,offsetParent:mt,fixedToAbsolute:E,presentAttr:xt,createElement:v,parseUrl:bt,normalizeUrl:ft,normalizeMethod:pt,createElementFromHtml:g,$createElementFromSelector:n,$createPlaceholder:r,selectorForElement:Rt,extend:$,copy:m,merge:ut,options:yt,option:gt,error:k,each:w,map:nt,times:Lt,any:i,all:u,detect:b,select:Ut,reject:$t,intersect:O,compact:p,uniq:Nt,last:et,isNull:H,isDefined:M,isUndefined:G,isGiven:I,isMissing:N,isPresent:V,isBlank:U,presence:St,isObject:_,isFunction:z,isString:X,isElement:K,isJQuery:q,isPromise:J,isDeferred:R,isHash:W,isArray:F,isFormData:L,isUnmodifiedKeyEvent:Y,isUnmodifiedMouseEvent:Z,nullJQuery:dt,unJQuery:qt,setTimer:jt,nextFrame:st,measure:rt,temporaryCss:Kt,cssAnimate:y,finishCssAnimate:P,forceCompositing:A,forceRepaint:C,escapePressed:S,copyAttributes:h,findWithSelf:T,contains:d,toArray:It,castedAttr:l,locationFromXhr:tt,titleFromXhr:zt,methodFromXhr:it,clientSize:c,only:vt,except:x,trim:Wt,unresolvableDeferred:Ht,unresolvablePromise:Qt,resolvedPromise:Ot,resolvedDeferred:Ct,resolvableWhen:At,setMissingAttrs:Mt,remove:Dt,memoize:ot,scrollbarWidth:Ft,config:f,cache:s,unwrapElement:_t,multiSelector:at,error:k,pluckData:wt,pluckKey:kt,extractOptions:D,isDetached:j,noop:ct}}($),up.error=up.util.error}.call(this),function(){var e=[].slice;up.log=function(){var t,n,r,o,u,i;return o=function(e){return"\u1d1c\u1d18 "+e},t=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?(r=up.browser).puts.apply(r,["debug",o(n)].concat(e.call(t))):void 0},u=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?(r=up.browser).puts.apply(r,["log",o(n)].concat(e.call(t))):void 0},i=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?(r=up.browser).puts.apply(r,["warn",o(n)].concat(e.call(t))):void 0},r=function(){var t,n,r,u;if(r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n=t.pop(),!r)return n();(u=up.browser).puts.apply(u,["group",o(r)].concat(e.call(t)));try{return n()}finally{r&&console.groupEnd()}},n=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?(r=up.browser).puts.apply(r,["error",o(n)].concat(e.call(t))):void 0},{puts:u,debug:t,error:n,warn:i,group:r}}(jQuery),up.puts=up.log.puts}.call(this),function(){var e=[].slice;up.browser=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w;return b=up.util,h=function(e,n){var r,o,u,i,a;return null==n&&(n={}),i=b.option(n.method,"get").toLowerCase(),"get"===i?(a=b.requestDataAsQuery(n.data),a&&(e=e+"?"+a),location.href=e):(r=t("<form method='post' action='"+e+"'></form>"),o=function(e){var n;return n=t('<input type="hidden">'),n.attr(e.name,e.value),n.appendTo(r)},o({name:up.proxy.config.wrapMethodParam,value:i}),(u=up.rails.csrfField())&&o(u),b.each(b.requestDataAsArray(n.data),o),r.hide().appendTo("body"),r.submit())},g=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],b.isDefined(console[r])||(r="log"),i()?console[r].apply(console,t):(n=y.apply(null,t),console[r](n))},n=/\%[odisf]/g,y=function(){var t,r,o,u;return u=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],r=0,o=80,u.replace(n,function(){var e,n;return e=t[r],n=typeof e,"string"===n?(e=e.replace(/\s+/g," "),e.length>o&&(e=e.substr(0,o)+"\u2026"),e='"'+e+'"'):e="undefined"===n?"undefined":"number"===n||"function"===n?e.toString():JSON.stringify(e),e.length>o&&(e=e.substr(0,o)+" \u2026",("object"===n||"function"===n)&&(e+=" }")),r+=1,e})},w=function(){return location.href},p=b.memoize(function(){return b.isUndefined(document.addEventListener)}),f=b.memoize(function(){return p()||-1!==navigator.appVersion.indexOf("MSIE 9.")}),a=b.memoize(function(){return b.isDefined(history.pushState)&&"get"===l()}),r=b.memoize(function(){return"transition"in document.documentElement.style}),u=b.memoize(function(){return"oninput"in document.createElement("input")}),o=b.memoize(function(){return!!window.FormData}),i=b.memoize(function(){return!f()}),d=b.memoize(function(){var e,n,r,o;return o=t.fn.jquery,r=o.split("."),e=parseInt(r[0]),n=parseInt(r[1]),e>=2||1===e&&n>=9}),v=function(e){var t,n;return n=null!=(t=document.cookie.match(new RegExp(e+"=(\\w+)")))?t[1]:void 0,b.isPresent(n)&&(document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},s=function(e){return e.preload||b.isBlank(e.confirm)||window.confirm(e.confirm)?b.resolvedPromise():b.unresolvablePromise()},l=b.memoize(function(){return(v("_up_request_method")||"get").toLowerCase()}),m=function(){return!p()&&d()},c=function(){return console.group||(console.group=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],g.apply(null,["group"].concat(e.call(t)))}),console.groupCollapsed||(console.groupCollapsed=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],g.apply(null,["groupCollapsed"].concat(e.call(t)))}),console.groupEnd||(console.groupEnd=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],g.apply(null,["groupEnd"].concat(e.call(t)))})},{url:w,loadPage:h,confirm:s,canPushState:a,canCssTransition:r,canInputEvent:u,canFormData:o,canLogSubstitution:i,isSupported:m,installPolyfills:c,puts:g,sprintf:y}}(jQuery)}.call(this),function(){var slice=[].slice;up.bus=function($){var boot,emit,emitReset,forgetUpDescription,live,liveUpDescriptions,logEmission,nextUpDescriptionNumber,nobodyPrevents,onEscape,rememberUpDescription,restoreSnapshot,snapshot,u,unbind,upDescriptionNumber,upDescriptionToJqueryDescription,upListenerToJqueryListener;return u=up.util,liveUpDescriptions={},nextUpDescriptionNumber=0,upListenerToJqueryListener=function(e){return function(t){var n;return n=t.$element||$(this),e.apply(n.get(0),[t,n,up.syntax.data(n)])}},upDescriptionToJqueryDescription=function(e,t){var n,r,o;return n=u.copy(e),o=n.pop(),r=void 0,t?(r=upListenerToJqueryListener(o),o._asJqueryListener=r,o._descriptionNumber=++nextUpDescriptionNumber):(r=o._asJqueryListener,r||u.error("up.off: The event listener %o was never registered through up.on")),n.push(r),n},live=function(){var e,t,n;return n=1<=arguments.length?slice.call(arguments,0):[],up.browser.isSupported()?(e=upDescriptionToJqueryDescription(n,!0),rememberUpDescription(n),(t=$(document)).on.apply(t,e),function(){return unbind.apply(null,n)}):function(){}},unbind=function(){var e,t,n;return n=1<=arguments.length?slice.call(arguments,0):[],e=upDescriptionToJqueryDescription(n,!1),forgetUpDescription(n),(t=$(document)).off.apply(t,e)},rememberUpDescription=function(e){var t;return t=upDescriptionNumber(e),liveUpDescriptions[t]=e},forgetUpDescription=function(e){var t;return t=upDescriptionNumber(e),delete liveUpDescriptions[t]},upDescriptionNumber=function(e){return u.last(e)._descriptionNumber},emit=function(e,t){var n,r;return null==t&&(t={}),r=$.Event(e,t),(n=t.$element)?delete t.$element:n=$(document),logEmission(e,t),n.trigger(r),r},logEmission=function(e,t){var n,r,o;return t.hasOwnProperty("message")?(n=t.message,delete t.message,u.isArray(n)?(o=n,n=o[0],r=2<=o.length?slice.call(o,1):[]):r=[],n?u.isPresent(t)?up.puts.apply(up,[n+" (%s (%o))"].concat(slice.call(r),[e],[t])):up.puts.apply(up,[n+" (%s)"].concat(slice.call(r),[e])):void 0):u.isPresent(t)?up.puts("Emitted event %s (%o)",e,t):up.puts("Emitted event %s",e)},nobodyPrevents=function(){var e,t;return e=1<=arguments.length?slice.call(arguments,0):[],t=emit.apply(null,e),t.isDefaultPrevented()?(up.puts("An observer prevented the event %s",e[0]),!1):!0},onEscape=function(e){return live("keydown","body",function(t){return u.escapePressed(t)?e(t):void 0})},snapshot=function(){var e,t,n,r;for(r=[],t=0,n=liveUpDescriptions.length;n>t;t++)e=liveUpDescriptions[t],r.push(e.isDefault=!0);return r},restoreSnapshot=function(){var e,t,n,r,o;for(t=u.reject(liveUpDescriptions,function(e){return e.isDefault}),o=[],n=0,r=t.length;r>n;n++)e=t[n],o.push(unbind.apply(null,e));return o},emitReset=function(){return up.emit("up:framework:reset",{message:"Resetting framework"})},boot=function(){return up.browser.isSupported()?(up.browser.installPolyfills(),up.emit("up:framework:boot",{message:"Booting framework"})):void 0},live("up:framework:boot",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,onEscape:onEscape,emitReset:emitReset,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 e=[].slice;up.syntax=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,n="up-destroyable",r="up-destroyer",l=[],d=[],s=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],p.apply(null,[l].concat(e.call(t)))},f=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],p.apply(null,[d].concat(e.call(t)))},u=function(){var t,n,r,o;return o=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n=t.pop(),r=v.options(t[0],{priority:0}),{selector:o,callback:n,priority:r.priority,batch:r.batch,keep:r.keep}},p=function(){var t,n,r,o,i;if(i=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],up.browser.isSupported()){for(r=u.apply(null,t),n=0;(o=i[n])&&o.priority<=r.priority;)n+=1;return i.splice(n,0,r)}},o=function(e,t,o){var u,i;return up.puts(e.isDefault?void 0:"Compiling '%s' on %o",e.selector,o),e.keep&&(i=v.isString(e.keep)?e.keep:"",t.attr("up-keep",i)),u=e.callback.apply(o,[t,c(t)]),v.isFunction(u)?(t.addClass(n),t.data(r,u)):void 0},a=function(e,n){var r;return n=v.options(n),r=t(n.skip),up.log.group("Compiling fragment %o",e.get(0),function(){var n,u,i,a,c,p;for(c=[d,l],p=[],u=0,i=c.length;i>u;u++)a=c[u],p.push(function(){var u,i,l;for(l=[],u=0,i=a.length;i>u;u++)s=a[u],n=v.findWithSelf(e,s.selector),n=n.filter(function(){var e;return e=t(this),v.all(r,function(t){return 0===e.closest(t).length})}),l.push(n.length?up.log.group(s.isDefault?void 0:"Compiling '%s' on %d element(s)",s.selector,n.length,function(){return s.batch?o(s,n,n.get()):n.each(function(){return o(s,t(this),this)})}):void 0);return l}());return p})},i=function(e){return v.findWithSelf(e,"."+n).each(function(){var e,n;return e=t(this),(n=e.data(r))()})},c=function(e){var n,r;return n=t(e),r=n.attr("up-data"),v.isString(r)&&""!==v.trim(r)?JSON.parse(r):{}},h=function(){var e,t,n;for(n=[],e=0,t=l.length;t>e;e++)s=l[e],n.push(s.isDefault=!0);return n},m=function(){return l=v.select(l,function(e){return e.isDefault})},up.on("up:framework:boot",h),up.on("up:framework:reset",m),{compiler:s,macro:f,compile:a,clean:i,data:c}}(jQuery),up.compiler=up.syntax.compiler,up.macro=up.syntax.macro,up.ready=function(){return up.util.error("up.ready no longer exists. Please use up.hello instead.")},up.awaken=function(){return up.util.error("up.awaken no longer exists. Please use up.compiler instead.")}}.call(this),function(){up.history=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,i=void 0,m=function(){return n.reset(),c=void 0,i=void 0},a=function(e){return v.normalizeUrl(e,{hash:!0})},r=function(){return a(up.browser.url())},o=function(e){return a(e)===r()},s=function(e){return i&&(c=i,i=void 0),i=e},d=function(e,t){return u("replace",e,t)},p=function(e,t){return up.puts("Current location is now %s",e),u("push",e,t)},u=function(e,n,u){var i,a;return u=v.options(u,{force:!1}),u.force||!o(n)?up.browser.canPushState()?(i=e+"State",a=t(),window.history[i](a,"",n),s(r())):v.error("This browser doesn't support history.pushState"):void 0},t=function(){return{fromUp:!0}},h=function(e){var t;return(null!=e?e.fromUp:void 0)?(t=r(),up.log.group("Restoring URL %s",t,function(){var e;return e=n.popTargets.join(", "),up.replace(e,t,{history:!1,title:!0,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll})})):up.puts("Ignoring a state not pushed by Unpoly (%o)",e)},l=function(e){return up.log.group("History state popped to URL %s",r(),function(){var t;return s(r()),up.layout.saveScroll({url:c}),t=e.originalEvent.state,h(t)})},up.browser.canPushState()&&(f=function(){return e(window).on("popstate",l),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(e){return v.isPresent(c)?(v.setMissingAttrs(e,{"up-href":c,"up-restore-scroll":""}),e.removeAttr("up-back"),up.link.makeFollowable(e)):void 0}),up.on("up:framework:reset",m),{config:n,defaults:function(){return v.error("up.history.defaults(...) no longer exists. Set values on he up.history.config property instead.")},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,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,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(e,t,n){var r,o,i,a,s;return r=$(e),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:t},r.get(0)===document&&(r=$("html, body")),r.animate(s,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(t),u.resolvedDeferred())},finishScrolling=function(e){return $(e).each(function(){var e;return(e=$(this).data(SCROLL_PROMISE_KEY))?e.resolve():void 0})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var e,t,n,r;return n=function(e,t){var n,r;return n=$(e),r=n.css(t),u.isPresent(r)||u.error("Fixed element %o must have a CSS attribute %s",n.get(0),t),parseInt(r)+n.height()},t=function(){var e,t,o,u;for(o=$(config.fixedTop.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"top"));return u}(),e=function(){var e,t,o,u;for(o=$(config.fixedBottom.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"bottom"));return u}(),{top:Math.max.apply(Math,[0].concat(slice.call(t))),bottom:Math.max.apply(Math,[0].concat(slice.call(e)))}},reveal=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m,h,v;return n=$(e),up.puts("Revealing fragment %o",e.get(0)),t=u.options(t),r=t.viewport?$(t.viewport):viewportOf(n),m=u.option(t.snap,config.snap),v=r.is(document),h=v?u.clientSize().height:r.height(),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+h-l.bottom-1},o=u.measure(n,{relative:r}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(s+=a-d()),(i<f()||t.top)&&(s=i-l.top),m>s&&(s=0),s!==p?scroll(r,s,t):u.resolvedDeferred()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(e,t){var n,r;return null==t&&(t={}),n=$(e),r=viewportSelector().seekUp(n),0===r.length&&t.strict!==!1&&u.error("Could not find viewport for %o",n),r},viewportsWithin=function(e){var t;return t=$(e),viewportSelector().findWithSelf(t)},viewports=function(){return viewportSelector().select()},scrollTops=function(){var e,t,n,r,o,u,i;for(u={},o=config.viewports,t=0,r=o.length;r>t;t++)i=o[t],e=$(i),e.length&&(n=i,i===document&&(n="document"),u[n]=e.scrollTop());return u},fixedChildren=function(e){var t,n;return null==e&&(e=void 0),e||(e=document.body),n=$(e),t=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(t=t.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(t=t.add(n.find(config.fixedBottom.join(", ")))),t},saveScroll=function(e){var t,n;return null==e&&(e={}),n=u.option(e.url,up.history.url()),t=u.option(e.tops,scrollTops()),up.puts("Saving scroll positions for URL %s (%o)",n,t),lastScrollTops.set(n,t)},restoreScroll=function(e){var t,n,r,o,i;return null==e&&(e={}),i=up.history.url(),r=void 0,e.around?(n=viewportsWithin(e.around),t=viewportOf(e.around),r=t.add(n)):r=viewports(),o=lastScrollTops.get(i),up.log.group("Restoring scroll positions for URL %s to %o",i,o,function(){var e,t,n,i;for(t in o)i=o[t],n="document"===t?document:t,e=r.filter(n),scroll(e,i,{duration:0});return u.resolvedDeferred()})},revealOrRestoreScroll=function(e,t){var n,r,o,i;return n=$(e),t.restoreScroll?restoreScroll({around:n}):t.reveal?(t.source&&(i=u.parseUrl(t.source),i.hash&&"#"!==i.hash&&(o=i.hash.substr(1),r=u.findWithSelf(n,"#"+o+", a[name='"+o+"']"),r.length&&(n=r))),reveal(n)):u.resolvedDeferred()},up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,scroll:scroll,finishScrolling:finishScrolling,config:config,defaults:function(){return u.error("up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.")},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}.call(this),function(){up.flow=function($){var autofocus,destroy,emitFragmentInserted,emitFragmentKept,extract,findKeepPlan,findOldFragment,first,hello,isRealElement,oldFragmentNotFound,parseImplantSteps,parseResponse,processResponse,reload,replace,resolveSelector,setSource,source,swapElements,transferKeepableElements,u,updateHistory;return u=up.util,setSource=function(e,t){var n;return n=$(e),u.isPresent(t)&&(t=u.normalizeUrl(t)),n.attr("up-source",t)},source=function(e){var t;return t=$(e).closest("[up-source]"),u.presence(t.attr("up-source"))||up.browser.url()},resolveSelector=function(e,t){var n,r;return u.isString(e)?(r=e,u.contains(r,"&")&&(t?(n=u.selectorForElement(t),r=r.replace(/\&/,n)):u.error("Found origin reference (%s) in selector %s, but options.origin is missing","&",r))):r=u.selectorForElement(e),r},replace=function(e,t,n){var r,o,i,a;return up.puts("Replacing %s from %s (%o)",e,t,n),n=u.options(n),a=resolveSelector(e,n.origin),r=u.option(n.failTarget,"body"),r=resolveSelector(r,n.origin),up.browser.canPushState()||n.history===!1?(i={url:t,method:n.method,data:n.data,target:a,failTarget:r,cache:n.cache,preload:n.preload,headers:n.headers},o=up.ajax(i),o.done(function(e,r,o){return processResponse(!0,a,t,i,o,n)}),o.fail(function(e){return processResponse(!1,r,t,i,e,n)}),o):(n.preload||up.browser.loadPage(t,u.only(n,"method","data")),u.unresolvablePromise())},processResponse=function(e,t,n,r,o,i){var a,s,l,c;return i.method=u.normalizeMethod(u.option(u.methodFromXhr(o),i.method)),i.title=u.option(u.titleFromXhr(o),i.title),i.title===!1||u.isString(i.title)||i.history===!1&&i.title!==!0||(i.title=u.titleFromXhr(o)),a="GET"===i.method,(c=u.locationFromXhr(o))?(n=c,e&&(s={url:n,method:u.methodFromXhr(o),target:t},up.proxy.alias(r,s))):a&&(l=u.requestDataAsQuery(i.data))&&(n=n+"?"+l),e?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)),i.preload?u.resolvedPromise():extract(t,o.responseText,i)},extract=function(e,t,n){return up.log.group("Extracting %s from %d bytes of HTML",e,null!=t?t.length:void 0,function(){var r,o,i,a,s,l,c,p;for(n=u.options(n,{historyMethod:"push",requireMatch:!0,keep:!0}),c=resolveSelector(e,n.origin),l=parseResponse(t,n),n.title||(n.title=l.title()),n.saveScroll!==!1&&up.layout.saveScroll(),"function"==typeof n.beforeSwap&&n.beforeSwap(),r=[],updateHistory(n),a=parseImplantSteps(c,n),o=0,i=a.length;i>o;o++)p=a[o],up.log.group("Updating %s",p.selector,function(){var e,t,o,u;
2
+ return t=findOldFragment(p.selector,n),e=null!=(u=l.find(p.selector))?u.first():void 0,t&&e?(o=swapElements(t,e,p.pseudoClass,p.transition,n),r.push(o)):void 0});return"function"==typeof n.afterSwap&&n.afterSwap(),(s=up.motion).when.apply(s,r)})},findOldFragment=function(e,t){return first(".up-popup "+e)||first(".up-modal "+e)||first(e)||oldFragmentNotFound(e,t)},oldFragmentNotFound=function(e,t){var n;return t.requireMatch?(n="Could not find selector %s in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),u.error(n,e)):void 0},parseResponse=function(e,t){var n;return n=u.createElementFromHtml(e),{title:function(){var e;return null!=(e=n.querySelector("title"))?e.textContent:void 0},find:function(r){var o;return(o=$.find(r,n)[0])?$(o):t.requireMatch?u.error("Could not find selector %s in response %o",r,e):void 0}}},updateHistory=function(e){return e.title&&(document.title=e.title),e.history?up.history[e.historyMethod](e.history):void 0},swapElements=function(e,t,n,r,o){var i,a,s,l;return r||(r="none"),"keep"===o.source&&(o=u.merge(o,{source:source(e)})),up.motion.finish(e),n?(i=t.contents().wrap('<span class="up-insertion"></span>').parent(),"before"===n?e.prepend(i):e.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(e,t,o))?(emitFragmentKept(a),s=u.resolvedPromise()):(l=function(){return o.keepPlans=transferKeepableElements(e,t,o),t.insertBefore(e),o.source!==!1&&setSource(t,o.source),autofocus(t),hello(t,o),up.morph(e,t,r,o)},s=destroy(e,{animation:l})),s},transferKeepableElements=function(e,t,n){var r,o,i,a,s,l,c,p;if(a=[],n.keep)for(p=e.find("[up-keep]"),i=0,l=p.length;l>i;i++)s=p[i],r=$(s),(c=findKeepPlan(r,t,u.merge(n,{descendantsOnly:!0})))&&(o=r.clone(),r.replaceWith(o),c.$newElement.replaceWith(r),a.push(c));return a},findKeepPlan=function(e,t,n){var r,o,i,a,s;return n.keep&&(r=e,(s=u.castedAttr(r,"up-keep"))&&(u.isString(s)||(s="&"),s=resolveSelector(s,r),o=n.descendantsOnly?t.find(s):u.findWithSelf(t,s),o=o.first(),o.length&&o.is("[up-keep]")&&(i={$element:r,$newElement:o,newData:up.syntax.data(o)},a=u.merge(i,{message:["Keeping element %o",r.get(0)]}),up.bus.nobodyPrevents("up:fragment:keep",a))))?i:void 0},parseImplantSteps=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m;for(d=t.transition||t.animation||"none",n=/\ *,\ */,r=e.split(n),m=u.isString(m)?d.split(n):[d],l=[],o=i=0,a=r.length;a>i;o=++i)c=r[o],p=c.match(/^(.+?)(?:\:(before|after))?$/),p||u.error('Could not parse selector atom "%s"',c),e=p[1],"html"===e&&(e="body"),s=p[2],f=m[o]||u.last(m),l.push({selector:e,pseudoClass:s,transition:f});return l},hello=function(e,t){var n,r,o,i,a,s;for(n=$(e),t=u.options(t,{keepPlans:[]}),o=[],s=t.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,t),n},emitFragmentInserted=function(e,t){var n;return n=$(e),up.emit("up:fragment:inserted",{$element:n,message:["Inserted fragment %o",n.get(0)],origin:t.origin})},emitFragmentKept=function(e){var t;return t=u.merge(e,{message:["Kept fragment %o",e.$element.get(0)]}),up.emit("up:fragment:kept",t)},autofocus=function(e){var t,n;return n="[autofocus]:last",t=u.findWithSelf(e,n),t.length&&t.get(0)!==document.activeElement?t.focus():void 0},isRealElement=function(e){var t;return t=".up-ghost, .up-destroying",0===e.closest(t).length},first=function(e){var t,n,r,o,i,a;for(o=void 0,o=u.isString(e)?$(e).get():e,n=void 0,i=0,a=o.length;a>i;i++)if(r=o[i],t=$(r),isRealElement(t)){n=t;break}return n},destroy=function(e,t){var n,r,o,i,a;return n=$(e),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})?(t=u.options(t,{animation:!1}),r=up.motion.animateOptions(t),n.addClass("up-destroying"),u.isPresent(t.url)&&up.history.push(t.url),u.isPresent(t.title)&&(document.title=t.title),o=u.presence(t.animation,u.isDeferred)||up.motion.animate(n,t.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(e,t){var n;return t=u.options(t,{cache:!1}),n=t.url||source(e),replace(e,n,t)},up.on("ready",function(){var e;return e=$(document.body),setSource(e,up.browser.url()),hello(e)}),{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}}(jQuery),up.replace=up.flow.replace,up.extract=up.flow.extract,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.first=up.flow.first,up.hello=up.flow.hello}.call(this),function(){var e=[].slice;up.motion=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,S,x,$,D,T,P,E,A;return E=up.util,a={},c={},T={},p={},l=E.config({duration:300,delay:0,easing:"ease",enabled:!0}),k=function(){return a=E.copy(c),T=E.copy(p),l.reset()},v=function(){return l.enabled&&up.browser.canCssTransition()},o=function(e,n,r){var i;return i=t(e),m(i),r=u(r),"none"===n||n===!1?b():E.isFunction(n)?s(n(i,r),n):E.isString(n)?o(i,d(n),r):E.isHash(n)?v()?E.cssAnimate(i,n,r):(i.css(n),E.resolvedDeferred()):E.error("Unknown animation type for %o",n)},u=function(){var t,n,r,o,u;return u=arguments[0],n=2<=arguments.length?e.call(arguments,1):[],u=E.options(u),r=E.extractOptions(n),t=n.length>1?n[1]:void 0,o={},o.easing=E.option(u.easing,null!=t?t.attr("up-easing"):void 0,r.easing,l.easing),o.duration=Number(E.option(u.duration,null!=t?t.attr("up-duration"):void 0,r.duration,l.duration)),o.delay=Number(E.option(u.delay,null!=t?t.attr("up-delay"):void 0,r.delay,l.delay)),o},d=function(e){return a[e]||E.error("Unknown animation %o",e)},r="up-ghosting-deferred",n="up-ghosting",A=function(e,t,o,u){var i,a,s,l,c,p,f,d;return o.copy===!1||e.is(".up-ghost")||t.is(".up-ghost")?u(e,t):(p=void 0,l=void 0,f=void 0,c=void 0,a=up.layout.viewportOf(e),i=e.add(t),E.temporaryCss(t,{display:"none"},function(){return p=w(e,a),f=a.scrollTop()}),E.temporaryCss(e,{display:"none"},function(){return up.layout.revealOrRestoreScroll(t,o),l=w(t,a),c=a.scrollTop()}),p.moveTop(c-f),e.hide(),d=E.temporaryCss(t,{opacity:"0"}),s=u(p.$ghost,l.$ghost),i.data(r,s),i.addClass(n),s.then(function(){return i.removeData(r),i.removeClass(n),d(),p.$bounds.remove(),l.$bounds.remove()}),s)},m=function(e){var r,o,u;return null==e&&(e=".up-animating"),o=t(e),r=E.findWithSelf(o,".up-animating"),E.finishCssAnimate(r),u=E.findWithSelf(o,"."+n),h(u)},h=function(e){return e.each(function(){var e,n;return e=t(this),(n=E.pluckData(e,r))?n.resolve():void 0})},s=function(e,t){return E.isDeferred(e)?e:E.error("Did not return a promise with .then and .resolve methods: %o",t)},y=function(e,n,r,i){var l,c;return"none"===r&&(r=!1),i=E.options(i),c=t(e),l=t(n),f(c,r),f(l,r),up.log.group(r?"Morphing %o to %o (using %s)":void 0,c.get(0),l.get(0),r,function(){var e,t,n,p;return t=E.only(i,"reveal","restoreScroll","source"),t=E.extend(t,u(i)),v()?(m(c),m(l),r?(e=a[r])?(x(c,l,t),o(l,e,t)):(p=E.presence(r,E.isFunction)||T[r])?A(c,l,t,function(e,n){var o;return o=p(e,n,t),s(o,r)}):E.isString(r)&&r.indexOf("/")>=0?(n=r.split("/"),p=function(e,t,r){return S(o(e,n[0],r),o(t,n[1],r))},y(c,l,p,t)):E.error("Unknown transition %o",r):x(c,l,t)):x(c,l,t)})},f=function(e,t){var n;return t&&0===e.parents("body").length?(n=e.get(0),E.error("Can't morph a <%s> element (%o)",n.tagName,n)):void 0},x=function(e,t,n){return e.hide(),up.layout.revealOrRestoreScroll(t,n)},w=function(e,n){var r,o,u,i,a,s,l,c,p;for(i=E.measure(e,{relative:!0,inner:!0}),u=e.clone(),u.find("script").remove(),u.css({position:"static"===e.css("position")?"static":"relative",top:"",right:"",bottom:"",left:"",width:"100%",height:"100%"}),u.addClass("up-ghost"),r=t('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(i),p=i.top,c=function(e){return 0!==e?(p+=e,r.css({top:p})):void 0},u.appendTo(r),r.insertBefore(e),c(e.offset().top-u.offset().top),o=up.layout.fixedChildren(u),s=0,l=o.length;l>s;s++)a=o[s],E.fixedToAbsolute(a,n);return{$ghost:u,$bounds:r,moveTop:c}},D=function(e,t){return T[e]=t},i=function(e,t){return a[e]=t},$=function(){return c=E.copy(a),p=E.copy(T)},S=E.resolvableWhen,b=E.resolvedDeferred,g=function(e){return e===!1||"none"===e||e===b},i("none",b),i("fade-in",function(e,t){return e.css({opacity:0}),o(e,{opacity:1},t)}),i("fade-out",function(e,t){return e.css({opacity:1}),o(e,{opacity:0},t)}),P=function(e,t){return{transform:"translate("+e+"px, "+t+"px)"}},i("move-to-top",function(e,t){var n,r;return n=E.measure(e),r=n.top+n.height,e.css(P(0,0)),o(e,P(0,-r),t)}),i("move-from-top",function(e,t){var n,r;return n=E.measure(e),r=n.top+n.height,e.css(P(0,-r)),o(e,P(0,0),t)}),i("move-to-bottom",function(e,t){var n,r;return n=E.measure(e),r=E.clientSize().height-n.top,e.css(P(0,0)),o(e,P(0,r),t)}),i("move-from-bottom",function(e,t){var n,r;return n=E.measure(e),r=E.clientSize().height-n.top,e.css(P(0,r)),o(e,P(0,0),t)}),i("move-to-left",function(e,t){var n,r;return n=E.measure(e),r=n.left+n.width,e.css(P(0,0)),o(e,P(-r,0),t)}),i("move-from-left",function(e,t){var n,r;return n=E.measure(e),r=n.left+n.width,e.css(P(-r,0)),o(e,P(0,0),t)}),i("move-to-right",function(e,t){var n,r;return n=E.measure(e),r=E.clientSize().width-n.left,e.css(P(0,0)),o(e,P(r,0),t)}),i("move-from-right",function(e,t){var n,r;return n=E.measure(e),r=E.clientSize().width-n.left,e.css(P(r,0)),o(e,P(0,0),t)}),i("roll-down",function(e,t){var n,r,u;return r=e.height(),u=E.temporaryCss(e,{height:"0px",overflow:"hidden"}),n=o(e,{height:r+"px"},t),n.then(u),n}),D("none",b),D("move-left",function(e,t,n){return S(o(e,"move-to-left",n),o(t,"move-from-right",n))}),D("move-right",function(e,t,n){return S(o(e,"move-to-right",n),o(t,"move-from-left",n))}),D("move-up",function(e,t,n){return S(o(e,"move-to-top",n),o(t,"move-from-bottom",n))}),D("move-down",function(e,t,n){return S(o(e,"move-to-bottom",n),o(t,"move-from-top",n))}),D("cross-fade",function(e,t,n){return S(o(e,"fade-out",n),o(t,"fade-in",n))}),up.on("up:framework:boot",$),up.on("up:framework:reset",k),{morph:y,animate:o,animateOptions:u,finish:m,transition:D,animation:i,config:l,isEnabled:v,defaults:function(){return E.error("up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.")},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 e=[].slice;up.proxy=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,S,x,$,D,T,P,E,A,C,O,F,U,R;return R=up.util,n=void 0,$=void 0,O=void 0,k=void 0,F=void 0,T=[],p=R.config({slowDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5,maxRequests:4,wrapMethods:["PATCH","PUT","DELETE"],wrapMethodParam:"_method",safeMethods:["GET","OPTIONS","HEAD"]}),i=function(e){return w(e),[e.url,e.method,e.data,e.target].join("|")},u=R.cache({size:function(){return p.cacheSize},expiry:function(){return p.cacheExpiry},key:i}),f=function(e){var t,n,r,o,i,a,s;for(e=w(e),n=[e],"html"!==e.target&&(a=R.merge(e,{target:"html"}),n.push(a),"body"!==e.target&&(i=R.merge(e,{target:"body"}),n.push(i))),r=0,o=n.length;o>r;r++)if(t=n[r],s=u.get(t))return s},a=function(){return clearTimeout($),$=null},s=function(){return clearTimeout(O),O=null},E=function(){return n=null,a(),s(),k=0,p.reset(),u.clear(),F=!1,T=[]},E(),w=function(e){return e._normalized||(e.method=R.normalizeMethod(e.method),e.url&&(e.url=R.normalizeUrl(e.url)),e.target||(e.target="body"),e._normalized=!0),e},r=function(){var t,n,r,o,u,i,a;return t=1<=arguments.length?e.call(arguments,0):[],o=R.extractOptions(t),R.isGiven(t[0])&&(o.url=t[0]),n=o.cache===!0,r=o.cache===!1,a=R.only(o,"url","method","data","target","headers","_normalized"),a=w(a),u=!0,m(a)||n?(i=f(a))&&!r?(up.puts("Re-using cached response for %s %s",a.method,a.url),u="pending"===i.state()):(i=y(a),C(a,i),i.fail(function(){return P(a)})):(c(),i=y(a)),u&&!o.preload&&(b(),i.always(g)),console.groupEnd(),i},h=function(){return 0===k},d=function(){return k>0},b=function(){var e,t;return t=h(),k+=1,t?(e=function(){return d()?(up.emit("up:proxy:slow",{message:"Proxy is busy"}),F=!0):void 0},O=R.setTimer(p.slowDelay,e)):void 0},g=function(){return k-=1,h()&&F?(up.emit("up:proxy:recover",{message:"Proxy is idle"}),F=!1):void 0},y=function(e){return k<p.maxRequests?v(e):D(e)},D=function(e){var n,r;return up.puts("Queuing request for %s %s",e.method,e.url),n=t.Deferred(),r={deferred:n,request:e},T.push(r),n.promise()},v=function(e){var n;return up.emit("up:proxy:load",R.merge(e,{message:["Loading %s %s",e.method,e.url]})),e=R.copy(e),e.headers||(e.headers={}),e.headers["X-Up-Target"]=e.target,R.contains(p.wrapMethods,e.method)&&(e.data=R.appendRequestData(e.data,p.wrapMethodParam,e.method),e.method="POST"),R.isFormData(e.data)&&(e.contentType=!1,e.processData=!1),n=t.ajax(e),n.done(function(t,n,r){return A(e,r)}),n.fail(function(t){return A(e,t)}),n},A=function(e,t){var n;return up.emit("up:proxy:received",R.merge(e,{message:["Server responded with %s %s (%d bytes)",t.status,t.statusText,null!=(n=t.responseText)?n.length:void 0]})),S()},S=function(){var t,n;return(t=T.shift())?(n=v(t.request),n.done(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).resolve.apply(r,n)}),n.fail(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).reject.apply(r,n)})):void 0},o=u.alias,C=u.set,P=u.remove,c=u.clear,m=function(e){return w(e),R.contains(p.safeMethods,e.method)},l=function(e){var t,r;return r=parseInt(R.presentAttr(e,"up-delay"))||p.preloadDelay,e.is(n)?void 0:(n=e,a(),t=function(){return x(e),n=null},U(t,r))},U=function(e,t){return $=setTimeout(e,t)},x=function(e,n){var r,o;return r=t(e),n=R.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),R.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(e,t){return up.link.childClicked(e,t)?void 0:l(t)}),up.on("up:framework:reset",E),{preload:x,ajax:r,get:f,alias:o,clear:c,remove:P,isIdle:h,isBusy:d,config:p,defaults:function(){return R.error("up.proxy.defaults(...) no longer exists. Set values on he up.proxy.config property instead.")}}}(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(e,t){var n;return t=u.options(t),n=u.option(t.target,"body"),up.replace(n,e,t)},follow=function(e,t){var n,r,o;return n=$(e),t=u.options(t),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(t.target,n.attr("up-target"),"body"),t.failTarget=u.option(t.failTarget,n.attr("up-fail-target"),"body"),t.transition=u.option(t.transition,u.castedAttr(n,"up-transition"),"none"),t.failTransition=u.option(t.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),t.history=u.option(t.history,u.castedAttr(n,"up-history")),t.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),t.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),t.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),t.method=followMethod(n,t),t.origin=u.option(t.origin,n),t.confirm=u.option(t.confirm,n.attr("up-confirm")),t=u.merge(t,up.motion.animateOptions(t,n)),up.browser.confirm(t).then(function(){return up.replace(r,o,t)})},followMethod=function(e,t){var n;return n=$(e),t=u.options(t),u.option(t.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},childClicked=function(e,t){var n,r;return n=$(e.target),r=n.closest("a, [up-href]"),r.length&&t.find(r).length},shouldProcessLinkEvent=function(e,t){return u.isUnmodifiedMouseEvent(e)&&!childClicked(e,t)},followVariantSelectors=[],allowDefault=function(){},onAction=function(e,t){var n;return followVariantSelectors.push(e),n=function(e){return up.navigation.withActiveMark(e,{enlarge:!0},function(){return t(e)})},up.on("click","a"+e+", [up-href]"+e,function(e,t){return shouldProcessLinkEvent(e,t)?t.is("[up-instant]")?e.preventDefault():(e.preventDefault(),n(t)):allowDefault(e)}),up.on("mousedown","a"+e+"[up-instant], [up-href]"+e+"[up-instant]",function(e,t){return shouldProcessLinkEvent(e,t)?(e.preventDefault(),n(t)):void 0})},isFollowable=function(e){return u.any(followVariantSelectors,function(t){return e.is(t)})},makeFollowable=function(e){var t;return t=$(e),isFollowable(t)?void 0:t.attr("up-follow","")},onAction("[up-target]",function(e){return follow(e)}),onAction("[up-follow]",function(e){return follow(e)}),up.macro("[up-dash]",function(e){var t,n;return n=u.castedAttr(e,"up-dash"),e.removeAttr("up-dash"),t={"up-preload":"","up-instant":""},n===!0?makeFollowable(e):t["up-target"]=n,u.setMissingAttrs(e,t)}),up.macro("[up-expand]",function(e){var t,n,r,o,i,a,s,l,c,p;if(t=e.find("a, [up-href]"),(c=e.attr("up-expand"))&&(t=t.filter(c)),i=t.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(e,s),e.removeAttr("up-expand"),makeFollowable(e)}}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,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,observeForm,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(e,t){var n,r,o,i,a,s,l;return n=$(e).closest("form"),t=u.options(t),s=u.option(t.target,n.attr("up-target"),"body"),l=u.option(t.url,n.attr("action"),up.browser.url()),t.failTarget=u.option(t.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),t.history=u.option(t.history,u.castedAttr(n,"up-history"),!0),t.transition=u.option(t.transition,u.castedAttr(n,"up-transition"),"none"),t.failTransition=u.option(t.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),t.method=u.option(t.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),t.headers=u.option(t.headers,{}),t.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),t.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),t.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),t.origin=u.option(t.origin,n),t.data=up.util.requestDataFromForm(n),t=u.merge(t,up.motion.animateOptions(t,n)),i=n.find("input[type=file]").length,r=!i||u.isFormData(t.data),o=up.browser.canPushState()||t.history===!1,t.validate&&(t.headers||(t.headers={}),t.headers["X-Up-Validate"]=t.validate,!r)?u.unresolvablePromise():(up.navigation.markActive(n),r&&o?(a=up.replace(s,l,t),a.always(function(){return up.navigation.unmarkActive(n)}),a):(n.get(0).submit(),u.unresolvablePromise()))},observe=function(){var $element,args,callback,callbackArg,callbackPromise,callbackTimer,changeEvents,check,clearTimer,delay,knownValue,nextCallback,options,rawCallback,runNextCallback,selectorOrElement;return selectorOrElement=arguments[0],args=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===args.length&&(callbackArg=args[0]),args.length>1&&(options=u.options(args[0]),callbackArg=args[1]),$element=$(selectorOrElement),options=u.options(options),delay=u.option($element.attr("up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),callback=null,u.isGiven(options.change)&&u.error("up.observe now takes the change callback as the last argument"),rawCallback=u.option(u.presentAttr($element,"op-observe"),callbackArg),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||u.error("up.observe: No change callback given"),$element.is("form")?observeForm($element,options,callback):(knownValue=null,callbackTimer=null,callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var e;return nextCallback?(e=nextCallback(),nextCallback=null,e):void 0},check=function(){var e,t,n;return n=$element.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($element.get(0),[n,$element])},e=function(){return callbackPromise.then(function(){var e;return e=runNextCallback(),callbackPromise=u.isPromise(e)?e:u.resolvedPromise()})},u.setTimer(delay,e))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$element.on(changeEvents,check),check(),function(){return $element.off(changeEvents,check),clearTimer()})},observeForm=function(e,t,n){var r,o;return r=u.multiSelector(config.fields).find(e),o=u.map(r,function(e){return observe(e,n)}),function(){var e,t,n,r;for(r=[],t=0,n=o.length;n>t;t++)e=o[t],r.push(e());return r}},autosubmit=function(e,t){return observe(e,t,function(e,t){var n;return n=t.closest("form"),t.addClass("up-active"),submit(n).always(function(){return t.removeClass("up-active")})})},resolveValidateTarget=function(e,t){var n;return n=u.option(t.target,e.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.flow.resolveSelector(n,t.origin),e.closest(r).length}))),u.isBlank(n)&&u.error("Could not find default validation target for %o (tried ancestors %o)",e.get(0),config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(e,t){var n,r,o;return n=$(e),t=u.options(t),t.origin=n,t.target=resolveValidateTarget(n,t),t.failTarget=t.target,t.history=!1,t.headers=u.option(t.headers,{}),t.validate=n.attr("name")||"__none__",t=u.merge(t,up.motion.animateOptions(t,n)),r=n.closest("form"),o=up.submit(r,t)},currentValuesForSwitch=function(e){var t,n,r;return r=void 0,e.is("input[type=checkbox]")?r=e.is(":checked")?[":checked",":present",e.val()]:[":unchecked",":blank"]:e.is("input[type=radio]")?(t=e.closest("form, body").find("input[type='radio'][name='"+e.attr("name")+"']:checked"),r=t.length?[":checked",":present",t.val()]:[":unchecked",":blank"]):(n=e.val(),r=u.isPresent(n)?[":present",n]:[":blank"]),r},currentValuesForSwitch=function(e){var t,n,r,o;return e.is("input[type=checkbox]")?e.is(":checked")?(r=e.val(),n=":checked"):n=":unchecked":e.is("input[type=radio]")?(t=e.closest("form, body").find("input[type='radio'][name='"+e.attr("name")+"']:checked"),t.length?(n=":checked",r=t.val()):n=":unchecked"):r=e.val(),o=[],u.isPresent(r)?(o.push(r),o.push(":present")):o.push(":blank"),u.isPresent(n)&&o.push(n),o},switchTargets=function(e,t){var n,r,o;return n=$(e),t=u.options(t),o=u.option(t.target,n.attr("up-switch")),u.isPresent(o)||u.error("No switch target given for %o",n.get(0)),r=currentValuesForSwitch(n),$(o).each(function(){var e,t,n,o;return e=$(this),(t=e.attr("up-hide-for"))?(t=t.split(" "),n=0===u.intersect(r,t).length):(o=(o=e.attr("up-show-for"))?o.split(" "):[":present",":checked"],n=u.intersect(r,o).length>0),e.toggle(n)})},up.on("submit","form[up-target]",function(e,t){return e.preventDefault(),submit(t)}),up.on("change","[up-validate]",function(e,t){return validate(t)}),up.on("change","[up-switch]",function(e,t){return switchTargets(t)}),up.compiler("[up-switch]",function(e){return switchTargets(e)}),up.compiler("[up-observe]",function(e){return observe(e)}),up.compiler("[up-autosubmit]",function(e){return autosubmit(e)}),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}}(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 attach,autoclose,close,config,contains,coveredUrl,createFrame,currentUrl,discardHistory,ensureInViewport,isOpen,reset,setPosition,u;return u=up.util,currentUrl=void 0,coveredUrl=function(){return $(".up-popup").attr("up-covered-url")},config=u.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right",history:!1}),reset=function(){return close({animation:!1}),config.reset()},setPosition=function(e,t){var n,r,o;return o=u.measure(e,{full:!0}),r=function(){switch(t){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.top+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return u.error("Unknown position option '%s'",t)}}(),n=$(".up-popup"),n.attr("up-position",t),n.css(r),ensureInViewport(n)},ensureInViewport=function(e){var t,n,r,o,i,a,s;if(n=u.measure(e,{full:!0}),r=null,o=null,n.right<0&&(r=-n.right),n.bottom<0&&(o=-n.bottom),n.left<0&&(r=n.left),n.top<0&&(o=n.top),r&&((i=parseInt(e.css("left")))?e.css("left",i-r):(a=parseInt(e.css("right")))&&e.css("right",a+r)),o){if(s=parseInt(e.css("top")))return e.css("top",s-o);if(t=parseInt(e.css("bottom")))return e.css("bottom",t+o)}},discardHistory=function(){var e;return e=$(".up-popup"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createFrame=function(e,t){var n;return n=u.$createElementFromSelector(".up-popup"),t.sticky&&n.attr("up-sticky",""),n.attr("up-covered-url",up.browser.url()),n.attr("up-covered-title",document.title),u.$createPlaceholder(e,n),n.appendTo(document.body),n},isOpen=function(){return $(".up-popup").length>0},attach=function(e,t){var n,r,o,i;return n=$(e),n.length||u.error("Cannot attach popup to non-existing element %o",e),t=u.options(t),i=u.option(t.url,n.attr("href")),o=u.option(t.target,n.attr("up-popup"),"body"),t.position=u.option(t.position,n.attr("up-position"),config.position),t.animation=u.option(t.animation,n.attr("up-animation"),config.openAnimation),t.sticky=u.option(t.sticky,u.castedAttr(n,"up-sticky")),t.history=up.browser.canPushState()?u.option(t.history,u.castedAttr(n,"up-history"),config.history):!1,t.confirm=u.option(t.confirm,n.attr("up-confirm")),r=up.motion.animateOptions(t,n),up.browser.confirm(t).then(function(){var e,a;return up.bus.nobodyPrevents("up:popup:open",{url:i,message:"Opening popup"})?(a=isOpen(),a&&close({animation:!1}),t.beforeSwap=function(){return createFrame(o,t)},e=up.replace(o,i,u.merge(t,{animation:!1})),e=e.then(function(){return setPosition(n,t.position)}),a||(e=e.then(function(){return up.animate($(".up-popup"),t.animation,r)})),e=e.then(function(){return up.emit("up:popup:opened",{message:"Popup opened"})})):u.unresolvableDeferred()})},close=function(e){var t,n;return t=$(".up-popup"),t.length?up.bus.nobodyPrevents("up:popup:close",{$element:t})?(e=u.options(e,{animation:config.closeAnimation,url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,n=up.destroy(t,e),n.then(function(){return up.emit("up:popup:closed",{message:"Popup closed"})}),n):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-popup").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-popup").length>0},up.link.onAction("[up-popup]",function(e){return e.is(".up-current")?close():attach(e)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-popup").length||t.closest("[up-popup]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(contains(e.origin))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-popup").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),attach:attach,close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.popup.defaults(...) no longer exists. Set values on he up.popup.config property instead.")},contains:contains,open:function(){return up.error("up.popup.open no longer exists. Please use up.popup.attach instead.")},source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")},isOpen:isOpen}}(jQuery)}.call(this),function(){up.modal=function($){var autoclose,close,config,contains,coveredUrl,createFrame,currentUrl,discardHistory,extract,follow,isOpen,open,reset,shiftElements,templateHtml,u,unshiftElements,unshifters,visit;return u=up.util,config=u.config({maxWidth:null,minWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",closeDuration:null,closeEasing:null,openDuration:null,openEasing:null,backdropOpenAnimation:"fade-in",backdropCloseAnimation:"fade-out",closeLabel:"\xd7",template:function(e){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-close" up-close>'+e.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n </div>\n</div>'}}),currentUrl=void 0,coveredUrl=function(){return $(".up-modal").attr("up-covered-url")},reset=function(){return close({animation:!1}),currentUrl=void 0,config.reset()},templateHtml=function(){var e;return e=config.template,u.isFunction(e)?e(config):e},discardHistory=function(){var e;return e=$(".up-modal"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createFrame=function(e,t){var n,r,o;return o=$(templateHtml()),t.sticky&&o.attr("up-sticky",""),o.attr("up-covered-url",up.browser.url()),o.attr("up-covered-title",document.title),r=o.find(".up-modal-dialog"),u.isPresent(t.width)&&r.css("width",t.width),u.isPresent(t.maxWidth)&&r.css("max-width",t.maxWidth),u.isPresent(t.height)&&r.css("height",t.height),n=o.find(".up-modal-content"),u.$createPlaceholder(e,n),o.appendTo(document.body),o},unshifters=[],shiftElements=function(){var e,t,n,r;return unshifters.length&&u.error("Tried to call shiftElements multiple times %o",unshifters.length),$(".up-modal").addClass("up-modal-ready"),n=u.scrollbarWidth(),e=parseInt($("body").css("padding-right")),t=n+e,r=u.temporaryCss($("body"),{"padding-right":t+"px","overflow-y":"hidden"}),unshifters.push(r),up.layout.anchoredRight().each(function(){var e,t,r,o;return e=$(this),t=parseInt(e.css("right")),r=n+t,o=u.temporaryCss(e,{right:r}),unshifters.push(o)})},unshiftElements=function(){var e,t;for($(".up-modal").removeClass("up-modal-ready"),e=[];t=unshifters.pop();)e.push(t());return e},isOpen=function(){return $(".up-modal").length>0},follow=function(e,t){return t=u.options(t),t.$link=$(e),open(t)},visit=function(e,t){return t=u.options(t),t.url=e,open(t)},extract=function(e,t,n){return n=u.options(n),n.html=t,n.history=u.option(n.history,!1),n.target=e,open(n)},open=function(e){var t,n,r,o,i;return e=u.options(e),t=u.option(u.pluckKey(e,"$link"),u.nullJQuery()),i=u.option(u.pluckKey(e,"url"),t.attr("up-href"),t.attr("href")),r=u.pluckKey(e,"html"),o=u.option(u.pluckKey(e,"target"),t.attr("up-modal"),"body"),e.width=u.option(e.width,t.attr("up-width"),config.width),e.maxWidth=u.option(e.maxWidth,t.attr("up-max-width"),config.maxWidth),e.height=u.option(e.height,t.attr("up-height"),config.height),e.animation=u.option(e.animation,t.attr("up-animation"),config.openAnimation),e.backdropAnimation=u.option(e.backdropAnimation,t.attr("up-backdrop-animation"),config.backdropOpenAnimation),e.sticky=u.option(e.sticky,u.castedAttr(t,"up-sticky")),e.confirm=u.option(e.confirm,t.attr("up-confirm")),n=up.motion.animateOptions(e,t,{duration:config.openDuration,easing:config.openEasing}),e.history=u.option(e.history,u.castedAttr(t,"up-history"),config.history),up.browser.canPushState()||(e.history=!1),up.browser.confirm(e).then(function(){var t,a,s;return up.bus.nobodyPrevents("up:modal:open",{url:i,message:"Opening modal"})?(s=isOpen(),s&&close({animation:!1}),e.beforeSwap=function(){return createFrame(o,e)},t=u.merge(e,{animation:!1}),a=i?up.replace(o,i,t):up.extract(o,r,t),s||up.motion.isNone(e.animation)||(a=a.then(function(){return $.when(up.animate($(".up-modal-backdrop"),e.backdropAnimation,n),up.animate($(".up-modal-viewport"),e.animation,n))
3
+ })),a=a.then(function(){return shiftElements(),up.emit("up:modal:opened",{message:"Modal opened"})})):u.unresolvablePromise()})},close=function(e){var t,n,r,o,i;return e=u.options(e),t=$(".up-modal"),t.length?up.bus.nobodyPrevents("up:modal:close",{$element:t,message:"Closing modal"})?(unshiftElements(),i=u.option(e.animation,config.closeAnimation),r=u.option(e.backdropAnimation,config.backdropCloseAnimation),n=up.motion.animateOptions(e,{duration:config.closeDuration,easing:config.closeEasing}),o=up.motion.isNone(i)?u.resolvedPromise():$.when(up.animate($(".up-modal-viewport"),i,n),up.animate($(".up-modal-backdrop"),r,n)),o=o.then(function(){var n;return n=u.options(u.except(e,"animation","duration","easing","delay"),{url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,up.destroy(t,n),up.emit("up:modal:closed",{message:"Modal closed"})})):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-modal").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-modal").length>0},up.link.onAction("[up-modal]",function(e){return follow(e)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-modal-dialog").length||t.closest("[up-modal]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(!up.popup.contains(t)&&contains(e.origin))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-modal").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,extract:extract,open:function(){return up.error("up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.")},close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.modal.defaults(...) no longer exists. Set values on he up.modal.config property instead.")},contains:contains,source:function(){return up.error("up.modal.source no longer exists. Please use up.popup.url instead.")},isOpen:isOpen}}(jQuery)}.call(this),function(){up.tooltip=function(e){var t,n,r,o,u,i,a;return a=up.util,r=a.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out"}),u=function(){return n({animation:!1}),r.reset()},i=function(e,t,n){var r,o,u;return o=a.measure(e),u=a.measure(t),r=function(){switch(n){case"top":return{left:o.left+.5*(o.width-u.width),top:o.top-u.height};case"left":return{left:o.left-u.width,top:o.top+.5*(o.height-u.height)};case"right":return{left:o.left+o.width,top:o.top+.5*(o.height-u.height)};case"bottom":return{left:o.left+.5*(o.width-u.width),top:o.top+o.height};default:return a.error("Unknown position option '%s'",n)}}(),t.attr("up-position",n),t.css(r)},o=function(e){var t;return t=a.$createElementFromSelector(".up-tooltip"),a.isGiven(e.text)?t.text(e.text):t.html(e.html),t.appendTo(document.body),t},t=function(t,u){var s,l,c,p,f,d,m;return null==u&&(u={}),s=e(t),f=a.option(u.html,s.attr("up-tooltip-html")),m=a.option(u.text,s.attr("up-tooltip")),d=a.option(u.position,s.attr("up-position"),r.position),p=a.option(u.animation,a.castedAttr(s,"up-animation"),r.openAnimation),c=up.motion.animateOptions(u,s),n(),l=o({text:m,html:f}),i(s,l,d),up.animate(l,p,c)},n=function(t){var n;return n=e(".up-tooltip"),n.length?(t=a.options(t,{animation:r.closeAnimation}),t=a.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[up-tooltip], [up-tooltip-html]",function(e){return e.on("mouseover",function(){return t(e)}),e.on("mouseout",function(){return n()})}),up.on("click","body",function(){return n()}),up.on("up:framework:reset",n),up.bus.onEscape(function(){return n()}),up.on("up:framework:reset",u),{attach:t,close:n,open:function(){return a.error("up.tooltip.open no longer exists. Use up.tooltip.attach instead.")}}}(jQuery)}.call(this),function(){up.navigation=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m;return p=up.util,r=p.config({currentClasses:["up-current"]}),l=function(){return r.reset()},o=function(){var e;return e=r.currentClasses,e=e.concat(["up-current"]),e=p.uniq(e),e.join(" ")},t="up-active",n="a, [up-href]",s=function(e){return p.isPresent(e)?p.normalizeUrl(e,{search:!1,stripTrailingSlash:!0}):void 0},c=function(e){var t,n,r,o,u,i,a,l,c,f;for(l=[],i=["href","up-href","up-alias"],n=0,o=i.length;o>n;n++)if(t=i[n],c=p.presentAttr(e,t))for(f="up-alias"===t?c.split(" "):[c],r=0,u=f.length;u>r;r++)a=f[r],"#"!==a&&(a=s(a),l.push(a));return l},d=function(e){var t,n,r,o;return e=p.compact(e),r=function(e){return"*"===e.substr(-1)?n(e.slice(0,-1)):t(e)},t=function(t){return p.contains(e,t)},n=function(t){return p.detect(e,function(e){return 0===e.indexOf(t)})},o=function(e){return p.detect(e,r)},{matchesAny:o}},i=function(){var t,r;return t=d([s(up.browser.url()),s(up.modal.url()),s(up.modal.coveredUrl()),s(up.popup.url()),s(up.popup.coveredUrl())]),r=o(),p.each(e(n),function(n){var o,u;return o=e(n),u=c(o),t.matchesAny(u)?o.addClass(r):o.hasClass(r)&&0===o.closest(".up-destroying").length?o.removeClass(r):void 0})},u=function(t,r){var o;return o=e(t),r=p.options(r,{enlarge:!1}),r.enlarge?p.presence(o.parent(n))||o:o},a=function(e,n){var r;return r=u(e,n),r.addClass(t)},f=function(e,n){var r;return r=u(e,n),r.removeClass(t)},m=function(t,n,r){var o,u;return o=e(t),a(o,n),u=r(),p.isPromise(u)?u.always(function(){return f(o,n)}):up.warn("Expected block to return a promise, but got %o",u),u},up.on("up:fragment:inserted",function(){return i()}),up.on("up:fragment:destroyed",function(e,t){return t.is(".up-modal, .up-popup")?i():void 0}),up.on("up:framework:reset",l),{config:r,defaults:function(){return p.error("up.navigation.defaults(...) no longer exists. Set values on he up.navigation.config property instead.")},markActive:a,unmarkActive:f,withActiveMark:m}}(jQuery)}.call(this),function(){up.rails=function(e){var t,n,r,o;return r=up.util,o=function(e){return e.is("[up-follow], [up-target], [up-modal], [up-popup]")},n=function(){return r.isGiven(e.rails)},r.each(["method","confirm"],function(e){var t,u;return t="data-"+e,u="up-"+e,up.compiler("["+t+"]",function(e){var i;return n()&&o(e)?(i={},i[u]=e.attr(t),r.setMissingAttrs(e,i),e.removeAttr(t)):void 0})}),t=function(){return n()?{name:e.rails.csrfParam(),value:e.rails.csrfToken()}:void 0},{csrfField:t,isRails:n}}(jQuery)}.call(this),function(){up.boot()}.call(this);
@@ -4,8 +4,11 @@
4
4
  up.modal.config.template =
5
5
  """
6
6
  <div class="up-modal">
7
- <div class="up-modal-dialog modal-dialog">
8
- <div class="up-modal-content modal-content"></div>
7
+ <div class="up-modal-backdrop"></div>
8
+ <div class="up-modal-viewport">
9
+ <div class="up-modal-dialog modal-dialog">
10
+ <div class="up-modal-content modal-content"></div>
11
+ </div>
9
12
  </div>
10
13
  </div>
11
14
  """
@@ -711,7 +711,9 @@ up.flow = (($) ->
711
711
  unless $element.is('.up-placeholder, .up-tooltip, .up-modal, .up-popup')
712
712
  destroyMessage = ['Destroying fragment %o', $element.get(0)]
713
713
  destroyedMessage = ['Destroyed fragment %o', $element.get(0)]
714
- if up.bus.nobodyPrevents('up:fragment:destroy', $element: $element, message: destroyMessage)
714
+ if $element.length == 0
715
+ u.resolvedDeferred()
716
+ else if up.bus.nobodyPrevents('up:fragment:destroy', $element: $element, message: destroyMessage)
715
717
  options = u.options(options, animation: false)
716
718
  animateOptions = up.motion.animateOptions(options)
717
719
  $element.addClass('up-destroying')
@@ -141,7 +141,7 @@ up.form = (($) ->
141
141
  unless canAjaxSubmit
142
142
  return u.unresolvablePromise()
143
143
 
144
- $form.addClass('up-active')
144
+ up.navigation.markActive($form)
145
145
 
146
146
  # If we can't submit this form via AJAX or if we wouldn't be able to change
147
147
  # the location URL as the result, fall back to a vanilla form submission.
@@ -150,7 +150,7 @@ up.form = (($) ->
150
150
  return u.unresolvablePromise()
151
151
 
152
152
  promise = up.replace(target, url, options)
153
- promise.always -> $form.removeClass('up-active')
153
+ promise.always -> up.navigation.unmarkActive($form)
154
154
  return promise
155
155
 
156
156
  ###*
@@ -269,10 +269,7 @@ up.form = (($) ->
269
269
  callbackPromise = returnValue
270
270
  else
271
271
  callbackPromise = u.resolvedPromise()
272
- if delay == 0
273
- runAndChain()
274
- else
275
- setTimeout(runAndChain, delay)
272
+ u.setTimer(delay, runAndChain)
276
273
 
277
274
  clearTimer = ->
278
275
  clearTimeout(callbackTimer)
@@ -54,7 +54,7 @@ up.layout = (($) ->
54
54
  ###
55
55
  config = u.config
56
56
  duration: 0
57
- viewports: [document, '.up-modal', '[up-viewport]']
57
+ viewports: [document, '.up-modal-viewport', '[up-viewport]']
58
58
  fixedTop: ['[up-fixed~=top]']
59
59
  fixedBottom: ['[up-fixed~=bottom]']
60
60
  anchoredRight: ['[up-anchored~=right]', '[up-fixed~=top]', '[up-fixed~=bottom]', '[up-fixed~=right]']
@@ -224,6 +224,8 @@ up.link = (($) ->
224
224
 
225
225
  onAction = (selector, handler) ->
226
226
  followVariantSelectors.push(selector)
227
+ handlerWithActiveMark = ($link) ->
228
+ up.navigation.withActiveMark $link, { enlarge: true }, -> handler($link)
227
229
  up.on 'click', "a#{selector}, [up-href]#{selector}", (event, $link) ->
228
230
  if shouldProcessLinkEvent(event, $link)
229
231
  if $link.is('[up-instant]')
@@ -232,14 +234,14 @@ up.link = (($) ->
232
234
  event.preventDefault()
233
235
  else
234
236
  event.preventDefault()
235
- handler($link)
237
+ handlerWithActiveMark($link)
236
238
  else
237
239
  allowDefault(event)
238
240
 
239
241
  up.on 'mousedown', "a#{selector}[up-instant], [up-href]#{selector}[up-instant]", (event, $link) ->
240
242
  if shouldProcessLinkEvent(event, $link)
241
243
  event.preventDefault()
242
- handler($link)
244
+ handlerWithActiveMark($link)
243
245
 
244
246
  isFollowable = ($link) ->
245
247
  u.any followVariantSelectors, (selector) -> $link.is(selector)
@@ -53,8 +53,8 @@ up.log = (($) ->
53
53
  group = (message, args...) ->
54
54
  block = args.pop() # Coffeescript copies the arguments array
55
55
  if message
56
- up.browser.puts('groupCollapsed', prefix(message), args...)
57
- # up.browser.puts('group', prefix(message), args...)
56
+ # up.browser.puts('groupCollapsed', prefix(message), args...)
57
+ up.browser.puts('group', prefix(message), args...)
58
58
  try
59
59
  block()
60
60
  finally
@@ -28,10 +28,13 @@ The easiest way to change how the dialog looks is by overriding the [default CSS
28
28
  By default the dialog uses the following DOM structure:
29
29
 
30
30
  <div class="up-modal">
31
- <div class="up-modal-dialog">
32
- <div class="up-modal-close" up-close>X</div>
33
- <div class="up-modal-content">
34
- ...
31
+ <div class="up-modal-backdrop">
32
+ <div class="up-modal-viewport">
33
+ <div class="up-modal-dialog">
34
+ <div class="up-modal-content">
35
+ ...
36
+ </div>
37
+ <div class="up-modal-close" up-close>X</div>
35
38
  </div>
36
39
  </div>
37
40
  </div>
@@ -63,6 +66,8 @@ up.modal = (($) ->
63
66
  Sets default options for future modals.
64
67
 
65
68
  @property up.modal.config
69
+ @param {String} [config.history=true]
70
+ Whether opening a modal will add a browser history entry.
66
71
  @param {Number} [config.width]
67
72
  The width of the dialog as a CSS value like `'400px'` or `50%`.
68
73
 
@@ -82,20 +87,28 @@ up.modal = (($) ->
82
87
  A string containing the HTML structure of the modal.
83
88
  You can supply an alternative template string, but make sure that it
84
89
  defines tag with the classes `up-modal`, `up-modal-dialog` and `up-modal-content`.
85
-
90
+ yy
86
91
  You can also supply a function that returns a HTML string.
87
92
  The function will be called with the modal options (merged from these defaults
88
93
  and any per-open overrides) whenever a modal opens.
89
94
  @param {String} [config.closeLabel='X']
90
95
  The label of the button that closes the dialog.
91
96
  @param {String} [config.openAnimation='fade-in']
92
- The animation used to open the modal. The animation will be applied
93
- to both the dialog box and the overlay dimming the page.
97
+ The animation used to open the viewport around the dialog.
94
98
  @param {String} [config.closeAnimation='fade-out']
95
- The animation used to close the modal. The animation will be applied
96
- to both the dialog box and the overlay dimming the page.
97
- @param {String} [config.history=true]
98
- Whether opening a modal will add a browser history entry.
99
+ The animation used to close the viewport the dialog.
100
+ @param {String} [config.backdropOpenAnimation='fade-in']
101
+ The animation used to open the backdrop that dims the page below the dialog.
102
+ @param {String} [config.backdropCloseAnimation='fade-out']
103
+ The animation used to close the backdrop that dims the page below the dialog.
104
+ @param {String} [config.openDuration]
105
+ The duration of the open animation (in milliseconds).
106
+ @param {String} [config.closeDuration]
107
+ The duration of the close animation (in milliseconds).
108
+ @param {String} [config.openEasing]
109
+ The timing function controlling the acceleration of the opening animation.
110
+ @param {String} [config.closeEasing]
111
+ The timing function controlling the acceleration of the closing animation.
99
112
  @stable
100
113
  ###
101
114
  config = u.config
@@ -106,13 +119,23 @@ up.modal = (($) ->
106
119
  history: true
107
120
  openAnimation: 'fade-in'
108
121
  closeAnimation: 'fade-out'
122
+ closeDuration: null
123
+ closeEasing: null
124
+ openDuration: null
125
+ openEasing: null
126
+ backdropOpenAnimation: 'fade-in'
127
+ backdropCloseAnimation: 'fade-out'
109
128
  closeLabel: '×'
129
+
110
130
  template: (config) ->
111
131
  """
112
132
  <div class="up-modal">
113
- <div class="up-modal-dialog">
114
- <div class="up-modal-close" up-close>#{config.closeLabel}</div>
115
- <div class="up-modal-content"></div>
133
+ <div class="up-modal-backdrop"></div>
134
+ <div class="up-modal-viewport">
135
+ <div class="up-modal-dialog">
136
+ <div class="up-modal-close" up-close>#{config.closeLabel}</div>
137
+ <div class="up-modal-content"></div>
138
+ </div>
116
139
  </div>
117
140
  </div>
118
141
  """
@@ -139,6 +162,7 @@ up.modal = (($) ->
139
162
  $('.up-modal').attr('up-covered-url')
140
163
 
141
164
  reset = ->
165
+ # Destroy the modal container regardless whether it's currently in a closing animation
142
166
  close(animation: false)
143
167
  currentUrl = undefined
144
168
  config.reset()
@@ -156,7 +180,6 @@ up.modal = (($) ->
156
180
  $modal.removeAttr('up-covered-title')
157
181
 
158
182
  createFrame = (target, options) ->
159
- shiftElements()
160
183
  $modal = $(templateHtml())
161
184
  $modal.attr('up-sticky', '') if options.sticky
162
185
  $modal.attr('up-covered-url', up.browser.url())
@@ -171,7 +194,6 @@ up.modal = (($) ->
171
194
  u.$createPlaceholder(target, $content)
172
195
  $modal.appendTo(document.body)
173
196
  $modal
174
-
175
197
  unshifters = []
176
198
 
177
199
  # Gives `<body>` a right padding in the width of a scrollbar.
@@ -182,6 +204,9 @@ up.modal = (($) ->
182
204
  # modal overlay, which has its own scroll bar.
183
205
  # This is screwed up, but Bootstrap does the same.
184
206
  shiftElements = ->
207
+ if unshifters.length
208
+ u.error('Tried to call shiftElements multiple times %o', unshifters.length)
209
+ $('.up-modal').addClass('up-modal-ready')
185
210
  scrollbarWidth = u.scrollbarWidth()
186
211
  bodyRightPadding = parseInt($('body').css('padding-right'))
187
212
  bodyRightShift = scrollbarWidth + bodyRightPadding
@@ -199,6 +224,7 @@ up.modal = (($) ->
199
224
 
200
225
  # Reverts the effects of `shiftElements`.
201
226
  unshiftElements = ->
227
+ $('.up-modal').removeClass('up-modal-ready')
202
228
  unshifter() while unshifter = unshifters.pop()
203
229
 
204
230
  ###*
@@ -262,7 +288,7 @@ up.modal = (($) ->
262
288
 
263
289
  Example:
264
290
 
265
- up.modal.visit('/foo', { target: '.list' })
291
+ up.modal.visit('/foo', { target: '.list' });
266
292
 
267
293
  This will request `/foo`, extract the `.list` selector from the response
268
294
  and open the selected container in a modal dialog.
@@ -287,37 +313,82 @@ up.modal = (($) ->
287
313
  options.url = url
288
314
  open(options)
289
315
 
316
+ ###*
317
+ [Extracts](/up.extract) the given CSS selector from the given HTML string and
318
+ opens the results in a modal.
319
+
320
+ Example:
321
+
322
+ var html = 'before <div class="content">inner</div> after';
323
+ up.modal.extract('/foo', '.content', html);
324
+
325
+ The would open a modal with the following contents:
326
+
327
+ <div class="content">inner</div>
328
+
329
+ Emits events [`up:modal:open`](/up:modal:open) and [`up:modal:opened`](/up:modal:opened).
330
+
331
+ @function up.modal.extract
332
+ @param {String} url
333
+ The URL to load.
334
+ @param {Object} options
335
+ See options for [`up.modal.follow`](/up.modal.follow).
336
+ @return {Promise}
337
+ A promise that will be resolved when the modal has been opened and the opening
338
+ animation has completed.
339
+ @stable
340
+ ###
341
+ extract = (selector, html, options) ->
342
+ options = u.options(options)
343
+ options.html = html
344
+ options.history = u.option(options.history, false)
345
+ options.target = selector
346
+ open(options)
347
+
290
348
  ###*
291
349
  @function open
292
350
  @internal
293
351
  ###
294
352
  open = (options) ->
295
353
  options = u.options(options)
296
- $link = u.option(options.$link, u.nullJQuery())
297
- url = u.option(options.url, $link.attr('up-href'), $link.attr('href'))
298
- target = u.option(options.target, $link.attr('up-modal'), 'body')
354
+ $link = u.option(u.pluckKey(options, '$link'), u.nullJQuery())
355
+ url = u.option(u.pluckKey(options, 'url'), $link.attr('up-href'), $link.attr('href'))
356
+ html = u.pluckKey(options, 'html')
357
+ target = u.option(u.pluckKey(options, 'target'), $link.attr('up-modal'), 'body')
299
358
  options.width = u.option(options.width, $link.attr('up-width'), config.width)
300
359
  options.maxWidth = u.option(options.maxWidth, $link.attr('up-max-width'), config.maxWidth)
301
360
  options.height = u.option(options.height, $link.attr('up-height'), config.height)
302
361
  options.animation = u.option(options.animation, $link.attr('up-animation'), config.openAnimation)
362
+ options.backdropAnimation = u.option(options.backdropAnimation, $link.attr('up-backdrop-animation'), config.backdropOpenAnimation)
303
363
  options.sticky = u.option(options.sticky, u.castedAttr($link, 'up-sticky'))
364
+ options.confirm = u.option(options.confirm, $link.attr('up-confirm'))
365
+ animateOptions = up.motion.animateOptions(options, $link, { duration: config.openDuration, easing: config.openEasing })
366
+
304
367
  # Although we usually fall back to full page loads if a browser doesn't support pushState,
305
368
  # in the case of modals we assume that the developer would rather see a dialog
306
369
  # without an URL update.
307
- options.history = if up.browser.canPushState() then u.option(options.history, u.castedAttr($link, 'up-history'), config.history) else false
308
- options.confirm = u.option(options.confirm, $link.attr('up-confirm'))
309
- animateOptions = up.motion.animateOptions(options, $link)
370
+ options.history = u.option(options.history, u.castedAttr($link, 'up-history'), config.history)
371
+ options.history = false unless up.browser.canPushState()
310
372
 
311
373
  up.browser.confirm(options).then ->
312
374
  if up.bus.nobodyPrevents('up:modal:open', url: url, message: 'Opening modal')
313
375
  wasOpen = isOpen()
314
376
  close(animation: false) if wasOpen
315
377
  options.beforeSwap = -> createFrame(target, options)
316
- promise = up.replace(target, url, u.merge(options, animation: false))
317
- unless wasOpen
378
+ extractOptions = u.merge(options, animation: false)
379
+ if url
380
+ promise = up.replace(target, url, extractOptions)
381
+ else
382
+ promise = up.extract(target, html, extractOptions)
383
+ # If we're not animating the dialog, don't animate the backdrop either
384
+ unless wasOpen || up.motion.isNone(options.animation)
318
385
  promise = promise.then ->
319
- up.animate($('.up-modal'), options.animation, animateOptions)
386
+ $.when(
387
+ up.animate($('.up-modal-backdrop'), options.backdropAnimation, animateOptions),
388
+ up.animate($('.up-modal-viewport'), options.animation, animateOptions)
389
+ )
320
390
  promise = promise.then ->
391
+ shiftElements()
321
392
  up.emit('up:modal:opened', message: 'Modal opened')
322
393
  promise
323
394
  else
@@ -351,24 +422,39 @@ up.modal = (($) ->
351
422
  @function up.modal.close
352
423
  @param {Object} options
353
424
  See options for [`up.animate`](/up.animate)
354
- @return {Deferred}
425
+ @return {Promise}
355
426
  A promise that will be resolved once the modal's close
356
427
  animation has finished.
357
428
  @stable
358
429
  ###
359
430
  close = (options) ->
431
+ options = u.options(options)
360
432
  $modal = $('.up-modal')
361
433
  if $modal.length
362
434
  if up.bus.nobodyPrevents('up:modal:close', $element: $modal, message: 'Closing modal')
363
- options = u.options(options,
364
- animation: config.closeAnimation,
365
- url: $modal.attr('up-covered-url')
366
- title: $modal.attr('up-covered-title')
367
- )
368
- currentUrl = undefined
369
- promise = up.destroy($modal, options)
435
+ unshiftElements()
436
+ viewportCloseAnimation = u.option(options.animation, config.closeAnimation)
437
+ backdropCloseAnimation = u.option(options.backdropAnimation, config.backdropCloseAnimation)
438
+ animateOptions = up.motion.animateOptions(options, { duration: config.closeDuration, easing: config.closeEasing })
439
+ if up.motion.isNone(viewportCloseAnimation)
440
+ # If we're not animating the dialog, don't animate the backdrop either
441
+ promise = u.resolvedPromise()
442
+ else
443
+ promise = $.when(
444
+ up.animate($('.up-modal-viewport'), viewportCloseAnimation, animateOptions),
445
+ up.animate($('.up-modal-backdrop'), backdropCloseAnimation, animateOptions)
446
+ )
370
447
  promise = promise.then ->
371
- unshiftElements()
448
+ destroyOptions = u.options(
449
+ u.except(options, 'animation', 'duration', 'easing', 'delay'),
450
+ url: $modal.attr('up-covered-url')
451
+ title: $modal.attr('up-covered-title')
452
+ )
453
+ # currentUrl must be deleted *before* calling up.destroy,
454
+ # since up.navigation listens to up:fragment:destroyed and then
455
+ # re-assigns .up-current classes.
456
+ currentUrl = undefined
457
+ up.destroy($modal, destroyOptions)
372
458
  up.emit('up:modal:closed', message: 'Modal closed')
373
459
  promise
374
460
  else
@@ -435,7 +521,9 @@ up.modal = (($) ->
435
521
  If set to `"true"`, the modal remains
436
522
  open even if the page changes in the background.
437
523
  @param {String} [up-animation]
438
- The animation to use when opening the modal.
524
+ The animation to use when opening the viewport containing the dialog.
525
+ @param {String} [up-backdrop-animation]
526
+ The animation to use when opening the backdrop that dims the page below the dialog.
439
527
  @param {String} [up-height]
440
528
  The width of the dialog in pixels.
441
529
  By [default](/up.modal.config) the dialog will grow to fit its contents.
@@ -496,6 +584,7 @@ up.modal = (($) ->
496
584
  knife: eval(Knife?.point)
497
585
  visit: visit
498
586
  follow: follow
587
+ extract: extract
499
588
  open: -> up.error('up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.')
500
589
  close: close
501
590
  url: -> currentUrl
@@ -48,8 +48,14 @@ up.motion = (($) ->
48
48
 
49
49
  @property up.motion.config
50
50
  @param {Number} [config.duration=300]
51
+ The default duration for all animations and transitions (in milliseconds).
51
52
  @param {Number} [config.delay=0]
53
+ The default delay for all animations and transitions (in milliseconds).
52
54
  @param {String} [config.easing='ease']
55
+ The default timing function that controls the acceleration of animations and transitions.
56
+
57
+ See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
58
+ for a list of pre-defined timing functions.
53
59
  @param {Boolean} [config.enabled=true]
54
60
  Whether animation is enabled.
55
61
 
@@ -150,6 +156,7 @@ up.motion = (($) ->
150
156
  The delay before the animation starts, in milliseconds.
151
157
  @param {String} [options.easing='ease']
152
158
  The timing function that controls the animation's acceleration.
159
+
153
160
  See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
154
161
  for a list of pre-defined timing functions.
155
162
  @return {Promise}
@@ -184,27 +191,35 @@ up.motion = (($) ->
184
191
  @function up.motion.animateOptions
185
192
  @internal
186
193
  ###
187
- animateOptions = (allOptions, $element = null) ->
188
- allOptions = u.options(allOptions)
194
+ animateOptions = (userOptions, args...) ->
195
+ userOptions = u.options(userOptions)
196
+ moduleDefaults = u.extractOptions(args)
197
+ $element = if args.length > 1 then args[1] else undefined
189
198
  options = {}
190
- options.easing = u.option(allOptions.easing, $element?.attr('up-easing'), config.easing)
191
- options.duration = Number(u.option(allOptions.duration, $element?.attr('up-duration'), config.duration))
192
- options.delay = Number(u.option(allOptions.delay, $element?.attr('up-delay'), config.delay))
199
+ options.easing = u.option(userOptions.easing, $element?.attr('up-easing'), moduleDefaults.easing, config.easing)
200
+ options.duration = Number(u.option(userOptions.duration, $element?.attr('up-duration'), moduleDefaults.duration, config.duration))
201
+ options.delay = Number(u.option(userOptions.delay, $element?.attr('up-delay'), moduleDefaults.delay, config.delay))
193
202
  options
194
203
 
195
204
  findAnimation = (name) ->
196
205
  animations[name] or u.error("Unknown animation %o", name)
197
-
206
+
198
207
  GHOSTING_DEFERRED_KEY = 'up-ghosting-deferred'
208
+ GHOSTING_CLASS = 'up-ghosting'
199
209
 
200
210
  withGhosts = ($old, $new, options, block) ->
201
211
 
212
+ # Don't create ghosts of ghosts in case a transition function is itself calling `morph`
213
+ if options.copy == false || $old.is('.up-ghost') || $new.is('.up-ghost')
214
+ return block($old, $new)
215
+
202
216
  oldCopy = undefined
203
217
  newCopy = undefined
204
218
  oldScrollTop = undefined
205
219
  newScrollTop = undefined
206
220
 
207
221
  $viewport = up.layout.viewportOf($old)
222
+ $both = $old.add($new)
208
223
 
209
224
  u.temporaryCss $new, display: 'none', ->
210
225
  # Within this block, $new is hidden but $old is visible
@@ -241,12 +256,12 @@ up.motion = (($) ->
241
256
  # already in progress. If someone attempted a new animation on the
242
257
  # same elements, the stored promises would be resolved by the second
243
258
  # animation call, making the transition jump to the last frame instantly.
244
- $old.data(GHOSTING_DEFERRED_KEY, deferred)
245
- $new.data(GHOSTING_DEFERRED_KEY, deferred)
246
-
259
+ $both.data(GHOSTING_DEFERRED_KEY, deferred)
260
+ $both.addClass(GHOSTING_CLASS)
261
+
247
262
  deferred.then ->
248
- $old.removeData(GHOSTING_DEFERRED_KEY)
249
- $new.removeData(GHOSTING_DEFERRED_KEY)
263
+ $both.removeData(GHOSTING_DEFERRED_KEY)
264
+ $both.removeClass(GHOSTING_CLASS)
250
265
  # Now that the transition is over we show $new again.
251
266
  showNew()
252
267
  oldCopy.$bounds.remove()
@@ -255,21 +270,26 @@ up.motion = (($) ->
255
270
  deferred
256
271
 
257
272
  ###*
258
- Completes all [animations](/up.animate) and [transitions](/up.morph)
259
- for the given element by jumping to the last animation frame instantly.
273
+ Completes [animations](/up.animate) and [transitions](/up.morph).
260
274
 
261
- All callbacks chained to the original animation's promise will be called.
275
+ If called without arguments, all animations on the screen are completed.
276
+ If given an element (or selector), animations on that element and its children
277
+ are completed.
262
278
 
263
- Does nothing if the given element is not currently animating.
279
+ Animations are completed by jumping to the last animation frame instantly.
280
+
281
+ Does nothing if there are no animation to complete.
264
282
 
265
283
  @function up.motion.finish
266
- @param {Element|jQuery|String} elementOrSelector
284
+ @param {Element|jQuery|String} [elementOrSelector]
267
285
  @stable
268
286
  ###
269
- finish = (elementOrSelector) ->
287
+ finish = (elementOrSelector = '.up-animating') ->
270
288
  $element = $(elementOrSelector)
271
- u.finishCssAnimate($element)
272
- finishGhosting($element)
289
+ $animatingSubtree = u.findWithSelf($element, '.up-animating')
290
+ u.finishCssAnimate($animatingSubtree)
291
+ $ghostingSubtree = u.findWithSelf($element, ".#{GHOSTING_CLASS}")
292
+ finishGhosting($ghostingSubtree)
273
293
 
274
294
  finishGhosting = ($collection) ->
275
295
  $collection.each ->
@@ -338,6 +358,7 @@ up.motion = (($) ->
338
358
  The delay before the animation starts, in milliseconds.
339
359
  @param {String} [options.easing='ease']
340
360
  The timing function that controls the transition's acceleration.
361
+
341
362
  See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
342
363
  for a list of pre-defined timing functions.
343
364
  @param {Boolean} [options.reveal=false]
@@ -350,6 +371,8 @@ up.motion = (($) ->
350
371
  if transitionOrName == 'none'
351
372
  transitionOrName = false
352
373
 
374
+ options = u.options(options)
375
+
353
376
  $old = $(source)
354
377
  $new = $(target)
355
378
 
@@ -392,7 +415,6 @@ up.motion = (($) ->
392
415
  element = $element.get(0)
393
416
  u.error("Can't morph a <%s> element (%o)", element.tagName, element)
394
417
 
395
-
396
418
  ###*
397
419
  This causes the side effects of a successful transition, but instantly.
398
420
  We use this to skip morphing for old browsers, or when the developer
@@ -561,6 +583,16 @@ up.motion = (($) ->
561
583
  ###
562
584
  none = u.resolvedDeferred
563
585
 
586
+ ###*
587
+ Returns whether the given animation option will cause the animation
588
+ to be skipped.
589
+
590
+ @function up.motion.isNone
591
+ @internal
592
+ ###
593
+ isNone = (animation) ->
594
+ animation is false || animation is 'none' || animation is none
595
+
564
596
  animation('none', none)
565
597
 
566
598
  animation('fade-in', ($ghost, options) ->
@@ -573,60 +605,63 @@ up.motion = (($) ->
573
605
  animate($ghost, { opacity: 0 }, options)
574
606
  )
575
607
 
608
+ translateCss = (x, y) ->
609
+ { transform: "translate(#{x}px, #{y}px)" }
610
+
576
611
  animation('move-to-top', ($ghost, options) ->
577
612
  box = u.measure($ghost)
578
613
  travelDistance = box.top + box.height
579
- $ghost.css('margin-top': '0px')
580
- animate($ghost, { 'margin-top': "-#{travelDistance}px" }, options)
614
+ $ghost.css(translateCss(0, 0))
615
+ animate($ghost, translateCss(0, -travelDistance), options)
581
616
  )
582
617
 
583
618
  animation('move-from-top', ($ghost, options) ->
584
619
  box = u.measure($ghost)
585
620
  travelDistance = box.top + box.height
586
- $ghost.css('margin-top': "-#{travelDistance}px")
587
- animate($ghost, { 'margin-top': '0px' }, options)
621
+ $ghost.css(translateCss(0, -travelDistance))
622
+ animate($ghost, translateCss(0, 0), options)
588
623
  )
589
624
 
590
625
  animation('move-to-bottom', ($ghost, options) ->
591
626
  box = u.measure($ghost)
592
627
  travelDistance = u.clientSize().height - box.top
593
- $ghost.css('margin-top': '0px')
594
- animate($ghost, { 'margin-top': "#{travelDistance}px" }, options)
628
+ $ghost.css(translateCss(0, 0))
629
+ animate($ghost, translateCss(0, travelDistance), options)
595
630
  )
596
631
 
597
632
  animation('move-from-bottom', ($ghost, options) ->
598
633
  box = u.measure($ghost)
599
634
  travelDistance = u.clientSize().height - box.top
600
- $ghost.css('margin-top': "#{travelDistance}px")
601
- animate($ghost, { 'margin-top': '0px' }, options)
635
+ $ghost.css(translateCss(0, travelDistance))
636
+ animate($ghost, translateCss(0, 0), options)
602
637
  )
603
638
 
604
639
  animation('move-to-left', ($ghost, options) ->
605
640
  box = u.measure($ghost)
606
641
  travelDistance = box.left + box.width
607
- $ghost.css('margin-left': '0px')
608
- animate($ghost, { 'margin-left': "-#{travelDistance}px" }, options)
642
+ $ghost.css(translateCss(0, 0))
643
+ animate($ghost, translateCss(-travelDistance, 0), options)
609
644
  )
610
645
 
611
646
  animation('move-from-left', ($ghost, options) ->
612
647
  box = u.measure($ghost)
613
648
  travelDistance = box.left + box.width
614
- $ghost.css('margin-left': "-#{travelDistance}px")
615
- animate($ghost, { 'margin-left': '0px' }, options)
649
+ $ghost.css(translateCss(-travelDistance, 0))
650
+ animate($ghost, translateCss(0, 0), options)
616
651
  )
617
652
 
618
653
  animation('move-to-right', ($ghost, options) ->
619
654
  box = u.measure($ghost)
620
655
  travelDistance = u.clientSize().width - box.left
621
- $ghost.css('margin-left': '0px')
622
- animate($ghost, { 'margin-left': "#{travelDistance}px" }, options)
656
+ $ghost.css(translateCss(0, 0))
657
+ animate($ghost, translateCss(travelDistance, 0), options)
623
658
  )
624
659
 
625
660
  animation('move-from-right', ($ghost, options) ->
626
661
  box = u.measure($ghost)
627
662
  travelDistance = u.clientSize().width - box.left
628
- $ghost.css('margin-left': "#{travelDistance}px")
629
- animate($ghost, { 'margin-left': '0px' }, options)
663
+ $ghost.css(translateCss(travelDistance, 0))
664
+ animate($ghost, translateCss(0, 0), options)
630
665
  )
631
666
 
632
667
  animation('roll-down', ($ghost, options) ->
@@ -635,7 +670,9 @@ up.motion = (($) ->
635
670
  height: '0px'
636
671
  overflow: 'hidden'
637
672
  )
638
- animate($ghost, { height: "#{fullHeight}px" }, options).then(styleMemo)
673
+ deferred = animate($ghost, { height: "#{fullHeight}px" }, options)
674
+ deferred.then(styleMemo)
675
+ deferred
639
676
  )
640
677
 
641
678
  transition('none', none)
@@ -690,6 +727,7 @@ up.motion = (($) ->
690
727
  none: none
691
728
  when: resolvableWhen
692
729
  prependCopy: prependCopy
730
+ isNone: isNone
693
731
 
694
732
  )(jQuery)
695
733