@cedros/pay-react 1.1.21 → 1.1.23

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.
Files changed (114) hide show
  1. package/dist/{AISettingsSection-BXWZcMQT.js → AISettingsSection-DAztmwnN.js} +1 -1
  2. package/dist/{AISettingsSection-8eDaxYp8.mjs → AISettingsSection-DpMIk431.mjs} +2 -2
  3. package/dist/{AutosaveIndicator-3S7EvXip.mjs → AutosaveIndicator-BRCqAWqP.mjs} +1 -1
  4. package/dist/{AutosaveIndicator-DW4IPbZ5.js → AutosaveIndicator-BnQkKxzr.js} +1 -1
  5. package/dist/{CedrosContext-D-lnoEkR.js → CedrosContext-7dwmEeUY.js} +2 -2
  6. package/dist/{CedrosContext-BE6P5PQ0.mjs → CedrosContext-BlArEF7k.mjs} +95 -78
  7. package/dist/{CryptoButton-Dy-g3bR0.js → CryptoButton-C1AAOOfj.js} +1 -1
  8. package/dist/{CryptoButton-CksMkZjL.mjs → CryptoButton-CREryx1l.mjs} +2 -2
  9. package/dist/{FAQSection-Dg-I7Z-N.mjs → FAQSection-Ruzs7a-0.mjs} +1 -1
  10. package/dist/{FAQSection-r6eKjfdO.js → FAQSection-yw64HLy3.js} +1 -1
  11. package/dist/{MessagingSection-D39EuOLN.mjs → MessagingSection-BLRjfBQT.mjs} +2 -2
  12. package/dist/{MessagingSection-Cld5Q7ZM.js → MessagingSection-Dp_SaXsv.js} +1 -1
  13. package/dist/OrdersSection-C2dyWqrR.js +1 -0
  14. package/dist/OrdersSection-l-MtP9EN.mjs +233 -0
  15. package/dist/{PaymentSettingsSection-CEGHN6VI.mjs → PaymentSettingsSection-Bbq93UtC.mjs} +1 -1
  16. package/dist/{PaymentSettingsSection-B-MRsh1K.js → PaymentSettingsSection-C5bhLgU7.js} +1 -1
  17. package/dist/{SettingsSection-ZrzfLBlS.js → SettingsSection-D_pKPRrP.js} +1 -1
  18. package/dist/{SettingsSection-CPFOuoZG.mjs → SettingsSection-DorqCFXE.mjs} +1 -1
  19. package/dist/SingleCategorySettings-BAND8Zkw.mjs +1006 -0
  20. package/dist/SingleCategorySettings-Cg-zuJfr.js +3 -0
  21. package/dist/{StorefrontSection-f54ySA6i.mjs → StorefrontSection-FSOxBclu.mjs} +2 -2
  22. package/dist/{StorefrontSection-DGVcJu1T.js → StorefrontSection-QZPEZ6Lz.js} +1 -1
  23. package/dist/{SubscriptionsSection-F2IiU2jv.mjs → SubscriptionsSection-C4TDXCX2.mjs} +1 -1
  24. package/dist/{SubscriptionsSection-fzbL5DGC.js → SubscriptionsSection-DYr99VzB.js} +1 -1
  25. package/dist/Token22Section-Cmn2lKcd.mjs +1685 -0
  26. package/dist/Token22Section-D3nnUyim.js +1 -0
  27. package/dist/{WalletManager-QcfgQmap.js → WalletManager-Bwk3rgr1.js} +1 -1
  28. package/dist/{WalletManager-D78miaJ2.mjs → WalletManager-peBN6RDH.mjs} +1 -1
  29. package/dist/bn-CHdpZHQm.mjs +1185 -0
  30. package/dist/bn-RbgIlcHc.js +1 -0
  31. package/dist/configApi-Ch0Rr7TD.mjs +554 -0
  32. package/dist/configApi-CxEbCAgG.js +1 -0
  33. package/dist/crypto-only.js +1 -1
  34. package/dist/crypto-only.mjs +54 -52
  35. package/dist/{index-bqhsxBTY.mjs → index-CKNB7XsA.mjs} +6709 -5888
  36. package/dist/index-vEe2Y39x.js +84 -0
  37. package/dist/index.js +1 -1
  38. package/dist/index.mjs +34 -32
  39. package/dist/pay-react_false-CPX8Vyp9.mjs +5 -0
  40. package/dist/pay-react_false-DaeIe3_l.js +1 -0
  41. package/dist/{sections-Dh0qFSUW.js → sections-Cklkxd85.js} +1 -1
  42. package/dist/{sections-CiAMjlPd.mjs → sections-Dt6vxDU4.mjs} +1 -1
  43. package/dist/src/components/CreditsBalance.d.ts +24 -0
  44. package/dist/src/components/CreditsBalance.d.ts.map +1 -0
  45. package/dist/src/components/admin/AssetClassesTab.d.ts +20 -0
  46. package/dist/src/components/admin/AssetClassesTab.d.ts.map +1 -0
  47. package/dist/src/components/admin/AssetRedemptionManager.d.ts +21 -0
  48. package/dist/src/components/admin/AssetRedemptionManager.d.ts.map +1 -0
  49. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
  50. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
  51. package/dist/src/components/admin/GiftCardComplianceTab.d.ts +3 -0
  52. package/dist/src/components/admin/GiftCardComplianceTab.d.ts.map +1 -0
  53. package/dist/src/components/admin/LiquidityPoolTab.d.ts +11 -0
  54. package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -0
  55. package/dist/src/components/admin/OrdersSection.d.ts +3 -0
  56. package/dist/src/components/admin/OrdersSection.d.ts.map +1 -0
  57. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
  58. package/dist/src/components/admin/RedemptionFormBuilder.d.ts +25 -0
  59. package/dist/src/components/admin/RedemptionFormBuilder.d.ts.map +1 -0
  60. package/dist/src/components/admin/Token22Section.d.ts +3 -0
  61. package/dist/src/components/admin/Token22Section.d.ts.map +1 -0
  62. package/dist/src/components/admin/configApi.d.ts.map +1 -1
  63. package/dist/src/components/admin/index.d.ts +3 -0
  64. package/dist/src/components/admin/index.d.ts.map +1 -1
  65. package/dist/src/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -1
  66. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  67. package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts +13 -0
  68. package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts.map +1 -0
  69. package/dist/src/ecommerce/components/catalog/ProductCard.d.ts.map +1 -1
  70. package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -1
  71. package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts +9 -2
  72. package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +1 -1
  73. package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts +7 -1
  74. package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +1 -1
  75. package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts +22 -0
  76. package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts.map +1 -0
  77. package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts +36 -0
  78. package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts.map +1 -0
  79. package/dist/src/ecommerce/components/orders/OrderCard.d.ts.map +1 -1
  80. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts +5 -1
  81. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -1
  82. package/dist/src/ecommerce/index.d.ts +6 -0
  83. package/dist/src/ecommerce/index.d.ts.map +1 -1
  84. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts +1 -0
  85. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -1
  86. package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
  87. package/dist/src/ecommerce/templates/ProductTemplate.d.ts.map +1 -1
  88. package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts +5 -1
  89. package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +1 -1
  90. package/dist/src/ecommerce/types.d.ts +20 -0
  91. package/dist/src/ecommerce/types.d.ts.map +1 -1
  92. package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -1
  93. package/dist/src/ecommerce/utils/safeHref.d.ts +9 -0
  94. package/dist/src/ecommerce/utils/safeHref.d.ts.map +1 -0
  95. package/dist/src/hooks/useCreditsBalance.d.ts +32 -0
  96. package/dist/src/hooks/useCreditsBalance.d.ts.map +1 -0
  97. package/dist/src/index.d.ts +4 -0
  98. package/dist/src/index.d.ts.map +1 -1
  99. package/dist/src/managers/CreditsManager.d.ts +15 -0
  100. package/dist/src/managers/CreditsManager.d.ts.map +1 -1
  101. package/dist/src/managers/MeteoraPoolManager.d.ts +86 -0
  102. package/dist/src/managers/MeteoraPoolManager.d.ts.map +1 -0
  103. package/dist/stripe-only.js +1 -1
  104. package/dist/stripe-only.mjs +2 -2
  105. package/dist/{styles-BWrLnaUW.js → styles-21F1-oqx.js} +1 -1
  106. package/dist/{styles--eKKnfdj.mjs → styles-2VMpwuaI.mjs} +3 -3
  107. package/dist/testing/index.js +1 -1
  108. package/dist/testing/index.mjs +1 -1
  109. package/dist/{walletPool-BqNfOhB0.js → walletPool-Ddv33tej.js} +1 -1
  110. package/dist/{walletPool-DShNjCQ6.mjs → walletPool-DgQsh7Se.mjs} +1 -1
  111. package/package.json +5 -1
  112. package/dist/SingleCategorySettings-DhHGIGwB.mjs +0 -1418
  113. package/dist/SingleCategorySettings-DxjCafCk.js +0 -3
  114. package/dist/index-7YUxR4u5.js +0 -84
