1(function(){function sightglass2(obj,keypath,callback,options){return new Observer(obj,keypath,callback,options)}sightglass2.adapters={};function Observer(obj,keypath,callback,options){this.options=options||{},this.options.adapters=this.options.adapters||{},this.obj=obj,this.keypath=keypath,this.callback=callback,this.objectPath=[],this.parse(),isObject(this.target=this.realize())&&this.set(!0,this.key,this.target,this.callback)}Observer.tokenize=function(keypath,interfaces,root){var tokens=[],current={i:root,path:""},index,chr;for(index=0;index<keypath.length;index++)chr=keypath.charAt(index),~interfaces.indexOf(chr)?(tokens.push(current),current={i:chr,path:""}):current.path+=chr;return tokens.push(current),tokens},Observer.prototype.parse=function(){var interfaces=this.interfaces(),root,path;interfaces.length||error("Must define at least one adapter interface."),~interfaces.indexOf(this.keypath[0])?(root=this.keypath[0],path=this.keypath.substr(1)):(typeof(root=this.options.root||sightglass2.root)=="undefined"&&error("Must define a default root adapter."),path=this.keypath),this.tokens=Observer.tokenize(path,interfaces,root),this.key=this.tokens.pop()},Observer.prototype.realize=function(){var current=this.obj,unreached=!1,prev;return this.tokens.forEach(function(token,index){isObject(current)?(typeof this.objectPath[index]!="undefined"?current!==(prev=this.objectPath[index])&&(this.set(!1,token,prev,this.update.bind(this)),this.set(!0,token,current,this.update.bind(this)),this.objectPath[index]=current):(this.set(!0,token,current,this.update.bind(this)),this.objectPath[index]=current),current=this.get(token,current)):(unreached===!1&&(unreached=index),(prev=this.objectPath[index])&&this.set(!1,token,prev,this.update.bind(this)))},this),unreached!==!1&&this.objectPath.splice(unreached),current},Observer.prototype.update=function(){var next,oldValue;(next=this.realize())!==this.target&&(isObject(this.target)&&this.set(!1,this.key,this.target,this.callback),isObject(next)&&this.set(!0,this.key,next,this.callback),oldValue=this.value(),this.target=next,this.value()!==oldValue&&this.callback())},Observer.prototype.value=function(){if(isObject(this.target))return this.get(this.key,this.target)},Observer.prototype.setValue=function(value){isObject(this.target)&&this.adapter(this.key).set(this.target,this.key.path,value)},Observer.prototype.get=function(key,obj){return this.adapter(key).get(obj,key.path)},Observer.prototype.set=function(active,key,obj,callback){var action=active?"observe":"unobserve";this.adapter(key)[action](obj,key.path,callback)},Observer.prototype.interfaces=function(){var interfaces=Object.keys(this.options.adapters);return Object.keys(sightglass2.adapters).forEach(function(i){~interfaces.indexOf(i)||interfaces.push(i)}),interfaces},Observer.prototype.adapter=function(key){return this.options.adapters[key.i]||sightglass2.adapters[key.i]},Observer.prototype.unobserve=function(){var obj;this.tokens.forEach(function(token,index){(obj=this.objectPath[index])&&this.set(!1,token,obj,this.update.bind(this))},this),isObject(this.target)&&this.set(!1,this.key,this.target,this.callback)};function isObject(obj){return typeof obj=="object"&&obj!==null}function error(message){throw new Error("[sightglass] "+message)}typeof module!="undefined"&&module.exports?module.exports=sightglass2:typeof define=="function"&&define.amd?define([],function(){return this.sightglass=sightglass2}):this.sightglass=sightglass2}).call(this),(function(){var Rivets,bindMethod,unbindMethod,_ref,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__slice=[].slice,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);function ctor(){this.constructor=child}return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++)if(i in this&&this[i]===item)return i;return-1};Rivets={options:["prefix","templateDelimiters","rootInterface","preloadData","handler"],extensions:["binders","formatters","components","adapters"],public:{binders:{},components:{},formatters:{},adapters:{},prefix:"rv",templateDelimiters:["{","}"],rootInterface:".",preloadData:!0,handler:function(context,ev,binding){return this.call(context,ev,binding.view.models)},configure:function(options){var descriptor,key,option,value;options==null&&(options={});for(option in options)if(value=options[option],option==="binders"||option==="components"||option==="formatters"||option==="adapters")for(key in value)descriptor=value[key],Rivets[option][key]=descriptor;else Rivets.public[option]=value},bind:function(el,models,options){var view;return models==null&&(models={}),options==null&&(options={}),view=new Rivets.View(el,models,options),view.bind(),view},init:function(component,el,data){var scope,view;return data==null&&(data={}),el==null&&(el=document.createElement("div")),component=Rivets.public.components[component],el.innerHTML=component.template.call(this,el),scope=component.initialize.call(this,el,data),view=new Rivets.View(el,scope),view.bind(),view}}},window.jQuery||window.$?(_ref="on"in jQuery.prototype?["on","off"]:["bind","unbind"],bindMethod=_ref[0],unbindMethod=_ref[1],Rivets.Util={bindEvent:function(el,event,handler){return jQuery(el)[bindMethod](event,handler)},unbindEvent:function(el,event,handler){return jQuery(el)[unbindMethod](event,handler)},getInputValue:function(el){var $el;return $el=jQuery(el),$el.attr("type")==="checkbox"?$el.is(":checked"):$el.val()}}):Rivets.Util={bindEvent:(function(){return"addEventListener"in window?function(el,event,handler){return el.addEventListener(event,handler,!1)}:function(el,event,handler){return el.attachEvent("on"+event,handler)}})(),unbindEvent:(function(){return"removeEventListener"in window?function(el,event,handler){return el.removeEventListener(event,handler,!1)}:function(el,event,handler){return el.detachEvent("on"+event,handler)}})(),getInputValue:function(el){var o,_i,_len,_results;if(el.type==="checkbox")return el.checked;if(el.type==="select-multiple"){for(_results=[],_i=0,_len=el.length;_i<_len;_i++)o=el[_i],o.selected&&_results.push(o.value);return _results}else return el.value}},Rivets.TypeParser=(function(){function TypeParser(){}return TypeParser.types={primitive:0,keypath:1},TypeParser.parse=function(string){return/^'.*'$|^".*"$/.test(string)?{type:this.t
1ypes.primitive,value:string.slice(1,-1)}:string==="true"?{type:this.types.primitive,value:!0}:string==="false"?{type:this.types.primitive,value:!1}:string==="null"?{type:this.types.primitive,value:null}:string==="undefined"?{type:this.types.primitive,value:void 0}:isNaN(Number(string))===!1?{type:this.types.primitive,value:Number(string)}:{type:this.types.keypath,value:string}},TypeParser})(),Rivets.TextTemplateParser=(function(){function TextTemplateParser(){}return TextTemplateParser.types={text:0,binding:1},TextTemplateParser.parse=function(template,delimiters){var index,lastIndex,lastToken,length,substring,tokens,value;for(tokens=[],length=template.length,index=0,lastIndex=0;lastIndex<length;)if(index=template.indexOf(delimiters[0],lastIndex),index<0){tokens.push({type:this.types.text,value:template.slice(lastIndex)});break}else{if(index>0&&lastIndex<index&&tokens.push({type:this.types.text,value:template.slice(lastIndex,index)}),lastIndex=index+delimiters[0].length,index=template.indexOf(delimiters[1],lastIndex),index<0){substring=template.slice(lastIndex-delimiters[1].length),lastToken=tokens[tokens.length-1],(lastToken!=null?lastToken.type:void 0)===this.types.text?lastToken.value+=substring:tokens.push({type:this.types.text,value:substring});break}value=template.slice(lastIndex,index).trim(),tokens.push({type:this.types.binding,value:value}),lastIndex=index+delimiters[1].length}return tokens}
1,TextTemplateParser})(),Rivets.View=(function(){function View(els,models,options){var k,option,v,_base,_i,_j,_len,_len1,_ref1,_ref2,_ref3,_ref4,_ref5;for(this.els=els,this.models=models,options==null&&(options={}),this.update=__bind(this.update,this),this.publish=__bind(this.publish,this),this.sync=__bind(this.sync,this),this.unbind=__bind(this.unbind,this),this.bind=__bind(this.bind,this),this.select=__bind(this.select,this),this.traverse=__bind(this.traverse,this),this.build=__bind(this.build,this),this.buildBinding=__bind(this.buildBinding,this),this.bindingRegExp=__bind(this.bindingRegExp,this),this.options=__bind(this.options,this),this.els.jquery||this.els instanceof Array||(this.els=[this.els]),_ref1=Rivets.extensions,_i=0,_len=_ref1.length;_i<_len;_i++){if(option=_ref1[_i],this[option]={},options[option]){_ref2=options[option];for(k in _ref2)v=_ref2[k],this[option][k]=v}_ref3=Rivets.public[option];for(k in _ref3)v=_ref3[k],(_base=this[option])[k]==null&&(_base[k]=v)}for(_ref4=Rivets.options,_j=0,_len1=_ref4.length;_j<_len1;_j++)option=_ref4[_j],this[option]=(_ref5=options[option])!=null?_ref5:Rivets.public[option];this.build()}return View.prototype.options=function(){var option,options,_i,_len,_ref1;for(options={},_ref1=Rivets.extensions.concat(Rivets.options),_i=0,_len=_ref1.length;_i<_len;_i++)option=_ref1[_i],options[option]=this[option];return options},View.prototype.bindingRegExp=function(){return new RegExp("^"+this.prefix+"-")},View.prototype.buildBinding=function(binding,node,type,declaration){var context,ctx,dependencies,keypath,options,pipe,pipes;return options={},pipes=(function(){var _i,_len,_ref1,_results;for(_ref1=declaration.split("|"),_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)pipe=_ref1[_i],_results.push(pipe.trim());return _results})(),context=(function(){var _i,_len,_ref1,_results;for(_ref1=pipes.shift().split("<"),_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)ctx=_ref1[_i],_results.push(ctx.trim());return _results})(),keypath=context.shift(),options.formatters=pipes,(dependencies=context.shift())&&(options.dependencies=dependencies.split(/\s+/)),this.bindings.push(new Rivets[binding](this,node,type,keypath,options))},View.prototype.build=function(){var el,parse,_i,_len,_ref1;for(this.bindings=[],parse=(function(_this){return function(node){var block,childNode,delimiters,n,parser,text,token,tokens,_i2,_j,_len2,_len1,_ref12,_results;if(node.nodeType===3){if(parser=Rivets.TextTemplateParser,(delimiters=_this.templateDelimiters)&&(tokens=parser.parse(node.data,delimiters)).length&&!(tokens.length===1&&tokens[0].type===parser.types.text)){for(_i2=0,_len2=tokens.length;_i2<_len2;_i2++)token=tokens[_i2],text=document.createTextNode(token.value),node.parentNode.insertBefore(text,node),token.type===1&&_this.buildBinding("TextBinding",text,null,token.value);node.parentNode.removeChild(node)}}else node.nodeType===1&&(block=_this.traverse(node));if(!block){for(_ref12=(function(){var _k,_len12,_ref13,_results1;for(_ref13=node.childNodes,_results1=[],_k=0,_len12=_ref13.length;_k<_len12;_k++)n=_ref13[_k],_results1.push(n);return _results1})(),_results=[],_j=0,_len1=_ref12.length;_j<_len1;_j++)childNode=_ref12[_j],_results.push(parse(childNode));return _results}}})(this),_ref1=this.els,_i=0,_len=_ref1.length;_i<_len;_i++)el=_ref1[_i],parse(el);this.bindings.sort(function(a,b){var _ref2,_ref3;return(((_ref2=b.binder)!=null?_ref2.priority:void 0)||0)-(((_ref3=a.binder)!=null?_ref3.priority:void 0)||0)})},View.prototype.traverse=function(node){var attribute,attributes,binder,bindingRegExp,block,identifier,regexp,type,value,_i,_j,_len,_len1,_ref1,_ref2,_ref3;for(bindingRegExp=this.bindingRegExp(),block=node.nodeName==="SCRIPT"||node.nodeName==="STYLE",_ref1=node.attributes,_i=0,_len=_ref1.length;_i<_len;_i++)if(attribute=_ref1[_i],bindingRegExp.test(attribute.name)){if(type=attribute.name.replace(bindingRegExp,""),!(binder=this.binders[type])){_ref2=this.binders;for(identifier in _ref2)value=_ref2[identifier],identifier!=="*"&&identifier.indexOf("*")!==-1&&(regexp=new RegExp("^"+identifier.replace(/\*/g,".+")+"$"),regexp.test(type)&&(binder=value))}binder||(binder=this.binders["*"]),binder.block&&(block=!0,attributes=[attribute])}for(_ref3=attributes||node.attributes,_j=0,_len1=_ref3.length;_j<_len1;_j++)attribute=_ref3[_j],bindingRegExp.test(attribute.name)&&(type=attribute.name.replace(bindingRegExp,""),this.buildBinding("Binding",node,type,attribute.value));return block||(type=node.nodeName.toLowerCase(),this.components[type]&&!node._bound&&(this.bindings.push(new Rivets.ComponentBinding(this,node,type)),block=!0)),block},View.prototype.select=function(fn){var binding,_i,_len,_ref1,_results;for(_ref1=this.bindings,_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)binding=_ref1[_i],fn(binding)&&_results.push(binding);return _results},View.prototype.bind=function(){var binding,_i,_len,_ref1,_results;for(_ref1=this.bindings,_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)binding=_ref1[_i],_results.push(binding.bind());return _results},View.prototype.unbind=function(){var binding,_i,_len,_ref1,_results;for(_ref1=this.bindings,_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)binding=_ref1[_i],_results.push(binding.unbind());return _results},View.prototype.sync=function(){var binding,_i,_len,_ref1,_results;for(_ref1=this.bindings,_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)binding=_ref1[_i],_results.push(typeof binding.sync=="function"?binding.sync():void 0);return _results},View.prototype.publish=function(){var binding,_i,_len,_ref1,_results;for(_ref1=this.select(function(b){var _ref12;return(_ref12=b.binder)!=null?_ref12.publishes:void 0}),_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)binding=_ref1[_i],_results.push(binding.publish());return _results},View.prototype.update=function(models){var binding,key,model,_i,_len,_ref1,_results;models==null&&(models={});for(key in models)model=models[key],this.models[key]=model;for(_ref1=this.bindings,_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)binding=_ref1[_i],_results.push(typeof binding.update=="function"?binding.update(models):void 0);return _results},View})(),Rivets.Binding=(function(){function Binding(view,el,type,keypath,options){this.view=view,this.el=el,this.type=type,this.keypath=keypath,this.options=options!=null?options:{},this.getValue=__bind(this.getValue,this),this.update=__bind(this.update,this),this.unbind=__bind(this.unbind,this),this.bind=__bind(this.bind,this),this.publish=__bind(this.publish,this),this.sync=__bind(this.sync,this),this.set=__bind(this.set,this),this.eventHandler=__bind(this.eventHandler,this),this.formattedValue=__bind(this.formattedValue,this),this.parseTarget=__bind(this.parseTarget,this),this.observe=__bind(this.observe,this),this.setBinder=__bind(this.setBinder,this),this.formatters=this.options.formatters||[],this.dependencies=[],this.formatterObservers={},this.model=void 0,this.setBinder()}return Binding.prototype.setBinder=function(){var identifier,regexp,value,_ref1;if(!(this.binder=this.view.binders[this.type])){_ref1=this.view.binders;for(identifier in _ref1)value=_ref1[identifier],identifier!=="*"&&identifier.indexOf("*")!==-1&&(regexp=new RegExp("^"+identifier.replace(/\*/g,".+")+"$"),regexp.test(this.t
1ype)&&(this.binder=value,this.args=new RegExp("^"+identifier.replace(/\*/g,"(.+)")+"$").exec(this.type),this.args.shift()))}if(this.binder||(this.binder=this.view.binders["*"]),this.binder instanceof Function)return this.binder={routine:this.binder}},Binding.prototype.observe=function(obj,keypath,callback){return Rivets.sightglass(obj,keypath,callback,{root:this.view.rootInterface,adapters:this.view.adapters})},Binding.prototype.parseTarget=function(){var token;return token=Rivets.TypeParser.parse(this.keypath),token.type===0?this.value=token.value:(this.observer=this.observe(this.view.models,this.keypath,this.sync),this.model=this.observer.target)},Binding.prototype.formattedValue=function(value){var ai,arg,args,fi,formatter,id,observer,processedArgs,_base,_i,_j,_len,_len1,_ref1;for(_ref1=this.formatters,fi=_i=0,_len=_ref1.length;_i<_len;fi=++_i){for(formatter=_ref1[fi],args=formatter.match(/[^\s']+|'([^']|'[^\s])*'|"([^"]|"[^\s])*"/g),id=args.shift(),formatter=this.view.formatters[id],args=(function(){var _j2,_len12,_results;for(_results=[],_j2=0,_len12=args.length;_j2<_len12;_j2++)arg=args[_j2],_results.push(Rivets.TypeParser.parse(arg));return _results})(),processedArgs=[],ai=_j=0,_len1=args.length;_j<_len1;ai=++_j)arg=args[ai],processedArgs.push(arg.type===0?arg.value:((_base=this.formatterObservers)[fi]||(_base[fi]={}),(observer=this.formatterObservers[fi][ai])||(observer=this.observe(this.view.models,arg.value,this.sync),this.formatterObservers[fi][ai]=observer),observer.value()));(formatter!=null?formatter.read:void 0)instanceof Function?value=formatter.read.apply(formatter,[value].concat(__slice.call(processedArgs))):formatter instanceof Function&&(value=formatter.apply(null,[value].concat(__slice.call(processedArgs))))}return value},Binding.prototype.eventHandler=function(fn){var binding,handler;return handler=(binding=this).view.handler,function(ev){return handler.call(fn,this,ev,binding)}},Binding.prototype.set=function(value){var _ref1;return value=value instanceof Function&&!this.binder.function?this.formattedValue(value.call(this.model)):this.formattedValue(value),(_ref1=this.binder.routine)!=null?_ref1.call(this,this.el,value):void 0},Binding.prototype.sync=function(){var dependency,observer;return this.set((function(){var _i,_j,_len,_len1,_ref1,_ref2,_ref3;if(this.observer){if(this.model!==this.observer.target){for(_ref1=this.dependencies,_i=0,_len=_ref1.length;_i<_len;_i++)observer=_ref1[_i],observer.unobserve();if(this.dependencies=[],(this.model=this.observer.target)!=null&&((_ref2=this.options.dependencies)!=null&&_ref2.length))for(_ref3=this.options.dependencies,_j=0,_len1=_ref3.length;_j<_len1;_j++)dependency=_ref3[_j],observer=this.observe(this.model,dependency,this.sync),this.dependencies.push(observer)}return this.observer.value()}else return this.value}).call(this))},Binding.prototype.publish=function(){var args,formatter,id,value,_i,_len,_ref1,_ref2,_ref3;if(this.observer){for(value=this.getValue(this.el),_ref1=this.formatters.slice(0).reverse(),_i=0,_len=_ref1.length;_i<_len;_i++)formatter=_ref1[_i],args=formatter.split(/\s+/),id=args.shift(),(_ref2=this.view.formatters[id])!=null&&_ref2.publish&&(value=(_ref3=this.view.formatters[id]).publish.apply(_ref3,[value].concat(__slice.call(args))));return this.observer.setValue(value)}},Binding.prototype.bind=function(){var dependency,observer,_i,_len,_ref1,_ref2,_ref3;if(this.parseTarget(),(_ref1=this.binder.bind)!=null&&_ref1.call(this,this.el),this.model!=null&&((_ref2=this.options.dependencies)!=null&&_ref2.length))for(_ref3=this.options.dependencies,_i=0,_len=_ref3.length;_i<_len;_i++)dependency=_ref3[_i],observer=this.observe(this.model,dependency,this.sync),this.dependencies.push(observer);if(this.view.preloadData)return this.sync()},Binding.prototype.unbind=function(){var ai,args,fi,observer,_i,_len,_ref1,_ref2,_ref3,_ref4;for((_ref1=this.binder.unbind)!=null&&_ref1.call(this,this.el),(_ref2=this.observer)!=null&&_ref2.unobserve(),_ref3=this.dependencies,_i=0,_len=_ref3.length;_i<_len;_i++)observer=_ref3[_i],observer.unobserve();this.dependencies=[],_ref4=this.formatterObservers;for(fi in _ref4){args=_ref4[fi];for(ai in args)observer=args[ai],observer.unobserve()}return this.formatterObservers={}},Binding.prototype.update=function(models){var _ref1,_ref2;return models==null&&(models={}),this.model=(_ref1=this.observer)!=null?_ref1.target:void 0,(_ref2=this.binder.update)!=null?_ref2.call(this,models):void 0},Binding.prototype.getValue=function(el){return this.binder&&this.binder.getValue!=null?this.binder.getValue.call(this,el):Rivets.Util.getInputValue(el)},Binding})(),Rivets.ComponentBinding=(function(_super){__extends(ComponentBinding,_super);function ComponentBinding(view,el,type){var attribute,bindingRegExp,propertyName,_i,_len,_ref1,_ref2;for(this.view=view,this.el=el,this.type=type,this.unbind=__bind(this.unbind,this),this.bind=__bind(this.bind,this),this.locals=__bind(this.locals,this),this.component=this.view.components[this.type],this.static={},this.observers={},this.upstreamObservers={},bindingRegExp=view.bindingRegExp(),_ref1=this.el.attributes||[],_i=0,_len=_ref1.length;_i<_len;_i++)attribute=_ref1[_i],bindingRegExp.test(attribute.name)||(propertyName=this.camelCase(attribute.name),__indexOf.call((_ref2=this.component.static)!=null?_ref2:[],propertyName)>=0?this.static[propertyName]=attribute.value:this.observers[propertyName]=attribute.value)}return ComponentBinding.prototype.sync=function(){},ComponentBinding.prototype.update=function(){},ComponentBinding.prototype.publish=function(){},ComponentBinding.prototype.locals=function(){var key,observer,result,value,_ref1,_ref2;result={},_ref1=this.static;for(key in _ref1)value=_ref1[key],result[key]=value;_ref2=this.observers;for(key in _ref2)observer=_ref2[key],result[key]=observer.value();return result},ComponentBinding.prototype.camelCase=function(string){return string.replace(/-([a-z])/g,function(grouped){return grouped[1].toUpperCase()})},ComponentBinding.prototype.bind=function(){var k,key,keypath,observer,option,options,scope,v,_base,_i,_j,_len,_len1,_ref1,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7,_results;if(!this.bound){_ref1=this.observers;for(key in _ref1)keypath=_ref1[key],this.observers[key]=this.observe(this.view.models,keypath,(function(_this){return function(key2){return function(){return _this.componentView.models[key2]=_this.observers[key2].value()}}})(this).call(this,key));this.bound=!0}if(this.componentView!=null)return this.componentView.bind();
1for(this.el.innerHTML=this.component.template.call(this),scope=this.component.initialize.call(this,this.el,this.locals()),this.el._bound=!0,options={},_ref2=Rivets.extensions,_i=0,_len=_ref2.length;_i<_len;_i++){if(option=_ref2[_i],options[option]={},this.component[option]){_ref3=this.component[option];for(k in _ref3)v=_ref3[k],options[option][k]=v}_ref4=this.view[option];for(k in _ref4)v=_ref4[k],(_base=options[option])[k]==null&&(_base[k]=v)}for(_ref5=Rivets.options,_j=0,_len1=_ref5.length;_j<_len1;_j++)option=_ref5[_j],options[option]=(_ref6=this.component[option])!=null?_ref6:this.view[option];this.componentView=new Rivets.View(this.el,scope,options),this.componentView.bind(),_ref7=this.observers,_results=[];for(key in _ref7)observer=_ref7[key],_results.push(this.upstreamObservers[key]=this.observe(this.componentView.models,key,(function(_this){return function(key2,observer2){return function(){return observer2.setValue(_this.componentView.models[key2])}}})(this).call(this,key,observer)));return _results},ComponentBinding.prototype.unbind=function(){var key,observer,_ref1,_ref2,_ref3;_ref1=this.upstreamObservers;for(key in _ref1)observer=_ref1[key],observer.unobserve();_ref2=this.observers;for(key in _ref2)observer=_ref2[key],observer.unobserve();return(_ref3=this.componentView)!=null?_ref3.unbind.call(this):void 0},ComponentBinding})(Rivets.Binding),Rivets.TextBinding=(function(_super){__extends(TextBinding,_super);function TextBinding(view,el,type,keypath,options){this.view=view,this.el=el,this.type=type,this.keypath=keypath,this.options=options!=null?options:{},this.sync=__bind(this.sync,this),this.formatters=this.options.formatters||[],this.dependencies=[],this.formatterObservers={}}return TextBinding.prototype.binder={routine:function(node,value){return node.data=value!=null?value:""}},TextBinding.prototype.sync=function(){return TextBinding.__super__.sync.apply(this,arguments)},TextBinding})(Rivets.Binding),Rivets.public.binders.text=function(el,value){return el.textContent!=null?el.textContent=value!=null?value:"":el.innerText=value!=null?value:""},Rivets.public.binders.html=function(el,value){return el.innerHTML=value!=null?value:""},Rivets.public.binders.show=function(el,value){return el.style.display=value?"":"none"},Rivets.public.binders.hide=function(el,value){return el.style.display=value?"none":""},Rivets.public.binders.enabled=function(el,value){return el.disabled=!value},Rivets.public.binders.disabled=function(el,value){return el.disabled=!!value},Rivets.public.binders["style-*"]=function(el,value){el.style.setProperty(this.args[0],value)},Rivets.public.binders["background-image"]=function(el,value){el.style.backgroundImage="url('"+value+"')"},Rivets.public.binders.checked={publishes:!0,priority:2e3,bind:function(el){return Rivets.Util.bindEvent(el,"change",this.publish)},unbind:function(el){return Rivets.Util.unbindEvent(el,"change",this.publish)},routine:function(el,value){var _ref1;return el.type==="radio"?el.checked=((_ref1=el.value)!=null?_ref1.toString():void 0)===(value!=null?value.toString():void 0):el.checked=!!value}},Rivets.public.binders.unchecked={publishes:!0,priority:2e3,bind:function(el){return Rivets.Util.bindEvent(el,"change",this.publish)},unbind:function(el){return Rivets.Util.unbindEvent(el,"change",this.publish)},routine:function(el,value){var _ref1;return el.type==="radio"?el.checked=((_ref1=el.value)!=null?_ref1.toString():void 0)!==(value!=null?value.toString():void 0):el.checked=!value}},Rivets.public.binders.value={publishes:!0,priority:3e3,bind:function(el){if(!(el.tagName==="INPUT"&&el.type==="radio"))return this.event=el.tagName==="SELECT"?"change":"input",Rivets.Util.bindEvent(el,this.event,this.publish)},unbind:function(el){if(!(el.tagName==="INPUT"&&el.type==="radio"))return Rivets.Util.unbindEvent(el,this.event,this.publish)},routine:function(el,value){var o,_i,_len,_ref1,_ref2,_ref3,_results;if(el.tagName==="INPUT"&&el.type==="radio")return el.setAttribute("value",value);if(window.jQuery!=null){if(el=jQuery(el),(value!=null?value.toString():void 0)!==((_ref1=el.val())!=null?_ref1.toString():void 0))return el.val(value!=null?value:"")}else if(el.type==="select-multiple"){if(value!=null){for(_results=[],_i=0,_len=el.length;_i<_len;_i++)o=el[_i],_results.push(o.selected=(_ref2=o.value,__indexOf.call(value,_ref2)>=0));return _results}}else if((value!=null?value.toString():void 0)!==((_ref3=el.value)!=null?_ref3.toString():void 0))return el.value=value!=null?value:""}},Rivets.public.binders.if={block:!0,priority:4e3,bind:function(el){var attr,declaration;if(this.marker==null)return attr=[this.view.prefix,this.type].join("-").replace("--","-"),declaration=el.getAttribute(attr),this.marker=document.createComment(" rivets: "+this.type+" "+declaration+" "),this.bound=!1,el.removeAttribute(attr),el.parentNode.insertBefore(this.marker,el),el.parentNode.removeChild(el)},unbind:function(){var _ref1;return(_ref1=this.nested)!=null?_ref1.unbind():void 0},routine:function(el,value){var key,model,models,_ref1;if(!!value==!this.bound)if(value){models={},_ref1=this.view.models;for(key in _ref1)model=_ref1[key],models[key]=model;return(this.nested||(this.nested=new Rivets.View(el,models,this.view.options()))).bind(),this.marker.parentNode.insertBefore(el,this.marker.nextSibling),this.bound=!0}else return el.parentNode.removeChild(el),this.nested.unbind(),this.bound=!1},update:function(models){var _ref1;return(_ref1=this.nested)!=null?_ref1.update(models):void 0}},Rivets.public.binders.unless={block:!0,priority:4e3,bind:function(el){return Rivets.public.binders.if.bind.call(this,el)},unbind:function(){return Rivets.public.binders.if.unbind.call(this)},routine:function(el,value){return Rivets.public.binders.if.routine.call(this,el,!value)},update:function(models){return Rivets.public.binders.if.update.call(this,models)}},Rivets.public.binders["on-*"]={function:!0,priority:1e3,unbind:function(el){if(this.handler)return Rivets.Util.unbindEvent(el,this.args[0],this.handler)},routine:function(el,value){return this.handler&&Rivets.Util.unbindEvent(el,this.args[0],this.handler),Rivets.Util.bindEvent(el,this.args[0],this.handler=this.eventHandler(value))}},Rivets.public.binders["each-*"]={block:!0,priority:4e3,bind:function(el){var attr,view,_i,_len,_ref1;if(this.marker==null)attr=[this.view.prefix,this.type].join("-").replace("--","-"),this.marker=document.createComment(" rivets: "+this.type+" "),this.iterated=[],el.removeAttribute(attr),el.parentNode.insertBefore(this.marker,el),el.parentNode.removeChild(el);else for(_ref1=this.iterated,_i=0,_len=_ref1.length;_i<_len;_i++)view=_ref1[_i],view.bind()},unbind:function(el){var view,_i,_len,_ref1,_results;if(this.iterated!=null){for(_ref1=this.iterated,_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)view=_ref1[_i],_results.push(view.unbind());return _results}},routine:function(el,collection){var binding,data,i,index,key,model,modelName,options,previous,template,view,_i,_j,_k,_len,_len1,_len2,_ref1,_ref2,_ref3,_results;if(modelName=this.args[0],collection=collection||[],this.iterated.length>collection.length)for(_ref1=Array(this.iterated.length-collection.length),_i=0,_len=_ref1.length;_i<_len;_i++)i=_ref1[_i],view=this.iterated.pop(),view.unbind(),this.marker.parentNode.removeChild(view.els[0]);for(index=_j=0,_len1=collection.length;_j<_len1;index=++_j)if(model=collection[index],data={index:index},data[modelName]=model,this.iterated[index]==null){_ref2=this.view.models;for(key in _ref2)model=_ref2[key],data[key]==null&&(data[key]=model);previous=this.iterated.length?this.iterated[this.iterated.length-1].els[0]:this.marker,options=this.view.options(),options.preloadData=!0,template=el.cloneNode(!0),view=new Rivets.View(template,data,options),view.bind(),this.iterated.push(view),this.marker.parentNode.insertBefore(template,previous.nextSibling)}else this.iterated[index].models[modelName]!==model&&this.iterated[index].update(data);if(el.nodeName==="OPTION"){for(_ref3=this.view.bindings,_results=[],_k=0,_len2=_ref3.length;_k<_len2;
1_k++)binding=_ref3[_k],binding.el===this.marker.parentNode&&binding.type==="value"?_results.push(binding.sync()):_results.push(void 0);return _results}},update:function(models){var data,key,model,view,_i,_len,_ref1,_results;data={};for(key in models)model=models[key],key!==this.args[0]&&(data[key]=model);for(_ref1=this.iterated,_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)view=_ref1[_i],_results.push(view.update(data));return _results}},Rivets.public.binders["class-*"]=function(el,value){var elClass;if(elClass=" "+el.className+" ",!value==(elClass.indexOf(" "+this.args[0]+" ")!==-1))return el.className=value?""+el.className+" "+this.args[0]:elClass.replace(" "+this.args[0]+" "," ").trim()},Rivets.public.binders["*"]=function(el,value){return value!=null?el.setAttribute(this.type,value):el.removeAttribute(this.type)},Rivets.public.adapters["."]={id:"_rv",counter:0,weakmap:{},weakReference:function(obj){var id,_base,_name;return obj.hasOwnProperty(this.id)||(id=this.counter++,Object.defineProperty(obj,this.id,{value:id})),(_base=this.weakmap)[_name=obj[this.id]]||(_base[_name]={callbacks:{}})},cleanupWeakReference:function(ref,id){if(!Object.keys(ref.callbacks).length&&!(ref.pointers&&Object.keys(ref.pointers).length))return delete this.weakmap[id]},stubFunction:function(obj,fn){var map,original,weakmap;return original=obj[fn],map=this.weakReference(obj),weakmap=this.weakmap,obj[fn]=function(){var callback,k,r,response,_i,_len,_ref1,_ref2,_ref3,_ref4;response=original.apply(obj,arguments),_ref1=map.pointers;for(r in _ref1)for(k=_ref1[r],_ref4=(_ref2=(_ref3=weakmap[r])!=null?_ref3.callbacks[k]:void 0)!=null?_ref2:[],_i=0,_len=_ref4.length;_i<_len;_i++)callback=_ref4[_i],callback();return response}},observeMutations:function(obj,ref,keypath){var fn,functions,map,_base,_i,_len;if(Array.isArray(obj)){if(map=this.weakReference(obj),map.pointers==null)for(map.pointers={},functions=["push","pop","shift","unshift","sort","reverse","splice"],_i=0,_len=functions.length;_i<_len;_i++)fn=functions[_i],this.stubFunction(obj,fn);if((_base=map.pointers)[ref]==null&&(_base[ref]=[]),__indexOf.call(map.pointers[ref],keypath)<0)return map.pointers[ref].push(keypath)}},unobserveMutations:function(obj,ref,keypath){var idx,map,pointers;if(Array.isArray(obj)&&obj[this.id]!=null&&(map=this.weakmap[obj[this.id]])&&(pointers=map.pointers[ref]))return(idx=pointers.indexOf(keypath))>=0&&pointers.splice(idx,1),pointers.length||delete map.pointers[ref],this.cleanupWeakReference(map,obj[this.id])},observe:function(obj,keypath,callback){var callbacks,desc,value;return callbacks=this.weakReference(obj).callbacks,callbacks[keypath]==null&&(callbacks[keypath]=[],desc=Object.getOwnPropertyDescriptor(obj,keypath),desc!=null&&desc.get||desc!=null&&desc.set||(value=obj[keypath],Object.defineProperty(obj,keypath,{enumerable:!0,get:function(){return value},set:(function(_this){return function(newValue){var map,_i,_len,_ref1;if(newValue!==value&&(_this.unobserveMutations(value,obj[_this.id],keypath),value=newValue,map=_this.weakmap[obj[_this.id]])){if(callbacks=map.callbacks,callbacks[keypath])for(_ref1=callbacks[keypath].slice(),_i=0,_len=_ref1.length;_i<_len;_i++)callback=_ref1[_i],__indexOf.call(callbacks[keypath],callback)>=0&&callback();return _this.observeMutations(newValue,obj[_this.id],keypath)}}})(this)}))),__indexOf.call(callbacks[keypath],callback)<0&&callbacks[keypath].push(callback),this.observeMutations(obj[keypath],obj[this.id],keypath)},unobserve:function(obj,keypath,callback){var callbacks,idx,map;if((map=this.weakmap[obj[this.id]])&&(callbacks=map.callbacks[keypath]))return(idx=callbacks.indexOf(callback))>=0&&(callbacks.splice(idx,1),callbacks.length||delete map.callbacks[keypath]),this.unobserveMutations(obj[keypath],obj[this.id],keypath),this.cleanupWeakReference(map,obj[this.id])},get:function(obj,keypath){return obj[keypath]},set:function(obj,keypath,value){return obj[keypath]=value}},Rivets.factory=function(sightglass2){return Rivets.sightglass=sightglass2,Rivets.public._=Rivets,Rivets.public},typeof(typeof module!="undefined"&&module!==null?module.exports:void 0)=="object"?module.exports=Rivets.factory(require("sightglass")):typeof define=="function"&&define.amd?define(["sightglass"],function(sightglass2){return this.rivets=Rivets.factory(sightglass2)}):this.rivets=Rivets.factory(sightglass)}).call(this),(function(){var $document,Cart,CartJS,Item,processing,queue,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};Cart=(function(){function Cart2(){this.update=__bind(this.update,this)}return Cart2.prototype.update=function(cart){var item,key,value;for(key in cart)value=cart[key],key!=="items"&&(this[key]=value);return this.items=(function(){var _i,_len,_ref,_results;for(_ref=cart.items,_results=[],_i=0,_len=_ref.length;_i<_len;_i++)item=_ref[_i],_results.push(new Item(item));return _results})()},Cart2})(),Item=(function(){function Item2(item){this.propertyArray=__bind(this.propertyArray,this),this.update=__bind(this.update,this),this.update(item)}return Item2.prototype.update=function(item){var key,value;for(key in item)value=item[key],key!=="properties"&&(this[key]=value);return this.properties=CartJS.Utils.extend({},item.properties)},Item2.prototype.propertyArray=function(){var name,value,_ref,_results;_ref=this.properties,_results=[];
1for(name in _ref)value=_ref[name],_results.push({name:name,value:value});return _results},Item2})(),CartJS={settings:{debug:!1,dataAPI:!0,requestBodyClass:null,rivetsModels:{},currency:null,moneyFormat:null,moneyWithCurrencyFormat:null,weightUnit:"g",weightPrecision:0},cart:new Cart},CartJS.init=function(cart,settings){return settings==null&&(settings={}),CartJS.configure(settings),CartJS.Utils.log("Initialising CartJS."),CartJS.cart.update(cart),CartJS.settings.dataAPI&&(CartJS.Utils.log('"dataAPI" setting is true, initialising Data API.'),CartJS.Data.init()),CartJS.settings.requestBodyClass&&(CartJS.Utils.log('"requestBodyClass" set, adding event listeners.'),jQuery(document).on("cart.requestStarted",function(){return jQuery("body").addClass(CartJS.settings.requestBodyClass)}),jQuery(document).on("cart.requestComplete",function(){return jQuery("body").removeClass(CartJS.settings.requestBodyClass)})),CartJS.Rivets.init(),jQuery(document).trigger("cart.ready",[CartJS.cart])},CartJS.configure=function(settings){return settings==null&&(settings={}),CartJS.Utils.extend(CartJS.settings,settings)},window.console==null&&(window.console={},window.console.log=function(){}),CartJS.Utils={log:function(){return CartJS.Utils.console(console.log,arguments)},error:function(){return CartJS.Utils.console(console.error,arguments)},console:function(method,args){if(CartJS.settings.debug&&typeof console!="undefined"&&console!==null)return args=Array.prototype.slice.call(args),args.unshift("[CartJS]:"),method.apply(console,args)},wrapKeys:function(obj,type,override){var key,value,wrapped;type==null&&(type="properties"),wrapped={};for(key in obj)value=obj[key],wrapped[""+type+"["+key+"]"]=override!=null?override:value;return wrapped},unwrapKeys:function(obj,type,override){var key,unwrapped,unwrappedKey,value;type==null&&(type="properties"),unwrapped={};for(key in obj)value=obj[key],unwrappedKey=key.replace(""+type+"[","").replace("]",""),unwrapped[unwrappedKey]=override!=null?override:value;return unwrapped},extend:function(object,properties){var key,val;for(key in properties)val=properties[key],object[key]=val;return object},clone:function(object){var key,newInstance;if(object==null||typeof object!="object")return object;newInstance=new object.constructor;for(key in object)newInstance[key]=clone(object[key]);return newInstance},isArray:Array.isArray||function(value){return{}.toString.call(value)==="[object Array]"},ensureArray:function(value){return CartJS.Utils.isArray(value)?value:value!=null?[value]:[]},formatMoney:function(value,format,formatName,currency){var _ref,_ref1;return currency==null&&(currency=""),currency||(currency=CartJS.settings.currency),window.Currency!=null&¤cy!==CartJS.settings.currency&&(value=Currency.convert(value,CartJS.settings.currency,currency),((_ref=window.Currency)!=null?_ref.moneyFormats:void 0)!=null&¤cy in window.Currency.moneyFormats&&(format=window.Currency.moneyFormats[currency][formatName])),((_ref1=window.Shopify)!=null?_ref1.formatMoney:void 0)!=null?Shopify.formatMoney(value,format):value},getSizedImageUrl:function(src,size){var _ref,_ref1;return((_ref=window.Shopify)!=null&&(_ref1=_ref.Image)!=null?_ref1.getSizedImageUrl:void 0)!=null?src?Shopify.Image.getSizedImageUrl(src,size):Shopify.Image.getSizedImageUrl("https://cdn.shopify.com/s/images/admin/no-image-.gif",size).replace("-_","-"):src||"https://cdn.shopify.com/s/images/admin/no-image-large.gif"}},queue=[],processing=!1,CartJS.Queue={add:function(url,data,options){var request;if(options==null&&(options={}),request={url:url,data:data,type:options.type||"POST",dataType:options.dataType||"json",success:CartJS.Utils.ensureArray(options.success),error:CartJS.Utils.ensureArray(options.error),complete:CartJS.Utils.ensureArray(options.complete)},options.updateCart&&request.success.push(CartJS.cart.update),queue.push(request),!processing)return jQuery(document).trigger("cart.requestStarted",[CartJS.cart]),CartJS.Queue.process()},process:function(){var params;if(!queue.length){processing=!1,jQuery(document).trigger("cart.requestComplete",[CartJS.cart]);return}return processing=!0,params=queue.shift(),params.complete=CartJS.Queue.process,jQuery.ajax(params)}},CartJS.Core={getCart:function(options){return options==null&&(options={}),options.type="GET",options.updateCart=!0,CartJS.Queue.add("/cart.js",{},options)},addItem:function(id,quantity,properties,options){var data;return quantity==null&&(quantity=1),properties==null&&(properties={}),options==null&&(options={}),data=CartJS.Utils.wrapKeys(properties),data.id=id,data.quantity=quantity,CartJS.Queue.add("/cart/add.js",data,options),CartJS.Core.getCart()},updateItem:function(line,quantity,properties,options){var data;return properties==null&&(properties={}),options==null&&(options={}),data=CartJS.Utils.wrapKeys(properties),data.line=line,quantity!=null&&(data.quantity=quantity),options.updateCart=!0,CartJS.Queue.add("/cart/change.js",data,options)},removeItem:function(line,options){return options==null&&(options={}),CartJS.Core.updateItem(line,0,{},options)},updateItemById:function(id,quantity,properties,options){var data;return properties==null&&(properties={}),options==null&&(options={}),data=CartJS.Utils.wrapKeys(properties),data.id=id,quantity!=null&&(data.quantity=quantity),options.updateCart=!0,CartJS.Queue.add("/cart/change.js",data,options)},updateItemQuantitiesById:function(updates,options){return updates==null&&(updates={}),options==null&&(options={}),options.updateCart=!0,CartJS.Queue.add("/cart/update.js",{updates:updates},options)},removeItemById:function(id,options){var data;return options==null&&(options={}),data={id:id,quantity:0},options.updateCart=!0,CartJS.Queue.add("/cart/change.js",data,options)},clear:function(options){return options==null&&(options={}),options.updateCart=!0,CartJS.Queue.add("/cart/clear.js",{},options)},getAttribute:function(attributeName,defaultValue){return attributeName in CartJS.cart.attributes?CartJS.cart.attributes[attributeName]:defaultValue},setAttribute:function(attributeName,value,options){var attributes;return options==null&&(options={}),attributes={},attributes[attributeName]=value,CartJS.Core.setAttributes(attributes,options)},getAttributes:function(){return CartJS.cart.attributes},setAttributes:function(attributes,options){return attributes==null&&(attributes={}),options==null&&(options={}),options.updateCart=!0,CartJS.Queue.add("/cart/update.js",CartJS.Utils.wrapKeys(attributes,"attributes"),options)},clearAttributes:function(options){return options==null&&(options={}),options.updateCart=!0,CartJS.Queue.add("/cart/update.js",CartJS.Utils.wrapKeys(CartJS.Core.getAttributes(),"attributes",""),options)},getNote:function(){return CartJS.cart.note},setNote:function(note,options){return options==null&&(options={}),options.updateCart=!0,CartJS.Queue.add("/cart/update.js",{note:note},options)}},$document=null,CartJS.Data={init:function(){return $document=jQuery(document),CartJS.Data.setEventListeners("on"),CartJS.Data.render(null,CartJS.cart)},destroy:function(){return CartJS.Data.setEventListeners("off")},setEventListeners:function(method){return $document[method]("click","[data-cart-add]",CartJS.Data.add
1),$document[method]("click","[data-cart-remove]",CartJS.Data.remove),$document[method]("click","[data-cart-remove-id]",CartJS.Data.removeById),$document[method]("click","[data-cart-update]",CartJS.Data.update),$document[method]("click","[data-cart-update-id]",CartJS.Data.updateById),$document[method]("click","[data-cart-clear]",CartJS.Data.clear),$document[method]("change","[data-cart-toggle]",CartJS.Data.toggle),$document[method]("change","[data-cart-toggle-attribute]",CartJS.Data.toggleAttribute),$document[method]("submit","[data-cart-submit]",CartJS.Data.submit),$document[method]("cart.requestComplete",CartJS.Data.render)},add:function(e){var $this;return e.preventDefault(),$this=jQuery(this),CartJS.Core.addItem($this.attr("data-cart-add"),$this.attr("data-cart-quantity"))},remove:function(e){var $this;return e.preventDefault(),$this=jQuery(this),CartJS.Core.removeItem($this.attr("data-cart-remove"))},removeById:function(e){var $this;return e.preventDefault(),$this=jQuery(this),CartJS.Core.removeItemById($this.attr("data-cart-remove-id"))},update:function(e){var $this;return e.preventDefault(),$this=jQuery(this),CartJS.Core.updateItem($this.attr("data-cart-update"),$this.attr("data-cart-quantity"))},updateById:function(e){var $this;return e.preventDefault(),$this=jQuery(this),CartJS.Core.updateItemById($this.attr("data-cart-update-id"),$this.attr("data-cart-quantity"))},clear:function(e){return e.preventDefault(),CartJS.Core.clear()},toggle:function(e){var $input,id;return $input=jQuery(this),id=$input.attr("data-cart-toggle"),$input.is(":checked")?CartJS.Core.addItem(id):CartJS.Core.removeItemById(id)},toggleAttribute:function(e){var $input,attribute;return $input=jQuery(this),attribute=$input.attr("data-cart-toggle-attribute"),CartJS.Core.setAttribute(attribute,$input.is(":checked")?"Yes":"")},submit:function(e){var dataArray,id,properties,quantity;return e.preventDefault(),dataArray=jQuery(this).serializeArray(),id=void 0,quantity=void 0,properties={},jQuery.each(dataArray,function(i,item){if(item.name==="id")return id=item.value;if(item.name==="quantity")return quantity=item.value;if(item.name.match(/^properties\[\w+\]$/))return properties[item.name]=item.value}),CartJS.Core.addItem(id,quantity,CartJS.Utils.unwrapKeys(properties))},render:function(e,cart){var context;return context={item_count:cart.item_count,total_price:cart.total_price,total_price_money:CartJS.Utils.formatMoney(cart.total_price,CartJS.settings.moneyFormat,"money_format",(typeof Currency!="undefined"&&Currency!==null?Currency.currentCurrency:void 0)!=null?Currency.currentCurrency:void 0),total_price_money_with_currency:CartJS.Utils.formatMoney(cart.total_price,CartJS.settings.moneyWithCurrencyFormat,"money_with_currency_format",(typeof Currency!="undefined"&&Currency!==null?Currency.currentCurrency:void 0)!=null?Currency.currentCurrency:void 0)},jQuery("[data-cart-render]").each(function(){var $this;return $this=jQuery(this),$this.html(context[$this.attr("data-cart-render")])})}},"rivets"in window?(CartJS.Rivets={model:null,boundViews:[],init:function(){return CartJS.Rivets.bindViews()},destroy:function(){return CartJS.Rivets.unbindViews()},bindViews:function(){return CartJS.Utils.log("Rivets.js is present, binding views."),CartJS.Rivets.unbindViews(),CartJS.Rivets.model=CartJS.Utils.extend({cart:CartJS.cart},CartJS.settings.rivetsModels),window.Currency!=null&&(CartJS.Rivets.model.Currency=window.Currency),jQuery("[data-cart-view]").each(function(){var view;return view=rivets.bind(jQuery(this),CartJS.Rivets.model),CartJS.Rivets.boundViews.push(view)})},unbindViews:function(){var view,_i,_len,_ref;for(_ref=CartJS.Rivets.boundViews,_i=0,_len=_ref.length;_i<_len;_i++)view=_ref[_i],view.unbind();return CartJS.Rivets.boundViews=[]}},rivets.formatters.eq=function(a,b){return a===b},rivets.formatters.includes=function(a,b){return a.indexOf(b)>=0},rivets.formatters.match=function(a,regexp,flags){return a.match(new RegExp(regexp,flags))},rivets.formatters.lt=function(a,b){return a<b},rivets.formatters.gt=function(a,b){return a>b},rivets.formatters.not=function(a){return!a},rivets.formatters.empty=function(a){return!a.length},rivets.formatters.plus=function(a,b){return parseInt(a)+parseInt(b)},rivets.formatters.minus=function(a,b){return parseInt(a)-parseInt(b)},rivets.formatters.times=function(a,b){return a*b},rivets.formatters.divided_by=function(a,b){return a/b},rivets.formatters.modulo=function(a,b){return a%b},rivets.formatters.prepend=function(a,b){return b+a},rivets.formatters.append=function(a,b){return a+b},rivets.formatters.slice=function(value,start,end){return value.slice(start,end)},rivets.formatters.pluralize=function(input,singular,plural){return plural==null&&(plural=singular+"s"),CartJS.Utils.isArray(input)&&(input=input.length),input===1?singular:plural},rivets.formatters.array_element=function(array,index){return array[index]},rivets.formatters.array_first=function(array){return array[0]},rivets.formatters.array_last=function(array){return array[array.length-1]},rivets.formatters.money=function(value,currency){return CartJS.Utils.formatMoney(value,CartJS.settings.moneyFormat,"money_format",currency)},rivets.formatters.money_with_currency=function(value,currency){return CartJS.Utils.formatMoney(value,CartJS.settings.moneyWithCurrencyFormat,"money_with_currency_format",currency)},rivets.formatters.weight=function(grams){switch(CartJS.settings.weightUnit){case"kg":return(grams/1e3).toFixed(CartJS.settings.weightPrecision);case"oz":return(grams*.035274).toFixed(CartJS.settings.weightPrecision);case"lb":return(grams*.00220462).toFixed(CartJS.settings.weightPrecision);default:return grams.toFixed(CartJS.settings.weightPrecision)}},rivets.formatters.weight_with_unit=function(grams){return rivets.formatters.weight(grams)+CartJS.settings.weightUnit},rivets.formatters.product_image_size=function(src,size){return CartJS.Utils.getSizedImageUrl(src,size)},rivets.formatters.moneyWithCurrency=rivets.formatters.money_with_currency,rivets.formatters.weightWithUnit=rivets.formatters.weight_with_unit,rivets.formatters.productImageSize=rivets.formatters.product_image_size):CartJS.Rivets={init:function(){},destroy:function(){}},CartJS.factory=function(exports2){return exports2.init=CartJS.init,exports2.configure=CartJS.configure,exports2.cart=CartJS.cart,exports2.settings=CartJS.settings,exports2.getCart=CartJS.Core.getCart,exports2.addItem=CartJS.Core.addItem,exports2.updateItem=CartJS.Core.updateItem,exports2.updateItemById=CartJS.Core.updateItemById,exports2.updateItemQuantitiesById=CartJS.Core.updateItemQuantitiesById,exports2.removeItem=CartJS.Core.removeItem,exports2.removeItemById=CartJS.Core.removeItemById,exports2.clear=CartJS.Core.clear,exports2.getAttribute=CartJS.Core.getAttribute,exports2.setAttribute=CartJS.Core.setAttribute,exports2.getAttributes=CartJS.Core.getAttributes,exports2.setAttributes=CartJS.Core.setAttributes,exports2.clearAttributes=CartJS.Core.clearAttributes,exports2.getNote=CartJS.Core.getNote,exports2.setNote=CartJS.Core.setNote,exports2.render=CartJS.Data.render},typeof exports=="object"?CartJS.factory(exports):typeof define=="function"&&define.amd?define(["exports"],function(exports2){return CartJS.factory(this.CartJS=exports2),exports2}):CartJS.factory(this.CartJS={})}).call(this); 2//# sourceMappingURL=/cdn/shop/t/117/assets/rivets-cart.js.map?v=121169019295910280801775885538
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.