@roomstay/core 0.1.37 → 0.1.38-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.js CHANGED
@@ -1,2 +1 @@
1
- /*! For license information please see node.js.LICENSE.txt */
2
- (()=>{"use strict";var n={d:(e,i)=>{for(var t in i)n.o(i,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:i[t]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},e={};let i,t,r,o,s,u,c,a,f,d,l,h,g,p,m;function w(n){return n.toUpperCase()}n.r(e),n.d(e,{EBookingPaymentMethod:()=>t,ECompanyProvider:()=>s,EDistanceUnitType:()=>u,EGuarantyPolicyPrepaymentType:()=>p,EHotelCardProcessor:()=>r,EHotelPriceModel:()=>c,EHotelStateFieldConfiguration:()=>a,EHotelWeekdayStartsOn:()=>f,EIntegration:()=>l,EPlanpayBookingStatus:()=>o,ERMSDiscountType:()=>h,ERoomstayImageSize:()=>g,HttpMethod:()=>m,IAuxiliaryFilterType:()=>d,IBookingStatus:()=>i,calculateTotalForMemberBooking:()=>v,nameof:()=>y,resizeRoomstayImageUrl:()=>N,roundMoney:()=>se,subset:()=>E,uppercaseString:()=>w}),function(n){n.Pending="Pending",n.Committed="Committed",n.Cancelled="Cancelled"}(i||(i={})),function(n){n.Card="Card",n.SavedCard="SavedCard",n.Planpay="Planpay",n.Adyen="Adyen"}(t||(t={})),function(n){n.Passthrough="Passthrough",n.Adyen="Adyen",n.Till="Till",n.RMSPay="RMSPay"}(r||(r={})),function(n){n.Unknown="unknown",n.Unpaid="unpaid",n.Accepted="accepted",n.Cancelled="cancelled",n.Refunded="refunded",n.Rejected="rejected"}(o||(o={})),function(n){n.Synxis="Synxis",n.Availpro="Availpro",n.RMS="RMS",n.Siteminder="Siteminder",n.Roomstay="Roomstay"}(s||(s={})),function(n){n.Metric="metric",n.Imperial="imperial"}(u||(u={})),function(n){n.PerPerson="PerPerson",n.PerDay="PerDay",n.PerOccupancy="PerOccupancy"}(c||(c={})),function(n){n.NotIncluded="NotIncluded",n.Optional="Optional",n.Required="Required"}(a||(a={})),function(n){n.Monday="monday",n.Sunday="sunday"}(f||(f={})),function(n){n.AreaDwellingLength="AreaDwellingLength",n.AreaDwellingType="AreaDwellingType"}(d||(d={})),function(n){n.Big4="Big4",n.Top10="Top10",n.Gday="Gday",n.Salesforce="Salesforce"}(l||(l={})),function(n){n.Percentage="Percentage",n.Amount="Amount",n.Bogo="BOGO",n.NightlyRateOverride="NightlyRateOverride"}(h||(h={})),function(n){n[n.Icon=128]="Icon",n[n.Tiny=256]="Tiny",n[n.Small=512]="Small",n[n.Medium=768]="Medium",n[n.Large=1024]="Large",n[n.ExtraLarge=1600]="ExtraLarge"}(g||(g={})),function(n){n.FixedAmount="fixed",n.Percentage="percentage",n.Nights="nights"}(p||(p={})),function(n){n.GET="GET",n.POST="POST",n.PUT="PUT",n.DELETE="DELETE",n.PATCH="PATCH",n.OPTIONS="OPTIONS",n.HEAD="HEAD"}(m||(m={}));const v=n=>{let e=0;const i=Object.values(n.itinerary);for(const n of i){const i=Object.keys(n.nights);for(const t of i)e+=n.nights[t].total}return e},N=(n,e)=>n.includes("cdn.app.roomstay.io")?n+"?w="+e:n,y=n=>n,E=(n,e)=>{const i={};return e.forEach((e=>{e in n&&(i[e]=n[e])})),i};var b,x,P=9e15,M=1e9,O="0123456789abcdef",S="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",T="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",A={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-P,maxE:P,crypto:!1},D=!0,q="[DecimalError] ",R=q+"Invalid argument: ",F=q+"Precision limit exceeded",C=q+"crypto unavailable",I="[object Decimal]",L=Math.floor,k=Math.pow,U=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Z=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,H=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,_=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,B=1e7,j=S.length-1,G=T.length-1,V={toStringTag:I};function $(n){var e,i,t,r=n.length-1,o="",s=n[0];if(r>0){for(o+=s,e=1;e<r;e++)(i=7-(t=n[e]+"").length)&&(o+=rn(i)),o+=t;(i=7-(t=(s=n[e])+"").length)&&(o+=rn(i))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function W(n,e,i){if(n!==~~n||n<e||n>i)throw Error(R+n)}function z(n,e,i,t){var r,o,s,u;for(o=n[0];o>=10;o/=10)--e;return--e<0?(e+=7,r=0):(r=Math.ceil((e+1)/7),e%=7),o=k(10,7-e),u=n[r]%o|0,null==t?e<3?(0==e?u=u/100|0:1==e&&(u=u/10|0),s=i<4&&99999==u||i>3&&49999==u||5e4==u||0==u):s=(i<4&&u+1==o||i>3&&u+1==o/2)&&(n[r+1]/o/100|0)==k(10,e-2)-1||(u==o/2||0==u)&&0==(n[r+1]/o/100|0):e<4?(0==e?u=u/1e3|0:1==e?u=u/100|0:2==e&&(u=u/10|0),s=(t||i<4)&&9999==u||!t&&i>3&&4999==u):s=((t||i<4)&&u+1==o||!t&&i>3&&u+1==o/2)&&(n[r+1]/o/1e3|0)==k(10,e-3)-1,s}function J(n,e,i){for(var t,r,o=[0],s=0,u=n.length;s<u;){for(r=o.length;r--;)o[r]*=e;for(o[0]+=O.indexOf(n.charAt(s++)),t=0;t<o.length;t++)o[t]>i-1&&(void 0===o[t+1]&&(o[t+1]=0),o[t+1]+=o[t]/i|0,o[t]%=i)}return o.reverse()}V.absoluteValue=V.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),Q(n)},V.ceil=function(){return Q(new this.constructor(this),this.e+1,2)},V.clampedTo=V.clamp=function(n,e){var i=this,t=i.constructor;if(n=new t(n),e=new t(e),!n.s||!e.s)return new t(NaN);if(n.gt(e))throw Error(R+e);return i.cmp(n)<0?n:i.cmp(e)>0?e:new t(i)},V.comparedTo=V.cmp=function(n){var e,i,t,r,o=this,s=o.d,u=(n=new o.constructor(n)).d,c=o.s,a=n.s;if(!s||!u)return c&&a?c!==a?c:s===u?0:!s^c<0?1:-1:NaN;if(!s[0]||!u[0])return s[0]?c:u[0]?-a:0;if(c!==a)return c;if(o.e!==n.e)return o.e>n.e^c<0?1:-1;for(e=0,i=(t=s.length)<(r=u.length)?t:r;e<i;++e)if(s[e]!==u[e])return s[e]>u[e]^c<0?1:-1;return t===r?0:t>r^c<0?1:-1},V.cosine=V.cos=function(){var n,e,i=this,t=i.constructor;return i.d?i.d[0]?(n=t.precision,e=t.rounding,t.precision=n+Math.max(i.e,i.sd())+7,t.rounding=1,i=function(n,e){var i,t,r;if(e.isZero())return e;(t=e.d.length)<32?r=(1/gn(4,i=Math.ceil(t/3))).toString():(i=16,r="2.3283064365386962890625e-10"),n.precision+=i,e=hn(n,1,e.times(r),new n(1));for(var o=i;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return n.precision-=i,e}(t,pn(t,i)),t.precision=n,t.rounding=e,Q(2==x||3==x?i.neg():i,n,e,!0)):new t(1):new t(NaN)},V.cubeRoot=V.cbrt=function(){var n,e,i,t,r,o,s,u,c,a,f=this,d=f.constructor;if(!f.isFinite()||f.isZero())return new d(f);for(D=!1,(o=f.s*k(f.s*f,1/3))&&Math.abs(o)!=1/0?t=new d(o.toString()):(i=$(f.d),(o=((n=f.e)-i.length+1)%3)&&(i+=1==o||-2==o?"0":"00"),o=k(i,1/3),n=L((n+1)/3)-(n%3==(n<0?-1:2)),(t=new d(i=o==1/0?"5e"+n:(i=o.toExponential()).slice(0,i.indexOf("e")+1)+n)).s=f.s),s=(n=d.precision)+3;;)if(a=(c=(u=t).times(u).times(u)).plus(f),t=K(a.plus(f).times(u),a.plus(c),s+2,1),$(u.d).slice(0,s)===(i=$(t.d)).slice(0,s)){if("9999"!=(i=i.slice(s-3,s+1))&&(r||"4999"!=i)){+i&&(+i.slice(1)||"5"!=i.charAt(0))||(Q(t,n+1,1),e=!t.times(t).times(t).eq(f));break}if(!r&&(Q(u,n+1,0),u.times(u).times(u).eq(f))){t=u;break}s+=4,r=1}return D=!0,Q(t,n,d.rounding,e)},V.decimalPlaces=V.dp=function(){var n,e=this.d,i=NaN;if(e){if(i=7*((n=e.length-1)-L(this.e/7)),n=e[n])for(;n%10==0;n/=10)i--;i<0&&(i=0)}return i},V.dividedBy=V.div=function(n){return K(this,new this.constructor(n))},V.dividedToIntegerBy=V.divToInt=function(n){var e=this.constructor;return Q(K(this,new e(n),0,1,1),e.precision,e.rounding)},V.equals=V.eq=function(n){return 0===this.cmp(n)},V.floor=function(){return Q(new this.constructor(this),this.e+1,3)},V.greaterThan=V.gt=function(n){return this.cmp(n)>0},V.greaterThanOrEqualTo=V.gte=function(n){var e=this.cmp(n);return 1==e||0===e},V.hyperbolicCosine=V.cosh=function(){var n,e,i,t,r,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;i=s.precision,t=s.rounding,s.precision=i+Math.max(o.e,o.sd())+4,s.rounding=1,(r=o.d.length)<32?e=(1/gn(4,n=Math.ceil(r/3))).toString():(n=16,e="2.3283064365386962890625e-10"),o=hn(s,1,o.times(e),new s(1),!0);for(var c,a=n,f=new s(8);a--;)c=o.times(o),o=u.minus(c.times(f.minus(c.times(f))));return Q(o,s.precision=i,s.rounding=t,!0)},V.hyperbolicSine=V.sinh=function(){var n,e,i,t,r=this,o=r.constructor;if(!r.isFinite()||r.isZero())return new o(r);if(e=o.precision,i=o.rounding,o.precision=e+Math.max(r.e,r.sd())+4,o.rounding=1,(t=r.d.length)<3)r=hn(o,2,r,r,!0);else{n=(n=1.4*Math.sqrt(t))>16?16:0|n,r=hn(o,2,r=r.times(1/gn(5,n)),r,!0);for(var s,u=new o(5),c=new o(16),a=new o(20);n--;)s=r.times(r),r=r.times(u.plus(s.times(c.times(s).plus(a))))}return o.precision=e,o.rounding=i,Q(r,e,i,!0)},V.hyperbolicTangent=V.tanh=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+7,t.rounding=1,K(i.sinh(),i.cosh(),t.precision=n,t.rounding=e)):new t(i.s)},V.inverseCosine=V.acos=function(){var n,e=this,i=e.constructor,t=e.abs().cmp(1),r=i.precision,o=i.rounding;return-1!==t?0===t?e.isNeg()?en(i,r,o):new i(0):new i(NaN):e.isZero()?en(i,r+4,o).times(.5):(i.precision=r+6,i.rounding=1,e=e.asin(),n=en(i,r+4,o).times(.5),i.precision=r,i.rounding=o,n.minus(e))},V.inverseHyperbolicCosine=V.acosh=function(){var n,e,i=this,t=i.constructor;return i.lte(1)?new t(i.eq(1)?0:NaN):i.isFinite()?(n=t.precision,e=t.rounding,t.precision=n+Math.max(Math.abs(i.e),i.sd())+4,t.rounding=1,D=!1,i=i.times(i).minus(1).sqrt().plus(i),D=!0,t.precision=n,t.rounding=e,i.ln()):new t(i)},V.inverseHyperbolicSine=V.asinh=function(){var n,e,i=this,t=i.constructor;return!i.isFinite()||i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+2*Math.max(Math.abs(i.e),i.sd())+6,t.rounding=1,D=!1,i=i.times(i).plus(1).sqrt().plus(i),D=!0,t.precision=n,t.rounding=e,i.ln())},V.inverseHyperbolicTangent=V.atanh=function(){var n,e,i,t,r=this,o=r.constructor;return r.isFinite()?r.e>=0?new o(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(n=o.precision,e=o.rounding,t=r.sd(),Math.max(t,n)<2*-r.e-1?Q(new o(r),n,e,!0):(o.precision=i=t-r.e,r=K(r.plus(1),new o(1).minus(r),i+n,1),o.precision=n+4,o.rounding=1,r=r.ln(),o.precision=n,o.rounding=e,r.times(.5))):new o(NaN)},V.inverseSine=V.asin=function(){var n,e,i,t,r=this,o=r.constructor;return r.isZero()?new o(r):(e=r.abs().cmp(1),i=o.precision,t=o.rounding,-1!==e?0===e?((n=en(o,i+4,t).times(.5)).s=r.s,n):new o(NaN):(o.precision=i+6,o.rounding=1,r=r.div(new o(1).minus(r.times(r)).sqrt().plus(1)).atan(),o.precision=i,o.rounding=t,r.times(2)))},V.inverseTangent=V.atan=function(){var n,e,i,t,r,o,s,u,c,a=this,f=a.constructor,d=f.precision,l=f.rounding;if(a.isFinite()){if(a.isZero())return new f(a);if(a.abs().eq(1)&&d+4<=G)return(s=en(f,d+4,l).times(.25)).s=a.s,s}else{if(!a.s)return new f(NaN);if(d+4<=G)return(s=en(f,d+4,l).times(.5)).s=a.s,s}for(f.precision=u=d+10,f.rounding=1,n=i=Math.min(28,u/7+2|0);n;--n)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(D=!1,e=Math.ceil(u/7),t=1,c=a.times(a),s=new f(a),r=a;-1!==n;)if(r=r.times(c),o=s.minus(r.div(t+=2)),r=r.times(c),void 0!==(s=o.plus(r.div(t+=2))).d[e])for(n=e;s.d[n]===o.d[n]&&n--;);return i&&(s=s.times(2<<i-1)),D=!0,Q(s,f.precision=d,f.rounding=l,!0)},V.isFinite=function(){return!!this.d},V.isInteger=V.isInt=function(){return!!this.d&&L(this.e/7)>this.d.length-2},V.isNaN=function(){return!this.s},V.isNegative=V.isNeg=function(){return this.s<0},V.isPositive=V.isPos=function(){return this.s>0},V.isZero=function(){return!!this.d&&0===this.d[0]},V.lessThan=V.lt=function(n){return this.cmp(n)<0},V.lessThanOrEqualTo=V.lte=function(n){return this.cmp(n)<1},V.logarithm=V.log=function(n){var e,i,t,r,o,s,u,c,a=this,f=a.constructor,d=f.precision,l=f.rounding;if(null==n)n=new f(10),e=!0;else{if(i=(n=new f(n)).d,n.s<0||!i||!i[0]||n.eq(1))return new f(NaN);e=n.eq(10)}if(i=a.d,a.s<0||!i||!i[0]||a.eq(1))return new f(i&&!i[0]?-1/0:1!=a.s?NaN:i?0:1/0);if(e)if(i.length>1)o=!0;else{for(r=i[0];r%10==0;)r/=10;o=1!==r}if(D=!1,s=an(a,u=d+5),t=e?nn(f,u+10):an(n,u),z((c=K(s,t,u,1)).d,r=d,l))do{if(s=an(a,u+=10),t=e?nn(f,u+10):an(n,u),c=K(s,t,u,1),!o){+$(c.d).slice(r+1,r+15)+1==1e14&&(c=Q(c,d+1,0));break}}while(z(c.d,r+=10,l));return D=!0,Q(c,d,l)},V.minus=V.sub=function(n){var e,i,t,r,o,s,u,c,a,f,d,l,h=this,g=h.constructor;if(n=new g(n),!h.d||!n.d)return h.s&&n.s?h.d?n.s=-n.s:n=new g(n.d||h.s!==n.s?h:NaN):n=new g(NaN),n;if(h.s!=n.s)return n.s=-n.s,h.plus(n);if(a=h.d,l=n.d,u=g.precision,c=g.rounding,!a[0]||!l[0]){if(l[0])n.s=-n.s;else{if(!a[0])return new g(3===c?-0:0);n=new g(h)}return D?Q(n,u,c):n}if(i=L(n.e/7),f=L(h.e/7),a=a.slice(),o=f-i){for((d=o<0)?(e=a,o=-o,s=l.length):(e=l,i=f,s=a.length),o>(t=Math.max(Math.ceil(u/7),s)+2)&&(o=t,e.length=1),e.reverse(),t=o;t--;)e.push(0);e.reverse()}else{for((d=(t=a.length)<(s=l.length))&&(s=t),t=0;t<s;t++)if(a[t]!=l[t]){d=a[t]<l[t];break}o=0}for(d&&(e=a,a=l,l=e,n.s=-n.s),s=a.length,t=l.length-s;t>0;--t)a[s++]=0;for(t=l.length;t>o;){if(a[--t]<l[t]){for(r=t;r&&0===a[--r];)a[r]=B-1;--a[r],a[t]+=B}a[t]-=l[t]}for(;0===a[--s];)a.pop();for(;0===a[0];a.shift())--i;return a[0]?(n.d=a,n.e=Y(a,i),D?Q(n,u,c):n):new g(3===c?-0:0)},V.modulo=V.mod=function(n){var e,i=this,t=i.constructor;return n=new t(n),!i.d||!n.s||n.d&&!n.d[0]?new t(NaN):!n.d||i.d&&!i.d[0]?Q(new t(i),t.precision,t.rounding):(D=!1,9==t.modulo?(e=K(i,n.abs(),0,3,1)).s*=n.s:e=K(i,n,0,t.modulo,1),e=e.times(n),D=!0,i.minus(e))},V.naturalExponential=V.exp=function(){return cn(this)},V.naturalLogarithm=V.ln=function(){return an(this)},V.negated=V.neg=function(){var n=new this.constructor(this);return n.s=-n.s,Q(n)},V.plus=V.add=function(n){var e,i,t,r,o,s,u,c,a,f,d=this,l=d.constructor;if(n=new l(n),!d.d||!n.d)return d.s&&n.s?d.d||(n=new l(n.d||d.s===n.s?d:NaN)):n=new l(NaN),n;if(d.s!=n.s)return n.s=-n.s,d.minus(n);if(a=d.d,f=n.d,u=l.precision,c=l.rounding,!a[0]||!f[0])return f[0]||(n=new l(d)),D?Q(n,u,c):n;if(o=L(d.e/7),t=L(n.e/7),a=a.slice(),r=o-t){for(r<0?(i=a,r=-r,s=f.length):(i=f,t=o,s=a.length),r>(s=(o=Math.ceil(u/7))>s?o+1:s+1)&&(r=s,i.length=1),i.reverse();r--;)i.push(0);i.reverse()}for((s=a.length)-(r=f.length)<0&&(r=s,i=f,f=a,a=i),e=0;r;)e=(a[--r]=a[r]+f[r]+e)/B|0,a[r]%=B;for(e&&(a.unshift(e),++t),s=a.length;0==a[--s];)a.pop();return n.d=a,n.e=Y(a,t),D?Q(n,u,c):n},V.precision=V.sd=function(n){var e,i=this;if(void 0!==n&&n!==!!n&&1!==n&&0!==n)throw Error(R+n);return i.d?(e=tn(i.d),n&&i.e+1>e&&(e=i.e+1)):e=NaN,e},V.round=function(){var n=this,e=n.constructor;return Q(new e(n),n.e+1,e.rounding)},V.sine=V.sin=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+Math.max(i.e,i.sd())+7,t.rounding=1,i=function(n,e){var i,t=e.d.length;if(t<3)return e.isZero()?e:hn(n,2,e,e);i=(i=1.4*Math.sqrt(t))>16?16:0|i,e=hn(n,2,e=e.times(1/gn(5,i)),e);for(var r,o=new n(5),s=new n(16),u=new n(20);i--;)r=e.times(e),e=e.times(o.plus(r.times(s.times(r).minus(u))));return e}(t,pn(t,i)),t.precision=n,t.rounding=e,Q(x>2?i.neg():i,n,e,!0)):new t(NaN)},V.squareRoot=V.sqrt=function(){var n,e,i,t,r,o,s=this,u=s.d,c=s.e,a=s.s,f=s.constructor;if(1!==a||!u||!u[0])return new f(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);for(D=!1,0==(a=Math.sqrt(+s))||a==1/0?(((e=$(u)).length+c)%2==0&&(e+="0"),a=Math.sqrt(e),c=L((c+1)/2)-(c<0||c%2),t=new f(e=a==1/0?"5e"+c:(e=a.toExponential()).slice(0,e.indexOf("e")+1)+c)):t=new f(a.toString()),i=(c=f.precision)+3;;)if(t=(o=t).plus(K(s,o,i+2,1)).times(.5),$(o.d).slice(0,i)===(e=$(t.d)).slice(0,i)){if("9999"!=(e=e.slice(i-3,i+1))&&(r||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Q(t,c+1,1),n=!t.times(t).eq(s));break}if(!r&&(Q(o,c+1,0),o.times(o).eq(s))){t=o;break}i+=4,r=1}return D=!0,Q(t,c,f.rounding,n)},V.tangent=V.tan=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+10,t.rounding=1,(i=i.sin()).s=1,i=K(i,new t(1).minus(i.times(i)).sqrt(),n+10,0),t.precision=n,t.rounding=e,Q(2==x||4==x?i.neg():i,n,e,!0)):new t(NaN)},V.times=V.mul=function(n){var e,i,t,r,o,s,u,c,a,f=this,d=f.constructor,l=f.d,h=(n=new d(n)).d;if(n.s*=f.s,!(l&&l[0]&&h&&h[0]))return new d(!n.s||l&&!l[0]&&!h||h&&!h[0]&&!l?NaN:l&&h?0*n.s:n.s/0);for(i=L(f.e/7)+L(n.e/7),(c=l.length)<(a=h.length)&&(o=l,l=h,h=o,s=c,c=a,a=s),o=[],t=s=c+a;t--;)o.push(0);for(t=a;--t>=0;){for(e=0,r=c+t;r>t;)u=o[r]+h[t]*l[r-t-1]+e,o[r--]=u%B|0,e=u/B|0;o[r]=(o[r]+e)%B|0}for(;!o[--s];)o.pop();return e?++i:o.shift(),n.d=o,n.e=Y(o,i),D?Q(n,d.precision,d.rounding):n},V.toBinary=function(n,e){return mn(this,2,n,e)},V.toDecimalPlaces=V.toDP=function(n,e){var i=this,t=i.constructor;return i=new t(i),void 0===n?i:(W(n,0,M),void 0===e?e=t.rounding:W(e,0,8),Q(i,n+i.e+1,e))},V.toExponential=function(n,e){var i,t=this,r=t.constructor;return void 0===n?i=X(t,!0):(W(n,0,M),void 0===e?e=r.rounding:W(e,0,8),i=X(t=Q(new r(t),n+1,e),!0,n+1)),t.isNeg()&&!t.isZero()?"-"+i:i},V.toFixed=function(n,e){var i,t,r=this,o=r.constructor;return void 0===n?i=X(r):(W(n,0,M),void 0===e?e=o.rounding:W(e,0,8),i=X(t=Q(new o(r),n+r.e+1,e),!1,n+t.e+1)),r.isNeg()&&!r.isZero()?"-"+i:i},V.toFraction=function(n){var e,i,t,r,o,s,u,c,a,f,d,l,h=this,g=h.d,p=h.constructor;if(!g)return new p(h);if(a=i=new p(1),t=c=new p(0),s=(o=(e=new p(t)).e=tn(g)-h.e-1)%7,e.d[0]=k(10,s<0?7+s:s),null==n)n=o>0?e:a;else{if(!(u=new p(n)).isInt()||u.lt(a))throw Error(R+u);n=u.gt(e)?o>0?e:a:u}for(D=!1,u=new p($(g)),f=p.precision,p.precision=o=7*g.length*2;d=K(u,e,0,1,1),1!=(r=i.plus(d.times(t))).cmp(n);)i=t,t=r,r=a,a=c.plus(d.times(r)),c=r,r=e,e=u.minus(d.times(r)),u=r;return r=K(n.minus(i),t,0,1,1),c=c.plus(r.times(a)),i=i.plus(r.times(t)),c.s=a.s=h.s,l=K(a,t,o,1).minus(h).abs().cmp(K(c,i,o,1).minus(h).abs())<1?[a,t]:[c,i],p.precision=f,D=!0,l},V.toHexadecimal=V.toHex=function(n,e){return mn(this,16,n,e)},V.toNearest=function(n,e){var i=this,t=i.constructor;if(i=new t(i),null==n){if(!i.d)return i;n=new t(1),e=t.rounding}else{if(n=new t(n),void 0===e?e=t.rounding:W(e,0,8),!i.d)return n.s?i:n;if(!n.d)return n.s&&(n.s=i.s),n}return n.d[0]?(D=!1,i=K(i,n,0,e,1).times(n),D=!0,Q(i)):(n.s=i.s,i=n),i},V.toNumber=function(){return+this},V.toOctal=function(n,e){return mn(this,8,n,e)},V.toPower=V.pow=function(n){var e,i,t,r,o,s,u=this,c=u.constructor,a=+(n=new c(n));if(!(u.d&&n.d&&u.d[0]&&n.d[0]))return new c(k(+u,a));if((u=new c(u)).eq(1))return u;if(t=c.precision,o=c.rounding,n.eq(1))return Q(u,t,o);if((e=L(n.e/7))>=n.d.length-1&&(i=a<0?-a:a)<=9007199254740991)return r=on(c,u,i,t),n.s<0?new c(1).div(r):Q(r,t,o);if((s=u.s)<0){if(e<n.d.length-1)return new c(NaN);if(0==(1&n.d[e])&&(s=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=s,u}return(e=0!=(i=k(+u,a))&&isFinite(i)?new c(i+"").e:L(a*(Math.log("0."+$(u.d))/Math.LN10+u.e+1)))>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(D=!1,c.rounding=u.s=1,i=Math.min(12,(e+"").length),(r=cn(n.times(an(u,t+i)),t)).d&&z((r=Q(r,t+5,1)).d,t,o)&&(e=t+10,+$((r=Q(cn(n.times(an(u,e+i)),e),e+5,1)).d).slice(t+1,t+15)+1==1e14&&(r=Q(r,t+1,0))),r.s=s,D=!0,c.rounding=o,Q(r,t,o))},V.toPrecision=function(n,e){var i,t=this,r=t.constructor;return void 0===n?i=X(t,t.e<=r.toExpNeg||t.e>=r.toExpPos):(W(n,1,M),void 0===e?e=r.rounding:W(e,0,8),i=X(t=Q(new r(t),n,e),n<=t.e||t.e<=r.toExpNeg,n)),t.isNeg()&&!t.isZero()?"-"+i:i},V.toSignificantDigits=V.toSD=function(n,e){var i=this.constructor;return void 0===n?(n=i.precision,e=i.rounding):(W(n,1,M),void 0===e?e=i.rounding:W(e,0,8)),Q(new i(this),n,e)},V.toString=function(){var n=this,e=n.constructor,i=X(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()&&!n.isZero()?"-"+i:i},V.truncated=V.trunc=function(){return Q(new this.constructor(this),this.e+1,1)},V.valueOf=V.toJSON=function(){var n=this,e=n.constructor,i=X(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()?"-"+i:i};var K=function(){function n(n,e,i){var t,r=0,o=n.length;for(n=n.slice();o--;)t=n[o]*e+r,n[o]=t%i|0,r=t/i|0;return r&&n.unshift(r),n}function e(n,e,i,t){var r,o;if(i!=t)o=i>t?1:-1;else for(r=o=0;r<i;r++)if(n[r]!=e[r]){o=n[r]>e[r]?1:-1;break}return o}function i(n,e,i,t){for(var r=0;i--;)n[i]-=r,r=n[i]<e[i]?1:0,n[i]=r*t+n[i]-e[i];for(;!n[0]&&n.length>1;)n.shift()}return function(t,r,o,s,u,c){var a,f,d,l,h,g,p,m,w,v,N,y,E,x,P,M,O,S,T,A,D=t.constructor,q=t.s==r.s?1:-1,R=t.d,F=r.d;if(!(R&&R[0]&&F&&F[0]))return new D(t.s&&r.s&&(R?!F||R[0]!=F[0]:F)?R&&0==R[0]||!F?0*q:q/0:NaN);for(c?(h=1,f=t.e-r.e):(c=B,h=7,f=L(t.e/h)-L(r.e/h)),T=F.length,O=R.length,v=(w=new D(q)).d=[],d=0;F[d]==(R[d]||0);d++);if(F[d]>(R[d]||0)&&f--,null==o?(x=o=D.precision,s=D.rounding):x=u?o+(t.e-r.e)+1:o,x<0)v.push(1),g=!0;else{if(x=x/h+2|0,d=0,1==T){for(l=0,F=F[0],x++;(d<O||l)&&x--;d++)P=l*c+(R[d]||0),v[d]=P/F|0,l=P%F|0;g=l||d<O}else{for((l=c/(F[0]+1)|0)>1&&(F=n(F,l,c),R=n(R,l,c),T=F.length,O=R.length),M=T,y=(N=R.slice(0,T)).length;y<T;)N[y++]=0;(A=F.slice()).unshift(0),S=F[0],F[1]>=c/2&&++S;do{l=0,(a=e(F,N,T,y))<0?(E=N[0],T!=y&&(E=E*c+(N[1]||0)),(l=E/S|0)>1?(l>=c&&(l=c-1),1==(a=e(p=n(F,l,c),N,m=p.length,y=N.length))&&(l--,i(p,T<m?A:F,m,c))):(0==l&&(a=l=1),p=F.slice()),(m=p.length)<y&&p.unshift(0),i(N,p,y,c),-1==a&&(a=e(F,N,T,y=N.length))<1&&(l++,i(N,T<y?A:F,y,c)),y=N.length):0===a&&(l++,N=[0]),v[d++]=l,a&&N[0]?N[y++]=R[M]||0:(N=[R[M]],y=1)}while((M++<O||void 0!==N[0])&&x--);g=void 0!==N[0]}v[0]||v.shift()}if(1==h)w.e=f,b=g;else{for(d=1,l=v[0];l>=10;l/=10)d++;w.e=d+f*h-1,Q(w,u?o+w.e+1:o,s,g)}return w}}();function Q(n,e,i,t){var r,o,s,u,c,a,f,d,l,h=n.constructor;n:if(null!=e){if(!(d=n.d))return n;for(r=1,u=d[0];u>=10;u/=10)r++;if((o=e-r)<0)o+=7,s=e,c=(f=d[l=0])/k(10,r-s-1)%10|0;else if((l=Math.ceil((o+1)/7))>=(u=d.length)){if(!t)break n;for(;u++<=l;)d.push(0);f=c=0,r=1,s=(o%=7)-7+1}else{for(f=u=d[l],r=1;u>=10;u/=10)r++;c=(s=(o%=7)-7+r)<0?0:f/k(10,r-s-1)%10|0}if(t=t||e<0||void 0!==d[l+1]||(s<0?f:f%k(10,r-s-1)),a=i<4?(c||t)&&(0==i||i==(n.s<0?3:2)):c>5||5==c&&(4==i||t||6==i&&(o>0?s>0?f/k(10,r-s):0:d[l-1])%10&1||i==(n.s<0?8:7)),e<1||!d[0])return d.length=0,a?(e-=n.e+1,d[0]=k(10,(7-e%7)%7),n.e=-e||0):d[0]=n.e=0,n;if(0==o?(d.length=l,u=1,l--):(d.length=l+1,u=k(10,7-o),d[l]=s>0?(f/k(10,r-s)%k(10,s)|0)*u:0),a)for(;;){if(0==l){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(n.e++,d[0]==B&&(d[0]=1));break}if(d[l]+=u,d[l]!=B)break;d[l--]=0,u=1}for(o=d.length;0===d[--o];)d.pop()}return D&&(n.e>h.maxE?(n.d=null,n.e=NaN):n.e<h.minE&&(n.e=0,n.d=[0])),n}function X(n,e,i){if(!n.isFinite())return fn(n);var t,r=n.e,o=$(n.d),s=o.length;return e?(i&&(t=i-s)>0?o=o.charAt(0)+"."+o.slice(1)+rn(t):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(n.e<0?"e":"e+")+n.e):r<0?(o="0."+rn(-r-1)+o,i&&(t=i-s)>0&&(o+=rn(t))):r>=s?(o+=rn(r+1-s),i&&(t=i-r-1)>0&&(o=o+"."+rn(t))):((t=r+1)<s&&(o=o.slice(0,t)+"."+o.slice(t)),i&&(t=i-s)>0&&(r+1===s&&(o+="."),o+=rn(t))),o}function Y(n,e){var i=n[0];for(e*=7;i>=10;i/=10)e++;return e}function nn(n,e,i){if(e>j)throw D=!0,i&&(n.precision=i),Error(F);return Q(new n(S),e,1,!0)}function en(n,e,i){if(e>G)throw Error(F);return Q(new n(T),e,i,!0)}function tn(n){var e=n.length-1,i=7*e+1;if(e=n[e]){for(;e%10==0;e/=10)i--;for(e=n[0];e>=10;e/=10)i++}return i}function rn(n){for(var e="";n--;)e+="0";return e}function on(n,e,i,t){var r,o=new n(1),s=Math.ceil(t/7+4);for(D=!1;;){if(i%2&&wn((o=o.times(e)).d,s)&&(r=!0),0===(i=L(i/2))){i=o.d.length-1,r&&0===o.d[i]&&++o.d[i];break}wn((e=e.times(e)).d,s)}return D=!0,o}function sn(n){return 1&n.d[n.d.length-1]}function un(n,e,i){for(var t,r=new n(e[0]),o=0;++o<e.length;){if(!(t=new n(e[o])).s){r=t;break}r[i](t)&&(r=t)}return r}function cn(n,e){var i,t,r,o,s,u,c,a=0,f=0,d=0,l=n.constructor,h=l.rounding,g=l.precision;if(!n.d||!n.d[0]||n.e>17)return new l(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==e?(D=!1,c=g):c=e,u=new l(.03125);n.e>-2;)n=n.times(u),d+=5;for(c+=t=Math.log(k(2,d))/Math.LN10*2+5|0,i=o=s=new l(1),l.precision=c;;){if(o=Q(o.times(n),c,1),i=i.times(++f),$((u=s.plus(K(o,i,c,1))).d).slice(0,c)===$(s.d).slice(0,c)){for(r=d;r--;)s=Q(s.times(s),c,1);if(null!=e)return l.precision=g,s;if(!(a<3&&z(s.d,c-t,h,a)))return Q(s,l.precision=g,h,D=!0);l.precision=c+=10,i=o=u=new l(1),f=0,a++}s=u}}function an(n,e){var i,t,r,o,s,u,c,a,f,d,l,h=1,g=n,p=g.d,m=g.constructor,w=m.rounding,v=m.precision;if(g.s<0||!p||!p[0]||!g.e&&1==p[0]&&1==p.length)return new m(p&&!p[0]?-1/0:1!=g.s?NaN:p?0:g);if(null==e?(D=!1,f=v):f=e,m.precision=f+=10,t=(i=$(p)).charAt(0),!(Math.abs(o=g.e)<15e14))return a=nn(m,f+2,v).times(o+""),g=an(new m(t+"."+i.slice(1)),f-10).plus(a),m.precision=v,null==e?Q(g,v,w,D=!0):g;for(;t<7&&1!=t||1==t&&i.charAt(1)>3;)t=(i=$((g=g.times(n)).d)).charAt(0),h++;for(o=g.e,t>1?(g=new m("0."+i),o++):g=new m(t+"."+i.slice(1)),d=g,c=s=g=K(g.minus(1),g.plus(1),f,1),l=Q(g.times(g),f,1),r=3;;){if(s=Q(s.times(l),f,1),$((a=c.plus(K(s,new m(r),f,1))).d).slice(0,f)===$(c.d).slice(0,f)){if(c=c.times(2),0!==o&&(c=c.plus(nn(m,f+2,v).times(o+""))),c=K(c,new m(h),f,1),null!=e)return m.precision=v,c;if(!z(c.d,f-10,w,u))return Q(c,m.precision=v,w,D=!0);m.precision=f+=10,a=s=g=K(d.minus(1),d.plus(1),f,1),l=Q(g.times(g),f,1),r=u=1}c=a,r+=2}}function fn(n){return String(n.s*n.s/0)}function dn(n,e){var i,t,r;for((i=e.indexOf("."))>-1&&(e=e.replace(".","")),(t=e.search(/e/i))>0?(i<0&&(i=t),i+=+e.slice(t+1),e=e.substring(0,t)):i<0&&(i=e.length),t=0;48===e.charCodeAt(t);t++);for(r=e.length;48===e.charCodeAt(r-1);--r);if(e=e.slice(t,r)){if(r-=t,n.e=i=i-t-1,n.d=[],t=(i+1)%7,i<0&&(t+=7),t<r){for(t&&n.d.push(+e.slice(0,t)),r-=7;t<r;)n.d.push(+e.slice(t,t+=7));t=7-(e=e.slice(t)).length}else t-=r;for(;t--;)e+="0";n.d.push(+e),D&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function ln(n,e){var i,t,r,o,s,u,c,a,f;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),_.test(e))return dn(n,e)}else if("Infinity"===e||"NaN"===e)return+e||(n.s=NaN),n.e=NaN,n.d=null,n;if(Z.test(e))i=16,e=e.toLowerCase();else if(U.test(e))i=2;else{if(!H.test(e))throw Error(R+e);i=8}for((o=e.search(/p/i))>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),s=(o=e.indexOf("."))>=0,t=n.constructor,s&&(o=(u=(e=e.replace(".","")).length)-o,r=on(t,new t(i),o,2*o)),o=f=(a=J(e,i,B)).length-1;0===a[o];--o)a.pop();return o<0?new t(0*n.s):(n.e=Y(a,f),n.d=a,D=!1,s&&(n=K(n,r,4*u)),c&&(n=n.times(Math.abs(c)<54?k(2,c):re.pow(2,c))),D=!0,n)}function hn(n,e,i,t,r){var o,s,u,c,a=n.precision,f=Math.ceil(a/7);for(D=!1,c=i.times(i),u=new n(t);;){if(s=K(u.times(c),new n(e++*e++),a,1),u=r?t.plus(s):t.minus(s),t=K(s.times(c),new n(e++*e++),a,1),void 0!==(s=u.plus(t)).d[f]){for(o=f;s.d[o]===u.d[o]&&o--;);if(-1==o)break}o=u,u=t,t=s,s=o}return D=!0,s.d.length=f+1,s}function gn(n,e){for(var i=n;--e;)i*=n;return i}function pn(n,e){var i,t=e.s<0,r=en(n,n.precision,1),o=r.times(.5);if((e=e.abs()).lte(o))return x=t?4:1,e;if((i=e.divToInt(r)).isZero())x=t?3:2;else{if((e=e.minus(i.times(r))).lte(o))return x=sn(i)?t?2:3:t?4:1,e;x=sn(i)?t?1:4:t?3:2}return e.minus(r).abs()}function mn(n,e,i,t){var r,o,s,u,c,a,f,d,l,h=n.constructor,g=void 0!==i;if(g?(W(i,1,M),void 0===t?t=h.rounding:W(t,0,8)):(i=h.precision,t=h.rounding),n.isFinite()){for(g?(r=2,16==e?i=4*i-3:8==e&&(i=3*i-2)):r=e,(s=(f=X(n)).indexOf("."))>=0&&(f=f.replace(".",""),(l=new h(1)).e=f.length-s,l.d=J(X(l),10,r),l.e=l.d.length),o=c=(d=J(f,10,r)).length;0==d[--c];)d.pop();if(d[0]){if(s<0?o--:((n=new h(n)).d=d,n.e=o,d=(n=K(n,l,i,t,0,r)).d,o=n.e,a=b),s=d[i],u=r/2,a=a||void 0!==d[i+1],a=t<4?(void 0!==s||a)&&(0===t||t===(n.s<0?3:2)):s>u||s===u&&(4===t||a||6===t&&1&d[i-1]||t===(n.s<0?8:7)),d.length=i,a)for(;++d[--i]>r-1;)d[i]=0,i||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,f="";s<c;s++)f+=O.charAt(d[s]);if(g){if(c>1)if(16==e||8==e){for(s=16==e?4:3,--c;c%s;c++)f+="0";for(c=(d=J(f,r,e)).length;!d[c-1];--c);for(s=1,f="1.";s<c;s++)f+=O.charAt(d[s])}else f=f.charAt(0)+"."+f.slice(1);f=f+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)f="0"+f;f="0."+f}else if(++o>c)for(o-=c;o--;)f+="0";else o<c&&(f=f.slice(0,o)+"."+f.slice(o))}else f=g?"0p+0":"0";f=(16==e?"0x":2==e?"0b":8==e?"0o":"")+f}else f=fn(n);return n.s<0?"-"+f:f}function wn(n,e){if(n.length>e)return n.length=e,!0}function vn(n){return new this(n).abs()}function Nn(n){return new this(n).acos()}function yn(n){return new this(n).acosh()}function En(n,e){return new this(n).plus(e)}function bn(n){return new this(n).asin()}function xn(n){return new this(n).asinh()}function Pn(n){return new this(n).atan()}function Mn(n){return new this(n).atanh()}function On(n,e){n=new this(n),e=new this(e);var i,t=this.precision,r=this.rounding,o=t+4;return n.s&&e.s?n.d||e.d?!e.d||n.isZero()?(i=e.s<0?en(this,t,r):new this(0)).s=n.s:!n.d||e.isZero()?(i=en(this,o,1).times(.5)).s=n.s:e.s<0?(this.precision=o,this.rounding=1,i=this.atan(K(n,e,o,1)),e=en(this,o,1),this.precision=t,this.rounding=r,i=n.s<0?i.minus(e):i.plus(e)):i=this.atan(K(n,e,o,1)):(i=en(this,o,1).times(e.s>0?.25:.75)).s=n.s:i=new this(NaN),i}function Sn(n){return new this(n).cbrt()}function Tn(n){return Q(n=new this(n),n.e+1,2)}function An(n,e,i){return new this(n).clamp(e,i)}function Dn(n){if(!n||"object"!=typeof n)throw Error(q+"Object expected");var e,i,t,r=!0===n.defaults,o=["precision",1,M,"rounding",0,8,"toExpNeg",-P,0,"toExpPos",0,P,"maxE",0,P,"minE",-P,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(i=o[e],r&&(this[i]=A[i]),void 0!==(t=n[i])){if(!(L(t)===t&&t>=o[e+1]&&t<=o[e+2]))throw Error(R+i+": "+t);this[i]=t}if(i="crypto",r&&(this[i]=A[i]),void 0!==(t=n[i])){if(!0!==t&&!1!==t&&0!==t&&1!==t)throw Error(R+i+": "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(C);this[i]=!0}else this[i]=!1}return this}function qn(n){return new this(n).cos()}function Rn(n){return new this(n).cosh()}function Fn(n,e){return new this(n).div(e)}function Cn(n){return new this(n).exp()}function In(n){return Q(n=new this(n),n.e+1,3)}function Ln(){var n,e,i=new this(0);for(D=!1,n=0;n<arguments.length;)if((e=new this(arguments[n++])).d)i.d&&(i=i.plus(e.times(e)));else{if(e.s)return D=!0,new this(1/0);i=e}return D=!0,i.sqrt()}function kn(n){return n instanceof re||n&&n.toStringTag===I||!1}function Un(n){return new this(n).ln()}function Zn(n,e){return new this(n).log(e)}function Hn(n){return new this(n).log(2)}function _n(n){return new this(n).log(10)}function Bn(){return un(this,arguments,"lt")}function jn(){return un(this,arguments,"gt")}function Gn(n,e){return new this(n).mod(e)}function Vn(n,e){return new this(n).mul(e)}function $n(n,e){return new this(n).pow(e)}function Wn(n){var e,i,t,r,o=0,s=new this(1),u=[];if(void 0===n?n=this.precision:W(n,1,M),t=Math.ceil(n/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(t));o<t;)(r=e[o])>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=r%1e7;else{if(!crypto.randomBytes)throw Error(C);for(e=crypto.randomBytes(t*=4);o<t;)(r=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((127&e[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,o):(u.push(r%1e7),o+=4);o=t/4}else for(;o<t;)u[o++]=1e7*Math.random()|0;for(n%=7,(t=u[--o])&&n&&(r=k(10,7-n),u[o]=(t/r|0)*r);0===u[o];o--)u.pop();if(o<0)i=0,u=[0];else{for(i=-1;0===u[0];i-=7)u.shift();for(t=1,r=u[0];r>=10;r/=10)t++;t<7&&(i-=7-t)}return s.e=i,s.d=u,s}function zn(n){return Q(n=new this(n),n.e+1,this.rounding)}function Jn(n){return(n=new this(n)).d?n.d[0]?n.s:0*n.s:n.s||NaN}function Kn(n){return new this(n).sin()}function Qn(n){return new this(n).sinh()}function Xn(n){return new this(n).sqrt()}function Yn(n,e){return new this(n).sub(e)}function ne(){var n=0,e=arguments,i=new this(e[n]);for(D=!1;i.s&&++n<e.length;)i=i.plus(e[n]);return D=!0,Q(i,this.precision,this.rounding)}function ee(n){return new this(n).tan()}function ie(n){return new this(n).tanh()}function te(n){return Q(n=new this(n),n.e+1,1)}V[Symbol.for("nodejs.util.inspect.custom")]=V.toString,V[Symbol.toStringTag]="Decimal";var re=V.constructor=function n(e){var i,t,r;function o(n){var e,i,t,r=this;if(!(r instanceof o))return new o(n);if(r.constructor=o,kn(n))return r.s=n.s,void(D?!n.d||n.e>o.maxE?(r.e=NaN,r.d=null):n.e<o.minE?(r.e=0,r.d=[0]):(r.e=n.e,r.d=n.d.slice()):(r.e=n.e,r.d=n.d?n.d.slice():n.d));if("number"==(t=typeof n)){if(0===n)return r.s=1/n<0?-1:1,r.e=0,void(r.d=[0]);if(n<0?(n=-n,r.s=-1):r.s=1,n===~~n&&n<1e7){for(e=0,i=n;i>=10;i/=10)e++;return void(D?e>o.maxE?(r.e=NaN,r.d=null):e<o.minE?(r.e=0,r.d=[0]):(r.e=e,r.d=[n]):(r.e=e,r.d=[n]))}return 0*n!=0?(n||(r.s=NaN),r.e=NaN,void(r.d=null)):dn(r,n.toString())}if("string"!==t)throw Error(R+n);return 45===(i=n.charCodeAt(0))?(n=n.slice(1),r.s=-1):(43===i&&(n=n.slice(1)),r.s=1),_.test(n)?dn(r,n):ln(r,n)}if(o.prototype=V,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=Dn,o.clone=n,o.isDecimal=kn,o.abs=vn,o.acos=Nn,o.acosh=yn,o.add=En,o.asin=bn,o.asinh=xn,o.atan=Pn,o.atanh=Mn,o.atan2=On,o.cbrt=Sn,o.ceil=Tn,o.clamp=An,o.cos=qn,o.cosh=Rn,o.div=Fn,o.exp=Cn,o.floor=In,o.hypot=Ln,o.ln=Un,o.log=Zn,o.log10=_n,o.log2=Hn,o.max=Bn,o.min=jn,o.mod=Gn,o.mul=Vn,o.pow=$n,o.random=Wn,o.round=zn,o.sign=Jn,o.sin=Kn,o.sinh=Qn,o.sqrt=Xn,o.sub=Yn,o.sum=ne,o.tan=ee,o.tanh=ie,o.trunc=te,void 0===e&&(e={}),e&&!0!==e.defaults)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<r.length;)e.hasOwnProperty(t=r[i++])||(e[t]=this[t]);return o.config(e),o}(A);S=new re(S),T=new re(T);const oe=re,se=n=>new oe(n).toDecimalPlaces(2).toNumber();module.exports=e})();
1
+ (()=>{"use strict";var e={n:n=>{var t=n&&n.__esModule?()=>n.default:()=>n;return e.d(t,{a:t}),t},d:(n,t)=>{for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};let t,o,a,r;e.r(n),e.d(n,{EBookingPaymentMethod:()=>o,ECompanyProvider:()=>c,EDistanceUnitType:()=>d,EGuarantyPolicyPrepaymentType:()=>m,EHotelCardProcessor:()=>a,EHotelPriceModel:()=>l,EHotelStateFieldConfiguration:()=>u,EHotelWeekdayStartsOn:()=>y,EIntegration:()=>g,EPlanpayBookingStatus:()=>r,ERMSDiscountType:()=>P,ERoomstayImageSize:()=>p,HttpMethod:()=>f,IAuxiliaryFilterType:()=>s,IBookingStatus:()=>t,PCIBookingCardProcessorTypes:()=>i,calculateTotalForMemberBooking:()=>T,nameof:()=>O,resizeRoomstayImageUrl:()=>E,roundMoney:()=>h,subset:()=>C,uppercaseString:()=>S}),function(e){e.Pending="Pending",e.Committed="Committed",e.Cancelled="Cancelled"}(t||(t={})),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.PCIBookingCard="PCIBookingCard"}(o||(o={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave"}(a||(a={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(r||(r={}));const i=[];let c,d,l,u,y,s,g,P,p,m,f;function S(e){return e.toUpperCase()}!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay"}(c||(c={})),function(e){e.Metric="metric",e.Imperial="imperial"}(d||(d={})),function(e){e.PerPerson="PerPerson",e.PerDay="PerDay",e.PerOccupancy="PerOccupancy"}(l||(l={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(u||(u={})),function(e){e.Monday="monday",e.Sunday="sunday"}(y||(y={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(s||(s={})),function(e){e.Big4="Big4",e.Top10="Top10",e.Gday="Gday",e.Salesforce="Salesforce"}(g||(g={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(P||(P={})),function(e){e[e.Icon=128]="Icon",e[e.Tiny=256]="Tiny",e[e.Small=512]="Small",e[e.Medium=768]="Medium",e[e.Large=1024]="Large",e[e.ExtraLarge=1600]="ExtraLarge"}(p||(p={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(m||(m={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(f||(f={}));const T=e=>{let n=0;const t=Object.values(e.itinerary);for(const e of t){const t=Object.keys(e.nights);for(const o of t)n+=e.nights[o].total}return n},E=(e,n)=>e.includes("cdn.app.roomstay.io")?e+"?w="+n:e,O=e=>e,C=(e,n)=>{const t={};return n.forEach((n=>{n in e&&(t[n]=e[n])})),t},A=require("decimal.js");var M=e.n(A);const h=e=>new(M())(e).toDecimalPlaces(2).toNumber();module.exports=n})();
@@ -2,16 +2,22 @@ export declare enum EBookingPaymentMethod {
2
2
  Card = "Card",
3
3
  SavedCard = "SavedCard",
4
4
  Planpay = "Planpay",
5
- Adyen = "Adyen"
5
+ Adyen = "Adyen",
6
+ PCIBookingCard = "PCIBookingCard"
6
7
  }
7
8
  /**
8
- * This enum decides what the function of the default payment input is (additionals like Planpay, or perhaps crypto in the future are other options, this only governs the default card input)
9
+ * This enum is used to determine which payment processor to use for the booking.
10
+ *
11
+ * Usually only applies if the payment method is Card, SavedCard, or PCIBookingCard.
12
+ *
13
+ * Other payment methods will generate their own checkout flow that will differ from this.
9
14
  */
10
15
  export declare enum EHotelCardProcessor {
11
16
  Passthrough = "Passthrough",
12
17
  Adyen = "Adyen",
13
18
  Till = "Till",
14
- RMSPay = "RMSPay"
19
+ RMSPay = "RMSPay",
20
+ Windcave = "Windcave"
15
21
  }
16
22
  export declare enum EPlanpayBookingStatus {
17
23
  Unknown = "unknown",
@@ -21,6 +27,8 @@ export declare enum EPlanpayBookingStatus {
21
27
  Refunded = "refunded",
22
28
  Rejected = "rejected"
23
29
  }
30
+ export declare const PCIBookingCardProcessorTypes: any[];
31
+ export type PCIBookingCardProcessorType = undefined;
24
32
  export type IBookingPaymentTokenizedCard = {
25
33
  Type: string;
26
34
  Number: string;
@@ -28,6 +36,22 @@ export type IBookingPaymentTokenizedCard = {
28
36
  CVV: string;
29
37
  Name: string;
30
38
  };
39
+ export type EHotelCardProcessorInitData = {
40
+ [EHotelCardProcessor.Passthrough]: undefined;
41
+ [EHotelCardProcessor.Adyen]: undefined;
42
+ [EHotelCardProcessor.RMSPay]: undefined;
43
+ [EHotelCardProcessor.Till]: undefined;
44
+ [EHotelCardProcessor.Windcave]: {
45
+ redirectUrl: string;
46
+ paymentId: string;
47
+ roomstayId: string;
48
+ };
49
+ };
50
+ type IPCIBookingCardNotificationData = {
51
+ CaptureCardRequestID: string;
52
+ CaptureCardRequestStatus: string;
53
+ CardUri: string;
54
+ };
31
55
  /**
32
56
  * Booking payment attached to a booking.
33
57
  *
@@ -38,5 +62,7 @@ export type IBookingPayment = {
38
62
  SavedCardID?: string;
39
63
  PlanpayCheckoutId?: string;
40
64
  PaymentCard?: IBookingPaymentTokenizedCard;
65
+ PCICardDetails?: IPCIBookingCardNotificationData;
41
66
  RedirectUrl?: string;
42
67
  };
68
+ export {};
@@ -6,6 +6,7 @@ export * from './Booking/IBookingStatus.type';
6
6
  export * from './Booking/IBookingPayment.type';
7
7
  export * from './Booking/IBookingQuote.type';
8
8
  export * from './Booking/IBookingCreateErrorResponse';
9
+ export * from './Booking/ICheckoutBrowserSession.type';
9
10
  /**
10
11
  * Company
11
12
  */
package/dist/web.js CHANGED
@@ -1,2 +1 @@
1
- /*! For license information please see web.js.LICENSE.txt */
2
- define("@roomstay/core",[],(()=>(()=>{"use strict";var n={d:(e,i)=>{for(var t in i)n.o(i,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:i[t]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},e={};let i,t,r,o,s,u,c,a,f,d,l,h,g,p,m;function w(n){return n.toUpperCase()}n.r(e),n.d(e,{EBookingPaymentMethod:()=>t,ECompanyProvider:()=>s,EDistanceUnitType:()=>u,EGuarantyPolicyPrepaymentType:()=>p,EHotelCardProcessor:()=>r,EHotelPriceModel:()=>c,EHotelStateFieldConfiguration:()=>a,EHotelWeekdayStartsOn:()=>f,EIntegration:()=>l,EPlanpayBookingStatus:()=>o,ERMSDiscountType:()=>h,ERoomstayImageSize:()=>g,HttpMethod:()=>m,IAuxiliaryFilterType:()=>d,IBookingStatus:()=>i,calculateTotalForMemberBooking:()=>v,nameof:()=>y,resizeRoomstayImageUrl:()=>N,roundMoney:()=>se,subset:()=>E,uppercaseString:()=>w}),function(n){n.Pending="Pending",n.Committed="Committed",n.Cancelled="Cancelled"}(i||(i={})),function(n){n.Card="Card",n.SavedCard="SavedCard",n.Planpay="Planpay",n.Adyen="Adyen"}(t||(t={})),function(n){n.Passthrough="Passthrough",n.Adyen="Adyen",n.Till="Till",n.RMSPay="RMSPay"}(r||(r={})),function(n){n.Unknown="unknown",n.Unpaid="unpaid",n.Accepted="accepted",n.Cancelled="cancelled",n.Refunded="refunded",n.Rejected="rejected"}(o||(o={})),function(n){n.Synxis="Synxis",n.Availpro="Availpro",n.RMS="RMS",n.Siteminder="Siteminder",n.Roomstay="Roomstay"}(s||(s={})),function(n){n.Metric="metric",n.Imperial="imperial"}(u||(u={})),function(n){n.PerPerson="PerPerson",n.PerDay="PerDay",n.PerOccupancy="PerOccupancy"}(c||(c={})),function(n){n.NotIncluded="NotIncluded",n.Optional="Optional",n.Required="Required"}(a||(a={})),function(n){n.Monday="monday",n.Sunday="sunday"}(f||(f={})),function(n){n.AreaDwellingLength="AreaDwellingLength",n.AreaDwellingType="AreaDwellingType"}(d||(d={})),function(n){n.Big4="Big4",n.Top10="Top10",n.Gday="Gday",n.Salesforce="Salesforce"}(l||(l={})),function(n){n.Percentage="Percentage",n.Amount="Amount",n.Bogo="BOGO",n.NightlyRateOverride="NightlyRateOverride"}(h||(h={})),function(n){n[n.Icon=128]="Icon",n[n.Tiny=256]="Tiny",n[n.Small=512]="Small",n[n.Medium=768]="Medium",n[n.Large=1024]="Large",n[n.ExtraLarge=1600]="ExtraLarge"}(g||(g={})),function(n){n.FixedAmount="fixed",n.Percentage="percentage",n.Nights="nights"}(p||(p={})),function(n){n.GET="GET",n.POST="POST",n.PUT="PUT",n.DELETE="DELETE",n.PATCH="PATCH",n.OPTIONS="OPTIONS",n.HEAD="HEAD"}(m||(m={}));const v=n=>{let e=0;const i=Object.values(n.itinerary);for(const n of i){const i=Object.keys(n.nights);for(const t of i)e+=n.nights[t].total}return e},N=(n,e)=>n.includes("cdn.app.roomstay.io")?n+"?w="+e:n,y=n=>n,E=(n,e)=>{const i={};return e.forEach((e=>{e in n&&(i[e]=n[e])})),i};var b,x,P=9e15,M=1e9,O="0123456789abcdef",S="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",T="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",A={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-P,maxE:P,crypto:!1},D=!0,q="[DecimalError] ",R=q+"Invalid argument: ",F=q+"Precision limit exceeded",C=q+"crypto unavailable",I="[object Decimal]",L=Math.floor,k=Math.pow,U=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Z=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,H=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,_=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,B=1e7,j=S.length-1,G=T.length-1,V={toStringTag:I};function $(n){var e,i,t,r=n.length-1,o="",s=n[0];if(r>0){for(o+=s,e=1;e<r;e++)(i=7-(t=n[e]+"").length)&&(o+=rn(i)),o+=t;(i=7-(t=(s=n[e])+"").length)&&(o+=rn(i))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function W(n,e,i){if(n!==~~n||n<e||n>i)throw Error(R+n)}function z(n,e,i,t){var r,o,s,u;for(o=n[0];o>=10;o/=10)--e;return--e<0?(e+=7,r=0):(r=Math.ceil((e+1)/7),e%=7),o=k(10,7-e),u=n[r]%o|0,null==t?e<3?(0==e?u=u/100|0:1==e&&(u=u/10|0),s=i<4&&99999==u||i>3&&49999==u||5e4==u||0==u):s=(i<4&&u+1==o||i>3&&u+1==o/2)&&(n[r+1]/o/100|0)==k(10,e-2)-1||(u==o/2||0==u)&&0==(n[r+1]/o/100|0):e<4?(0==e?u=u/1e3|0:1==e?u=u/100|0:2==e&&(u=u/10|0),s=(t||i<4)&&9999==u||!t&&i>3&&4999==u):s=((t||i<4)&&u+1==o||!t&&i>3&&u+1==o/2)&&(n[r+1]/o/1e3|0)==k(10,e-3)-1,s}function J(n,e,i){for(var t,r,o=[0],s=0,u=n.length;s<u;){for(r=o.length;r--;)o[r]*=e;for(o[0]+=O.indexOf(n.charAt(s++)),t=0;t<o.length;t++)o[t]>i-1&&(void 0===o[t+1]&&(o[t+1]=0),o[t+1]+=o[t]/i|0,o[t]%=i)}return o.reverse()}V.absoluteValue=V.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),Q(n)},V.ceil=function(){return Q(new this.constructor(this),this.e+1,2)},V.clampedTo=V.clamp=function(n,e){var i=this,t=i.constructor;if(n=new t(n),e=new t(e),!n.s||!e.s)return new t(NaN);if(n.gt(e))throw Error(R+e);return i.cmp(n)<0?n:i.cmp(e)>0?e:new t(i)},V.comparedTo=V.cmp=function(n){var e,i,t,r,o=this,s=o.d,u=(n=new o.constructor(n)).d,c=o.s,a=n.s;if(!s||!u)return c&&a?c!==a?c:s===u?0:!s^c<0?1:-1:NaN;if(!s[0]||!u[0])return s[0]?c:u[0]?-a:0;if(c!==a)return c;if(o.e!==n.e)return o.e>n.e^c<0?1:-1;for(e=0,i=(t=s.length)<(r=u.length)?t:r;e<i;++e)if(s[e]!==u[e])return s[e]>u[e]^c<0?1:-1;return t===r?0:t>r^c<0?1:-1},V.cosine=V.cos=function(){var n,e,i=this,t=i.constructor;return i.d?i.d[0]?(n=t.precision,e=t.rounding,t.precision=n+Math.max(i.e,i.sd())+7,t.rounding=1,i=function(n,e){var i,t,r;if(e.isZero())return e;(t=e.d.length)<32?r=(1/gn(4,i=Math.ceil(t/3))).toString():(i=16,r="2.3283064365386962890625e-10"),n.precision+=i,e=hn(n,1,e.times(r),new n(1));for(var o=i;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return n.precision-=i,e}(t,pn(t,i)),t.precision=n,t.rounding=e,Q(2==x||3==x?i.neg():i,n,e,!0)):new t(1):new t(NaN)},V.cubeRoot=V.cbrt=function(){var n,e,i,t,r,o,s,u,c,a,f=this,d=f.constructor;if(!f.isFinite()||f.isZero())return new d(f);for(D=!1,(o=f.s*k(f.s*f,1/3))&&Math.abs(o)!=1/0?t=new d(o.toString()):(i=$(f.d),(o=((n=f.e)-i.length+1)%3)&&(i+=1==o||-2==o?"0":"00"),o=k(i,1/3),n=L((n+1)/3)-(n%3==(n<0?-1:2)),(t=new d(i=o==1/0?"5e"+n:(i=o.toExponential()).slice(0,i.indexOf("e")+1)+n)).s=f.s),s=(n=d.precision)+3;;)if(a=(c=(u=t).times(u).times(u)).plus(f),t=K(a.plus(f).times(u),a.plus(c),s+2,1),$(u.d).slice(0,s)===(i=$(t.d)).slice(0,s)){if("9999"!=(i=i.slice(s-3,s+1))&&(r||"4999"!=i)){+i&&(+i.slice(1)||"5"!=i.charAt(0))||(Q(t,n+1,1),e=!t.times(t).times(t).eq(f));break}if(!r&&(Q(u,n+1,0),u.times(u).times(u).eq(f))){t=u;break}s+=4,r=1}return D=!0,Q(t,n,d.rounding,e)},V.decimalPlaces=V.dp=function(){var n,e=this.d,i=NaN;if(e){if(i=7*((n=e.length-1)-L(this.e/7)),n=e[n])for(;n%10==0;n/=10)i--;i<0&&(i=0)}return i},V.dividedBy=V.div=function(n){return K(this,new this.constructor(n))},V.dividedToIntegerBy=V.divToInt=function(n){var e=this.constructor;return Q(K(this,new e(n),0,1,1),e.precision,e.rounding)},V.equals=V.eq=function(n){return 0===this.cmp(n)},V.floor=function(){return Q(new this.constructor(this),this.e+1,3)},V.greaterThan=V.gt=function(n){return this.cmp(n)>0},V.greaterThanOrEqualTo=V.gte=function(n){var e=this.cmp(n);return 1==e||0===e},V.hyperbolicCosine=V.cosh=function(){var n,e,i,t,r,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;i=s.precision,t=s.rounding,s.precision=i+Math.max(o.e,o.sd())+4,s.rounding=1,(r=o.d.length)<32?e=(1/gn(4,n=Math.ceil(r/3))).toString():(n=16,e="2.3283064365386962890625e-10"),o=hn(s,1,o.times(e),new s(1),!0);for(var c,a=n,f=new s(8);a--;)c=o.times(o),o=u.minus(c.times(f.minus(c.times(f))));return Q(o,s.precision=i,s.rounding=t,!0)},V.hyperbolicSine=V.sinh=function(){var n,e,i,t,r=this,o=r.constructor;if(!r.isFinite()||r.isZero())return new o(r);if(e=o.precision,i=o.rounding,o.precision=e+Math.max(r.e,r.sd())+4,o.rounding=1,(t=r.d.length)<3)r=hn(o,2,r,r,!0);else{n=(n=1.4*Math.sqrt(t))>16?16:0|n,r=hn(o,2,r=r.times(1/gn(5,n)),r,!0);for(var s,u=new o(5),c=new o(16),a=new o(20);n--;)s=r.times(r),r=r.times(u.plus(s.times(c.times(s).plus(a))))}return o.precision=e,o.rounding=i,Q(r,e,i,!0)},V.hyperbolicTangent=V.tanh=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+7,t.rounding=1,K(i.sinh(),i.cosh(),t.precision=n,t.rounding=e)):new t(i.s)},V.inverseCosine=V.acos=function(){var n,e=this,i=e.constructor,t=e.abs().cmp(1),r=i.precision,o=i.rounding;return-1!==t?0===t?e.isNeg()?en(i,r,o):new i(0):new i(NaN):e.isZero()?en(i,r+4,o).times(.5):(i.precision=r+6,i.rounding=1,e=e.asin(),n=en(i,r+4,o).times(.5),i.precision=r,i.rounding=o,n.minus(e))},V.inverseHyperbolicCosine=V.acosh=function(){var n,e,i=this,t=i.constructor;return i.lte(1)?new t(i.eq(1)?0:NaN):i.isFinite()?(n=t.precision,e=t.rounding,t.precision=n+Math.max(Math.abs(i.e),i.sd())+4,t.rounding=1,D=!1,i=i.times(i).minus(1).sqrt().plus(i),D=!0,t.precision=n,t.rounding=e,i.ln()):new t(i)},V.inverseHyperbolicSine=V.asinh=function(){var n,e,i=this,t=i.constructor;return!i.isFinite()||i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+2*Math.max(Math.abs(i.e),i.sd())+6,t.rounding=1,D=!1,i=i.times(i).plus(1).sqrt().plus(i),D=!0,t.precision=n,t.rounding=e,i.ln())},V.inverseHyperbolicTangent=V.atanh=function(){var n,e,i,t,r=this,o=r.constructor;return r.isFinite()?r.e>=0?new o(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(n=o.precision,e=o.rounding,t=r.sd(),Math.max(t,n)<2*-r.e-1?Q(new o(r),n,e,!0):(o.precision=i=t-r.e,r=K(r.plus(1),new o(1).minus(r),i+n,1),o.precision=n+4,o.rounding=1,r=r.ln(),o.precision=n,o.rounding=e,r.times(.5))):new o(NaN)},V.inverseSine=V.asin=function(){var n,e,i,t,r=this,o=r.constructor;return r.isZero()?new o(r):(e=r.abs().cmp(1),i=o.precision,t=o.rounding,-1!==e?0===e?((n=en(o,i+4,t).times(.5)).s=r.s,n):new o(NaN):(o.precision=i+6,o.rounding=1,r=r.div(new o(1).minus(r.times(r)).sqrt().plus(1)).atan(),o.precision=i,o.rounding=t,r.times(2)))},V.inverseTangent=V.atan=function(){var n,e,i,t,r,o,s,u,c,a=this,f=a.constructor,d=f.precision,l=f.rounding;if(a.isFinite()){if(a.isZero())return new f(a);if(a.abs().eq(1)&&d+4<=G)return(s=en(f,d+4,l).times(.25)).s=a.s,s}else{if(!a.s)return new f(NaN);if(d+4<=G)return(s=en(f,d+4,l).times(.5)).s=a.s,s}for(f.precision=u=d+10,f.rounding=1,n=i=Math.min(28,u/7+2|0);n;--n)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(D=!1,e=Math.ceil(u/7),t=1,c=a.times(a),s=new f(a),r=a;-1!==n;)if(r=r.times(c),o=s.minus(r.div(t+=2)),r=r.times(c),void 0!==(s=o.plus(r.div(t+=2))).d[e])for(n=e;s.d[n]===o.d[n]&&n--;);return i&&(s=s.times(2<<i-1)),D=!0,Q(s,f.precision=d,f.rounding=l,!0)},V.isFinite=function(){return!!this.d},V.isInteger=V.isInt=function(){return!!this.d&&L(this.e/7)>this.d.length-2},V.isNaN=function(){return!this.s},V.isNegative=V.isNeg=function(){return this.s<0},V.isPositive=V.isPos=function(){return this.s>0},V.isZero=function(){return!!this.d&&0===this.d[0]},V.lessThan=V.lt=function(n){return this.cmp(n)<0},V.lessThanOrEqualTo=V.lte=function(n){return this.cmp(n)<1},V.logarithm=V.log=function(n){var e,i,t,r,o,s,u,c,a=this,f=a.constructor,d=f.precision,l=f.rounding;if(null==n)n=new f(10),e=!0;else{if(i=(n=new f(n)).d,n.s<0||!i||!i[0]||n.eq(1))return new f(NaN);e=n.eq(10)}if(i=a.d,a.s<0||!i||!i[0]||a.eq(1))return new f(i&&!i[0]?-1/0:1!=a.s?NaN:i?0:1/0);if(e)if(i.length>1)o=!0;else{for(r=i[0];r%10==0;)r/=10;o=1!==r}if(D=!1,s=an(a,u=d+5),t=e?nn(f,u+10):an(n,u),z((c=K(s,t,u,1)).d,r=d,l))do{if(s=an(a,u+=10),t=e?nn(f,u+10):an(n,u),c=K(s,t,u,1),!o){+$(c.d).slice(r+1,r+15)+1==1e14&&(c=Q(c,d+1,0));break}}while(z(c.d,r+=10,l));return D=!0,Q(c,d,l)},V.minus=V.sub=function(n){var e,i,t,r,o,s,u,c,a,f,d,l,h=this,g=h.constructor;if(n=new g(n),!h.d||!n.d)return h.s&&n.s?h.d?n.s=-n.s:n=new g(n.d||h.s!==n.s?h:NaN):n=new g(NaN),n;if(h.s!=n.s)return n.s=-n.s,h.plus(n);if(a=h.d,l=n.d,u=g.precision,c=g.rounding,!a[0]||!l[0]){if(l[0])n.s=-n.s;else{if(!a[0])return new g(3===c?-0:0);n=new g(h)}return D?Q(n,u,c):n}if(i=L(n.e/7),f=L(h.e/7),a=a.slice(),o=f-i){for((d=o<0)?(e=a,o=-o,s=l.length):(e=l,i=f,s=a.length),o>(t=Math.max(Math.ceil(u/7),s)+2)&&(o=t,e.length=1),e.reverse(),t=o;t--;)e.push(0);e.reverse()}else{for((d=(t=a.length)<(s=l.length))&&(s=t),t=0;t<s;t++)if(a[t]!=l[t]){d=a[t]<l[t];break}o=0}for(d&&(e=a,a=l,l=e,n.s=-n.s),s=a.length,t=l.length-s;t>0;--t)a[s++]=0;for(t=l.length;t>o;){if(a[--t]<l[t]){for(r=t;r&&0===a[--r];)a[r]=B-1;--a[r],a[t]+=B}a[t]-=l[t]}for(;0===a[--s];)a.pop();for(;0===a[0];a.shift())--i;return a[0]?(n.d=a,n.e=Y(a,i),D?Q(n,u,c):n):new g(3===c?-0:0)},V.modulo=V.mod=function(n){var e,i=this,t=i.constructor;return n=new t(n),!i.d||!n.s||n.d&&!n.d[0]?new t(NaN):!n.d||i.d&&!i.d[0]?Q(new t(i),t.precision,t.rounding):(D=!1,9==t.modulo?(e=K(i,n.abs(),0,3,1)).s*=n.s:e=K(i,n,0,t.modulo,1),e=e.times(n),D=!0,i.minus(e))},V.naturalExponential=V.exp=function(){return cn(this)},V.naturalLogarithm=V.ln=function(){return an(this)},V.negated=V.neg=function(){var n=new this.constructor(this);return n.s=-n.s,Q(n)},V.plus=V.add=function(n){var e,i,t,r,o,s,u,c,a,f,d=this,l=d.constructor;if(n=new l(n),!d.d||!n.d)return d.s&&n.s?d.d||(n=new l(n.d||d.s===n.s?d:NaN)):n=new l(NaN),n;if(d.s!=n.s)return n.s=-n.s,d.minus(n);if(a=d.d,f=n.d,u=l.precision,c=l.rounding,!a[0]||!f[0])return f[0]||(n=new l(d)),D?Q(n,u,c):n;if(o=L(d.e/7),t=L(n.e/7),a=a.slice(),r=o-t){for(r<0?(i=a,r=-r,s=f.length):(i=f,t=o,s=a.length),r>(s=(o=Math.ceil(u/7))>s?o+1:s+1)&&(r=s,i.length=1),i.reverse();r--;)i.push(0);i.reverse()}for((s=a.length)-(r=f.length)<0&&(r=s,i=f,f=a,a=i),e=0;r;)e=(a[--r]=a[r]+f[r]+e)/B|0,a[r]%=B;for(e&&(a.unshift(e),++t),s=a.length;0==a[--s];)a.pop();return n.d=a,n.e=Y(a,t),D?Q(n,u,c):n},V.precision=V.sd=function(n){var e,i=this;if(void 0!==n&&n!==!!n&&1!==n&&0!==n)throw Error(R+n);return i.d?(e=tn(i.d),n&&i.e+1>e&&(e=i.e+1)):e=NaN,e},V.round=function(){var n=this,e=n.constructor;return Q(new e(n),n.e+1,e.rounding)},V.sine=V.sin=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+Math.max(i.e,i.sd())+7,t.rounding=1,i=function(n,e){var i,t=e.d.length;if(t<3)return e.isZero()?e:hn(n,2,e,e);i=(i=1.4*Math.sqrt(t))>16?16:0|i,e=hn(n,2,e=e.times(1/gn(5,i)),e);for(var r,o=new n(5),s=new n(16),u=new n(20);i--;)r=e.times(e),e=e.times(o.plus(r.times(s.times(r).minus(u))));return e}(t,pn(t,i)),t.precision=n,t.rounding=e,Q(x>2?i.neg():i,n,e,!0)):new t(NaN)},V.squareRoot=V.sqrt=function(){var n,e,i,t,r,o,s=this,u=s.d,c=s.e,a=s.s,f=s.constructor;if(1!==a||!u||!u[0])return new f(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);for(D=!1,0==(a=Math.sqrt(+s))||a==1/0?(((e=$(u)).length+c)%2==0&&(e+="0"),a=Math.sqrt(e),c=L((c+1)/2)-(c<0||c%2),t=new f(e=a==1/0?"5e"+c:(e=a.toExponential()).slice(0,e.indexOf("e")+1)+c)):t=new f(a.toString()),i=(c=f.precision)+3;;)if(t=(o=t).plus(K(s,o,i+2,1)).times(.5),$(o.d).slice(0,i)===(e=$(t.d)).slice(0,i)){if("9999"!=(e=e.slice(i-3,i+1))&&(r||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Q(t,c+1,1),n=!t.times(t).eq(s));break}if(!r&&(Q(o,c+1,0),o.times(o).eq(s))){t=o;break}i+=4,r=1}return D=!0,Q(t,c,f.rounding,n)},V.tangent=V.tan=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+10,t.rounding=1,(i=i.sin()).s=1,i=K(i,new t(1).minus(i.times(i)).sqrt(),n+10,0),t.precision=n,t.rounding=e,Q(2==x||4==x?i.neg():i,n,e,!0)):new t(NaN)},V.times=V.mul=function(n){var e,i,t,r,o,s,u,c,a,f=this,d=f.constructor,l=f.d,h=(n=new d(n)).d;if(n.s*=f.s,!(l&&l[0]&&h&&h[0]))return new d(!n.s||l&&!l[0]&&!h||h&&!h[0]&&!l?NaN:l&&h?0*n.s:n.s/0);for(i=L(f.e/7)+L(n.e/7),(c=l.length)<(a=h.length)&&(o=l,l=h,h=o,s=c,c=a,a=s),o=[],t=s=c+a;t--;)o.push(0);for(t=a;--t>=0;){for(e=0,r=c+t;r>t;)u=o[r]+h[t]*l[r-t-1]+e,o[r--]=u%B|0,e=u/B|0;o[r]=(o[r]+e)%B|0}for(;!o[--s];)o.pop();return e?++i:o.shift(),n.d=o,n.e=Y(o,i),D?Q(n,d.precision,d.rounding):n},V.toBinary=function(n,e){return mn(this,2,n,e)},V.toDecimalPlaces=V.toDP=function(n,e){var i=this,t=i.constructor;return i=new t(i),void 0===n?i:(W(n,0,M),void 0===e?e=t.rounding:W(e,0,8),Q(i,n+i.e+1,e))},V.toExponential=function(n,e){var i,t=this,r=t.constructor;return void 0===n?i=X(t,!0):(W(n,0,M),void 0===e?e=r.rounding:W(e,0,8),i=X(t=Q(new r(t),n+1,e),!0,n+1)),t.isNeg()&&!t.isZero()?"-"+i:i},V.toFixed=function(n,e){var i,t,r=this,o=r.constructor;return void 0===n?i=X(r):(W(n,0,M),void 0===e?e=o.rounding:W(e,0,8),i=X(t=Q(new o(r),n+r.e+1,e),!1,n+t.e+1)),r.isNeg()&&!r.isZero()?"-"+i:i},V.toFraction=function(n){var e,i,t,r,o,s,u,c,a,f,d,l,h=this,g=h.d,p=h.constructor;if(!g)return new p(h);if(a=i=new p(1),t=c=new p(0),s=(o=(e=new p(t)).e=tn(g)-h.e-1)%7,e.d[0]=k(10,s<0?7+s:s),null==n)n=o>0?e:a;else{if(!(u=new p(n)).isInt()||u.lt(a))throw Error(R+u);n=u.gt(e)?o>0?e:a:u}for(D=!1,u=new p($(g)),f=p.precision,p.precision=o=7*g.length*2;d=K(u,e,0,1,1),1!=(r=i.plus(d.times(t))).cmp(n);)i=t,t=r,r=a,a=c.plus(d.times(r)),c=r,r=e,e=u.minus(d.times(r)),u=r;return r=K(n.minus(i),t,0,1,1),c=c.plus(r.times(a)),i=i.plus(r.times(t)),c.s=a.s=h.s,l=K(a,t,o,1).minus(h).abs().cmp(K(c,i,o,1).minus(h).abs())<1?[a,t]:[c,i],p.precision=f,D=!0,l},V.toHexadecimal=V.toHex=function(n,e){return mn(this,16,n,e)},V.toNearest=function(n,e){var i=this,t=i.constructor;if(i=new t(i),null==n){if(!i.d)return i;n=new t(1),e=t.rounding}else{if(n=new t(n),void 0===e?e=t.rounding:W(e,0,8),!i.d)return n.s?i:n;if(!n.d)return n.s&&(n.s=i.s),n}return n.d[0]?(D=!1,i=K(i,n,0,e,1).times(n),D=!0,Q(i)):(n.s=i.s,i=n),i},V.toNumber=function(){return+this},V.toOctal=function(n,e){return mn(this,8,n,e)},V.toPower=V.pow=function(n){var e,i,t,r,o,s,u=this,c=u.constructor,a=+(n=new c(n));if(!(u.d&&n.d&&u.d[0]&&n.d[0]))return new c(k(+u,a));if((u=new c(u)).eq(1))return u;if(t=c.precision,o=c.rounding,n.eq(1))return Q(u,t,o);if((e=L(n.e/7))>=n.d.length-1&&(i=a<0?-a:a)<=9007199254740991)return r=on(c,u,i,t),n.s<0?new c(1).div(r):Q(r,t,o);if((s=u.s)<0){if(e<n.d.length-1)return new c(NaN);if(0==(1&n.d[e])&&(s=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=s,u}return(e=0!=(i=k(+u,a))&&isFinite(i)?new c(i+"").e:L(a*(Math.log("0."+$(u.d))/Math.LN10+u.e+1)))>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(D=!1,c.rounding=u.s=1,i=Math.min(12,(e+"").length),(r=cn(n.times(an(u,t+i)),t)).d&&z((r=Q(r,t+5,1)).d,t,o)&&(e=t+10,+$((r=Q(cn(n.times(an(u,e+i)),e),e+5,1)).d).slice(t+1,t+15)+1==1e14&&(r=Q(r,t+1,0))),r.s=s,D=!0,c.rounding=o,Q(r,t,o))},V.toPrecision=function(n,e){var i,t=this,r=t.constructor;return void 0===n?i=X(t,t.e<=r.toExpNeg||t.e>=r.toExpPos):(W(n,1,M),void 0===e?e=r.rounding:W(e,0,8),i=X(t=Q(new r(t),n,e),n<=t.e||t.e<=r.toExpNeg,n)),t.isNeg()&&!t.isZero()?"-"+i:i},V.toSignificantDigits=V.toSD=function(n,e){var i=this.constructor;return void 0===n?(n=i.precision,e=i.rounding):(W(n,1,M),void 0===e?e=i.rounding:W(e,0,8)),Q(new i(this),n,e)},V.toString=function(){var n=this,e=n.constructor,i=X(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()&&!n.isZero()?"-"+i:i},V.truncated=V.trunc=function(){return Q(new this.constructor(this),this.e+1,1)},V.valueOf=V.toJSON=function(){var n=this,e=n.constructor,i=X(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()?"-"+i:i};var K=function(){function n(n,e,i){var t,r=0,o=n.length;for(n=n.slice();o--;)t=n[o]*e+r,n[o]=t%i|0,r=t/i|0;return r&&n.unshift(r),n}function e(n,e,i,t){var r,o;if(i!=t)o=i>t?1:-1;else for(r=o=0;r<i;r++)if(n[r]!=e[r]){o=n[r]>e[r]?1:-1;break}return o}function i(n,e,i,t){for(var r=0;i--;)n[i]-=r,r=n[i]<e[i]?1:0,n[i]=r*t+n[i]-e[i];for(;!n[0]&&n.length>1;)n.shift()}return function(t,r,o,s,u,c){var a,f,d,l,h,g,p,m,w,v,N,y,E,x,P,M,O,S,T,A,D=t.constructor,q=t.s==r.s?1:-1,R=t.d,F=r.d;if(!(R&&R[0]&&F&&F[0]))return new D(t.s&&r.s&&(R?!F||R[0]!=F[0]:F)?R&&0==R[0]||!F?0*q:q/0:NaN);for(c?(h=1,f=t.e-r.e):(c=B,h=7,f=L(t.e/h)-L(r.e/h)),T=F.length,O=R.length,v=(w=new D(q)).d=[],d=0;F[d]==(R[d]||0);d++);if(F[d]>(R[d]||0)&&f--,null==o?(x=o=D.precision,s=D.rounding):x=u?o+(t.e-r.e)+1:o,x<0)v.push(1),g=!0;else{if(x=x/h+2|0,d=0,1==T){for(l=0,F=F[0],x++;(d<O||l)&&x--;d++)P=l*c+(R[d]||0),v[d]=P/F|0,l=P%F|0;g=l||d<O}else{for((l=c/(F[0]+1)|0)>1&&(F=n(F,l,c),R=n(R,l,c),T=F.length,O=R.length),M=T,y=(N=R.slice(0,T)).length;y<T;)N[y++]=0;(A=F.slice()).unshift(0),S=F[0],F[1]>=c/2&&++S;do{l=0,(a=e(F,N,T,y))<0?(E=N[0],T!=y&&(E=E*c+(N[1]||0)),(l=E/S|0)>1?(l>=c&&(l=c-1),1==(a=e(p=n(F,l,c),N,m=p.length,y=N.length))&&(l--,i(p,T<m?A:F,m,c))):(0==l&&(a=l=1),p=F.slice()),(m=p.length)<y&&p.unshift(0),i(N,p,y,c),-1==a&&(a=e(F,N,T,y=N.length))<1&&(l++,i(N,T<y?A:F,y,c)),y=N.length):0===a&&(l++,N=[0]),v[d++]=l,a&&N[0]?N[y++]=R[M]||0:(N=[R[M]],y=1)}while((M++<O||void 0!==N[0])&&x--);g=void 0!==N[0]}v[0]||v.shift()}if(1==h)w.e=f,b=g;else{for(d=1,l=v[0];l>=10;l/=10)d++;w.e=d+f*h-1,Q(w,u?o+w.e+1:o,s,g)}return w}}();function Q(n,e,i,t){var r,o,s,u,c,a,f,d,l,h=n.constructor;n:if(null!=e){if(!(d=n.d))return n;for(r=1,u=d[0];u>=10;u/=10)r++;if((o=e-r)<0)o+=7,s=e,c=(f=d[l=0])/k(10,r-s-1)%10|0;else if((l=Math.ceil((o+1)/7))>=(u=d.length)){if(!t)break n;for(;u++<=l;)d.push(0);f=c=0,r=1,s=(o%=7)-7+1}else{for(f=u=d[l],r=1;u>=10;u/=10)r++;c=(s=(o%=7)-7+r)<0?0:f/k(10,r-s-1)%10|0}if(t=t||e<0||void 0!==d[l+1]||(s<0?f:f%k(10,r-s-1)),a=i<4?(c||t)&&(0==i||i==(n.s<0?3:2)):c>5||5==c&&(4==i||t||6==i&&(o>0?s>0?f/k(10,r-s):0:d[l-1])%10&1||i==(n.s<0?8:7)),e<1||!d[0])return d.length=0,a?(e-=n.e+1,d[0]=k(10,(7-e%7)%7),n.e=-e||0):d[0]=n.e=0,n;if(0==o?(d.length=l,u=1,l--):(d.length=l+1,u=k(10,7-o),d[l]=s>0?(f/k(10,r-s)%k(10,s)|0)*u:0),a)for(;;){if(0==l){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(n.e++,d[0]==B&&(d[0]=1));break}if(d[l]+=u,d[l]!=B)break;d[l--]=0,u=1}for(o=d.length;0===d[--o];)d.pop()}return D&&(n.e>h.maxE?(n.d=null,n.e=NaN):n.e<h.minE&&(n.e=0,n.d=[0])),n}function X(n,e,i){if(!n.isFinite())return fn(n);var t,r=n.e,o=$(n.d),s=o.length;return e?(i&&(t=i-s)>0?o=o.charAt(0)+"."+o.slice(1)+rn(t):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(n.e<0?"e":"e+")+n.e):r<0?(o="0."+rn(-r-1)+o,i&&(t=i-s)>0&&(o+=rn(t))):r>=s?(o+=rn(r+1-s),i&&(t=i-r-1)>0&&(o=o+"."+rn(t))):((t=r+1)<s&&(o=o.slice(0,t)+"."+o.slice(t)),i&&(t=i-s)>0&&(r+1===s&&(o+="."),o+=rn(t))),o}function Y(n,e){var i=n[0];for(e*=7;i>=10;i/=10)e++;return e}function nn(n,e,i){if(e>j)throw D=!0,i&&(n.precision=i),Error(F);return Q(new n(S),e,1,!0)}function en(n,e,i){if(e>G)throw Error(F);return Q(new n(T),e,i,!0)}function tn(n){var e=n.length-1,i=7*e+1;if(e=n[e]){for(;e%10==0;e/=10)i--;for(e=n[0];e>=10;e/=10)i++}return i}function rn(n){for(var e="";n--;)e+="0";return e}function on(n,e,i,t){var r,o=new n(1),s=Math.ceil(t/7+4);for(D=!1;;){if(i%2&&wn((o=o.times(e)).d,s)&&(r=!0),0===(i=L(i/2))){i=o.d.length-1,r&&0===o.d[i]&&++o.d[i];break}wn((e=e.times(e)).d,s)}return D=!0,o}function sn(n){return 1&n.d[n.d.length-1]}function un(n,e,i){for(var t,r=new n(e[0]),o=0;++o<e.length;){if(!(t=new n(e[o])).s){r=t;break}r[i](t)&&(r=t)}return r}function cn(n,e){var i,t,r,o,s,u,c,a=0,f=0,d=0,l=n.constructor,h=l.rounding,g=l.precision;if(!n.d||!n.d[0]||n.e>17)return new l(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==e?(D=!1,c=g):c=e,u=new l(.03125);n.e>-2;)n=n.times(u),d+=5;for(c+=t=Math.log(k(2,d))/Math.LN10*2+5|0,i=o=s=new l(1),l.precision=c;;){if(o=Q(o.times(n),c,1),i=i.times(++f),$((u=s.plus(K(o,i,c,1))).d).slice(0,c)===$(s.d).slice(0,c)){for(r=d;r--;)s=Q(s.times(s),c,1);if(null!=e)return l.precision=g,s;if(!(a<3&&z(s.d,c-t,h,a)))return Q(s,l.precision=g,h,D=!0);l.precision=c+=10,i=o=u=new l(1),f=0,a++}s=u}}function an(n,e){var i,t,r,o,s,u,c,a,f,d,l,h=1,g=n,p=g.d,m=g.constructor,w=m.rounding,v=m.precision;if(g.s<0||!p||!p[0]||!g.e&&1==p[0]&&1==p.length)return new m(p&&!p[0]?-1/0:1!=g.s?NaN:p?0:g);if(null==e?(D=!1,f=v):f=e,m.precision=f+=10,t=(i=$(p)).charAt(0),!(Math.abs(o=g.e)<15e14))return a=nn(m,f+2,v).times(o+""),g=an(new m(t+"."+i.slice(1)),f-10).plus(a),m.precision=v,null==e?Q(g,v,w,D=!0):g;for(;t<7&&1!=t||1==t&&i.charAt(1)>3;)t=(i=$((g=g.times(n)).d)).charAt(0),h++;for(o=g.e,t>1?(g=new m("0."+i),o++):g=new m(t+"."+i.slice(1)),d=g,c=s=g=K(g.minus(1),g.plus(1),f,1),l=Q(g.times(g),f,1),r=3;;){if(s=Q(s.times(l),f,1),$((a=c.plus(K(s,new m(r),f,1))).d).slice(0,f)===$(c.d).slice(0,f)){if(c=c.times(2),0!==o&&(c=c.plus(nn(m,f+2,v).times(o+""))),c=K(c,new m(h),f,1),null!=e)return m.precision=v,c;if(!z(c.d,f-10,w,u))return Q(c,m.precision=v,w,D=!0);m.precision=f+=10,a=s=g=K(d.minus(1),d.plus(1),f,1),l=Q(g.times(g),f,1),r=u=1}c=a,r+=2}}function fn(n){return String(n.s*n.s/0)}function dn(n,e){var i,t,r;for((i=e.indexOf("."))>-1&&(e=e.replace(".","")),(t=e.search(/e/i))>0?(i<0&&(i=t),i+=+e.slice(t+1),e=e.substring(0,t)):i<0&&(i=e.length),t=0;48===e.charCodeAt(t);t++);for(r=e.length;48===e.charCodeAt(r-1);--r);if(e=e.slice(t,r)){if(r-=t,n.e=i=i-t-1,n.d=[],t=(i+1)%7,i<0&&(t+=7),t<r){for(t&&n.d.push(+e.slice(0,t)),r-=7;t<r;)n.d.push(+e.slice(t,t+=7));t=7-(e=e.slice(t)).length}else t-=r;for(;t--;)e+="0";n.d.push(+e),D&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function ln(n,e){var i,t,r,o,s,u,c,a,f;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),_.test(e))return dn(n,e)}else if("Infinity"===e||"NaN"===e)return+e||(n.s=NaN),n.e=NaN,n.d=null,n;if(Z.test(e))i=16,e=e.toLowerCase();else if(U.test(e))i=2;else{if(!H.test(e))throw Error(R+e);i=8}for((o=e.search(/p/i))>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),s=(o=e.indexOf("."))>=0,t=n.constructor,s&&(o=(u=(e=e.replace(".","")).length)-o,r=on(t,new t(i),o,2*o)),o=f=(a=J(e,i,B)).length-1;0===a[o];--o)a.pop();return o<0?new t(0*n.s):(n.e=Y(a,f),n.d=a,D=!1,s&&(n=K(n,r,4*u)),c&&(n=n.times(Math.abs(c)<54?k(2,c):re.pow(2,c))),D=!0,n)}function hn(n,e,i,t,r){var o,s,u,c,a=n.precision,f=Math.ceil(a/7);for(D=!1,c=i.times(i),u=new n(t);;){if(s=K(u.times(c),new n(e++*e++),a,1),u=r?t.plus(s):t.minus(s),t=K(s.times(c),new n(e++*e++),a,1),void 0!==(s=u.plus(t)).d[f]){for(o=f;s.d[o]===u.d[o]&&o--;);if(-1==o)break}o=u,u=t,t=s,s=o}return D=!0,s.d.length=f+1,s}function gn(n,e){for(var i=n;--e;)i*=n;return i}function pn(n,e){var i,t=e.s<0,r=en(n,n.precision,1),o=r.times(.5);if((e=e.abs()).lte(o))return x=t?4:1,e;if((i=e.divToInt(r)).isZero())x=t?3:2;else{if((e=e.minus(i.times(r))).lte(o))return x=sn(i)?t?2:3:t?4:1,e;x=sn(i)?t?1:4:t?3:2}return e.minus(r).abs()}function mn(n,e,i,t){var r,o,s,u,c,a,f,d,l,h=n.constructor,g=void 0!==i;if(g?(W(i,1,M),void 0===t?t=h.rounding:W(t,0,8)):(i=h.precision,t=h.rounding),n.isFinite()){for(g?(r=2,16==e?i=4*i-3:8==e&&(i=3*i-2)):r=e,(s=(f=X(n)).indexOf("."))>=0&&(f=f.replace(".",""),(l=new h(1)).e=f.length-s,l.d=J(X(l),10,r),l.e=l.d.length),o=c=(d=J(f,10,r)).length;0==d[--c];)d.pop();if(d[0]){if(s<0?o--:((n=new h(n)).d=d,n.e=o,d=(n=K(n,l,i,t,0,r)).d,o=n.e,a=b),s=d[i],u=r/2,a=a||void 0!==d[i+1],a=t<4?(void 0!==s||a)&&(0===t||t===(n.s<0?3:2)):s>u||s===u&&(4===t||a||6===t&&1&d[i-1]||t===(n.s<0?8:7)),d.length=i,a)for(;++d[--i]>r-1;)d[i]=0,i||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,f="";s<c;s++)f+=O.charAt(d[s]);if(g){if(c>1)if(16==e||8==e){for(s=16==e?4:3,--c;c%s;c++)f+="0";for(c=(d=J(f,r,e)).length;!d[c-1];--c);for(s=1,f="1.";s<c;s++)f+=O.charAt(d[s])}else f=f.charAt(0)+"."+f.slice(1);f=f+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)f="0"+f;f="0."+f}else if(++o>c)for(o-=c;o--;)f+="0";else o<c&&(f=f.slice(0,o)+"."+f.slice(o))}else f=g?"0p+0":"0";f=(16==e?"0x":2==e?"0b":8==e?"0o":"")+f}else f=fn(n);return n.s<0?"-"+f:f}function wn(n,e){if(n.length>e)return n.length=e,!0}function vn(n){return new this(n).abs()}function Nn(n){return new this(n).acos()}function yn(n){return new this(n).acosh()}function En(n,e){return new this(n).plus(e)}function bn(n){return new this(n).asin()}function xn(n){return new this(n).asinh()}function Pn(n){return new this(n).atan()}function Mn(n){return new this(n).atanh()}function On(n,e){n=new this(n),e=new this(e);var i,t=this.precision,r=this.rounding,o=t+4;return n.s&&e.s?n.d||e.d?!e.d||n.isZero()?(i=e.s<0?en(this,t,r):new this(0)).s=n.s:!n.d||e.isZero()?(i=en(this,o,1).times(.5)).s=n.s:e.s<0?(this.precision=o,this.rounding=1,i=this.atan(K(n,e,o,1)),e=en(this,o,1),this.precision=t,this.rounding=r,i=n.s<0?i.minus(e):i.plus(e)):i=this.atan(K(n,e,o,1)):(i=en(this,o,1).times(e.s>0?.25:.75)).s=n.s:i=new this(NaN),i}function Sn(n){return new this(n).cbrt()}function Tn(n){return Q(n=new this(n),n.e+1,2)}function An(n,e,i){return new this(n).clamp(e,i)}function Dn(n){if(!n||"object"!=typeof n)throw Error(q+"Object expected");var e,i,t,r=!0===n.defaults,o=["precision",1,M,"rounding",0,8,"toExpNeg",-P,0,"toExpPos",0,P,"maxE",0,P,"minE",-P,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(i=o[e],r&&(this[i]=A[i]),void 0!==(t=n[i])){if(!(L(t)===t&&t>=o[e+1]&&t<=o[e+2]))throw Error(R+i+": "+t);this[i]=t}if(i="crypto",r&&(this[i]=A[i]),void 0!==(t=n[i])){if(!0!==t&&!1!==t&&0!==t&&1!==t)throw Error(R+i+": "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(C);this[i]=!0}else this[i]=!1}return this}function qn(n){return new this(n).cos()}function Rn(n){return new this(n).cosh()}function Fn(n,e){return new this(n).div(e)}function Cn(n){return new this(n).exp()}function In(n){return Q(n=new this(n),n.e+1,3)}function Ln(){var n,e,i=new this(0);for(D=!1,n=0;n<arguments.length;)if((e=new this(arguments[n++])).d)i.d&&(i=i.plus(e.times(e)));else{if(e.s)return D=!0,new this(1/0);i=e}return D=!0,i.sqrt()}function kn(n){return n instanceof re||n&&n.toStringTag===I||!1}function Un(n){return new this(n).ln()}function Zn(n,e){return new this(n).log(e)}function Hn(n){return new this(n).log(2)}function _n(n){return new this(n).log(10)}function Bn(){return un(this,arguments,"lt")}function jn(){return un(this,arguments,"gt")}function Gn(n,e){return new this(n).mod(e)}function Vn(n,e){return new this(n).mul(e)}function $n(n,e){return new this(n).pow(e)}function Wn(n){var e,i,t,r,o=0,s=new this(1),u=[];if(void 0===n?n=this.precision:W(n,1,M),t=Math.ceil(n/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(t));o<t;)(r=e[o])>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=r%1e7;else{if(!crypto.randomBytes)throw Error(C);for(e=crypto.randomBytes(t*=4);o<t;)(r=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((127&e[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,o):(u.push(r%1e7),o+=4);o=t/4}else for(;o<t;)u[o++]=1e7*Math.random()|0;for(n%=7,(t=u[--o])&&n&&(r=k(10,7-n),u[o]=(t/r|0)*r);0===u[o];o--)u.pop();if(o<0)i=0,u=[0];else{for(i=-1;0===u[0];i-=7)u.shift();for(t=1,r=u[0];r>=10;r/=10)t++;t<7&&(i-=7-t)}return s.e=i,s.d=u,s}function zn(n){return Q(n=new this(n),n.e+1,this.rounding)}function Jn(n){return(n=new this(n)).d?n.d[0]?n.s:0*n.s:n.s||NaN}function Kn(n){return new this(n).sin()}function Qn(n){return new this(n).sinh()}function Xn(n){return new this(n).sqrt()}function Yn(n,e){return new this(n).sub(e)}function ne(){var n=0,e=arguments,i=new this(e[n]);for(D=!1;i.s&&++n<e.length;)i=i.plus(e[n]);return D=!0,Q(i,this.precision,this.rounding)}function ee(n){return new this(n).tan()}function ie(n){return new this(n).tanh()}function te(n){return Q(n=new this(n),n.e+1,1)}V[Symbol.for("nodejs.util.inspect.custom")]=V.toString,V[Symbol.toStringTag]="Decimal";var re=V.constructor=function n(e){var i,t,r;function o(n){var e,i,t,r=this;if(!(r instanceof o))return new o(n);if(r.constructor=o,kn(n))return r.s=n.s,void(D?!n.d||n.e>o.maxE?(r.e=NaN,r.d=null):n.e<o.minE?(r.e=0,r.d=[0]):(r.e=n.e,r.d=n.d.slice()):(r.e=n.e,r.d=n.d?n.d.slice():n.d));if("number"==(t=typeof n)){if(0===n)return r.s=1/n<0?-1:1,r.e=0,void(r.d=[0]);if(n<0?(n=-n,r.s=-1):r.s=1,n===~~n&&n<1e7){for(e=0,i=n;i>=10;i/=10)e++;return void(D?e>o.maxE?(r.e=NaN,r.d=null):e<o.minE?(r.e=0,r.d=[0]):(r.e=e,r.d=[n]):(r.e=e,r.d=[n]))}return 0*n!=0?(n||(r.s=NaN),r.e=NaN,void(r.d=null)):dn(r,n.toString())}if("string"!==t)throw Error(R+n);return 45===(i=n.charCodeAt(0))?(n=n.slice(1),r.s=-1):(43===i&&(n=n.slice(1)),r.s=1),_.test(n)?dn(r,n):ln(r,n)}if(o.prototype=V,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=Dn,o.clone=n,o.isDecimal=kn,o.abs=vn,o.acos=Nn,o.acosh=yn,o.add=En,o.asin=bn,o.asinh=xn,o.atan=Pn,o.atanh=Mn,o.atan2=On,o.cbrt=Sn,o.ceil=Tn,o.clamp=An,o.cos=qn,o.cosh=Rn,o.div=Fn,o.exp=Cn,o.floor=In,o.hypot=Ln,o.ln=Un,o.log=Zn,o.log10=_n,o.log2=Hn,o.max=Bn,o.min=jn,o.mod=Gn,o.mul=Vn,o.pow=$n,o.random=Wn,o.round=zn,o.sign=Jn,o.sin=Kn,o.sinh=Qn,o.sqrt=Xn,o.sub=Yn,o.sum=ne,o.tan=ee,o.tanh=ie,o.trunc=te,void 0===e&&(e={}),e&&!0!==e.defaults)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<r.length;)e.hasOwnProperty(t=r[i++])||(e[t]=this[t]);return o.config(e),o}(A);S=new re(S),T=new re(T);const oe=re,se=n=>new oe(n).toDecimalPlaces(2).toNumber();return e})()));
1
+ define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var n={60:n=>{n.exports=e}},t={};function o(e){var r=t[e];if(void 0!==r)return r.exports;var a=t[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return o.d(n,{a:n}),n},o.d=(e,n)=>{for(var t in n)o.o(n,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},o.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{let e,n,t,a;o.r(r),o.d(r,{EBookingPaymentMethod:()=>n,ECompanyProvider:()=>c,EDistanceUnitType:()=>d,EGuarantyPolicyPrepaymentType:()=>f,EHotelCardProcessor:()=>t,EHotelPriceModel:()=>l,EHotelStateFieldConfiguration:()=>u,EHotelWeekdayStartsOn:()=>s,EIntegration:()=>p,EPlanpayBookingStatus:()=>a,ERMSDiscountType:()=>g,ERoomstayImageSize:()=>P,HttpMethod:()=>m,IAuxiliaryFilterType:()=>y,IBookingStatus:()=>e,PCIBookingCardProcessorTypes:()=>i,calculateTotalForMemberBooking:()=>T,nameof:()=>O,resizeRoomstayImageUrl:()=>E,roundMoney:()=>M,subset:()=>C,uppercaseString:()=>S}),function(e){e.Pending="Pending",e.Committed="Committed",e.Cancelled="Cancelled"}(e||(e={})),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.PCIBookingCard="PCIBookingCard"}(n||(n={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave"}(t||(t={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(a||(a={}));const i=[];let c,d,l,u,s,y,p,g,P,f,m;function S(e){return e.toUpperCase()}!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay"}(c||(c={})),function(e){e.Metric="metric",e.Imperial="imperial"}(d||(d={})),function(e){e.PerPerson="PerPerson",e.PerDay="PerDay",e.PerOccupancy="PerOccupancy"}(l||(l={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(u||(u={})),function(e){e.Monday="monday",e.Sunday="sunday"}(s||(s={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(y||(y={})),function(e){e.Big4="Big4",e.Top10="Top10",e.Gday="Gday",e.Salesforce="Salesforce"}(p||(p={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(g||(g={})),function(e){e[e.Icon=128]="Icon",e[e.Tiny=256]="Tiny",e[e.Small=512]="Small",e[e.Medium=768]="Medium",e[e.Large=1024]="Large",e[e.ExtraLarge=1600]="ExtraLarge"}(P||(P={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(f||(f={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(m||(m={}));const T=e=>{let n=0;const t=Object.values(e.itinerary);for(const e of t){const t=Object.keys(e.nights);for(const o of t)n+=e.nights[o].total}return n},E=(e,n)=>e.includes("cdn.app.roomstay.io")?e+"?w="+n:e,O=e=>e,C=(e,n)=>{const t={};return n.forEach((n=>{n in e&&(t[n]=e[n])})),t};var v=o(60),A=o.n(v);const M=e=>new(A())(e).toDecimalPlaces(2).toNumber()})(),r})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomstay/core",
3
- "version": "0.1.37",
3
+ "version": "0.1.38-0",
4
4
  "description": "Details shared between Roomstay libraries. Anything from Currency, to Generic types",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -35,6 +35,7 @@
35
35
  "@babel/runtime": "^7.11.2",
36
36
  "babel": "^6.23.0",
37
37
  "babel-loader": "^8.1.0",
38
+ "decimal.js": "^10.4.3",
38
39
  "np": "^7.6.3",
39
40
  "resolve-tspaths": "^0.8.3",
40
41
  "shx": "^0.3.4",
@@ -43,7 +44,7 @@
43
44
  "webpack": "^5.75.0",
44
45
  "webpack-cli": "^5.0.0"
45
46
  },
46
- "dependencies": {
47
+ "peerDependencies": {
47
48
  "decimal.js": "^10.4.3"
48
49
  }
49
50
  }