@@ -0,0 +1 @@
1
+ "use strict";function mi(it,nt){for(var ft=0;ft<nt.length;ft++){const d=nt[ft];if(typeof d!="string"&&!Array.isArray(d)){for(const rt in d)if(rt!=="default"&&!(rt in it)){const l=Object.getOwnPropertyDescriptor(d,rt);l&&Object.defineProperty(it,rt,l.get?l:{enumerable:!0,get:()=>d[rt]})}}}return Object.freeze(Object.defineProperty(it,Symbol.toStringTag,{value:"Module"}))}function pi(it){return it&&it.__esModule&&Object.prototype.hasOwnProperty.call(it,"default")?it.default:it}function Mi(it){if(Object.prototype.hasOwnProperty.call(it,"__esModule"))return it;var nt=it.default;if(typeof nt=="function"){var ft=function d(){var rt=!1;try{rt=this instanceof d}catch{}return rt?Reflect.construct(nt,arguments,this.constructor):nt.apply(this,arguments)};ft.prototype=nt.prototype}else ft={};return Object.defineProperty(ft,"__esModule",{value:!0}),Object.keys(it).forEach(function(d){var rt=Object.getOwnPropertyDescriptor(it,d);Object.defineProperty(ft,d,rt.get?rt:{enumerable:!0,get:function(){return it[d]}})}),ft}const ci={},gi=Object.freeze(Object.defineProperty({__proto__:null,default:ci},Symbol.toStringTag,{value:"Module"}));var lt={exports:{}};const wi=Mi(gi);var yi=lt.exports,oi;function xi(){return oi||(oi=1,(function(it){(function(nt,ft){function d(o,t){if(!o)throw new Error(t||"Assertion failed")}function rt(o,t){o.super_=t;var r=function(){};r.prototype=t.prototype,o.prototype=new r,o.prototype.constructor=o}function l(o,t,r){if(l.isBN(o))return o;this.negative=0,this.words=null,this.length=0,this.red=null,o!==null&&((t==="le"||t==="be")&&(r=t,t=10),this._init(o||0,t||10,r||"be"))}typeof nt=="object"?nt.exports=l:ft.BN=l,l.BN=l,l.wordSize=26;var ot;try{typeof window<"u"&&typeof window.Buffer<"u"?ot=window.Buffer:ot=wi.Buffer}catch{}l.isBN=function(t){return t instanceof l?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===l.wordSize&&Array.isArray(t.words)},l.max=function(t,r){return t.cmp(r)>0?t:r},l.min=function(t,r){return t.cmp(r)<0?t:r},l.prototype._init=function(t,r,e){if(typeof t=="number")return this._initNumber(t,r,e);if(typeof t=="object")return this._initArray(t,r,e);r==="hex"&&(r=16),d(r===(r|0)&&r>=2&&r<=36),t=t.toString().replace(/\s+/g,"");var f=0;t[0]==="-"&&(f++,this.negative=1),f<t.length&&(r===16?this._parseHex(t,f,e):(this._parseBase(t,r,f),e==="le"&&this._initArray(this.toArray(),r,e)))},l.prototype._initNumber=function(t,r,e){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[t&67108863],this.length=1):t<4503599627370496?(this.words=[t&67108863,t/67108864&67108863],this.length=2):(d(t<9007199254740992),this.words=[t&67108863,t/67108864&67108863,1],this.length=3),e==="le"&&this._initArray(this.toArray(),r,e)},l.prototype._initArray=function(t,r,e){if(d(typeof t.length=="number"),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var s,a,u=0;if(e==="be")for(f=t.length-1,s=0;f>=0;f-=3)a=t[f]|t[f-1]<<8|t[f-2]<<16,this.words[s]|=a<<u&67108863,this.words[s+1]=a>>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);else if(e==="le")for(f=0,s=0;f<t.length;f+=3)a=t[f]|t[f+1]<<8|t[f+2]<<16,this.words[s]|=a<<u&67108863,this.words[s+1]=a>>>26-u&67108863,u+=24,u>=26&&(u-=26,s++);return this._strip()};function Zt(o,t){var r=o.charCodeAt(t);if(r>=48&&r<=57)return r-48;if(r>=65&&r<=70)return r-55;if(r>=97&&r<=102)return r-87;d(!1,"Invalid character in "+o)}function Et(o,t,r){var e=Zt(o,r);return r-1>=t&&(e|=Zt(o,r-1)<<4),e}l.prototype._parseHex=function(t,r,e){this.length=Math.ceil((t.length-r)/6),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var s=0,a=0,u;if(e==="be")for(f=t.length-1;f>=r;f-=2)u=Et(t,r,f)<<s,this.words[a]|=u&67108863,s>=18?(s-=18,a+=1,this.words[a]|=u>>>26):s+=8;else{var h=t.length-r;for(f=h%2===0?r+1:r;f<t.length;f+=2)u=Et(t,r,f)<<s,this.words[a]|=u&67108863,s>=18?(s-=18,a+=1,this.words[a]|=u>>>26):s+=8}this._strip()};function Tt(o,t,r,e){for(var f=0,s=0,a=Math.min(o.length,r),u=t;u<a;u++){var h=o.charCodeAt(u)-48;f*=e,h>=49?s=h-49+10:h>=17?s=h-17+10:s=h,d(h>=0&&s<e,"Invalid character"),f+=s}return f}l.prototype._parseBase=function(t,r,e){this.words=[0],this.length=1;for(var f=0,s=1;s<=67108863;s*=r)f++;f--,s=s/r|0;for(var a=t.length-e,u=a%f,h=Math.min(a,a-u)+e,i=0,n=e;n<h;n+=f)i=Tt(t,n,n+f,r),this.imuln(s),this.words[0]+i<67108864?this.words[0]+=i:this._iaddn(i);if(u!==0){var m=1;for(i=Tt(t,n,t.length,r),n=0;n<u;n++)m*=r;this.imuln(m),this.words[0]+i<67108864?this.words[0]+=i:this._iaddn(i)}this._strip()},l.prototype.copy=function(t){t.words=new Array(this.length);for(var r=0;r<this.length;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red};function It(o,t){o.words=t.words,o.length=t.length,o.negative=t.negative,o.red=t.red}if(l.prototype._move=function(t){It(t,this)},l.prototype.clone=function(){var t=new l(null);return this.copy(t),t},l.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},l.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},l.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{l.prototype[Symbol.for("nodejs.util.inspect.custom")]=ut}catch{l.prototype.inspect=ut}else l.prototype.inspect=ut;function ut(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var zt=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],li=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ui=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];l.prototype.toString=function(t,r){t=t||10,r=r|0||1;var e;if(t===16||t==="hex"){e="";for(var f=0,s=0,a=0;a<this.length;a++){var u=this.words[a],h=((u<<f|s)&16777215).toString(16);s=u>>>24-f&16777215,f+=2,f>=26&&(f-=26,a--),s!==0||a!==this.length-1?e=zt[6-h.length]+h+e:e=h+e}for(s!==0&&(e=s.toString(16)+e);e.length%r!==0;)e="0"+e;return this.negative!==0&&(e="-"+e),e}if(t===(t|0)&&t>=2&&t<=36){var i=li[t],n=ui[t];e="";var m=this.clone();for(m.negative=0;!m.isZero();){var v=m.modrn(n).toString(t);m=m.idivn(n),m.isZero()?e=v+e:e=zt[i-v.length]+v+e}for(this.isZero()&&(e="0"+e);e.length%r!==0;)e="0"+e;return this.negative!==0&&(e="-"+e),e}d(!1,"Base should be between 2 and 36")},l.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&d(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},l.prototype.toJSON=function(){return this.toString(16,2)},ot&&(l.prototype.toBuffer=function(t,r){return this.toArrayLike(ot,t,r)}),l.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)};var di=function(t,r){return t.allocUnsafe?t.allocUnsafe(r):new t(r)};l.prototype.toArrayLike=function(t,r,e){this._strip();var f=this.byteLength(),s=e||Math.max(1,f);d(f<=s,"byte array longer than desired length"),d(s>0,"Requested array length <= 0");var a=di(t,s),u=r==="le"?"LE":"BE";return this["_toArrayLike"+u](a,f),a},l.prototype._toArrayLikeLE=function(t,r){for(var e=0,f=0,s=0,a=0;s<this.length;s++){var u=this.words[s]<<a|f;t[e++]=u&255,e<t.length&&(t[e++]=u>>8&255),e<t.length&&(t[e++]=u>>16&255),a===6?(e<t.length&&(t[e++]=u>>24&255),f=0,a=0):(f=u>>>24,a+=2)}if(e<t.length)for(t[e++]=f;e<t.length;)t[e++]=0},l.prototype._toArrayLikeBE=function(t,r){for(var e=t.length-1,f=0,s=0,a=0;s<this.length;s++){var u=this.words[s]<<a|f;t[e--]=u&255,e>=0&&(t[e--]=u>>8&255),e>=0&&(t[e--]=u>>16&255),a===6?(e>=0&&(t[e--]=u>>24&255),f=0,a=0):(f=u>>>24,a+=2)}if(e>=0)for(t[e--]=f;e>=0;)t[e--]=0},Math.clz32?l.prototype._countBits=function(t){return 32-Math.clz32(t)}:l.prototype._countBits=function(t){var r=t,e=0;return r>=4096&&(e+=13,r>>>=13),r>=64&&(e+=7,r>>>=7),r>=8&&(e+=4,r>>>=4),r>=2&&(e+=2,r>>>=2),e+r},l.prototype._zeroBits=function(t){if(t===0)return 26;var r=t,e=0;return(r&8191)===0&&(e+=13,r>>>=13),(r&127)===0&&(e+=7,r>>>=7),(r&15)===0&&(e+=4,r>>>=4),(r&3)===0&&(e+=2,r>>>=2),(r&1)===0&&e++,e},l.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return(this.length-1)*26+r};function vi(o){for(var t=new Array(o.bitLength()),r=0;r<t.length;r++){var e=r/26|0,f=r%26;t[r]=o.words[e]>>>f&1}return t}l.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;r<this.length;r++){var e=this._zeroBits(this.words[r]);if(t+=e,e!==26)break}return t},l.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},l.prototype.toTwos=function(t){return this.negative!==0?this.abs().inotn(t).iaddn(1):this.clone()},l.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},l.prototype.isNeg=function(){return this.negative!==0},l.prototype.neg=function(){return this.clone().ineg()},l.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},l.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]|t.words[r];return this._strip()},l.prototype.ior=function(t){return d((this.negative|t.negative)===0),this.iuor(t)},l.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},l.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},l.prototype.iuand=function(t){var r;this.length>t.length?r=t:r=this;for(var e=0;e<r.length;e++)this.words[e]=this.words[e]&t.words[e];return this.length=r.length,this._strip()},l.prototype.iand=function(t){return d((this.negative|t.negative)===0),this.iuand(t)},l.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},l.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},l.prototype.iuxor=function(t){var r,e;this.length>t.length?(r=this,e=t):(r=t,e=this);for(var f=0;f<e.length;f++)this.words[f]=r.words[f]^e.words[f];if(this!==r)for(;f<r.length;f++)this.words[f]=r.words[f];return this.length=r.length,this._strip()},l.prototype.ixor=function(t){return d((this.negative|t.negative)===0),this.iuxor(t)},l.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},l.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},l.prototype.inotn=function(t){d(typeof t=="number"&&t>=0);var r=Math.ceil(t/26)|0,e=t%26;this._expand(r),e>0&&r--;for(var f=0;f<r;f++)this.words[f]=~this.words[f]&67108863;return e>0&&(this.words[f]=~this.words[f]&67108863>>26-e),this._strip()},l.prototype.notn=function(t){return this.clone().inotn(t)},l.prototype.setn=function(t,r){d(typeof t=="number"&&t>=0);var e=t/26|0,f=t%26;return this._expand(e+1),r?this.words[e]=this.words[e]|1<<f:this.words[e]=this.words[e]&~(1<<f),this._strip()},l.prototype.iadd=function(t){var r;if(this.negative!==0&&t.negative===0)return this.negative=0,r=this.isub(t),this.negative^=1,this._normSign();if(this.negative===0&&t.negative!==0)return t.negative=0,r=this.isub(t),t.negative=1,r._normSign();var e,f;this.length>t.length?(e=this,f=t):(e=t,f=this);for(var s=0,a=0;a<f.length;a++)r=(e.words[a]|0)+(f.words[a]|0)+s,this.words[a]=r&67108863,s=r>>>26;for(;s!==0&&a<e.length;a++)r=(e.words[a]|0)+s,this.words[a]=r&67108863,s=r>>>26;if(this.length=e.length,s!==0)this.words[this.length]=s,this.length++;else if(e!==this)for(;a<e.length;a++)this.words[a]=e.words[a];return this},l.prototype.add=function(t){var r;return t.negative!==0&&this.negative===0?(t.negative=0,r=this.sub(t),t.negative^=1,r):t.negative===0&&this.negative!==0?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},l.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var e=this.cmp(t);if(e===0)return this.negative=0,this.length=1,this.words[0]=0,this;var f,s;e>0?(f=this,s=t):(f=t,s=this);for(var a=0,u=0;u<s.length;u++)r=(f.words[u]|0)-(s.words[u]|0)+a,a=r>>26,this.words[u]=r&67108863;for(;a!==0&&u<f.length;u++)r=(f.words[u]|0)+a,a=r>>26,this.words[u]=r&67108863;if(a===0&&u<f.length&&f!==this)for(;u<f.length;u++)this.words[u]=f.words[u];return this.length=Math.max(this.length,u),f!==this&&(this.negative=1),this._strip()},l.prototype.sub=function(t){return this.clone().isub(t)};function Pt(o,t,r){r.negative=t.negative^o.negative;var e=o.length+t.length|0;r.length=e,e=e-1|0;var f=o.words[0]|0,s=t.words[0]|0,a=f*s,u=a&67108863,h=a/67108864|0;r.words[0]=u;for(var i=1;i<e;i++){for(var n=h>>>26,m=h&67108863,v=Math.min(i,t.length-1),p=Math.max(0,i-o.length+1);p<=v;p++){var et=i-p|0;f=o.words[et]|0,s=t.words[p]|0,a=f*s+m,n+=a/67108864|0,m=a&67108863}r.words[i]=m|0,h=n|0}return h!==0?r.words[i]=h|0:r.length--,r._strip()}var Kt=function(t,r,e){var f=t.words,s=r.words,a=e.words,u=0,h,i,n,m=f[0]|0,v=m&8191,p=m>>>13,et=f[1]|0,M=et&8191,c=et>>>13,Ct=f[2]|0,w=Ct&8191,y=Ct>>>13,Ut=f[3]|0,x=Ut&8191,_=Ut>>>13,Jt=f[4]|0,b=Jt&8191,S=Jt>>>13,Wt=f[5]|0,A=Wt&8191,B=Wt>>>13,Gt=f[6]|0,k=Gt&8191,q=Gt>>>13,Qt=f[7]|0,N=Qt&8191,R=Qt>>>13,Vt=f[8]|0,L=Vt&8191,O=Vt>>>13,Xt=f[9]|0,Z=Xt&8191,E=Xt>>>13,Yt=s[0]|0,T=Yt&8191,I=Yt>>>13,jt=s[1]|0,z=jt&8191,P=jt>>>13,ti=s[2]|0,K=ti&8191,D=ti>>>13,ii=s[3]|0,F=ii&8191,$=ii>>>13,ri=s[4]|0,H=ri&8191,C=ri>>>13,ei=s[5]|0,U=ei&8191,J=ei>>>13,hi=s[6]|0,W=hi&8191,G=hi>>>13,fi=s[7]|0,Q=fi&8191,V=fi>>>13,ni=s[8]|0,X=ni&8191,Y=ni>>>13,si=s[9]|0,j=si&8191,tt=si>>>13;e.negative=t.negative^r.negative,e.length=19,h=Math.imul(v,T),i=Math.imul(v,I),i=i+Math.imul(p,T)|0,n=Math.imul(p,I);var mt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,h=Math.imul(M,T),i=Math.imul(M,I),i=i+Math.imul(c,T)|0,n=Math.imul(c,I),h=h+Math.imul(v,z)|0,i=i+Math.imul(v,P)|0,i=i+Math.imul(p,z)|0,n=n+Math.imul(p,P)|0;var pt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(pt>>>26)|0,pt&=67108863,h=Math.imul(w,T),i=Math.imul(w,I),i=i+Math.imul(y,T)|0,n=Math.imul(y,I),h=h+Math.imul(M,z)|0,i=i+Math.imul(M,P)|0,i=i+Math.imul(c,z)|0,n=n+Math.imul(c,P)|0,h=h+Math.imul(v,K)|0,i=i+Math.imul(v,D)|0,i=i+Math.imul(p,K)|0,n=n+Math.imul(p,D)|0;var Mt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,h=Math.imul(x,T),i=Math.imul(x,I),i=i+Math.imul(_,T)|0,n=Math.imul(_,I),h=h+Math.imul(w,z)|0,i=i+Math.imul(w,P)|0,i=i+Math.imul(y,z)|0,n=n+Math.imul(y,P)|0,h=h+Math.imul(M,K)|0,i=i+Math.imul(M,D)|0,i=i+Math.imul(c,K)|0,n=n+Math.imul(c,D)|0,h=h+Math.imul(v,F)|0,i=i+Math.imul(v,$)|0,i=i+Math.imul(p,F)|0,n=n+Math.imul(p,$)|0;var ct=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(ct>>>26)|0,ct&=67108863,h=Math.imul(b,T),i=Math.imul(b,I),i=i+Math.imul(S,T)|0,n=Math.imul(S,I),h=h+Math.imul(x,z)|0,i=i+Math.imul(x,P)|0,i=i+Math.imul(_,z)|0,n=n+Math.imul(_,P)|0,h=h+Math.imul(w,K)|0,i=i+Math.imul(w,D)|0,i=i+Math.imul(y,K)|0,n=n+Math.imul(y,D)|0,h=h+Math.imul(M,F)|0,i=i+Math.imul(M,$)|0,i=i+Math.imul(c,F)|0,n=n+Math.imul(c,$)|0,h=h+Math.imul(v,H)|0,i=i+Math.imul(v,C)|0,i=i+Math.imul(p,H)|0,n=n+Math.imul(p,C)|0;var gt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,h=Math.imul(A,T),i=Math.imul(A,I),i=i+Math.imul(B,T)|0,n=Math.imul(B,I),h=h+Math.imul(b,z)|0,i=i+Math.imul(b,P)|0,i=i+Math.imul(S,z)|0,n=n+Math.imul(S,P)|0,h=h+Math.imul(x,K)|0,i=i+Math.imul(x,D)|0,i=i+Math.imul(_,K)|0,n=n+Math.imul(_,D)|0,h=h+Math.imul(w,F)|0,i=i+Math.imul(w,$)|0,i=i+Math.imul(y,F)|0,n=n+Math.imul(y,$)|0,h=h+Math.imul(M,H)|0,i=i+Math.imul(M,C)|0,i=i+Math.imul(c,H)|0,n=n+Math.imul(c,C)|0,h=h+Math.imul(v,U)|0,i=i+Math.imul(v,J)|0,i=i+Math.imul(p,U)|0,n=n+Math.imul(p,J)|0;var wt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,h=Math.imul(k,T),i=Math.imul(k,I),i=i+Math.imul(q,T)|0,n=Math.imul(q,I),h=h+Math.imul(A,z)|0,i=i+Math.imul(A,P)|0,i=i+Math.imul(B,z)|0,n=n+Math.imul(B,P)|0,h=h+Math.imul(b,K)|0,i=i+Math.imul(b,D)|0,i=i+Math.imul(S,K)|0,n=n+Math.imul(S,D)|0,h=h+Math.imul(x,F)|0,i=i+Math.imul(x,$)|0,i=i+Math.imul(_,F)|0,n=n+Math.imul(_,$)|0,h=h+Math.imul(w,H)|0,i=i+Math.imul(w,C)|0,i=i+Math.imul(y,H)|0,n=n+Math.imul(y,C)|0,h=h+Math.imul(M,U)|0,i=i+Math.imul(M,J)|0,i=i+Math.imul(c,U)|0,n=n+Math.imul(c,J)|0,h=h+Math.imul(v,W)|0,i=i+Math.imul(v,G)|0,i=i+Math.imul(p,W)|0,n=n+Math.imul(p,G)|0;var yt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,h=Math.imul(N,T),i=Math.imul(N,I),i=i+Math.imul(R,T)|0,n=Math.imul(R,I),h=h+Math.imul(k,z)|0,i=i+Math.imul(k,P)|0,i=i+Math.imul(q,z)|0,n=n+Math.imul(q,P)|0,h=h+Math.imul(A,K)|0,i=i+Math.imul(A,D)|0,i=i+Math.imul(B,K)|0,n=n+Math.imul(B,D)|0,h=h+Math.imul(b,F)|0,i=i+Math.imul(b,$)|0,i=i+Math.imul(S,F)|0,n=n+Math.imul(S,$)|0,h=h+Math.imul(x,H)|0,i=i+Math.imul(x,C)|0,i=i+Math.imul(_,H)|0,n=n+Math.imul(_,C)|0,h=h+Math.imul(w,U)|0,i=i+Math.imul(w,J)|0,i=i+Math.imul(y,U)|0,n=n+Math.imul(y,J)|0,h=h+Math.imul(M,W)|0,i=i+Math.imul(M,G)|0,i=i+Math.imul(c,W)|0,n=n+Math.imul(c,G)|0,h=h+Math.imul(v,Q)|0,i=i+Math.imul(v,V)|0,i=i+Math.imul(p,Q)|0,n=n+Math.imul(p,V)|0;var xt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,h=Math.imul(L,T),i=Math.imul(L,I),i=i+Math.imul(O,T)|0,n=Math.imul(O,I),h=h+Math.imul(N,z)|0,i=i+Math.imul(N,P)|0,i=i+Math.imul(R,z)|0,n=n+Math.imul(R,P)|0,h=h+Math.imul(k,K)|0,i=i+Math.imul(k,D)|0,i=i+Math.imul(q,K)|0,n=n+Math.imul(q,D)|0,h=h+Math.imul(A,F)|0,i=i+Math.imul(A,$)|0,i=i+Math.imul(B,F)|0,n=n+Math.imul(B,$)|0,h=h+Math.imul(b,H)|0,i=i+Math.imul(b,C)|0,i=i+Math.imul(S,H)|0,n=n+Math.imul(S,C)|0,h=h+Math.imul(x,U)|0,i=i+Math.imul(x,J)|0,i=i+Math.imul(_,U)|0,n=n+Math.imul(_,J)|0,h=h+Math.imul(w,W)|0,i=i+Math.imul(w,G)|0,i=i+Math.imul(y,W)|0,n=n+Math.imul(y,G)|0,h=h+Math.imul(M,Q)|0,i=i+Math.imul(M,V)|0,i=i+Math.imul(c,Q)|0,n=n+Math.imul(c,V)|0,h=h+Math.imul(v,X)|0,i=i+Math.imul(v,Y)|0,i=i+Math.imul(p,X)|0,n=n+Math.imul(p,Y)|0;var _t=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,h=Math.imul(Z,T),i=Math.imul(Z,I),i=i+Math.imul(E,T)|0,n=Math.imul(E,I),h=h+Math.imul(L,z)|0,i=i+Math.imul(L,P)|0,i=i+Math.imul(O,z)|0,n=n+Math.imul(O,P)|0,h=h+Math.imul(N,K)|0,i=i+Math.imul(N,D)|0,i=i+Math.imul(R,K)|0,n=n+Math.imul(R,D)|0,h=h+Math.imul(k,F)|0,i=i+Math.imul(k,$)|0,i=i+Math.imul(q,F)|0,n=n+Math.imul(q,$)|0,h=h+Math.imul(A,H)|0,i=i+Math.imul(A,C)|0,i=i+Math.imul(B,H)|0,n=n+Math.imul(B,C)|0,h=h+Math.imul(b,U)|0,i=i+Math.imul(b,J)|0,i=i+Math.imul(S,U)|0,n=n+Math.imul(S,J)|0,h=h+Math.imul(x,W)|0,i=i+Math.imul(x,G)|0,i=i+Math.imul(_,W)|0,n=n+Math.imul(_,G)|0,h=h+Math.imul(w,Q)|0,i=i+Math.imul(w,V)|0,i=i+Math.imul(y,Q)|0,n=n+Math.imul(y,V)|0,h=h+Math.imul(M,X)|0,i=i+Math.imul(M,Y)|0,i=i+Math.imul(c,X)|0,n=n+Math.imul(c,Y)|0,h=h+Math.imul(v,j)|0,i=i+Math.imul(v,tt)|0,i=i+Math.imul(p,j)|0,n=n+Math.imul(p,tt)|0;var bt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,h=Math.imul(Z,z),i=Math.imul(Z,P),i=i+Math.imul(E,z)|0,n=Math.imul(E,P),h=h+Math.imul(L,K)|0,i=i+Math.imul(L,D)|0,i=i+Math.imul(O,K)|0,n=n+Math.imul(O,D)|0,h=h+Math.imul(N,F)|0,i=i+Math.imul(N,$)|0,i=i+Math.imul(R,F)|0,n=n+Math.imul(R,$)|0,h=h+Math.imul(k,H)|0,i=i+Math.imul(k,C)|0,i=i+Math.imul(q,H)|0,n=n+Math.imul(q,C)|0,h=h+Math.imul(A,U)|0,i=i+Math.imul(A,J)|0,i=i+Math.imul(B,U)|0,n=n+Math.imul(B,J)|0,h=h+Math.imul(b,W)|0,i=i+Math.imul(b,G)|0,i=i+Math.imul(S,W)|0,n=n+Math.imul(S,G)|0,h=h+Math.imul(x,Q)|0,i=i+Math.imul(x,V)|0,i=i+Math.imul(_,Q)|0,n=n+Math.imul(_,V)|0,h=h+Math.imul(w,X)|0,i=i+Math.imul(w,Y)|0,i=i+Math.imul(y,X)|0,n=n+Math.imul(y,Y)|0,h=h+Math.imul(M,j)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(c,j)|0,n=n+Math.imul(c,tt)|0;var St=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(St>>>26)|0,St&=67108863,h=Math.imul(Z,K),i=Math.imul(Z,D),i=i+Math.imul(E,K)|0,n=Math.imul(E,D),h=h+Math.imul(L,F)|0,i=i+Math.imul(L,$)|0,i=i+Math.imul(O,F)|0,n=n+Math.imul(O,$)|0,h=h+Math.imul(N,H)|0,i=i+Math.imul(N,C)|0,i=i+Math.imul(R,H)|0,n=n+Math.imul(R,C)|0,h=h+Math.imul(k,U)|0,i=i+Math.imul(k,J)|0,i=i+Math.imul(q,U)|0,n=n+Math.imul(q,J)|0,h=h+Math.imul(A,W)|0,i=i+Math.imul(A,G)|0,i=i+Math.imul(B,W)|0,n=n+Math.imul(B,G)|0,h=h+Math.imul(b,Q)|0,i=i+Math.imul(b,V)|0,i=i+Math.imul(S,Q)|0,n=n+Math.imul(S,V)|0,h=h+Math.imul(x,X)|0,i=i+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=n+Math.imul(_,Y)|0,h=h+Math.imul(w,j)|0,i=i+Math.imul(w,tt)|0,i=i+Math.imul(y,j)|0,n=n+Math.imul(y,tt)|0;var At=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(At>>>26)|0,At&=67108863,h=Math.imul(Z,F),i=Math.imul(Z,$),i=i+Math.imul(E,F)|0,n=Math.imul(E,$),h=h+Math.imul(L,H)|0,i=i+Math.imul(L,C)|0,i=i+Math.imul(O,H)|0,n=n+Math.imul(O,C)|0,h=h+Math.imul(N,U)|0,i=i+Math.imul(N,J)|0,i=i+Math.imul(R,U)|0,n=n+Math.imul(R,J)|0,h=h+Math.imul(k,W)|0,i=i+Math.imul(k,G)|0,i=i+Math.imul(q,W)|0,n=n+Math.imul(q,G)|0,h=h+Math.imul(A,Q)|0,i=i+Math.imul(A,V)|0,i=i+Math.imul(B,Q)|0,n=n+Math.imul(B,V)|0,h=h+Math.imul(b,X)|0,i=i+Math.imul(b,Y)|0,i=i+Math.imul(S,X)|0,n=n+Math.imul(S,Y)|0,h=h+Math.imul(x,j)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(_,j)|0,n=n+Math.imul(_,tt)|0;var Bt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,h=Math.imul(Z,H),i=Math.imul(Z,C),i=i+Math.imul(E,H)|0,n=Math.imul(E,C),h=h+Math.imul(L,U)|0,i=i+Math.imul(L,J)|0,i=i+Math.imul(O,U)|0,n=n+Math.imul(O,J)|0,h=h+Math.imul(N,W)|0,i=i+Math.imul(N,G)|0,i=i+Math.imul(R,W)|0,n=n+Math.imul(R,G)|0,h=h+Math.imul(k,Q)|0,i=i+Math.imul(k,V)|0,i=i+Math.imul(q,Q)|0,n=n+Math.imul(q,V)|0,h=h+Math.imul(A,X)|0,i=i+Math.imul(A,Y)|0,i=i+Math.imul(B,X)|0,n=n+Math.imul(B,Y)|0,h=h+Math.imul(b,j)|0,i=i+Math.imul(b,tt)|0,i=i+Math.imul(S,j)|0,n=n+Math.imul(S,tt)|0;var kt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,h=Math.imul(Z,U),i=Math.imul(Z,J),i=i+Math.imul(E,U)|0,n=Math.imul(E,J),h=h+Math.imul(L,W)|0,i=i+Math.imul(L,G)|0,i=i+Math.imul(O,W)|0,n=n+Math.imul(O,G)|0,h=h+Math.imul(N,Q)|0,i=i+Math.imul(N,V)|0,i=i+Math.imul(R,Q)|0,n=n+Math.imul(R,V)|0,h=h+Math.imul(k,X)|0,i=i+Math.imul(k,Y)|0,i=i+Math.imul(q,X)|0,n=n+Math.imul(q,Y)|0,h=h+Math.imul(A,j)|0,i=i+Math.imul(A,tt)|0,i=i+Math.imul(B,j)|0,n=n+Math.imul(B,tt)|0;var qt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(qt>>>26)|0,qt&=67108863,h=Math.imul(Z,W),i=Math.imul(Z,G),i=i+Math.imul(E,W)|0,n=Math.imul(E,G),h=h+Math.imul(L,Q)|0,i=i+Math.imul(L,V)|0,i=i+Math.imul(O,Q)|0,n=n+Math.imul(O,V)|0,h=h+Math.imul(N,X)|0,i=i+Math.imul(N,Y)|0,i=i+Math.imul(R,X)|0,n=n+Math.imul(R,Y)|0,h=h+Math.imul(k,j)|0,i=i+Math.imul(k,tt)|0,i=i+Math.imul(q,j)|0,n=n+Math.imul(q,tt)|0;var Nt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,h=Math.imul(Z,Q),i=Math.imul(Z,V),i=i+Math.imul(E,Q)|0,n=Math.imul(E,V),h=h+Math.imul(L,X)|0,i=i+Math.imul(L,Y)|0,i=i+Math.imul(O,X)|0,n=n+Math.imul(O,Y)|0,h=h+Math.imul(N,j)|0,i=i+Math.imul(N,tt)|0,i=i+Math.imul(R,j)|0,n=n+Math.imul(R,tt)|0;var Rt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,h=Math.imul(Z,X),i=Math.imul(Z,Y),i=i+Math.imul(E,X)|0,n=Math.imul(E,Y),h=h+Math.imul(L,j)|0,i=i+Math.imul(L,tt)|0,i=i+Math.imul(O,j)|0,n=n+Math.imul(O,tt)|0;var Lt=(u+h|0)+((i&8191)<<13)|0;u=(n+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,h=Math.imul(Z,j),i=Math.imul(Z,tt),i=i+Math.imul(E,j)|0,n=Math.imul(E,tt);var Ot=(u+h|0)+((i&8191)<<13)|0;return u=(n+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a[0]=mt,a[1]=pt,a[2]=Mt,a[3]=ct,a[4]=gt,a[5]=wt,a[6]=yt,a[7]=xt,a[8]=_t,a[9]=bt,a[10]=St,a[11]=At,a[12]=Bt,a[13]=kt,a[14]=qt,a[15]=Nt,a[16]=Rt,a[17]=Lt,a[18]=Ot,u!==0&&(a[19]=u,e.length++),e};Math.imul||(Kt=Pt);function Dt(o,t,r){r.negative=t.negative^o.negative,r.length=o.length+t.length;for(var e=0,f=0,s=0;s<r.length-1;s++){var a=f;f=0;for(var u=e&67108863,h=Math.min(s,t.length-1),i=Math.max(0,s-o.length+1);i<=h;i++){var n=s-i,m=o.words[n]|0,v=t.words[i]|0,p=m*v,et=p&67108863;a=a+(p/67108864|0)|0,et=et+u|0,u=et&67108863,a=a+(et>>>26)|0,f+=a>>>26,a&=67108863}r.words[s]=u,e=a,a=f}return e!==0?r.words[s]=e:r.length--,r._strip()}function Ft(o,t,r){return Dt(o,t,r)}l.prototype.mulTo=function(t,r){var e,f=this.length+t.length;return this.length===10&&t.length===10?e=Kt(this,t,r):f<63?e=Pt(this,t,r):f<1024?e=Dt(this,t,r):e=Ft(this,t,r),e},l.prototype.mul=function(t){var r=new l(null);return r.words=new Array(this.length+t.length),this.mulTo(t,r)},l.prototype.mulf=function(t){var r=new l(null);return r.words=new Array(this.length+t.length),Ft(this,t,r)},l.prototype.imul=function(t){return this.clone().mulTo(t,this)},l.prototype.imuln=function(t){var r=t<0;r&&(t=-t),d(typeof t=="number"),d(t<67108864);for(var e=0,f=0;f<this.length;f++){var s=(this.words[f]|0)*t,a=(s&67108863)+(e&67108863);e>>=26,e+=s/67108864|0,e+=a>>>26,this.words[f]=a&67108863}return e!==0&&(this.words[f]=e,this.length++),this.length=t===0?1:this.length,r?this.ineg():this},l.prototype.muln=function(t){return this.clone().imuln(t)},l.prototype.sqr=function(){return this.mul(this)},l.prototype.isqr=function(){return this.imul(this.clone())},l.prototype.pow=function(t){var r=vi(t);if(r.length===0)return new l(1);for(var e=this,f=0;f<r.length&&r[f]===0;f++,e=e.sqr());if(++f<r.length)for(var s=e.sqr();f<r.length;f++,s=s.sqr())r[f]!==0&&(e=e.mul(s));return e},l.prototype.iushln=function(t){d(typeof t=="number"&&t>=0);var r=t%26,e=(t-r)/26,f=67108863>>>26-r<<26-r,s;if(r!==0){var a=0;for(s=0;s<this.length;s++){var u=this.words[s]&f,h=(this.words[s]|0)-u<<r;this.words[s]=h|a,a=u>>>26-r}a&&(this.words[s]=a,this.length++)}if(e!==0){for(s=this.length-1;s>=0;s--)this.words[s+e]=this.words[s];for(s=0;s<e;s++)this.words[s]=0;this.length+=e}return this._strip()},l.prototype.ishln=function(t){return d(this.negative===0),this.iushln(t)},l.prototype.iushrn=function(t,r,e){d(typeof t=="number"&&t>=0);var f;r?f=(r-r%26)/26:f=0;var s=t%26,a=Math.min((t-s)/26,this.length),u=67108863^67108863>>>s<<s,h=e;if(f-=a,f=Math.max(0,f),h){for(var i=0;i<a;i++)h.words[i]=this.words[i];h.length=a}if(a!==0)if(this.length>a)for(this.length-=a,i=0;i<this.length;i++)this.words[i]=this.words[i+a];else this.words[0]=0,this.length=1;var n=0;for(i=this.length-1;i>=0&&(n!==0||i>=f);i--){var m=this.words[i]|0;this.words[i]=n<<26-s|m>>>s,n=m&u}return h&&n!==0&&(h.words[h.length++]=n),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},l.prototype.ishrn=function(t,r,e){return d(this.negative===0),this.iushrn(t,r,e)},l.prototype.shln=function(t){return this.clone().ishln(t)},l.prototype.ushln=function(t){return this.clone().iushln(t)},l.prototype.shrn=function(t){return this.clone().ishrn(t)},l.prototype.ushrn=function(t){return this.clone().iushrn(t)},l.prototype.testn=function(t){d(typeof t=="number"&&t>=0);var r=t%26,e=(t-r)/26,f=1<<r;if(this.length<=e)return!1;var s=this.words[e];return!!(s&f)},l.prototype.imaskn=function(t){d(typeof t=="number"&&t>=0);var r=t%26,e=(t-r)/26;if(d(this.negative===0,"imaskn works only with positive numbers"),this.length<=e)return this;if(r!==0&&e++,this.length=Math.min(e,this.length),r!==0){var f=67108863^67108863>>>r<<r;this.words[this.length-1]&=f}return this._strip()},l.prototype.maskn=function(t){return this.clone().imaskn(t)},l.prototype.iaddn=function(t){return d(typeof t=="number"),d(t<67108864),t<0?this.isubn(-t):this.negative!==0?this.length===1&&(this.words[0]|0)<=t?(this.words[0]=t-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},l.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},l.prototype.isubn=function(t){if(d(typeof t=="number"),d(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this._strip()},l.prototype.addn=function(t){return this.clone().iaddn(t)},l.prototype.subn=function(t){return this.clone().isubn(t)},l.prototype.iabs=function(){return this.negative=0,this},l.prototype.abs=function(){return this.clone().iabs()},l.prototype._ishlnsubmul=function(t,r,e){var f=t.length+e,s;this._expand(f);var a,u=0;for(s=0;s<t.length;s++){a=(this.words[s+e]|0)+u;var h=(t.words[s]|0)*r;a-=h&67108863,u=(a>>26)-(h/67108864|0),this.words[s+e]=a&67108863}for(;s<this.length-e;s++)a=(this.words[s+e]|0)+u,u=a>>26,this.words[s+e]=a&67108863;if(u===0)return this._strip();for(d(u===-1),u=0,s=0;s<this.length;s++)a=-(this.words[s]|0)+u,u=a>>26,this.words[s]=a&67108863;return this.negative=1,this._strip()},l.prototype._wordDiv=function(t,r){var e=this.length-t.length,f=this.clone(),s=t,a=s.words[s.length-1]|0,u=this._countBits(a);e=26-u,e!==0&&(s=s.ushln(e),f.iushln(e),a=s.words[s.length-1]|0);var h=f.length-s.length,i;if(r!=="mod"){i=new l(null),i.length=h+1,i.words=new Array(i.length);for(var n=0;n<i.length;n++)i.words[n]=0}var m=f.clone()._ishlnsubmul(s,1,h);m.negative===0&&(f=m,i&&(i.words[h]=1));for(var v=h-1;v>=0;v--){var p=(f.words[s.length+v]|0)*67108864+(f.words[s.length+v-1]|0);for(p=Math.min(p/a|0,67108863),f._ishlnsubmul(s,p,v);f.negative!==0;)p--,f.negative=0,f._ishlnsubmul(s,1,v),f.isZero()||(f.negative^=1);i&&(i.words[v]=p)}return i&&i._strip(),f._strip(),r!=="div"&&e!==0&&f.iushrn(e),{div:i||null,mod:f}},l.prototype.divmod=function(t,r,e){if(d(!t.isZero()),this.isZero())return{div:new l(0),mod:new l(0)};var f,s,a;return this.negative!==0&&t.negative===0?(a=this.neg().divmod(t,r),r!=="mod"&&(f=a.div.neg()),r!=="div"&&(s=a.mod.neg(),e&&s.negative!==0&&s.iadd(t)),{div:f,mod:s}):this.negative===0&&t.negative!==0?(a=this.divmod(t.neg(),r),r!=="mod"&&(f=a.div.neg()),{div:f,mod:a.mod}):(this.negative&t.negative)!==0?(a=this.neg().divmod(t.neg(),r),r!=="div"&&(s=a.mod.neg(),e&&s.negative!==0&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new l(0),mod:this}:t.length===1?r==="div"?{div:this.divn(t.words[0]),mod:null}:r==="mod"?{div:null,mod:new l(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new l(this.modrn(t.words[0]))}:this._wordDiv(t,r)},l.prototype.div=function(t){return this.divmod(t,"div",!1).div},l.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},l.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},l.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var e=r.div.negative!==0?r.mod.isub(t):r.mod,f=t.ushrn(1),s=t.andln(1),a=e.cmp(f);return a<0||s===1&&a===0?r.div:r.div.negative!==0?r.div.isubn(1):r.div.iaddn(1)},l.prototype.modrn=function(t){var r=t<0;r&&(t=-t),d(t<=67108863);for(var e=(1<<26)%t,f=0,s=this.length-1;s>=0;s--)f=(e*f+(this.words[s]|0))%t;return r?-f:f},l.prototype.modn=function(t){return this.modrn(t)},l.prototype.idivn=function(t){var r=t<0;r&&(t=-t),d(t<=67108863);for(var e=0,f=this.length-1;f>=0;f--){var s=(this.words[f]|0)+e*67108864;this.words[f]=s/t|0,e=s%t}return this._strip(),r?this.ineg():this},l.prototype.divn=function(t){return this.clone().idivn(t)},l.prototype.egcd=function(t){d(t.negative===0),d(!t.isZero());var r=this,e=t.clone();r.negative!==0?r=r.umod(t):r=r.clone();for(var f=new l(1),s=new l(0),a=new l(0),u=new l(1),h=0;r.isEven()&&e.isEven();)r.iushrn(1),e.iushrn(1),++h;for(var i=e.clone(),n=r.clone();!r.isZero();){for(var m=0,v=1;(r.words[0]&v)===0&&m<26;++m,v<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(f.isOdd()||s.isOdd())&&(f.iadd(i),s.isub(n)),f.iushrn(1),s.iushrn(1);for(var p=0,et=1;(e.words[0]&et)===0&&p<26;++p,et<<=1);if(p>0)for(e.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(i),u.isub(n)),a.iushrn(1),u.iushrn(1);r.cmp(e)>=0?(r.isub(e),f.isub(a),s.isub(u)):(e.isub(r),a.isub(f),u.isub(s))}return{a,b:u,gcd:e.iushln(h)}},l.prototype._invmp=function(t){d(t.negative===0),d(!t.isZero());var r=this,e=t.clone();r.negative!==0?r=r.umod(t):r=r.clone();for(var f=new l(1),s=new l(0),a=e.clone();r.cmpn(1)>0&&e.cmpn(1)>0;){for(var u=0,h=1;(r.words[0]&h)===0&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)f.isOdd()&&f.iadd(a),f.iushrn(1);for(var i=0,n=1;(e.words[0]&n)===0&&i<26;++i,n<<=1);if(i>0)for(e.iushrn(i);i-- >0;)s.isOdd()&&s.iadd(a),s.iushrn(1);r.cmp(e)>=0?(r.isub(e),f.isub(s)):(e.isub(r),s.isub(f))}var m;return r.cmpn(1)===0?m=f:m=s,m.cmpn(0)<0&&m.iadd(t),m},l.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),e=t.clone();r.negative=0,e.negative=0;for(var f=0;r.isEven()&&e.isEven();f++)r.iushrn(1),e.iushrn(1);do{for(;r.isEven();)r.iushrn(1);for(;e.isEven();)e.iushrn(1);var s=r.cmp(e);if(s<0){var a=r;r=e,e=a}else if(s===0||e.cmpn(1)===0)break;r.isub(e)}while(!0);return e.iushln(f)},l.prototype.invm=function(t){return this.egcd(t).a.umod(t)},l.prototype.isEven=function(){return(this.words[0]&1)===0},l.prototype.isOdd=function(){return(this.words[0]&1)===1},l.prototype.andln=function(t){return this.words[0]&t},l.prototype.bincn=function(t){d(typeof t=="number");var r=t%26,e=(t-r)/26,f=1<<r;if(this.length<=e)return this._expand(e+1),this.words[e]|=f,this;for(var s=f,a=e;s!==0&&a<this.length;a++){var u=this.words[a]|0;u+=s,s=u>>>26,u&=67108863,this.words[a]=u}return s!==0&&(this.words[a]=s,this.length++),this},l.prototype.isZero=function(){return this.length===1&&this.words[0]===0},l.prototype.cmpn=function(t){var r=t<0;if(this.negative!==0&&!r)return-1;if(this.negative===0&&r)return 1;this._strip();var e;if(this.length>1)e=1;else{r&&(t=-t),d(t<=67108863,"Number is too big");var f=this.words[0]|0;e=f===t?0:f<t?-1:1}return this.negative!==0?-e|0:e},l.prototype.cmp=function(t){if(this.negative!==0&&t.negative===0)return-1;if(this.negative===0&&t.negative!==0)return 1;var r=this.ucmp(t);return this.negative!==0?-r|0:r},l.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var r=0,e=this.length-1;e>=0;e--){var f=this.words[e]|0,s=t.words[e]|0;if(f!==s){f<s?r=-1:f>s&&(r=1);break}}return r},l.prototype.gtn=function(t){return this.cmpn(t)===1},l.prototype.gt=function(t){return this.cmp(t)===1},l.prototype.gten=function(t){return this.cmpn(t)>=0},l.prototype.gte=function(t){return this.cmp(t)>=0},l.prototype.ltn=function(t){return this.cmpn(t)===-1},l.prototype.lt=function(t){return this.cmp(t)===-1},l.prototype.lten=function(t){return this.cmpn(t)<=0},l.prototype.lte=function(t){return this.cmp(t)<=0},l.prototype.eqn=function(t){return this.cmpn(t)===0},l.prototype.eq=function(t){return this.cmp(t)===0},l.red=function(t){return new g(t)},l.prototype.toRed=function(t){return d(!this.red,"Already a number in reduction context"),d(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},l.prototype.fromRed=function(){return d(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},l.prototype._forceRed=function(t){return this.red=t,this},l.prototype.forceRed=function(t){return d(!this.red,"Already a number in reduction context"),this._forceRed(t)},l.prototype.redAdd=function(t){return d(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},l.prototype.redIAdd=function(t){return d(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},l.prototype.redSub=function(t){return d(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},l.prototype.redISub=function(t){return d(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},l.prototype.redShl=function(t){return d(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},l.prototype.redMul=function(t){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},l.prototype.redIMul=function(t){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},l.prototype.redSqr=function(){return d(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},l.prototype.redISqr=function(){return d(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},l.prototype.redSqrt=function(){return d(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},l.prototype.redInvm=function(){return d(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},l.prototype.redNeg=function(){return d(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},l.prototype.redPow=function(t){return d(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var dt={k256:null,p224:null,p192:null,p25519:null};function ht(o,t){this.name=o,this.p=new l(t,16),this.n=this.p.bitLength(),this.k=new l(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ht.prototype._tmp=function(){var t=new l(null);return t.words=new Array(Math.ceil(this.n/13)),t},ht.prototype.ireduce=function(t){var r=t,e;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var f=e<this.n?-1:r.ucmp(this.p);return f===0?(r.words[0]=0,r.length=1):f>0?r.isub(this.p):r.strip!==void 0?r.strip():r._strip(),r},ht.prototype.split=function(t,r){t.iushrn(this.n,0,r)},ht.prototype.imulK=function(t){return t.imul(this.k)};function at(){ht.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}rt(at,ht),at.prototype.split=function(t,r){for(var e=4194303,f=Math.min(t.length,9),s=0;s<f;s++)r.words[s]=t.words[s];if(r.length=f,t.length<=9){t.words[0]=0,t.length=1;return}var a=t.words[9];for(r.words[r.length++]=a&e,s=10;s<t.length;s++){var u=t.words[s]|0;t.words[s-10]=(u&e)<<4|a>>>22,a=u}a>>>=22,t.words[s-10]=a,a===0&&t.length>10?t.length-=10:t.length-=9},at.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,e=0;e<t.length;e++){var f=t.words[e]|0;r+=f*977,t.words[e]=r&67108863,r=f*64+(r/67108864|0)}return t.words[t.length-1]===0&&(t.length--,t.words[t.length-1]===0&&t.length--),t};function $t(){ht.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}rt($t,ht);function Ht(){ht.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}rt(Ht,ht);function vt(){ht.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}rt(vt,ht),vt.prototype.imulK=function(t){for(var r=0,e=0;e<t.length;e++){var f=(t.words[e]|0)*19+r,s=f&67108863;f>>>=26,t.words[e]=s,r=f}return r!==0&&(t.words[t.length++]=r),t},l._prime=function(t){if(dt[t])return dt[t];var r;if(t==="k256")r=new at;else if(t==="p224")r=new $t;else if(t==="p192")r=new Ht;else if(t==="p25519")r=new vt;else throw new Error("Unknown prime "+t);return dt[t]=r,r};function g(o){if(typeof o=="string"){var t=l._prime(o);this.m=t.p,this.prime=t}else d(o.gtn(1),"modulus must be greater than 1"),this.m=o,this.prime=null}g.prototype._verify1=function(t){d(t.negative===0,"red works only with positives"),d(t.red,"red works only with red numbers")},g.prototype._verify2=function(t,r){d((t.negative|r.negative)===0,"red works only with positives"),d(t.red&&t.red===r.red,"red works only with red numbers")},g.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(It(t,t.umod(this.m)._forceRed(this)),t)},g.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},g.prototype.add=function(t,r){this._verify2(t,r);var e=t.add(r);return e.cmp(this.m)>=0&&e.isub(this.m),e._forceRed(this)},g.prototype.iadd=function(t,r){this._verify2(t,r);var e=t.iadd(r);return e.cmp(this.m)>=0&&e.isub(this.m),e},g.prototype.sub=function(t,r){this._verify2(t,r);var e=t.sub(r);return e.cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},g.prototype.isub=function(t,r){this._verify2(t,r);var e=t.isub(r);return e.cmpn(0)<0&&e.iadd(this.m),e},g.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},g.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},g.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},g.prototype.isqr=function(t){return this.imul(t,t.clone())},g.prototype.sqr=function(t){return this.mul(t,t)},g.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(d(r%2===1),r===3){var e=this.m.add(new l(1)).iushrn(2);return this.pow(t,e)}for(var f=this.m.subn(1),s=0;!f.isZero()&&f.andln(1)===0;)s++,f.iushrn(1);d(!f.isZero());var a=new l(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),i=this.m.bitLength();for(i=new l(2*i*i).toRed(this);this.pow(i,h).cmp(u)!==0;)i.redIAdd(u);for(var n=this.pow(i,f),m=this.pow(t,f.addn(1).iushrn(1)),v=this.pow(t,f),p=s;v.cmp(a)!==0;){for(var et=v,M=0;et.cmp(a)!==0;M++)et=et.redSqr();d(M<p);var c=this.pow(n,new l(1).iushln(p-M-1));m=m.redMul(c),n=c.redSqr(),v=v.redMul(n),p=M}return m},g.prototype.invm=function(t){var r=t._invmp(this.m);return r.negative!==0?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},g.prototype.pow=function(t,r){if(r.isZero())return new l(1).toRed(this);if(r.cmpn(1)===0)return t.clone();var e=4,f=new Array(1<<e);f[0]=new l(1).toRed(this),f[1]=t;for(var s=2;s<f.length;s++)f[s]=this.mul(f[s-1],t);var a=f[0],u=0,h=0,i=r.bitLength()%26;for(i===0&&(i=26),s=r.length-1;s>=0;s--){for(var n=r.words[s],m=i-1;m>=0;m--){var v=n>>m&1;if(a!==f[0]&&(a=this.sqr(a)),v===0&&u===0){h=0;continue}u<<=1,u|=v,h++,!(h!==e&&(s!==0||m!==0))&&(a=this.mul(a,f[u]),h=0,u=0)}i=26}return a},g.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},g.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},l.mont=function(t){return new st(t)};function st(o){g.call(this,o),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new l(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}rt(st,g),st.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},st.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},st.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var e=t.imul(r),f=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=e.isub(f).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},st.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new l(0)._forceRed(this);var e=t.mul(r),f=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=e.isub(f).iushrn(this.shift),a=s;return s.cmp(this.m)>=0?a=s.isub(this.m):s.cmpn(0)<0&&(a=s.iadd(this.m)),a._forceRed(this)},st.prototype.invm=function(t){var r=this.imod(t._invmp(this.m).mul(this.r2));return r._forceRed(this)}})(it,yi)})(lt)),lt.exports}var ai=xi();const _i=pi(ai),bi=mi({__proto__:null,default:_i},[ai]);exports.bn=bi;
@@ -0,0 +1,554 @@
1
+ class o {
2
+ constructor(e, t, i) {
3
+ this._serverUrl = e, this.auth = t, this.authManager = i;
4
+ }
5
+ /** Server URL passed at construction (retained for API compatibility). */
6
+ get serverUrl() {
7
+ return this._serverUrl;
8
+ }
9
+ async fetch(e, t = {}) {
10
+ if (this.authManager?.isAuthenticated())
11
+ return this.authManager.fetchWithAuth(e, t);
12
+ throw this.auth ? new Error(
13
+ "Legacy AdminAuth is no longer supported due to replay vulnerability. Use IAdminAuthManager instead."
14
+ ) : new Error(
15
+ "Admin authentication required. Provide an IAdminAuthManager to ConfigApi."
16
+ );
17
+ }
18
+ /** List all config categories */
19
+ async listCategories(e = 100) {
20
+ return this.fetch(`/admin/config?limit=${e}`);
21
+ }
22
+ /** Get config for a category */
23
+ async getConfig(e, t = !0) {
24
+ return this.fetch(`/admin/config/${e}?redact_secrets=${t}`);
25
+ }
26
+ /** Full update - replace entire category config */
27
+ async updateConfig(e, t, i) {
28
+ await this.fetch(`/admin/config/${e}`, {
29
+ method: "PUT",
30
+ body: JSON.stringify({ config: t, description: i })
31
+ });
32
+ }
33
+ /** Partial update - update specific keys */
34
+ async patchConfig(e, t, i) {
35
+ await this.fetch(`/admin/config/${e}`, {
36
+ method: "PATCH",
37
+ body: JSON.stringify({ updates: t, description: i })
38
+ });
39
+ }
40
+ /** Batch update multiple categories */
41
+ async batchUpdate(e) {
42
+ await this.fetch("/admin/config/batch", {
43
+ method: "POST",
44
+ body: JSON.stringify({ updates: e })
45
+ });
46
+ }
47
+ /** Validate config before saving */
48
+ async validateConfig(e, t) {
49
+ return this.fetch("/admin/config/validate", {
50
+ method: "POST",
51
+ body: JSON.stringify({ category: e, config: t })
52
+ });
53
+ }
54
+ /** Get config change history */
55
+ async getHistory(e, t = 50) {
56
+ const i = new URLSearchParams({ limit: t.toString() });
57
+ return e && i.set("category", e), this.fetch(`/admin/config/history?${i}`);
58
+ }
59
+ }
60
+ const r = {
61
+ server: {
62
+ label: "Server",
63
+ secrets: [],
64
+ icon: "🖥️",
65
+ fields: {
66
+ admin_metrics_api_key: { hidden: !0 },
67
+ // Moved to metrics tab
68
+ cors_allowed_origins: { hidden: !0 }
69
+ // Moved to security tab
70
+ }
71
+ },
72
+ security: {
73
+ label: "Security",
74
+ description: "Configure CORS, rate limiting, and other security settings",
75
+ secrets: [],
76
+ icon: "🔒",
77
+ fields: {
78
+ cors_allowed_origins: {
79
+ description: 'List of allowed origins for CORS requests. Use ["*"] to allow all origins (not recommended for production).'
80
+ }
81
+ }
82
+ },
83
+ metrics: {
84
+ label: "Metrics",
85
+ description: "Configure metrics collection and API access",
86
+ secrets: ["admin_metrics_api_key"],
87
+ icon: "📊",
88
+ fields: {
89
+ admin_metrics_api_key: {
90
+ description: "API key for accessing the admin metrics endpoint. Keep this secret."
91
+ }
92
+ }
93
+ },
94
+ logging: {
95
+ label: "Logging",
96
+ secrets: [],
97
+ icon: "📝",
98
+ fields: {
99
+ level: { type: "dropdown", options: ["trace", "debug", "info", "warn", "error"] },
100
+ format: { hidden: !0 },
101
+ // Developer setting
102
+ environment: { hidden: !0 }
103
+ // Developer setting
104
+ }
105
+ },
106
+ stripe: {
107
+ label: "Stripe",
108
+ secrets: ["secret_key", "webhook_secret"],
109
+ icon: "💳",
110
+ fields: {
111
+ enabled: { hidden: !0 },
112
+ // Shown in header toggle
113
+ secret_key: {
114
+ description: "Stripe Dashboard → Developers → API keys → Secret key. Use the test key (sk_test_...) for testing, or the live key (sk_live_...) for production."
115
+ },
116
+ publishable_key: {
117
+ description: "Stripe Dashboard → Developers → API keys → Publishable key. Starts with pk_test_... or pk_live_..."
118
+ },
119
+ mode: {
120
+ type: "dropdown",
121
+ options: ["test", "live"],
122
+ description: 'Use "test" mode with test API keys during development, then switch to "live" with live keys for real payments.'
123
+ },
124
+ webhook_url: {
125
+ description: "The full URL Stripe sends webhook events to. Default is your server URL + /webhook/stripe (e.g. https://example.com/webhook/stripe). Only change this if you've customized the route in your cedros-pay server."
126
+ },
127
+ webhook_secret: {
128
+ description: `Stripe Dashboard → Developers → Webhooks → "Create an event destination" → select events: checkout.session.completed, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, invoice.paid, invoice.payment_failed → Continue → choose "Webhook endpoint" → enter your server's webhook endpoint, e.g. https://example.com/webhook/stripe (your server URL + /webhook/stripe) → after creating, click the endpoint and "Click to reveal" the signing secret. Starts with whsec_...`
129
+ },
130
+ tax_rate_id: {
131
+ description: `Stripe Dashboard → More → Product catalog → Tax rates → "+ New" → set the percentage, region, and whether tax is inclusive or exclusive → Save → copy the tax rate ID from the detail page (starts with txr_...). Leave empty if you don't collect tax.`
132
+ },
133
+ success_url: { hidden: !0 },
134
+ // Library provides default pages
135
+ cancel_url: { hidden: !0 }
136
+ // Library provides default pages
137
+ }
138
+ },
139
+ x402: {
140
+ label: "X402 (Crypto)",
141
+ secrets: ["server_wallets"],
142
+ icon: "⚡",
143
+ fields: {
144
+ enabled: { hidden: !0 },
145
+ // Shown in header toggle
146
+ payment_address: {
147
+ type: "solana_address",
148
+ description: "The Solana wallet address where payments are received. This is where customer funds are sent."
149
+ },
150
+ token_mint: {
151
+ type: "token_mint",
152
+ description: "The SPL token used for payments. Most commonly USDC."
153
+ },
154
+ token_decimals: {
155
+ type: "number",
156
+ description: "Number of decimal places for the token (e.g., USDC has 6 decimals).",
157
+ hidden: !0
158
+ // Managed by token_mint selector
159
+ },
160
+ custom_token_symbol: {
161
+ description: 'Display symbol for your custom token (e.g., "MYTOKEN").',
162
+ hidden: !0
163
+ // Managed by token_mint selector
164
+ },
165
+ custom_token_icon: {
166
+ description: "URL to your token's icon image.",
167
+ hidden: !0
168
+ // Managed by token_mint selector
169
+ },
170
+ rpc_url: {
171
+ description: "Solana RPC endpoint URL. Required for crypto payment verification (e.g., from Helius, QuickNode, or Alchemy)."
172
+ },
173
+ gasless_enabled: {
174
+ type: "toggle",
175
+ description: "When enabled, your server pays transaction fees so customers don't need SOL."
176
+ },
177
+ server_wallets: {
178
+ type: "secret_array",
179
+ description: "Server keypair(s) used to sign and pay for transactions. Required for gasless payments.",
180
+ showWhen: "gasless_enabled"
181
+ },
182
+ rounding_mode: {
183
+ type: "dropdown",
184
+ options: ["nearest", "up", "down"],
185
+ description: "How to round fractional token amounts: nearest (default), up (always round up), or down (always round down)."
186
+ },
187
+ network: { hidden: !0 },
188
+ ws_url: { hidden: !0 },
189
+ // Derived from rpc_url
190
+ skip_preflight: { hidden: !0 },
191
+ // Always false; not a user decision
192
+ commitment: { hidden: !0 },
193
+ // Internal Solana parameter
194
+ compute_unit_limit: { hidden: !0 },
195
+ // Internal Solana parameter
196
+ compute_unit_price: { hidden: !0 }
197
+ // Internal Solana parameter
198
+ }
199
+ },
200
+ paywall: {
201
+ label: "Paywall",
202
+ secrets: [],
203
+ icon: "🚪",
204
+ fields: {
205
+ product_cache_ttl: { type: "number", unit: "seconds" }
206
+ }
207
+ },
208
+ coupons: {
209
+ label: "Coupons",
210
+ secrets: [],
211
+ icon: "🎟️",
212
+ fields: {
213
+ cache_ttl: { type: "number", unit: "seconds" }
214
+ }
215
+ },
216
+ subscriptions: {
217
+ label: "Subscriptions",
218
+ secrets: [],
219
+ icon: "🔄",
220
+ fields: {
221
+ grace_period_hours: { type: "number", unit: "hours" }
222
+ }
223
+ },
224
+ callbacks: {
225
+ label: "Callbacks",
226
+ secrets: ["hmac_secret"],
227
+ icon: "🔔"
228
+ },
229
+ email: {
230
+ label: "Email",
231
+ description: "Email receipts for customers after purchase",
232
+ secrets: ["smtp_password"],
233
+ icon: "📧",
234
+ fields: {
235
+ enabled: { hidden: !0 },
236
+ // Shown in header toggle
237
+ provider: {
238
+ type: "dropdown",
239
+ options: ["sendgrid", "mailgun", "postmark", "ses", "resend", "custom"],
240
+ description: "Email service provider."
241
+ },
242
+ smtp_host: {
243
+ description: "SMTP server hostname.",
244
+ showWhen: "provider"
245
+ },
246
+ smtp_port: {
247
+ type: "number",
248
+ description: "SMTP server port (typically 587 for TLS).",
249
+ showWhen: "provider"
250
+ },
251
+ smtp_user: {
252
+ description: "SMTP authentication username or API key name.",
253
+ showWhen: "provider"
254
+ },
255
+ smtp_password: {
256
+ description: "SMTP password or API key.",
257
+ showWhen: "provider"
258
+ },
259
+ from_address: {
260
+ description: "Sender email address (e.g., orders@yourstore.com)."
261
+ },
262
+ from_name: {
263
+ description: 'Sender display name (e.g., "Your Store").'
264
+ }
265
+ }
266
+ },
267
+ webhook: {
268
+ label: "Webhook",
269
+ description: "HTTP notifications when purchases occur",
270
+ secrets: ["secret"],
271
+ icon: "🔔",
272
+ fields: {
273
+ enabled: { hidden: !0 },
274
+ // Shown in header toggle
275
+ url: {
276
+ description: "URL to receive POST notifications (e.g., https://api.yoursite.com/webhooks/orders)."
277
+ },
278
+ secret: {
279
+ description: "Shared secret for HMAC-SHA256 signature verification."
280
+ },
281
+ retry_attempts: {
282
+ type: "number",
283
+ description: "Number of retry attempts on failure (default: 3)."
284
+ }
285
+ }
286
+ },
287
+ messaging: {
288
+ label: "Messaging",
289
+ description: "Email and webhook notifications for purchases",
290
+ secrets: ["smtp_password", "webhook_secret"],
291
+ icon: "📬",
292
+ fields: {
293
+ // Email settings
294
+ email_enabled: {
295
+ type: "boolean",
296
+ description: "Send order confirmation emails to customers."
297
+ },
298
+ email_provider: {
299
+ description: "Email service provider (mailgun, sendgrid, postmark, ses, resend, custom).",
300
+ showWhen: "email_enabled"
301
+ },
302
+ smtp_host: {
303
+ description: "SMTP server hostname.",
304
+ showWhen: "email_enabled"
305
+ },
306
+ smtp_port: {
307
+ type: "number",
308
+ description: "SMTP server port (typically 587 for TLS).",
309
+ showWhen: "email_enabled"
310
+ },
311
+ smtp_username: {
312
+ description: "SMTP authentication username or API key.",
313
+ showWhen: "email_enabled"
314
+ },
315
+ smtp_password: {
316
+ description: "SMTP password or API key.",
317
+ showWhen: "email_enabled"
318
+ },
319
+ from_email: {
320
+ description: "Sender email address (e.g., orders@yourstore.com).",
321
+ showWhen: "email_enabled"
322
+ },
323
+ from_name: {
324
+ description: 'Sender display name (e.g., "Your Store").',
325
+ showWhen: "email_enabled"
326
+ },
327
+ // Webhook settings
328
+ webhook_enabled: {
329
+ type: "boolean",
330
+ description: "Send webhook notifications when purchases complete."
331
+ },
332
+ webhook_url: {
333
+ description: "URL to receive POST notifications.",
334
+ showWhen: "webhook_enabled"
335
+ },
336
+ webhook_secret: {
337
+ description: "Shared secret for HMAC-SHA256 signature verification.",
338
+ showWhen: "webhook_enabled"
339
+ },
340
+ webhook_timeout: {
341
+ type: "number",
342
+ description: "Request timeout in seconds (default: 30).",
343
+ showWhen: "webhook_enabled"
344
+ }
345
+ }
346
+ },
347
+ monitoring: {
348
+ label: "Monitoring",
349
+ secrets: [],
350
+ icon: "📊",
351
+ fields: {
352
+ check_interval: { type: "number", unit: "seconds" },
353
+ low_balance_threshold: { type: "number", unit: "SOL" }
354
+ }
355
+ },
356
+ rate_limit: {
357
+ label: "Rate Limiting",
358
+ secrets: [],
359
+ icon: "⏱️"
360
+ },
361
+ circuit_breaker: {
362
+ label: "Circuit Breaker",
363
+ secrets: [],
364
+ icon: "🔌"
365
+ },
366
+ admin: {
367
+ label: "Admin Keys",
368
+ secrets: [],
369
+ icon: "👤"
370
+ },
371
+ api_keys: {
372
+ label: "API Keys",
373
+ secrets: [],
374
+ icon: "🔐"
375
+ },
376
+ cedros_login: {
377
+ label: "Cedros Login",
378
+ secrets: ["api_key"],
379
+ icon: "🔑",
380
+ fields: {
381
+ enabled: { hidden: !0 },
382
+ // Shown in header toggle
383
+ credits_enabled: { hidden: !0 },
384
+ // Shown in header toggle when relevant
385
+ base_url: { hidden: !0 },
386
+ // Deployment setting
387
+ timeout: { hidden: !0 },
388
+ // Developer setting
389
+ jwt_issuer: { hidden: !0 },
390
+ // Internal auth config
391
+ jwt_audience: { hidden: !0 }
392
+ // Internal auth config
393
+ }
394
+ },
395
+ gift_cards: {
396
+ label: "Gift Cards",
397
+ description: "Gift card issuance, expiry, and Token-22 secondary market settings",
398
+ secrets: [],
399
+ icon: "🎁",
400
+ fields: {
401
+ enabled: { hidden: !0 },
402
+ // Shown in header toggle
403
+ secondary_market_enabled: {
404
+ type: "toggle",
405
+ description: "Enable Token-22 secondary market for gift card store credit tokens."
406
+ },
407
+ transfer_fee_bps: {
408
+ type: "number",
409
+ description: "Transfer fee in basis points charged on secondary market trades (e.g. 250 = 2.5%)."
410
+ },
411
+ max_transfer_fee: {
412
+ type: "number",
413
+ description: "Maximum transfer fee in token atomic units (e.g. 500 = $5.00 with 2 decimals)."
414
+ },
415
+ treasury_address: {
416
+ type: "solana_address",
417
+ description: "Solana wallet address where collected transfer fees are sent."
418
+ },
419
+ token_name: {
420
+ description: 'Display name for the store credit token (e.g. "Store Credits USD").'
421
+ },
422
+ token_symbol: {
423
+ description: 'Token symbol for the store credit token (e.g. "storeUSD").'
424
+ },
425
+ token_decimals: {
426
+ type: "number",
427
+ description: "Number of decimal places for the token (default: 2 for cent precision)."
428
+ },
429
+ mint_address: {
430
+ type: "solana_address",
431
+ description: "Solana Token-22 mint address (auto-populated after initialization)."
432
+ },
433
+ business_state: {
434
+ type: "dropdown",
435
+ options: [
436
+ "AL",
437
+ "AK",
438
+ "AZ",
439
+ "AR",
440
+ "CA",
441
+ "CO",
442
+ "CT",
443
+ "DE",
444
+ "FL",
445
+ "GA",
446
+ "HI",
447
+ "ID",
448
+ "IL",
449
+ "IN",
450
+ "IA",
451
+ "KS",
452
+ "KY",
453
+ "LA",
454
+ "ME",
455
+ "MD",
456
+ "MA",
457
+ "MI",
458
+ "MN",
459
+ "MS",
460
+ "MO",
461
+ "MT",
462
+ "NE",
463
+ "NV",
464
+ "NH",
465
+ "NJ",
466
+ "NM",
467
+ "NY",
468
+ "NC",
469
+ "ND",
470
+ "OH",
471
+ "OK",
472
+ "OR",
473
+ "PA",
474
+ "RI",
475
+ "SC",
476
+ "SD",
477
+ "TN",
478
+ "TX",
479
+ "UT",
480
+ "VT",
481
+ "VA",
482
+ "WA",
483
+ "WV",
484
+ "WI",
485
+ "WY",
486
+ "DC",
487
+ "PR"
488
+ ],
489
+ description: "US state where your business is registered. Determines applicable gift card regulations."
490
+ },
491
+ min_gift_card_value_cents: {
492
+ type: "number",
493
+ description: "Minimum gift card face value in cents. Auto-suggested based on state cash-out threshold."
494
+ },
495
+ max_gift_card_value_cents: {
496
+ type: "number",
497
+ description: "Maximum gift card face value in cents. Default $10,000 (AML compliance)."
498
+ },
499
+ liquidity_pool_address: {
500
+ type: "solana_address",
501
+ description: "Meteora DLMM pool address for gift card secondary market buyback."
502
+ },
503
+ buyback_rate_bps: {
504
+ type: "number",
505
+ description: "Buyback rate in basis points (8000 = 80 cents on the dollar)."
506
+ },
507
+ liquidity_usdc_amount: {
508
+ type: "number",
509
+ description: "USDC amount deposited into the liquidity pool (in atomic units).",
510
+ hidden: !0
511
+ },
512
+ liquidity_deployed_at: {
513
+ description: "ISO timestamp when the liquidity pool was deployed.",
514
+ hidden: !0
515
+ }
516
+ }
517
+ },
518
+ tokenization: {
519
+ label: "Asset Tokenization",
520
+ description: "Settings for tokenized asset classes and on-chain minting",
521
+ secrets: [],
522
+ icon: "🪙",
523
+ fields: {
524
+ enabled: { type: "toggle", description: "Enable asset tokenization features." },
525
+ default_transfer_fee_bps: { type: "number", description: "Default transfer fee in basis points for tokenized asset transfers (e.g. 250 = 2.5%)." },
526
+ require_custody_proof: { type: "toggle", description: "Require a custody proof URL before an asset class can be activated." }
527
+ }
528
+ },
529
+ shop: {
530
+ label: "Storefront",
531
+ description: "Product pages & display settings",
532
+ secrets: [],
533
+ icon: "🏪",
534
+ fields: {
535
+ enabled: { hidden: !0 },
536
+ // Shown in StorefrontSection header toggle
537
+ "relatedProducts.mode": {
538
+ type: "dropdown",
539
+ options: ["most_recent", "by_category", "manual", "ai"]
540
+ },
541
+ "relatedProducts.maxItems": { type: "number" }
542
+ }
543
+ }
544
+ };
545
+ function n(s, e) {
546
+ return r[s]?.secrets.includes(e) ?? !1;
547
+ }
548
+ const a = "[REDACTED]";
549
+ export {
550
+ r as C,
551
+ a as R,
552
+ o as a,
553
+ n as i
554
+ };