@tangle-network/sandbox 0.9.1 → 0.9.3

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.
@@ -1 +1,225 @@
1
- (function(_0x131941,_0xe0e7fa){const _0x3309bf=a0_0x347a,_0x3fc7b5=_0x131941();while(!![]){try{const _0x199049=parseInt(_0x3309bf(0xa7))/0x1+parseInt(_0x3309bf(0xb3))/0x2*(-parseInt(_0x3309bf(0xd6))/0x3)+-parseInt(_0x3309bf(0xce))/0x4*(-parseInt(_0x3309bf(0xa3))/0x5)+-parseInt(_0x3309bf(0xbd))/0x6*(parseInt(_0x3309bf(0xc8))/0x7)+-parseInt(_0x3309bf(0x99))/0x8*(parseInt(_0x3309bf(0xbf))/0x9)+-parseInt(_0x3309bf(0xa8))/0xa*(parseInt(_0x3309bf(0xda))/0xb)+parseInt(_0x3309bf(0xcd))/0xc*(parseInt(_0x3309bf(0xcc))/0xd);if(_0x199049===_0xe0e7fa)break;else _0x3fc7b5['push'](_0x3fc7b5['shift']());}catch(_0x2bbcfe){_0x3fc7b5['push'](_0x3fc7b5['shift']());}}}(a0_0xa820,0x6af9e));function a0_0x347a(_0xb1036f,_0x2f05dc){_0xb1036f=_0xb1036f-0x95;const _0xa82059=a0_0xa820();let _0x347a3d=_0xa82059[_0xb1036f];if(a0_0x347a['\x69\x4b\x64\x68\x4b\x70']===undefined){var _0x597ab6=function(_0x2299ae){const _0x2719fa='\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x2b\x2f\x3d';let _0x50df70='',_0x1686df='';for(let _0x4d5b6e=0x0,_0x4980b5,_0x301f25,_0x40f4f9=0x0;_0x301f25=_0x2299ae['\x63\x68\x61\x72\x41\x74'](_0x40f4f9++);~_0x301f25&&(_0x4980b5=_0x4d5b6e%0x4?_0x4980b5*0x40+_0x301f25:_0x301f25,_0x4d5b6e++%0x4)?_0x50df70+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x4980b5>>(-0x2*_0x4d5b6e&0x6)):0x0){_0x301f25=_0x2719fa['\x69\x6e\x64\x65\x78\x4f\x66'](_0x301f25);}for(let _0x57990a=0x0,_0x114803=_0x50df70['\x6c\x65\x6e\x67\x74\x68'];_0x57990a<_0x114803;_0x57990a++){_0x1686df+='\x25'+('\x30\x30'+_0x50df70['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x57990a)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x1686df);};a0_0x347a['\x42\x52\x55\x55\x64\x71']=_0x597ab6,a0_0x347a['\x52\x64\x6a\x46\x59\x61']={},a0_0x347a['\x69\x4b\x64\x68\x4b\x70']=!![];}const _0x3aa0e9=_0xa82059[0x0],_0x14d6c7=_0xb1036f+_0x3aa0e9,_0x3a344f=a0_0x347a['\x52\x64\x6a\x46\x59\x61'][_0x14d6c7];return!_0x3a344f?(_0x347a3d=a0_0x347a['\x42\x52\x55\x55\x64\x71'](_0x347a3d),a0_0x347a['\x52\x64\x6a\x46\x59\x61'][_0x14d6c7]=_0x347a3d):_0x347a3d=_0x3a344f,_0x347a3d;}import{f as a0_0x5ab731,r as a0_0x479a9c,u as a0_0x60a10a}from'\x2e\x2e\x2f\x65\x72\x72\x6f\x72\x73\x2d\x44\x5a\x73\x66\x4a\x55\x75\x63\x2e\x6a\x73';const DEFAULT_INTELLIGENCE_BASE_URL='\x68\x74\x74\x70\x73\x3a\x2f\x2f\x69\x6e\x74\x65\x6c\x6c\x69\x67\x65\x6e\x63\x65\x2e\x74\x61\x6e\x67\x6c\x65\x2e\x74\x6f\x6f\x6c\x73',DEFAULT_TIMEOUT_MS=0x7530;function a0_0xa820(){const _0x594def=['\x43\x68\x48\x57\x79\x4e\x6d','\x6d\x74\x65\x35\x6e\x64\x4c\x78\x75\x77\x6a\x41\x72\x4d\x57','\x72\x4d\x66\x50\x42\x67\x76\x4b\x69\x68\x72\x56\x69\x67\x6e\x56\x42\x4d\x35\x4c\x79\x33\x71\x47\x44\x67\x38\x47\x73\x77\x35\x30\x7a\x77\x58\x53\x41\x77\x44\x4c\x42\x4d\x6e\x4c\x69\x65\x66\x71\x73\x74\x4f\x47','\x45\x4e\x44\x50\x41\x65\x71','\x7a\x4e\x6a\x56\x42\x71','\x6f\x64\x48\x35\x73\x68\x6a\x54\x41\x31\x79','\x79\x33\x76\x59\x43\x32\x39\x59','\x43\x4d\x48\x6e\x73\x67\x4b','\x41\x66\x66\x34\x7a\x75\x53','\x72\x30\x76\x75','\x6e\x64\x4b\x30\x6d\x5a\x6a\x7a\x43\x4d\x4c\x63\x76\x78\x69','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x31\x5a','\x6c\x33\x79\x58\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x59\x38','\x42\x4d\x76\x34\x44\x65\x6e\x31\x43\x4e\x6e\x56\x43\x47','\x71\x4d\x76\x48\x43\x4d\x76\x59\x69\x61','\x7a\x32\x66\x30\x7a\x71','\x41\x67\x76\x48\x7a\x67\x76\x59\x43\x57','\x72\x30\x54\x56\x7a\x66\x69','\x74\x76\x50\x68\x43\x4d\x4b','\x41\x78\x72\x4c\x42\x78\x6d','\x6d\x74\x76\x30\x45\x68\x4c\x67\x45\x77\x47','\x43\x32\x4c\x36\x7a\x71','\x6c\x33\x79\x58\x6c\x33\x6a\x31\x42\x4e\x6d','\x43\x33\x72\x48\x44\x68\x76\x5a','\x6e\x4a\x69\x31\x6d\x5a\x4b\x35\x44\x78\x48\x32\x43\x4d\x4c\x63','\x6d\x5a\x4b\x35\x6e\x4a\x65\x57\x7a\x30\x48\x6e\x72\x33\x6e\x62','\x71\x75\x31\x35\x73\x76\x79','\x79\x78\x62\x50\x73\x32\x76\x35','\x44\x78\x6e\x4c\x43\x4b\x4c\x4b','\x43\x67\x66\x59\x43\x32\x75','\x42\x67\x4c\x54\x41\x78\x71','\x79\x4d\x66\x5a\x7a\x76\x76\x59\x42\x61','\x42\x4d\x66\x54\x7a\x71','\x42\x30\x48\x33\x45\x65\x71','\x42\x4d\x7a\x33\x79\x4b\x47','\x41\x67\x54\x58\x74\x65\x79','\x6d\x74\x69\x59\x74\x75\x39\x63\x42\x68\x50\x74','\x75\x67\x44\x6b\x74\x4c\x61','\x41\x31\x44\x71\x73\x4b\x4b','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x31\x48\x43\x67\x4b','\x79\x78\x62\x57\x42\x67\x4c\x4a\x79\x78\x72\x50\x42\x32\x34\x56\x41\x4e\x6e\x56\x42\x47','\x42\x67\x66\x49\x7a\x77\x57','\x6c\x33\x79\x58\x6c\x33\x6a\x31\x42\x4e\x6d\x56','\x6c\x33\x79\x58\x6c\x33\x6e\x4c\x43\x33\x6e\x50\x42\x32\x35\x5a\x6c\x57','\x73\x77\x35\x30\x7a\x77\x58\x53\x41\x77\x44\x4c\x42\x4d\x6e\x4c\x69\x65\x66\x71\x73\x73\x62\x59\x7a\x78\x72\x31\x43\x4d\x35\x4c\x7a\x63\x62\x48\x42\x49\x62\x6f\x72\x65\x50\x74\x74\x30\x34\x47\x7a\x78\x48\x57\x42\x33\x6a\x30\x69\x68\x44\x50\x44\x67\x47\x47\x42\x4d\x38\x47\x79\x4d\x39\x4b\x45\x73\x62\x5a\x44\x68\x6a\x4c\x79\x77\x30','\x6c\x33\x79\x58\x6c\x33\x6e\x4c\x43\x33\x6e\x50\x42\x32\x35\x5a','\x6d\x4a\x47\x32\x6e\x4a\x65\x31\x6f\x67\x6a\x4d\x45\x66\x62\x32\x76\x47','\x43\x4e\x76\x55\x73\x77\x71','\x6d\x74\x47\x35\x79\x75\x35\x35\x76\x65\x44\x31','\x42\x32\x7a\x4d\x43\x32\x76\x30','\x43\x32\x4c\x4e\x42\x4d\x66\x53','\x77\x78\x72\x79\x73\x30\x57','\x43\x4d\x76\x57\x42\x67\x66\x4a\x7a\x71','\x73\x4c\x6e\x77\x72\x78\x61','\x41\x4b\x7a\x41\x75\x66\x79','\x42\x77\x39\x4b\x7a\x77\x57','\x44\x67\x76\x34\x44\x61','\x6e\x30\x44\x6c\x76\x75\x44\x71\x43\x71','\x42\x68\x50\x48\x44\x31\x4f','\x43\x32\x76\x30','\x6c\x33\x6e\x57\x79\x77\x35\x5a','\x6d\x5a\x4c\x69\x75\x76\x62\x6d\x74\x77\x71','\x6d\x4a\x75\x31\x6d\x64\x6d\x58\x6d\x4e\x6e\x4c\x75\x76\x62\x51\x41\x61','\x6e\x64\x79\x57\x6e\x64\x61\x57\x41\x4c\x72\x63\x41\x4d\x54\x48','\x6c\x33\x72\x59\x79\x77\x6e\x4c\x43\x57','\x79\x33\x6a\x4c\x79\x78\x72\x4c\x73\x77\x35\x30\x7a\x77\x58\x53\x41\x77\x44\x4c\x42\x4d\x6e\x4c\x71\x32\x58\x50\x7a\x77\x35\x30\x6f\x49\x62\x48\x43\x67\x4c\x6c\x7a\x78\x4b\x47\x41\x78\x6d\x47\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x77\x71','\x71\x32\x4c\x4b\x45\x78\x4b','\x71\x77\x6a\x56\x43\x4e\x72\x66\x43\x4e\x6a\x56\x43\x47','\x79\x4c\x48\x6c\x7a\x77\x53','\x44\x66\x62\x69\x43\x78\x4f'];a0_0xa820=function(){return _0x594def;};return a0_0xa820();}function appendParam(_0x151934,_0x4c141c,_0x565031){const _0x5adc41=a0_0x347a,_0x30433b={'\x7a\x77\x69\x68\x44':function(_0x599959,_0x48ff70){return _0x599959===_0x48ff70;}};if(_0x30433b[_0x5adc41(0xd8)](_0x565031,void 0x0))return;_0x151934[_0x5adc41(0xca)](_0x4c141c,String(_0x565031));}function createIntelligenceClient(_0x209b54){const _0x3f0165=a0_0x347a,_0x3afab5={'\x56\x53\x6d\x56\x50':function(_0x17ad67,_0x28dd39){return _0x17ad67 instanceof _0x28dd39;},'\x4e\x4b\x56\x48\x45':_0x3f0165(0xd2),'\x6a\x46\x5a\x50\x56':function(_0xf31e9e,_0x3835c7){return _0xf31e9e(_0x3835c7);},'\x6c\x7a\x61\x77\x5a':_0x3f0165(0xb6),'\x63\x4d\x6a\x41\x6f':function(_0x538ac0,_0x5af539,_0x39f72d,_0x3e561a,_0x4ea9c4){return _0x538ac0(_0x5af539,_0x39f72d,_0x3e561a,_0x4ea9c4);},'\x6f\x48\x77\x78\x44':_0x3f0165(0xad),'\x50\x67\x4a\x4e\x50':function(_0x2ce1d9,_0x147cc8,_0x5551c0,_0x5a4e8d){return _0x2ce1d9(_0x147cc8,_0x5551c0,_0x5a4e8d);},'\x6e\x66\x77\x62\x48':function(_0x1f8853,_0x3e56f5){return _0x1f8853>_0x3e56f5;},'\x43\x56\x69\x78\x6e':function(_0x4140a7,_0x335230,_0x53a62a,_0x4e1de3){return _0x4140a7(_0x335230,_0x53a62a,_0x4e1de3);},'\x62\x58\x4b\x65\x6b':_0x3f0165(0x95),'\x4d\x5a\x47\x72\x69':function(_0x16166e,_0x4f3e82,_0x1a5ae3,_0x12bcd9,_0x2daeed){return _0x16166e(_0x4f3e82,_0x1a5ae3,_0x12bcd9,_0x2daeed);},'\x70\x78\x70\x62\x73':_0x3f0165(0x98),'\x6b\x57\x50\x4a\x49':_0x3f0165(0x9e),'\x4a\x53\x56\x45\x70':_0x3f0165(0xb8),'\x74\x50\x48\x71\x7a':function(_0x3cf494,_0x93daf6){return _0x3cf494(_0x93daf6);},'\x72\x68\x4d\x48\x69':function(_0x3e669a,_0x27a27a,_0x497ffc,_0xaa95f3){return _0x3e669a(_0x27a27a,_0x497ffc,_0xaa95f3);},'\x53\x58\x45\x66\x6a':function(_0x5e768a,_0x189fbe,_0x64b481,_0x365afe){return _0x5e768a(_0x189fbe,_0x64b481,_0x365afe);},'\x68\x6b\x71\x4c\x46':_0x3f0165(0xab),'\x43\x69\x64\x79\x79':function(_0x220c83,_0x49feed){return _0x220c83>_0x49feed;},'\x59\x74\x58\x4b\x4c':function(_0x276171,_0x458949,_0x14dcc9,_0x505f7e){return _0x276171(_0x458949,_0x14dcc9,_0x505f7e);},'\x68\x51\x78\x65\x4b':function(_0x262cb5,_0x40193c,_0x439e8b){return _0x262cb5(_0x40193c,_0x439e8b);},'\x41\x4d\x79\x49\x56':function(_0x2ed624,_0x3a89fd){return _0x2ed624(_0x3a89fd);},'\x47\x4b\x6f\x64\x52':'\x68\x74\x74\x70\x73\x3a\x2f\x2f\x69\x6e\x74\x65\x6c\x6c\x69\x67\x65\x6e\x63\x65\x2e\x74\x61\x6e\x67\x6c\x65\x2e\x74\x6f\x6f\x6c\x73'};if(!_0x209b54[_0x3f0165(0xaa)])throw new Error(_0x3f0165(0xd0));const _0x243907=_0x209b54['\x61\x70\x69\x4b\x65\x79'],_0x4f0114=(_0x209b54[_0x3f0165(0xae)]??_0x3afab5[_0x3f0165(0xa0)])[_0x3f0165(0xc3)](/\/$/,''),_0x1ec6fe=_0x209b54[_0x3f0165(0x9a)]??DEFAULT_TIMEOUT_MS;async function _0x14b2b6(_0x3b2274){const _0x141de8=_0x3f0165,_0x22a2b1=''+_0x4f0114+_0x3b2274,_0x274c85=new AbortController(),_0xf548ee=setTimeout(()=>_0x274c85['\x61\x62\x6f\x72\x74'](),_0x1ec6fe);try{return await globalThis['\x66\x65\x74\x63\x68'](_0x22a2b1,{'\x68\x65\x61\x64\x65\x72\x73':{'\x41\x75\x74\x68\x6f\x72\x69\x7a\x61\x74\x69\x6f\x6e':_0x141de8(0x9d)+_0x243907,'\x41\x63\x63\x65\x70\x74':_0x141de8(0xb7)},'\x73\x69\x67\x6e\x61\x6c':_0x274c85[_0x141de8(0xc1)]});}catch(_0x51947a){if(_0x3afab5['\x56\x53\x6d\x56\x50'](_0x51947a,Error)&&_0x51947a[_0x141de8(0xaf)]===_0x3afab5['\x4e\x4b\x56\x48\x45'])throw new a0_0x60a10a(_0x1ec6fe);throw new a0_0x479a9c(_0x141de8(0xd7)+(_0x51947a instanceof Error?_0x51947a['\x6d\x65\x73\x73\x61\x67\x65']:_0x3afab5['\x6a\x46\x5a\x50\x56'](String,_0x51947a)),_0x51947a instanceof Error?_0x51947a:void 0x0,{'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x3b2274,'\x6f\x72\x69\x67\x69\x6e':_0x3afab5[_0x141de8(0xc9)]});}finally{clearTimeout(_0xf548ee);}}async function _0x235c20(_0x8694ea){const _0x2ced3a=_0x3f0165,_0x587d87=await _0x14b2b6(_0x8694ea),_0x63c5ff=await _0x587d87[_0x2ced3a(0xc7)]();if(!_0x587d87['\x6f\x6b'])throw _0x3afab5['\x63\x4d\x6a\x41\x6f'](a0_0x5ab731,_0x587d87[_0x2ced3a(0xa6)],_0x63c5ff,{'\x6d\x65\x74\x68\x6f\x64':_0x2ced3a(0x98),'\x70\x61\x74\x68':_0x8694ea},_0x587d87[_0x2ced3a(0x9f)]);return JSON[_0x2ced3a(0xac)](_0x63c5ff);}async function _0x41822b(_0x1274bc={}){const _0x380c33=_0x3f0165,_0x339fe0=new URLSearchParams();return appendParam(_0x339fe0,_0x3afab5[_0x380c33(0xb0)],_0x1274bc[_0x380c33(0xad)]),_0x3afab5[_0x380c33(0xb4)](appendParam,_0x339fe0,_0x380c33(0xd9),_0x1274bc['\x66\x72\x6f\x6d']),appendParam(_0x339fe0,'\x74\x6f',_0x1274bc['\x74\x6f']),_0x3afab5['\x50\x67\x4a\x4e\x50'](appendParam,_0x339fe0,'\x71',_0x1274bc['\x71']),appendParam(_0x339fe0,_0x380c33(0xc6),_0x1274bc['\x6d\x6f\x64\x65\x6c']),_0x3afab5[_0x380c33(0xb4)](appendParam,_0x339fe0,_0x380c33(0xbe),_0x1274bc['\x72\x75\x6e\x49\x64']),appendParam(_0x339fe0,_0x380c33(0xa6),_0x1274bc['\x73\x74\x61\x74\x75\x73']),appendParam(_0x339fe0,_0x380c33(0x95),_0x1274bc[_0x380c33(0x95)]),_0x235c20('\x2f\x76\x31\x2f\x74\x72\x61\x63\x65\x73'+(_0x3afab5[_0x380c33(0xb1)](_0x339fe0[_0x380c33(0xa4)],0x0)?'\x3f'+_0x339fe0:''));}async function _0x410531(_0x433df4,_0x22a8c1={}){const _0x3eeabf=_0x3f0165,_0x62a79c=new URLSearchParams();appendParam(_0x62a79c,'\x6c\x69\x6d\x69\x74',_0x22a8c1['\x6c\x69\x6d\x69\x74']),_0x3afab5['\x43\x56\x69\x78\x6e'](appendParam,_0x62a79c,_0x3afab5['\x62\x58\x4b\x65\x6b'],_0x22a8c1[_0x3eeabf(0x95)]);const _0x24bfc7=_0x62a79c['\x73\x69\x7a\x65']>0x0?'\x3f'+_0x62a79c:'';return _0x235c20(_0x3eeabf(0x9b)+encodeURIComponent(_0x433df4)+_0x3eeabf(0xcb)+_0x24bfc7);}async function _0x294471(_0x487be4){const _0x1da319=_0x3f0165,_0x4f6acc=_0x1da319(0x9b)+encodeURIComponent(_0x487be4)+'\x2f\x73\x70\x61\x6e\x73\x2e\x6e\x64\x6a\x73\x6f\x6e',_0xf5fe02=await _0x14b2b6(_0x4f6acc);if(!_0xf5fe02['\x6f\x6b']){const _0x55c69e=await _0xf5fe02[_0x1da319(0xc7)]();throw _0x3afab5[_0x1da319(0xa1)](a0_0x5ab731,_0xf5fe02[_0x1da319(0xa6)],_0x55c69e,{'\x6d\x65\x74\x68\x6f\x64':_0x3afab5[_0x1da319(0xd5)],'\x70\x61\x74\x68':_0x4f6acc},_0xf5fe02[_0x1da319(0x9f)]);}if(!_0xf5fe02['\x62\x6f\x64\x79'])throw new a0_0x479a9c(_0x1da319(0xbb),{'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x4f6acc,'\x6f\x72\x69\x67\x69\x6e':_0x3afab5[_0x1da319(0xc9)]});return _0xf5fe02['\x62\x6f\x64\x79'];}async function _0x4e7edc(_0x4dac0d={}){const _0x42d349=_0x3f0165,_0x15c99f=new URLSearchParams();return _0x3afab5[_0x42d349(0xb4)](appendParam,_0x15c99f,_0x42d349(0xad),_0x4dac0d[_0x42d349(0xad)]),appendParam(_0x15c99f,'\x6f\x66\x66\x73\x65\x74',_0x4dac0d[_0x42d349(0xc0)]),appendParam(_0x15c99f,_0x42d349(0xa6),_0x4dac0d[_0x42d349(0xa6)]),appendParam(_0x15c99f,_0x3afab5[_0x42d349(0xb5)],_0x4dac0d[_0x42d349(0x9e)]),appendParam(_0x15c99f,'\x71',_0x4dac0d['\x71']),appendParam(_0x15c99f,'\x66\x72\x6f\x6d',_0x4dac0d[_0x42d349(0xd9)]),_0x3afab5[_0x42d349(0xb4)](appendParam,_0x15c99f,'\x74\x6f',_0x4dac0d['\x74\x6f']),_0x3afab5['\x50\x67\x4a\x4e\x50'](appendParam,_0x15c99f,_0x3afab5[_0x42d349(0xc4)],_0x4dac0d[_0x42d349(0xb8)]),appendParam(_0x15c99f,'\x63\x75\x72\x73\x6f\x72',_0x4dac0d[_0x42d349(0x95)]),_0x235c20(_0x42d349(0xa5)+(_0x3afab5['\x6e\x66\x77\x62\x48'](_0x15c99f['\x73\x69\x7a\x65'],0x0)?'\x3f'+_0x15c99f:''));}async function _0x459ba0(_0x357c1d){return _0x235c20('\x2f\x76\x31\x2f\x72\x75\x6e\x73\x2f'+encodeURIComponent(_0x357c1d));}async function _0x2f4979(_0x50812a){const _0x3e78d9=_0x3f0165;return _0x3afab5[_0x3e78d9(0xc5)](_0x235c20,_0x3e78d9(0xb9)+_0x3afab5[_0x3e78d9(0xd4)](encodeURIComponent,_0x50812a)+_0x3e78d9(0xcf));}async function _0x91b2d9(_0x26e5af={}){const _0x205f37=_0x3f0165,_0x350261=new URLSearchParams();return appendParam(_0x350261,_0x3afab5[_0x205f37(0xb0)],_0x26e5af['\x6c\x69\x6d\x69\x74']),_0x3afab5[_0x205f37(0x96)](appendParam,_0x350261,_0x205f37(0xd9),_0x26e5af[_0x205f37(0xd9)]),_0x3afab5['\x53\x58\x45\x66\x6a'](appendParam,_0x350261,'\x74\x6f',_0x26e5af['\x74\x6f']),appendParam(_0x350261,'\x71',_0x26e5af['\x71']),appendParam(_0x350261,_0x3afab5[_0x205f37(0xb2)],_0x26e5af[_0x205f37(0xab)]),appendParam(_0x350261,'\x63\x75\x72\x73\x6f\x72',_0x26e5af[_0x205f37(0x95)]),_0x235c20(_0x205f37(0xbc)+(_0x3afab5[_0x205f37(0xd1)](_0x350261[_0x205f37(0xa4)],0x0)?'\x3f'+_0x350261:''));}async function _0x434a82(_0x5a161d,_0x104d37={}){const _0x4c2890=_0x3f0165,_0x18518c=new URLSearchParams();_0x3afab5[_0x4c2890(0xb4)](appendParam,_0x18518c,_0x3afab5[_0x4c2890(0xb0)],_0x104d37[_0x4c2890(0xad)]),_0x3afab5[_0x4c2890(0xc2)](appendParam,_0x18518c,_0x3afab5[_0x4c2890(0xd3)],_0x104d37['\x63\x75\x72\x73\x6f\x72']);const _0x2f6744=_0x18518c['\x73\x69\x7a\x65']>0x0?'\x3f'+_0x18518c:'';return _0x235c20(_0x4c2890(0xba)+encodeURIComponent(_0x5a161d)+_0x4c2890(0xcf)+_0x2f6744);}async function*_0x40f358(_0x5a421c,_0x5ea515={}){const _0x29bc9a=_0x3f0165;let _0xa42e34=_0x5ea515[_0x29bc9a(0x95)];for(;;){const _0x1ee059=await _0x3afab5[_0x29bc9a(0x97)](_0x410531,_0x5a421c,{..._0x5ea515,'\x63\x75\x72\x73\x6f\x72':_0xa42e34});for(const _0x1c3ca1 of _0x1ee059[_0x29bc9a(0xa2)])yield _0x1c3ca1;if(!_0x1ee059[_0x29bc9a(0x9c)])return;_0xa42e34=_0x1ee059['\x6e\x65\x78\x74\x43\x75\x72\x73\x6f\x72'];}}async function*_0x105572(_0x434a72={}){const _0x9cf5d=_0x3f0165;let _0x125156=_0x434a72[_0x9cf5d(0x95)];for(;;){const _0xbc293f=await _0x41822b({..._0x434a72,'\x63\x75\x72\x73\x6f\x72':_0x125156});for(const _0x57ecbc of _0xbc293f[_0x9cf5d(0xa2)])yield _0x57ecbc;if(!_0xbc293f[_0x9cf5d(0x9c)])return;_0x125156=_0xbc293f['\x6e\x65\x78\x74\x43\x75\x72\x73\x6f\x72'];}}async function*_0x1e82c5(_0x27686f={}){const _0x2f8220=_0x3f0165;let _0x2cdfff=_0x27686f[_0x2f8220(0x95)];for(;;){const _0x1f1a52=await _0x3afab5[_0x2f8220(0xa9)](_0x91b2d9,{..._0x27686f,'\x63\x75\x72\x73\x6f\x72':_0x2cdfff});for(const _0x489d00 of _0x1f1a52['\x69\x74\x65\x6d\x73'])yield _0x489d00;if(!_0x1f1a52[_0x2f8220(0x9c)])return;_0x2cdfff=_0x1f1a52[_0x2f8220(0x9c)];}}return{'\x6c\x69\x73\x74\x54\x72\x61\x63\x65\x73':_0x41822b,'\x67\x65\x74\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73':_0x410531,'\x65\x78\x70\x6f\x72\x74\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73\x4e\x64\x6a\x73\x6f\x6e':_0x294471,'\x6c\x69\x73\x74\x52\x75\x6e\x73':_0x4e7edc,'\x67\x65\x74\x52\x75\x6e':_0x459ba0,'\x67\x65\x74\x52\x75\x6e\x54\x72\x61\x63\x65\x73':_0x2f4979,'\x6c\x69\x73\x74\x53\x65\x73\x73\x69\x6f\x6e\x73':_0x91b2d9,'\x67\x65\x74\x53\x65\x73\x73\x69\x6f\x6e\x54\x72\x61\x63\x65\x73':_0x434a82,'\x69\x74\x65\x72\x61\x74\x65\x54\x72\x61\x63\x65\x53\x70\x61\x6e\x73':_0x40f358,'\x69\x74\x65\x72\x61\x74\x65\x54\x72\x61\x63\x65\x73':_0x105572,'\x69\x74\x65\x72\x61\x74\x65\x53\x65\x73\x73\x69\x6f\x6e\x73':_0x1e82c5};}export{DEFAULT_INTELLIGENCE_BASE_URL,createIntelligenceClient};
1
+ import { f as parseErrorResponse, r as NetworkError, u as TimeoutError } from "../errors-DZsfJUuc.js";
2
+ //#region src/intelligence/index.ts
3
+ /**
4
+ * `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
5
+ * hosted trace-read surface on Tangle Intelligence
6
+ * (`https://intelligence.tangle.tools`, default port 3030).
7
+ *
8
+ * This is a SEPARATE host from the Sandbox API. The SDK's `IntelligenceClient`
9
+ * (exposed as `client.intelligence`) routes intelligence-*report* calls through
10
+ * `SandboxClient.fetch` against the **sandbox** `baseUrl` — that is the
11
+ * sandbox-api intelligence-report surface, a different service. The trace-read
12
+ * routes (`/v1/traces`, `/v1/runs*`, `/v1/sessions*`) live on intelligence-api
13
+ * and are tenant-scoped by the customer key, so this client does NOT reuse
14
+ * `SandboxClient.fetch`; it carries its own intelligence-host base URL.
15
+ *
16
+ * Auth is the customer key (`sk-tan-*`) sent as `Authorization: Bearer ...`;
17
+ * the platform resolves it to the caller's tenant and filters `tenant_id`
18
+ * first and unconditionally on every route, so a cross-tenant id returns an
19
+ * empty result or 404, never the row.
20
+ *
21
+ * Nothing here uses a Node API — `globalThis.fetch` only — so it runs in the
22
+ * browser, Cloudflare Workers, Deno, and Node 20+ unchanged. The base URL must
23
+ * be supplied by the caller (e.g. from `TANGLE_INTELLIGENCE_BASE_URL`) or it
24
+ * falls back to the production host.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * import { createIntelligenceClient } from "@tangle-network/sandbox/intelligence";
29
+ *
30
+ * const intel = createIntelligenceClient({
31
+ * apiKey: process.env.TANGLE_API_KEY!,
32
+ * baseUrl: process.env.TANGLE_INTELLIGENCE_BASE_URL,
33
+ * });
34
+ *
35
+ * const { items } = await intel.listTraces({ status: "ERROR", limit: 20 });
36
+ * for await (const span of intel.iterateTraceSpans(items[0].traceId)) {
37
+ * console.log(span.name, span.durationMs);
38
+ * }
39
+ * ```
40
+ *
41
+ * @packageDocumentation
42
+ */
43
+ /**
44
+ * Production intelligence-api host. Mirrors the api-side
45
+ * `DEFAULT_INTELLIGENCE_BASE_URL` so the SDK default and the server default
46
+ * never drift.
47
+ */
48
+ const DEFAULT_INTELLIGENCE_BASE_URL = "https://intelligence.tangle.tools";
49
+ const DEFAULT_TIMEOUT_MS = 3e4;
50
+ function appendParam(search, key, value) {
51
+ if (value === void 0) return;
52
+ search.set(key, String(value));
53
+ }
54
+ /**
55
+ * Create a browser-safe client for the Tangle Intelligence trace-read surface.
56
+ *
57
+ * @param config.apiKey Customer key (`sk-tan-*`) — Bearer auth, resolved to a tenant.
58
+ * @param config.baseUrl Intelligence-api host; defaults to {@link DEFAULT_INTELLIGENCE_BASE_URL}.
59
+ */
60
+ function createIntelligenceClient(config) {
61
+ if (!config.apiKey) throw new Error("createIntelligenceClient: apiKey is required");
62
+ const apiKey = config.apiKey;
63
+ const baseUrl = (config.baseUrl ?? "https://intelligence.tangle.tools").replace(/\/$/, "");
64
+ const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
65
+ /**
66
+ * One authenticated request. Mirrors `SandboxClient.fetch`: Bearer auth,
67
+ * an `AbortController` timeout that surfaces as `TimeoutError`, and a
68
+ * transport failure wrapped as `NetworkError`. Never reuses the sandbox
69
+ * `baseUrl` — this is the intelligence host.
70
+ */
71
+ async function request(path) {
72
+ const url = `${baseUrl}${path}`;
73
+ const controller = new AbortController();
74
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
75
+ try {
76
+ return await globalThis.fetch(url, {
77
+ headers: {
78
+ Authorization: `Bearer ${apiKey}`,
79
+ Accept: "application/json"
80
+ },
81
+ signal: controller.signal
82
+ });
83
+ } catch (err) {
84
+ if (err instanceof Error && err.name === "AbortError") throw new TimeoutError(timeoutMs);
85
+ throw new NetworkError(`Failed to connect to Intelligence API: ${err instanceof Error ? err.message : String(err)}`, err instanceof Error ? err : void 0, {
86
+ endpoint: path,
87
+ origin: "sandbox-api"
88
+ });
89
+ } finally {
90
+ clearTimeout(timeoutId);
91
+ }
92
+ }
93
+ /** GET a JSON route, raising the SDK's typed error on a non-2xx response. */
94
+ async function getJson(path) {
95
+ const response = await request(path);
96
+ const body = await response.text();
97
+ if (!response.ok) throw parseErrorResponse(response.status, body, {
98
+ method: "GET",
99
+ path
100
+ }, response.headers);
101
+ return JSON.parse(body);
102
+ }
103
+ async function listTraces(params = {}) {
104
+ const search = new URLSearchParams();
105
+ appendParam(search, "limit", params.limit);
106
+ appendParam(search, "from", params.from);
107
+ appendParam(search, "to", params.to);
108
+ appendParam(search, "q", params.q);
109
+ appendParam(search, "model", params.model);
110
+ appendParam(search, "runId", params.runId);
111
+ appendParam(search, "status", params.status);
112
+ appendParam(search, "cursor", params.cursor);
113
+ return getJson(`/v1/traces${search.size > 0 ? `?${search}` : ""}`);
114
+ }
115
+ async function getTraceSpans(traceId, params = {}) {
116
+ const search = new URLSearchParams();
117
+ appendParam(search, "limit", params.limit);
118
+ appendParam(search, "cursor", params.cursor);
119
+ const suffix = search.size > 0 ? `?${search}` : "";
120
+ return getJson(`/v1/traces/${encodeURIComponent(traceId)}/spans${suffix}`);
121
+ }
122
+ async function exportTraceSpansNdjson(traceId) {
123
+ const path = `/v1/traces/${encodeURIComponent(traceId)}/spans.ndjson`;
124
+ const response = await request(path);
125
+ if (!response.ok) {
126
+ const body = await response.text();
127
+ throw parseErrorResponse(response.status, body, {
128
+ method: "GET",
129
+ path
130
+ }, response.headers);
131
+ }
132
+ if (!response.body) throw new NetworkError("Intelligence API returned an NDJSON export with no body stream", {
133
+ endpoint: path,
134
+ origin: "sandbox-api"
135
+ });
136
+ return response.body;
137
+ }
138
+ async function listRuns(params = {}) {
139
+ const search = new URLSearchParams();
140
+ appendParam(search, "limit", params.limit);
141
+ appendParam(search, "offset", params.offset);
142
+ appendParam(search, "status", params.status);
143
+ appendParam(search, "gate", params.gate);
144
+ appendParam(search, "q", params.q);
145
+ appendParam(search, "from", params.from);
146
+ appendParam(search, "to", params.to);
147
+ appendParam(search, "label", params.label);
148
+ appendParam(search, "cursor", params.cursor);
149
+ return getJson(`/v1/runs${search.size > 0 ? `?${search}` : ""}`);
150
+ }
151
+ async function getRun(runId) {
152
+ return getJson(`/v1/runs/${encodeURIComponent(runId)}`);
153
+ }
154
+ async function getRunTraces(runId) {
155
+ return getJson(`/v1/runs/${encodeURIComponent(runId)}/traces`);
156
+ }
157
+ async function listSessions(params = {}) {
158
+ const search = new URLSearchParams();
159
+ appendParam(search, "limit", params.limit);
160
+ appendParam(search, "from", params.from);
161
+ appendParam(search, "to", params.to);
162
+ appendParam(search, "q", params.q);
163
+ appendParam(search, "userId", params.userId);
164
+ appendParam(search, "cursor", params.cursor);
165
+ return getJson(`/v1/sessions${search.size > 0 ? `?${search}` : ""}`);
166
+ }
167
+ async function getSessionTraces(sessionId, params = {}) {
168
+ const search = new URLSearchParams();
169
+ appendParam(search, "limit", params.limit);
170
+ appendParam(search, "cursor", params.cursor);
171
+ const suffix = search.size > 0 ? `?${search}` : "";
172
+ return getJson(`/v1/sessions/${encodeURIComponent(sessionId)}/traces${suffix}`);
173
+ }
174
+ async function* iterateTraceSpans(traceId, params = {}) {
175
+ let cursor = params.cursor;
176
+ for (;;) {
177
+ const page = await getTraceSpans(traceId, {
178
+ ...params,
179
+ cursor
180
+ });
181
+ for (const span of page.items) yield span;
182
+ if (!page.nextCursor) return;
183
+ cursor = page.nextCursor;
184
+ }
185
+ }
186
+ async function* iterateTraces(params = {}) {
187
+ let cursor = params.cursor;
188
+ for (;;) {
189
+ const page = await listTraces({
190
+ ...params,
191
+ cursor
192
+ });
193
+ for (const trace of page.items) yield trace;
194
+ if (!page.nextCursor) return;
195
+ cursor = page.nextCursor;
196
+ }
197
+ }
198
+ async function* iterateSessions(params = {}) {
199
+ let cursor = params.cursor;
200
+ for (;;) {
201
+ const page = await listSessions({
202
+ ...params,
203
+ cursor
204
+ });
205
+ for (const session of page.items) yield session;
206
+ if (!page.nextCursor) return;
207
+ cursor = page.nextCursor;
208
+ }
209
+ }
210
+ return {
211
+ listTraces,
212
+ getTraceSpans,
213
+ exportTraceSpansNdjson,
214
+ listRuns,
215
+ getRun,
216
+ getRunTraces,
217
+ listSessions,
218
+ getSessionTraces,
219
+ iterateTraceSpans,
220
+ iterateTraces,
221
+ iterateSessions
222
+ };
223
+ }
224
+ //#endregion
225
+ export { DEFAULT_INTELLIGENCE_BASE_URL, createIntelligenceClient };