(function(n,t){function o(n){return!!(""===n||n&&n.charCodeAt&&n.substr)}function u(n){return v?v(n):"[object Array]"===y.call(n)}function s(n){return"[object Object]"===y.call(n)}function h(n,t){var i,n=n||{},t=t||{};for(i in t)t.hasOwnProperty(i)&&null==n[i]&&(n[i]=t[i]);return n}function r(n,t,i){var u=[],r,f;if(!n)return u;if(a&&n.map===a)return n.map(t,i);for(r=0,f=n.length;r<f;r++)u[r]=t.call(i,n[r],r,n);return u}function f(n,t){return n=Math.round(Math.abs(n)),isNaN(n)?t:n}function l(n){var t=i.settings.currency.format;return"function"==typeof n&&(n=n()),o(n)&&n.match("%v")?{pos:n,neg:n.replace("-","").replace("%v","-%v"),zero:n}:!n||!n.pos||!n.pos.match("%v")?o(t)?i.settings.currency.format={pos:t,neg:t.replace("%v","-%v"),zero:t}:t:n}var i={version:"0.4.1",settings:{currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}}},a=Array.prototype.map,v=Array.isArray,y=Object.prototype.toString,e=i.unformat=i.parse=function(n,t){if(u(n))return r(n,function(n){return e(n,t)});if(n=n||0,"number"==typeof n)return n;var t=t||".",i=RegExp("[^0-9-"+t+"]",["g"]),i=parseFloat((""+n).replace(/\((.*)\)/,"-$1").replace(i,"").replace(t,"."));return isNaN(i)?0:i},p=i.toFixed=function(n,t){var t=f(t,i.settings.number.precision),r=Math.pow(10,t);return(Math.round(i.unformat(n)*r)/r).toFixed(t)},c=i.formatNumber=i.format=function(n,t,o,l){if(u(n))return r(n,function(n){return c(n,t,o,l)});var n=e(n),a=h(s(t)?t:{precision:t,thousand:o,decimal:l},i.settings.number),y=f(a.precision),b=0>n?"-":"",v=parseInt(p(Math.abs(n||0),y),10)+"",w=3<v.length?v.length%3:0;return b+(w?v.substr(0,w)+a.thousand:"")+v.substr(w).replace(/(\d{3})(?=\d)/g,"$1"+a.thousand)+(y?a.decimal+p(Math.abs(n),y).split(".")[1]:"")},w=i.formatMoney=function(n,t,o,a,v,y){if(u(n))return r(n,function(n){return w(n,t,o,a,v,y)});var n=e(n),p=h(s(t)?t:{symbol:t,precision:o,thousand:a,decimal:v,format:y},i.settings.currency),b=l(p.format);return(0<n?b.pos:0>n?b.neg:b.zero).replace("%s",p.symbol).replace("%v",c(Math.abs(n),f(p.precision),p.thousand,p.decimal))};i.formatColumn=function(n,t,a,v,y,p){if(!n)return[];var w=h(s(t)?t:{symbol:t,precision:a,thousand:v,decimal:y,format:p},i.settings.currency),b=l(w.format),d=b.pos.indexOf("%s")<b.pos.indexOf("%v")?!0:!1,k=0,n=r(n,function(n){return u(n)?i.formatColumn(n,w):(n=e(n),n=(0<n?b.pos:0>n?b.neg:b.zero).replace("%s",w.symbol).replace("%v",c(Math.abs(n),f(w.precision),w.thousand,w.decimal)),n.length>k&&(k=n.length),n)});return r(n,function(n){return o(n)&&n.length<k?d?n.replace(w.symbol,w.symbol+Array(k-n.length+1).join(" ")):Array(k-n.length+1).join(" ")+n:n})};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=i),exports.accounting=i):"function"==typeof define&&define.amd?define([],function(){return i}):(i.noConflict=function(r){return function(){return n.accounting=r,i.noConflict=t,i}}(n.accounting),n.accounting=i)})(this);TTI.Money={};var MoneyAmountType={Default:"Default",Commission:"Commission",Tax:"Tax"},CurrencySettings={EUR:{Symbol:"€",DecimalSeparator:",",ThousandSeparator:" ",Precision:2,Format:"%v %s"},USD:{Symbol:"$",DecimalSeparator:".",ThousandSeparator:",",Precision:2,Format:"%v %s"},XOF:{Symbol:"XOF",DecimalSeparator:"",ThousandSeparator:" ",Precision:0,Format:"%v %s"},XAF:{Symbol:"XAF",DecimalSeparator:"",ThousandSeparator:" ",Precision:0,Format:"%v %s"}};TTI.Money.GetCurrencySubDivision=function(n,t){var i=2;switch(t){case MoneyAmountType.Default:i=n.SubDivision;break;case MoneyAmountType.Commission:i=n.CommissionSubDivision;break;case MoneyAmountType.Tax:i=n.TaxSubDivision}return i};TTI.Money.RoundAmount=function(n,t,i){var u=TTI.Money.GetCurrencySubDivision(t,i),r=Math.abs(n),f,e,o;return r=r*Math.pow(10,u),f=Math.round(r-Math.floor(r),1),e=.5,r=f>e?Math.round(r+.1)/Math.pow(10,u):f==e?Math.round(r+.1)/Math.pow(10,u):Math.round(r)/Math.pow(10,u),o=0,o=n>0?1:-1,o*r};TTI.Money.ToUpperRoundedFare=function(n){return Math.ceil(n)};TTI.Money.FormatAmount=function(n,t,i,r){return CurrencySettings[t.Code]==null?accounting.formatMoney(n,{symbol:t.Code,precision:r.precision==null?2:r.precision,format:r.Format==null?"%v %s":r.Format,thousand:r.thousand,decimal:r.decimal}):accounting.formatMoney(n,{symbol:t.Code,precision:r.precision==null?CurrencySettings[t.Code].Precision:r.precision,format:r.Format==null?CurrencySettings[t.Code].Format:r.Format,thousand:CurrencySettings[t.Code].ThousandSeparator,decimal:CurrencySettings[t.Code].DecimalSeparator})};TTI.Money.RoundAndFormatAmount=function(n,t,i,r){var u;return r=new TTI.Money.Options(r),u=TTI.Money.RoundAmount(n,t,i),r.ToUpperRoundedFare&&(u=TTI.Money.ToUpperRoundedFare(u)),TTI.Money.FormatAmount(u,t,i,r)};TTI.Money.Options=function(n){n=n?n:{};var t=this;return t.Format=n.Format,t.ToUpperRoundedFare=n.ToUpperRoundedFare!=null?n.ToUpperRoundedFare:!1,t.precision=t.ToUpperRoundedFare?0:n.precision!=null?n.precision:null,t.thousand=n.thousand,t.decimal=n.decimal,t}