@tangle-network/sandbox 0.9.2 → 0.9.3-develop.20260627012805.bf68a85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1026 -1
- package/dist/auth/index.js +273 -1
- package/dist/{client-D3FqPlde.d.ts → client-BBb2p7y5.d.ts} +1 -1
- package/dist/client-CjqJUa22.js +2193 -0
- package/dist/collaboration/index.js +2 -1
- package/dist/collaboration-BxlfZ2Uh.js +201 -1
- package/dist/core.d.ts +2 -2
- package/dist/core.js +4 -1
- package/dist/errors-DZsfJUuc.js +262 -1
- package/dist/{index-Dy1fHLYz.d.ts → index-BY1_6xI7.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1180 -1
- package/dist/intelligence/index.js +225 -1
- package/dist/openai/index.js +1760 -1
- package/dist/{sandbox-B55j2q9K.d.ts → sandbox-BQQ2jhV3.d.ts} +14 -26
- package/dist/sandbox-FcVsLeUJ.js +4500 -0
- package/dist/session-gateway/index.js +667 -1
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +2 -1
- package/dist/tangle-DvdKAK94.js +831 -0
- package/package.json +4 -4
- package/dist/client-BBZ7YLmq.js +0 -1
- package/dist/sandbox-joKtQ5y3.js +0 -1
- package/dist/tangle-DM0o66lW.js +0 -1
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-BxlfZ2Uh.js";
|
|
2
|
+
export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -1 +1,201 @@
|
|
|
1
|
-
const a0_0x4ee562=a0_0x416b;(function(_0x25d56f,_0x32ac9b){const _0x29e9f8=a0_0x416b,_0x45d659=_0x25d56f();while(!![]){try{const _0x49edfe=-parseInt(_0x29e9f8(0x17d))/0x1+-parseInt(_0x29e9f8(0x16e))/0x2+parseInt(_0x29e9f8(0x19f))/0x3*(-parseInt(_0x29e9f8(0x1ac))/0x4)+-parseInt(_0x29e9f8(0x189))/0x5+-parseInt(_0x29e9f8(0x186))/0x6+-parseInt(_0x29e9f8(0x1ad))/0x7+parseInt(_0x29e9f8(0x181))/0x8;if(_0x49edfe===_0x32ac9b)break;else _0x45d659['push'](_0x45d659['shift']());}catch(_0x2ba8d8){_0x45d659['push'](_0x45d659['shift']());}}}(a0_0x2093,0x4e78d));import{f as a0_0x4a16ea,r as a0_0x1107e9,u as a0_0x2e276d}from'\x2e\x2f\x65\x72\x72\x6f\x72\x73\x2d\x44\x5a\x73\x66\x4a\x55\x75\x63\x2e\x6a\x73';const DEFAULT_TIMEOUT_MS=0x7530;function normalizeBaseUrl(_0x6880f1){const _0x1087c7=a0_0x416b;return _0x6880f1[_0x1087c7(0x1a5)](/\/+$/,'');}var CollaborationClient=class{['\x62\x61\x73\x65\x55\x72\x6c'];[a0_0x4ee562(0x1b2)];[a0_0x4ee562(0x1a3)];[a0_0x4ee562(0x17b)];constructor(_0xdff5bf){const _0x2dee5b=a0_0x4ee562;this[_0x2dee5b(0x175)]=normalizeBaseUrl(_0xdff5bf[_0x2dee5b(0x175)]),this[_0x2dee5b(0x1b2)]=_0xdff5bf['\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73']??DEFAULT_TIMEOUT_MS,this[_0x2dee5b(0x1a3)]=_0xdff5bf[_0x2dee5b(0x183)]??globalThis[_0x2dee5b(0x183)][_0x2dee5b(0x18e)](globalThis),this[_0x2dee5b(0x17b)]=_0xdff5bf['\x68\x65\x61\x64\x65\x72\x73'];}async[a0_0x4ee562(0x1b4)](_0x436adb){const _0x226ae5=a0_0x4ee562,_0x339075={'\x49\x79\x53\x41\x43':_0x226ae5(0x176),'\x45\x53\x71\x47\x66':_0x226ae5(0x188)};return this['\x72\x65\x71\x75\x65\x73\x74\x4a\x73\x6f\x6e'](_0x339075['\x49\x79\x53\x41\x43'],{'\x6d\x65\x74\x68\x6f\x64':_0x339075['\x45\x53\x71\x47\x66'],'\x62\x6f\x64\x79':JSON[_0x226ae5(0x18c)](_0x436adb)});}async[a0_0x4ee562(0x1b8)](_0x2fa451){const _0x53ebe2=a0_0x4ee562;return this['\x72\x65\x71\x75\x65\x73\x74\x4a\x73\x6f\x6e']('\x2f\x61\x70\x69\x2f\x63\x6f\x6c\x6c\x61\x62\x6f\x72\x61\x74\x69\x6f\x6e\x2f\x74\x6f\x6b\x65\x6e',{'\x6d\x65\x74\x68\x6f\x64':'\x50\x4f\x53\x54','\x62\x6f\x64\x79':JSON[_0x53ebe2(0x18c)](_0x2fa451)});}async[a0_0x4ee562(0x19b)](_0x17ed53){const _0x97f70c=a0_0x4ee562,_0x3be860={'\x45\x64\x51\x46\x64':_0x97f70c(0x188)};return this[_0x97f70c(0x16a)](_0x97f70c(0x171),{'\x6d\x65\x74\x68\x6f\x64':_0x3be860[_0x97f70c(0x17a)],'\x62\x6f\x64\x79':JSON[_0x97f70c(0x18c)](_0x17ed53)});}async[a0_0x4ee562(0x16a)](_0x489475,_0x2db60a){const _0x3c1617=a0_0x4ee562,_0x1b2ec1={'\x73\x44\x7a\x46\x54':_0x3c1617(0x168),'\x6b\x6b\x4c\x55\x43':function(_0x1a0d32,_0x556b08){return _0x1a0d32 instanceof _0x556b08;},'\x6a\x66\x66\x4b\x47':'\x41\x62\x6f\x72\x74\x45\x72\x72\x6f\x72','\x4e\x54\x53\x46\x45':'\x63\x6f\x64\x65','\x62\x4f\x77\x4f\x52':function(_0x14ce4f,_0x51e2a7){return _0x14ce4f(_0x51e2a7);}},_0x325bef=new AbortController(),_0x27b3cd=setTimeout(()=>_0x325bef[_0x3c1617(0x177)](),this['\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73']);try{const _0x210781=new Headers(await this[_0x3c1617(0x16d)]());if(!_0x210781[_0x3c1617(0x1a4)](_0x1b2ec1['\x73\x44\x7a\x46\x54']))_0x210781[_0x3c1617(0x173)](_0x3c1617(0x168),'\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x2f\x6a\x73\x6f\x6e');const _0x654a4e=await this[_0x3c1617(0x1a3)](''+this[_0x3c1617(0x175)]+_0x489475,{..._0x2db60a,'\x68\x65\x61\x64\x65\x72\x73':_0x210781,'\x73\x69\x67\x6e\x61\x6c':_0x2db60a['\x73\x69\x67\x6e\x61\x6c']??_0x325bef['\x73\x69\x67\x6e\x61\x6c']});if(!_0x654a4e['\x6f\x6b']){const _0x1fb0e9=await _0x654a4e['\x74\x65\x78\x74']();throw a0_0x4a16ea(_0x654a4e[_0x3c1617(0x166)],_0x1fb0e9,{'\x6d\x65\x74\x68\x6f\x64':_0x2db60a['\x6d\x65\x74\x68\x6f\x64'],'\x70\x61\x74\x68':_0x489475},_0x654a4e[_0x3c1617(0x17b)]);}return _0x654a4e['\x6a\x73\x6f\x6e']();}catch(_0xea2e37){if(_0x1b2ec1['\x6b\x6b\x4c\x55\x43'](_0xea2e37,Error)&&_0xea2e37[_0x3c1617(0x1a0)]===_0x1b2ec1['\x6a\x66\x66\x4b\x47'])throw new a0_0x2e276d(this['\x74\x69\x6d\x65\x6f\x75\x74\x4d\x73']);if(_0xea2e37 instanceof Error&&_0x1b2ec1[_0x3c1617(0x1ba)]in _0xea2e37)throw _0xea2e37;throw new a0_0x1107e9('\x46\x61\x69\x6c\x65\x64\x20\x74\x6f\x20\x63\x6f\x6e\x6e\x65\x63\x74\x20\x74\x6f\x20\x63\x6f\x6c\x6c\x61\x62\x6f\x72\x61\x74\x69\x6f\x6e\x20\x41\x50\x49\x3a\x20'+(_0xea2e37 instanceof Error?_0xea2e37['\x6d\x65\x73\x73\x61\x67\x65']:_0x1b2ec1[_0x3c1617(0x1b3)](String,_0xea2e37)),_0xea2e37 instanceof Error?_0xea2e37:void 0x0);}finally{clearTimeout(_0x27b3cd);}}async['\x72\x65\x73\x6f\x6c\x76\x65\x48\x65\x61\x64\x65\x72\x73'](){const _0x312e9f=a0_0x4ee562,_0x1668b8={'\x56\x62\x77\x42\x43':_0x312e9f(0x1af)};if(typeof this[_0x312e9f(0x17b)]===_0x1668b8[_0x312e9f(0x191)])return this[_0x312e9f(0x17b)]();return this[_0x312e9f(0x17b)];}};const DOCUMENT_PREFIX=a0_0x4ee562(0x1ae),FILE_SEGMENT=a0_0x4ee562(0x19e);function assertValidWorkspaceId(_0x154ba1){const _0x235dec=a0_0x4ee562,_0x1a273b={'\x77\x48\x4c\x74\x68':'\x77\x6f\x72\x6b\x73\x70\x61\x63\x65\x49\x64\x20\x6d\x75\x73\x74\x20\x6e\x6f\x74\x20\x63\x6f\x6e\x74\x61\x69\x6e\x20\x70\x61\x74\x68\x20\x73\x65\x70\x61\x72\x61\x74\x6f\x72\x73\x20\x6f\x72\x20\x6e\x75\x6c\x6c\x20\x62\x79\x74\x65\x73'};if(!_0x154ba1)throw new Error(_0x235dec(0x196));if(_0x154ba1[_0x235dec(0x184)]('\x2f')||_0x154ba1[_0x235dec(0x184)]('\x5c')||_0x154ba1[_0x235dec(0x184)]('\x00'))throw new Error(_0x1a273b['\x77\x48\x4c\x74\x68']);}function normalizeCollaborationPath(_0x2af897){const _0x15b749=a0_0x4ee562,_0x4bd326={'\x75\x54\x77\x68\x57':_0x15b749(0x197),'\x4e\x4d\x65\x69\x6b':'\x72\x65\x6c\x61\x74\x69\x76\x65\x50\x61\x74\x68\x20\x6d\x75\x73\x74\x20\x6e\x6f\x74\x20\x63\x6f\x6e\x74\x61\x69\x6e\x20\x6e\x75\x6c\x6c\x20\x62\x79\x74\x65\x73'};if(!_0x2af897)throw new Error(_0x15b749(0x1ab));const _0x2bc7ee=_0x2af897[_0x15b749(0x1a5)](/\\/g,'\x2f')[_0x15b749(0x1b6)]('\x2f')[_0x15b749(0x182)](_0x56560f=>_0x56560f['\x6c\x65\x6e\x67\x74\x68']>0x0&&_0x56560f!=='\x2e');if(_0x2bc7ee[_0x15b749(0x1a2)]===0x0)throw new Error(_0x4bd326[_0x15b749(0x1a1)]);for(const _0x2cd6b4 of _0x2bc7ee){if(_0x2cd6b4==='\x2e\x2e')throw new Error(_0x15b749(0x190));if(_0x2cd6b4[_0x15b749(0x184)]('\x00'))throw new Error(_0x4bd326[_0x15b749(0x199)]);}return _0x2bc7ee[_0x15b749(0x17c)]('\x2f');}function buildCollaborationDocumentId(_0x19bfb0){const _0x26eef4=a0_0x4ee562;assertValidWorkspaceId(_0x19bfb0[_0x26eef4(0x194)]);const _0x5e47f4=normalizeCollaborationPath(_0x19bfb0[_0x26eef4(0x1a8)]);return''+DOCUMENT_PREFIX+_0x19bfb0[_0x26eef4(0x194)]+FILE_SEGMENT+_0x5e47f4;}function a0_0x416b(_0x31c6a5,_0x53a3a7){_0x31c6a5=_0x31c6a5-0x165;const _0x2093b9=a0_0x2093();let _0x416b7b=_0x2093b9[_0x31c6a5];if(a0_0x416b['\x52\x4c\x65\x65\x53\x4d']===undefined){var _0x1551c0=function(_0x25bc53){const _0x56a30d='\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 _0x1c9c03='',_0x4b94fd='';for(let _0x27b17f=0x0,_0x45fdec,_0x23d97d,_0x218a12=0x0;_0x23d97d=_0x25bc53['\x63\x68\x61\x72\x41\x74'](_0x218a12++);~_0x23d97d&&(_0x45fdec=_0x27b17f%0x4?_0x45fdec*0x40+_0x23d97d:_0x23d97d,_0x27b17f++%0x4)?_0x1c9c03+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0x45fdec>>(-0x2*_0x27b17f&0x6)):0x0){_0x23d97d=_0x56a30d['\x69\x6e\x64\x65\x78\x4f\x66'](_0x23d97d);}for(let _0xf16a37=0x0,_0x37e893=_0x1c9c03['\x6c\x65\x6e\x67\x74\x68'];_0xf16a37<_0x37e893;_0xf16a37++){_0x4b94fd+='\x25'+('\x30\x30'+_0x1c9c03['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0xf16a37)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x4b94fd);};a0_0x416b['\x43\x65\x50\x6a\x46\x47']=_0x1551c0,a0_0x416b['\x62\x76\x48\x46\x6e\x67']={},a0_0x416b['\x52\x4c\x65\x65\x53\x4d']=!![];}const _0x5241a9=_0x2093b9[0x0],_0x340a42=_0x31c6a5+_0x5241a9,_0x25a1b2=a0_0x416b['\x62\x76\x48\x46\x6e\x67'][_0x340a42];return!_0x25a1b2?(_0x416b7b=a0_0x416b['\x43\x65\x50\x6a\x46\x47'](_0x416b7b),a0_0x416b['\x62\x76\x48\x46\x6e\x67'][_0x340a42]=_0x416b7b):_0x416b7b=_0x25a1b2,_0x416b7b;}function parseCollaborationDocumentId(_0xdb908a){const _0x164daf=a0_0x4ee562;if(!_0xdb908a[_0x164daf(0x185)](DOCUMENT_PREFIX))return null;const _0x2b6cd0=_0xdb908a[_0x164daf(0x1a6)](FILE_SEGMENT,0xa);if(_0x2b6cd0===-0x1)return null;const _0xdffb9f=_0xdb908a[_0x164daf(0x172)](0xa,_0x2b6cd0),_0x11bed9=_0xdb908a['\x73\x6c\x69\x63\x65'](_0x2b6cd0+0x6);try{return assertValidWorkspaceId(_0xdffb9f),{'\x77\x6f\x72\x6b\x73\x70\x61\x63\x65\x49\x64':_0xdffb9f,'\x72\x65\x6c\x61\x74\x69\x76\x65\x50\x61\x74\x68':normalizeCollaborationPath(_0x11bed9)};}catch{return null;}}const DEFAULT_DEBOUNCE_MS=0x1f4,FILE_ORIGIN=a0_0x4ee562(0x165);var CollaborationFileBridge=class{[a0_0x4ee562(0x17f)];[a0_0x4ee562(0x169)];[a0_0x4ee562(0x1a7)]=null;[a0_0x4ee562(0x18a)]=null;['\x75\x6e\x73\x75\x62\x73\x63\x72\x69\x62\x65\x46\x69\x6c\x65\x45\x76\x65\x6e\x74\x73']=null;[a0_0x4ee562(0x16c)]=null;[a0_0x4ee562(0x1bb)]=![];[a0_0x4ee562(0x1aa)];['\x6c\x61\x73\x74\x57\x72\x69\x74\x74\x65\x6e\x43\x6f\x6e\x74\x65\x6e\x74']=null;constructor(_0x14934b){const _0x2b55c9=a0_0x4ee562;this[_0x2b55c9(0x169)]=_0x14934b,this[_0x2b55c9(0x1aa)]=_0x14934b[_0x2b55c9(0x1a8)],this[_0x2b55c9(0x17f)]=_0x14934b[_0x2b55c9(0x17f)]??DEFAULT_DEBOUNCE_MS;}[a0_0x4ee562(0x18e)](_0x9696fc){const _0x3e18b3=a0_0x4ee562,_0x14d33c={'\x41\x69\x71\x78\x6d':function(_0x17b43b,_0x8058ce){return _0x17b43b===_0x8058ce;}};this[_0x3e18b3(0x1b7)](),this[_0x3e18b3(0x1bb)]=![],this[_0x3e18b3(0x1a7)]=_0x9696fc,this[_0x3e18b3(0x1aa)]=this['\x6f\x70\x74\x69\x6f\x6e\x73']['\x72\x65\x6c\x61\x74\x69\x76\x65\x50\x61\x74\x68'],this[_0x3e18b3(0x18a)]=_0x9696fc[_0x3e18b3(0x178)](_0x28f93b=>{const _0x30ed13=_0x3e18b3;if(_0x28f93b[_0x30ed13(0x1b9)]===FILE_ORIGIN)return;if(this[_0x30ed13(0x19c)]!==null&&_0x14d33c[_0x30ed13(0x187)](_0x28f93b[_0x30ed13(0x18f)],this[_0x30ed13(0x19c)]))return;this[_0x30ed13(0x1b5)](_0x28f93b[_0x30ed13(0x18f)]);}),this[_0x3e18b3(0x19a)]=this['\x6f\x70\x74\x69\x6f\x6e\x73'][_0x3e18b3(0x180)](this[_0x3e18b3(0x1aa)],_0x3bee5d=>{this['\x68\x61\x6e\x64\x6c\x65\x46\x69\x6c\x65\x45\x76\x65\x6e\x74'](_0x3bee5d);});}async['\x66\x6c\x75\x73\x68'](){const _0x3c2eb9=a0_0x4ee562,_0x2e4c46={'\x69\x70\x6c\x53\x72':function(_0x18859d,_0x48dd90){return _0x18859d(_0x48dd90);}};if(!this[_0x3c2eb9(0x1a7)])return;this[_0x3c2eb9(0x16c)]&&(_0x2e4c46['\x69\x70\x6c\x53\x72'](clearTimeout,this[_0x3c2eb9(0x16c)]),this[_0x3c2eb9(0x16c)]=null);const _0x5d8936=this[_0x3c2eb9(0x1a7)][_0x3c2eb9(0x1b0)]();await this[_0x3c2eb9(0x167)](_0x5d8936);}[a0_0x4ee562(0x198)](){return this['\x62\x6f\x75\x6e\x64\x50\x61\x74\x68'];}['\x64\x65\x73\x74\x72\x6f\x79'](){const _0x3f3e26=a0_0x4ee562,_0x99a9e8=_0x3f3e26(0x170)['\x73\x70\x6c\x69\x74']('\x7c');let _0x5dc071=0x0;while(!![]){switch(_0x99a9e8[_0x5dc071++]){case'\x30':this[_0x3f3e26(0x19a)]?.();continue;case'\x31':this[_0x3f3e26(0x16c)]&&(clearTimeout(this['\x70\x65\x6e\x64\x69\x6e\x67\x57\x72\x69\x74\x65\x54\x69\x6d\x65\x72']),this[_0x3f3e26(0x16c)]=null);continue;case'\x32':this[_0x3f3e26(0x18a)]=null;continue;case'\x33':this[_0x3f3e26(0x19a)]=null;continue;case'\x34':this[_0x3f3e26(0x18a)]?.();continue;case'\x35':this[_0x3f3e26(0x1bb)]=!![];continue;case'\x36':this[_0x3f3e26(0x1a7)]=null;continue;}break;}}[a0_0x4ee562(0x1b5)](_0x4b78ea){const _0x13243f=a0_0x4ee562;if(this[_0x13243f(0x16c)])clearTimeout(this[_0x13243f(0x16c)]);this[_0x13243f(0x16c)]=setTimeout(()=>{const _0x103f34=_0x13243f;this[_0x103f34(0x16c)]=null,this[_0x103f34(0x167)](_0x4b78ea);},this['\x64\x65\x62\x6f\x75\x6e\x63\x65\x4d\x73']);}async[a0_0x4ee562(0x167)](_0x2d57b2){const _0x3adc8f=a0_0x4ee562;if(this[_0x3adc8f(0x1bb)])return;this[_0x3adc8f(0x19c)]=_0x2d57b2,await this[_0x3adc8f(0x169)][_0x3adc8f(0x193)](this[_0x3adc8f(0x1aa)],_0x2d57b2);}['\x68\x61\x6e\x64\x6c\x65\x46\x69\x6c\x65\x45\x76\x65\x6e\x74'](_0x397ef9){const _0x5f4519=a0_0x4ee562,_0x2615e2={'\x6b\x48\x6e\x57\x6a':function(_0x52d8d7,_0x4fd0b7){return _0x52d8d7===_0x4fd0b7;},'\x73\x6f\x71\x52\x41':_0x5f4519(0x18d),'\x55\x54\x52\x53\x4c':function(_0x2fbeb2,_0x2db194){return _0x2fbeb2!==_0x2db194;},'\x58\x45\x56\x54\x72':function(_0x154b02,_0x697402){return _0x154b02===_0x697402;}};if(!this[_0x5f4519(0x1a7)]||this['\x64\x65\x73\x74\x72\x6f\x79\x65\x64'])return;if(_0x2615e2[_0x5f4519(0x195)](_0x397ef9['\x74\x79\x70\x65'],_0x2615e2[_0x5f4519(0x16f)])&&_0x397ef9[_0x5f4519(0x16b)]){this['\x62\x6f\x75\x6e\x64\x50\x61\x74\x68']=_0x397ef9['\x6e\x65\x78\x74\x50\x61\x74\x68'],this[_0x5f4519(0x169)][_0x5f4519(0x192)]?.(_0x397ef9);return;}if(_0x397ef9[_0x5f4519(0x1b1)]==='\x64\x65\x6c\x65\x74\x65\x64'){this[_0x5f4519(0x169)][_0x5f4519(0x18b)]?.(_0x397ef9);return;}if(_0x397ef9[_0x5f4519(0x1b1)]!==_0x5f4519(0x1a9)||_0x2615e2[_0x5f4519(0x17e)](typeof _0x397ef9['\x63\x6f\x6e\x74\x65\x6e\x74'],_0x5f4519(0x179)))return;if(_0x2615e2[_0x5f4519(0x174)](_0x397ef9['\x63\x6f\x6e\x74\x65\x6e\x74'],this['\x61\x64\x61\x70\x74\x65\x72'][_0x5f4519(0x1b0)]()))return;if(this['\x6c\x61\x73\x74\x57\x72\x69\x74\x74\x65\x6e\x43\x6f\x6e\x74\x65\x6e\x74']!==null&&_0x397ef9[_0x5f4519(0x18f)]===this[_0x5f4519(0x19c)])return;this['\x61\x64\x61\x70\x74\x65\x72'][_0x5f4519(0x19d)](_0x397ef9['\x63\x6f\x6e\x74\x65\x6e\x74'],{'\x6f\x72\x69\x67\x69\x6e':FILE_ORIGIN,'\x76\x65\x72\x73\x69\x6f\x6e':_0x397ef9['\x76\x65\x72\x73\x69\x6f\x6e']});}};function a0_0x2093(){const _0x476858=['\x7a\x4d\x76\x30\x79\x32\x48\x6a\x42\x78\x62\x53','\x41\x67\x66\x5a','\x43\x4d\x76\x57\x42\x67\x66\x4a\x7a\x71','\x41\x77\x35\x4b\x7a\x78\x48\x70\x7a\x47','\x79\x77\x72\x48\x43\x68\x72\x4c\x43\x47','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f','\x44\x78\x62\x4b\x79\x78\x72\x4c\x7a\x61','\x79\x4d\x39\x31\x42\x4d\x72\x71\x79\x78\x72\x4f','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f\x69\x67\x4c\x5a\x69\x68\x6a\x4c\x43\x78\x76\x50\x43\x4d\x76\x4b','\x6d\x4a\x65\x33\x6f\x74\x65\x34\x6e\x68\x6a\x62\x72\x67\x35\x48\x43\x61','\x6d\x74\x79\x35\x6e\x5a\x43\x57\x6d\x30\x4c\x41\x76\x31\x6e\x72\x42\x47','\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x6f\x47','\x7a\x4e\x76\x55\x79\x33\x72\x50\x42\x32\x34','\x7a\x32\x76\x30\x71\x32\x39\x55\x44\x67\x76\x55\x44\x61','\x44\x68\x4c\x57\x7a\x71','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x31\x5a','\x79\x4b\x39\x33\x74\x31\x69','\x79\x4d\x39\x56\x44\x68\x6e\x30\x43\x4d\x66\x57','\x43\x32\x6e\x4f\x7a\x77\x72\x31\x42\x67\x76\x78\x43\x4d\x4c\x30\x7a\x71','\x43\x33\x62\x53\x41\x78\x71','\x7a\x67\x76\x5a\x44\x68\x6a\x56\x45\x71','\x43\x4d\x76\x4d\x43\x4d\x76\x5a\x41\x66\x72\x56\x41\x32\x76\x55','\x42\x33\x6a\x50\x7a\x32\x4c\x55','\x74\x4c\x72\x74\x72\x4b\x75','\x7a\x67\x76\x5a\x44\x68\x6a\x56\x45\x77\x76\x4b','\x79\x4e\x6a\x50\x7a\x67\x44\x4c\x6f\x4d\x7a\x50\x42\x67\x75','\x43\x33\x72\x48\x44\x68\x76\x5a','\x44\x33\x6a\x50\x44\x67\x75','\x71\x32\x39\x55\x44\x67\x76\x55\x44\x63\x31\x75\x45\x78\x62\x4c','\x42\x33\x62\x30\x41\x77\x39\x55\x43\x57','\x43\x4d\x76\x58\x44\x77\x76\x5a\x44\x65\x50\x5a\x42\x32\x34','\x42\x4d\x76\x34\x44\x66\x62\x48\x44\x67\x47','\x43\x67\x76\x55\x7a\x67\x4c\x55\x7a\x31\x44\x59\x41\x78\x72\x4c\x76\x67\x4c\x54\x7a\x78\x69','\x43\x4d\x76\x5a\x42\x32\x58\x32\x7a\x75\x48\x4c\x79\x77\x72\x4c\x43\x4e\x6d','\x6d\x74\x69\x58\x6d\x64\x6d\x5a\x6e\x4e\x6e\x78\x71\x76\x48\x41\x74\x61','\x43\x32\x39\x58\x75\x4b\x65','\x6e\x78\x57\x58\x46\x64\x72\x38\x6d\x4e\x57\x57\x46\x64\x6e\x38\x6e\x47','\x6c\x32\x66\x57\x41\x73\x39\x4a\x42\x32\x58\x53\x79\x77\x6a\x56\x43\x4d\x66\x30\x41\x77\x39\x55\x6c\x33\x6e\x55\x79\x78\x62\x5a\x41\x67\x39\x30','\x43\x32\x58\x50\x79\x32\x75','\x43\x32\x76\x30','\x77\x65\x76\x77\x76\x68\x69','\x79\x4d\x66\x5a\x7a\x76\x76\x59\x42\x61','\x6c\x32\x66\x57\x41\x73\x39\x4a\x42\x32\x58\x53\x79\x77\x6a\x56\x43\x4d\x66\x30\x41\x77\x39\x55\x6c\x32\x6a\x56\x42\x33\x72\x5a\x44\x68\x6a\x48\x43\x61','\x79\x77\x6a\x56\x43\x4e\x71','\x43\x33\x76\x49\x43\x32\x6e\x59\x41\x77\x6a\x4c','\x43\x33\x72\x59\x41\x77\x35\x4e','\x72\x77\x72\x72\x72\x4d\x71','\x41\x67\x76\x48\x7a\x67\x76\x59\x43\x57','\x41\x4d\x39\x50\x42\x47','\x6e\x64\x65\x59\x6d\x74\x6a\x79\x45\x67\x48\x79\x72\x31\x6d','\x76\x76\x72\x73\x75\x30\x57','\x7a\x67\x76\x49\x42\x33\x76\x55\x79\x32\x76\x6e\x43\x57','\x43\x33\x76\x49\x43\x32\x6e\x59\x41\x77\x6a\x4c\x76\x67\x39\x67\x41\x77\x58\x4c\x72\x78\x7a\x4c\x42\x4e\x72\x5a','\x6d\x74\x4b\x58\x6d\x5a\x61\x32\x6e\x74\x7a\x50\x79\x30\x50\x35\x79\x33\x79','\x7a\x4d\x4c\x53\x44\x67\x76\x59','\x7a\x4d\x76\x30\x79\x32\x47','\x41\x77\x35\x4a\x42\x68\x76\x4b\x7a\x78\x6d','\x43\x33\x72\x48\x43\x4e\x72\x5a\x76\x32\x4c\x30\x41\x61','\x6d\x5a\x6d\x5a\x6e\x5a\x4b\x31\x6d\x68\x7a\x67\x45\x75\x50\x54\x74\x61','\x71\x77\x4c\x58\x45\x67\x30','\x75\x65\x39\x74\x76\x61','\x6d\x5a\x4b\x35\x6e\x64\x61\x31\x77\x66\x6a\x6b\x79\x77\x35\x70','\x44\x77\x35\x5a\x44\x77\x6a\x5a\x79\x33\x6a\x50\x79\x4d\x76\x65\x42\x32\x6e\x31\x42\x77\x76\x55\x44\x61','\x42\x32\x35\x67\x41\x77\x58\x4c\x72\x67\x76\x53\x7a\x78\x72\x4c\x7a\x61','\x43\x33\x72\x59\x41\x77\x35\x4e\x41\x77\x7a\x35','\x43\x4d\x76\x55\x79\x77\x31\x4c\x7a\x61','\x79\x4d\x4c\x55\x7a\x61','\x79\x32\x39\x55\x44\x67\x76\x55\x44\x61','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f\x69\x67\x31\x31\x43\x33\x71\x47\x42\x4d\x39\x30\x69\x67\x6e\x56\x42\x4e\x72\x48\x41\x77\x34\x47\x69\x49\x34\x55\x69\x47','\x76\x4d\x6a\x33\x71\x4b\x6d','\x42\x32\x35\x67\x41\x77\x58\x4c\x75\x4d\x76\x55\x79\x77\x31\x4c\x7a\x61','\x44\x33\x6a\x50\x44\x67\x76\x67\x41\x77\x58\x4c','\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x73\x77\x71','\x41\x30\x48\x55\x76\x32\x4f','\x44\x32\x39\x59\x41\x33\x6e\x57\x79\x77\x6e\x4c\x73\x77\x71\x47\x41\x78\x6d\x47\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x77\x71','\x43\x4d\x76\x53\x79\x78\x72\x50\x44\x4d\x76\x71\x79\x78\x72\x4f\x69\x67\x31\x31\x43\x33\x71\x47\x42\x4d\x39\x30\x69\x67\x6a\x4c\x69\x67\x76\x54\x43\x68\x72\x35','\x7a\x32\x76\x30\x75\x67\x66\x30\x41\x61','\x74\x4b\x31\x4c\x41\x77\x53','\x44\x77\x35\x5a\x44\x77\x6a\x5a\x79\x33\x6a\x50\x79\x4d\x76\x67\x41\x77\x58\x4c\x72\x78\x7a\x4c\x42\x4e\x72\x5a','\x43\x32\x66\x32\x7a\x76\x6e\x55\x79\x78\x62\x5a\x41\x67\x39\x30','\x42\x67\x66\x5a\x44\x66\x44\x59\x41\x78\x72\x30\x7a\x77\x35\x64\x42\x32\x35\x30\x7a\x77\x35\x30','\x43\x4d\x76\x57\x42\x67\x66\x4a\x7a\x75\x6e\x56\x42\x4e\x72\x4c\x42\x4e\x71','\x6f\x4d\x7a\x50\x42\x67\x75\x36','\x6d\x31\x48\x63\x76\x77\x39\x55\x77\x71','\x42\x4d\x66\x54\x7a\x71','\x44\x76\x72\x33\x41\x66\x43','\x42\x67\x76\x55\x7a\x33\x72\x4f'];a0_0x2093=function(){return _0x476858;};return a0_0x2093();}export{CollaborationClient as a,parseCollaborationDocumentId as i,buildCollaborationDocumentId as n,normalizeCollaborationPath as r,CollaborationFileBridge as t};
|
|
1
|
+
import { f as parseErrorResponse, r as NetworkError, u as TimeoutError } from "./errors-DZsfJUuc.js";
|
|
2
|
+
//#region src/collaboration/client.ts
|
|
3
|
+
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
4
|
+
function normalizeBaseUrl(url) {
|
|
5
|
+
return url.replace(/\/+$/, "");
|
|
6
|
+
}
|
|
7
|
+
var CollaborationClient = class {
|
|
8
|
+
baseUrl;
|
|
9
|
+
timeoutMs;
|
|
10
|
+
fetchImpl;
|
|
11
|
+
headers;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.baseUrl = normalizeBaseUrl(config.baseUrl);
|
|
14
|
+
this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
15
|
+
this.fetchImpl = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
16
|
+
this.headers = config.headers;
|
|
17
|
+
}
|
|
18
|
+
async bootstrap(request) {
|
|
19
|
+
return this.requestJson("/api/collaboration/bootstrap", {
|
|
20
|
+
method: "POST",
|
|
21
|
+
body: JSON.stringify(request)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async refreshToken(request) {
|
|
25
|
+
return this.requestJson("/api/collaboration/token", {
|
|
26
|
+
method: "POST",
|
|
27
|
+
body: JSON.stringify(request)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async saveSnapshot(request) {
|
|
31
|
+
return this.requestJson("/api/collaboration/snapshot", {
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: JSON.stringify(request)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async requestJson(path, init) {
|
|
37
|
+
const controller = new AbortController();
|
|
38
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
39
|
+
try {
|
|
40
|
+
const headers = new Headers(await this.resolveHeaders());
|
|
41
|
+
if (!headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
42
|
+
const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
43
|
+
...init,
|
|
44
|
+
headers,
|
|
45
|
+
signal: init.signal ?? controller.signal
|
|
46
|
+
});
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const body = await response.text();
|
|
49
|
+
throw parseErrorResponse(response.status, body, {
|
|
50
|
+
method: init.method,
|
|
51
|
+
path
|
|
52
|
+
}, response.headers);
|
|
53
|
+
}
|
|
54
|
+
return response.json();
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error instanceof Error && error.name === "AbortError") throw new TimeoutError(this.timeoutMs);
|
|
57
|
+
if (error instanceof Error && "code" in error) throw error;
|
|
58
|
+
throw new NetworkError(`Failed to connect to collaboration API: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : void 0);
|
|
59
|
+
} finally {
|
|
60
|
+
clearTimeout(timeoutId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async resolveHeaders() {
|
|
64
|
+
if (typeof this.headers === "function") return this.headers();
|
|
65
|
+
return this.headers;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/collaboration/document-id.ts
|
|
70
|
+
const DOCUMENT_PREFIX = "workspace:";
|
|
71
|
+
const FILE_SEGMENT = ":file:";
|
|
72
|
+
function assertValidWorkspaceId(workspaceId) {
|
|
73
|
+
if (!workspaceId) throw new Error("workspaceId is required");
|
|
74
|
+
if (workspaceId.includes("/") || workspaceId.includes("\\") || workspaceId.includes("\0")) throw new Error("workspaceId must not contain path separators or null bytes");
|
|
75
|
+
}
|
|
76
|
+
function normalizeCollaborationPath(path) {
|
|
77
|
+
if (!path) throw new Error("relativePath is required");
|
|
78
|
+
const normalized = path.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0 && segment !== ".");
|
|
79
|
+
if (normalized.length === 0) throw new Error("relativePath must not be empty");
|
|
80
|
+
for (const segment of normalized) {
|
|
81
|
+
if (segment === "..") throw new Error("relativePath must not contain \"..\"");
|
|
82
|
+
if (segment.includes("\0")) throw new Error("relativePath must not contain null bytes");
|
|
83
|
+
}
|
|
84
|
+
return normalized.join("/");
|
|
85
|
+
}
|
|
86
|
+
function buildCollaborationDocumentId(ref) {
|
|
87
|
+
assertValidWorkspaceId(ref.workspaceId);
|
|
88
|
+
const relativePath = normalizeCollaborationPath(ref.relativePath);
|
|
89
|
+
return `${DOCUMENT_PREFIX}${ref.workspaceId}${FILE_SEGMENT}${relativePath}`;
|
|
90
|
+
}
|
|
91
|
+
function parseCollaborationDocumentId(documentId) {
|
|
92
|
+
if (!documentId.startsWith(DOCUMENT_PREFIX)) return null;
|
|
93
|
+
const separatorIndex = documentId.indexOf(FILE_SEGMENT, 10);
|
|
94
|
+
if (separatorIndex === -1) return null;
|
|
95
|
+
const workspaceId = documentId.slice(10, separatorIndex);
|
|
96
|
+
const relativePath = documentId.slice(separatorIndex + 6);
|
|
97
|
+
try {
|
|
98
|
+
assertValidWorkspaceId(workspaceId);
|
|
99
|
+
return {
|
|
100
|
+
workspaceId,
|
|
101
|
+
relativePath: normalizeCollaborationPath(relativePath)
|
|
102
|
+
};
|
|
103
|
+
} catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/collaboration/file-bridge.ts
|
|
109
|
+
const DEFAULT_DEBOUNCE_MS = 500;
|
|
110
|
+
const FILE_ORIGIN = "bridge:file";
|
|
111
|
+
/**
|
|
112
|
+
* Headless bridge between a collaborative document adapter and the sandbox
|
|
113
|
+
* filesystem. Keeps this package free of direct Yjs assumptions.
|
|
114
|
+
*/
|
|
115
|
+
var CollaborationFileBridge = class {
|
|
116
|
+
debounceMs;
|
|
117
|
+
options;
|
|
118
|
+
adapter = null;
|
|
119
|
+
unsubscribeDocument = null;
|
|
120
|
+
unsubscribeFileEvents = null;
|
|
121
|
+
pendingWriteTimer = null;
|
|
122
|
+
destroyed = false;
|
|
123
|
+
boundPath;
|
|
124
|
+
lastWrittenContent = null;
|
|
125
|
+
constructor(options) {
|
|
126
|
+
this.options = options;
|
|
127
|
+
this.boundPath = options.relativePath;
|
|
128
|
+
this.debounceMs = options.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
129
|
+
}
|
|
130
|
+
bind(adapter) {
|
|
131
|
+
this.destroy();
|
|
132
|
+
this.destroyed = false;
|
|
133
|
+
this.adapter = adapter;
|
|
134
|
+
this.boundPath = this.options.relativePath;
|
|
135
|
+
this.unsubscribeDocument = adapter.subscribe((change) => {
|
|
136
|
+
if (change.origin === FILE_ORIGIN) return;
|
|
137
|
+
if (this.lastWrittenContent !== null && change.content === this.lastWrittenContent) return;
|
|
138
|
+
this.scheduleWrite(change.content);
|
|
139
|
+
});
|
|
140
|
+
this.unsubscribeFileEvents = this.options.subscribeToFileEvents(this.boundPath, (event) => {
|
|
141
|
+
this.handleFileEvent(event);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async flush() {
|
|
145
|
+
if (!this.adapter) return;
|
|
146
|
+
if (this.pendingWriteTimer) {
|
|
147
|
+
clearTimeout(this.pendingWriteTimer);
|
|
148
|
+
this.pendingWriteTimer = null;
|
|
149
|
+
}
|
|
150
|
+
const content = this.adapter.getContent();
|
|
151
|
+
await this.write(content);
|
|
152
|
+
}
|
|
153
|
+
getPath() {
|
|
154
|
+
return this.boundPath;
|
|
155
|
+
}
|
|
156
|
+
destroy() {
|
|
157
|
+
this.destroyed = true;
|
|
158
|
+
if (this.pendingWriteTimer) {
|
|
159
|
+
clearTimeout(this.pendingWriteTimer);
|
|
160
|
+
this.pendingWriteTimer = null;
|
|
161
|
+
}
|
|
162
|
+
this.unsubscribeDocument?.();
|
|
163
|
+
this.unsubscribeDocument = null;
|
|
164
|
+
this.unsubscribeFileEvents?.();
|
|
165
|
+
this.unsubscribeFileEvents = null;
|
|
166
|
+
this.adapter = null;
|
|
167
|
+
}
|
|
168
|
+
scheduleWrite(content) {
|
|
169
|
+
if (this.pendingWriteTimer) clearTimeout(this.pendingWriteTimer);
|
|
170
|
+
this.pendingWriteTimer = setTimeout(() => {
|
|
171
|
+
this.pendingWriteTimer = null;
|
|
172
|
+
this.write(content);
|
|
173
|
+
}, this.debounceMs);
|
|
174
|
+
}
|
|
175
|
+
async write(content) {
|
|
176
|
+
if (this.destroyed) return;
|
|
177
|
+
this.lastWrittenContent = content;
|
|
178
|
+
await this.options.writeFile(this.boundPath, content);
|
|
179
|
+
}
|
|
180
|
+
handleFileEvent(event) {
|
|
181
|
+
if (!this.adapter || this.destroyed) return;
|
|
182
|
+
if (event.type === "renamed" && event.nextPath) {
|
|
183
|
+
this.boundPath = event.nextPath;
|
|
184
|
+
this.options.onFileRenamed?.(event);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (event.type === "deleted") {
|
|
188
|
+
this.options.onFileDeleted?.(event);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (event.type !== "updated" || typeof event.content !== "string") return;
|
|
192
|
+
if (event.content === this.adapter.getContent()) return;
|
|
193
|
+
if (this.lastWrittenContent !== null && event.content === this.lastWrittenContent) return;
|
|
194
|
+
this.adapter.replaceContent(event.content, {
|
|
195
|
+
origin: FILE_ORIGIN,
|
|
196
|
+
version: event.version
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
//#endregion
|
|
201
|
+
export { CollaborationClient as a, parseCollaborationDocumentId as i, buildCollaborationDocumentId as n, normalizeCollaborationPath as r, CollaborationFileBridge as t };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as SandboxClient } from "./client-
|
|
1
|
+
import { $t as NetworkConfig, _t as ExecResult, an as PreviewLinkManager, cr as SandboxInfo, gt as ExecOptions, in as PreviewLinkInfo, jn as SandboxClientConfig, n as SandboxInstance, nt as CreateSandboxOptions, pr as SandboxStatus } from "./sandbox-BQQ2jhV3.js";
|
|
2
|
+
import { i as SandboxClient } from "./client-BBb2p7y5.js";
|
|
3
3
|
import { a as PartialFailureError, c as SandboxErrorJson, d as StateError, f as TimeoutError, i as NotFoundError, l as SandboxFailureDetail, n as CapabilityError, o as QuotaError, p as ValidationError, r as NetworkError, s as SandboxError, t as AuthError, u as ServerError } from "./errors-1Se5ATyZ.js";
|
|
4
4
|
export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, QuotaError, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError };
|
package/dist/core.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as SandboxInstance } from "./sandbox-FcVsLeUJ.js";
|
|
2
|
+
import { a as PartialFailureError, c as ServerError, d as ValidationError, i as NotFoundError, l as StateError, n as CapabilityError, o as QuotaError, r as NetworkError, s as SandboxError, t as AuthError, u as TimeoutError } from "./errors-DZsfJUuc.js";
|
|
3
|
+
import { n as SandboxClient } from "./client-CjqJUa22.js";
|
|
4
|
+
export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError };
|
package/dist/errors-DZsfJUuc.js
CHANGED
|
@@ -1 +1,262 @@
|
|
|
1
|
-
function a0_0x1c39(_0x1d5ce2,_0x18246a){_0x1d5ce2=_0x1d5ce2-0xdf;const _0x1e0d7a=a0_0x1e0d();let _0x1c3990=_0x1e0d7a[_0x1d5ce2];if(a0_0x1c39['\x48\x6a\x57\x51\x4d\x4a']===undefined){var _0x4453a3=function(_0x5d54c8){const _0x4aabd8='\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 _0x264e7c='',_0x7b08b2='';for(let _0x1645c2=0x0,_0xa94383,_0x3e5ef5,_0x2afdd9=0x0;_0x3e5ef5=_0x5d54c8['\x63\x68\x61\x72\x41\x74'](_0x2afdd9++);~_0x3e5ef5&&(_0xa94383=_0x1645c2%0x4?_0xa94383*0x40+_0x3e5ef5:_0x3e5ef5,_0x1645c2++%0x4)?_0x264e7c+=String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](0xff&_0xa94383>>(-0x2*_0x1645c2&0x6)):0x0){_0x3e5ef5=_0x4aabd8['\x69\x6e\x64\x65\x78\x4f\x66'](_0x3e5ef5);}for(let _0x39222c=0x0,_0x3f8548=_0x264e7c['\x6c\x65\x6e\x67\x74\x68'];_0x39222c<_0x3f8548;_0x39222c++){_0x7b08b2+='\x25'+('\x30\x30'+_0x264e7c['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'](_0x39222c)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x10))['\x73\x6c\x69\x63\x65'](-0x2);}return decodeURIComponent(_0x7b08b2);};a0_0x1c39['\x77\x57\x55\x77\x7a\x79']=_0x4453a3,a0_0x1c39['\x57\x54\x59\x49\x62\x48']={},a0_0x1c39['\x48\x6a\x57\x51\x4d\x4a']=!![];}const _0x41557c=_0x1e0d7a[0x0],_0x429e85=_0x1d5ce2+_0x41557c,_0x5b3e11=a0_0x1c39['\x57\x54\x59\x49\x62\x48'][_0x429e85];return!_0x5b3e11?(_0x1c3990=a0_0x1c39['\x77\x57\x55\x77\x7a\x79'](_0x1c3990),a0_0x1c39['\x57\x54\x59\x49\x62\x48'][_0x429e85]=_0x1c3990):_0x1c3990=_0x5b3e11,_0x1c3990;}const a0_0xe5a6e2=a0_0x1c39;(function(_0xda4ed9,_0x454e42){const _0x413e85=a0_0x1c39,_0x49ebdf=_0xda4ed9();while(!![]){try{const _0x10da7d=-parseInt(_0x413e85(0x105))/0x1+-parseInt(_0x413e85(0x139))/0x2+parseInt(_0x413e85(0xee))/0x3*(-parseInt(_0x413e85(0xe4))/0x4)+parseInt(_0x413e85(0x11b))/0x5+-parseInt(_0x413e85(0x13c))/0x6*(parseInt(_0x413e85(0x106))/0x7)+-parseInt(_0x413e85(0x128))/0x8*(-parseInt(_0x413e85(0x12a))/0x9)+-parseInt(_0x413e85(0xf4))/0xa*(-parseInt(_0x413e85(0xf5))/0xb);if(_0x10da7d===_0x454e42)break;else _0x49ebdf['push'](_0x49ebdf['shift']());}catch(_0xfef54c){_0x49ebdf['push'](_0x49ebdf['shift']());}}}(a0_0x1e0d,0xc6d74));var SandboxError=class extends Error{[a0_0xe5a6e2(0x14b)];[a0_0xe5a6e2(0x145)];[a0_0xe5a6e2(0x149)];[a0_0xe5a6e2(0x140)];[a0_0xe5a6e2(0x10c)];[a0_0xe5a6e2(0x13b)];[a0_0xe5a6e2(0x159)];constructor(_0x124145,_0x6f75b8,_0x1a46ea,_0x32bec3){const _0x2f7da2=a0_0xe5a6e2,_0x1bc2a0={'\x6b\x4c\x50\x65\x45':_0x2f7da2(0x13a)};super(_0x124145),this[_0x2f7da2(0x143)]=_0x1bc2a0['\x6b\x4c\x50\x65\x45'],this['\x63\x6f\x64\x65']=_0x6f75b8,this[_0x2f7da2(0x14b)]=_0x1a46ea,this[_0x2f7da2(0x149)]=_0x32bec3?.['\x6f\x72\x69\x67\x69\x6e'],this[_0x2f7da2(0x140)]=_0x32bec3?.[_0x2f7da2(0x140)],this[_0x2f7da2(0x10c)]=_0x32bec3?.[_0x2f7da2(0x10c)],this[_0x2f7da2(0x13b)]=_0x32bec3?.[_0x2f7da2(0x13b)],this[_0x2f7da2(0x159)]=_0x32bec3?.[_0x2f7da2(0x159)];}},AuthError=class extends SandboxError{constructor(_0x58670a='\x41\x75\x74\x68\x65\x6e\x74\x69\x63\x61\x74\x69\x6f\x6e\x20\x66\x61\x69\x6c\x65\x64',_0x11e5cb){const _0xa53d94=a0_0xe5a6e2;super(_0x58670a,'\x41\x55\x54\x48\x5f\x45\x52\x52\x4f\x52',0x191,_0x11e5cb),this[_0xa53d94(0x143)]=_0xa53d94(0x12b);}},NotFoundError=class extends SandboxError{['\x72\x65\x73\x6f\x75\x72\x63\x65\x54\x79\x70\x65'];['\x72\x65\x73\x6f\x75\x72\x63\x65\x49\x64'];constructor(_0x19a635,_0x34a817,_0x31469a){const _0x3f2fe5=a0_0xe5a6e2,_0x12dab6={'\x4f\x55\x74\x43\x49':_0x3f2fe5(0x13f)};super(_0x19a635+_0x3f2fe5(0xea)+_0x34a817,_0x12dab6[_0x3f2fe5(0xeb)],0x194,_0x31469a),this[_0x3f2fe5(0x143)]=_0x3f2fe5(0xf7),this[_0x3f2fe5(0xfc)]=_0x19a635,this[_0x3f2fe5(0x131)]=_0x34a817;}},QuotaError=class extends SandboxError{[a0_0xe5a6e2(0xf2)];[a0_0xe5a6e2(0x132)];[a0_0xe5a6e2(0xe2)];[a0_0xe5a6e2(0x10c)];constructor(_0x216beb,_0x2722d0,_0x4dc701,_0x3b77a7,_0x48904a,_0x87211a=0x1ad){const _0x364b45=a0_0xe5a6e2;super(_0x2722d0??_0x364b45(0x158)+_0x216beb,_0x364b45(0x152),_0x87211a,_0x48904a),this[_0x364b45(0x143)]='\x51\x75\x6f\x74\x61\x45\x72\x72\x6f\x72',this[_0x364b45(0xf2)]=_0x216beb,this[_0x364b45(0x132)]=_0x4dc701,this[_0x364b45(0xe2)]=_0x3b77a7,this[_0x364b45(0x10c)]=_0x48904a?.[_0x364b45(0x10c)];}},CapabilityError=class extends SandboxError{[a0_0xe5a6e2(0x157)];constructor(_0x11e713,_0x4a8c52=a0_0xe5a6e2(0x101),_0x1b363a=0x190,_0x55a74f,_0x4aa471){const _0x1c7761=a0_0xe5a6e2;super(_0x11e713,_0x4a8c52,_0x1b363a,_0x55a74f),this[_0x1c7761(0x143)]=_0x1c7761(0xe8),this[_0x1c7761(0x157)]=_0x4aa471;}},PartialFailureError=class extends SandboxError{['\x66\x61\x69\x6c\x75\x72\x65\x73'];constructor(_0x28c639,_0x5898d2=a0_0xe5a6e2(0x12d),_0x5c8dd4=0x1f6,_0x4b0315,_0x18a556){const _0x23870f=a0_0xe5a6e2;super(_0x28c639,_0x5898d2,_0x5c8dd4,_0x4b0315),this['\x6e\x61\x6d\x65']=_0x23870f(0xe0),this['\x66\x61\x69\x6c\x75\x72\x65\x73']=_0x18a556;}},ValidationError=class extends SandboxError{[a0_0xe5a6e2(0x147)];constructor(_0x1600dd,_0x48b661,_0x3c1952){const _0x4fee80=a0_0xe5a6e2,_0x24b160={'\x4f\x61\x4d\x4d\x46':_0x4fee80(0x146)};super(_0x1600dd,_0x24b160[_0x4fee80(0x126)],0x190,_0x3c1952),this[_0x4fee80(0x143)]=_0x4fee80(0x141),this[_0x4fee80(0x147)]=_0x48b661;}},StateError=class extends SandboxError{[a0_0xe5a6e2(0x110)];['\x72\x65\x71\x75\x69\x72\x65\x64\x53\x74\x61\x74\x65'];constructor(_0x5c0b66,_0xcf353,_0x568370,_0x5eddcf){const _0x140257=a0_0xe5a6e2;super(_0x5c0b66,_0x140257(0x136),0x199,_0x5eddcf),this[_0x140257(0x143)]=_0x140257(0xf8),this['\x63\x75\x72\x72\x65\x6e\x74\x53\x74\x61\x74\x65']=_0xcf353,this[_0x140257(0x11f)]=_0x568370;}},TimeoutError=class extends SandboxError{[a0_0xe5a6e2(0xe3)];constructor(_0x11fb80,_0x2b2752,_0x246ec1){const _0x5977ed=a0_0xe5a6e2,_0x4d6eb2={'\x6a\x71\x61\x51\x6e':_0x5977ed(0x14d)};super(_0x2b2752??_0x5977ed(0xfb)+_0x11fb80+'\x6d\x73','\x54\x49\x4d\x45\x4f\x55\x54',0x198,_0x246ec1),this[_0x5977ed(0x143)]=_0x4d6eb2[_0x5977ed(0x115)],this[_0x5977ed(0xe3)]=_0x11fb80;}},NetworkError=class extends SandboxError{[a0_0xe5a6e2(0x102)];constructor(_0x1254fd,_0x80ccbd,_0x2870f7){const _0x58b5fa=a0_0xe5a6e2,_0x1c87c7={'\x63\x64\x65\x59\x50':function(_0x37c7d0,_0x5eafde){return _0x37c7d0 instanceof _0x5eafde;},'\x56\x72\x4e\x59\x65':function(_0x2e25af,_0x22ef5e){return _0x2e25af??_0x22ef5e;}},_0x4064a4=_0x1c87c7[_0x58b5fa(0x138)](_0x80ccbd,Error)?_0x80ccbd:void 0x0,_0x403653=_0x1c87c7[_0x58b5fa(0x138)](_0x80ccbd,Error)?_0x2870f7:_0x1c87c7[_0x58b5fa(0xe7)](_0x80ccbd,_0x2870f7);super(_0x1254fd,'\x4e\x45\x54\x57\x4f\x52\x4b\x5f\x45\x52\x52\x4f\x52',void 0x0,_0x403653),this[_0x58b5fa(0x143)]=_0x58b5fa(0x123),this[_0x58b5fa(0x102)]=_0x4064a4;}},ServerError=class extends SandboxError{constructor(_0x9b49f9,_0x4c4b03=0x1f4,_0x391db3){const _0x18da17=a0_0xe5a6e2,_0x1aea56={'\x57\x70\x48\x4d\x59':_0x18da17(0xfe)};super(_0x9b49f9,_0x1aea56['\x57\x70\x48\x4d\x59'],_0x4c4b03,_0x391db3),this['\x6e\x61\x6d\x65']=_0x18da17(0x108);}};function parseRetryAfterMs(_0x1bd1e2,_0x3cac86){const _0x5180c3=a0_0xe5a6e2,_0x8b9c8e={'\x44\x6c\x51\x6e\x51':_0x5180c3(0x10f)};if(typeof _0x3cac86[_0x5180c3(0x10c)]===_0x8b9c8e['\x44\x6c\x51\x6e\x51']&&Number[_0x5180c3(0x116)](_0x3cac86[_0x5180c3(0x10c)]))return Math['\x6d\x61\x78'](0x0,_0x3cac86[_0x5180c3(0x10c)]);if(!_0x1bd1e2)return void 0x0;const _0x48f80f=_0x1bd1e2[_0x5180c3(0x12c)]();if(!_0x48f80f)return void 0x0;const _0xeb0d17=Number(_0x48f80f);if(Number['\x69\x73\x46\x69\x6e\x69\x74\x65'](_0xeb0d17))return Math[_0x5180c3(0x148)](0x0,_0xeb0d17)*0x3e8;const _0x3dcf3f=Date['\x70\x61\x72\x73\x65'](_0x48f80f);if(!Number[_0x5180c3(0x114)](_0x3dcf3f))return Math[_0x5180c3(0x148)](0x0,_0x3dcf3f-Date['\x6e\x6f\x77']());}function a0_0x1e0d(){const _0x4c59a1=['\x42\x67\x4c\x54\x41\x78\x71','\x44\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x31\x5a','\x6e\x64\x71\x32\x6e\x4a\x65\x32\x6f\x66\x6a\x6d\x7a\x32\x44\x34\x79\x71','\x45\x63\x31\x5a\x41\x77\x72\x4c\x79\x32\x66\x59\x6c\x77\x4c\x54\x79\x77\x44\x4c','\x78\x31\x66\x76\x74\x31\x72\x62\x78\x30\x76\x79\x71\x30\x76\x66\x72\x65\x76\x65','\x76\x4e\x6a\x6f\x77\x77\x75','\x71\x32\x66\x57\x79\x77\x6a\x50\x42\x67\x4c\x30\x45\x75\x76\x59\x43\x4d\x39\x59','\x75\x66\x4c\x30\x41\x32\x38','\x69\x67\x35\x56\x44\x63\x62\x4d\x42\x33\x76\x55\x7a\x64\x4f\x47','\x74\x31\x76\x30\x71\x30\x4b','\x43\x4d\x66\x30\x7a\x76\x39\x53\x41\x77\x31\x50\x44\x61','\x6c\x32\x4c\x55\x43\x33\x72\x48\x42\x4d\x6e\x4c\x43\x57','\x6d\x30\x50\x78\x72\x68\x76\x57\x75\x71','\x45\x4b\x44\x74\x41\x33\x4f','\x72\x4b\x72\x70\x7a\x67\x4f','\x42\x77\x76\x30\x41\x67\x39\x4b','\x43\x78\x76\x56\x44\x67\x66\x75\x45\x78\x62\x4c','\x45\x63\x31\x56\x43\x4d\x6e\x4f\x7a\x78\x6e\x30\x43\x4d\x66\x30\x42\x33\x69\x54\x44\x4d\x76\x59\x43\x32\x4c\x56\x42\x47','\x6d\x4a\x61\x31\x6d\x65\x39\x68\x72\x32\x44\x56\x74\x57','\x6d\x74\x61\x5a\x6e\x64\x4b\x35\x42\x65\x6e\x4b\x7a\x67\x50\x30','\x72\x4b\x58\x66\x72\x76\x72\x46\x75\x65\x66\x73\x76\x65\x4c\x62\x74\x66\x39\x67\x71\x75\x4c\x6d\x76\x76\x6a\x66','\x74\x4d\x39\x30\x72\x4d\x39\x31\x42\x4d\x72\x66\x43\x4e\x6a\x56\x43\x47','\x75\x33\x72\x48\x44\x67\x76\x66\x43\x4e\x6a\x56\x43\x47','\x42\x77\x76\x5a\x43\x32\x66\x4e\x7a\x71','\x44\x68\x48\x30\x42\x65\x30','\x75\x4d\x76\x58\x44\x77\x76\x5a\x44\x63\x62\x30\x41\x77\x31\x4c\x7a\x63\x62\x56\x44\x78\x71\x47\x79\x77\x7a\x30\x7a\x78\x69\x47','\x43\x4d\x76\x5a\x42\x33\x76\x59\x79\x32\x76\x75\x45\x78\x62\x4c','\x41\x67\x66\x5a','\x75\x30\x76\x73\x76\x4b\x76\x73\x78\x30\x76\x73\x75\x4b\x39\x73','\x74\x4b\x39\x75\x78\x30\x4c\x6e\x75\x65\x58\x66\x74\x75\x76\x6f\x76\x65\x76\x65','\x42\x4b\x72\x34\x75\x31\x47','\x71\x30\x66\x71\x71\x75\x6a\x6a\x74\x65\x4c\x75\x77\x76\x39\x76\x74\x4c\x6e\x76\x75\x66\x62\x70\x75\x4c\x72\x66\x72\x61','\x79\x32\x66\x31\x43\x32\x75','\x74\x76\x6a\x66\x71\x77\x69','\x77\x75\x39\x41\x7a\x65\x6d','\x6e\x74\x61\x5a\x6e\x74\x79\x33\x45\x4b\x72\x51\x74\x4e\x44\x78','\x6d\x4a\x47\x31\x6d\x74\x66\x7a\x74\x65\x48\x6b\x71\x32\x71','\x76\x4b\x4c\x72\x79\x30\x47','\x75\x32\x76\x59\x44\x4d\x76\x59\x72\x78\x6a\x59\x42\x33\x69','\x45\x63\x31\x5a\x41\x77\x72\x4c\x79\x32\x66\x59\x6c\x78\x7a\x4c\x43\x4e\x6e\x50\x42\x32\x34','\x41\x78\x6e\x62\x43\x4e\x6a\x48\x45\x71','\x76\x77\x35\x52\x42\x4d\x39\x33\x42\x49\x62\x4c\x43\x4e\x6a\x56\x43\x47','\x43\x4d\x76\x30\x43\x4e\x4c\x62\x7a\x4e\x72\x4c\x43\x4b\x31\x5a','\x79\x32\x39\x55\x44\x68\x6a\x56\x42\x63\x31\x57\x42\x67\x66\x55\x7a\x71','\x75\x4d\x76\x5a\x42\x33\x76\x59\x79\x32\x75','\x42\x4e\x76\x54\x79\x4d\x76\x59','\x79\x33\x76\x59\x43\x4d\x76\x55\x44\x66\x6e\x30\x79\x78\x72\x4c','\x43\x32\x4c\x4b\x7a\x77\x6e\x48\x43\x47','\x43\x33\x72\x59\x41\x77\x35\x4e','\x43\x33\x72\x48\x43\x4e\x72\x5a\x76\x32\x4c\x30\x41\x61','\x41\x78\x6e\x6f\x79\x75\x34','\x41\x4e\x66\x48\x75\x77\x34','\x41\x78\x6e\x67\x41\x77\x35\x50\x44\x67\x75','\x41\x4d\x31\x78\x42\x65\x75','\x45\x76\x6a\x76\x73\x4d\x65','\x71\x32\x66\x4c\x7a\x65\x38','\x72\x4b\x58\x66\x72\x76\x72\x46\x75\x30\x48\x62\x75\x4b\x76\x65\x78\x31\x44\x70\x75\x4b\x54\x74\x75\x65\x66\x64\x72\x76\x39\x76\x74\x4c\x6e\x76\x75\x66\x62\x70\x75\x4c\x72\x66\x72\x61','\x6e\x5a\x6d\x57\x6e\x74\x61\x33\x6e\x77\x35\x6c\x71\x4b\x6e\x57\x76\x61','\x75\x4d\x66\x50\x72\x75\x79','\x43\x66\x72\x70\x43\x77\x6d','\x76\x75\x35\x74\x76\x76\x62\x71\x74\x31\x6a\x75\x72\x75\x72\x46\x71\x30\x66\x71\x71\x75\x6a\x6a\x74\x65\x4c\x75\x77\x71','\x43\x4d\x76\x58\x44\x77\x4c\x59\x7a\x77\x72\x74\x44\x67\x66\x30\x7a\x71','\x72\x67\x44\x63\x41\x33\x71','\x43\x4d\x76\x5a\x44\x77\x58\x30\x43\x57','\x6c\x33\x6e\x50\x7a\x67\x76\x4a\x79\x78\x6a\x5a','\x74\x4d\x76\x30\x44\x32\x39\x59\x41\x30\x76\x59\x43\x4d\x39\x59','\x77\x65\x31\x66\x43\x31\x4f','\x74\x78\x44\x76\x41\x4d\x65','\x74\x32\x66\x6e\x74\x75\x79','\x72\x66\x44\x36\x7a\x4b\x75','\x6e\x4a\x65\x59\x6e\x4a\x65\x32\x77\x68\x72\x50\x74\x4d\x76\x50','\x7a\x67\x76\x30\x79\x77\x4c\x53\x43\x57','\x6f\x74\x62\x49\x71\x78\x4c\x71\x74\x66\x61','\x71\x78\x76\x30\x41\x65\x76\x59\x43\x4d\x39\x59','\x44\x68\x6a\x50\x42\x71','\x75\x65\x66\x73\x76\x65\x4c\x62\x74\x66\x39\x67\x71\x75\x4c\x6d\x76\x76\x6a\x66','\x6c\x33\x79\x58\x6c\x57','\x72\x4b\x58\x66\x72\x76\x72\x46\x72\x65\x4c\x74\x75\x65\x66\x75\x71\x30\x48\x46\x75\x65\x66\x73\x76\x65\x4c\x62\x74\x66\x39\x67\x71\x75\x4c\x6d\x76\x76\x6a\x66','\x73\x30\x39\x34\x76\x75\x71','\x43\x4d\x76\x5a\x42\x33\x76\x59\x79\x32\x76\x6a\x7a\x61','\x79\x33\x76\x59\x43\x4d\x76\x55\x44\x61','\x76\x33\x44\x6d\x41\x31\x4f','\x7a\x32\x76\x30','\x45\x63\x31\x30\x79\x77\x35\x4e\x42\x67\x75\x54\x43\x4d\x76\x58\x44\x77\x76\x5a\x44\x63\x31\x57\x79\x78\x72\x4f','\x73\x75\x35\x77\x71\x75\x58\x6a\x72\x66\x39\x74\x76\x65\x66\x75\x72\x71','\x42\x65\x35\x75\x75\x76\x4f','\x79\x32\x72\x4c\x77\x76\x61','\x6d\x4a\x75\x31\x6e\x64\x69\x59\x6e\x67\x35\x5a\x73\x67\x39\x6e\x44\x61','\x75\x32\x66\x55\x7a\x67\x6a\x56\x45\x65\x76\x59\x43\x4d\x39\x59','\x43\x32\x4c\x4b\x7a\x77\x6e\x48\x43\x4c\x7a\x4c\x43\x4e\x6e\x50\x42\x32\x34','\x6e\x4a\x75\x30\x74\x4c\x7a\x58\x75\x33\x66\x76','\x76\x33\x4c\x41\x73\x75\x71','\x71\x30\x66\x71\x71\x75\x6a\x6a\x74\x65\x4c\x75\x77\x76\x39\x6f\x74\x31\x72\x46\x72\x75\x35\x62\x71\x4b\x58\x66\x72\x61','\x74\x4b\x39\x75\x78\x30\x7a\x70\x76\x75\x35\x65','\x7a\x77\x35\x4b\x43\x67\x39\x50\x42\x4e\x71','\x76\x4d\x66\x53\x41\x77\x72\x48\x44\x67\x4c\x56\x42\x4b\x76\x59\x43\x4d\x39\x59','\x44\x77\x35\x52\x42\x4d\x39\x33\x42\x47','\x42\x4d\x66\x54\x7a\x71','\x75\x4b\x76\x72\x76\x75\x76\x74\x76\x61','\x79\x32\x39\x4b\x7a\x71','\x76\x4b\x66\x6d\x73\x75\x72\x62\x76\x65\x4c\x70\x74\x4c\x39\x66\x75\x4c\x6a\x70\x75\x47','\x7a\x4d\x4c\x4c\x42\x67\x72\x5a','\x42\x77\x66\x34','\x42\x33\x6a\x50\x7a\x32\x4c\x55','\x42\x32\x6a\x51\x7a\x77\x6e\x30','\x43\x33\x72\x48\x44\x68\x76\x5a','\x42\x78\x4c\x76\x79\x4e\x43','\x76\x67\x4c\x54\x7a\x77\x39\x31\x44\x65\x76\x59\x43\x4d\x39\x59','\x71\x31\x66\x64\x77\x4e\x75','\x43\x4e\x76\x55\x44\x67\x4c\x54\x7a\x71','\x7a\x77\x35\x4b\x43\x31\x44\x50\x44\x67\x47','\x45\x65\x58\x48\x72\x4c\x75','\x75\x76\x76\x70\x76\x65\x66\x46\x72\x76\x48\x64\x72\x75\x76\x65\x72\x75\x71','\x7a\x4d\x66\x50\x42\x68\x76\x59\x7a\x78\x6d','\x43\x32\x66\x55\x7a\x67\x6a\x56\x45\x63\x31\x48\x43\x67\x4b','\x43\x67\x66\x59\x43\x32\x75','\x7a\x4d\x4c\x53\x44\x67\x76\x59','\x79\x32\x66\x57\x79\x77\x6a\x50\x42\x67\x4c\x30\x45\x71','\x75\x78\x76\x56\x44\x67\x65\x47\x7a\x78\x48\x4a\x7a\x77\x76\x4b\x7a\x77\x71\x36\x69\x61','\x79\x32\x39\x55\x44\x67\x66\x50\x42\x4d\x76\x59\x73\x77\x31\x48\x7a\x32\x75','\x43\x67\x66\x30\x41\x61','\x6c\x33\x62\x59\x42\x32\x50\x4c\x79\x33\x72\x5a','\x42\x67\x76\x55\x7a\x33\x72\x4f','\x75\x67\x66\x59\x44\x67\x4c\x48\x42\x65\x7a\x48\x41\x77\x58\x31\x43\x4d\x76\x66\x43\x4e\x6a\x56\x43\x47','\x76\x75\x35\x6c\x74\x4b\x39\x78\x74\x4c\x39\x66\x75\x4c\x6a\x70\x75\x47'];a0_0x1e0d=function(){return _0x4c59a1;};return a0_0x1e0d();}function inferOrigin(_0x5eecf6,_0x42d51e){const _0xc096a3=a0_0xe5a6e2,_0x32b6c2={'\x79\x52\x55\x4a\x61':_0xc096a3(0x109),'\x4d\x52\x45\x41\x62':'\x78\x2d\x73\x69\x64\x65\x63\x61\x72\x2d\x69\x6d\x61\x67\x65\x2d\x74\x61\x67','\x59\x4f\x5a\x64\x43':_0xc096a3(0x122),'\x4b\x4f\x78\x55\x44':_0xc096a3(0x10d)},_0x55c5dd=_0x42d51e?.['\x70\x61\x74\x68']??_0x5eecf6?.[_0xc096a3(0x134)](_0xc096a3(0x135))??void 0x0;if(!_0x5eecf6)return _0x42d51e?.[_0xc096a3(0x15a)]?_0xc096a3(0x154):void 0x0;if(_0x5eecf6[_0xc096a3(0xfd)](_0x32b6c2[_0xc096a3(0x118)])||_0x5eecf6['\x68\x61\x73'](_0xc096a3(0xe5))||_0x5eecf6[_0xc096a3(0xfd)](_0x32b6c2[_0xc096a3(0x103)]))return _0xc096a3(0x111);if(_0x5eecf6['\x68\x61\x73'](_0xc096a3(0xf3)))return _0xc096a3(0x10d);if(_0x55c5dd?.[_0xc096a3(0x113)](_0xc096a3(0x12e)))return _0xc096a3(0x154);if(_0x55c5dd){if(_0x55c5dd['\x73\x74\x61\x72\x74\x73\x57\x69\x74\x68'](_0xc096a3(0x15b))||_0x55c5dd[_0xc096a3(0x113)](_0x32b6c2[_0xc096a3(0x104)])||_0x55c5dd['\x73\x74\x61\x72\x74\x73\x57\x69\x74\x68'](_0xc096a3(0xed)))return _0x32b6c2[_0xc096a3(0x130)];return _0xc096a3(0x14f);}return _0xc096a3(0x142);}function isQuotaCode(_0x25b352){const _0x547b63=a0_0xe5a6e2,_0x2620d9={'\x6d\x79\x55\x62\x77':_0x547b63(0x152),'\x44\x67\x42\x6b\x74':_0x547b63(0xe6)};return _0x25b352===_0x2620d9[_0x547b63(0x14c)]||_0x25b352?.[_0x547b63(0x150)](_0x2620d9[_0x547b63(0x120)])===!![];}function isCapabilityCode(_0x30940e){const _0x21381e=a0_0xe5a6e2,_0x58c529={'\x78\x4c\x61\x46\x55':_0x21381e(0x13e),'\x4d\x77\x55\x6a\x61':function(_0x394a31,_0x3bec96){return _0x394a31===_0x3bec96;},'\x7a\x7a\x76\x78\x79':_0x21381e(0x11e),'\x74\x78\x74\x6c\x4d':function(_0x540144,_0x5d4c90){return _0x540144===_0x5d4c90;},'\x5a\x5a\x47\x45\x66':_0x21381e(0x11a)};return _0x30940e===_0x58c529[_0x21381e(0x151)]||_0x30940e===_0x21381e(0x101)||_0x58c529[_0x21381e(0x125)](_0x30940e,_0x58c529['\x7a\x7a\x76\x78\x79'])||_0x58c529[_0x21381e(0xfa)](_0x30940e,_0x58c529['\x5a\x5a\x47\x45\x66'])||_0x30940e==='\x53\x48\x41\x52\x45\x44\x5f\x57\x4f\x52\x4b\x53\x50\x41\x43\x45\x5f\x55\x4e\x53\x55\x50\x50\x4f\x52\x54\x45\x44';}function isPartialFailureCode(_0x571d9d){const _0x315a55=a0_0xe5a6e2,_0x18bf8b={'\x6e\x44\x78\x53\x58':function(_0x458287,_0x23b1ce){return _0x458287===_0x23b1ce;},'\x57\x79\x5a\x49\x44':function(_0x37e121,_0x4f0c81){return _0x37e121===_0x4f0c81;}};return _0x18bf8b[_0x315a55(0x100)](_0x571d9d,_0x315a55(0x12d))||_0x18bf8b[_0x315a55(0x13d)](_0x571d9d,_0x315a55(0xf6))||_0x571d9d===_0x315a55(0x12f)||_0x571d9d==='\x46\x4c\x45\x45\x54\x5f\x44\x45\x50\x52\x4f\x56\x49\x53\x49\x4f\x4e\x5f\x46\x41\x49\x4c\x45\x44';}function asString(_0xef3495){const _0x485d27=a0_0xe5a6e2,_0x2b6dda={'\x57\x77\x4c\x6b\x5a':function(_0x4a0972,_0x263467){return _0x4a0972===_0x263467;}};return _0x2b6dda[_0x485d27(0x133)](typeof _0xef3495,_0x485d27(0x112))&&_0xef3495[_0x485d27(0x12c)]()[_0x485d27(0xdf)]>0x0?_0xef3495:void 0x0;}function isFailureDetail(_0x29b784){const _0x162fdf=a0_0xe5a6e2,_0x794157={'\x6c\x4e\x54\x51\x5a':function(_0x337e79,_0x2b059f){return _0x337e79!==_0x2b059f;}};return typeof _0x29b784===_0x162fdf(0x14a)&&_0x794157[_0x162fdf(0x137)](_0x29b784,null)&&!Array[_0x162fdf(0x10a)](_0x29b784);}function readCapability(_0x3d7596,_0x6e827e){const _0x3fb9d0=a0_0xe5a6e2,_0x25cad8={'\x70\x54\x4f\x71\x63':function(_0xf11554,_0x617976){return _0xf11554(_0x617976);}},_0x22e18=typeof _0x6e827e==='\x6f\x62\x6a\x65\x63\x74'&&_0x6e827e!==null?_0x25cad8[_0x3fb9d0(0x11d)](asString,_0x6e827e['\x63\x61\x70\x61\x62\x69\x6c\x69\x74\x79']):void 0x0;return asString(_0x3d7596[_0x3fb9d0(0x157)])??_0x22e18;}function readFailures(_0x349ac8,_0x15d858){const _0x416e74=a0_0xe5a6e2,_0x327c14={'\x7a\x47\x53\x6b\x7a':function(_0x1ccaf0,_0x2b8638){return _0x1ccaf0===_0x2b8638;},'\x44\x57\x7a\x66\x45':_0x416e74(0x14a),'\x50\x59\x74\x6b\x6f':function(_0x2ae68a,_0x5bf763){return _0x2ae68a!==_0x5bf763;}};if(Array[_0x416e74(0x10a)](_0x349ac8['\x66\x61\x69\x6c\x75\x72\x65\x73']))return _0x349ac8[_0x416e74(0x153)][_0x416e74(0x156)](isFailureDetail);if(Array[_0x416e74(0x10a)](_0x349ac8[_0x416e74(0x121)])){const _0x56fea7=_0x349ac8[_0x416e74(0x121)]['\x66\x69\x6c\x74\x65\x72'](_0x1bd05a=>typeof _0x1bd05a===_0x416e74(0x14a)&&_0x1bd05a!==null&&_0x1bd05a['\x6f\x6b']===![]);if(_0x56fea7[_0x416e74(0xdf)]>0x0)return _0x56fea7[_0x416e74(0x156)](isFailureDetail);}if(_0x327c14[_0x416e74(0xef)](typeof _0x15d858,_0x327c14[_0x416e74(0x127)])&&_0x327c14[_0x416e74(0xe9)](_0x15d858,null)&&Array[_0x416e74(0x10a)](_0x15d858[_0x416e74(0x153)]))return _0x15d858['\x66\x61\x69\x6c\x75\x72\x65\x73'][_0x416e74(0x156)](isFailureDetail);}function parseErrorResponse(_0x373535,_0x2ee968,_0x2a37ae,_0x42d704){const _0x292306=a0_0xe5a6e2,_0x1e4fab={'\x6a\x6d\x57\x6c\x45':function(_0x453750,_0x5e4fcb){return _0x453750===_0x5e4fcb;},'\x43\x51\x43\x5a\x75':_0x292306(0x14a),'\x52\x61\x69\x45\x46':function(_0x1990fb,_0xb2f281){return _0x1990fb===_0xb2f281;},'\x46\x44\x4f\x64\x6a':_0x292306(0x112),'\x43\x61\x65\x64\x4f':'\x72\x61\x74\x65\x5f\x6c\x69\x6d\x69\x74','\x58\x4d\x45\x73\x5a':function(_0x54fe73,_0x13c73e){return _0x54fe73(_0x13c73e);},'\x6c\x6e\x5a\x65\x6f':function(_0x509f61,_0x91ab30,_0x1e5fac){return _0x509f61(_0x91ab30,_0x1e5fac);},'\x56\x49\x51\x63\x48':function(_0x1ead33,_0x2a372b){return _0x1ead33||_0x2a372b;}};let _0x1bf6d0;try{_0x1bf6d0=JSON[_0x292306(0x155)](_0x2ee968);}catch{_0x1bf6d0={'\x6d\x65\x73\x73\x61\x67\x65':_0x2ee968};}const _0xb4fcc2=_0x1bf6d0['\x65\x72\x72\x6f\x72'],_0x2d2a38=_0x1e4fab[_0x292306(0x117)](typeof _0xb4fcc2,_0x292306(0x14a))&&_0xb4fcc2!==null?_0xb4fcc2[_0x292306(0xf9)]:void 0x0,_0xac0511=typeof _0xb4fcc2===_0x1e4fab[_0x292306(0x14e)]&&_0xb4fcc2!==null?_0xb4fcc2['\x63\x6f\x64\x65']:void 0x0,_0x5224a1=_0x1bf6d0[_0x292306(0xf9)]||_0x2d2a38||(_0x1e4fab[_0x292306(0x11c)](typeof _0xb4fcc2,_0x1e4fab[_0x292306(0xf0)])?_0xb4fcc2:void 0x0)||_0x2ee968||_0x292306(0x10b),_0x2da4da=typeof _0x1bf6d0['\x64\x65\x74\x61\x69\x6c\x73']===_0x1e4fab['\x46\x44\x4f\x64\x6a']&&_0x1bf6d0[_0x292306(0x129)][_0x292306(0x12c)]()[_0x292306(0xdf)]>0x0?_0x1bf6d0[_0x292306(0x129)][_0x292306(0x12c)]():void 0x0,_0x18409f=!!_0x2da4da&&_0x2da4da!==_0x5224a1&&(_0x5224a1===_0x292306(0x10b)||/^failed\b/i['\x74\x65\x73\x74'](_0x5224a1)||/^provision failed\b/i['\x74\x65\x73\x74'](_0x5224a1)||/^deprovision failed\b/i['\x74\x65\x73\x74'](_0x5224a1)),_0x5465a8=_0x1bf6d0[_0x292306(0x145)]||_0xac0511,_0x62d11c=''+(_0x2a37ae?(_0x2a37ae[_0x292306(0xf1)]??_0x292306(0x144))+'\x20'+(_0x2a37ae[_0x292306(0x15a)]??'')+'\x3a\x20':'')+(_0x18409f?_0x5224a1+'\x3a\x20'+_0x2da4da:_0x5224a1),_0x1ceaa9={'\x6f\x72\x69\x67\x69\x6e':inferOrigin(_0x42d704,_0x2a37ae),'\x65\x6e\x64\x70\x6f\x69\x6e\x74':_0x2a37ae?.[_0x292306(0x15a)]??_0x42d704?.[_0x292306(0x134)](_0x292306(0x135))??void 0x0,'\x72\x65\x74\x72\x79\x41\x66\x74\x65\x72\x4d\x73':parseRetryAfterMs(_0x42d704?.[_0x292306(0x134)]('\x72\x65\x74\x72\x79\x2d\x61\x66\x74\x65\x72')??void 0x0,_0x1bf6d0),'\x73\x69\x64\x65\x63\x61\x72\x56\x65\x72\x73\x69\x6f\x6e':_0x42d704?.[_0x292306(0x134)]('\x78\x2d\x73\x69\x64\x65\x63\x61\x72\x2d\x76\x65\x72\x73\x69\x6f\x6e')??void 0x0,'\x63\x6f\x6e\x74\x61\x69\x6e\x65\x72\x49\x6d\x61\x67\x65':_0x42d704?.[_0x292306(0x134)]('\x78\x2d\x73\x69\x64\x65\x63\x61\x72\x2d\x69\x6d\x61\x67\x65')??_0x42d704?.[_0x292306(0x134)]('\x78\x2d\x73\x69\x64\x65\x63\x61\x72\x2d\x69\x6d\x61\x67\x65\x2d\x74\x61\x67')??void 0x0};if(isQuotaCode(_0x5465a8))return new QuotaError(_0x1bf6d0['\x71\x75\x6f\x74\x61\x54\x79\x70\x65']||_0x1e4fab[_0x292306(0x119)],_0x62d11c,_0x1bf6d0[_0x292306(0x132)],_0x1bf6d0[_0x292306(0xe2)],_0x1ceaa9,_0x373535);if(_0x1e4fab[_0x292306(0x124)](isCapabilityCode,_0x5465a8))return new CapabilityError(_0x62d11c,_0x5465a8,_0x373535,_0x1ceaa9,readCapability(_0x1bf6d0,_0xb4fcc2));if(isPartialFailureCode(_0x5465a8))return new PartialFailureError(_0x62d11c,_0x5465a8,_0x373535,_0x1ceaa9,_0x1e4fab['\x6c\x6e\x5a\x65\x6f'](readFailures,_0x1bf6d0,_0xb4fcc2));switch(_0x373535){case 0x190:return new ValidationError(_0x62d11c,_0x1bf6d0[_0x292306(0x147)],_0x1ceaa9);case 0x191:return new AuthError(_0x62d11c,_0x1ceaa9);case 0x194:return new NotFoundError(_0x1bf6d0[_0x292306(0xfc)]||_0x292306(0x10e),_0x1bf6d0[_0x292306(0x131)]||_0x292306(0x142),_0x1ceaa9);case 0x198:return new TimeoutError(_0x1bf6d0[_0x292306(0xe3)]||0x7530,_0x62d11c,_0x1ceaa9);case 0x199:return new StateError(_0x62d11c,_0x1bf6d0[_0x292306(0x110)]||_0x292306(0x142),_0x1bf6d0[_0x292306(0x11f)],_0x1ceaa9);case 0x1ad:return new QuotaError(_0x1bf6d0['\x71\x75\x6f\x74\x61\x54\x79\x70\x65']||_0x292306(0xec),_0x62d11c,_0x1bf6d0[_0x292306(0x132)],_0x1bf6d0[_0x292306(0xe2)],_0x1ceaa9);case 0x1f5:return new SandboxError(_0x62d11c,_0x5465a8||_0x292306(0xff),_0x373535,_0x1ceaa9);default:if(_0x373535>=0x1f4)return new ServerError(_0x62d11c,_0x373535,_0x1ceaa9);return new SandboxError(_0x62d11c,_0x1e4fab[_0x292306(0x107)](_0x5465a8,_0x292306(0xe1)),_0x373535,_0x1ceaa9);}}export{PartialFailureError as a,ServerError as c,ValidationError as d,parseErrorResponse as f,NotFoundError as i,StateError as l,CapabilityError as n,QuotaError as o,NetworkError as r,SandboxError as s,AuthError as t,TimeoutError as u};
|
|
1
|
+
//#region src/errors.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sandbox SDK Errors
|
|
4
|
+
*
|
|
5
|
+
* Error classes for the Sandbox client SDK.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base error class for all Sandbox SDK errors.
|
|
9
|
+
*/
|
|
10
|
+
var SandboxError = class extends Error {
|
|
11
|
+
/** HTTP status code if applicable */
|
|
12
|
+
status;
|
|
13
|
+
/** Error code for programmatic handling */
|
|
14
|
+
code;
|
|
15
|
+
/** Best-effort origin of the failing request */
|
|
16
|
+
origin;
|
|
17
|
+
/** Request path or endpoint when known */
|
|
18
|
+
endpoint;
|
|
19
|
+
/** Retry-after duration in ms when surfaced by the upstream */
|
|
20
|
+
retryAfterMs;
|
|
21
|
+
/** Sidecar version when the runtime emitted it */
|
|
22
|
+
sidecarVersion;
|
|
23
|
+
/** Sidecar image/tag/sha when the runtime emitted it */
|
|
24
|
+
containerImage;
|
|
25
|
+
constructor(message, code, status, metadata) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "SandboxError";
|
|
28
|
+
this.code = code;
|
|
29
|
+
this.status = status;
|
|
30
|
+
this.origin = metadata?.origin;
|
|
31
|
+
this.endpoint = metadata?.endpoint;
|
|
32
|
+
this.retryAfterMs = metadata?.retryAfterMs;
|
|
33
|
+
this.sidecarVersion = metadata?.sidecarVersion;
|
|
34
|
+
this.containerImage = metadata?.containerImage;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Authentication failed or API key is invalid.
|
|
39
|
+
*/
|
|
40
|
+
var AuthError = class extends SandboxError {
|
|
41
|
+
constructor(message = "Authentication failed", metadata) {
|
|
42
|
+
super(message, "AUTH_ERROR", 401, metadata);
|
|
43
|
+
this.name = "AuthError";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The requested resource was not found.
|
|
48
|
+
*/
|
|
49
|
+
var NotFoundError = class extends SandboxError {
|
|
50
|
+
/** The resource type that was not found */
|
|
51
|
+
resourceType;
|
|
52
|
+
/** The resource ID that was not found */
|
|
53
|
+
resourceId;
|
|
54
|
+
constructor(resourceType, resourceId, metadata) {
|
|
55
|
+
super(`${resourceType} not found: ${resourceId}`, "NOT_FOUND", 404, metadata);
|
|
56
|
+
this.name = "NotFoundError";
|
|
57
|
+
this.resourceType = resourceType;
|
|
58
|
+
this.resourceId = resourceId;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Account quota or rate limit exceeded.
|
|
63
|
+
*/
|
|
64
|
+
var QuotaError = class extends SandboxError {
|
|
65
|
+
/** The type of quota that was exceeded */
|
|
66
|
+
quotaType;
|
|
67
|
+
/** Current usage */
|
|
68
|
+
current;
|
|
69
|
+
/** Maximum allowed */
|
|
70
|
+
limit;
|
|
71
|
+
/** Suggested retry-after duration in ms */
|
|
72
|
+
retryAfterMs;
|
|
73
|
+
constructor(quotaType, message, current, limit, metadata, status = 429) {
|
|
74
|
+
super(message ?? `Quota exceeded: ${quotaType}`, "QUOTA_EXCEEDED", status, metadata);
|
|
75
|
+
this.name = "QuotaError";
|
|
76
|
+
this.quotaType = quotaType;
|
|
77
|
+
this.current = current;
|
|
78
|
+
this.limit = limit;
|
|
79
|
+
this.retryAfterMs = metadata?.retryAfterMs;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The requested capability is unavailable for the account, driver, or sandbox.
|
|
84
|
+
*/
|
|
85
|
+
var CapabilityError = class extends SandboxError {
|
|
86
|
+
/** Capability or feature that was rejected when known */
|
|
87
|
+
capability;
|
|
88
|
+
constructor(message, code = "CAPABILITY_UNSUPPORTED", status = 400, metadata, capability) {
|
|
89
|
+
super(message, code, status, metadata);
|
|
90
|
+
this.name = "CapabilityError";
|
|
91
|
+
this.capability = capability;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* A multi-resource operation failed for one or more branches.
|
|
96
|
+
*/
|
|
97
|
+
var PartialFailureError = class extends SandboxError {
|
|
98
|
+
/** Per-resource failures returned by the API when available */
|
|
99
|
+
failures;
|
|
100
|
+
constructor(message, code = "PARTIAL_FAILURE", status = 502, metadata, failures) {
|
|
101
|
+
super(message, code, status, metadata);
|
|
102
|
+
this.name = "PartialFailureError";
|
|
103
|
+
this.failures = failures;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The request was invalid or malformed.
|
|
108
|
+
*/
|
|
109
|
+
var ValidationError = class extends SandboxError {
|
|
110
|
+
/** Field-level validation errors */
|
|
111
|
+
fields;
|
|
112
|
+
constructor(message, fields, metadata) {
|
|
113
|
+
super(message, "VALIDATION_ERROR", 400, metadata);
|
|
114
|
+
this.name = "ValidationError";
|
|
115
|
+
this.fields = fields;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* The sandbox is not in a valid state for the requested operation.
|
|
120
|
+
*/
|
|
121
|
+
var StateError = class extends SandboxError {
|
|
122
|
+
/** Current state of the sandbox */
|
|
123
|
+
currentState;
|
|
124
|
+
/** Required state for the operation */
|
|
125
|
+
requiredState;
|
|
126
|
+
constructor(message, currentState, requiredState, metadata) {
|
|
127
|
+
super(message, "INVALID_STATE", 409, metadata);
|
|
128
|
+
this.name = "StateError";
|
|
129
|
+
this.currentState = currentState;
|
|
130
|
+
this.requiredState = requiredState;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* The request timed out.
|
|
135
|
+
*/
|
|
136
|
+
var TimeoutError = class extends SandboxError {
|
|
137
|
+
/** Timeout duration in milliseconds */
|
|
138
|
+
timeoutMs;
|
|
139
|
+
constructor(timeoutMs, message, metadata) {
|
|
140
|
+
super(message ?? `Request timed out after ${timeoutMs}ms`, "TIMEOUT", 408, metadata);
|
|
141
|
+
this.name = "TimeoutError";
|
|
142
|
+
this.timeoutMs = timeoutMs;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* A network or connection error occurred.
|
|
147
|
+
*/
|
|
148
|
+
var NetworkError = class extends SandboxError {
|
|
149
|
+
/** The underlying error */
|
|
150
|
+
cause;
|
|
151
|
+
constructor(message, causeOrMetadata, metadata) {
|
|
152
|
+
const cause = causeOrMetadata instanceof Error ? causeOrMetadata : void 0;
|
|
153
|
+
const resolvedMetadata = causeOrMetadata instanceof Error ? metadata : causeOrMetadata ?? metadata;
|
|
154
|
+
super(message, "NETWORK_ERROR", void 0, resolvedMetadata);
|
|
155
|
+
this.name = "NetworkError";
|
|
156
|
+
this.cause = cause;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The server returned an unexpected error.
|
|
161
|
+
*/
|
|
162
|
+
var ServerError = class extends SandboxError {
|
|
163
|
+
constructor(message, status = 500, metadata) {
|
|
164
|
+
super(message, "SERVER_ERROR", status, metadata);
|
|
165
|
+
this.name = "ServerError";
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
function parseRetryAfterMs(rawValue, data) {
|
|
169
|
+
if (typeof data.retryAfterMs === "number" && Number.isFinite(data.retryAfterMs)) return Math.max(0, data.retryAfterMs);
|
|
170
|
+
if (!rawValue) return void 0;
|
|
171
|
+
const trimmed = rawValue.trim();
|
|
172
|
+
if (!trimmed) return void 0;
|
|
173
|
+
const seconds = Number(trimmed);
|
|
174
|
+
if (Number.isFinite(seconds)) return Math.max(0, seconds) * 1e3;
|
|
175
|
+
const targetTs = Date.parse(trimmed);
|
|
176
|
+
if (!Number.isNaN(targetTs)) return Math.max(0, targetTs - Date.now());
|
|
177
|
+
}
|
|
178
|
+
function inferOrigin(headers, context) {
|
|
179
|
+
const derivedPath = context?.path ?? headers?.get("x-tangle-request-path") ?? void 0;
|
|
180
|
+
if (!headers) return context?.path ? "sandbox-api" : void 0;
|
|
181
|
+
if (headers.has("x-sidecar-version") || headers.has("x-sidecar-image") || headers.has("x-sidecar-image-tag")) return "sidecar";
|
|
182
|
+
if (headers.has("x-orchestrator-version")) return "control-plane";
|
|
183
|
+
if (derivedPath?.startsWith("/v1/")) return "sandbox-api";
|
|
184
|
+
if (derivedPath) {
|
|
185
|
+
if (derivedPath.startsWith("/projects") || derivedPath.startsWith("/sidecars") || derivedPath.startsWith("/instances")) return "control-plane";
|
|
186
|
+
return "runtime";
|
|
187
|
+
}
|
|
188
|
+
return "unknown";
|
|
189
|
+
}
|
|
190
|
+
function isQuotaCode(code) {
|
|
191
|
+
return code === "QUOTA_EXCEEDED" || code?.endsWith("_QUOTA_EXCEEDED") === true;
|
|
192
|
+
}
|
|
193
|
+
function isCapabilityCode(code) {
|
|
194
|
+
return code === "CAPABILITY_NOT_ENABLED" || code === "CAPABILITY_UNSUPPORTED" || code === "UNSUPPORTED_CAPABILITY" || code === "FLEET_SHARED_WORKSPACE_UNSUPPORTED" || code === "SHARED_WORKSPACE_UNSUPPORTED";
|
|
195
|
+
}
|
|
196
|
+
function isPartialFailureCode(code) {
|
|
197
|
+
return code === "PARTIAL_FAILURE" || code === "FLEET_PARTIAL_FAILURE" || code === "FLEET_DISPATCH_PARTIAL_FAILURE" || code === "FLEET_DEPROVISION_FAILED";
|
|
198
|
+
}
|
|
199
|
+
function asString(value) {
|
|
200
|
+
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
201
|
+
}
|
|
202
|
+
function isFailureDetail(value) {
|
|
203
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
204
|
+
}
|
|
205
|
+
function readCapability(data, errorObj) {
|
|
206
|
+
const nested = typeof errorObj === "object" && errorObj !== null ? asString(errorObj.capability) : void 0;
|
|
207
|
+
return asString(data.capability) ?? nested;
|
|
208
|
+
}
|
|
209
|
+
function readFailures(data, errorObj) {
|
|
210
|
+
if (Array.isArray(data.failures)) return data.failures.filter(isFailureDetail);
|
|
211
|
+
if (Array.isArray(data.results)) {
|
|
212
|
+
const failures = data.results.filter((result) => typeof result === "object" && result !== null && result.ok === false);
|
|
213
|
+
if (failures.length > 0) return failures.filter(isFailureDetail);
|
|
214
|
+
}
|
|
215
|
+
if (typeof errorObj === "object" && errorObj !== null && Array.isArray(errorObj.failures)) return errorObj.failures.filter(isFailureDetail);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Parse an error response from the API.
|
|
219
|
+
* @param status - HTTP status code
|
|
220
|
+
* @param body - Response body text
|
|
221
|
+
* @param context - Optional request context for better error messages
|
|
222
|
+
*/
|
|
223
|
+
function parseErrorResponse(status, body, context, headers) {
|
|
224
|
+
let data;
|
|
225
|
+
try {
|
|
226
|
+
data = JSON.parse(body);
|
|
227
|
+
} catch {
|
|
228
|
+
data = { message: body };
|
|
229
|
+
}
|
|
230
|
+
const errorObj = data.error;
|
|
231
|
+
const nestedMessage = typeof errorObj === "object" && errorObj !== null ? errorObj.message : void 0;
|
|
232
|
+
const nestedCode = typeof errorObj === "object" && errorObj !== null ? errorObj.code : void 0;
|
|
233
|
+
const baseMessage = data.message || nestedMessage || (typeof errorObj === "string" ? errorObj : void 0) || body || "Unknown error";
|
|
234
|
+
const details = typeof data.details === "string" && data.details.trim().length > 0 ? data.details.trim() : void 0;
|
|
235
|
+
const shouldAppendDetails = !!details && details !== baseMessage && (baseMessage === "Unknown error" || /^failed\b/i.test(baseMessage) || /^provision failed\b/i.test(baseMessage) || /^deprovision failed\b/i.test(baseMessage));
|
|
236
|
+
const code = data.code || nestedCode;
|
|
237
|
+
const message = `${context ? `${context.method ?? "REQUEST"} ${context.path ?? ""}: ` : ""}${shouldAppendDetails ? `${baseMessage}: ${details}` : baseMessage}`;
|
|
238
|
+
const metadata = {
|
|
239
|
+
origin: inferOrigin(headers, context),
|
|
240
|
+
endpoint: context?.path ?? headers?.get("x-tangle-request-path") ?? void 0,
|
|
241
|
+
retryAfterMs: parseRetryAfterMs(headers?.get("retry-after") ?? void 0, data),
|
|
242
|
+
sidecarVersion: headers?.get("x-sidecar-version") ?? void 0,
|
|
243
|
+
containerImage: headers?.get("x-sidecar-image") ?? headers?.get("x-sidecar-image-tag") ?? void 0
|
|
244
|
+
};
|
|
245
|
+
if (isQuotaCode(code)) return new QuotaError(data.quotaType || "rate_limit", message, data.current, data.limit, metadata, status);
|
|
246
|
+
if (isCapabilityCode(code)) return new CapabilityError(message, code, status, metadata, readCapability(data, errorObj));
|
|
247
|
+
if (isPartialFailureCode(code)) return new PartialFailureError(message, code, status, metadata, readFailures(data, errorObj));
|
|
248
|
+
switch (status) {
|
|
249
|
+
case 400: return new ValidationError(message, data.fields, metadata);
|
|
250
|
+
case 401: return new AuthError(message, metadata);
|
|
251
|
+
case 404: return new NotFoundError(data.resourceType || "Resource", data.resourceId || "unknown", metadata);
|
|
252
|
+
case 408: return new TimeoutError(data.timeoutMs || 3e4, message, metadata);
|
|
253
|
+
case 409: return new StateError(message, data.currentState || "unknown", data.requiredState, metadata);
|
|
254
|
+
case 429: return new QuotaError(data.quotaType || "rate_limit", message, data.current, data.limit, metadata);
|
|
255
|
+
case 501: return new SandboxError(message, code || "NOT_IMPLEMENTED", status, metadata);
|
|
256
|
+
default:
|
|
257
|
+
if (status >= 500) return new ServerError(message, status, metadata);
|
|
258
|
+
return new SandboxError(message, code || "UNKNOWN_ERROR", status, metadata);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
export { PartialFailureError as a, ServerError as c, ValidationError as d, parseErrorResponse as f, NotFoundError as i, StateError as l, CapabilityError as n, QuotaError as o, NetworkError as r, SandboxError as s, AuthError as t, TimeoutError as u };
|