-
Notifications
You must be signed in to change notification settings - Fork 27
/
celery-cart.min.js
2 lines (2 loc) · 44.8 KB
/
celery-cart.min.js
1
2
var requirejs,require,define;!function(e){function t(e,t){return v.call(e,t)}function n(e,t){var n,r,i,a,o,s,l,c,u,d,p,f=t&&t.split("/"),h=m.map,y=h&&h["*"]||{};if(e&&"."===e.charAt(0))if(t){for(f=f.slice(0,f.length-1),e=e.split("/"),o=e.length-1,m.nodeIdCompat&&C.test(e[o])&&(e[o]=e[o].replace(C,"")),e=f.concat(e),u=0;u<e.length;u+=1)if(p=e[u],"."===p)e.splice(u,1),u-=1;else if(".."===p){if(1===u&&(".."===e[2]||".."===e[0]))break;u>0&&(e.splice(u-1,2),u-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((f||y)&&h){for(n=e.split("/"),u=n.length;u>0;u-=1){if(r=n.slice(0,u).join("/"),f)for(d=f.length;d>0;d-=1)if(i=h[f.slice(0,d).join("/")],i&&(i=i[r])){a=i,s=u;break}if(a)break;!l&&y&&y[r]&&(l=y[r],c=u)}!a&&l&&(a=l,s=c),a&&(n.splice(0,s,a),e=n.join("/"))}return e}function r(t,n){return function(){return u.apply(e,g.call(arguments,0).concat([t,n]))}}function i(e){return function(t){return n(t,e)}}function a(e){return function(t){f[e]=t}}function o(n){if(t(h,n)){var r=h[n];delete h[n],y[n]=!0,c.apply(e,r)}if(!t(f,n)&&!t(y,n))throw new Error("No "+n);return f[n]}function s(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function l(e){return function(){return m&&m.config&&m.config[e]||{}}}var c,u,d,p,f={},h={},m={},y={},v=Object.prototype.hasOwnProperty,g=[].slice,C=/\.js$/;d=function(e,t){var r,a=s(e),l=a[0];return e=a[1],l&&(l=n(l,t),r=o(l)),l?e=r&&r.normalize?r.normalize(e,i(t)):n(e,t):(e=n(e,t),a=s(e),l=a[0],e=a[1],l&&(r=o(l))),{f:l?l+"!"+e:e,n:e,pr:l,p:r}},p={require:function(e){return r(e)},exports:function(e){var t=f[e];return"undefined"!=typeof t?t:f[e]={}},module:function(e){return{id:e,uri:"",exports:f[e],config:l(e)}}},c=function(n,i,s,l){var c,u,m,v,g,C,x=[],b=typeof s;if(l=l||n,"undefined"===b||"function"===b){for(i=!i.length&&s.length?["require","exports","module"]:i,g=0;g<i.length;g+=1)if(v=d(i[g],l),u=v.f,"require"===u)x[g]=p.require(n);else if("exports"===u)x[g]=p.exports(n),C=!0;else if("module"===u)c=x[g]=p.module(n);else if(t(f,u)||t(h,u)||t(y,u))x[g]=o(u);else{if(!v.p)throw new Error(n+" missing "+u);v.p.load(v.n,r(l,!0),a(u),{}),x[g]=f[u]}m=s?s.apply(f[n],x):void 0,n&&(c&&c.exports!==e&&c.exports!==f[n]?f[n]=c.exports:m===e&&C||(f[n]=m))}else n&&(f[n]=s)},requirejs=require=u=function(t,n,r,i,a){if("string"==typeof t)return p[t]?p[t](n):o(d(t,n).f);if(!t.splice){if(m=t,m.deps&&u(m.deps,m.callback),!n)return;n.splice?(t=n,n=r,r=null):t=e}return n=n||function(){},"function"==typeof r&&(r=i,i=a),i?c(e,t,n,r):setTimeout(function(){c(e,t,n,r)},4),u},u.config=function(e){return u(e)},requirejs._defined=f,define=function(e,n,r){n.splice||(r=n,n=[]),t(f,e)||t(h,e)||(h[e]=[e,n,r])},define.amd={jQuery:!0}}(),define("vendor/almond/almond.js",function(){}),require.config({baseUrl:"js",paths:{"celery-js":"vendor/celery-js/src/index","jquery.payment":"vendor/jquery.payment/lib/jquery.payment",text:"vendor/requirejs-text/text",tmpl:"vendor/microtemplates/index"},map:{"*":{jquery:"jquery-loader"}},shim:{"jquery.payment":{deps:["jquery"]}}}),define("require-config",function(){}),define("jquery-loader",[],function(){var e=window.jQuery||window.$;return e?e:console.error("jQuery must be loaded before CeleryCart")}),function(e){var t={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},n=/(.)^/,r={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},i=/\\|'|\r|\n|\t|\u2028|\u2029/g,a={"&":"&","<":"<",">":">",'"':""","'":"'"},o=new RegExp("[&<>\"']","g"),s=function(e){return null==e?"":(""+e).replace(o,function(e){return a[e]})},l=0,c=function(e,a){var o,c=new RegExp([(t.escape||n).source,(t.interpolate||n).source,(t.evaluate||n).source].join("|")+"|$","g"),u=0,d="__p+='";e.replace(c,function(t,n,a,o,s){return d+=e.slice(u,s).replace(i,function(e){return"\\"+r[e]}),n&&(d+="'+\n((__t=("+n+"))==null?'':escapeExpr(__t))+\n'"),a&&(d+="'+\n((__t=("+a+"))==null?'':__t)+\n'"),o&&(d+="';\n"+o+"\n__p+='"),u=s+t.length,t}),d+="';\n",t.variable||(d="with(obj||{}){\n"+d+"}\n"),d="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+d+"return __p;\n//# sourceURL=/microtemplates/source["+l++ +"]";try{o=new Function(t.variable||"obj","escapeExpr",d)}catch(p){throw p.source=d,p}if(a)return o(a,s);var f=function(e){return o.call(this,e,s)};return f.source="function("+(t.variable||"obj")+"){\n"+d+"}",f};c.settings=t,"undefined"!=typeof define&&define.amd?define("tmpl",[],function(){return c}):"undefined"!=typeof module&&module.exports?module.exports=c:e.microtemplate=c}(this),define("text",["module"],function(e){var t,n,r,i,a,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],s=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,l=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,c="undefined"!=typeof location&&location.href,u=c&&location.protocol&&location.protocol.replace(/\:/,""),d=c&&location.hostname,p=c&&(location.port||void 0),f={},h=e.config&&e.config()||{};return t={version:"2.0.12",strip:function(e){if(e){e=e.replace(s,"");var t=e.match(l);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:h.createXhr||function(){var e,t,n;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(t=0;3>t;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,a=e.indexOf("."),o=0===e.indexOf("./")||0===e.indexOf("../");return-1!==a&&(!o||a>1)?(t=e.substring(0,a),n=e.substring(a+1,e.length)):t=e,r=n||t,a=r.indexOf("!"),-1!==a&&(i="strip"===r.substring(a+1),r=r.substring(0,a),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var a,o,s,l=t.xdRegExp.exec(e);return l?(a=l[2],o=l[3],o=o.split(":"),s=o[1],o=o[0],!(a&&a!==n||o&&o.toLowerCase()!==r.toLowerCase()||(s||o)&&s!==i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,h.isBuild&&(f[e]=r),i(r)},load:function(e,n,r,i){if(i&&i.isBuild&&!i.inlineText)return void r();h.isBuild=i&&i.isBuild;var a=t.parseName(e),o=a.moduleName+(a.ext?"."+a.ext:""),s=n.toUrl(o),l=h.useXhr||t.useXhr;return 0===s.indexOf("empty:")?void r():void(!c||l(s,u,d,p)?t.get(s,function(n){t.finishLoad(e,a.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(a.moduleName+"."+a.ext,a.strip,e,r)}))},write:function(e,n,r){if(f.hasOwnProperty(n)){var i=t.jsEscape(f[n]);r.asModule(e+"!"+n,"define(function () { return '"+i+"';});\n")}},writeFile:function(e,n,r,i,a){var o=t.parseName(n),s=o.ext?"."+o.ext:"",l=o.moduleName+s,c=r.toUrl(o.moduleName+s)+".js";t.load(l,r,function(){var n=function(e){return i(c,e)};n.asModule=function(e,t){return i.asModule(e,c,t)},t.write(e,l,n,a)},a)}},"node"===h.env||!h.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]?(n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");0===i.indexOf("")&&(i=i.substring(1)),t(i)}catch(a){r&&r(a)}}):"xhr"===h.env||!h.env&&t.createXhr()?t.get=function(e,n,r,i){var a,o=t.createXhr();if(o.open("GET",e,!0),i)for(a in i)i.hasOwnProperty(a)&&o.setRequestHeader(a.toLowerCase(),i[a]);h.onXhr&&h.onXhr(o,e),o.onreadystatechange=function(){var t,i;4===o.readyState&&(t=o.status||0,t>399&&600>t?(i=new Error(e+" HTTP status: "+t),i.xhr=o,r&&r(i)):n(o.responseText),h.onXhrComplete&&h.onXhrComplete(o,e))},o.send(null)}:"rhino"===h.env||!h.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?t.get=function(e,t){var n,r,i="utf-8",a=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),s=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(a),i)),l="";try{for(n=new java.lang.StringBuffer,r=s.readLine(),r&&r.length()&&65279===r.charAt(0)&&(r=r.substring(1)),null!==r&&n.append(r);null!==(r=s.readLine());)n.append(o),n.append(r);l=String(n.toString())}finally{s.close()}t(l)}:("xpconnect"===h.env||!h.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),a="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,s,l={};a&&(e=e.replace(/\//g,"\\")),s=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(s,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),l),o.close(),n.close(),t(l.value)}catch(c){throw new Error((s&&s.path||"")+": "+c)}}),t}),define("text!../templates/confirmation.tmpl",[],function(){return'<div class="Celery-OrderConfirmation">\n <span class="Celery-Icon Celery-Icon--check Celery-Icon--hero">\n </span>\n\n <div class="Celery-OrderConfirmation-header">\n <h1 class="Celery-OrderConfirmation-heading">\n Thank you<br /> for your support!\n </h1>\n </div>\n\n <div class="Celery-OrderConfirmation-body">\n Your pre-order number is #<%= number %>. A confirmation email is on the way to your inbox.\n </div>\n\n <div class="Celery-OrderConfirmation-footer">\n <div class="Celery-OrderConfirmation-header">\n <h2 class="Celery-OrderConfirmation-heading Celery-OrderConfirmation-heading--footer">\n Share with your friends!\n </h2>\n </div>\n\n <a class="Celery-ReferralLink"></a>\n\n <div class="Celery-SocialButtons">\n <ul class="Celery-SocialButtons-buttons">\n <li class="Celery-SocialButtons-button Celery-SocialButtons-button--twitter">\n <a class="Celery-Icon Celery-Icon--twitter"\n href="<%= twitterHref %>"\n target="_blank">\n <span class="u-hiddenVisually">Twitter</span>\n </a>\n </li>\n <li class="Celery-SocialButtons-button Celery-SocialButtons-button--facebook">\n <a class="Celery-Icon Celery-Icon--facebook"\n href="<%= facebookHref %>"\n target="_blank">\n <span class="u-hiddenVisually">Facebook</span>\n </a>\n </li>\n <li class="Celery-SocialButtons-button Celery-SocialButtons-button--email">\n <a class="Celery-Icon Celery-Icon--email"\n href="<%= mailHref %>">\n <span class="u-hiddenVisually">Email</span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n</div>\n'}),define("text!templates/form.html",[],function(){return'<form class="Celery-Form" novalidate>\n <div class="Celery-Form-body">\n\n <div class="Celery-FormSection Celery-FormSection--inline">\n <div class="Celery-FormSection-header">\n <h2 class="Celery-FormSection-heading">\n Quantity\n </h2>\n </div>\n\n <div class="Celery-FormSection-body">\n <div class="Celery-Form-group">\n <div class="Celery-Select">\n <!-- Edit these options to set your quantity choices -->\n <select class="Celery-Select-select" name="quantity">\n <option value="1">1</option>\n <option value="2">2</option>\n <option value="3">3</option>\n <option value="4">4</option>\n <option value="5">5</option>\n </select>\n </div>\n </div>\n </div>\n </div>\n\n <div class="Celery-FormSection Celery-FormSection--inline">\n <div class="Celery-FormSection-header">\n <h2 class="Celery-FormSection-heading">\n Shipping\n </h2>\n </div>\n\n <div class="Celery-FormSection-body">\n <div class="Celery-Form-group">\n <div class="Celery-Select">\n <!-- Edit these options for the countries you wish to ship to -->\n <!-- "zz" is Unknown/TBD -->\n <select class="Celery-Select-select" name="country">\n <option value="us">United States</option>\n <option value="zz">International</option>\n </select>\n </div>\n </div>\n </div>\n </div>\n\n <div class="Celery-FormSection">\n <div class="Celery-FormSection-header">\n <h2 class="Celery-FormSection-heading">\n Contact Information\n </h2>\n </div>\n\n <div class="Celery-FormSection-body">\n <div class="Celery-Form-group">\n <input class="Celery-TextInput Celery-TextInput--email"\n type="email"\n placeholder="Email"\n name="email"\n data-celery-validate="email"\n required />\n <span class="Celery-Icon Celery-Icon--innerInput Celery-Icon--email">\n </span>\n </div>\n </div>\n </div>\n\n <div class="Celery-FormSection">\n <div class="Celery-FormSection-header">\n <h2 class="Celery-FormSection-heading">\n Payment\n </h2>\n </div>\n\n <div class="Celery-FormSection-body">\n <div class="Celery-Form-group">\n <input class="Celery-TextInput Celery-TextInput--cardNumber"\n type="text"\n name="card_number"\n pattern="\\d*"\n placeholder="Credit Card Number"\n data-celery-validate="cardNumber" />\n <span class="Celery-Icon Celery-Icon--innerInput Celery-Icon--card">\n </span>\n </div>\n <div class="Celery-Form-group Celery-Form-group--inline Celery-Form-group--expiry">\n <input class="Celery-TextInput Celery-TextInput--expiry"\n type="text"\n name="expiry"\n pattern="\\d*"\n placeholder="MM / YY"\n data-celery-validate="expiry"\n maxlength="7"/>\n <span class="Celery-Icon Celery-Icon--innerInput Celery-Icon--date">\n </span>\n </div>\n <div class="Celery-Form-group Celery-Form-group--inline Celery-Form-group--cvc">\n <input class="Celery-TextInput Celery-TextInput--cvc"\n type="text"\n name="cvc"\n pattern="\\d*"\n placeholder="CVC"\n autocomplete="off"\n data-celery-validate="cvc"\n maxlength="4" />\n <span class="Celery-Icon Celery-Icon--innerInput Celery-Icon--cvc">\n </span>\n </div>\n </div>\n </div>\n\n <div class="Celery-FormSection Celery-FormSection--errors u-hidden">\n <div class="Celery-FormSection-body">\n\n </div>\n </div>\n </div>\n\n <div class="Celery-Form-footer">\n <div class="Celery-OrderSummary">\n <div class="Celery-OrderSummary-line">\n <span class="Celery-OrderSummary-price Celery-OrderSummary-price--price">\n 0\n </span>\n <span class="Celery-OrderSummary-label">Pre-Order</span>\n </div>\n\n <span class="Celery-OrderSummary-operator">×</span>\n\n <div class="Celery-OrderSummary-line">\n <span class="Celery-OrderSummary-number Celery-OrderSummary-number--quantity">\n 1\n </span>\n <span class="Celery-OrderSummary-label">Qty</span>\n </div>\n\n <span class="Celery-OrderSummary-operator">+</span>\n\n <div class="Celery-OrderSummary-line">\n <span class="Celery-OrderSummary-price Celery-OrderSummary-price--shipping">\n 0\n </span>\n <span class="Celery-OrderSummary-label">Ship</span>\n </div>\n\n <span class="Celery-OrderSummary-operator">=</span>\n\n <div class="Celery-OrderSummary-line">\n <span class="Celery-OrderSummary-price Celery-OrderSummary-price--total">\n 0\n </span>\n <span class="Celery-OrderSummary-label">Total</span>\n </div>\n </div>\n\n <a class="Celery-Button Celery-Button--buy" href="#" tabindex="0">\n Pre-Order Now\n </a>\n\n <div class="Celery-Note Celery-Note--subtle u-textCenter">\n This page is secured with 128-bit encryption\n </div>\n </div>\n\n <button class="Celery-HiddenSubmit" type="submit"></button>\n</form>\n'}),define("text!templates/overlay.html",[],function(){return'<div class="Celery-Overlay is-hidden"></div>\n'}),define("text!templates/modal.html",[],function(){return'<div class="Celery-ModalContainer is-hidden">\n <a class="Celery-ModalCloseButton">\n ×\n </a>\n <div class="Celery-Modal">\n <div class="Celery-Modal-header">\n <h1 class="Celery-Modal-heading">\n Pre-Order for 50% Off!\n </h1>\n\n <h2 class="Celery-Modal-subheading">\n Your card will be charged immediately\n </h2>\n </div>\n\n <div class="Celery-Modal-body">\n </div>\n\n <div class="Celery-Modal-footer">\n <p>\n We plan to start shipping summer 2014.<br />\n We will send you an email to collect your address later.\n </p>\n </div>\n </div>\n</div>\n'}),define("text!templates/svg/card.svg",[],function(){return'<svg width="19" height="14" viewBox="0 0 19 14" xmlns="http://www.w3.org/2000/svg"><desc>Created with Sketch.</desc><path d="M1.99742191,0 C0.894276248,0 0,0.897060126 0,2.00585866 L0,11.9941413 C0,13.1019465 0.890925393,14 1.99742191,14 L17.0025781,14 C18.1057238,14 19,13.1029399 19,11.9941413 L19,2.00585866 C19,0.898053512 18.1090746,0 17.0025781,0 L1.99742191,0 Z M13,9 L13,11 L17,11 L17,9 L13,9 Z M0,4 L0,6 L19,6 L19,4 L0,4 Z" transform="translate(0 0)" fill="none" fill-rule="evenodd"/></svg>'}),define("text!templates/svg/check.svg",[],function(){return'<svg width="56" height="52" viewBox="0 0 56 52" xmlns="http://www.w3.org/2000/svg"><desc>Created with Sketch.</desc><path d="M55.999,5 C55.999,2.238 53.761,0 50.999,0 C49.54,0 48.261,0.655 47.349,1.654 L47.314,1.621 L18.321,33.25 L8.535,23.465 L8.524,23.476 C7.621,22.57 6.38,22 5,22 C2.238,22 1.13686838e-13,24.238 1.13686838e-13,27 C1.13686838e-13,28.067 0.34,29.052 0.91,29.863 L0.903,29.867 L14.903,49.867 L14.91,49.863 C15.814,51.152 17.306,52 19,52 C20.622,52 22.049,51.216 22.962,50.019 L22.978,50.031 L54.978,8.031 L54.962,8.019 C55.603,7.178 55.999,6.14 55.999,5 L55.999,5 Z" transform="translate(0 0)" fill="#fff" fill-rule="evenodd"/></svg>'}),define("text!templates/svg/cvc.svg",[],function(){return'<svg width="19" height="14" viewBox="0 0 19 14" xmlns="http://www.w3.org/2000/svg"><desc>Created with Sketch.</desc><g transform="translate(0 0)" fill="none" fill-rule="evenodd"><rect fill="#ddd" width="19" height="14" rx="2"/><text font-family="Tahoma" font-size="8" fill="#fff"><tspan x="3" y="10">123</tspan></text></g></svg>'}),define("text!templates/svg/date.svg",[],function(){return'<svg width="16" height="15" viewBox="0 0 16 15" xmlns="http://www.w3.org/2000/svg"><desc>Created with Sketch.</desc><g transform="translate(0 0)" fill="none" fill-rule="evenodd"><rect fill="#ddd" y="1" width="16" height="14" rx="2"/><rect fill="#ddd" x="2" width="2" height="3" rx="3"/><rect fill="#ddd" x="12" width="2" height="3" rx="3"/><rect fill="#ddd" x="7" width="2" height="3" rx="3"/><path fill="#fff" d="M1 2H15V4H1z"/><text font-family="Tahoma" font-size="8" letter-spacing="1.2" fill="#fff"><tspan x="3" y="12">22</tspan></text><text font-family="Tahoma" font-size="8" letter-spacing="1.2" fill="#fff"><tspan x="3" y="12">22</tspan></text></g></svg>'}),define("text!templates/svg/email.svg",[],function(){return'<svg width="20" height="13" viewBox="0 0 20 13" xmlns="http://www.w3.org/2000/svg"><desc>Created with Sketch.</desc><path d="M21.5060714,21.814 L30.2228571,13 L11.7653571,13 L20.4825,21.814 C20.7653571,22.0996389 21.2235714,22.0996389 21.5060714,21.814 L21.5060714,21.814 Z M11.1114286,13.338 C11.0417857,13.4495833 11,13.5806667 11,13.7225833 L11,25.2781389 C11,25.4196944 11.0417857,25.5511389 11.1114286,25.6623611 L17.2025,19.49675 L11.1114286,13.338 L11.1114286,13.338 Z M30.8846429,13.3304167 L24.7864286,19.4963889 L30.8846429,25.6692222 C30.9571429,25.5565556 31,25.4222222 31,25.2777778 L31,13.7222222 C31,13.5777778 30.9571429,13.4438056 30.8846429,13.3304167 L30.8846429,13.3304167 Z M21.9903571,22.3231667 C21.4403571,22.8792778 20.5485714,22.8792778 19.9982143,22.3231667 L17.6967857,19.9961667 L11.7653571,26 L30.2235714,26 L24.2925,19.9961667 L21.9903571,22.3231667 L21.9903571,22.3231667 Z" transform="translate(-11 -13)" fill="none" fill-rule="evenodd"/></svg>'}),define("text!templates/svg/facebook.svg",[],function(){return'<svg width="10" height="19" viewBox="0 0 10 19" xmlns="http://www.w3.org/2000/svg"><desc>Created with Sketch.</desc><path d="M17.1635294,20.499875 L17.1635294,29 L21.2605882,29 L21.2605882,20.54025 L24.0570588,20.54025 L24.7335294,17.0139688 L21.2894118,17.0139688 L21.2894118,14.427 C21.2894118,14.0689687 21.4788235,13.5915937 22.0517647,13.5915937 L24.0429412,13.5915937 L24.0429412,10 L20.3252941,10 C19.0429412,10 17.1494118,11.5942187 17.1494118,13.289375 L17.1494118,16.913625 L15,16.913625 L15,20.4850312 L17.1635294,20.499875" transform="translate(-15 -10)" fill="#4E71B0" fill-rule="evenodd"/></svg>'}),define("text!templates/svg/twitter.svg",[],function(){return'<svg width="19" height="17" viewBox="0 0 19 17" xmlns="http://www.w3.org/2000/svg"><desc>Created with Sketch.</desc><path d="M30,13.9386296 C29.3011563,14.2672963 28.5500625,14.4895556 27.7615625,14.589037 C28.5660938,14.0777778 29.1841875,13.2674444 29.475125,12.3028519 C28.72225,12.7763333 27.8874375,13.1201111 26.9997812,13.3052222 C26.2890625,12.5024444 25.276125,12 24.1545313,12 C22.0015937,12 20.2565625,13.8511111 20.2565625,16.1335185 C20.2565625,16.4577778 20.2904063,16.7732222 20.3575,17.0760741 C17.1174063,16.9029259 14.2454375,15.2577037 12.322875,12.7568148 C11.9874062,13.3675556 11.7950312,14.0777778 11.7950312,14.8352222 C11.7950312,16.2688889 12.4831875,17.5344444 13.5287812,18.2755185 C12.8899062,18.2541111 12.2890313,18.0683704 11.7635625,17.7585926 C11.7629688,17.7755926 11.7629688,17.7932222 11.7629688,17.8102222 C11.7629688,19.8130741 13.106625,21.4841111 14.89025,21.8637778 C14.5630938,21.9582222 14.2187188,22.0085926 13.8630625,22.0085926 C13.6119063,22.0085926 13.367875,21.9827778 13.1297813,21.9349259 C13.6255625,23.5763704 15.0654063,24.772037 16.77125,24.8054074 C15.4370937,25.9135556 13.7561875,26.5746667 11.9298125,26.5746667 C11.615125,26.5746667 11.3051875,26.5551481 11,26.5167407 C12.7248437,27.6897407 14.773875,28.3741481 16.9755,28.3741481 C24.145625,28.3741481 28.0661563,22.0753333 28.0661563,16.6126667 C28.0661563,16.4338519 28.0625938,16.2556667 28.054875,16.0781111 C28.8166563,15.4950741 29.4775,14.7672222 30,13.9386296" transform="translate(-11 -12)" fill="#3BB2E4" fill-rule="evenodd"/></svg>'}),define("templates",["require","tmpl","text!../templates/confirmation.tmpl","text!templates/form.html","text!templates/overlay.html","text!templates/modal.html","text!templates/svg/card.svg","text!templates/svg/check.svg","text!templates/svg/cvc.svg","text!templates/svg/date.svg","text!templates/svg/email.svg","text!templates/svg/facebook.svg","text!templates/svg/twitter.svg"],function(e){var t=e("tmpl");return{confirmation:t(e("text!../templates/confirmation.tmpl")),form:e("text!templates/form.html"),overlay:e("text!templates/overlay.html"),modal:e("text!templates/modal.html"),svg:{card:e("text!templates/svg/card.svg"),check:e("text!templates/svg/check.svg"),cvc:e("text!templates/svg/cvc.svg"),date:e("text!templates/svg/date.svg"),email:e("text!templates/svg/email.svg"),facebook:e("text!templates/svg/facebook.svg"),twitter:e("text!templates/svg/twitter.svg")}}}),function(e,t){function n(e){return!!(""===e||e&&e.charCodeAt&&e.substr)}function r(e){return d?d(e):"[object Array]"===p.call(e)}function i(e){return"[object Object]"===p.call(e)}function a(e,t){var n;e=e||{},t=t||{};for(n in t)t.hasOwnProperty(n)&&null==e[n]&&(e[n]=t[n]);return e}function o(e,t,n){var r,i,a=[];if(!e)return a;if(u&&e.map===u)return e.map(t,n);for(r=0,i=e.length;i>r;r++)a[r]=t.call(n,e[r],r,e);return a}function s(e,t){return e=Math.round(Math.abs(e)),isNaN(e)?t:e}function l(e){var t=c.settings.currency.format;return"function"==typeof e&&(e=e()),n(e)&&e.match("%v")?{pos:e,neg:e.replace("-","").replace("%v","-%v"),zero:e}:e&&e.pos&&e.pos.match("%v")?e:n(t)?c.settings.currency.format={pos:t,neg:t.replace("%v","-%v"),zero:t}:t}var c={};c.version="0.3.2",c.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var u=Array.prototype.map,d=Array.isArray,p=Object.prototype.toString,f=c.unformat=c.parse=function(e,t){if(r(e))return o(e,function(e){return f(e,t)});if(e=e||0,"number"==typeof e)return e;t=t||".";var n=new RegExp("[^0-9-"+t+"]",["g"]),i=parseFloat((""+e).replace(/\((.*)\)/,"-$1").replace(n,"").replace(t,"."));return isNaN(i)?0:i},h=c.toFixed=function(e,t){t=s(t,c.settings.number.precision);var n=Math.pow(10,t);return(Math.round(c.unformat(e)*n)/n).toFixed(t)},m=c.formatNumber=function(e,t,n,l){if(r(e))return o(e,function(e){return m(e,t,n,l)});e=f(e);var u=a(i(t)?t:{precision:t,thousand:n,decimal:l},c.settings.number),d=s(u.precision),p=0>e?"-":"",y=parseInt(h(Math.abs(e||0),d),10)+"",v=y.length>3?y.length%3:0;return p+(v?y.substr(0,v)+u.thousand:"")+y.substr(v).replace(/(\d{3})(?=\d)/g,"$1"+u.thousand)+(d?u.decimal+h(Math.abs(e),d).split(".")[1]:"")},y=c.formatMoney=function(e,t,n,u,d,p){if(r(e))return o(e,function(e){return y(e,t,n,u,d,p)});e=f(e);var h=a(i(t)?t:{symbol:t,precision:n,thousand:u,decimal:d,format:p},c.settings.currency),v=l(h.format),g=e>0?v.pos:0>e?v.neg:v.zero;return g.replace("%s",h.symbol).replace("%v",m(Math.abs(e),s(h.precision),h.thousand,h.decimal))};c.formatColumn=function(e,t,u,d,p,h){if(!e)return[];var y=a(i(t)?t:{symbol:t,precision:u,thousand:d,decimal:p,format:h},c.settings.currency),v=l(y.format),g=v.pos.indexOf("%s")<v.pos.indexOf("%v")?!0:!1,C=0,x=o(e,function(e){if(r(e))return c.formatColumn(e,y);e=f(e);var t=e>0?v.pos:0>e?v.neg:v.zero,n=t.replace("%s",y.symbol).replace("%v",m(Math.abs(e),s(y.precision),y.thousand,y.decimal));return n.length>C&&(C=n.length),n});return o(x,function(e){return n(e)&&e.length<C?g?e.replace(y.symbol,y.symbol+new Array(C-e.length+1).join(" ")):new Array(C-e.length+1).join(" ")+e:e})},"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=c),exports.accounting=c):"function"==typeof define&&define.amd?define("vendor/accounting.js/accounting",[],function(){return c}):(c.noConflict=function(n){return function(){return e.accounting=n,c.noConflict=t,c}}(e.accounting),e.accounting=c)}(this),define("format",["require","vendor/accounting.js/accounting"],function(e){var t=e("vendor/accounting.js/accounting");return{formatMoney:function(e){var n={precision:2},r=e/100;return r%1===0&&(n.precision=0),t.formatMoney(r,n)}}}),function(e){var t=function(e,t){if(e=e||{},this.request=t||jQuery&&jQuery.ajax,!this.request)return console.error("Celery requires jQuery or another AJAX library");this._setUserId=$.proxy(this._setUserId,this);var n=this.config={};n.apiHost=e.apiHost||"https://api.trycelery.com",n.apiVersion=e.apiVersion||"v2",n.apiUrl=n.apiHost+"/"+n.apiVersion,n.slug=e.slug||"",n.userId=e.userId||""};t.prototype.fetchShop=function(e,t){if(e=e||this.config.slug,!e)return console.error("Must pass a product/collection ID to #fetchShop");var n=$.proxy(function(e,n){return(n||n.data)&&this._setUserId(n.data.user_id),t.apply(this,arguments)},this);return this.request({type:"GET",url:this.config.apiUrl+"/shop/"+e}).done(this._generateSuccessCb(n)).fail(this._generateErrorCb(t))},t.prototype.fetchTaxes=function(){console.warn("Implement fetchTaxes")},t.prototype.fetchShippingWeights=function(){console.warn("Implement fetchShippingWeights")},t.prototype.fetchShippingRates=function(){console.warn("Implement fetchShippingRates")},t.prototype.fetchCoupon=function(){console.warn("Implement fetchCoupon")},t.prototype.serializeOrder=function(e,t){return this._callOrder("serialize",e,t)},t.prototype.createOrder=function(e,t){return this._callOrder("checkout",e,t)},t.prototype._setUserId=function(e){return this.config.userId=e,this},t.prototype._callOrder=function(e,t,n){return n=n||function(){},this.request({type:"POST",url:this.config.apiUrl+"/orders/"+e,data:JSON.stringify(t),contentType:"application/json; charset=utf-8",dataType:"json",context:this}).done(this._generateSuccessCb(n)).fail(this._generateErrorCb(n))},t.prototype._createError=function(e){var t="";return e&&e.responseText&&(t=e.responseText),e&&e.responseJSON&&(t=e.responseJSON.meta.error.message),new Error(t)},t.prototype._generateSuccessCb=function(e){return function(t){"function"==typeof e&&e(null,t)}},t.prototype._generateErrorCb=function(e){var t=this;return function(n){if("function"==typeof e){var r=t._createError(n);e(r)}}},"function"==typeof define&&define.amd?define("celery-js",["jquery"],function(){return t}):"object"==typeof exports?exports=t:e.Celery=t}(this),define("config",["require"],function(){return{}}),define("celery_client",["require","celery-js","config"],function(e){var t=e("celery-js"),n=e("config");return new t(n)}),define("shop",["require","celery_client"],function(e){var t=e("celery_client");return{fetch:function(e){var n=this;return t.fetchShop(null,function(t,r){r&&r.data&&(n.data=$.extend(n.data,r.data)),"function"==typeof e&&e(t,r)})},data:{}}}),function(e){define("jquery.payment",["jquery"],function(){return function(){(function(){var e,t,n,r,i,a,o,s,l,c,u,d,p,f,h,m,y,v,g,C,x=[].slice,b=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};e=jQuery,e.payment={},e.payment.fn={},e.fn.payment=function(){var t,n;return n=arguments[0],t=2<=arguments.length?x.call(arguments,1):[],e.payment.fn[n].apply(this,t)},i=/(\d{1,4})/g,r=[{type:"visaelectron",pattern:/^4(026|17500|405|508|844|91[37])/,format:i,length:[16],cvcLength:[3],luhn:!0},{type:"maestro",pattern:/^(5(018|0[23]|[68])|6(39|7))/,format:i,length:[12,13,14,15,16,17,18,19],cvcLength:[3],luhn:!0},{type:"forbrugsforeningen",pattern:/^600/,format:i,length:[16],cvcLength:[3],luhn:!0},{type:"dankort",pattern:/^5019/,format:i,length:[16],cvcLength:[3],luhn:!0},{type:"visa",pattern:/^4/,format:i,length:[13,16],cvcLength:[3],luhn:!0},{type:"mastercard",pattern:/^5[0-5]/,format:i,length:[16],cvcLength:[3],luhn:!0},{type:"amex",pattern:/^3[47]/,format:/(\d{1,4})(\d{1,6})?(\d{1,5})?/,length:[15],cvcLength:[3,4],luhn:!0},{type:"dinersclub",pattern:/^3[0689]/,format:i,length:[14],cvcLength:[3],luhn:!0},{type:"discover",pattern:/^6([045]|22)/,format:i,length:[16],cvcLength:[3],luhn:!0},{type:"unionpay",pattern:/^(62|88)/,format:i,length:[16,17,18,19],cvcLength:[3],luhn:!1},{type:"jcb",pattern:/^35/,format:i,length:[16],cvcLength:[3],luhn:!0}],t=function(e){var t,n,i;for(e=(e+"").replace(/\D/g,""),n=0,i=r.length;i>n;n++)if(t=r[n],t.pattern.test(e))return t},n=function(e){var t,n,i;for(n=0,i=r.length;i>n;n++)if(t=r[n],t.type===e)return t},p=function(e){var t,n,r,i,a,o;for(r=!0,i=0,n=(e+"").split("").reverse(),a=0,o=n.length;o>a;a++)t=n[a],t=parseInt(t,10),(r=!r)&&(t*=2),t>9&&(t-=9),i+=t;return i%10===0},d=function(e){var t;return null!=e.prop("selectionStart")&&e.prop("selectionStart")!==e.prop("selectionEnd")?!0:("undefined"!=typeof document&&null!==document&&null!=(t=document.selection)&&"function"==typeof t.createRange?t.createRange().text:void 0)?!0:!1},f=function(t){return setTimeout(function(){var n,r;return n=e(t.currentTarget),r=n.val(),r=e.payment.formatCardNumber(r),n.val(r)})},s=function(n){var r,i,a,o,s,l,c;return a=String.fromCharCode(n.which),!/^\d+$/.test(a)||(r=e(n.currentTarget),c=r.val(),i=t(c+a),o=(c.replace(/\D/g,"")+a).length,l=16,i&&(l=i.length[i.length.length-1]),o>=l||null!=r.prop("selectionStart")&&r.prop("selectionStart")!==c.length)?void 0:(s=i&&"amex"===i.type?/^(\d{4}|\d{4}\s\d{6})$/:/(?:^|\s)(\d{4})$/,s.test(c)?(n.preventDefault(),setTimeout(function(){return r.val(c+" "+a)
})):s.test(c+a)?(n.preventDefault(),setTimeout(function(){return r.val(c+a+" ")})):void 0)},a=function(t){var n,r;return n=e(t.currentTarget),r=n.val(),8!==t.which||null!=n.prop("selectionStart")&&n.prop("selectionStart")!==r.length?void 0:/\d\s$/.test(r)?(t.preventDefault(),setTimeout(function(){return n.val(r.replace(/\d\s$/,""))})):/\s\d?$/.test(r)?(t.preventDefault(),setTimeout(function(){return n.val(r.replace(/\s\d?$/,""))})):void 0},h=function(t){return setTimeout(function(){var n,r;return n=e(t.currentTarget),r=n.val(),r=e.payment.formatExpiry(r),n.val(r)})},l=function(t){var n,r,i;return r=String.fromCharCode(t.which),/^\d+$/.test(r)?(n=e(t.currentTarget),i=n.val()+r,/^\d$/.test(i)&&"0"!==i&&"1"!==i?(t.preventDefault(),setTimeout(function(){return n.val("0"+i+" / ")})):/^\d\d$/.test(i)?(t.preventDefault(),setTimeout(function(){return n.val(""+i+" / ")})):void 0):void 0},c=function(t){var n,r,i;return r=String.fromCharCode(t.which),/^\d+$/.test(r)?(n=e(t.currentTarget),i=n.val(),/^\d\d$/.test(i)?n.val(""+i+" / "):void 0):void 0},u=function(t){var n,r,i;return r=String.fromCharCode(t.which),"/"===r||" "===r?(n=e(t.currentTarget),i=n.val(),/^\d$/.test(i)&&"0"!==i?n.val("0"+i+" / "):void 0):void 0},o=function(t){var n,r;return n=e(t.currentTarget),r=n.val(),8!==t.which||null!=n.prop("selectionStart")&&n.prop("selectionStart")!==r.length?void 0:/\s\/\s\d?$/.test(r)?(t.preventDefault(),setTimeout(function(){return n.val(r.replace(/\s\/\s\d?$/,""))})):void 0},g=function(e){var t;return e.metaKey||e.ctrlKey?!0:32===e.which?!1:0===e.which?!0:e.which<33?!0:(t=String.fromCharCode(e.which),!!/[\d\s]/.test(t))},y=function(n){var r,i,a,o;return r=e(n.currentTarget),a=String.fromCharCode(n.which),/^\d+$/.test(a)&&!d(r)?(o=(r.val()+a).replace(/\D/g,""),i=t(o),i?o.length<=i.length[i.length.length-1]:o.length<=16):void 0},v=function(t){var n,r,i;return n=e(t.currentTarget),r=String.fromCharCode(t.which),/^\d+$/.test(r)&&!d(n)?(i=n.val()+r,i=i.replace(/\D/g,""),i.length>6?!1:void 0):void 0},m=function(t){var n,r,i;return n=e(t.currentTarget),r=String.fromCharCode(t.which),/^\d+$/.test(r)&&!d(n)?(i=n.val()+r,i.length<=4):void 0},C=function(t){var n,i,a,o,s;return n=e(t.currentTarget),s=n.val(),o=e.payment.cardType(s)||"unknown",n.hasClass(o)?void 0:(i=function(){var e,t,n;for(n=[],e=0,t=r.length;t>e;e++)a=r[e],n.push(a.type);return n}(),n.removeClass("unknown"),n.removeClass(i.join(" ")),n.addClass(o),n.toggleClass("identified","unknown"!==o),n.trigger("payment.cardType",o))},e.payment.fn.formatCardCVC=function(){return this.payment("restrictNumeric"),this.on("keypress",m),this},e.payment.fn.formatCardExpiry=function(){return this.payment("restrictNumeric"),this.on("keypress",v),this.on("keypress",l),this.on("keypress",u),this.on("keypress",c),this.on("keydown",o),this.on("change",h),this.on("input",h),this},e.payment.fn.formatCardNumber=function(){return this.payment("restrictNumeric"),this.on("keypress",y),this.on("keypress",s),this.on("keydown",a),this.on("keyup",C),this.on("paste",f),this.on("change",f),this.on("input",f),this.on("input",C),this},e.payment.fn.restrictNumeric=function(){return this.on("keypress",g),this},e.payment.fn.cardExpiryVal=function(){return e.payment.cardExpiryVal(e(this).val())},e.payment.cardExpiryVal=function(e){var t,n,r,i;return e=e.replace(/\s/g,""),i=e.split("/",2),t=i[0],r=i[1],2===(null!=r?r.length:void 0)&&/^\d+$/.test(r)&&(n=(new Date).getFullYear(),n=n.toString().slice(0,2),r=n+r),t=parseInt(t,10),r=parseInt(r,10),{month:t,year:r}},e.payment.validateCardNumber=function(e){var n,r;return e=(e+"").replace(/\s+|-/g,""),/^\d+$/.test(e)?(n=t(e),n?(r=e.length,b.call(n.length,r)>=0&&(n.luhn===!1||p(e))):!1):!1},e.payment.validateCardExpiry=function(t,n){var r,i,a;return"object"==typeof t&&"month"in t&&(a=t,t=a.month,n=a.year),t&&n?(t=e.trim(t),n=e.trim(n),/^\d+$/.test(t)&&/^\d+$/.test(n)&&t>=1&&12>=t?(2===n.length&&(n=70>n?"20"+n:"19"+n),4!==n.length?!1:(i=new Date(n,t),r=new Date,i.setMonth(i.getMonth()-1),i.setMonth(i.getMonth()+1,1),i>r)):!1):!1},e.payment.validateCardCVC=function(t,r){var i,a;return t=e.trim(t),/^\d+$/.test(t)?r?(i=t.length,b.call(null!=(a=n(r))?a.cvcLength:void 0,i)>=0):t.length>=3&&t.length<=4:!1},e.payment.cardType=function(e){var n;return e?(null!=(n=t(e))?n.type:void 0)||null:null},e.payment.formatCardNumber=function(n){var r,i,a,o;return(r=t(n))?(a=r.length[r.length.length-1],n=n.replace(/\D/g,""),n=n.slice(0,a),r.format.global?null!=(o=n.match(r.format))?o.join(" "):void 0:(i=r.format.exec(n),null!=i?(i.shift(),i=e.grep(i,function(e){return e}),i.join(" ")):void 0)):n},e.payment.formatExpiry=function(e){var t,n,r,i;return(n=e.match(/^\D*(\d{1,2})(\D+)?(\d{1,4})?/))?(t=n[1]||"",r=n[2]||"",i=n[3]||"",(i.length>0||r.length>0&&!/\ \/?\ ?/.test(r))&&(r=" / "),1===t.length&&"0"!==t&&"1"!==t&&(t="0"+t,r=" / "),t+r+i):""}}).call(this)}.apply(e,arguments)})}(this),define("validation",["require","jquery.payment","jquery"],function(e){function t(e){return e||(e={}),function(t){return"string"==typeof t&&(t=t.trim()),e.strictCharacters&&!i.test(t)?!1:a.test(t)}}function n(e){return e&&"string"==typeof e?!0:!1}e("jquery.payment");var r=e("jquery"),i=/^[\x20-\x7F]*$/,a=/^(([^<>()\[\]\\.,;:\s@\"]+(\.[^<>()\[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return{required:n,email:t(),cvc:r.payment.validateCardCVC,expiry:function(e){var t=e.split("/");return r.payment.validateCardExpiry.apply(this,t)},cardNumber:r.payment.validateCardNumber}}),define("form",["require","templates","jquery","validation","jquery.payment"],function(e){var t=e("templates").form,n=e("jquery"),r=e("validation");return e("jquery.payment"),{initialize:function(){return this.initFormatting(),this.$buyButton=this.$el.find(".Celery-Button--buy"),this.submit=n.proxy(this.submit,this),this.validate=n.proxy(this.validate,this),this.validateField=n.proxy(this.validateField,this),this.liveValidate=n.proxy(this.liveValidate,this),this.$buyButton.on("click",n.proxy(function(){this.$el.submit()},this)),this.$el.on("submit",this.submit),this.$el.on("input","input",this.liveValidate),this.$el.on("blur","input",this.validateField),this},$el:n(t),initFormatting:function(){this.$cardEl=this.$el.find(".Celery-TextInput--cardNumber").payment("formatCardNumber"),this.$expiryEl=this.$el.find(".Celery-TextInput--expiry").payment("formatCardExpiry"),this.$cvcEl=this.$el.find(".Celery-TextInput--cvc").payment("formatCardCVC")},validate:function(){var e=!0;return this.$el.find("[data-celery-validate]").each(n.proxy(function(t,n){var r=this.validateField(n);return r?void 0:(e=!1,!0)},this)),e},validateField:function(e){var t;e&&e.currentTarget?(t=n(e.currentTarget),e=e.currentTarget):t=n(e);var i=t.data("celery-validate"),a=r[i](t.val());return this._setValidationClass(e,a),t.data("celery-livevalidate",""),a},liveValidate:function(e){var t=n(e.currentTarget);void 0!==t.data("celery-livevalidate")&&this.validateField(t)},_setValidationClass:function(e,t){var r=n(e);r.toggleClass("is-invalid",!t),r.toggleClass("is-valid",t)},enableBuyButton:function(){this.$buyButton.removeClass("is-disabled").text(this.buyButtonText)},disableBuyButton:function(){this.buyButtonText=this.$buyButton.text(),this.$buyButton.addClass("is-disabled").text("Processing...")},submit:function(e){e&&e.preventDefault&&e.preventDefault();var t="is-disabled";if(!this.$buyButton.hasClass(t)){this.disableBuyButton();var n=this.validate();return n?void this.$el.trigger("valid"):void this.enableBuyButton()}}}}),define("confirmation",["require","templates","shop"],function(e){var t=e("templates"),n=e("shop").data;return{initialize:function(e){return e=e||{number:1},this.data=e||this.data||{},this.render(),this},$el:null,template:t.confirmation,render:function(e){e=e||this.data||{},e.twitterHref=this.generateTwitterHref(),e.facebookHref=this.generateFacebookHref(),e.mailHref=this.generateMailHref();this.$el=$(this.template(e));return this._appendIcons(),this},generateFacebookHref:function(){var e=this._getWebsite(),t=this._getSlug(),n=$.param({u:e||"https://shop.trycelery.com/page/"+t});return"https://www.facebook.com/sharer/sharer.php?"+n},generateTwitterHref:function(){var e=n.twitter,t=this._getProductName(),r=this._getWebsite(),i=this._getSlug(),a=[];t&&a.push("Check out "+t),e&&a.push("from "+e),a.push("on @trycelery");var o=$.param({url:r||"https://shop.trycelery.com/page/"+i,text:a.join(" ")});return"http://twitter.com/share?"+o},generateMailHref:function(){var e=this._getProductName();return"mailto:?subject=Check out "+e},_appendIcons:function(){var e=this.$el,n=$(t.svg.check),r=$(t.svg.twitter),i=$(t.svg.facebook),a=$(t.svg.email);e.find(".Celery-Icon--check").append(n),e.find(".Celery-Icon--twitter").append(r),e.find(".Celery-Icon--facebook").append(i),e.find(".Celery-Icon--email").append(a)},_getSlug:function(){return this._getProduct()._id},_getProduct:function(){return n.product||{}},_getProductName:function(){return this._getProduct().name},_getWebsite:function(){return n.website}}}),define("app",["require","jquery","templates","format","shop","celery_client","form","confirmation"],function(e){var t=e("jquery"),n=e("templates"),r=e("format").formatMoney,i=e("shop"),a=e("celery_client"),o=e("form").initialize(),s=e("confirmation").initialize();return{initialize:function(e){if(this.initialized)return this;e&&e.slug&&(a.config.slug=e.slug);{var r=this.$overlay=t(n.overlay),i=this.$el=t(n.modal),l=this.$form=o.$el;this.$confirmation=s.$el}return this.children=[r,i],t.each(["show","hide","updateOrderSummary","createOrder","handleOrder","handleError","showShop","showConfirmation"],t.proxy(function(e,n){this[n]=t.proxy(this[n],this)},this)),l.find(".Celery-Icon--card").append(t(n.svg.card)),l.find(".Celery-Icon--cvc").append(t(n.svg.cvc)),l.find(".Celery-Icon--date").append(t(n.svg.date)),l.find(".Celery-Icon--email").append(t(n.svg.email)),this.$modalBody=i.find(".Celery-Modal-body"),t(document.body).on("click","[data-celery]",this.show),this.$el.on("click",".Celery-ModalCloseButton",this.hide),l.on("valid",this.createOrder),l.on("change","select",this.updateOrderSummary),l.find("select").change(),this.preloadShop(),this.showShop(),this.initialized=!0,this},preloadShop:function(){var e=t("[data-celery]").first(),n=e&&t(e).data("celery")||"";n&&(a.config.slug=n),this.fetchShop()},fetchShop:function(){i.fetch(this.updateOrderSummary)},show:function(){var e=this;return t(document.body).append(this.children),this.showShop(),this.$overlay.removeClass("u-hidden"),this.$el.removeClass("u-hidden"),setTimeout(function(){e.$overlay.removeClass("is-hidden"),e.$el.removeClass("is-hidden")},0),this},hide:function(){var e=this;return this.clear(),this.$overlay.addClass("is-hidden"),this.$el.addClass("is-hidden"),setTimeout(function(){e.$overlay.addClass("u-hidden"),e.$el.addClass("u-hidden"),e.showShop()},300),this},clear:function(){this.$form.find("input").val(""),this.$form.find(".is-invalid, .is-valid").removeClass("is-invalid is-valid")},updateOrderSummary:function(){var e=i.data;if(e){var t=this._getQuantity(),n=r(this._getPrice()),a=r(this._getShipping()),o=r(this._getTotal()),s=this.$form;s.find(".Celery-OrderSummary-price--price").text(n),s.find(".Celery-OrderSummary-price--shipping").text(a),s.find(".Celery-OrderSummary-price--total").text(o),s.find(".Celery-OrderSummary-number--quantity").text(t)}},createOrder:function(){var e=this._generateOrder();a.createOrder(e,this.handleOrder)},handleOrder:function(e,t){return e?this.handleError(e):(this.showConfirmation(t.data),void this.onConfirmation(t.data))},onConfirmation:function(){},handleError:function(e){var t=this.$form.find(".Celery-FormSection--errors");t.find(".Celery-FormSection-body").text(e.message),t.removeClass("u-hidden"),o.enableBuyButton()},hideErrors:function(){var e=this.$form.find(".Celery-FormSection--errors");e.addClass("u-hidden")},hideHeader:function(){this.$el.find(".Celery-Modal-header").addClass("is-hidden")},showHeader:function(){this.$el.find(".Celery-Modal-header").removeClass("is-hidden")},showShop:function(){this.showHeader(),this.hideErrors(),this.$confirmation.detach(),this.$modalBody.append(this.$form)},showConfirmation:function(e){s.render(e),this.hideHeader(),this.$form.detach(),this.$modalBody.append(s.$el)},_generateOrder:function(){var e=this.$form,t={buyer:{},shipping_address:{},line_items:[],payment_source:{card:{number:"",exp_month:"",exp_year:"",cvc:""}}};t.user_id=i.data.user_id,t.buyer.email=e.find("[name=email]").val();var n=t.payment_source.card;n.number=e.find("[name=card_number]").val(),n.cvc=e.find("[name=cvc]").val();var r=e.find("[name=expiry]").val().split("/");n.exp_month=r[0].trim(),n.exp_year=r[1].trim(),t.shipping_address.country=e.find("[name=country]").val();var a={product_id:i.data.product._id,quantity:this._getQuantity()};return t.line_items.push(a),t},_getQuantity:function(){return this.$form.find("[name=quantity]").val()},_getCountry:function(){return this.$form.find("[name=country]").val()},_getPrice:function(){return i.data.product&&i.data.product.price},_getShipping:function(){var e=this._getQuantity(),t=this._getShippingRates();if(!t)return 0;var n=t.base||0,r=t.item||0;return n||r?n+(e-1)*r:0},_getShippingRates:function(){var e=i.data.shipping_rates,n=e;if(!e||!e.countries||!e.countries.length)return n;var r=this._getCountry();return t.each(e.countries,function(e,t){return t.code===r?void(n=t):void 0}),n},_getTotal:function(){var e=this._getQuantity(),t=this._getPrice(),n=this._getShipping();return e*t+n}}}),require(["require-config"],function(){require(["app"],function(e){return window.CeleryCart=e.initialize()})}),define("main",function(){});