https://ordzaar.com/_next/static/chunks/507-aed31d38850db6d1.js?dpl=dpl_6x3Ve42Ci6fLhefu6Gd9EtKHV353
1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[507],{3401:(e,t,r)=>{r.d(t,{Bh:()=>h,C5:()=>l,NI:()=>g,Q2:()=>c,XL:()=>y,XN:()=>E,du:()=>b,fQ:()=>p,hl:()=>O,k1:()=>m,mG:()=>d,n0:()=>w});var i=r(48315),n=r(26250),s=r(58507),o=r(53032),a=r(52493),f=r(67643);function u(e){return t=>{try{return e({output:t}),!0}catch(e){return!1}}}let h=u(a.p2ms),c=u(a.p2pk),l=u(a.p2pkh),p=u(a.p2wpkh),d=u(a.p2wsh),w=u(a.p2sh),g=u(a.p2tr);function b(e){let t=new Uint8Array(0);function r(e){let r=t.length,n=i.encodingLength(e);t=f.concat([t,new Uint8Array(n)]),i.encode(e,t,r)}return r(e.length),e.forEach(function(e){r(e.length),t=f.concat([t,e])}),t}function m(e,t){let r=(0,o.hash160)(e),i=e.slice(1,33),s=n.decompile(t);if(null===s)throw Error("Unknown script error");return s.findIndex(t=>"number"!=typeof t&&(0===f.compare(e,t)||0===f.compare(r,t)||0===f.compare(i,t)))}function O(e,t){return -1!==m(e,t)}function y(e,t){return(function(e){let t=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return[];t=function(e){let t=e.finalScriptSig&&n.decompile(e.finalScriptSig)||[],r=e.finalScriptWitness&&n.decompile(e.finalScriptWitness)||[];return t.concat(r).filter(e=>e instanceof Uint8Array&&n.isCanonicalScriptSignature(e)).map(e=>({signature:e}))}(e)}else t=e.partialSig;return t.map(e=>e.signature)})(e).some(e=>E(e,n.signature.decode,t))}function E(e,t,r){let{hashType:i}=t(e),n=[];switch(i&s.Z.SIGHASH_ANYONECANPAY&&n.push("addInput"),31&i){case s.Z.SIGHASH_ALL:break;case s.Z.SIGHASH_SINGLE:case s.Z.SIGHASH_NONE:n.push("addOutput"),n.push("setInputSequence")}return -1===n.indexOf(r)}},4402:(e,t,r)=>{r.r(t),r.d(t,{bitcoin:()=>i,regtest:()=>n,testnet:()=>s});let i={messagePrefix:"\x18Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:0x488b21e,private:0x488ade4},pubKeyHash:0,scriptHash:5,wif:128},n={messagePrefix:"\x18Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:0x43587cf,private:0x4358394},pubKeyHash:111,scriptHash:196,wif:239},s={messagePrefix:"\x18Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:0x43587cf,private:0x4358394},pubKeyHash:111,scriptHash:196,wif:239}},16824:(e,t,r)=>{r.d(t,{CB:()=>function e(t,r){if("left"in t&&"right"in t){let i=e(t.left,r);if(void 0!==i)return[...i,t.right.hash];let n=e(t.right,r);if(void 0!==n)return[...n,t.left.hash]}else if(0===a.compare(t.hash,r))return[]},Kn:()=>l,RY:()=>u,WH:()=>h,o4:()=>c,ri:()=>f,uu:()=>function e(t){if((0,o.k0)(t))return{hash:c(t)};let r=[e(t[0]),e(t[1])];r.sort((e,t)=>a.compare(e.hash,t.hash));let[i,n]=r;return{hash:p(i.hash,n.hash),left:i,right:n}}});var i=r(68686),n=r(53032),s=r(62488),o=r(76674),a=r(67643);let f=192,u=128;function h(e,t){if(e.length<33)throw TypeError(`The control-block length is too small. Got ${e.length}, expected min 33.`);let r=(e.length-33)/32,i=t;for(let t=0;t<r;t++){let r=e.slice(33+32*t,65+32*t);i=0>a.compare(i,r)?p(i,r):p(r,i)}return i}function c(e){let t=e.version||f;return n.taggedHash("TapLeaf",a.concat([Uint8Array.from([t]),function(e){let t=new Uint8Array(s.Uu.encodingLength(e.length));return s.Uu.encode(e.length,t),a.concat([t,e])}(e.output)]))}function l(e,t){if(!(e instanceof Uint8Array)||32!==e.length||t&&32!==t.length)return null;let r=n.taggedHash("TapTweak",a.concat(t?[e,t]:[e])),s=(0,i.l)().xOnlyPointAddTweak(e,r);return s&&null!==s.xOnlyPubkey?{parity:s.parity,x:Uint8Array.from(s.xOnlyPubkey)}:null}function p(e,t){return n.taggedHash("TapBranch",a.concat([e,t]))}},17852:(e,t,r)=>{r.d(t,{Az:()=>u,DM:()=>f,TQ:()=>s,ol:()=>o,r9:()=>n,tT:()=>h,yc:()=>a});var i=r(83025);function n(e,t,r){return e&t^~e&r}function s(e,t,r){return e&t^e&r^t&r}class o extends i.Vw{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=(0,i.O8)(this.buffer)}update(e){(0,i.CC)(this),e=(0,i.ZJ)(e),(0,i.DO)(e);let{view:t,buffer:r,blockLen:n}=this,s=e.length;for(let o=0;o<s;){let a=Math.min(n-this.pos,s-o);if(a===n){let t=(0,i.O8)(e);for(;n<=s-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,i.CC)(this),(0,i.Ht)(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:s}=this,{pos:o}=this;t[o++]=128,(0,i.uH)(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),f=4*!!i,u=4*!i;e.setUint32(t+f,o,i),e.setUint32(t+u,a,i)}(r,n-8,BigInt(8*this.length),s),this.process(r,0);let a=(0,i.O8)(e),f=this.outputLen;if(f%4)throw Error("_sha2: outputLen should be aligned to 32bit");let u=f/4,h=this.get();if(u>h.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)a.setUint32(4*e,h[e],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=n,e.length=i,e.pos=o,i%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}
1let a=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),f=Uint32Array.from([0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]),u=Uint32Array.from([0xcbbb9d5d,0xc1059ed8,0x629a292a,0x367cd507,0x9159015a,0x3070dd17,0x152fecd8,0xf70e5939,0x67332667,0xffc00b31,0x8eb44a87,0x68581511,0xdb0c2e0d,0x64f98fa7,0x47b5481d,0xbefa4fa4]),h=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179])},26250:(e,t,r)=>{r.r(t),r.d(t,{OPS:()=>s.D,compile:()=>I,countNonPushOnlyOPs:()=>E,decompile:()=>S,fromASM:()=>T,isCanonicalPubKey:()=>v,isCanonicalScriptSignature:()=>H,isDefinedHashType:()=>k,isPushOnly:()=>y,number:()=>N,signature:()=>R,toASM:()=>x,toStack:()=>U});var i={};r.r(i),r.d(i,{decode:()=>f,encode:()=>u});var n={};r.r(n),r.d(n,{decode:()=>w,encode:()=>g});var s=r(31699),o=r(67643);function a(e){return e<s.D.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}function f(e,t,r){t=t||4,r=void 0===r||r;let i=e.length;if(0===i)return 0;if(i>t)throw TypeError("Script number overflow");if(r&&(127&e[i-1])==0&&(i<=1||(128&e[i-2])==0))throw Error("Non-minimally encoded script number");if(5===i){let t=o.readUInt32(e,0,"LE"),r=o.readUInt8(e,4);return 128&r?-((-129&r)*0x100000000+t):0x100000000*r+t}let n=0;for(let t=0;t<i;++t)n|=e[t]<<8*t;return 128&e[i-1]?-(n&~(128<<8*(i-1))):n}function u(e){var t;let r=Math.abs(e),i=(t=r)>0x7fffffff?5:t>8388607?4:t>32767?3:t>127?2:+(t>0),n=new Uint8Array(i),s=e<0;for(let e=0;e<i;++e)o.writeUInt8(n,e,255&r),r>>=8;return 128&n[i-1]?o.writeUInt8(n,i-1,128*!!s):s&&(n[i-1]|=128),n}var h=r(50774),c=r(76674);let l=new Uint8Array(1);function p(e){let t=0;for(;0===e[t];)++t;return t===e.length?l:128&(e=e.slice(t))[0]?o.concat([l,e]):e}function d(e){0===e[0]&&(e=e.slice(1));let t=new Uint8Array(32),r=Math.max(0,32-e.length);return t.set(e,r),t}function w(e){let t=o.readUInt8(e,e.length-1);if(!k(t))throw Error("Invalid hashType "+t);let r=function(e){if(e.length<8)throw Error("DER sequence length is too short");if(e.length>72)throw Error("DER sequence length is too long");if(48!==e[0])throw Error("Expected DER sequence");if(e[1]!==e.length-2)throw Error("DER sequence length is invalid");if(2!==e[2])throw Error("Expected DER integer");let t=e[3];if(0===t)throw Error("R length is zero");if(5+t>=e.length)throw Error("R length is too long");if(2!==e[4+t])throw Error("Expected DER integer (2)");let r=e[5+t];if(0===r)throw Error("S length is zero");if(6+t+r!==e.length)throw Error("S length is invalid");if(128&e[4])throw Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw Error("R value excessively padded");if(128&e[t+6])throw Error("S value is negative");if(r>1&&0===e[t+6]&&!(128&e[t+7]))throw Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}(e.subarray(0,-1)),i=d(r.r),n=d(r.s);return{signature:o.concat([i,n]),hashType:t}}function g(e,t){if(h.qgA(h.Ikc({signature:(0,c.o_)(64),hashType:c.Uz}),{signature:e,hashType:t}),!k(t))throw Error("Invalid hashType "+t);let r=new Uint8Array(1);o.writeUInt8(r,0,t);let i=p(e.slice(0,32)),n=p(e.slice(32,64));return o.concat([function(e,t){let r=e.length,i=t.length;if(0===r)throw Error("R length is zero");if(0===i)throw Error("S length is zero");if(r>33)throw Error("R length is too long");if(i>33)throw Error("S length is too long");if(128&e[0])throw Error("R value is negative");if(128&t[0])throw Error("S value is negative");if(r>1&&0===e[0]&&!(128&e[1]))throw Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw Error("S value excessively padded");let n=new Uint8Array(6+r+i);return n[0]=48,n[1]=n.length-2,n[2]=2,n[3]=e.length,n.set(e,4),n[4+r]=2,n[5+r]=t.length,n.set(t,6+r),n}(i,n),r])}let b=s.D.OP_RESERVED,m=h.YOg(h.KCZ([h.KJ$(Uint8Array),h.aig()]));function O(e){return h.is(c.Yt,e)||h.is(h.aig(),e)&&(e===s.D.OP_0||e>=s.D.OP_1&&e<=s.D.OP_16||e===s.D.OP_1NEGATE)}function y(e){return h.is(h.FsL(h.bzn(),h.l5M(O)),e)}function E(e){return e.length-e.filter(O).length}function P(e){if(0===e.length)return s.D.OP_0;if(1===e.length){if(e[0]>=1&&e[0]<=16)return b+e[0];if(129===e[0])return s.D.OP_1NEGATE}}function _(e){return e instanceof Uint8Array}function A(e){return e instanceof Uint8Array}function I(e){if(_(e))return e;h.qgA(m,e);let t=new Uint8Array(e.reduce((e,t)=>
1A(t)?1===t.length&&void 0!==P(t)?e+1:e+a(t.length)+t.length:e+1,0)),r=0;if(e.forEach(e=>{if(A(e)){let i=P(e);if(void 0!==i){o.writeUInt8(t,r,i),r+=1;return}r+=function(e,t,r){let i=a(t);return 1===i?o.writeUInt8(e,r,t):2===i?(o.writeUInt8(e,r,s.D.OP_PUSHDATA1),o.writeUInt8(e,r+1,t)):3===i?(o.writeUInt8(e,r,s.D.OP_PUSHDATA2),o.writeUInt16(e,r+1,t,"LE")):(o.writeUInt8(e,r,s.D.OP_PUSHDATA4),o.writeUInt32(e,r+1,t,"LE")),i}(t,e.length,r),t.set(e,r),r+=e.length}else o.writeUInt8(t,r,e),r+=1}),r!==t.length)throw Error("Could not decode chunks");return t}function S(e){if(h.is(m,e))return e;h.qgA(c.Yt,e);let t=[],r=0;for(;r<e.length;){let i=e[r];if(i>s.D.OP_0&&i<=s.D.OP_PUSHDATA4){let i=function(e,t){let r,i,n=o.readUInt8(e,t);if(n<s.D.OP_PUSHDATA1)r=n,i=1;else if(n===s.D.OP_PUSHDATA1){if(t+2>e.length)return null;r=o.readUInt8(e,t+1),i=2}else if(n===s.D.OP_PUSHDATA2){if(t+3>e.length)return null;r=o.readUInt16(e,t+1,"LE"),i=3}else{if(t+5>e.length)return null;if(n!==s.D.OP_PUSHDATA4)throw Error("Unexpected opcode");r=o.readUInt32(e,t+1,"LE"),i=5}return{opcode:n,number:r,size:i}}(e,r);if(null===i||(r+=i.size)+i.number>e.length)return null;let n=e.slice(r,r+i.number);r+=i.number;let a=P(n);void 0!==a?t.push(a):t.push(n)}else t.push(i),r+=1}return t}function x(e){if(_(e)&&(e=S(e)),!e)throw Error("Could not convert invalid chunks to ASM");return e.map(e=>{if(A(e)){let t=P(e);if(void 0===t)return o.toHex(e);e=t}return s.D[e]}).join(" ")}function T(e){return h.qgA(h.YjP(),e),I(e.split(" ").map(e=>isNaN(Number(e))&&e in s.D?s.D[e]:(h.qgA(c.rL,e),o.fromHex(e))))}function U(e){return e=S(e),h.qgA(h.IeY(y),e),e.map(e=>A(e)?e:e===s.D.OP_0?new Uint8Array(0):u(e-b))}function v(e){return c.fT(e)}function k(e){let t=-129&e;return t>0&&t<4}function H(e){if(!(e instanceof Uint8Array)||!k(e[e.length-1]))return!1;var t=e.slice(0,-1);if(t.length<8||t.length>72||48!==t[0]||t[1]!==t.length-2||2!==t[2])return!1;let r=t[3];if(0===r||5+r>=t.length||2!==t[4+r])return!1;let i=t[5+r];return 0!==i&&6+r+i===t.length&&!(128&t[4])&&(!(r>1)||0!==t[4]||!!(128&t[5]))&&!(128&t[r+6])&&(!(i>1)||0!==t[r+6]||!!(128&t[r+7]))}let N=i,R=n},31699:(e,t,r)=>{var i;r.d(t,{D:()=>i}),function(e){e[e.OP_FALSE=0]="OP_FALSE",e[e.OP_0=0]="OP_0",e[e.OP_PUSHDATA1=76]="OP_PUSHDATA1",e[e.OP_PUSHDATA2=77]="OP_PUSHDATA2",e[e.OP_PUSHDATA4=78]="OP_PUSHDATA4",e[e.OP_1NEGATE=79]="OP_1NEGATE",e[e.OP_RESERVED=80]="OP_RESERVED",e[e.OP_TRUE=81]="OP_TRUE",e[e.OP_1=81]="OP_1",e[e.OP_2=82]="OP_2",e[e.OP_3=83]="OP_3",e[e.OP_4=84]="OP_4",e[e.OP_5=85]="OP_5",e[e.OP_6=86]="OP_6",e[e.OP_7=87]="OP_7",e[e.OP_8=88]="OP_8",e[e.OP_9=89]="OP_9",e[e.OP_10=90]="OP_10",e[e.OP_11=91]="OP_11",e[e.OP_12=92]="OP_12",e[e.OP_13=93]="OP_13",e[e.OP_14=94]="OP_14",e[e.OP_15=95]="OP_15",e[e.OP_16=96]="OP_16",e[e.OP_NOP=97]="OP_NOP",e[e.OP_VER=98]="OP_VER",e[e.OP_IF=99]="OP_IF",e[e.OP_NOTIF=100]="OP_NOTIF",e[e.OP_VERIF=101]="OP_VERIF",e[e.OP_VERNOTIF=102]="OP_VERNOTIF",e[e.OP_ELSE=103]="OP_ELSE",e[e.OP_ENDIF=104]="OP_ENDIF",e[e.OP_VERIFY=105]="OP_VERIFY",e[e.OP_RETURN=106]="OP_RETURN",e[e.OP_TOALTSTACK=107]="OP_TOALTSTACK",e[e.OP_FROMALTSTACK=108]="OP_FROMALTSTACK",e[e.OP_2DROP=109]="OP_2DROP",e[e.OP_2DUP=110]="OP_2DUP",e[e.OP_3DUP=111]="OP_3DUP",e[e.OP_2OVER=112]="OP_2OVER",e[e.OP_2ROT=113]="OP_2ROT",e[e.OP_2SWAP=114]="OP_2SWAP",e[e.OP_IFDUP=115]="OP_IFDUP",e[e.OP_DEPTH=116]="OP_DEPTH",e[e.OP_DROP=117]="OP_DROP",e[e.OP_DUP=118]="OP_DUP",e[e.OP_NIP=119]="OP_NIP",e[e.OP_OVER=120]="OP_OVER",e[e.OP_PICK=121]="OP_PICK",e[e.OP_ROLL=122]="OP_ROLL",e[e.OP_ROT=123]="OP_ROT",e[e.OP_SWAP=124]="OP_SWAP",e[e.OP_TUCK=125]="OP_TUCK",e[e.OP_CAT=126]="OP_CAT",e[e.OP_SUBSTR=127]="OP_SUBSTR",e[e.OP_LEFT=128]="OP_LEFT",e[e.OP_RIGHT=129]="OP_RIGHT",e[e.OP_SIZE=130]="OP_SIZE",e[e.OP_INVERT=131]="OP_INVERT",e[e.OP_AND=132]="OP_AND",e[e.OP_OR=133]="OP_OR",e[e.OP_XOR=134]="OP_XOR",e[e.OP_EQUAL=135]="OP_EQUAL",e[e.OP_EQUALVERIFY=136]="OP_EQUALVERIFY",e[e.OP_RESERVED1=137]="OP_RESERVED1",e[e.OP_RESERVED2=138]="OP_RESERVED2",e[e.OP_1ADD=139]="OP_1ADD",e[e.OP_1SUB=140]="OP_1SUB",e[e.OP_2MUL=141]="OP_2MUL",e[e.OP_2DIV=142]="OP_2DIV",e[e.OP_NEGATE=143]="OP_NEGATE",e[e.OP_ABS=144]="OP_ABS",e[e.OP_NOT=145]="OP_NOT",e[e.OP_0NOTEQUAL=146]="OP_0NOTEQUAL",e[e.OP_ADD=147]="OP_ADD",e[e.OP_SUB=148]="OP_SUB",e[e.OP_MUL=149]="OP_MUL",e[e.OP_DIV=150]="OP_DIV",e[e.OP_MOD=151]="OP_MOD",e[e.OP_LSHIFT=152]="OP_LSHIFT",e[e.OP_RSHIFT=153]="OP_RSHIFT",e[e.OP_BOOLAND=154]="OP_BOOLAND",e[e.OP_BOOLOR=155]="OP_BOOLOR",e[e.OP_NUMEQUAL=156]="OP_NUMEQUAL",e[e.OP_NUMEQUALVERIFY=157]="OP_NUMEQUALVERIFY",e[e.OP_NUMNOTEQUAL=158]="OP_NUMNOTEQUAL",e[e.OP_LESSTHAN=159]="OP_LESSTHAN",e[e.OP_GREATERTHAN=160]="OP_GREATERTHAN",e[e.OP_LESSTHANOREQUAL=161]="OP_LESSTHANOREQUAL",e[e.OP_GREATERTHANOREQUAL=162]="OP_GREATERTHANOREQUAL",e[e.OP_MIN=163]="OP_MIN",e[e.OP_MAX=164]="OP_MAX",e[e.OP_WITHIN=165]="OP_WITHIN",e[e.OP_RIPEMD160=166]="OP_RIPEMD160",e[e.OP_SHA1=167]="OP_SHA1",e[e.OP_SHA256=168]="OP_SHA256",e[e.OP_HASH160=169]="OP_HASH160",e[e.OP_HASH256=170]="OP_HASH256",e[e.OP_CODESEPARATOR=171]="OP_CODESEPARATOR",e[e.OP_CHECKSIG=172]="OP_CHECKSIG",e[e.OP_CHECKSIGVERIFY=173]="OP_CHECKSIGVERIFY",e[e.OP_CHECKMULTISIG=174]="OP_CHECKMULTISIG",e[e.OP_CHECKMULTISIGVERIFY=175]="OP_CHECKMULTISIGVERIFY",e[e.OP_NOP1=176]="OP_NOP1",e[e.OP_CHECKLOCKTIMEVERIFY=177]="OP_CHECKLOCKTIMEVERIFY",e[e.OP_NOP2
1=177]="OP_NOP2",e[e.OP_CHECKSEQUENCEVERIFY=178]="OP_CHECKSEQUENCEVERIFY",e[e.OP_NOP3=178]="OP_NOP3",e[e.OP_NOP4=179]="OP_NOP4",e[e.OP_NOP5=180]="OP_NOP5",e[e.OP_NOP6=181]="OP_NOP6",e[e.OP_NOP7=182]="OP_NOP7",e[e.OP_NOP8=183]="OP_NOP8",e[e.OP_NOP9=184]="OP_NOP9",e[e.OP_NOP10=185]="OP_NOP10",e[e.OP_CHECKSIGADD=186]="OP_CHECKSIGADD",e[e.OP_PUBKEYHASH=253]="OP_PUBKEYHASH",e[e.OP_PUBKEY=254]="OP_PUBKEY",e[e.OP_INVALIDOPCODE=255]="OP_INVALIDOPCODE"}(i||(i={}))},48315:(e,t,r)=>{r.r(t),r.d(t,{decode:()=>o,encode:()=>s,encodingLength:()=>a});var i=r(41487);function n(e){if("number"==typeof e){if(e<0||e>Number.MAX_SAFE_INTEGER||e%1!=0)throw RangeError("value out of range")}else if(e<0||e>0xffffffffffffffffn)throw RangeError("value out of range")}function s(e,t,r){n(e),void 0===r&&(r=0),void 0===t&&(t=new Uint8Array(a(e)));let s=0;return e<253?(t.set([Number(e)],r),s=1):e<=65535?(t.set([253],r),i.writeUInt16(t,r+1,Number(e),"LE"),s=3):e<=0xffffffff?(t.set([254],r),i.writeUInt32(t,r+1,Number(e),"LE"),s=5):(t.set([255],r),i.writeUInt64(t,r+1,BigInt(e),"LE"),s=9),{buffer:t,bytes:s}}function o(e,t){void 0===t&&(t=0);let r=e.at(t);if(void 0===r)throw Error("buffer too small");if(r<253)return{numberValue:r,bigintValue:BigInt(r),bytes:1};if(253===r){let r=i.readUInt16(e,t+1,"LE");return{numberValue:r,bigintValue:BigInt(r),bytes:3}}if(254===r){let r=i.readUInt32(e,t+1,"LE");return{numberValue:r,bigintValue:BigInt(r),bytes:5}}{let r=i.readUInt64(e,t+1,"LE");return{numberValue:r<=Number.MAX_SAFE_INTEGER?Number(r):null,bigintValue:r,bytes:9}}}function a(e){return n(e),e<253?1:e<=65535?3:e<=0xffffffff?5:9}},49327:(e,t,r)=>{r.r(t),r.d(t,{fromBase58Check:()=>p,fromBech32:()=>d,fromOutputScript:()=>b,toBase58Check:()=>w,toBech32:()=>g,toOutputScript:()=>m});var i=r(4402),n=r(52493),s=r(26250),o=r(76674),a=r(88263),f=r(68696),u=r(67643),h=r(50774);let c="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.",l=[!1,!1];function p(e){let t=f.A.decode(e);if(t.length<21)throw TypeError(e+" is too short");if(t.length>21)throw TypeError(e+" is too long");return{version:u.readUInt8(t,0),hash:t.slice(1)}}function d(e){let t,r;try{t=a.bech32.decode(e)}catch(e){}if(t){if(0!==(r=t.words[0]))throw TypeError(e+" uses wrong encoding")}else if(0===(r=(t=a.bech32m.decode(e)).words[0]))throw TypeError(e+" uses wrong encoding");let i=a.bech32.fromWords(t.words.slice(1));return{version:r,prefix:t.prefix,data:Uint8Array.from(i)}}function w(e,t){h.qgA(h.PVZ([o.Um,o.Uz]),[e,t]);let r=new Uint8Array(21);return u.writeUInt8(r,0,t),r.set(e,1),f.A.encode(r)}function g(e,t,r){let i=a.bech32.toWords(e);return i.unshift(t),0===t?a.bech32.encode(r,i):a.bech32m.encode(r,i)}function b(e,t){t=t||i.bitcoin;try{return n.p2pkh({output:e,network:t}).address}catch(e){}try{return n.p2sh({output:e,network:t}).address}catch(e){}try{return n.p2wpkh({output:e,network:t}).address}catch(e){}try{return n.p2wsh({output:e,network:t}).address}catch(e){}try{return n.p2tr({output:e,network:t}).address}catch(e){}try{var r=t;let i=e.slice(2);if(i.length<2||i.length>40)throw TypeError("Invalid program length for segwit address");let n=e[0]-80;if(n<2||n>16)throw TypeError("Invalid version for segwit address");if(e[1]!==i.length)throw TypeError("Invalid script for segwit address");return!1===l[0]&&(console.warn(c),l[0]=!0),g(i,n,r.bech32)}catch(e){}throw Error(s.toASM(e)+" has no matching Address")}function m(e,t){let r,o;t=t||i.bitcoin;try{r=p(e)}catch(e){}if(r){if(r.version===t.pubKeyHash)return n.p2pkh({hash:r.hash}).output;if(r.version===t.scriptHash)return n.p2sh({hash:r.hash}).output}else{try{o=d(e)}catch(e){}if(o){if(o.prefix!==t.bech32)throw Error(e+" has an invalid prefix");if(0===o.version){if(20===o.data.length)return n.p2wpkh({hash:o.data}).output;if(32===o.data.length)return n.p2wsh({hash:o.data}).output}else if(1===o.version){if(32===o.data.length)return n.p2tr({pubkey:o.data}).output}else if(o.version>=2&&o.version<=16&&o.data.length>=2&&o.data.length<=40)return!1===l[1]&&(console.warn(c),l[1]=!0),s.compile([o.version+80,o.data])}}throw Error(e+" has no matching Script")}},52493:(e,t,r)=>{r.r(t),r.d(t,{embed:()=>h,p2ms:()=>p,p2pk:()=>g,p2pkh:()=>y,p2sh:()=>P,p2tr:()=>
1C,p2wpkh:()=>S,p2wsh:()=>k});var i=r(4402),n=r(26250),s=r(76674);function o(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=r.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})}function a(e){let t;return()=>void 0!==t?t:t=e()}var f=r(50774);let u=n.OPS;function h(e,t){if(!e.data&&!e.output)throw TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),f.qgA(f.OH3(f.Ikc({network:f.Ikc({}),output:s.Yt,data:f.YOg(s.Yt)})),e);let r={name:"embed",network:e.network||i.bitcoin};if(o(r,"output",()=>{if(e.data)return n.compile([u.OP_RETURN].concat(e.data))}),o(r,"data",()=>{if(e.output)return n.decompile(e.output).slice(1)}),t.validate&&e.output){let t=n.decompile(e.output);if(t[0]!==u.OP_RETURN||!t.slice(1).every(e=>f.is(s.Yt,e)))throw TypeError("Output is invalid");if(e.data&&!(0,s.Yl)(e.data,r.data))throw TypeError("Data mismatch")}return Object.assign(r,e)}let c=n.OPS,l=c.OP_RESERVED;function p(e,t){if(!e.input&&!e.output&&!(e.pubkeys&&void 0!==e.m)&&!e.signatures)throw TypeError("Not enough data");function r(e){return n.isCanonicalScriptSignature(e)||(t.allowIncomplete&&e===c.OP_0)!==void 0}t=Object.assign({validate:!0},t||{}),f.qgA(f.OH3(f.Ikc({network:f.Ikc({}),m:f.aig(),n:f.aig(),output:s.Yt,pubkeys:f.YOg(f.IeY(s.fT),"Received invalid pubkey"),signatures:f.YOg(f.IeY(r),"Expected signature to be of type isAcceptableSignature"),input:s.Yt})),e);let a={network:e.network||i.bitcoin},u=[],h=!1;function p(e){h||(h=!0,a.m=(u=n.decompile(e))[0]-l,a.n=u[u.length-2]-l,a.pubkeys=u.slice(1,-2))}if(o(a,"output",()=>{if(e.m&&a.n&&e.pubkeys)return n.compile([].concat(l+e.m,e.pubkeys,l+a.n,c.OP_CHECKMULTISIG))}),o(a,"m",()=>{if(a.output)return p(a.output),a.m}),o(a,"n",()=>{if(a.pubkeys)return a.pubkeys.length}),o(a,"pubkeys",()=>{if(e.output)return p(e.output),a.pubkeys}),o(a,"signatures",()=>{if(e.input)return n.decompile(e.input).slice(1)}),o(a,"input",()=>{if(e.signatures)return n.compile([c.OP_0].concat(e.signatures))}),o(a,"witness",()=>{if(a.input)return[]}),o(a,"name",()=>{if(a.m&&a.n)return`p2ms(${a.m} of ${a.n})`}),t.validate){if(e.output){if(p(e.output),f.qgA(f.aig(),u[0],{message:"Output is invalid"}),f.qgA(f.aig(),u[u.length-2],{message:"Output is invalid"}),u[u.length-1]!==c.OP_CHECKMULTISIG||a.m<=0||a.n>16||a.m>a.n||a.n!==u.length-3||!a.pubkeys.every(e=>(0,s.fT)(e)))throw TypeError("Output is invalid");if(void 0!==e.m&&e.m!==a.m)throw TypeError("m mismatch");if(void 0!==e.n&&e.n!==a.n)throw TypeError("n mismatch");if(e.pubkeys&&!(0,s.Yl)(e.pubkeys,a.pubkeys))throw TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw TypeError("Pubkey count mismatch");if(a.n=e.pubkeys.length,a.n<a.m)throw TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<a.m)throw TypeError("Not enough signatures provided");if(e.signatures.length>a.m)throw TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==c.OP_0)throw TypeError("Input is invalid");if(0===a.signatures.length||!a.signatures.every(r))throw TypeError("Input has invalid signature(s)");if(e.signatures&&!(0,s.Yl)(e.signatures,a.signatures))throw TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw TypeError("Signature count mismatch")}}return Object.assign(a,e)}var d=r(67643);let w=n.OPS;function g(e,t){if(!e.input&&!e.output&&!e.pubkey&&!e.input&&!e.signature)throw TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),f.qgA(f.OH3(f.Ikc({network:f.Ikc({}),output:s.Yt,pubkey:f.IeY(s.fT,"invalid pubkey"),signature:f.IeY(n.isCanonicalScriptSignature,"Expected signature to be of type isCanonicalScriptSignature"),input:s.Yt})),e);let r=a(()=>n.decompile(e.input)),u={name:"p2pk",network:e.network||i.bitcoin};if(o(u,"output",()=>{if(e.pubkey)return n.compile([e.pubkey,w.OP_CHECKSIG])}),o(u,"pubkey",()=>{if(e.output)return e.output.slice(1,-1)}),o(u,"signature",()=>{if(e.input)return r()[0]}),o(u,"input",()=>{if(e.signature)return n.compile([e.signature])}),o(u,"witness",()=>{if(u.input)return[]}),t.validate){if(e.output){if(e.output[e.output.length-1]!==w.OP_CHECKSIG)throw TypeError("Output is invali
1d");if(!(0,s.fT)(u.pubkey))throw TypeError("Output pubkey is invalid");if(e.pubkey&&0!==d.compare(e.pubkey,u.pubkey))throw TypeError("Pubkey mismatch")}if(e.signature&&e.input&&0!==d.compare(e.input,u.input))throw TypeError("Signature mismatch");if(e.input){if(1!==r().length)throw TypeError("Input is invalid");if(!n.isCanonicalScriptSignature(u.signature))throw TypeError("Input has invalid signature")}}return Object.assign(u,e)}var b=r(53032),m=r(68696);let O=n.OPS;function y(e,t){if(!e.address&&!e.hash&&!e.output&&!e.pubkey&&!e.input)throw TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),f.qgA(f.OH3(f.Ikc({network:f.Ikc({}),address:f.YjP(),hash:s.Um,output:(0,s.o_)(25),pubkey:f.IeY(s.fT),signature:f.IeY(n.isCanonicalScriptSignature),input:s.Yt})),e);let r=a(()=>{let t=m.A.decode(e.address);return{version:d.readUInt8(t,0),hash:t.slice(1)}}),u=a(()=>n.decompile(e.input)),h=e.network||i.bitcoin,c={name:"p2pkh",network:h};if(o(c,"address",()=>{if(!c.hash)return;let e=new Uint8Array(21);return d.writeUInt8(e,0,h.pubKeyHash),e.set(c.hash,1),m.A.encode(e)}),o(c,"hash",()=>e.output?e.output.slice(3,23):e.address?r().hash:e.pubkey||c.pubkey?b.hash160(e.pubkey||c.pubkey):void 0),o(c,"output",()=>{if(c.hash)return n.compile([O.OP_DUP,O.OP_HASH160,c.hash,O.OP_EQUALVERIFY,O.OP_CHECKSIG])}),o(c,"pubkey",()=>{if(e.input)return u()[1]}),o(c,"signature",()=>{if(e.input)return u()[0]}),o(c,"input",()=>{if(e.pubkey&&e.signature)return n.compile([e.signature,e.pubkey])}),o(c,"witness",()=>{if(c.input)return[]}),t.validate){let t=Uint8Array.from([]);if(e.address){if(r().version!==h.pubKeyHash)throw TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw TypeError("Invalid address");t=r().hash}if(e.hash)if(t.length>0&&0!==d.compare(t,e.hash))throw TypeError("Hash mismatch");else t=e.hash;if(e.output){if(25!==e.output.length||e.output[0]!==O.OP_DUP||e.output[1]!==O.OP_HASH160||20!==e.output[2]||e.output[23]!==O.OP_EQUALVERIFY||e.output[24]!==O.OP_CHECKSIG)throw TypeError("Output is invalid");let r=e.output.slice(3,23);if(t.length>0&&0!==d.compare(t,r))throw TypeError("Hash mismatch");t=r}if(e.pubkey){let r=b.hash160(e.pubkey);if(t.length>0&&0!==d.compare(t,r))throw TypeError("Hash mismatch");t=r}if(e.input){let r=u();if(2!==r.length)throw TypeError("Input is invalid");if(!n.isCanonicalScriptSignature(r[0]))throw TypeError("Input has invalid signature");if(!(0,s.fT)(r[1]))throw TypeError("Input has invalid pubkey");if(e.signature&&0!==d.compare(e.signature,r[0]))throw TypeError("Signature mismatch");if(e.pubkey&&0!==d.compare(e.pubkey,r[1]))throw TypeError("Pubkey mismatch");let i=b.hash160(r[1]);if(t.length>0&&0!==d.compare(t,i))throw TypeError("Hash mismatch")}}return Object.assign(c,e)}let E=n.OPS;function P(e,t){if(!e.address&&!e.hash&&!e.output&&!e.redeem&&!e.input)throw TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),f.qgA(f.OH3(f.Ikc({network:f.Ikc({}),address:f.YjP(),hash:(0,s.o_)(20),output:(0,s.o_)(23),redeem:f.OH3(f.Ikc({network:f.Ikc({}),output:s.Yt,input:s.Yt,witness:f.YOg(s.Yt)})),input:s.Yt,witness:f.YOg(s.Yt)})),e);let r=e.network;r||(r=e.redeem&&e.redeem.network||i.bitcoin);let u={network:r},h=a(()=>{let t=m.A.decode(e.address);return{version:d.readUInt8(t,0),hash:t.slice(1)}}),c=a(()=>n.decompile(e.input)),l=a(()=>{let t=c(),i=t[t.length-1];return{network:r,output:i===E.OP_FALSE?Uint8Array.from([]):i,input:n.compile(t.slice(0,-1)),witness:e.witness||[]}});if(o(u,"address",()=>{if(!u.hash)return;let e=new Uint8Array(21);return d.writeUInt8(e,0,u.network.scriptHash),e.set(u.hash,1),m.A.encode(e)}),o(u,"hash",()=>e.output?e.output.slice(2,22):e.address?h().hash:u.redeem&&u.redeem.output?b.hash160(u.redeem.output):void 0),o(u,"output",()=>{if(u.hash)return n.compile([E.OP_HASH160,u.hash,E.OP_EQUAL])}),o(u,"redeem",()=>{if(e.input)return l()}),o(u,"input",()=>{if(e.redeem&&e.redeem.input&&e.redeem.output)return n.compile([].concat(n.decompile(e.redeem.input),e.redeem.output))}),o(u,"witness",()=>u.redeem&&u.redeem.witness?u.redeem.witness:u.input?[]:void 0),o(u,"name",()=>{let e=["p2sh"];return void 0!==u.redeem&&void 0!==u.redeem.name&&e.push(u.redeem.name),e.join("-")}),t.validate){let t=Uint8Array.from([]);if(e.address){if(h().version!==r.scriptHash)throw TypeError("Invalid version or Network mismatch");if(20!==h().hash.length)throw TypeError("Invalid address");t=h().hash}if(e.hash)if(t.length>0&&0!==d.compare(t,e.hash))throw TypeError("Hash mismatch");else t=e.hash;if(e.output){if(23!==e.output.length||e.output[0]!==E.OP_HASH160||20!==e.output[1]||e.output[22]!==E.OP_EQUAL)throw TypeError("Output is invali
1d");let r=e.output.slice(2,22);if(t.length>0&&0!==d.compare(t,r))throw TypeError("Hash mismatch");t=r}let i=e=>{if(e.output){let r=n.decompile(e.output);if(!r||r.length<1)throw TypeError("Redeem.output too short");if(e.output.byteLength>520)throw TypeError("Redeem.output unspendable if larger than 520 bytes");if(n.countNonPushOnlyOPs(r)>201)throw TypeError("Redeem.output unspendable with more than 201 non-push ops");let i=b.hash160(e.output);if(t.length>0&&0!==d.compare(t,i))throw TypeError("Hash mismatch");t=i}if(e.input){let t=e.input.length>0,r=e.witness&&e.witness.length>0;if(!t&&!r)throw TypeError("Empty input");if(t&&r)throw TypeError("Input and witness provided");if(t){let t=n.decompile(e.input);if(!n.isPushOnly(t))throw TypeError("Non push-only scriptSig")}}};if(e.input){let e=c();if(!e||e.length<1)throw TypeError("Input too short");if(!(l().output instanceof Uint8Array))throw TypeError("Input is invalid");i(l())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==r)throw TypeError("Network mismatch");if(e.input){let t=l();if(e.redeem.output&&0!==d.compare(e.redeem.output,t.output))throw TypeError("Redeem.output mismatch");if(e.redeem.input&&0!==d.compare(e.redeem.input,t.input))throw TypeError("Redeem.input mismatch")}i(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!(0,s.Yl)(e.redeem.witness,e.witness))throw TypeError("Witness and redeem.witness mismatch")}return Object.assign(u,e)}var _=r(88263);let A=n.OPS,I=new Uint8Array(0);function S(e,t){if(!e.address&&!e.hash&&!e.output&&!e.pubkey&&!e.witness)throw TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),f.qgA(f.OH3(f.Ikc({address:f.YjP(),hash:(0,s.o_)(20),input:(0,s.o_)(0),network:f.Ikc({}),output:(0,s.o_)(22),pubkey:f.IeY(s.fT,"Not a valid pubkey"),signature:f.IeY(n.isCanonicalScriptSignature),witness:f.YOg(s.Yt)})),e);let r=a(()=>{let t=_.bech32.decode(e.address),r=t.words.shift(),i=_.bech32.fromWords(t.words);return{version:r,prefix:t.prefix,data:Uint8Array.from(i)}}),u=e.network||i.bitcoin,h={name:"p2wpkh",network:u};if(o(h,"address",()=>{if(!h.hash)return;let e=_.bech32.toWords(h.hash);return e.unshift(0),_.bech32.encode(u.bech32,e)}),o(h,"hash",()=>e.output?e.output.slice(2,22):e.address?r().data:e.pubkey||h.pubkey?b.hash160(e.pubkey||h.pubkey):void 0),o(h,"output",()=>{if(h.hash)return n.compile([A.OP_0,h.hash])}),o(h,"pubkey",()=>e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0),o(h,"signature",()=>{if(e.witness)return e.witness[0]}),o(h,"input",()=>{if(h.witness)return I}),o(h,"witness",()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]}),t.validate){let t=Uint8Array.from([]);if(e.address){if(u&&u.bech32!==r().prefix)throw TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw TypeError("Invalid address version");if(20!==r().data.length)throw TypeError("Invalid address data");t=r().data}if(e.hash)if(t.length>0&&0!==d.compare(t,e.hash))throw TypeError("Hash mismatch");else t=e.hash;if(e.output){if(22!==e.output.length||e.output[0]!==A.OP_0||20!==e.output[1])throw TypeError("Output is invalid");if(t.length>0&&0!==d.compare(t,e.output.slice(2)))throw TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){let r=b.hash160(e.pubkey);if(t.length>0&&0!==d.compare(t,r))throw TypeError("Hash mismatch");if(t=r,!(0,s.fT)(e.pubkey)||33!==e.pubkey.length)throw TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw TypeError("Witness is invalid");if(!n.isCanonicalScriptSignature(e.witness[0]))throw TypeError("Witness has invalid signature");if(!(0,s.fT)(e.witness[1])||33!==e.witness[1].length)throw TypeError("Witness has invalid pubkey");if(e.signature&&0!==d.compare(e.signature,e.witness[0]))throw TypeError("Signature mismatch");if(e.pubkey&&0!==d.compare(e.pubkey,e.witness[1]))throw TypeError("Pubkey mismatch");let r=b.hash160(e.witness[1]);if(t.length>0&&0!==d.compare(t,r))throw TypeError("Hash mismatch")}}return Object.assign(h,e)}var x=r(67489);let T=n.OPS,U=new Uint8Array(0);function v(e){return!!(e instanceof Uint8Array&&65===e.length&&4===e[0]&&(0,s.fT)(e))}function k(e,t){if(!e.address&&!e.hash&&!e.output&&!e.redeem&&!e.witness)throw TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),f.qgA((0,s.HH)({network:f.Ikc({}),address:f.YjP(),hash:s.wV,output:(0,s.o_)(34),redeem:(0,s.HH)({input:s.Yt,network:f.Ikc({}),output:s.Yt,witness:f.YOg(s.Yt)}
1),input:(0,s.o_)(0),witness:f.YOg(s.Yt)}),e);let r=a(()=>{let t=_.bech32.decode(e.address),r=t.words.shift(),i=_.bech32.fromWords(t.words);return{version:r,prefix:t.prefix,data:Uint8Array.from(i)}}),u=a(()=>n.decompile(e.redeem.input)),h=e.network;h||(h=e.redeem&&e.redeem.network||i.bitcoin);let c={network:h};if(o(c,"address",()=>{if(!c.hash)return;let e=_.bech32.toWords(c.hash);return e.unshift(0),_.bech32.encode(h.bech32,e)}),o(c,"hash",()=>e.output?e.output.slice(2):e.address?r().data:c.redeem&&c.redeem.output?(0,x.sc)(c.redeem.output):void 0),o(c,"output",()=>{if(c.hash)return n.compile([T.OP_0,c.hash])}),o(c,"redeem",()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:U,witness:e.witness.slice(0,-1)}}),o(c,"input",()=>{if(c.witness)return U}),o(c,"witness",()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){let t=n.toStack(u());return c.redeem=Object.assign({witness:t},e.redeem),c.redeem.input=U,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)}),o(c,"name",()=>{let e=["p2wsh"];return void 0!==c.redeem&&void 0!==c.redeem.name&&e.push(c.redeem.name),e.join("-")}),t.validate){let t=Uint8Array.from([]);if(e.address){if(r().prefix!==h.bech32)throw TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw TypeError("Invalid address version");if(32!==r().data.length)throw TypeError("Invalid address data");t=r().data}if(e.hash)if(t.length>0&&0!==d.compare(t,e.hash))throw TypeError("Hash mismatch");else t=e.hash;if(e.output){if(34!==e.output.length||e.output[0]!==T.OP_0||32!==e.output[1])throw TypeError("Output is invalid");let r=e.output.slice(2);if(t.length>0&&0!==d.compare(t,r))throw TypeError("Hash mismatch");t=r}if(e.redeem){if(e.redeem.network&&e.redeem.network!==h)throw TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw TypeError("Ambiguous witness source");if(e.redeem.output){let r=n.decompile(e.redeem.output);if(!r||r.length<1)throw TypeError("Redeem.output is invalid");if(e.redeem.output.byteLength>3600)throw TypeError("Redeem.output unspendable if larger than 3600 bytes");if(n.countNonPushOnlyOPs(r)>201)throw TypeError("Redeem.output unspendable with more than 201 non-push ops");let i=(0,x.sc)(e.redeem.output);if(t.length>0&&0!==d.compare(t,i))throw TypeError("Hash mismatch");t=i}if(e.redeem.input&&!n.isPushOnly(u()))throw TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!(0,s.Yl)(e.witness,e.redeem.witness))throw TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&u().some(v)||e.redeem.output&&(n.decompile(e.redeem.output)||[]).some(v))throw TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){let t=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&0!==d.compare(e.redeem.output,t))throw TypeError("Witness and redeem.output mismatch");if(e.witness.some(v)||(n.decompile(t)||[]).some(v))throw TypeError("Witness contains uncompressed pubkey")}}return Object.assign(c,e)}var H=r(68686),N=r(16824),R=r(49327);let L=n.OPS;function C(e,t){if(!e.address&&!e.output&&!e.pubkey&&!e.internalPubkey&&!(e.witness&&e.witness.length>1))throw TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),f.qgA(f.OH3(f.Ikc({address:f.YjP(),input:(0,s.o_)(0),network:f.Ikc({}),output:(0,s.o_)(34),internalPubkey:(0,s.o_)(32),hash:(0,s.o_)(32),pubkey:(0,s.o_)(32),signature:f.KCZ([(0,s.o_)(64),(0,s.o_)(65)]),witness:f.YOg(s.Yt),scriptTree:f.IeY(s.m1,"Taptree is not of type isTaptree"),redeem:f.OH3(f.Ikc({output:s.Yt,redeemVersion:f.aig(),witness:f.YOg(s.Yt)})),redeemVersion:f.aig()})),e);let r=a(()=>(0,R.fromBech32)(e.address)),u=a(()=>{if(e.witness&&e.witness.length)return e.witness.length>=2&&80===e.witness[e.witness.length-1][0]?e.witness.slice(0,-1):e.witness.slice()}),h=a(()=>e.scriptTree?(0,N.uu)(e.scriptTree):e.hash?{hash:e.hash}:void 0),c=e.network||i.bitcoin,l={name:"p2tr",network:c};if(o(l,"address",()=>{if(!l.pubkey)return;let e=_.bech32m.toWords(l.pubkey);return e.unshift(1),_.bech32m.encode(c.bech32,e)}),o(l,"hash",()=>{let e=h();if(e)return e.hash;let t=u();if(t&&t.length>1){let e=t[t.length-1],r=e[0]&s.gM,i=t[t.length-2],n=(0,N.o4)({output:i,version:r});return(0,N.WH)(e,n)}return null}),o(l,"output",()=>{if(l.pubkey)return n.compile([L.OP_1,l.pubkey])}),o(l,"redeemVersion",()=>e.redeemVersion?e.redeemVersion:e.redeem&&void 0!==e.redeem.redeemVersion&&null!==e.redeem.redeemVersion?e.redeem.redeemVersion:N.ri),o(l,"redeem",()=>{let e=u();if(e&&!(e.length<2))return{output:e[e.length-2],witness:e.slice(0,-2),redeemVersion:e[e.length-1][0]&s.gM}}),o(l,"pubkey",()=>{if(e.pubkey)return e.pubkey;if(e.output)return e.output.slice(2);if(e.address)return r().data;if(l.internalPubkey){let e=(0,N.Kn)(l.internalPubkey,l.hash);if(e)return e.x}}),o(l,"internalPubkey",()=>{if(e.internalPubkey)return e.internalPubkey;let t=u();if(t&&t.length>1)return t[t.length-1].slice(1,33)}),o(l,"signature",()=>{if(e.signature)return e.signature;let t=u();if(t&&1===t.length)return t[0]}),o(l,"witness",()=>{if(e.witness)return e.witness;let t=h();if(t&&e.redeem&&e.redeem.output&&e.internalPubkey){let r=(0,N.o4)({output:e.redeem.output,version:l.redeemVersion}),i=(0,N.CB)(t,r);if(!i)return;let n=(0,N.Kn)(e.internalPubkey,t.hash);if(!n)return;let s=d.concat([Uint8Array.from([l.redeemVersion|n.parity]),e.internalPubkey].concat(i));return[e.redeem.output,s]}if(e.signature)return[e.signature]}),t.validate){let t=Uint8Array.from([]);if(e.address){if(c&&c.bech32!==r().prefix)throw TypeError("Invalid prefix or Network mismatch");
1if(1!==r().version)throw TypeError("Invalid address version");if(32!==r().data.length)throw TypeError("Invalid address data");t=r().data}if(e.pubkey)if(t.length>0&&0!==d.compare(t,e.pubkey))throw TypeError("Pubkey mismatch");else t=e.pubkey;if(e.output){if(34!==e.output.length||e.output[0]!==L.OP_1||32!==e.output[1])throw TypeError("Output is invalid");if(t.length>0&&0!==d.compare(t,e.output.slice(2)))throw TypeError("Pubkey mismatch");t=e.output.slice(2)}if(e.internalPubkey){let r=(0,N.Kn)(e.internalPubkey,l.hash);if(t.length>0&&0!==d.compare(t,r.x))throw TypeError("Pubkey mismatch");t=r.x}if(t&&t.length&&!(0,H.l)().isXOnlyPoint(t))throw TypeError("Invalid pubkey for p2tr");let i=h();if(e.hash&&i&&0!==d.compare(e.hash,i.hash))throw TypeError("Hash mismatch");if(e.redeem&&e.redeem.output&&i){let t=(0,N.o4)({output:e.redeem.output,version:l.redeemVersion});if(!(0,N.CB)(i,t))throw TypeError("Redeem script not in tree")}let o=u();if(e.redeem&&l.redeem){if(e.redeem.redeemVersion&&e.redeem.redeemVersion!==l.redeem.redeemVersion)throw TypeError("Redeem.redeemVersion and witness mismatch");if(e.redeem.output){if(0===n.decompile(e.redeem.output).length)throw TypeError("Redeem.output is invalid");if(l.redeem.output&&0!==d.compare(e.redeem.output,l.redeem.output))throw TypeError("Redeem.output and witness mismatch")}if(e.redeem.witness&&l.redeem.witness&&!(0,s.Yl)(e.redeem.witness,l.redeem.witness))throw TypeError("Redeem.witness and witness mismatch")}if(o&&o.length)if(1===o.length){if(e.signature&&0!==d.compare(e.signature,o[0]))throw TypeError("Signature mismatch")}else{let r=o[o.length-1];if(r.length<33)throw TypeError(`The control-block length is too small. Got ${r.length}, expected min 33.`);if((r.length-33)%32!=0)throw TypeError(`The control-block length of ${r.length} is incorrect!`);let i=(r.length-33)/32;if(i>128)throw TypeError(`The script path is too long. Got ${i}, expected max 128.`);let n=r.slice(1,33);if(e.internalPubkey&&0!==d.compare(e.internalPubkey,n))throw TypeError("Internal pubkey mismatch");if(!(0,H.l)().isXOnlyPoint(n))throw TypeError("Invalid internalPubkey for p2tr witness");let a=r[0]&s.gM,f=o[o.length-2],u=(0,N.o4)({output:f,version:a}),h=(0,N.WH)(r,u),c=(0,N.Kn)(n,h);if(!c)throw TypeError("Invalid outputKey for p2tr witness");if(t.length&&0!==d.compare(t,c.x))throw TypeError("Pubkey mismatch for p2tr witness");if(c.parity!==(1&r[0]))throw Error("Incorrect parity")}}return Object.assign(l,e)}},53032:(e,t,r)=>{r.r(t),r.d(t,{TAGGED_HASH_PREFIXES:()=>S,TAGS:()=>I,hash160:()=>_,hash256:()=>A,taggedHash:()=>x});var i=r(17852),n=r(83025);let s=Uint32Array.from([0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0]);i.ol,i.ol;let o=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),a=Uint8Array.from(Array(16).fill(0).map((e,t)=>t)),f=a.map(e=>(9*e+5)%16),u=(()=>{let e=[[a],[f]];for(let t=0;t<4;t++)for(let r of e)r.push(r[t].map(e=>o[e]));return e})(),h=u[0],c=u[1],l=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),p=h.map((e,t)=>e.map(e=>l[t][e])),d=c.map((e,t)=>e.map(e=>l[t][e])),w=Uint32Array.from([0,0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xa953fd4e]),g=Uint32Array.from([0x50a28be6,0x5c4dd124,0x6d703ef3,0x7a6d76e9,0]);function b(e,t,r,i){return 0===e?t^r^i:1===e?t&r|~t&i:2===e?(t|~r)^i:3===e?t&i|r&~i:t^(r|~i)}let m=new Uint32Array(16);class O extends i.ol{constructor(){super(64,20,8,!0),this.h0=0x67452301,this.h1=-0x10325477,this.h2=-0x67452302,this.h3=0x10325476,this.h4=-0x3c2d1e10}get(){let{h0:e,h1:t,h2:r,h3:i,h4:n}=this;return[e,t,r,i,n]}set(e,t,r,i,n){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|i,this.h4=0|n}process(e,t){for(let r=0;r<16;r++,t+=4)m[r]=e.getUint32(t,!0);let r=0|this.h0,i=r,s=0|this.h1,o=s,a=0|this.h2,f=a,u=0|this.h3,l=u,O=0|this.h4,y=O;for(let e=0;e<5;e++){let t=4-e,E=w[e],P=g[e],_=h[e],A=c[e],I=p[e],S=d[e];for(let t=0;t<16;t++){let i=(0,n.aZ)(r+b(e,s,a,u)+m[_[t]]+E,I[t])+O|0;r=O,O=u,u=0|(0,n.aZ)(a,10),a=s,s=i}for(let e=0;e<16;e++){let r=(0,n.aZ)(i+b(t,o,f,l)+m[A[e]]+P,S[e])+y|0;i=y,y=l,l=0|(0,n.aZ)(f,10),f=o,o=r}}this.set(this.h1+a+l|0,this.h2+u+y|0,this.h3+O+i|0,this.h4+r+o|0,this.h0+s+f|0)}roundClean(){(0,n.uH)(m)}destroy(){this.destroyed=!0,(0,n.uH)(this.buffer),this.set(0,0,0,0,0)}}let y=(0,n.qj)(()=>new O);var E=r(67489),P=r(67643);function _(e){return y((0,E.sc)(e))}function A(e){return(0,E.sc)((0,E.sc)(e))}let I=["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"],S={"BIP0340/challenge":Uint8Array.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),"BIP0340/aux":Uint8Array.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),"BIP0340/nonce":Uint8Array.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),TapLeaf:Uint8Array.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),TapBranch:Uint8Array.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),TapSighash:Uint8Array.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),TapTweak:Uint8Array.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),"KeyAgg list":Uint8Array.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),"KeyAgg coefficient":Uint8Array.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129])};function x(e,t){return(0,E.sc)(P.concat([S[e],t]))}},58507:(e,t,r)=>{r.d(t,{Z:()=>g});var i=r(62488),n=r(53032),s=r(67489),o=r(26250),a=r(76674),f=r(67643),u=r(50774);function h(e){let t=e.length;return i.Uu.encodingLength(t)+t}let c=new Uint8Array(0),l=[],p=f.fromHex("0000000000000000000000000000000000000000000000000000000000000000"),d=f.fromHex("0000000000000000000000000000000000000000000000000000000000000001"),w={script:c,valueBuffer:f.fromHex("ffffffffffffffff")};class g{static DEFAULT_SEQUENCE=0xffffffff;static SIGHASH_DEFAULT=0;static SIGHASH_ALL=1;static SIGHASH_NONE=2;static SIGHASH_SINGLE=3;static SIGHASH_ANYONECANPAY=128;static SIGHASH_OUTPUT_MASK=3;static SIGHASH_INPUT_MASK=128;static ADVANCED_TRANSACTION_MARKER=0;static ADVANCED_TRANSACTION_FLAG=1;static fromBuffer(e,t){let r=new i.Oo(e),n=new g;n.version=r.readUInt32();let s=r.readUInt8(),o=r.readUInt8(),a=!1;s===g.ADVANCED_TRANSACTION_MARKER&&o===g.ADVANCED_TRANSACTION_FLAG?a=!0:r.offset-=2;let f=r.readVarInt();for(let e=0;e<f;++e)n.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:l});let u=r.readVarInt();for(let e=0;e<u;++e)n.outs.push({value:r.readInt64(),script:r.readVarSlice()});if(a){for(let e=0;e<f;++e)n.ins[e].witness=r.readVector();if(!n.hasWitnesses())throw Error("Transaction has superfluous witness data")}if(n.locktime=r.readUInt32(),t)return n;if(r.offset!==e.length)throw Error("Transaction has unexpected data");return n}static fromHex(e){return g.fromBuffer(f.fromHex(e),!1)}static isCoinbaseHash(e){u.qgA(a.el,e);for(let t=0;t<32;++t)if(0!==e[t])return!1;return!0}version=1;locktime=0;ins=[];outs=[];isCoinbase(){return 1===this.ins.length&&g.isCoinbaseHash(this.ins[0].hash)}
1addInput(e,t,r,i){return u.qgA(u.PVZ([a.el,a.b_,u.mee(u.lqM(a.b_)),u.mee(u.lqM(a.Yt))]),[e,t,r,i]),null==r&&(r=g.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:i||c,sequence:r,witness:l})-1}addOutput(e,t){return u.qgA(u.PVZ([a.Yt,a.nH]),[e,t]),this.outs.push({script:e,value:t})-1}hasWitnesses(){return this.ins.some(e=>0!==e.witness.length)}stripWitnesses(){this.ins.forEach(e=>{e.witness=l})}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(e=!0){let t=e&&this.hasWitnesses();return(t?10:8)+i.Uu.encodingLength(this.ins.length)+i.Uu.encodingLength(this.outs.length)+this.ins.reduce((e,t)=>e+40+h(t.script),0)+this.outs.reduce((e,t)=>e+8+h(t.script),0)+(t?this.ins.reduce((e,t)=>e+function(e){let t=e.length;return i.Uu.encodingLength(t)+e.reduce((e,t)=>e+h(t),0)}(t.witness),0):0)}clone(){let e=new g;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map(e=>({hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness})),e.outs=this.outs.map(e=>({script:e.script,value:e.value})),e}hashForSignature(e,t,r){if(u.qgA(u.PVZ([a.b_,a.Yt,u.aig()]),[e,t,r]),e>=this.ins.length)return d;let i=o.compile(o.decompile(t).filter(e=>e!==o.OPS.OP_CODESEPARATOR)),s=this.clone();if((31&r)===g.SIGHASH_NONE)s.outs=[],s.ins.forEach((t,r)=>{r!==e&&(t.sequence=0)});else if((31&r)===g.SIGHASH_SINGLE){if(e>=this.outs.length)return d;s.outs.length=e+1;for(let t=0;t<e;t++)s.outs[t]=w;s.ins.forEach((t,r)=>{r!==e&&(t.sequence=0)})}r&g.SIGHASH_ANYONECANPAY?(s.ins=[s.ins[e]],s.ins[0].script=i):(s.ins.forEach(e=>{e.script=c}),s.ins[e].script=i);let h=new Uint8Array(s.byteLength(!1)+4);return f.writeInt32(h,h.length-4,r,"LE"),s.__toBuffer(h,0,!1),n.hash256(h)}hashForWitnessV1(e,t,r,o,l,p){if(u.qgA(u.PVZ([a.b_,u.YOg(a.Yt),u.YOg(a.nH),a.b_]),[e,t,r,o]),r.length!==this.ins.length||t.length!==this.ins.length)throw Error("Must supply prevout script and value for all inputs");let d=o===g.SIGHASH_DEFAULT?g.SIGHASH_ALL:o&g.SIGHASH_OUTPUT_MASK,w=(o&g.SIGHASH_INPUT_MASK)===g.SIGHASH_ANYONECANPAY,b=d===g.SIGHASH_NONE,m=d===g.SIGHASH_SINGLE,O=c,y=c,E=c,P=c,_=c;if(!w){let e=i.ac.withCapacity(36*this.ins.length);this.ins.forEach(t=>{e.writeSlice(t.hash),e.writeUInt32(t.index)}),O=(0,s.sc)(e.end()),e=i.ac.withCapacity(8*this.ins.length),r.forEach(t=>e.writeInt64(t)),y=(0,s.sc)(e.end()),e=i.ac.withCapacity(t.map(h).reduce((e,t)=>e+t)),t.forEach(t=>e.writeVarSlice(t)),E=(0,s.sc)(e.end()),e=i.ac.withCapacity(4*this.ins.length),this.ins.forEach(t=>e.writeUInt32(t.sequence)),P=(0,s.sc)(e.end())}if(b||m){if(m&&e<this.outs.length){let t=this.outs[e],r=i.ac.withCapacity(8+h(t.script));r.writeInt64(t.value),r.writeVarSlice(t.script),_=(0,s.sc)(r.end())}}else{if(!this.outs.length)throw Error("Add outputs to the transaction before signing.");let e=this.outs.map(e=>8+h(e.script)).reduce((e,t)=>e+t),t=i.ac.withCapacity(e);this.outs.forEach(e=>{t.writeInt64(e.value),t.writeVarSlice(e.script)}),_=(0,s.sc)(t.end())}let A=2*!!l+ +!!p,I=174-49*!!w-32*!!b+32*!!p+37*!!l,S=i.ac.withCapacity(I);if(S.writeUInt8(o),S.writeUInt32(this.version),S.writeUInt32(this.locktime),S.writeSlice(O),S.writeSlice(y),S.writeSlice(E),S.writeSlice(P),b||m||S.writeSlice(_),S.writeUInt8(A),w){let i=this.ins[e];S.writeSlice(i.hash),S.writeUInt32(i.index),S.writeInt64(r[e]),S.writeVarSlice(t[e]),S.writeUInt32(i.sequence)}else S.writeUInt32(e);if(p){let e=i.ac.withCapacity(h(p));e.writeVarSlice(p),S.writeSlice((0,s.sc)(e.end()))}return m&&S.writeSlice(_),l&&(S.writeSlice(l),S.writeUInt8(0),S.writeUInt32(0xffffffff)),n.taggedHash("TapSighash",f.concat([Uint8Array.from([0]),S.end()]))}hashForWitnessV0(e,t,r,s){let o;u.qgA(u.PVZ([a.b_,a.Yt,a.nH,a.b_]),[e,t,r,s]);let f=Uint8Array.from([]),c=p,l=p,d=p;if(s&g.SIGHASH_ANYONECANPAY||(f=new Uint8Array(36*this.ins.length),o=new i.ac(f,0),this.ins.forEach(e=>{o.writeSlice(e.hash),o.writeUInt32(e.index)}),l=n.hash256(f)),s&g.SIGHASH_ANYONECANPAY||(31&s)===g.SIGHASH_SINGLE||(31&s)===g.SIGHASH_NONE||(f=new Uint8Array(4*this.ins.length),o=new i.ac(f,0),this.ins.forEach(e=>{o.writeUInt32(e.sequence)}),d=n.hash256(f)),(31&s)!==g.SIGHASH_SINGLE&&(31&s)!==g.SIGHASH_NONE)f=new Uint8Array(this.outs.reduce((e,t)=>
1e+8+h(t.script),0)),o=new i.ac(f,0),this.outs.forEach(e=>{o.writeInt64(e.value),o.writeVarSlice(e.script)}),c=n.hash256(f);else if((31&s)===g.SIGHASH_SINGLE&&e<this.outs.length){let t=this.outs[e];f=new Uint8Array(8+h(t.script)),(o=new i.ac(f,0)).writeInt64(t.value),o.writeVarSlice(t.script),c=n.hash256(f)}f=new Uint8Array(156+h(t)),o=new i.ac(f,0);let w=this.ins[e];return o.writeUInt32(this.version),o.writeSlice(l),o.writeSlice(d),o.writeSlice(w.hash),o.writeUInt32(w.index),o.writeVarSlice(t),o.writeInt64(r),o.writeUInt32(w.sequence),o.writeSlice(c),o.writeUInt32(this.locktime),o.writeUInt32(s),n.hash256(f)}getHash(e){return e&&this.isCoinbase()?new Uint8Array(32):n.hash256(this.__toBuffer(void 0,void 0,e))}getId(){return f.toHex((0,i.Fl)(this.getHash(!1)))}toBuffer(e,t){return this.__toBuffer(e,t,!0)}toHex(){return f.toHex(this.toBuffer(void 0,void 0))}setInputScript(e,t){u.qgA(u.PVZ([u.aig(),a.Yt]),[e,t]),this.ins[e].script=t}setWitness(e,t){u.qgA(u.PVZ([u.aig(),u.YOg(a.Yt)]),[e,t]),this.ins[e].witness=t}__toBuffer(e,t,r=!1){e||(e=new Uint8Array(this.byteLength(r)));let n=new i.ac(e,t||0);n.writeUInt32(this.version);let s=r&&this.hasWitnesses();return(s&&(n.writeUInt8(g.ADVANCED_TRANSACTION_MARKER),n.writeUInt8(g.ADVANCED_TRANSACTION_FLAG)),n.writeVarInt(this.ins.length),this.ins.forEach(e=>{n.writeSlice(e.hash),n.writeUInt32(e.index),n.writeVarSlice(e.script),n.writeUInt32(e.sequence)}),n.writeVarInt(this.outs.length),this.outs.forEach(e=>{void 0!==e.value?n.writeInt64(e.value):n.writeSlice(e.valueBuffer),n.writeVarSlice(e.script)}),s&&this.ins.forEach(e=>{n.writeVector(e.witness)}),n.writeUInt32(this.locktime),void 0!==t)?e.slice(t,n.offset):e}}},62488:(e,t,r)=>{r.d(t,{Eb:()=>f,Fl:()=>a,Oo:()=>h,Uu:()=>n,ac:()=>u});var i=r(76674),n=r(48315),s=r(50774),o=r(67643);function a(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let i=0;i<e.length/2;i++)r=e[i],e[i]=e[t],e[t]=r,t--;return e}function f(e){let t=new Uint8Array(e.length);return t.set(e),t}class u{buffer;offset;static withCapacity(e){return new u(new Uint8Array(e))}constructor(e,t=0){this.buffer=e,this.offset=t,s.qgA(s.PVZ([i.Yt,i.b_]),[e,t])}writeUInt8(e){this.offset=o.writeUInt8(this.buffer,this.offset,e)}writeInt32(e){this.offset=o.writeInt32(this.buffer,this.offset,e,"LE")}writeInt64(e){this.offset=o.writeInt64(this.buffer,this.offset,BigInt(e),"LE")}writeUInt32(e){this.offset=o.writeUInt32(this.buffer,this.offset,e,"LE")}writeUInt64(e){this.offset=o.writeUInt64(this.buffer,this.offset,BigInt(e),"LE")}writeVarInt(e){let{bytes:t}=n.encode(e,this.buffer,this.offset);this.offset+=t}writeSlice(e){if(this.buffer.length<this.offset+e.length)throw Error("Cannot write slice out of bounds");this.buffer.set(e,this.offset),this.offset+=e.length}writeVarSlice(e){this.writeVarInt(e.length),this.writeSlice(e)}writeVector(e){this.writeVarInt(e.length),e.forEach(e=>this.writeVarSlice(e))}end(){if(this.buffer.length===this.offset)return this.buffer;throw Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}class h{buffer;offset;constructor(e,t=0){this.buffer=e,this.offset=t,s.qgA(s.PVZ([i.Yt,i.b_]),[e,t])}readUInt8(){let e=o.readUInt8(this.buffer,this.offset);return this.offset++,e}readInt32(){let e=o.readInt32(this.buffer,this.offset,"LE");return this.offset+=4,e}readUInt32(){let e=o.readUInt32(this.buffer,this.offset,"LE");return this.offset+=4,e}readInt64(){let e=o.readInt64(this.buffer,this.offset,"LE");return this.offset+=8,e}readVarInt(){let{bigintValue:e,bytes:t}=n.decode(this.buffer,this.offset);return this.offset+=t,e}readSlice(e){if("number"!=typeof e&&"bigint"!=typeof e)throw Error("cannot write a non-number as a number");if(e<0&&e<BigInt(0))throw Error("specified a negative value for writing an unsigned value");if(e>0x1fffffffffffff&&e>BigInt(0x1fffffffffffff))throw Error("RangeError: value out of range");if(Math.floor(Number(e))!==Number(e))throw Error("value has a fractional component");let t=Number(e);if(this.buffer.length<this.offset+t)throw Error("Cannot read slice out of bounds");let r=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,r}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){let e=this.readVarInt(),t=[];for(let r=0;r<e;r++)t.push(this.readVarSlice());return t}}},67489:(e,t,r)=>{r.d(t,{sc:()=>c});var i=r(17852);let n=BigInt(0x100000000-1),s=BigInt(32);var o=r(83025);let a=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc
176c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),f=new Uint32Array(64);class u extends i.ol{constructor(e=32){super(64,e,8,!1),this.A=0|i.yc[0],this.B=0|i.yc[1],this.C=0|i.yc[2],this.D=0|i.yc[3],this.E=0|i.yc[4],this.F=0|i.yc[5],this.G=0|i.yc[6],this.H=0|i.yc[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)f[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=f[e-15],r=f[e-2],i=(0,o.Ow)(t,7)^(0,o.Ow)(t,18)^t>>>3,n=(0,o.Ow)(r,17)^(0,o.Ow)(r,19)^r>>>10;f[e]=n+f[e-7]+i+f[e-16]|0}let{A:r,B:n,C:s,D:u,E:h,F:c,G:l,H:p}=this;for(let e=0;e<64;e++){let t=p+((0,o.Ow)(h,6)^(0,o.Ow)(h,11)^(0,o.Ow)(h,25))+(0,i.r9)(h,c,l)+a[e]+f[e]|0,d=((0,o.Ow)(r,2)^(0,o.Ow)(r,13)^(0,o.Ow)(r,22))+(0,i.TQ)(r,n,s)|0;p=l,l=c,c=h,h=u+t|0,u=s,s=n,n=r,r=t+d|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,u=u+this.D|0,h=h+this.E|0,c=c+this.F|0,l=l+this.G|0,p=p+this.H|0,this.set(r,n,s,u,h,c,l,p)}roundClean(){(0,o.uH)(f)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,o.uH)(this.buffer)}}let h=function(e,t=!1){let r=e.length,i=new Uint32Array(r),o=new Uint32Array(r);for(let a=0;a<r;a++){let{h:r,l:f}=function(e,t=!1){return t?{h:Number(e&n),l:Number(e>>s&n)}:{h:0|Number(e>>s&n),l:0|Number(e&n)}}(e[a],t);[i[a],o[a]]=[r,f]}return[i,o]}(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
15771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e)));h[0],h[1],i.ol;let c=(0,o.qj)(()=>new u)},68686:(e,t,r)=>{r.d(t,{f:()=>s,l:()=>o});var i=r(67643);let n={};function s(e,t){var r;e?e!==n.eccLib&&(t?.DANGER_DO_NOT_VERIFY_ECCLIB||(f("function"==typeof(r=e).isXOnlyPoint),f(r.isXOnlyPoint(a("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),f(r.isXOnlyPoint(a("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e"))),f(r.isXOnlyPoint(a("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"))),f(r.isXOnlyPoint(a("0000000000000000000000000000000000000000000000000000000000000001"))),f(!r.isXOnlyPoint(a("0000000000000000000000000000000000000000000000000000000000000000"))),f(!r.isXOnlyPoint(a("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"))),f("function"==typeof r.xOnlyPointAddTweak),u.forEach(e=>{let t=r.xOnlyPointAddTweak(a(e.pubkey),a(e.tweak));null===e.result?f(null===t):(f(null!==t),f(t.parity===e.parity),f(0===i.compare(t.xOnlyPubkey,a(e.result))))})),n.eccLib=e):n.eccLib=e}function o(){if(!n.eccLib)throw Error("No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance");return n.eccLib}let a=e=>i.fromHex(e);function f(e){if(!e)throw Error("ecc library invalid")}let u=[{pubkey:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",tweak:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",parity:-1,result:null},{pubkey:"1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b",tweak:"a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac",parity:1,result:"e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"},{pubkey:"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",tweak:"823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47",parity:0,result:"9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"}]},68696:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(67489);let n=function(e){if(e.length>=255)throw TypeError("Alphabet too long");let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let r=0;r<e.length;r++){let i=e.charAt(r),n=i.charCodeAt(0);if(255!==t[n])throw TypeError(i+" is ambiguous");t[n]=r}let r=e.length,i=e.charAt(0),n=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;let s=0,o=0,a=0;for(;e[s]===i;)o++,s++;let f=(e.length-s)*n+1>>>0,u=new Uint8Array(f);for(;s<e.length;){let i=e.charCodeAt(s);if(i>255)return;let n=t[i];if(255===n)return;let o=0;for(let e=f-1;(0!==n||o<a)&&-1!==e;e--,o++)n+=r*u[e]>>>0,u[e]=n%256>>>0,n=n/256>>>0;if(0!==n)throw Error("Non-zero carry");a=o,s++}let h=f-a;for(;h!==f&&0===u[h];)h++;let c=new Uint8Array(o+(f-h)),l=o;for(;h!==f;)c[l++]=u[h++];return c}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";let n=0,o=0,a=0,f=t.length;for(;a!==f&&0===t[a];)a++,n++;let u=(f-a)*s+1>>>0,h=new Uint8Array(u);for(;a!==f;){let e=t[a],i=0;for(let t=u-1;(0!==e||i<o)&&-1!==t;t--,i++)e+=256*h[t]>>>0,h[t]=e%r>>>0,e=e/r>>>0;if(0!==e)throw Error("Non-zero carry");o=i,a++}let c=u-o;for(;c!==u&&0===h[c];)c++;let l=i.repeat(n);for(;c<u;++c)l+=e.charAt(h[c]);return l},decodeUnsafe:o,decode:function(e){let t=o(e);if(t)return t;throw Error("Non-base"+r+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),s=function(e){function t(t){var r=t.slice(0,-4),i=t.slice(-4),n=e(r);if(!(i[0]^n[0]|i[1]^n[1]|i[2]^n[2]|i[3]^n[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),i=e(r),s=new Uint8Array(r.length+4);return s.set(r,0),s.set(i.subarray(0,4),r.length),n.encode(s)},decode:function(e){var r=t(n.decode(e));if(null==r)throw Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(null!=r)return t(r)}}}(function(e){return(0,i.sc)((0,i.sc)(e))})},76674:(e,t,r)=>{r.d(t,{HH:()=>y,Um:()=>p,Uz:()=>b,Yl:()=>f,Yt:()=>w,b_:()=>m,el:()=>d,fT:()=>u,gM:()=>h,k0:()=>c,m1:()=>function e(t){return Array.isArray(t)?2===t.length&&t.every(t=>e(t)):c(t)},nH:()=>O,o_:()=>a,rL:()=>g,wV:()=>l});var i=r(67643),n=r(50774);let s=new Uint8Array(32),o=i.fromHex("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),a=e=>n.FsL(n.KJ$(Uint8Array),n.Bw9(e));function f(e,t){return e.length===t.length&&e.every((e,r)=>0===i.compare(e,t[r]))}function u(e){if(!(e instanceof Uint8Array)||e.length<33)return!1;let t=e[0],r=e.slice(1,33);if(0===i.compare(s,r)||i.compare(r,o)>=0)return!1;if((2===t||3===t)&&33===e.length)return!0;let n=e.slice(33);return!(0===i.compare(s,n)||i.compare(n,o)>=0)&&4===t&&65===e.length}let h=254;function c(e){return!!e&&"output"in e&&e.output instanceof Uint8Array&&(void 0===e.version||(e.version&h)===e.version)}let l=a(32),p=a(20),d=a(32),w=n.KJ$(Uint8Array),g=n.FsL(n.YjP(),n.yGV(/^([0-9a-f]{2})+$/i)),b=n.FsL(n.aig(),n.ndf(),n.Wwf(0),n.cGV(255)),m=n.FsL(n.aig(),n.ndf(),n.Wwf(0),n.cGV(0xffffffff)),O=n.FsL(n.oad(),n.Wwf(0n),n.cGV(0x7fffffffffffffffn)),y=e=>n.Ikc(Object.entries(e).reduce((e,t)=>
1({...e,[t[0]]:n.cl6(t[1])}),{}))},83025:(e,t,r)=>{function i(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function n(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function s(e,t){i(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function o(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function a(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function f(e,t){return e<<32-t|e>>>t}function u(e,t){return e<<t|e>>>32-t>>>0}function h(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),i(e),e}r.d(t,{CC:()=>n,DO:()=>i,Ht:()=>s,O8:()=>a,Ow:()=>f,Vw:()=>c,ZJ:()=>h,aZ:()=>u,qj:()=>l,uH:()=>o});class c{}function l(e){let t=t=>e().update(h(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}},90507:(e,t,r)=>{r.d(t,{AM:()=>l,C2:()=>c,LE:()=>h,R0:()=>d,em:()=>w,toXOnly:()=>u,vJ:()=>g});var i=r(76674),n=r(58507),s=r(3401),o=r(16824),a=r(52493),f=r(67643);let u=e=>32===e.length?e:e.slice(1,33);function h(e,t,r){let i=function(e,t,r){if(!e.tapScriptSig||!e.tapScriptSig.length)throw Error(`Can not finalize taproot input #${t}. No tapleaf script signature provided.`);let i=(e.tapLeafScript||[]).sort((e,t)=>e.controlBlock.length-t.controlBlock.length).find(t=>(function(e,t,r){let i=(0,o.o4)({output:e.script,version:e.leafVersion});return(!r||0===f.compare(i,r))&&void 0!==t.find(e=>0===f.compare(e.leafHash,i))})(t,e.tapScriptSig,r));if(!i)throw Error(`Can not finalize taproot input #${t}. Signature for tapleaf script not found.`);return i}(t,e,r);try{let e=(function(e,t){let r=(0,o.o4)({output:t.script,version:t.leafVersion});return(e.tapScriptSig||[]).filter(e=>0===f.compare(e.leafHash,r)).map(e=>{var r,i;return r=t.script,i=e,Object.assign({positionInScript:(0,s.k1)(i.pubkey,r)},i)}).sort((e,t)=>t.positionInScript-e.positionInScript).map(e=>e.signature)})(t,i).concat(i.script).concat(i.controlBlock);return{finalScriptWitness:(0,s.du)(e)}}catch(t){throw Error(`Can not finalize taproot input #${e}: ${t}`)}}function c(e,t){let r=t?Uint8Array.from([t]):Uint8Array.from([]);return f.concat([e,r])}function l(e){return e&&!!(e.tapInternalKey||e.tapMerkleRoot||e.tapLeafScript&&e.tapLeafScript.length||e.tapBip32Derivation&&e.tapBip32Derivation.length||e.witnessUtxo&&(0,s.NI)(e.witnessUtxo.script))}function p(e,t){return e&&!!(e.tapInternalKey||e.tapTree||e.tapBip32Derivation&&e.tapBip32Derivation.length||t&&(0,s.NI)(t))}function d(e,t,r){(function(e,t,r){let i=l(e)&&O(t),n=O(e)&&l(t),s=e===t&&l(t)&&O(t);if(i||n||s)throw Error(`Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`)})(e,t,r),function(e,t,r){if(t.tapMerkleRoot){let i=(t.tapLeafScript||[]).every(e=>m(e,t.tapMerkleRoot)),n=(e.tapLeafScript||[]).every(e=>m(e,t.tapMerkleRoot));if(!i||!n)throw Error(`Invalid arguments for Psbt.${r}. Tapleaf not part of taptree.`)}else if(e.tapMerkleRoot&&!(t.tapLeafScript||[]).every(t=>m(t,e.tapMerkleRoot)))throw Error(`Invalid arguments for Psbt.${r}. Tapleaf not part of taptree.`)}(e,t,r)}function w(e,t,r){(function(e,t,r){let i=p(e)&&O(t),n=O(e)&&p(t),s=e===t&&p(t)&&O(t);if(i||n||s)throw Error(`Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`)})(e,t,r),function(e,t){if(!t.tapTree&&!t.tapInternalKey)return;let r=t.tapInternalKey||e.tapInternalKey,n=t.tapTree||e.tapTree;if(r){let{script:t}=e,s=function(e,t){let r=t&&function(e=[]){return 1===e.length&&0===e[0].depth?{output:e[0].script,version:e[0].leafVersion}:function(e){let t;for(let r of e)if(!(t=function e(t,r,n=0){if(n>o.RY)throw Error("Max taptree depth exceeded.");if(t.depth===n)return r?void 0:{output:t.script,version:t.leafVersion};if((0,i.k0)(r))return;let s=e(t,r&&r[0],n+1);if(s)return[s,r&&r[1]];let a=e(t,r&&r[1],n+1);if(a)return[r&&r[0],a]}(r,t)))throw Error("No room left to insert tapleaf in tree");return t}(e)}(t.leaves),{output:n}=(0,a.p2tr)({internalPubkey:e,scriptTree:r});return n}(r,n);if(t&&0!==f.compare(s,t))throw Error("Error adding output. Script or address mismatch.")}}(e,t)}function g(e,t){return(function(e){let t=[];if(e.tapKeySig&&t.push(e.tapKeySig),e.tapScriptSig&&t.push(...e.tapScriptSig.map(e=>e.signature)),!t.length){let r=function(e){if(!e)return;let t=e.slice(2);if(64===t.length||65===t.length)return t}(e.finalScriptWitness);r&&t.push(r)}return t})(e).some(e=>(0,s.XN)(e,b,t))}function b(e){return{signature:e.slice(0,64),hashType:e.slice(64)[0]||n.Z.SIGHASH_DEFAULT}}function m(e,t){if(!t)return!0;let r=(0,o.o4)({output:e.script,version:e.leafVersion}),i=(0,o.WH)(e.controlBlock,r);return 0===f.compare(i,t)}function O(e){return e&&!!(e.redeemScript||e.witnessScript||e.bip32Derivation&&e.bip32Derivation.length)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.