@p697/clawket 0.4.1 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +3439 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,2 +1,3440 @@
1
1
  #!/usr/bin/env node
2
- (function(_0xe3e922,_0xd820c4){const _0x58f06b={_0x23f0d5:0x20e,_0x361e04:0x190,_0x4f48ca:0x197,_0x3c38e3:0x771,_0x2f8b9e:0x331,_0x221114:0x530,_0x32b071:0x24,_0x44285e:0x474,_0x1c4f86:0x7b9,_0xbc2997:0x348,_0x338b4d:0x28a,_0x410779:0x3a4},_0x5a3bc0=_0xe3e922();function _0x98b90c(_0x42c681,_0x2e7e3a){return _0x1fba(_0x42c681- -0x1c5,_0x2e7e3a);}function _0x26aed1(_0x2af1d9,_0x3f0ee8){return _0x1fba(_0x3f0ee8- -0x1a2,_0x2af1d9);}while(!![]){try{const _0x176171=parseInt(_0x26aed1(0x248,_0x58f06b._0x23f0d5))/0x1*(parseInt(_0x26aed1(_0x58f06b._0x361e04,0x1f7))/0x2)+-parseInt(_0x26aed1(0x10e,0x282))/0x3*(-parseInt(_0x26aed1(-_0x58f06b._0x4f48ca,0x100))/0x4)+parseInt(_0x26aed1(_0x58f06b._0x3c38e3,0x4aa))/0x5+-parseInt(_0x26aed1(_0x58f06b._0x2f8b9e,_0x58f06b._0x221114))/0x6+-parseInt(_0x98b90c(0x11c,-_0x58f06b._0x32b071))/0x7*(-parseInt(_0x98b90c(_0x58f06b._0x44285e,0x513))/0x8)+parseInt(_0x26aed1(_0x58f06b._0x1c4f86,0x4e9))/0x9*(parseInt(_0x98b90c(0x363,_0x58f06b._0xbc2997))/0xa)+-parseInt(_0x98b90c(0x343,0x112))/0xb*(parseInt(_0x98b90c(_0x58f06b._0x338b4d,_0x58f06b._0x410779))/0xc);if(_0x176171===_0xd820c4)break;else _0x5a3bc0['push'](_0x5a3bc0['shift']());}catch(_0x4df009){_0x5a3bc0['push'](_0x5a3bc0['shift']());}}}(_0x1876,0xb3ef0));const _0x3fec44=(function(){let _0x3bf892=!![];return function(_0xf3976d,_0x54c33a){const _0x2e6d54=_0x3bf892?function(){if(_0x54c33a){const _0x184ba8=_0x54c33a['apply'](_0xf3976d,arguments);return _0x54c33a=null,_0x184ba8;}}:function(){};return _0x3bf892=![],_0x2e6d54;};}()),_0x5726ab=_0x3fec44(this,function(){const _0x1b29ea={_0xa7b9c8:0x409,_0x2be472:0x379,_0x33b088:0x32e,_0x509c0a:0x584,_0x392389:0x4a5,_0x3a126d:0x420,_0x47a7f3:0x41b,_0x2e7eb5:0x379,_0xab5bfe:0x977,_0x152620:0x7e9};function _0x2251c7(_0x5f5d3d,_0x862d4a){return _0x1fba(_0x862d4a-0x96,_0x5f5d3d);}function _0x34d2a7(_0xddf612,_0x53faf9){return _0x1fba(_0x53faf9- -0x59,_0xddf612);}return _0x5726ab[_0x34d2a7(0x462,0x32e)]()[_0x34d2a7(0x23f,0x51f)](_0x34d2a7(_0x1b29ea._0xa7b9c8,_0x1b29ea._0x2be472)+'+)+$')[_0x34d2a7(0x2c5,_0x1b29ea._0x33b088)]()[_0x2251c7(_0x1b29ea._0x509c0a,_0x1b29ea._0x392389)+_0x34d2a7(0x33c,_0x1b29ea._0x3a126d)](_0x5726ab)[_0x34d2a7(0x610,0x51f)](_0x34d2a7(_0x1b29ea._0x47a7f3,_0x1b29ea._0x2e7eb5)+_0x2251c7(_0x1b29ea._0xab5bfe,_0x1b29ea._0x152620));});_0x5726ab();import _0x1bbb4f from'qrcode-terminal';import{readFileSync as _0x546d61}from'fs';import{Socket}from'net';import{homedir as _0x305903}from'os';import{existsSync,mkdirSync,readFileSync,rmSync,writeFileSync}from'fs';import{randomUUID}from'crypto';import{homedir,hostname,userInfo}from'os';import{join}from'path';var CONFIG_DIR=join(homedir(),'.clawket'),CONFIG_PATH=join(CONFIG_DIR,_0x35d151(0x399,0x3d5)+_0x341e52(0x8ef,0xa7f));function getPairingConfigPath(){return CONFIG_PATH;}function readPairingConfig(){const _0x38785e={_0x155687:0x537,_0x5a6133:0xf8,_0x5d7a20:0x111,_0x32094a:0xf9,_0x1b7a9b:0x8f9,_0x55e905:0x663,_0x4ebeaa:0x15e,_0x4907a6:0x160,_0x412c1a:0x35e,_0x1626ea:0x56,_0x4e0820:0x117,_0xe22255:0x103,_0x2d10f7:0x874,_0x19500a:0x609,_0x139a51:0x5d1,_0x217922:0x5eb,_0x133576:0x6a3},_0x65f889={_0x50c7ab:0x142},_0x2f839c={_0x28c88f:0x5da};function _0xa67761(_0x403a2c,_0x308bd8){return _0x341e52(_0x403a2c- -_0x2f839c._0x28c88f,_0x308bd8);}const _0x13d16c={'NJyUP':function(_0x1b3544){return _0x1b3544();},'ETXWN':function(_0x3ba1e4,_0x34fc37){return _0x3ba1e4!==_0x34fc37;}};if(!existsSync(CONFIG_PATH))return null;function _0x3087fc(_0x32e816,_0xccc7ea){return _0x341e52(_0xccc7ea- -_0x65f889._0x50c7ab,_0x32e816);}try{const _0x153e45=JSON[_0x3087fc(0x4cd,0x75b)](readFileSync(CONFIG_PATH,_0x3087fc(0x284,_0x38785e._0x155687)));if(!_0x153e45[_0xa67761(_0x38785e._0x5a6133,0x10c)+'l']||!_0x153e45['gatewayI'+'d']||!_0x153e45[_0xa67761(-0xfa,_0x38785e._0x5d7a20)+_0x3087fc(_0x38785e._0x32094a,0x3e7)]||!_0x153e45[_0x3087fc(0x3ff,0x45b)])return null;const _0x5365f7={'serverUrl':_0x153e45['serverUr'+'l'],'gatewayId':_0x153e45[_0x3087fc(_0x38785e._0x1b7a9b,_0x38785e._0x55e905)+'d'],'relaySecret':_0x153e45['relaySec'+'ret'],'relayUrl':_0x153e45[_0x3087fc(_0x38785e._0x4ebeaa,0x45b)],'instanceId':_0x153e45['instance'+'Id']?.[_0x3087fc(0x6eb,0x4c1)]()||_0x13d16c['NJyUP'](createInstanceId),'displayName':_0x153e45[_0x3087fc(0x70d,0x48f)+_0xa67761(_0x38785e._0x4907a6,_0x38785e._0x412c1a)]??null,'createdAt':_0x153e45[_0xa67761(0x32e,0x323)+'t']??new Date()[_0xa67761(-0x117,-_0x38785e._0x1626ea)+_0xa67761(0x171,0x426)](),'updatedAt':_0x153e45['updatedA'+'t']??new Date()[_0xa67761(-_0x38785e._0x4e0820,-_0x38785e._0xe22255)+_0x3087fc(_0x38785e._0x2d10f7,_0x38785e._0x19500a)]()};return _0x13d16c[_0x3087fc(0x5a6,_0x38785e._0x139a51)](_0x153e45[_0x3087fc(_0x38785e._0x217922,_0x38785e._0x133576)+'Id'],_0x5365f7['instance'+'Id'])&&writePairingConfig(_0x5365f7),_0x5365f7;}catch{return null;}}function writePairingConfig(_0x103bc5){const _0x19644c={_0x51ce4f:0x6db,_0x44158e:0x90a,_0xe51811:0xb09,_0x5a0a2a:0x8ec,_0x54e56f:0xa6a},_0x2a0509={_0x4b0f0c:0x287},_0x4201fa={_0x3cb586:0x124};function _0x4c0575(_0x424575,_0x52680b){return _0x341e52(_0x52680b-_0x4201fa._0x3cb586,_0x424575);}const _0x446e7f={'xVXoQ':function(_0x58a87b,_0x247fbe,_0x795117){return _0x58a87b(_0x247fbe,_0x795117);}};function _0x404ebf(_0x3023b5,_0x3e59d9){return _0x341e52(_0x3e59d9- -_0x2a0509._0x4b0f0c,_0x3023b5);}const _0xfd8cc8={};_0xfd8cc8[_0x4c0575(_0x19644c._0x51ce4f,_0x19644c._0x44158e)+'e']=!![],_0x446e7f[_0x4c0575(_0x19644c._0xe51811,_0x19644c._0x5a0a2a)](mkdirSync,CONFIG_DIR,_0xfd8cc8),writeFileSync(CONFIG_PATH,JSON[_0x4c0575(_0x19644c._0x54e56f,0x89c)+'y'](_0x103bc5,null,0x2)+'\x0a','utf8');}function deletePairingConfig(){const _0x2ccdaf={'QcUQu':function(_0x153852,_0x361b9a){return _0x153852(_0x361b9a);},'xcNLu':function(_0x460be0,_0x24dd9e,_0x3ac16a){return _0x460be0(_0x24dd9e,_0x3ac16a);}};if(!_0x2ccdaf[_0x478337(0x767,0x7a3)](existsSync,CONFIG_PATH))return;function _0x478337(_0x56eecc,_0x19c221){return _0x341e52(_0x19c221-0xbb,_0x56eecc);}const _0x106255={};_0x106255['force']=!![],_0x2ccdaf['xcNLu'](rmSync,CONFIG_PATH,_0x106255);}function getDefaultBridgeDisplayName(){const _0x1d62de={_0x54dff7:0x1f5,_0x4c5a6b:0x28c,_0x4ab551:0x5e,_0x59d379:0x418},_0x5cafe4={_0x17a06a:0xfb},_0x19973a={_0x29e80e:0x1a3},_0x22b0e2=readOpenClawDefaultAgentName();function _0x2816b6(_0x16cab4,_0x18d03d){return _0x35d151(_0x16cab4,_0x18d03d- -_0x19973a._0x29e80e);}if(_0x22b0e2)return _0x22b0e2;function _0x2300bc(_0x50339f,_0xd42e1a){return _0x35d151(_0x50339f,_0xd42e1a- -_0x5cafe4._0x17a06a);}try{const _0x87b83a=userInfo()[_0x2300bc(-0x183,0x1a)][_0x2300bc(_0x1d62de._0x54dff7,_0x1d62de._0x4c5a6b)]();if(_0x87b83a)return _0x87b83a;}catch{}const _0x58946b=(process.env.LOGNAME??process.env.USER??process.env.USERNAME??'')[_0x2816b6(_0x1d62de._0x4ab551,0x1e4)]();if(_0x58946b)return _0x58946b;return hostname()[_0x2816b6(0x14c,0x1e4)]()||_0x2300bc(0x651,_0x1d62de._0x59d379)+'Bridge';}function pickOpenClawDefaultAgentName(_0x490213){const _0x478e78={_0x39c2e5:0x2ab,_0x21158e:0x37,_0x103085:0x4e,_0x2db205:0x106,_0x1bdc47:0x87,_0x5f3154:0x3a2};if(!_0x490213||typeof _0x490213!=='object')return null;function _0x2a5670(_0x3912ab,_0x15ba24){return _0x35d151(_0x15ba24,_0x3912ab- -0x244);}const _0x1040a6=_0x490213[_0x2a5670(_0x478e78._0x39c2e5,0x50c)];function _0x22d2f8(_0x347aeb,_0x3f8e6b){return _0x35d151(_0x3f8e6b,_0x347aeb- -0x1a3);}const _0x5bd491=Array[_0x22d2f8(_0x478e78._0x21158e,_0x478e78._0x103085)](_0x1040a6?.[_0x22d2f8(-0x87,-_0x478e78._0x2db205)])?_0x1040a6[_0x22d2f8(-_0x478e78._0x1bdc47,-0x115)]:[],_0x5c9ef3=_0x5bd491[_0x22d2f8(_0x478e78._0x5f3154,0x3bc)](_0x11200a=>isDefaultAgent(_0x11200a))??_0x5bd491[_0x22d2f8(0x3a2,0x14c)](_0x542056=>hasAgentId(_0x542056,'main'))??_0x5bd491[0x0];return readAgentName(_0x5c9ef3);}function createInstanceId(){const _0x7a25db={_0x2a8ac1:0x184,_0x3b25a8:0xc6,_0x5d179a:0x125},_0x230fea={_0x2b9647:0x537};function _0x2e2e79(_0x2f000,_0x4cdf09){return _0x341e52(_0x2f000-0x83,_0x4cdf09);}const _0x26137b=sanitizeId(hostname()||_0x18dbb9(0x288,_0x7a25db._0x2a8ac1));function _0x18dbb9(_0x53692c,_0x48dc53){return _0x341e52(_0x48dc53- -_0x230fea._0x2b9647,_0x53692c);}return _0x18dbb9(_0x7a25db._0x3b25a8,0x292)+_0x26137b+'-'+randomUUID()[_0x18dbb9(-0x197,-_0x7a25db._0x5d179a)](0x0,0xa);}function sanitizeId(_0x1843f0){const _0x4b4861={_0x5eb25c:0x71e,_0x5b3bdd:0x961,_0x1a137d:0xa1e,_0x8d75b9:0x27c},_0x431cb8={_0x46360e:0x262};function _0x4077d1(_0x4fa3ec,_0x46df3e){return _0x341e52(_0x4fa3ec- -_0x431cb8._0x46360e,_0x46df3e);}function _0x48cc37(_0x5d0ba6,_0x26d875){return _0x341e52(_0x26d875-0x11b,_0x5d0ba6);}return _0x1843f0[_0x48cc37(0x5f7,_0x4b4861._0x5eb25c)]()['toLowerC'+_0x48cc37(_0x4b4861._0x5b3bdd,_0x4b4861._0x1a137d)]()[_0x4077d1(_0x4b4861._0x8d75b9,0x30f)](/[^a-z0-9._-]+/g,'-')['replace'](/^-+|-+$/g,'')||'host';}function readOpenClawDefaultAgentName(){const _0x2fa85b={_0x326b38:0x618,_0x5ab87b:0x7b0},_0x20caf8={'CHHaT':function(_0x50a422){return _0x50a422();}};function _0x52856e(_0x379146,_0x39a52d){return _0x35d151(_0x39a52d,_0x379146-0x3b3);}const _0xe44ec5=_0x20caf8[_0x3c1225(0x4b5,_0x2fa85b._0x326b38)](resolveOpenClawConfigPath);function _0x3c1225(_0x363ac7,_0x512949){return _0x35d151(_0x512949,_0x363ac7-0x1ed);}if(!_0xe44ec5||!existsSync(_0xe44ec5))return null;try{const _0x347590=JSON['parse'](readFileSync(_0xe44ec5,_0x52856e(_0x2fa85b._0x5ab87b,0x84f)));return pickOpenClawDefaultAgentName(_0x347590);}catch{return null;}}function resolveOpenClawConfigPath(){const _0x1a41be={_0x5302ee:0x12d,_0x410d89:0x76b,_0x5ba3d7:0x591,_0x122388:0x329,_0x5e2837:0xa6,_0x29e07c:0xd9,_0x1aa277:0x10a,_0x1b1301:0xfc,_0x233b9e:0x6f5,_0x3bb8df:0x4f1,_0x249183:0x61f,_0x26fa2f:0x555,_0x281e2b:0x6f4},_0x363916={_0x197ce2:0x73a,_0x318b65:0x9ec},_0x4c9df3={_0x36d975:0x2d3};function _0x48ee68(_0x564cc5,_0x2e2020){return _0x341e52(_0x2e2020-0x49,_0x564cc5);}const _0x114b80={'zwQxw':function(_0x222e52){return _0x222e52();},'PcqLU':_0x106bba(-_0x1a41be._0x5302ee,0xc4),'tIJxt':function(_0x264dcd,_0x52b359,_0x54f336,_0x42fcb3){return _0x264dcd(_0x52b359,_0x54f336,_0x42fcb3);},'UduTX':_0x48ee68(_0x1a41be._0x410d89,0x80d)+'.json'};function _0x106bba(_0x18fdf9,_0x814d46){return _0x341e52(_0x814d46- -_0x4c9df3._0x36d975,_0x18fdf9);}const _0x27c453=new Set(),_0x4193ff=[_0x114b80[_0x48ee68(0x347,_0x1a41be._0x5ba3d7)](homedir),_0x114b80[_0x106bba(_0x1a41be._0x122388,_0x1a41be._0x5e2837)]][_0x106bba(0x1bc,_0x1a41be._0x29e07c)](_0x360e5b=>_0x360e5b[_0x106bba(0x4a1,0x330)]())['filter'](Boolean)[_0x106bba(-_0x1a41be._0x1aa277,_0x1a41be._0x1b1301)](_0x15ca34=>{if(_0x27c453[_0x49ffbb(_0x363916._0x197ce2,_0x363916._0x318b65)](_0x15ca34))return![];_0x27c453['add'](_0x15ca34);function _0x49ffbb(_0x4180c2,_0xb22a50){return _0x48ee68(_0xb22a50,_0x4180c2- -0x220);}return!![];});for(const _0x2db028 of _0x4193ff){const _0x5cf947=_0x114b80['tIJxt'](join,_0x2db028,_0x48ee68(_0x1a41be._0x233b9e,0x93b)+'w',_0x106bba(0x36b,_0x1a41be._0x3bb8df)+_0x48ee68(0x7f8,0x530));if(existsSync(_0x5cf947))return _0x5cf947;}return _0x4193ff[0x0]?join(_0x4193ff[0x0],_0x106bba(0x443,_0x1a41be._0x249183)+'w',_0x114b80[_0x48ee68(_0x1a41be._0x26fa2f,_0x1a41be._0x281e2b)]):null;}function isDefaultAgent(_0x927e8){const _0x313626={_0x54cfa8:0x2dc,_0x3f4ce6:0x1ca},_0x2aa4a4={};_0x2aa4a4['VxHpk']=function(_0x43b6fe,_0x268da3){return _0x43b6fe===_0x268da3;};const _0x4018de=_0x2aa4a4;function _0x41dcf4(_0xfd511d,_0x43dd54){return _0x35d151(_0xfd511d,_0x43dd54- -0x15f);}function _0x3191d9(_0x5dc931,_0x58c02a){return _0x35d151(_0x5dc931,_0x58c02a- -0x17a);}return Boolean(_0x927e8&&_0x4018de['VxHpk'](typeof _0x927e8,_0x41dcf4(_0x313626._0x54cfa8,0xe2))&&_0x927e8[_0x41dcf4(0x2ef,_0x313626._0x3f4ce6)]===!![]);}function hasAgentId(_0x4082a5,_0x6296f2){const _0x740e6e={_0x59d106:0x6b5,_0x1e60b2:0x4a6,_0x44ba93:0x762},_0x3e6d99={_0x560ec1:0x21c};function _0x12925f(_0x34c11f,_0x4bb2e0){return _0x35d151(_0x4bb2e0,_0x34c11f-0x348);}const _0x4e5407={};_0x4e5407[_0x35095a(0x34,0x2cc)]=function(_0x5e77ef,_0x480687){return _0x5e77ef===_0x480687;};function _0x35095a(_0x4d56e7,_0x2e8d5d){return _0x35d151(_0x4d56e7,_0x2e8d5d- -_0x3e6d99._0x560ec1);}const _0x571479=_0x4e5407;return Boolean(_0x4082a5&&typeof _0x4082a5===_0x12925f(0x589,_0x740e6e._0x59d106)&&_0x571479['VUTKF'](typeof _0x4082a5['id'],_0x12925f(_0x740e6e._0x1e60b2,_0x740e6e._0x44ba93))&&_0x4082a5['id'][_0x12925f(0x6cf,0x899)]()===_0x6296f2);}function readAgentName(_0x73bbe9){const _0x58bb4d={_0x51b056:0x20,_0x54b0ba:0xa9,_0x345a4d:0x28a,_0x3c7f1b:0xa7,_0x12c820:0x37f,_0x274055:0x245,_0x353754:0x2a9,_0x19673f:0x376,_0x4ac887:0x113,_0x1b88cb:0x245,_0x46daaa:0x136},_0x4bac4a={_0x46b000:0x414},_0x4aa1a2={_0x576201:0x34c},_0x56eaf3={};_0x56eaf3[_0x59ed69(-0xc0,_0x58bb4d._0x51b056)]=_0x59ed69(_0x58bb4d._0x54b0ba,_0x58bb4d._0x345a4d),_0x56eaf3[_0x265893(0x253,0x4ad)]=function(_0x1d40e5,_0x46d74f){return _0x1d40e5===_0x46d74f;};function _0x265893(_0x5b82c6,_0x375910){return _0x341e52(_0x375910- -_0x4aa1a2._0x576201,_0x5b82c6);}_0x56eaf3[_0x59ed69(0x171,0x2f2)]='string';const _0x117f21=_0x56eaf3;if(!_0x73bbe9||typeof _0x73bbe9!==_0x117f21['IYVtn'])return null;const _0x1fce3f=_0x73bbe9,_0x1dc8ca=_0x117f21['dicqH'](typeof _0x1fce3f[_0x265893(0x28f,_0x58bb4d._0x3c7f1b)]?.['name'],_0x117f21['OfhYu'])?_0x1fce3f[_0x265893(_0x58bb4d._0x12c820,0xa7)][_0x59ed69(_0x58bb4d._0x274055,_0x58bb4d._0x353754)]['trim']():'';if(_0x1dc8ca)return _0x1dc8ca;function _0x59ed69(_0x1fb3e9,_0xaf97ae){return _0x341e52(_0x1fb3e9- -_0x4bac4a._0x46b000,_0xaf97ae);}const _0x48fe79=_0x117f21[_0x59ed69(0x3e5,_0x58bb4d._0x19673f)](typeof _0x1fce3f['name'],_0x265893(_0x58bb4d._0x4ac887,0x8e))?_0x1fce3f[_0x59ed69(_0x58bb4d._0x1b88cb,_0x58bb4d._0x46daaa)][_0x59ed69(0x1ef,-_0x58bb4d._0x51b056)]():'';return _0x48fe79||null;}function buildPairingQrPayload(_0x5b7fc4){const _0x963870={_0x53e698:0x981,_0x11aec0:0xb2c,_0x279d7c:0x85e,_0x54b008:0xb27,_0x2e4ab8:0x7be,_0x3cb0cc:0xa32,_0x3ff823:0x96c,_0x36b617:0xa29,_0x497acc:0x965,_0x4d98d1:0x7f2,_0x1dfcb5:0xa44,_0x50061a:0xa97},_0x550b0d={};_0x550b0d['v']=0x2,_0x550b0d['k']='cp',_0x550b0d['s']=_0x5b7fc4[_0x315be5(_0x963870._0x53e698,_0x963870._0x11aec0)],_0x550b0d['g']=_0x5b7fc4['gatewayI'+'d'],_0x550b0d['a']=_0x5b7fc4[_0x315be5(0x5b7,0x7a5)+'de'],_0x550b0d['rb']=0x1;function _0x5d82ad(_0x28a7cc,_0x3917af){return _0x35d151(_0x3917af,_0x28a7cc-0x3a0);}_0x550b0d['pv']=0x2;function _0x315be5(_0x248cf4,_0x114372){return _0x35d151(_0x114372,_0x248cf4-0x437);}_0x550b0d['sb']=!![];const _0x19b2ea=_0x550b0d;return _0x5b7fc4['displayN'+_0x5d82ad(_0x963870._0x279d7c,_0x963870._0x54b008)]?.[_0x315be5(_0x963870._0x2e4ab8,0x631)]()&&(_0x19b2ea['n']=_0x5b7fc4['displayN'+_0x5d82ad(0x85e,_0x963870._0x3cb0cc)]['trim']()),_0x5b7fc4[_0x315be5(0x925,_0x963870._0x3ff823)]?.[_0x315be5(0x7be,_0x963870._0x36b617)]()&&(_0x19b2ea['t']=_0x5b7fc4[_0x315be5(0x925,_0x963870._0x497acc)]['trim']()),_0x5b7fc4[_0x5d82ad(0x7f2,0x554)]?.[_0x315be5(0x7be,0x8e6)]()&&(_0x19b2ea['p']=_0x5b7fc4[_0x5d82ad(_0x963870._0x4d98d1,_0x963870._0x1dfcb5)][_0x315be5(_0x963870._0x2e4ab8,0x780)]()),JSON[_0x315be5(0x933,_0x963870._0x50061a)+'y'](_0x19b2ea);}function buildGatewayQrPayload(_0x5a0133){const _0x205d5a={_0xb97e2d:0xfb,_0x33266e:0x404,_0xebef52:0x749,_0x297242:0x5c7,_0x22eee7:0x6d9,_0x335c88:0x68b,_0x3b3fa4:0x704,_0x868ea7:0x1ef,_0x43cbec:0x347,_0xacbe14:0x46,_0x5cf945:0x5a4,_0x5318cf:0x573,_0x5871d0:0x750,_0x4ac37b:0x481,_0x316fe4:0x6ec,_0xfd060f:0x40c,_0x348d6f:0x4d7,_0x1de85d:0x447,_0x3afd70:0x6ec,_0x88d07f:0x40c,_0x2fa985:0x581},_0x3d888a={_0x25dee4:0x85},_0x2f05db={};_0x2f05db[_0x328efc(_0x205d5a._0xb97e2d,_0x205d5a._0x33266e)]='gateway';function _0x4fc62e(_0x333a4c,_0x112498){return _0x35d151(_0x112498,_0x333a4c-_0x3d888a._0x25dee4);}const _0x1a6ad1=_0x2f05db,_0xc15c96=normalizeGatewayQrUrl(_0x5a0133[_0x4fc62e(_0x205d5a._0xebef52,0x7de)+'rl']),_0x30e6f0={'url':_0xc15c96[_0x328efc(0x734,0x657)],'host':_0xc15c96[_0x328efc(_0x205d5a._0x297242,_0x205d5a._0x22eee7)],'port':_0xc15c96[_0x328efc(_0x205d5a._0x335c88,_0x205d5a._0x3b3fa4)],'tls':_0xc15c96[_0x4fc62e(0x1c3,0x41d)],'mode':_0x1a6ad1[_0x4fc62e(_0x205d5a._0x868ea7,_0x205d5a._0x43cbec)],'expiresAt':_0x5a0133[_0x4fc62e(0x1f5,_0x205d5a._0xacbe14)+'t']??Date['now']()+0xa*0x3c*0x3e8,'qrVersion':0x2};_0x5a0133[_0x328efc(_0x205d5a._0x5cf945,0x788)]?.[_0x328efc(0x6b4,0x621)]()&&(_0x30e6f0[_0x4fc62e(_0x205d5a._0x5318cf,_0x205d5a._0x5871d0)]=_0x5a0133['token'][_0x328efc(_0x205d5a._0x4ac37b,0x621)]());_0x5a0133[_0x328efc(0x624,_0x205d5a._0x316fe4)]?.[_0x4fc62e(_0x205d5a._0xfd060f,0x38a)]()&&(_0x30e6f0[_0x4fc62e(_0x205d5a._0x348d6f,0x3ad)]=_0x5a0133[_0x328efc(_0x205d5a._0x1de85d,_0x205d5a._0x3afd70)][_0x4fc62e(_0x205d5a._0x88d07f,0x3a8)]());function _0x328efc(_0x55aa8e,_0x13b69b){return _0x35d151(_0x55aa8e,_0x13b69b-0x29a);}return JSON[_0x4fc62e(_0x205d5a._0x2fa985,0x59d)+'y'](_0x30e6f0);}function normalizeGatewayQrUrl(_0x5d1212){const _0x5f459d={_0xbd7a5f:0x28b,_0x584f1b:0x4b8,_0x2525a8:0xcc,_0x516227:0x153,_0x115f9:0x15a,_0x4fbe4b:0x1c,_0x31f967:0x244,_0x3b6699:0x15d,_0x335690:0x14e,_0x4ab515:0x585,_0x4e843d:0x6a0,_0x46ddff:0x671,_0x3005ae:0x58b,_0x29b564:0x460,_0x154c37:0x163,_0x3a71f8:0x564,_0x554117:0x1f,_0x55c99d:0x259,_0x6f6d2b:0x560,_0x4ea864:0x455,_0x144db9:0x18a,_0x184872:0x169,_0x54fdfb:0x1a2},_0x471c43={_0x1a86ed:0x55c},_0x3f084b={};_0x3f084b['mfObE']=function(_0x1f7f10,_0x4a189e){return _0x1f7f10===_0x4a189e;},_0x3f084b[_0x393ce0(_0x5f459d._0xbd7a5f,0x15a)]=_0x17b1e8(_0x5f459d._0x584f1b,0x55e),_0x3f084b['jIPGQ']=function(_0x2f9288,_0x5c0fb1){return _0x2f9288===_0x5c0fb1;};function _0x393ce0(_0x50dfa7,_0xb79067){return _0x341e52(_0xb79067- -_0x471c43._0x1a86ed,_0x50dfa7);}function _0x17b1e8(_0x334576,_0x52eb64){return _0x341e52(_0x52eb64- -0x15b,_0x334576);}const _0x5b0c61=_0x3f084b,_0x2e310f=new URL(_0x5d1212['trim']()),_0x89e810=_0x5b0c61[_0x393ce0(0xbd,_0x5f459d._0x2525a8)](_0x2e310f[_0x393ce0(-0x18f,_0x5f459d._0x516227)],_0x5b0c61[_0x393ce0(0x146,_0x5f459d._0x115f9)])||_0x5b0c61[_0x17b1e8(_0x5f459d._0x4fbe4b,_0x5f459d._0x31f967)](_0x2e310f[_0x17b1e8(0x7cc,0x554)],'https:'),_0x4553c9=_0x89e810?_0x393ce0(0x1d3,_0x5f459d._0x3b6699):_0x393ce0(-0x37,_0x5f459d._0x335690),_0x1ed1a1=_0x2e310f[_0x17b1e8(_0x5f459d._0x4ab515,0x45e)],_0x333e40=_0x2e310f[_0x17b1e8(_0x5f459d._0x4e843d,0x58b)]?Number(_0x2e310f[_0x17b1e8(_0x5f459d._0x46ddff,_0x5f459d._0x3005ae)]):_0x89e810?0x1bb:0x50,_0x121278=!_0x2e310f[_0x393ce0(_0x5f459d._0x29b564,_0x5f459d._0x154c37)]||_0x2e310f[_0x17b1e8(0x79b,0x564)]===''?'/':_0x2e310f[_0x17b1e8(0x2df,_0x5f459d._0x3a71f8)],_0x1ad746={};return _0x1ad746[_0x393ce0(-_0x5f459d._0x554117,0xdd)]=_0x4553c9+'//'+_0x1ed1a1+':'+_0x333e40+_0x121278,_0x1ad746[_0x17b1e8(_0x5f459d._0x55c99d,_0x5f459d._0x6f6d2b)]=_0x1ed1a1,_0x1ad746[_0x393ce0(_0x5f459d._0x4ea864,_0x5f459d._0x144db9)]=_0x333e40,_0x1ad746[_0x17b1e8(0x566,0x6d9)]=_0x121278,_0x1ad746[_0x393ce0(_0x5f459d._0x184872,-_0x5f459d._0x54fdfb)]=_0x89e810,_0x1ad746;}var DEFAULT_REGISTRY_BASE='https://'+_0x35d151(0x3cb,0x15f)+_0x341e52(0x8ed,0x7cb)+'.ai',DEFAULT_REGISTRY_FALLBACK_BASE='https://'+_0x341e52(0x540,0x80b)+_0x341e52(0x3db,0x326)+_0x341e52(0x8ed,0x881)+'.workers'+_0x35d151(0x417,0x3a9);async function pairGateway(_0x46835a){const _0x301935={_0x105275:0x47b,_0x28082e:0x2f3,_0x4764a9:0xc8,_0x5e6ec1:0x5d,_0x4e315e:0x1ea,_0x306095:0x24,_0x358a16:0x16b,_0x25e21a:0x21c,_0x44b34d:0x375,_0x5760eb:0x290,_0x1b385b:0x73,_0x7df648:0x11b,_0x46524a:0x4ea,_0x3add2e:0x318,_0x191b64:0x21a,_0x18a6df:0x4bc,_0x4bcdc2:0x6fe,_0x44fc25:0x6fe,_0x2b7424:0x528,_0x349e59:0x44c,_0xc442c6:0x151,_0x2220fa:0x67,_0x52a3d2:0x3c9,_0x47a146:0x36c,_0xf2d8ca:0x4a4,_0x3c0c83:0x447,_0x52cb83:0x300,_0xff845f:0x1e,_0x277096:0x28c,_0x581f35:0x22d,_0x23d4e9:0x96,_0x286e65:0x394,_0x1e5fee:0x222,_0x2eb8dd:0x7b,_0x37de7a:0xaf,_0xeb760a:0x40a,_0x5c4f47:0x35f,_0x57d098:0x4b9,_0x560dd1:0x3fb,_0x27736b:0x5c0,_0x27a23f:0x3b3,_0x59f879:0x4d0,_0x48455b:0x1a6,_0x746023:0x75,_0x54f3f5:0x490,_0x4970de:0x17c,_0x52c56a:0x260,_0x10b570:0x53,_0x4d51e1:0x32f,_0x562fe3:0x344,_0xf6531d:0x176,_0x23568a:0x284,_0x39a22e:0x1a,_0x5309ab:0x25c,_0x3aba73:0x101,_0x32f271:0x1ac,_0x56b148:0x1b9,_0x94242d:0x47f,_0xf86610:0xcd,_0x5317cb:0x14d,_0x1479f8:0x4e},_0x3c43f9={_0x1c32e5:0x23a},_0x82c7cd={'qqRAF':function(_0x4339f1,_0x5de1f2,_0xcaf9ff){return _0x4339f1(_0x5de1f2,_0xcaf9ff);},'EwXeu':_0x84cd97(_0x301935._0x105275,_0x301935._0x28082e)+'existing','ZuChv':function(_0x212d50,_0x581287){return _0x212d50(_0x581287);},'foUgj':_0x84cd97(_0x301935._0x4764a9,-0x8c),'QXDnZ':_0x203d6e(_0x301935._0x5e6ec1,_0x301935._0x4e315e)+_0x84cd97(0x152,-0xc)},_0x2a45de=normalizeHttpBase(_0x46835a[_0x203d6e(0x314,0x482)+'l']),_0x53a971=readPairingConfig();function _0x203d6e(_0x24c231,_0x351ab5){return _0x35d151(_0x24c231,_0x351ab5-0x2c);}const _0x30d460=_0x82c7cd[_0x203d6e(0x5fa,0x3f7)](assessPairingCompatibility,_0x53a971,_0x2a45de);function _0x84cd97(_0x369756,_0x3faad1){return _0x35d151(_0x3faad1,_0x369756- -_0x3c43f9._0x1c32e5);}if(_0x30d460===_0x82c7cd[_0x84cd97(_0x301935._0x306095,_0x301935._0x358a16)]&&_0x53a971){const _0x5dac29={};return _0x5dac29[_0x84cd97(_0x301935._0x25e21a,_0x301935._0x44b34d)+'l']=_0x53a971['serverUr'+'l'],_0x5dac29[_0x203d6e(0x4dc,0x555)+'d']=_0x53a971[_0x84cd97(0x2ef,0x548)+'d'],_0x5dac29[_0x203d6e(0x41d,_0x301935._0x5760eb)+_0x84cd97(0x73,0x147)]=_0x53a971['relaySec'+_0x84cd97(_0x301935._0x1b385b,-0x274)],_0x5dac29[_0x84cd97(_0x301935._0x7df648,0x21e)+_0x203d6e(0x56d,_0x301935._0x46524a)]=_0x46835a[_0x203d6e(0x394,0x381)+'ame'],_0x5dac29[_0x84cd97(_0x301935._0x3add2e,0x32c)+'oken']=_0x46835a['gatewayT'+_0x203d6e(0x1e,_0x301935._0x191b64)],_0x5dac29[_0x203d6e(0x5a3,_0x301935._0x18a6df)+_0x203d6e(0x9cb,_0x301935._0x4bcdc2)]=_0x46835a['gatewayP'+_0x203d6e(0x8e4,_0x301935._0x44fc25)],_0x82c7cd[_0x203d6e(_0x301935._0x2b7424,0x280)](refreshAccessCode,_0x5dac29);}if(_0x30d460===_0x84cd97(-0x7b,-0x34c)+_0x203d6e(0x54b,_0x301935._0x349e59))throw new Error(_0x84cd97(_0x301935._0xc442c6,_0x301935._0x2220fa)+'dge\x20is\x20a'+_0x84cd97(_0x301935._0x52a3d2,_0x301935._0x47a146)+'aired\x20wi'+_0x84cd97(_0x301935._0xf2d8ca,_0x301935._0x3c0c83)+_0x53a971?.[_0x84cd97(_0x301935._0x25e21a,-0x61)+'l']+(_0x84cd97(-0x89,-_0x301935._0x52cb83)+'lawket\x20r'+_0x84cd97(_0x301935._0xff845f,-_0x301935._0x277096)+_0x84cd97(_0x301935._0x581f35,_0x301935._0x23d4e9)+_0x84cd97(_0x301935._0x286e65,0x66d)+_0x84cd97(_0x301935._0x1e5fee,-_0x301935._0x2eb8dd)+_0x84cd97(-_0x301935._0x37de7a,-0xe1)+'rver.'));const _0x325e24=await postJsonWithCloudflareFallback(_0x2a45de+('/v1/pair'+_0x203d6e(0x357,_0x301935._0xeb760a)+'r'),{'method':_0x82c7cd[_0x84cd97(_0x301935._0x5c4f47,_0x301935._0x57d098)],'headers':{'content-type':_0x82c7cd[_0x203d6e(0x352,_0x301935._0x560dd1)],'accept':'applicat'+'ion/json'},'body':JSON[_0x203d6e(_0x301935._0x27736b,0x528)+'y']({'displayName':_0x46835a['displayN'+'ame']?.[_0x203d6e(0x4f2,_0x301935._0x27a23f)]()||null})});if(!_0x325e24[_0x84cd97(0x22a,_0x301935._0x59f879)]['ok'])throw await buildPairingRequestError(_0x84cd97(_0x301935._0x48455b,-_0x301935._0x746023)+'ister',_0x325e24);const _0x3ca618=await _0x325e24[_0x203d6e(0x38c,_0x301935._0x54f3f5)]['json'](),_0x32f23e=new Date()[_0x203d6e(_0x301935._0x4970de,0x273)+'ing'](),_0x14d9d0={'serverUrl':_0x2a45de,'gatewayId':_0x3ca618['gatewayI'+'d'],'relaySecret':_0x3ca618[_0x203d6e(_0x301935._0x52c56a,0x290)+_0x84cd97(0x73,_0x301935._0x10b570)],'relayUrl':_0x3ca618['relayUrl'],'instanceId':_0x53a971?.[_0x84cd97(_0x301935._0x4d51e1,_0x301935._0x562fe3)+'Id']??_0x203d6e(0x364,0x579)+_0x3ca618[_0x84cd97(0x2ef,_0x301935._0xf6531d)+'d'][_0x203d6e(0x430,0x1c2)](-0xa),'displayName':_0x3ca618[_0x203d6e(0x116,0x381)+_0x84cd97(_0x301935._0x23568a,-0x58)],'createdAt':_0x32f23e,'updatedAt':_0x32f23e};return _0x82c7cd[_0x84cd97(_0x301935._0x39a22e,_0x301935._0x4e315e)](writePairingConfig,_0x14d9d0),{'config':_0x14d9d0,'accessCode':_0x3ca618[_0x84cd97(-0xba,-_0x301935._0x5309ab)+'de'],'accessCodeExpiresAt':_0x3ca618[_0x203d6e(_0x301935._0x3aba73,_0x301935._0x32f271)+'deExpire'+_0x84cd97(0x1b9,_0x301935._0x56b148)],'action':_0x203d6e(_0x301935._0x94242d,0x241)+'ed','qrPayload':buildPairingQrPayload({'server':_0x2a45de,'gatewayId':_0x3ca618[_0x84cd97(0x2ef,0x238)+'d'],'accessCode':_0x3ca618[_0x84cd97(-0xba,-0x19b)+'de'],'displayName':_0x3ca618['displayN'+'ame'],'token':_0x46835a[_0x203d6e(0x71a,0x57e)+_0x203d6e(-_0x301935._0xf86610,0x21a)]?.[_0x84cd97(_0x301935._0x5317cb,_0x301935._0x1479f8)]()||null,'password':_0x46835a['gatewayP'+_0x84cd97(0x498,0x1f1)]?.[_0x84cd97(0x14d,0x39b)]()||null})};}async function refreshAccessCode(_0x19b370){const _0x195604={_0x10160a:0x470,_0x2f2fbb:0x387,_0x1857dd:0x53a,_0x112ac2:0x685,_0x389888:0x60d,_0x3c6670:0x800,_0xdafa3:0x508,_0x2c8679:0x65b,_0x30f59d:0x67f,_0x1eb7dc:0x580,_0xbe970:0x92a,_0x5d7b47:0x6ed,_0x426be4:0x767,_0x566763:0xa6a,_0x50d726:0x529,_0x32331a:0x21f,_0x2901cc:0xa90,_0x4f3fe4:0xb71,_0xbd277b:0x6f9,_0x2c0930:0x1c2,_0x29c719:0x1af,_0x3dc4a0:0x2fa,_0x89f75d:0x2e8,_0x2ba0a8:0x5a2,_0x115dac:0x754,_0x38f3f7:0x9b5,_0x527a22:0x39e,_0x47f4fb:0x479,_0x2a0073:0x3b4,_0x4bb7ca:0x548,_0x497fee:0x794,_0x148ad9:0x60d,_0x261505:0x12f,_0x322804:0x27a,_0x47c270:0xa83,_0x4ba9b4:0xccc,_0x47da81:0x4c,_0x4dcf8b:0x264,_0x395410:0x577,_0x108031:0x3ae,_0xc2cc6d:0x9cc,_0x34ed52:0x8bb,_0x410cbb:0x437,_0x33f370:0x733,_0x128fb0:0x574},_0x554927={_0x1013ae:0x3f7},_0x5ede80={'GQPfV':function(_0xc92a34,_0x5ad864,_0x27cf66){return _0xc92a34(_0x5ad864,_0x27cf66);},'WMCKN':_0x1de7b0(0x5b5,0x63e)+_0x4fd989(0x4a7,_0x195604._0x10160a),'JGEBJ':function(_0x49acc6,_0x416d3d){return _0x49acc6(_0x416d3d);}},_0x508d6d=readPairingConfig(),_0x48acce=normalizeHttpBase(_0x19b370?.['serverUr'+'l']??_0x508d6d?.[_0x4fd989(_0x195604._0x2f2fbb,_0x195604._0x1857dd)+'l']??''),_0x2700af=_0x19b370?.[_0x4fd989(_0x195604._0x112ac2,_0x195604._0x389888)+'d']??_0x508d6d?.[_0x1de7b0(0x920,_0x195604._0x3c6670)+'d']??'',_0x1026e2=_0x19b370?.['relaySec'+_0x4fd989(_0x195604._0xdafa3,0x391)]??_0x508d6d?.[_0x1de7b0(_0x195604._0x2c8679,_0x195604._0x30f59d)+'ret']??'';function _0x1de7b0(_0xec43de,_0x248856){return _0x35d151(_0x248856,_0xec43de-_0x554927._0x1013ae);}if(!_0x48acce||!_0x2700af||!_0x1026e2)throw new Error(_0x1de7b0(_0x195604._0x1eb7dc,0x5c8)+_0x1de7b0(_0x195604._0xbe970,0x7b5)+_0x4fd989(_0x195604._0x5d7b47,_0x195604._0x426be4)+'.\x20Run\x20pa'+_0x1de7b0(0x98f,_0x195604._0x566763)+'.');const _0xa341a9=await _0x5ede80['GQPfV'](postJsonWithCloudflareFallback,_0x48acce+(_0x4fd989(_0x195604._0x50d726,_0x195604._0x32331a)+_0x1de7b0(_0x195604._0x2901cc,_0x195604._0x4f3fe4)+_0x1de7b0(0x509,0x594)),{'method':_0x1de7b0(_0x195604._0xbd277b,0x4e4),'headers':{'content-type':_0x4fd989(0x492,0x2a2)+_0x4fd989(_0x195604._0x2c0930,0x470),'accept':_0x5ede80[_0x4fd989(_0x195604._0x29c719,_0x195604._0x3dc4a0)]},'body':JSON['stringif'+'y']({'gatewayId':_0x2700af,'relaySecret':_0x1026e2,'displayName':_0x19b370?.['displayN'+_0x4fd989(_0x195604._0x89f75d,_0x195604._0x2ba0a8)]?.['trim']()||void 0x0})});if(!_0xa341a9['response']['ok'])throw await _0x5ede80[_0x4fd989(0x46e,_0x195604._0x115dac)](buildPairingRequestError,_0x1de7b0(0x760,_0x195604._0x38f3f7)+'ode\x20refr'+_0x4fd989(_0x195604._0x527a22,_0x195604._0x47f4fb),_0xa341a9);const _0x4b165d=await _0xa341a9[_0x4fd989(_0x195604._0x2a0073,_0x195604._0x4bb7ca)][_0x1de7b0(0x5c5,0x886)]();function _0x4fd989(_0xf99ee8,_0x1b85b3){return _0x35d151(_0xf99ee8,_0x1b85b3-0xe4);}const _0x345615={'serverUrl':_0x48acce,'gatewayId':_0x4b165d[_0x4fd989(_0x195604._0x497fee,_0x195604._0x389888)+'d'],'relaySecret':_0x1026e2,'relayUrl':_0x4b165d['relayUrl'],'instanceId':_0x508d6d?.['instance'+'Id']??_0x4fd989(0x497,0x631)+_0x4b165d[_0x4fd989(0x87f,_0x195604._0x148ad9)+'d'][_0x4fd989(_0x195604._0x261505,_0x195604._0x322804)](-0xa),'displayName':_0x4b165d['displayN'+'ame'],'createdAt':_0x508d6d?.[_0x1de7b0(_0x195604._0x47c270,_0x195604._0x4ba9b4)+'t']??new Date()[_0x1de7b0(0x63e,0x80e)+_0x1de7b0(0x8c6,0x727)](),'updatedAt':new Date()[_0x4fd989(_0x195604._0x47da81,0x32b)+_0x4fd989(0x7d1,0x5b3)]()};return writePairingConfig(_0x345615),{'config':_0x345615,'accessCode':_0x4b165d[_0x4fd989(0x1d1,_0x195604._0x4dcf8b)+'de'],'accessCodeExpiresAt':_0x4b165d[_0x1de7b0(_0x195604._0x395410,_0x195604._0x108031)+'deExpire'+_0x4fd989(0x44b,0x4d7)],'action':_0x1de7b0(_0x195604._0xc2cc6d,_0x195604._0x34ed52)+'d','qrPayload':_0x5ede80[_0x1de7b0(0x722,0x87f)](buildPairingQrPayload,{'server':_0x48acce,'gatewayId':_0x4b165d['gatewayI'+'d'],'accessCode':_0x4b165d[_0x4fd989(_0x195604._0x410cbb,_0x195604._0x4dcf8b)+'de'],'displayName':_0x4b165d[_0x4fd989(0x50d,0x439)+'ame'],'token':_0x19b370?.['gatewayT'+_0x1de7b0(0x5e5,_0x195604._0x33f370)]?.['trim']()||null,'password':_0x19b370?.[_0x4fd989(0x54e,_0x195604._0x128fb0)+'assword']?.['trim']()||null})};}function normalizeHttpBase(_0x2dc61b){const _0x585f29={_0x5a33be:0x40f,_0x28483c:0x136,_0x436fed:0x55e,_0x1499d7:0xa5a,_0x31f26c:0x26f,_0x1ea7b1:0x427,_0x1fd673:0x9a8,_0x2c76df:0x7c8,_0x1457a3:0x49c,_0x3219b6:0x5d6,_0x38fc80:0x4dc,_0x21328e:0x36d,_0x2ff2ab:0x85b,_0x5e5f77:0x439,_0x33b9ce:0x442,_0x5ac92b:0x5b4,_0x4566f4:0x6b4,_0x248204:0x159,_0x37e20e:0x4a0},_0x31d491={};_0x31d491[_0x4b1aa3(0x349,_0x585f29._0x5a33be)]='https://',_0x31d491[_0x4b1aa3(_0x585f29._0x28483c,0x198)]=_0x4b1aa3(0x396,0xa8);const _0x299761=_0x31d491;function _0x4b1aa3(_0x3f5043,_0x321a52){return _0x341e52(_0x321a52- -0x2b9,_0x3f5043);}const _0x390b14=_0x2dc61b[_0xaa554f(0x7f5,_0x585f29._0x436fed)]();if(!_0x390b14)return'';if(_0x390b14[_0xaa554f(_0x585f29._0x1499d7,0x7c8)+'th'](_0x4b1aa3(0x207,_0x585f29._0x31f26c))||_0x390b14[_0x4b1aa3(0x5c5,0x5b4)+'th'](_0x299761[_0xaa554f(0x796,0x623)]))return _0x390b14[_0x4b1aa3(_0x585f29._0x1ea7b1,0x225)](/\/+$/,'');if(_0x390b14[_0xaa554f(_0x585f29._0x1fd673,_0x585f29._0x2c76df)+'th'](_0xaa554f(_0x585f29._0x1457a3,_0x585f29._0x3219b6)))return(_0x4b1aa3(0x2b7,_0x585f29._0x31f26c)+_0x390b14[_0xaa554f(_0x585f29._0x38fc80,_0x585f29._0x21328e)](_0xaa554f(_0x585f29._0x2ff2ab,_0x585f29._0x3219b6)['length']))[_0xaa554f(0x30e,_0x585f29._0x5e5f77)](/\/+$/,'');if(_0x390b14[_0x4b1aa3(_0x585f29._0x33b9ce,_0x585f29._0x5ac92b)+'th']('wss://'))return(_0xaa554f(0x4f6,_0x585f29._0x4566f4)+_0x390b14[_0x4b1aa3(-0x195,_0x585f29._0x248204)](_0x299761['SEGZo'][_0x4b1aa3(0x7d1,0x5b0)]))[_0xaa554f(0x2d0,0x439)](/\/+$/,'');function _0xaa554f(_0x1a3d92,_0x213b13){return _0x341e52(_0x213b13- -0xa5,_0x1a3d92);}return(_0x4b1aa3(0x2f9,_0x585f29._0x37e20e)+_0x390b14)[_0xaa554f(0x186,_0x585f29._0x5e5f77)](/\/+$/,'');}function assessPairingCompatibility(_0x54fed5,_0x1b1587){const _0x2c1c5a={_0x32554c:0x71,_0x549f85:0x6f4,_0x16762c:0x9d,_0x251fce:0x19a,_0x4a5517:0x18b},_0x59723f={_0x15ac11:0x4b7};function _0x22e89c(_0x732974,_0x425c89){return _0x341e52(_0x732974- -0x502,_0x425c89);}if(!_0x54fed5)return _0x22e89c(-_0x2c1c5a._0x32554c,0x1cf)+_0x22e89c(0x3b8,0x675);function _0x324e05(_0x1ca617,_0x2dc049){return _0x341e52(_0x2dc049- -_0x59723f._0x15ac11,_0x1ca617);}if(_0x54fed5['serverUr'+'l']===_0x1b1587)return _0x22e89c(0x42f,_0x2c1c5a._0x549f85)+_0x22e89c(-_0x2c1c5a._0x16762c,0x26d);return'server-m'+_0x22e89c(_0x2c1c5a._0x251fce,_0x2c1c5a._0x4a5517);}async function postJsonWithCloudflareFallback(_0x4a997e,_0x49de85){const _0x55e7b5={_0x470076:0x554,_0x10afb2:0x846,_0x449258:0x8c9,_0x114508:0x71b,_0x36e0bf:0x9d3},_0x58b39e={_0x1d06e8:0xb0};function _0x259dd3(_0x5082f3,_0x5417c6){return _0x341e52(_0x5082f3-_0x58b39e._0x1d06e8,_0x5417c6);}const _0x35756b={'NFGyT':function(_0x412896,_0x1738a1,_0x3ed790){return _0x412896(_0x1738a1,_0x3ed790);},'DQlpP':function(_0x2d381c,_0x1bab15,_0x2afc59){return _0x2d381c(_0x1bab15,_0x2afc59);}},_0x2c38a1=await fetch(_0x4a997e,_0x49de85),_0x4e7400=_0x35756b[_0x3183d3(_0x55e7b5._0x470076,_0x55e7b5._0x10afb2)](resolveCloudflareChallengeFallbackUrl,_0x4a997e,_0x2c38a1);if(!_0x4e7400){const _0x152519={};return _0x152519[_0x3183d3(0x883,0xa6d)]=_0x2c38a1,_0x152519[_0x259dd3(0x55d,0x5b5)+_0x3183d3(0x7c2,0x8a9)]=_0x4a997e,_0x152519[_0x3183d3(0x655,_0x55e7b5._0x449258)+'Url']=null,_0x152519;}function _0x3183d3(_0x135bc1,_0x4775){return _0x341e52(_0x135bc1-0x1a3,_0x4775);}return{'response':await _0x35756b[_0x3183d3(_0x55e7b5._0x114508,_0x55e7b5._0x36e0bf)](fetch,_0x4e7400,_0x49de85),'attemptedUrl':_0x4a997e,'fallbackUrl':_0x4e7400};}async function buildPairingRequestError(_0x48ce18,_0x3a950d){const _0x3bf9d7={_0x320e2f:0x119,_0x45f827:0xdd,_0x3c2d38:0x38,_0x25b7d1:0x30b,_0x54c191:0x319,_0x398254:0x617,_0x327df4:0x656,_0x4f1744:0x1bb,_0x4a42aa:0x141,_0x5b7db5:0x330,_0x5bb2c0:0x4a6,_0x27ab7f:0x115,_0x5c8ff1:0x222,_0x34bfda:0x99,_0x3f41f3:0x7b9,_0x477b26:0x73c,_0x55cf86:0x28d,_0x148779:0x47c,_0x5324de:0x26a,_0xec523e:0x242,_0xbf76b5:0x710,_0x5b5d8b:0x335,_0x4b16c5:0x74,_0x263bb4:0x22b,_0x1fa276:0x179,_0x107f19:0x241,_0x553048:0x13d,_0x55a247:0x247,_0x42516b:0x33,_0x5872e4:0x4c4,_0x567818:0x707,_0x208314:0x57,_0x123438:0x16f,_0x5118f4:0x547,_0x2ab195:0x56e,_0x92659d:0x3a3,_0x34abc8:0x40d,_0x50eb8b:0x153,_0x574ff9:0xe6},_0xfbff3a={_0x62a7ef:0xe3};function _0x5e11c8(_0x2915b5,_0x53ab1e){return _0x35d151(_0x53ab1e,_0x2915b5- -0x34f);}const _0x4cd4cb={'lPwjT':function(_0xd27c6b,_0xd95efd){return _0xd27c6b(_0xd95efd);}};if(_0x4cd4cb[_0x5e11c8(0x1a1,-0x79)](isCloudflareChallengeResponse,_0x3a950d[_0x5e11c8(0x115,-0x145)])){const _0x2dd3d8=new URL(_0x3a950d[_0x5e11c8(-_0x3bf9d7._0x320e2f,_0x3bf9d7._0x45f827)+'Url']??_0x3a950d[_0x3fd8be(0x314,_0x3bf9d7._0x3c2d38)+'dUrl'])[_0x5e11c8(-0x26f,-_0x3bf9d7._0x25b7d1)],_0x30bb9f=_0x3a950d[_0x3fd8be(_0x3bf9d7._0x54c191,_0x3bf9d7._0x398254)+_0x3fd8be(0x4a6,0x798)]?_0x5e11c8(0x37e,_0x3bf9d7._0x327df4)+_0x5e11c8(_0x3bf9d7._0x4f1744,-_0x3bf9d7._0x4a42aa)+_0x5e11c8(_0x3bf9d7._0x5b7db5,0x5de)+_0x3a950d['fallback'+_0x3fd8be(_0x3bf9d7._0x5bb2c0,0x4bb)]+(_0x3fd8be(0x5b8,0x62f)+_0x3fd8be(0x42f,0x3f4)+_0x3fd8be(0x4a8,0x283)+'hallenge'+'.'):'';return new Error(_0x48ce18+(_0x3fd8be(0x601,0x68f)+'(')+_0x3a950d[_0x5e11c8(_0x3bf9d7._0x27ab7f,_0x3bf9d7._0x5c8ff1)][_0x3fd8be(0x3a3,0x468)]+(_0x5e11c8(0xc8,-_0x3bf9d7._0x34bfda)+_0x3fd8be(_0x3bf9d7._0x3f41f3,_0x3bf9d7._0x477b26)+_0x3fd8be(_0x3bf9d7._0x55cf86,_0x3bf9d7._0x148779)+_0x5e11c8(_0x3bf9d7._0x5324de,0x1ad)+_0x3fd8be(0x38d,0x1f0)+_0x5e11c8(0x2b2,_0x3bf9d7._0xec523e)+_0x3fd8be(_0x3bf9d7._0xbf76b5,0x99a))+_0x2dd3d8+'.'+_0x30bb9f+(_0x5e11c8(_0x3bf9d7._0x5b5d8b,0x35a)+_0x3fd8be(0x772,0x5fb)+'fferent\x20'+_0x5e11c8(-_0x3bf9d7._0x4b16c5,_0x3bf9d7._0x263bb4)+'or\x20use\x20a'+_0x5e11c8(_0x3bf9d7._0x1fa276,_0x3bf9d7._0x107f19)+_0x5e11c8(-_0x3bf9d7._0x553048,-0x34f)+_0x3fd8be(_0x3bf9d7._0x55a247,_0x3bf9d7._0x42516b)+_0x3fd8be(_0x3bf9d7._0x5872e4,_0x3bf9d7._0x567818)+_0x5e11c8(_0x3bf9d7._0x208314,-_0x3bf9d7._0x123438)+'\x20browser'+_0x3fd8be(0x6cf,0x506)+'ation.'));}function _0x3fd8be(_0x325c8c,_0x446eb1){return _0x35d151(_0x446eb1,_0x325c8c-_0xfbff3a._0x62a7ef);}return new Error(_0x48ce18+(_0x5e11c8(0x1cf,0x285)+'(')+_0x3a950d[_0x3fd8be(_0x3bf9d7._0x5118f4,_0x3bf9d7._0x2ab195)][_0x3fd8be(_0x3bf9d7._0x92659d,_0x3bf9d7._0x34abc8)]+_0x3fd8be(0x2e8,0x290)+summarizeFailedResponse(await _0x3a950d['response'][_0x5e11c8(-_0x3bf9d7._0x50eb8b,_0x3bf9d7._0x574ff9)]()));}function isCloudflareChallengeResponse(_0x5a66be){const _0x4a2c9b={_0x4fc6e4:0x537,_0x46072c:0x267,_0x355612:0x673,_0x35fc79:0x3f9,_0x359e3d:0x218,_0x166ce4:0x3c7,_0x4e71dc:0x5e0,_0x47d9a8:0x6a1,_0x564761:0x7d0,_0x220b66:0x5f8,_0x2c06d0:0x8ad,_0x5a757:0x5b5};function _0x551d77(_0xd076bd,_0x4e98ad){return _0x35d151(_0x4e98ad,_0xd076bd-0x3e1);}const _0x3c0ae9={};_0x3c0ae9[_0x551d77(_0x4a2c9b._0x4fc6e4,0x486)]=function(_0x156f55,_0x2c071e){return _0x156f55===_0x2c071e;};function _0x5836c1(_0x5ef651,_0x1c594e){return _0x35d151(_0x1c594e,_0x5ef651-0x271);}_0x3c0ae9[_0x5836c1(0x3de,_0x4a2c9b._0x46072c)]=function(_0x406a20,_0x503b32){return _0x406a20===_0x503b32;},_0x3c0ae9[_0x5836c1(0x660,0x517)]=_0x5836c1(_0x4a2c9b._0x355612,0x6df)+_0x5836c1(_0x4a2c9b._0x35fc79,_0x4a2c9b._0x359e3d);const _0x54034f=_0x3c0ae9;return _0x54034f[_0x5836c1(_0x4a2c9b._0x166ce4,_0x4a2c9b._0x4e71dc)](_0x5a66be[_0x551d77(_0x4a2c9b._0x47d9a8,0x556)],0x193)&&_0x54034f[_0x551d77(0x54e,0x6cb)](_0x5a66be[_0x551d77(0x7ca,0x514)]['get'](_0x54034f[_0x551d77(_0x4a2c9b._0x564761,0x746)])?.[_0x5836c1(_0x4a2c9b._0x220b66,0x73e)]()[_0x5836c1(_0x4a2c9b._0x2c06d0,_0x4a2c9b._0x5a757)+'ase'](),_0x551d77(0x972,0x751)+'e');}function resolveCloudflareChallengeFallbackUrl(_0x5df21f,_0xc8e128){const _0x599932={_0x7e7d29:0x2ca,_0x2f0259:0x3f8,_0x34bba6:0x5e1,_0x157456:0x20d},_0x13c33b={_0x23d983:0x18};function _0x1eabdf(_0x34a6d0,_0x1b9a80){return _0x35d151(_0x1b9a80,_0x34a6d0-0xea);}const _0xa8de05={'sYjRY':function(_0x260e2e,_0x4fd913){return _0x260e2e(_0x4fd913);},'jbufU':function(_0x2ad2cb,_0x424bda){return _0x2ad2cb!==_0x424bda;}};if(!_0xa8de05[_0x1eabdf(_0x599932._0x7e7d29,_0x599932._0x2f0259)](isCloudflareChallengeResponse,_0xc8e128))return null;const _0x1d2fe7=new URL(_0x5df21f);function _0x54b33d(_0x46ae9f,_0x5344d0){return _0x35d151(_0x46ae9f,_0x5344d0-_0x13c33b._0x23d983);}if(_0xa8de05[_0x1eabdf(0x327,_0x599932._0x34bba6)](_0x1d2fe7['origin'],DEFAULT_REGISTRY_BASE))return null;return''+DEFAULT_REGISTRY_FALLBACK_BASE+_0x1d2fe7[_0x54b33d(_0x599932._0x157456,0x45b)]+_0x1d2fe7[_0x54b33d(0x78d,0x528)];}function summarizeFailedResponse(_0x2e0424){const _0x4e68c4={_0x4de2b9:0x850,_0x1b13df:0x709,_0x5d8e22:0x619,_0x52edd9:0x942,_0x116de2:0x4a9,_0xb885f7:0x590},_0x23b700={_0xfcccab:0x3b7};function _0x22a534(_0x57dca1,_0x4d82ad){return _0x35d151(_0x4d82ad,_0x57dca1-0x224);}const _0x3afdfa={};_0x3afdfa[_0x22a534(_0x4e68c4._0x4de2b9,_0x4e68c4._0x1b13df)]=function(_0x1bc85d,_0x3170af){return _0x1bc85d<=_0x3170af;};const _0x51bc75=_0x3afdfa,_0x4f5315=_0x2e0424[_0x1bf47e(0x428,_0x4e68c4._0x5d8e22)](/\s+/g,'\x20')[_0x1bf47e(_0x4e68c4._0x52edd9,0x73e)]();function _0x1bf47e(_0x568499,_0x13bd75){return _0x35d151(_0x568499,_0x13bd75-_0x23b700._0xfcccab);}if(!_0x4f5315)return _0x22a534(_0x4e68c4._0x116de2,0x252)+_0x1bf47e(_0x4e68c4._0xb885f7,0x612)+_0x1bf47e(0x6d0,0x946);if(_0x51bc75[_0x1bf47e(0xbcc,0x9e3)](_0x4f5315[_0x1bf47e(0x98f,0x9a4)],0xf0))return _0x4f5315;return _0x4f5315['slice'](0x0,0xed)+'...';}import{execFileSync,spawn}from'child_process';import{chmodSync,closeSync,existsSync as _0xf90435,mkdirSync as _0x4fd96b,openSync,readFileSync as _0x3f080b,realpathSync,rmSync as _0x26bed0,writeFileSync as _0x162251}from'fs';import{homedir as _0x4846ad}from'os';import{dirname,join as _0x5de2bf}from'path';import{setTimeout as _0x55d728}from'timers/promises';var SERVICE_LABEL=_0x341e52(0x356,0x4e4)+_0x35d151(0x65d,0x51f)+'e.cli',SYSTEMD_UNIT_NAME=SERVICE_LABEL+'.service',WINDOWS_RUN_KEY=_0x35d151(-0x1ad,0x151)+_0x341e52(0x6b7,0x7cf),SERVICE_DIR=_0x5de2bf(_0x4846ad(),_0x341e52(0x8ed,0xa44)),LOG_DIR=_0x5de2bf(SERVICE_DIR,_0x35d151(0x3ff,0x55e)),SERVICE_STATE_PATH=_0x5de2bf(SERVICE_DIR,_0x341e52(0x72d,0x94e)+'ervice.j'+_0x341e52(0x809,0x695)),RUNTIME_REGISTRY_PATH=_0x5de2bf(SERVICE_DIR,_0x341e52(0x353,0x456)+_0x35d151(0x850,0x5d3)+_0x341e52(0x827,0x8d4)+_0x341e52(0x4e7,0x4de)),SERVICE_LAUNCHER_PATH=_0x5de2bf(SERVICE_DIR,'clawket-'+_0x35d151(-0x127,0x102)+_0x341e52(0x857,0x759)),LINUX_CRON_RECORD_PATH=_0x5de2bf(SERVICE_DIR,_0x341e52(0x72d,0x585)+'ervice.c'+_0x341e52(0x7c2,0x7a3)),SERVICE_LOG_PATH=_0x5de2bf(LOG_DIR,_0x35d151(0x402,0x3d5)+_0x35d151(0x602,0x330)),SERVICE_ERROR_LOG_PATH=_0x5de2bf(LOG_DIR,_0x35d151(0x64f,0x3d5)+_0x341e52(0x3a8,0xf8)+_0x341e52(0x645,0x445)),MACOS_PLIST_PATH=_0x5de2bf(_0x4846ad(),_0x35d151(0x44a,0x588),'LaunchAg'+_0x35d151(0x956,0x6b3),SERVICE_LABEL+_0x35d151(0x3cc,0x4f8)),LINUX_SERVICE_PATH=_0x5de2bf(_0x4846ad(),_0x341e52(0x93b,0x6c8),_0x35d151(0x37c,0x227),_0x35d151(0x50b,0x640),SYSTEMD_UNIT_NAME),LINUX_CRON_MARKER='#\x20clawke'+_0x341e52(0x730,0x76d)+'-cli';function getServiceProgramArgs(_0x2d3f9f={},_0x5817b0=process[_0x341e52(0x8f3,0x86b)]){const _0x93468={_0x3586fb:0x89,_0x3a0e90:0x1f8,_0x144322:0x4c,_0xfe16eb:0x35,_0x23cd53:0x67f,_0x32a32f:0x785,_0x8669c1:0x88a,_0x18dcf2:0x83c,_0x3ee089:0x5b0,_0x525570:0x263,_0x5327f5:0x1,_0x114e1a:0xa71,_0x5f2544:0x9ed};function _0x80317(_0x4ec196,_0x3f3d81){return _0x35d151(_0x4ec196,_0x3f3d81-0x37c);}const _0x370135={'iiZVC':function(_0x231498,_0x176a2b){return _0x231498(_0x176a2b);},'NKWHb':_0x322c16(0x3d7,0x6b5)},_0x124b5d=_0x2d3f9f['nodePath']?.[_0x322c16(_0x93468._0x3586fb,_0x93468._0x3a0e90)]()||process['execPath'];function _0x322c16(_0x4bdd8b,_0x42fb44){return _0x35d151(_0x42fb44,_0x4bdd8b- -0x2fe);}const _0x904a30=resolveScriptPath(_0x2d3f9f[_0x322c16(_0x93468._0x144322,_0x93468._0xfe16eb)+'th']);if(!_0x904a30)throw new Error('Unable\x20t'+'o\x20resolv'+'e\x20CLI\x20sc'+_0x80317(_0x93468._0x23cd53,_0x93468._0x32a32f)+_0x80317(0x8a4,_0x93468._0x8669c1)+_0x322c16(0x255,-0x5a)+_0x80317(_0x93468._0x18dcf2,0x9ac)+_0x80317(_0x93468._0x3ee089,0x60b));if(_0x5817b0!==_0x322c16(0x70,-_0x93468._0x525570)){const _0x4d065c={};_0x4d065c[_0x322c16(-_0x93468._0x5327f5,-0x17d)]=_0x124b5d,_0x4d065c['scriptPa'+'th']=_0x904a30,_0x4d065c[_0x80317(_0x93468._0x114e1a,0xa37)]=process.env.PATH??'';const _0x30171e=_0x370135['iiZVC'](writeServiceLauncher,_0x4d065c);return ensureLaunchScriptExecutable(_0x30171e,_0x5817b0),[_0x30171e];}return[_0x124b5d,_0x904a30,_0x370135[_0x80317(0xae8,0x96b)],_0x80317(_0x93468._0x5f2544,0xa4c)+'e'];}function getServiceStatus(){const _0x4d9a52={_0x5a8920:0x70,_0x1bc0f3:0x116,_0x207691:0x135,_0x2fbd4a:0x511,_0x24fc89:0x483,_0x525f05:0x201,_0x48a589:0x757,_0x35e11d:0x489,_0x5b1335:0x793,_0x2c986b:0x42d,_0x465d39:0x4f2,_0x1cf42e:0x440,_0x21cc12:0x5e,_0x18d286:0x434,_0x3de316:0x691,_0x3eccfa:0x4e3,_0x28d406:0x27a,_0x4b911b:0x78a,_0x3d5283:0x46e,_0x289f01:0x4af,_0x439878:0x4f2,_0x1a3c08:0x46c,_0x1e6e0b:0xfb,_0x332da4:0x491,_0x4a708f:0x14f,_0x26549e:0x42c,_0x32933e:0x529,_0x2b0e46:0x793,_0x2b87ab:0x3a4,_0xa74adb:0x651,_0x4cff5d:0x524,_0x42dede:0x6f9},_0x33d5f6={'ISfMa':function(_0x53734e,_0x497d63){return _0x53734e!=_0x497d63;},'xZQvQ':function(_0xa7bd97,_0xbd4a3){return _0xa7bd97(_0xbd4a3);},'TgPCd':_0x3a6e0d(-0x1c4,_0x4d9a52._0x5a8920)+_0x3a6e0d(_0x4d9a52._0x1bc0f3,_0x4d9a52._0x207691),'aqIBV':function(_0x18e1ef,_0x1f4533,_0xd1e16b){return _0x18e1ef(_0x1f4533,_0xd1e16b);}};function _0x3081fb(_0x5e4f5a,_0x1f09f5){return _0x341e52(_0x5e4f5a- -0x99,_0x1f09f5);}function _0x3a6e0d(_0x40a1e5,_0x5db374){return _0x341e52(_0x5db374- -0x33a,_0x40a1e5);}ensureServiceDirs();const _0x493076=readServiceState()?.[_0x3081fb(0x724,0x97f)]??null,_0x5c3ceb=detectServiceMethod(),_0x4ab7be={'installed':![],'running':_0x33d5f6['ISfMa'](_0x493076,null)&&isPidRunning(_0x493076),'method':_0x5c3ceb,'servicePath':getServicePath(_0x5c3ceb),'logPath':SERVICE_LOG_PATH,'errorLogPath':SERVICE_ERROR_LOG_PATH,'pid':_0x493076};_0x4ab7be[_0x3a6e0d(_0x4d9a52._0x2fbd4a,_0x4d9a52._0x24fc89)]!=null&&!_0x4ab7be[_0x3a6e0d(_0x4d9a52._0x525f05,0x193)]&&(clearServiceState(_0x4ab7be['pid']),_0x4ab7be[_0x3a6e0d(0x2a6,_0x4d9a52._0x24fc89)]=null);switch(_0x4ab7be[_0x3081fb(_0x4d9a52._0x48a589,0x707)]){case _0x3081fb(_0x4d9a52._0x35e11d,0x6ee)+'ent':_0x4ab7be[_0x3081fb(_0x4d9a52._0x5b1335,0x5a2)+'d']=_0xf90435(MACOS_PLIST_PATH);_0x4ab7be[_0x3a6e0d(_0x4d9a52._0x2c986b,_0x4d9a52._0x465d39)+'d']&&(_0x4ab7be['running']=commandSucceeds(_0x3081fb(0x2f1,_0x4d9a52._0x1cf42e)+'l',[_0x3a6e0d(-0xce,_0x4d9a52._0x21cc12),SERVICE_LABEL])||_0x4ab7be[_0x3081fb(_0x4d9a52._0x18d286,_0x4d9a52._0x3de316)]);return _0x4ab7be;case _0x3a6e0d(_0x4d9a52._0x3eccfa,_0x4d9a52._0x28d406)+'user':_0x4ab7be[_0x3a6e0d(_0x4d9a52._0x4b911b,0x4f2)+'d']=_0x33d5f6[_0x3081fb(_0x4d9a52._0x3d5283,_0x4d9a52._0x289f01)](_0xf90435,LINUX_SERVICE_PATH);_0x4ab7be[_0x3a6e0d(0x3b1,_0x4d9a52._0x439878)+'d']&&(_0x4ab7be[_0x3081fb(0x434,_0x4d9a52._0x1a3c08)]=commandSucceeds('systemct'+'l',['--user',_0x3a6e0d(0x862,0x581)+'e',_0x3a6e0d(-0x26,_0x4d9a52._0x1e6e0b),SYSTEMD_UNIT_NAME])||_0x4ab7be[_0x3081fb(0x434,0x4bc)]);return _0x4ab7be;case _0x33d5f6[_0x3a6e0d(0x786,_0x4d9a52._0x332da4)]:_0x4ab7be[_0x3081fb(0x793,0x5b3)+'d']=hasLinuxCronRegistration();return _0x4ab7be;case _0x3a6e0d(_0x4d9a52._0x4a708f,_0x4d9a52._0x26549e)+_0x3a6e0d(0x6ae,_0x4d9a52._0x32933e)+'stry':_0x4ab7be[_0x3081fb(_0x4d9a52._0x2b0e46,0x601)+'d']=_0x33d5f6[_0x3081fb(0x55a,0x64b)](commandSucceeds,_0x3081fb(_0x4d9a52._0x2b87ab,0x1dc),[_0x3a6e0d(_0x4d9a52._0xa74adb,_0x4d9a52._0x4cff5d),_0x3081fb(0x7fa,0x6df)+'tware\x5cMi'+'crosoft\x5c'+_0x3081fb(0x894,0x95f)+'CurrentV'+_0x3081fb(_0x4d9a52._0x42dede,0x495)+'un','/v',WINDOWS_RUN_KEY]);return _0x4ab7be;default:return _0x4ab7be;}}function installService(_0x53f0dd={}){const _0x3cd0ac={_0x3222ef:0xb2b,_0x1a6a2c:0x8f9,_0x58aa3a:0x5b0,_0x54184f:0x504,_0x6c92be:0x60f,_0x31ccdf:0x432,_0x640b6c:0x187,_0x4a47e3:0x7ff,_0x29a183:0x5de,_0x5e2049:0xa4c,_0x51eb85:0xa7b,_0x312b17:0x2b7,_0x407f0c:0x9e8,_0x375425:0x5b7,_0x4aba59:0xd9,_0x509441:0xa05,_0x1d6340:0x2d9,_0x16b149:0x958,_0x41256b:0xa6d},_0x1df701={_0x5ba10c:0x99};function _0x1815c5(_0x405470,_0x3052ea){return _0x35d151(_0x405470,_0x3052ea-0x3f6);}const _0x3a2296={};_0x3a2296[_0x1815c5(_0x3cd0ac._0x3222ef,0x98b)]=_0x16b53c(0x3c1,0x364),_0x3a2296[_0x1815c5(_0x3cd0ac._0x1a6a2c,0x863)]=_0x1815c5(_0x3cd0ac._0x58aa3a,_0x3cd0ac._0x54184f)+'l',_0x3a2296[_0x1815c5(_0x3cd0ac._0x6c92be,0x695)]='load',_0x3a2296['Mwftn']=_0x16b53c(_0x3cd0ac._0x31ccdf,_0x3cd0ac._0x640b6c),_0x3a2296[_0x16b53c(0x1db,0x32f)]=_0x1815c5(_0x3cd0ac._0x4a47e3,0xa7f);const _0x36d3f1=_0x3a2296;ensureServiceDirs();const _0x522aca=getServiceProgramArgs(_0x53f0dd);switch(process[_0x16b53c(0x7cc,_0x3cd0ac._0x29a183)]){case _0x1815c5(0xbd5,_0x3cd0ac._0x5e2049):_0x162251(MACOS_PLIST_PATH,buildMacosPlist(_0x522aca,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH),_0x36d3f1[_0x1815c5(_0x3cd0ac._0x51eb85,0x98b)]),execIgnoreFailure(_0x36d3f1[_0x16b53c(0x4a6,0x3d4)],[_0x1815c5(0x4e1,0x65d),'-w',MACOS_PLIST_PATH]);const _0x515df1={};_0x515df1['stdio']=_0x16b53c(0x48a,0x559),execFileSync('launchct'+'l',[_0x36d3f1[_0x16b53c(_0x3cd0ac._0x312b17,0x206)],'-w',MACOS_PLIST_PATH],_0x515df1);break;case _0x36d3f1['Mwftn']:installLinuxService(_0x522aca);break;case _0x16b53c(0x8e,0x2d5):stopRunningProcess();const _0x42cad0={};_0x42cad0['stdio']=_0x1815c5(0xcea,_0x3cd0ac._0x407f0c),execFileSync(_0x1815c5(0x797,_0x3cd0ac._0x375425),[_0x36d3f1['IPQER'],_0x16b53c(0x34f,0x57e)+_0x16b53c(0x62,_0x3cd0ac._0x4aba59)+_0x1815c5(0x314,0x603)+_0x16b53c(0x830,0x618)+_0x1815c5(0xba6,_0x3cd0ac._0x509441)+'ersion\x5cR'+'un','/v',WINDOWS_RUN_KEY,'/t',_0x16b53c(_0x3cd0ac._0x1d6340,0x38a),'/d',buildWindowsRunCommand(_0x522aca),'/f'],_0x42cad0),startDetachedWindowsService(_0x522aca);break;default:throw new Error(_0x1815c5(0x540,0x844)+'ted\x20plat'+_0x1815c5(0x34f,0x5a1)+_0x16b53c(0x208,0x4de)+'vice\x20ins'+'tallatio'+'n:\x20'+process[_0x1815c5(_0x3cd0ac._0x16b149,_0x3cd0ac._0x41256b)]);}function _0x16b53c(_0x3a5abb,_0x1537b2){return _0x35d151(_0x3a5abb,_0x1537b2- -_0x1df701._0x5ba10c);}return getServiceStatus();}function restartService(_0x2d5301={}){const _0xa21b6c={_0x4981b3:0x1d,_0x20e5c6:0x6e2,_0x59fb37:0x23c,_0x561b31:0x9d,_0x25f181:0x4fe,_0x21f93a:0x3b2,_0x432984:0x50,_0x3523ab:0xf3,_0x134bf5:0x74e,_0x1bcea2:0x211,_0x4682f9:0x415,_0x267a1e:0x1f0,_0x41e6c8:0x102,_0x230a45:0x19d,_0x587a1c:0x641,_0x50822b:0x506,_0x4dc717:0x134,_0x4bd945:0x2c6,_0x4f19d9:0x37,_0x1e9979:0x57,_0x1a9977:0x337,_0x3b8d1d:0x5d,_0x121788:0x33d,_0x12b36d:0x475},_0x183f62={_0x20463c:0x202};function _0xacfd81(_0x248548,_0x386150){return _0x35d151(_0x248548,_0x386150- -0x70);}const _0x332c4f={'dqfGB':function(_0x24db3c,_0x4f605c,_0xafd7ac,_0x3c636c){return _0x24db3c(_0x4f605c,_0xafd7ac,_0x3c636c);},'XONhO':function(_0x5b0fae,_0x3f2ccf,_0x2891bf,_0x3b01d2){return _0x5b0fae(_0x3f2ccf,_0x2891bf,_0x3b01d2);},'HqgdL':_0x878456(0x513,0x3f0),'GFbeL':_0x878456(_0xa21b6c._0x4981b3,0x1e),'ffPis':_0x878456(0xa9,0x16c),'jCoEh':function(_0x1c925d,_0x1a78e6){return _0x1c925d(_0x1a78e6);}};function _0x878456(_0x48d290,_0x33384e){return _0x35d151(_0x48d290,_0x33384e- -_0x183f62._0x20463c);}ensureServiceDirs();const _0x20067c=getServiceProgramArgs(_0x2d5301);switch(process[_0x878456(_0xa21b6c._0x20e5c6,0x475)]){case _0x878456(0x5f7,0x454):if(!_0xf90435(MACOS_PLIST_PATH))return installService(_0x2d5301);_0x332c4f[_0xacfd81(-_0xa21b6c._0x59fb37,_0xa21b6c._0x561b31)](_0x162251,MACOS_PLIST_PATH,_0x332c4f[_0xacfd81(_0xa21b6c._0x25f181,_0xa21b6c._0x21f93a)](buildMacosPlist,_0x20067c,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH),_0xacfd81(0x3b6,0x38d)),execIgnoreFailure('launchct'+'l',['unload','-w',MACOS_PLIST_PATH]),_0x332c4f['XONhO'](execFileSync,_0x878456(-0x2b5,-0xf4)+'l',[_0xacfd81(0x73b,0x510),'-w',MACOS_PLIST_PATH],{'stdio':_0x332c4f[_0xacfd81(_0xa21b6c._0x432984,0xe0)]});break;case _0x332c4f['GFbeL']:restartLinuxService(_0x20067c);break;case _0x332c4f[_0xacfd81(0x231,_0xa21b6c._0x3523ab)]:stopRunningProcess();const _0x1f5a22={};_0x1f5a22[_0x878456(_0xa21b6c._0x134bf5,0x4d1)]='ignore',execFileSync('reg',['add',_0x878456(_0xa21b6c._0x1bcea2,_0xa21b6c._0x4682f9)+_0xacfd81(-_0xa21b6c._0x267a1e,_0xa21b6c._0x41e6c8)+_0xacfd81(0x2ff,_0xa21b6c._0x230a45)+_0xacfd81(0x4e7,_0xa21b6c._0x587a1c)+'CurrentV'+_0x878456(_0xa21b6c._0x50822b,0x314)+'un','/v',WINDOWS_RUN_KEY,'/t','REG_SZ','/d',buildWindowsRunCommand(_0x20067c),'/f'],_0x1f5a22),_0x332c4f[_0xacfd81(-0x107,_0xa21b6c._0x4dc717)](startDetachedWindowsService,_0x20067c);break;default:throw new Error(_0x878456(0x4c9,0x24c)+_0x878456(_0xa21b6c._0x4bd945,_0xa21b6c._0x4f19d9)+_0x878456(0x69,-_0xa21b6c._0x1e9979)+_0xacfd81(0x80b,0x507)+_0x878456(0x5a2,_0xa21b6c._0x1a9977)+_0x878456(0x27b,-_0xa21b6c._0x3b8d1d)+process[_0x878456(_0xa21b6c._0x121788,_0xa21b6c._0x12b36d)]);}return getServiceStatus();}async function startTransientRuntime(_0x432602={}){const _0x4172ea={_0x900835:0xc0,_0x561eb8:0x404,_0x2b1aed:0xd9,_0x11aa52:0x3a7,_0x3bbb72:0x3b5,_0x48f0fc:0x522,_0x573ce9:0x267},_0x3fbb01={_0x516726:0x160},_0x5f5c32={'UVbwb':function(_0x495222){return _0x495222();}};function _0x4d8e46(_0xb54c2a,_0x3eec7c){return _0x35d151(_0x3eec7c,_0xb54c2a-0x35f);}_0x5f5c32['UVbwb'](ensureServiceDirs);function _0x3e90e4(_0x4db0e3,_0x4b4688){return _0x35d151(_0x4db0e3,_0x4b4688- -_0x3fbb01._0x516726);}const _0x5c485f=getServiceProgramArgs(_0x432602);switch(process[_0x3e90e4(0x6fa,0x517)]){case _0x4d8e46(0x9b5,0xc21):case _0x3e90e4(-0x73,_0x4172ea._0x900835):startDetachedPosixService(_0x5c485f);break;case _0x3e90e4(_0x4172ea._0x561eb8,0x20e):startDetachedWindowsService(_0x5c485f);break;default:throw new Error('Unsuppor'+_0x3e90e4(-0x57,_0x4172ea._0x2b1aed)+_0x4d8e46(0x50a,_0x4172ea._0x11aa52)+_0x3e90e4(_0x4172ea._0x3bbb72,_0x4172ea._0x48f0fc)+_0x4d8e46(0x4fb,0x358)+'untime\x20s'+_0x4d8e46(0x504,_0x4172ea._0x573ce9)+process['platform']);}return _0x5f5c32[_0x4d8e46(0x915,0xa35)](waitForRuntimeState);}function uninstallService(){const _0x1a78d1={_0x4f1709:0x6af,_0x22b062:0xd3,_0x106b74:0x8cf,_0x257c80:0x321,_0x22dfbf:0x1ae,_0x1a80b2:0x22f,_0x199672:0x4e4,_0x3914e7:0x9b8,_0xf5fb15:0x138,_0x5867d6:0x450,_0x20130c:0x7ae,_0x21171a:0x810,_0x3f4ca5:0x58c,_0x35bbce:0x701,_0x35bb67:0x737},_0x33bb5b={'aklsg':'darwin','nbCxU':'unload','iQoha':_0x343019(0x17d,0x43e),'CDykV':'systemct'+'l','RDgdq':_0x343019(0x5eb,_0x1a78d1._0x4f1709),'ExDkX':'disable','XskEv':function(_0x47f19d,_0xaf304){return _0x47f19d(_0xaf304);},'BBEwg':_0x343019(0x81e,0x835)+'tware\x5cMi'+_0x5a3100(-0x149,_0x1a78d1._0x22b062)+_0x343019(0x6f7,_0x1a78d1._0x106b74)+'CurrentV'+'ersion\x5cR'+'un'};stopRunningProcess();switch(process[_0x5a3100(_0x1a78d1._0x257c80,_0x1a78d1._0x22dfbf)]){case _0x33bb5b['aklsg']:execIgnoreFailure(_0x343019(_0x1a78d1._0x1a80b2,0x32c)+'l',[_0x33bb5b['nbCxU'],'-w',MACOS_PLIST_PATH]),rmIfExists(MACOS_PLIST_PATH);break;case _0x33bb5b[_0x343019(_0x1a78d1._0x199672,0x324)]:_0xf90435(LINUX_SERVICE_PATH)&&(execIgnoreFailure(_0x33bb5b[_0x343019(_0x1a78d1._0x3914e7,0x804)],[_0x33bb5b['RDgdq'],_0x33bb5b[_0x5a3100(_0x1a78d1._0xf5fb15,0x138)],'--now',SYSTEMD_UNIT_NAME]),_0x33bb5b[_0x343019(0x1e4,_0x1a78d1._0x5867d6)](rmIfExists,LINUX_SERVICE_PATH),execIgnoreFailure(_0x343019(0x9b3,_0x1a78d1._0x20130c)+'l',[_0x5a3100(0x13b,0x43d),'daemon-r'+_0x5a3100(-0xe0,-0x9c)]));removeLinuxCronRegistration();break;case _0x343019(_0x1a78d1._0x21171a,_0x1a78d1._0x3f4ca5):execIgnoreFailure('reg',[_0x343019(_0x1a78d1._0x35bbce,_0x1a78d1._0x35bb67),_0x33bb5b['BBEwg'],'/v',WINDOWS_RUN_KEY,'/f']);break;default:break;}clearServiceState();function _0x343019(_0x147414,_0x14d1c3){return _0x341e52(_0x14d1c3- -0x5e,_0x147414);}function _0x5a3100(_0x5cbc5a,_0x5ef0cb){return _0x341e52(_0x5cbc5a- -0x5d2,_0x5ef0cb);}return getServiceStatus();}function stopService(){const _0x49ce77={_0xcd94ed:0x612,_0x4d3785:0x46c,_0x1131ef:0x6e7,_0x11b436:0x62b,_0x1376c0:0x767,_0x12f0b5:0xd1,_0x37cb9e:0x510,_0x57058f:0x737,_0x362655:0x459,_0x386975:0x1f5,_0x3d42ae:0x3d1,_0x391e1c:0xa77,_0x3b616b:0x49e},_0xb7a333={_0x1e1bcc:0x3ab};function _0x2b7104(_0x3d08b3,_0x5b1500){return _0x35d151(_0x3d08b3,_0x5b1500- -0x2b);}const _0x280b6a={'yPVsc':function(_0x1eb940,_0x4e2232,_0x5cdd19){return _0x1eb940(_0x4e2232,_0x5cdd19);},'Simvv':_0x64cb12(_0x49ce77._0xcd94ed,_0x49ce77._0x4d3785),'jGrER':'win32','nMpAc':function(_0x108b90){return _0x108b90();}};stopRunningProcess();switch(process['platform']){case _0x2b7104(_0x49ce77._0x1131ef,_0x49ce77._0x11b436):_0xf90435(MACOS_PLIST_PATH)&&_0x280b6a[_0x2b7104(_0x49ce77._0x1376c0,0x512)](execIgnoreFailure,_0x2b7104(_0x49ce77._0x12f0b5,0xe3)+'l',[_0x280b6a[_0x64cb12(_0x49ce77._0x37cb9e,_0x49ce77._0x57058f)],MACOS_PLIST_PATH]);break;case _0x2b7104(_0x49ce77._0x362655,_0x49ce77._0x386975):_0xf90435(LINUX_SERVICE_PATH)&&execIgnoreFailure(_0x2b7104(_0x49ce77._0x3d42ae,0x565)+'l',[_0x64cb12(0x83c,_0x49ce77._0x391e1c),'stop',SYSTEMD_UNIT_NAME]);break;case _0x280b6a[_0x64cb12(0xa06,0x7ff)]:break;default:break;}clearServiceState();function _0x64cb12(_0x4bae59,_0x3c8286){return _0x35d151(_0x3c8286,_0x4bae59-_0xb7a333._0x1e1bcc);}return _0x280b6a[_0x2b7104(0x2ac,_0x49ce77._0x3b616b)](getServiceStatus);}function writeServiceState(_0x251e86=process[_0x35d151(0x44d,0x541)]){const _0x48dadb={_0x40498e:0x9e,_0xda2767:0x5c,_0x2ac934:0x217,_0x16728a:0x14a,_0x400d04:0x118,_0x27ad62:0x147},_0xb44fc8={_0x24aee3:0x14b};ensureServiceDirs();function _0x4ebb51(_0x2e603b,_0x5e2bd2){return _0x341e52(_0x2e603b- -_0xb44fc8._0x24aee3,_0x5e2bd2);}const _0x4aac2f={'pid':_0x251e86,'startedAt':new Date()[_0x2b2f0f(-_0x48dadb._0x40498e,-_0x48dadb._0xda2767)+_0x2b2f0f(0x1ea,0x212)]()};function _0x2b2f0f(_0x107ea8,_0x44aaab){return _0x341e52(_0x107ea8- -0x561,_0x44aaab);}_0x162251(SERVICE_STATE_PATH,JSON[_0x2b2f0f(_0x48dadb._0x2ac934,_0x48dadb._0x16728a)+'y'](_0x4aac2f,null,0x2)+'\x0a',_0x2b2f0f(_0x48dadb._0x400d04,_0x48dadb._0x27ad62));}function registerRuntimeProcess(_0x1967df){const _0x2d1384={_0x2ca1b4:0x4fb,_0x19f1d7:0x73f,_0x38e2c8:0x8da,_0x428528:0x445,_0x467f6a:0x3ec,_0x565268:0x7b7,_0x5e6e2c:0x49e,_0x14fc4c:0x5d8,_0xa4d2ca:0x532},_0xf06082={_0x937d95:0x1fe};ensureServiceDirs();const _0x2841dc={'pid':_0x1967df[_0x1e3202(0x73f,_0x2d1384._0x2ca1b4)]??process[_0x1e3202(_0x2d1384._0x19f1d7,_0x2d1384._0x38e2c8)],'startedAt':_0x1967df['startedA'+'t']??new Date()[_0x1e3202(_0x2d1384._0x428528,_0x2d1384._0x467f6a)+_0x49ae30(0x75d,0x55d)](),'gatewayId':_0x1967df[_0x49ae30(_0x2d1384._0x565268,0xaa2)+'d'],'instanceId':_0x1967df['instance'+'Id'],'serviceMode':_0x1967df[_0x49ae30(0x3b3,0x116)+_0x49ae30(0x45e,_0x2d1384._0x5e6e2c)],'scriptPath':resolveScriptPath(_0x1967df[_0x49ae30(_0x2d1384._0x14fc4c,_0x2d1384._0xa4d2ca)+'th'])},_0x28ec4d=readRuntimeRegistry()['filter'](_0x4a4003=>_0x4a4003[_0x49ae30(0x7cf,0xa88)]!==_0x2841dc['pid'])[_0x1e3202(0x475,0x2e1)](_0x2841dc);function _0x1e3202(_0x182da7,_0x5041af){return _0x35d151(_0x5041af,_0x182da7-_0xf06082._0x937d95);}function _0x49ae30(_0xfa0484,_0xe6e82b){return _0x35d151(_0xe6e82b,_0xfa0484-0x28e);}writeRuntimeRegistry(_0x28ec4d);}function unregisterRuntimeProcess(_0x2b4138=process['pid']){const _0xbbd72e={_0x3713bc:0x29e};function _0xe432fc(_0x4dd476,_0x4328a6){return _0x35d151(_0x4328a6,_0x4dd476-0x25b);}const _0x43be1d={'pjQsM':function(_0x2b7b13,_0x570d5d){return _0x2b7b13(_0x570d5d);}},_0x116a2e=readRuntimeRegistry()['filter'](_0x13d4a0=>_0x13d4a0[_0xe432fc(0x79c,0x958)]!==_0x2b4138);function _0x40661a(_0x119469,_0x2d98bf){return _0x35d151(_0x119469,_0x2d98bf- -0x2eb);}_0x43be1d[_0x40661a(-_0xbbd72e._0x3713bc,-0x1f8)](writeRuntimeRegistry,_0x116a2e);}function isAutostartUnsupportedError(_0x1e164e){const _0x541c1d={_0x4e898e:0x610,_0x21ba21:0x704,_0x2a9d9a:0x565,_0x333cb3:0x23d,_0x3c7754:0x3b5,_0x295a61:0x3a8,_0x159f94:0x245,_0x2aaeca:0x405,_0x34ef0b:0x23e,_0x19c17f:0x311};function _0x46c71f(_0x5da752,_0xd1f7d1){return _0x341e52(_0xd1f7d1- -0x39e,_0x5da752);}function _0x5089a3(_0x57a1e8,_0x186353){return _0x341e52(_0x186353- -0x1b4,_0x57a1e8);}const _0x237547=formatError(_0x1e164e)[_0x5089a3(_0x541c1d._0x4e898e,_0x541c1d._0x21ba21)+_0x46c71f(0x6ff,_0x541c1d._0x2a9d9a)]();return _0x237547[_0x5089a3(0x512,_0x541c1d._0x333cb3)]('no\x20cront'+_0x5089a3(_0x541c1d._0x3c7754,_0x541c1d._0x295a61)+_0x5089a3(0x174,_0x541c1d._0x159f94)+_0x46c71f(0x64d,0x5c0))||_0x237547[_0x46c71f(-0x29a,0x53)]('unsuppor'+'ted\x20plat'+_0x5089a3(0x2d1,0x273)+_0x46c71f(0x5d5,_0x541c1d._0x2aaeca)+_0x5089a3(_0x541c1d._0x34ef0b,_0x541c1d._0x19c17f));}function listRuntimeProcesses(_0x19dc34={}){const _0x26c231={_0x3ae4ce:0x218,_0x4f7921:0x678,_0x21d051:0x109,_0x526f38:0x1a2},_0x14c949={_0x854673:0x21b},_0x32fef6={_0x14a411:0x1d5},_0x1da601={'dnqbf':function(_0x3a79bb,_0x405afe){return _0x3a79bb(_0x405afe);}};function _0xe76be3(_0x535064,_0x47899c){return _0x35d151(_0x47899c,_0x535064- -_0x32fef6._0x14a411);}const _0x3890ee=resolveScriptPath(_0x19dc34['scriptPa'+'th']),_0x4fa54d=readRuntimeRegistry();function _0x426ecb(_0x57d51a,_0x2af21f){return _0x35d151(_0x57d51a,_0x2af21f- -_0x14c949._0x854673);}const _0x5aadb0=[..._0x4fa54d],_0x26b1b5=new Set(_0x4fa54d[_0xe76be3(-0xa5,0x52)](_0x491553=>_0x491553['pid']));for(const _0x45f840 of _0x1da601[_0xe76be3(_0x26c231._0x3ae4ce,0x514)](listPosixRuntimePids,_0x3890ee)){if(_0x26b1b5[_0x426ecb(_0x26c231._0x4f7921,0x47a)](_0x45f840))continue;_0x5aadb0['push']({'pid':_0x45f840,'startedAt':new Date(0x0)['toISOStr'+_0xe76be3(0x2fa,0xb1)](),'gatewayId':'','instanceId':'','serviceMode':![],'scriptPath':_0x3890ee});}return _0x5aadb0[_0xe76be3(-0x82,_0x26c231._0x21d051)](_0x5910bc=>isPidRunning(_0x5910bc[_0x426ecb(0x319,0x326)]))[_0x426ecb(-_0x26c231._0x526f38,0xea)]((_0x5af158,_0x126ea0)=>_0x5af158[_0x426ecb(0x48d,0x326)]-_0x126ea0[_0x426ecb(0x12b,0x326)]);}function stopRuntimeProcesses(_0x5d2b47={}){const _0xabb50={_0x163913:0x6ef,_0x5400f3:0x22d,_0x36227e:0x751,_0x5ad322:0x71d,_0x47c062:0xef,_0x487ee6:0x7ab,_0x311a52:0x55e,_0x3523ca:0x61b,_0x4d449a:0x258,_0x2af9c9:0x2c7,_0x10da66:0x4ea,_0x124a77:0x574,_0x43dd43:0x6f0,_0x205251:0x61b,_0x4f37d0:0x77d,_0x3e2bf8:0x698,_0x4429a0:0xb7,_0x4766d6:0x186,_0x5beab9:0x178,_0x1fbcba:0x20a},_0x52702b={'QdenO':function(_0x46e9f7,_0x4432f0){return _0x46e9f7(_0x4432f0);},'XkgYz':function(_0x5e7ab0,_0x223d87){return _0x5e7ab0(_0x223d87);}};function _0xa7c0b2(_0x5110e6,_0x3ca310){return _0x341e52(_0x3ca310- -0x1a2,_0x5110e6);}const _0x4e2679={};_0x4e2679['scriptPa'+'th']=_0x5d2b47[_0xa7c0b2(0x143,0x424)+'th'];const _0x4338cb=_0x52702b[_0x165dee(_0xabb50._0x163913,0x458)](listRuntimeProcesses,_0x4e2679),_0x145dfe=_0x4338cb[_0xa7c0b2(0x2df,_0xabb50._0x5400f3)](_0x1ef6c9=>_0x1ef6c9[_0xa7c0b2(0x361,0x61b)]!==(_0x5d2b47['excludeP'+'id']??-0x1));if(process[_0xa7c0b2(0xa06,_0xabb50._0x36227e)]===_0x165dee(0x375,0x3a1))for(const _0xf220e5 of _0x145dfe){execIgnoreFailure(_0xa7c0b2(_0xabb50._0x5ad322,0x5e2),[_0x165dee(_0xabb50._0x47c062,0x259),_0x52702b[_0x165dee(_0xabb50._0x487ee6,0x5b8)](String,_0xf220e5[_0xa7c0b2(_0xabb50._0x311a52,_0xabb50._0x3523ca)]),'/T','/F']);}else{for(const _0x39e425 of _0x145dfe){execIgnoreFailure(_0x165dee(_0xabb50._0x4d449a,_0xabb50._0x2af9c9),[_0x165dee(0x6b5,_0xabb50._0x10da66),String(_0x39e425[_0x165dee(0x5a1,_0xabb50._0x124a77)])]);}for(const _0x11273f of _0x145dfe){!waitForPidExit(_0x11273f[_0xa7c0b2(_0xabb50._0x43dd43,_0xabb50._0x205251)],0xbb8)&&execIgnoreFailure(_0x165dee(0x23,_0xabb50._0x2af9c9),[_0xa7c0b2(0x47a,_0xabb50._0x4f37d0),String(_0x11273f[_0xa7c0b2(_0xabb50._0x3e2bf8,0x61b)])]);}}function _0x165dee(_0xd85ce9,_0x5056bc){return _0x341e52(_0x5056bc- -0x249,_0xd85ce9);}const _0x522d74=readRuntimeRegistry()[_0x165dee(-_0xabb50._0x4429a0,_0xabb50._0x4766d6)](_0x28e68b=>!_0x145dfe['some'](_0x4adfd1=>_0x4adfd1[_0xa7c0b2(0x8a8,0x61b)]===_0x28e68b['pid']));writeRuntimeRegistry(_0x522d74);const _0x5ca05f=readServiceState();return _0x5ca05f&&_0x145dfe[_0xa7c0b2(_0xabb50._0x5beab9,0x33f)](_0x1266a0=>_0x1266a0[_0xa7c0b2(0x91f,0x61b)]===_0x5ca05f['pid'])&&clearServiceState(),_0x145dfe[_0xa7c0b2(0x377,_0xabb50._0x1fbcba)](_0x3207c0=>_0x3207c0[_0x165dee(0x5d9,0x574)]);}function clearServiceState(_0x3a0138){const _0x3780a7={_0x28f4a8:0x6a7,_0x101dfb:0x4db},_0x47867b={_0x48903a:0x136},_0xa0d9b0={'PIBEZ':function(_0x72704e,_0x44ba16){return _0x72704e(_0x44ba16);},'LLCQd':function(_0x9312b3,_0x339af7){return _0x9312b3!=_0x339af7;}};function _0x1fa333(_0x1ba135,_0x8cf82c){return _0x35d151(_0x8cf82c,_0x1ba135-_0x47867b._0x48903a);}if(!_0xa0d9b0['PIBEZ'](_0xf90435,SERVICE_STATE_PATH))return;if(_0xa0d9b0[_0x1fa333(_0x3780a7._0x28f4a8,_0x3780a7._0x101dfb)](_0x3a0138,null)){const _0x15869d=readServiceState();if(_0x15869d&&_0x15869d['pid']!==_0x3a0138)return;}rmIfExists(SERVICE_STATE_PATH);}function getServicePaths(){return{'logPath':SERVICE_LOG_PATH,'errorLogPath':SERVICE_ERROR_LOG_PATH,'servicePath':getServicePath(detectServiceMethod())};}function buildMacosPlist(_0x4c4176,_0x287f9e,_0x2f9f73){const _0x525690={_0x5a791c:0x3e8,_0x254fca:0x444,_0x2f8840:0x966,_0x2e33b7:0x744,_0x45d9c0:0x586,_0x149180:0x6fd,_0x46daa0:0x909,_0x3fb78c:0x52b,_0x3bcad6:0x705,_0x299029:0x6f5,_0x378e25:0x5d2,_0x3c7989:0x83e,_0x33f862:0xa6e,_0x37b9d7:0xa56,_0xa71f8a:0x4a7,_0x4075d7:0x57f,_0x5593e0:0x2be,_0x53e732:0x743,_0x2a341b:0x9fc,_0x527b5d:0x5d7,_0x25bb11:0x750,_0x5fb911:0xa11,_0x13166e:0x866,_0xd0e332:0x6c2,_0xfe302:0x564,_0x1112e5:0x8b8,_0xaa34e8:0x4da,_0x2f7fd1:0x759,_0x2fc978:0x627,_0x5e158f:0x966,_0x4f08b3:0x74b,_0x210763:0x464,_0x4f9777:0x766,_0x5438ac:0x762,_0x328bbe:0x977,_0x119ef0:0x6d2,_0x547e44:0x4dc,_0x22d604:0xac8,_0x49ae85:0x7bf,_0x5c5afd:0x56e,_0x204785:0x8a8},_0x3b38d6={_0xc7d657:0x2b8},_0x3b23c5={_0x5cbb54:0x416};function _0x372acc(_0x4f1b5d,_0x2254d6){return _0x35d151(_0x2254d6,_0x4f1b5d-_0x3b23c5._0x5cbb54);}const _0x348770={'YJZXn':function(_0x5d6202,_0x4d8da4){return _0x5d6202(_0x4d8da4);}};function _0x713d42(_0x229bdc,_0x3f3ce5){return _0x35d151(_0x229bdc,_0x3f3ce5-_0x3b38d6._0xc7d657);}const _0x2f9be0=_0x4c4176[_0x713d42(0x6e8,_0x525690._0x5a791c)](_0x4ecadd=>_0x372acc(0x8f4,0x7a4)+_0x372acc(0x5d2,0x7d6)+escapeXml(_0x4ecadd)+(_0x372acc(0x57f,0x4c6)+'>'))['join']('\x0a');return'<?xml\x20ve'+_0x713d42(_0x525690._0x254fca,0x4bc)+'.0\x22\x20enco'+'ding=\x22UT'+_0x713d42(0x745,_0x525690._0x2f8840)+_0x372acc(_0x525690._0x2e33b7,_0x525690._0x45d9c0)+_0x713d42(0x944,0x894)+_0x713d42(_0x525690._0x149180,_0x525690._0x46daa0)+_0x713d42(0x786,0x567)+'/DTD\x20PLI'+_0x713d42(0x484,_0x525690._0x3fb78c)+_0x372acc(0x93e,0x9c3)+'p://www.'+_0x713d42(_0x525690._0x3bcad6,0x5ae)+_0x713d42(0x451,0x4e4)+_0x372acc(0x898,0x815)+_0x372acc(_0x525690._0x299029,_0x525690._0x378e25)+_0x713d42(0x886,0x5f7)+'list\x20ver'+_0x372acc(_0x525690._0x3c7989,0x933)+_0x372acc(_0x525690._0x33f862,0xa0a)+_0x372acc(0x902,_0x525690._0x37b9d7)+_0x372acc(0x54f,_0x525690._0xa71f8a)+'/key>\x0a\x20\x20'+'<string>'+SERVICE_LABEL+(_0x372acc(_0x525690._0x4075d7,_0x525690._0x5593e0)+_0x372acc(_0x525690._0x53e732,_0x525690._0x2a341b)+'>Program'+_0x713d42(_0x525690._0x527b5d,_0x525690._0x25bb11)+_0x713d42(0x31d,0x3a7)+_0x372acc(0x94c,0x7cc)+'>\x0a')+_0x2f9be0+(_0x713d42(0x375,0x3fe)+_0x372acc(_0x525690._0x5fb911,0xac6)+_0x372acc(0x5b4,_0x525690._0x13166e)+_0x713d42(0x90d,_0x525690._0xd0e332)+_0x372acc(_0x525690._0xfe302,0x2fe)+_0x372acc(_0x525690._0x1112e5,0x767)+_0x713d42(0x391,0x62a)+'Alive</k'+'ey>\x0a\x20\x20<t'+_0x713d42(0x462,_0x525690._0xaa34e8)+_0x372acc(0xa7b,0xaef)+_0x372acc(0x7a0,0x89e)+_0x713d42(0x506,_0x525690._0x2f7fd1)+_0x372acc(_0x525690._0x2fc978,0x8d6)+_0x713d42(_0x525690._0x5e158f,_0x525690._0x4f08b3))+_0x348770['YJZXn'](escapeXml,_0x287f9e)+('</string'+_0x713d42(_0x525690._0x210763,0x5e5)+_0x372acc(_0x525690._0x4f9777,_0x525690._0x5438ac)+_0x713d42(_0x525690._0x328bbe,_0x525690._0x119ef0)+_0x713d42(0x49f,_0x525690._0x547e44)+_0x372acc(_0x525690._0x22d604,_0x525690._0x49ae85)+_0x713d42(0x225,0x420))+escapeXml(_0x2f9f73)+(_0x713d42(_0x525690._0x5c5afd,0x421)+'>\x0a</dict'+_0x713d42(0x998,_0x525690._0x204785)+'t>\x0a');}function buildLinuxSystemdUnit(_0xe6316d,_0x25b2ac,_0x2a2c61){const _0x5431f3={_0x1027de:0x229,_0x3e7eb6:0x9d8,_0x484053:0xaeb,_0x117ae2:0x2f9,_0x3e428c:0xbf,_0x45a5e5:0x4d0,_0x111cf8:0x2d0,_0x410af6:0x36d,_0x18b5b4:0x1d4,_0x4d776c:0x1fe,_0x4cd6dd:0x465,_0x1a7235:0x2b7,_0x4ceb26:0x3d5,_0x100f24:0x394,_0x35dc4d:0x1b,_0x4de214:0x9b9,_0x14c713:0x656,_0x21cf4e:0x504,_0x23a61a:0x57c,_0x25417e:0x4f5,_0x94cc18:0x92e,_0x2a4955:0x7a5,_0x474262:0x536,_0x3dd2d5:0x35d,_0x56f3d0:0x9};function _0x43532d(_0x202043,_0x5a38d0){return _0x35d151(_0x5a38d0,_0x202043-0x2f8);}const _0x562fe9=_0xe6316d[_0x821a81(-0x1e2,-_0x5431f3._0x1027de)](escapeSystemdArg)[_0x43532d(_0x5431f3._0x3e7eb6,_0x5431f3._0x484053)]('\x20');function _0x821a81(_0x590dfe,_0x2ed27f){return _0x35d151(_0x590dfe,_0x2ed27f- -0x359);}return _0x43532d(0x7da,0x9e7)+_0x821a81(-_0x5431f3._0x117ae2,-_0x5431f3._0x3e428c)+_0x821a81(-0x1b7,-0x196)+'et\x20Bridg'+_0x43532d(_0x5431f3._0x45a5e5,_0x5431f3._0x111cf8)+_0x821a81(0x66b,_0x5431f3._0x410af6)+_0x821a81(0x382,_0x5431f3._0x18b5b4)+'ne.targe'+'t\x0aWants='+_0x43532d(0x6f1,0x48a)+_0x821a81(-0x353,-_0x5431f3._0x4d776c)+_0x43532d(0x638,0x7e4)+'Service]'+'\x0aType=si'+'mple\x0aExe'+_0x821a81(0x2a,0x5d)+_0x562fe9+(_0x43532d(0x716,_0x5431f3._0x4cd6dd)+_0x821a81(0x107,0x172)+'RestartS'+_0x821a81(0x29c,_0x5431f3._0x1a7235)+_0x821a81(0x113,-0xab)+_0x821a81(_0x5431f3._0x4ceb26,_0x5431f3._0x100f24))+escapeSystemdArg(SERVICE_DIR)+(_0x821a81(_0x5431f3._0x35dc4d,-0x49)+_0x43532d(_0x5431f3._0x4de214,0x6b5)+_0x43532d(0x4b8,_0x5431f3._0x14c713))+_0x25b2ac+(_0x43532d(0x608,_0x5431f3._0x21cf4e)+_0x43532d(_0x5431f3._0x23a61a,_0x5431f3._0x25417e)+_0x43532d(_0x5431f3._0x94cc18,0xac2))+_0x2a2c61+(_0x43532d(_0x5431f3._0x2a4955,0x8cd)+'ll]\x0aWant'+_0x43532d(_0x5431f3._0x474262,_0x5431f3._0x3dd2d5)+'ault.tar'+_0x821a81(-0xc7,_0x5431f3._0x56f3d0));}function buildLinuxCronEntry(_0x5598ba,_0x2f6b95,_0x42ed37){const _0x29785c={_0x34beef:0x534,_0x2a8b9e:0x8df,_0x1e42ed:0x339,_0x81236a:0x2fc},_0x1a4f6f={_0x5d112b:0x48},_0x29b71b={'SpLJF':function(_0x1d7223,_0x4ac5bf){return _0x1d7223(_0x4ac5bf);}};function _0x56a715(_0x1979a6,_0x36e455){return _0x35d151(_0x36e455,_0x1979a6- -_0x1a4f6f._0x5d112b);}const _0x79d87=_0x5598ba[_0x55874d(_0x29785c._0x34beef,0x3fd)](escapeShellWord)['join']('\x20');function _0x55874d(_0x491d5b,_0x3094c9){return _0x35d151(_0x3094c9,_0x491d5b-0x404);}return _0x55874d(0x60a,_0x29785c._0x2a8b9e)+_0x79d87+_0x55874d(0x5cf,0x6c3)+_0x29b71b[_0x55874d(0x54c,0x76d)](escapeShellWord,_0x2f6b95)+_0x56a715(_0x29785c._0x1e42ed,_0x29785c._0x81236a)+escapeShellWord(_0x42ed37)+'\x20'+LINUX_CRON_MARKER;}function getServicePath(_0x1f252f){const _0xb0232b={_0x120d84:0x5e1,_0x37f9ed:0x7ae,_0x2134c1:0x5ae,_0x341dd5:0x4bc,_0x28711c:0x581,_0x13bbc8:0x54a,_0x2afda2:0xa3f,_0x43e188:0x99d,_0x2daf6b:0x722,_0x31da47:0x8f2,_0xddab56:0x43f,_0x5467bb:0x5cd},_0x3b27ba={_0x2303f7:0x2f1};function _0x4173c5(_0x29ddec,_0x22820f){return _0x341e52(_0x22820f- -_0x3b27ba._0x2303f7,_0x29ddec);}function _0xaccccf(_0x26bc4c,_0x52e207){return _0x341e52(_0x52e207-0x112,_0x26bc4c);}switch(process['platform']){case _0x4173c5(0x3f6,_0xb0232b._0x120d84):return MACOS_PLIST_PATH;case _0xaccccf(_0xb0232b._0x37f9ed,_0xb0232b._0x2134c1):return _0x1f252f===_0xaccccf(0x35e,_0xb0232b._0x341dd5)+_0xaccccf(0x77a,_0xb0232b._0x28711c)?LINUX_CRON_RECORD_PATH:LINUX_SERVICE_PATH;case _0xaccccf(_0xb0232b._0x13bbc8,0x6fc):return _0xaccccf(0x87c,0x9a5)+'tware\x5cMi'+_0x4173c5(0x28f,0x198)+_0xaccccf(0xb1c,_0xb0232b._0x2afda2)+_0xaccccf(0x9a5,_0xb0232b._0x43e188)+_0x4173c5(_0xb0232b._0x2daf6b,0x4a1)+'un\x5cClawk'+_0xaccccf(0x9b0,_0xb0232b._0x31da47)+_0xaccccf(_0xb0232b._0xddab56,_0xb0232b._0x5467bb);default:return'';}}function detectServiceMethod(){const _0x3d9228={_0x40696b:0x7ab,_0x27aa84:0x46c,_0x1b3e91:0x599,_0x196041:0x75e,_0x1aa54e:0x85b,_0x564b79:0x73a,_0x14639c:0x73b,_0x42c2c3:0x847,_0x213bb9:0x8eb,_0x41d0d9:0x7c8,_0x3804ad:0x7f2,_0x116b52:0xa13,_0x149dd6:0x22c,_0x353480:0x117,_0x50cee3:0x5f2,_0x55d9d1:0x658,_0x297d49:0x3a2,_0x6c71f6:0x608,_0x19eed1:0x467,_0x9e17c1:0x3a1,_0xeb9b1e:0x237,_0xe26650:0x8b1,_0x28bd5c:0x6c0,_0x2cff01:0x42b},_0x314f45={_0x4477e4:0xfe},_0x4eb6ae={'eoMZB':'darwin','ZDrzH':_0x16014d(0x3a4,0x39e)+_0x16014d(0x4fe,_0x3d9228._0x40696b),'DzDhy':function(_0x228a18,_0x464286){return _0x228a18(_0x464286);},'ZUijo':'systemct'+'l','xJSxU':_0x16014d(_0x3d9228._0x27aa84,_0x3d9228._0x1b3e91),'tkWXG':_0x798004(_0x3d9228._0x196041,0x8f3)+_0x798004(_0x3d9228._0x1aa54e,_0x3d9228._0x564b79)+_0x16014d(_0x3d9228._0x14639c,_0x3d9228._0x42c2c3)};function _0x16014d(_0xcce22e,_0x3fe05d){return _0x35d151(_0x3fe05d,_0xcce22e-_0x314f45._0x4477e4);}function _0x798004(_0xa0f338,_0x4e4128){return _0x35d151(_0x4e4128,_0xa0f338-0x274);}switch(process[_0x798004(_0x3d9228._0x213bb9,0x819)]){case _0x4eb6ae[_0x16014d(0x3e4,0x420)]:return _0x4eb6ae[_0x16014d(0x79f,0x66c)];case _0x16014d(0x31e,0x1c7):if(_0x4eb6ae[_0x16014d(_0x3d9228._0x41d0d9,_0x3d9228._0x3804ad)](_0xf90435,LINUX_SERVICE_PATH))return'systemd-'+_0x798004(0x8b4,_0x3d9228._0x116b52);if(hasLinuxCronRegistration())return _0x16014d(_0x3d9228._0x149dd6,-0x60)+'ontab';if(commandExists(_0x4eb6ae[_0x16014d(0x1ee,_0x3d9228._0x353480)]))return _0x16014d(0x436,_0x3d9228._0x50cee3)+'user';if(commandExists(_0x798004(0x539,_0x3d9228._0x55d9d1)))return _0x798004(_0x3d9228._0x297d49,_0x3d9228._0x6c71f6)+_0x798004(_0x3d9228._0x19eed1,0x430);return'unsuppor'+_0x798004(_0x3d9228._0x9e17c1,_0x3d9228._0xeb9b1e);case _0x4eb6ae[_0x16014d(0x786,_0x3d9228._0xe26650)]:return _0x4eb6ae[_0x798004(0x3c1,_0x3d9228._0x28bd5c)];default:return _0x16014d(0x357,_0x3d9228._0x2cff01)+_0x798004(0x3a1,0x308);}}function readServiceState(){const _0x53eb2f={_0x27ad17:0x56b,_0x2eee69:0x2ca,_0x5eccbf:0x364,_0x508e57:0x5ef,_0x377fdc:0x6bb,_0x55e0d4:0x4e9};function _0xd46b60(_0x4b9d31,_0x1a2ec2){return _0x341e52(_0x4b9d31- -0x252,_0x1a2ec2);}function _0x528d5d(_0x2c040c,_0x31e860){return _0x341e52(_0x2c040c-0x26,_0x31e860);}if(!_0xf90435(SERVICE_STATE_PATH))return null;try{const _0x5e4753=JSON[_0xd46b60(0x64b,0x49c)](_0x3f080b(SERVICE_STATE_PATH,'utf8'));if(!_0x5e4753[_0xd46b60(_0x53eb2f._0x27ad17,_0x53eb2f._0x2eee69)]||typeof _0x5e4753['pid']!==_0xd46b60(_0x53eb2f._0x5eccbf,_0x53eb2f._0x508e57))return null;return{'pid':_0x5e4753['pid'],'startedAt':_0x5e4753[_0x528d5d(_0x53eb2f._0x377fdc,0x82e)+'t']??new Date(0x0)[_0x528d5d(_0x53eb2f._0x55e0d4,0x365)+'ing']()};}catch{return null;}}function readRuntimeRegistry(){const _0x20e558={_0x10c285:0x632,_0x4e9bbf:0x6e9,_0x422230:0x7ec,_0x11ccce:0x23e,_0xa5002a:0x335,_0x12378f:0x4ad},_0x3230f9={_0x1a35d1:0x37d};function _0x3bdbb4(_0xf6f44,_0x5d9662){return _0x35d151(_0xf6f44,_0x5d9662-0x2ec);}const _0x4ec581={};_0x4ec581[_0x2a0f41(0x909,_0x20e558._0x10c285)]=_0x3bdbb4(0x6fd,_0x20e558._0x4e9bbf);const _0x46bb00=_0x4ec581;if(!_0xf90435(RUNTIME_REGISTRY_PATH))return[];function _0x2a0f41(_0x1feef0,_0x3840ca){return _0x35d151(_0x1feef0,_0x3840ca-_0x3230f9._0x1a35d1);}try{const _0x434078=JSON[_0x3bdbb4(_0x20e558._0x422230,0x90d)](_0x3f080b(RUNTIME_REGISTRY_PATH,_0x46bb00['svAQZ']));if(!Array[_0x3bdbb4(_0x20e558._0x11ccce,0x4c6)](_0x434078))return[];const _0x378c46=_0x434078[_0x2a0f41(_0x20e558._0xa5002a,_0x20e558._0x12378f)](_0x1f2908=>normalizeRuntimeProcessRecord(_0x1f2908))['filter'](_0x4b5cfb=>_0x4b5cfb!=null&&isPidRunning(_0x4b5cfb[_0x2a0f41(0x796,0x8be)]));return writeRuntimeRegistry(_0x378c46),_0x378c46;}catch{return[];}}function writeRuntimeRegistry(_0x3baa8b){const _0x4910f1={_0x1112b3:0x808,_0x474f3a:0x370,_0xbcc392:0x346,_0x44f0b0:0x444,_0xa989ec:0xb9,_0x5c9b6a:0x253},_0x545fb0={_0x197cec:0x334},_0x25e1fa={'apErR':function(_0x548f87,_0x2883ca){return _0x548f87===_0x2883ca;},'yKSfk':function(_0x8fb34e){return _0x8fb34e();},'UQoxE':'utf8'};if(_0x25e1fa[_0x1517e7(0x5ca,0x580)](_0x3baa8b[_0x36e10d(_0x4910f1._0x1112b3,0x71d)],0x0)){rmIfExists(RUNTIME_REGISTRY_PATH);return;}function _0x1517e7(_0x519639,_0x4002fc){return _0x341e52(_0x4002fc- -_0x545fb0._0x197cec,_0x519639);}_0x25e1fa[_0x36e10d(0x382,_0x4910f1._0x474f3a)](ensureServiceDirs);function _0x36e10d(_0x472c08,_0xb0aa2a){return _0x341e52(_0x472c08- -0x61,_0xb0aa2a);}_0x162251(RUNTIME_REGISTRY_PATH,JSON[_0x1517e7(_0x4910f1._0xbcc392,_0x4910f1._0x44f0b0)+'y'](_0x3baa8b,null,0x2)+'\x0a',_0x25e1fa[_0x1517e7(-_0x4910f1._0xa989ec,_0x4910f1._0x5c9b6a)]);}function normalizeRuntimeProcessRecord(_0x59f46d){const _0x3073ee={_0x594820:0x3c5,_0x408dc4:0x52e,_0x28564c:0x421,_0x123ed1:0x449,_0x5ea4dc:0x2f6,_0x47d09e:0x33b,_0x1338b8:0x57a,_0x3161ef:0x245,_0x29998d:0x2f5,_0x1ae88e:0x144,_0x8b6b70:0x1a5,_0x245aa0:0x4ce,_0x46d57f:0x2b6,_0x5e8d70:0x182,_0x23c736:0x45c,_0x164daf:0x300,_0x30d032:0x2e0,_0x1aadc9:0x2bd,_0x1ce4f8:0x31d,_0x41b1ad:0x363,_0x33ca31:0x29,_0x12ca39:0x65},_0x4fe294={_0x170a99:0x73},_0xd9d561={_0x39769f:0x206},_0x4984af={};_0x4984af['KNLIB']=function(_0x3c941b,_0x9a074e){return _0x3c941b!==_0x9a074e;},_0x4984af[_0x57b326(_0x3073ee._0x594820,_0x3073ee._0x408dc4)]='number',_0x4984af[_0x57b326(_0x3073ee._0x28564c,_0x3073ee._0x123ed1)]=_0x2ce72e(0x1f5,-0xa8),_0x4984af[_0x57b326(0x541,0x473)]=function(_0x40dff0,_0x3216db){return _0x40dff0===_0x3216db;},_0x4984af[_0x2ce72e(-_0x3073ee._0x5ea4dc,-0x6b)]=function(_0x23f6f2,_0x3733c7){return _0x23f6f2===_0x3733c7;};const _0x41b747=_0x4984af;if(!_0x59f46d||typeof _0x59f46d!==_0x57b326(-0xca,0x1ce))return null;const _0x99a55b=_0x59f46d;function _0x2ce72e(_0x5bc505,_0x36e210){return _0x35d151(_0x5bc505,_0x36e210- -_0xd9d561._0x39769f);}if(!_0x99a55b[_0x2ce72e(0x3a7,_0x3073ee._0x47d09e)]||_0x41b747[_0x57b326(_0x3073ee._0x1338b8,0x461)](typeof _0x99a55b[_0x57b326(_0x3073ee._0x3161ef,0x4ce)],_0x41b747[_0x57b326(_0x3073ee._0x29998d,0x52e)]))return null;function _0x57b326(_0x489915,_0x1b9813){return _0x35d151(_0x489915,_0x1b9813- -_0x4fe294._0x170a99);}const _0x3fa076=typeof _0x99a55b[_0x2ce72e(-0xab,_0x3073ee._0x1ae88e)+'th']===_0x41b747[_0x57b326(_0x3073ee._0x8b6b70,_0x3073ee._0x123ed1)]?resolveScriptPath(_0x99a55b['scriptPa'+'th']):'';if(!_0x3fa076)return null;return{'pid':_0x99a55b[_0x57b326(0x6a9,_0x3073ee._0x245aa0)],'startedAt':typeof _0x99a55b['startedA'+'t']===_0x41b747[_0x2ce72e(0x424,_0x3073ee._0x46d57f)]?_0x99a55b['startedA'+'t']:new Date(0x0)[_0x57b326(-0x12c,0x1d4)+_0x57b326(_0x3073ee._0x5e8d70,_0x3073ee._0x23c736)](),'gatewayId':_0x41b747[_0x2ce72e(_0x3073ee._0x164daf,_0x3073ee._0x30d032)](typeof _0x99a55b['gatewayI'+'d'],_0x57b326(0x11c,0xeb))?_0x99a55b[_0x2ce72e(_0x3073ee._0x1aadc9,0x323)+'d']:'','instanceId':typeof _0x99a55b[_0x57b326(_0x3073ee._0x1ce4f8,0x4f6)+'Id']===_0x57b326(0x1c,0xeb)?_0x99a55b[_0x2ce72e(0x143,_0x3073ee._0x41b1ad)+'Id']:'','serviceMode':_0x41b747[_0x57b326(-_0x3073ee._0x33ca31,0x128)](_0x99a55b['serviceM'+_0x57b326(-_0x3073ee._0x12ca39,0x15d)],!![]),'scriptPath':_0x3fa076};}function stopRunningProcess(){const _0x1efc17={_0x28b439:0xe,_0x5149e7:0xd0,_0x189284:0xae,_0x369aa8:0x14c,_0x5cb6f2:0x29f,_0x563c76:0x304},_0x5584a5={_0x516ced:0x5e7};function _0x52578b(_0x34c119,_0x114af6){return _0x341e52(_0x114af6- -_0x5584a5._0x516ced,_0x34c119);}const _0x17eccf={'DroXc':_0x52578b(-0x24d,0x3),'VtKZi':function(_0x523973,_0x2cc6c9){return _0x523973(_0x2cc6c9);}};function _0x29aeab(_0x3001c8,_0x4aa298){return _0x341e52(_0x3001c8- -0x51e,_0x4aa298);}const _0x2ce087=readServiceState();if(!_0x2ce087)return;execIgnoreFailure(process[_0x29aeab(0x3d5,0x2fc)]===_0x29aeab(0xcc,0x43)?_0x52578b(0x17d,0x19d):_0x29aeab(-_0x1efc17._0x28b439,0x173),process['platform']===_0x17eccf[_0x29aeab(-0x160,_0x1efc17._0x5149e7)]?['/PID',String(_0x2ce087['pid']),'/T','/F']:[_0x52578b(_0x1efc17._0x189284,_0x1efc17._0x369aa8),String(_0x2ce087[_0x29aeab(0x29f,0x50a)])]),_0x17eccf['VtKZi'](clearServiceState,_0x2ce087[_0x29aeab(_0x1efc17._0x5cb6f2,_0x1efc17._0x563c76)]);}function listPosixRuntimePids(_0x5e4b25){const _0x242af3={_0x8b38cd:0x100,_0x164934:0x358,_0x13aa11:0x3ba,_0x27e8e0:0x60e,_0x92646d:0x2e1,_0x58f1b6:0x419,_0x4a2c36:0xb9,_0x19845f:0x346,_0x3ba1ab:0x37e},_0x120793={_0x27551f:0x801,_0x38dfdb:0x591,_0x524dab:0x55b,_0x415486:0x7d6,_0x573ba2:0x7e2},_0x325222={};_0x325222[_0x47ac4(_0x242af3._0x8b38cd,0x11e)]=function(_0x264480,_0x27bda3){return _0x264480===_0x27bda3;};const _0x30f85f=_0x325222;function _0x47ac4(_0x36c6b3,_0x46785b){return _0x35d151(_0x36c6b3,_0x46785b- -0x2c7);}if(!_0x5e4b25||_0x30f85f[_0x124732(_0x242af3._0x164934,_0x242af3._0x13aa11)](process[_0x124732(0x5ea,_0x242af3._0x27e8e0)],_0x124732(_0x242af3._0x92646d,_0x242af3._0x58f1b6)))return[];function _0x124732(_0x4eb207,_0x59043a){return _0x35d151(_0x59043a,_0x4eb207- -0x8d);}try{const _0x55114f={};_0x55114f[_0x47ac4(-0x38b,-0x1cc)]=_0x47ac4(-_0x242af3._0x4a2c36,0x136);const _0x3f8c33=execFileSync('ps',[_0x124732(0x4de,0x572),'-o',_0x47ac4(0xe6,-0x1e8)+'s='],_0x55114f);return _0x3f8c33[_0x47ac4(0x3af,0x2dc)]('\x0a')[_0x124732(0xa3,_0x242af3._0x92646d)](_0x5db85d=>_0x5db85d[_0x47ac4(0x3b9,0xc0)]())['filter'](Boolean)[_0x124732(_0x242af3._0x19845f,_0x242af3._0x3ba1ab)](_0x5a2002=>{function _0x97594f(_0x2b3b67,_0x1ddcf3){return _0x124732(_0x2b3b67- -0x2dd,_0x1ddcf3);}function _0x442338(_0x1e2bb3,_0x11a301){return _0x124732(_0x1e2bb3-0x4a9,_0x11a301);}const _0x1a52f5=_0x5a2002['match'](/^(\d+)\s+(.*)$/);if(!_0x1a52f5)return[];const _0x4e74c2=Number(_0x1a52f5[0x1]),_0x4f3338=_0x1a52f5[0x2];if(!Number[_0x97594f(-0x115,-0x340)+'r'](_0x4e74c2)||_0x4e74c2<=0x0||_0x30f85f[_0x442338(_0x120793._0x27551f,0x8d6)](_0x4e74c2,process[_0x97594f(0x1d7,-0x73)]))return[];if(!_0x4f3338[_0x442338(_0x120793._0x38dfdb,_0x120793._0x524dab)](_0x5e4b25))return[];if(!/\brun\b/[_0x442338(_0x120793._0x415486,_0x120793._0x573ba2)](_0x4f3338))return[];return[_0x4e74c2];});}catch{return[];}}function isPidRunning(_0x1300c2){const _0x9dfbc4={_0x4b3bd7:0x1bd};function _0x2640d5(_0x1b4485,_0x24199d){return _0x35d151(_0x1b4485,_0x24199d- -0x180);}try{return process[_0x2640d5(-_0x9dfbc4._0x4b3bd7,0x114)](_0x1300c2,0x0),!![];}catch{return![];}}function waitForPidExit(_0x90e314,_0x57ca9d){const _0xc416bb={_0x3097d2:0x2dc,_0x19cc81:0x177,_0x39c93b:0x92,_0x57bf31:0x9b,_0x11e66c:0x395},_0x2f6b44={_0x41a391:0x4bf},_0x1ef73a=Date[_0x2d4d81(0x177,_0xc416bb._0x3097d2)]()+_0x57ca9d,_0x252ea9=new Int32Array(new SharedArrayBuffer(0x4));function _0x2d4d81(_0x2cc2b2,_0x3bf24d){return _0x341e52(_0x2cc2b2- -0x271,_0x3bf24d);}function _0x3fa3ae(_0x175000,_0x41bc59){return _0x341e52(_0x175000- -_0x2f6b44._0x41a391,_0x41bc59);}while(isPidRunning(_0x90e314)){if(Date[_0x2d4d81(_0xc416bb._0x19cc81,_0xc416bb._0x39c93b)]()>=_0x1ef73a)return![];Atomics[_0x3fa3ae(-_0xc416bb._0x57bf31,-_0xc416bb._0x11e66c)](_0x252ea9,0x0,0x0,0x32);}return!![];}function startDetachedWindowsService(_0x44dc76){const _0x436589={_0x357dea:0x56f,_0x4743c4:0x6fa,_0x4bc5c1:0xa44,_0x56751c:0x335,_0x1cb8a9:0x7cd},_0x4294b2={'BNSGa':function(_0x13ce87,_0x44e898){return _0x13ce87(_0x44e898);}};function _0x336292(_0x4bbca2,_0x2d28bc){return _0x341e52(_0x4bbca2- -0x141,_0x2d28bc);}function _0x50d2b4(_0x4d2553,_0x58e1c0){return _0x341e52(_0x58e1c0-0x5c,_0x4d2553);}const _0x58b1eb=openSync(SERVICE_LOG_PATH,'a'),_0x45e0ed=openSync(SERVICE_ERROR_LOG_PATH,'a');try{const [_0x393694,..._0x43aa26]=_0x44dc76,_0xe656f6={};_0xe656f6[_0x336292(_0x436589._0x357dea,0x3e2)]=!![],_0xe656f6[_0x50d2b4(_0x436589._0x4743c4,0x9ab)]=[_0x50d2b4(_0x436589._0x4bc5c1,0x8ca),_0x58b1eb,_0x45e0ed],_0xe656f6[_0x336292(_0x436589._0x56751c,0x449)+'ide']=!![];const _0x117934=spawn(_0x393694,_0x43aa26,_0xe656f6);_0x117934[_0x336292(_0x436589._0x1cb8a9,0x5d4)]();}finally{closeSync(_0x58b1eb),_0x4294b2[_0x50d2b4(0xaaf,0x931)](closeSync,_0x45e0ed);}}function startDetachedPosixService(_0x1447ee){const _0x99c84={_0x168985:0x157},_0x47ba66=openSync(SERVICE_LOG_PATH,'a');function _0x5448cb(_0x2f0453,_0x412cd2){return _0x341e52(_0x2f0453-0xf4,_0x412cd2);}function _0x2327d3(_0x4d673b,_0x48294e){return _0x341e52(_0x48294e-_0x99c84._0x168985,_0x4d673b);}const _0x3b62b1=openSync(SERVICE_ERROR_LOG_PATH,'a');try{const [_0x2f4383,..._0x2cd6b7]=_0x1447ee,_0x3c7177={};_0x3c7177[_0x5448cb(0x7a4,0xa6d)]=!![],_0x3c7177[_0x5448cb(0xa43,0xb82)]=['ignore',_0x47ba66,_0x3b62b1];const _0x20eabf=spawn(_0x2f4383,_0x2cd6b7,_0x3c7177);_0x20eabf['unref']();}finally{closeSync(_0x47ba66),closeSync(_0x3b62b1);}}async function waitForRuntimeState(_0x311416=0x5dc,_0x1aa438=0x32){const _0x2d005a={_0x1cbc3c:0x4e8,_0x3adbba:0x469,_0x3707c0:0x563,_0x1481e8:0x349,_0x21772f:0x714},_0x1262a0={_0x586486:0x274};function _0x476628(_0x56edb3,_0x32cc8b){return _0x35d151(_0x56edb3,_0x32cc8b-_0x1262a0._0x586486);}const _0x3b5e18={'UBuCf':function(_0x4c30ef,_0x2c0906){return _0x4c30ef+_0x2c0906;},'wwoqI':function(_0x22fbb9){return _0x22fbb9();},'ZycUr':function(_0x318282,_0x54162c){return _0x318282(_0x54162c);}};function _0x51b512(_0x7cc5a,_0x4c5c0e){return _0x35d151(_0x4c5c0e,_0x7cc5a-0xf8);}const _0x54b4a8=_0x3b5e18['UBuCf'](Date[_0x476628(0x148,0x3e0)](),_0x311416);let _0x4b31b6=_0x3b5e18[_0x51b512(_0x2d005a._0x1cbc3c,_0x2d005a._0x3adbba)](getServiceStatus);while(Date[_0x476628(_0x2d005a._0x3707c0,0x3e0)]()<_0x54b4a8){if(_0x4b31b6[_0x51b512(_0x2d005a._0x1481e8,0x3da)])return _0x4b31b6;await _0x3b5e18[_0x51b512(_0x2d005a._0x21772f,0x954)](_0x55d728,_0x1aa438),_0x4b31b6=getServiceStatus();}return _0x4b31b6;}function installLinuxService(_0x826a69){try{installLinuxSystemdService(_0x826a69),removeLinuxCronRegistration();return;}catch(_0x3049fd){installLinuxCronService(_0x826a69,_0x3049fd);}}function restartLinuxService(_0xe1fc71){const _0x1e7e38={_0x34670e:0x842},_0x45a526={'QHpIV':function(_0x3431ee,_0xd8dc18,_0x5ecf81){return _0x3431ee(_0xd8dc18,_0x5ecf81);}};function _0x2822d8(_0x263bd8,_0x574654){return _0x341e52(_0x574654- -0x18,_0x263bd8);}try{restartLinuxSystemdService(_0xe1fc71),removeLinuxCronRegistration();return;}catch(_0x1faace){_0x45a526[_0x2822d8(_0x1e7e38._0x34670e,0x78a)](installLinuxCronService,_0xe1fc71,_0x1faace);}}function installLinuxSystemdService(_0x42637a){const _0x5f5807={_0x48ef12:0x963,_0x2dcb37:0x686,_0x221c1b:0x800,_0xa51c9c:0x244,_0x39a162:0x546,_0x4c07f1:0xef,_0x1e74e6:0x74a,_0x1f3cee:0x934,_0x3cbc94:0x536,_0x64e7f5:0x7a9,_0x3b98f2:0xa49,_0x59438c:0xa77,_0x188534:0x912,_0x525367:0x39d,_0x9d703c:0x29e,_0x42c7d3:0x17f,_0x16135a:0x1b6,_0x4a9aa8:0x3ff,_0x5c99f6:0x687,_0x4bdc6d:0x361,_0x2271b2:0x1a,_0x161132:0x61f},_0xa8a8b2={_0x13db5b:0x46f},_0x167cc1={};_0x167cc1[_0x3ccc50(_0x5f5807._0x48ef12,_0x5f5807._0x2dcb37)]='systemct'+'l';function _0x3ccc50(_0x22a069,_0x21fd15){return _0x341e52(_0x21fd15-0x128,_0x22a069);}_0x167cc1[_0x6d6409(0x37b,0x54c)]=_0x3ccc50(_0x5f5807._0x221c1b,0x996),_0x167cc1[_0x6d6409(0x3f8,_0x5f5807._0xa51c9c)]=_0x3ccc50(0x8df,0x835),_0x167cc1[_0x3ccc50(_0x5f5807._0x39a162,0x61f)]='--now';const _0x70376e=_0x167cc1;if(!commandExists(_0x70376e[_0x6d6409(_0x5f5807._0x4c07f1,0x14b)]))throw new Error(_0x3ccc50(_0x5f5807._0x1e74e6,_0x5f5807._0x1f3cee)+_0x3ccc50(_0x5f5807._0x3cbc94,_0x5f5807._0x64e7f5)+_0x3ccc50(0xd1a,_0x5f5807._0x3b98f2)+'le');const _0x2d0437={};_0x2d0437['recursiv'+'e']=!![],_0x4fd96b(dirname(LINUX_SERVICE_PATH),_0x2d0437),_0x162251(LINUX_SERVICE_PATH,buildLinuxSystemdUnit(_0x42637a,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH),_0x6d6409(0x20a,0x4be));const _0x33d890={};_0x33d890[_0x3ccc50(0x898,_0x5f5807._0x59438c)]=_0x70376e[_0x3ccc50(0x73f,_0x5f5807._0x188534)],execFileSync(_0x6d6409(_0x5f5807._0x525367,0x691)+'l',[_0x6d6409(_0x5f5807._0x9d703c,_0x5f5807._0x42c7d3),'daemon-r'+_0x6d6409(0x83,-_0x5f5807._0x16135a)],_0x33d890);const _0x2806a0={};function _0x6d6409(_0x317e3c,_0x5d94d7){return _0x341e52(_0x317e3c- -_0xa8a8b2._0x13db5b,_0x5d94d7);}_0x2806a0[_0x3ccc50(0x88e,0xa77)]=_0x6d6409(_0x5f5807._0x4a9aa8,_0x5f5807._0x5c99f6),execFileSync(_0x6d6409(_0x5f5807._0x525367,_0x5f5807._0x4bdc6d)+'l',[_0x70376e[_0x6d6409(0x3f8,0x513)],_0x6d6409(-_0x5f5807._0x2271b2,-0x113),_0x70376e[_0x3ccc50(0x40b,_0x5f5807._0x161132)],SYSTEMD_UNIT_NAME],_0x2806a0);}function restartLinuxSystemdService(_0x35920a){const _0x5f33aa={_0x3c5876:0x513,_0x42ea01:0x88a,_0x3782b8:0x648,_0xdbbf2d:0x724,_0x33213a:0xc31,_0x3e131c:0x942,_0x452ccf:0x750,_0x2fe1e1:0x9cd,_0x4fb9b6:0x64f,_0x1ff277:0xb72,_0x202f40:0x8ec,_0x42fcbe:0x5f1};function _0x523b0b(_0x2f007e,_0x1b8ed0){return _0x35d151(_0x2f007e,_0x1b8ed0-0x2fa);}const _0x47bec2={};_0x47bec2[_0x6ad3b5(0x812,_0x5f33aa._0x3c5876)]=_0x523b0b(0xa90,_0x5f33aa._0x42ea01)+_0x6ad3b5(0x719,0x4c4)+_0x6ad3b5(0x9b8,0x764)+'le',_0x47bec2[_0x523b0b(_0x5f33aa._0x3782b8,0x942)]='utf8',_0x47bec2[_0x6ad3b5(0x506,0x5cb)]=_0x6ad3b5(0x75f,0x672)+'eload';const _0x26658c=_0x47bec2;if(!commandExists(_0x523b0b(0x647,_0x5f33aa._0x42ea01)+'l'))throw new Error(_0x26658c[_0x6ad3b5(_0x5f33aa._0xdbbf2d,_0x5f33aa._0x3c5876)]);if(!_0xf90435(LINUX_SERVICE_PATH)){installLinuxSystemdService(_0x35920a);return;}_0x162251(LINUX_SERVICE_PATH,buildLinuxSystemdUnit(_0x35920a,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH),_0x26658c[_0x523b0b(_0x5f33aa._0x33213a,_0x5f33aa._0x3e131c)]);const _0x463fa5={};_0x463fa5[_0x523b0b(_0x5f33aa._0x452ccf,_0x5f33aa._0x2fe1e1)]=_0x523b0b(0xa87,0x8ec),execFileSync(_0x6ad3b5(0x51e,_0x5f33aa._0x4fb9b6)+'l',['--user',_0x26658c[_0x523b0b(0x732,0x806)]],_0x463fa5);const _0x5e6186={};_0x5e6186['stdio']=_0x523b0b(_0x5f33aa._0x1ff277,_0x5f33aa._0x202f40);function _0x6ad3b5(_0x33848f,_0xeec0d3){return _0x35d151(_0x33848f,_0xeec0d3-0xbf);}execFileSync(_0x523b0b(_0x5f33aa._0x42fcbe,0x88a)+'l',['--user','restart',SYSTEMD_UNIT_NAME],_0x5e6186);}function installLinuxCronService(_0x3b42a4,_0x28d892){const _0x55d583={_0x366c25:0x633,_0x5063f8:0x39e,_0x550358:0x815,_0x39b2ad:0x683,_0x2c76a4:0x67c,_0x3d430c:0x6fd,_0x303cca:0x595,_0x132882:0x5b0},_0x1cad49={_0x341618:0x54},_0xc9a32e={'dPeFo':function(_0x4218b9,_0x1bd49a){return _0x4218b9(_0x1bd49a);},'KRXko':function(_0x4c8f49,_0x5746b4){return _0x4c8f49+_0x5746b4;}};if(!_0xc9a32e[_0x29e730(0x35a,_0x55d583._0x366c25)](commandExists,_0x29e730(0x364,0x1ca)))throw new Error(_0x311526(0x3ad,_0x55d583._0x5063f8)+'rvice\x20in'+_0x29e730(0x6cf,_0x55d583._0x550358)+_0x311526(0x725,_0x55d583._0x39b2ad)+_0x29e730(_0x55d583._0x2c76a4,_0x55d583._0x3d430c)+'\x20crontab'+'\x20fallbac'+_0x311526(_0x55d583._0x303cca,0x75e)+_0x29e730(0x29d,0xa8)+formatError(_0x28d892));rmIfExists(LINUX_SERVICE_PATH);const _0x2a76b6=buildLinuxCronEntry(_0x3b42a4,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH);writeLinuxCrontabEntry(_0x2a76b6),_0x162251(LINUX_CRON_RECORD_PATH,_0xc9a32e[_0x29e730(0x5b9,0x50d)](_0x2a76b6,'\x0a'),_0x311526(0x625,_0x55d583._0x132882));function _0x29e730(_0xfa7caa,_0x55f30e){return _0x341e52(_0xfa7caa- -0x1dd,_0x55f30e);}function _0x311526(_0x14d2ef,_0x4646cb){return _0x341e52(_0x14d2ef- -_0x1cad49._0x341618,_0x4646cb);}stopRunningProcess(),_0xc9a32e['dPeFo'](startDetachedPosixService,_0x3b42a4);}function hasLinuxCronRegistration(){const _0x743ff4={_0x23325f:0xe,_0x3db928:0x1d2,_0x46438c:0x6fa,_0x201ba2:0x53},_0x308ecb={_0x435652:0x3ba},_0x1aa8a={_0x1b3bfb:0x48e},_0x119703={};_0x119703[_0x35ecdd(0x39b,0x1e8)]=_0x11451b(_0x743ff4._0x23325f,_0x743ff4._0x3db928);const _0x4d0e57=_0x119703;if(process[_0x35ecdd(0x539,_0x743ff4._0x46438c)]!==_0x4d0e57[_0x11451b(0x2c7,0x537)])return![];function _0x11451b(_0x36bf94,_0x397f93){return _0x341e52(_0x36bf94- -_0x1aa8a._0x1b3bfb,_0x397f93);}function _0x35ecdd(_0xb04281,_0x74982f){return _0x341e52(_0xb04281- -_0x308ecb._0x435652,_0x74982f);}return readLinuxCrontab()[_0x11451b(_0x743ff4._0x201ba2,-0xb4)](_0x32d1bf=>_0x32d1bf[_0x35ecdd(0x37,0x1b7)](LINUX_CRON_MARKER));}function removeLinuxCronRegistration(){const _0x2dd170={_0x407b9e:0x788,_0x11ea51:0x56b};function _0x8210d8(_0x16fba1,_0x56645e){return _0x341e52(_0x56645e- -0x16b,_0x16fba1);}if(process[_0x8210d8(0x66d,_0x2dd170._0x407b9e)]!==_0x3f730c(0x60d,0x476))return;if(commandExists(_0x8210d8(_0x2dd170._0x11ea51,0x3d6))){const _0x51bbc4=readLinuxCrontab()['filter'](_0x56eb62=>!_0x56eb62[_0x3f730c(0x512,0x3cb)](LINUX_CRON_MARKER));writeLinuxCrontab(_0x51bbc4);}function _0x3f730c(_0x5c40cf,_0xf143a0){return _0x341e52(_0xf143a0- -0x26,_0x5c40cf);}rmIfExists(LINUX_CRON_RECORD_PATH);}function writeLinuxCrontabEntry(_0x1a2e6d){const _0x1c5ee3={_0x4f1e0e:0x170,_0x2811bd:0x642},_0x4f8a1a=readLinuxCrontab()[_0x32a9f2(_0x1c5ee3._0x4f1e0e,0x44e)](_0x1477d4=>!_0x1477d4['includes'](LINUX_CRON_MARKER));function _0x4baa46(_0x1f8f3b,_0x43689b){return _0x341e52(_0x43689b-0x96,_0x1f8f3b);}function _0x32a9f2(_0x5e9bfa,_0x4c28fa){return _0x341e52(_0x5e9bfa- -0x25f,_0x4c28fa);}_0x4f8a1a[_0x32a9f2(_0x1c5ee3._0x2811bd,0x533)](_0x1a2e6d),writeLinuxCrontab(_0x4f8a1a);}function readLinuxCrontab(){const _0x483bb5={_0x4bde00:0x6e8,_0x1a8a3b:0x600,_0x157217:0x88e},_0x45627d={_0x1041ad:0x6f};function _0x376c49(_0x33c5a6,_0x1113c9){return _0x341e52(_0x33c5a6- -0x22f,_0x1113c9);}if(!commandExists('crontab'))return[];function _0x412814(_0x1bda3b,_0x5101cb){return _0x341e52(_0x1bda3b-_0x45627d._0x1041ad,_0x5101cb);}try{const _0x460fae={};_0x460fae[_0x376c49(0x148,-0x131)]=_0x412814(_0x483bb5._0x4bde00,_0x483bb5._0x1a8a3b);const _0x2559e5=execFileSync('crontab',['-l'],_0x460fae);return _0x2559e5[_0x412814(_0x483bb5._0x157217,0x65a)]('\x0a')[_0x376c49(0x17d,0x489)](_0x490fd6=>_0x490fd6[_0x376c49(0x635,0x86f)]())[_0x412814(0x43e,0x1b3)](_0x1fa1c5=>_0x1fa1c5[_0x376c49(0x63a,0x7cf)]>0x0);}catch(_0x2c5f46){if(isMissingCrontabError(_0x2c5f46))return[];throw _0x2c5f46;}}function writeLinuxCrontab(_0x34c82b){const _0xf1e3ee={_0x471bef:0x4c,_0x277e54:0x33b,_0x50c91b:0x181,_0x371258:0x134,_0x57e02e:0x24f,_0x276e67:0x467,_0x359264:0x1c2,_0x4f7626:0x442,_0x1a82bf:0x694,_0x133cff:0x804,_0x357562:0x694},_0x4665a3={_0x209ef1:0x279};function _0x1ccc8f(_0x668d60,_0x43ad7f){return _0x35d151(_0x43ad7f,_0x668d60-0xa2);}const _0x21076b={'ZkFFt':function(_0x390bf4,_0x71175){return _0x390bf4(_0x71175);},'rPenu':_0x43bb43(_0xf1e3ee._0x471bef,-0x1a5)};function _0x43bb43(_0x4dd32b,_0x1bfb8a){return _0x35d151(_0x1bfb8a,_0x4dd32b- -_0x4665a3._0x209ef1);}if(!_0x21076b[_0x1ccc8f(_0xf1e3ee._0x277e54,_0xf1e3ee._0x50c91b)](commandExists,_0x43bb43(0x4c,-_0xf1e3ee._0x371258)))return;if(_0x34c82b[_0x1ccc8f(0x68f,0x83a)]===0x0){execIgnoreFailure(_0x21076b[_0x1ccc8f(0x31a,_0xf1e3ee._0x57e02e)],['-r']);return;}execFileSync('crontab',['-'],{'input':_0x34c82b[_0x43bb43(_0xf1e3ee._0x276e67,_0xf1e3ee._0x359264)]('\x0a')+'\x0a','encoding':_0x43bb43(0x184,_0xf1e3ee._0x4f7626),'stdio':['pipe',_0x1ccc8f(_0xf1e3ee._0x1a82bf,_0xf1e3ee._0x133cff),_0x1ccc8f(_0xf1e3ee._0x357562,0x669)]});}function resolveScriptPath(_0x17ef5f){const _0x3ffb9f=_0x17ef5f?.['trim']()||process['argv'][0x1]?.['trim']()||'';if(!_0x3ffb9f)return'';try{return realpathSync(_0x3ffb9f);}catch{return _0x3ffb9f;}}function ensureLaunchScriptExecutable(_0x23345f,_0x25be20){const _0x1f0b08={_0x590b3e:0x88b,_0x32ba4d:0x580},_0x23292c={};_0x23292c[_0x3ae993(_0x1f0b08._0x590b3e,_0x1f0b08._0x32ba4d)]=function(_0x4b1753,_0x3b19c3){return _0x4b1753===_0x3b19c3;};function _0x3ae993(_0x3f30be,_0x130ae7){return _0x341e52(_0x130ae7- -0x5b,_0x3f30be);}const _0x216529=_0x23292c;function _0x2ce5a7(_0x3c4825,_0x190291){return _0x341e52(_0x3c4825- -0x298,_0x190291);}if(_0x216529[_0x3ae993(0x3e6,0x580)](_0x25be20,'win32')||!_0xf90435(_0x23345f))return;try{chmodSync(_0x23345f,0x1ed);}catch{}}function writeServiceLauncher(_0xef2045){const _0x58c470={_0x55f6ff:0x837,_0x4f92c5:0x6f1,_0x20d14b:0x546,_0x428784:0x8d9,_0x26f8c3:0x173,_0x414af9:0x333,_0x553be6:0x202,_0x69f317:0x794,_0x22eb6f:0x5a9,_0x1c6391:0x68f,_0x1e0f3e:0x607,_0x8ef15e:0x7f5,_0x2bf8c4:0x733,_0x4c3503:0x12a,_0x2933b1:0x7c2,_0xc61659:0x3e1,_0xa78954:0x3ff,_0x594d34:0x5c7,_0x1d9965:0x660,_0x3db71b:0x766,_0x4c1cdd:0x749,_0x49aec5:0x70b,_0x8b4135:0x697,_0x22a8c4:0x404,_0x4b3c7b:0x39e,_0x23f1e1:0x351,_0x3c9d21:0x320,_0x4177bc:0x5e5,_0xec3a50:0x42d,_0x16e790:0x58f,_0xe44466:0x714,_0x44eb4f:0x7a1,_0x3795c7:0x649,_0x127769:0x536,_0x1fc3c5:0x7d1,_0x368ff5:0x632},_0xa390a6={_0x415d6c:0x18b},_0x321420={_0x5e0a3f:0x47},_0x5c6dfb={'DFwKy':function(_0x87f175){return _0x87f175();},'hHTum':function(_0x3fbf41,_0x2bd69a){return _0x3fbf41(_0x2bd69a);},'oRvRU':function(_0x5c1615,_0xeb23f0){return _0x5c1615(_0xeb23f0);},'QsjZz':_0x2ee742(0x6a6,_0x58c470._0x55f6ff)+'nd\x20-v\x20no'+'de\x20>/dev'+_0x2ee742(_0x58c470._0x4f92c5,0x553)+_0x2ee742(_0x58c470._0x20d14b,0x539),'PHqcj':function(_0x5cd965,_0x3292a7,_0x547e21,_0x1ab3b3){return _0x5cd965(_0x3292a7,_0x547e21,_0x1ab3b3);}};_0x5c6dfb[_0x3a5ac0(0x702,0x73f)](ensureServiceDirs);function _0x2ee742(_0x3eb805,_0x2da93f){return _0x341e52(_0x2da93f- -_0x321420._0x5e0a3f,_0x3eb805);}const _0x2b2298=[_0x2ee742(0x872,_0x58c470._0x428784)+'h',_0x3a5ac0(0x26e,0x30f)+_0x3a5ac0(_0x58c470._0x26f8c3,_0x58c470._0x414af9)+_0x5c6dfb[_0x3a5ac0(0x36d,0x650)](escapeShellDoubleQuoted,_0xef2045['pathEnv'])+'\x22',_0x2ee742(_0x58c470._0x553be6,0x329)+_0x3a5ac0(0x191,0x2c5)+_0x5c6dfb[_0x2ee742(0x945,_0x58c470._0x69f317)](escapeShellDoubleQuoted,_0xef2045['nodePath'])+'\x22',_0x2ee742(0x2ca,_0x58c470._0x22eb6f)+_0x2ee742(0x4ea,0x477)+_0x5c6dfb[_0x2ee742(0x317,0x456)](escapeShellDoubleQuoted,_0xef2045[_0x2ee742(0x7a6,0x57f)+'th'])+'\x22',_0x3a5ac0(_0x58c470._0x1c6391,0x6e9)+_0x2ee742(_0x58c470._0x1e0f3e,0x6d2)+_0x2ee742(_0x58c470._0x8ef15e,_0x58c470._0x2bf8c4)+_0x2ee742(_0x58c470._0x4c3503,0x3db),_0x3a5ac0(0x780,0x4db)+_0x2ee742(_0x58c470._0x2933b1,0x667)+_0x2ee742(0x38c,_0x58c470._0xc61659)+_0x3a5ac0(_0x58c470._0xa78954,_0x58c470._0x594d34)+'H\x22\x20run\x20-'+_0x2ee742(_0x58c470._0x1d9965,_0x58c470._0x3db71b),'fi',_0x5c6dfb[_0x3a5ac0(_0x58c470._0x1d9965,0x501)],'\x20\x20exec\x20n'+'ode\x20\x22$SC'+_0x2ee742(_0x58c470._0x4c1cdd,_0x58c470._0x49aec5)+_0x3a5ac0(0x231,0x2cd)+'-service','fi',_0x3a5ac0(_0x58c470._0x8b4135,_0x58c470._0x22a8c4)+_0x3a5ac0(_0x58c470._0x4b3c7b,_0x58c470._0x23f1e1)+_0x2ee742(0x347,_0x58c470._0x3c9d21)+_0x3a5ac0(0x585,_0x58c470._0x4177bc)+_0x3a5ac0(_0x58c470._0xec3a50,_0x58c470._0x16e790)+'\x20Bridge\x20'+_0x3a5ac0(-0x49,0x21c)+_0x3a5ac0(_0x58c470._0xe44466,0x54a),_0x2ee742(0x916,0x8d1),''];function _0x3a5ac0(_0x3ea324,_0x55fe41){return _0x341e52(_0x55fe41- -_0xa390a6._0x415d6c,_0x3ea324);}return _0x5c6dfb[_0x3a5ac0(_0x58c470._0x44eb4f,_0x58c470._0x3795c7)](_0x162251,SERVICE_LAUNCHER_PATH,_0x2b2298[_0x3a5ac0(_0x58c470._0x127769,_0x58c470._0x1fc3c5)]('\x0a'),_0x2ee742(0x760,_0x58c470._0x368ff5)),SERVICE_LAUNCHER_PATH;}function escapeShellDoubleQuoted(_0x137eca){const _0x19dc83={_0x354b0c:0x477,_0x3c4a9a:0x35e},_0x1e6ef9={_0x48b3b2:0x39b},_0x3597f2={_0x280886:0x4b4};function _0x34cdee(_0x1f2b29,_0x174380){return _0x341e52(_0x174380- -_0x3597f2._0x280886,_0x1f2b29);}function _0x6292d8(_0xcbd533,_0xde41c5){return _0x341e52(_0xcbd533- -_0x1e6ef9._0x48b3b2,_0xde41c5);}return _0x137eca[_0x6292d8(_0x19dc83._0x354b0c,0x596)+'ll']('\x5c','\x5c\x5c')[_0x34cdee(0x13c,_0x19dc83._0x3c4a9a)+'ll']('\x22','\x5c\x22')['replaceA'+'ll']('$','\x5c$')['replaceA'+'ll']('`','\x5c`');}function escapeShellWord(_0x514ca4){const _0x2c88d2={_0x2f7bac:0x74a,_0x2d4f51:0x341,_0x5340ab:0x396,_0x50e94d:0x383};function _0x173a76(_0x222232,_0x1fcb6a){return _0x35d151(_0x222232,_0x1fcb6a- -0x255);}if(_0x514ca4[_0x52b1f9(0xa1c,_0x2c88d2._0x2f7bac)]===0x0)return'\x27\x27';function _0x52b1f9(_0x3d56f6,_0x5ed257){return _0x35d151(_0x5ed257,_0x3d56f6-0x42f);}return'\x27'+_0x514ca4[_0x173a76(0x50a,_0x2c88d2._0x2d4f51)+'ll']('\x27',_0x173a76(_0x2c88d2._0x5340ab,_0x2c88d2._0x50e94d))+'\x27';}function buildWindowsRunCommand(_0x482d57){const _0x546931={_0x4269ec:0x3dc,_0x29fb1f:0x151},_0x1ee88c={_0x1f392e:0x281};function _0x389960(_0x182152,_0x11702e){return _0x35d151(_0x182152,_0x11702e- -_0x1ee88c._0x1f392e);}return _0x482d57[_0x389960(-_0x546931._0x4269ec,-_0x546931._0x29fb1f)](escapeWindowsArg)['join']('\x20');}function ensureServiceDirs(){const _0x2df320={_0x1182c:0x20c},_0x589b88={_0x36a39b:0x35e},_0x13313a={'BtxPy':function(_0x1d89a7,_0x2fe884,_0x2734f8){return _0x1d89a7(_0x2fe884,_0x2734f8);}},_0x141df4={};function _0x19f0c3(_0x58d724,_0x151d25){return _0x35d151(_0x151d25,_0x58d724- -_0x589b88._0x36a39b);}_0x141df4[_0x19f0c3(_0x2df320._0x1182c,0x1c0)+'e']=!![];function _0x3eb268(_0x21f9bf,_0x3a7c60){return _0x35d151(_0x3a7c60,_0x21f9bf-0xa7);}_0x13313a[_0x3eb268(0x1bf,0x11f)](_0x4fd96b,SERVICE_DIR,_0x141df4);const _0x2bd0ff={};_0x2bd0ff[_0x3eb268(0x611,0x3eb)+'e']=!![],_0x4fd96b(LOG_DIR,_0x2bd0ff);}function escapeXml(_0x424584){const _0x5f3bff={_0x1b82ec:0x25f,_0x1a7c45:0x217,_0x4cfbb5:0x2c,_0x165f67:0x233,_0x3f4451:0x4dc,_0x1c64f8:0x217,_0x5c671f:0x66,_0x2f78df:0x52c},_0x47118e={_0xfae4dd:0x37f},_0x2645f5={_0x39be7f:0xba},_0x1628d9={};function _0x270b66(_0x5772e7,_0x1d658e){return _0x35d151(_0x5772e7,_0x1d658e- -_0x2645f5._0x39be7f);}function _0xcf357e(_0x34241a,_0x4a94fd){return _0x35d151(_0x4a94fd,_0x34241a- -_0x47118e._0xfae4dd);}_0x1628d9[_0xcf357e(-_0x5f3bff._0x1b82ec,-0x14b)]=_0xcf357e(-0x28a,-0x38a);const _0x5b61a1=_0x1628d9;return _0x424584[_0xcf357e(_0x5f3bff._0x1a7c45,-_0x5f3bff._0x4cfbb5)+'ll']('&','&amp;')[_0x270b66(_0x5f3bff._0x165f67,_0x5f3bff._0x3f4451)+'ll']('<','&lt;')[_0xcf357e(_0x5f3bff._0x1c64f8,0x1d3)+'ll']('>',_0x5b61a1[_0x270b66(0xc,_0x5f3bff._0x5c671f)])[_0x270b66(_0x5f3bff._0x2f78df,0x4dc)+'ll']('\x22','&quot;')['replaceA'+'ll']('\x27',_0xcf357e(0x55,0xd9));}function escapeSystemdArg(_0x36f95f){const _0x35d313={_0x3acd2f:0xf5};function _0x47cbae(_0x107666,_0x727ab3){return _0x35d151(_0x727ab3,_0x107666- -_0x35d313._0x3acd2f);}return'\x22'+_0x36f95f[_0x47cbae(0x4a1,0x67b)+'ll']('\x5c','\x5c\x5c')['replaceA'+'ll']('\x22','\x5c\x22')+'\x22';}function escapeWindowsArg(_0x18cc50){const _0x2cbac7={_0x461cab:0x262};function _0x29a646(_0x1d0842,_0x5e8c6c){return _0x341e52(_0x1d0842- -_0x2cbac7._0x461cab,_0x5e8c6c);}return'\x22'+_0x18cc50[_0x29a646(0x5b0,0x414)+'ll']('\x22','\x5c\x22')+'\x22';}function commandSucceeds(_0xd6b811,_0x2f46a1){const _0x3fb99f={_0x52c88a:0x864,_0x622333:0xa41},_0x31594c={_0x3321c5:0x36e};function _0x19dbfb(_0x310009,_0x8b8d1d){return _0x35d151(_0x310009,_0x8b8d1d-_0x31594c._0x3321c5);}try{const _0x558395={};return _0x558395[_0x19dbfb(_0x3fb99f._0x52c88a,_0x3fb99f._0x622333)]='ignore',execFileSync(_0xd6b811,_0x2f46a1,_0x558395),!![];}catch{return![];}}function commandExists(_0x332c99){const _0x3feef0={_0x37613a:0x4f4,_0x416778:0x874,_0x5a8502:0x875,_0x40ac29:0x715,_0x2726c9:0x261,_0x32f921:0x345,_0x1aafcf:0x110},_0x46cd6f={};_0x46cd6f[_0x288ee8(0x345,_0x3feef0._0x37613a)]=_0x4b9230(0x62c,_0x3feef0._0x416778);function _0x288ee8(_0x56d53c,_0x3bd277){return _0x341e52(_0x56d53c- -0x491,_0x3bd277);}_0x46cd6f[_0x4b9230(0x7f8,0x922)]=_0x4b9230(_0x3feef0._0x5a8502,_0x3feef0._0x40ac29);const _0x24c015=_0x46cd6f;function _0x4b9230(_0x54a191,_0x232ed1){return _0x341e52(_0x54a191-0x42,_0x232ed1);}if(process[_0x288ee8(0x462,_0x3feef0._0x2726c9)]===_0x24c015[_0x288ee8(_0x3feef0._0x32f921,_0x3feef0._0x1aafcf)])return commandSucceeds(_0x24c015['XAypN'],[_0x332c99]);return commandSucceeds('sh',['-c',_0x288ee8(0x1b5,0x137)+'-v\x20'+escapeShellWord(_0x332c99)]);}function execIgnoreFailure(_0x2c58eb,_0x42ec86){const _0x164700={_0x4f7145:0x288,_0x14eff9:0x1d5,_0x800e21:0x51},_0x32c5c5={};_0x32c5c5['OPjRL']=_0x408bde(_0x164700._0x4f7145,0x2f5);function _0x5d6b29(_0x40c4ee,_0x4b0fa0){return _0x35d151(_0x4b0fa0,_0x40c4ee-0x234);}function _0x408bde(_0x4d88a5,_0x376dc9){return _0x35d151(_0x376dc9,_0x4d88a5- -0x36a);}const _0x2eb45a=_0x32c5c5;try{const _0x11de0a={};_0x11de0a[_0x408bde(0x369,_0x164700._0x14eff9)]=_0x2eb45a[_0x408bde(-_0x164700._0x800e21,-0x14e)],execFileSync(_0x2c58eb,_0x42ec86,_0x11de0a);}catch{}}function rmIfExists(_0x16ce99){if(!_0xf90435(_0x16ce99))return;const _0x3f1a14={};_0x3f1a14['force']=!![],_0x26bed0(_0x16ce99,_0x3f1a14);}function isMissingCrontabError(_0x2e9738){const _0x11f91b={_0x4b5c13:0x7d,_0x106627:0x13a,_0x2abeca:0x27d,_0x2f4cb1:0x4ac,_0x58bcf5:0x27c,_0xfafb48:0x370,_0x3fd86e:0x691,_0x27b5b4:0x103,_0x290c40:0x240,_0x5c6589:0x263,_0x47cf85:0x1aa},_0x391b4b={_0x3b7021:0x457},_0x3f04fe={_0xc32b8a:0x198},_0x1e77e5={};_0x1e77e5['HvhdC']=function(_0x56c1ea,_0x3ece6d){return _0x56c1ea===_0x3ece6d;};function _0x44188f(_0x291ea7,_0x4d0a37){return _0x341e52(_0x291ea7- -_0x3f04fe._0xc32b8a,_0x4d0a37);}function _0x3d16f6(_0x1c3eaf,_0x5874f8){return _0x341e52(_0x5874f8- -_0x391b4b._0x3b7021,_0x1c3eaf);}_0x1e77e5[_0x3d16f6(-0xf5,0x172)]=_0x3d16f6(-0x2da,-_0x11f91b._0x4b5c13),_0x1e77e5[_0x3d16f6(-_0x11f91b._0x106627,-0x5c)]='no\x20cront'+_0x44188f(0x23e,0x2e0);const _0x1528bc=_0x1e77e5;if(!(_0x2e9738 instanceof Error))return![];const _0x22a783=_0x2e9738[_0x44188f(_0x11f91b._0x2abeca,0xce)][_0x3d16f6(0x5f6,0x461)+_0x3d16f6(0x5a3,_0x11f91b._0x2f4cb1)](),_0x57f18d=_0x2e9738[_0x3d16f6(_0x11f91b._0x58bcf5,_0x11f91b._0xfafb48)],_0x440913=_0x1528bc[_0x44188f(0x52d,0x461)](typeof _0x57f18d,_0x1528bc[_0x44188f(0x431,0x3b2)])?_0x57f18d[_0x44188f(0x720,_0x11f91b._0x3fd86e)+_0x3d16f6(0x3ad,0x4ac)]():Buffer[_0x3d16f6(-_0x11f91b._0x27b5b4,0x4)](_0x57f18d)?_0x57f18d[_0x3d16f6(_0x11f91b._0x290c40,0x144)](_0x3d16f6(0x37c,0x222))[_0x44188f(0x720,0x542)+'ase']():'';return _0x22a783['includes'](_0x1528bc[_0x44188f(_0x11f91b._0x5c6589,0x196)])||_0x440913['includes'](_0x3d16f6(_0x11f91b._0x47cf85,0x3d4)+_0x3d16f6(0x1f8,-0x81));}function formatError(_0xc98423){const _0x55f925={_0x269f9a:0x172,_0x3c9f13:0x463,_0x191946:0x172,_0xc715ba:0xc1},_0x281494={_0x2680c2:0x137};function _0x1704e5(_0x513b02,_0x43e012){return _0x341e52(_0x43e012- -0x587,_0x513b02);}const _0x1679b7={'NLZCD':function(_0x10a394,_0x4c0640){return _0x10a394(_0x4c0640);}};function _0x5d7afc(_0x1b7225,_0x403244){return _0x341e52(_0x403244- -_0x281494._0x2680c2,_0x1b7225);}if(_0xc98423 instanceof Error&&_0xc98423[_0x1704e5(-0x22b,-_0x55f925._0x269f9a)])return _0xc98423[_0x1704e5(-_0x55f925._0x3c9f13,-_0x55f925._0x191946)];return _0x1679b7[_0x1704e5(0x350,_0x55f925._0xc715ba)](String,_0xc98423);}import{execFile}from'child_process';import{randomBytes}from'crypto';import{existsSync as _0x57e205,readFileSync as _0x5806a3}from'fs';import{chmod,mkdir,readFile,rename,rm,writeFile}from'fs/promises';import{homedir as _0xcdcfe7}from'os';import{dirname as _0x1d553f,join as _0x4cb7e2,resolve}from'path';var DEFAULT_GATEWAY_URL=_0x35d151(0x22a,0x1f1)+_0x341e52(0x871,0x942)+_0x35d151(-0x3b,0x16f),DEVICE_BOOTSTRAP_TOKEN_TTL_MS=0xa*0x3c*0x3e8,BOOTSTRAP_FILENAME=_0x341e52(0x73b,0x4a3)+'p.json',PAIRING_TOKEN_BYTES=0x20,OPENCLAW_CLI_COMMAND=_0x35d151(0x28a,0x548),withBootstrapLock=createAsyncLock();function resolveGatewayUrl(_0x1bd9d5){const _0x51925e={_0x391619:0x33,_0x1aea7f:0x366,_0x4b333f:0x4ed,_0x4ec99f:0x2bc},_0x34fadd={_0x2c1a9d:0x404},_0x3173d2={};_0x3173d2['BxVnP']=_0x5a4aca(0x1b2,0x88);const _0x3bffc1=_0x3173d2,_0x3380a1=_0x1bd9d5?.[_0x5a4aca(0x1ff,-_0x51925e._0x391619)]();function _0x5a4aca(_0x267a75,_0x114107){return _0x341e52(_0x267a75- -_0x34fadd._0x2c1a9d,_0x114107);}if(_0x3380a1)return _0x3380a1;function _0x4f0d40(_0x423577,_0x384264){return _0x341e52(_0x423577- -0x3ac,_0x384264);}const _0x2784ab=readOpenClawInfo();if(typeof _0x2784ab['gatewayP'+_0x4f0d40(_0x51925e._0x1aea7f,_0x51925e._0x4b333f)]===_0x3bffc1[_0x5a4aca(0x201,0x4b)])return'ws://127'+_0x5a4aca(0x17b,0x3e4)+_0x2784ab[_0x5a4aca(0x308,0x2a7)+_0x5a4aca(0x30e,_0x51925e._0x4ec99f)];return DEFAULT_GATEWAY_URL;}function readOpenClawInfo(){const _0x7961e0={_0x4c355c:0x105,_0x38e80b:0x561,_0x11664c:0x53c,_0x3e85a4:0x71f,_0x4d83e8:0x4c2,_0x23c652:0x3ae,_0x9ceb94:0x52a,_0x14f534:0x568,_0x473c67:0x46b,_0x56f184:0x6ff,_0x51fdcc:0x9a,_0x35fbf3:0x1ea,_0x4bc962:0x1a1,_0x108d93:0x167,_0x46338c:0x92,_0x546792:0x3a,_0x2f2f18:0xdf,_0x258592:0x3db,_0x210870:0x182,_0x237f86:0x325,_0x309db6:0x739,_0xf979da:0x9c0,_0x5b225a:0x824,_0x392f3d:0x3b1,_0x183fe8:0x11c,_0x222994:0x52a,_0x5a6461:0x5ec,_0xcd1cee:0x8bd,_0xcbd5a9:0x50,_0x2836c8:0x499,_0x5b344d:0x594,_0x138b2e:0x5ec,_0x364070:0x747},_0x501119={'mlIlK':function(_0x3399b0){return _0x3399b0();},'eeIMS':function(_0x13b411,_0x32bb11,_0x3e7a89){return _0x13b411(_0x32bb11,_0x3e7a89);},'AgOtZ':'utf8','FBOMp':function(_0x3ad1ac,_0x129c41){return _0x3ad1ac===_0x129c41;},'jbyeF':_0x2a0fa1(_0x7961e0._0x4c355c,-0x98),'Unoci':function(_0x408085,_0x2677d4){return _0x408085(_0x2677d4);},'FwJZe':function(_0x1fa141){return _0x1fa141();}};function _0x12c43f(_0x50b223,_0x262065){return _0x35d151(_0x262065,_0x50b223-0xfe);}const _0x47ef15=_0x501119['mlIlK'](resolveOpenClawPaths);if(!_0x57e205(_0x47ef15[_0x12c43f(0x6f7,0x879)+'th']))return{'configFound':![],'gatewayPort':null,'authMode':null,'token':_0x501119[_0x12c43f(_0x7961e0._0x38e80b,_0x7961e0._0x11664c)](readGatewayTokenEnv),'password':readGatewayPasswordEnv()};function _0x2a0fa1(_0x5b903d,_0x84e1ac){return _0x35d151(_0x84e1ac,_0x5b903d- -0x34d);}try{const _0x554fb4=JSON[_0x12c43f(_0x7961e0._0x3e85a4,0x734)](_0x501119[_0x12c43f(_0x7961e0._0x4d83e8,_0x7961e0._0x23c652)](_0x5806a3,_0x47ef15['configPa'+'th'],_0x501119[_0x12c43f(0x4b0,0x6eb)])),_0xd292e8=_0x554fb4[_0x12c43f(_0x7961e0._0x9ceb94,0x22a)]?.[_0x12c43f(_0x7961e0._0x14f534,_0x7961e0._0x473c67)],_0x26c1d9=typeof _0xd292e8===_0x12c43f(0x438,_0x7961e0._0x56f184)&&Number['isIntege'+'r'](_0xd292e8)?_0xd292e8:null,_0x4cde5e=_0x554fb4['gateway']?.[_0x2a0fa1(-_0x7961e0._0x51fdcc,-_0x7961e0._0x35fbf3)]?.['mode']===_0x2a0fa1(_0x7961e0._0x4bc962,_0x7961e0._0x108d93)||_0x501119[_0x2a0fa1(_0x7961e0._0x46338c,-_0x7961e0._0x546792)](_0x554fb4[_0x2a0fa1(_0x7961e0._0x2f2f18,_0x7961e0._0x258592)]?.[_0x2a0fa1(-_0x7961e0._0x51fdcc,-_0x7961e0._0x210870)]?.[_0x2a0fa1(_0x7961e0._0x237f86,0x51f)],_0x501119[_0x12c43f(_0x7961e0._0x309db6,_0x7961e0._0xf979da)])?_0x554fb4[_0x12c43f(_0x7961e0._0x9ceb94,_0x7961e0._0x5b225a)][_0x12c43f(_0x7961e0._0x392f3d,_0x7961e0._0x183fe8)][_0x12c43f(0x770,0x7fb)]:null,_0x94a885=readConfiguredSecret(_0x554fb4[_0x12c43f(_0x7961e0._0x222994,0x3e4)]?.[_0x2a0fa1(-_0x7961e0._0x51fdcc,0x1e)]?.[_0x12c43f(_0x7961e0._0x5a6461,0x504)])??readGatewayTokenEnv(),_0x28f7ae=_0x501119[_0x12c43f(0x702,_0x7961e0._0xcd1cee)](readConfiguredSecret,_0x554fb4[_0x12c43f(0x52a,0x75e)]?.[_0x2a0fa1(-_0x7961e0._0x51fdcc,-_0x7961e0._0xcbd5a9)]?.['password'])??readGatewayPasswordEnv(),_0x168a20={};return _0x168a20[_0x2a0fa1(-0x210,-0x39)+'und']=!![],_0x168a20[_0x12c43f(0x58e,_0x7961e0._0x2836c8)+_0x12c43f(_0x7961e0._0x5b344d,0x648)]=_0x26c1d9,_0x168a20[_0x2a0fa1(-0x144,-0x197)]=_0x4cde5e,_0x168a20[_0x12c43f(_0x7961e0._0x138b2e,_0x7961e0._0x364070)]=_0x94a885,_0x168a20[_0x2a0fa1(0x105,0x30b)]=_0x28f7ae,_0x168a20;}catch{return{'configFound':!![],'gatewayPort':null,'authMode':null,'token':readGatewayTokenEnv(),'password':_0x501119['FwJZe'](readGatewayPasswordEnv)};}}function resolveGatewayAuth(){const _0x50e5ae={_0x4698b6:0x72c,_0xd930e9:0x983,_0x50aea3:0x57d,_0xa897f3:0x203,_0x1e441f:0x78e,_0x6316bd:0x9fc,_0xa3bab4:0x20e,_0x459744:0xe2,_0x1d48e3:0x167,_0x48e5f6:0x7d6,_0x1b69d3:0x84e,_0x2b7e86:0x9f6,_0x24bbe8:0x6bf,_0x304132:0x621,_0x3c1132:0x991,_0x2a6ed7:0x826,_0x1f1eee:0x1ae,_0x107f80:0x250,_0x5988ba:0x71,_0x967baa:0x4f6,_0x2ced47:0x5e4,_0x50fe85:0x8c9,_0x3062eb:0x302,_0x2d4004:0x66,_0x30110c:0x44,_0x317be9:0x2ef,_0x248dec:0x203,_0x2c1504:0x70a,_0xb488fe:0x82d,_0x1da9f6:0x75e},_0x325015={_0x2627a7:0x567},_0x5a0361={_0x651fd1:0x15f},_0x4a22d7={};_0x4a22d7[_0x2fe023(_0x50e5ae._0x4698b6,_0x50e5ae._0xd930e9)]=function(_0x330346,_0xd7b600){return _0x330346&&_0xd7b600;},_0x4a22d7['LGwMa']=_0x2fe023(_0x50e5ae._0x50aea3,0x82d);const _0x4db6f4=_0x4a22d7,_0x2ef5a6=readOpenClawInfo(),_0xdd827f=_0x2ef5a6[_0x16b9fb(0x2a8,_0x50e5ae._0xa897f3)],_0x5a084e=_0x2ef5a6[_0x2fe023(_0x50e5ae._0x1e441f,0x82d)];if(_0x4db6f4[_0x2fe023(_0x50e5ae._0x6316bd,_0x50e5ae._0xd930e9)](_0xdd827f,_0x5a084e)&&_0x2ef5a6[_0x16b9fb(-_0x50e5ae._0xa3bab4,-_0x50e5ae._0x459744)]==null){const _0x54115e={};return _0x54115e[_0x16b9fb(0x398,0x203)]=_0xdd827f,_0x54115e[_0x16b9fb(0x82,_0x50e5ae._0x1d48e3)]=_0x5a084e,_0x54115e['label']=_0x16b9fb(0xa5,_0x50e5ae._0xa897f3),_0x54115e[_0x2fe023(_0x50e5ae._0x48e5f6,0x70f)]='OpenClaw'+'\x20has\x20bot'+_0x16b9fb(-0x294,-0xcf)+_0x2fe023(_0x50e5ae._0x1b69d3,_0x50e5ae._0x2b7e86)+'and\x20pass'+'word\x20con'+_0x2fe023(_0x50e5ae._0x24bbe8,_0x50e5ae._0x304132)+'\x20but\x20gat'+_0x16b9fb(0x3cc,0x29c)+_0x2fe023(_0x50e5ae._0x3c1132,_0x50e5ae._0x2a6ed7)+_0x16b9fb(0x48e,_0x50e5ae._0x1f1eee)+'\x20Set\x20the'+_0x16b9fb(_0x50e5ae._0x107f80,_0x50e5ae._0x5988ba)+'\x20token\x20o'+'r\x20passwo'+'rd\x20befor'+_0x2fe023(0xae8,0x8bf)+'g.',_0x54115e;}if(_0x2ef5a6[_0x2fe023(_0x50e5ae._0x967baa,_0x50e5ae._0x2ced47)]===_0x16b9fb(-0x10b,0x167)){const _0x3404af={};return _0x3404af[_0x2fe023(0x9c5,_0x50e5ae._0x50fe85)]=null,_0x3404af[_0x16b9fb(_0x50e5ae._0x3062eb,0x167)]=null,_0x3404af[_0x16b9fb(_0x50e5ae._0x2d4004,_0x50e5ae._0x30110c)]=null,_0x5a084e?{'token':null,'password':_0x5a084e,'label':'password'}:_0x3404af;}if(_0x2ef5a6[_0x16b9fb(-0x8f,-_0x50e5ae._0x459744)]===_0x16b9fb(_0x50e5ae._0x317be9,0x203)){const _0x57bdeb={};return _0x57bdeb[_0x2fe023(0xa97,_0x50e5ae._0x50fe85)]=null,_0x57bdeb['password']=null,_0x57bdeb['label']=null,_0xdd827f?{'token':_0xdd827f,'password':null,'label':'token'}:_0x57bdeb;}if(_0xdd827f){const _0xa5c210={};return _0xa5c210[_0x2fe023(0x94d,_0x50e5ae._0x50fe85)]=_0xdd827f,_0xa5c210[_0x16b9fb(-0xc7,0x167)]=null,_0xa5c210[_0x16b9fb(-0x16,0x44)]='token',_0xa5c210;}if(_0x5a084e){const _0x2e6faa={};return _0x2e6faa[_0x16b9fb(0x505,_0x50e5ae._0x248dec)]=null,_0x2e6faa['password']=_0x5a084e,_0x2e6faa[_0x2fe023(0x434,_0x50e5ae._0x2c1504)]=_0x4db6f4['LGwMa'],_0x2e6faa;}const _0x4a55b0={};_0x4a55b0[_0x16b9fb(0x148,0x203)]=null,_0x4a55b0[_0x2fe023(0xb2a,_0x50e5ae._0xb488fe)]=null;function _0x2fe023(_0x39838e,_0x3668c6){return _0x341e52(_0x3668c6-_0x5a0361._0x651fd1,_0x39838e);}function _0x16b9fb(_0x4bae1e,_0x3203a0){return _0x341e52(_0x3203a0- -_0x325015._0x2627a7,_0x4bae1e);}return _0x4a55b0[_0x2fe023(_0x50e5ae._0x1da9f6,0x70a)]=null,_0x4a55b0;}function getOpenClawConfigDir(){return resolveOpenClawPaths()['configDi'+'r'];}function getOpenClawStateDir(){function _0x1f8d10(_0x443a7a,_0x33411a){return _0x341e52(_0x33411a- -0xd6,_0x443a7a);}return resolveOpenClawPaths()[_0x1f8d10(0x7e8,0x4fa)];}function getOpenClawMediaDir(){const _0x2cd796={_0xbb1c60:0x1a0};function _0x2161b2(_0x493f2c,_0x2489e5){return _0x341e52(_0x2489e5- -_0x2cd796._0xbb1c60,_0x493f2c);}return resolveOpenClawPaths()[_0x2161b2(0x4c4,0x2e6)];}async function configureOpenClawLanAccess(_0x176f7d){const _0xa6abfd={_0x447f59:0x96,_0x3cac84:0x400,_0x29e90e:0x253,_0x4933dc:0x32,_0x25e31a:0x2c5,_0x12df27:0x3ba,_0x5b6ce3:0x3fa,_0x3fb950:0x4f5,_0x26cb90:0x260,_0x41bde4:0x116,_0x137068:0x44,_0x23b33f:0x5e3,_0x3fc702:0x386,_0x396ef0:0x3cb,_0x2a6da5:0x1d7,_0xb9170:0x706,_0x3607da:0x493,_0x5c549a:0x191,_0x156d28:0x78,_0x163077:0x265,_0x5d62a6:0x2b9,_0x16b184:0x4d1,_0x5c70f8:0x705,_0x24239c:0x909,_0x1fc66f:0x38e,_0x2b9ad7:0x1d4,_0x6191:0x3b4,_0x415a54:0x63c,_0xc531cb:0x589,_0x456db5:0x6f5,_0x37bf2f:0x5e8,_0x57e8fb:0x6cf,_0x1b8668:0x86f,_0xd1c8d:0x8a9,_0xcc1cd1:0x2f0},_0x4cf954={'zRxRE':function(_0x1bc0c2){return _0x1bc0c2();},'jzWvX':function(_0x2babb7,_0x457e47){return _0x2babb7(_0x457e47);},'nMzpX':function(_0x220fae,_0x5bdcf1,_0x3a6ffc){return _0x220fae(_0x5bdcf1,_0x3a6ffc);},'OpVQs':function(_0x44eec7,_0xc277d6){return _0x44eec7(_0xc277d6);},'PStZg':'set','ZUwBs':function(_0x25a044,_0x71c94f,_0x5f90f5){return _0x25a044(_0x71c94f,_0x5f90f5);},'EJfCH':function(_0xd84245,_0x2c160e){return _0xd84245!==_0x2c160e;},'OCMUO':_0x2b8875(-_0xa6abfd._0x447f59,-0x286),'UeQEP':'--strict'+'-json'},_0x2752a7=_0x4cf954[_0x40d9e5(0x424,_0xa6abfd._0x3cac84)](resolveOpenClawPaths);if(!_0x4cf954[_0x2b8875(-_0xa6abfd._0x29e90e,_0xa6abfd._0x4933dc)](_0x57e205,_0x2752a7[_0x2b8875(_0xa6abfd._0x25e31a,_0xa6abfd._0x12df27)+'th']))throw new Error(_0x40d9e5(_0xa6abfd._0x5b6ce3,0x5aa)+_0x40d9e5(0x3af,_0xa6abfd._0x3fb950)+_0x40d9e5(0x40f,0x1e0)+'found\x20at'+'\x20'+_0x2752a7[_0x40d9e5(0x6cf,0x92c)+'th']+(_0x40d9e5(0x495,0x75f)+'enClaw\x20s'+_0x2b8875(-0xd7,-0xf6)+_0x2b8875(_0xa6abfd._0x26cb90,0x2ca)+_0x40d9e5(0x547,0x4c7)+_0x2b8875(0x305,_0xa6abfd._0x41bde4)+_0x2b8875(-_0xa6abfd._0x137068,0xed)));const _0x4265ea=normalizeControlUiOrigin(_0x176f7d[_0x40d9e5(0x3b4,0x28d)+_0x2b8875(-0x41,0x22a)]),_0x1b128c=await _0x4cf954['nMzpX'](readOpenClawConfigString,_0x2b8875(0x38e,0x49b)+_0x40d9e5(0x658,0x6c5),_0x2752a7),_0x1e9b22=await _0x4cf954[_0x40d9e5(0x3fe,_0xa6abfd._0x23b33f)](readOpenClawAllowedOrigins,_0x2752a7);let _0x4eb122=![];_0x1b128c!==_0x40d9e5(_0xa6abfd._0x3fc702,0x224)&&(await _0x4cf954[_0x40d9e5(_0xa6abfd._0x396ef0,_0xa6abfd._0x2a6da5)](runOpenClawCli,[_0x40d9e5(0x374,0x33f),_0x4cf954[_0x40d9e5(0x6b7,_0xa6abfd._0xb9170)],_0x40d9e5(0x798,_0xa6abfd._0x3607da)+'bind','lan'],_0x2752a7),_0x4eb122=!![]);function _0x40d9e5(_0x1ad21b,_0x104fd7){return _0x35d151(_0x104fd7,_0x1ad21b-0xd6);}const _0x564e01=_0x4cf954[_0x2b8875(0x152,_0xa6abfd._0x5c549a)](appendUniqueOrigin,_0x1e9b22,_0x4265ea),_0x2a374d=_0x4cf954[_0x2b8875(-_0xa6abfd._0x156d28,-_0xa6abfd._0x163077)](_0x564e01[_0x40d9e5(0x6c3,0x87f)],_0x1e9b22[_0x2b8875(_0xa6abfd._0x5d62a6,_0xa6abfd._0x16b184)]);_0x2a374d&&await runOpenClawCli([_0x4cf954[_0x40d9e5(_0xa6abfd._0x5c70f8,_0xa6abfd._0x24239c)],'set',_0x2b8875(_0xa6abfd._0x1fc66f,_0xa6abfd._0x2b9ad7)+_0x40d9e5(_0xa6abfd._0x6191,_0xa6abfd._0x415a54)+_0x40d9e5(_0xa6abfd._0xc531cb,0x468)+'dOrigins',JSON[_0x2b8875(0x1c8,0x443)+'y'](_0x564e01),_0x4cf954[_0x40d9e5(_0xa6abfd._0x456db5,_0xa6abfd._0x37bf2f)]],_0x2752a7);function _0x2b8875(_0x495233,_0x59697c){return _0x35d151(_0x59697c,_0x495233- -0x334);}const _0x411100={};return _0x411100['configPa'+'th']=_0x2752a7[_0x40d9e5(_0xa6abfd._0x57e8fb,_0xa6abfd._0x1b8668)+'th'],_0x411100[_0x2b8875(0x25a,0x2a0)+_0x40d9e5(0x778,_0xa6abfd._0xd1c8d)]=_0x4eb122,_0x411100['allowedO'+_0x2b8875(0x28f,0x148)+'ed']=_0x2a374d,_0x411100[_0x2b8875(-0x1f1,-0x12a)+'rigins']=_0x564e01,_0x411100[_0x2b8875(-0x56,-_0xa6abfd._0xcc1cd1)+'iOrigin']=_0x4265ea,_0x411100;}async function restartOpenClawGateway(){const _0x53e551={_0x4ac002:0x236,_0x3b7c64:0x1da,_0x2fcda0:0x367,_0x125d75:0x42f,_0x5ac613:0x1b3,_0xd579b:0x547,_0xc2185c:0x2af,_0x39ce93:0x452,_0x4aedb1:0x535,_0x1aeabf:0x316,_0x236186:0x44a,_0x785b0e:0x66d,_0x860083:0x254,_0x1da7b4:0x2ba,_0x1f5f24:0xd4,_0x3bea7b:0x99,_0x4c1299:0xd4,_0x102cbe:0x114,_0x1633d2:0x2ca,_0x32cd6e:0x6ad,_0x14dec6:0x15c,_0x373700:0x4f6,_0x121ce8:0x8c,_0x511028:0xd4,_0x4735a7:0x2a8,_0x4406b2:0x86,_0x3c242f:0x4a,_0x29da24:0x212},_0x260348={_0x409c74:0x341},_0x51acab={'omLkj':'not-load'+'ed','uqpdn':_0x734730(0x449,_0x53e551._0x4ac002),'wnzNc':_0x734730(_0x53e551._0x3b7c64,0x3af),'tCtHH':function(_0x38bddb,_0x17ecc9){return _0x38bddb===_0x17ecc9;},'oWFlR':function(_0xe0b18a,_0x51e836){return _0xe0b18a(_0x51e836);},'jMtHK':_0x42dace(0x3d0,0x508)+'d'};function _0x42dace(_0x24009a,_0x1cb4c7){return _0x341e52(_0x24009a- -_0x260348._0x409c74,_0x1cb4c7);}const _0x25193a=resolveOpenClawPaths(),_0x404417=await runOpenClawDaemonCommand([_0x42dace(_0x53e551._0x2fcda0,0x418),_0x734730(0x294,0x513),_0x734730(_0x53e551._0x125d75,0x3af)],_0x25193a);if(_0x404417[_0x734730(_0x53e551._0x5ac613,0x2ba)]===_0x51acab[_0x42dace(0x2ab,_0x53e551._0xd579b)]){const _0x478e18=await runOpenClawDaemonCommand([_0x734730(0x19e,_0x53e551._0xc2185c),_0x51acab[_0x734730(0x17e,_0x53e551._0x39ce93)],_0x51acab['wnzNc']],_0x25193a);if(_0x51acab[_0x42dace(0x393,_0x53e551._0x4aedb1)](_0x478e18['result'],_0x734730(_0x53e551._0x1aeabf,0x17e)+'ed'))throw new Error(_0x51acab[_0x42dace(0x5a1,_0x53e551._0x236186)](buildGatewayNotLoadedMessage,_0x478e18));const _0x9bc7f9={};return _0x9bc7f9[_0x42dace(0x5af,_0x53e551._0x785b0e)]=_0x734730(_0x53e551._0x860083,0x6a),_0x9bc7f9[_0x734730(0xa1,_0x53e551._0x1da7b4)]=_0x478e18['result']??_0x734730(0x144,0x6a),_0x9bc7f9[_0x42dace(_0x53e551._0x1f5f24,-_0x53e551._0x3bea7b)]=_0x478e18[_0x42dace(_0x53e551._0x4c1299,_0x53e551._0x102cbe)],_0x9bc7f9[_0x42dace(_0x53e551._0x1633d2,0x36d)]=_0x478e18['warnings'],_0x9bc7f9;}const _0xb5e054={};function _0x734730(_0x5cf617,_0x401efb){return _0x341e52(_0x401efb- -0x3f9,_0x5cf617);}return _0xb5e054[_0x42dace(0x5af,_0x53e551._0x32cd6e)]=_0x734730(_0x53e551._0x14dec6,0x318)+'d',_0xb5e054[_0x734730(_0x53e551._0x373700,0x2ba)]=_0x404417[_0x734730(0x3ad,_0x53e551._0x1da7b4)]??_0x51acab[_0x42dace(0x1c9,-_0x53e551._0x121ce8)],_0xb5e054[_0x42dace(_0x53e551._0x511028,-0x66)]=_0x404417[_0x734730(_0x53e551._0x4735a7,0x1c)],_0xb5e054[_0x734730(-_0x53e551._0x4406b2,0x212)]=_0x404417[_0x734730(-_0x53e551._0x3c242f,_0x53e551._0x29da24)],_0xb5e054;}function getOpenClawBootstrapPath(_0x57e2b1=getOpenClawStateDir()){return _0x4cb7e2(_0x57e2b1,'devices',BOOTSTRAP_FILENAME);}async function issueOpenClawBootstrapToken(_0x4cbcad){const _0x263942={_0x4f2308:0x86f,_0x726351:0x16d,_0x2e8c3d:0x36,_0x50979c:0x7eb,_0x3ff491:0x8cc,_0x4764fd:0xa43,_0x290457:0xb9,_0x197ce3:0x147,_0x216d7a:0x20c,_0x405150:0x980},_0x125c6c={_0x4d4c57:0x318,_0x1c67af:0x1aa,_0x1f943c:0x130,_0x52e5c2:0x2fd,_0x800189:0x3cb,_0x5b841c:0x314},_0x2a0f1c={_0x294479:0x3f6},_0xe01d1b={_0x1ccd7a:0x351},_0x54f904={'cCzxd':function(_0x55da4c,_0x206a31,_0x1fa290){return _0x55da4c(_0x206a31,_0x1fa290);}},_0xe55053=_0x4cbcad[_0x4bb948(_0x263942._0x4f2308,0xa43)][_0x7a0bed(_0x263942._0x726351,_0x263942._0x2e8c3d)]();function _0x7a0bed(_0x33c7b3,_0x1a43f0){return _0x35d151(_0x33c7b3,_0x1a43f0- -_0xe01d1b._0x1ccd7a);}function _0x4bb948(_0x26c572,_0x2e1909){return _0x35d151(_0x26c572,_0x2e1909-_0x2a0f1c._0x294479);}const _0x4aeae5=_0x4cbcad[_0x7a0bed(0x11a,0xdc)+'y']['trim'](),_0x3956e0=_0x4cbcad[_0x7a0bed(0x2e3,0xe4)][_0x7a0bed(-0x12a,0x36)](),_0x1807e5=normalizeStringArray(_0x4cbcad[_0x4bb948(0xa3b,_0x263942._0x50979c)]);if(!_0xe55053||!_0x4aeae5||!_0x3956e0||_0x1807e5['length']===0x0)throw new Error(_0x4bb948(_0x263942._0x3ff491,_0x263942._0x4764fd)+_0x4bb948(0xa82,0xa5a)+_0x7a0bed(_0x263942._0x290457,-0x1a)+_0x4bb948(0x7e3,0x7f4)+_0x7a0bed(-_0x263942._0x197ce3,-_0x263942._0x216d7a)+_0x4bb948(0x715,_0x263942._0x405150)+'ed');return await withBootstrapLock(async()=>{const _0x4a62e9={_0x22bd35:0x315},_0x164f19=_0x4cbcad[_0x1feae1(0xd6,_0x125c6c._0x4d4c57)]??getOpenClawStateDir();function _0xc0fe20(_0x4dc538,_0x281a90){return _0x7a0bed(_0x281a90,_0x4dc538-0x160);}const _0x443ec4=getOpenClawBootstrapPath(_0x164f19),_0x2f0d94=await loadBootstrapState(_0x443ec4),_0x51dfb6=generatePairingToken();function _0x1feae1(_0x213ddc,_0x31bd0e){return _0x7a0bed(_0x213ddc,_0x31bd0e-_0x4a62e9._0x22bd35);}const _0x422fb0=Date[_0x1feae1(_0x125c6c._0x1c67af,_0x125c6c._0x1f943c)]();_0x2f0d94[_0x51dfb6]={'token':_0x51dfb6,'ts':_0x422fb0,'deviceId':_0xe55053,'publicKey':_0x4aeae5,'roles':[_0x3956e0],'scopes':_0x1807e5,'issuedAtMs':_0x422fb0},await _0x54f904[_0x1feae1(0x508,0x25b)](writeJsonAtomic,_0x443ec4,_0x2f0d94);const _0x1ca382={};return _0x1ca382[_0xc0fe20(_0x125c6c._0x52e5c2,0xba)]=_0x51dfb6,_0x1ca382['expiresA'+'tMs']=_0x422fb0+DEVICE_BOOTSTRAP_TOKEN_TTL_MS,_0x1ca382[_0xc0fe20(_0x125c6c._0x800189,_0x125c6c._0x5b841c)+'h']=_0x443ec4,_0x1ca382;});}function readConfiguredSecret(_0x223e94){const _0x25d31b={_0x4a7d4f:0x651,_0x1bea56:0x53d,_0x52734f:0x651},_0x3b5848={_0x33555d:0xf2};function _0x1eae88(_0x557a4d,_0x703cad){return _0x35d151(_0x557a4d,_0x703cad-0x2ca);}function _0x133db4(_0xa8c123,_0x7421f3){return _0x35d151(_0xa8c123,_0x7421f3-_0x3b5848._0x33555d);}return typeof _0x223e94==='string'&&_0x223e94[_0x1eae88(0x660,_0x25d31b._0x4a7d4f)]()?_0x223e94[_0x1eae88(_0x25d31b._0x1bea56,_0x25d31b._0x52734f)]():null;}async function readOpenClawConfigString(_0x4a8429,_0x59c050=resolveOpenClawPaths()){const _0x525b1b={_0x4b49ac:0x563,_0x10fee7:0x697},_0x1e4029={_0x35b6b9:0xa0};function _0x26371f(_0xdded66,_0x2b6b6d){return _0x341e52(_0xdded66- -0x13e,_0x2b6b6d);}const _0x66ce26={};_0x66ce26[_0x26371f(0x5c8,0x5ea)]=function(_0x462f31,_0x40a669){return _0x462f31||_0x40a669;};function _0x3a3a21(_0x2d0849,_0x4bb577){return _0x341e52(_0x2d0849- -_0x1e4029._0x35b6b9,_0x4bb577);}const _0x1731f2=_0x66ce26;try{const {stdout:_0xa9f975}=await runOpenClawCli(['config','get',_0x4a8429],_0x59c050),_0x3b587c=_0xa9f975[_0x3a3a21(_0x525b1b._0x4b49ac,_0x525b1b._0x10fee7)]();return _0x1731f2[_0x3a3a21(0x666,0x73b)](_0x3b587c,null);}catch(_0x382a0e){if(isMissingConfigPathError(_0x382a0e))return null;throw _0x382a0e;}}async function readOpenClawAllowedOrigins(_0x1a5295=resolveOpenClawPaths()){const _0x46b8a4={_0x1ef4d3:0x546,_0x109022:0x256,_0x149053:0x71d,_0x1d00a6:0x96f,_0x22f588:0x7a1,_0x43e032:0x3a4},_0x4c2a59={_0x5abd2f:0x7},_0x554ba4={_0x20bee0:0x2b3};function _0xf49a6a(_0x2ed292,_0x9e44d1){return _0x341e52(_0x2ed292- -_0x554ba4._0x20bee0,_0x9e44d1);}const _0x1b0ec2={'iiOhZ':function(_0x4d8373,_0x153582){return _0x4d8373(_0x153582);}};function _0x2ec098(_0x11a1c5,_0x2bfdc2){return _0x341e52(_0x2bfdc2- -_0x4c2a59._0x5abd2f,_0x11a1c5);}try{const {stdout:_0x5485e8}=await runOpenClawCli(['config',_0xf49a6a(0x610,0x53f),'gateway.'+_0xf49a6a(0x2a7,_0x46b8a4._0x1ef4d3)+_0xf49a6a(0x47c,_0x46b8a4._0x109022)+_0x2ec098(_0x46b8a4._0x149053,0x6fc),_0x2ec098(_0x46b8a4._0x1d00a6,_0x46b8a4._0x22f588)],_0x1a5295),_0x605b6e=_0x1b0ec2[_0x2ec098(0x6df,0x958)](parseEmbeddedJsonValue,_0x5485e8);return Array[_0x2ec098(0x74d,0x44f)](_0x605b6e)?_0x605b6e['filter'](_0x4d6d9e=>typeof _0x4d6d9e===_0xf49a6a(0x127,0x144))[_0x2ec098(_0x46b8a4._0x43e032,0x3a5)](_0x2119aa=>_0x2119aa[_0xf49a6a(0x350,0x4b2)]())['filter'](Boolean):[];}catch(_0x43713a){if(isMissingConfigPathError(_0x43713a))return[];throw _0x43713a;}}function _0x1fba(_0x195bfa,_0x4512f3){_0x195bfa=_0x195bfa-0x13f;const _0x1c02a0=_0x1876();let _0x5726ab=_0x1c02a0[_0x195bfa];if(_0x1fba['WDJDxY']===undefined){var _0x3fec44=function(_0x4a0909){const _0x31c4be='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x173271='',_0x5ac91e='',_0x414904=_0x173271+_0x3fec44;for(let _0x11e45d=0x0,_0x345389,_0x1b4cd2,_0x3b27b9=0x0;_0x1b4cd2=_0x4a0909['charAt'](_0x3b27b9++);~_0x1b4cd2&&(_0x345389=_0x11e45d%0x4?_0x345389*0x40+_0x1b4cd2:_0x1b4cd2,_0x11e45d++%0x4)?_0x173271+=_0x414904['charCodeAt'](_0x3b27b9+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x345389>>(-0x2*_0x11e45d&0x6)):_0x11e45d:0x0){_0x1b4cd2=_0x31c4be['indexOf'](_0x1b4cd2);}for(let _0x313280=0x0,_0x4b8985=_0x173271['length'];_0x313280<_0x4b8985;_0x313280++){_0x5ac91e+='%'+('00'+_0x173271['charCodeAt'](_0x313280)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5ac91e);};_0x1fba['bVxmbE']=_0x3fec44,_0x1fba['xhFNlG']={},_0x1fba['WDJDxY']=!![];}const _0x187645=_0x1c02a0[0x0],_0x1fbab1=_0x195bfa+_0x187645,_0x294128=_0x1fba['xhFNlG'][_0x1fbab1];if(!_0x294128){const _0x4e5008=function(_0x515ca9){this['MtTXQG']=_0x515ca9,this['PSVEqf']=[0x1,0x0,0x0],this['biILYU']=function(){return'newState';},this['FOAsIB']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['KVNPPj']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4e5008['prototype']['CrMseH']=function(){const _0x511a74=new RegExp(this['FOAsIB']+this['KVNPPj']),_0x1f3bc0=_0x511a74['test'](this['biILYU']['toString']())?--this['PSVEqf'][0x1]:--this['PSVEqf'][0x0];return this['pKiIVW'](_0x1f3bc0);},_0x4e5008['prototype']['pKiIVW']=function(_0x11b731){if(!Boolean(~_0x11b731))return _0x11b731;return this['shfLnt'](this['MtTXQG']);},_0x4e5008['prototype']['shfLnt']=function(_0x400002){for(let _0x51359b=0x0,_0x3094f5=this['PSVEqf']['length'];_0x51359b<_0x3094f5;_0x51359b++){this['PSVEqf']['push'](Math['round'](Math['random']())),_0x3094f5=this['PSVEqf']['length'];}return _0x400002(this['PSVEqf'][0x0]);},new _0x4e5008(_0x1fba)['CrMseH'](),_0x5726ab=_0x1fba['bVxmbE'](_0x5726ab),_0x1fba['xhFNlG'][_0x1fbab1]=_0x5726ab;}else _0x5726ab=_0x294128;return _0x5726ab;}async function runOpenClawDaemonCommand(_0x500ce3,_0x49a8eb=resolveOpenClawPaths()){const _0x173eac={_0x5c0a26:0x444,_0x437c7b:0x25f,_0x52ee9c:0x250,_0x4004a0:0x477,_0x471e71:0x2e9,_0x269ce9:0x42d,_0x40d869:0x6eb,_0xa71bb:0x794,_0x577292:0x21d,_0x14ca82:0x3f8,_0x3cd2ed:0x48a,_0xa1eec1:0x42d,_0x56f7bf:0xd8,_0x1726c9:0x393,_0x447423:0x444,_0x40c8b7:0x589,_0x576c79:0x5c7,_0x3d22a7:0x9be,_0xb02070:0x184,_0x77fbb8:0x350,_0x1b27fb:0x2ec,_0x3feccc:0x44a,_0x46c1b0:0x11a,_0x373a5d:0x275,_0x1da8dc:0x6b9,_0x5b50cc:0x656,_0x3c2fde:0x2a6,_0x261e78:0x161,_0x4a558d:0x27a,_0x19f77d:0x139,_0x238da1:0x53f,_0x2d0b15:0x46b},_0x50f79f={_0x4c022b:0x153};function _0x8d9c5b(_0x655475,_0x32f8d5){return _0x35d151(_0x32f8d5,_0x655475-_0x50f79f._0x4c022b);}const _0x2fd300={};_0x2fd300[_0x8d9c5b(_0x173eac._0x5c0a26,0x3d1)]=function(_0x29bbd3,_0x58fd4f){return _0x29bbd3===_0x58fd4f;},_0x2fd300[_0x9136c1(0x416,0x36d)]=_0x9136c1(-0x155,-_0x173eac._0x437c7b);const _0x4973f0=_0x2fd300,{stdout:_0x3e41de}=await runOpenClawCli(_0x500ce3,_0x49a8eb);let _0x482f33;try{_0x482f33=parseEmbeddedJsonValue(_0x3e41de);}catch(_0x2358e6){const _0x5a0352={};_0x5a0352[_0x9136c1(_0x173eac._0x52ee9c,0x44d)]=_0x2358e6;throw new Error(_0x8d9c5b(_0x173eac._0x4004a0,0x2ed)+'\x20'+_0x500ce3[_0x8d9c5b(_0x173eac._0x471e71,0x12a)](0x0,0x2)[_0x9136c1(_0x173eac._0x269ce9,_0x173eac._0x40d869)]('\x20')+('\x20returne'+'d\x20invali'+_0x8d9c5b(0x683,_0x173eac._0xa71bb)+_0x9136c1(_0x173eac._0x577292,0x419)),_0x5a0352);}if(_0x482f33['ok']!==!![])throw new Error(_0x482f33[_0x8d9c5b(0x487,_0x173eac._0x14ca82)]?.['trim']()||'OpenClaw'+'\x20'+_0x500ce3[_0x8d9c5b(0x2e9,_0x173eac._0x3cd2ed)](0x0,0x2)[_0x9136c1(_0x173eac._0xa1eec1,0x1ef)]('\x20')+_0x9136c1(-_0x173eac._0x56f7bf,-_0x173eac._0x1726c9));function _0x9136c1(_0x4e64aa,_0x40aee0){return _0x35d151(_0x40aee0,_0x4e64aa- -0x2b3);}return{'result':_0x4973f0[_0x8d9c5b(_0x173eac._0x447423,_0x173eac._0x40c8b7)](typeof _0x482f33[_0x8d9c5b(0x58a,_0x173eac._0x576c79)],_0x4973f0[_0x8d9c5b(0x81c,_0x173eac._0x3d22a7)])?_0x482f33[_0x9136c1(_0x173eac._0xb02070,_0x173eac._0x77fbb8)]:void 0x0,'message':typeof _0x482f33[_0x8d9c5b(_0x173eac._0x1b27fb,0x17a)]===_0x8d9c5b(0x2b1,_0x173eac._0x3feccc)?_0x482f33[_0x9136c1(-_0x173eac._0x46c1b0,-_0x173eac._0x373a5d)]:null,'warnings':Array['isArray'](_0x482f33[_0x8d9c5b(0x4e2,_0x173eac._0x1da8dc)])?_0x482f33[_0x8d9c5b(0x4e2,_0x173eac._0x5b50cc)][_0x8d9c5b(_0x173eac._0x3c2fde,_0x173eac._0x261e78)](_0x8f80fb=>typeof _0x8f80fb===_0x8d9c5b(0x2b1,0x3)):[],'hints':Array[_0x8d9c5b(0x32d,_0x173eac._0x4a558d)](_0x482f33[_0x9136c1(_0x173eac._0x19f77d,0x41d)])?_0x482f33[_0x8d9c5b(_0x173eac._0x238da1,0x402)][_0x9136c1(-0x160,-_0x173eac._0x2d0b15)](_0x4e099a=>typeof _0x4e099a===_0x9136c1(-0x155,-0x181)):[]};}async function runOpenClawCli(_0x546583,_0xd1909e=resolveOpenClawPaths()){const _0x272e8f={_0x1ecc58:0x56,_0x2713f7:0x1c3,_0x66429c:0x136,_0x5b9474:0x18f,_0x225da0:0x149,_0x3ee8f5:0x3db,_0x2f706f:0x1e5,_0x322438:0x1df,_0x34471d:0x32,_0x176ca6:0x3};try{return await new Promise((_0x45d08a,_0x173020)=>{const _0x287599={_0x441cfa:0x959,_0x1c4156:0x4a6};function _0x273262(_0x989ba,_0x45069d){return _0x1fba(_0x45069d- -0x286,_0x989ba);}const _0x490d2a={...process.env};_0x490d2a['OPENCLAW'+_0x2fad44(-_0x272e8f._0x1ecc58,0x22d)+'IR']=_0xd1909e[_0x273262(-_0x272e8f._0x2713f7,_0x272e8f._0x66429c)],_0x490d2a[_0x2fad44(_0x272e8f._0x5b9474,_0x272e8f._0x225da0)+'_CONFIG_'+'PATH']=_0xd1909e[_0x273262(0x225,_0x272e8f._0x3ee8f5)+'th'];const _0x131dac={};_0x131dac[_0x2fad44(-0x3b5,-_0x272e8f._0x2f706f)]=_0x273262(0x2a8,_0x272e8f._0x322438),_0x131dac[_0x2fad44(_0x272e8f._0x34471d,-_0x272e8f._0x176ca6)]=_0x490d2a,_0x131dac['maxBuffe'+'r']=0x400*0x400;function _0x2fad44(_0x32f379,_0x19ab0a){return _0x1fba(_0x19ab0a- -0x348,_0x32f379);}execFile(OPENCLAW_CLI_COMMAND,_0x546583,_0x131dac,(_0x33f501,_0x10c9a7,_0x21aaa8)=>{const _0x44a167={_0xcc1a6c:0x4e9};if(_0x33f501){const _0x23d62a={};_0x23d62a[_0x43768d(0x333,0x1c9)]=_0x10c9a7,_0x23d62a[_0xe6285d(0x8c7,_0x287599._0x441cfa)]=_0x21aaa8,Object['assign'](_0x33f501,_0x23d62a),_0x173020(_0x33f501);return;}function _0x43768d(_0x51ad91,_0x22d6de){return _0x2fad44(_0x22d6de,_0x51ad91-_0x44a167._0xcc1a6c);}const _0x40ed95={};_0x40ed95[_0xe6285d(_0x287599._0x1c4156,0x3c2)]=_0x10c9a7,_0x40ed95['stderr']=_0x21aaa8;function _0xe6285d(_0x560608,_0x1df390){return _0x2fad44(_0x1df390,_0x560608-0x65c);}_0x45d08a(_0x40ed95);});});}catch(_0x199757){throw formatOpenClawCliError(_0x546583,_0x199757);}}function formatOpenClawCliError(_0x51b75c,_0x32c087){const _0x19e8ea={_0x28b7bc:0x63c,_0x5c1300:0x238,_0xc53b22:0x406,_0x89baa7:0x43f,_0x399303:0x7b7,_0x115eba:0x5f6,_0x214666:0x66b,_0x4567dc:0x673,_0x256900:0x441,_0x58b5f1:0x8cd,_0xd982c4:0x6a3,_0xe068a:0x173,_0x2f73ea:0x20c,_0x51e405:0x63b,_0x1b0783:0x469,_0x4e4eab:0x643,_0x17926c:0x53c,_0x183ba9:0x4f3},_0x34edcf={_0x332724:0x9c};function _0xc16ed0(_0x23d58f,_0x54e890){return _0x341e52(_0x54e890- -0x19a,_0x23d58f);}const _0x199e7e={};_0x199e7e['IjSts']=function(_0x36d01f,_0x15230a){return _0x36d01f===_0x15230a;};const _0x27e478=_0x199e7e;function _0x6e11c8(_0x2cefa0,_0x239ada){return _0x341e52(_0x2cefa0-_0x34edcf._0x332724,_0x239ada);}const _0x1e8849=_0x6e11c8(_0x19e8ea._0x28b7bc,0x4e7)+'\x20'+_0x51b75c[_0xc16ed0(0x7ee,0x7c2)]('\x20');if(isExecFileError(_0x32c087)){if(_0x27e478['IjSts'](_0x32c087['code'],'ENOENT'))return new Error(_0xc16ed0(_0x19e8ea._0x5c1300,_0x19e8ea._0xc53b22)+_0x6e11c8(0x71b,_0x19e8ea._0x89baa7)+'\x20not\x20fou'+_0x6e11c8(0x5ff,_0x19e8ea._0x399303)+_0x6e11c8(0x8c2,_0x19e8ea._0x115eba)+'all\x20Open'+_0x6e11c8(_0x19e8ea._0x214666,0x70f)+_0xc16ed0(_0x19e8ea._0x4567dc,0x7c9)+'`'+OPENCLAW_CLI_COMMAND+(_0x6e11c8(0x59a,0x719)+'ilable\x20b'+'efore\x20ru'+_0x6e11c8(_0x19e8ea._0x256900,0x39b)+'cal\x20pair'+_0x6e11c8(_0x19e8ea._0x58b5f1,_0x19e8ea._0xd982c4)));const _0x540d41=[_0x32c087[_0x6e11c8(0x863,0x65b)],_0x32c087[_0xc16ed0(_0x19e8ea._0xe068a,_0x19e8ea._0x2f73ea)]][_0x6e11c8(0x46b,0x73e)](_0x2320ef=>typeof _0x2320ef===_0x6e11c8(0x476,0x4b0)&&_0x2320ef[_0x6e11c8(0x69f,0x84b)]()[_0x6e11c8(0x905,0x9f5)]>0x0)['join']('\x0a')[_0xc16ed0(_0x19e8ea._0x51e405,_0x19e8ea._0x1b0783)]();return new Error(_0x540d41?_0x1e8849+(_0xc16ed0(_0x19e8ea._0x4e4eab,_0x19e8ea._0x17926c)+'\x20')+_0x540d41:_0x1e8849+_0x6e11c8(_0x19e8ea._0x183ba9,0x71c));}return _0x32c087 instanceof Error?_0x32c087:new Error(_0x1e8849+('\x20failed:'+'\x20')+String(_0x32c087));}function isMissingConfigPathError(_0x58d35a){const _0x2005ec={_0x44bc3f:0x1e9},_0x11fbe6={_0x347199:0x2d6},_0x4f382b={_0x379c05:0x29b};function _0xf8aaef(_0x1c239c,_0x35d6ce){return _0x35d151(_0x35d6ce,_0x1c239c-_0x4f382b._0x379c05);}function _0x565d1c(_0x3632e1,_0x376ef7){return _0x35d151(_0x376ef7,_0x3632e1- -_0x11fbe6._0x347199);}return _0x58d35a instanceof Error&&/Config path not found:/i[_0x565d1c(0xe4,-0x106)](_0x58d35a[_0x565d1c(-0x13d,-_0x2005ec._0x44bc3f)]);}function isExecFileError(_0x534e5a){return _0x534e5a instanceof Error;}function normalizeControlUiOrigin(_0x2e44d1){function _0x4b53c4(_0x2b3005,_0x1c90e4){return _0x35d151(_0x2b3005,_0x1c90e4-0x41e);}const _0x25e23d=new URL(_0x2e44d1[_0x4b53c4(0x67f,0x7a5)]());return _0x25e23d['origin'];}function appendUniqueOrigin(_0x44df0a,_0xdb4fdf){const _0x104241={_0x4b0ce0:0xa23,_0x4a5c12:0x7f0,_0x29bf3d:0x9d2,_0x1fa5c7:0xa1f,_0x16923c:0xb69,_0x41ea24:0xc43,_0x34c54f:0xbe1,_0x150997:0x95c,_0x1ca743:0x833};function _0x342134(_0x1a0f1a,_0x559c3f){return _0x341e52(_0x1a0f1a-0x11a,_0x559c3f);}const _0x42ad63={'cYOPJ':function(_0x3d5568,_0x44acaf){return _0x3d5568(_0x44acaf);}},_0x161956=normalizeControlUiOrigin(_0xdb4fdf)[_0x342134(0x9d2,0x808)+_0x185efd(_0x104241._0x4b0ce0,_0x104241._0x4a5c12)](),_0x44bf6c=new Set(),_0x3344a5=new Set();function _0x185efd(_0x1b8dec,_0xdb6d35){return _0x341e52(_0x1b8dec-0x120,_0xdb6d35);}const _0x53ce4b=[];for(const _0x1d006e of _0x44df0a){const _0x559265=_0x1d006e['trim']();if(!_0x559265)continue;let _0x24955e;try{_0x24955e=normalizeControlUiOrigin(_0x559265)[_0x342134(_0x104241._0x29bf3d,0xcd0)+'ase']();}catch{const _0x1629eb=_0x559265['toLowerC'+_0x185efd(0xa23,0xc54)]();if(_0x3344a5['has'](_0x1629eb))continue;_0x3344a5[_0x342134(_0x104241._0x1fa5c7,_0x104241._0x16923c)](_0x1629eb),_0x53ce4b[_0x342134(0x9bb,0x6dc)](_0x559265);continue;}if(_0x44bf6c['has'](_0x24955e))continue;_0x44bf6c[_0x185efd(0xa25,0xcdd)](_0x24955e),_0x53ce4b[_0x342134(0x9bb,_0x104241._0x41ea24)](_0x24955e===_0x161956?normalizeControlUiOrigin(_0xdb4fdf):normalizeControlUiOrigin(_0x559265));}return!_0x44bf6c[_0x342134(0xa2b,_0x104241._0x34c54f)](_0x161956)&&_0x53ce4b[_0x185efd(0x9c1,_0x104241._0x150997)](_0x42ad63[_0x342134(0x67a,_0x104241._0x1ca743)](normalizeControlUiOrigin,_0xdb4fdf)),_0x53ce4b;}function buildGatewayNotLoadedMessage(_0x36b347){const _0x54d556={_0x1a8181:0x5ba,_0x2eb54a:0x559,_0xd7550a:0x47,_0x5ced42:0x465,_0x51bdb0:0x3c2,_0x5ede41:0x4ef,_0x136e94:0x34c,_0x30b94a:0x208,_0x5df65c:0x17e,_0x2a5926:0x897,_0x34000c:0x36a,_0x367b78:0x720,_0x499384:0x996,_0x3ea6aa:0x3c7,_0x37fe0d:0x11,_0x53b96c:0x7a6,_0x2d9577:0x49d,_0x456822:0x11,_0x52a446:0x43d,_0x129ade:0x264,_0x984093:0x5bc},_0x35d0e8={_0x57e3d6:0x404},_0x139798={};_0x139798[_0x49b8e7(_0x54d556._0x1a8181,0x51f)]=_0x56d053(0x6ea,_0x54d556._0x2eb54a)+_0x49b8e7(0x293,_0x54d556._0xd7550a)+_0x56d053(_0x54d556._0x5ced42,0x435)+_0x56d053(_0x54d556._0x51bdb0,0x245)+_0x56d053(0x63,0x361)+'wket\x20pai'+_0x49b8e7(_0x54d556._0x5ede41,0x69a)+'l`.';function _0x49b8e7(_0x350a54,_0x5961d9){return _0x341e52(_0x350a54- -0x23b,_0x5961d9);}const _0x597b07=_0x139798;function _0x56d053(_0x406f3b,_0x2b9f19){return _0x341e52(_0x2b9f19- -_0x35d0e8._0x57e3d6,_0x406f3b);}const _0x3f83df=[_0x56d053(0xd3,0x19c)+'\x20Gateway'+_0x49b8e7(0x195,0x1f6)+'running\x20'+'under\x20a\x20'+_0x56d053(_0x54d556._0x136e94,_0x54d556._0x30b94a)+_0x56d053(0x1b5,0x3a3)+_0x49b8e7(0x28e,0x3b5)+_0x49b8e7(0x43b,_0x54d556._0x5df65c)+'d\x20gatewa'+_0x49b8e7(0x63b,_0x54d556._0x2a5926)+_0x56d053(_0x54d556._0x34000c,0x550)+_0x56d053(0x241,0x4ca)+_0x49b8e7(_0x54d556._0x367b78,_0x54d556._0x499384)+_0x56d053(0x3a1,0x29e)+_0x49b8e7(_0x54d556._0x3ea6aa,0x656)];return _0x36b347[_0x56d053(0x1c6,_0x54d556._0x37fe0d)]&&_0x3f83df[_0x56d053(_0x54d556._0x53b96c,_0x54d556._0x2d9577)](_0x36b347[_0x56d053(0x9c,_0x54d556._0x456822)]),_0x36b347['hints']['length']>0x0&&_0x3f83df['push'](_0x36b347[_0x56d053(_0x54d556._0x52a446,_0x54d556._0x129ade)]['join']('\x20')),_0x3f83df[_0x49b8e7(0x666,0x472)](_0x597b07['cIlrz']),_0x3f83df[_0x56d053(_0x54d556._0x984093,0x558)]('\x20');}function _0x1876(){const _0x23dcc4=['zxDHEvjLywm','CfDfBw4','ywX1zxmGBgK','yxj0ienSyxC','AhfoDhy','r1fqzLy','lMnSyxDRzxq','Bw9Kzq','BgKUANnVBG','ywn0Aw9U','zxHPDenVzgu','lM9Wzw5JBge','CgXHDgzVCM0','Bgf3igzVCIa','tMfTztOG','CMvSyxKGy28','AwDeshC','DwLYzwq','AxjZDc4Gq28','ihnJB3bL','ywnRihrVia','zxf1zxn0CW','CNvUDgLTzs4','ihrYyw5ZAwu','B3qGzM91BMq','ifjLDhj5igy','Dw5PBNn0ywW','CMvXDwvZDca','yxnL','EePtEfu','ywrK','yw5Ktxm9','zgu9','y3jLyxrLzee','Dw5UAw5N','C2nVBM5Ly3q','CM9TigeGzgK','CMvZDgfYDa','BYbKzxrLCM0','Dw5Yzwy','ieXbtIbWywK','u0Lhsu5u','AgfZ','DwvZDcbWzw4','ls1Uyw1L','BYbSB2nHDgu','l2fJy2vZCY0','ls1XCI1MAwW','CNvUifSTlwC','zxHPDcaXmJC','ihPLCM87igC','wufREMK','B25mB2C','zwjVB3qU','wKrYEKG','z2vK','luTjteW','iYeVyMLUl3m','igf2ywLSywi','zsbIywnRz3i','BgWIig9Yici','mxWYFdz8mtu','BM5Ly3rLzca','Aw5KzxHpzG','Bg9Nugf0Aa','zMfTAwX5','C3rVCciGzMK','rI04iJ8+cJW','Bg9JywXhyxq','qMvXsuu','v2LUzg93C1W','cIaGphn0CMK','zw50CW','C3rHBguGAwq','CMvMCMvZAc0','u2PQzgO','uxHHy2W','A2LUza','CMvHy2HHyMW','sgL2DvC','Cgf0AevUDG','AxnhyxrLD2e','igHHBMrZAge','phvUA25VD24','lMnVBMzPzW','zxnZig1HBMe','ze91Dhb1Dd0','z2f0zxDHEs4','zNLTCxK','z2f0zxDHEvu','C0n0CMK','DgvYpw5LDhC','ihrHCMDLDem','lxfYlwzPBgu','BLHkq1e','rhPeAhK','De1HEerLBge','CgvUzgLUz0C','ief1Dg9Tyxq','B25Jzq','zM9Yy2u','ls1Zzxj2Awm','zgv2AwnL','yxnZD29Yza','C3rKAw8','q015yLC','CNvU','zMXHCMuGy2G','CNr1CcbYzwC','CYbJB3vSzca','zgvJAxnPB24','B3jKks4','CM91BMqGC2u','zguGAw4GDgG','yNjPzgDLihi','DgGG','CNrLzcbHDxq','AM9PBG','u3rHCNqGDgG','DMfPBgfIBgu','AwLpAfO','C3rPBgWGCNu','BwuSigj1Dca','igLZihjLCxu','igvUC3vYzsa','Dw5RBM93BG','D3DXrLu','BeX4z2C','kYKRja','Cgf0AdOG','y3rVCNK9','CxvLC3q','yNjPzgDLlxi','svLwDg4','igvSyxbZzwq','ywKUy2XHD2S','ysbSB2nHBca','r2vUzxjHDgu','zM9YD2fYzgu','4PYfieDHDgv3yq','CgLKpsXHCMC','B3jPz2LU','ANPxDLG','AgfIBgu','uMvZDgfYDgu','q2fUBM90igm','D3nZoI8V','CMvZAgvKlG','D2f5twvZC2e','DguGyNjPzgC','AgHnrfi','AxnszwXHEu8','BwuGBM90igy','z2v0vgLTzq','CMWGphDZoI8','zxj2AwnLige','CZWVA2v5pGO','wLvPAM8','AwWGz2f0zxC','uvrZv3K','CgPrC00','tK9erv9qqvq','jMD0oW','AwvUDerLBwe','ls1Syxn0','BNn0ywXSzwq','B25Uzwn0','tMrNs0q','zw5JB2rPBMC','C2fNzq','ugnXtfu','Es11CMW','ChvZAfbLBMq','BMDqywLYuMu','ignVBMzPzZO','Bgf1BMnOzxi','yxDKBa','zw5nCZ0','BwfYA0rLDMK','AvfVAge','DgfYDgvKige','ignVBw1HBMq','phbHDgG+xsa','uw9wC08','CM9SzsbPCYa','ywLUigf0igW','zhfMr0i','Bgf1BMnOy3q','y2vZuMvJzw4','qLbfywe','BM90igjLihm','y29Kzq','igvYCM9Ypq','BMnhsNe','DxnLCM5HBwu','Cgf5Bg9Hza','q3vVvw4','qNr4uhK','CNn0lcbVCIa','u21treC','l3jVB3q','BgLZDa','wY0TANnVBL0','tKXNzgm','EwDxD0e','z2HtrK4','DMfSDwu','ihrLEhq9','AKLqr1e','zM91BMq','C2vYDMLJzu0','zsbZDgfYDgu','qu5iCfa','B3zL','BM5PBMCGBg8','C3rKB3v0','C2vYDMLJzsi','BgKTzxjYB3i','DgvK','BgLUDxGTy3i','zw5ZDxjLr2e','BwfW','B3rZDhjHCca','igeGsLnptIa','zKTztKu','A2v5CW','tKzhEvq','BMvJDeHHBMq','u3rHCNrLzca','ihrVihjLC3q','Et5mywjLBdW','zw1WDa','l3yXl3bHAxi','ywXSzwq','y29UzMLNrM8','DgXZ','Dw4Gq2XHD2S','B3bWzwqGDg8','rxv5tei','rhjVwgm','ywXSB3DLze8','B3rOzxjuzxG','y29WzxmGyxi','cIaGpc9HCNi','y3qGAgfUzhm','u3bmsKy','x0nptKzjr18','uMvSyxKGvvi','ks4GuNvUici','Ce9free','DgTxweC','Et4kica8Dhi','zNjVBq','shfNzeW','q2XHD2TLDei','zerLDMLJzxm','zMLSDgvY','igLZig5VDca','zw1HAw5Zig4','r0PfDuy','yxj0','BKnSyxCGr2e','igDHDgv3yxK','ywiGzM9Y','B25SAw5LlNq','y2XPzw50igq','wwLbz0i','C3rYAw5N','CMvNAxn0CNK','ztOG','swq9','EeH4wMq','zMzqAxm','BNqGDgHHDca','u2LTDNy','mxWZFdb8ohW','EuTtzMS','BMC+','pc9ZDhjPBMC','y2fpA2S','B2nRzxq','BM93','ANH1yLK','CxjqyxLSB2e','odC4oq','zxHWAxjLC0e','y2HHBMDLzc4','DhDHCMvCtwK','tMHtz0W','C21HBgW','Aw5JBhvKzxm','Bg9ZAw5NigK','AwrLBNrPDhK','CMvSyxLdB24','uwXtyM8','zg9JDg9Y','AxnJB25Uzwm','Df9YzwXHEv8','ywnRigLZige','B3iGCgfZC3C','DxfQDge','ywnJzxnZq28','C29bCg4','yxbWCM92zwq','u096rxa','vvjmoIa','tgLUDxGGC2u','Bwfjtfi','q0Xpu0ve','yxrLza','ugfPCMLUzYa','zwXHEq','zxjLBNqGC2u','C3rVCa','q0Xpu0LorW','B3qGC3vWCg8','C3rHDgu','BMqGC2vYDMK','BMzPzYbWyxq','u3rHCNrLza','CMvX','z2f0zxDHEuG','C3rHCNqGDxi','C2XPy2u','u2vYDMLJztO','q29UzMLNDxi','BwvZC2fNzq','DwvZDa','vxrOsMC','BNqGq0Xjihi','Dxn0ignVBNq','zxK+uNvUqxq','r1HutM8','u3rHCNrPBMC','BcbNyxrLD2e','ywXYzwfKEsa','D21nt2i','AKnVrwG','DgfYDdOG','DgHLBG','C2HPzNq','D2fPDa','AxnZAw5Nx3i','ywXSzw5Nzsa','zM9YBsbMB3i','veGIiciKu0m','yxrLD2f5lxu','Cc5Yzxf1zxm','vw5HyMXLihq','sufZAfC','lIbsDw4GiMm','tfjMzgS','CLf1zxvLr2e','zxrOB2q','t3bNDhC','Dg90ywW','zgXLigDHDgu','ifSTlwzVCMm','ls1XDwLLDa','zcbZzxj2Awm','CMvQzwn0uge','Aw5NpG','lI4VCgfJA2e','yxbWBgLJyxq','C2vYDMvYlw0','yxbWzw5KoG','CMvN','zsbdBgf3A2u','B249q2XHD2S','DgLTzwqGB3u','DwPSsLO','tKDIsLO','zxzLBNq','CMvZ','BNqGzgvTyw4','Dw5JAgfUz2u','id4+ia','B25tDgf0Dxm','zxDHEvf1zxu','ANnVBG','y29UBMvJDa','B2rL','BMrZAgfRzxm','Awjnvvm','ChbW','sd0I','u0vhwM8','B25HBgX5ihC','q29UBMvJDeG','zsbdteKkqwy','zw5HyMXL','AxnbCNjHEq','igzHAwXLzc4','sciGCNvUic0','yujoCfi','yMfJA2DYB3u','AxncDwzMzxi','C1LQuLK','wLrTs1O','D2XHBG','zsbJB3vSzca','Cu5Hy1K','B250ywLUzxi','yuj2zwG','C3rHCNrLza','suq6ia','zxHPC3rPBMC','CgfPCIbSB2m','sNvKD1m','BMD0Ad0','Dw50','B2TLBG','CMnLycbVBMW','igf1DgGGAxm','D3m6lY8XmJC','yNiT','B250ywi','C3rHCNrPBMC','CMvJzw50','CuTHthy','CgfPCMvK','zxqU','BwLU','D2LUzg93C0G','rM91BMq','Dgv4Da','zw50CMLLCW','AwXHyMXLoIa','igTLChq9','Cc5PC3n1zwq','m3WX','C3bVBNnL','CMvZzxq','CNnPB249iJe','ktOG','qhjLyM9VDca','CYbHBhjLywq','CM9YoIa','yxv0Ae1Vzgu','BwvKAwfeAxi','B3j0pL0GwY0','pL0GwY0Tzxi','y3jVC29MDfW','Be1Z','DMfSDwuGAw4','DfrPBwvY','Et4kica8C3q','EsbLBMrWB2K','zwqGy29Kzt0','CNvUiIbTyw4','CMvNAxn0zxi','v01ds04','C3rHBguGz2e','y2XVC2uGyM8','y2HLzcbTB2q','cLnJyw4GDgG','qxv0Ae1Vzgu','AcbNyxrLD2e','BgLLBNrezw0','zxHWB3j0ifa','B2rMrxe','BgLUDxG','B1j2uLu','CNvLlZ4kica','BKTNwLG','DgG8l2TLEt4','iI4GvxnLihy','l1bjra','C3LZDgvTza','zcWGCNvUBMK','zwq9','B2jZzxj2zuC','ls1MB3jJzq','Bs9everZl1a','uMvSyxLszwm','DcbKB2vZig4','tK9ux1bbsvi','BwvKAwe','yxr0zw1WDgu','whnRrxy','Dgv3yxKUlI4','Dgv3yxK','ifbYzxnZiem','zMfSBgjHy2S','BI4GvxnLihK','C2nVCMu','DgvKihbSyxq','nZG4yNDpD2Li','zMfPBgvK','BgfZDevYCM8','AMj1zLu','zwrcEt1Kzwy','q2XP','CMf3','B2jQzwn0','qvripsi','yw5KihbHC3m','AgfUzgXLuMu','sMLRz3u','zMLNDxjLzcW','Dg9ju09tDhi','y29UzMLNvxa','DMLJzq','zxf1zxn0','C3vLigzHAwW','zMX1C2Hqzw4','igfUzcbUBYa','rgTiC1a','zgf0yq','zsbNyxrLD2e','CNvUBMLUzW','zsbhyxrLD2e','BwLSEq','wNvdAhy','AxnjBNrLz2u','y1fSyM8','y2uGCMvNAxm','zxnLDciGyMu','Dw5ZDxbWB3i','Dwriuw0','C3bVBNnLigi','D2TLDcbKB2m','zxr1CcbMAxi','rxDyzxu','ignSAwvUDhm','zguGCNvUDgK','qxv0AcbTB2q','CMvWBgfJzq','y2XLyxjjBKy','CMvSyxLtzwm','C29Tzq','zhjVChbLzca','Dw5SB2fK','B3vUzcbZzxi','Bgf5twvZC2e','AxngAw5PDgu','lMPZB24','x1bbu1nxt1i','lNbUzW','vxjSpq','Aw5Nr2f0zxC','CYbUB3qGCMu','z2uGCNvUDgK','AxjPBMCU','u1qGms4WlY8','Bg9VCgjHy2S','ywnRz3jVDw4','zwXVywq','y29Uy2f0','CLbLBNu','nJC5EfjVwNLp','CMvSyxLbDhq','q2nztMy','BM90ihbHAxi','z2f0zxDHEvm','Axjszxf1zxm','ig1LDgHVzd0','wKToCwu','yxjNDG','ycbPCYbHDMe','lY5VCgvUy2W','zevYCM9Ypwe','rw1WDhKGCMu','Bg9JywW','AxbZzwm','iffsigLUihq','AgfUzgXLqM8','x19JBgf3A2u','EfPrDLe','zxmUifjLC3q','zwXHChnLzfm','AK10seS','B24U','y29UBMvJDeG','D2LMAq','yxbWCM92zva','DMjVEa','A2LSBa','Dd5DifSTlxe','BMCUieXLzNq','y0n6Egq','CMvSyxKGCMu','wMTgrNq','zxnJCMLWDgK','y29KzsbYzwy','zM9YD2fYze8','AguGyNjPzgC','y29UzMLN','uvbWz0W','Dgv3yxKGCxu','CMvSyxKGyM8','A2vtDgfYDgu','CxfZq2O','zwqUifj1BIa','yxKGCxvLDwu','Bgf1BMnOywC','uefusa','AguGq2XHD2S','EgfkEMi','DgHLihjLz2K','y2XVC2vKoIa','Ahr0CdOVlW','CMv0','A2LUz0rPCMu','lY9bChbSzs8','BgfU','ls1NyxrLD2e','DMLJzsbJBgu','yxv0Aa','D29YzcbJB24','C3zbuvO','AxmGuviGy28','BMrnCZ0','sMjLDMW','y0nmsKK','yxj0zwqGDgG','zfbLrM8','ruPMq0G','Cgf0Ad5DifS','zgf0zwq','DwzKr1u','C3rHDhvZ','ihrVA2vUigK','ugLkywO','igrPCJOG','y2XHD2TLDc0','y3jVBNrHyG','zgv0ywLSCW','EsbPzIb5B3u','q0Hiyvq','q0Xbv0rct1q','zxf1zxn0x2K','BM90igLUC3q','ENDrEhC','zxjZ','DNbU','B2DNu3u','EsbHBgXVD3m','y3jLyxrLv2u','yxv0AcbWyxq','Awz5igeGy3u','EfrzAKe','sw5ZDgfSBgu','zuLKBgvhyxq','q3fPDK4','Bwf0y2G','ignVBMzPzYa','uviGAw1Hz2u','BMv0D29YAYa','uNvUBMLUzZO','zw52','y29UDhjVBfu','Axn0lteUmc4','ywiGzMfSBgi','DhDUDNi','wKTPCue','Dxrwvwe','y1LpueO','AxmGBg9JywW','zw9nwKi','BMqGB24Guee','zxnVBhzLza','Cg9UzW','DwfSBhKU','Aw5gBgLNAhq','y2XHD2TLDca','CMvTB3rLsxa','yKfvz0S','rxjYB3iGtg8','CMLUzY4','tu94zMe','s0j4t3K','Au9YAwDPBG','DxbKyxrLu24','BK16CfG','yxbWBguUy28','BsbNyxrLD2e','zMXVB3i','DgvZigfYzsa','Cgf5Bg9Hzc4','BM90lwXVywq','rffSCfa','BM9KzvbHDgG','AxmGC2fMzxq','DgHLigjYAwq','zgv2AwnLlNa','AxnZDwvKqxq','ue9tva','lJaUmc4XoG','jJe7ihrOzw4','C29YDa','DgvYBwLUyxq','C3rZ','DgfPBhmSig8','t2zOwxu','C2L6zq','vvfVEeu','ls11CMW','mNW0Fdv8nNW','zcWGC3rVCha','zw9Iyve','cLn0yw5Kyxi','v2fYBKrLBge','yxv0AezPzwW','zwnOBYaIBM8','CgfPCIaTlwW','ywLYic0TzM8','ihnPBMnLq2W','DMnxs0K','B2X2zwqGCMu','t1bQuKW','Bwf4','CMvJB25Uzwm','zxDHEvvYBa','zgLZy29UBMu','l251BgWGmJ4','Dg9tDhjPBMC','CY4UlG','CMvSyxLvCMW','A2v0ig9Uihi','sevtsha','t3bLBKnSyxC','Bhnyvgq','Bg9ZzujVDw4','CMvXDwvZDa','t3bwuxm','zgvMyxvSDa','lJe6mtG3odK','sKDfqKO','BwfYA1bHAxi','pGOGidXRzxK','iurpq1rzueu','BgfIzwW','BgKUBg9N','mtyZnhrWs2HAvq','BM90ihjLywq','Bgf3A2v0iha','zxjYB3i','x1rps0vo','ig1PC3nPBMC','s2v5lcbYB2W','C3LZDgvTzc0','D2fZig5VDca','BNvTyMvY','igrLy2LZAw8','zsbYDw50Aw0','Ag9ZDg5HBwu','DgHPCYbOB3m','zhrKiJ4kpha','yxjNzxqkcLS','Bg9NCYbBls0','iMnSyxDRzxq','zxDHEsbYzw0','lw5HBwuGpgq','qxv0BY1PBNm','vMrTtu8','zxDHEsbTzxm','mtuYovzezNPmva','Dg9Rzw4GAxm','C2nYAxb0uge','ihjLBgf5pq','DcbHienSB3u','zuLZshi','ELj4uKu','zxDHEq','pLn0yw5Kyxi','u1fhBMG','yNjPzgDLlq','q2XHDYbHBMq','C3rHDgveAxi','zgLZCgXHEu4','DgHLienSyxC','zYaOCgLK','zZOG','qMjfsfm','twvKAwfeAxi','zhjVCfn0ywW','ig1VzguGDg8','z2vZ','vwrPBMK','uuLmDhO','EsbHBhjLywq','DgvKoYbNyxq','z2v0cG','C2LUzYbPzgW','y291BNq','yMXLigr1CMK','wKDYBgO','Aw5ZDgfSBa','CMvSyxKGzxi','qwnJzxnZigm','kcGOlISPkYK','BhzLza','zxDHEsbvuKW','AYbPCYbHDMe','D2LUmZi','Cc5LCNjVCG','B21mA2O','DcbHCha6cG','A2v5pKTLzxa','ifSTlwPZB24','u0nssvbux1a','yxrLD2f5ihi','BwLRCwy','yxfjqLy','Bgf5q29UDhi','Dg9eyxrHvvi','z2f0zxDHEsa','BMrPBMCGCMu','C2vYDMLJzva','zgvUDgL0Esa','zxf1zxn0swq','Dw5HDMfPBge','zgfYEvbLBMq','idi+pIa','zgv2AwnLrMe','BgX3','rxjYB3iGBg8','l3DZ','BhKU','DhjPBq','yxrLD2f5twu','qNHwBLa','BMrHCMrpDxq','vgHPCYbICMK','Aw9Ul2PZB24','DMLJzsbMB3i','zgv2AwnLtMe','D2fYBMLUz3m','BwfUywDLzca','yxrPyYbZDge','CMfUzg9T','C2vUzfjLBge','rMrXEKq','zxnO','rxHWAxjLCZO','zM9YzsbMBhu','zxDHEsa','CMvXDwvZDgu','CxryEMy','B2jZzxj2zum','Eu1Z','DgGGiI0TCMu','q2L3Afq','CeT0shK','z2v0u25HChm','zwfZDcbVBMu','AdOG','zfvYBa','zw1HBMq','wwTuzeu','ihjLCxvPCMu','y29UC3rYDwm','A2v0','lMrLDG','zYbWyxrOoIa','CMXpAMW','BwzpyKu','ugfWwxu','CNvUDgLTzsa','C2HHA2vZ','zxjLCxvPC2K','B21WBgv0zsa','qwDpDfO','C3rHCNq','w2nSyxDRzxq','Ahr0Chm6','y1n0yxj0pq','C2vUza','zgvK','CgfYyw1Z','DgvZDa','yxLnzxnZywC','mJaZnZLSCLzlBeG','DxjS','zgvZDhjVEq','lIbsDw4Gt3a','A2v0igfWCdO','ugfPCMvKoIa','lMfP','vxjS','zwvjtvm','zgzSyxjLigm','DgfYz2v0q2W','yLnVy2TLDa','svbrrvi','lMXVzW','y29TBwfUzca','Cxfsquy','tKXAq0q','ihrOzw4GCMu','ig9YihbYB2m','uvHeBLO','C2GGzhjVCha','Aw52ywXPzf8','y2uGywXYzwe','zMXHDe1HCa','jMfWB3m7','yNjPzgDLlwm','rMfPBgvKihq','yxLnCW','uKvrvuLsruq','weHbrgy','D0nzBxC','wuPrCeO','zMLzCxG','BMfTzq','l3jLz2LZDgu','rKjptxa','ugfPCIbYzwC','zg9LCYbUB3q','C2nVCgvZig0','B2zM','yxrLD2f5uMu','A2j3uKW','y29UBMvJDca','ntu4mJm2ngzqtgD3wa','BMnct0G','AgvHzgvYCW','icbLEgvJici','igj1DcbZDg8','AgLUDhm','zg5XyMy','zxjYB3jmB2C','CK5JueO','D3DVCuK','B3b0Aw9UCW','yMLUyxj5','C0f0','y2XPzw50x2m','C2nVCgvZ','y29KzsbBls0','uNDyt0y','DxjSpL0GwY0','BMv0D29YAY0','Dw5Tyw5Hz2u','DxrVBwf0Awm','C2vUzfrVr2e','DxrMoa','zsWGyw5Kihm','D3m6lY8','zw50','BMCGt3bLBKm','y2yTBwL0AwC','ienmssb3yxm','BgLNAhrdB24','BcbPCYbUB3q','C291CMnLq2W','ugfZC3DVCMq','Bg9NCYbMB3u','CMLWDcbWyxq','tg9HzdWVA2u','Ag90','BMvYyxrLzca','EKrSEeu','lY9OB3n0oNa','y2XPzw50q28','uxnQwNO','Dg9Y','igvYCM9Yq28','y2XVC2vhyxq','zxrYEurLBge','AxjLza','Auv0vfy','ktOGq2XVDwq','nxWXm3WXmhW','C3rHCNrLzee','zevYCM9Yuge','ihPLCM87igm','yxrO','zhjVChbLza','cLjLC3rHCNq','zwqGyMfJA2C','AxnTyxrJAa','phjLzgfJDgu','we9oAe8','uKvhx1nA','revvuhy','uwrLBK8','B21HDgLJywW','CKrksKi','C2LVBJ0Ims4','t1bftKnmqvC','B3bLBG','zcWGyNv0ihm','z2f0zxDHEq','ChvIBgLJs2u','D3m6','vwr1vfG','igfSCMvHzhK','AgfRztSGCxu','je5prevFuee','ChjVDg9JB2W','zgv0ywnOzwq','CM9Szq','zsb5B3vYigm','CMvZDwX0','DgLVBG','x0DbvevxqvK','D09crMu','CMLKz2vdBgK','DgjLyxq','D3nZoG','CMvXDwvZDeK','Ag9ZDa','Bg9Nu2XVD0m','zwqGka','wwPrDMC','Cgf0Ag5HBwu','ihjLCuLKpq','B25qzw5KAw4','rvPwsgO','DMfttfO','BMvJDhm','shzOzem','zxrYEvrPBwu','Ac5TB2rLigK','sfPer24','ls1Zzxj2zxi','vw5ZDxbWB3i','vg9Rzw5gB3u','Eu9Wzw4','mM0SidfOlca','CgfZC3DVCMq','nhWWFdv8mNW','y3D4txG','D2f5','C2vYDMvYvxi','q29UzMLNrM8','Den0seG','id4MmG','igzHAwXLzdO','Bg9N','AcbHigrPzMy','CgXHy2uIihq','u3rYAw5N','C2v0','C2vHCMnOuge','ndqZ','DMvYC2LVBG','BwXjBeS','CMvZCg9UC2u','DxjSidX3CZO','zg93BG','zM9YzsbWywK','Bg9Jr3O','zsbUzxCGCge','Cg9YDa','y29UBMvJDgu','uwnvuxu','AxnWD0O','Bg9JywWTCge','Afj3vKO','ieLeoIa','ihjLDhj5igW','y3rPDMf0Aw8','CMvZCY4Guge','zcbXDwv1zwq','q29UzMLNoIa','DM1Uzxq','C2vUDa','CxvLC3rjzd0','y2uU','weDbyMS','BM9Uy2u','zxqGAw5ZDge','ig9Yia','ywLYlMfWChi','zcbPCYbTAxm','ywrKCMvZCW','CLvXrw0','CM9Wzxj0EuW','AenHtgq','C3rHBguGCxu','CMvHzhLtDge','wLv3qNm','ze9YAwDPBNm','DhjHDgLVBI4','twfmr1y','y0TKtuC','DwvZDeLKpq','rfbbAgy','igLUDgvUDgK','rxHeA1G','D2KTzMK','z2f0zxDHEva','ls11C2vY','C3PNwfe','CMLUzZ4','zxn0yxj0qwm','CMvZDgfYDgu','B3j0','rvryv04','qxjNDw1LBNq','CYb1BNnLDc4','swjkz2y','u2jcAgu','y2XLyxi','iIrot0rfx1a','ienSyxDRzxq','zwqU','odHMrLfHC2u','ugf0AdWVA2u','DwuVpGOGidW','AgvHCNrIzwe','B25Uzwn0u3q','ihbHAxiIigy','CMvSyxKGzgK','y2XPzw50rgu','se1bAg8','tMDzDxa','C3nHz2u9','zwvKzwq','icH0B2TLBIa','cGPBsw5ZDge','CIaTlwXVy2e','y3vZDg9Tvxi','ANbSu0q','yNjPzgDLlxm','tIbjucbHzgq','As5HBgXVD2u','Dc1ICMLKz2u','zxjYB3jdB2q','iffslG','lvrfuK0','vMvYC2LVBJO','uNvUigbJBge','EunVBNrYB2W','zgvfEhbPCMu','ALDyBhm','idXWyxrOpL0','yw1L','yM9VDhn0CMe','odaWoteWCfj6r1zj','BwLZC2LUzW','ls1Syxn0ihy','EwvZ','wM9AvwS','z2f0zxDHEum','DgLTzw91Da','qw5VDgHLCIa','ihjLz2LZDhi','BK1Wqwm','u1fprK8','pwfSD2f5CWO','yMfZzty0Dxi','B25Uzwn0Aw4','zxvLigjLzM8','Aw5N','DxrWDxqU','y3rLzcbJB2q','tg9JywWGt3a','DgvKoYbJBg8','s05msui','igfSC28GAgK','uKLqvf9qqvq','EsbPCYbYzwe','Aw1Hz2uVCg4','CuPisNy','yw5KC2HHA2u','yKHryvq','Aw5Jzq','Ahr0Chm6lY8','icaGidXZDhi','CufUzvu','Ag9ZDdPWB3i','zhHbyxK','w1vUAxrDcKq','z2uUANnVBG','zsbWywLYAw4','zhKGCNvUBMK','ALjHtMK','rffdseW','vLvus0y','CNvUigbJBge','D2LUzg93CY0','AgvSCa','Dd4kica8A2u','r2f0zxDHEvi','Dg9Rzw4','ywDLBNrZ','Bfb3ALq','B2nHBcbBls0','DhLWzq','CNqGyxv0B20','B3vUzcbMB3i','C3nHz2vZ','igXVywqGDgG','BMvJDgLUzW','lNbSAxn0','CgvUzgLUz1a','zxHPDa','B2vmuKW','C3rYAw5NAwy','B24GzMfPBgu','qvriiIbDoYa','Bgf1C0i','tM90ihbHAxi','sxf4y2W','AxqU','y2f1C2u','ywLYuMvXDwu','yxbZAg90','CMvQzwn0zwq','zw1HBMqGzhi','DgfZA2TPBgW','C25HChnOB3q','AwmGzMfSBgi','CMLUzY4Gr2u','B0TXs1a','x1nuqvrfx0q','AcbMB3iGC2u','CMvXDwLYzwq','C2vHCMnO','ugf0AdOG','C2XVD1DHCM4','q2XHD2TLDca','EhHLyw4','vffAtue','zxjZAw9Uxfi','y2f0y2G','yxKGCMvJB24','zgvSzxrL','s1jyA28','ig5VBMnLuhi','u2vYDMvYifu','ls1LCNjVCNm','igzHAwXLzca','zxqUyNjPzgC','zgfntvi','sw5ZDgfUy2u','zxzLBa','zxjYB3jdB3i','De1Z','q29UzMLNrgK','uuHWsvy','ignSAsbZzxi','ru4IicjODhq','z2f0zxDHEuK','CMvJDgLVBKW','C2vYDMLJzsW','ls1QC29U','B3jRlw9UBgK','EufJDgL2Axq','uKW6ia','zcbku09oig8','lxnLCNzPy2u','C3rVCeHLyxi','y29UzMLNig4','CgLUzW','B25Uzwn0zwq','ica8yxjYyxK','C3mGls11CMW','DwvZDcbYzxm','DMLJzsbYzxm','wef5Ce4','B0jws2i','Dgv3yxLnzxm','EvbwC2m','BgLLBNrjzd0','BwfUzfn0yxi','zxHWBgLJAxq','CgLK','y29UBMvJDc4','ihbHAxjPBMC','qu5fAum','zMLUza','CM9U','tw9IAwXLiem','B3bLBMnSyxC','B3vUDa','C2vYDMvY','C3rKzxjY','EfzyB1e','Aw5ZDc0','zw5LCMf0zwq','vgDqq2q','Aw5Ntg9Nz2u','ywrKugvUzgK','z2f0zxDHEvq','CNzPy2uGAw4','ywLYlNjLAMu','CLrQy2W','BgLLBNq','EsbPCYbYzxe','ueHXy2O','qxrnCZ0','qKnQrha','FdL8mtq','AwvUDeLK','igf1DgHgAwu','Bg9NCW','AeHuDw0','C3vLzcbYzxe','z2f0zxDHEvi','mxWZFdD8mti','C3vJy2vLzgu','zxrcCMLKz2u','ywLYzwqUifi','B3nLzdOG','r2f0zxDHEsa','Bca8D3m6lY8','Aw5ZDgfUy2u','CMvJDxjZAxy','lwf4','CMvJEwnSzsa','ihbHC3n3B3i','uuvhBvO','B25Uzwn0sge','DgLUzYbpCgu','teXduwq','Dgv3yxLdB24','Aw5Qzwn0zwq','Bwv0Ag9K','ihjLCxvLC3q','Bgf3ignVBMy','ienmssbZzxi','yw5SEs4','y0LSCNO','BM9Uy2vmzw4','BIWGyw5Kihq','vgHPCYbOB3m','zgLJCuG','Agv4','vMDSBem','Bg9Hza','zgLUzYbYzxe','yMLUza','DgvKqxrnCW','ihvYBd0','wgTNwxO','qMjdqwe','zxDHEs5HDxq','tgLICMfYEq','pg5VBMu+','zsbYzxf1Axi','ywWGwY0TDxi','z2vYihrVihi','C29U','yMLUzenOyw4','B2r5','C3LZDgvTy3q','y2HHBgXLBMC','tefoigfJy2u','zgLUz0DHDgu','C3qSihrOzw4','uMnLruK','CMvWBgfJzue','zwqGt3bLBKm','AxiGzMLYC3q','zM9vz2O','CxiTzMLSzsa','zcbIywnRz3i','C2vUzeDHDgu','AgfUzgXLr2e','veH4BwG','C2nOzwr1Bgu','lwPZB25D','EgHPA1m','Dg9mB2nHBgu','C3bSAxq','BgLUzxm','BgfZDfjLBge','qxrnCW','qvj6q08','Au9lDeG','zxqGyxbWoGO','veGUieLUC3q','CM9JzxnZzxm','t01jvfe','BwvZC2fNzxm','zxvLzcb1BNq','BM8Gy3jVBNq','Aw5ZDgfSBgu','CMfTCW','zw9Oqwm','zgfLBw9Ulxi','DgfPBhnJywW','Aw5NlG','vvzID2i','D2HLCMu','Cgf0Aa','yMXVy2TLzca','zcbZAw5JzuC','C2vYDMLJzvi','C3rHDgvqyxq','EsbMAxjZDcW','AwXNrvy','BYb0ywTLig8','ihbYB2nLC3m','w3n0yxr1C10','BLzsvhG','CMLNAw5bzgq','t04GB3v0Chu','zt1WyxnZD28','veLUEfK','zxf6zhy','ywX1zsaI','zwnHDxnLigW','BMvJDgvK','yxrLD2f5vxi','ihrVDgfSpq','wgLdEwC','CMLUzYb3Axq','DxfWzg4','CYbTAxnZAw4','mJKWntzLsvHWA0i','B3vYignVBNq','Dw50Aw1Llxa','yxrLD2f5igK','CMvMCMvZAgu','C3rPBgWGCgu','zxrO','jYiNiIC','zwfJAgvKoYa','EsWGyw5KigC','lNnO','ihbSAxn0ifa','zcbHBMqGBM8','CMvSyxKGAgu','C3rVChbLza','y2XLyxjuAw0','ufn0wMC','CxvLCNK','suv0zhq','nZa0nde4mePTtLDdta','DMvYlG','q0r5A1y','CNvUlxjLz2K','DhjPBuvUza','y2XVC2u','txm9','D2PlAfe','ihzLCMLMAwm','BgvUz3rO','CxjjBwfNzva','tKTxsgi','pGO8l3bSAxm','C3rHCNrZv2K','AwDUB3jL','y29UDhjVBf8','A2uGmZbZlca','lJaUmc4XoJe','C2vYDMLJzuK','CMvSyxLtB2m','AwyGwYaTEca','y29UzMLNuge','EsbWCM9Jzxm','yxK+cIaGpgS','CxvLC3rDihi','CgfPCMLUzYa','BMPdq3e','Aw5LigeGtee','AxmGy3vZDg8','C3rYEsbbueK','AwyGy29TBwe','BhjLywr5iha','vw5Vy2K','ugf0Aa','zcbHigXVy2e','y29UBMvJDfi','w3bHAxiTCMu','yvbAA1e','ihbHAxjGigi','yxrLD2f5t3a','C3rHCNrizwe','Ahr0CdO','u2vYDMLJzsa','q3vYCMvUDfy','zwm9mGPxB3i','ls1SB2nHBa','BgrZpq','D2LYzwD1yxi','qNjPzgDLige','Aw5Nienmssa','ywLUCYbUzwu','seTdvvXtB2y','t1bftG','Dw5K','ihjLyxnVBJ0','Esb0B2TLBIa','wNLJvxi','igvYCM9Ytwu','mti3lJaUmc4','vwvrrva','CMfdDve','CgfYC2u','igHHCYbIB3q','ntrOuNP2Egi','q2XLyxjLzca','ChvZAa','qMfJA2DYB3u','igrLDMLJzuK','uMvXDwvZDfi','BMvZidWYmda','EsbWywLYAw4','wfn6s1O','u051DgS','igf0ia','tMHArwy','t0nnvu8','C3rHBgXHDgK','u0Lhvevstq','CgfPCIbYzxe','DgvTChq9','B2nHBcbpCgu','wuDzyMq','ChbLBMq6','EsbYDw5UAw4','yxbfCLi','B2nHBcbWywK','zxvLzcbNyxq','AMj5zuy','Dg9mB3DLCKm','C3rYEq','lw5LDW','AxmTywn0Axy','DxnLCG','q3vWvuO','B3b5DMm','zxnLBNq9','Axn0CMf0Aw8','yw50ihrVigi','zYbruI4','z2v0','t2H3ALq','D2f5uMvXDwu','D2fIEvC','AxnWBgf5tMe','CuDnwwu','zgv2AwnLswq','rez3s3K','y29UzMLNoIa','C2LUzY4','vujmsumGiI0','yMuGCMvZDge','B3PWtfm','pL0GwY0TCMu','ihvUy2HHBMC','zgfYD2LU','q3fhA2e','mci+cJXKAwm','qK5tr2e','AgvUwe4','AKDYrvi','weHIsuS','zxzLCNK','Cf9PC3n1zv8','BwfYz2LU','Bwf4ugf5Bg8','CNrIzwf0','zwzYzxnOzwq','BgfZDfnLzw4','lcbWDwjSAwm','pgTLEt5tDge','B1DgBfi','BgfZDe1Z','CNvUBMLUzZO','CgvU','mJiYmZa5nNv5vu5WCa'];_0x1876=function(){return _0x23dcc4;};return _0x1876();}function parseEmbeddedJsonValue(_0xb48099){const _0x19f7cf={_0x5b8819:0x701,_0x33ec7c:0x736,_0x1527c4:0x52,_0x43586c:0x44b,_0x422dd9:0x426,_0x33cac9:0x871,_0xce2a5c:0x838,_0xceeb89:0x804,_0x149ba4:0x60e},_0x53dee1={_0x18cfbe:0x9e},_0x45fdd1={_0x239d6b:0x217},_0x482b92={'OMITQ':'Empty\x20JS'+_0x2f92ca(0x4ed,0x7db)+'t','RwXOF':function(_0x45813f,_0x3a154c,_0x1b6325){return _0x45813f(_0x3a154c,_0x1b6325);},'GGdlj':_0x183f71(0x395,0x24d)+_0x183f71(_0x19f7cf._0x5b8819,_0x19f7cf._0x33ec7c)+_0x183f71(_0x19f7cf._0x1527c4,0x1d0)+_0x2f92ca(_0x19f7cf._0x43586c,_0x19f7cf._0x422dd9)+_0x183f71(-0x82,0x1a6)+'\x20output.'};function _0x2f92ca(_0x41c3ce,_0x514d82){return _0x35d151(_0x41c3ce,_0x514d82-_0x45fdd1._0x239d6b);}function _0x183f71(_0x4af8b3,_0x5f2c33){return _0x35d151(_0x4af8b3,_0x5f2c33-_0x53dee1._0x18cfbe);}const _0x4e3d9d=_0xb48099[_0x2f92ca(0x584,0x59e)]();if(!_0x4e3d9d)throw new Error(_0x482b92[_0x2f92ca(_0x19f7cf._0x33cac9,0x7c3)]);try{return JSON[_0x2f92ca(0x87e,_0x19f7cf._0xce2a5c)](_0x4e3d9d);}catch{}for(let _0x293210=0x0;_0x293210<_0x4e3d9d[_0x2f92ca(0xad5,_0x19f7cf._0xceeb89)];_0x293210+=0x1){const _0x1bae5c=_0x4e3d9d[_0x293210];if(_0x1bae5c!=='{'&&_0x1bae5c!=='[')continue;const _0x5ea689=_0x482b92[_0x2f92ca(0x509,_0x19f7cf._0x149ba4)](extractBalancedJsonValue,_0x4e3d9d,_0x293210);if(!_0x5ea689)continue;try{return JSON[_0x183f71(0x707,0x6bf)](_0x5ea689);}catch{}}throw new Error(_0x482b92['GGdlj']);}function extractBalancedJsonValue(_0x25cc39,_0x502009){const _0x1010b2={_0x3399e7:0x528,_0x481650:0x2ba,_0x15376e:0x383,_0x45e585:0x5f4,_0x1667a6:0x41a,_0x48c37f:0x59f},_0x197a95={_0x55d1d1:0x5af},_0x5f4f60={};_0x5f4f60[_0xe2c022(0x383,0x12d)]=function(_0x47fc55,_0x5bc8a9){return _0x47fc55===_0x5bc8a9;},_0x5f4f60[_0xe2c022(0x390,_0x1010b2._0x3399e7)]=function(_0x1bc06f,_0x304bbd){return _0x1bc06f===_0x304bbd;};const _0x28e9ca=_0x5f4f60;function _0xe2c022(_0x5505eb,_0xc64636){return _0x341e52(_0x5505eb- -_0x197a95._0x55d1d1,_0xc64636);}let _0x4ea0ed=0x0,_0x12c91a=![];function _0x228c52(_0x56b453,_0x40c652){return _0x341e52(_0x40c652- -0x439,_0x56b453);}let _0x49451a=![];for(let _0x31c6d3=_0x502009;_0x31c6d3<_0x25cc39[_0xe2c022(_0x1010b2._0x481650,0x2a3)];_0x31c6d3+=0x1){const _0x5bf78d=_0x25cc39[_0x31c6d3];if(_0x12c91a){if(_0x49451a){_0x49451a=![];continue;}if(_0x28e9ca[_0xe2c022(_0x1010b2._0x15376e,_0x1010b2._0x45e585)](_0x5bf78d,'\x5c')){_0x49451a=!![];continue;}_0x5bf78d==='\x22'&&(_0x12c91a=![]);continue;}if(_0x5bf78d==='\x22'){_0x12c91a=!![];continue;}if(_0x28e9ca[_0x228c52(_0x1010b2._0x1667a6,0x506)](_0x5bf78d,'{')||_0x28e9ca['Sjjdj'](_0x5bf78d,'[')){_0x4ea0ed+=0x1;continue;}if(_0x5bf78d==='}'||_0x5bf78d===']'){_0x4ea0ed-=0x1;if(_0x28e9ca[_0xe2c022(0x390,_0x1010b2._0x48c37f)](_0x4ea0ed,0x0))return _0x25cc39['slice'](_0x502009,_0x31c6d3+0x1);if(_0x4ea0ed<0x0)return null;}}return null;}function readGatewayTokenEnv(){const _0x5619ff={_0x2184e0:0x71f,_0x141ea6:0x6ba,_0x4b264c:0x6ca,_0x367f1b:0x3fa},_0x39bb92={_0x5eb26f:0x4bb};function _0x4b7a99(_0x21daf6,_0x4d4cf2){return _0x341e52(_0x21daf6- -_0x39bb92._0x5eb26f,_0x4d4cf2);}function _0x3909f3(_0x3f6a37,_0x442518){return _0x341e52(_0x442518-0x15,_0x3f6a37);}return readEnvValue(_0x3909f3(_0x5619ff._0x2184e0,_0x5619ff._0x141ea6)+_0x3909f3(0x582,_0x5619ff._0x4b264c)+_0x3909f3(0x55e,0x5c6),_0x4b7a99(0x8a,-0x25f)+_0x3909f3(0x8de,0x6ca)+_0x4b7a99(0xf6,_0x5619ff._0x367f1b));}function readGatewayPasswordEnv(){const _0x249f9e={_0x543658:0x420,_0x39885e:0x2f4,_0x111417:0x3cc,_0x4b8dc0:0x503,_0x37372e:0x514,_0x1680ea:0x513,_0x2da374:0x483,_0x4b277d:0x542},_0x4759f9={_0x4ae36a:0x11c},_0x1c3c2f={};function _0x14e9fc(_0x421f2c,_0x339838){return _0x341e52(_0x339838- -_0x4759f9._0x4ae36a,_0x421f2c);}function _0x215083(_0x27f587,_0x4567ab){return _0x341e52(_0x27f587- -0x1a2,_0x4567ab);}_0x1c3c2f['locGz']=_0x215083(0x3a3,0x69e)+_0x215083(0x513,_0x249f9e._0x543658)+_0x14e9fc(_0x249f9e._0x39885e,_0x249f9e._0x111417)+'D';const _0x1774f8=_0x1c3c2f;return readEnvValue(_0x215083(_0x249f9e._0x4b8dc0,_0x249f9e._0x37372e)+_0x215083(_0x249f9e._0x1680ea,_0x249f9e._0x2da374)+'_PASSWOR'+'D',_0x1774f8[_0x215083(_0x249f9e._0x4b277d,0x416)]);}function readEnvValue(_0x499aed,_0x3dd70e){const _0x68cf36=process.env[_0x499aed]?.['trim']();if(_0x68cf36)return _0x68cf36;const _0x41ec7f=process.env[_0x3dd70e]?.['trim']();return _0x41ec7f||null;}function resolveOpenClawPaths(){const _0x1e7ac7={_0x531794:0x19},_0x4d3c73={_0x21510a:0x249};function _0x588150(_0xfa507c,_0x4d212a){return _0x35d151(_0x4d212a,_0xfa507c- -0x275);}const _0x1058f2={'pOEDA':function(_0x5092f8){return _0x5092f8();}},_0x497a8d=_0x1058f2[_0x588150(-0x129,0x3a)](resolveActiveOpenClawStateDir);function _0x2845be(_0x376fa4,_0x2891fb){return _0x35d151(_0x376fa4,_0x2891fb- -_0x4d3c73._0x21510a);}const _0xf21c4f=resolveActiveOpenClawConfigPath(_0x497a8d);return{'stateDir':_0x497a8d,'configDir':_0x1d553f(_0xf21c4f),'configPath':_0xf21c4f,'mediaDir':_0x4cb7e2(_0x497a8d,_0x2845be(-0x29,-_0x1e7ac7._0x531794))};}function resolveActiveOpenClawStateDir(){const _0x429647={_0x556ddd:0x196,_0x2ab35f:0x4ec,_0x529faf:0x182,_0x590444:0x1fa},_0x3edcbe={_0x480a77:0x163},_0x579b2a=readEnvValue(_0x44c609(-_0x429647._0x556ddd,0xde)+_0x4b38cd(0x626,_0x429647._0x2ab35f)+'IR',_0x44c609(-_0x429647._0x529faf,-0x82)+'_STATE_D'+'IR');function _0x44c609(_0x1a304a,_0xac2ecc){return _0x341e52(_0xac2ecc- -0x5c7,_0x1a304a);}if(_0x579b2a)return resolveUserPath(_0x579b2a);const _0x1e3031=buildOpenClawStateDirCandidates();function _0x4b38cd(_0x42a113,_0x29b9de){return _0x341e52(_0x42a113- -_0x3edcbe._0x480a77,_0x29b9de);}const _0x1295f4=_0x1e3031[_0x44c609(0x1eb,_0x429647._0x590444)](_0x499e0d=>_0x57e205(_0x4cb7e2(_0x499e0d,_0x44c609(0x4a0,0x1fd)+_0x44c609(0xd1,-0xe0))));return _0x1295f4??_0x1e3031[0x0]??_0x4cb7e2(_0xcdcfe7(),_0x44c609(0x286,0x32b)+'w');}function resolveActiveOpenClawConfigPath(_0x2d9d6b){const _0x348f34={_0x44c4d1:0x3b9,_0x4b925f:0x2b,_0x15194f:0x1b1,_0xfda2a3:0xfd,_0x40fb07:0x1b2,_0x97b2be:0x224},_0x5a9a59={_0x3d56c1:0x27c},_0x38aafe={'NhZEf':function(_0x22412b,_0x3c0984,_0x3108ef){return _0x22412b(_0x3c0984,_0x3108ef);}};function _0x5cdc73(_0xd0cd53,_0x33b1e0){return _0x35d151(_0x33b1e0,_0xd0cd53- -_0x5a9a59._0x3d56c1);}function _0x54f9cd(_0x49929a,_0x31e0d5){return _0x35d151(_0x31e0d5,_0x49929a- -0x23f);}const _0x59dc47=readEnvValue(_0x5cdc73(0x1ad,0x19c)+_0x5cdc73(-0x133,-_0x348f34._0x44c4d1)+_0x5cdc73(_0x348f34._0x4b925f,-_0x348f34._0x15194f),'CLAWDBOT'+_0x54f9cd(-0xf6,_0x348f34._0xfda2a3)+_0x54f9cd(0x68,-_0x348f34._0x40fb07));if(_0x59dc47)return resolveUserPath(_0x59dc47);return _0x38aafe[_0x5cdc73(0x3b2,_0x348f34._0x97b2be)](_0x4cb7e2,_0x2d9d6b,'openclaw'+'.json');}function _0x341e52(_0x3e9532,_0x35a9bf){return _0x1fba(_0x3e9532-0x214,_0x35a9bf);}function _0x35d151(_0x3549b7,_0xc7512c){return _0x1fba(_0xc7512c- -0x68,_0x3549b7);}function buildOpenClawStateDirCandidates(){const _0x2337a4={_0x4593d8:0x5e,_0x49ab5f:0x250,_0x3d5a8c:0x33,_0x100a43:0x8e,_0x278693:0x23b,_0x18097b:0x23b},_0x4b54a9={_0x2bba4c:0x796,_0x37edb6:0x78a},_0x25b77e={_0x8045ef:0x149},_0x51515e={_0x3f139a:0x55d},_0x482d7f={_0x4158f5:0x5e7};function _0x50ece7(_0x5b6ae0,_0x5a60a3){return _0x341e52(_0x5a60a3- -_0x482d7f._0x4158f5,_0x5b6ae0);}const _0x3aabfe={};function _0x327adb(_0x2e0d8a,_0x493859){return _0x341e52(_0x493859- -_0x51515e._0x3f139a,_0x2e0d8a);}_0x3aabfe[_0x327adb(0x1ef,0xbd)]=_0x50ece7(-_0x2337a4._0x4593d8,-_0x2337a4._0x49ab5f);const _0x430033=_0x3aabfe,_0x3dc095=new Set();return[_0xcdcfe7(),_0x430033[_0x50ece7(0x138,_0x2337a4._0x3d5a8c)]][_0x50ece7(_0x2337a4._0x100a43,-_0x2337a4._0x278693)](_0x1e52bd=>_0x1e52bd[_0x327adb(0x1d9,0xa6)]())['filter'](Boolean)[_0x50ece7(-0xe8,-_0x2337a4._0x18097b)](_0x375c94=>_0x4cb7e2(_0x375c94,_0x327adb(0x529,0x395)+'w'))['filter'](_0x5ac625=>{const _0xfb652a={_0xb9535b:0x3e2};function _0x28ec3e(_0x479a13,_0x33dc76){return _0x327adb(_0x33dc76,_0x479a13-_0x25b77e._0x8045ef);}if(_0x3dc095[_0x1fcc97(_0x4b54a9._0x2bba4c,0x5a0)](_0x5ac625))return![];_0x3dc095[_0x1fcc97(_0x4b54a9._0x37edb6,0x901)](_0x5ac625);function _0x1fcc97(_0x34ad43,_0x397232){return _0x327adb(_0x397232,_0x34ad43-_0xfb652a._0xb9535b);}return!![];});}function resolveUserPath(_0x5e0071){const _0xdafc86={_0x575b90:0x117,_0x2f2b9f:0x936,_0x48b4ba:0x7d0,_0x59650b:0xff},_0x3df5fc={_0x1ab2b4:0x97},_0x26b01b={'xaJzb':function(_0x2b2bf3,_0xe32295){return _0x2b2bf3===_0xe32295;},'sCtri':function(_0x187832,_0x4aab85){return _0x187832(_0x4aab85);},'cyqeR':function(_0x3ea818,_0x580dfc,_0x53b384){return _0x3ea818(_0x580dfc,_0x53b384);},'EuyLB':function(_0x4fcfda,_0x46911c){return _0x4fcfda(_0x46911c);}},_0x1f2964=_0x5e0071[_0x5e5dae(0x40c,0x2f0)]();if(!_0x1f2964)return _0x1f2964;function _0x5e5dae(_0x3f2813,_0x529fb6){return _0x35d151(_0x3f2813,_0x529fb6- -_0x3df5fc._0x1ab2b4);}if(_0x26b01b[_0x5e5dae(_0xdafc86._0x575b90,0x212)](_0x1f2964,'~'))return resolve(_0xcdcfe7());if(_0x1f2964['startsWi'+'th']('~/'))return _0x26b01b[_0x29352a(_0xdafc86._0x2f2b9f,_0xdafc86._0x48b4ba)](resolve,_0x26b01b['cyqeR'](_0x4cb7e2,_0xcdcfe7(),_0x1f2964[_0x5e5dae(0x3e8,_0xdafc86._0x59650b)](0x2)));function _0x29352a(_0x16db31,_0x2b7bba){return _0x35d151(_0x16db31,_0x2b7bba-0x10b);}return _0x26b01b[_0x29352a(0x1ae,0x24c)](resolve,_0x1f2964);}async function loadBootstrapState(_0x40beb4){const _0x1ac634={_0x5b8744:0x19b,_0x3803a8:0x244,_0x539658:0x369,_0x1a261e:0x371},_0x533341={_0x41cdb0:0x20c},_0x385380={};_0x385380[_0x1941bc(0x111,0x404)]=function(_0x2e71c5,_0x382af7){return _0x2e71c5===_0x382af7;};const _0x248ae4=_0x385380,_0x65d6c4=await readJsonFile(_0x40beb4)??{};function _0x1941bc(_0x43ef36,_0x46dae1){return _0x341e52(_0x46dae1- -_0x533341._0x41cdb0,_0x43ef36);}function _0xd6866b(_0x44de8b,_0x16209c){return _0x341e52(_0x16209c- -0x24d,_0x44de8b);}const _0x376162=Date[_0xd6866b(-0xce,_0x1ac634._0x5b8744)]();for(const [_0x17d9ce,_0x2dab26]of Object['entries'](_0x65d6c4)){if(!_0x2dab26||typeof _0x2dab26!==_0xd6866b(_0x1ac634._0x3803a8,0x270)){delete _0x65d6c4[_0x17d9ce];continue;}typeof _0x2dab26['ts']!==_0xd6866b(0x1e2,_0x1ac634._0x539658)&&_0x248ae4['FdqzD'](typeof _0x2dab26[_0x1941bc(0x353,0x371)+'Ms'],'number')&&(_0x2dab26['ts']=_0x2dab26[_0x1941bc(0x4ca,_0x1ac634._0x1a261e)+'Ms']),_0x376162-_0x2dab26['ts']>DEVICE_BOOTSTRAP_TOKEN_TTL_MS&&delete _0x65d6c4[_0x17d9ce];}return _0x65d6c4;}async function readJsonFile(_0x119029){const _0x2982f4={_0x23a419:0x72a},_0x2c02ba={_0x5d48a1:0x32d},_0x34b9c7={'cCLJI':function(_0x467c8c,_0xe3e43e,_0x44b3c5){return _0x467c8c(_0xe3e43e,_0x44b3c5);}};function _0x1370d8(_0x40966d,_0x57ab64){return _0x35d151(_0x57ab64,_0x40966d-0xe);}function _0x51da4e(_0x3507b0,_0x128570){return _0x35d151(_0x128570,_0x3507b0-_0x2c02ba._0x5d48a1);}try{return JSON[_0x51da4e(0x94e,0x7c8)](await _0x34b9c7[_0x51da4e(0x5e6,0x825)](readFile,_0x119029,_0x51da4e(_0x2982f4._0x23a419,0x470)));}catch{return null;}}async function writeJsonAtomic(_0x579348,_0x37413f){const _0x5ba70b={_0x20e276:0x654,_0xd9beb4:0x5c2,_0x70cae8:0x8d3,_0x55bdd2:0x920,_0x2ea79e:0x464,_0x5b74b7:0x766,_0xc1551c:0x55a,_0x13d90a:0x738,_0x4ebff5:0x67a,_0x197ebd:0xa38,_0x2c4121:0x880},_0x487933={_0x5a1816:0xed},_0x264a2e={_0x46138a:0x1b6},_0x5b18d9={'PMfbD':function(_0x5dd717,_0x180a52){return _0x5dd717(_0x180a52);},'dxAay':function(_0x36f438,_0x65c68d,_0xc6184e){return _0x36f438(_0x65c68d,_0xc6184e);}};function _0x5d70a5(_0x45047b,_0x4e99ba){return _0x341e52(_0x4e99ba- -_0x264a2e._0x46138a,_0x45047b);}const _0xd7298f=JSON[_0x5d70a5(_0x5ba70b._0x20e276,_0x5ba70b._0xd9beb4)+'y'](_0x37413f,null,0x2),_0x473631={};_0x473631[_0x18100a(_0x5ba70b._0x70cae8,_0x5ba70b._0x55bdd2)+'e']=!![],_0x473631['mode']=0x1c0,await mkdir(_0x5b18d9['PMfbD'](_0x1d553f,_0x579348),_0x473631);function _0x18100a(_0x50f8ce,_0x521d96){return _0x341e52(_0x50f8ce-_0x487933._0x5a1816,_0x521d96);}const _0x56f3af=_0x579348+'.'+randomUUIDFragment()+'.tmp';try{const _0xac379d={};_0xac379d[_0x18100a(_0x5ba70b._0x2ea79e,0x21b)]=_0x18100a(_0x5ba70b._0x5b74b7,_0x5ba70b._0xc1551c),_0xac379d[_0x5d70a5(0x933,_0x5ba70b._0x13d90a)]=0x180,await writeFile(_0x56f3af,_0xd7298f,_0xac379d),await safeChmod(_0x56f3af,0x180),await rename(_0x56f3af,_0x579348),await _0x5b18d9[_0x18100a(0x84a,_0x5ba70b._0x4ebff5)](safeChmod,_0x579348,0x180);}finally{const _0x84630e={};_0x84630e[_0x18100a(_0x5ba70b._0x197ebd,0xa49)]=!![],await rm(_0x56f3af,_0x84630e)[_0x18100a(_0x5ba70b._0x2c4121,0x6a3)](()=>void 0x0);}}async function safeChmod(_0x3777ca,_0x456c37){try{await chmod(_0x3777ca,_0x456c37);}catch{}}function generatePairingToken(){const _0x24aa64={_0x424135:0x612,_0x3365f1:0x63e,_0x5bdc56:0x716,_0x365977:0x7eb,_0x39d76d:0x8c0},_0x7c5e2f={_0x1df55b:0xa3};function _0x2c097c(_0x3b495d,_0x1b646b){return _0x341e52(_0x3b495d-_0x7c5e2f._0x1df55b,_0x1b646b);}function _0x4f8ad3(_0x3d1aa0,_0x408297){return _0x341e52(_0x3d1aa0- -0x30c,_0x408297);}const _0x1a8314={'zDlxE':function(_0x3de96f,_0x4f2c6b){return _0x3de96f(_0x4f2c6b);}};return _0x1a8314[_0x4f8ad3(0x37d,_0x24aa64._0x424135)](randomBytes,PAIRING_TOKEN_BYTES)[_0x2c097c(_0x24aa64._0x3365f1,_0x24aa64._0x5bdc56)](_0x2c097c(_0x24aa64._0x365977,_0x24aa64._0x39d76d)+'l');}function normalizeStringArray(_0x3729b2){const _0x17869c={_0x5c57e5:0x1d4,_0x3a8b7a:0x442,_0xe9f154:0x960,_0x1b93f8:0x686,_0x1ca0ea:0x983},_0x3dcf8e={_0x5b7f36:0x83},_0x5748f1={};_0x5748f1['Jbevl']=_0x38329d(_0x17869c._0x5c57e5,_0x17869c._0x3a8b7a);const _0x3fc9f6=_0x5748f1,_0x402f7f=new Set();function _0x32423e(_0x44017f,_0x300492){return _0x341e52(_0x300492-_0x3dcf8e._0x5b7f36,_0x44017f);}for(const _0x276c7f of _0x3729b2){const _0x29d09a=typeof _0x276c7f===_0x3fc9f6[_0x38329d(0x32e,0x1cd)]?_0x276c7f[_0x32423e(_0x17869c._0xe9f154,_0x17869c._0x1b93f8)]():'';_0x29d09a&&_0x402f7f[_0x32423e(_0x17869c._0x1ca0ea,0x988)](_0x29d09a);}function _0x38329d(_0x5760c7,_0x3f1854){return _0x341e52(_0x5760c7- -0x206,_0x3f1854);}return[..._0x402f7f]['sort']();}function randomUUIDFragment(){const _0x53e02f={_0x3891b8:0x1fb},_0x2c3b2a={_0x38c127:0x187};function _0x12c5a4(_0x197ccd,_0x53ac9b){return _0x35d151(_0x197ccd,_0x53ac9b-_0x2c3b2a._0x38c127);}function _0x1af47e(_0xa392d5,_0x2867c6){return _0x35d151(_0xa392d5,_0x2867c6-_0x53e02f._0x3891b8);}return randomBytes(0xc)[_0x1af47e(0x35b,0x51a)](_0x12c5a4(0x8f1,0x705));}function createAsyncLock(){let _0x51503a=Promise['resolve']();return async function _0x22923c(_0x1875e3){const _0x533da3=_0x51503a;let _0x3247e6;_0x51503a=new Promise(_0x12b88b=>{_0x3247e6=_0x12b88b;}),await _0x533da3;try{return await _0x1875e3();}finally{_0x3247e6?.();}};}var CONTROL_PREFIX=_0x341e52(0x506,0x4da)+_0x35d151(-0xbd,0x17c)+'control_'+'_:';function parseControl(_0x3e6fca){const _0xf34d48={_0x38b6e3:0x3eb,_0x14dee5:0x15f,_0x15146c:0x161,_0x5cfc02:0x759,_0x587d2a:0x18,_0x293cea:0x192,_0x59f0b5:0x6b4,_0x1791b6:0xe1,_0x278e2b:0x5f1,_0x23bf8a:0x485,_0x540d90:0x48,_0x54c6d4:0x2ee,_0x5d3220:0xc9,_0x484aac:0x32f,_0x24797a:0x39a,_0x3a1696:0x693,_0x38804b:0x7e9},_0xf636c0={_0x2d3066:0x2b1},_0x4b6f71={_0x382b4e:0x11},_0x80f3dd={'wwqFU':_0x3d8021(_0xf34d48._0x38b6e3,_0xf34d48._0x14dee5),'OEtAV':'number','HESHp':function(_0x8876b0,_0x19595a){return _0x8876b0===_0x19595a;},'SQOFO':function(_0x9a8a3d,_0x59171b){return _0x9a8a3d(_0x59171b);}};function _0x3d8021(_0x242969,_0x2b2282){return _0x341e52(_0x242969-_0x4b6f71._0x382b4e,_0x2b2282);}if(!_0x3e6fca['startsWi'+'th'](CONTROL_PREFIX))return null;function _0x1d6ee6(_0x3efbed,_0x35af06){return _0x341e52(_0x35af06- -_0xf636c0._0x2d3066,_0x3efbed);}try{const _0x31d548=JSON['parse'](_0x3e6fca[_0x1d6ee6(0x2f,_0xf34d48._0x15146c)](CONTROL_PREFIX[_0x3d8021(0x87a,_0xf34d48._0x5cfc02)]));if(typeof _0x31d548[_0x1d6ee6(_0xf34d48._0x587d2a,_0xf34d48._0x293cea)]!==_0x80f3dd[_0x1d6ee6(0x706,_0xf34d48._0x59f0b5)]||!_0x31d548[_0x1d6ee6(0x3e7,0x192)][_0x3d8021(0x614,0x760)]())return null;const _0x192da7=isRecord(_0x31d548[_0x3d8021(0x3a3,0x5df)])?_0x31d548[_0x1d6ee6(0x9,_0xf34d48._0x1791b6)]:void 0x0,_0x560cd3=typeof _0x31d548[_0x3d8021(_0xf34d48._0x278e2b,0x65d)]===_0x80f3dd['OEtAV']&&Number[_0x1d6ee6(_0xf34d48._0x23bf8a,0x235)](_0x31d548['count'])?_0x31d548[_0x3d8021(0x5f1,0x469)]:_0x80f3dd[_0x1d6ee6(_0xf34d48._0x540d90,_0xf34d48._0x54c6d4)](typeof _0x192da7?.[_0x3d8021(0x5f1,0x2f8)],_0x1d6ee6(_0xf34d48._0x5d3220,0x305))&&Number['isFinite'](_0x192da7[_0x1d6ee6(0x47d,_0xf34d48._0x484aac)])?_0x192da7['count']:void 0x0;return{'event':_0x31d548[_0x3d8021(0x454,0x1f1)][_0x1d6ee6(_0xf34d48._0x24797a,0x352)](),'requestId':readOptionalString(_0x31d548[_0x3d8021(0x6cb,0x5cc)+'d']),'payload':_0x192da7,'sourceClientId':readOptionalString(_0x31d548[_0x3d8021(_0xf34d48._0x3a1696,0x931)+_0x3d8021(_0xf34d48._0x38804b,0x820)]),'targetClientId':_0x80f3dd[_0x1d6ee6(0x654,0x495)](readOptionalString,_0x31d548[_0x1d6ee6(0x396,0x391)+'ientId']),'count':_0x560cd3};}catch{return null;}}function parseConnectStartIdentity(_0x21ecfb){const _0x187c19={_0xf74f31:0x79c,_0xf991a5:0x618,_0xb24864:0x418,_0x2b222a:0x2e0,_0x5756b3:0x4e3,_0x1e11ec:0x18f,_0x4f2987:0x74c,_0x17ea9f:0xdd,_0x2d2374:0x91,_0xa4c481:0x7ce,_0x41d2bd:0x836,_0x1f8e4b:0x2ab,_0x4f7244:0x199,_0x4096ee:0x2e9,_0x1baef7:0x376,_0x2361e3:0x3ec,_0x3a29c7:0x5e1,_0x1e765e:0x5ec,_0x6b45fc:0x82d,_0x30c536:0x3f0,_0x4b8296:0x301,_0x49af99:0x76e,_0x86d208:0x61e},_0x334a84={_0x1356b9:0x13e},_0x36355b={'qNacY':function(_0x3cbf46,_0x581e61){return _0x3cbf46!==_0x581e61;},'CqivN':_0xfe3baf(_0x187c19._0xf74f31,0x834)+'start','TQZMA':function(_0x2d2a78,_0x4211b9,_0x5a8cd0,_0x2d3450,_0x4f8b6b){return _0x2d2a78(_0x4211b9,_0x5a8cd0,_0x2d3450,_0x4f8b6b);},'xxean':_0xfe3baf(0x7a1,_0x187c19._0xf991a5)+_0x3c451d(0x3a5,_0x187c19._0xb24864)};function _0xfe3baf(_0x496e77,_0x336cd2){return _0x35d151(_0x336cd2,_0x496e77-0x25a);}function _0x3c451d(_0x2eb178,_0x39e73e){return _0x35d151(_0x2eb178,_0x39e73e- -_0x334a84._0x1356b9);}try{const _0xb4c3da=JSON[_0x3c451d(_0x187c19._0x2b222a,_0x187c19._0x5756b3)](_0x21ecfb);if(_0x36355b[_0xfe3baf(0x43e,_0x187c19._0x1e11ec)](_0xb4c3da[_0xfe3baf(_0x187c19._0x4f2987,0x7a3)],'req'))return null;if(_0xb4c3da['method']!==_0x3c451d(-_0x187c19._0x17ea9f,_0x187c19._0x2d2374)&&_0xb4c3da[_0xfe3baf(_0x187c19._0xa4c481,_0x187c19._0x41d2bd)]!==_0x36355b[_0x3c451d(_0x187c19._0x1f8e4b,_0x187c19._0x4f7244)])return null;const _0x32936d=_0xb4c3da[_0x3c451d(_0x187c19._0x4096ee,0x27b)]??{},_0x345b02=typeof _0xb4c3da['id']===_0xfe3baf(0x3b8,_0x187c19._0x1baef7)&&_0xb4c3da['id'][_0x3c451d(_0x187c19._0x2361e3,0x249)]()?_0xb4c3da['id'][_0xfe3baf(_0x187c19._0x3a29c7,0x5f0)]():'req-'+Math[_0xfe3baf(_0x187c19._0x1e765e,_0x187c19._0x6b45fc)]()['toString'](0x24)[_0xfe3baf(_0x187c19._0x30c536,0x1e4)](0x2,0xc),_0x20f7cd=_0x36355b[_0x3c451d(_0x187c19._0x4b8296,0x3d7)](firstString,_0x32936d[_0xfe3baf(0x5e8,0x4fd)+'me'],_0x32936d['clientNa'+'me'],_0x32936d['deviceId'],_0x36355b[_0xfe3baf(_0x187c19._0x49af99,_0x187c19._0x86d208)]),_0x4c4b53={};return _0x4c4b53['id']=_0x345b02,_0x4c4b53[_0x3c451d(0x3df,0x1f1)]=_0x20f7cd,_0x4c4b53;}catch{return null;}}function isConnectHandshakeRequest(_0x4952cf){const _0x191fac={_0x368df0:0x28a,_0x40650c:0x29c,_0x443073:0x355,_0x3dc0b5:0x1b,_0x131221:0x25a,_0x50a96a:0x4f,_0x10a6c8:0x5a},_0xda488d={_0x249527:0x3c1},_0x1eb144={_0x3d0db7:0x469};function _0x3712e7(_0x4c9109,_0x1d155a){return _0x341e52(_0x1d155a- -_0x1eb144._0x3d0db7,_0x4c9109);}const _0x49fe37={};function _0x319442(_0x1ef1a1,_0x167dac){return _0x341e52(_0x1ef1a1- -_0xda488d._0x249527,_0x167dac);}_0x49fe37[_0x3712e7(_0x191fac._0x368df0,_0x191fac._0x40650c)]=function(_0x31238a,_0x3b362e){return _0x31238a===_0x3b362e;},_0x49fe37['oyILz']=_0x3712e7(0x11e,_0x191fac._0x443073)+_0x3712e7(_0x191fac._0x3dc0b5,0x1c6);const _0x377a38=_0x49fe37;try{const _0x87a7a0=JSON['parse'](_0x4952cf);return _0x377a38[_0x3712e7(_0x191fac._0x131221,_0x191fac._0x40650c)](_0x87a7a0[_0x3712e7(0x5,0x305)],_0x3712e7(_0x191fac._0x50a96a,-_0x191fac._0x10a6c8))&&(_0x87a7a0['method']===_0x3712e7(-0x200,-0x1e)||_0x87a7a0['method']===_0x377a38['oyILz']);}catch{return![];}}function parseConnectHandshakeMeta(_0x31712f){const _0x56f316={_0x22d322:0x400,_0x50af1c:0x4b2,_0xe673a1:0x423,_0x5eefb2:0x654,_0x103644:0x668,_0xcd1533:0x65f,_0x49f923:0x614,_0x39b937:0x473,_0x5c183b:0x2e7,_0x115dba:0x7a3,_0x398d93:0x6e8,_0x2b3e94:0x6eb,_0x124e19:0x646,_0x31f735:0x230,_0x42efb9:0x617,_0x424e5c:0x42e,_0x27fa67:0x572,_0x288f7f:0x40e},_0x40147d={_0x361a6f:0xd2},_0x12ece0={};_0x12ece0['Iqxcl']=_0x3735fb(_0x56f316._0x22d322,0x587),_0x12ece0['WlRxv']='string',_0x12ece0[_0x3735fb(_0x56f316._0x50af1c,0x485)]=function(_0x477290,_0x2ccbfb){return _0x477290===_0x2ccbfb;};const _0x5a0253=_0x12ece0;function _0x1f7c93(_0xb7704a,_0xd37995){return _0x35d151(_0xb7704a,_0xd37995-_0x40147d._0x361a6f);}function _0x3735fb(_0x2b8b72,_0xe7ac6c){return _0x35d151(_0xe7ac6c,_0x2b8b72-0x26d);}try{const _0x1c4b3e=JSON['parse'](_0x31712f);if(_0x1c4b3e[_0x1f7c93(_0x56f316._0xe673a1,0x5c4)]!==_0x5a0253[_0x1f7c93(_0x56f316._0x5eefb2,0x5d3)])return null;if(_0x1c4b3e[_0x1f7c93(0x8ca,0x646)]!==_0x3735fb(0x43c,_0x56f316._0x103644)&&_0x1c4b3e['method']!==_0x1f7c93(_0x56f316._0xcd1533,_0x56f316._0x49f923)+_0x3735fb(0x620,_0x56f316._0x39b937))return null;const _0x77dcec=_0x1c4b3e[_0x1f7c93(_0x56f316._0x5c183b,0x48b)]?.[_0x1f7c93(0x88a,_0x56f316._0x115dba)]?.[_0x3735fb(_0x56f316._0x398d93,_0x56f316._0x2b3e94)],_0x1230a9=_0x1c4b3e[_0x3735fb(0x626,0x59d)]?.[_0x1f7c93(0x689,0x385)];return{'id':typeof _0x1c4b3e['id']===_0x5a0253['WlRxv']&&_0x1c4b3e['id'][_0x3735fb(0x5f4,0x372)]()?_0x1c4b3e['id'][_0x3735fb(0x5f4,0x558)]():null,'method':_0x1c4b3e[_0x1f7c93(0x8ab,_0x56f316._0x124e19)],'noncePresent':typeof _0x77dcec===_0x1f7c93(0x2cd,0x230)&&_0x77dcec[_0x3735fb(0x85a,0x795)]>0x0,'nonceLength':_0x5a0253[_0x3735fb(0x4b2,0x2d8)](typeof _0x77dcec,_0x1f7c93(0x352,_0x56f316._0x31f735))?_0x77dcec[_0x1f7c93(0x67e,0x6bf)]:null,'authFields':_0x1230a9&&typeof _0x1230a9===_0x1f7c93(_0x56f316._0x42efb9,0x313)?Object[_0x3735fb(0x3a1,_0x56f316._0x424e5c)](_0x1230a9)[_0x3735fb(_0x56f316._0x27fa67,_0x56f316._0x288f7f)]():[]};}catch{return null;}}function parsePairingRequestFromError(_0x1deaf2,_0xba1969=Date[_0x35d151(0x312,0x16c)]()){const _0x2e616b={_0x183b32:0x2eb,_0xacabe4:0xa,_0x1a820e:0x798,_0x39a357:0x44b,_0x3a38ec:0x464,_0x315259:0x4c1,_0x424ddb:0x37a,_0x300d44:0x690,_0x40f528:0x2a7,_0x3a479a:0x29f,_0x391113:0x100,_0xb9402e:0x2a6,_0x1e71f9:0x189,_0xfe4b3:0x5e7,_0x102eb8:0x302,_0x361e58:0x1c1,_0x1395d0:0x3ec,_0x596a42:0xe7,_0x5184d9:0x5ae,_0x109abf:0x636,_0x681cb7:0x481,_0x47bc89:0x4c1,_0x195485:0x23e,_0x306554:0x3b8,_0x2847d1:0x238,_0x4450a5:0x4c1,_0x2c07c8:0x2ab,_0x2c5f87:0x430,_0x2253db:0x875,_0x18290a:0x50f,_0x530ba4:0x24c,_0x4c07d8:0x4a4,_0x37addf:0x27c,_0x47c989:0x5c2,_0x29d838:0x47a,_0x2097f4:0x74c},_0x5a09e6={'DPAhf':function(_0x8826ba,_0x36d8cc){return _0x8826ba===_0x36d8cc;},'ncBOH':_0xde0815(_0x2e616b._0x183b32,_0x2e616b._0xacabe4),'XGAbk':'PAIRING_'+_0xde0815(0x565,_0x2e616b._0x1a820e),'PapYu':function(_0x21b44f,_0x5aa2ff){return _0x21b44f(_0x5aa2ff);},'vcWKI':function(_0x50a192,_0x258664){return _0x50a192(_0x258664);}};function _0x2ac7a9(_0x3292c0,_0x8f8576){return _0x35d151(_0x3292c0,_0x8f8576- -0x8e);}function _0xde0815(_0x216bf2,_0x44e1cc){return _0x35d151(_0x44e1cc,_0x216bf2-0x18d);}try{const _0x57544e=JSON[_0xde0815(0x7ae,0x58f)](_0x1deaf2);if(_0x57544e[_0x2ac7a9(_0x2e616b._0x39a357,_0x2e616b._0x3a38ec)]!==_0xde0815(0x355,0x123)||_0x57544e['ok']!==![]||!_0x57544e[_0xde0815(_0x2e616b._0x315259,_0x2e616b._0x424ddb)])return null;const _0x8f7e12=_0x5a09e6[_0xde0815(0x619,_0x2e616b._0x300d44)](typeof _0x57544e[_0xde0815(0x4c1,_0x2e616b._0x40f528)][_0xde0815(_0x2e616b._0x3a479a,0x53d)],_0x5a09e6[_0x2ac7a9(_0x2e616b._0x391113,0x35a)])?_0x57544e[_0x2ac7a9(0x525,_0x2e616b._0xb9402e)]['code']:'',_0x350ab5=typeof _0x57544e['error'][_0x2ac7a9(-_0x2e616b._0x1e71f9,0x10b)]===_0xde0815(_0x2e616b._0x183b32,_0x2e616b._0xfe4b3)?_0x57544e[_0xde0815(0x4c1,0x63b)][_0x2ac7a9(-0x1e4,0x10b)]:'';if(!_0x8f7e12[_0x2ac7a9(0x8,0xe7)]('NOT_PAIR'+'ED')&&!_0x8f7e12[_0xde0815(_0x2e616b._0x102eb8,0x5ad)](_0x5a09e6[_0x2ac7a9(_0x2e616b._0x361e58,_0x2e616b._0x1395d0)])&&!_0x350ab5[_0x2ac7a9(0x2f4,_0x2e616b._0x596a42)](_0xde0815(0x3bc,_0x2e616b._0x5184d9)+'ED')&&!_0x350ab5[_0xde0815(_0x2e616b._0x102eb8,0x508)](_0xde0815(0x78a,0x93c)+_0x2ac7a9(_0x2e616b._0x109abf,_0x2e616b._0x681cb7)))return null;const _0x1e530f=_0x57544e[_0xde0815(_0x2e616b._0x47bc89,_0x2e616b._0x195485)][_0x2ac7a9(_0x2e616b._0x306554,_0x2e616b._0x2847d1)]??_0x57544e[_0xde0815(_0x2e616b._0x4450a5,_0x2e616b._0x2c07c8)]['data']??{},_0x17adb1=firstString(_0x1e530f['requestI'+'d'],extractRequestIdFromMessage(_0x350ab5),_0xde0815(0x875,0x799));return{'requestId':_0x17adb1,'deviceId':firstString(_0x1e530f[_0x2ac7a9(0x609,0x5bf)],''),'displayName':firstNullableString(_0x1e530f['displayN'+_0x2ac7a9(0x2d3,_0x2e616b._0x2c5f87)]),'platform':_0x5a09e6[_0xde0815(0x53a,0x830)](firstNullableString,_0x1e530f[_0x2ac7a9(_0x2e616b._0x2253db,0x5e9)]),'deviceFamily':firstNullableString(_0x1e530f[_0xde0815(_0x2e616b._0x18290a,0x382)+_0x2ac7a9(_0x2e616b._0x530ba4,0x1c5)]),'role':_0x5a09e6[_0xde0815(_0x2e616b._0x4c07d8,_0x2e616b._0x37addf)](firstNullableString,_0x1e530f[_0xde0815(_0x2e616b._0x47c989,0x445)]),'remoteIp':firstNullableString(_0x1e530f[_0xde0815(_0x2e616b._0x29d838,_0x2e616b._0x2097f4)]),'receivedAtMs':_0xba1969,'status':'pending'};}catch{return null;}}function parsePairResolvedEvent(_0x2157c6){const _0x3117c8={_0x3c9ea5:0x3cf,_0x5bd4a6:0x7d,_0x374c4d:0x46,_0x1470b2:0x4f3,_0x564b41:0x296,_0x50b2e9:0xa6,_0x1f0724:0x267,_0xd4cbb6:0x1e5,_0x290bfb:0x4ac,_0x2e7f83:0x46c,_0x212d5a:0x36e,_0x1daca0:0x50d,_0x3a3bce:0x456,_0x4f45cf:0x311,_0x4e5f36:0x1e5,_0x1cc85f:0x72c,_0x570d68:0x7d3,_0x5a4bbd:0xe,_0x4bfff7:0x2ba,_0xc45f76:0x8a5,_0x66c0f7:0x5d5,_0x26b7cb:0x474,_0x31eb37:0x150,_0x2635f1:0x66c},_0x5cf6ef={_0xcb0e16:0x2ee},_0x3221a5={_0xf5d9d9:0xcf},_0x120e21={};function _0x25661c(_0x5ea9c7,_0x31ff51){return _0x35d151(_0x5ea9c7,_0x31ff51-_0x3221a5._0xf5d9d9);}_0x120e21[_0x25661c(0x6af,0x624)]=_0x25661c(0x5ca,_0x3117c8._0x3c9ea5)+'air.reso'+_0x12c3d2(_0x3117c8._0x5bd4a6,0x296),_0x120e21[_0x12c3d2(-0x1c7,_0x3117c8._0x374c4d)]=_0x25661c(_0x3117c8._0x1470b2,0x22d);function _0x12c3d2(_0x4b1302,_0x19d015){return _0x35d151(_0x19d015,_0x4b1302- -_0x5cf6ef._0xcb0e16);}_0x120e21[_0x12c3d2(-0x103,0xbf)]=_0x12c3d2(0x3fa,0x6b7);const _0x3c58c2=_0x120e21;try{const _0x1c237d=JSON[_0x12c3d2(0x333,0x516)](_0x2157c6);if(_0x1c237d[_0x12c3d2(0x204,0x4)]!==_0x25661c(0x18e,_0x3117c8._0x564b41)||_0x1c237d[_0x25661c(_0x3117c8._0x50b2e9,0x296)]!==_0x3c58c2[_0x12c3d2(_0x3117c8._0x1f0724,-0x75)]||!_0x1c237d[_0x25661c(0x289,_0x3117c8._0xd4cbb6)])return null;const _0x4323f0=typeof _0x1c237d[_0x12c3d2(-0x1d8,-0x397)][_0x25661c(_0x3117c8._0x290bfb,0x50d)+'d']===_0x3c58c2['ANHpP']?_0x1c237d[_0x25661c(_0x3117c8._0x2e7f83,_0x3117c8._0xd4cbb6)][_0x25661c(_0x3117c8._0x212d5a,_0x3117c8._0x1daca0)+'d'][_0x25661c(0x697,_0x3117c8._0x3a3bce)]():'';if(!_0x4323f0)return null;const _0x1da068=typeof _0x1c237d[_0x25661c(_0x3117c8._0x4f45cf,_0x3117c8._0x4e5f36)][_0x25661c(_0x3117c8._0x1cc85f,0x7a8)]==='string'?_0x1c237d[_0x25661c(0xc3,_0x3117c8._0xd4cbb6)][_0x25661c(_0x3117c8._0x570d68,0x7a8)]:_0x3c58c2[_0x25661c(-_0x3117c8._0x5a4bbd,_0x3117c8._0x4bfff7)],_0x13e6a0=_0x1da068==='approved'||_0x1da068===_0x25661c(_0x3117c8._0xc45f76,_0x3117c8._0x66c0f7)?_0x1da068:_0x12c3d2(0x3fa,_0x3117c8._0x26b7cb),_0x253b86={};return _0x253b86[_0x12c3d2(_0x3117c8._0x31eb37,0x2b0)+'d']=_0x4323f0,_0x253b86[_0x12c3d2(0x3eb,_0x3117c8._0x2635f1)]=_0x13e6a0,_0x253b86;}catch{return null;}}function parseResponseEnvelopeMeta(_0xe13e30){const _0x113e46={_0x4fea80:0xa9,_0x228ab8:0x5ba,_0x8235f1:0x83f,_0x2b4bcd:0x710,_0x494b13:0x648,_0x445829:0x402,_0x1e21bf:0x320,_0x332cd1:0x62b,_0x479785:0x552,_0x3be634:0x10c,_0x3b01df:0x375,_0x58cc2e:0x402,_0x2504d4:0x5d8,_0x2ccd64:0x467,_0x4cb118:0x62b,_0x3441dc:0x299,_0x987d67:0x614,_0x49a1c7:0x37c,_0x39ba8b:0x43d,_0x272541:0x5a5,_0x2e54d3:0x552,_0x52c4d4:0x4f5,_0x5a2c18:0x57c},_0x463b25={_0x3d32c4:0x2a4},_0x328748={_0x4e83b3:0x21e},_0x4996b7={};_0x4996b7[_0x58422f(_0x113e46._0x4fea80,0x39e)]=function(_0x1dbceb,_0x3de90a){return _0x1dbceb!==_0x3de90a;};function _0x18732d(_0x3a1320,_0x4bcc2d){return _0x35d151(_0x4bcc2d,_0x3a1320-_0x328748._0x4e83b3);}_0x4996b7[_0x18732d(0x3f0,_0x113e46._0x228ab8)]=_0x18732d(0x3e6,0xdf);const _0xec5ada=_0x4996b7;function _0x58422f(_0xb6c140,_0x1b78af){return _0x35d151(_0xb6c140,_0x1b78af-_0x463b25._0x3d32c4);}try{const _0x373ce8=JSON[_0x18732d(_0x113e46._0x8235f1,0x5c5)](_0xe13e30);if(_0xec5ada['NdgKD'](_0x373ce8[_0x18732d(_0x113e46._0x2b4bcd,0x7f0)],_0xec5ada[_0x18732d(0x3f0,_0x113e46._0x494b13)]))return null;if(_0xec5ada['NdgKD'](typeof _0x373ce8['id'],_0x58422f(0x67e,_0x113e46._0x445829))||!_0x373ce8['id'][_0x58422f(_0x113e46._0x1e21bf,_0x113e46._0x332cd1)]())return null;return{'id':_0x373ce8['id']['trim'](),'ok':_0x373ce8['ok']===!![],'errorCode':typeof _0x373ce8[_0x18732d(_0x113e46._0x479785,0x651)]?.[_0x18732d(0x330,_0x113e46._0x3be634)]===_0x58422f(_0x113e46._0x3b01df,_0x113e46._0x58cc2e)&&_0x373ce8['error']['code']['trim']()?_0x373ce8[_0x58422f(0x493,_0x113e46._0x2504d4)][_0x58422f(_0x113e46._0x2ccd64,0x3b6)][_0x58422f(0x44a,_0x113e46._0x4cb118)]():null,'errorMessage':typeof _0x373ce8[_0x18732d(_0x113e46._0x479785,_0x113e46._0x3441dc)]?.[_0x18732d(0x3b7,_0x113e46._0x987d67)]===_0x18732d(_0x113e46._0x49a1c7,0x24d)&&_0x373ce8[_0x58422f(0x84e,_0x113e46._0x2504d4)][_0x58422f(0x56b,_0x113e46._0x39ba8b)][_0x18732d(_0x113e46._0x272541,0x458)]()?_0x373ce8[_0x18732d(_0x113e46._0x2e54d3,_0x113e46._0x52c4d4)][_0x18732d(0x3b7,0x227)][_0x58422f(_0x113e46._0x5a2c18,_0x113e46._0x4cb118)]():null};}catch{return null;}}function firstString(..._0x17fc9e){const _0x5a516b={_0xe7945e:0x80b,_0x1ce107:0x3b6},_0x2c855c={_0x335a18:0x9b},_0x3b776c={_0x3764ca:0x18f},_0x525727={};_0x525727[_0x3651ce(_0x5a516b._0xe7945e,0x534)]=_0x3651ce(_0x5a516b._0x1ce107,0x2ed);function _0x3651ce(_0xaa29b1,_0x577703){return _0x35d151(_0xaa29b1,_0x577703-_0x3b776c._0x3764ca);}const _0x42cb89=_0x525727;function _0x48a23d(_0x4d69d2,_0x5591d9){return _0x35d151(_0x5591d9,_0x4d69d2-_0x2c855c._0x335a18);}for(const _0x2211b6 of _0x17fc9e){if(typeof _0x2211b6===_0x42cb89[_0x48a23d(0x440,0x22f)]&&_0x2211b6[_0x3651ce(0x386,0x516)]())return _0x2211b6['trim']();}return'';}function firstNullableString(_0x240ca7){const _0x124ce8={_0x278992:0x189,_0x403fa7:0x69d,_0xcdbc8b:0x634,_0x565048:0x4f8},_0x354363={};_0x354363['aPZkQ']=_0x3bb402(-0x92,_0x124ce8._0x278992);function _0x511b51(_0x35db64,_0x163171){return _0x35d151(_0x35db64,_0x163171-0x350);}const _0x207bbd=_0x354363;function _0x3bb402(_0x2358d4,_0x32d5e1){return _0x35d151(_0x2358d4,_0x32d5e1-0x2b);}return typeof _0x240ca7===_0x207bbd[_0x3bb402(_0x124ce8._0x403fa7,_0x124ce8._0xcdbc8b)]&&_0x240ca7[_0x511b51(0x45e,0x6d7)]()?_0x240ca7[_0x3bb402(_0x124ce8._0x565048,0x3b2)]():null;}function readOptionalString(_0x413aa5){const _0x497d52={_0x117427:0x5b7,_0x22bfe4:0x6db,_0x5e1d26:0x5e5},_0xa79626={_0x47dff6:0x25e};function _0x59b6e4(_0x1ce695,_0x1e5ff6){return _0x35d151(_0x1ce695,_0x1e5ff6-0x230);}function _0x1e208b(_0x5b1e7d,_0x45a059){return _0x35d151(_0x5b1e7d,_0x45a059-_0xa79626._0x47dff6);}return typeof _0x413aa5===_0x59b6e4(0xa9,0x38e)&&_0x413aa5[_0x59b6e4(0x694,_0x497d52._0x117427)]()?_0x413aa5[_0x1e208b(_0x497d52._0x22bfe4,_0x497d52._0x5e1d26)]():void 0x0;}function isRecord(_0x8dce88){const _0x877ce={_0x6fc225:0x80a,_0x3a4858:0x2ad,_0x916937:0x1a1};function _0x52cb6d(_0x31b134,_0x57c2e1){return _0x35d151(_0x31b134,_0x57c2e1- -0x39);}const _0x4e3ebf={};function _0x4506e0(_0x386b3c,_0xc9c7b){return _0x35d151(_0x386b3c,_0xc9c7b-0x3a9);}_0x4e3ebf[_0x52cb6d(0x601,0x4e7)]=_0x4506e0(_0x877ce._0x6fc225,0x5ea);const _0x1e93e0=_0x4e3ebf;return typeof _0x8dce88===_0x1e93e0['daMMR']&&_0x8dce88!=null&&!Array[_0x52cb6d(_0x877ce._0x3a4858,_0x877ce._0x916937)](_0x8dce88);}function extractRequestIdFromMessage(_0x640772){const _0x5f15c7=_0x640772['match'](/requestId[:\s]*([a-f0-9-]+)/i);return _0x5f15c7?.[0x1]??null;}import{randomUUID as _0x579fc8}from'crypto';import{setTimeout as _0x5f15a5}from'timers/promises';import _0x42d174 from'ws';var HEARTBEAT_INTERVAL_MS=0x2710,HEARTBEAT_TIMEOUT_MS=0x88b8,GATEWAY_RETRY_DELAY_MS=0x4b0,RECONNECT_BASE_DELAY_MS=0x3e8,RECONNECT_MAX_DELAY_MS=0x3a98,CONNECT_HANDSHAKE_WARN_DELAY_MS=0x1f40,MAX_PENDING_GATEWAY_MESSAGES=0x100,MAX_DEVICE_DETAILS=0x20,MAX_PENDING_PAIR_REQUESTS=0x10,BridgeRuntime=class{[_0x35d151(0x5a5,0x3f1)];[_0x341e52(0x873,0x766)+_0x35d151(0x214,0x3a8)]=null;['gatewayS'+_0x341e52(0x3e7,0x4ab)]=null;[_0x341e52(0x3f4,0x4e7)+_0x341e52(0x773,0x7a0)]=![];[_0x341e52(0x741,0x4de)+'onnectin'+'g']=![];[_0x341e52(0x85b,0x9ec)]=!![];['relayAtt'+_0x341e52(0x3b6,0x6ae)]=0x0;[_0x35d151(0x7c6,0x5a5)+_0x341e52(0x7aa,0xa3f)+'yMs']=0x0;[_0x35d151(0x1c5,0x31b)+_0x35d151(-0x16,0x210)]=null;[_0x341e52(0x7dd,0x774)+'etryTime'+'r']=null;[_0x341e52(0x71f,0x637)+_0x35d151(0x138,0x210)]=null;[_0x35d151(0x45f,0x6cc)+_0x341e52(0x604,0x4d9)+_0x35d151(0x45a,0x4f5)]=[];[_0x35d151(0x491,0x194)+'andshake'+_0x35d151(0xc3,0x192)]=![];[_0x35d151(0x6aa,0x4c5)+_0x35d151(0x54a,0x326)+_0x341e52(0x5fc,0x3d5)+_0x35d151(0x682,0x4cf)]=![];[_0x35d151(0x4f0,0x4a7)+'mandStar'+'tedAtMs']=null;[_0x341e52(0x741,0x98c)+_0x341e52(0x7b1,0x59f)+'AtMs']=null;[_0x35d151(0x464,0x2eb)+'ConnectH'+'andshake'+'s']=new Map();[_0x35d151(0x4e1,0x509)];constructor(_0x33cb81){const _0x35b058={_0x416ed4:0x46e,_0x31de16:0x614,_0x466005:0x1b8,_0x55ed4e:0x382,_0x25a0ed:0x405},_0x255edf={_0x12b900:0x337},_0x116393={_0x2d81fc:0x198};function _0x414ca8(_0x399c6f,_0x33bef5){return _0x341e52(_0x33bef5- -_0x116393._0x2d81fc,_0x399c6f);}function _0x22d325(_0x15e532,_0x42b767){return _0x341e52(_0x15e532- -_0x255edf._0x12b900,_0x42b767);}this['options']=_0x33cb81,this[_0x414ca8(0x6ab,0x5ed)]={'running':![],'relayConnected':![],'gatewayConnected':![],'gatewayId':_0x33cb81['config'][_0x22d325(_0x35b058._0x416ed4,_0x35b058._0x31de16)+'d'],'instanceId':_0x33cb81[_0x22d325(0x1e3,-0x6a)][_0x22d325(0x4ae,0x68b)+'Id'],'relayUrl':_0x33cb81[_0x414ca8(_0x35b058._0x466005,_0x35b058._0x55ed4e)][_0x414ca8(0x5e8,_0x35b058._0x25a0ed)],'gatewayUrl':_0x33cb81[_0x22d325(0x609,0x8c1)+'rl'],'clientCount':0x0,'connectedDevices':[],'pendingPairRequests':[],'lastError':null,'lastUpdatedMs':Date['now']()};}['start'](){const _0x5af7e1={_0x28ff33:0x9e0,_0x3f2623:0x2b0,_0x2a092f:0x50b,_0x5f5b26:0x581,_0xdb6bf7:0x1d6,_0x1b2a0a:0x306,_0x336cb7:0xc2,_0x20ca97:0xf5,_0x435524:0x395,_0x429656:0x12c,_0x3b0212:0xee,_0x550213:0x34e,_0x5eccd9:0x4b0,_0x4ab76f:0x3a1,_0x27b785:0xa,_0xe40462:0x52a,_0x2f2025:0x4e1,_0xf2e1e1:0x587},_0x54c995={_0x8745fb:0x2bc};if(!this[_0x1775f1(_0x5af7e1._0x28ff33,0x89b)])return;this[_0x487a35(_0x5af7e1._0x3f2623,_0x5af7e1._0x2a092f)]=![];function _0x1775f1(_0x9a5c0,_0x589475){return _0x35d151(_0x9a5c0,_0x589475-_0x54c995._0x8745fb);}function _0x487a35(_0x2210d7,_0x5f1a05){return _0x35d151(_0x5f1a05,_0x2210d7- -0x32f);}this[_0x1775f1(_0x5af7e1._0x5f5b26,0x5b0)+_0x487a35(_0x5af7e1._0xdb6bf7,_0x5af7e1._0x1b2a0a)]({'running':!![],'gatewayUrl':this[_0x487a35(_0x5af7e1._0x336cb7,-_0x5af7e1._0x20ca97)][_0x487a35(_0x5af7e1._0x435524,0x278)+'rl']}),this[_0x487a35(_0x5af7e1._0x429656,_0x5af7e1._0x3b0212)](_0x487a35(0x7f,_0x5af7e1._0x550213)+_0x1775f1(0x3ef,_0x5af7e1._0x5eccd9)+_0x1775f1(_0x5af7e1._0x4ab76f,0x415)+_0x1775f1(0x145,0x41d)+this['options'][_0x1775f1(0x423,0x55a)][_0x487a35(0x1fa,_0x5af7e1._0x27b785)+'d']+('\x20gateway'+_0x1775f1(0x33b,_0x5af7e1._0xe40462))+this[_0x1775f1(0x760,0x6ad)][_0x487a35(_0x5af7e1._0x435524,_0x5af7e1._0x2f2025)+'rl']),void this[_0x1775f1(0xbce,0x8c3)+_0x1775f1(_0x5af7e1._0xf2e1e1,0x446)]();}async[_0x35d151(0x1fe,0x18c)](){const _0x1c9867={_0x3d9361:0x350,_0xb23c8d:0x351,_0x305f1c:0x3ee,_0x5b37a4:0x299,_0x2faa05:0x4da,_0x1dfdb2:0xd9,_0x55cbbe:0x5d8,_0x36cabc:0x48c,_0x839746:0x12,_0x2ee43f:0x3b0,_0x1cfd2d:0xef,_0x52d880:0xfd,_0x3c7bcc:0x304,_0x50ee34:0x236,_0x1b2a50:0x240,_0x12322a:0x218,_0x5ed659:0x2f4,_0x39676c:0x2a6,_0xa7406a:0x196,_0x3d34a9:0x5c,_0x136d7c:0x360,_0x54f4db:0x1d,_0x25d89a:0x12f,_0x2e00d8:0x252,_0x571d02:0x23e,_0x52406b:0x3e,_0x682945:0x69,_0x21bfbc:0x6a,_0x573cf3:0x162,_0x3f1224:0x1fd,_0x490f18:0x18,_0x35c752:0x1cc,_0x55b9bc:0x29f,_0x5b7331:0x295,_0x3bb731:0x27c},_0x48df1e={_0x424ea8:0x50b},_0x707be1={'njCCq':function(_0x41dcd9,_0x5eacc3){return _0x41dcd9(_0x5eacc3);}};if(this['stopped'])return;this[_0x5de1f8(0x651,_0x1c9867._0x3d9361)]=!![],this[_0x5de1f8(0x634,_0x1c9867._0xb23c8d)+_0x17d2cd(0x1be,0x257)](),this[_0x5de1f8(_0x1c9867._0x305f1c,0x368)+_0x17d2cd(_0x1c9867._0x5b37a4,0x4db)]?.[_0x17d2cd(_0x1c9867._0x2faa05,0x345)]();function _0x5de1f8(_0x228444,_0x1ee153){return _0x341e52(_0x1ee153- -_0x48df1e._0x424ea8,_0x228444);}this[_0x17d2cd(0x16e,0x45a)+_0x5de1f8(_0x1c9867._0x1dfdb2,-0x124)]?.[_0x17d2cd(0x4da,_0x1c9867._0x55cbbe)](),this[_0x17d2cd(0x4e8,0x398)+_0x17d2cd(0x299,_0x1c9867._0x36cabc)]=null,this[_0x5de1f8(-0x279,-_0x1c9867._0x839746)+'ocket']=null,this['pendingG'+_0x17d2cd(0x279,_0x1c9867._0x2ee43f)+'ssages']=[],this[_0x17d2cd(0x85,_0x1c9867._0x1cfd2d)+_0x5de1f8(0x133,0x24b)+_0x5de1f8(-0x3f5,-_0x1c9867._0x52d880)]=![],this[_0x5de1f8(_0x1c9867._0x3c7bcc,_0x1c9867._0x50ee34)+'loseBoun'+_0x5de1f8(0x3b8,0xf1)+_0x5de1f8(0x429,_0x1c9867._0x1b2a50)]=![],this[_0x5de1f8(-0x95,_0x1c9867._0x12322a)+_0x5de1f8(0x4f2,0x2b0)+_0x17d2cd(0x474,0x623)]=null,this[_0x5de1f8(_0x1c9867._0x5ed659,0x236)+_0x5de1f8(0x38,_0x1c9867._0x39676c)+'AtMs']=null;function _0x17d2cd(_0x16ac20,_0x45731c){return _0x341e52(_0x16ac20- -0x38b,_0x45731c);}this[_0x5de1f8(_0x1c9867._0xa7406a,_0x1c9867._0x3d34a9)+'ConnectH'+'andshake'+'s'][_0x17d2cd(0x38d,_0x1c9867._0x136d7c)](),this[_0x5de1f8(-_0x1c9867._0x54f4db,-0x117)+_0x5de1f8(_0x1c9867._0x25d89a,0x268)]=![],this['gatewayC'+_0x5de1f8(_0x1c9867._0x2e00d8,_0x1c9867._0x571d02)+'g']=![];const _0x3dbf01={};_0x3dbf01[_0x5de1f8(-0x1a2,-_0x1c9867._0x52406b)]=![],_0x3dbf01[_0x17d2cd(_0x1c9867._0x682945,-_0x1c9867._0x21bfbc)+'nected']=![],_0x3dbf01[_0x5de1f8(0xde,0x236)+_0x17d2cd(0x426,_0x1c9867._0x573cf3)]=![],_0x3dbf01['clientCo'+_0x5de1f8(-_0x1c9867._0x3f1224,-0xa2)]=0x0,_0x3dbf01['lastErro'+'r']=null,this['updateSn'+_0x5de1f8(0x515,0x276)](_0x3dbf01),this[_0x5de1f8(-_0x1c9867._0x490f18,_0x1c9867._0x35c752)](_0x17d2cd(_0x1c9867._0x55b9bc,_0x1c9867._0x5b7331)+'stopped'),await _0x707be1[_0x17d2cd(0x4ef,_0x1c9867._0x3bb731)](_0x5f15a5,0x19);}async[_0x35d151(0x15c,0x292)+_0x341e52(0x780,0x587)+'st'](_0x3d19d3){const _0x149a31={_0x17fd34:0x432,_0x287cbc:0x32f,_0x2ec81c:0x315,_0x33db1b:0x3ed,_0x2238f8:0x79,_0x1a2040:0x778,_0x3d122b:0x2da,_0x32f889:0x351,_0x1da0be:0x7da,_0x4e551a:0x49a,_0x4ce481:0x230,_0x318f76:0x334},_0x50cc8f={_0x306bf7:0xca},_0x2c008c={};_0x2c008c[_0x3d2cdb(_0x149a31._0x17fd34,0x1b7)+'d']=_0x3d19d3;function _0x4591c8(_0x4b8744,_0x197c3c){return _0x341e52(_0x4b8744- -_0x50cc8f._0x306bf7,_0x197c3c);}this[_0x3d2cdb(_0x149a31._0x287cbc,_0x149a31._0x2ec81c)+_0x3d2cdb(_0x149a31._0x33db1b,0x3c2)+'st'](_0x3d2cdb(0x193,_0x149a31._0x2238f8)+_0x4591c8(0x630,_0x149a31._0x1a2040)+_0x4591c8(_0x149a31._0x3d122b,_0x149a31._0x32f889),_0x2c008c);function _0x3d2cdb(_0xb7f22b,_0x306c87){return _0x341e52(_0x306c87- -0x503,_0xb7f22b);}this['markPair'+_0x4591c8(_0x149a31._0x1da0be,0x63b)+_0x4591c8(_0x149a31._0x4e551a,_0x149a31._0x4ce481)](_0x3d19d3,_0x4591c8(_0x149a31._0x318f76,0x350));}async[_0x341e52(0x437,0x1e8)+_0x341e52(0x4fa,0x41f)+'t'](_0x4d581c){const _0x20c930={_0x4f1f02:0x320,_0x1f615d:0x6e7,_0xf5006c:0x47c,_0x51899c:0x1ed,_0x37e453:0x434,_0x5862b6:0x462,_0x35c009:0x50a},_0x535a95={_0x16f03b:0x39c},_0x3e5c17={_0x59388c:0x39a};function _0xd78a31(_0x55c708,_0x1cd53e){return _0x341e52(_0x1cd53e- -_0x3e5c17._0x59388c,_0x55c708);}const _0x3d8d78={};_0x3d8d78[_0xd78a31(0x3e7,_0x20c930._0x4f1f02)+'d']=_0x4d581c;function _0x3c7e1b(_0x43c7e3,_0x39a51f){return _0x341e52(_0x39a51f- -_0x535a95._0x16f03b,_0x43c7e3);}this[_0x3c7e1b(_0x20c930._0x1f615d,_0x20c930._0xf5006c)+'wayReque'+'st'](_0x3c7e1b(_0x20c930._0x51899c,0x1e0)+_0x3c7e1b(0x295,_0x20c930._0x37e453)+'ct',_0x3d8d78),this['markPair'+_0xd78a31(_0x20c930._0x5862b6,_0x20c930._0x35c009)+_0xd78a31(0x271,0x1ca)](_0x4d581c,'rejected');}['getSnaps'+'hot'](){const _0x297a15={_0x30d610:0x7ed,_0x3105d5:0x80d,_0x1a8c31:0x592,_0x2d40d3:0x76f,_0x4e9a94:0xaa0,_0x2f41a4:0x7fd,_0x4ab9dd:0xb0a,_0x11c749:0x751,_0x42fb86:0x500,_0x2e29d4:0xa26,_0x4331dc:0x808},_0x199b48={_0x3e36f9:0x304};function _0xeed9c0(_0x3c462d,_0x3e8ab1){return _0x35d151(_0x3e8ab1,_0x3c462d-0x44a);}const _0x5c197d={...this[_0x59bcd3(_0x297a15._0x30d610,_0x297a15._0x3105d5)]};_0x5c197d['connecte'+'dDevices']=[...this[_0x59bcd3(0xa35,0x80d)][_0x59bcd3(_0x297a15._0x1a8c31,_0x297a15._0x2d40d3)+'dDevices']];function _0x59bcd3(_0x5aa854,_0xb1f006){return _0x35d151(_0x5aa854,_0xb1f006-_0x199b48._0x3e36f9);}return _0x5c197d[_0x59bcd3(_0x297a15._0x4e9a94,_0x297a15._0x2f41a4)+_0x59bcd3(_0x297a15._0x4ab9dd,0x808)+_0xeed9c0(_0x297a15._0x11c749,_0x297a15._0x42fb86)]=[...this['snapshot'][_0xeed9c0(0x943,_0x297a15._0x2e29d4)+_0x59bcd3(0x8c3,_0x297a15._0x4331dc)+'sts']],_0x5c197d;}async[_0x341e52(0x883,0x76e)+'elay'](){const _0x2637a={_0x4b9de6:0x5b4,_0x2fdd5e:0x8b4,_0x38e289:0xdd,_0x20b501:0x2b2,_0x12f26d:0x27e,_0x17a5f4:0x2a2,_0x592c24:0x927,_0x2590e9:0x203,_0x580c5d:0x4e8,_0x9de169:0x516,_0x2a294b:0x95e,_0x4f58ff:0x9a7,_0x99d6c:0x55c,_0x527735:0x6d3,_0x53966e:0x9f9,_0x514dbf:0xfe,_0x13fcaf:0xb4,_0x3c5a3e:0x633,_0x5689a8:0x48f,_0x2fe156:0x3c6},_0x44830d={_0x4c937c:0x5b4,_0x47a11e:0x79c,_0x17ae5d:0x147,_0x4b993d:0x2e9,_0xf74971:0x5a3,_0x138d93:0x248,_0x24c308:0xe1,_0x13d7b7:0x2a9,_0x3a2b03:0x28,_0x52abb7:0x286,_0x47cfb4:0x505,_0x81702c:0x43b,_0x2641f2:0x5b5,_0x32cdba:0x369,_0x5e7183:0x691,_0x2183fd:0x62f,_0x496c46:0x2e2,_0x591c03:0x33a,_0x3e64a7:0x90,_0x2bd858:0x1a8,_0xad7e37:0x92},_0x375c68={_0x577978:0x1ea,_0x472f03:0x2c4,_0x4ae177:0x96},_0x11be9d={_0x9d46fd:0x530,_0x2a3591:0x82e,_0x4f69fc:0x84b,_0x7a85c8:0x327,_0x2b876f:0x59b},_0x3678f2={_0x4aebe0:0x77},_0x18f755={_0x3a19ff:0x264,_0x30d878:0x1d4,_0x1da090:0x289},_0x11681d={_0x455460:0xbb},_0x2cffd8={_0x1eb20f:0x687,_0xacdf57:0x622,_0x1e12a6:0x464,_0xce34fb:0x1f2,_0x5abc3e:0x1e9,_0x2f2584:0x433,_0x31cbed:0x1b,_0x5a6a6a:0x2d8,_0x43b59c:0x39b,_0x29756a:0x50d,_0x3dd482:0x209,_0xeb146e:0x4a,_0x1ae5f2:0x57,_0x2c8154:0x1e0,_0x1c1524:0x37e,_0xa49e79:0x161,_0x52d5ba:0x372,_0x176a72:0x2c8,_0x81f0d2:0x4e7,_0x5986e7:0x516,_0x14907a:0x4ce,_0xbf37ce:0x149,_0x114f23:0x37,_0x4fe9dc:0x1c4,_0x1efa26:0x2ff,_0x416a6c:0x1d2,_0x478131:0x47e,_0x3832f7:0x15b,_0x4e7042:0x4ed,_0x9405f8:0x238},_0x466043={_0x18fd99:0x4be},_0x561ada={_0x3fa6cc:0x9b};function _0x562548(_0x570ef8,_0x562f48){return _0x35d151(_0x570ef8,_0x562f48-0x32b);}const _0x1f3379={'qAneU':function(_0x1bda31,_0x4a0c56,_0x42e987){return _0x1bda31(_0x4a0c56,_0x42e987);},'vcbtS':function(_0x42de4e,_0x386be3){return _0x42de4e(_0x386be3);},'pWEmn':_0x562548(_0x2637a._0x4b9de6,_0x2637a._0x2fdd5e)};if(this['stopped']||this[_0x17f8c9(_0x2637a._0x38e289,-0xcf)+_0x562548(0x5be,0x822)]||this['isRelayO'+_0x562548(0xb4e,0x994)]())return;this[_0x17f8c9(0xdd,_0x2637a._0x20b501)+_0x17f8c9(0x45c,_0x2637a._0x12f26d)]=!![],this['relayAtt'+'empt']+=0x1;const _0x1394b7=this[_0x17f8c9(0x1df,_0x2637a._0x17a5f4)+'empt'],_0x25adad=buildRelayWsUrl(this[_0x562548(_0x2637a._0x592c24,0x71c)][_0x17f8c9(_0x2637a._0x2590e9,_0x2637a._0x580c5d)]);this[_0x17f8c9(0x3c0,_0x2637a._0x9de169)](_0x562548(0xb9a,0x9a5)+'nnect\x20at'+_0x562548(0x9fc,_0x2637a._0x2a294b)+_0x1394b7+_0x17f8c9(0x4e9,0x65b)+redactRelayWsUrl(_0x25adad));const _0x368df9=this[_0x562548(0x7dd,0x5fc)+_0x562548(_0x2637a._0x4f58ff,0x6f2)](_0x25adad);this[_0x17f8c9(_0x2637a._0x99d6c,0x819)+_0x562548(0x86a,_0x2637a._0x527735)]=_0x368df9;function _0x17f8c9(_0x187193,_0x3720d7){return _0x35d151(_0x3720d7,_0x187193- -_0x561ada._0x3fa6cc);}_0x368df9[_0x562548(0xa63,_0x2637a._0x53966e)](_0x562548(0x63d,0x755),()=>{const _0x505a14={_0x4a4c3b:0x4e1};function _0x240122(_0x276665,_0x1ff7c8){return _0x562548(_0x276665,_0x1ff7c8- -_0x466043._0x18fd99);}if(this[_0x2404b2(0x429,_0x2cffd8._0x1eb20f)]||this[_0x240122(_0x2cffd8._0xacdf57,_0x2cffd8._0x1e12a6)+_0x2404b2(_0x2cffd8._0xce34fb,_0x2cffd8._0x5abc3e)]!==_0x368df9){_0x368df9[_0x2404b2(_0x2cffd8._0x2f2584,0x45f)]();return;}this[_0x240122(0x12f,-_0x2cffd8._0x31cbed)+_0x240122(0x536,0x364)]=![],this[_0x2404b2(0x3ef,0x16c)+_0x240122(_0x2cffd8._0x5a6a6a,_0x2cffd8._0x43b59c)+_0x240122(_0x2cffd8._0x29756a,_0x2cffd8._0x3dd482)]=Date[_0x2404b2(-_0x2cffd8._0xeb146e,_0x2cffd8._0x1ae5f2)]();const _0x49b6ac={};_0x49b6ac[_0x2404b2(-0x3e,_0x2cffd8._0x2c8154)+'nected']=!![];function _0x2404b2(_0x4d2739,_0x28d3dd){return _0x562548(_0x28d3dd,_0x4d2739- -_0x505a14._0x4a4c3b);}_0x49b6ac[_0x2404b2(0x86,_0x2cffd8._0x1c1524)+'r']=null,this[_0x240122(-0x3c,_0x2cffd8._0xa49e79)+_0x240122(0x1b9,_0x2cffd8._0x52d5ba)](_0x49b6ac),this[_0x240122(0x3eb,_0x2cffd8._0x176a72)](_0x240122(0x28f,_0x2cffd8._0x81f0d2)+_0x240122(0x627,_0x2cffd8._0x5986e7)+'attempt='+_0x1394b7),this[_0x240122(0x456,0x479)+_0x240122(0x4b3,_0x2cffd8._0x14907a)](),_0x1f3379[_0x240122(_0x2cffd8._0xbf37ce,0x34c)](shouldKeepGatewayConnected,this['snapshot']['clientCo'+_0x2404b2(_0x2cffd8._0x114f23,-_0x2cffd8._0x4fe9dc)],summarizePendingGatewayMessages(this[_0x2404b2(0x516,_0x2cffd8._0x1efa26)+_0x2404b2(_0x2cffd8._0x416a6c,0x319)+_0x240122(_0x2cffd8._0x478131,0x362)])[_0x2404b2(0x451,_0x2cffd8._0x3832f7)+_0x240122(0x217,_0x2cffd8._0x4e7042)])&&this['ensureGa'+'tewayCon'+_0x240122(_0x2cffd8._0x9405f8,0x437)]();}),_0x368df9['on'](_0x17f8c9(_0x2637a._0x514dbf,_0x2637a._0x13fcaf),(_0x42a96e,_0x3fde66)=>{function _0x499972(_0x98fe41,_0x370045){return _0x17f8c9(_0x98fe41-_0x11681d._0x455460,_0x370045);}function _0x5f34c4(_0x3e7db3,_0x1ffb83){return _0x17f8c9(_0x3e7db3- -0x270,_0x1ffb83);}void this[_0x499972(_0x18f755._0x3a19ff,_0x18f755._0x30d878)+_0x499972(_0x18f755._0x1da090,0xf8)+'ge'](_0x42a96e,_0x3fde66);}),_0x368df9['on'](_0x562548(0x7d9,0x614),()=>{function _0x25317b(_0x232288,_0x1a5f03){return _0x562548(_0x232288,_0x1a5f03- -_0x3678f2._0x4aebe0);}function _0x33c039(_0x5d8c6d,_0x50413e){return _0x562548(_0x50413e,_0x5d8c6d- -0x3a0);}this[_0x33c039(_0x11be9d._0x9d46fd,_0x11be9d._0x2a3591)+_0x25317b(_0x11be9d._0x4f69fc,0x7e2)+_0x33c039(_0x11be9d._0x7a85c8,0x11a)]=Date[_0x25317b(_0x11be9d._0x2b876f,0x420)]();}),_0x368df9[_0x17f8c9(_0x2637a._0x3c5a3e,0x63f)](_0x562548(_0x2637a._0x5689a8,0x65f),_0x4beb0f=>{const _0xcb2f9b={_0x378dd1:0x4a9};function _0x4067e0(_0x5cb19b,_0x38e054){return _0x562548(_0x38e054,_0x5cb19b- -_0xcb2f9b._0x378dd1);}function _0x1ed37e(_0x559b83,_0x27fa63){return _0x562548(_0x559b83,_0x27fa63- -0x5c9);}this[_0x1ed37e(0x184,0x1bd)](_0x4067e0(_0x375c68._0x577978,_0x375c68._0x472f03)+_0x1ed37e(0x95,-_0x375c68._0x4ae177)+_0x1f3379['vcbtS'](String,_0x4beb0f));}),_0x368df9['once'](_0x17f8c9(0x54e,_0x2637a._0x2fe156),(_0x31aa4d,_0x5dc50a)=>{const _0x57f9fe=(_0x5a2c28(0x50,0x208)+_0x1b16e2(0x274,0x3a)+'7')['split']('|');let _0x3226c7=0x0;function _0x5a2c28(_0x1134f6,_0x438893){return _0x562548(_0x438893,_0x1134f6- -0x5e8);}function _0x1b16e2(_0x1d6747,_0x5a3db2){return _0x562548(_0x5a3db2,_0x1d6747- -0x21d);}while(!![]){switch(_0x57f9fe[_0x3226c7++]){case'0':this[_0x5a2c28(0x19e,-0xa8)](_0x1b16e2(_0x44830d._0x4c937c,0x358)+_0x1b16e2(_0x44830d._0x47a11e,0x7e7)+_0x5a2c28(-0xaa,0xeb)+_0x31aa4d+_0x1b16e2(0x728,0xa19)+(_0x5dc50a[_0x5a2c28(0x62,0x174)]()||_0x1f3379[_0x5a2c28(0x3af,_0x44830d._0x17ae5d)]));continue;case'1':this['gatewayC'+'onnected'+_0x5a2c28(_0x44830d._0x4b993d,0x4c4)]=null;continue;case'2':this['relaySoc'+'ket']===_0x368df9&&(this[_0x1b16e2(0x705,_0x44830d._0xf74971)+_0x1b16e2(0x4b6,0x36f)]=null);continue;case'3':this['updateSn'+_0x5a2c28(_0x44830d._0x138d93,_0x44830d._0x24c308)]({'relayConnected':![],'gatewayConnected':![],'clientCount':0x0,'lastError':_0x31aa4d===0x3e8?null:'relay\x20cl'+_0x5a2c28(_0x44830d._0x13d7b7,0xa1)+(_0x5dc50a[_0x5a2c28(0x62,-_0x44830d._0x3a2b03)]()||_0x31aa4d)});continue;case'4':this[_0x1b16e2(_0x44830d._0x52abb7,_0x44830d._0x47cfb4)+_0x1b16e2(0x605,0x30b)]=![];continue;case'5':this[_0x5a2c28(0x275,0x33d)+_0x1b16e2(0x54a,_0x44830d._0x81702c)]();continue;case'6':this[_0x1b16e2(_0x44830d._0x2641f2,_0x44830d._0x32cdba)+_0x5a2c28(0x282,0x571)+_0x1b16e2(_0x44830d._0x5e7183,_0x44830d._0x2183fd)]=null;continue;case'7':this[_0x5a2c28(_0x44830d._0x496c46,_0x44830d._0x591c03)+_0x5a2c28(-_0x44830d._0x3e64a7,_0x44830d._0x2bd858)+'onnect']();continue;case'8':this[_0x5a2c28(0x156,0x2f3)+_0x5a2c28(_0x44830d._0xad7e37,0x28a)]();continue;}break;}});}async[_0x341e52(0x4c0,0x245)+'layMessa'+'ge'](_0x315c70,_0x27b0f9){const _0x3b659f={_0x3f73ae:0x4d4,_0x2002c2:0x233,_0x3e61a5:0x3ba,_0x350da7:0xdb,_0x3aee08:0x3a0,_0x238e9c:0x37b,_0x166bcf:0x163,_0x376623:0x3df,_0x4a3a08:0x64d,_0x362c5a:0x155,_0x33f711:0x3d3,_0x2e7469:0x416,_0x5d91aa:0x6a,_0x598630:0x1be,_0x5ed245:0x16e,_0x3f18a9:0x273,_0x33163b:0x1cb,_0x27618a:0x23f,_0x15059c:0x37b},_0x1b3901={_0x575159:0x1c1},_0x11e0ee={'jplSD':function(_0x1e17e0,_0x5d4acb){return _0x1e17e0(_0x5d4acb);}};this[_0xa01bd6(_0x3b659f._0x3f73ae,_0x3b659f._0x2002c2)+_0xa01bd6(0x45d,0x233)+'yMs']=Date[_0x36c0f3(-0x270,-0x55)]();if(_0x27b0f9){this[_0x36c0f3(_0x3b659f._0x3e61a5,_0x3b659f._0x350da7)+'rQueueGa'+_0x36c0f3(_0x3b659f._0x3aee08,_0x3b659f._0x238e9c)+_0x36c0f3(-0x230,-0xc5)]({'kind':_0xa01bd6(0x321,_0x3b659f._0x166bcf),'data':normalizeBinary(_0x315c70)});return;}const _0x53fb1b=normalizeText(_0x315c70);if(_0x53fb1b==null)return;const _0x9d2e2d=_0x11e0ee[_0xa01bd6(_0x3b659f._0x376623,_0x3b659f._0x4a3a08)](parseControl,_0x53fb1b);function _0xa01bd6(_0x3b89d8,_0xe01f0f){return _0x35d151(_0xe01f0f,_0x3b89d8- -0xd1);}if(_0x9d2e2d){await this[_0xa01bd6(0x173,0x204)+_0x36c0f3(0x220,0x1b7)+'ol'](_0x9d2e2d);return;}const _0x2b5d2c=parseConnectStartIdentity(_0x53fb1b);_0x2b5d2c&&this[_0xa01bd6(0x2ca,_0x3b659f._0x362c5a)+_0xa01bd6(_0x3b659f._0x33f711,_0x3b659f._0x2e7469)+_0x36c0f3(-0xb9,-_0x3b659f._0x5d91aa)](_0x2b5d2c['id'],_0x2b5d2c[_0x36c0f3(_0x3b659f._0x598630,_0x3b659f._0x5ed245)]);const _0x28b1eb={};_0x28b1eb[_0xa01bd6(0x5e7,0x7e4)]=_0x36c0f3(_0x3b659f._0x3f18a9,0x3b),_0x28b1eb['text']=_0x53fb1b;function _0x36c0f3(_0xc5d72d,_0x585387){return _0x35d151(_0xc5d72d,_0x585387- -_0x1b3901._0x575159);}this[_0xa01bd6(_0x3b659f._0x33163b,-0x91)+_0x36c0f3(-0x317,-0xe)+_0x36c0f3(_0x3b659f._0x27618a,_0x3b659f._0x15059c)+'sage'](_0x28b1eb);}async[_0x35d151(0xb8,0x244)+'layContr'+'ol'](_0x2856c5){const _0x2b9d1a={_0x5d9568:0x90b,_0x2d81b7:0x2bb,_0x138fe8:0x28e,_0xb9ee6b:0x3c4,_0x464b3c:0x46c,_0x3e7254:0x70a,_0x508de5:0x655,_0x32e840:0x444,_0x1ea3f8:0x7eb,_0x5d1b9e:0x605,_0x50f718:0x62a,_0x2625c1:0x56a,_0x4d669b:0x40a,_0x48960f:0x896,_0x50c6cc:0x5f9,_0x4a29eb:0x616,_0x3761bf:0x670,_0x2aa96f:0x506,_0x4a9fa0:0x5f0,_0x238ecd:0x60d,_0x1de986:0x66a,_0x211c8c:0x463,_0x27da79:0x54a,_0x349538:0x398,_0x535467:0x3ed,_0x5e250c:0x527,_0x3f9b0d:0x6a9,_0x5a29cd:0x992,_0xb8046:0x697,_0x2e87c9:0x486,_0x13cfd5:0x1d7,_0x31e8f5:0x4fd,_0x4f145d:0x468,_0xb99250:0x7c1,_0x4409f9:0x5f5,_0x21b32d:0x55e,_0x408281:0x617,_0x5c7f1d:0x421,_0x510b73:0x5a9,_0x5692c3:0x8cc,_0x49c603:0x366,_0x57e931:0x5bc,_0x1b5ea8:0x2e2,_0x5ed5e4:0x78f,_0x1d88d3:0x253,_0x4c6c42:0x424,_0x36cfd3:0x31b,_0x3fda0b:0x755,_0x5e50a9:0xb8c,_0x4307d3:0x5c2,_0x5a7f7e:0x80a,_0x5af80b:0x454,_0x4b00d9:0x5a9,_0x147a76:0x561,_0x4ea24b:0x5a5,_0x53a587:0x49d,_0x242abd:0x850,_0x3a90c3:0x971,_0xcbcb64:0x4ed,_0x45d98f:0x798,_0x9aaee1:0x4d6,_0x43476f:0x643,_0x1ec9a8:0x9cd,_0x48561c:0x4ff,_0x4ef0b6:0x623,_0x4053ae:0x821,_0x57ca6c:0x74f,_0x183156:0x516,_0x4cf975:0x317,_0x3f6022:0x815,_0x272f4c:0x729,_0x1a91a1:0x8bc,_0x4cec66:0xb0,_0x1c2dfa:0x2e2,_0x18e8db:0xa58,_0x21e9d0:0x81a,_0x3d36e1:0x63d,_0x4be782:0x543,_0x5afdfe:0x4f9,_0x4b19b4:0x90d,_0x18569d:0x903,_0x55285f:0x7aa,_0x797924:0x4cc,_0x14d08a:0x3ee,_0x4dfa42:0x31a,_0xa02aba:0x4de,_0x566f0d:0x359,_0x2d4563:0x56b,_0x199d04:0x5d8,_0x13655e:0x499,_0x3cfc3e:0x88f,_0x16e893:0x80a,_0x3ea971:0x474,_0x266733:0x6dc,_0x5f353f:0x7ea,_0x4f6b2b:0x442,_0xd41354:0x653,_0x3ee00a:0x710,_0x39ec69:0x3c4,_0x21401b:0x198,_0x40f882:0x720,_0xd783b5:0x654,_0x202d67:0x759,_0x3dd840:0x5e6,_0x300f5e:0x613,_0x30588c:0x80b,_0xc39f42:0x628,_0x792af4:0x6e0,_0x5558f1:0x6c0,_0x4037d9:0x87f,_0x48d611:0x2c9,_0xfcb04b:0x3e2,_0x30e943:0x447,_0x44815e:0x810,_0x590a5a:0x55d,_0xc5b994:0x33b,_0x3418f7:0x5a9,_0x285e28:0x471,_0x425f0a:0x25d,_0x39b188:0x4a9,_0x7117a7:0x434,_0x581907:0x3cc,_0x37491f:0x540,_0xe1b06b:0x4d0,_0x403e18:0x788,_0x54dfe7:0x4b1,_0x38a75a:0x3e9,_0x1f16d5:0x39e,_0x3e17a4:0x59c,_0x3eec39:0x6c0,_0x1efce1:0x8bb},_0x45a243={_0x22542a:0x2b5};function _0x553805(_0x24906b,_0x3238ba){return _0x35d151(_0x24906b,_0x3238ba-_0x45a243._0x22542a);}const _0x25cde2={'XHADf':function(_0x3d5cef,_0x21ab83){return _0x3d5cef===_0x21ab83;},'aCAMm':function(_0x3c0e82,_0x3abeb0){return _0x3c0e82==_0x3abeb0;},'oggSu':function(_0x2e1186,_0x14454a){return _0x2e1186===_0x14454a;},'NxcZs':'client\x20d'+_0x4ccb8b(_0x2b9d1a._0x5d9568,0x655)+_0x4ccb8b(_0x2b9d1a._0x2d81b7,_0x2b9d1a._0x138fe8)+_0x4ccb8b(0x753,0x569)+_0x553805(_0x2b9d1a._0xb9ee6b,0x42b)+_0x553805(0x281,_0x2b9d1a._0x464b3c)+_0x553805(0x88d,_0x2b9d1a._0x3e7254),'rUqEm':'client\x20d'+_0x4ccb8b(0x706,_0x2b9d1a._0x508de5)+_0x4ccb8b(_0x2b9d1a._0x32e840,_0x2b9d1a._0x138fe8)+_0x4ccb8b(0x5f4,_0x2b9d1a._0x1ea3f8)+_0x553805(_0x2b9d1a._0x5d1b9e,_0x2b9d1a._0x50f718)+_0x553805(_0x2b9d1a._0x2625c1,_0x2b9d1a._0x4d669b)+_0x4ccb8b(_0x2b9d1a._0x48960f,_0x2b9d1a._0x50c6cc),'wabyW':function(_0x5893b5,_0x1309db){return _0x5893b5(_0x1309db);},'rlOjl':function(_0x40f80c,_0x35357b){return _0x40f80c>_0x35357b;},'CuoUn':function(_0x554066,_0x2e25c7,_0x29b9eb,_0x52fe92){return _0x554066(_0x2e25c7,_0x29b9eb,_0x52fe92);},'mwTEa':_0x553805(0x244,0x411)+'isconnec'+_0x553805(0x741,_0x2b9d1a._0x4a29eb)+_0x4ccb8b(_0x2b9d1a._0x3761bf,0x491)+_0x4ccb8b(0x954,0x764)+_0x4ccb8b(0x3c4,_0x2b9d1a._0x2aa96f)};function _0x4ccb8b(_0x22f011,_0x470355){return _0x35d151(_0x22f011,_0x470355-0x14e);}if(_0x2856c5[_0x553805(_0x2b9d1a._0x4a9fa0,0x47c)]===_0x4ccb8b(0x779,_0x2b9d1a._0x238ecd)+_0x553805(_0x2b9d1a._0x1de986,_0x2b9d1a._0x211c8c)+'t'){await this[_0x553805(0x4e4,0x53e)+'otstrapR'+_0x4ccb8b(_0x2b9d1a._0x27da79,_0x2b9d1a._0x349538)](_0x2856c5);return;}const {event:_0x3bfca8,count:_0x253fce}=_0x2856c5;if(_0x25cde2[_0x4ccb8b(_0x2b9d1a._0x535467,_0x2b9d1a._0x5e250c)](_0x3bfca8,_0x4ccb8b(0x46e,0x542)+_0x553805(0x78f,0x7ea))||_0x3bfca8===_0x553805(0x8cc,_0x2b9d1a._0x3f9b0d)+_0x4ccb8b(_0x2b9d1a._0x5a29cd,_0x2b9d1a._0xb8046)){const _0x43bdfd=this[_0x4ccb8b(_0x2b9d1a._0x2e87c9,0x657)][_0x4ccb8b(0x35f,0x55d)+_0x553805(_0x2b9d1a._0x13cfd5,0x4a2)],_0x2ab72e=_0x253fce??Math[_0x4ccb8b(_0x2b9d1a._0x31e8f5,_0x2b9d1a._0x4f145d)](0x1,this[_0x4ccb8b(0x677,0x657)][_0x4ccb8b(0x4ad,0x55d)+'unt']);_0x2ab72e>0x0&&_0x25cde2['aCAMm'](this[_0x4ccb8b(_0x2b9d1a._0xb99250,_0x2b9d1a._0x4409f9)+'mandStar'+_0x553805(_0x2b9d1a._0x21b32d,0x838)],null)&&(this['clientDe'+_0x553805(0x5b1,0x7f4)+_0x553805(_0x2b9d1a._0x408281,0x838)]=Date[_0x553805(0x245,_0x2b9d1a._0x5c7f1d)]());const _0x3d154a={};_0x3d154a[_0x4ccb8b(0x5b4,0x55d)+_0x553805(0x469,0x4a2)]=_0x2ab72e,this[_0x553805(0x665,_0x2b9d1a._0x510b73)+_0x4ccb8b(_0x2b9d1a._0x5692c3,0x653)](_0x3d154a);if(_0x25cde2[_0x4ccb8b(_0x2b9d1a._0x49c603,0x41d)](_0x2ab72e,0x0)){this[_0x4ccb8b(_0x2b9d1a._0x57e931,_0x2b9d1a._0x1b5ea8)+_0x553805(0xa47,_0x2b9d1a._0x5ed5e4)+'Started']=![],this[_0x4ccb8b(-0x95,_0x2b9d1a._0x1d88d3)+_0x553805(0x227,0x3c4)+'t'](),this['dropStal'+_0x4ccb8b(0x6f6,_0x2b9d1a._0x4c6c42)+_0x4ccb8b(0x442,_0x2b9d1a._0x36cfd3)+'e']();const _0x4480c5=summarizePendingGatewayMessages(this[_0x4ccb8b(0x5c8,0x81a)+'atewayMe'+'ssages'])[_0x4ccb8b(0xa21,_0x2b9d1a._0x3fda0b)+_0x553805(_0x2b9d1a._0x5e50a9,0x935)];shouldScheduleGatewayIdleClose(_0x2ab72e,_0x4480c5,this[_0x4ccb8b(_0x2b9d1a._0x4307d3,_0x2b9d1a._0x5a7f7e)+'yOpen']())?(this[_0x4ccb8b(_0x2b9d1a._0x5af80b,_0x2b9d1a._0x4b00d9)](_0x25cde2['NxcZs']),this[_0x4ccb8b(0x39f,_0x2b9d1a._0x147a76)+_0x4ccb8b(_0x2b9d1a._0x4ea24b,_0x2b9d1a._0x53a587)]()):this[_0x4ccb8b(0x7ef,_0x2b9d1a._0x510b73)](_0x25cde2[_0x553805(_0x2b9d1a._0x242abd,0x736)]);}else{if(shouldRecycleGatewayForFreshClient(_0x43bdfd,_0x2ab72e,this[_0x553805(0xb28,_0x2b9d1a._0x3a90c3)+_0x553805(_0x2b9d1a._0xcbcb64,0x705)](),![])){const _0x2ee74b=_0x25cde2[_0x4ccb8b(0x95c,_0x2b9d1a._0x45d98f)](summarizePendingGatewayMessages,this[_0x553805(0x819,0x981)+_0x4ccb8b(0x4e9,_0x2b9d1a._0x9aaee1)+_0x4ccb8b(0x897,_0x2b9d1a._0x43476f)]);this[_0x553805(_0x2b9d1a._0x1ec9a8,0x710)](_0x553805(_0x2b9d1a._0x48561c,0x62f)+_0x553805(_0x2b9d1a._0x4ef0b6,_0x2b9d1a._0x4053ae)+_0x4ccb8b(_0x2b9d1a._0x57ca6c,0x4e7)+'d\x20for\x20fr'+'esh\x20clie'+_0x4ccb8b(_0x2b9d1a._0x183156,_0x2b9d1a._0x4cf975)+_0x553805(_0x2b9d1a._0x3f6022,_0x2b9d1a._0x272f4c)+'='+_0x2ee74b['total']+('\x20connect'+'=')+_0x2ee74b[_0x553805(0x84b,_0x2b9d1a._0x1a91a1)+_0x4ccb8b(0x913,0x7ce)]+'\x20text='+_0x2ee74b['otherTex'+'t']+'\x20binary='+_0x2ee74b['binary']+(_0x4ccb8b(0x854,0x80b)+_0x553805(0x546,0x557)+'d=')+this[_0x4ccb8b(_0x2b9d1a._0x4cec66,_0x2b9d1a._0x1c2dfa)+'andshake'+_0x4ccb8b(0x127,0x2e0)]);const _0xb0219b=prunePendingGatewayMessagesForFreshDemand(this[_0x4ccb8b(_0x2b9d1a._0x18e8db,_0x2b9d1a._0x21e9d0)+_0x553805(0x666,_0x2b9d1a._0x3d36e1)+_0x4ccb8b(_0x2b9d1a._0x4be782,_0x2b9d1a._0x43476f)]);_0x25cde2[_0x4ccb8b(0x610,_0x2b9d1a._0x5afdfe)](_0xb0219b['dropped'],0x0)&&(this[_0x4ccb8b(_0x2b9d1a._0x4b19b4,0x81a)+_0x4ccb8b(0x46a,0x4d6)+_0x553805(_0x2b9d1a._0x18569d,_0x2b9d1a._0x55285f)]=_0xb0219b['messages'],this['log']('dropped\x20'+_0x553805(0x1d7,_0x2b9d1a._0x797924)+_0x4ccb8b(0x496,_0x2b9d1a._0x14d08a)+_0x4ccb8b(_0x2b9d1a._0x4dfa42,0x61c)+'re\x20recyc'+'le\x20dropp'+_0x553805(0x4e5,_0x2b9d1a._0xa02aba)+_0xb0219b[_0x4ccb8b(_0x2b9d1a._0x566f0d,_0x2b9d1a._0x2d4563)]+_0x553805(_0x2b9d1a._0x199d04,0x4b4)+_0xb0219b[_0x4ccb8b(0x402,0x6fb)]['length'])),this[_0x4ccb8b(0x50c,0x561)+_0x4ccb8b(_0x2b9d1a._0x13655e,_0x2b9d1a._0x53a587)](!![]);}if(this[_0x4ccb8b(_0x2b9d1a._0x3cfc3e,_0x2b9d1a._0x16e893)+_0x553805(0x6bd,0x705)]()&&!this['gatewayC'+_0x4ccb8b(0x75e,_0x2b9d1a._0x3ea971)+_0x553805(0x6f9,0x635)+'ing']){const _0x5ce3c8={};_0x5ce3c8[_0x553805(0x73b,0x77a)+_0x553805(_0x2b9d1a._0x266733,_0x2b9d1a._0x5f353f)]=!![],_0x5ce3c8['lastErro'+'r']=null,this[_0x4ccb8b(0x663,_0x2b9d1a._0x4f6b2b)+_0x4ccb8b(0x82b,_0x2b9d1a._0xd41354)](_0x5ce3c8),this[_0x553805(0x50b,_0x2b9d1a._0x3ee00a)](_0x4ccb8b(_0x2b9d1a._0x39ec69,0x4c8)+_0x553805(_0x2b9d1a._0x21401b,0x457)+_0x553805(0x659,_0x2b9d1a._0x40f882)+_0x553805(0xa42,0x86f)+_0x4ccb8b(_0x2b9d1a._0xd783b5,_0x2b9d1a._0x202d67)+_0x553805(_0x2b9d1a._0x3dd840,0x3b9)+this['elapsedS'+_0x553805(0xa45,0x791)](this[_0x4ccb8b(0x53e,_0x2b9d1a._0x300f5e)+'onnected'+_0x4ccb8b(0x492,0x6f4)])+(_0x4ccb8b(0x601,_0x2b9d1a._0x30588c)+'keStarte'+'d=')+this['gatewayH'+_0x4ccb8b(0x89f,_0x2b9d1a._0xc39f42)+'Started']);}}this['ensureGa'+_0x4ccb8b(_0x2b9d1a._0x792af4,_0x2b9d1a._0x5558f1)+_0x553805(0xa00,_0x2b9d1a._0x4037d9)]();return;}if(_0x3bfca8==='client_d'+_0x4ccb8b(0x58f,_0x2b9d1a._0x48d611)+_0x553805(0x606,_0x2b9d1a._0xfcb04b)){this['gatewayH'+_0x4ccb8b(0x90a,0x628)+_0x553805(0x2a3,_0x2b9d1a._0x30e943)]=![];const _0x48f815={};_0x48f815[_0x4ccb8b(_0x2b9d1a._0x44815e,_0x2b9d1a._0x590a5a)+_0x4ccb8b(0x3de,_0x2b9d1a._0xc5b994)]=0x0,this[_0x553805(0x593,_0x2b9d1a._0x3418f7)+_0x4ccb8b(0x40e,_0x2b9d1a._0xd41354)](_0x48f815),this[_0x4ccb8b(_0x2b9d1a._0x285e28,0x253)+_0x4ccb8b(0xb,_0x2b9d1a._0x425f0a)+'t'](),this[_0x4ccb8b(0x677,_0x2b9d1a._0x39b188)+_0x4ccb8b(0x6aa,0x424)+'ewayQueu'+'e']();const _0x135c62=summarizePendingGatewayMessages(this['pendingG'+_0x4ccb8b(_0x2b9d1a._0x7117a7,0x4d6)+'ssages'])['connectR'+'equests'];_0x25cde2[_0x553805(0x3fd,_0x2b9d1a._0x581907)](shouldScheduleGatewayIdleClose,0x0,_0x135c62,this[_0x553805(0xbe5,_0x2b9d1a._0x3a90c3)+'yOpen']())?(this[_0x553805(_0x2b9d1a._0x37491f,0x710)]('client\x20d'+'isconnec'+_0x553805(_0x2b9d1a._0xe1b06b,_0x2b9d1a._0x403e18)+_0x4ccb8b(0x615,_0x2b9d1a._0x54dfe7)+_0x4ccb8b(_0x2b9d1a._0x38a75a,_0x2b9d1a._0x1f16d5)+'y'),this['closeGat'+'eway']()):(this[_0x4ccb8b(0x6d6,0x5a9)](_0x25cde2['mwTEa']),this[_0x4ccb8b(0x18e,0x27d)+_0x4ccb8b(_0x2b9d1a._0x3e17a4,_0x2b9d1a._0x3eec39)+_0x4ccb8b(_0x2b9d1a._0x1efce1,0x718)]());return;}}async['handleBo'+'otstrapR'+_0x341e52(0x4c6,0x760)](_0x3d96eb){const _0x494293={_0x27b2f5:0xf6,_0x2e8202:0x3bb,_0x13eaa9:0x60,_0x5d43a7:0x162,_0x2366d8:0x48f,_0x21eecb:0x283,_0x4a64be:0x458,_0x4aebfd:0x616,_0x2d6e26:0x41e,_0x1b9bf6:0x5b4,_0xbccfad:0x5d5,_0x32610e:0x3df,_0x4da38e:0x19d,_0x2a5564:0x349,_0x1c7724:0x2be,_0x27a9ca:0x4e9,_0x5bfce8:0x16f,_0x56eec6:0x357,_0x263dd4:0x10f,_0x56a4c9:0x2d,_0x5462e5:0x4be,_0xe8f1a:0x5d,_0xe56001:0x672,_0x24ce5e:0x38,_0x31cdf7:0xe,_0x57c3f9:0x1a2,_0x398da2:0x1f1,_0x3329a7:0x41b,_0x3a14ec:0x432,_0x26fbc7:0x179,_0x3dfd89:0x3f5,_0x3ae4e6:0x58c,_0x4fd84b:0x5b8,_0x145d7b:0x5c3,_0x1de3fb:0x595,_0x283fc0:0x485,_0x1c4a7b:0x292,_0x39b4a3:0x1c8,_0x2a4d8f:0x3ea,_0x419037:0x28b,_0x16d77b:0x57c,_0x590343:0xd4,_0x518ea3:0x7b,_0x1a71e9:0x28f,_0xaaea06:0x43a,_0x4986c0:0x3bb,_0x2c9b14:0x2ac,_0x4db490:0xfc,_0x3325e1:0x6,_0x4f7e50:0x95,_0x53d9a4:0x6c7,_0xcb75e0:0x4b3,_0x16c78f:0x147,_0x19bd64:0x16b,_0x5059fc:0x87,_0x59ff9b:0x29b,_0x21c5e8:0x3eb,_0x19fef4:0x293,_0x537591:0x3c7},_0x211142={_0x44d0e9:0x380},_0x27e507={};_0x27e507['MVMTd']=_0x1bbdaf(_0x494293._0x27b2f5,_0x494293._0x2e8202)+'p.error',_0x27e507[_0x1bbdaf(_0x494293._0x13eaa9,0x221)]=function(_0x4fdef4,_0x231d90){return _0x4fdef4||_0x231d90;},_0x27e507[_0xdae84e(0x45,_0x494293._0x5d43a7)]=function(_0xf7e2fe,_0x3ab756){return _0xf7e2fe||_0x3ab756;};const _0x377698=_0x27e507,_0x3cdb47=_0x3d96eb[_0x1bbdaf(_0x494293._0x2366d8,0x33a)+'d']?.[_0x1bbdaf(0x22d,_0x494293._0x21eecb)]()??'';function _0x1bbdaf(_0x533202,_0x5c4f70){return _0x341e52(_0x5c4f70- -_0x211142._0x44d0e9,_0x533202);}function _0xdae84e(_0x576251,_0x5f5a1f){return _0x341e52(_0x5f5a1f- -0x224,_0x576251);}const _0x50017c=_0x3d96eb['sourceCl'+_0x1bbdaf(0x4c2,_0x494293._0x4a64be)]?.['trim']()||_0x3d96eb[_0xdae84e(_0x494293._0x4aebfd,_0x494293._0x2d6e26)+_0xdae84e(0x773,_0x494293._0x1b9bf6)]?.[_0xdae84e(_0x494293._0xbccfad,_0x494293._0x32610e)]()||'';if(!_0x3cdb47){this[_0x1bbdaf(0x1e3,0x357)](_0x1bbdaf(0x454,_0x494293._0x4da38e)+'otstrap\x20'+_0x1bbdaf(0x605,0x582)+_0xdae84e(_0x494293._0x2a5564,_0x494293._0x1c7724)+'reason=m'+_0xdae84e(_0x494293._0x27a9ca,0x201)+_0x1bbdaf(0xc0,0x1c6)+'d');return;}const _0x89b09c=parseBootstrapRequestPayload(_0x3d96eb['payload']);if(!_0x89b09c['ok']){this[_0x1bbdaf(_0x494293._0x5bfce8,_0x494293._0x56eec6)]('relay\x20bo'+_0x1bbdaf(-_0x494293._0x263dd4,_0x494293._0x56a4c9)+_0xdae84e(0x981,0x6de)+'rejected'+_0xdae84e(_0x494293._0x5462e5,0x5cd)+_0x1bbdaf(0x173,_0x494293._0xe8f1a)+_0x3cdb47+'\x20code='+_0x89b09c['code']+_0xdae84e(0x376,_0x494293._0xe56001)+_0x89b09c['message']);const _0x53f588={};_0x53f588[_0x1bbdaf(_0x494293._0x24ce5e,_0x494293._0x31cdf7)]=_0x89b09c[_0x1bbdaf(-0x2a0,0xe)],_0x53f588[_0xdae84e(_0x494293._0x57c3f9,_0x494293._0x398da2)]=_0x89b09c[_0xdae84e(0x19c,0x1f1)],this[_0xdae84e(_0x494293._0x3329a7,0x3eb)+_0x1bbdaf(0x1e1,0x3b6)]({'event':_0x377698['MVMTd'],'requestId':_0x3cdb47,'targetClientId':_0x377698[_0x1bbdaf(0x28,0x221)](_0x50017c,void 0x0),'payload':_0x53f588});return;}try{const _0x2ac657=await issueOpenClawBootstrapToken(_0x89b09c[_0xdae84e(_0x494293._0x3a14ec,_0x494293._0x26fbc7)]);this['log']('relay\x20bo'+_0xdae84e(_0x494293._0x3dfd89,0x189)+_0x1bbdaf(0x4a5,0x245)+_0xdae84e(_0x494293._0x3ae4e6,_0x494293._0x4fd84b)+'uestId='+_0x3cdb47+(_0x1bbdaf(0x42e,0x523)+'d=')+_0x89b09c['value']['deviceId']+(_0x1bbdaf(0x655,_0x494293._0x145d7b)+_0x1bbdaf(0x740,0x43a))+(_0x50017c||_0x1bbdaf(_0x494293._0x1de3fb,_0x494293._0x283fc0))+('\x20expires'+_0x1bbdaf(_0x494293._0x1c4a7b,0x455))+_0x2ac657[_0xdae84e(0x322,_0x494293._0x39b4a3)+'tMs']);const _0xf8c4bc={};_0xf8c4bc['bootstra'+'pToken']=_0x2ac657[_0x1bbdaf(0x3f0,_0x494293._0x2a4d8f)],_0xf8c4bc[_0x1bbdaf(-0x14b,0x6c)+_0xdae84e(_0x494293._0x419037,_0x494293._0x16d77b)]=_0x2ac657[_0xdae84e(-_0x494293._0x590343,_0x494293._0x39b4a3)+'tMs'],this[_0x1bbdaf(_0x494293._0x518ea3,_0x494293._0x1a71e9)+'yControl']({'event':_0x1bbdaf(_0x494293._0xaaea06,_0x494293._0x4986c0)+_0x1bbdaf(_0x494293._0x2c9b14,_0x494293._0x4db490),'requestId':_0x3cdb47,'targetClientId':_0x377698[_0x1bbdaf(-0xed,_0x494293._0x3325e1)](_0x50017c,void 0x0),'payload':_0xf8c4bc});}catch(_0x1d306a){const _0x2b3cd1=_0x1d306a instanceof Error?_0x1d306a[_0x1bbdaf(-0x1e4,_0x494293._0x4f7e50)]:String(_0x1d306a);this[_0xdae84e(_0x494293._0x53d9a4,_0x494293._0xcb75e0)]('relay\x20bo'+_0xdae84e(0x2da,0x189)+_0xdae84e(0x69f,0x3a1)+_0x1bbdaf(-0x54,_0x494293._0x16c78f)+'ed\x20reque'+'stId='+_0x3cdb47+_0xdae84e(0x89,_0x494293._0x19bd64)+_0x2b3cd1);const _0x496e16={};_0x496e16[_0x1bbdaf(-0x3c,0xe)]=_0x1bbdaf(_0x494293._0x2366d8,0x3bb)+_0xdae84e(0x61e,0x6b6)+_0xdae84e(_0x494293._0x5059fc,0x293),_0x496e16[_0x1bbdaf(0x19a,0x95)]=_0x2b3cd1,this[_0xdae84e(_0x494293._0x59ff9b,_0x494293._0x21c5e8)+_0xdae84e(_0x494293._0x19fef4,0x512)]({'event':'bootstra'+_0xdae84e(0x3b2,_0x494293._0x537591),'requestId':_0x3cdb47,'targetClientId':_0x377698[_0xdae84e(0x519,0x37d)](_0x50017c,void 0x0),'payload':_0x496e16});}}[_0x35d151(0x33d,0x29c)+'rQueueGa'+_0x341e52(0x7b8,0x4f1)+_0x341e52(0x378,0xc9)](_0x47a3db){const _0x225338={_0x58c7dd:0x43d,_0x57ef12:0x474,_0x20c12a:0x428,_0x27f1b9:0x1dd,_0x564fd0:0x62,_0x4e72e4:0x343,_0x12227c:0xfb,_0x4cad1a:0xaf,_0x49c7ee:0x602,_0xabe02b:0x13a,_0x5cbee9:0x2a6,_0x1193d3:0x167,_0x40c130:0x6db,_0x2ffadd:0x1f2,_0x50adf3:0x462,_0x12ce39:0x2b0,_0x167fd2:0x2ac,_0x3f4be8:0x332,_0x40cfca:0x502,_0x24024a:0x646,_0x4547ee:0x3a7,_0x5ca660:0x442,_0x173a71:0x428,_0x456761:0x20a,_0x510367:0x113,_0x6cf2ee:0x476,_0x442ceb:0x1b4,_0x33120e:0x12a,_0x4d668a:0x59d,_0x28dc29:0x226,_0x20ad15:0x1cb,_0x44cc60:0x9d,_0x37dd82:0x429,_0xc91301:0x18a,_0x4bec47:0xa0,_0x1985fa:0x5c,_0x56200c:0x1e9,_0x403e70:0x131,_0x538c1d:0x156,_0x4ccd0a:0x342,_0x45c3be:0x6a,_0x16cc4c:0x317,_0x56e02a:0x2cf,_0x46adf7:0x57,_0xcfa7f:0xde,_0x4c7e5e:0xd1,_0xd92c04:0x2f7},_0x23a0cd={_0x49385e:0x31e};function _0x211957(_0x29eed6,_0x59810a){return _0x35d151(_0x29eed6,_0x59810a- -_0x23a0cd._0x49385e);}const _0x3abc99={'Udini':_0x3355b8(0x596,_0x225338._0x58c7dd)+_0x3355b8(_0x225338._0x57ef12,0x442)+_0x3355b8(0x2bb,_0x225338._0x20c12a)+'ng\x20conne'+'ct\x20hands'+'hake;\x20qu'+_0x211957(0x285,0x290)+_0x211957(-0x1bc,-0x22d)+_0x3355b8(0x701,0x5db)+'nects','VgllC':function(_0x52810c,_0x8563f5){return _0x52810c(_0x8563f5);}},_0x2c1fa5=_0x47a3db['kind']==='text'&&isConnectHandshakeRequest(_0x47a3db['text']);if(this['gatewayC'+_0x3355b8(0x66a,0x3e9)+_0x211957(-_0x225338._0x27f1b9,_0x225338._0x564fd0)+_0x3355b8(_0x225338._0x4e72e4,0x592)]){this['pushPend'+_0x211957(-_0x225338._0x12227c,-_0x225338._0x4cad1a)+'ayMessag'+'e'](_0x47a3db);_0x2c1fa5&&this['log'](_0x3abc99[_0x3355b8(_0x225338._0x49c7ee,0x421)]);return;}const _0x26d5fb=this['gatewayS'+_0x211957(-_0x225338._0xabe02b,-0x1b3)];if(!_0x26d5fb||_0x26d5fb[_0x211957(_0x225338._0x5cbee9,_0x225338._0x1193d3)+'te']!==_0x42d174[_0x3355b8(0x5b1,_0x225338._0x40c130)]){this[_0x3355b8(-0xaf,_0x225338._0x2ffadd)+_0x3355b8(_0x225338._0x50adf3,0x635)+_0x211957(_0x225338._0x12ce39,_0x225338._0x167fd2)](),this['pushPend'+_0x3355b8(0x2e,_0x225338._0x3f4be8)+_0x3355b8(0x582,0x47e)+'e'](_0x47a3db);_0x2c1fa5&&this[_0x3355b8(_0x225338._0x40cfca,0x51e)](_0x3355b8(_0x225338._0x24024a,0x43d)+_0x3355b8(_0x225338._0x4547ee,_0x225338._0x5ca660)+_0x3355b8(0x69f,_0x225338._0x173a71)+'ng\x20conne'+_0x3355b8(0x5f,_0x225338._0x456761)+_0x211957(-0x10c,_0x225338._0x510367)+_0x3355b8(0x3cd,0x671)+_0x3355b8(_0x225338._0x6cf2ee,_0x225338._0x442ceb)+'ay\x20recon'+_0x211957(0x345,_0x225338._0x33120e));return;}function _0x3355b8(_0x209eae,_0x22d7f7){return _0x35d151(_0x209eae,_0x22d7f7-0xc3);}if(!this['gatewayH'+_0x3355b8(0x4af,_0x225338._0x4d668a)+_0x3355b8(0x25d,0x255)]){if(!_0x2c1fa5){this['pushPend'+_0x211957(-_0x225338._0x28dc29,-_0x225338._0x4cad1a)+_0x211957(-_0x225338._0x20ad15,_0x225338._0x44cc60)+'e'](_0x47a3db);return;}this[_0x211957(-_0x225338._0x37dd82,-_0x225338._0xc91301)+_0x211957(_0x225338._0x4bec47,0x1bc)+_0x3355b8(0x111,0x255)]=!![];const _0x5bf844=_0x3abc99[_0x3355b8(0x4fc,0x642)](parseConnectHandshakeMeta,_0x47a3db[_0x3355b8(0xdd,0x2bf)]);this['log'](_0x211957(-_0x225338._0x1193d3,_0x225338._0x1985fa)+'handshak'+_0x3355b8(_0x225338._0x167fd2,_0x225338._0x56200c)+_0x211957(-_0x225338._0x403e70,_0x225338._0x538c1d)+'='+this[_0x211957(_0x225338._0x4ccd0a,0x3ae)+_0x211957(0x352,_0x225338._0x45c3be)+_0x3355b8(_0x225338._0x16cc4c,0x5b8)][_0x211957(0x4a8,_0x225338._0x56e02a)]+formatConnectHandshakeMetaForLog(_0x5bf844));}this[_0x211957(-_0x225338._0x46adf7,_0x225338._0xcfa7f)+_0x3355b8(_0x225338._0x4c7e5e,_0x225338._0xd92c04)](_0x47a3db);}['ensureGa'+_0x35d151(0x62f,0x572)+'nected'](){const _0x541155={_0x39e109:0x55c,_0x4a5a55:0x7b2,_0x539f36:0x1d8,_0x5a73b5:0x75c,_0x3d9fab:0x896,_0x31d546:0x543,_0x40641b:0x64b,_0x55c1b7:0x649,_0x114b6a:0x32e,_0x54ce3b:0x5d6,_0x4b618d:0x5bd,_0x22a1a1:0x54e,_0x2c4356:0x46d,_0x2ae82c:0x4e4,_0xcb10b3:0x4f0,_0x81a0f:0xa11,_0x3cf08c:0x602,_0x1fa30c:0x3bf,_0x491f45:0x43e,_0x556681:0x4b5,_0x3760a1:0x518,_0x1f3fe4:0x422,_0x3d0807:0x7bb,_0x448a89:0x6d7},_0x160845={_0x345897:0x9c5,_0x1fe0e3:0x79c,_0x29461b:0x9b7,_0x396b14:0xb39,_0x16cc34:0x6b7,_0x10dc8f:0x825,_0x4325e6:0x806,_0xc687b:0x9c,_0xd596f9:0x6a,_0x427183:0x15c,_0x283355:0x462,_0x22906b:0x9d8,_0x2cd677:0x7fc,_0x34ae99:0xa40,_0x454039:0x62e,_0x4bb39b:0x455,_0x2be41c:0x112,_0x4c7c8d:0x405,_0x187dc6:0x1b,_0x18e5f8:0x20,_0x1acdf1:0x4ac,_0x14e59f:0x654,_0x255799:0x3b8,_0xf8e86f:0x1ed,_0x347870:0xeb,_0x180a02:0x11d,_0x234c04:0x229,_0xbc1bf8:0x5e2,_0x430276:0x89d,_0xc32cfa:0x656,_0x47e8ac:0x3a6,_0x259e2a:0x366,_0x71db14:0x1cc,_0x17350a:0x55f,_0x4bc4aa:0x380,_0xe4742a:0x656,_0x4c6f64:0x1c5,_0x588312:0x5a3,_0x3efa84:0x38b,_0x854d88:0x7de,_0x2559a4:0x9f0,_0x2b7121:0x876,_0x327817:0x792,_0x3a4995:0x169,_0x24740a:0x229,_0x2b251b:0x652,_0x3e8611:0x61c,_0x25447d:0x1ff,_0xdfadb4:0x253,_0x3dc4e2:0x466,_0x1a990f:0x8a9,_0x206695:0x788,_0x89591a:0x9de,_0x624fef:0x824,_0x40e49c:0x52c},_0x53adca={_0x3fffaa:0x750,_0x1a8618:0x581},_0xad659a={_0x20749e:0x349},_0x5567e1={_0x1fd91d:0x9ab},_0x7d498d={_0x1e4908:0x585,_0x28d810:0x376,_0x5d94d4:0x552,_0x4d26cb:0x7cd,_0x10738e:0x61e,_0xa6fcc6:0x6ec,_0x5e60ed:0x8e2,_0xd7dc57:0x8c1,_0x1b41f3:0x49a,_0x15b6be:0x362,_0x62ee71:0x634,_0x5104f5:0x62e,_0x1b3b22:0x5ff,_0x4d3f7d:0x6d2,_0x52c41b:0x682,_0x2900df:0x8ac,_0xd1860a:0x8ae,_0x584b24:0x5bf,_0x34f5ae:0x474,_0x21bae5:0x881,_0x353a92:0x83d,_0x562c7c:0xac3,_0x249682:0x5e8,_0x420048:0x604,_0x20b513:0x907,_0x2d3df5:0x28a,_0x2d490a:0x7e4,_0x55bab9:0x8bd,_0x3f6192:0x97a,_0x32e955:0x3ef,_0x50fa29:0x581},_0x504eb7={_0x5614e9:0x18e},_0x5c847d={};_0x5c847d[_0xd67f1c(0x20d,0x28e)]=function(_0x284a11,_0x4e9d9c){return _0x284a11===_0x4e9d9c;},_0x5c847d[_0xd67f1c(0x734,_0x541155._0x39e109)]=_0x2b83fe(0x1f1,0x287);const _0x960686=_0x5c847d;function _0xd67f1c(_0x2c4764,_0x46302a){return _0x341e52(_0x2c4764- -0x189,_0x46302a);}if(this[_0x2b83fe(_0x541155._0x4a5a55,0x6cd)]||!this[_0x2b83fe(0x247,_0x541155._0x539f36)+_0xd67f1c(_0x541155._0x5a73b5,0x5b7)]()||this[_0xd67f1c(0x5b8,0x8b0)+_0xd67f1c(0x5c0,0x2cd)+'g']||this[_0xd67f1c(0x7af,_0x541155._0x3d9fab)+_0xd67f1c(_0x541155._0x31d546,_0x541155._0x40641b)]()||this['gatewayC'+_0xd67f1c(0x419,_0x541155._0x55c1b7)+_0x2b83fe(_0x541155._0x114b6a,0x46e)+_0x2b83fe(_0x541155._0x54ce3b,_0x541155._0x4b618d)])return;function _0x2b83fe(_0x38966f,_0x538d9d){return _0x341e52(_0x538d9d- -_0x504eb7._0x5614e9,_0x38966f);}this[_0xd67f1c(0x5b8,0x55f)+'onnectin'+'g']=!![],this[_0xd67f1c(_0x541155._0x22a1a1,0x4cc)](_0xd67f1c(_0x541155._0x2c4356,0x495)+_0x2b83fe(0x7bd,0x4d4)+_0x2b83fe(0x5f,0x283)+'l='+this[_0xd67f1c(_0x541155._0x2ae82c,_0x541155._0xcb10b3)][_0x2b83fe(_0x541155._0x81a0f,0x7b2)+'rl']);const _0x2db52f=this[_0x2b83fe(_0x541155._0x3cf08c,_0x541155._0x1fa30c)+_0x2b83fe(_0x541155._0x491f45,_0x541155._0x556681)](this[_0xd67f1c(_0x541155._0x2ae82c,0x2e0)]['gatewayU'+'rl']);this['gatewayS'+'ocket']=_0x2db52f,_0x2db52f[_0x2b83fe(0x4be,0x7bc)](_0x2b83fe(0x612,_0x541155._0x3760a1),()=>{function _0x41e619(_0x1d4185,_0x12d7f6){return _0xd67f1c(_0x12d7f6-0x2f4,_0x1d4185);}function _0x10cd7e(_0x5335ee,_0x1a4484){return _0xd67f1c(_0x5335ee-0x215,_0x1a4484);}if(this['stopped']||this[_0x10cd7e(_0x7d498d._0x1e4908,_0x7d498d._0x28d810)+_0x41e619(0x43d,_0x7d498d._0x5d94d4)]!==_0x2db52f){_0x2db52f['close']();return;}this[_0x10cd7e(_0x7d498d._0x4d26cb,_0x7d498d._0x10738e)+_0x41e619(_0x7d498d._0xa6fcc6,0x8b4)+'g']=![],this[_0x41e619(0x663,0x57b)+_0x41e619(_0x7d498d._0x5e60ed,_0x7d498d._0xd7dc57)+_0x10cd7e(_0x7d498d._0x1b41f3,_0x7d498d._0x15b6be)]=![],this[_0x41e619(_0x7d498d._0x62ee71,0x8ac)+_0x10cd7e(_0x7d498d._0x5104f5,0x515)+_0x10cd7e(0x688,_0x7d498d._0x1b3b22)+_0x10cd7e(0x7d7,_0x7d498d._0x4d3f7d)]=![],this[_0x41e619(_0x7d498d._0x52c41b,_0x7d498d._0x2900df)+_0x10cd7e(0x83d,0x990)+_0x10cd7e(_0x7d498d._0xd1860a,_0x7d498d._0x584b24)]=Date[_0x10cd7e(_0x7d498d._0x34f5ae,0x5d8)]();const _0x40961a={};_0x40961a[_0x10cd7e(0x7cd,_0x7d498d._0x21bae5)+_0x10cd7e(_0x7d498d._0x353a92,_0x7d498d._0x562c7c)]=!![],_0x40961a['lastErro'+'r']=null,this[_0x10cd7e(0x5fc,_0x7d498d._0x249682)+'apshot'](_0x40961a),this['log'](_0x10cd7e(0x682,0x530)+'connecte'+'d\x20sinceC'+_0x41e619(0x841,_0x7d498d._0x420048)+_0x10cd7e(0x992,_0x7d498d._0x20b513)+this[_0x10cd7e(0x595,_0x7d498d._0x2d3df5)+_0x10cd7e(_0x7d498d._0x2d490a,_0x7d498d._0x55bab9)](this['clientDe'+'mandStar'+_0x41e619(0x8b4,0x96a)])),this['flushPen'+_0x41e619(0xab1,_0x7d498d._0x3f6192)+_0x10cd7e(_0x7d498d._0x32e955,_0x7d498d._0x50fa29)+_0x10cd7e(0x665,_0x7d498d._0x1b41f3)]();}),_0x2db52f['on'](_0x960686['CupUJ'],(_0x48df10,_0x360a12)=>{const _0x218e22={_0x339895:0x2e4};function _0x1d0854(_0x42b6c1,_0x1f2e48){return _0xd67f1c(_0x1f2e48- -0xe6,_0x42b6c1);}function _0x118635(_0x428442,_0x21faf9){return _0xd67f1c(_0x21faf9-_0x218e22._0x339895,_0x428442);}this[_0x118635(_0x5567e1._0x1fd91d,0x974)+'tewayMes'+_0x118635(0x464,0x4d3)](_0x48df10,_0x360a12);}),_0x2db52f[_0xd67f1c(0x7c1,0x679)](_0x2b83fe(0x678,_0x541155._0x1f3fe4),_0x363a2f=>{function _0x5aeaea(_0x22c6b4,_0x52bf84){return _0xd67f1c(_0x22c6b4-_0xad659a._0x20749e,_0x52bf84);}function _0x285dc0(_0x1bec43,_0x402f41){return _0xd67f1c(_0x1bec43-0x202,_0x402f41);}this[_0x285dc0(_0x53adca._0x3fffaa,0x51e)](_0x5aeaea(0x7b6,_0x53adca._0x1a8618)+'error:\x20'+String(_0x363a2f));}),_0x2db52f['once'](_0x2b83fe(_0x541155._0x3d0807,_0x541155._0x448a89),(_0x585a6d,_0xf0d626)=>{const _0x3755c0=summarizePendingGatewayMessages(this[_0x19083b(0xa03,_0x160845._0x345897)+_0x19083b(0x6bf,_0x160845._0x1fe0e3)+_0x19083b(0x82c,0x998)])['connectR'+_0x19083b(_0x160845._0x29461b,_0x160845._0x396b14)];function _0x19083b(_0x14736d,_0x1bb8ad){return _0xd67f1c(_0x14736d-0x244,_0x1bb8ad);}const _0x537484=this['gatewayC'+_0x55c23a(0xe6,0x1d5)+_0x19083b(_0x160845._0x16cc34,_0x160845._0x10dc8f)+_0x19083b(_0x160845._0x4325e6,0x54d)]&&shouldKeepGatewayConnected(this[_0x55c23a(0x648,0x3b8)][_0x55c23a(-0x4e,0x2be)+_0x55c23a(0x97,_0x160845._0xc687b)],_0x3755c0);this[_0x55c23a(-_0x160845._0xd596f9,0x12c)+_0x55c23a(-0x4a,0x1a)]===_0x2db52f&&(this[_0x19083b(0x5b4,0x2c5)+_0x19083b(0x4a2,0x307)]=null);this[_0x19083b(0x7fc,0x746)+_0x55c23a(_0x160845._0x427183,0x37c)+'g']=![],this[_0x19083b(0x4cb,0x769)+_0x55c23a(0x257,0x389)+'Started']=![],this[_0x19083b(0x7fc,0x8bc)+_0x55c23a(_0x160845._0x283355,0x1d5)+'daryPend'+_0x19083b(_0x160845._0x4325e6,_0x160845._0x22906b)]=![];function _0x55c23a(_0xe472c3,_0x220f69){return _0xd67f1c(_0x220f69- -0x244,_0xe472c3);}this[_0x19083b(_0x160845._0x2cd677,_0x160845._0x34ae99)+_0x19083b(0x86c,_0x160845._0x454039)+_0x55c23a(0x34f,_0x160845._0x4bb39b)]=null,this[_0x55c23a(0x22c,_0x160845._0x2be41c)+_0x55c23a(_0x160845._0x4c7c8d,0x2b3)+_0x55c23a(0x260,-_0x160845._0x187dc6)+_0x55c23a(_0x160845._0x18e5f8,0x25e)](_0x55c23a(_0x160845._0x1acdf1,0x229)+_0x19083b(_0x160845._0x14e59f,0x7d9)+_0x55c23a(0x193,0x380)+'e='+_0x585a6d),this['updateSn'+'apshot']({'gatewayConnected':![],'lastError':_0x960686['SmSDG'](_0x585a6d,0x3e8)||_0x537484?this[_0x55c23a(0x662,_0x160845._0x255799)][_0x55c23a(-_0x160845._0xf8e86f,_0x160845._0x347870)+'r']:_0x55c23a(_0x160845._0x180a02,_0x160845._0x234c04)+_0x19083b(_0x160845._0xbc1bf8,_0x160845._0x430276)+(_0xf0d626[_0x19083b(_0x160845._0xc32cfa,_0x160845._0x47e8ac)]()||_0x585a6d)}),this['log'](_0x55c23a(0xdc,0x229)+_0x55c23a(_0x160845._0x259e2a,_0x160845._0x71db14)+_0x55c23a(_0x160845._0x17350a,_0x160845._0x4bc4aa)+'e='+_0x585a6d+_0x55c23a(0x1ee,0x4c9)+(_0xf0d626[_0x19083b(_0x160845._0xe4742a,0x870)]()||_0x55c23a(0x512,0x438))+(_0x55c23a(-0x2a,_0x160845._0x4c6f64)+_0x19083b(0x42d,_0x160845._0x588312)+_0x55c23a(0x366,0x166))+this['elapsedS'+_0x55c23a(0x57f,_0x160845._0x3efa84)](this[_0x19083b(_0x160845._0x854d88,_0x160845._0x2559a4)+_0x19083b(_0x160845._0x2b7121,0x5dd)+'tedAtMs']));if(_0x537484){this[_0x19083b(_0x160845._0x327817,0x9d6)](_0x55c23a(_0x160845._0x3a4995,_0x160845._0x24740a)+_0x19083b(0x54f,0x6af)+'undary\x20r'+_0x19083b(0x910,0x673)+_0x19083b(_0x160845._0x2b251b,_0x160845._0x3e8611)+'ting\x20for'+'\x20fresh\x20d'+_0x55c23a(_0x160845._0x25447d,_0x160845._0xdfadb4)),this[_0x19083b(_0x160845._0x3dc4e2,0x4f6)+_0x19083b(_0x160845._0x1a990f,_0x160845._0x206695)+_0x19083b(0x901,_0x160845._0x89591a)]();return;}this['schedule'+_0x19083b(_0x160845._0x624fef,_0x160845._0x40e49c)+'econnect']();});}[_0x35d151(0x30e,0x59d)+_0x341e52(0x7b8,0x563)+'sage'](_0x3c68d7,_0x397242){const _0x5508de={_0x373be4:0x305,_0x30434c:0x741,_0x37367f:0x314,_0x56dfd2:0x79b,_0x13261c:0x7b3,_0x470108:0x1b,_0x13dd97:0x587,_0x4254fb:0x784,_0xcbc8d2:0x289,_0x29f49b:0x3f8,_0x567ad5:0x3af,_0x1649ae:0x3e5},_0x4df1cd={_0x27609e:0xae};function _0x24786e(_0x56e9ed,_0x369d9d){return _0x341e52(_0x56e9ed- -_0x4df1cd._0x27609e,_0x369d9d);}const _0x2050bb={'MjDvw':function(_0x2fd7a6,_0x29aba0){return _0x2fd7a6!==_0x29aba0;},'XiCyg':function(_0x1dd5df,_0x1c2d8d){return _0x1dd5df(_0x1c2d8d);},'GXTNo':function(_0x5f0370,_0x38dc7d){return _0x5f0370==_0x38dc7d;}};function _0x2a1547(_0x43e1c0,_0x3cc0dc){return _0x341e52(_0x43e1c0- -0x31f,_0x3cc0dc);}const _0x5d8f34=this[_0x2a1547(0x554,0x6f7)+_0x2a1547(_0x5508de._0x373be4,0x5c5)];if(!_0x5d8f34||_0x2050bb['MjDvw'](_0x5d8f34[_0x2a1547(0x3e2,0x663)+'te'],_0x42d174[_0x24786e(0x7e6,_0x5508de._0x30434c)]))return;if(_0x397242){_0x5d8f34[_0x2a1547(_0x5508de._0x37367f,0x192)](_0x2050bb[_0x24786e(_0x5508de._0x56dfd2,_0x5508de._0x13261c)](normalizeBinary,_0x3c68d7));return;}const _0x4436a7=normalizeText(_0x3c68d7);if(_0x2050bb[_0x2a1547(0xfc,-_0x5508de._0x470108)](_0x4436a7,null))return;const _0xd87fb1=parsePairingRequestFromError(_0x4436a7);_0xd87fb1&&this[_0x2a1547(0x4ae,_0x5508de._0x13dd97)+_0x24786e(0x2ce,0x3be)+_0x24786e(0x8bc,_0x5508de._0x4254fb)](_0xd87fb1);const _0x2b1023=parsePairResolvedEvent(_0x4436a7);_0x2b1023&&this[_0x2a1547(_0x5508de._0xcbc8d2,0x38b)+_0x24786e(0x7f6,0xa04)+'esolved'](_0x2b1023['requestI'+'d'],_0x2b1023[_0x2a1547(0x636,0x419)]);const _0x37fe16=parseResponseEnvelopeMeta(_0x4436a7);_0x37fe16&&this[_0x24786e(_0x5508de._0x29f49b,0x312)+_0x2a1547(0x341,_0x5508de._0x567ad5)+_0x2a1547(0x15f,_0x5508de._0x1649ae)](_0x37fe16),_0x5d8f34[_0x2a1547(0x314,0xe5)](_0x4436a7);}[_0x341e52(0x4c8,0x4bc)+_0x341e52(0x80f,0x891)+_0x341e52(0x363,0x55c)+'ges'](){const _0x5e6e71={_0x3eaa67:0x40f,_0x22f870:0x47c,_0x416bdd:0x1a8,_0x497aa4:0x485,_0x600e8c:0x32d,_0x3159f8:0x806,_0x5be9e9:0xab8,_0x1272b5:0x132,_0x109e38:0x76c,_0xc553c7:0x577,_0x107e74:0x670,_0x323d90:0x34f,_0x482187:0x166,_0x4afec7:0xc2,_0x4216ff:0x8be,_0x46838f:0x83a,_0x3efafa:0x2c,_0x4d92e4:0x75e,_0x2631b8:0x2c2,_0x2c4fec:0x3e2,_0x1f2c23:0x157,_0xb35a83:0xa71,_0x2397e2:0x4f7,_0x10d483:0x3cd,_0x1ccd42:0x33c,_0x2a659c:0x202,_0x2418e5:0x10,_0x3ee908:0x1ef,_0x2542d9:0x3d4,_0x4c3809:0x545,_0x300c71:0x9dd,_0x337c11:0xa83,_0x483f7d:0x732},_0x26490f={_0x114844:0x567};function _0x4cc9a2(_0x5e53d1,_0x3c5047){return _0x341e52(_0x3c5047- -_0x26490f._0x114844,_0x5e53d1);}const _0x1adfe4={'eFMgq':_0x4c613d(0x50d,_0x5e6e71._0x3eaa67),'hhMDR':function(_0x21b515,_0x575515){return _0x21b515(_0x575515);}},_0x285220=this[_0x4cc9a2(0x1a3,-0x6e)+_0x4c613d(_0x5e6e71._0x22f870,_0x5e6e71._0x416bdd)];if(!_0x285220||_0x285220[_0x4c613d(0x796,0x6e8)+'te']!==_0x42d174[_0x4cc9a2(_0x5e6e71._0x497aa4,_0x5e6e71._0x600e8c)])return;const _0x1d14f5=[],_0x12512a=dedupePendingGatewayMessages(this['pendingG'+'atewayMe'+_0x4c613d(_0x5e6e71._0x3159f8,_0x5e6e71._0x5be9e9)]);_0x12512a[_0x4cc9a2(0x387,_0x5e6e71._0x1272b5)]>0x0&&this[_0x4c613d(_0x5e6e71._0x109e38,0x545)](_0x4c613d(_0x5e6e71._0xc553c7,_0x5e6e71._0x107e74)+_0x4cc9a2(0x2de,0x199)+_0x4cc9a2(0x58f,_0x5e6e71._0x323d90)+_0x4cc9a2(0x34d,0x5c)+'sages\x20be'+_0x4cc9a2(0x2c9,0xac)+_0x4c613d(0x6e1,0x937)+_0x4cc9a2(_0x5e6e71._0x482187,-_0x5e6e71._0x4afec7)+_0x12512a['dropped']+'\x20kept='+_0x12512a[_0x4c613d(_0x5e6e71._0x4216ff,_0x5e6e71._0x46838f)][_0x4cc9a2(_0x5e6e71._0x3efafa,0x302)]);this['pendingG'+_0x4cc9a2(0x21d,0x9d)+_0x4c613d(0x806,_0x5e6e71._0x4d92e4)]=[];for(const _0x167df1 of _0x12512a[_0x4cc9a2(0x56a,_0x5e6e71._0x2631b8)]){if(!this[_0x4cc9a2(-_0x5e6e71._0x2c4fec,-_0x5e6e71._0x1f2c23)+_0x4c613d(0x7eb,_0x5e6e71._0xb35a83)+_0x4c613d(0x4a3,_0x5e6e71._0x2397e2)]){if(_0x167df1[_0x4cc9a2(0x3cf,_0x5e6e71._0x10d483)]!==_0x1adfe4['eFMgq']||!_0x1adfe4[_0x4cc9a2(-_0x5e6e71._0x1ccd42,-_0x5e6e71._0x2a659c)](isConnectHandshakeRequest,_0x167df1['text'])){_0x1d14f5[_0x4cc9a2(0x11e,0x33a)](_0x167df1);continue;}this['gatewayH'+_0x4cc9a2(_0x5e6e71._0x2418e5,_0x5e6e71._0x3ee908)+_0x4c613d(0x4a3,0x452)]=!![];}this[_0x4cc9a2(_0x5e6e71._0x2542d9,0x111)+_0x4c613d(_0x5e6e71._0x4c3809,0x55f)](_0x167df1);}function _0x4c613d(_0x452824,_0x4ccd95){return _0x341e52(_0x452824-0x95,_0x4ccd95);}this[_0x4c613d(_0x5e6e71._0x300c71,_0x5e6e71._0x337c11)+'atewayMe'+_0x4c613d(_0x5e6e71._0x3159f8,_0x5e6e71._0x483f7d)]=_0x1d14f5;}['sendToGa'+'teway'](_0x526dd5){const _0x5960c8={_0x4818be:0x2ae,_0x46e5bf:0x9c0,_0x4c9cb8:0x2d8,_0x1f1076:0x275,_0x3f1542:0x693,_0x2a43b7:0x553,_0x43672c:0x91c,_0x5adf58:0x931,_0xabfe9c:0x1e5,_0x5ddca8:0x12f,_0x2acaf5:0x803,_0x256e7b:0x820,_0x49c751:0x722,_0x57d212:0x78e,_0x2e81cf:0xa2e,_0x531619:0xb93,_0x1b12f6:0x803,_0x71ea4e:0x3f3,_0x59d573:0x3c5,_0x5cfb27:0x67a,_0x2b939f:0x4f5,_0x14bc54:0x141,_0x27c1dd:0x96d,_0x358e96:0x726,_0x2c8be9:0x75f,_0x28555d:0xa48,_0x40b676:0x2c8,_0x27f2e6:0x28},_0x56ebe5={'soApn':function(_0x4c56de,_0x120ea2){return _0x4c56de!==_0x120ea2;},'MpJFz':function(_0x5cc498,_0x327941){return _0x5cc498(_0x327941);}},_0x24818e=this[_0x4d1c43(0x625,0x778)+_0x4d1c43(0x513,_0x5960c8._0x4818be)];function _0x4d1c43(_0x34e9b5,_0x2ff782){return _0x341e52(_0x34e9b5-0x12c,_0x2ff782);}if(!_0x24818e||_0x56ebe5[_0x4ded53(0x1fa,0xb9)](_0x24818e['readySta'+'te'],_0x42d174[_0x4d1c43(_0x5960c8._0x46e5bf,0x6ca)])){this[_0x4d1c43(0x4a7,_0x5960c8._0x4c9cb8)+_0x4ded53(0x2e8,0x97)+'ayMessag'+'e'](_0x526dd5);return;}function _0x4ded53(_0x2a0687,_0x8e9d41){return _0x341e52(_0x2a0687- -0x203,_0x8e9d41);}if(_0x526dd5[_0x4ded53(0x731,0x621)]===_0x4ded53(0x275,0x91)){const _0x74caca=patchConnectRequestGatewayAuth(_0x526dd5[_0x4ded53(_0x5960c8._0x1f1076,0x2f7)],readOpenClawInfo()),_0x1a8cc8=_0x56ebe5['MpJFz'](parseConnectHandshakeMeta,_0x74caca['text']);_0x1a8cc8&&(_0x1a8cc8['id']&&this[_0x4d1c43(_0x5960c8._0x3f1542,0x668)+'ConnectH'+_0x4ded53(_0x5960c8._0x2a43b7,0x3c3)+'s'][_0x4d1c43(0x807,0x68b)](_0x1a8cc8['id'],{'method':_0x1a8cc8[_0x4d1c43(_0x5960c8._0x43672c,_0x5960c8._0x5adf58)],'startedAtMs':Date[_0x4ded53(_0x5960c8._0xabfe9c,_0x5960c8._0x5ddca8)](),'slowWarningLogged':![]}),this[_0x4d1c43(_0x5960c8._0x2acaf5,_0x5960c8._0x256e7b)](_0x4d1c43(_0x5960c8._0x49c751,0x8bb)+_0x4d1c43(_0x5960c8._0x57d212,0x581)+_0x4d1c43(_0x5960c8._0x2e81cf,_0x5960c8._0x531619)+_0x4d1c43(0x485,0x5bd)+'d'+formatConnectHandshakeMetaForLog(_0x1a8cc8)));_0x74caca['injected']&&this[_0x4d1c43(_0x5960c8._0x1b12f6,0x80a)](_0x4ded53(_0x5960c8._0x71ea4e,_0x5960c8._0x59d573)+'connect\x20'+_0x4d1c43(_0x5960c8._0x5cfb27,_0x5960c8._0x2b939f)+_0x4ded53(0x292,_0x5960c8._0x14bc54)+_0x4d1c43(_0x5960c8._0x27c1dd,_0x5960c8._0x358e96)+'rd');_0x24818e['send'](_0x74caca['text']);return;}_0x24818e[_0x4d1c43(_0x5960c8._0x2c8be9,_0x5960c8._0x28555d)](_0x526dd5[_0x4ded53(_0x5960c8._0x40b676,-_0x5960c8._0x27f2e6)]);}[_0x35d151(0x45b,0x59c)+_0x341e52(0x8c5,0x75c)+'st'](_0x30a601,_0x5edb5e){const _0x1ddf7f={_0x47e0b6:0x4d4,_0xd415c:0x4f8,_0x136b1b:0x32a,_0x109da3:0x9db,_0x562823:0x490,_0x45b669:0x822,_0x2fbc0a:0x514,_0xd71e4:0x4ab},_0x494c41={_0x3ee46b:0xe9},_0x5234ed=JSON[_0x58d071(_0x1ddf7f._0x47e0b6,0x711)+'y']({'type':_0xb2c6fe(_0x1ddf7f._0xd415c,0x68b),'id':_0x58d071(_0x1ddf7f._0x136b1b,0x7b)+_0x579fc8(),'method':_0x30a601,'params':_0x5edb5e}),_0x2dd505={};function _0xb2c6fe(_0x40c69a,_0x586cc1){return _0x341e52(_0x40c69a-_0x494c41._0x3ee46b,_0x586cc1);}_0x2dd505[_0xb2c6fe(0xa1d,_0x1ddf7f._0x109da3)]=_0xb2c6fe(0x561,_0x1ddf7f._0x562823),_0x2dd505['text']=_0x5234ed;function _0x58d071(_0x35e237,_0x9727df){return _0x341e52(_0x35e237- -0x2a4,_0x9727df);}this[_0xb2c6fe(0x601,_0x1ddf7f._0x45b669)+'rQueueGa'+_0x58d071(_0x1ddf7f._0x2fbc0a,_0x1ddf7f._0xd71e4)+_0x58d071(0xd4,-0x21c)](_0x2dd505);}['sendRela'+_0x341e52(0x736,0x910)](_0x5d7f3a){const _0x467546={_0x1a2a48:0x425,_0x3a2f55:0x553,_0x33308a:0x3a,_0x42b097:0x301,_0x25f0a4:0x497,_0xc29410:0x35b,_0x5bea46:0x2d3,_0x4f9bc9:0xeb,_0x522a76:0x2fc,_0x4aac9f:0x89,_0x4c9170:0x4dc},_0x31bb66=this['relaySoc'+'ket'];function _0x4c4fdc(_0xadc5ae,_0x5a3a4a){return _0x341e52(_0x5a3a4a- -0x341,_0xadc5ae);}if(!_0x31bb66||_0x31bb66[_0x3df0c3(0x284,_0x467546._0x1a2a48)+'te']!==_0x42d174[_0x4c4fdc(0x343,_0x467546._0x3a2f55)])return;const _0x4d8aa5={};_0x4d8aa5['type']='control',_0x4d8aa5['event']=_0x5d7f3a[_0x3df0c3(-_0x467546._0x33308a,-0x240)];function _0x3df0c3(_0x5df353,_0x7e155c){return _0x341e52(_0x5df353- -0x47d,_0x7e155c);}_0x4d8aa5[_0x4c4fdc(0x65c,0x379)+'d']=_0x5d7f3a[_0x4c4fdc(0x646,0x379)+'d'],_0x4d8aa5[_0x4c4fdc(0x4d9,_0x467546._0x42b097)+_0x4c4fdc(0x26b,_0x467546._0x25f0a4)]=_0x5d7f3a['targetCl'+_0x3df0c3(_0x467546._0xc29410,_0x467546._0x5bea46)],_0x4d8aa5[_0x3df0c3(-_0x467546._0x4f9bc9,-_0x467546._0x522a76)]=_0x5d7f3a['payload'],_0x31bb66[_0x4c4fdc(0xe3,0x2f2)](_0x3df0c3(_0x467546._0x4aac9f,-0xe4)+_0x3df0c3(-0x85,-0x138)+_0x4c4fdc(_0x467546._0x4c9170,0x52e)+'_:'+JSON['stringif'+'y'](_0x4d8aa5));}[_0x341e52(0x68f,0x781)+_0x35d151(0xe4,0x34f)](_0xda2d4=![]){const _0x5b218f={_0x50ee5f:0x36f,_0x31da42:0x866,_0x567533:0x56,_0x20296d:0x288,_0x9a9e95:0x39f,_0x3de1a8:0x6cb,_0x260758:0x609,_0x171552:0x8de,_0x428d5d:0x5fb,_0x38ddc9:0x36b,_0x4c47b7:0x72b,_0x5c3c27:0x78a,_0x4c5d31:0x4fe,_0x3b5e1e:0x248,_0x4a57f7:0x2e,_0x2bb941:0x30,_0x26efa6:0x395,_0xe98383:0x373,_0x58d40b:0x3e4,_0x510344:0x802,_0x453e4e:0x5a7,_0x4ec387:0x1be,_0xb20428:0x809,_0x4bf013:0x750,_0x5bce89:0x303,_0x557c94:0x3b0,_0x4ec820:0xafa,_0x21ec8b:0x84b,_0x29073b:0x35,_0xba2b68:0x2ac,_0x2b05d4:0xd5,_0x255320:0x616,_0x435ade:0x30d,_0xb3ac02:0x8c4,_0x425019:0x706,_0x1b2999:0x3b,_0x5273f2:0x807,_0x4d102c:0x6f5,_0x56e400:0x298,_0x410d96:0x57,_0x2570a0:0x36a,_0x12a4ab:0x4fe,_0x513d50:0x58d,_0x2c78de:0x3ec,_0xbf11df:0x6c,_0x5e1eea:0x164,_0x45cc73:0x601,_0x48c2fa:0x8f2,_0x569558:0x750,_0x939e28:0x596,_0x2ede92:0x5bd,_0xa97dbe:0x30b,_0x47541f:0x33f,_0x177692:0x408,_0x10ebb8:0x164,_0x50489d:0x5a4,_0x35d477:0x6b5},_0xaf08cd={_0x2089d9:0x1c2},_0x406dd9={'bxWIq':function(_0x321d6,_0x3e5b26){return _0x321d6(_0x3e5b26);},'plvsA':function(_0x4eac57,_0x5e4ccc){return _0x4eac57===_0x5e4ccc;},'BbCAa':function(_0x354c9a,_0x3fff10){return _0x354c9a===_0x3fff10;}};this[_0x1833e1(_0x5b218f._0x50ee5f,0x39f)+'etryTime'+'r']&&(clearTimeout(this[_0x5eb43c(_0x5b218f._0x31da42,0x7e2)+_0x1833e1(-_0x5b218f._0x567533,_0x5b218f._0x20296d)+'r']),this[_0x1833e1(0x245,_0x5b218f._0x9a9e95)+_0x5eb43c(0x6c3,_0x5b218f._0x3de1a8)+'r']=null);const _0x32796b=_0x406dd9['bxWIq'](summarizePendingGatewayMessages,this[_0x1833e1(0x205,0x50a)+_0x5eb43c(0x330,_0x5b218f._0x260758)+_0x5eb43c(_0x5b218f._0x171552,0x776)])[_0x1833e1(0x337,0x445)+_0x5eb43c(_0x5b218f._0x428d5d,0x901)],_0x571a60=_0xda2d4&&this[_0x5eb43c(0x2c1,_0x5b218f._0x38ddc9)+'pen']()&&shouldKeepGatewayConnected(this[_0x5eb43c(_0x5b218f._0x4c47b7,_0x5b218f._0x5c3c27)]['clientCo'+'unt'],_0x32796b),_0x589b6c=this[_0x5eb43c(0x6c7,_0x5b218f._0x4c5d31)+_0x5eb43c(0x255,0x3ec)];this[_0x1833e1(_0x5b218f._0x3b5e1e,-_0x5b218f._0x4a57f7)+'andshake'+_0x1833e1(-0x4e,-_0x5b218f._0x2bb941)]=![],this['gatewayC'+_0x1833e1(_0x5b218f._0x26efa6,_0x5b218f._0xe98383)+_0x1833e1(0x4d7,_0x5b218f._0x58d40b)]=null;function _0x1833e1(_0xc1b16d,_0x5d3a25){return _0x35d151(_0xc1b16d,_0x5d3a25- -_0xaf08cd._0x2089d9);}if(!_0x589b6c){this[_0x5eb43c(_0x5b218f._0x510344,0x746)+_0x5eb43c(0x754,_0x5b218f._0x453e4e)+_0x1833e1(0x284,_0x5b218f._0x4ec387)+_0x5eb43c(_0x5b218f._0xb20428,_0x5b218f._0x4bf013)]=![],this[_0x1833e1(0x2f9,_0x5b218f._0x5bce89)+'onnectin'+'g']=![];_0x571a60&&this['ensureGa'+_0x1833e1(0x680,_0x5b218f._0x557c94)+_0x5eb43c(_0x5b218f._0x4ec820,_0x5b218f._0x21ec8b)]();return;}if(_0x406dd9['plvsA'](_0x589b6c[_0x1833e1(0x26a,0x2c3)+'te'],_0x42d174[_0x1833e1(-0x24a,-_0x5b218f._0x29073b)])){this['gatewayC'+_0x1833e1(_0x5b218f._0xba2b68,0x164)+_0x1833e1(-_0x5b218f._0x2b05d4,0x1be)+_0x1833e1(_0x5b218f._0x255320,_0x5b218f._0x435ade)]=_0x571a60;return;}if(_0x589b6c[_0x5eb43c(_0x5b218f._0xb3ac02,_0x5b218f._0x425019)+'te']===_0x42d174[_0x1833e1(0x277,-_0x5b218f._0x1b2999)]){_0x406dd9[_0x5eb43c(0xabc,_0x5b218f._0x5273f2)](this[_0x5eb43c(_0x5b218f._0x4d102c,_0x5b218f._0x4c5d31)+_0x1833e1(-_0x5b218f._0x56e400,-_0x5b218f._0x410d96)],_0x589b6c)&&(this[_0x5eb43c(_0x5b218f._0x2570a0,_0x5b218f._0x12a4ab)+_0x5eb43c(_0x5b218f._0x513d50,_0x5b218f._0x2c78de)]=null);this['gatewayC'+_0x1833e1(_0x5b218f._0xbf11df,_0x5b218f._0x5e1eea)+_0x5eb43c(0x431,_0x5b218f._0x45cc73)+_0x5eb43c(_0x5b218f._0x48c2fa,_0x5b218f._0x569558)]=![],this[_0x5eb43c(_0x5b218f._0x939e28,0x746)+_0x1833e1(_0x5b218f._0x2ede92,_0x5b218f._0xa97dbe)+'g']=![];_0x571a60&&this[_0x5eb43c(0x2b7,0x3b0)+'tewayCon'+_0x1833e1(_0x5b218f._0x47541f,_0x5b218f._0x177692)]();return;}this['gatewayC'+_0x1833e1(0x331,_0x5b218f._0x10ebb8)+'daryPend'+_0x1833e1(_0x5b218f._0x50489d,0x30d)]=_0x571a60;function _0x5eb43c(_0x7f35e8,_0x3e3279){return _0x35d151(_0x7f35e8,_0x3e3279-0x281);}_0x589b6c[_0x1833e1(_0x5b218f._0x35d477,0x427)]();}[_0x341e52(0x54d,0x449)+_0x35d151(0x2d7,0x3c7)](_0x124be2){const _0x56965c={_0x3660e2:0x41f,_0x4a79c6:0x4ad,_0x3052cd:0x43,_0x41a2d5:0x78b},_0x374af4={_0xe7e8e3:0x2ad};function _0x52c9f3(_0x369293,_0x28cc6c){return _0x35d151(_0x369293,_0x28cc6c-0xb6);}function _0x5e9c4c(_0x21da37,_0x32ed11){return _0x35d151(_0x21da37,_0x32ed11- -_0x374af4._0xe7e8e3);}if(this['options'][_0x52c9f3(0x347,0x387)+_0x52c9f3(_0x56965c._0x3660e2,0x47d)])return this[_0x52c9f3(_0x56965c._0x4a79c6,0x4a7)]['createWe'+_0x5e9c4c(-_0x56965c._0x3052cd,0x11a)](_0x124be2);const _0xbef669={};return _0xbef669[_0x52c9f3(_0x56965c._0x41a2d5,0x716)+'ad']=0x19*0x400*0x400,new _0x42d174(_0x124be2,_0xbef669);}['observeG'+'atewayRe'+'sponse'](_0x2dedf0){const _0x5ed406={_0x17fe4c:0xee,_0x361d75:0x371,_0x1cf54c:0x58c,_0x11d226:0x478,_0x3b6a55:0x5fe,_0x45a923:0x8e8,_0x56ca30:0x77b,_0x4c4b37:0x1e5,_0x3cd9e2:0x1cb,_0x41dbf8:0xde,_0xf12077:0x357,_0x5e469a:0x756,_0x11398b:0x3fb,_0x8c2334:0x387,_0x43f2f4:0xa8a,_0x2da281:0x95b,_0x14b6f0:0x61b,_0x2de90b:0xb2,_0x2865eb:0x7b8,_0x52fe4d:0x705,_0x2b1456:0x101,_0x5eba78:0x25b,_0x38ec65:0x2b6,_0x26b8bf:0x1c8,_0x49c1c5:0xe5,_0x54b6cc:0x58,_0x172839:0x7c5},_0x4df63b={_0x33e8ad:0x2a1},_0x12a3cf={};_0x12a3cf[_0x39f996(0x386,_0x5ed406._0x17fe4c)]='<none>';const _0x53d622=_0x12a3cf,_0x69497=this[_0xc8ed00(_0x5ed406._0x361d75,_0x5ed406._0x1cf54c)+_0xc8ed00(0x3d1,_0x5ed406._0x11d226)+_0xc8ed00(0x725,0x77b)+'s'][_0xc8ed00(_0x5ed406._0x3b6a55,_0x5ed406._0x45a923)](_0x2dedf0['id']);if(!_0x69497)return;this['inFlight'+_0xc8ed00(0x4d7,_0x5ed406._0x11d226)+_0xc8ed00(0x874,_0x5ed406._0x56ca30)+'s'][_0x39f996(_0x5ed406._0x4c4b37,_0x5ed406._0x3cd9e2)](_0x2dedf0['id']);function _0xc8ed00(_0x250635,_0xae54e7){return _0x35d151(_0x250635,_0xae54e7-_0x4df63b._0x33e8ad);}function _0x39f996(_0x1a4082,_0x16300e){return _0x35d151(_0x16300e,_0x1a4082- -0x334);}const _0x5efbb2=_0x2dedf0['ok']?'ok=true':'ok=false'+_0x39f996(_0x5ed406._0x41dbf8,-0x17f)+_0x39f996(_0x5ed406._0xf12077,0x2f6)+(_0x2dedf0[_0xc8ed00(0x763,_0x5ed406._0x5e469a)+'e']??_0xc8ed00(0xaab,0x82a))+(_0x39f996(0x2e9,_0x5ed406._0x11398b)+_0xc8ed00(0x59d,0x74b))+(_0x2dedf0['errorMes'+_0xc8ed00(_0x5ed406._0x8c2334,0x39d)]??_0x53d622[_0xc8ed00(_0x5ed406._0x43f2f4,_0x5ed406._0x2da281)]);this[_0x39f996(0x127,0x38)](_0xc8ed00(0x47a,_0x5ed406._0x14b6f0)+_0x39f996(_0x5ed406._0x2de90b,0x138)+_0xc8ed00(_0x5ed406._0x2865eb,_0x5ed406._0x52fe4d)+_0x39f996(0x110,-_0x5ed406._0x2b1456)+_0x2dedf0['id']+_0xc8ed00(0x2dd,0x520)+_0x69497['method']+(_0x39f996(-_0x5ed406._0x5eba78,-0x489)+_0x39f996(_0x5ed406._0x38ec65,0x1a9))+(Date[_0x39f996(-_0x5ed406._0x26b8bf,-0x4a0)]()-_0x69497[_0x39f996(_0x5ed406._0x49c1c5,-_0x5ed406._0x54b6cc)+_0xc8ed00(0x51f,_0x5ed406._0x172839)])+'\x20'+_0x5efbb2);}[_0x35d151(0x41,0x263)+_0x341e52(0x680,0x8fe)+_0x35d151(0x393,0x136)+_0x341e52(0x62b,0x8b1)](_0x48b045){const _0x201d16={_0xacb20:0x103,_0x1b0407:0xc6,_0x4d3204:0x20e,_0xe2c5b0:0x16a,_0x2a56e7:0xc7,_0x298e6a:0xab,_0x2a30ca:0x5db,_0x5bea7b:0x3b0,_0x1408cc:0x3cb,_0x2f44ec:0x234,_0x5a4fc0:0x38d,_0x346786:0x2ab},_0x400d70={_0x3b4ceb:0x1a0};function _0x9edaf1(_0x5b6410,_0xb4c227){return _0x35d151(_0xb4c227,_0x5b6410- -_0x400d70._0x3b4ceb);}function _0x41aec0(_0x95628f,_0x2281b7){return _0x35d151(_0x2281b7,_0x95628f- -0x10f);}const _0x4b6100={};_0x4b6100[_0x9edaf1(_0x201d16._0xacb20,-_0x201d16._0x1b0407)]=function(_0xf4401c,_0x31bb9c){return _0xf4401c===_0x31bb9c;};const _0x373d4=_0x4b6100;if(_0x373d4['qqsCj'](this['inFlight'+_0x41aec0(0xc8,-_0x201d16._0x4d3204)+_0x9edaf1(0x33a,0x1d6)+'s'][_0x9edaf1(_0x201d16._0xe2c5b0,-0xbf)],0x0))return;for(const [_0x589396,_0x646005]of this[_0x9edaf1(0x14b,0x192)+_0x41aec0(0xc8,-0x242)+_0x41aec0(0x3cb,0x456)+'s'][_0x9edaf1(0x5d,0x62)]()){this['log']('gateway\x20'+_0x9edaf1(0x246,0x36c)+_0x9edaf1(0x2c4,0xa9)+'\x20missing'+_0x41aec0(0x335,0x2d5)+_0x589396+'\x20method='+_0x646005['method']+(_0x9edaf1(-_0x201d16._0x2a56e7,_0x201d16._0x298e6a)+_0x41aec0(0x4db,_0x201d16._0x2a30ca))+(Date['now']()-_0x646005[_0x41aec0(0x30a,0x1b6)+'tMs'])+'\x20reason='+_0x48b045);}this[_0x9edaf1(0x14b,_0x201d16._0x5bea7b)+'ConnectH'+_0x41aec0(_0x201d16._0x1408cc,_0x201d16._0x2f44ec)+'s'][_0x41aec0(_0x201d16._0x5a4fc0,_0x201d16._0x346786)]();}[_0x35d151(0x3b8,0x59f)+_0x341e52(0x4a9,0x6b1)+_0x341e52(0x375,0x1d3)](){const _0x30f848={_0x2b4596:0x48a,_0x341d84:0x21,_0x14bcfc:0xb1,_0x2618f8:0x202,_0x1b14c8:0x12c,_0x58fabb:0x4dc,_0x2f1a6b:0x398,_0x294bea:0x5c0,_0x1a9c36:0x4e9,_0x5ec7ff:0x41d,_0x225804:0xf4,_0x8d1539:0x26c,_0x1f1a3d:0xa9,_0x504328:0x66,_0x4570ee:0x1f7,_0x5e3009:0x5a},_0x393ea0={_0x5c8dd1:0x12d,_0x5ad9d7:0x2c2},_0x4b65c2={_0x4fa300:0x224};if(this[_0x5c63e7(0x3f0,_0x30f848._0x2b4596)]||this['reconnec'+_0x5c63e7(_0x30f848._0x341d84,-0x1c9)])return;const _0x5b5565=this[_0x5c63e7(0x202,_0x30f848._0x14bcfc)]['reconnec'+'tBaseDel'+_0x5c63e7(0x1e8,-0xa)]??RECONNECT_BASE_DELAY_MS,_0x213bbe=this[_0x5c63e7(_0x30f848._0x2618f8,0x1fb)][_0x5c63e7(_0x30f848._0x1b14c8,0x3e6)+_0x5c63e7(_0x30f848._0x58fabb,_0x30f848._0x2f1a6b)+_0x213b6f(_0x30f848._0x294bea,_0x30f848._0x1a9c36)]??RECONNECT_MAX_DELAY_MS;function _0x5c63e7(_0x54a4d3,_0x310788){return _0x35d151(_0x310788,_0x54a4d3- -0x1ef);}function _0x213b6f(_0x5b2803,_0x5f2e3d){return _0x35d151(_0x5f2e3d,_0x5b2803-_0x4b65c2._0x4fa300);}const _0x222b0a=Math[_0x213b6f(_0x30f848._0x5ec7ff,0x1a8)](_0x213bbe,_0x5b5565*Math[_0x5c63e7(0x12b,_0x30f848._0x225804)](0x1,this[_0x5c63e7(0x8b,0x188)+_0x5c63e7(-0xb5,0x4)]));this[_0x5c63e7(_0x30f848._0x8d1539,0x39f)](_0x5c63e7(_0x30f848._0x1f1a3d,_0x30f848._0x504328)+_0x5c63e7(_0x30f848._0x4570ee,_0x30f848._0x5e3009)+'schedule'+'d\x20delayM'+'s='+_0x222b0a),this['reconnec'+_0x213b6f(0x434,0x390)]=setTimeout(()=>{function _0x385343(_0xbcdd28,_0x3fb026){return _0x5c63e7(_0xbcdd28-0x487,_0x3fb026);}function _0x385de2(_0xe632a6,_0x1e7f17){return _0x5c63e7(_0xe632a6-0x10c,_0x1e7f17);}this['reconnec'+_0x385de2(_0x393ea0._0x5c8dd1,_0x393ea0._0x5ad9d7)]=null,void this[_0x385de2(0x524,0x25e)+_0x385de2(0xa7,-0x1f6)]();},_0x222b0a);}[_0x35d151(0x596,0x59f)+_0x35d151(0x224,0x4ed)+'econnect'](){const _0x1a060f={_0x4f5b44:0x637,_0x43c92b:0x68b,_0x448db1:0x468,_0x4d44d2:0x79d,_0x69eeaa:0x787,_0x56c12e:0x63f,_0xffa78b:0x55f,_0x1b3b12:0x1ca,_0x13c4de:0x4c8,_0x5bf01d:0x641,_0x579a54:0x64b,_0x439148:0x4f4,_0x16a28f:0x4bf,_0x1837ff:0x54c,_0x4a2d12:0x52a,_0x38b049:0x6dd},_0x3f7a3e={_0x3c1a99:0x554,_0x250b95:0x6c4,_0x2f24c1:0x696,_0x5798af:0x7ec,_0xb32b13:0x8f1},_0x2a89ba={_0x2d9c6b:0x2c},_0x1c5964=summarizePendingGatewayMessages(this[_0x566914(_0x1a060f._0x4f5b44,_0x1a060f._0x43c92b)+_0x34d9cd(_0x1a060f._0x448db1,0x214)+_0x566914(0x46c,0x4b4)])[_0x566914(_0x1a060f._0x4d44d2,0x5c6)+_0x566914(_0x1a060f._0x69eeaa,_0x1a060f._0x56c12e)];if(this['stopped']||this['gatewayR'+_0x566914(_0x1a060f._0xffa78b,0x409)+'r']||!this[_0x34d9cd(_0x1a060f._0x1b3b12,0x1af)+_0x34d9cd(0x749,0x9ce)]()||!shouldKeepGatewayConnected(this[_0x566914(0x60b,_0x1a060f._0x13c4de)][_0x566914(0x2dd,0x3ce)+'unt'],_0x1c5964))return;const _0x8d0c54=this['options'][_0x34d9cd(_0x1a060f._0x5bf01d,_0x1a060f._0x579a54)+_0x34d9cd(_0x1a060f._0x439148,_0x1a060f._0x16a28f)+_0x566914(0x62d,0x35b)]??GATEWAY_RETRY_DELAY_MS;function _0x34d9cd(_0xd88f80,_0x162e40){return _0x35d151(_0x162e40,_0xd88f80-0xe0);}function _0x566914(_0x3a2c52,_0x2b6d1b){return _0x35d151(_0x3a2c52,_0x2b6d1b- -0x41);}this[_0x566914(_0x1a060f._0x1837ff,0x520)+_0x34d9cd(_0x1a060f._0x4a2d12,_0x1a060f._0x38b049)+'r']=setTimeout(()=>{function _0xd12999(_0x135562,_0x49fe15){return _0x34d9cd(_0x49fe15-_0x2a89ba._0x2d9c6b,_0x135562);}this['gatewayR'+_0x44a7cf(_0x3f7a3e._0x3c1a99,_0x3f7a3e._0x250b95)+'r']=null;function _0x44a7cf(_0x37b755,_0x332c86){return _0x34d9cd(_0x332c86-0x19a,_0x37b755);}this['ensureGa'+_0x44a7cf(_0x3f7a3e._0x2f24c1,_0x3f7a3e._0x5798af)+_0xd12999(_0x3f7a3e._0xb32b13,0x6d6)]();},_0x8d0c54);}['startHea'+_0x35d151(0x598,0x661)](){const _0x4e722a={_0x3de8ed:0x99d,_0x2f76f3:0x562,_0x524a8f:0x46c,_0x59d54b:0x637,_0x3c6be1:0x8fc},_0x309dd0={_0x229dbf:0x69f,_0x565c5c:0x450,_0x433490:0x4db,_0x328a39:0x51b,_0xd96def:0x320,_0x4d5432:0x368,_0x439ce5:0x1ce,_0x48513c:0x2bd,_0x75df93:0x4e8,_0x599f48:0x53a,_0x354a0d:0x360,_0x33e1c2:0x214,_0x607110:0x18a,_0x443794:0x148,_0x34af1c:0x369,_0x16660b:0x1ef,_0x18f889:0x203,_0x374ef7:0x24a,_0x27ab3c:0x1d3,_0x2ca371:0x5fb,_0x100ef5:0x26c,_0x17b0df:0x3ae,_0x58a174:0x613},_0x39c37c={_0xd4743c:0x30},_0x38a1c3={};_0x38a1c3[_0x4f3668(0x946,0x6ab)]=function(_0x1ad496,_0x103552){return _0x1ad496!==_0x103552;};function _0x4f3668(_0x35b4c1,_0x1b890f){return _0x35d151(_0x35b4c1,_0x1b890f-_0x39c37c._0xd4743c);}_0x38a1c3[_0xb10061(0x924,_0x4e722a._0x3de8ed)]=function(_0x54f9a9,_0x47da08){return _0x54f9a9>_0x47da08;};function _0xb10061(_0x30257e,_0x26acde){return _0x35d151(_0x26acde,_0x30257e-0x429);}const _0x22271f=_0x38a1c3;this[_0x4f3668(0x686,_0x4e722a._0x2f76f3)+_0x4f3668(0x248,_0x4e722a._0x524a8f)](),this[_0xb10061(0x8cc,0x7d5)+'tTimer']=setInterval(()=>{const _0x2af810={_0x5524fa:0x78},_0x64b170=this[_0x37279d(_0x309dd0._0x229dbf,0x838)+_0x37279d(_0x309dd0._0x565c5c,_0x309dd0._0x433490)];function _0x37279d(_0x59b642,_0x30036b){return _0x4f3668(_0x30036b,_0x59b642-_0x2af810._0x5524fa);}if(!_0x64b170||_0x22271f[_0x393834(_0x309dd0._0x328a39,_0x309dd0._0xd96def)](_0x64b170[_0x37279d(0x52d,_0x309dd0._0x4d5432)+'te'],_0x42d174[_0x393834(_0x309dd0._0x439ce5,_0x309dd0._0x48513c)]))return;this[_0x37279d(_0x309dd0._0x75df93,_0x309dd0._0x599f48)+_0x393834(_0x309dd0._0x354a0d,_0x309dd0._0x33e1c2)+_0x393834(-0xb9,-_0x309dd0._0x607110)]();const _0x34df44=this[_0x37279d(0x499,0x32f)][_0x393834(0x12a,_0x309dd0._0x443794)+'tTimeout'+'Ms']??HEARTBEAT_TIMEOUT_MS;if(_0x22271f[_0x393834(_0x309dd0._0x34af1c,0x1a0)](Date[_0x393834(-0x3b7,-_0x309dd0._0x16660b)]()-this[_0x393834(_0x309dd0._0x18f889,_0x309dd0._0x374ef7)+_0x393834(0x2f4,_0x309dd0._0x27ab3c)+'yMs'],_0x34df44)){this[_0x393834(0x335,0x100)](_0x37279d(0x686,_0x309dd0._0x2ca371)+'artbeat\x20'+_0x37279d(_0x309dd0._0x100ef5,0xcc)+'t'),_0x64b170[_0x37279d(_0x309dd0._0x17b0df,0x222)+'e']();return;}function _0x393834(_0x51ddcf,_0x5eb89f){return _0x4f3668(_0x51ddcf,_0x5eb89f- -0x38b);}_0x64b170[_0x37279d(0x5dc,_0x309dd0._0x58a174)]();},this[_0xb10061(0x81a,0x57f)][_0xb10061(0x8cc,0xaf4)+'tInterva'+_0xb10061(_0x4e722a._0x59d54b,_0x4e722a._0x3c6be1)]??HEARTBEAT_INTERVAL_MS);}[_0x341e52(0x7ae,0x50c)+'tbeat'](){const _0x1bd39e={_0x44daa6:0x7e,_0x375fc1:0x753,_0x3c5da3:0x4c0,_0x4f9891:0x3d};function _0x561bcd(_0x410852,_0x45df83){return _0x35d151(_0x410852,_0x45df83- -0x1d3);}function _0x21b78b(_0x5c290c,_0x56899c){return _0x35d151(_0x5c290c,_0x56899c-0x2b0);}this['heartbea'+_0x561bcd(_0x1bd39e._0x44daa6,0x3d)]&&(clearInterval(this[_0x21b78b(0x506,_0x1bd39e._0x375fc1)+_0x21b78b(0x36c,_0x1bd39e._0x3c5da3)]),this[_0x21b78b(0x734,_0x1bd39e._0x375fc1)+_0x561bcd(0x19,_0x1bd39e._0x4f9891)]=null);}[_0x341e52(0x6bc,0x871)+_0x341e52(0x7eb,0x583)+_0x341e52(0x44d,0x527)](){const _0x32b0b3={_0x41d8ef:0x12d,_0x777882:0x251,_0x450d57:0x1b0,_0x5afee1:0x440,_0x1ff23d:0x1f8,_0x4b6446:0x277,_0x5afcd5:0x211,_0x4063f1:0x13d,_0x27ef99:0x11f,_0x23ca9b:0x10c,_0x307593:0x21b,_0x44268b:0x13e,_0xb4c6a8:0x223,_0xef4c9b:0x209,_0x3c2946:0x405,_0x59e4f2:0x247,_0x4cce10:0x3c1,_0x435ffb:0x5f4,_0x60e4ba:0x35f,_0x5a8695:0x1d7,_0xf62bac:0xdd,_0x4b966e:0x37e,_0x3dce54:0x157,_0x30e11d:0x3f},_0x1f10c9={_0xb8251f:0x309};function _0x44d995(_0x24a446,_0x19ec2e){return _0x35d151(_0x24a446,_0x19ec2e- -_0x1f10c9._0xb8251f);}const _0x29aaab={};_0x29aaab[_0x44d995(-_0x32b0b3._0x41d8ef,0x13e)]=function(_0x3f3363,_0x1c8b99){return _0x3f3363<_0x1c8b99;};const _0x18d8dd=_0x29aaab;if(this[_0x453acd(_0x32b0b3._0x777882,0x31)+_0x453acd(0x13d,-_0x32b0b3._0x450d57)+_0x453acd(_0x32b0b3._0x5afee1,_0x32b0b3._0x1ff23d)+'s']['size']===0x0)return;const _0x5e49cb=this['options'][_0x44d995(0x26a,-0x79)+'andshake'+_0x453acd(_0x32b0b3._0x4b6446,0x5c)+_0x44d995(-_0x32b0b3._0x5afcd5,0x93)]??CONNECT_HANDSHAKE_WARN_DELAY_MS;function _0x453acd(_0x23dbf2,_0x391b83){return _0x35d151(_0x391b83,_0x23dbf2- -0x9a);}const _0x1a6b6d=Date[_0x453acd(0xd2,0x25a)]();for(const [_0x2a9b52,_0x50e438]of this[_0x453acd(0x251,0x4df)+_0x453acd(_0x32b0b3._0x4063f1,_0x32b0b3._0x27ef99)+'andshake'+'s'][_0x44d995(-0x217,-_0x32b0b3._0x23ca9b)]()){const _0x1bc8d9=_0x1a6b6d-_0x50e438[_0x453acd(0x37f,0x4fb)+_0x44d995(0xa5,_0x32b0b3._0x307593)];if(_0x50e438[_0x453acd(0x478,0x51d)+'ingLogge'+'d']||_0x18d8dd[_0x44d995(0x445,_0x32b0b3._0x44268b)](_0x1bc8d9,_0x5e49cb))continue;_0x50e438[_0x44d995(_0x32b0b3._0xb4c6a8,_0x32b0b3._0xef4c9b)+_0x44d995(_0x32b0b3._0x3c2946,_0x32b0b3._0x59e4f2)+'d']=!![],this[_0x453acd(_0x32b0b3._0x4cce10,_0x32b0b3._0x435ffb)](_0x453acd(0x2e0,_0x32b0b3._0x60e4ba)+_0x44d995(-_0x32b0b3._0x5a8695,_0x32b0b3._0xf62bac)+_0x44d995(0x356,0x2cd)+_0x44d995(_0x32b0b3._0x4b966e,0x72)+'qId='+_0x2a9b52+_0x44d995(-_0x32b0b3._0x3dce54,-0x8a)+_0x50e438['method']+(_0x453acd(_0x32b0b3._0x30e11d,-0x267)+_0x44d995(0x2f7,0x2e1))+_0x1bc8d9);}}['pushPend'+'ingGatew'+_0x341e52(0x637,0x408)+'e'](_0x3ad95a){const _0x5d3e3e={_0x350287:0x247,_0x3b6749:0x8a4,_0x2a122c:0x34a,_0x5425f3:0x127,_0x489eb0:0x68e,_0x34f91f:0x4b7,_0x3d101e:0x468,_0x57b2df:0x46b},_0x4ae8b3={_0x2248fc:0x365};function _0x37fd6c(_0x3e4296,_0xba0c55){return _0x35d151(_0xba0c55,_0x3e4296- -0x3e);}this['pendingG'+_0x37fd6c(0x34a,_0x5d3e3e._0x350287)+_0x54fbb4(_0x5d3e3e._0x3b6749,0x85a)]['length']>=MAX_PENDING_GATEWAY_MESSAGES&&this['pendingG'+_0x37fd6c(_0x5d3e3e._0x2a122c,_0x5d3e3e._0x5425f3)+_0x37fd6c(0x4b7,0x67d)][_0x54fbb4(0x526,0x50c)]();function _0x54fbb4(_0x5064e3,_0x4d0b50){return _0x35d151(_0x5064e3,_0x4d0b50-_0x4ae8b3._0x2248fc);}this[_0x37fd6c(_0x5d3e3e._0x489eb0,0x96f)+_0x37fd6c(0x34a,0x142)+_0x37fd6c(_0x5d3e3e._0x34f91f,_0x5d3e3e._0x3d101e)][_0x37fd6c(0x5e7,_0x5d3e3e._0x57b2df)](_0x3ad95a);}[_0x341e52(0x5d7,0x826)+_0x341e52(0x552,0x6d6)+'ewayQueu'+'e'](){const _0x3ee0bb={_0x5262e7:0x446,_0x2eece1:0x2f6,_0x42b680:0x5e0,_0x454b0f:0x8c0,_0x2d1618:0x63a,_0x3de804:0x3cd,_0x1a1574:0x1ef,_0x386524:0x347,_0x3b6fe4:0x622,_0x82212a:0x789,_0xb53b6b:0x2f,_0x3f85e9:0x32b,_0x4d1cca:0x345,_0x56a373:0x37b},_0x2749c6={'DEUPv':function(_0x50d1cb,_0x24252c){return _0x50d1cb(_0x24252c);}};function _0x4b9d77(_0x3d518c,_0xb4b20e){return _0x35d151(_0xb4b20e,_0x3d518c- -0x77);}function _0xb26007(_0x2930f2,_0x357503){return _0x35d151(_0x357503,_0x2930f2- -0x92);}const _0x3df091=_0x2749c6[_0x4b9d77(0x3ad,0x5a2)](summarizePendingGatewayMessages,this[_0xb26007(0x63a,_0x3ee0bb._0x5262e7)+_0xb26007(_0x3ee0bb._0x2eece1,0x34a)+_0xb26007(0x463,_0x3ee0bb._0x42b680)]);if(_0x3df091['total']===0x0||_0x3df091['connectR'+_0xb26007(0x5ee,_0x3ee0bb._0x454b0f)]>0x0)return;this[_0xb26007(_0x3ee0bb._0x2d1618,_0x3ee0bb._0x3de804)+_0x4b9d77(0x311,0x9b)+_0x4b9d77(0x47e,0x37b)]=[],this['log'](_0x4b9d77(_0x3ee0bb._0x1a1574,_0x3ee0bb._0x386524)+_0xb26007(_0x3ee0bb._0x3b6fe4,_0x3ee0bb._0x82212a)+'le\x20gatew'+_0xb26007(0x213,-0x8b)+_0x4b9d77(0x555,0x46b)+_0x3df091[_0xb26007(0x124,_0x3ee0bb._0xb53b6b)]+_0xb26007(0x90,_0x3ee0bb._0x3f85e9)+_0x3df091[_0xb26007(0xb2,_0x3ee0bb._0x4d1cca)+'t']+'\x20binary='+_0x3df091[_0x4b9d77(_0x3ee0bb._0x56a373,0x3e6)]);}['observeC'+_0x35d151(0x519,0x4a4)+_0x341e52(0x3d3,0x5f3)](_0x4b291d,_0xd9479d){const _0x8a8318={_0x42dbb7:0x47a,_0x31db41:0x196,_0x8aef63:0xbe,_0xe48cdd:0xcf,_0x370e1e:0x10f,_0x485958:0xf1,_0x47dff4:0x81,_0x1ec754:0x24a,_0xb16420:0xa8,_0x35abb7:0x13c,_0x2dce6f:0x398,_0x3cc432:0x3a,_0x131152:0x135,_0x537aa3:0x158},_0x9a6efc={_0x5c4274:0x2cb},_0xb694f4={};_0xb694f4[_0x5e8279(0x3a4,_0x8a8318._0x42dbb7)]=_0x219fa2(0x24a,_0x8a8318._0x31db41)+'d';const _0x46c566=_0xb694f4,_0x49eda1=Date['now'](),_0x35292e=new Map(this[_0x5e8279(0x23e,0x407)][_0x219fa2(0x24a,-_0x8a8318._0x8aef63)+_0x219fa2(-_0x8a8318._0xe48cdd,-_0x8a8318._0x370e1e)][_0x219fa2(-_0x8a8318._0x485958,-_0x8a8318._0x47dff4)](_0x364ae8=>[_0x364ae8['id'],{..._0x364ae8}])),_0x228803=_0x35292e['get'](_0x4b291d)??{'id':_0x4b291d,'label':_0xd9479d,'state':_0x219fa2(_0x8a8318._0x1ec754,_0x8a8318._0xb16420)+'d','lastSeenMs':_0x49eda1};function _0x5e8279(_0x553ee6,_0x360f1a){return _0x35d151(_0x360f1a,_0x553ee6- -_0x9a6efc._0x5c4274);}_0x228803['label']=_0xd9479d,_0x228803[_0x5e8279(-_0x8a8318._0x35abb7,0xe9)]=_0x46c566['hqNtv'],_0x228803[_0x5e8279(_0x8a8318._0x2dce6f,0x3a5)+'Ms']=_0x49eda1,_0x35292e['set'](_0x4b291d,_0x228803);const _0x159b68=[..._0x35292e['values']()][_0x5e8279(_0x8a8318._0x3cc432,-0x1d1)]((_0x12c5e4,_0x50baf3)=>_0x50baf3[_0x219fa2(0x442,0x36d)+'Ms']-_0x12c5e4[_0x219fa2(0x442,0x64b)+'Ms'])[_0x5e8279(-_0x8a8318._0x131152,-_0x8a8318._0x537aa3)](0x0,MAX_DEVICE_DETAILS),_0x548d34={};_0x548d34['connecte'+'dDevices']=_0x159b68;function _0x219fa2(_0x9717d,_0x54d357){return _0x35d151(_0x54d357,_0x9717d- -0x221);}this[_0x219fa2(0xd3,0x24f)+_0x5e8279(0x23a,-0xbe)](_0x548d34);}['markDevi'+_0x341e52(0x38b,0x11f)+'t'](){const _0x56277c={_0x1c72ab:0x5a7,_0x47d31e:0x65d,_0x468982:0x4c0};function _0x1e7aab(_0x505e81,_0x481469){return _0x341e52(_0x481469- -0x128,_0x505e81);}function _0x1a2c69(_0x4c5ed5,_0x463cba){return _0x341e52(_0x463cba-0x114,_0x4c5ed5);}this['updateSn'+_0x1a2c69(0x782,0x895)]({'connectedDevices':this[_0x1e7aab(_0x56277c._0x1c72ab,_0x56277c._0x47d31e)]['connecte'+'dDevices'][_0x1a2c69(0x6e4,_0x56277c._0x468982)](_0x59e2d1=>({..._0x59e2d1,'state':_0x1a2c69(0x466,0x585)}))});}[_0x35d151(0x3af,0x551)+_0x35d151(0x138,0x100)+_0x35d151(0x8a5,0x6ee)](_0xaa7d63){const _0x2dc2cd={_0x4bf980:0x8f1,_0x26f774:0x85a,_0x23cdbe:0xab0,_0x3dc624:0xaff,_0x1231bc:0x85a,_0x39f89a:0x765,_0x565bc0:0x57e,_0x1e5f5e:0x7d9,_0x54da23:0x82d,_0x443159:0x5da,_0x477934:0xaad,_0x2bd108:0x988,_0x268139:0x969,_0x2bcd3b:0x873,_0x3f982e:0x7f4,_0x510b84:0x794,_0x43b8f0:0xa0f,_0x5db604:0xa35,_0x3af999:0x729,_0x440b76:0xb30},_0x2ba3ca={_0x4e65d9:0xda};if(this[_0x4d0433(_0x2dc2cd._0x4bf980,0x609)]['pendingP'+_0x2dae79(_0x2dc2cd._0x26f774,0x6dd)+'sts'][_0x4d0433(0x64d,0x92e)](_0x172f97=>_0x172f97['requestI'+'d']===_0xaa7d63['requestI'+'d']))return;function _0x4d0433(_0x491ce6,_0x4e8457){return _0x341e52(_0x491ce6-0x16c,_0x4e8457);}const _0x9d5923=[...this[_0x4d0433(0x8f1,_0x2dc2cd._0x23cdbe)][_0x2dae79(0x84f,_0x2dc2cd._0x3dc624)+_0x2dae79(_0x2dc2cd._0x1231bc,_0x2dc2cd._0x39f89a)+_0x4d0433(0x6ef,0x549)],_0xaa7d63][_0x4d0433(_0x2dc2cd._0x565bc0,0x858)](-MAX_PENDING_PAIR_REQUESTS);function _0x2dae79(_0x2fc520,_0xc4f43b){return _0x341e52(_0x2fc520-_0x2ba3ca._0x4e65d9,_0xc4f43b);}const _0x29a6b9={};_0x29a6b9['pendingP'+'airReque'+'sts']=_0x9d5923,this['updateSn'+'apshot'](_0x29a6b9),this[_0x4d0433(_0x2dc2cd._0x1e5f5e,0x593)][_0x4d0433(_0x2dc2cd._0x54da23,_0x2dc2cd._0x443159)+'gPairReq'+_0x2dae79(0x4f0,0x33c)]?.(_0xaa7d63),this[_0x2dae79(0x7b1,_0x2dc2cd._0x477934)](_0x2dae79(_0x2dc2cd._0x2bd108,0x749)+_0x4d0433(0xa7e,0x914)+_0x4d0433(_0x2dc2cd._0x268139,0x7a4)+_0x4d0433(_0x2dc2cd._0x2bcd3b,_0x2dc2cd._0x3f982e)+_0xaa7d63[_0x2dae79(_0x2dc2cd._0x510b84,0x8b2)+'d']+(_0x4d0433(_0x2dc2cd._0x43b8f0,0x8f0)+'d=')+(_0xaa7d63[_0x4d0433(_0x2dc2cd._0x5db604,_0x2dc2cd._0x3af999)]||_0x4d0433(0xaa6,_0x2dc2cd._0x440b76)+'>'));}['markPair'+_0x341e52(0x8a4,0xb11)+_0x341e52(0x564,0x399)](_0xff4d23,_0x3972cb){const _0x5a7b09={_0x4b3fb7:0x822,_0x8ff650:0x889,_0x5a7475:0x4ac,_0x24fb8b:0x7e6,_0x5a096c:0x7f1,_0x42c2d4:0x6d4,_0x104025:0x5e3,_0x1d6211:0x7e0,_0x5d4540:0x9b7,_0x1142c4:0x8df,_0x1b530d:0x8bd,_0x1ecb1c:0x34f,_0x4a2d7e:0x710,_0x1ddafc:0x7fd,_0x2f0543:0x903,_0x2e9cd9:0x6c0},_0x1c31f3={_0x499e1b:0x2ed};function _0xff22ae(_0x4f4c45,_0x5d21cd){return _0x35d151(_0x5d21cd,_0x4f4c45-_0x1c31f3._0x499e1b);}const _0x9df88c=this[_0xff22ae(0x7f6,_0x5a7b09._0x4b3fb7)]['pendingP'+_0x565786(0x706,_0x5a7b09._0x8ff650)+_0x565786(0x7a3,0x68c)][_0x565786(_0x5a7b09._0x5a7475,0x4b5)](_0x235b18=>_0x235b18['requestI'+'d']===_0xff4d23?{..._0x235b18,'status':_0x3972cb===_0x565786(0x5e8,0x507)||_0x3972cb===_0xff22ae(0x7f3,0x7e2)?_0x3972cb:_0x235b18[_0xff22ae(0x5ad,0x58c)]}:_0x235b18);function _0x565786(_0x148ec2,_0x5033fc){return _0x35d151(_0x148ec2,_0x5033fc-0x385);}const _0x2aabe2={};_0x2aabe2[_0xff22ae(_0x5a7b09._0x24fb8b,0x607)+_0xff22ae(_0x5a7b09._0x5a096c,_0x5a7b09._0x42c2d4)+_0xff22ae(0x5f4,0x80e)]=_0x9df88c,this[_0xff22ae(0x5e1,0x56e)+_0xff22ae(0x7f2,_0x5a7b09._0x104025)](_0x2aabe2),this[_0x565786(0x983,_0x5a7b09._0x1d6211)](_0x565786(0xc7f,_0x5a7b09._0x5d4540)+_0x565786(_0x5a7b09._0x1142c4,_0x5a7b09._0x1b530d)+_0xff22ae(0x605,_0x5a7b09._0x1ecb1c)+_0x565786(_0x5a7b09._0x4a2d7e,_0x5a7b09._0x1ddafc)+_0xff4d23+(_0x565786(_0x5a7b09._0x2f0543,_0x5a7b09._0x2e9cd9)+'n=')+_0x3972cb);}[_0x341e52(0x570,0x5c8)+_0x341e52(0x781,0x934)](_0x50b634){const _0x5a44c4={_0x304b59:0x40d,_0x52c657:0x5f1,_0x342003:0x1eb};function _0x36c593(_0x453f26,_0x1656bf){return _0x341e52(_0x1656bf- -0x2b,_0x453f26);}function _0x5b36cc(_0x1dd5e2,_0x2a5e57){return _0x341e52(_0x2a5e57- -0x49c,_0x1dd5e2);}Object['assign'](this[_0x5b36cc(0x3cf,0x2e9)],_0x50b634,{'lastUpdatedMs':Date['now']()}),this[_0x5b36cc(_0x5a44c4._0x304b59,0x1d1)][_0x36c593(0x4b4,0x41d)]?.(this[_0x36c593(0x561,_0x5a44c4._0x52c657)+_0x5b36cc(0x4ec,_0x5a44c4._0x342003)]());}[_0x35d151(0x619,0x45b)](_0x27bb93){const _0x19b058={_0x436f29:0x5af,_0xcc8452:0x680},_0x534f0d={_0x212a08:0xe6},_0x299c4b={_0x339725:0x75};function _0x3cd2ec(_0x2986b7,_0x1ab2aa){return _0x341e52(_0x2986b7-_0x299c4b._0x339725,_0x1ab2aa);}function _0x291dd3(_0x509359,_0x14c0b5){return _0x341e52(_0x509359- -_0x534f0d._0x212a08,_0x14c0b5);}this[_0x291dd3(0x587,_0x19b058._0x436f29)][_0x291dd3(0x835,_0x19b058._0xcc8452)]?.(_0x27bb93);}[_0x35d151(0x2cc,0xea)+'pen'](){const _0x11985c={_0x293c13:0x309},_0x47dc47={_0x2e7936:0x160};function _0xdb537a(_0x3073d0,_0x361186){return _0x35d151(_0x361186,_0x3073d0-_0x47dc47._0x2e7936);}function _0x3316d6(_0x4ea244,_0x8f93ff){return _0x35d151(_0x8f93ff,_0x4ea244-0x253);}return this[_0x3316d6(0x84a,0x7bb)+_0x3316d6(0x5fb,_0x11985c._0x293c13)]?.[_0xdb537a(0x5e5,0x6f5)+'te']===_0x42d174['OPEN'];}[_0x35d151(0x49a,0x6bc)+_0x341e52(0x6cc,0x3e7)](){const _0x5129c2={_0x4deecb:0x30,_0xd34d72:0x47b,_0x25cb8e:0x2ac,_0x266c40:0x1ac,_0x49b042:0x928,_0x67fdd0:0xae5};function _0x1a95dc(_0x170ead,_0x54719c){return _0x35d151(_0x54719c,_0x170ead-0x310);}function _0x43fe4c(_0x466a27,_0x122594){return _0x35d151(_0x122594,_0x466a27- -0x1d9);}return this[_0x43fe4c(0xa4,-_0x5129c2._0x4deecb)+_0x1a95dc(_0x5129c2._0xd34d72,0x354)]?.[_0x43fe4c(_0x5129c2._0x25cb8e,_0x5129c2._0x266c40)+'te']===_0x42d174[_0x1a95dc(_0x5129c2._0x49b042,_0x5129c2._0x67fdd0)];}[_0x35d151(0x4de,0x5e0)+_0x341e52(0x549,0x56c)](){const _0x58d7b2={_0x29f1e2:0x6e4,_0x2a2fb8:0x5db,_0x18e36b:0x855,_0x4129de:0x427,_0x1f8ab0:0x821,_0x28b897:0x8cb,_0x1c39dc:0x6d4,_0x408d47:0x821,_0x241346:0x625,_0x1f6e61:0x5c8},_0x210841={_0x39be01:0x2c0};this[_0x4a514d(_0x58d7b2._0x29f1e2,0x97f)+_0x4a514d(0x5ee,0x855)]();this[_0x4a243a(_0x58d7b2._0x2a2fb8,0x8dd)+_0x4a243a(0x4d0,0x5b4)]&&(clearTimeout(this[_0x4a243a(_0x58d7b2._0x2a2fb8,_0x58d7b2._0x18e36b)+'tTimer']),this[_0x4a514d(0x4cd,0x590)+_0x4a514d(0x3c2,_0x58d7b2._0x4129de)]=null);function _0x4a243a(_0x435e62,_0xa432bd){return _0x35d151(_0xa432bd,_0x435e62-_0x210841._0x39be01);}function _0x4a514d(_0x3e5fc3,_0x14b6a2){return _0x35d151(_0x14b6a2,_0x3e5fc3-0x1b2);}this[_0x4a243a(_0x58d7b2._0x1f8ab0,_0x58d7b2._0x28b897)+_0x4a243a(0x70a,_0x58d7b2._0x1c39dc)+'r']&&(clearTimeout(this[_0x4a243a(_0x58d7b2._0x408d47,0xa09)+_0x4a514d(0x5fc,_0x58d7b2._0x241346)+'r']),this['gatewayR'+_0x4a514d(0x5fc,_0x58d7b2._0x1f6e61)+'r']=null);}[_0x341e52(0x509,0x602)+_0x35d151(0x42a,0x4dc)](_0xd2c938){const _0x4dc045={_0x2c96f1:0x295,_0x50fd69:0x4ca},_0x4b5db6={_0x45a6af:0x85};function _0x320133(_0x21a838,_0x1d272f){return _0x35d151(_0x1d272f,_0x21a838- -_0x4b5db6._0x45a6af);}return _0xd2c938==null?null:Math[_0x320133(_0x4dc045._0x2c96f1,_0x4dc045._0x50fd69)](0x0,Date['now']()-_0xd2c938);}};function shouldKeepGatewayConnected(_0x1eaa7f,_0x32b029){const _0x24ed67={_0x54150e:0x1de},_0x59c919={_0x20f939:0x546};function _0x10c2fc(_0x5df3da,_0x3cf99a){return _0x341e52(_0x3cf99a- -_0x59c919._0x20f939,_0x5df3da);}const _0x2e9bf4={};function _0xf633b2(_0x8e94a5,_0xf2c35c){return _0x341e52(_0x8e94a5- -0x424,_0xf2c35c);}_0x2e9bf4[_0x10c2fc(-0x9b,0x1de)]=function(_0x59c6ad,_0x489221){return _0x59c6ad>_0x489221;};const _0x479862=_0x2e9bf4;return _0x1eaa7f>0x0||_0x479862[_0x10c2fc(0x207,_0x24ed67._0x54150e)](_0x32b029,0x0);}function shouldScheduleGatewayIdleClose(_0x58a689,_0x3c8901,_0x1d51f7){return _0x1d51f7&&!shouldKeepGatewayConnected(_0x58a689,_0x3c8901);}function shouldRecycleGatewayForFreshClient(_0x2c5ff0,_0x4186dc,_0x1a6927,_0x1bf0e9){const _0x5a8e8b={_0x321eab:0x59e,_0x5165ff:0x321},_0x23e817={_0xfb54e9:0x141},_0x4e9d8c={};_0x4e9d8c[_0x3c8708(_0x5a8e8b._0x321eab,_0x5a8e8b._0x5165ff)]=function(_0x55c04f,_0x11cb15){return _0x55c04f===_0x11cb15;};const _0x3f635c=_0x4e9d8c;function _0x3c8708(_0x6a7589,_0x3d2790){return _0x341e52(_0x3d2790- -_0x23e817._0xfb54e9,_0x6a7589);}return _0x1a6927&&_0x4186dc>0x0&&(_0x3f635c['aBveh'](_0x2c5ff0,0x0)||_0x1bf0e9);}function summarizePendingGatewayMessages(_0x4f02e7){const _0x37e360={_0x5bc723:0x5ac,_0x749630:0x589,_0x523e55:0x837,_0x1243e5:0x87e,_0xe53baf:0xafd,_0x3740a4:0x881,_0x1d5a52:0x72b,_0x74238e:0x621,_0x54c7fd:0x8a0,_0x3ac0a1:0xc8f},_0x8627e7={_0x26ed6f:0x3f6},_0x359234={'ufdGU':'binary','eohAc':function(_0x2dcf6f,_0x24dea1){return _0x2dcf6f(_0x24dea1);}},_0x52d26e={};function _0x5dbb14(_0x1ebefd,_0x503384){return _0x35d151(_0x1ebefd,_0x503384-_0x8627e7._0x26ed6f);}_0x52d26e[_0x5dbb14(0x771,_0x37e360._0x5bc723)]=_0x4f02e7[_0x5e29e3(0xa32,0x7d7)],_0x52d26e['connectR'+_0x5e29e3(0xac5,0xdcd)]=0x0,_0x52d26e[_0x5e29e3(_0x37e360._0x749630,0x80f)+'t']=0x0;function _0x5e29e3(_0x497d9f,_0x381eb0){return _0x35d151(_0x381eb0,_0x497d9f-0x445);}_0x52d26e[_0x5e29e3(_0x37e360._0x523e55,_0x37e360._0x1243e5)]=0x0;const _0x27e502=_0x52d26e;for(const _0x33d5b1 of _0x4f02e7){if(_0x33d5b1[_0x5e29e3(_0x37e360._0xe53baf,_0x37e360._0x3740a4)]===_0x359234[_0x5e29e3(0x704,_0x37e360._0x1d5a52)]){_0x27e502[_0x5dbb14(_0x37e360._0x74238e,0x7e8)]+=0x1;continue;}if(_0x359234[_0x5dbb14(_0x37e360._0x54c7fd,0x9a8)](isConnectHandshakeRequest,_0x33d5b1[_0x5e29e3(0x641,0x53b)])){_0x27e502[_0x5dbb14(_0x37e360._0x3ac0a1,0x9fd)+'equests']+=0x1;continue;}_0x27e502[_0x5dbb14(0x4bf,0x53a)+'t']+=0x1;}return _0x27e502;}function dedupePendingGatewayMessages(_0x1bb665){const _0x84db3a={_0x6a7808:0x44d,_0x47c952:0x8b9,_0x290208:0x192,_0x15f166:0xc,_0x5d02eb:0x1be,_0x24c520:0x7ae,_0x398ca7:0x61e,_0x2d3044:0x7ee,_0xb9d381:0x92,_0x4028cb:0x38e},_0x3e537c={_0x32369a:0x4db},_0x658013={_0x58c524:0x7b};function _0x44499a(_0x2bd180,_0x21862b){return _0x341e52(_0x2bd180- -_0x658013._0x58c524,_0x21862b);}const _0x126c24={};_0x126c24[_0x44499a(0x6dc,_0x84db3a._0x6a7808)]=function(_0x2fb676,_0x29eeb4){return _0x2fb676<=_0x29eeb4;};const _0x15c2e8=_0x126c24;let _0x19eab1=-0x1;for(let _0x5266b7=_0x1bb665['length']-0x1;_0x5266b7>=0x0;_0x5266b7-=0x1){const _0x1994ec=_0x1bb665[_0x5266b7];if(_0x1994ec?.[_0x44499a(_0x84db3a._0x47c952,0x8bc)]===_0x44499a(0x3fd,0x149)&&isConnectHandshakeRequest(_0x1994ec[_0x18d80f(-_0x84db3a._0x290208,-0x63)])){_0x19eab1=_0x5266b7;break;}}if(_0x15c2e8[_0x44499a(0x6dc,0x9cf)](_0x19eab1,0x0)){const _0x4c92f5={};return _0x4c92f5[_0x44499a(0x7ae,0x7d2)]=[..._0x1bb665],_0x4c92f5[_0x18d80f(_0x84db3a._0x15f166,_0x84db3a._0x5d02eb)]=0x0,_0x4c92f5;}const _0x37edaa=_0x1bb665['filter']((_0x483d73,_0x4398e7)=>_0x4398e7>=_0x19eab1||(_0x483d73[_0x18d80f(0x24c,0x459)]!==_0x44499a(0x3fd,0x5e5)||!isConnectHandshakeRequest(_0x483d73[_0x18d80f(-0x2a6,-0x63)]))),_0x4b4d24={};function _0x18d80f(_0x4358f4,_0x5a4e34){return _0x341e52(_0x5a4e34- -_0x3e537c._0x32369a,_0x4358f4);}return _0x4b4d24[_0x44499a(_0x84db3a._0x24c520,0x845)]=_0x37edaa,_0x4b4d24[_0x44499a(_0x84db3a._0x398ca7,0x451)]=_0x1bb665[_0x44499a(_0x84db3a._0x2d3044,0x7a3)]-_0x37edaa[_0x18d80f(_0x84db3a._0xb9d381,_0x84db3a._0x4028cb)],_0x4b4d24;}function prunePendingGatewayMessagesForFreshDemand(_0x3e9df3){const _0x59c5b0={_0x1680d3:0x7e,_0x1cfbb2:0x761,_0xce1344:0x501,_0x4e02e0:0x15f,_0x145a1f:0x16f,_0x5daa96:0x331,_0x4db54c:0x346,_0x2ba732:0x118,_0x223f75:0x14,_0x234a7d:0x729,_0x515fe9:0x15a,_0xa7d37c:0x6d,_0x40c29d:0x7a0,_0x43aee8:0x501,_0x446efe:0xaa,_0x20025f:0x28e,_0xd18115:0x3d8,_0x5c9df5:0x318},_0x59acdc={_0x10208d:0x40b},_0x3851e0={};_0x3851e0[_0x58c4ad(-_0x59c5b0._0x1680d3,0xb7)]=function(_0x13f39a,_0x36d91d){return _0x13f39a===_0x36d91d;},_0x3851e0[_0x58c4ad(0x687,0x3d8)]=function(_0x191a3c,_0x3f1bd0){return _0x191a3c-_0x3f1bd0;};const _0x8a45c3=_0x3851e0;if(_0x3e9df3[_0x58c4ad(_0x59c5b0._0x1cfbb2,_0x59c5b0._0xce1344)]===0x0){const _0x164489={};return _0x164489[_0xf3890f(_0x59c5b0._0x4e02e0,0x41e)]=[],_0x164489[_0x58c4ad(_0x59c5b0._0x145a1f,_0x59c5b0._0x5daa96)]=0x0,_0x164489;}function _0xf3890f(_0x3cc0f4,_0x16d7b1){return _0x341e52(_0x16d7b1- -_0x59acdc._0x10208d,_0x3cc0f4);}let _0x176078=-0x1;for(let _0x30a707=_0x3e9df3[_0x58c4ad(_0x59c5b0._0x4db54c,0x501)]-0x1;_0x30a707>=0x0;_0x30a707-=0x1){const _0x482e9f=_0x3e9df3[_0x30a707];if(_0x8a45c3[_0xf3890f(-_0x59c5b0._0x2ba732,_0x59c5b0._0x223f75)](_0x482e9f?.[_0xf3890f(_0x59c5b0._0x234a7d,0x529)],_0x58c4ad(-0x11c,0x110))&&isConnectHandshakeRequest(_0x482e9f[_0xf3890f(-_0x59c5b0._0x515fe9,_0x59c5b0._0xa7d37c)])){_0x176078=_0x30a707;break;}}function _0x58c4ad(_0x44912d,_0x2f61f7){return _0x341e52(_0x2f61f7- -0x368,_0x44912d);}if(_0x176078===-0x1){const _0x358335={};return _0x358335[_0xf3890f(0x266,0x41e)]=[],_0x358335['dropped']=_0x3e9df3[_0x58c4ad(_0x59c5b0._0x40c29d,_0x59c5b0._0x43aee8)],_0x358335;}const _0x1aea89=_0x3e9df3[_0x58c4ad(-0x1d,_0x59c5b0._0x446efe)](_0x176078);return{'messages':_0x1aea89,'dropped':_0x8a45c3[_0x58c4ad(_0x59c5b0._0x20025f,_0x59c5b0._0xd18115)](_0x3e9df3[_0x58c4ad(_0x59c5b0._0x5c9df5,_0x59c5b0._0xce1344)],_0x1aea89['length'])};}function patchConnectRequestGatewayAuth(_0x2ad4da,_0x56c90f){const _0x517f6c={_0x449987:0x32f,_0x5efd68:0x28d,_0x50aad6:0x38e,_0x5ec0f4:0x7c5,_0x4ff7d2:0x742,_0x47ad61:0x43c,_0x112169:0x5e8,_0x7dfc29:0x90f,_0x19eea5:0x2c1,_0x13de4d:0x4b9,_0x3a0a45:0x5bf,_0x49440b:0x3f7,_0x3eff39:0xc27,_0x3276b1:0x989,_0x38f121:0x8a2,_0x49275e:0x6ed,_0x44eff4:0x32e,_0x23e803:0xa82,_0x11b5c5:0x8dc,_0x31e09d:0x73d,_0x3a2cda:0x71b,_0x184391:0x1ef,_0x378724:0x5b4,_0x39a449:0x5b4,_0x49eed6:0x68f,_0x2420f3:0x43c,_0x5f1d03:0x5f0,_0xf571ec:0x4ae,_0x1ae876:0x689,_0x244a85:0x71a,_0x73a898:0x9f9,_0x27be1f:0x8db,_0x48c007:0x245,_0x4559a9:0x859,_0x5e4281:0x5b4,_0x2189eb:0x766},_0x27fe83={_0x1e0fb1:0x368},_0x382855={};_0x382855[_0x59fdd7(_0x517f6c._0x449987,0x49b)]=_0x1e4aa9(_0x517f6c._0x5efd68,_0x517f6c._0x50aad6);function _0x1e4aa9(_0x39ff79,_0x412f0f){return _0x35d151(_0x39ff79,_0x412f0f-0x1fb);}_0x382855[_0x59fdd7(0xa11,0x9aa)]=function(_0x471568,_0x165434){return _0x471568!==_0x165434;};function _0x59fdd7(_0x118fe2,_0x340817){return _0x35d151(_0x118fe2,_0x340817-_0x27fe83._0x1e0fb1);}_0x382855[_0x59fdd7(_0x517f6c._0x5ec0f4,_0x517f6c._0x4ff7d2)]=_0x1e4aa9(0x747,_0x517f6c._0x47ad61),_0x382855[_0x1e4aa9(_0x517f6c._0x112169,0x449)]=function(_0x5b7847,_0x3abcd3){return _0x5b7847===_0x3abcd3;},_0x382855[_0x59fdd7(0x77d,_0x517f6c._0x7dfc29)]='string';const _0x100ca0=_0x382855;if(_0x56c90f[_0x1e4aa9(_0x517f6c._0x19eea5,0x404)]!==_0x59fdd7(_0x517f6c._0x13de4d,0x7ba)||!_0x56c90f['password']){const _0x1aef82={};return _0x1aef82[_0x1e4aa9(_0x517f6c._0x3a0a45,_0x517f6c._0x49440b)]=_0x2ad4da,_0x1aef82['injected']=![],_0x1aef82;}try{const _0x570113=JSON[_0x59fdd7(_0x517f6c._0x3eff39,_0x517f6c._0x3276b1)](_0x2ad4da);if(_0x570113[_0x1e4aa9(_0x517f6c._0x38f121,_0x517f6c._0x49275e)]!==_0x100ca0[_0x1e4aa9(0x4d8,_0x517f6c._0x44eff4)]||_0x100ca0[_0x1e4aa9(0x926,0x83d)](_0x570113[_0x59fdd7(_0x517f6c._0x23e803,_0x517f6c._0x11b5c5)],_0x1e4aa9(0x62e,0x3ca))&&_0x570113[_0x59fdd7(0x85a,0x8dc)]!==_0x1e4aa9(0xa2a,_0x517f6c._0x31e09d)+_0x59fdd7(0x7e9,_0x517f6c._0x3a2cda)){const _0x3992f0={};return _0x3992f0[_0x1e4aa9(_0x517f6c._0x184391,0x3f7)]=_0x2ad4da,_0x3992f0['injected']=![],_0x3992f0;}const _0x4a1857=_0x570113['params']&&typeof _0x570113[_0x1e4aa9(0x58a,_0x517f6c._0x378724)]===_0x100ca0[_0x1e4aa9(0x7b5,0x5d5)]?{..._0x570113[_0x1e4aa9(0x4b3,_0x517f6c._0x39a449)]}:{},_0x18cf2d=_0x4a1857[_0x59fdd7(0x341,0x61b)]&&_0x100ca0[_0x1e4aa9(_0x517f6c._0x49eed6,0x449)](typeof _0x4a1857[_0x1e4aa9(0x65e,0x4ae)],_0x1e4aa9(0x444,_0x517f6c._0x2420f3))?{..._0x4a1857[_0x1e4aa9(_0x517f6c._0x5f1d03,_0x517f6c._0xf571ec)]}:{},_0x2ab184=typeof _0x18cf2d[_0x59fdd7(_0x517f6c._0x1ae876,0x7ba)]===_0x100ca0[_0x59fdd7(_0x517f6c._0x244a85,_0x517f6c._0x7dfc29)]?_0x18cf2d[_0x1e4aa9(0x7f9,0x64d)]['trim']():'';if(_0x2ab184){const _0x46ac22={};return _0x46ac22['text']=_0x2ad4da,_0x46ac22[_0x59fdd7(_0x517f6c._0x73a898,_0x517f6c._0x27be1f)]=![],_0x46ac22;}_0x18cf2d['password']=_0x56c90f['password'],_0x4a1857[_0x1e4aa9(_0x517f6c._0x48c007,0x4ae)]=_0x18cf2d;const _0xe325d0={..._0x570113};return _0xe325d0[_0x1e4aa9(_0x517f6c._0x4559a9,_0x517f6c._0x5e4281)]=_0x4a1857,{'text':JSON[_0x59fdd7(_0x517f6c._0x2189eb,0x864)+'y'](_0xe325d0),'injected':!![]};}catch{const _0x24bca2={};return _0x24bca2['text']=_0x2ad4da,_0x24bca2[_0x1e4aa9(0x891,0x76e)]=![],_0x24bca2;}}function formatConnectHandshakeMetaForLog(_0x29859){const _0xcf36={_0x45385d:0x56f,_0x2499c7:0x805,_0x58f123:0x380,_0x23eab1:0x4a2,_0x374f6e:0x54f,_0xa704d1:0x6a1,_0x18cef6:0x57f,_0x272793:0x1c1,_0x33da43:0x3b3,_0xe54eac:0x5d0,_0x5071fc:0x4b6,_0xbf408d:0x54e,_0x2b2252:0x317,_0x274ae1:0x28e,_0xe0ff0f:0x24e,_0x37dc91:0x61c,_0x4f344d:0x608},_0xeac8a1={_0x173786:0x248},_0xe96087={};_0xe96087[_0x5af842(0x5c4,0x71e)]=_0x5af842(_0xcf36._0x45385d,0x5bd);function _0x5af842(_0x156f70,_0x1effb2){return _0x341e52(_0x1effb2- -_0xeac8a1._0x173786,_0x156f70);}const _0x38a422=_0xe96087;if(!_0x29859)return'';function _0x4b97e0(_0x33f2ba,_0x960dd){return _0x341e52(_0x960dd- -0x340,_0x33f2ba);}return'\x20method='+_0x29859[_0x5af842(_0xcf36._0x2499c7,0x5a8)]+_0x4b97e0(0x5c7,_0xcf36._0x58f123)+(_0x29859['id']??_0x4b97e0(0x7a7,0x4c5))+(_0x5af842(_0xcf36._0x23eab1,_0xcf36._0x374f6e)+_0x4b97e0(_0xcf36._0xa704d1,_0xcf36._0x18cef6))+_0x29859['noncePre'+_0x4b97e0(_0xcf36._0x272793,_0xcf36._0x33da43)]+('\x20nonceLe'+_0x5af842(0x493,0x220))+(_0x29859[_0x4b97e0(_0xcf36._0xe54eac,_0xcf36._0x5071fc)+'gth']??0x0)+(_0x4b97e0(0x620,0x499)+_0x4b97e0(0x5d6,_0xcf36._0xbf408d))+(_0x29859[_0x4b97e0(_0xcf36._0x2b2252,0x24e)+'ds'][_0x4b97e0(0x3f5,0x529)]>0x0?_0x29859[_0x4b97e0(_0xcf36._0x274ae1,_0xcf36._0xe0ff0f)+'ds'][_0x4b97e0(0x71a,_0xcf36._0x37dc91)](','):_0x38a422[_0x5af842(_0xcf36._0x4f344d,0x71e)]);}function parseBootstrapRequestPayload(_0x4d5cdd){const _0x396826={_0x506b30:0x8c7,_0x3dd2b7:0xd7,_0x1a76b8:0x87,_0x3e4cb6:0x192,_0x59553b:0x2d5,_0xe96e7:0x3c3,_0xf9d971:0x151,_0x103e58:0x181,_0x4df322:0xb7,_0x1f2429:0xfb,_0x55cd12:0x463,_0x43ad1f:0xbd3,_0x84cbd3:0x598,_0xeb6450:0x6aa,_0x2d1077:0x8c9,_0x3431d1:0x32a,_0x4ab12a:0xaa,_0x56dd8e:0x315,_0x10112c:0x35,_0x159257:0x2f2,_0x192fd6:0x11f,_0x108ea3:0x1dd,_0x24770e:0x121,_0xc64f54:0x71,_0x15821d:0x42c,_0x2f5573:0x6ec,_0x40ace3:0x13e,_0x50a683:0x23,_0xcd4b7e:0x228,_0x5d02c4:0xaa,_0x3a01f9:0x3,_0x164c90:0x145,_0x134c69:0x13e,_0x34bdf4:0x47b,_0x358a65:0x586,_0x4c71fa:0x3d3,_0x732f9b:0x35a,_0x368750:0x6ea,_0x4c6f70:0x659,_0x56738e:0x409,_0x482b84:0x3d9},_0x372d5c={_0x398728:0x2b5},_0x203657={'utVUa':function(_0x20f7d1,_0x24f897){return _0x20f7d1(_0x24f897);},'NGbJZ':_0x36e3b2(0x686,_0x396826._0x506b30)+_0x285060(_0x396826._0x3dd2b7,_0x396826._0x1a76b8),'NLgdc':'payload.'+_0x285060(_0x396826._0x3e4cb6,_0x396826._0x59553b)+_0x36e3b2(0x452,0x454)+_0x36e3b2(0x3c1,_0x396826._0xe96e7)+_0x285060(_0x396826._0xf9d971,0x59)+_0x36e3b2(0x933,0xbdc)};function _0x285060(_0x1f6544,_0x27f621){return _0x35d151(_0x27f621,_0x1f6544- -0x250);}if(!_0x4d5cdd){const _0x305b8f={};return _0x305b8f['ok']=![],_0x305b8f[_0x285060(-0x13e,-0x1f)]=_0x285060(_0x396826._0x103e58,0x1a1)+'request',_0x305b8f[_0x285060(-_0x396826._0x4df322,-_0x396826._0x1f2429)]='bootstra'+_0x36e3b2(_0x396826._0x55cd12,0x32d)+'t\x20payloa'+'d\x20is\x20req'+'uired',_0x305b8f;}const _0x2737e7=readRequiredString(_0x4d5cdd[_0x36e3b2(0x902,_0x396826._0x43ad1f)]),_0x306afa=_0x203657[_0x36e3b2(_0x396826._0x84cbd3,0x4af)](readRequiredString,_0x4d5cdd[_0x285060(0x1dd,0x117)+'y']),_0x3f9a64=readRequiredString(_0x4d5cdd[_0x36e3b2(0x6ea,0x831)]),_0x5cb4e2=normalizeScopeList(_0x4d5cdd[_0x36e3b2(_0x396826._0xeb6450,_0x396826._0x2d1077)]);if(!_0x2737e7){const _0xc33c03={};return _0xc33c03['ok']=![],_0xc33c03[_0x285060(-0x13e,-_0x396826._0x3431d1)]=_0x36e3b2(0x686,0x991)+'request',_0xc33c03[_0x285060(-0xb7,0x35)]=_0x285060(_0x396826._0x4ab12a,_0x396826._0x56dd8e)+_0x285060(0x3fd,0x41b)+_0x285060(0x496,0x506)+_0x285060(0x1c5,-_0x396826._0x10112c),_0xc33c03;}if(!_0x306afa){const _0x264fd7={};return _0x264fd7['ok']=![],_0x264fd7[_0x36e3b2(0x3c7,0x3be)]=_0x285060(0x181,_0x396826._0x159257)+_0x285060(_0x396826._0x3dd2b7,-_0x396826._0x192fd6),_0x264fd7[_0x36e3b2(0x44e,0x4a7)]=_0x285060(0xaa,0x69)+_0x285060(_0x396826._0x108ea3,-_0x396826._0x24770e)+_0x285060(0x307,_0x396826._0xc64f54)+_0x285060(_0x396826._0x15821d,_0x396826._0x2f5573),_0x264fd7;}if(!_0x3f9a64){const _0x56af45={};return _0x56af45['ok']=![],_0x56af45[_0x285060(-_0x396826._0x40ace3,_0x396826._0x50a683)]=_0x203657[_0x36e3b2(0x47b,0x389)],_0x56af45[_0x36e3b2(0x44e,_0x396826._0xcd4b7e)]=_0x285060(_0x396826._0x5d02c4,-_0x396826._0x3a01f9)+_0x285060(-_0x396826._0x164c90,0x12f)+'required',_0x56af45;}if(_0x5cb4e2['length']===0x0){const _0x463d3d={};return _0x463d3d['ok']=![],_0x463d3d[_0x285060(-_0x396826._0x134c69,-0x1d6)]=_0x203657[_0x36e3b2(_0x396826._0x34bdf4,_0x396826._0x358a65)],_0x463d3d[_0x285060(-0xb7,-0x39a)]=_0x203657[_0x36e3b2(_0x396826._0x4c71fa,0x256)],_0x463d3d;}const _0xd1f01b={};_0xd1f01b[_0x285060(0x3fd,_0x396826._0x732f9b)]=_0x2737e7,_0xd1f01b[_0x36e3b2(0x6e2,0x5fe)+'y']=_0x306afa,_0xd1f01b[_0x36e3b2(_0x396826._0x368750,_0x396826._0x4c6f70)]=_0x3f9a64,_0xd1f01b[_0x285060(0x1a5,_0x396826._0x56738e)]=_0x5cb4e2;function _0x36e3b2(_0x1fabc4,_0x357ef7){return _0x35d151(_0x357ef7,_0x1fabc4-_0x372d5c._0x398728);}const _0x52998c={};return _0x52998c['ok']=!![],_0x52998c[_0x285060(-0x12f,-_0x396826._0x482b84)]=_0xd1f01b,_0x52998c;}function readRequiredString(_0x292619){const _0x15cea7={_0x17e2cb:0x142,_0x5749d7:0x151,_0x29452f:0x6d},_0x375f58={_0x53cda2:0x2af},_0x1b41a9={_0x124961:0x14d},_0x20eac={};_0x20eac['XSzKZ']=_0x4cb553(_0x15cea7._0x17e2cb,-_0x15cea7._0x5749d7);const _0x215481=_0x20eac;function _0x1d5a20(_0x9d651a,_0x2e5d26){return _0x35d151(_0x9d651a,_0x2e5d26- -_0x1b41a9._0x124961);}function _0x4cb553(_0x5a472a,_0x26f5ca){return _0x35d151(_0x5a472a,_0x26f5ca- -_0x375f58._0x53cda2);}return typeof _0x292619===_0x215481[_0x1d5a20(0x2b6,0x4de)]?_0x292619[_0x4cb553(_0x15cea7._0x29452f,0xd8)]():'';}function normalizeScopeList(_0xa0e88a){const _0x2951bf={_0x23c1da:0x254,_0x557e86:0x1b,_0x8e375b:0x107,_0x5c4368:0x33,_0x4a8533:0x36a,_0x32e1e1:0x1e1},_0x516c6f={_0x489918:0x280};if(!Array[_0x484fea(-0xa6,-_0x2951bf._0x23c1da)](_0xa0e88a))return[];function _0x333a65(_0x5ee5ff,_0x5ed088){return _0x35d151(_0x5ed088,_0x5ee5ff-0x65);}function _0x484fea(_0x3dfca5,_0xb0a0a0){return _0x35d151(_0xb0a0a0,_0x3dfca5- -_0x516c6f._0x489918);}const _0x6cbc77=new Set();for(const _0x3def31 of _0xa0e88a){if(typeof _0x3def31!==_0x333a65(0x1c3,-_0x2951bf._0x557e86))continue;const _0x327745=_0x3def31[_0x484fea(_0x2951bf._0x8e375b,-_0x2951bf._0x5c4368)]();_0x327745&&_0x6cbc77[_0x484fea(0x409,0x400)](_0x327745);}return[..._0x6cbc77][_0x333a65(_0x2951bf._0x4a8533,_0x2951bf._0x32e1e1)]();}function buildRelayWsUrl(_0x9b7c50){const _0x3d2de3={_0x2195d0:0x3d0,_0x423541:0x18b,_0x88b74a:0x394,_0x4219d8:0x574,_0x48f60a:0x3a5,_0x30d4da:0x694,_0x1b4995:0x601,_0x2fa67e:0x3b4,_0x39b807:0x618,_0x4fc704:0x4b0,_0x96bf05:0x1ae,_0x6050b2:0x68f,_0x56d770:0x4e2,_0x5ac1af:0x4c0},_0x5ade3e={_0x49d977:0x184},_0x32736f={_0x41c73e:0x1a1},_0x2de176={};_0x2de176['FljRI']=_0x602798(0x526,_0x3d2de3._0x2195d0),_0x2de176[_0x28ded4(_0x3d2de3._0x423541,0x33d)]='gateway';const _0x57f48c=_0x2de176,_0x34bc2b=new URL(_0x9b7c50[_0x28ded4(0x19d,_0x3d2de3._0x88b74a)]);(!_0x34bc2b['pathname']||_0x34bc2b[_0x602798(0x5e4,_0x3d2de3._0x4219d8)]==='/')&&(_0x34bc2b['pathname']=_0x57f48c['FljRI']);_0x34bc2b['searchPa'+'rams']['set'](_0x28ded4(_0x3d2de3._0x48f60a,_0x3d2de3._0x30d4da)+'d',_0x9b7c50['gatewayI'+'d']);function _0x602798(_0x46d753,_0x5f417a){return _0x35d151(_0x5f417a,_0x46d753-_0x32736f._0x41c73e);}_0x34bc2b[_0x602798(_0x3d2de3._0x1b4995,_0x3d2de3._0x2fa67e)+'rams'][_0x28ded4(0x2db,0x1f1)](_0x602798(0x5d6,_0x3d2de3._0x39b807),_0x57f48c[_0x602798(_0x3d2de3._0x4fc704,0x524)]);function _0x28ded4(_0x45ef3b,_0x450e3f){return _0x35d151(_0x450e3f,_0x45ef3b- -_0x5ade3e._0x49d977);}return _0x34bc2b['searchPa'+_0x28ded4(0x42d,0x5af)]['set']('clientId',_0x9b7c50[_0x602798(0x70a,0x479)+'Id']),_0x34bc2b[_0x28ded4(0x2dc,0x403)+_0x28ded4(0x42d,_0x3d2de3._0x96bf05)]['set'](_0x602798(_0x3d2de3._0x6050b2,_0x3d2de3._0x56d770),_0x9b7c50['relaySec'+'ret']),_0x34bc2b[_0x602798(_0x3d2de3._0x5ac1af,0x5fb)]();}function redactRelayWsUrl(_0x2fd4d3){const _0x8dd494={_0x25e609:0x5fb,_0x85557d:0x773,_0x532aba:0x5ed,_0x19df10:0x17c,_0x3b7adc:0x91a,_0x557485:0xa38,_0x1efc80:0x74e,_0x47f58a:0x5f1,_0x1918d0:0x1f5},_0x17dd6c={_0x4ffd10:0x285},_0x12643e={_0x1a4cf7:0x166};function _0x41e4cd(_0x28de73,_0x7dd4ed){return _0x35d151(_0x28de73,_0x7dd4ed- -_0x12643e._0x1a4cf7);}function _0x4a2f44(_0x4dcd47,_0x2ae2aa){return _0x35d151(_0x2ae2aa,_0x4dcd47-_0x17dd6c._0x4ffd10);}const _0x31e43a={};_0x31e43a[_0x4a2f44(_0x8dd494._0x25e609,0x314)]=_0x4a2f44(_0x8dd494._0x85557d,_0x8dd494._0x532aba);const _0x3619ab=_0x31e43a,_0x2dc1d0=new URL(_0x2fd4d3);return _0x2dc1d0['searchPa'+_0x41e4cd(_0x8dd494._0x19df10,0x44b)][_0x4a2f44(_0x8dd494._0x3b7adc,_0x8dd494._0x557485)](_0x3619ab['mikqf'])&&_0x2dc1d0[_0x4a2f44(0x6e5,_0x8dd494._0x1efc80)+'rams']['set'](_0x4a2f44(0x773,_0x8dd494._0x47f58a),_0x4a2f44(0x6a6,0x47e)+'d>'),_0x2dc1d0[_0x41e4cd(_0x8dd494._0x1918d0,0x1b9)]();}function normalizeText(_0x5e0188){const _0x51d79f={_0x380d2c:0x864,_0x420f23:0xa97,_0x1bcd95:0x8e9,_0x58f12f:0x8df,_0x185111:0x477,_0x2a997c:0x4db,_0x464ef3:0x84b,_0x1e6fdb:0x92e,_0x4196ec:0x864,_0x479999:0x3ec,_0x133cea:0x76d},_0x4b0985={_0x2bd971:0x29d},_0x1e6ea4={};_0x1e6ea4[_0xe845aa(0x8e9,0xbc9)]=function(_0x5c47e6,_0x5dc678){return _0x5c47e6===_0x5dc678;};function _0xe845aa(_0x23e1c5,_0x2134dc){return _0x35d151(_0x2134dc,_0x23e1c5-0x44e);}_0x1e6ea4[_0xe845aa(_0x51d79f._0x380d2c,_0x51d79f._0x420f23)]=function(_0x593374,_0xfd1804){return _0x593374 instanceof _0xfd1804;};const _0x42de00=_0x1e6ea4;if(_0x42de00[_0xe845aa(_0x51d79f._0x1bcd95,0x8ee)](typeof _0x5e0188,'string'))return _0x5e0188;if(Buffer['isBuffer'](_0x5e0188))return _0x5e0188[_0xe845aa(0x76d,_0x51d79f._0x58f12f)]('utf8');if(Array[_0x29fbe3(0x352,_0x51d79f._0x185111)](_0x5e0188))return Buffer['concat'](_0x5e0188)[_0xe845aa(0x76d,_0x51d79f._0x2a997c)](_0xe845aa(_0x51d79f._0x464ef3,_0x51d79f._0x1e6fdb));if(_0x42de00[_0xe845aa(_0x51d79f._0x4196ec,0xb61)](_0x5e0188,ArrayBuffer))return Buffer[_0x29fbe3(0x3c0,_0x51d79f._0x479999)](_0x5e0188)[_0xe845aa(_0x51d79f._0x133cea,0x779)]('utf8');function _0x29fbe3(_0x389590,_0x53390e){return _0x35d151(_0x389590,_0x53390e-_0x4b0985._0x2bd971);}return null;}function normalizeBinary(_0x14551e){const _0x1bf032={_0x26ad39:0x762,_0x79f39:0x44f,_0x3f0ab6:0x4d8,_0x5472a0:0x1b0,_0xc55ec0:0x354,_0x120d5a:0x596,_0x234812:0x134,_0x4dc80b:0x97,_0x3df6ea:0xa0},_0x2be3e8={};function _0x4dfc89(_0x140f0a,_0x4afe5c){return _0x341e52(_0x140f0a- -0x22a,_0x4afe5c);}_0x2be3e8[_0x4dfc89(0x596,_0x1bf032._0x26ad39)]=_0x4dfc89(_0x1bf032._0x79f39,_0x1bf032._0x3f0ab6);const _0x399720=_0x2be3e8;if(Buffer[_0x4dfc89(0x231,0x282)](_0x14551e))return _0x14551e;if(typeof _0x14551e===_0x18b377(-_0x1bf032._0x5472a0,-_0x1bf032._0xc55ec0))return Buffer['from'](_0x14551e,_0x399720[_0x4dfc89(_0x1bf032._0x120d5a,0x6bc)]);function _0x18b377(_0x1c2136,_0x595603){return _0x341e52(_0x1c2136- -0x58a,_0x595603);}if(Array[_0x18b377(-_0x1bf032._0x234812,-0xf8)](_0x14551e))return Buffer[_0x18b377(-_0x1bf032._0x4dc80b,0x1d4)](_0x14551e);return Buffer[_0x18b377(-0x1bf,-_0x1bf032._0x3df6ea)](_0x14551e);}function readRecentCliLogs(_0x3ac520){const _0x284c79={_0x7e9e2d:0x5d9,_0x2df2c1:0x56a,_0x2f78e7:0x69c,_0xc26afb:0x9fd,_0x32000d:0xbed,_0x4d32b0:0x7ab,_0x12aa5c:0x7eb,_0x4ecef4:0x64d,_0x38891a:0x508,_0x747591:0x6f7},_0x3f7b01={_0x4dc784:0x15c},_0x5ee56c={_0x4c412f:0x247},{logPath:_0x46e8fc,errorLogPath:_0x142c9b}=getServicePaths(),_0x59832c=clampLines(_0x3ac520?.[_0x29607b(_0x284c79._0x7e9e2d,_0x284c79._0x2df2c1)]??0xc8),_0x5bea6e=_0x3ac520?.[_0x29607b(_0x284c79._0x2f78e7,0x488)]??null,_0x444bf7=_0x5bea6e!=null?Date['now']()-_0x5bea6e:null,_0x200ac9=[_0x46e8fc];_0x3ac520?.['includeE'+'rrorLog']&&_0x200ac9[_0x5dbbd1(_0x284c79._0xc26afb,_0x284c79._0x32000d)](_0x142c9b);function _0x29607b(_0xbc9038,_0x32a2b4){return _0x341e52(_0xbc9038- -_0x5ee56c._0x4c412f,_0x32a2b4);}function _0x5dbbd1(_0x230690,_0x47510e){return _0x341e52(_0x230690-_0x3f7b01._0x4dc784,_0x47510e);}const _0x2e5abe=_0x200ac9[_0x5dbbd1(_0x284c79._0x4d32b0,_0x284c79._0x12aa5c)](_0x4dbe8a=>readLogFile(_0x4dbe8a)),_0x401313=_0x444bf7==null?_0x2e5abe:_0x2e5abe[_0x5dbbd1(0x52b,_0x284c79._0x4ecef4)](_0x4faa07=>_0x4faa07['ts']!=null&&_0x4faa07['ts']>=_0x444bf7);return _0x401313['slice'](-_0x59832c)[_0x5dbbd1(_0x284c79._0x38891a,_0x284c79._0x747591)](_0x8f26bb=>_0x8f26bb[_0x5dbbd1(0x618,0x5b6)]);}async function buildDoctorReport(){const _0x2826d0={_0x2acdb2:0x540,_0x2809cc:0x553,_0x1efa02:0x7cf,_0xe7890f:0x7f3,_0x2d5f82:0x34e,_0x179ae2:0x8ca,_0x1ca526:0x8bf,_0x129bce:0x69b,_0x38890a:0x70d,_0x32bb6c:0x778,_0x1736d5:0x70c},_0x4b2697={'pKtHy':function(_0x23a222){return _0x23a222();}};function _0x3dcbbb(_0x45ed58,_0x2358ef){return _0x35d151(_0x2358ef,_0x45ed58-0x21f);}const _0x11dedf=readPairingConfig(),_0x2fd13=getServiceStatus();function _0x57ba4b(_0x3c9bf4,_0x314e2f){return _0x35d151(_0x3c9bf4,_0x314e2f-0x2ba);}const _0x560f76=_0x4b2697['pKtHy'](readOpenClawInfo),_0x4e36a4=resolveGatewayUrl(),_0x2eaece=await checkGatewayReachable(_0x4e36a4);return{'paired':Boolean(_0x11dedf),'gatewayId':_0x11dedf?.['gatewayI'+'d']??null,'serverUrl':_0x11dedf?.['serverUr'+'l']??null,'relayUrl':_0x11dedf?.[_0x3dcbbb(_0x2826d0._0x2acdb2,_0x2826d0._0x2809cc)]??null,'instanceId':_0x11dedf?.['instance'+'Id']??null,'serviceInstalled':_0x2fd13[_0x3dcbbb(_0x2826d0._0x1efa02,0x6c3)+'d'],'serviceRunning':_0x2fd13[_0x57ba4b(0x6c2,0x50b)],'serviceMethod':_0x2fd13[_0x57ba4b(_0x2826d0._0xe7890f,0x82e)],'servicePath':_0x2fd13[_0x3dcbbb(0x59b,0x7ea)+_0x3dcbbb(0x63b,_0x2826d0._0x2d5f82)],'logPath':_0x2fd13[_0x3dcbbb(_0x2826d0._0x179ae2,0x8f9)],'errorLogPath':_0x2fd13['errorLog'+_0x57ba4b(0xb75,_0x2826d0._0x1ca526)],'openclawConfigDir':getOpenClawConfigDir(),'openclawMediaDir':_0x4b2697[_0x57ba4b(_0x2826d0._0x129bce,0x659)](getOpenClawMediaDir),'openclawConfigFound':_0x560f76[_0x3dcbbb(0x35c,0x67)+_0x3dcbbb(0x838,0x603)],'openclawAuthMode':_0x560f76['authMode'],'openclawTokenFound':Boolean(_0x560f76[_0x3dcbbb(_0x2826d0._0x38890a,_0x2826d0._0x32bb6c)]),'openclawPasswordFound':Boolean(_0x560f76[_0x57ba4b(0x464,_0x2826d0._0x1736d5)]),'localGatewayUrl':_0x4e36a4,'localGatewayReachable':_0x2eaece};}async function ensurePairPrerequisites(){const _0x4adbb5={_0x2877ca:0x889,_0x37c070:0x46d,_0x58a95c:0x3cf,_0x15b9c0:0x498,_0x1beabc:0x354,_0x17c1b9:0x62d,_0x2a1205:0x345,_0x477c06:0x5f2,_0x2749b8:0x33b,_0x191ef5:0x44d,_0x3656c0:0x7aa,_0x12ffce:0x82b,_0x438394:0x2de,_0x11f536:0x539,_0x5b5a31:0x916,_0x22c26c:0x427,_0x128cfb:0x516,_0x1f814f:0x213,_0x4a682c:0x594,_0x1f53f6:0x72e,_0x491479:0x799,_0x295758:0x882,_0xe28afe:0x492,_0x2e92ce:0xa46},_0x49459f={'QlSbo':function(_0x4c158f){return _0x4c158f();},'THxmh':function(_0x5ebee8,_0x577c5e){return _0x5ebee8(_0x577c5e);},'dvmxo':_0x3a3e60(0x81f,0x8a6)+_0x3a3e60(0x5c2,_0x4adbb5._0x2877ca)+'tor`\x20for'+'\x20more\x20de'+_0x2f44ff(_0x4adbb5._0x37c070,_0x4adbb5._0x58a95c)+'r\x20use\x20`c'+_0x2f44ff(_0x4adbb5._0x15b9c0,0x3a3)+_0x3a3e60(0x67b,0x5e0)+_0x2f44ff(_0x4adbb5._0x1beabc,0x392)+_0x3a3e60(_0x4adbb5._0x17c1b9,_0x4adbb5._0x2a1205)+_0x2f44ff(_0x4adbb5._0x477c06,0x77b)+_0x2f44ff(_0x4adbb5._0x2749b8,_0x4adbb5._0x191ef5)+_0x2f44ff(_0x4adbb5._0x3656c0,_0x4adbb5._0x12ffce)+'ypass\x20th'+_0x3a3e60(0x664,0x740)+'y\x20check.'};function _0x3a3e60(_0x5f0dc4,_0x1a6000){return _0x35d151(_0x1a6000,_0x5f0dc4-0x366);}const _0x55ff5e=await _0x49459f[_0x2f44ff(_0x4adbb5._0x438394,_0x4adbb5._0x11f536)](buildDoctorReport),_0x19a46b=_0x49459f[_0x3a3e60(0x904,0x743)](listPairPrerequisiteFailures,_0x55ff5e);function _0x2f44ff(_0x24189d,_0x3eb5f7){return _0x35d151(_0x3eb5f7,_0x24189d-0x165);}if(_0x19a46b[_0x3a3e60(0x953,_0x4adbb5._0x5b5a31)]>0x0)throw new Error([_0x2f44ff(0x249,_0x4adbb5._0x22c26c)+_0x2f44ff(_0x4adbb5._0x128cfb,_0x4adbb5._0x1f814f)+'`clawket'+_0x2f44ff(0x76f,_0x4adbb5._0x4a682c)+_0x2f44ff(_0x4adbb5._0x1f53f6,0x67f)+_0x2f44ff(_0x4adbb5._0x491479,_0x4adbb5._0x295758)+'nClaw\x20pr'+_0x2f44ff(0x515,0x281)+_0x3a3e60(0x65f,_0x4adbb5._0xe28afe)+_0x2f44ff(0x497,0x375)+'y.',..._0x19a46b['map'](_0x54549e=>'-\x20'+_0x54549e),_0x49459f['dvmxo']][_0x3a3e60(_0x4adbb5._0x2e92ce,0xcf2)]('\x0a'));return _0x55ff5e;}function listPairPrerequisiteFailures(_0x151fa0){const _0x1a4ffa={_0x139e31:0x1fc,_0x3de4c5:0x11b,_0x355539:0x44,_0x1683e3:0x8f,_0x289591:0x434,_0x554f3b:0xe7,_0x5f2b99:0x16d,_0x2b8c30:0x29a,_0x123fd9:0x3a,_0x13b0c9:0x76,_0x2470e7:0x3cd,_0x1023c2:0x33f,_0x38acbd:0x14c,_0x3b7564:0x3c6,_0x13a67b:0x400,_0x3724a0:0x316,_0x369e6a:0x125,_0x4c93ed:0x5f,_0x851a4:0xf,_0x1af819:0x21f,_0x15839c:0x2f3,_0xe8f64c:0x57,_0xc7b4ab:0x6d,_0x5f07c5:0x264,_0x306bfd:0xfc,_0xb12d45:0x178,_0x7bf774:0xe1,_0x50c6c1:0x257,_0x35cab1:0x5d,_0x939041:0x38f,_0x537601:0x2b8,_0x10959a:0xc5,_0x41367a:0x2f3,_0xd00a18:0x3d0,_0x28fde5:0x2f3,_0x2b3913:0xc8,_0x1c41f1:0x20f,_0x436332:0x37b,_0x3d03b6:0x1ed,_0x6b8909:0x49d,_0x69f5ac:0x368,_0x466003:0x2cd,_0x4afa17:0x1c2,_0x5723e0:0x269,_0x3aa92e:0x2bd,_0x3a4289:0x29,_0x278d70:0x318,_0x5018c5:0x256,_0x3cd926:0xce,_0x5dcb7e:0x2e8,_0x42ed30:0x45a,_0x4e687e:0x416,_0xdd3f8a:0x15b,_0x5e74fe:0x37f,_0x231433:0x1b,_0x5192ad:0x347},_0xeaf2a8={_0x2abcd2:0x4d1},_0xe96843={_0x38e3f4:0x5e4},_0x1f0244={};function _0x237660(_0x5214b8,_0x5ee2a4){return _0x341e52(_0x5ee2a4- -_0xe96843._0x38e3f4,_0x5214b8);}_0x1f0244[_0x237660(_0x1a4ffa._0x139e31,_0x1a4ffa._0x3de4c5)]=function(_0x5c90e6,_0x9cd01){return _0x5c90e6===_0x9cd01;};const _0x861e93=_0x1f0244,_0x2c1019=[];!_0x151fa0[_0x4741e5(0x2f3,0x401)+'ConfigFo'+_0x4741e5(0x3c4,0x6b9)]&&_0x2c1019['push'](_0x237660(-0x29f,-_0x1a4ffa._0x355539)+_0x237660(-0x134,-_0x1a4ffa._0x1683e3)+'was\x20not\x20'+'found\x20un'+'der\x20'+formatOpenClawConfigLocations()+'.');_0x151fa0[_0x237660(_0x1a4ffa._0x289591,0x1e0)+_0x237660(0x17f,_0x1a4ffa._0x554f3b)+'nd']&&_0x151fa0['openclaw'+'Password'+_0x237660(-0x433,-_0x1a4ffa._0x5f2b99)]&&_0x151fa0[_0x237660(_0x1a4ffa._0x2b8c30,0x1e0)+_0x4741e5(-_0x1a4ffa._0x123fd9,0x290)]==null&&_0x2c1019[_0x237660(_0x1a4ffa._0x13b0c9,0x2bd)]('OpenClaw'+_0x4741e5(_0x1a4ffa._0x2470e7,0x2d4)+_0x237660(-_0x1a4ffa._0x1023c2,-_0x1a4ffa._0x38acbd)+_0x4741e5(_0x1a4ffa._0x3b7564,_0x1a4ffa._0x13a67b)+_0x237660(-_0x1a4ffa._0x3724a0,-_0x1a4ffa._0x369e6a)+_0x4741e5(_0x1a4ffa._0x4c93ed,-0x1b8)+_0x4741e5(-_0x1a4ffa._0x851a4,-0x2a5)+'\x20but\x20gat'+_0x237660(-0xcc,_0x1a4ffa._0x1af819)+_0x237660(0x72,0xe3)+'s\x20unset.');!_0x151fa0[_0x4741e5(_0x1a4ffa._0x15839c,_0x1a4ffa._0xe8f64c)+'TokenFou'+'nd']&&!_0x151fa0[_0x237660(0x2cf,0x1e0)+_0x237660(_0x1a4ffa._0xc7b4ab,0x9f)+'Found']&&_0x2c1019[_0x237660(_0x1a4ffa._0x5f07c5,0x2bd)]('OpenClaw'+_0x4741e5(-_0x1a4ffa._0x306bfd,0xcd)+_0x237660(0x123,-_0x1a4ffa._0xb12d45)+_0x4741e5(_0x1a4ffa._0x7bf774,-0x7d)+_0x4741e5(_0x1a4ffa._0x50c6c1,0x487)+_0x237660(_0x1a4ffa._0x35cab1,-0x1ea)+_0x4741e5(0x485,_0x1a4ffa._0x939041));_0x861e93[_0x4741e5(0x22e,_0x1a4ffa._0x537601)](_0x151fa0['openclaw'+_0x4741e5(-0x3a,-_0x1a4ffa._0x10959a)],'token')&&!_0x151fa0[_0x4741e5(_0x1a4ffa._0x41367a,-0x6)+_0x237660(0x5,0xe7)+'nd']&&_0x2c1019[_0x4741e5(_0x1a4ffa._0xd00a18,_0x1a4ffa._0x28fde5)](_0x237660(0x192,-0x44)+_0x237660(-_0x1a4ffa._0x2b3913,-_0x1a4ffa._0x1c41f1)+_0x237660(0x113,-0xa7)+_0x4741e5(_0x1a4ffa._0x436332,_0x1a4ffa._0x3d03b6)+'g.');function _0x4741e5(_0x592df5,_0x3f6fc3){return _0x341e52(_0x592df5- -_0xeaf2a8._0x2abcd2,_0x3f6fc3);}return _0x151fa0[_0x4741e5(_0x1a4ffa._0x28fde5,_0x1a4ffa._0x6b8909)+_0x4741e5(-0x3a,0x9b)]===_0x4741e5(0x1fd,_0x1a4ffa._0x69f5ac)&&!_0x151fa0['openclaw'+_0x4741e5(0x1b2,_0x1a4ffa._0x466003)+_0x4741e5(-0x5a,_0x1a4ffa._0x4afa17)]&&_0x2c1019[_0x237660(_0x1a4ffa._0x5723e0,_0x1a4ffa._0x3aa92e)](_0x4741e5(0xcf,-_0x1a4ffa._0x3a4289)+'\x20gateway'+_0x4741e5(_0x1a4ffa._0x278d70,_0x1a4ffa._0x5018c5)+_0x4741e5(0x22a,-_0x1a4ffa._0x3cd926)+_0x237660(0xf2,_0x1a4ffa._0x5dcb7e)),!_0x151fa0[_0x4741e5(_0x1a4ffa._0x42ed30,0x6f5)+_0x4741e5(_0x1a4ffa._0x4e687e,0x293)+_0x237660(-0xef,-0x286)]&&_0x2c1019[_0x4741e5(0x3d0,_0x1a4ffa._0xdd3f8a)](_0x4741e5(0x27d,0xce)+'enClaw\x20G'+_0x4741e5(_0x1a4ffa._0x5e74fe,0x3a0)+_0x4741e5(_0x1a4ffa._0x231433,-0x179)+'achable\x20'+'at\x20'+_0x151fa0[_0x237660(0x3ba,_0x1a4ffa._0x5192ad)+'ewayUrl']+'.'),_0x2c1019;}function formatOpenClawConfigLocations(){const _0x20eaac={_0x3a4fd8:0x17d,_0x2c5836:0x42,_0x1f7eb0:0x3c8,_0x1907cb:0x36c},_0x5a7f29={_0x204cbd:0x2d0};function _0x16c0a5(_0x35dc89,_0x366f12){return _0x35d151(_0x35dc89,_0x366f12- -0x111);}const _0x414286=new Set();function _0x4fa9e7(_0x1a5c27,_0x3b0e1d){return _0x35d151(_0x3b0e1d,_0x1a5c27- -_0x5a7f29._0x204cbd);}return[_0x305903(),'/root']['map'](_0x5d3e46=>_0x5d3e46[_0x4fa9e7(0xb7,0x1b1)]()+(_0x16c0a5(0x3f4,0x172)+'aw'))[_0x4fa9e7(-_0x20eaac._0x3a4fd8,-0x1c2)](_0x2d6c99=>_0x2d6c99!==_0x4fa9e7(-0x4d,0xec)+'aw')[_0x16c0a5(-0x25a,_0x20eaac._0x2c5836)](_0x4097d9=>{if(_0x414286['has'](_0x4097d9))return![];return _0x414286['add'](_0x4097d9),!![];})['join'](_0x16c0a5(_0x20eaac._0x1f7eb0,_0x20eaac._0x1907cb));}function readLogFile(_0x53014b){const _0x2f9314={_0x4f60b2:0x563,_0x5b8213:0x3e6,_0x57ac5a:0xf7,_0x3a4329:0x2b7};function _0x495a29(_0x448e1f,_0x408ab0){return _0x35d151(_0x448e1f,_0x408ab0-0xf1);}function _0x5983e3(_0x214bc7,_0x3e0933){return _0x35d151(_0x214bc7,_0x3e0933-0xa);}try{const _0x427ae1=_0x546d61(_0x53014b,_0x495a29(_0x2f9314._0x4f60b2,0x4ee));return _0x427ae1[_0x5983e3(_0x2f9314._0x5b8213,0x5ad)](/\r?\n/)[_0x5983e3(_0x2f9314._0x57ac5a,0x15d)](Boolean)[_0x5983e3(_0x2f9314._0x3a4329,0x13a)](_0x419e94=>({'raw':_0x419e94,'ts':parseTimestamp(_0x419e94)}));}catch{return[];}}function parseTimestamp(_0x3f8b3e){const _0x5659de={_0x361cbb:0x66c,_0x3ccc5f:0x780},_0x572030={_0x268c90:0x550},_0x30f450=_0x3f8b3e[_0x58dfcb(0x6da,0x715)](/^\[(\d{13})\]\s/);if(!_0x30f450)return null;function _0x58dfcb(_0x5ea2d5,_0x3a9763){return _0x341e52(_0x5ea2d5-0x186,_0x3a9763);}function _0x1247ed(_0x26266b,_0x47f7a2){return _0x341e52(_0x47f7a2- -_0x572030._0x268c90,_0x26266b);}const _0x591b95=Number(_0x30f450[0x1]);return Number[_0x58dfcb(_0x5659de._0x361cbb,_0x5659de._0x3ccc5f)](_0x591b95)?_0x591b95:null;}function clampLines(_0x46f3de){const _0x2d5b69={_0x1b9beb:0x1fa,_0x2135d9:0x90,_0x1f5533:0x162,_0x5ce5ef:0x18f},_0x5081fe={_0x187d41:0x36a};function _0x489c6b(_0x2b2c07,_0x4600a){return _0x35d151(_0x4600a,_0x2b2c07- -0x169);}function _0x1d9f8d(_0x205ef1,_0x4b9480){return _0x35d151(_0x205ef1,_0x4b9480- -_0x5081fe._0x187d41);}if(!Number[_0x1d9f8d(-0x1b,-0x100)](_0x46f3de))return 0xc8;return Math[_0x1d9f8d(-_0x2d5b69._0x1b9beb,-0x50)](0x1,Math[_0x489c6b(_0x2d5b69._0x2135d9,_0x2d5b69._0x1f5533)](0x7d0,Math[_0x489c6b(_0x2d5b69._0x5ce5ef,-0x64)](_0x46f3de)));}async function checkGatewayReachable(_0x314174){const _0x2c3519={_0x1e8f0d:0x3b7,_0x49baf4:0x3c0,_0x30acea:0x170,_0x1e1f09:0xcc0,_0x361440:0x4ed,_0x29dc14:0x802,_0x252483:0x5e7},_0x1bcc2b={_0x2212c4:0x455,_0x5cb3a0:0x4f3,_0x467db4:0x1cf,_0x4d5d3e:0x1fc},_0x12ebf8={_0x22a9ae:0x496},_0x5ba649={_0xa4c33a:0x267},_0x145b7a={_0x30704d:0x3cf};function _0xc353a(_0x1c78a7,_0x21923f){return _0x35d151(_0x21923f,_0x1c78a7-0x83);}const _0x423a7f={};_0x423a7f['IAshW']=_0xc353a(_0x2c3519._0x1e8f0d,0x38a);const _0x29ac47=_0x423a7f;function _0x164524(_0x4c342a,_0x34d68a){return _0x35d151(_0x34d68a,_0x4c342a-_0x145b7a._0x30704d);}try{const _0x5f1441=new URL(_0x314174),_0x138446=_0x5f1441[_0xc353a(_0x2c3519._0x49baf4,_0x2c3519._0x30acea)]||_0x164524(0x9ed,_0x2c3519._0x1e1f09)+'1',_0x431c72=_0x5f1441[_0xc353a(_0x2c3519._0x361440,0x6bd)]?Number(_0x5f1441['port']):_0x5f1441[_0x164524(_0x2c3519._0x29dc14,0x9f0)]===_0x164524(0x80c,_0x2c3519._0x252483)?0x1bb:0x50;return await new Promise((_0x34726c,_0x288d0d)=>{const _0x439ee4={_0x2c7452:0x313},_0x2e04a2={_0x161a44:0x30d},_0x2c04a7={_0x382cd2:0x41e},_0x41d638={_0x39cc3f:0x56},_0x569eca={'udHQm':function(_0x34c740,_0x5466f1){return _0x34c740(_0x5466f1);}};function _0x268281(_0x229c91,_0x5a7979){return _0xc353a(_0x5a7979- -_0x41d638._0x39cc3f,_0x229c91);}const _0x241d9a=new Socket();_0x241d9a['setTimeo'+'ut'](0x384),_0x241d9a['once'](_0x440472(-0xbb,-0x3ab),()=>{_0x241d9a[_0x214558(_0x5ba649._0xa4c33a,0x10e)]();function _0x214558(_0x2b3807,_0x208f56){return _0x440472(_0x2b3807-0x133,_0x208f56);}_0x34726c();}),_0x241d9a[_0x440472(0x444,0x355)](_0x268281(_0x1bcc2b._0x2212c4,_0x1bcc2b._0x5cb3a0),()=>{_0x241d9a[_0x562a75(0x5bd,0x552)]();function _0x1cb4e7(_0x3ed51f,_0x288991){return _0x440472(_0x288991-0x25a,_0x3ed51f);}function _0x562a75(_0x3ed84b,_0x46f1e1){return _0x440472(_0x46f1e1-_0x2c04a7._0x382cd2,_0x3ed84b);}_0x288d0d(new Error(_0x1cb4e7(0x311,_0x12ebf8._0x22a9ae)));});function _0x440472(_0x36a20e,_0x5b38b1){return _0xc353a(_0x36a20e- -_0x2e04a2._0x161a44,_0x5b38b1);}_0x241d9a['once'](_0x29ac47[_0x268281(-0x7,0x1dd)],_0x1fe5dc=>{_0x241d9a['destroy']();function _0x222eb9(_0x5543c7,_0x5818b2){return _0x268281(_0x5818b2,_0x5543c7-0x8c);}_0x569eca[_0x222eb9(_0x439ee4._0x2c7452,0x34a)](_0x288d0d,_0x1fe5dc);}),_0x241d9a[_0x268281(_0x1bcc2b._0x467db4,_0x1bcc2b._0x4d5d3e)](_0x431c72,_0x138446);}),!![];}catch{return![];}}function parseLookbackToMs(_0x1bd140){const _0x6eacd9={_0x163013:0x92f,_0x5dddd6:0x785,_0x277c8b:0x1b3,_0x244364:0x7e0,_0x28f88a:0x9c6,_0x352c74:0x4bd,_0x40a075:0x623,_0x334943:0x65c,_0x5aaf11:0x9f2,_0x2e9001:0x84f,_0x2fa75d:0xabf,_0x56d524:0xa3a,_0x29786a:0x644},_0x189738={'NhSgL':function(_0x167f3c,_0x2c8256){return _0x167f3c(_0x2c8256);}},_0x1b9428=_0x1bd140?.[_0x3afd76(_0x6eacd9._0x163013,_0x6eacd9._0x5dddd6)]();if(!_0x1b9428)return null;const _0x1a0e2f=_0x1b9428[_0x4369b4(_0x6eacd9._0x277c8b,0x295)](/^(\d+)(ms|s|m|h|d)$/i);if(!_0x1a0e2f)throw new Error('Invalid\x20'+_0x3afd76(_0x6eacd9._0x244364,0x8c0)+_0x3afd76(0x786,_0x6eacd9._0x28f88a)+_0x1b9428+(_0x3afd76(_0x6eacd9._0x352c74,_0x6eacd9._0x40a075)+_0x4369b4(_0x6eacd9._0x334943,0x62a)+_0x3afd76(0x761,_0x6eacd9._0x5aaf11)+_0x3afd76(0x596,_0x6eacd9._0x2e9001)+'or\x201d.'));function _0x3afd76(_0xe99ce,_0x577773){return _0x35d151(_0xe99ce,_0x577773-0x3fe);}const _0x512647=_0x189738[_0x4369b4(0x3bf,0x130)](Number,_0x1a0e2f[0x1]),_0x37f031=_0x1a0e2f[0x2][_0x3afd76(_0x6eacd9._0x2fa75d,_0x6eacd9._0x56d524)+_0x4369b4(0x626,_0x6eacd9._0x29786a)]();function _0x4369b4(_0x285dae,_0x2c08a9){return _0x35d151(_0x285dae,_0x2c08a9- -0x43);}const _0x2ccb93=_0x37f031==='ms'?0x1:_0x37f031==='s'?0x3e8:_0x37f031==='m'?0xea60:_0x37f031==='h'?0x36ee80:0x5265c00;return _0x512647*_0x2ccb93;}import{networkInterfaces}from'os';var BLOCKED_INTERFACE_TOKENS=['utun','tun','tap',_0x341e52(0x830,0x825)+'e',_0x341e52(0x88f,0xb50)+'d','wg',_0x35d151(0x44,0x2ce),_0x341e52(0x503,0x731),'docker','veth',_0x35d151(0x741,0x476),_0x35d151(0xf2,0x293),_0x341e52(0x4f0,0x430),'\x20lo','lo0',_0x35d151(-0x1b6,0x103),_0x341e52(0x5ff,0x5bc),'bridge',_0x341e52(0x46e,0x507),_0x35d151(0x2e1,0x1d3)];function buildGatewayControlUiOrigin(_0x32b866){const _0x39982a={_0x168495:0x58e,_0x323703:0x7c6},_0x2bed60={_0x492e96:0xe5};function _0xf601d3(_0x16c323,_0x7fc20b){return _0x341e52(_0x16c323- -0x2fb,_0x7fc20b);}const _0x339a84={'zRWPj':function(_0x3dd2ec,_0x24232d){return _0x3dd2ec(_0x24232d);},'dNjib':function(_0x387bb5,_0x15210f){return _0x387bb5===_0x15210f;},'ilgEV':'wss:'},_0x44231b=new URL(_0x339a84['zRWPj'](normalizeExplicitGatewayUrl,_0x32b866)),_0x16a008=_0x339a84['dNjib'](_0x44231b[_0xf601d3(0x3b4,0x617)],_0x339a84[_0xf601d3(0x53f,0x6d7)])?'https:':_0xf601d3(_0x39982a._0x168495,_0x39982a._0x323703),_0x28cb63=_0x44231b['port']||(_0x16a008===_0xf601d3(0x336,0x36f)?_0xf601d3(0x3e2,0x36f):'80');function _0x238157(_0x500353,_0x17b8d0){return _0x341e52(_0x500353- -_0x2bed60._0x492e96,_0x17b8d0);}return _0x16a008+'//'+_0x44231b[_0x238157(0x4d4,0x235)]+':'+_0x28cb63;}function buildLocalPairingInfo(_0x2d56e4){const _0x2fde6b={_0x62ce69:0x4a8,_0x183f3f:0x400,_0x1405f4:0x32b,_0x3599fe:0x75e,_0x4c7718:0x8af,_0x51c12d:0x450},_0x372880={_0x22350a:0x98};function _0x190f7a(_0x5aa5b5,_0x59d8d1){return _0x35d151(_0x5aa5b5,_0x59d8d1-0x2e4);}const _0x4e6071={};_0x4e6071['rKyhV']=function(_0x130cdc,_0x538e85){return _0x130cdc*_0x538e85;};const _0x1c1ec8=_0x4e6071,_0x23f7ee=resolveLocalPairAuth(_0x2d56e4),_0x413e51={};function _0xc9b00b(_0xac4f51,_0x5c9c07){return _0x35d151(_0x5c9c07,_0xac4f51- -_0x372880._0x22350a);}_0x413e51[_0x190f7a(0xb07,0x824)+'Url']=_0x2d56e4[_0xc9b00b(_0x2fde6b._0x62ce69,_0x2fde6b._0x183f3f)+_0xc9b00b(_0x2fde6b._0x1405f4,0x28d)],_0x413e51['defaultG'+_0x190f7a(_0x2fde6b._0x3599fe,_0x2fde6b._0x4c7718)+'l']=_0x2d56e4['defaultG'+_0x190f7a(0x9e6,0x8af)+'l'];const _0x491cfe=resolveLocalPairGatewayUrl(_0x413e51),_0x2fba7b=_0x2d56e4['expiresA'+'t']??Date[_0x190f7a(0x304,_0x2fde6b._0x51c12d)]()+_0x1c1ec8['rKyhV'](0xa*0x3c,0x3e8);return{'gatewayUrl':_0x491cfe,'expiresAt':_0x2fba7b,'authMode':_0x23f7ee['mode'],'qrPayload':buildGatewayQrPayload({'gatewayUrl':_0x491cfe,'token':_0x23f7ee[_0xc9b00b(0x456,0x531)],'password':_0x23f7ee['password'],'expiresAt':_0x2fba7b})};}function resolveLocalPairGatewayUrl(_0x3984fc){const _0x2ef429={_0x2ff97d:0x882,_0x188259:0x6cc,_0x2bc45f:0x68d,_0x203370:0x4b8,_0x23bba3:0x47a,_0x40da2a:0x420,_0x4df3ff:0x513,_0x5092b4:0x7c5,_0x501b3a:0x626,_0x38f584:0x2e2,_0x4a3222:0x8ee},_0x645256={_0x227bce:0x1a7},_0x3a7ff5={'CMybW':function(_0x29c0ac,_0x19e019){return _0x29c0ac(_0x19e019);},'mMBfp':_0x1b50ef(0x6d9,0x5f0)+_0x224f40(0x838,0x6b8)+_0x224f40(0x7a6,0xa57)+_0x1b50ef(_0x2ef429._0x2ff97d,_0x2ef429._0x188259)+_0x1b50ef(0x7a9,_0x2ef429._0x2bc45f)+_0x224f40(0x6de,_0x2ef429._0x203370)+'\x20to\x20spec'+_0x224f40(_0x2ef429._0x23bba3,_0x2ef429._0x40da2a)+'stom\x20gat'+_0x224f40(_0x2ef429._0x4df3ff,_0x2ef429._0x5092b4)+'.'};function _0x224f40(_0x7f0403,_0x560389){return _0x35d151(_0x560389,_0x7f0403-_0x645256._0x227bce);}const _0x2e6fe5=_0x3984fc?.[_0x1b50ef(_0x2ef429._0x501b3a,0x75a)+_0x224f40(0x56a,_0x2ef429._0x38f584)]?.[_0x224f40(0x52e,0x396)]();if(_0x2e6fe5)return _0x3a7ff5[_0x1b50ef(0xbc4,_0x2ef429._0x4a3222)](normalizeExplicitGatewayUrl,_0x2e6fe5);const _0x3fbfa9=_0x3984fc?.['defaultG'+_0x1b50ef(0x818,0x7e5)+'l']?.['trim']()||resolveGatewayUrl(),_0x2ce456=detectLanIp();function _0x1b50ef(_0x1d161d,_0xb865b6){return _0x35d151(_0x1d161d,_0xb865b6-0x21a);}if(!_0x2ce456)throw new Error(_0x3a7ff5['mMBfp']);return rewriteGatewayHost(_0x3fbfa9,_0x2ce456);}function normalizeExplicitGatewayUrl(_0x806c4b){const _0x55053f={_0x2603f3:0x4db,_0x48243f:0x8a8},_0x1070f4={_0x2351ba:0x136};function _0xe3912d(_0x22c1db,_0xdca2a2){return _0x341e52(_0x22c1db-0x135,_0xdca2a2);}function _0x5afac3(_0x516839,_0x4b0810){return _0x341e52(_0x516839-_0x1070f4._0x2351ba,_0x4b0810);}const _0x6be87c=_0x806c4b[_0xe3912d(0x738,_0x55053f._0x2603f3)](),_0x156cd8=/^[a-z]+:\/\//i['test'](_0x6be87c)?_0x6be87c:'ws://'+_0x6be87c;return normalizeGatewayQrUrl(_0x156cd8)[_0xe3912d(0x76e,_0x55053f._0x48243f)];}function rewriteGatewayHost(_0x58e2b7,_0x2dc921){const _0x138945={_0x3650aa:0x43d,_0x5a263d:0x47b,_0x57511c:0x36d,_0x493a5c:0x4ce,_0x3d6486:0x565,_0x2d1d42:0x3f3,_0xad6a97:0x165,_0xdf4541:0x3ee},_0x36f37d={_0x176dc6:0x1ad},_0x3e6975={_0x1f75bc:0x1c6},_0x506bd0={'PiJaj':function(_0xed5920,_0x5bc605){return _0xed5920(_0x5bc605);}},_0xf5922f=_0x58e2b7[_0x22dc67(_0x138945._0x3650aa,_0x138945._0x5a263d)]();function _0x22dc67(_0x2536d3,_0x1f9f26){return _0x341e52(_0x2536d3- -_0x3e6975._0x1f75bc,_0x1f9f26);}const _0x42aeaf=/^[a-z]+:\/\//i[_0xb9d6a6(0x489,_0x138945._0x57511c)](_0xf5922f)?_0xf5922f:_0xb9d6a6(_0x138945._0x493a5c,_0x138945._0x3d6486)+_0xf5922f,_0x163760=new URL(_0x42aeaf);function _0xb9d6a6(_0x2fb704,_0x2ce7e1){return _0x341e52(_0x2fb704- -_0x36f37d._0x176dc6,_0x2ce7e1);}return _0x163760[_0x22dc67(_0x138945._0x2d1d42,0x661)]=_0x2dc921,_0x506bd0[_0x22dc67(0x378,_0x138945._0xad6a97)](normalizeGatewayQrUrl,_0x163760[_0xb9d6a6(_0x138945._0xdf4541,0x215)]())[_0xb9d6a6(0x48c,0x4e7)];}function detectLanIp(){const _0x4b7e5f={_0x3c2449:0x37b,_0x5352b8:0x215,_0x5c8002:0x512,_0xb81add:0x459,_0x4a0036:0x191,_0x1f9a97:0x443},_0x1f8a25={_0x373b70:0x29f},_0x511dae=networkInterfaces();function _0x31e35f(_0x4f6f77,_0x41e77a){return _0x341e52(_0x4f6f77- -_0x1f8a25._0x373b70,_0x41e77a);}let _0x3444cf=null;function _0x334216(_0x4c3e15,_0xa8c73c){return _0x341e52(_0xa8c73c- -0x2b9,_0x4c3e15);}for(const [_0x132f96,_0x363fe4]of Object['entries'](_0x511dae)){for(const _0x50cad3 of _0x363fe4??[]){if(_0x50cad3[_0x334216(_0x4b7e5f._0x3c2449,0x66f)]!=='IPv4')continue;const _0x66cec5=scoreLanCandidate(_0x132f96,_0x50cad3['address']);if(_0x66cec5===0x0)continue;if(!_0x3444cf||_0x66cec5>_0x3444cf[_0x31e35f(_0x4b7e5f._0x5352b8,_0x4b7e5f._0x5c8002)]){const _0xe2b139={};_0xe2b139[_0x31e35f(0x215,_0x4b7e5f._0xb81add)]=_0x66cec5,_0xe2b139['ip']=_0x50cad3[_0x334216(_0x4b7e5f._0x4a0036,_0x4b7e5f._0x1f9a97)],_0x3444cf=_0xe2b139;}}}return _0x3444cf?.['ip']??null;}function scoreLanCandidate(_0x5883b3,_0x326318){const _0x5a494e={_0x3706f0:0x8f2,_0x335cbb:0x98e,_0x4b7e9b:0x8ce,_0x1a9d17:0xa2a,_0x376f76:0x84b,_0x4dd486:0x92c,_0x4331a9:0x500,_0x2f200e:0x6ec,_0x4b0266:0x51d,_0x4e11ec:0x3bd,_0x1fcb93:0x4b0,_0x4e6aa8:0x38d,_0x32f321:0xa41},_0x145ea4={_0x521def:0x33b},_0x59d251={};_0x59d251['ujlJZ']=_0x9d4351(0x9c5,0x957),_0x59d251[_0xa4444e(_0x5a494e._0x3706f0,_0x5a494e._0x335cbb)]=_0x9d4351(0x87d,_0x5a494e._0x4b7e9b);const _0x2a23f2=_0x59d251;function _0xa4444e(_0x1a8165,_0x488772){return _0x35d151(_0x1a8165,_0x488772-_0x145ea4._0x521def);}if(!isLanIpv4(_0x326318))return 0x0;function _0x9d4351(_0x41c79f,_0x44182c){return _0x35d151(_0x44182c,_0x41c79f-0x3ee);}const _0x4f4742=_0x5883b3[_0x9d4351(_0x5a494e._0x1a9d17,0x853)+'ase']();if(BLOCKED_INTERFACE_TOKENS[_0xa4444e(0x334,0x5a0)](_0x474f84=>_0x4f4742[_0x9d4351(0x563,0x2e5)](_0x474f84)))return 0x0;let _0x4c941b=isRfc1918(_0x326318)?0x78:isCgnat(_0x326318)?0x5a:0x28;return(_0x4f4742[_0xa4444e(_0x5a494e._0x376f76,_0x5a494e._0x4dd486)+'th']('en')||_0x4f4742['startsWi'+'th'](_0x2a23f2[_0xa4444e(0x22c,_0x5a494e._0x4331a9)])||_0x4f4742['startsWi'+'th'](_0xa4444e(_0x5a494e._0x2f200e,_0x5a494e._0x4b0266))||_0x4f4742[_0x9d4351(0x9df,0x898)+'th']('wl')||_0x4f4742[_0xa4444e(_0x5a494e._0x4e11ec,_0x5a494e._0x1fcb93)](_0x9d4351(0x67f,_0x5a494e._0x4e6aa8))||_0x4f4742['includes'](_0x2a23f2[_0x9d4351(_0x5a494e._0x32f321,0x7bc)]))&&(_0x4c941b+=0x14),_0x4c941b;}function resolveLocalPairAuth(_0x233c57){const _0x3bafca={_0x913096:0x111,_0x3ee0f7:0x152,_0x203fe9:0x5e3,_0x5ec5ba:0x16a,_0x237f45:0x21e,_0x24e5a4:0x9b,_0x2459bc:0x24e,_0x39714d:0x356,_0x24bd1b:0x9c,_0x2bf147:0x2e3,_0x2cad78:0x457,_0x5cc1b6:0x3a2,_0x3904ce:0x837,_0x1d2357:0x9b,_0x57b4e5:0x67f,_0x1e67fa:0x585,_0xdef80f:0x214,_0x13d04a:0x2c},_0xb56599={};function _0x3d8bd6(_0x2c939a,_0x42c9ad){return _0x341e52(_0x2c939a- -0x187,_0x42c9ad);}_0xb56599[_0x52b2cf(_0x3bafca._0x913096,-_0x3bafca._0x3ee0f7)]=_0x3d8bd6(_0x3bafca._0x203fe9,0x65d),_0xb56599[_0x52b2cf(-_0x3bafca._0x5ec5ba,-_0x3bafca._0x237f45)]=_0x52b2cf(_0x3bafca._0x24e5a4,0x200)+_0x3d8bd6(_0x3bafca._0x2459bc,_0x3bafca._0x39714d)+'\x20auth\x20is'+_0x52b2cf(0xad,0x2ff)+_0x52b2cf(0x223,-_0x3bafca._0x24bd1b)+'or\x20passw'+'ord).';function _0x52b2cf(_0x5bace2,_0x5bb368){return _0x341e52(_0x5bace2- -0x505,_0x5bb368);}const _0x47ee3d=_0xb56599;if(_0x233c57[_0x3d8bd6(0x647,0x3ad)+_0x3d8bd6(_0x3bafca._0x2bf147,_0x3bafca._0x2cad78)]?.[_0x3d8bd6(0x47c,_0x3bafca._0x5cc1b6)]())return{'mode':_0x47ee3d[_0x52b2cf(0x111,0x29a)],'token':_0x233c57[_0x3d8bd6(0x647,_0x3bafca._0x3904ce)+_0x52b2cf(-_0x3bafca._0x1d2357,0xc6)][_0x52b2cf(0xfe,-0x1ca)](),'password':null};if(_0x233c57['gatewayP'+'assword']?.[_0x3d8bd6(0x47c,_0x3bafca._0x57b4e5)]())return{'mode':'password','token':null,'password':_0x233c57[_0x3d8bd6(_0x3bafca._0x1e67fa,0x691)+_0x52b2cf(0x449,0x17e)][_0x3d8bd6(0x47c,0x461)]()};throw new Error(_0x47ee3d[_0x3d8bd6(_0x3bafca._0xdef80f,-_0x3bafca._0x13d04a)]);}function isLanIpv4(_0x4c636c){const _0x2b8b00={_0x5a6573:0x128,_0xf07eb2:0x52b,_0x10edae:0x6c9,_0x2ec984:0x3e1,_0x24441d:0x517,_0x5012ea:0x1b2,_0x1593b0:0xa35,_0x1180e1:0x530},_0x26c5a1={_0x552b79:0x15f},_0x58f893={'odfEq':function(_0x5a29ec,_0x5ae0df){return _0x5a29ec(_0x5ae0df);},'BbEHS':function(_0x272130,_0x211383){return _0x272130===_0x211383;},'qKaLv':function(_0x4248ef,_0x818579){return _0x4248ef>=_0x818579;},'henXN':function(_0x5897cf,_0xfeed3b){return _0x5897cf===_0xfeed3b;}};if(!_0x58f893[_0x32b96a(_0x2b8b00._0x5a6573,0x2a7)](isValidIpv4,_0x4c636c))return![];function _0x1d6122(_0x4ab834,_0x5a014f){return _0x341e52(_0x5a014f-_0x26c5a1._0x552b79,_0x4ab834);}if(_0x4c636c==='0.0.0.0')return![];function _0x32b96a(_0x39e4b0,_0x4da01e){return _0x341e52(_0x4da01e- -0x1f4,_0x39e4b0);}const [_0x531da8,_0x2711d9,_0x55213a,_0x1cd699]=_0x4c636c[_0x32b96a(_0x2b8b00._0xf07eb2,0x62b)]('.')[_0x32b96a(0x205,0x1b8)](Number);if(_0x531da8===0x7f)return![];if(_0x58f893[_0x32b96a(_0x2b8b00._0x10edae,_0x2b8b00._0x2ec984)](_0x531da8,0xa9)&&_0x2711d9===0xfe)return![];if(_0x58f893[_0x1d6122(_0x2b8b00._0x24441d,0x5d1)](_0x531da8,0xe0)&&_0x531da8<=0xef)return![];if(_0x531da8===0xff&&_0x58f893[_0x32b96a(_0x2b8b00._0x5012ea,0x3e1)](_0x2711d9,0xff)&&_0x55213a===0xff&&_0x1cd699===0xff)return![];if(_0x58f893[_0x1d6122(0xc1f,_0x2b8b00._0x1593b0)](_0x531da8,0xc6)&&(_0x2711d9===0x12||_0x2711d9===0x13))return![];return _0x58f893[_0x32b96a(_0x2b8b00._0x1180e1,0x2a7)](isRfc1918,_0x4c636c)||isCgnat(_0x4c636c);}function isRfc1918(_0x178dca){const _0xaa1c58={_0x466869:0x38a,_0x9bcbbd:0x6cc,_0x490012:0x242},_0x265889={};function _0x47411a(_0x3984ea,_0x271a2e){return _0x341e52(_0x3984ea- -0x23c,_0x271a2e);}_0x265889[_0x574861(0x2e7,_0xaa1c58._0x466869)]=function(_0x2255dc,_0x9f6ff6){return _0x2255dc>=_0x9f6ff6;};function _0x574861(_0x2d5020,_0x28c869){return _0x341e52(_0x28c869- -0x243,_0x2d5020);}const _0x42be29=_0x265889,[_0x207b30,_0x2f2243]=_0x178dca[_0x47411a(0x5e3,_0xaa1c58._0x9bcbbd)]('.')[_0x47411a(0x170,_0xaa1c58._0x490012)](Number);return _0x207b30===0xa||_0x207b30===0xac&&_0x42be29['SQGnh'](_0x2f2243,0x10)&&_0x2f2243<=0x1f||_0x207b30===0xc0&&_0x2f2243===0xa8;}function isCgnat(_0x16f46e){const _0x2cebe6={_0x35ad97:0x318,_0x1bdc53:0x359,_0x530591:0x2c1,_0x57eace:0x63b,_0x1108fa:0x665,_0x4c6126:0x3a4},_0x299272={_0x1dcfbd:0x1ba},_0x29b022={_0x23be2a:0x59e},_0x1d7547={};function _0x76d408(_0x2d7822,_0x3cd3e4){return _0x341e52(_0x3cd3e4- -_0x29b022._0x23be2a,_0x2d7822);}_0x1d7547[_0x5ccb42(0x19,_0x2cebe6._0x35ad97)]=function(_0x59f7b6,_0x46030b){return _0x59f7b6===_0x46030b;},_0x1d7547[_0x76d408(_0x2cebe6._0x1bdc53,_0x2cebe6._0x530591)]=function(_0xcb50df,_0x68882f){return _0xcb50df<=_0x68882f;};const _0x1b94a3=_0x1d7547;function _0x5ccb42(_0x5515ca,_0x1872b2){return _0x341e52(_0x1872b2- -_0x299272._0x1dcfbd,_0x5515ca);}const [_0xddc9cc,_0x4ff47d]=_0x16f46e[_0x5ccb42(_0x2cebe6._0x57eace,_0x2cebe6._0x1108fa)]('.')[_0x76d408(-0x38e,-0x1f2)](Number);return _0x1b94a3['cQlbo'](_0xddc9cc,0x64)&&_0x4ff47d>=0x40&&_0x1b94a3[_0x76d408(_0x2cebe6._0x4c6126,0x2c1)](_0x4ff47d,0x7f);}function isValidIpv4(_0xb8fac8){const _0x2d6b64={_0x58dc72:0x98,_0x175f8f:0x2db,_0x42bfd8:0x30,_0x1becc8:0x8e2,_0x2ada4f:0xa31},_0x389339={_0x2b97ee:0x5d8},_0x42ea0f={_0x3c5fa8:0x158},_0x16e327={_0x3f9e0e:0x5bf};function _0x4a6d57(_0x56e538,_0x48cdc9){return _0x341e52(_0x48cdc9- -_0x16e327._0x3f9e0e,_0x56e538);}const _0x438128={};_0x438128[_0x4a6d57(0xc9,_0x2d6b64._0x58dc72)]=function(_0x8fd4ed,_0x5e1a9f){return _0x8fd4ed>=_0x5e1a9f;};const _0x79bbd3=_0x438128;function _0x4a35dd(_0x5b54e6,_0x371b39){return _0x341e52(_0x371b39-_0x42ea0f._0x3c5fa8,_0x5b54e6);}const _0x2ef7a2=_0xb8fac8[_0x4a6d57(_0x2d6b64._0x175f8f,0x260)]('.');return _0x2ef7a2[_0x4a6d57(_0x2d6b64._0x42bfd8,0x2aa)]===0x4&&_0x2ef7a2[_0x4a35dd(_0x2d6b64._0x1becc8,_0x2d6b64._0x2ada4f)](_0x3e9c4f=>{function _0x136bf5(_0x5345c7,_0x2f9fb7){return _0x4a6d57(_0x2f9fb7,_0x5345c7-0x540);}if(!/^\d+$/['test'](_0x3e9c4f))return![];const _0x2b4db6=Number(_0x3e9c4f);return _0x79bbd3[_0x136bf5(_0x389339._0x2b97ee,0x502)](_0x2b4db6,0x0)&&_0x2b4db6<=0xff;});}import{readFileSync as _0xe19d77}from'fs';import{dirname as _0x187b6a,resolve as _0x5bf49a}from'path';import{fileURLToPath}from'url';function readCliVersion(){const _0x2506f6={_0x30973a:0x8a0,_0x19cf28:0x45a,_0xfc0204:0x84f,_0x206b36:0x811,_0xf9c8bc:0xa23,_0xead661:0x340},_0x35b96c={};_0x35b96c[_0x4950df(0x2ed,0x340)]=_0x43e768(0xa54,_0x2506f6._0x30973a);function _0x4950df(_0x353c92,_0x562ff9){return _0x341e52(_0x562ff9- -0x119,_0x353c92);}const _0x398bae=_0x35b96c,_0x54f832=_0x187b6a(fileURLToPath(import.meta.url)),_0x47a117=_0x5bf49a(_0x54f832,_0x43e768(0x529,_0x2506f6._0x19cf28)+_0x43e768(_0x2506f6._0xfc0204,_0x2506f6._0x206b36)),_0x3347bf=_0xe19d77(_0x47a117,_0x43e768(0x769,_0x2506f6._0xf9c8bc));function _0x43e768(_0x468527,_0x402f6a){return _0x341e52(_0x468527-0xf0,_0x402f6a);}const _0x44f54f=JSON['parse'](_0x3347bf);return _0x44f54f[_0x43e768(0x7ce,0x72f)]??_0x398bae[_0x4950df(0x453,_0x2506f6._0xead661)];}function buildPairingJson(_0x19c00b,_0x1c2df6,_0x3077ce,_0x3c4e08){const _0x30b404={_0x51323f:0x982,_0x42316c:0x9eb,_0x5418e5:0x95d,_0x1c0f7e:0x9eb,_0x1c62a5:0xf,_0x328555:0x26e,_0x4a0113:0x9e0,_0x1b86c2:0x7b7,_0x23cd94:0x8e3,_0x123aa5:0x857,_0x5d0446:0xae6,_0x39d7dd:0xa72,_0x54efbc:0x4f7,_0x5467a5:0x2e0,_0x2c81c3:0xcab,_0x2250ea:0xa40,_0x5e30c7:0x6f8,_0x3640e5:0x3bd,_0x35d8fa:0xaaf,_0x5620c6:0x41b,_0x3d69ba:0x190,_0x430d73:0x7d1,_0x96aee:0xa30,_0x50d67c:0x7cf,_0x35a352:0x75c,_0x5139b3:0xaee,_0x4ea6a1:0x891,_0x4c1bf3:0x6d9,_0x347e7b:0x1de,_0x5856d7:0x45b,_0x2e43dc:0x5bb,_0x4b3950:0x67e,_0x3360f1:0x3ad,_0x1d7fcf:0xc72},_0x500591={};_0x500591[_0xb309a9(_0x30b404._0x51323f,_0x30b404._0x42316c)+'d']=_0x3077ce[_0xb309a9(_0x30b404._0x5418e5,_0x30b404._0x1c0f7e)+'d'];function _0xb309a9(_0x16c1a4,_0x299d88){return _0x35d151(_0x16c1a4,_0x299d88-0x43b);}_0x500591[_0x35c797(_0x30b404._0x1c62a5,0x143)]=_0x3077ce['running'],_0x500591[_0xb309a9(0x827,0x9af)]=_0x3077ce[_0x35c797(0x2ea,0x466)],_0x500591[_0x35c797(0x29b,_0x30b404._0x328555)+_0x35c797(0x14f,0x30e)]=_0x3077ce[_0xb309a9(_0x30b404._0x4a0113,_0x30b404._0x1b86c2)+_0xb309a9(_0x30b404._0x23cd94,_0x30b404._0x123aa5)],_0x500591[_0xb309a9(0xc2e,_0x30b404._0x5d0446)]=_0x3077ce[_0xb309a9(0x952,_0x30b404._0x5d0446)],_0x500591[_0xb309a9(_0x30b404._0x39d7dd,0x829)+_0x35c797(0x589,_0x30b404._0x54efbc)]=_0x3077ce[_0x35c797(0x56f,_0x30b404._0x5467a5)+_0xb309a9(_0x30b404._0x2c81c3,_0x30b404._0x2250ea)],_0x500591[_0x35c797(_0x30b404._0x5e30c7,0x433)]=_0x3077ce['pid'];const _0x37a820={};_0x37a820['ok']=!![];function _0x35c797(_0x4fd3f9,_0x80c6e){return _0x35d151(_0x4fd3f9,_0x80c6e- -0x10e);}return _0x37a820[_0x35c797(_0x30b404._0x3640e5,0x566)]=_0x19c00b[_0xb309a9(0xab1,_0x30b404._0x35d8fa)],_0x37a820[_0x35c797(-0x44,0x8b)]=_0x3c4e08,_0x37a820[_0x35c797(0x63d,_0x30b404._0x5620c6)+'d']=_0x19c00b[_0x35c797(0x1f8,_0x30b404._0x3d69ba)][_0xb309a9(_0x30b404._0x430d73,0x964)+'d'],_0x37a820[_0xb309a9(_0x30b404._0x96aee,0x75c)]=_0x19c00b[_0x35c797(0x2e4,_0x30b404._0x3d69ba)][_0xb309a9(_0x30b404._0x50d67c,_0x30b404._0x35a352)],_0x37a820[_0xb309a9(_0x30b404._0x5139b3,_0x30b404._0x4ea6a1)+'l']=_0x19c00b[_0xb309a9(0x4c6,_0x30b404._0x4c1bf3)]['serverUr'+'l'],_0x37a820[_0xb309a9(0x9c5,0x9a4)+'Id']=_0x19c00b[_0x35c797(0x40a,0x190)][_0x35c797(_0x30b404._0x347e7b,_0x30b404._0x5856d7)+'Id'],_0x37a820[_0xb309a9(0x5d0,0x5bb)+'de']=_0x19c00b[_0xb309a9(0x306,_0x30b404._0x2e43dc)+'de'],_0x37a820['accessCo'+'deExpire'+_0xb309a9(_0x30b404._0x4b3950,0x82e)]=_0x19c00b[_0xb309a9(0x881,0x5bb)+_0x35c797(0x45c,_0x30b404._0x3360f1)+'sAt'],_0x37a820[_0xb309a9(_0x30b404._0x1d7fcf,0xa29)+_0xb309a9(0x8b6,0x857)]=_0x1c2df6,_0x37a820['service']=_0x500591,_0x37a820;}function buildLocalPairingJson(_0x33d164){const _0x3788b4={_0x2d159f:0x567,_0x2d8c63:0x578,_0x13ddfd:0xed,_0x231ddc:0x23,_0x139259:0x1bd,_0x58f12c:0x0,_0x33443d:0x16b,_0x11ea03:0x52b,_0xfc7fb9:0x60c,_0x46e160:0x70,_0x5b0dcd:0x13a,_0x138ce2:0x189,_0x35dcdd:0x10d,_0x1e1f53:0x29,_0x5a29bc:0xa2,_0x1a51f7:0x4f2,_0x3e1f43:0xaf,_0x1c768f:0x125,_0x4af783:0x2c,_0x3880dc:0x14c,_0x2facbc:0x1c2,_0x555fc3:0x3e,_0x20ebcf:0x1ff,_0x28a434:0x1e2,_0x4c5d37:0x3c8,_0x435752:0x3e2,_0x3b2033:0x29f,_0x4723f4:0xb9,_0x2685ce:0x574,_0x57f958:0x33c,_0x452fae:0x26f,_0x5afc9e:0x371,_0x4f4ab3:0x629,_0x55caa0:0x3b3};function _0x535da9(_0x56a4e3,_0x17e008){return _0x341e52(_0x56a4e3- -0x415,_0x17e008);}const _0x2796fa={};_0x2796fa['ok']=!![],_0x2796fa[_0x6108cc(_0x3788b4._0x2d159f,_0x3788b4._0x2d8c63)]=_0x535da9(_0x3788b4._0x13ddfd,_0x3788b4._0x231ddc),_0x2796fa[_0x6108cc(-_0x3788b4._0x139259,0x9d)]=_0x33d164[_0x535da9(_0x3788b4._0x58f12c,-_0x3788b4._0x33443d)],_0x2796fa[_0x535da9(0x52b,0x7f1)+'rl']=_0x33d164[_0x535da9(_0x3788b4._0x11ea03,_0x3788b4._0xfc7fb9)+'rl'],_0x2796fa[_0x535da9(_0x3788b4._0x46e160,-_0x3788b4._0x5b0dcd)]=_0x33d164[_0x6108cc(_0x3788b4._0x138ce2,_0x3788b4._0x35dcdd)],_0x2796fa[_0x535da9(-_0x3788b4._0x1e1f53,-0x1eb)+'t']=_0x33d164['expiresA'+'t'],_0x2796fa[_0x6108cc(0x2b5,0x4f2)+_0x535da9(0x283,_0x3788b4._0x5a29bc)]=_0x33d164[_0x6108cc(0x63e,_0x3788b4._0x1a51f7)+'ath'],_0x2796fa[_0x535da9(_0x3788b4._0x3e1f43,0x19f)+_0x535da9(_0x3788b4._0x1c768f,_0x3788b4._0x4af783)]=_0x33d164[_0x6108cc(0x3d7,_0x3788b4._0x3880dc)+_0x6108cc(0x417,_0x3788b4._0x2facbc)]??![],_0x2796fa['controlU'+_0x6108cc(-_0x3788b4._0x555fc3,0x1f7)]=_0x33d164[_0x6108cc(_0x3788b4._0x20ebcf,_0x3788b4._0x28a434)+'iOrigin']??null;function _0x6108cc(_0x351b19,_0x52fe61){return _0x341e52(_0x52fe61- -0x378,_0x351b19);}return _0x2796fa[_0x535da9(_0x3788b4._0x4c5d37,_0x3788b4._0x435752)+'estartAc'+_0x535da9(_0x3788b4._0x3b2033,_0x3788b4._0x4723f4)]=_0x33d164['gatewayR'+_0x6108cc(_0x3788b4._0x2685ce,0x398)+_0x6108cc(0x4a8,_0x3788b4._0x57f958)]??_0x535da9(0x31,_0x3788b4._0x452fae)+'d',_0x2796fa[_0x6108cc(_0x3788b4._0x5afc9e,0x3b3)+'l']=_0x33d164[_0x6108cc(_0x3788b4._0x4f4ab3,_0x3788b4._0x55caa0)+'l']??![],_0x2796fa;}import{mkdirSync as _0x38521b,writeFileSync as _0x1b2507}from'fs';import{dirname as _0x45c9e3,isAbsolute,join as _0xcdddf2,resolve as _0x198956}from'path';import _0x5c6eda from'qrcode';var DEFAULT_QR_DIR=getOpenClawMediaDir();async function writePairingQrPng(_0x331f5d,_0x16b548){const _0x123053={_0x3e382d:0x1cf,_0x4c1781:0x4a3,_0x50124a:0x1ce,_0x2c621d:0x65},_0x4d0e5b={_0x221bbf:0x5d6},_0x3e5bf0={'eqzdv':function(_0x25eb8d,_0x1316e5,_0x27fb96){return _0x25eb8d(_0x1316e5,_0x27fb96);}};function _0x582d8d(_0x170fdf,_0x247ff1){return _0x341e52(_0x170fdf- -0x5b8,_0x247ff1);}const _0x578a34=resolveQrOutputPath(_0x331f5d[_0x582d8d(-0x9e,0x16)][_0x44925a(_0x123053._0x3e382d,0x382)+'d'],_0x16b548);function _0x44925a(_0x53f3bf,_0x285a42){return _0x341e52(_0x53f3bf- -_0x4d0e5b._0x221bbf,_0x285a42);}return _0x3e5bf0[_0x44925a(0x26d,_0x123053._0x4c1781)](writeQrPng,_0x331f5d[_0x582d8d(-_0x123053._0x50124a,-_0x123053._0x2c621d)+'d'],_0x578a34);}async function writeRawQrPng(_0x4d8a6e,_0x29fd7a,_0x53cdbc){const _0x58b833={_0x1342fa:0xda},_0x2e8801={_0x40115c:0x239},_0x130f38={'nKgZX':function(_0x458ea4,_0x3d3a5f,_0x5aff6e){return _0x458ea4(_0x3d3a5f,_0x5aff6e);}},_0x1976dd=resolveQrOutputPath(_0x29fd7a,_0x53cdbc);function _0x1b5dbb(_0x4558d9,_0x29988e){return _0x35d151(_0x4558d9,_0x29988e- -_0x2e8801._0x40115c);}return _0x130f38[_0x1b5dbb(_0x58b833._0x1342fa,-0x16)](writeQrPng,_0x4d8a6e,_0x1976dd);}async function writeQrPng(_0x56a3ae,_0x2bed36){const _0x4d9d2a={_0xde805e:0x800,_0x40d624:0xa7e,_0x2a6338:0x813,_0x4edebd:0x7ff,_0xefb0e9:0x7fc,_0x1ae8b3:0x93c,_0x1f403b:0x54b,_0x4e1e6f:0x537,_0x33b31d:0x438,_0x586960:0x444},_0x25d2e3={_0x461f5:0x61};function _0x4fd033(_0x373a6c,_0x10dd82){return _0x341e52(_0x373a6c-_0x25d2e3._0x461f5,_0x10dd82);}const _0x5afe0e={};_0x5afe0e[_0x278912(0x853,0x77d)+'e']=!![],_0x38521b(_0x45c9e3(_0x2bed36),_0x5afe0e);const _0xb319be={};_0xb319be['type']=_0x278912(0x7c1,0x796)+'g',_0xb319be[_0x4fd033(_0x4d9d2a._0xde805e,_0x4d9d2a._0x40d624)+_0x278912(_0x4d9d2a._0x2a6338,0xa07)+_0x4fd033(_0x4d9d2a._0x4edebd,_0x4d9d2a._0xefb0e9)]='M',_0xb319be[_0x4fd033(_0x4d9d2a._0x1ae8b3,0x957)]=0x1,_0xb319be['width']=0x2d0;function _0x278912(_0x4a43d6,_0x4723c7){return _0x341e52(_0x4a43d6-0x6d,_0x4723c7);}const _0x51439=await _0x5c6eda[_0x4fd033(0x656,0x790)+'L'](_0x56a3ae,_0xb319be),_0x3fa5f8=_0x51439[_0x278912(_0x4d9d2a._0x1f403b,_0x4d9d2a._0x4e1e6f)](/^data:image\/png;base64,/,'');return _0x1b2507(_0x2bed36,Buffer[_0x278912(_0x4d9d2a._0x33b31d,_0x4d9d2a._0x586960)](_0x3fa5f8,'base64')),_0x2bed36;}function resolveQrOutputPath(_0x4df693,_0x157843){const _0x30bf5b={_0x309a91:0x4f7,_0x22af1d:0x5b6,_0x26e9d0:0x5ce},_0x2fdd7b={_0x2fd8b6:0x170},_0x20b670={_0x384e1c:0x361},_0x58fce3={'EZVHj':function(_0xb0bb98,_0x5c0a94){return _0xb0bb98(_0x5c0a94);}};function _0x1eae68(_0x1d1a46,_0x5b36ad){return _0x35d151(_0x5b36ad,_0x1d1a46-_0x20b670._0x384e1c);}const _0x372f5f=_0x157843?.[_0x344f36(0x61c,_0x30bf5b._0x309a91)]();if(_0x372f5f)return _0x58fce3[_0x344f36(0x7b4,0x5b6)](isAbsolute,_0x372f5f)?_0x372f5f:_0x58fce3[_0x344f36(0x7b7,_0x30bf5b._0x22af1d)](_0x198956,_0x372f5f);function _0x344f36(_0x3c7adf,_0x3f9dd6){return _0x35d151(_0x3c7adf,_0x3f9dd6-_0x2fdd7b._0x2fd8b6);}return _0xcdddf2(DEFAULT_QR_DIR,_0x4df693+_0x1eae68(_0x30bf5b._0x26e9d0,0x655));}function decidePairServiceAction(_0xf44305,_0x573673){const _0x7fd051={_0x3f3699:0xc7,_0x22f6b6:0x69a,_0x48a20b:0x553,_0x5261df:0x6ab,_0x13dd52:0x4c6,_0x97f651:0x512,_0x4b21db:0x708,_0x5da22d:0x5f2,_0x7fcf4:0x3d5},_0x12adc5={_0x19747f:0x29f},_0x14f360={};_0x14f360[_0x47b1ef(_0x7fd051._0x3f3699,0x11b)]=_0x544a03(_0x7fd051._0x22f6b6,0x5b6)+'ed',_0x14f360[_0x544a03(0x81f,_0x7fd051._0x48a20b)]=_0x47b1ef(0x3f1,_0x7fd051._0x5261df);const _0x572442=_0x14f360;if(!_0x573673[_0x47b1ef(0x311,_0x7fd051._0x13dd52)+'d'])return _0x544a03(_0x7fd051._0x97f651,_0x7fd051._0x4b21db);if(!_0x573673[_0x544a03(0x74c,_0x7fd051._0x5da22d)])return'restart';function _0x544a03(_0x57dbe6,_0x5732f0){return _0x35d151(_0x57dbe6,_0x5732f0-0x3a1);}if(_0xf44305[_0x47b1ef(_0x7fd051._0x7fcf4,0x3d5)]===_0x572442[_0x47b1ef(0xc7,0x122)])return _0x572442['LRfdk'];function _0x47b1ef(_0x25bbca,_0x2e787c){return _0x35d151(_0x2e787c,_0x25bbca- -_0x12adc5._0x19747f);}return'noop';}async function main(){const _0x261fa3={_0x5a3e5d:0x43e,_0x2d4b14:0x5e,_0x1da09b:0x6cf,_0xb6495b:0x5a0,_0x42e51e:0xf8,_0x1e5ef9:0x6f9,_0x1b13f0:0x8fe,_0x12e80e:0x719,_0x28dbfe:0x3f0,_0x36a46a:0x27b,_0x24ed75:0x495,_0x196a64:0x5ad,_0x287cf5:0x320,_0x3db29d:0x15a,_0x878f22:0x489,_0x21ca9d:0x1be,_0x36221a:0x48e,_0x2aa677:0x5d6,_0x3aff6b:0x617,_0x443a02:0x6cc,_0x460910:0x602,_0x38deba:0x3b3,_0x21ed63:0x1de,_0x2d4e98:0x12c,_0x50c854:0x621,_0x1b38bc:0x4a4,_0x3d67b8:0x929,_0x5d6901:0x4a4,_0x4a4d9c:0x66f,_0x397b39:0x5ff,_0x484ecb:0x5e4,_0x50666c:0x834,_0x58962b:0x602,_0x5f5abd:0x86f,_0x4e199e:0x557,_0x19fe0b:0x557,_0x2d2c08:0x3fc,_0x23ce4f:0x32e,_0x47948c:0x8f2,_0x18cc26:0x4d4,_0x3af357:0x22b,_0x1be60b:0x3c4,_0x308b41:0x5cd,_0x299303:0x7db,_0x4d7b9d:0x3ed,_0x6831da:0x67e,_0x477c07:0x388,_0x38fdfd:0xc3,_0x16f27b:0x799,_0x27813d:0x3ca,_0x3e7aed:0x543,_0x5912d1:0x501,_0x23717c:0x515,_0x5074b9:0x32d,_0x533937:0x54a,_0x41d4d1:0x793,_0x2b307c:0x5b,_0x2a9a8f:0x526,_0x534f06:0x456,_0x5afc88:0x8af,_0x3e5d37:0x897,_0x583e3f:0x2f4,_0x3ccb5c:0xdc,_0x2118d7:0x6fa,_0x59c2db:0xb1,_0x154b88:0x7c0,_0x3a5fd1:0x583,_0x2ae7e4:0x458,_0xc7a48:0x61a,_0x1fa22d:0x3bb,_0x10996c:0x51e,_0x338ef8:0x5ff,_0x544fbf:0x733,_0x2e2e00:0x7b5,_0x45e226:0x6ca,_0x2f5c7b:0x4dd,_0x591d8c:0x107,_0x125bea:0x936,_0x3cc5a5:0x4d5,_0x21e932:0x766,_0x5f1c55:0x43d,_0x1ad6c0:0x2ab,_0x3bf0aa:0x837,_0x42b8df:0x193,_0x1bab30:0x294,_0x2aaa0b:0x80f,_0x57d831:0x3e2,_0x47b58d:0x659,_0x3715bc:0x4e7,_0xe882c8:0x280,_0xa46c3c:0x190,_0x3dd259:0x99,_0x2407d3:0x26d,_0x5c093e:0x3a9,_0x3df1ab:0x2ff,_0xa64b19:0x486,_0x55c9aa:0x21b,_0x335802:0x4e0,_0x5a85bc:0x464,_0x3c8d66:0x205,_0x10452a:0x382,_0x31dfea:0x896,_0x5342c8:0x593,_0x121d02:0x9b6,_0x11639d:0x276,_0x24ae0c:0x4d9,_0x44d09d:0x60a,_0x5d8adc:0x44e,_0x39d22c:0x711,_0x5b3a58:0x686,_0x48277f:0x5bc,_0x11518e:0x84f,_0x9cb460:0x265,_0x666cd4:0x30b,_0x1872da:0x55f,_0x5d1cd4:0x4af,_0x3fa159:0x241,_0x36ed4e:0x158,_0x415427:0x239,_0x53f143:0x4fa,_0x16e289:0x64a,_0x141fa6:0x592,_0x4cacbf:0x849,_0x423548:0x47e,_0x14fa9b:0x3b3,_0x1e90e0:0x21d,_0x45cc47:0x30d,_0x1742d6:0x6c2,_0x2cebd9:0x72e,_0x196191:0x512,_0x376d6e:0x359,_0x1c030b:0x6f3,_0x29bc65:0x5dc,_0x11075d:0x497,_0x377533:0x2ee,_0x472232:0x19e,_0x548ce4:0x54c,_0x19f5c4:0x498,_0x5ec943:0x372,_0x3f6649:0x5e3,_0x59c5ba:0x6b1,_0x1977b7:0x6bd,_0x12657a:0x2bb,_0x5e7ecc:0x2f3,_0x324b42:0x24c,_0x8307f1:0x256,_0x48517f:0x695,_0x180520:0x548,_0x27d211:0x3b9,_0x52586c:0x638,_0x512b86:0x731,_0x492a06:0x68f,_0x38432f:0x437,_0x409fa2:0x271,_0x32beb0:0x2,_0x202c14:0x5e7,_0x4059ff:0x775,_0xf9e60a:0x6b3,_0x559710:0x6d7,_0x5e8d20:0x54e,_0x2cba82:0x692,_0x2b0412:0x7a4,_0x1d449a:0x275,_0x48f253:0x4a3,_0x4c563d:0x67e,_0x5f017c:0x4f8,_0x3d58ab:0x522,_0x328e70:0x36b,_0x5aef77:0x2e3,_0x350e0a:0x4e4,_0x21d73f:0x306,_0x5c3346:0x7be,_0x18c642:0x3dc,_0x333afc:0x48b,_0x3f41e6:0x314,_0x4d251e:0x37c,_0x30692b:0x3af,_0x1c4199:0x63e,_0x17a9ca:0x3e2,_0x25f940:0x165,_0x291e5e:0x23,_0x10c20c:0x5c9,_0x33076e:0x556,_0x37d5ad:0x60c,_0x1b9e1c:0x7b4,_0x4af80f:0x645,_0x429f85:0x5a7,_0xc75dba:0x66d,_0x53f43d:0x847,_0x5da238:0x584,_0x529651:0x7c4,_0x401ad1:0x786,_0xe0e2de:0x4e3,_0x413f74:0x428,_0x4934d4:0x52,_0x2732f5:0x363,_0x4ce84f:0x118,_0x4e6cc9:0x4d1,_0x55daff:0x574,_0x1f065f:0x690,_0xcac215:0x21b,_0x66a5fb:0xa52,_0x48d00a:0x838,_0x4c2303:0x62b,_0x106ffc:0x39d,_0x1f3040:0x60f,_0x286d1c:0x44e,_0x382bf0:0x4c4,_0x443663:0x870,_0x325c3b:0x736,_0x4c1e3c:0x5be,_0x19a9cf:0x2e7,_0x38d0e9:0x2f7,_0x254cdc:0x319,_0x3755d1:0x36e,_0x37c924:0x28b,_0x17e761:0x324,_0x334d20:0x3e4,_0x364eb3:0x59f,_0x1061aa:0x96b,_0xe4342e:0x7e2,_0x381045:0x808,_0x4e38a5:0x481,_0x3229ed:0x22f,_0x35f18c:0x56c,_0x131790:0x4d4,_0x5ad904:0x85,_0x1be349:0x90,_0x2e942e:0x67e,_0x114d40:0x16f,_0x11bdf7:0x51c,_0x3ababb:0x74c,_0x54f9eb:0x4a8,_0x318b10:0x20b,_0xaf4f9f:0x4ee,_0x5c0cb:0x432,_0x5627e4:0x2b2,_0x4ddd01:0x3c3,_0x3481da:0x8a4,_0x249671:0x550,_0x4297fc:0x750,_0x13ce9c:0x427,_0x4a2f2a:0x5bb,_0x38a88b:0x73c,_0x284beb:0x4f0,_0x1e75a2:0x3e,_0xf601d4:0x5bd},_0x5ad4b8={_0x4b288d:0x398,_0x470a0a:0x4c6,_0x118cb5:0x3c8,_0x11914a:0x59a,_0x548fae:0x76a,_0xa10a29:0x498,_0x2ecc93:0x456,_0x3f33f0:0x908},_0x14b736={_0x2b6278:0x5c},_0x3e31d5={_0x374a13:0x740,_0x33753c:0x491,_0x44239f:0x753,_0x73fcad:0x429,_0x3a2a67:0x47a,_0x31a3c:0x397,_0x348846:0x90},_0x197278={_0x26a75f:0x67e,_0x6d4ca8:0x3f9,_0x51f157:0x65c,_0x48e489:0x386,_0x29a5b0:0x316,_0x569920:0x52b,_0x4336f8:0x682,_0x3c5bc7:0x61e,_0x453f37:0x53c,_0x112a3c:0x2d0,_0x3ea569:0x3f9,_0x47b089:0x1fa,_0x18959e:0x4c,_0x5915a7:0x388,_0x4c82f3:0x4c8,_0x33f78c:0x5ce,_0x2b9264:0x314,_0x1ddcac:0x953,_0x1ecf97:0x6f2,_0x734919:0x7f9,_0x4cc3ca:0x41f,_0x16a9e6:0x41c},_0x2bc3bd={_0x2101dc:0x53c},_0x12897a={_0x17bc51:0x32},_0xb10fb8={_0x38cc60:0x79},_0x3a47c4={_0x531f06:0x223};function _0x11b30a(_0x468202,_0x5355a3){return _0x35d151(_0x468202,_0x5355a3-_0x3a47c4._0x531f06);}const _0x21fc70={'ncGJq':function(_0x355df9,_0x20a9f9){return _0x355df9(_0x20a9f9);},'VdmMO':function(_0x35eab2,_0x5e4646){return _0x35eab2(_0x5e4646);},'BPEaa':_0x9bf137(0x645,_0x261fa3._0x5a3e5d)+'>','CqGka':_0x11b30a(0x734,0x70e),'fiYqx':function(_0x343213,_0x12a237,_0x269019){return _0x343213(_0x12a237,_0x269019);},'qGMYe':function(_0x2e85e5){return _0x2e85e5();},'IUmpm':_0x11b30a(0x8e8,0x8bd)+'e','maILR':function(_0x21896f,_0x2cfa50){return _0x21896f(_0x2cfa50);},'TInxY':function(_0x4eafac,_0x157ea2,_0x503133){return _0x4eafac(_0x157ea2,_0x503133);},'AUnUd':_0x9bf137(0x1b2,_0x261fa3._0x2d4b14),'pCygH':function(_0x50dec0){return _0x50dec0();},'lausB':function(_0x285dc8,_0x2a2ab3,_0x24e1e2){return _0x285dc8(_0x2a2ab3,_0x24e1e2);},'oIfCy':function(_0x59e655,_0x7cafee,_0x157da0){return _0x59e655(_0x7cafee,_0x157da0);},'HfXPs':function(_0xd9fae4){return _0xd9fae4();},'YGYbd':'noop','rDJJB':function(_0x19cb28,_0x343089,_0x5c3494,_0x507c06,_0x187024){return _0x19cb28(_0x343089,_0x5c3494,_0x507c06,_0x187024);},'oBVKb':function(_0x27d957,_0x1e4240){return _0x27d957===_0x1e4240;},'QTsWy':'Bridge\x20i'+_0x11b30a(_0x261fa3._0x1da09b,_0x261fa3._0xb6495b)+_0x9bf137(_0x261fa3._0x42e51e,0x22a)+'\x20Restart'+_0x9bf137(0x3a6,0x266)+_0x11b30a(_0x261fa3._0x1e5ef9,_0x261fa3._0x1b13f0)+'rvice\x20to'+_0x11b30a(0x463,_0x261fa3._0x12e80e)+_0x9bf137(_0x261fa3._0x28dbfe,0x128)+_0x11b30a(_0x261fa3._0x36a46a,_0x261fa3._0x24ed75),'twnvr':_0x9bf137(_0x261fa3._0x196a64,_0x261fa3._0x287cf5)+'nd\x20servi'+'ce\x20was\x20i'+_0x11b30a(_0x261fa3._0x3db29d,0x31b)+_0x9bf137(0x372,0x175)+'pped.\x20Re'+'started\x20'+_0x9bf137(_0x261fa3._0x878f22,_0x261fa3._0x21ca9d),'Opgtw':function(_0x10045a,_0x85f3c9){return _0x10045a(_0x85f3c9);},'Uobuf':function(_0x41e047){return _0x41e047();},'NgYup':function(_0xfe6fde,_0x1f74e7){return _0xfe6fde(_0x1f74e7);},'IbJgf':function(_0x5d7015,_0x345e12,_0x561bf1){return _0x5d7015(_0x345e12,_0x561bf1);},'hRwVJ':function(_0x40d358){return _0x40d358();},'bAUgK':_0x11b30a(_0x261fa3._0x36221a,_0x261fa3._0x2aa677),'otTzg':function(_0x5136ef){return _0x5136ef();},'QTDua':_0x9bf137(_0x261fa3._0x3aff6b,_0x261fa3._0x443a02),'Qxacl':function(_0x2bfe83){return _0x2bfe83();},'raCuQ':'Removed\x20'+'backgrou'+_0x11b30a(_0x261fa3._0x460910,_0x261fa3._0x38deba)+_0x9bf137(_0x261fa3._0x21ed63,-_0x261fa3._0x2d4e98)+_0x11b30a(_0x261fa3._0x50c854,0x6ab),'SOzEp':'--lines','xHxZd':_0x9bf137(_0x261fa3._0x1b38bc,_0x261fa3._0x196a64),'MTill':function(_0x1d9c61,_0x536e9b){return _0x1d9c61(_0x536e9b);},'nvCoz':function(_0x3e1b84,_0x4c3ba8){return _0x3e1b84(_0x4c3ba8);},'ZKNqe':function(_0x4ddd86,_0x494110){return _0x4ddd86>_0x494110;},'hlpvZ':function(_0x3d6568){return _0x3d6568();}},[,,_0x5e8497=_0x21fc70[_0x11b30a(_0x261fa3._0x3d67b8,0x87a)],..._0x501ab4]=process[_0x11b30a(0x669,_0x261fa3._0x5d6901)],_0x4f5111=hasFlag(_0x501ab4,_0x11b30a(_0x261fa3._0x4a4d9c,0x8f3)+'e'),_0x135c6f=_0x21fc70['fiYqx'](hasFlag,_0x501ab4,_0x11b30a(0x603,0x74f));if(_0x5e8497==='pair'){const _0x5f17df=readPairSubcommand(_0x501ab4),_0x2ce6bf=_0x5f17df==='local'||_0x21fc70[_0x11b30a(0x897,_0x261fa3._0x397b39)](hasFlag,_0x501ab4,_0x11b30a(_0x261fa3._0x484ecb,_0x261fa3._0x50666c));if(_0x2ce6bf){const _0x55b94f=_0x21fc70[_0x11b30a(_0x261fa3._0x58962b,_0x261fa3._0x5f5abd)](resolveGatewayAuth);if(_0x11b30a(0x5df,_0x261fa3._0x4e199e)in _0x55b94f)throw new Error(_0x55b94f[_0x11b30a(0x447,_0x261fa3._0x19fe0b)]);const _0x2280c2=readFlag(_0x501ab4,_0x21fc70['IUmpm']),_0x4b25e5=readFlag(_0x501ab4,_0x11b30a(_0x261fa3._0x2d2c08,0x52f)),_0x337943={};_0x337943['explicit'+'Url']=_0x4b25e5,_0x337943['gatewayT'+'oken']=_0x55b94f[_0x9bf137(0x475,_0x261fa3._0x23ce4f)],_0x337943[_0x11b30a(0x9be,0x6b3)+_0x11b30a(_0x261fa3._0x47948c,0x8f5)]=_0x55b94f[_0x9bf137(0x3d9,0x376)];const _0x22cf42=_0x21fc70[_0x9bf137(0x2cd,_0x261fa3._0x18cc26)](buildLocalPairingInfo,_0x337943);let _0x4a660f=_0x11b30a(_0x261fa3._0x3af357,0x2ff)+_0x11b30a(0x7f1,0x829)+_0x11b30a(0x53c,_0x261fa3._0x1be60b)+_0x9bf137(0x5b1,0x821)+_0x9bf137(_0x261fa3._0x308b41,_0x261fa3._0x299303),_0x2cc823=![],_0x431774=null,_0x3421c2=_0x11b30a(0x393,_0x261fa3._0x4d7b9d)+'d';if(!_0x4b25e5){_0x431774=buildGatewayControlUiOrigin(_0x22cf42[_0x11b30a(0x825,0x8e7)+'rl']);!_0x135c6f&&console[_0x11b30a(0x61c,_0x261fa3._0x6831da)]('⏳\x20Updati'+_0x9bf137(_0x261fa3._0x477c07,_0x261fa3._0x38fdfd)+_0x11b30a(0x8de,_0x261fa3._0x16f27b)+'ig\x20for\x20L'+'AN\x20acces'+_0x11b30a(_0x261fa3._0x27813d,_0x261fa3._0x3e7aed));const _0x426fe3={};_0x426fe3[_0x11b30a(_0x261fa3._0x5912d1,_0x261fa3._0x5912d1)+_0x9bf137(0x27a,0x226)]=_0x431774;const _0xc65b9d=await configureOpenClawLanAccess(_0x426fe3);_0x2cc823=_0xc65b9d[_0x9bf137(_0x261fa3._0x23717c,0x5a7)+_0x11b30a(0x94b,0x8c5)]||_0xc65b9d[_0x11b30a(_0x261fa3._0x5074b9,0x366)+_0x9bf137(_0x261fa3._0x533937,0x48f)+'ed'];if(_0x2cc823){!_0x135c6f&&console['log']('⏳\x20Restar'+_0x11b30a(0x96c,_0x261fa3._0x41d4d1)+_0x9bf137(0xdf,_0x261fa3._0x2b307c)+_0x11b30a(_0x261fa3._0x2a9a8f,_0x261fa3._0x534f06));const _0x51ad5a=await restartOpenClawGateway();_0x3421c2=_0x51ad5a[_0x11b30a(_0x261fa3._0x5afc88,_0x261fa3._0x3e5d37)],!_0x135c6f&&console[_0x9bf137(0x3e2,_0x261fa3._0x583e3f)](_0x9bf137(0x65,-_0x261fa3._0x3ccb5c)+_0x11b30a(0x51a,_0x261fa3._0x2118d7)+'dy.');}else!_0x135c6f&&console['log'](_0x9bf137(0x65,-_0x261fa3._0x59c2db)+_0x11b30a(_0x261fa3._0x154b88,_0x261fa3._0x3a5fd1)+_0x9bf137(0x257,_0x261fa3._0x2ae7e4)+_0x9bf137(_0x261fa3._0xc7a48,0x431)+'ring.');_0x4a660f=_0x2cc823?_0x11b30a(0x59b,_0x261fa3._0x1fa22d)+_0x9bf137(_0x261fa3._0x10996c,0x45b)+_0x9bf137(_0x261fa3._0x338ef8,_0x261fa3._0x544fbf)+_0x11b30a(0x9e6,_0x261fa3._0x2e2e00)+'ss,\x20rest'+_0x11b30a(_0x261fa3._0x45e226,_0x261fa3._0x2f5c7b)+_0x9bf137(0x1d9,_0x261fa3._0x591d8c)+_0x11b30a(_0x261fa3._0x125bea,0x7fd)+_0x9bf137(_0x261fa3._0x3cc5a5,0x5b5)+'\x20a\x20local'+'\x20gateway'+_0x11b30a(0x9ae,_0x261fa3._0x21e932)+_0x9bf137(_0x261fa3._0x5f1c55,0x1dc):_0x9bf137(_0x261fa3._0x1ad6c0,0x3ce)+_0x9bf137(0x3b7,0x336)+'\x20allowed'+_0x11b30a(_0x261fa3._0x3bf0aa,0x8b6)+_0x9bf137(0x492,_0x261fa3._0x42b8df)+_0x11b30a(0x4b4,0x62f)+_0x9bf137(0x62,_0x261fa3._0x1bab30)+_0x11b30a(_0x261fa3._0x2aaa0b,0x59d)+_0x9bf137(0x584,_0x261fa3._0x57d831)+'QR.';}const _0x364724=await writeRawQrPng(_0x22cf42['qrPayloa'+'d'],_0x11b30a(_0x261fa3._0x47b58d,_0x261fa3._0x3715bc)+_0x9bf137(0x3f5,_0x261fa3._0xe882c8)+'ir',_0x2280c2);_0x135c6f?printJson(buildLocalPairingJson({'gatewayUrl':_0x22cf42['gatewayU'+'rl'],'authMode':_0x22cf42[_0x9bf137(_0x261fa3._0xa46c3c,0x42c)],'expiresAt':_0x22cf42[_0x9bf137(0xf7,-_0x261fa3._0x3dd259)+'t'],'qrImagePath':_0x364724,'message':_0x4a660f,'configUpdated':_0x2cc823,'controlUiOrigin':_0x431774,'gatewayRestartAction':_0x3421c2,'customUrl':_0x21fc70[_0x11b30a(_0x261fa3._0x2407d3,_0x261fa3._0x5c093e)](Boolean,_0x4b25e5)})):printLocalPairingInfo(_0x22cf42['gatewayU'+'rl'],_0x22cf42['authMode'],_0x22cf42[_0x11b30a(0x476,0x393)+'t'],_0x22cf42['qrPayloa'+'d'],_0x364724,_0x4b25e5);return;}const _0x4eb7da=_0x21fc70[_0x9bf137(0x54d,_0x261fa3._0x3df1ab)](hasFlag,_0x501ab4,_0x21fc70['AUnUd']);!_0x4eb7da&&await _0x21fc70['pCygH'](ensurePairPrerequisites);const _0x2b626f=resolveGatewayAuth();if('error'in _0x2b626f)throw new Error(_0x2b626f['error']);const _0x3abf63=_0x21fc70[_0x9bf137(_0x261fa3._0xa64b19,_0x261fa3._0x55c9aa)](readFlag,_0x501ab4,_0x11b30a(_0x261fa3._0x335802,0x670))??readFlag(_0x501ab4,'-s')??_0x9bf137(_0x261fa3._0x5a85bc,0x1f2)+_0x11b30a(_0x261fa3._0x3c8d66,_0x261fa3._0x10452a)+'.clawket'+_0x11b30a(_0x261fa3._0x31dfea,0x5e5),_0x2fd491=_0x21fc70['oIfCy'](readFlag,_0x501ab4,_0x9bf137(0x61e,_0x261fa3._0x5342c8))??readFlag(_0x501ab4,'-n')??_0x21fc70['HfXPs'](getDefaultBridgeDisplayName),_0x18e14f=_0x21fc70[_0x11b30a(0x598,0x722)](readFlag,_0x501ab4,_0x11b30a(_0x261fa3._0x121d02,0x8bd)+'e'),_0x12af9c={};_0x12af9c['serverUr'+'l']=_0x3abf63,_0x12af9c[_0x11b30a(_0x261fa3._0x11639d,0x578)+_0x11b30a(0x4a8,0x6e1)]=_0x2fd491,_0x12af9c[_0x9bf137(_0x261fa3._0x24ae0c,_0x261fa3._0x44d09d)+_0x9bf137(0x175,0x77)]=_0x2b626f[_0x11b30a(_0x261fa3._0x5d8adc,_0x261fa3._0x39d22c)],_0x12af9c[_0x9bf137(0x417,_0x261fa3._0x5b3a58)+_0x9bf137(_0x261fa3._0x47b58d,0x7c5)]=_0x2b626f['password'];const _0x47315a=await pairGateway(_0x12af9c),_0x239d2f=await writePairingQrPng(_0x47315a,_0x18e14f),_0x4eaabf=getServiceStatus(),_0x18f969=decidePairServiceAction(_0x47315a,_0x4eaabf);if(_0x18f969===_0x21fc70[_0x9bf137(_0x261fa3._0x48277f,_0x261fa3._0x11518e)]){const _0x3c26b5=listRuntimeProcesses();if(_0x3c26b5['length']>0x1){stopRuntimeProcesses();const _0x2482f1=restartService(),_0x1f204d='Detected'+'\x20duplica'+_0x11b30a(_0x261fa3._0x9cb460,_0x261fa3._0x666cd4)+_0x11b30a(0x4c0,_0x261fa3._0x1872da)+_0x11b30a(0x3c1,_0x261fa3._0x5d1cd4)+_0x9bf137(_0x261fa3._0x3fa159,_0x261fa3._0x36ed4e)+_0x9bf137(0x62d,0x3ac)+'ound\x20ser'+_0x9bf137(_0x261fa3._0x415427,0x31b)+_0x9bf137(0x4ff,_0x261fa3._0x53f143);_0x135c6f?printJson(buildPairingJson(_0x47315a,_0x239d2f,_0x2482f1,_0x1f204d)):(printPairingInfo(_0x47315a,_0x239d2f),printServiceResult(_0x1f204d,_0x2482f1));return;}_0x135c6f?printJson(_0x21fc70[_0x11b30a(0x6ba,_0x261fa3._0x16e289)](buildPairingJson,_0x47315a,_0x239d2f,_0x4eaabf,_0x11b30a(_0x261fa3._0x141fa6,_0x261fa3._0x4cacbf)+_0x11b30a(_0x261fa3._0x423548,_0x261fa3._0x14fa9b)+'ce\x20alrea'+_0x11b30a(0x4bc,0x708)+_0x9bf137(_0x261fa3._0x1e90e0,_0x261fa3._0x45cc47)+'\x20unchang'+_0x11b30a(0x933,_0x261fa3._0x1742d6))):(printPairingInfo(_0x47315a,_0x239d2f),console[_0x9bf137(0x3e2,0x378)](_0x11b30a(_0x261fa3._0x2cebd9,_0x261fa3._0x4cacbf)+_0x11b30a(_0x261fa3._0x196191,0x3b3)+_0x9bf137(_0x261fa3._0x376d6e,0x338)+_0x11b30a(_0x261fa3._0x1c030b,0x708)+'ng.\x20Left'+_0x9bf137(_0x261fa3._0x29bc65,0x67c)+_0x9bf137(0x426,_0x261fa3._0x11075d)),printServiceResult(null,_0x4eaabf));return;}try{stopRuntimeProcesses();const _0x13440d=_0x21fc70[_0x11b30a(0x5a7,0x75e)](_0x18f969,_0x9bf137(_0x261fa3._0x377533,_0x261fa3._0x472232))?installService():restartService(),_0x4d5c35=_0x18f969===_0x9bf137(_0x261fa3._0x377533,0x48c)?_0x11b30a(0x6fd,0x568)+'talled\x20b'+_0x11b30a(_0x261fa3._0x548ce4,_0x261fa3._0x19f5c4)+_0x11b30a(0x115,0x3dd)+'e.':_0x47315a['action']==='register'+'ed'?_0x21fc70[_0x11b30a(_0x261fa3._0x5ec943,0x315)]:_0x21fc70[_0x9bf137(0x268,0x2ad)];_0x135c6f?_0x21fc70[_0x9bf137(0x13c,-0x146)](printJson,buildPairingJson(_0x47315a,_0x239d2f,_0x13440d,_0x4d5c35)):(printPairingInfo(_0x47315a,_0x239d2f),printServiceResult(_0x4d5c35,_0x13440d));}catch(_0x47c9a2){if(isAutostartUnsupportedError(_0x47c9a2)){const _0x18b907=await _0x21fc70['Uobuf'](startTransientRuntime),_0x48bc6f=_0x21fc70[_0x11b30a(_0x261fa3._0x3f6649,_0x261fa3._0x443a02)](buildUnsupportedAutostartMessage,_0x18b907);_0x135c6f?printJson(buildPairingJson(_0x47315a,_0x239d2f,_0x18b907,_0x48bc6f)):(_0x21fc70['TInxY'](printPairingInfo,_0x47315a,_0x239d2f),_0x21fc70[_0x11b30a(_0x261fa3._0x59c5ba,_0x261fa3._0x1977b7)](printServiceResult,_0x48bc6f,_0x18b907));return;}console[_0x9bf137(_0x261fa3._0x12657a,_0x261fa3._0x5e7ecc)]('Pairing\x20'+_0x9bf137(0x4ea,0x3f7)+_0x9bf137(0x3b2,_0x261fa3._0x324b42)+_0x11b30a(_0x261fa3._0x8307f1,0x311)+_0x11b30a(0x529,_0x261fa3._0x48517f)+'n\x20failed'+':\x20'+formatError2(_0x47c9a2)),console[_0x11b30a(_0x261fa3._0x180520,_0x261fa3._0x19fe0b)]('You\x20can\x20'+_0x9bf137(0x66b,_0x261fa3._0x27d211)+'n\x20\x22clawk'+_0x9bf137(0x403,_0x261fa3._0x52586c)+_0x11b30a(_0x261fa3._0x512b86,0x8ca)+_0x11b30a(_0x261fa3._0x492a06,0x50f)+_0x11b30a(0x4ea,_0x261fa3._0x38432f)+_0x9bf137(_0x261fa3._0x409fa2,_0x261fa3._0x32beb0)),process[_0x11b30a(_0x261fa3._0x202c14,0x898)]=0x1;}return;}if(_0x5e8497===_0x11b30a(0x74f,0x8d8)+_0x11b30a(0x3a9,0x335)){const _0x3b636f=readFlag(_0x501ab4,_0x21fc70['IUmpm']),_0x5ba93b=resolveGatewayAuth();if(_0x9bf137(0x2bb,0x4c9)in _0x5ba93b)throw new Error(_0x5ba93b['error']);const _0x348d64={};_0x348d64[_0x11b30a(0x7b7,_0x261fa3._0x4059ff)+_0x9bf137(0x175,0x7b)]=_0x5ba93b[_0x11b30a(0x95e,0x711)],_0x348d64[_0x11b30a(0x54e,_0x261fa3._0xf9e60a)+_0x11b30a(_0x261fa3._0x559710,0x8f5)]=_0x5ba93b[_0x11b30a(0x5d2,0x675)];const _0x14c6f5=await _0x21fc70[_0x11b30a(_0x261fa3._0x5e8d20,_0x261fa3._0x443a02)](refreshAccessCode,_0x348d64),_0x2856db=await writePairingQrPng(_0x14c6f5,_0x3b636f);_0x135c6f?printJson(buildPairingJson(_0x14c6f5,_0x2856db,_0x21fc70[_0x11b30a(0x3e4,_0x261fa3._0x2cba82)](getServiceStatus),_0x11b30a(0xa7,0x3ac)+_0x11b30a(_0x261fa3._0x2b0412,0x4be)+_0x11b30a(0x3af,0x309))):printPairingInfo(_0x14c6f5,_0x2856db);return;}if(_0x5e8497==='install'||_0x5e8497===_0x21fc70[_0x9bf137(_0x261fa3._0x1d449a,0x1e3)]){const _0x467aa0=requirePairingConfig();_0x21fc70['otTzg'](stopRuntimeProcesses);const _0x1344d6=installService();console[_0x11b30a(_0x261fa3._0x48f253,_0x261fa3._0x4c563d)](_0x11b30a(0x377,_0x261fa3._0x5f017c)+_0x9bf137(_0x261fa3._0x3d58ab,_0x261fa3._0x328e70)+'ound\x20ser'+_0x9bf137(0x314,0x50e)+_0x11b30a(_0x261fa3._0x5aef77,0x37c)+'\x20'+_0x467aa0['gatewayI'+'d']+'.'),printServiceResult(null,_0x1344d6);return;}if(_0x21fc70['oBVKb'](_0x5e8497,_0x21fc70['QTDua'])){const _0x1d23cb=requirePairingConfig();stopRuntimeProcesses();const _0x165981=restartService();console[_0x11b30a(0x893,_0x261fa3._0x6831da)](_0x11b30a(_0x261fa3._0x350e0a,_0x261fa3._0x21d73f)+_0x11b30a(0x6c6,_0x261fa3._0x5c3346)+_0x11b30a(_0x261fa3._0x18c642,_0x261fa3._0x333afc)+_0x9bf137(_0x261fa3._0x3f41e6,0x25f)+_0x11b30a(0x4cd,_0x261fa3._0x4d251e)+'\x20'+_0x1d23cb['gatewayI'+'d']+'.'),printServiceResult(null,_0x165981);return;}function _0x9bf137(_0x329c4f,_0x44a495){return _0x35d151(_0x44a495,_0x329c4f- -_0xb10fb8._0x38cc60);}if(_0x21fc70[_0x11b30a(0x61b,0x75e)](_0x5e8497,_0x11b30a(0x690,_0x261fa3._0x30692b))){const _0x146f22=stopService();_0x21fc70[_0x9bf137(_0x261fa3._0x1c4199,_0x261fa3._0x28dbfe)](stopRuntimeProcesses),console[_0x9bf137(_0x261fa3._0x17a9ca,0x14a)]('Stopped\x20'+_0x9bf137(_0x261fa3._0x25f940,-_0x261fa3._0x291e5e)+_0x11b30a(_0x261fa3._0x10c20c,_0x261fa3._0x38deba)+_0x11b30a(_0x261fa3._0x33076e,0x69c)),printServiceResult(null,_0x146f22);return;}if(_0x5e8497===_0x9bf137(_0x261fa3._0x37d5ad,_0x261fa3._0x1b9e1c)+'l'){const _0x50f601=uninstallService();stopRuntimeProcesses(),console[_0x9bf137(_0x261fa3._0x17a9ca,_0x261fa3._0x4af80f)](_0x21fc70[_0x9bf137(_0x261fa3._0x429f85,_0x261fa3._0xc75dba)]),printServiceResult(null,_0x50f601);return;}if(_0x5e8497==='reset'){stopRuntimeProcesses(),stopService(),deletePairingConfig(),console[_0x11b30a(0x4da,0x67e)](_0x11b30a(0x90f,_0x261fa3._0x53f43d)+_0x9bf137(_0x261fa3._0x5da238,_0x261fa3._0x529651)+_0x11b30a(0xa4b,0x872)+getPairingConfigPath());return;}if(_0x5e8497===_0x11b30a(_0x261fa3._0x401ad1,_0x261fa3._0xe0e2de)){printStatus();return;}if(_0x5e8497===_0x9bf137(0x4e5,_0x261fa3._0x413f74)){const _0x7f9899=Number(readFlag(_0x501ab4,_0x21fc70[_0x11b30a(0x398,0x3a6)])??'200'),_0x1ed30f=parseLookbackToMs(readFlag(_0x501ab4,_0x9bf137(0x7e,-_0x261fa3._0x4934d4))??readFlag(_0x501ab4,'-l')),_0x32d05f=readRecentCliLogs({'lines':_0x7f9899,'lastMs':_0x1ed30f,'includeErrorLog':_0x21fc70[_0x9bf137(_0x261fa3._0x2732f5,_0x261fa3._0x4ce84f)](hasFlag,_0x501ab4,_0x21fc70[_0x9bf137(0xe9,0x1ec)])});if(_0x135c6f){const _0x40c915={};_0x40c915['ok']=!![],_0x40c915[_0x11b30a(_0x261fa3._0x4e6cc9,0x7c7)]=_0x32d05f,printJson(_0x40c915);}else _0x21fc70['oBVKb'](_0x32d05f[_0x9bf137(_0x261fa3._0x55daff,_0x261fa3._0x1f065f)],0x0)?console[_0x9bf137(_0x261fa3._0x57d831,_0x261fa3._0xcac215)]('No\x20match'+_0x11b30a(_0x261fa3._0x66a5fb,_0x261fa3._0x48d00a)+_0x11b30a(0x6c7,_0x261fa3._0x4c2303)+'nd.'):console['log'](_0x32d05f[_0x9bf137(0x667,0x928)]('\x0a'));return;}if(_0x5e8497===_0x11b30a(0x573,_0x261fa3._0x106ffc)){const _0x5d21ed=await buildDoctorReport();_0x135c6f?_0x21fc70['MTill'](printJson,_0x5d21ed):_0x21fc70['nvCoz'](printDoctorReport,_0x5d21ed);return;}if(_0x21fc70[_0x11b30a(_0x261fa3._0x1f3040,0x75e)](_0x5e8497,'run')){const _0x5635df=requirePairingConfig(),_0x41799b=hasFlag(_0x501ab4,'--replac'+'e'),_0x1ec45a=listRuntimeProcesses()[_0x9bf137(0xb7,0x38)](_0x69c39d=>_0x69c39d['pid']);_0x21fc70[_0x11b30a(0x635,0x4a3)](_0x1ec45a['length'],0x0)&&(!_0x41799b&&(console[_0x9bf137(0x2bb,0x30b)](_0x9bf137(_0x261fa3._0x286d1c,_0x261fa3._0x382bf0)+_0x11b30a(_0x261fa3._0x443663,_0x261fa3._0x325c3b)+_0x11b30a(0x8ee,0x900)+'untime\x20i'+_0x11b30a(0x152,0x42a)+_0x9bf137(_0x261fa3._0x4c1e3c,_0x261fa3._0x19a9cf)+_0x9bf137(0x2de,_0x261fa3._0x38d0e9)+(_0x1ec45a['length']>0x1?'s':'')+':\x20'+_0x1ec45a['join'](',\x20')+(_0x11b30a(_0x261fa3._0x254cdc,_0x261fa3._0x3755d1)+'clawket\x20'+_0x9bf137(0x634,0x3d8)+_0x9bf137(0xa0,_0x261fa3._0x37c924)+'rerun\x20wi'+_0x9bf137(_0x261fa3._0x17e761,0x370)+_0x9bf137(_0x261fa3._0x334d20,_0x261fa3._0x364eb3)+_0x11b30a(_0x261fa3._0x1061aa,_0x261fa3._0xe4342e)+_0x11b30a(0x5ef,_0x261fa3._0x381045))),process[_0x9bf137(_0x261fa3._0x4e38a5,_0x261fa3._0x3229ed)](0x1)),_0x21fc70['hlpvZ'](stopRuntimeProcesses));const _0x40185e=resolveGatewayUrl(readFlag(_0x501ab4,_0x11b30a(_0x261fa3._0x35f18c,_0x261fa3._0x131790)+_0x9bf137(_0x261fa3._0x5ad904,_0x261fa3._0x1be349))??readFlag(_0x501ab4,'-g')),_0x22df46=_0x432e3f=>{function _0xad40b0(_0x5ac1da,_0x1b4fb3){return _0x11b30a(_0x5ac1da,_0x1b4fb3-_0x12897a._0x17bc51);}console['log']('['+Date[_0xad40b0(_0x2bc3bd._0x2101dc,0x3c1)]()+']\x20'+_0x432e3f);};!_0x4f5111?(console[_0x11b30a(0x8f5,_0x261fa3._0x2e942e)](_0x11b30a(0x63b,0x78a)+_0x9bf137(_0x261fa3._0x114d40,0x2d3)+_0x5635df[_0x11b30a(_0x261fa3._0x11bdf7,_0x261fa3._0x3ababb)+'d']),console[_0x9bf137(0x3e2,0x5ef)](_0x9bf137(_0x261fa3._0x54f9eb,0x485)+_0x9bf137(0x3f7,_0x261fa3._0x318b10)+_0x5635df[_0x11b30a(_0x261fa3._0x429f85,0x78c)+'Id']),console['log'](_0x9bf137(_0x261fa3._0xaf4f9f,_0x261fa3._0x5c0cb)+'URL:\x20'+_0x40185e),console[_0x9bf137(0x3e2,0x2fa)](''),console['log'](_0x11b30a(_0x261fa3._0x5627e4,_0x261fa3._0x4ddd01)+'\x20bridge\x20'+_0x11b30a(0x693,_0x261fa3._0x3481da)+_0x11b30a(_0x261fa3._0x249671,_0x261fa3._0x2ae7e4)+'trl+C\x20to'+'\x20stop.'),console[_0x11b30a(_0x261fa3._0x4297fc,0x67e)]('')):_0x22df46(_0x11b30a(_0x261fa3._0x13ce9c,0x3c3)+'\x20Clawket'+'\x20service'+'\x20runtime'+'\x20for\x20gat'+_0x11b30a(0x333,_0x261fa3._0x4a2f2a)+_0x5635df[_0x9bf137(0x4b0,0x6c5)+'d']);_0x4f5111&&writeServiceState();const _0x42ba68=new BridgeRuntime({'config':_0x5635df,'gatewayUrl':_0x40185e,'onLog':_0x2540e0=>{const _0x3f250b={_0x2549f0:0x433};function _0x387eb6(_0x1a3765,_0x221d0e){return _0x9bf137(_0x221d0e-_0x3f250b._0x2549f0,_0x1a3765);}_0x22df46(_0x387eb6(0x71d,0x76e)+']\x20'+_0x2540e0);},'onStatus':_0x42de4c=>{function _0x45dfb2(_0x3bf20f,_0x376419){return _0x9bf137(_0x376419-0x236,_0x3bf20f);}function _0x5237cf(_0x1a7ebd,_0x5afb59){return _0x9bf137(_0x5afb59- -0x4f,_0x1a7ebd);}if(_0x42de4c[_0x45dfb2(_0x197278._0x26a75f,_0x197278._0x6d4ca8)+'r']){_0x22df46(_0x45dfb2(_0x197278._0x51f157,0x77e)+'\x20relay='+(_0x42de4c['relayCon'+_0x5237cf(_0x197278._0x48e489,0x502)]?'up':'down')+(_0x45dfb2(0x1f8,_0x197278._0x29a5b0)+'=')+(_0x42de4c[_0x45dfb2(_0x197278._0x569920,_0x197278._0x4336f8)+_0x5237cf(_0x197278._0x3c5bc7,0x46d)]?'up':_0x45dfb2(0x7d1,0x623))+('\x20clients'+'=')+_0x42de4c[_0x45dfb2(_0x197278._0x453f37,0x5cc)+'unt']+_0x45dfb2(0xec,_0x197278._0x112a3c)+_0x42de4c[_0x45dfb2(0x426,_0x197278._0x3ea569)+'r']);return;}_0x21fc70[_0x5237cf(-_0x197278._0x47b089,_0x197278._0x18959e)](_0x22df46,'[status]'+_0x5237cf(_0x197278._0x5915a7,0x283)+(_0x42de4c[_0x45dfb2(_0x197278._0x4c82f3,0x335)+'nected']?'up':_0x45dfb2(_0x197278._0x33f78c,0x623))+(_0x5237cf(_0x197278._0x2b9264,0x91)+'=')+(_0x42de4c['gatewayC'+_0x45dfb2(_0x197278._0x1ddcac,_0x197278._0x1ecf97)]?'up':_0x45dfb2(_0x197278._0x734919,0x623))+(_0x45dfb2(_0x197278._0x4cc3ca,_0x197278._0x16a9e6)+'=')+_0x42de4c[_0x45dfb2(0x509,0x5cc)+_0x5237cf(-0x12b,0x125)]);},'onPendingPairRequest':_0x11904b=>{function _0x5aadba(_0x49eb5e,_0x14aa29){return _0x9bf137(_0x14aa29- -0x15a,_0x49eb5e);}function _0x2949cf(_0x5544ef,_0x249380){return _0x9bf137(_0x249380-0x1c4,_0x5544ef);}_0x21fc70[_0x2949cf(_0x3e31d5._0x374a13,_0x3e31d5._0x33753c)](_0x22df46,_0x2949cf(0x478,_0x3e31d5._0x44239f)+_0x5aadba(0x5df,_0x3e31d5._0x73fcad)+_0x2949cf(0x724,0x4c9)+'='+_0x11904b[_0x5aadba(0x411,0x26b)+'d']+(_0x5aadba(0x29b,0x454)+'d=')+(_0x11904b[_0x5aadba(0x5c7,_0x3e31d5._0x3a2a67)]||_0x21fc70[_0x2949cf(_0x3e31d5._0x31a3c,0x25b)])+'\x20name='+(_0x11904b[_0x5aadba(-_0x3e31d5._0x348846,0x182)+_0x2949cf(0x624,0x609)]??_0x2949cf(0x9d4,0x809)+'>'));}});_0x42ba68[_0x11b30a(_0x261fa3._0x38a88b,0x5d6)]();const _0x42ddd1={};_0x42ddd1['gatewayI'+'d']=_0x5635df['gatewayI'+'d'],_0x42ddd1[_0x9bf137(_0x261fa3._0x284beb,0x745)+'Id']=_0x5635df['instance'+'Id'],_0x42ddd1[_0x9bf137(0xac,-_0x261fa3._0x1e75a2)+_0x9bf137(0x157,0x1ce)]=_0x4f5111,registerRuntimeProcess(_0x42ddd1);const _0x5c2c36=async()=>{const _0x1e9680={_0x1479a5:0x1b0},_0x1e21a9=(_0x16cf70(_0x5ad4b8._0x4b288d,_0x5ad4b8._0x470a0a)+_0x2acfbb(_0x5ad4b8._0x118cb5,_0x5ad4b8._0x11914a))[_0x2acfbb(_0x5ad4b8._0x548fae,_0x5ad4b8._0xa10a29)]('|');let _0x9edbb6=0x0;function _0x16cf70(_0x396f22,_0x401e78){return _0x11b30a(_0x396f22,_0x401e78- -_0x1e9680._0x1479a5);}function _0x2acfbb(_0x107c28,_0xdb7559){return _0x11b30a(_0xdb7559,_0x107c28- -_0x14b736._0x2b6278);}while(!![]){switch(_0x1e21a9[_0x9edbb6++]){case'0':process[_0x16cf70(0x4b5,_0x5ad4b8._0x2ecc93)](_0x2acfbb(0x7f8,_0x5ad4b8._0x3f33f0),_0x5c2c36);continue;case'1':process[_0x16cf70(0x3f3,0x56d)](0x0);continue;case'2':unregisterRuntimeProcess(process[_0x16cf70(0x5b8,0x5b4)]);continue;case'3':_0x4f5111&&clearServiceState(process['pid']);continue;case'4':process['off'](_0x2acfbb(0x85b,0x582),_0x5c2c36);continue;case'5':await _0x42ba68['stop']();continue;}break;}};process['on']('SIGINT',_0x5c2c36),process['on'](_0x9bf137(0x5b8,_0x261fa3._0xf601d4),_0x5c2c36),await new Promise(()=>{});}printHelp();}function printPairingInfo(_0x185947,_0x46d1c9){const _0x4f7001={_0x4c8438:0x637,_0x4ad6b4:0x1c8,_0x31282f:0x3ff,_0x523451:0x47,_0x274183:0x47f,_0x5a69b7:0x1e2,_0x2d559d:0x114,_0x1fa00e:0x3df,_0x921b81:0x441,_0x3d87a8:0x405,_0x3938bc:0x259,_0x5cc2f2:0x87,_0x41e8a2:0x473,_0x3946a3:0x1fe,_0x57b94f:0x671,_0x3aa62c:0xdc,_0x54ae00:0xfb,_0x5d5172:0x139,_0x5234cf:0x19f,_0x465a4a:0x4e,_0x570984:0x196,_0x2c5f24:0x111,_0x4ed2bc:0x7d},_0x3437ff={_0x3706cc:0x25d},_0x42fa16={};_0x42fa16[_0x56e43c(_0x4f7001._0x4c8438,0x441)]=_0x56e43c(0x1d6,0x366)+'d',_0x42fa16[_0x1276f6(_0x4f7001._0x4ad6b4,_0x4f7001._0x31282f)]='\x0aScan\x20th'+_0x56e43c(-0x10d,_0x4f7001._0x523451)+_0x1276f6(0x6e6,_0x4f7001._0x274183)+_0x1276f6(_0x4f7001._0x5a69b7,-0x9b)+_0x1276f6(-0x1d9,_0x4f7001._0x2d559d);const _0x1a6f1b=_0x42fa16;function _0x56e43c(_0x433176,_0x5910ed){return _0x35d151(_0x433176,_0x5910ed- -0x26f);}_0x185947['action']===_0x1a6f1b[_0x56e43c(_0x4f7001._0x1fa00e,_0x4f7001._0x921b81)]&&console['log'](_0x1276f6(0x468,0x3b7)+_0x56e43c(0x39a,0x394)+_0x1276f6(0x378,0x308)+_0x1276f6(0x141,_0x4f7001._0x3d87a8)+'\x20the\x20pai'+'ring\x20cod'+'e.');console['log']('Gateway\x20'+_0x56e43c(-_0x4f7001._0x3938bc,-_0x4f7001._0x5cc2f2)+_0x185947['config']['gatewayI'+'d']),console[_0x1276f6(_0x4f7001._0x41e8a2,_0x4f7001._0x3946a3)](_0x1a6f1b[_0x1276f6(_0x4f7001._0x57b94f,0x3ff)]);function _0x1276f6(_0x25eb58,_0x4229ff){return _0x35d151(_0x25eb58,_0x4229ff- -_0x3437ff._0x3706cc);}const _0x3e1622={};_0x3e1622[_0x56e43c(-_0x4f7001._0x3aa62c,-_0x4f7001._0x54ae00)]=!![],_0x1bbb4f['generate'](_0x185947[_0x1276f6(-0x36,-0xef)+'d'],_0x3e1622),console['log'](_0x1276f6(0x294,_0x4f7001._0x5d5172)+'\x20'+formatLocalTime(_0x185947[_0x1276f6(-_0x4f7001._0x5234cf,-0xdd)+_0x1276f6(0x187,0x25e)+_0x1276f6(_0x4f7001._0x465a4a,_0x4f7001._0x570984)])),console['log'](_0x1276f6(_0x4f7001._0x2c5f24,_0x4f7001._0x4ed2bc)+':\x20'+_0x46d1c9);}function printLocalPairingInfo(_0x3f8a89,_0x2c6c23,_0x312fbc,_0x4c2b7d,_0x5a3a88,_0xbc7a19){const _0x2b85f4={_0x67d160:0x35a,_0x50c5f6:0x2fc,_0x36d276:0x38b,_0x26bd77:0x4a1,_0x231efe:0x5e8,_0x46034b:0x198,_0x55a7b2:0x4b9,_0x4f44c9:0x261,_0x3606b1:0xfe,_0x251371:0xbd,_0xae122e:0x186,_0x369352:0x1b1,_0xc460a:0x5ce,_0x2f4d3d:0x44a,_0x462396:0xc7,_0x852ec4:0x4f9,_0x2eed24:0x24a,_0x1b9aac:0x443,_0xf8d555:0x706,_0x1b2d04:0x5c1,_0x9715e2:0x499,_0x3095b9:0x43d,_0x25ae70:0x158};console[_0x2aec47(0x2fc,0x246)](_0x2aec47(0x408,_0x2b85f4._0x67d160)+'URL:\x20'+_0x3f8a89);function _0x588d97(_0x34c6d8,_0xc50d6a){return _0x35d151(_0xc50d6a,_0x34c6d8-0x163);}console[_0x2aec47(_0x2b85f4._0x50c5f6,0x58f)](_0x2aec47(0x102,0x2c0)+_0x588d97(0x2c3,_0x2b85f4._0x36d276)+_0x2c6c23),console['log'](_0xbc7a19?_0x2aec47(0xbb,0x143)+_0x2aec47(_0x2b85f4._0x26bd77,_0x2b85f4._0x231efe)+_0x2aec47(_0x2b85f4._0x46034b,0x2f7)+'y\x20QR\x20in\x20'+_0x588d97(_0x2b85f4._0x55a7b2,0x1e0)+_0x2aec47(_0x2b85f4._0x4f44c9,_0x2b85f4._0x3606b1)+'\x0a':_0x2aec47(0xbb,-_0x2b85f4._0x251371)+_0x2aec47(_0x2b85f4._0xae122e,-0xd)+_0x588d97(0x2bc,_0x2b85f4._0x369352)+_0x588d97(0x3eb,_0x2b85f4._0xc460a)+_0x588d97(0x40b,0x444)+_0x2aec47(_0x2b85f4._0x2f4d3d,0x13f));const _0x168c1b={};_0x168c1b['small']=!![];function _0x2aec47(_0x1c55ab,_0x386c59){return _0x35d151(_0x386c59,_0x1c55ab- -0x15f);}_0x1bbb4f['generate'](_0x4c2b7d,_0x168c1b),console[_0x2aec47(0x2fc,_0x2b85f4._0x462396)](_0x588d97(_0x2b85f4._0x852ec4,_0x2b85f4._0x2eed24)+'\x20'+new Date(_0x312fbc)[_0x2aec47(_0x2b85f4._0x1b9aac,_0x2b85f4._0xf8d555)+_0x588d97(_0x2b85f4._0x1b2d04,_0x2b85f4._0x9715e2)]()),console[_0x2aec47(0x2fc,0x1be)](_0x588d97(_0x2b85f4._0x3095b9,_0x2b85f4._0x25ae70)+':\x20'+_0x5a3a88);}function printStatus(){const _0x295b41={_0x50f9a3:0x212,_0x20198e:0x2,_0x5addbc:0x650,_0x451f26:0x157,_0x1d9bd3:0x302,_0x5f1e27:0x573,_0x246d0e:0x478,_0x410829:0x1f4,_0x3575e6:0x2a1,_0x4e7412:0x1db,_0x11a9d2:0x85,_0x4a8f79:0x2b,_0xff04de:0x1ce,_0x4c0062:0x443,_0x14fa2e:0x1e1,_0x3340a8:0x141,_0x432cb1:0x685,_0x15446b:0x985,_0x33e5b9:0x170,_0x7474d6:0x1ab,_0x18b64f:0x262,_0x18d5d5:0x7b7,_0x41e2fb:0x2e8,_0x502a3d:0x44,_0x527999:0xfd,_0x4e1db9:0x175,_0x3571c3:0x2e4,_0x318548:0x467,_0x1b5982:0x741,_0xe9a181:0xa7,_0x280c31:0x388,_0x5cd6dc:0xce,_0x401123:0x699,_0x3a3a30:0x97,_0x5896d1:0xa,_0x14dbec:0x681},_0x557112={_0x5dd44b:0x5ca},_0x23f1b3={'xTYjA':function(_0x4ad95b){return _0x4ad95b();},'YjQvg':function(_0x335012){return _0x335012();},'XgtHL':'not\x20inst'+_0x6b0887(-_0x295b41._0x50f9a3,-_0x295b41._0x20198e)},_0x1786c4=readPairingConfig(),_0xac3072=_0x23f1b3[_0x6b0887(-0x7a,0x133)](getServiceStatus),{logPath:_0x35d236,errorLogPath:_0x1188b3}=getServicePaths();function _0x174b59(_0x578f16,_0x2c9095){return _0x341e52(_0x578f16- -0x270,_0x2c9095);}const _0x5d27ea=readCliVersion();console[_0x174b59(0x467,_0x295b41._0x5addbc)](_0x6b0887(0x16a,0x281)+'\x20'+_0x5d27ea);!_0x1786c4?console[_0x6b0887(0x10d,0x22b)](_0x6b0887(0x127,0x336)+_0x6b0887(-0xd2,-0x35e)+_0x6b0887(0xf3,0xdd)+getPairingConfigPath()+')'):(console[_0x6b0887(0x10d,0x178)](_0x6b0887(0x127,-0x151)+_0x6b0887(-_0x295b41._0x451f26,-_0x295b41._0x1d9bd3)),console['log'](_0x174b59(_0x295b41._0x5f1e27,_0x295b41._0x246d0e)+_0x174b59(_0x295b41._0x410829,_0x295b41._0x3575e6)+_0x1786c4[_0x6b0887(_0x295b41._0x4e7412,-_0x295b41._0x11a9d2)+'d']),console['log'](_0x6b0887(0x1d3,_0x295b41._0x4a8f79)+':\x20'+_0x1786c4[_0x174b59(0x575,0x83e)+'Id']),console[_0x174b59(0x467,0x433)](_0x6b0887(_0x295b41._0xff04de,_0x295b41._0x4c0062)+_0x6b0887(_0x295b41._0x14fa2e,_0x295b41._0x3340a8)+_0x1786c4['serverUr'+'l']),console['log'](_0x174b59(_0x295b41._0x432cb1,_0x295b41._0x15446b)+(_0x1786c4[_0x174b59(0x361,0x3a7)+_0x6b0887(_0x295b41._0x33e5b9,-0x21)]??'-')));function _0x6b0887(_0xa419ed,_0x20e758){return _0x341e52(_0xa419ed- -_0x557112._0x5dd44b,_0x20e758);}console[_0x6b0887(0x10d,_0x295b41._0x7474d6)]('Gateway:'+'\x20'+_0x23f1b3[_0x6b0887(0xf4,-0x1e3)](resolveGatewayUrl)),console['log']('Service:'+'\x20'+(_0xac3072[_0x6b0887(0x262,0x339)+'d']?_0x6b0887(_0x295b41._0x18b64f,0x392)+'d':_0x23f1b3['XgtHL'])+'\x20('+_0xac3072[_0x174b59(0x580,_0x295b41._0x18d5d5)]+')'),console['log'](_0x174b59(_0x295b41._0x41e2fb,_0x295b41._0x502a3d)+'\x20'+(_0xac3072[_0x6b0887(-_0x295b41._0x527999,-0x99)]?_0x6b0887(_0x295b41._0x4e1db9,_0x295b41._0x3571c3):'no')),console[_0x174b59(_0x295b41._0x318548,_0x295b41._0x1b5982)](_0x6b0887(0x1c3,_0x295b41._0xe9a181)+(_0xac3072[_0x174b59(_0x295b41._0x280c31,0x5eb)+_0x6b0887(_0x295b41._0x5cd6dc,-0xfe)]||'-')),console[_0x174b59(_0x295b41._0x318548,0x3d5)]('Log:\x20'+_0x35d236),console[_0x174b59(_0x295b41._0x318548,_0x295b41._0x401123)](_0x174b59(0x2fb,_0x295b41._0x3a3a30)+_0x6b0887(_0x295b41._0x5896d1,0xbe)+_0x1188b3),!_0x1786c4&&(process[_0x174b59(_0x295b41._0x14dbec,0x90b)]=0x1);}function printServiceResult(_0x5e0c8c,_0x1e778b){const _0x61e7b={_0x23ad37:0x878,_0x344661:0x755,_0x2df3b1:0x56c,_0x3ac794:0x6da,_0x563479:0x137,_0x4ce280:0x417,_0x3da242:0x40b,_0x3efca3:0x528,_0x5648d2:0x654,_0xad704b:0x941,_0x3c79dd:0x2a2,_0x5676a1:0x953,_0x2f5504:0xa3f,_0xb96dae:0x65c,_0xf0f394:0x4db,_0x23b80e:0x4cd,_0x994a77:0x7ec,_0x45ab84:0x5ca,_0x3db55d:0x73a,_0x2f337e:0xd3c},_0x24f361={_0x5abc30:0x391},_0xc69664={};_0xc69664[_0x419309(_0x61e7b._0x23ad37,0xa73)]=_0x30945f(0x56c,_0x61e7b._0x344661)+_0x419309(0x5b9,0x39b)+'ng';function _0x30945f(_0x110504,_0xf2e743){return _0x35d151(_0xf2e743,_0x110504- -0x44);}_0xc69664['nVRTx']=_0x30945f(_0x61e7b._0x2df3b1,_0x61e7b._0x3ac794)+_0x30945f(0x2ca,_0x61e7b._0x563479)+'ed';function _0x419309(_0xa011bf,_0x1f11c7){return _0x35d151(_0x1f11c7,_0xa011bf-_0x24f361._0x5abc30);}const _0x69e36c=_0xc69664;_0x5e0c8c&&console[_0x30945f(0x417,0x44e)](_0x5e0c8c),console[_0x30945f(_0x61e7b._0x4ce280,_0x61e7b._0x3da242)](_0x419309(_0x61e7b._0x3efca3,_0x61e7b._0x5648d2)+'\x20'+(_0x1e778b[_0x419309(_0x61e7b._0xad704b,0x6b2)+'d']?_0x1e778b[_0x30945f(0x20d,_0x61e7b._0x3c79dd)]?_0x69e36c[_0x419309(0x878,0xa07)]:_0x69e36c[_0x419309(_0x61e7b._0x5676a1,_0x61e7b._0x2f5504)]:_0x419309(_0x61e7b._0xb96dae,_0x61e7b._0xf0f394)+_0x419309(_0x61e7b._0x23b80e,0x70a))),console[_0x419309(_0x61e7b._0x994a77,0x5c9)](_0x30945f(_0x61e7b._0x45ab84,_0x61e7b._0x3db55d)+_0x419309(0xa7d,_0x61e7b._0x2f337e)+(_0x1e778b[_0x419309(0x70d,0x8cf)+'ath']||'-'));}function printDoctorReport(_0x4f52cd){const _0xbd8cc9={_0x45cce0:0x36d,_0x1358c6:0x116,_0x2eceb7:0x1e8,_0x1f1e41:0x695,_0x46d2a8:0x558,_0x348a7d:0x384,_0xbf813e:0x410,_0x5c4610:0x1a1,_0x55c81d:0xbe,_0x107f3c:0x2fa,_0x4774b0:0xff,_0x1a70ff:0x20e,_0x1f4b2f:0x60f,_0x4d994d:0x410,_0x18d95e:0x319,_0x467cd7:0x425,_0xdd1330:0x660,_0x12d3d0:0x58,_0x1d4ceb:0xe4,_0x413644:0x3a3,_0x191a44:0x4e1,_0x2725fc:0x303,_0x4f94c8:0x17d,_0x1d66b4:0x159,_0x17fc51:0x1e1,_0xc53c07:0x10b,_0x170c2f:0x410,_0x43b7eb:0x20a,_0x45c154:0x565,_0x42cc4c:0x1c6,_0x5f3432:0x169,_0x166eb8:0x252,_0x2f1bf1:0x439,_0x39ef0f:0x2d9,_0x2c3ed:0x364,_0x207f2e:0x4fd,_0x19a2b6:0x395,_0x5515eb:0x394,_0x4cbb2e:0x317,_0x33c3c2:0x141,_0x30fae4:0x266,_0x321b5c:0x3ad,_0x573c5e:0x12f,_0x3475f4:0x265,_0x536237:0x2f4,_0x363e68:0x24d,_0x2c1859:0x4d1,_0x43e401:0x6a,_0x4617c7:0x2f0,_0x15f429:0xdd,_0x5de55e:0x246,_0x5cf66e:0x5d4,_0x302c28:0x4fd,_0x243844:0x3ba,_0x4c3554:0x1bf,_0x8deeed:0x227,_0x3be53e:0x43e,_0x3e9661:0x159,_0x211f94:0x51c,_0x248ce9:0x115,_0x394f7f:0x21a,_0xe4da24:0x3ad,_0x4a8554:0x7da,_0x3d1205:0x2bc,_0xd2e5e:0x220,_0xb97ff5:0x4b2,_0x67cc24:0x289,_0x12b203:0x410,_0x5162d3:0x302,_0x5234b0:0x30c,_0x2f9f6c:0x817,_0x561769:0x38b,_0x53fe5d:0x19a},_0x12761a={_0x30bb7f:0x302},_0x2f8918={_0xb9f9ac:0x4b},_0x40a1f3=(_0x5cd2fe(_0xbd8cc9._0x45cce0,_0xbd8cc9._0x1358c6)+_0x3aeee8(0x929,0x65d)+'|0|8|4|1'+_0x5cd2fe(_0xbd8cc9._0x2eceb7,0x260)+_0x5cd2fe(0x199,0x259))[_0x3aeee8(_0xbd8cc9._0x1f1e41,_0xbd8cc9._0x46d2a8)]('|');let _0x285cab=0x0;function _0x3aeee8(_0x1700f3,_0x454e99){return _0x35d151(_0x1700f3,_0x454e99- -_0x2f8918._0xb9f9ac);}function _0x5cd2fe(_0x58ace9,_0x78284){return _0x35d151(_0x58ace9,_0x78284- -_0x12761a._0x30bb7f);}while(!![]){switch(_0x40a1f3[_0x285cab++]){case'0':console[_0x3aeee8(_0xbd8cc9._0x348a7d,_0xbd8cc9._0xbf813e)]('Service\x20'+'path:\x20'+(_0x4f52cd['serviceP'+_0x5cd2fe(-_0xbd8cc9._0x5c4610,0x11a)]||'-'));continue;case'1':console[_0x5cd2fe(-_0xbd8cc9._0x55c81d,0x159)](_0x3aeee8(_0xbd8cc9._0x107f3c,_0xbd8cc9._0x4774b0)+'L:\x20'+(_0x4f52cd[_0x5cd2fe(-_0xbd8cc9._0x1a70ff,0x1f)]??'-'));continue;case'2':console[_0x3aeee8(_0xbd8cc9._0x1f4b2f,_0xbd8cc9._0x4d994d)](_0x5cd2fe(-0xc2,0x21f)+_0x3aeee8(_0xbd8cc9._0x18d95e,_0xbd8cc9._0x467cd7)+(_0x4f52cd['instance'+'Id']??'-'));continue;case'3':console[_0x3aeee8(_0xbd8cc9._0xdd1330,0x410)]('OpenClaw'+'\x20media:\x20'+_0x4f52cd['openclaw'+_0x5cd2fe(0x32c,_0xbd8cc9._0x12d3d0)]);continue;case'4':console['log'](_0x3aeee8(0x203,0x339)+_0x5cd2fe(0x60,0xa8)+_0x4f52cd[_0x3aeee8(_0xbd8cc9._0x1d4ceb,_0xbd8cc9._0x413644)+_0x5cd2fe(_0xbd8cc9._0x191a44,_0xbd8cc9._0x2725fc)]);continue;case'5':console[_0x5cd2fe(-_0xbd8cc9._0x4f94c8,_0xbd8cc9._0x1d66b4)](_0x5cd2fe(-_0xbd8cc9._0x17fc51,0xbf)+(_0x4f52cd[_0x5cd2fe(-0x1cb,-_0xbd8cc9._0xc53c07)]?'yes':'no'));continue;case'6':console[_0x3aeee8(0x369,_0xbd8cc9._0x170c2f)](_0x3aeee8(0xb4,0x14c)+'\x20'+(_0x4f52cd[_0x3aeee8(0x61b,0x5ab)+_0x5cd2fe(-0x344,-_0xbd8cc9._0x43b7eb)]?_0x3aeee8(0x5d2,_0xbd8cc9._0x45c154)+'d':_0x3aeee8(0xe4,0x280)+_0x5cd2fe(0xd2,-_0xbd8cc9._0x42cc4c))+'\x20('+_0x4f52cd['serviceM'+_0x3aeee8(0xe,_0xbd8cc9._0x5f3432)]+')');continue;case'7':console[_0x3aeee8(_0xbd8cc9._0x166eb8,0x410)](_0x3aeee8(_0xbd8cc9._0x2f1bf1,_0xbd8cc9._0x39ef0f)+_0x5cd2fe(-_0xbd8cc9._0x2c3ed,-0x201)+'\x20'+(_0x4f52cd[_0x3aeee8(0x6de,_0xbd8cc9._0x207f2e)+_0x3aeee8(_0xbd8cc9._0x19a2b6,0x40c)+_0x5cd2fe(_0xbd8cc9._0x5515eb,_0xbd8cc9._0x4cbb2e)]?_0x3aeee8(-_0xbd8cc9._0x33c3c2,0xd9):_0x5cd2fe(0x3,0x1bf)));continue;case'8':console[_0x5cd2fe(_0xbd8cc9._0x30fae4,0x159)]('Log\x20path'+':\x20'+_0x4f52cd[_0x3aeee8(0x7e3,_0xbd8cc9._0xdd1330)]);continue;case'9':console[_0x3aeee8(_0xbd8cc9._0x321b5c,0x410)](_0x5cd2fe(_0xbd8cc9._0x573c5e,_0xbd8cc9._0x3475f4)+_0x3aeee8(_0xbd8cc9._0x536237,0x139)+_0x4f52cd['localGat'+_0x3aeee8(0x5a4,0x2d1)]);continue;case'10':console[_0x3aeee8(0x222,0x410)](_0x3aeee8(_0xbd8cc9._0x363e68,_0xbd8cc9._0x2c1859)+'RL:\x20'+(_0x4f52cd[_0x5cd2fe(_0xbd8cc9._0x43e401,0x154)+'l']??'-'));continue;case'11':console[_0x3aeee8(0x366,0x410)]('OpenClaw'+_0x5cd2fe(-_0xbd8cc9._0x4617c7,-0x3f)+_0x4f52cd[_0x5cd2fe(_0xbd8cc9._0x15f429,_0xbd8cc9._0x5de55e)+_0x3aeee8(_0xbd8cc9._0x5cf66e,0x4da)+'r']);continue;case'12':console[_0x5cd2fe(-0x56,_0xbd8cc9._0x1d66b4)](_0x3aeee8(0x4a9,0x2d9)+'\x20token:\x20'+(_0x4f52cd[_0x3aeee8(0x523,_0xbd8cc9._0x302c28)+_0x3aeee8(_0xbd8cc9._0x243844,0x404)+'nd']?'found':_0x5cd2fe(0x325,_0xbd8cc9._0x4c3554)));continue;case'13':console[_0x3aeee8(0x686,0x410)]('Gateway\x20'+_0x3aeee8(-0x52,0x19d)+(_0x4f52cd[_0x5cd2fe(-0x15,_0xbd8cc9._0x8deeed)+'d']??'-'));continue;case'14':console[_0x5cd2fe(_0xbd8cc9._0x3be53e,_0xbd8cc9._0x3e9661)](_0x3aeee8(0x33e,_0xbd8cc9._0x211f94)+_0x5cd2fe(0x169,0x3b7)+_0x3aeee8(0x3e1,_0xbd8cc9._0x248ce9)+(_0x4f52cd[_0x5cd2fe(_0xbd8cc9._0x394f7f,_0xbd8cc9._0xe4da24)+_0x3aeee8(_0xbd8cc9._0x4a8554,0x620)+_0x5cd2fe(-_0xbd8cc9._0x3d1205,-_0xbd8cc9._0xd2e5e)]?_0x5cd2fe(_0xbd8cc9._0xb97ff5,0x1c1):'no'));continue;case'15':console[_0x3aeee8(_0xbd8cc9._0x67cc24,_0xbd8cc9._0x12b203)](_0x5cd2fe(_0xbd8cc9._0x5162d3,_0xbd8cc9._0x5234b0)+_0x3aeee8(_0xbd8cc9._0x2f9f6c,0x61d)+'\x20'+(_0x4f52cd[_0x3aeee8(0x521,0x570)+_0x5cd2fe(0x172,_0xbd8cc9._0x561769)]?_0x5cd2fe(_0xbd8cc9._0x53fe5d,0x1c1):'no'));continue;}break;}}function requirePairingConfig(){const _0x5621c1={_0x5001c2:0x58d,_0x563132:0x93a,_0x56693e:0x926,_0x19d044:0x7bb,_0x4e0c78:0x550,_0x310f69:0x5b0,_0x521e3c:0x68b,_0x2b1813:0x851},_0xf33435={_0x1adac3:0x143};function _0xd454b6(_0x20df99,_0x471d6e){return _0x341e52(_0x20df99-_0xf33435._0x1adac3,_0x471d6e);}const _0x4e9ffa=readPairingConfig();function _0x11ee53(_0x205248,_0x21c437){return _0x341e52(_0x205248-0x6d,_0x21c437);}return!_0x4e9ffa&&(console[_0x11ee53(0x61d,0x6a6)](_0x11ee53(0x7e9,0x995)+_0x11ee53(_0x5621c1._0x5001c2,0x812)+_0xd454b6(0x701,_0x5621c1._0x563132)+_0x11ee53(0x78e,_0x5621c1._0x56693e)+_0x11ee53(0x966,_0x5621c1._0x19d044)+_0xd454b6(_0x5621c1._0x4e0c78,_0x5621c1._0x310f69)+_0x11ee53(_0x5621c1._0x521e3c,_0x5621c1._0x2b1813)+getPairingConfigPath()),process['exit'](0x1)),_0x4e9ffa;}function readFlag(_0x34a29a,_0x302f44){const _0x15f286={_0x4d475d:0x1d9},_0x2411bb=_0x34a29a[_0x5d637d(0x643,0x4d1)](_0x302f44);function _0x5d637d(_0x494bd5,_0x31b38d){return _0x35d151(_0x494bd5,_0x31b38d- -_0x15f286._0x4d475d);}if(_0x2411bb<0x0)return null;const _0x5cca0c=_0x34a29a[_0x2411bb+0x1];return _0x5cca0c?.['trim']()?_0x5cca0c['trim']():null;}function hasFlag(_0x41e2de,_0x1b0fa8){const _0x2c939d={_0x7478c5:0x285},_0x32bb8f={_0x205f93:0x2ec};function _0x1d875c(_0x2928b8,_0x4b33a8){return _0x35d151(_0x4b33a8,_0x2928b8- -_0x32bb8f._0x205f93);}return _0x41e2de[_0x1d875c(-0x177,-_0x2c939d._0x7478c5)](_0x1b0fa8);}function readPairSubcommand(_0x29a1fa){const _0x12657d={_0x5ea208:0x49f};function _0x13bd22(_0x971303,_0x3e9248){return _0x35d151(_0x3e9248,_0x971303-0x154);}for(const _0x256a22 of _0x29a1fa){if(!_0x256a22[_0x13bd22(0x745,0x9bb)+'th']('-'))return _0x256a22[_0x4739cd(0x20a,_0x12657d._0x5ea208)]()||null;}function _0x4739cd(_0x5532c8,_0xbe9861){return _0x35d151(_0xbe9861,_0x5532c8- -0x17d);}return null;}function printHelp(){const _0x2784c9={_0x2081fb:0xaff,_0x156ae9:0x346,_0x341e28:0x584,_0x4834b0:0x4bf,_0x57668b:0x40f,_0xb1fc4b:0x468,_0x566306:0x669,_0x4cccc2:0xaf2,_0x5c0dc8:0x9cf,_0x2f7d82:0x71c,_0x334af9:0x6df,_0x2f25a6:0x7cd,_0xf8ce03:0x1b7,_0x47e7b2:0x4a8,_0x16c296:0x62d,_0x1fab5a:0x60b,_0x36e703:0x40c,_0x55d6c1:0xa53,_0x4e4a6d:0xb54,_0x167fa2:0x636,_0x3e93de:0x35d,_0x33ea29:0xc49,_0xc5b988:0x8d9,_0x4d5b69:0x30d,_0x444d15:0x754,_0x30791d:0x885,_0x3fd9bf:0x8bc,_0x1e110c:0x822,_0x5b4e10:0x39e,_0x4e9abf:0x533,_0x33ddd4:0x286,_0x18decc:0x547,_0x2afd9c:0x716,_0x47eed4:0x614,_0x211733:0x9b5,_0x21e9dc:0xc24,_0x36a1b0:0x53a,_0x18da21:0x6e7,_0x5aa73c:0x4ec,_0x3cf6ac:0x814,_0x274e65:0x1b3,_0x5c5fd0:0x547,_0x5f5ad6:0x716,_0x55872b:0x547,_0x35f272:0x7dd,_0xcfee3d:0x65d,_0x500559:0x81f,_0x50947b:0x5b6,_0x3948b4:0x71c,_0xa51b15:0x5da,_0xd000ec:0x9ef},_0x540d75={};_0x540d75[_0x4e1bb4(0x8bc,_0x2784c9._0x2081fb)]=_0x4c1edd(_0x2784c9._0x156ae9,_0x2784c9._0x341e28)+_0x4c1edd(0x36e,0x5a2)+_0x4e1bb4(0x91b,0xba8)+_0x4c1edd(_0x2784c9._0x4834b0,_0x2784c9._0x57668b)+_0x4c1edd(_0x2784c9._0xb1fc4b,_0x2784c9._0x566306)+_0x4c1edd(0x265,0x42)+_0x4e1bb4(_0x2784c9._0x4cccc2,0x9b8)+_0x4c1edd(0x517,0x2a3)+_0x4e1bb4(0x79d,_0x2784c9._0x5c0dc8)+']';function _0x4c1edd(_0x38f5f4,_0x26d3ef){return _0x35d151(_0x26d3ef,_0x38f5f4-0x5a);}_0x540d75['sGDvw']='clawket\x20'+_0x4c1edd(0x3c1,0x56e),_0x540d75[_0x4e1bb4(_0x2784c9._0x2f7d82,0x8c6)]=_0x4c1edd(0x346,0x121)+_0x4c1edd(_0x2784c9._0x334af9,_0x2784c9._0x2f25a6)+'l';function _0x4e1bb4(_0x3d68ed,_0x1d1e57){return _0x35d151(_0x1d1e57,_0x3d68ed-0x42a);}_0x540d75[_0x4c1edd(_0x2784c9._0xf8ce03,_0x2784c9._0x47e7b2)]='clawket\x20'+_0x4e1bb4(_0x2784c9._0x16c296,0x7ee),_0x540d75[_0x4e1bb4(_0x2784c9._0x1fab5a,_0x2784c9._0x36e703)]='clawket\x20'+_0x4e1bb4(0x76b,0x936)+'last\x20<2m'+'>]\x20[--li'+_0x4e1bb4(_0x2784c9._0x55d6c1,_0x2784c9._0x4e4a6d)+_0x4e1bb4(_0x2784c9._0x167fa2,_0x2784c9._0x3e93de)+'rors]\x20[-'+_0x4e1bb4(0x9ca,_0x2784c9._0x33ea29),_0x540d75['NLCBW']='clawket\x20'+_0x4c1edd(0x6f5,_0x2784c9._0xc5b988)+_0x4c1edd(0x207,0x2c9)+_0x4e1bb4(0x517,_0x2784c9._0x4d5b69)+'/127.0.0'+_0x4e1bb4(_0x2784c9._0x444d15,0x78b)+_0x4c1edd(0x6ae,0x3bb)+'place]';const _0x315ce6=_0x540d75;console[_0x4e1bb4(_0x2784c9._0x30791d,0x955)]([_0x4e1bb4(0x716,_0x2784c9._0x3fd9bf)+'pair\x20[--'+'server\x20<'+_0x4e1bb4(_0x2784c9._0x1e110c,0xa9e)+_0x4c1edd(_0x2784c9._0x5b4e10,0x415)+_0x4e1bb4(0xa75,0x9a2)+'me>]\x20[--'+'qr-file\x20'+_0x4e1bb4(_0x2784c9._0x4e9abf,_0x2784c9._0x33ddd4)+_0x4e1bb4(_0x2784c9._0x18decc,0x7ae)+_0x4e1bb4(0x5e2,0x8d5)+'e]',_0x4e1bb4(_0x2784c9._0x2afd9c,0x7a8)+_0x4e1bb4(_0x2784c9._0x47eed4,0x7db)+_0x4e1bb4(_0x2784c9._0x211733,0x715)+_0x4e1bb4(0x992,_0x2784c9._0x21e9dc)+_0x4c1edd(_0x2784c9._0x36a1b0,0x7d4)+_0x4e1bb4(0x6bf,0x3fe)+'r-file\x20<'+_0x4e1bb4(_0x2784c9._0x18da21,0x8e8)+'--json]',_0x315ce6[_0x4c1edd(_0x2784c9._0x5aa73c,0x7f1)],_0x4c1edd(0x346,0x64e)+'refresh-'+_0x4e1bb4(0x820,_0x2784c9._0x3cf6ac)+_0x4c1edd(0x5f4,0x31e)+_0x4c1edd(0x163,_0x2784c9._0x274e65)+_0x4e1bb4(_0x2784c9._0x5c5fd0,0x7e9),_0x4e1bb4(_0x2784c9._0x5f5ad6,_0x2784c9._0x55872b)+_0x4e1bb4(_0x2784c9._0x35f272,_0x2784c9._0xcfee3d),_0x315ce6['sGDvw'],_0x4e1bb4(0x716,_0x2784c9._0x500559)+_0x4c1edd(0x6ea,0x5ba),_0x4e1bb4(0x716,0x4df)+_0x4e1bb4(_0x2784c9._0x50947b,0x7d7),_0x315ce6[_0x4e1bb4(_0x2784c9._0x3948b4,_0x2784c9._0xa51b15)],_0x315ce6['YiAgB'],'clawket\x20'+'status',_0x315ce6[_0x4e1bb4(0x60b,0x3d4)],_0x4c1edd(0x346,0x2ae)+'doctor\x20['+'--json]',_0x315ce6['NLCBW']][_0x4c1edd(0x73a,_0x2784c9._0xd000ec)]('\x0a'));}function buildUnsupportedAutostartMessage(_0x264a9c){const _0x489e2f={_0x132794:0x720,_0xadde46:0x1b9,_0x91a791:0x376,_0x234a25:0x56f,_0x4616de:0x4dd,_0x1fd249:0x4ef,_0x480322:0x777,_0x415ca5:0x51c,_0x11f577:0x2b0,_0x4611a6:0x3b7,_0x1eef39:0x2a5,_0x52a40d:0x935,_0x52197f:0x415,_0x7e82cd:0x7b0,_0x44bf4c:0x642,_0x1ca2dd:0x62a,_0x5d7d71:0x2d5,_0x5cf92c:0x6f0,_0x36e55d:0x3a4,_0x594e08:0x2a1,_0x442979:0x42f,_0x20e36a:0x75a,_0x932e21:0x36c,_0xedfc19:0x575,_0x1226ce:0x413,_0x4e98fd:0x119,_0x71a20d:0x759,_0x2b61ea:0x6c6,_0x1e412f:0x404,_0x46e9b2:0x193,_0x787a6b:0x34b,_0x3f2151:0x2cf,_0x2e446d:0x7ee,_0x23906b:0x5d9,_0x4a4995:0x227,_0x3f6027:0x625,_0x2c4117:0x787,_0x20eee6:0x89e,_0xbe867c:0x649,_0xa08d68:0x31d,_0x5422ef:0x27a},_0x31b9a0={_0xcc5aa:0x82},_0x32d9cb={};_0x32d9cb[_0x2007d6(_0x489e2f._0x132794,0x4b0)]=_0x2007d6(_0x489e2f._0xadde46,_0x489e2f._0x91a791)+_0x12750f(_0x489e2f._0x234a25,_0x489e2f._0x4616de)+_0x2007d6(0x2f3,_0x489e2f._0x1fd249)+_0x2007d6(0x767,0x58b)+_0x12750f(_0x489e2f._0x480322,_0x489e2f._0x415ca5)+_0x2007d6(_0x489e2f._0x11f577,_0x489e2f._0x4611a6)+_0x12750f(0x7a,0x36c)+_0x2007d6(0x575,_0x489e2f._0x1eef39)+_0x12750f(0x597,0x56f)+'rtup\x20reg'+_0x2007d6(0x6c6,_0x489e2f._0x52a40d)+_0x12750f(0x67e,_0x489e2f._0x52197f)+_0x12750f(0xa9e,_0x489e2f._0x7e82cd)+'ainer\x20or'+_0x2007d6(_0x489e2f._0x44bf4c,_0x489e2f._0x1ca2dd)+'\x20manager'+_0x12750f(_0x489e2f._0x5d7d71,0x316)+_0x2007d6(_0x489e2f._0x5cf92c,0x7bf)+_0x2007d6(_0x489e2f._0x36e55d,0x2f7)+_0x2007d6(0x722,0x9ee);const _0x3631b7=_0x32d9cb;if(_0x264a9c[_0x12750f(_0x489e2f._0x594e08,_0x489e2f._0x442979)])return _0x3631b7[_0x2007d6(0x720,0x67a)];function _0x2007d6(_0x41f4ba,_0x2a2fb9){return _0x35d151(_0x2a2fb9,_0x41f4ba-_0x31b9a0._0xcc5aa);}function _0x12750f(_0x37ab56,_0x31af91){return _0x35d151(_0x37ab56,_0x31af91-0x1de);}return _0x12750f(0x81b,_0x489e2f._0x20e36a)+_0x2007d6(0x2b0,0x104)+_0x12750f(0x4ad,_0x489e2f._0x932e21)+_0x2007d6(_0x489e2f._0xedfc19,0x6c3)+_0x2007d6(_0x489e2f._0x1226ce,_0x489e2f._0x4e98fd)+_0x2007d6(_0x489e2f._0x71a20d,0x9d5)+_0x2007d6(_0x489e2f._0x2b61ea,_0x489e2f._0x1e412f)+_0x12750f(0x45d,_0x489e2f._0x71a20d)+_0x12750f(0x39f,0x47b)+'e\x20runtim'+_0x2007d6(0x265,0xe9)+_0x2007d6(_0x489e2f._0x46e9b2,_0x489e2f._0x787a6b)+_0x12750f(_0x489e2f._0x3f2151,0x2e5)+_0x12750f(_0x489e2f._0x2e446d,_0x489e2f._0x23906b)+'ally.\x20Us'+_0x2007d6(0x4b8,_0x489e2f._0x4a4995)+_0x12750f(_0x489e2f._0x3f6027,0x3c3)+_0x2007d6(0x450,0x6d5)+_0x12750f(_0x489e2f._0x2c4117,_0x489e2f._0x20eee6)+_0x12750f(_0x489e2f._0xbe867c,0x76a)+_0x12750f(0xcb,_0x489e2f._0xa08d68)+_0x2007d6(_0x489e2f._0x5422ef,0x31f);}function formatLocalTime(_0x165576){const _0x5f5c3f={_0x13e97c:0x276},_0x22e27a=new Date(_0x165576);if(Number['isNaN'](_0x22e27a[_0x501a0e(_0x5f5c3f._0x13e97c,0x2b1)]()))return _0x165576;function _0x501a0e(_0x56bf6d,_0x255a9d){return _0x35d151(_0x56bf6d,_0x255a9d-0x1c5);}return _0x22e27a['toLocale'+'String']();}function formatError2(_0x2bc132){const _0x269eff={_0x3b7511:0xf4},_0x55f8da={_0x3e8387:0x28d};function _0x68127f(_0x411d8b,_0x5b95a7){return _0x35d151(_0x411d8b,_0x5b95a7- -_0x55f8da._0x3e8387);}return _0x2bc132 instanceof Error?_0x2bc132[_0x68127f(-0x1d9,-_0x269eff._0x3b7511)]:String(_0x2bc132);}function printJson(_0x25827e){const _0x274d90={_0x40f4a9:0x525},_0x3605aa={_0x454cdf:0x253};function _0x48b56d(_0x43bb83,_0x12ac7b){return _0x341e52(_0x12ac7b- -_0x3605aa._0x454cdf,_0x43bb83);}function _0x1f1faa(_0x10d553,_0x59cee4){return _0x341e52(_0x59cee4-0xc6,_0x10d553);}console[_0x48b56d(0x597,0x484)](JSON[_0x48b56d(0x26d,_0x274d90._0x40f4a9)+'y'](_0x25827e,null,0x2));}main()[_0x341e52(0x793,0x7ee)](_0x4e3947=>{const _0x205a19={_0x5d871b:0x60e};function _0x550f0b(_0x5584f6,_0x5bf3fe){return _0x341e52(_0x5bf3fe- -0x198,_0x5584f6);}function _0x15df3e(_0x1b5baf,_0x319472){return _0x341e52(_0x319472- -0x2d,_0x1b5baf);}console[_0x550f0b(0x244,0x418)](formatError2(_0x4e3947)),process[_0x550f0b(_0x205a19._0x5d871b,0x5de)](0x1);});
2
+
3
+ // src/index.ts
4
+ import qrcodeTerminal from "qrcode-terminal";
5
+
6
+ // src/diagnostics.ts
7
+ import { readFileSync as readFileSync4 } from "fs";
8
+ import { Socket } from "net";
9
+ import { homedir as homedir4 } from "os";
10
+
11
+ // ../../packages/bridge-core/dist/config.js
12
+ import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
13
+ import { randomUUID } from "crypto";
14
+ import { homedir, hostname, userInfo } from "os";
15
+ import { join } from "path";
16
+ var CONFIG_DIR = join(homedir(), ".clawket");
17
+ var CONFIG_PATH = join(CONFIG_DIR, "bridge-cli.json");
18
+ var CONFIG_DIR_MODE = 448;
19
+ var CONFIG_FILE_MODE = 384;
20
+ function getPairingConfigPath() {
21
+ return CONFIG_PATH;
22
+ }
23
+ function readPairingConfig() {
24
+ if (!existsSync(CONFIG_PATH))
25
+ return null;
26
+ hardenPairingConfigPermissions();
27
+ try {
28
+ const parsed = JSON.parse(readFileSync(CONFIG_PATH, "utf8"));
29
+ if (!parsed.serverUrl || !parsed.gatewayId || !parsed.relaySecret || !parsed.relayUrl) {
30
+ return null;
31
+ }
32
+ const normalized = {
33
+ serverUrl: parsed.serverUrl,
34
+ gatewayId: parsed.gatewayId,
35
+ relaySecret: parsed.relaySecret,
36
+ relayUrl: parsed.relayUrl,
37
+ instanceId: parsed.instanceId?.trim() || createInstanceId(),
38
+ displayName: parsed.displayName ?? null,
39
+ createdAt: parsed.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
40
+ updatedAt: parsed.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
41
+ };
42
+ if (parsed.instanceId !== normalized.instanceId) {
43
+ writePairingConfig(normalized);
44
+ }
45
+ return normalized;
46
+ } catch {
47
+ return null;
48
+ }
49
+ }
50
+ function writePairingConfig(config) {
51
+ ensurePairingConfigDir();
52
+ writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + "\n", {
53
+ encoding: "utf8",
54
+ mode: CONFIG_FILE_MODE
55
+ });
56
+ safeChmodSync(CONFIG_PATH, CONFIG_FILE_MODE);
57
+ }
58
+ function deletePairingConfig() {
59
+ if (!existsSync(CONFIG_PATH))
60
+ return;
61
+ rmSync(CONFIG_PATH, { force: true });
62
+ }
63
+ function getDefaultBridgeDisplayName() {
64
+ const openClawName = readOpenClawDefaultAgentName();
65
+ if (openClawName)
66
+ return openClawName;
67
+ try {
68
+ const username = userInfo().username.trim();
69
+ if (username)
70
+ return username;
71
+ } catch {
72
+ }
73
+ const envName = (process.env.LOGNAME ?? process.env.USER ?? process.env.USERNAME ?? "").trim();
74
+ if (envName)
75
+ return envName;
76
+ return hostname().trim() || "Clawket Bridge";
77
+ }
78
+ function pickOpenClawDefaultAgentName(value) {
79
+ if (!value || typeof value !== "object")
80
+ return null;
81
+ const agents = value.agents;
82
+ const list = Array.isArray(agents?.list) ? agents.list : [];
83
+ const preferred = list.find((item) => isDefaultAgent(item)) ?? list.find((item) => hasAgentId(item, "main")) ?? list[0];
84
+ return readAgentName(preferred);
85
+ }
86
+ function createInstanceId() {
87
+ const host = sanitizeId(hostname() || "host");
88
+ return `inst-${host}-${randomUUID().slice(0, 10)}`;
89
+ }
90
+ function sanitizeId(input) {
91
+ return input.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "host";
92
+ }
93
+ function readOpenClawDefaultAgentName() {
94
+ const openclawConfigPath = resolveOpenClawConfigPath();
95
+ if (!openclawConfigPath || !existsSync(openclawConfigPath))
96
+ return null;
97
+ try {
98
+ const parsed = JSON.parse(readFileSync(openclawConfigPath, "utf8"));
99
+ return pickOpenClawDefaultAgentName(parsed);
100
+ } catch {
101
+ return null;
102
+ }
103
+ }
104
+ function ensurePairingConfigDir() {
105
+ mkdirSync(CONFIG_DIR, { recursive: true, mode: CONFIG_DIR_MODE });
106
+ safeChmodSync(CONFIG_DIR, CONFIG_DIR_MODE);
107
+ }
108
+ function hardenPairingConfigPermissions() {
109
+ if (existsSync(CONFIG_DIR)) {
110
+ safeChmodSync(CONFIG_DIR, CONFIG_DIR_MODE);
111
+ }
112
+ safeChmodSync(CONFIG_PATH, CONFIG_FILE_MODE);
113
+ }
114
+ function safeChmodSync(path, mode) {
115
+ try {
116
+ chmodSync(path, mode);
117
+ } catch {
118
+ }
119
+ }
120
+ function resolveOpenClawConfigPath() {
121
+ const seen = /* @__PURE__ */ new Set();
122
+ const homes = [homedir(), "/root"].map((value) => value.trim()).filter(Boolean).filter((value) => {
123
+ if (seen.has(value))
124
+ return false;
125
+ seen.add(value);
126
+ return true;
127
+ });
128
+ for (const home of homes) {
129
+ const configPath = join(home, ".openclaw", "openclaw.json");
130
+ if (existsSync(configPath))
131
+ return configPath;
132
+ }
133
+ return homes[0] ? join(homes[0], ".openclaw", "openclaw.json") : null;
134
+ }
135
+ function isDefaultAgent(value) {
136
+ return Boolean(value && typeof value === "object" && value.default === true);
137
+ }
138
+ function hasAgentId(value, id) {
139
+ return Boolean(value && typeof value === "object" && typeof value.id === "string" && value.id.trim() === id);
140
+ }
141
+ function readAgentName(value) {
142
+ if (!value || typeof value !== "object")
143
+ return null;
144
+ const record = value;
145
+ const identityName = typeof record.identity?.name === "string" ? record.identity.name.trim() : "";
146
+ if (identityName)
147
+ return identityName;
148
+ const name = typeof record.name === "string" ? record.name.trim() : "";
149
+ return name || null;
150
+ }
151
+
152
+ // ../../packages/bridge-core/dist/qr.js
153
+ function buildPairingQrPayload(input) {
154
+ const payload = {
155
+ v: 2,
156
+ k: "cp",
157
+ s: input.server,
158
+ g: input.gatewayId,
159
+ a: input.accessCode,
160
+ rb: 1,
161
+ pv: 2,
162
+ sb: true
163
+ };
164
+ if (input.displayName?.trim()) {
165
+ payload.n = input.displayName.trim();
166
+ }
167
+ if (input.token?.trim()) {
168
+ payload.t = input.token.trim();
169
+ }
170
+ if (input.password?.trim()) {
171
+ payload.p = input.password.trim();
172
+ }
173
+ return JSON.stringify(payload);
174
+ }
175
+ function buildGatewayQrPayload(input) {
176
+ const parsed = normalizeGatewayQrUrl(input.gatewayUrl);
177
+ const payload = {
178
+ url: parsed.url,
179
+ host: parsed.host,
180
+ port: parsed.port,
181
+ tls: parsed.tls,
182
+ mode: "gateway",
183
+ expiresAt: input.expiresAt ?? Date.now() + 10 * 60 * 1e3,
184
+ qrVersion: 2
185
+ };
186
+ if (input.token?.trim()) {
187
+ payload.token = input.token.trim();
188
+ }
189
+ if (input.password?.trim()) {
190
+ payload.password = input.password.trim();
191
+ }
192
+ return JSON.stringify(payload);
193
+ }
194
+ function normalizeGatewayQrUrl(url) {
195
+ const parsed = new URL(url.trim());
196
+ const tls = parsed.protocol === "wss:" || parsed.protocol === "https:";
197
+ const scheme = tls ? "wss:" : "ws:";
198
+ const host = parsed.hostname;
199
+ const port = parsed.port ? Number(parsed.port) : tls ? 443 : 80;
200
+ const path = !parsed.pathname || parsed.pathname === "" ? "/" : parsed.pathname;
201
+ return {
202
+ url: `${scheme}//${host}:${port}${path}`,
203
+ host,
204
+ port,
205
+ path,
206
+ tls
207
+ };
208
+ }
209
+
210
+ // ../../packages/bridge-core/dist/pairing.js
211
+ var DEFAULT_REGISTRY_BASE = "https://registry.clawket.ai";
212
+ var DEFAULT_REGISTRY_FALLBACK_BASE = "https://clawket-registry.clawket.workers.dev";
213
+ async function pairGateway(input) {
214
+ const baseUrl = normalizeHttpBase(input.serverUrl);
215
+ const existing = readPairingConfig();
216
+ const compatibility = assessPairingCompatibility(existing, baseUrl);
217
+ if (compatibility === "refresh-existing" && existing) {
218
+ return refreshAccessCode({
219
+ serverUrl: existing.serverUrl,
220
+ gatewayId: existing.gatewayId,
221
+ relaySecret: existing.relaySecret,
222
+ displayName: input.displayName,
223
+ gatewayToken: input.gatewayToken,
224
+ gatewayPassword: input.gatewayPassword
225
+ });
226
+ }
227
+ if (compatibility === "server-mismatch") {
228
+ throw new Error(`This bridge is already paired with ${existing?.serverUrl}. Run "clawket reset" before pairing with a different server.`);
229
+ }
230
+ const registerRequest = await postJsonWithCloudflareFallback(`${baseUrl}/v1/pair/register`, {
231
+ method: "POST",
232
+ headers: { "content-type": "application/json", accept: "application/json" },
233
+ body: JSON.stringify({
234
+ displayName: input.displayName?.trim() || null
235
+ })
236
+ });
237
+ if (!registerRequest.response.ok) {
238
+ throw await buildPairingRequestError("Pair register", registerRequest);
239
+ }
240
+ const payload = await registerRequest.response.json();
241
+ const now = (/* @__PURE__ */ new Date()).toISOString();
242
+ const config = {
243
+ serverUrl: baseUrl,
244
+ gatewayId: payload.gatewayId,
245
+ relaySecret: payload.relaySecret,
246
+ relayUrl: payload.relayUrl,
247
+ instanceId: existing?.instanceId ?? `inst-${payload.gatewayId.slice(-10)}`,
248
+ displayName: payload.displayName,
249
+ createdAt: now,
250
+ updatedAt: now
251
+ };
252
+ writePairingConfig(config);
253
+ return {
254
+ config,
255
+ accessCode: payload.accessCode,
256
+ accessCodeExpiresAt: payload.accessCodeExpiresAt,
257
+ action: "registered",
258
+ qrPayload: buildPairingQrPayload({
259
+ server: baseUrl,
260
+ gatewayId: payload.gatewayId,
261
+ accessCode: payload.accessCode,
262
+ displayName: payload.displayName,
263
+ token: input.gatewayToken?.trim() || null,
264
+ password: input.gatewayPassword?.trim() || null
265
+ })
266
+ };
267
+ }
268
+ async function refreshAccessCode(input) {
269
+ const existing = readPairingConfig();
270
+ const serverUrl = normalizeHttpBase(input?.serverUrl ?? existing?.serverUrl ?? "");
271
+ const gatewayId = input?.gatewayId ?? existing?.gatewayId ?? "";
272
+ const relaySecret = input?.relaySecret ?? existing?.relaySecret ?? "";
273
+ if (!serverUrl || !gatewayId || !relaySecret) {
274
+ throw new Error("Pairing config not found. Run pair first.");
275
+ }
276
+ const refreshRequest = await postJsonWithCloudflareFallback(`${serverUrl}/v1/pair/access-code`, {
277
+ method: "POST",
278
+ headers: { "content-type": "application/json", accept: "application/json" },
279
+ body: JSON.stringify({
280
+ gatewayId,
281
+ relaySecret,
282
+ displayName: input?.displayName?.trim() || void 0
283
+ })
284
+ });
285
+ if (!refreshRequest.response.ok) {
286
+ throw await buildPairingRequestError("Access code refresh", refreshRequest);
287
+ }
288
+ const payload = await refreshRequest.response.json();
289
+ const nextConfig = {
290
+ serverUrl,
291
+ gatewayId: payload.gatewayId,
292
+ relaySecret,
293
+ relayUrl: payload.relayUrl,
294
+ instanceId: existing?.instanceId ?? `inst-${payload.gatewayId.slice(-10)}`,
295
+ displayName: payload.displayName,
296
+ createdAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
297
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
298
+ };
299
+ writePairingConfig(nextConfig);
300
+ return {
301
+ config: nextConfig,
302
+ accessCode: payload.accessCode,
303
+ accessCodeExpiresAt: payload.accessCodeExpiresAt,
304
+ action: "refreshed",
305
+ qrPayload: buildPairingQrPayload({
306
+ server: serverUrl,
307
+ gatewayId: payload.gatewayId,
308
+ accessCode: payload.accessCode,
309
+ displayName: payload.displayName,
310
+ token: input?.gatewayToken?.trim() || null,
311
+ password: input?.gatewayPassword?.trim() || null
312
+ })
313
+ };
314
+ }
315
+ function normalizeHttpBase(url) {
316
+ const trimmed = url.trim();
317
+ if (!trimmed)
318
+ return "";
319
+ if (trimmed.startsWith("http://") || trimmed.startsWith("https://")) {
320
+ return trimmed.replace(/\/+$/, "");
321
+ }
322
+ if (trimmed.startsWith("ws://"))
323
+ return `http://${trimmed.slice("ws://".length)}`.replace(/\/+$/, "");
324
+ if (trimmed.startsWith("wss://"))
325
+ return `https://${trimmed.slice("wss://".length)}`.replace(/\/+$/, "");
326
+ return `https://${trimmed}`.replace(/\/+$/, "");
327
+ }
328
+ function assessPairingCompatibility(existing, nextServerUrl) {
329
+ if (!existing)
330
+ return "register-new";
331
+ if (existing.serverUrl === nextServerUrl)
332
+ return "refresh-existing";
333
+ return "server-mismatch";
334
+ }
335
+ async function postJsonWithCloudflareFallback(url, init) {
336
+ const response = await fetch(url, init);
337
+ const fallbackUrl = resolveCloudflareChallengeFallbackUrl(url, response);
338
+ if (!fallbackUrl) {
339
+ return { response, attemptedUrl: url, fallbackUrl: null };
340
+ }
341
+ return {
342
+ response: await fetch(fallbackUrl, init),
343
+ attemptedUrl: url,
344
+ fallbackUrl
345
+ };
346
+ }
347
+ async function buildPairingRequestError(action, request) {
348
+ if (isCloudflareChallengeResponse(request.response)) {
349
+ const targetOrigin = new URL(request.fallbackUrl ?? request.attemptedUrl).origin;
350
+ const fallbackText = request.fallbackUrl ? ` Automatic fallback to ${request.fallbackUrl} also hit a Cloudflare challenge.` : "";
351
+ return new Error(`${action} failed (${request.response.status}): Cloudflare challenge blocked the registry API at ${targetOrigin}.${fallbackText} Retry from a different network or use a registry endpoint that does not require browser verification.`);
352
+ }
353
+ return new Error(`${action} failed (${request.response.status}): ${summarizeFailedResponse(await request.response.text())}`);
354
+ }
355
+ function isCloudflareChallengeResponse(response) {
356
+ return response.status === 403 && response.headers.get("cf-mitigated")?.trim().toLowerCase() === "challenge";
357
+ }
358
+ function resolveCloudflareChallengeFallbackUrl(url, response) {
359
+ if (!isCloudflareChallengeResponse(response))
360
+ return null;
361
+ const requestUrl = new URL(url);
362
+ if (requestUrl.origin !== DEFAULT_REGISTRY_BASE)
363
+ return null;
364
+ return `${DEFAULT_REGISTRY_FALLBACK_BASE}${requestUrl.pathname}${requestUrl.search}`;
365
+ }
366
+ function summarizeFailedResponse(text) {
367
+ const collapsed = text.replace(/\s+/g, " ").trim();
368
+ if (!collapsed)
369
+ return "Empty response body";
370
+ if (collapsed.length <= 240)
371
+ return collapsed;
372
+ return `${collapsed.slice(0, 237)}...`;
373
+ }
374
+
375
+ // ../../packages/bridge-core/dist/service.js
376
+ import { execFileSync, spawn } from "child_process";
377
+ import { chmodSync as chmodSync2, closeSync, existsSync as existsSync2, mkdirSync as mkdirSync2, openSync, readFileSync as readFileSync2, realpathSync, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
378
+ import { homedir as homedir2 } from "os";
379
+ import { dirname, join as join2 } from "path";
380
+ import { setTimeout as delay } from "timers/promises";
381
+ var SERVICE_LABEL = "ai.clawket.bridge.cli";
382
+ var SYSTEMD_UNIT_NAME = `${SERVICE_LABEL}.service`;
383
+ var WINDOWS_RUN_KEY = "ClawketBridgeCli";
384
+ var SERVICE_DIR = join2(homedir2(), ".clawket");
385
+ var LOG_DIR = join2(SERVICE_DIR, "logs");
386
+ var SERVICE_STATE_PATH = join2(SERVICE_DIR, "bridge-service.json");
387
+ var RUNTIME_REGISTRY_PATH = join2(SERVICE_DIR, "bridge-runtime-processes.json");
388
+ var SERVICE_LAUNCHER_PATH = join2(SERVICE_DIR, "clawket-launcher.sh");
389
+ var LINUX_CRON_RECORD_PATH = join2(SERVICE_DIR, "bridge-service.cron");
390
+ var SERVICE_LOG_PATH = join2(LOG_DIR, "bridge-cli.log");
391
+ var SERVICE_ERROR_LOG_PATH = join2(LOG_DIR, "bridge-cli-error.log");
392
+ var MACOS_PLIST_PATH = join2(homedir2(), "Library", "LaunchAgents", `${SERVICE_LABEL}.plist`);
393
+ var LINUX_SERVICE_PATH = join2(homedir2(), ".config", "systemd", "user", SYSTEMD_UNIT_NAME);
394
+ var LINUX_CRON_MARKER = "# clawket-bridge-cli";
395
+ function getServiceProgramArgs(context = {}, platform = process.platform) {
396
+ const nodePath = context.nodePath?.trim() || process.execPath;
397
+ const scriptPath = resolveScriptPath(context.scriptPath);
398
+ if (!scriptPath) {
399
+ throw new Error("Unable to resolve CLI script path for service installation.");
400
+ }
401
+ if (platform !== "win32") {
402
+ const launcherPath = writeServiceLauncher({
403
+ nodePath,
404
+ scriptPath,
405
+ pathEnv: process.env.PATH ?? ""
406
+ });
407
+ ensureLaunchScriptExecutable(launcherPath, platform);
408
+ return [launcherPath];
409
+ }
410
+ return [nodePath, scriptPath, "run", "--service"];
411
+ }
412
+ function getServiceStatus() {
413
+ ensureServiceDirs();
414
+ const pid = readServiceState()?.pid ?? null;
415
+ const method = detectServiceMethod();
416
+ const base = {
417
+ installed: false,
418
+ running: pid != null && isPidRunning(pid),
419
+ method,
420
+ servicePath: getServicePath(method),
421
+ logPath: SERVICE_LOG_PATH,
422
+ errorLogPath: SERVICE_ERROR_LOG_PATH,
423
+ pid
424
+ };
425
+ if (base.pid != null && !base.running) {
426
+ clearServiceState(base.pid);
427
+ base.pid = null;
428
+ }
429
+ switch (base.method) {
430
+ case "launchagent":
431
+ base.installed = existsSync2(MACOS_PLIST_PATH);
432
+ if (base.installed) {
433
+ base.running = commandSucceeds("launchctl", ["list", SERVICE_LABEL]) || base.running;
434
+ }
435
+ return base;
436
+ case "systemd-user":
437
+ base.installed = existsSync2(LINUX_SERVICE_PATH);
438
+ if (base.installed) {
439
+ base.running = commandSucceeds("systemctl", ["--user", "is-active", "--quiet", SYSTEMD_UNIT_NAME]) || base.running;
440
+ }
441
+ return base;
442
+ case "linux-crontab":
443
+ base.installed = hasLinuxCronRegistration();
444
+ return base;
445
+ case "windows-run-registry":
446
+ base.installed = commandSucceeds("reg", [
447
+ "query",
448
+ "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
449
+ "/v",
450
+ WINDOWS_RUN_KEY
451
+ ]);
452
+ return base;
453
+ default:
454
+ return base;
455
+ }
456
+ }
457
+ function installService(context = {}) {
458
+ ensureServiceDirs();
459
+ const args = getServiceProgramArgs(context);
460
+ switch (process.platform) {
461
+ case "darwin":
462
+ writeFileSync2(MACOS_PLIST_PATH, buildMacosPlist(args, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH), "utf8");
463
+ execIgnoreFailure("launchctl", ["unload", "-w", MACOS_PLIST_PATH]);
464
+ execFileSync("launchctl", ["load", "-w", MACOS_PLIST_PATH], { stdio: "ignore" });
465
+ break;
466
+ case "linux":
467
+ installLinuxService(args);
468
+ break;
469
+ case "win32":
470
+ stopRunningProcess();
471
+ execFileSync("reg", [
472
+ "add",
473
+ "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
474
+ "/v",
475
+ WINDOWS_RUN_KEY,
476
+ "/t",
477
+ "REG_SZ",
478
+ "/d",
479
+ buildWindowsRunCommand(args),
480
+ "/f"
481
+ ], { stdio: "ignore" });
482
+ startDetachedWindowsService(args);
483
+ break;
484
+ default:
485
+ throw new Error(`Unsupported platform for CLI service installation: ${process.platform}`);
486
+ }
487
+ return getServiceStatus();
488
+ }
489
+ function restartService(context = {}) {
490
+ ensureServiceDirs();
491
+ const args = getServiceProgramArgs(context);
492
+ switch (process.platform) {
493
+ case "darwin":
494
+ if (!existsSync2(MACOS_PLIST_PATH)) {
495
+ return installService(context);
496
+ }
497
+ writeFileSync2(MACOS_PLIST_PATH, buildMacosPlist(args, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH), "utf8");
498
+ execIgnoreFailure("launchctl", ["unload", "-w", MACOS_PLIST_PATH]);
499
+ execFileSync("launchctl", ["load", "-w", MACOS_PLIST_PATH], { stdio: "ignore" });
500
+ break;
501
+ case "linux":
502
+ restartLinuxService(args);
503
+ break;
504
+ case "win32":
505
+ stopRunningProcess();
506
+ execFileSync("reg", [
507
+ "add",
508
+ "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
509
+ "/v",
510
+ WINDOWS_RUN_KEY,
511
+ "/t",
512
+ "REG_SZ",
513
+ "/d",
514
+ buildWindowsRunCommand(args),
515
+ "/f"
516
+ ], { stdio: "ignore" });
517
+ startDetachedWindowsService(args);
518
+ break;
519
+ default:
520
+ throw new Error(`Unsupported platform for CLI service restart: ${process.platform}`);
521
+ }
522
+ return getServiceStatus();
523
+ }
524
+ async function startTransientRuntime(context = {}) {
525
+ ensureServiceDirs();
526
+ const args = getServiceProgramArgs(context);
527
+ switch (process.platform) {
528
+ case "darwin":
529
+ case "linux":
530
+ startDetachedPosixService(args);
531
+ break;
532
+ case "win32":
533
+ startDetachedWindowsService(args);
534
+ break;
535
+ default:
536
+ throw new Error(`Unsupported platform for transient CLI runtime start: ${process.platform}`);
537
+ }
538
+ return waitForRuntimeState();
539
+ }
540
+ function uninstallService() {
541
+ stopRunningProcess();
542
+ switch (process.platform) {
543
+ case "darwin":
544
+ execIgnoreFailure("launchctl", ["unload", "-w", MACOS_PLIST_PATH]);
545
+ rmIfExists(MACOS_PLIST_PATH);
546
+ break;
547
+ case "linux":
548
+ if (existsSync2(LINUX_SERVICE_PATH)) {
549
+ execIgnoreFailure("systemctl", ["--user", "disable", "--now", SYSTEMD_UNIT_NAME]);
550
+ rmIfExists(LINUX_SERVICE_PATH);
551
+ execIgnoreFailure("systemctl", ["--user", "daemon-reload"]);
552
+ }
553
+ removeLinuxCronRegistration();
554
+ break;
555
+ case "win32":
556
+ execIgnoreFailure("reg", [
557
+ "delete",
558
+ "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
559
+ "/v",
560
+ WINDOWS_RUN_KEY,
561
+ "/f"
562
+ ]);
563
+ break;
564
+ default:
565
+ break;
566
+ }
567
+ clearServiceState();
568
+ return getServiceStatus();
569
+ }
570
+ function stopService() {
571
+ stopRunningProcess();
572
+ switch (process.platform) {
573
+ case "darwin":
574
+ if (existsSync2(MACOS_PLIST_PATH)) {
575
+ execIgnoreFailure("launchctl", ["unload", MACOS_PLIST_PATH]);
576
+ }
577
+ break;
578
+ case "linux":
579
+ if (existsSync2(LINUX_SERVICE_PATH)) {
580
+ execIgnoreFailure("systemctl", ["--user", "stop", SYSTEMD_UNIT_NAME]);
581
+ }
582
+ break;
583
+ case "win32":
584
+ break;
585
+ default:
586
+ break;
587
+ }
588
+ clearServiceState();
589
+ return getServiceStatus();
590
+ }
591
+ function writeServiceState(pid = process.pid) {
592
+ ensureServiceDirs();
593
+ const state = {
594
+ pid,
595
+ startedAt: (/* @__PURE__ */ new Date()).toISOString()
596
+ };
597
+ writeFileSync2(SERVICE_STATE_PATH, JSON.stringify(state, null, 2) + "\n", "utf8");
598
+ }
599
+ function registerRuntimeProcess(record) {
600
+ ensureServiceDirs();
601
+ const next = {
602
+ pid: record.pid ?? process.pid,
603
+ startedAt: record.startedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
604
+ gatewayId: record.gatewayId,
605
+ instanceId: record.instanceId,
606
+ serviceMode: record.serviceMode,
607
+ scriptPath: resolveScriptPath(record.scriptPath)
608
+ };
609
+ const records = readRuntimeRegistry().filter((entry) => entry.pid !== next.pid).concat(next);
610
+ writeRuntimeRegistry(records);
611
+ }
612
+ function unregisterRuntimeProcess(pid = process.pid) {
613
+ const records = readRuntimeRegistry().filter((entry) => entry.pid !== pid);
614
+ writeRuntimeRegistry(records);
615
+ }
616
+ function isAutostartUnsupportedError(error) {
617
+ const message = formatError(error).toLowerCase();
618
+ return message.includes("no crontab fallback is available") || message.includes("unsupported platform for cli service");
619
+ }
620
+ function listRuntimeProcesses(context = {}) {
621
+ const scriptPath = resolveScriptPath(context.scriptPath);
622
+ const records = readRuntimeRegistry();
623
+ const result = [...records];
624
+ const known = new Set(records.map((entry) => entry.pid));
625
+ for (const pid of listPosixRuntimePids(scriptPath)) {
626
+ if (known.has(pid))
627
+ continue;
628
+ result.push({
629
+ pid,
630
+ startedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
631
+ gatewayId: "",
632
+ instanceId: "",
633
+ serviceMode: false,
634
+ scriptPath
635
+ });
636
+ }
637
+ return result.filter((entry) => isPidRunning(entry.pid)).sort((a, b) => a.pid - b.pid);
638
+ }
639
+ function stopRuntimeProcesses(options = {}) {
640
+ const records = listRuntimeProcesses({ scriptPath: options.scriptPath });
641
+ const victims = records.filter((entry) => entry.pid !== (options.excludePid ?? -1));
642
+ if (process.platform === "win32") {
643
+ for (const entry of victims) {
644
+ execIgnoreFailure("taskkill", ["/PID", String(entry.pid), "/T", "/F"]);
645
+ }
646
+ } else {
647
+ for (const entry of victims) {
648
+ execIgnoreFailure("kill", ["-TERM", String(entry.pid)]);
649
+ }
650
+ for (const entry of victims) {
651
+ if (!waitForPidExit(entry.pid, 3e3)) {
652
+ execIgnoreFailure("kill", ["-KILL", String(entry.pid)]);
653
+ }
654
+ }
655
+ }
656
+ const remaining = readRuntimeRegistry().filter((entry) => !victims.some((victim) => victim.pid === entry.pid));
657
+ writeRuntimeRegistry(remaining);
658
+ const serviceState = readServiceState();
659
+ if (serviceState && victims.some((entry) => entry.pid === serviceState.pid)) {
660
+ clearServiceState();
661
+ }
662
+ return victims.map((entry) => entry.pid);
663
+ }
664
+ function clearServiceState(expectedPid) {
665
+ if (!existsSync2(SERVICE_STATE_PATH))
666
+ return;
667
+ if (expectedPid != null) {
668
+ const current = readServiceState();
669
+ if (current && current.pid !== expectedPid) {
670
+ return;
671
+ }
672
+ }
673
+ rmIfExists(SERVICE_STATE_PATH);
674
+ }
675
+ function getServicePaths() {
676
+ return {
677
+ logPath: SERVICE_LOG_PATH,
678
+ errorLogPath: SERVICE_ERROR_LOG_PATH,
679
+ servicePath: getServicePath(detectServiceMethod())
680
+ };
681
+ }
682
+ function buildMacosPlist(programArgs, logPath, errorLogPath) {
683
+ const argsXml = programArgs.map((arg) => ` <string>${escapeXml(arg)}</string>`).join("\n");
684
+ return `<?xml version="1.0" encoding="UTF-8"?>
685
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
686
+ <plist version="1.0">
687
+ <dict>
688
+ <key>Label</key>
689
+ <string>${SERVICE_LABEL}</string>
690
+ <key>ProgramArguments</key>
691
+ <array>
692
+ ${argsXml}
693
+ </array>
694
+ <key>RunAtLoad</key>
695
+ <true/>
696
+ <key>KeepAlive</key>
697
+ <true/>
698
+ <key>StandardOutPath</key>
699
+ <string>${escapeXml(logPath)}</string>
700
+ <key>StandardErrorPath</key>
701
+ <string>${escapeXml(errorLogPath)}</string>
702
+ </dict>
703
+ </plist>
704
+ `;
705
+ }
706
+ function buildLinuxSystemdUnit(programArgs, logPath, errorLogPath) {
707
+ const execStart = programArgs.map(escapeSystemdArg).join(" ");
708
+ return `[Unit]
709
+ Description=Clawket Bridge CLI
710
+ After=network-online.target
711
+ Wants=network-online.target
712
+
713
+ [Service]
714
+ Type=simple
715
+ ExecStart=${execStart}
716
+ Restart=always
717
+ RestartSec=2
718
+ WorkingDirectory=${escapeSystemdArg(SERVICE_DIR)}
719
+ StandardOutput=append:${logPath}
720
+ StandardError=append:${errorLogPath}
721
+
722
+ [Install]
723
+ WantedBy=default.target
724
+ `;
725
+ }
726
+ function buildLinuxCronEntry(programArgs, logPath, errorLogPath) {
727
+ const command = programArgs.map(escapeShellWord).join(" ");
728
+ return `@reboot ${command} >> ${escapeShellWord(logPath)} 2>> ${escapeShellWord(errorLogPath)} ${LINUX_CRON_MARKER}`;
729
+ }
730
+ function getServicePath(method) {
731
+ switch (process.platform) {
732
+ case "darwin":
733
+ return MACOS_PLIST_PATH;
734
+ case "linux":
735
+ return method === "linux-crontab" ? LINUX_CRON_RECORD_PATH : LINUX_SERVICE_PATH;
736
+ case "win32":
737
+ return "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\ClawketBridgeCli";
738
+ default:
739
+ return "";
740
+ }
741
+ }
742
+ function detectServiceMethod() {
743
+ switch (process.platform) {
744
+ case "darwin":
745
+ return "launchagent";
746
+ case "linux":
747
+ if (existsSync2(LINUX_SERVICE_PATH)) {
748
+ return "systemd-user";
749
+ }
750
+ if (hasLinuxCronRegistration()) {
751
+ return "linux-crontab";
752
+ }
753
+ if (commandExists("systemctl")) {
754
+ return "systemd-user";
755
+ }
756
+ if (commandExists("crontab")) {
757
+ return "linux-crontab";
758
+ }
759
+ return "unsupported";
760
+ case "win32":
761
+ return "windows-run-registry";
762
+ default:
763
+ return "unsupported";
764
+ }
765
+ }
766
+ function readServiceState() {
767
+ if (!existsSync2(SERVICE_STATE_PATH))
768
+ return null;
769
+ try {
770
+ const parsed = JSON.parse(readFileSync2(SERVICE_STATE_PATH, "utf8"));
771
+ if (!parsed.pid || typeof parsed.pid !== "number")
772
+ return null;
773
+ return {
774
+ pid: parsed.pid,
775
+ startedAt: parsed.startedAt ?? (/* @__PURE__ */ new Date(0)).toISOString()
776
+ };
777
+ } catch {
778
+ return null;
779
+ }
780
+ }
781
+ function readRuntimeRegistry() {
782
+ if (!existsSync2(RUNTIME_REGISTRY_PATH))
783
+ return [];
784
+ try {
785
+ const parsed = JSON.parse(readFileSync2(RUNTIME_REGISTRY_PATH, "utf8"));
786
+ if (!Array.isArray(parsed))
787
+ return [];
788
+ const normalized = parsed.map((entry) => normalizeRuntimeProcessRecord(entry)).filter((entry) => entry != null && isPidRunning(entry.pid));
789
+ writeRuntimeRegistry(normalized);
790
+ return normalized;
791
+ } catch {
792
+ return [];
793
+ }
794
+ }
795
+ function writeRuntimeRegistry(records) {
796
+ if (records.length === 0) {
797
+ rmIfExists(RUNTIME_REGISTRY_PATH);
798
+ return;
799
+ }
800
+ ensureServiceDirs();
801
+ writeFileSync2(RUNTIME_REGISTRY_PATH, JSON.stringify(records, null, 2) + "\n", "utf8");
802
+ }
803
+ function normalizeRuntimeProcessRecord(value) {
804
+ if (!value || typeof value !== "object")
805
+ return null;
806
+ const entry = value;
807
+ if (!entry.pid || typeof entry.pid !== "number")
808
+ return null;
809
+ const scriptPath = typeof entry.scriptPath === "string" ? resolveScriptPath(entry.scriptPath) : "";
810
+ if (!scriptPath)
811
+ return null;
812
+ return {
813
+ pid: entry.pid,
814
+ startedAt: typeof entry.startedAt === "string" ? entry.startedAt : (/* @__PURE__ */ new Date(0)).toISOString(),
815
+ gatewayId: typeof entry.gatewayId === "string" ? entry.gatewayId : "",
816
+ instanceId: typeof entry.instanceId === "string" ? entry.instanceId : "",
817
+ serviceMode: entry.serviceMode === true,
818
+ scriptPath
819
+ };
820
+ }
821
+ function stopRunningProcess() {
822
+ const state = readServiceState();
823
+ if (!state)
824
+ return;
825
+ execIgnoreFailure(process.platform === "win32" ? "taskkill" : "kill", process.platform === "win32" ? ["/PID", String(state.pid), "/T", "/F"] : ["-TERM", String(state.pid)]);
826
+ clearServiceState(state.pid);
827
+ }
828
+ function listPosixRuntimePids(scriptPath) {
829
+ if (!scriptPath || process.platform === "win32")
830
+ return [];
831
+ try {
832
+ const output = execFileSync("ps", ["-ax", "-o", "pid=,args="], { encoding: "utf8" });
833
+ return output.split("\n").map((line) => line.trim()).filter(Boolean).flatMap((line) => {
834
+ const match = line.match(/^(\d+)\s+(.*)$/);
835
+ if (!match)
836
+ return [];
837
+ const pid = Number(match[1]);
838
+ const command = match[2];
839
+ if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid)
840
+ return [];
841
+ if (!command.includes(scriptPath))
842
+ return [];
843
+ if (!/\brun\b/.test(command))
844
+ return [];
845
+ return [pid];
846
+ });
847
+ } catch {
848
+ return [];
849
+ }
850
+ }
851
+ function isPidRunning(pid) {
852
+ try {
853
+ process.kill(pid, 0);
854
+ return true;
855
+ } catch {
856
+ return false;
857
+ }
858
+ }
859
+ function waitForPidExit(pid, timeoutMs) {
860
+ const deadline = Date.now() + timeoutMs;
861
+ const sleepBuf = new Int32Array(new SharedArrayBuffer(4));
862
+ while (isPidRunning(pid)) {
863
+ if (Date.now() >= deadline)
864
+ return false;
865
+ Atomics.wait(sleepBuf, 0, 0, 50);
866
+ }
867
+ return true;
868
+ }
869
+ function startDetachedWindowsService(programArgs) {
870
+ const outFd = openSync(SERVICE_LOG_PATH, "a");
871
+ const errFd = openSync(SERVICE_ERROR_LOG_PATH, "a");
872
+ try {
873
+ const [command, ...args] = programArgs;
874
+ const child = spawn(command, args, {
875
+ detached: true,
876
+ stdio: ["ignore", outFd, errFd],
877
+ windowsHide: true
878
+ });
879
+ child.unref();
880
+ } finally {
881
+ closeSync(outFd);
882
+ closeSync(errFd);
883
+ }
884
+ }
885
+ function startDetachedPosixService(programArgs) {
886
+ const outFd = openSync(SERVICE_LOG_PATH, "a");
887
+ const errFd = openSync(SERVICE_ERROR_LOG_PATH, "a");
888
+ try {
889
+ const [command, ...args] = programArgs;
890
+ const child = spawn(command, args, {
891
+ detached: true,
892
+ stdio: ["ignore", outFd, errFd]
893
+ });
894
+ child.unref();
895
+ } finally {
896
+ closeSync(outFd);
897
+ closeSync(errFd);
898
+ }
899
+ }
900
+ async function waitForRuntimeState(timeoutMs = 1500, pollMs = 50) {
901
+ const deadline = Date.now() + timeoutMs;
902
+ let lastStatus = getServiceStatus();
903
+ while (Date.now() < deadline) {
904
+ if (lastStatus.running)
905
+ return lastStatus;
906
+ await delay(pollMs);
907
+ lastStatus = getServiceStatus();
908
+ }
909
+ return lastStatus;
910
+ }
911
+ function installLinuxService(programArgs) {
912
+ try {
913
+ installLinuxSystemdService(programArgs);
914
+ removeLinuxCronRegistration();
915
+ return;
916
+ } catch (error) {
917
+ installLinuxCronService(programArgs, error);
918
+ }
919
+ }
920
+ function restartLinuxService(programArgs) {
921
+ try {
922
+ restartLinuxSystemdService(programArgs);
923
+ removeLinuxCronRegistration();
924
+ return;
925
+ } catch (error) {
926
+ installLinuxCronService(programArgs, error);
927
+ }
928
+ }
929
+ function installLinuxSystemdService(programArgs) {
930
+ if (!commandExists("systemctl")) {
931
+ throw new Error("systemctl is not available");
932
+ }
933
+ mkdirSync2(dirname(LINUX_SERVICE_PATH), { recursive: true });
934
+ writeFileSync2(LINUX_SERVICE_PATH, buildLinuxSystemdUnit(programArgs, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH), "utf8");
935
+ execFileSync("systemctl", ["--user", "daemon-reload"], { stdio: "ignore" });
936
+ execFileSync("systemctl", ["--user", "enable", "--now", SYSTEMD_UNIT_NAME], { stdio: "ignore" });
937
+ }
938
+ function restartLinuxSystemdService(programArgs) {
939
+ if (!commandExists("systemctl")) {
940
+ throw new Error("systemctl is not available");
941
+ }
942
+ if (!existsSync2(LINUX_SERVICE_PATH)) {
943
+ installLinuxSystemdService(programArgs);
944
+ return;
945
+ }
946
+ writeFileSync2(LINUX_SERVICE_PATH, buildLinuxSystemdUnit(programArgs, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH), "utf8");
947
+ execFileSync("systemctl", ["--user", "daemon-reload"], { stdio: "ignore" });
948
+ execFileSync("systemctl", ["--user", "restart", SYSTEMD_UNIT_NAME], { stdio: "ignore" });
949
+ }
950
+ function installLinuxCronService(programArgs, systemdError) {
951
+ if (!commandExists("crontab")) {
952
+ throw new Error(`Linux service installation failed and no crontab fallback is available: ${formatError(systemdError)}`);
953
+ }
954
+ rmIfExists(LINUX_SERVICE_PATH);
955
+ const entry = buildLinuxCronEntry(programArgs, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH);
956
+ writeLinuxCrontabEntry(entry);
957
+ writeFileSync2(LINUX_CRON_RECORD_PATH, entry + "\n", "utf8");
958
+ stopRunningProcess();
959
+ startDetachedPosixService(programArgs);
960
+ }
961
+ function hasLinuxCronRegistration() {
962
+ if (process.platform !== "linux")
963
+ return false;
964
+ return readLinuxCrontab().some((line) => line.includes(LINUX_CRON_MARKER));
965
+ }
966
+ function removeLinuxCronRegistration() {
967
+ if (process.platform !== "linux")
968
+ return;
969
+ if (commandExists("crontab")) {
970
+ const filtered = readLinuxCrontab().filter((line) => !line.includes(LINUX_CRON_MARKER));
971
+ writeLinuxCrontab(filtered);
972
+ }
973
+ rmIfExists(LINUX_CRON_RECORD_PATH);
974
+ }
975
+ function writeLinuxCrontabEntry(entry) {
976
+ const filtered = readLinuxCrontab().filter((line) => !line.includes(LINUX_CRON_MARKER));
977
+ filtered.push(entry);
978
+ writeLinuxCrontab(filtered);
979
+ }
980
+ function readLinuxCrontab() {
981
+ if (!commandExists("crontab"))
982
+ return [];
983
+ try {
984
+ const output = execFileSync("crontab", ["-l"], { encoding: "utf8" });
985
+ return output.split("\n").map((line) => line.trimEnd()).filter((line) => line.length > 0);
986
+ } catch (error) {
987
+ if (isMissingCrontabError(error)) {
988
+ return [];
989
+ }
990
+ throw error;
991
+ }
992
+ }
993
+ function writeLinuxCrontab(lines) {
994
+ if (!commandExists("crontab"))
995
+ return;
996
+ if (lines.length === 0) {
997
+ execIgnoreFailure("crontab", ["-r"]);
998
+ return;
999
+ }
1000
+ execFileSync("crontab", ["-"], {
1001
+ input: `${lines.join("\n")}
1002
+ `,
1003
+ encoding: "utf8",
1004
+ stdio: ["pipe", "ignore", "ignore"]
1005
+ });
1006
+ }
1007
+ function resolveScriptPath(scriptPath) {
1008
+ const value = scriptPath?.trim() || process.argv[1]?.trim() || "";
1009
+ if (!value)
1010
+ return "";
1011
+ try {
1012
+ return realpathSync(value);
1013
+ } catch {
1014
+ return value;
1015
+ }
1016
+ }
1017
+ function ensureLaunchScriptExecutable(scriptPath, platform) {
1018
+ if (platform === "win32" || !existsSync2(scriptPath))
1019
+ return;
1020
+ try {
1021
+ chmodSync2(scriptPath, 493);
1022
+ } catch {
1023
+ }
1024
+ }
1025
+ function writeServiceLauncher(input) {
1026
+ ensureServiceDirs();
1027
+ const lines = [
1028
+ "#!/bin/sh",
1029
+ `export PATH="${escapeShellDoubleQuoted(input.pathEnv)}"`,
1030
+ `NODE_PATH="${escapeShellDoubleQuoted(input.nodePath)}"`,
1031
+ `SCRIPT_PATH="${escapeShellDoubleQuoted(input.scriptPath)}"`,
1032
+ 'if [ -x "$NODE_PATH" ]; then',
1033
+ ' exec "$NODE_PATH" "$SCRIPT_PATH" run --service',
1034
+ "fi",
1035
+ "if command -v node >/dev/null 2>&1; then",
1036
+ ' exec node "$SCRIPT_PATH" run --service',
1037
+ "fi",
1038
+ 'echo "node runtime not found for Clawket Bridge service" >&2',
1039
+ "exit 127",
1040
+ ""
1041
+ ];
1042
+ writeFileSync2(SERVICE_LAUNCHER_PATH, lines.join("\n"), "utf8");
1043
+ return SERVICE_LAUNCHER_PATH;
1044
+ }
1045
+ function escapeShellDoubleQuoted(value) {
1046
+ return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("$", "\\$").replaceAll("`", "\\`");
1047
+ }
1048
+ function escapeShellWord(value) {
1049
+ if (value.length === 0)
1050
+ return "''";
1051
+ return `'${value.replaceAll("'", `'"'"'`)}'`;
1052
+ }
1053
+ function buildWindowsRunCommand(programArgs) {
1054
+ return programArgs.map(escapeWindowsArg).join(" ");
1055
+ }
1056
+ function ensureServiceDirs() {
1057
+ mkdirSync2(SERVICE_DIR, { recursive: true });
1058
+ mkdirSync2(LOG_DIR, { recursive: true });
1059
+ }
1060
+ function escapeXml(value) {
1061
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
1062
+ }
1063
+ function escapeSystemdArg(value) {
1064
+ return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
1065
+ }
1066
+ function escapeWindowsArg(value) {
1067
+ return `"${value.replaceAll('"', '\\"')}"`;
1068
+ }
1069
+ function commandSucceeds(command, args) {
1070
+ try {
1071
+ execFileSync(command, args, { stdio: "ignore" });
1072
+ return true;
1073
+ } catch {
1074
+ return false;
1075
+ }
1076
+ }
1077
+ function commandExists(command) {
1078
+ if (process.platform === "win32") {
1079
+ return commandSucceeds("where", [command]);
1080
+ }
1081
+ return commandSucceeds("sh", ["-c", `command -v ${escapeShellWord(command)}`]);
1082
+ }
1083
+ function execIgnoreFailure(command, args) {
1084
+ try {
1085
+ execFileSync(command, args, { stdio: "ignore" });
1086
+ } catch {
1087
+ }
1088
+ }
1089
+ function rmIfExists(path) {
1090
+ if (!existsSync2(path))
1091
+ return;
1092
+ rmSync2(path, { force: true });
1093
+ }
1094
+ function isMissingCrontabError(error) {
1095
+ if (!(error instanceof Error))
1096
+ return false;
1097
+ const message = error.message.toLowerCase();
1098
+ const stderrValue = error.stderr;
1099
+ const stderr = typeof stderrValue === "string" ? stderrValue.toLowerCase() : Buffer.isBuffer(stderrValue) ? stderrValue.toString("utf8").toLowerCase() : "";
1100
+ return message.includes("no crontab for") || stderr.includes("no crontab for");
1101
+ }
1102
+ function formatError(error) {
1103
+ if (error instanceof Error && error.message) {
1104
+ return error.message;
1105
+ }
1106
+ return String(error);
1107
+ }
1108
+
1109
+ // ../../packages/bridge-runtime/dist/openclaw.js
1110
+ import { execFile } from "child_process";
1111
+ import { randomBytes } from "crypto";
1112
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
1113
+ import { chmod, mkdir, readFile, rename, rm, writeFile } from "fs/promises";
1114
+ import { homedir as homedir3 } from "os";
1115
+ import { dirname as dirname2, join as join3, resolve } from "path";
1116
+ var DEFAULT_GATEWAY_URL = "ws://127.0.0.1:18789";
1117
+ var DEVICE_BOOTSTRAP_TOKEN_TTL_MS = 10 * 60 * 1e3;
1118
+ var BOOTSTRAP_FILENAME = "bootstrap.json";
1119
+ var PAIRING_TOKEN_BYTES = 32;
1120
+ var OPENCLAW_CLI_COMMAND = "openclaw";
1121
+ var withBootstrapLock = createAsyncLock();
1122
+ function resolveGatewayUrl(explicitUrl) {
1123
+ const trimmed = explicitUrl?.trim();
1124
+ if (trimmed)
1125
+ return trimmed;
1126
+ const info = readOpenClawInfo();
1127
+ if (typeof info.gatewayPort === "number") {
1128
+ return `ws://127.0.0.1:${info.gatewayPort}`;
1129
+ }
1130
+ return DEFAULT_GATEWAY_URL;
1131
+ }
1132
+ function readOpenClawInfo() {
1133
+ const openclaw = resolveOpenClawPaths();
1134
+ if (!existsSync3(openclaw.configPath)) {
1135
+ return {
1136
+ configFound: false,
1137
+ gatewayPort: null,
1138
+ authMode: null,
1139
+ token: readGatewayTokenEnv(),
1140
+ password: readGatewayPasswordEnv()
1141
+ };
1142
+ }
1143
+ try {
1144
+ const parsed = JSON.parse(readFileSync3(openclaw.configPath, "utf8"));
1145
+ const rawPort = parsed.gateway?.port;
1146
+ const gatewayPort = typeof rawPort === "number" && Number.isInteger(rawPort) ? rawPort : null;
1147
+ const authMode = parsed.gateway?.auth?.mode === "token" || parsed.gateway?.auth?.mode === "password" ? parsed.gateway.auth.mode : null;
1148
+ const token = readConfiguredSecret(parsed.gateway?.auth?.token) ?? readGatewayTokenEnv();
1149
+ const password = readConfiguredSecret(parsed.gateway?.auth?.password) ?? readGatewayPasswordEnv();
1150
+ return {
1151
+ configFound: true,
1152
+ gatewayPort,
1153
+ authMode,
1154
+ token,
1155
+ password
1156
+ };
1157
+ } catch {
1158
+ return {
1159
+ configFound: true,
1160
+ gatewayPort: null,
1161
+ authMode: null,
1162
+ token: readGatewayTokenEnv(),
1163
+ password: readGatewayPasswordEnv()
1164
+ };
1165
+ }
1166
+ }
1167
+ function resolveGatewayAuth() {
1168
+ const info = readOpenClawInfo();
1169
+ const token = info.token;
1170
+ const password = info.password;
1171
+ if (token && password && info.authMode == null) {
1172
+ return {
1173
+ token,
1174
+ password,
1175
+ label: "token",
1176
+ error: "OpenClaw has both gateway token and password configured, but gateway.auth.mode is unset. Set the mode to token or password before pairing."
1177
+ };
1178
+ }
1179
+ if (info.authMode === "password") {
1180
+ return password ? { token: null, password, label: "password" } : { token: null, password: null, label: null };
1181
+ }
1182
+ if (info.authMode === "token") {
1183
+ return token ? { token, password: null, label: "token" } : { token: null, password: null, label: null };
1184
+ }
1185
+ if (token) {
1186
+ return { token, password: null, label: "token" };
1187
+ }
1188
+ if (password) {
1189
+ return { token: null, password, label: "password" };
1190
+ }
1191
+ return { token: null, password: null, label: null };
1192
+ }
1193
+ function getOpenClawConfigDir() {
1194
+ return resolveOpenClawPaths().configDir;
1195
+ }
1196
+ function getOpenClawStateDir() {
1197
+ return resolveOpenClawPaths().stateDir;
1198
+ }
1199
+ function getOpenClawMediaDir() {
1200
+ return resolveOpenClawPaths().mediaDir;
1201
+ }
1202
+ async function configureOpenClawLanAccess(params) {
1203
+ const openclaw = resolveOpenClawPaths();
1204
+ if (!existsSync3(openclaw.configPath)) {
1205
+ throw new Error(`OpenClaw config was not found at ${openclaw.configPath}. Run OpenClaw setup first, then retry local pairing.`);
1206
+ }
1207
+ const controlUiOrigin = normalizeControlUiOrigin(params.controlUiOrigin);
1208
+ const currentBind = await readOpenClawConfigString("gateway.bind", openclaw);
1209
+ const currentAllowedOrigins = await readOpenClawAllowedOrigins(openclaw);
1210
+ let bindChanged = false;
1211
+ if (currentBind !== "lan") {
1212
+ await runOpenClawCli(["config", "set", "gateway.bind", "lan"], openclaw);
1213
+ bindChanged = true;
1214
+ }
1215
+ const allowedOrigins = appendUniqueOrigin(currentAllowedOrigins, controlUiOrigin);
1216
+ const allowedOriginAdded = allowedOrigins.length !== currentAllowedOrigins.length;
1217
+ if (allowedOriginAdded) {
1218
+ await runOpenClawCli([
1219
+ "config",
1220
+ "set",
1221
+ "gateway.controlUi.allowedOrigins",
1222
+ JSON.stringify(allowedOrigins),
1223
+ "--strict-json"
1224
+ ], openclaw);
1225
+ }
1226
+ return {
1227
+ configPath: openclaw.configPath,
1228
+ bindChanged,
1229
+ allowedOriginAdded,
1230
+ allowedOrigins,
1231
+ controlUiOrigin
1232
+ };
1233
+ }
1234
+ async function restartOpenClawGateway() {
1235
+ const openclaw = resolveOpenClawPaths();
1236
+ const restart = await runOpenClawDaemonCommand(["gateway", "restart", "--json"], openclaw);
1237
+ if (restart.result === "not-loaded") {
1238
+ const start = await runOpenClawDaemonCommand(["gateway", "start", "--json"], openclaw);
1239
+ if (start.result === "not-loaded") {
1240
+ throw new Error(buildGatewayNotLoadedMessage(start));
1241
+ }
1242
+ return {
1243
+ action: "started",
1244
+ result: start.result ?? "started",
1245
+ message: start.message,
1246
+ warnings: start.warnings
1247
+ };
1248
+ }
1249
+ return {
1250
+ action: "restarted",
1251
+ result: restart.result ?? "restarted",
1252
+ message: restart.message,
1253
+ warnings: restart.warnings
1254
+ };
1255
+ }
1256
+ function getOpenClawBootstrapPath(stateDir = getOpenClawStateDir()) {
1257
+ return join3(stateDir, "devices", BOOTSTRAP_FILENAME);
1258
+ }
1259
+ async function issueOpenClawBootstrapToken(params) {
1260
+ const deviceId = params.deviceId.trim();
1261
+ const publicKey = params.publicKey.trim();
1262
+ const role = params.role.trim();
1263
+ const scopes = normalizeStringArray(params.scopes);
1264
+ if (!deviceId || !publicKey || !role || scopes.length === 0) {
1265
+ throw new Error("deviceId, publicKey, role, and scopes are required");
1266
+ }
1267
+ return await withBootstrapLock(async () => {
1268
+ const stateDir = params.stateDir ?? getOpenClawStateDir();
1269
+ const statePath = getOpenClawBootstrapPath(stateDir);
1270
+ const state = await loadBootstrapState(statePath);
1271
+ const token = generatePairingToken();
1272
+ const issuedAtMs = Date.now();
1273
+ state[token] = {
1274
+ token,
1275
+ ts: issuedAtMs,
1276
+ deviceId,
1277
+ publicKey,
1278
+ roles: [role],
1279
+ scopes,
1280
+ issuedAtMs
1281
+ };
1282
+ await writeJsonAtomic(statePath, state);
1283
+ return {
1284
+ token,
1285
+ expiresAtMs: issuedAtMs + DEVICE_BOOTSTRAP_TOKEN_TTL_MS,
1286
+ statePath
1287
+ };
1288
+ });
1289
+ }
1290
+ function readConfiguredSecret(value) {
1291
+ return typeof value === "string" && value.trim() ? value.trim() : null;
1292
+ }
1293
+ async function readOpenClawConfigString(configPath, openclaw = resolveOpenClawPaths()) {
1294
+ try {
1295
+ const { stdout } = await runOpenClawCli(["config", "get", configPath], openclaw);
1296
+ const trimmed = stdout.trim();
1297
+ return trimmed || null;
1298
+ } catch (error) {
1299
+ if (isMissingConfigPathError(error)) {
1300
+ return null;
1301
+ }
1302
+ throw error;
1303
+ }
1304
+ }
1305
+ async function readOpenClawAllowedOrigins(openclaw = resolveOpenClawPaths()) {
1306
+ try {
1307
+ const { stdout } = await runOpenClawCli(["config", "get", "gateway.controlUi.allowedOrigins", "--json"], openclaw);
1308
+ const parsed = parseEmbeddedJsonValue(stdout);
1309
+ return Array.isArray(parsed) ? parsed.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : [];
1310
+ } catch (error) {
1311
+ if (isMissingConfigPathError(error)) {
1312
+ return [];
1313
+ }
1314
+ throw error;
1315
+ }
1316
+ }
1317
+ async function runOpenClawDaemonCommand(args, openclaw = resolveOpenClawPaths()) {
1318
+ const { stdout } = await runOpenClawCli(args, openclaw);
1319
+ let parsed;
1320
+ try {
1321
+ parsed = parseEmbeddedJsonValue(stdout);
1322
+ } catch (error) {
1323
+ throw new Error(`OpenClaw ${args.slice(0, 2).join(" ")} returned invalid JSON output.`, { cause: error });
1324
+ }
1325
+ if (parsed.ok !== true) {
1326
+ throw new Error(parsed.error?.trim() || `OpenClaw ${args.slice(0, 2).join(" ")} failed.`);
1327
+ }
1328
+ return {
1329
+ result: typeof parsed.result === "string" ? parsed.result : void 0,
1330
+ message: typeof parsed.message === "string" ? parsed.message : null,
1331
+ warnings: Array.isArray(parsed.warnings) ? parsed.warnings.filter((value) => typeof value === "string") : [],
1332
+ hints: Array.isArray(parsed.hints) ? parsed.hints.filter((value) => typeof value === "string") : []
1333
+ };
1334
+ }
1335
+ async function runOpenClawCli(args, openclaw = resolveOpenClawPaths()) {
1336
+ try {
1337
+ return await new Promise((resolvePromise, rejectPromise) => {
1338
+ execFile(OPENCLAW_CLI_COMMAND, args, {
1339
+ encoding: "utf8",
1340
+ env: {
1341
+ ...process.env,
1342
+ OPENCLAW_STATE_DIR: openclaw.stateDir,
1343
+ OPENCLAW_CONFIG_PATH: openclaw.configPath
1344
+ },
1345
+ maxBuffer: 1024 * 1024
1346
+ }, (error, stdout, stderr) => {
1347
+ if (error) {
1348
+ Object.assign(error, {
1349
+ stdout,
1350
+ stderr
1351
+ });
1352
+ rejectPromise(error);
1353
+ return;
1354
+ }
1355
+ resolvePromise({ stdout, stderr });
1356
+ });
1357
+ });
1358
+ } catch (error) {
1359
+ throw formatOpenClawCliError(args, error);
1360
+ }
1361
+ }
1362
+ function formatOpenClawCliError(args, error) {
1363
+ const messagePrefix = `OpenClaw ${args.join(" ")}`;
1364
+ if (isExecFileError(error)) {
1365
+ if (error.code === "ENOENT") {
1366
+ return new Error(`OpenClaw CLI was not found on PATH. Install OpenClaw and ensure \`${OPENCLAW_CLI_COMMAND}\` is available before running local pairing.`);
1367
+ }
1368
+ const combined = [error.stderr, error.stdout].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
1369
+ return new Error(combined ? `${messagePrefix} failed: ${combined}` : `${messagePrefix} failed.`);
1370
+ }
1371
+ return error instanceof Error ? error : new Error(`${messagePrefix} failed: ${String(error)}`);
1372
+ }
1373
+ function isMissingConfigPathError(error) {
1374
+ return error instanceof Error && /Config path not found:/i.test(error.message);
1375
+ }
1376
+ function isExecFileError(error) {
1377
+ return error instanceof Error;
1378
+ }
1379
+ function normalizeControlUiOrigin(origin) {
1380
+ const parsed = new URL(origin.trim());
1381
+ return parsed.origin;
1382
+ }
1383
+ function appendUniqueOrigin(currentOrigins, nextOrigin) {
1384
+ const normalizedNext = normalizeControlUiOrigin(nextOrigin).toLowerCase();
1385
+ const seen = /* @__PURE__ */ new Set();
1386
+ const seenInvalid = /* @__PURE__ */ new Set();
1387
+ const result = [];
1388
+ for (const origin of currentOrigins) {
1389
+ const trimmed = origin.trim();
1390
+ if (!trimmed) {
1391
+ continue;
1392
+ }
1393
+ let normalized;
1394
+ try {
1395
+ normalized = normalizeControlUiOrigin(trimmed).toLowerCase();
1396
+ } catch {
1397
+ const invalidKey = trimmed.toLowerCase();
1398
+ if (seenInvalid.has(invalidKey)) {
1399
+ continue;
1400
+ }
1401
+ seenInvalid.add(invalidKey);
1402
+ result.push(trimmed);
1403
+ continue;
1404
+ }
1405
+ if (seen.has(normalized)) {
1406
+ continue;
1407
+ }
1408
+ seen.add(normalized);
1409
+ result.push(normalized === normalizedNext ? normalizeControlUiOrigin(nextOrigin) : normalizeControlUiOrigin(trimmed));
1410
+ }
1411
+ if (!seen.has(normalizedNext)) {
1412
+ result.push(normalizeControlUiOrigin(nextOrigin));
1413
+ }
1414
+ return result;
1415
+ }
1416
+ function buildGatewayNotLoadedMessage(result) {
1417
+ const parts = [
1418
+ "OpenClaw Gateway is not running under a managed service, and no unmanaged gateway process could be restarted automatically."
1419
+ ];
1420
+ if (result.message) {
1421
+ parts.push(result.message);
1422
+ }
1423
+ if (result.hints.length > 0) {
1424
+ parts.push(result.hints.join(" "));
1425
+ }
1426
+ parts.push("Start the Gateway first, then rerun `clawket pair --local`.");
1427
+ return parts.join(" ");
1428
+ }
1429
+ function parseEmbeddedJsonValue(text) {
1430
+ const trimmed = text.trim();
1431
+ if (!trimmed) {
1432
+ throw new Error("Empty JSON output");
1433
+ }
1434
+ try {
1435
+ return JSON.parse(trimmed);
1436
+ } catch {
1437
+ }
1438
+ for (let index = 0; index < trimmed.length; index += 1) {
1439
+ const char = trimmed[index];
1440
+ if (char !== "{" && char !== "[") {
1441
+ continue;
1442
+ }
1443
+ const candidate = extractBalancedJsonValue(trimmed, index);
1444
+ if (!candidate) {
1445
+ continue;
1446
+ }
1447
+ try {
1448
+ return JSON.parse(candidate);
1449
+ } catch {
1450
+ }
1451
+ }
1452
+ throw new Error("Unable to locate a JSON value in command output.");
1453
+ }
1454
+ function extractBalancedJsonValue(text, startIndex) {
1455
+ let depth = 0;
1456
+ let inString = false;
1457
+ let escaping = false;
1458
+ for (let index = startIndex; index < text.length; index += 1) {
1459
+ const char = text[index];
1460
+ if (inString) {
1461
+ if (escaping) {
1462
+ escaping = false;
1463
+ continue;
1464
+ }
1465
+ if (char === "\\") {
1466
+ escaping = true;
1467
+ continue;
1468
+ }
1469
+ if (char === '"') {
1470
+ inString = false;
1471
+ }
1472
+ continue;
1473
+ }
1474
+ if (char === '"') {
1475
+ inString = true;
1476
+ continue;
1477
+ }
1478
+ if (char === "{" || char === "[") {
1479
+ depth += 1;
1480
+ continue;
1481
+ }
1482
+ if (char === "}" || char === "]") {
1483
+ depth -= 1;
1484
+ if (depth === 0) {
1485
+ return text.slice(startIndex, index + 1);
1486
+ }
1487
+ if (depth < 0) {
1488
+ return null;
1489
+ }
1490
+ }
1491
+ }
1492
+ return null;
1493
+ }
1494
+ function readGatewayTokenEnv() {
1495
+ return readEnvValue("OPENCLAW_GATEWAY_TOKEN", "CLAWDBOT_GATEWAY_TOKEN");
1496
+ }
1497
+ function readGatewayPasswordEnv() {
1498
+ return readEnvValue("OPENCLAW_GATEWAY_PASSWORD", "CLAWDBOT_GATEWAY_PASSWORD");
1499
+ }
1500
+ function readEnvValue(primary, legacy) {
1501
+ const current = process.env[primary]?.trim();
1502
+ if (current)
1503
+ return current;
1504
+ const fallback = process.env[legacy]?.trim();
1505
+ return fallback || null;
1506
+ }
1507
+ function resolveOpenClawPaths() {
1508
+ const stateDir = resolveActiveOpenClawStateDir();
1509
+ const configPath = resolveActiveOpenClawConfigPath(stateDir);
1510
+ return {
1511
+ stateDir,
1512
+ configDir: dirname2(configPath),
1513
+ configPath,
1514
+ mediaDir: join3(stateDir, "media")
1515
+ };
1516
+ }
1517
+ function resolveActiveOpenClawStateDir() {
1518
+ const explicitStateDir = readEnvValue("OPENCLAW_STATE_DIR", "CLAWDBOT_STATE_DIR");
1519
+ if (explicitStateDir) {
1520
+ return resolveUserPath(explicitStateDir);
1521
+ }
1522
+ const candidates = buildOpenClawStateDirCandidates();
1523
+ const existing = candidates.find((stateDir) => existsSync3(join3(stateDir, "openclaw.json")));
1524
+ return existing ?? candidates[0] ?? join3(homedir3(), ".openclaw");
1525
+ }
1526
+ function resolveActiveOpenClawConfigPath(stateDir) {
1527
+ const explicitConfigPath = readEnvValue("OPENCLAW_CONFIG_PATH", "CLAWDBOT_CONFIG_PATH");
1528
+ if (explicitConfigPath) {
1529
+ return resolveUserPath(explicitConfigPath);
1530
+ }
1531
+ return join3(stateDir, "openclaw.json");
1532
+ }
1533
+ function buildOpenClawStateDirCandidates() {
1534
+ const seen = /* @__PURE__ */ new Set();
1535
+ return [homedir3(), "/root"].map((value) => value.trim()).filter(Boolean).map((home) => join3(home, ".openclaw")).filter((value) => {
1536
+ if (seen.has(value))
1537
+ return false;
1538
+ seen.add(value);
1539
+ return true;
1540
+ });
1541
+ }
1542
+ function resolveUserPath(input) {
1543
+ const trimmed = input.trim();
1544
+ if (!trimmed)
1545
+ return trimmed;
1546
+ if (trimmed === "~") {
1547
+ return resolve(homedir3());
1548
+ }
1549
+ if (trimmed.startsWith("~/")) {
1550
+ return resolve(join3(homedir3(), trimmed.slice(2)));
1551
+ }
1552
+ return resolve(trimmed);
1553
+ }
1554
+ async function loadBootstrapState(statePath) {
1555
+ const state = await readJsonFile(statePath) ?? {};
1556
+ const now = Date.now();
1557
+ for (const [token, entry] of Object.entries(state)) {
1558
+ if (!entry || typeof entry !== "object") {
1559
+ delete state[token];
1560
+ continue;
1561
+ }
1562
+ if (typeof entry.ts !== "number" && typeof entry.issuedAtMs === "number") {
1563
+ entry.ts = entry.issuedAtMs;
1564
+ }
1565
+ if (now - entry.ts > DEVICE_BOOTSTRAP_TOKEN_TTL_MS) {
1566
+ delete state[token];
1567
+ }
1568
+ }
1569
+ return state;
1570
+ }
1571
+ async function readJsonFile(filePath) {
1572
+ try {
1573
+ return JSON.parse(await readFile(filePath, "utf8"));
1574
+ } catch {
1575
+ return null;
1576
+ }
1577
+ }
1578
+ async function writeJsonAtomic(filePath, value) {
1579
+ const payload = JSON.stringify(value, null, 2);
1580
+ await mkdir(dirname2(filePath), { recursive: true, mode: 448 });
1581
+ const tmpPath = `${filePath}.${randomUUIDFragment()}.tmp`;
1582
+ try {
1583
+ await writeFile(tmpPath, payload, { encoding: "utf8", mode: 384 });
1584
+ await safeChmod(tmpPath, 384);
1585
+ await rename(tmpPath, filePath);
1586
+ await safeChmod(filePath, 384);
1587
+ } finally {
1588
+ await rm(tmpPath, { force: true }).catch(() => void 0);
1589
+ }
1590
+ }
1591
+ async function safeChmod(filePath, mode) {
1592
+ try {
1593
+ await chmod(filePath, mode);
1594
+ } catch {
1595
+ }
1596
+ }
1597
+ function generatePairingToken() {
1598
+ return randomBytes(PAIRING_TOKEN_BYTES).toString("base64url");
1599
+ }
1600
+ function normalizeStringArray(values) {
1601
+ const normalized = /* @__PURE__ */ new Set();
1602
+ for (const value of values) {
1603
+ const trimmed = typeof value === "string" ? value.trim() : "";
1604
+ if (trimmed) {
1605
+ normalized.add(trimmed);
1606
+ }
1607
+ }
1608
+ return [...normalized].sort();
1609
+ }
1610
+ function randomUUIDFragment() {
1611
+ return randomBytes(12).toString("hex");
1612
+ }
1613
+ function createAsyncLock() {
1614
+ let lock = Promise.resolve();
1615
+ return async function withLock(fn) {
1616
+ const prev = lock;
1617
+ let release;
1618
+ lock = new Promise((resolveLock) => {
1619
+ release = resolveLock;
1620
+ });
1621
+ await prev;
1622
+ try {
1623
+ return await fn();
1624
+ } finally {
1625
+ release?.();
1626
+ }
1627
+ };
1628
+ }
1629
+
1630
+ // ../../packages/bridge-runtime/dist/protocol.js
1631
+ var CONTROL_PREFIX = "__clawket_relay_control__:";
1632
+ function parseControl(text) {
1633
+ if (!text.startsWith(CONTROL_PREFIX))
1634
+ return null;
1635
+ try {
1636
+ const parsed = JSON.parse(text.slice(CONTROL_PREFIX.length));
1637
+ if (typeof parsed.event !== "string" || !parsed.event.trim())
1638
+ return null;
1639
+ const payload = isRecord(parsed.payload) ? parsed.payload : void 0;
1640
+ const countCandidate = typeof parsed.count === "number" && Number.isFinite(parsed.count) ? parsed.count : typeof payload?.count === "number" && Number.isFinite(payload.count) ? payload.count : void 0;
1641
+ return {
1642
+ event: parsed.event.trim(),
1643
+ requestId: readOptionalString(parsed.requestId),
1644
+ payload,
1645
+ sourceClientId: readOptionalString(parsed.sourceClientId),
1646
+ targetClientId: readOptionalString(parsed.targetClientId),
1647
+ count: countCandidate
1648
+ };
1649
+ } catch {
1650
+ return null;
1651
+ }
1652
+ }
1653
+ function parseConnectStartIdentity(text) {
1654
+ try {
1655
+ const parsed = JSON.parse(text);
1656
+ if (parsed.type !== "req")
1657
+ return null;
1658
+ if (parsed.method !== "connect" && parsed.method !== "connect.start")
1659
+ return null;
1660
+ const params = parsed.params ?? {};
1661
+ const id = typeof parsed.id === "string" && parsed.id.trim() ? parsed.id.trim() : `req-${Math.random().toString(36).slice(2, 12)}`;
1662
+ const label = firstString(params.deviceName, params.clientName, params.deviceId, "Mobile Client");
1663
+ return { id, label };
1664
+ } catch {
1665
+ return null;
1666
+ }
1667
+ }
1668
+ function isConnectHandshakeRequest(text) {
1669
+ try {
1670
+ const parsed = JSON.parse(text);
1671
+ return parsed.type === "req" && (parsed.method === "connect" || parsed.method === "connect.start");
1672
+ } catch {
1673
+ return false;
1674
+ }
1675
+ }
1676
+ function parseConnectHandshakeMeta(text) {
1677
+ try {
1678
+ const parsed = JSON.parse(text);
1679
+ if (parsed.type !== "req")
1680
+ return null;
1681
+ if (parsed.method !== "connect" && parsed.method !== "connect.start")
1682
+ return null;
1683
+ const nonce = parsed.params?.device?.nonce;
1684
+ const auth = parsed.params?.auth;
1685
+ return {
1686
+ id: typeof parsed.id === "string" && parsed.id.trim() ? parsed.id.trim() : null,
1687
+ method: parsed.method,
1688
+ noncePresent: typeof nonce === "string" && nonce.length > 0,
1689
+ nonceLength: typeof nonce === "string" ? nonce.length : null,
1690
+ authFields: auth && typeof auth === "object" ? Object.keys(auth).sort() : []
1691
+ };
1692
+ } catch {
1693
+ return null;
1694
+ }
1695
+ }
1696
+ function parsePairingRequestFromError(text, nowMs = Date.now()) {
1697
+ try {
1698
+ const parsed = JSON.parse(text);
1699
+ if (parsed.type !== "res" || parsed.ok !== false || !parsed.error)
1700
+ return null;
1701
+ const code = typeof parsed.error.code === "string" ? parsed.error.code : "";
1702
+ const message = typeof parsed.error.message === "string" ? parsed.error.message : "";
1703
+ if (!code.includes("NOT_PAIRED") && !code.includes("PAIRING_REQUIRED") && !message.includes("NOT_PAIRED") && !message.includes("pairing required")) {
1704
+ return null;
1705
+ }
1706
+ const details = parsed.error.details ?? parsed.error.data ?? {};
1707
+ const requestId = firstString(details.requestId, extractRequestIdFromMessage(message), "unknown");
1708
+ return {
1709
+ requestId,
1710
+ deviceId: firstString(details.deviceId, ""),
1711
+ displayName: firstNullableString(details.displayName),
1712
+ platform: firstNullableString(details.platform),
1713
+ deviceFamily: firstNullableString(details.deviceFamily),
1714
+ role: firstNullableString(details.role),
1715
+ remoteIp: firstNullableString(details.remoteIp),
1716
+ receivedAtMs: nowMs,
1717
+ status: "pending"
1718
+ };
1719
+ } catch {
1720
+ return null;
1721
+ }
1722
+ }
1723
+ function parsePairResolvedEvent(text) {
1724
+ try {
1725
+ const parsed = JSON.parse(text);
1726
+ if (parsed.type !== "event" || parsed.event !== "device.pair.resolved" || !parsed.payload)
1727
+ return null;
1728
+ const requestId = typeof parsed.payload.requestId === "string" ? parsed.payload.requestId.trim() : "";
1729
+ if (!requestId)
1730
+ return null;
1731
+ const decisionValue = typeof parsed.payload.decision === "string" ? parsed.payload.decision : "unknown";
1732
+ const decision = decisionValue === "approved" || decisionValue === "rejected" ? decisionValue : "unknown";
1733
+ return { requestId, decision };
1734
+ } catch {
1735
+ return null;
1736
+ }
1737
+ }
1738
+ function parseResponseEnvelopeMeta(text) {
1739
+ try {
1740
+ const parsed = JSON.parse(text);
1741
+ if (parsed.type !== "res")
1742
+ return null;
1743
+ if (typeof parsed.id !== "string" || !parsed.id.trim())
1744
+ return null;
1745
+ return {
1746
+ id: parsed.id.trim(),
1747
+ ok: parsed.ok === true,
1748
+ errorCode: typeof parsed.error?.code === "string" && parsed.error.code.trim() ? parsed.error.code.trim() : null,
1749
+ errorMessage: typeof parsed.error?.message === "string" && parsed.error.message.trim() ? parsed.error.message.trim() : null
1750
+ };
1751
+ } catch {
1752
+ return null;
1753
+ }
1754
+ }
1755
+ function firstString(...values) {
1756
+ for (const value of values) {
1757
+ if (typeof value === "string" && value.trim())
1758
+ return value.trim();
1759
+ }
1760
+ return "";
1761
+ }
1762
+ function firstNullableString(value) {
1763
+ return typeof value === "string" && value.trim() ? value.trim() : null;
1764
+ }
1765
+ function readOptionalString(value) {
1766
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
1767
+ }
1768
+ function isRecord(value) {
1769
+ return typeof value === "object" && value != null && !Array.isArray(value);
1770
+ }
1771
+ function extractRequestIdFromMessage(message) {
1772
+ const matched = message.match(/requestId[:\s]*([a-f0-9-]+)/i);
1773
+ return matched?.[1] ?? null;
1774
+ }
1775
+
1776
+ // ../../packages/bridge-runtime/dist/runtime.js
1777
+ import { randomUUID as randomUUID2 } from "crypto";
1778
+ import { setTimeout as delay2 } from "timers/promises";
1779
+ import WebSocket from "ws";
1780
+ var HEARTBEAT_INTERVAL_MS = 1e4;
1781
+ var HEARTBEAT_TIMEOUT_MS = 35e3;
1782
+ var GATEWAY_RETRY_DELAY_MS = 1200;
1783
+ var RECONNECT_BASE_DELAY_MS = 1e3;
1784
+ var RECONNECT_MAX_DELAY_MS = 15e3;
1785
+ var CONNECT_HANDSHAKE_WARN_DELAY_MS = 8e3;
1786
+ var MAX_PENDING_GATEWAY_MESSAGES = 256;
1787
+ var MAX_DEVICE_DETAILS = 32;
1788
+ var MAX_PENDING_PAIR_REQUESTS = 16;
1789
+ var BridgeRuntime = class {
1790
+ options;
1791
+ relaySocket = null;
1792
+ gatewaySocket = null;
1793
+ relayConnecting = false;
1794
+ gatewayConnecting = false;
1795
+ stopped = true;
1796
+ relayAttempt = 0;
1797
+ lastRelayActivityMs = 0;
1798
+ reconnectTimer = null;
1799
+ gatewayRetryTimer = null;
1800
+ heartbeatTimer = null;
1801
+ pendingGatewayMessages = [];
1802
+ gatewayHandshakeStarted = false;
1803
+ gatewayCloseBoundaryPending = false;
1804
+ clientDemandStartedAtMs = null;
1805
+ gatewayConnectedAtMs = null;
1806
+ inFlightConnectHandshakes = /* @__PURE__ */ new Map();
1807
+ snapshot;
1808
+ constructor(options) {
1809
+ this.options = options;
1810
+ this.snapshot = {
1811
+ running: false,
1812
+ relayConnected: false,
1813
+ gatewayConnected: false,
1814
+ gatewayId: options.config.gatewayId,
1815
+ instanceId: options.config.instanceId,
1816
+ relayUrl: options.config.relayUrl,
1817
+ gatewayUrl: options.gatewayUrl,
1818
+ clientCount: 0,
1819
+ connectedDevices: [],
1820
+ pendingPairRequests: [],
1821
+ lastError: null,
1822
+ lastUpdatedMs: Date.now()
1823
+ };
1824
+ }
1825
+ start() {
1826
+ if (!this.stopped)
1827
+ return;
1828
+ this.stopped = false;
1829
+ this.updateSnapshot({ running: true, gatewayUrl: this.options.gatewayUrl });
1830
+ this.log(`runtime starting gatewayId=${this.options.config.gatewayId} gatewayUrl=${this.options.gatewayUrl}`);
1831
+ void this.connectRelay();
1832
+ }
1833
+ async stop() {
1834
+ if (this.stopped)
1835
+ return;
1836
+ this.stopped = true;
1837
+ this.clearTimers();
1838
+ this.relaySocket?.close();
1839
+ this.gatewaySocket?.close();
1840
+ this.relaySocket = null;
1841
+ this.gatewaySocket = null;
1842
+ this.pendingGatewayMessages = [];
1843
+ this.gatewayHandshakeStarted = false;
1844
+ this.gatewayCloseBoundaryPending = false;
1845
+ this.clientDemandStartedAtMs = null;
1846
+ this.gatewayConnectedAtMs = null;
1847
+ this.inFlightConnectHandshakes.clear();
1848
+ this.relayConnecting = false;
1849
+ this.gatewayConnecting = false;
1850
+ this.updateSnapshot({
1851
+ running: false,
1852
+ relayConnected: false,
1853
+ gatewayConnected: false,
1854
+ clientCount: 0,
1855
+ lastError: null
1856
+ });
1857
+ this.log("runtime stopped");
1858
+ await delay2(25);
1859
+ }
1860
+ async approvePairRequest(requestId) {
1861
+ this.sendGatewayRequest("device.pair.approve", { requestId });
1862
+ this.markPairRequestResolved(requestId, "approved");
1863
+ }
1864
+ async rejectPairRequest(requestId) {
1865
+ this.sendGatewayRequest("device.pair.reject", { requestId });
1866
+ this.markPairRequestResolved(requestId, "rejected");
1867
+ }
1868
+ getSnapshot() {
1869
+ return {
1870
+ ...this.snapshot,
1871
+ connectedDevices: [...this.snapshot.connectedDevices],
1872
+ pendingPairRequests: [...this.snapshot.pendingPairRequests]
1873
+ };
1874
+ }
1875
+ async connectRelay() {
1876
+ if (this.stopped || this.relayConnecting || this.isRelayOpen())
1877
+ return;
1878
+ this.relayConnecting = true;
1879
+ this.relayAttempt += 1;
1880
+ const attempt = this.relayAttempt;
1881
+ const relayUrl = buildRelayWsUrl(this.options.config);
1882
+ const relayHeaders = buildRelayWsHeaders(this.options.config);
1883
+ this.log(`relay connect attempt=${attempt} url=${redactRelayWsUrl(relayUrl)} authorization=${redactAuthorizationHeader(relayHeaders.Authorization)}`);
1884
+ const relay = this.createWebSocket(relayUrl, {
1885
+ headers: relayHeaders,
1886
+ maxPayload: 25 * 1024 * 1024
1887
+ });
1888
+ this.relaySocket = relay;
1889
+ relay.once("open", () => {
1890
+ if (this.stopped || this.relaySocket !== relay) {
1891
+ relay.close();
1892
+ return;
1893
+ }
1894
+ this.relayConnecting = false;
1895
+ this.lastRelayActivityMs = Date.now();
1896
+ this.updateSnapshot({ relayConnected: true, lastError: null });
1897
+ this.log(`relay connected attempt=${attempt}`);
1898
+ this.startHeartbeat();
1899
+ if (shouldKeepGatewayConnected(this.snapshot.clientCount, summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests)) {
1900
+ this.ensureGatewayConnected();
1901
+ }
1902
+ });
1903
+ relay.on("message", (data, isBinary) => {
1904
+ void this.handleRelayMessage(data, isBinary);
1905
+ });
1906
+ relay.on("pong", () => {
1907
+ this.lastRelayActivityMs = Date.now();
1908
+ });
1909
+ relay.once("error", (error) => {
1910
+ this.log(`relay error: ${String(error)}`);
1911
+ });
1912
+ relay.once("close", (code, reason) => {
1913
+ if (this.relaySocket === relay) {
1914
+ this.relaySocket = null;
1915
+ }
1916
+ this.relayConnecting = false;
1917
+ this.stopHeartbeat();
1918
+ this.clientDemandStartedAtMs = null;
1919
+ this.gatewayConnectedAtMs = null;
1920
+ this.updateSnapshot({
1921
+ relayConnected: false,
1922
+ gatewayConnected: false,
1923
+ clientCount: 0,
1924
+ lastError: code === 1e3 ? null : `relay closed: ${reason.toString() || code}`
1925
+ });
1926
+ this.log(`relay disconnected code=${code} reason=${reason.toString() || "<none>"}`);
1927
+ this.closeGateway();
1928
+ this.scheduleRelayReconnect();
1929
+ });
1930
+ }
1931
+ async handleRelayMessage(data, isBinary) {
1932
+ this.lastRelayActivityMs = Date.now();
1933
+ if (isBinary) {
1934
+ this.forwardOrQueueGatewayMessage({ kind: "binary", data: normalizeBinary(data) });
1935
+ return;
1936
+ }
1937
+ const text = normalizeText(data);
1938
+ if (text == null)
1939
+ return;
1940
+ const control = parseControl(text);
1941
+ if (control) {
1942
+ await this.handleRelayControl(control);
1943
+ return;
1944
+ }
1945
+ const identity = parseConnectStartIdentity(text);
1946
+ if (identity) {
1947
+ this.observeConnectStart(identity.id, identity.label);
1948
+ }
1949
+ this.forwardOrQueueGatewayMessage({ kind: "text", text });
1950
+ }
1951
+ async handleRelayControl(control) {
1952
+ if (control.event === "bootstrap.request") {
1953
+ await this.handleBootstrapRequest(control);
1954
+ return;
1955
+ }
1956
+ const { event, count } = control;
1957
+ if (event === "client_connected" || event === "client_count") {
1958
+ const previousClientCount = this.snapshot.clientCount;
1959
+ const clientCount = count ?? Math.max(1, this.snapshot.clientCount);
1960
+ if (clientCount > 0 && this.clientDemandStartedAtMs == null) {
1961
+ this.clientDemandStartedAtMs = Date.now();
1962
+ }
1963
+ this.updateSnapshot({ clientCount });
1964
+ if (clientCount === 0) {
1965
+ this.gatewayHandshakeStarted = false;
1966
+ this.markDevicesRecent();
1967
+ this.dropStaleIdleGatewayQueue();
1968
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
1969
+ if (shouldScheduleGatewayIdleClose(clientCount, queuedConnectRequests, this.isGatewayOpen())) {
1970
+ this.log("client demand dropped to zero; closing idle gateway");
1971
+ this.closeGateway();
1972
+ } else {
1973
+ this.log("client demand dropped to zero; gateway remains needed");
1974
+ }
1975
+ } else {
1976
+ if (shouldRecycleGatewayForFreshClient(previousClientCount, clientCount, this.isGatewayOpen(), false)) {
1977
+ const queued = summarizePendingGatewayMessages(this.pendingGatewayMessages);
1978
+ this.log(`gateway recycle requested for fresh client demand queued=${queued.total} connect=${queued.connectRequests} text=${queued.otherText} binary=${queued.binary} handshakeStarted=${this.gatewayHandshakeStarted}`);
1979
+ const pruned = prunePendingGatewayMessagesForFreshDemand(this.pendingGatewayMessages);
1980
+ if (pruned.dropped > 0) {
1981
+ this.pendingGatewayMessages = pruned.messages;
1982
+ this.log(`dropped stale gateway queue before recycle dropped=${pruned.dropped} kept=${pruned.messages.length}`);
1983
+ }
1984
+ this.closeGateway(true);
1985
+ }
1986
+ if (this.isGatewayOpen() && !this.gatewayCloseBoundaryPending) {
1987
+ this.updateSnapshot({ gatewayConnected: true, lastError: null });
1988
+ this.log(`gateway already connected sinceGatewayOpenMs=${this.elapsedSince(this.gatewayConnectedAtMs)} handshakeStarted=${this.gatewayHandshakeStarted}`);
1989
+ }
1990
+ }
1991
+ this.ensureGatewayConnected();
1992
+ return;
1993
+ }
1994
+ if (event === "client_disconnected") {
1995
+ this.gatewayHandshakeStarted = false;
1996
+ this.updateSnapshot({ clientCount: 0 });
1997
+ this.markDevicesRecent();
1998
+ this.dropStaleIdleGatewayQueue();
1999
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
2000
+ if (shouldScheduleGatewayIdleClose(0, queuedConnectRequests, this.isGatewayOpen())) {
2001
+ this.log("client disconnected; closing idle gateway");
2002
+ this.closeGateway();
2003
+ } else {
2004
+ this.log("client disconnected; gateway remains needed");
2005
+ this.ensureGatewayConnected();
2006
+ }
2007
+ return;
2008
+ }
2009
+ }
2010
+ async handleBootstrapRequest(control) {
2011
+ const requestId = control.requestId?.trim() ?? "";
2012
+ const replyTargetClientId = control.sourceClientId?.trim() || control.targetClientId?.trim() || "";
2013
+ if (!requestId) {
2014
+ this.log("relay bootstrap request dropped reason=missing_request_id");
2015
+ return;
2016
+ }
2017
+ const parsed = parseBootstrapRequestPayload(control.payload);
2018
+ if (!parsed.ok) {
2019
+ this.log(`relay bootstrap request rejected requestId=${requestId} code=${parsed.code} reason=${parsed.message}`);
2020
+ this.sendRelayControl({
2021
+ event: "bootstrap.error",
2022
+ requestId,
2023
+ targetClientId: replyTargetClientId || void 0,
2024
+ payload: {
2025
+ code: parsed.code,
2026
+ message: parsed.message
2027
+ }
2028
+ });
2029
+ return;
2030
+ }
2031
+ try {
2032
+ const issued = await issueOpenClawBootstrapToken(parsed.value);
2033
+ this.log(`relay bootstrap token issued requestId=${requestId} deviceId=${parsed.value.deviceId} targetClientId=${replyTargetClientId || "<none>"} expiresAtMs=${issued.expiresAtMs}`);
2034
+ this.sendRelayControl({
2035
+ event: "bootstrap.issued",
2036
+ requestId,
2037
+ targetClientId: replyTargetClientId || void 0,
2038
+ payload: {
2039
+ bootstrapToken: issued.token,
2040
+ expiresAtMs: issued.expiresAtMs
2041
+ }
2042
+ });
2043
+ } catch (error) {
2044
+ const message = error instanceof Error ? error.message : String(error);
2045
+ this.log(`relay bootstrap token issue failed requestId=${requestId} error=${message}`);
2046
+ this.sendRelayControl({
2047
+ event: "bootstrap.error",
2048
+ requestId,
2049
+ targetClientId: replyTargetClientId || void 0,
2050
+ payload: {
2051
+ code: "bootstrap_issue_failed",
2052
+ message
2053
+ }
2054
+ });
2055
+ }
2056
+ }
2057
+ forwardOrQueueGatewayMessage(message) {
2058
+ const isConnectHandshake = message.kind === "text" && isConnectHandshakeRequest(message.text);
2059
+ if (this.gatewayCloseBoundaryPending) {
2060
+ this.pushPendingGatewayMessage(message);
2061
+ if (isConnectHandshake) {
2062
+ this.log("gateway unavailable during connect handshake; queued until gateway reconnects");
2063
+ }
2064
+ return;
2065
+ }
2066
+ const gateway = this.gatewaySocket;
2067
+ if (!gateway || gateway.readyState !== WebSocket.OPEN) {
2068
+ this.ensureGatewayConnected();
2069
+ this.pushPendingGatewayMessage(message);
2070
+ if (isConnectHandshake) {
2071
+ this.log("gateway unavailable during connect handshake; queued until gateway reconnects");
2072
+ }
2073
+ return;
2074
+ }
2075
+ if (!this.gatewayHandshakeStarted) {
2076
+ if (!isConnectHandshake) {
2077
+ this.pushPendingGatewayMessage(message);
2078
+ return;
2079
+ }
2080
+ this.gatewayHandshakeStarted = true;
2081
+ const meta = parseConnectHandshakeMeta(message.text);
2082
+ this.log(`gateway handshake started queued=${this.pendingGatewayMessages.length}` + formatConnectHandshakeMetaForLog(meta));
2083
+ }
2084
+ this.sendToGateway(message);
2085
+ }
2086
+ ensureGatewayConnected() {
2087
+ if (this.stopped || !this.isRelayOpen() || this.gatewayConnecting || this.isGatewayOpen() || this.gatewayCloseBoundaryPending)
2088
+ return;
2089
+ this.gatewayConnecting = true;
2090
+ this.log(`gateway connect start url=${this.options.gatewayUrl}`);
2091
+ const gateway = this.createWebSocket(this.options.gatewayUrl);
2092
+ this.gatewaySocket = gateway;
2093
+ gateway.once("open", () => {
2094
+ if (this.stopped || this.gatewaySocket !== gateway) {
2095
+ gateway.close();
2096
+ return;
2097
+ }
2098
+ this.gatewayConnecting = false;
2099
+ this.gatewayHandshakeStarted = false;
2100
+ this.gatewayCloseBoundaryPending = false;
2101
+ this.gatewayConnectedAtMs = Date.now();
2102
+ this.updateSnapshot({ gatewayConnected: true, lastError: null });
2103
+ this.log(`gateway connected sinceClientDemandMs=${this.elapsedSince(this.clientDemandStartedAtMs)}`);
2104
+ this.flushPendingGatewayMessages();
2105
+ });
2106
+ gateway.on("message", (data, isBinary) => {
2107
+ this.handleGatewayMessage(data, isBinary);
2108
+ });
2109
+ gateway.once("error", (error) => {
2110
+ this.log(`gateway error: ${String(error)}`);
2111
+ });
2112
+ gateway.once("close", (code, reason) => {
2113
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
2114
+ const reconnectAfterClose = this.gatewayCloseBoundaryPending && shouldKeepGatewayConnected(this.snapshot.clientCount, queuedConnectRequests);
2115
+ if (this.gatewaySocket === gateway) {
2116
+ this.gatewaySocket = null;
2117
+ }
2118
+ this.gatewayConnecting = false;
2119
+ this.gatewayHandshakeStarted = false;
2120
+ this.gatewayCloseBoundaryPending = false;
2121
+ this.gatewayConnectedAtMs = null;
2122
+ this.clearInFlightConnectHandshakes(`gateway disconnected code=${code}`);
2123
+ this.updateSnapshot({
2124
+ gatewayConnected: false,
2125
+ lastError: code === 1e3 || reconnectAfterClose ? this.snapshot.lastError : `gateway closed: ${reason.toString() || code}`
2126
+ });
2127
+ this.log(`gateway disconnected code=${code} reason=${reason.toString() || "<none>"} sinceClientDemandMs=${this.elapsedSince(this.clientDemandStartedAtMs)}`);
2128
+ if (reconnectAfterClose) {
2129
+ this.log("gateway close boundary reached; reconnecting for fresh demand");
2130
+ this.ensureGatewayConnected();
2131
+ return;
2132
+ }
2133
+ this.scheduleGatewayReconnect();
2134
+ });
2135
+ }
2136
+ handleGatewayMessage(data, isBinary) {
2137
+ const relay = this.relaySocket;
2138
+ if (!relay || relay.readyState !== WebSocket.OPEN)
2139
+ return;
2140
+ if (isBinary) {
2141
+ relay.send(normalizeBinary(data));
2142
+ return;
2143
+ }
2144
+ const text = normalizeText(data);
2145
+ if (text == null)
2146
+ return;
2147
+ const pairReq = parsePairingRequestFromError(text);
2148
+ if (pairReq) {
2149
+ this.addPendingPairRequest(pairReq);
2150
+ }
2151
+ const resolved = parsePairResolvedEvent(text);
2152
+ if (resolved) {
2153
+ this.markPairRequestResolved(resolved.requestId, resolved.decision);
2154
+ }
2155
+ const response = parseResponseEnvelopeMeta(text);
2156
+ if (response) {
2157
+ this.observeGatewayResponse(response);
2158
+ }
2159
+ relay.send(text);
2160
+ }
2161
+ flushPendingGatewayMessages() {
2162
+ const gateway = this.gatewaySocket;
2163
+ if (!gateway || gateway.readyState !== WebSocket.OPEN)
2164
+ return;
2165
+ const deferred = [];
2166
+ const queued = dedupePendingGatewayMessages(this.pendingGatewayMessages);
2167
+ if (queued.dropped > 0) {
2168
+ this.log(`dropped stale queued gateway messages before flush dropped=${queued.dropped} kept=${queued.messages.length}`);
2169
+ }
2170
+ this.pendingGatewayMessages = [];
2171
+ for (const message of queued.messages) {
2172
+ if (!this.gatewayHandshakeStarted) {
2173
+ if (message.kind !== "text" || !isConnectHandshakeRequest(message.text)) {
2174
+ deferred.push(message);
2175
+ continue;
2176
+ }
2177
+ this.gatewayHandshakeStarted = true;
2178
+ }
2179
+ this.sendToGateway(message);
2180
+ }
2181
+ this.pendingGatewayMessages = deferred;
2182
+ }
2183
+ sendToGateway(message) {
2184
+ const gateway = this.gatewaySocket;
2185
+ if (!gateway || gateway.readyState !== WebSocket.OPEN) {
2186
+ this.pushPendingGatewayMessage(message);
2187
+ return;
2188
+ }
2189
+ if (message.kind === "text") {
2190
+ const patched = patchConnectRequestGatewayAuth(message.text, readOpenClawInfo());
2191
+ const meta = parseConnectHandshakeMeta(patched.text);
2192
+ if (meta) {
2193
+ if (meta.id) {
2194
+ this.inFlightConnectHandshakes.set(meta.id, {
2195
+ method: meta.method,
2196
+ startedAtMs: Date.now(),
2197
+ slowWarningLogged: false
2198
+ });
2199
+ }
2200
+ this.log(`gateway connect request forwarded${formatConnectHandshakeMetaForLog(meta)}`);
2201
+ }
2202
+ if (patched.injected) {
2203
+ this.log("gateway connect auth patched mode=password");
2204
+ }
2205
+ gateway.send(patched.text);
2206
+ return;
2207
+ }
2208
+ gateway.send(message.data);
2209
+ }
2210
+ sendGatewayRequest(method, params) {
2211
+ const payload = JSON.stringify({
2212
+ type: "req",
2213
+ id: `bridge-${randomUUID2()}`,
2214
+ method,
2215
+ params
2216
+ });
2217
+ this.forwardOrQueueGatewayMessage({ kind: "text", text: payload });
2218
+ }
2219
+ sendRelayControl(control) {
2220
+ const relay = this.relaySocket;
2221
+ if (!relay || relay.readyState !== WebSocket.OPEN)
2222
+ return;
2223
+ relay.send(`__clawket_relay_control__:${JSON.stringify({
2224
+ type: "control",
2225
+ event: control.event,
2226
+ requestId: control.requestId,
2227
+ targetClientId: control.targetClientId,
2228
+ payload: control.payload
2229
+ })}`);
2230
+ }
2231
+ closeGateway(reconnectAfterClose = false) {
2232
+ if (this.gatewayRetryTimer) {
2233
+ clearTimeout(this.gatewayRetryTimer);
2234
+ this.gatewayRetryTimer = null;
2235
+ }
2236
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
2237
+ const shouldReconnectAfterClose = reconnectAfterClose && this.isRelayOpen() && shouldKeepGatewayConnected(this.snapshot.clientCount, queuedConnectRequests);
2238
+ const gateway = this.gatewaySocket;
2239
+ this.gatewayHandshakeStarted = false;
2240
+ this.gatewayConnectedAtMs = null;
2241
+ if (!gateway) {
2242
+ this.gatewayCloseBoundaryPending = false;
2243
+ this.gatewayConnecting = false;
2244
+ if (shouldReconnectAfterClose) {
2245
+ this.ensureGatewayConnected();
2246
+ }
2247
+ return;
2248
+ }
2249
+ if (gateway.readyState === WebSocket.CLOSING) {
2250
+ this.gatewayCloseBoundaryPending = shouldReconnectAfterClose;
2251
+ return;
2252
+ }
2253
+ if (gateway.readyState === WebSocket.CLOSED) {
2254
+ if (this.gatewaySocket === gateway) {
2255
+ this.gatewaySocket = null;
2256
+ }
2257
+ this.gatewayCloseBoundaryPending = false;
2258
+ this.gatewayConnecting = false;
2259
+ if (shouldReconnectAfterClose) {
2260
+ this.ensureGatewayConnected();
2261
+ }
2262
+ return;
2263
+ }
2264
+ this.gatewayCloseBoundaryPending = shouldReconnectAfterClose;
2265
+ gateway.close();
2266
+ }
2267
+ createWebSocket(url, options) {
2268
+ if (this.options.createWebSocket) {
2269
+ return this.options.createWebSocket(url, options);
2270
+ }
2271
+ return new WebSocket(url, {
2272
+ maxPayload: options?.maxPayload ?? 25 * 1024 * 1024,
2273
+ headers: options?.headers
2274
+ });
2275
+ }
2276
+ observeGatewayResponse(response) {
2277
+ const pending = this.inFlightConnectHandshakes.get(response.id);
2278
+ if (!pending)
2279
+ return;
2280
+ this.inFlightConnectHandshakes.delete(response.id);
2281
+ const detail = response.ok ? "ok=true" : `ok=false errorCode=${response.errorCode ?? "<none>"} errorMessage=${response.errorMessage ?? "<none>"}`;
2282
+ this.log(`gateway connect response reqId=${response.id} method=${pending.method} elapsedMs=${Date.now() - pending.startedAtMs} ${detail}`);
2283
+ }
2284
+ clearInFlightConnectHandshakes(reason) {
2285
+ if (this.inFlightConnectHandshakes.size === 0)
2286
+ return;
2287
+ for (const [requestId, pending] of this.inFlightConnectHandshakes.entries()) {
2288
+ this.log(`gateway connect response missing reqId=${requestId} method=${pending.method} elapsedMs=${Date.now() - pending.startedAtMs} reason=${reason}`);
2289
+ }
2290
+ this.inFlightConnectHandshakes.clear();
2291
+ }
2292
+ scheduleRelayReconnect() {
2293
+ if (this.stopped || this.reconnectTimer)
2294
+ return;
2295
+ const base = this.options.reconnectBaseDelayMs ?? RECONNECT_BASE_DELAY_MS;
2296
+ const max = this.options.reconnectMaxDelayMs ?? RECONNECT_MAX_DELAY_MS;
2297
+ const delayMs = Math.min(max, base * Math.max(1, this.relayAttempt));
2298
+ this.log(`relay reconnect scheduled delayMs=${delayMs}`);
2299
+ this.reconnectTimer = setTimeout(() => {
2300
+ this.reconnectTimer = null;
2301
+ void this.connectRelay();
2302
+ }, delayMs);
2303
+ }
2304
+ scheduleGatewayReconnect() {
2305
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
2306
+ if (this.stopped || this.gatewayRetryTimer || !this.isRelayOpen() || !shouldKeepGatewayConnected(this.snapshot.clientCount, queuedConnectRequests))
2307
+ return;
2308
+ const delayMs = this.options.gatewayRetryDelayMs ?? GATEWAY_RETRY_DELAY_MS;
2309
+ this.gatewayRetryTimer = setTimeout(() => {
2310
+ this.gatewayRetryTimer = null;
2311
+ this.ensureGatewayConnected();
2312
+ }, delayMs);
2313
+ }
2314
+ startHeartbeat() {
2315
+ this.stopHeartbeat();
2316
+ this.heartbeatTimer = setInterval(() => {
2317
+ const relay = this.relaySocket;
2318
+ if (!relay || relay.readyState !== WebSocket.OPEN)
2319
+ return;
2320
+ this.logSlowConnectHandshakes();
2321
+ const timeoutMs = this.options.heartbeatTimeoutMs ?? HEARTBEAT_TIMEOUT_MS;
2322
+ if (Date.now() - this.lastRelayActivityMs > timeoutMs) {
2323
+ this.log("relay heartbeat timed out");
2324
+ relay.terminate();
2325
+ return;
2326
+ }
2327
+ relay.ping();
2328
+ }, this.options.heartbeatIntervalMs ?? HEARTBEAT_INTERVAL_MS);
2329
+ }
2330
+ stopHeartbeat() {
2331
+ if (this.heartbeatTimer) {
2332
+ clearInterval(this.heartbeatTimer);
2333
+ this.heartbeatTimer = null;
2334
+ }
2335
+ }
2336
+ logSlowConnectHandshakes() {
2337
+ if (this.inFlightConnectHandshakes.size === 0)
2338
+ return;
2339
+ const warnDelayMs = this.options.connectHandshakeWarnDelayMs ?? CONNECT_HANDSHAKE_WARN_DELAY_MS;
2340
+ const now = Date.now();
2341
+ for (const [requestId, pending] of this.inFlightConnectHandshakes.entries()) {
2342
+ const elapsedMs = now - pending.startedAtMs;
2343
+ if (pending.slowWarningLogged || elapsedMs < warnDelayMs)
2344
+ continue;
2345
+ pending.slowWarningLogged = true;
2346
+ this.log(`gateway connect still pending reqId=${requestId} method=${pending.method} elapsedMs=${elapsedMs}`);
2347
+ }
2348
+ }
2349
+ pushPendingGatewayMessage(message) {
2350
+ if (this.pendingGatewayMessages.length >= MAX_PENDING_GATEWAY_MESSAGES) {
2351
+ this.pendingGatewayMessages.shift();
2352
+ }
2353
+ this.pendingGatewayMessages.push(message);
2354
+ }
2355
+ dropStaleIdleGatewayQueue() {
2356
+ const queued = summarizePendingGatewayMessages(this.pendingGatewayMessages);
2357
+ if (queued.total === 0 || queued.connectRequests > 0)
2358
+ return;
2359
+ this.pendingGatewayMessages = [];
2360
+ this.log(`dropped stale idle gateway queue total=${queued.total} text=${queued.otherText} binary=${queued.binary}`);
2361
+ }
2362
+ observeConnectStart(id, label) {
2363
+ const now = Date.now();
2364
+ const map = new Map(this.snapshot.connectedDevices.map((item) => [item.id, { ...item }]));
2365
+ const existing = map.get(id) ?? {
2366
+ id,
2367
+ label,
2368
+ state: "connected",
2369
+ lastSeenMs: now
2370
+ };
2371
+ existing.label = label;
2372
+ existing.state = "connected";
2373
+ existing.lastSeenMs = now;
2374
+ map.set(id, existing);
2375
+ const connectedDevices = [...map.values()].sort((a, b) => b.lastSeenMs - a.lastSeenMs).slice(0, MAX_DEVICE_DETAILS);
2376
+ this.updateSnapshot({ connectedDevices });
2377
+ }
2378
+ markDevicesRecent() {
2379
+ this.updateSnapshot({
2380
+ connectedDevices: this.snapshot.connectedDevices.map((item) => ({
2381
+ ...item,
2382
+ state: "recent"
2383
+ }))
2384
+ });
2385
+ }
2386
+ addPendingPairRequest(request) {
2387
+ if (this.snapshot.pendingPairRequests.some((item) => item.requestId === request.requestId))
2388
+ return;
2389
+ const next = [...this.snapshot.pendingPairRequests, request].slice(-MAX_PENDING_PAIR_REQUESTS);
2390
+ this.updateSnapshot({ pendingPairRequests: next });
2391
+ this.options.onPendingPairRequest?.(request);
2392
+ this.log(`pair request pending requestId=${request.requestId} deviceId=${request.deviceId || "<unknown>"}`);
2393
+ }
2394
+ markPairRequestResolved(requestId, decision) {
2395
+ const next = this.snapshot.pendingPairRequests.map((item) => item.requestId === requestId ? { ...item, status: decision === "approved" || decision === "rejected" ? decision : item.status } : item);
2396
+ this.updateSnapshot({ pendingPairRequests: next });
2397
+ this.log(`pair request resolved requestId=${requestId} decision=${decision}`);
2398
+ }
2399
+ updateSnapshot(patch) {
2400
+ Object.assign(this.snapshot, patch, { lastUpdatedMs: Date.now() });
2401
+ this.options.onStatus?.(this.getSnapshot());
2402
+ }
2403
+ log(line) {
2404
+ this.options.onLog?.(line);
2405
+ }
2406
+ isRelayOpen() {
2407
+ return this.relaySocket?.readyState === WebSocket.OPEN;
2408
+ }
2409
+ isGatewayOpen() {
2410
+ return this.gatewaySocket?.readyState === WebSocket.OPEN;
2411
+ }
2412
+ clearTimers() {
2413
+ this.stopHeartbeat();
2414
+ if (this.reconnectTimer) {
2415
+ clearTimeout(this.reconnectTimer);
2416
+ this.reconnectTimer = null;
2417
+ }
2418
+ if (this.gatewayRetryTimer) {
2419
+ clearTimeout(this.gatewayRetryTimer);
2420
+ this.gatewayRetryTimer = null;
2421
+ }
2422
+ }
2423
+ elapsedSince(startedAtMs) {
2424
+ return startedAtMs == null ? null : Math.max(0, Date.now() - startedAtMs);
2425
+ }
2426
+ };
2427
+ function shouldKeepGatewayConnected(clientCount, pendingConnectRequests) {
2428
+ return clientCount > 0 || pendingConnectRequests > 0;
2429
+ }
2430
+ function shouldScheduleGatewayIdleClose(clientCount, pendingConnectRequests, gatewayConnected) {
2431
+ return gatewayConnected && !shouldKeepGatewayConnected(clientCount, pendingConnectRequests);
2432
+ }
2433
+ function shouldRecycleGatewayForFreshClient(previousClientCount, nextClientCount, gatewayConnected, hadPendingIdleClose) {
2434
+ return gatewayConnected && nextClientCount > 0 && (previousClientCount === 0 || hadPendingIdleClose);
2435
+ }
2436
+ function summarizePendingGatewayMessages(messages) {
2437
+ const summary = {
2438
+ total: messages.length,
2439
+ connectRequests: 0,
2440
+ otherText: 0,
2441
+ binary: 0
2442
+ };
2443
+ for (const message of messages) {
2444
+ if (message.kind === "binary") {
2445
+ summary.binary += 1;
2446
+ continue;
2447
+ }
2448
+ if (isConnectHandshakeRequest(message.text)) {
2449
+ summary.connectRequests += 1;
2450
+ continue;
2451
+ }
2452
+ summary.otherText += 1;
2453
+ }
2454
+ return summary;
2455
+ }
2456
+ function dedupePendingGatewayMessages(messages) {
2457
+ let latestConnectIndex = -1;
2458
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
2459
+ const message = messages[index];
2460
+ if (message?.kind === "text" && isConnectHandshakeRequest(message.text)) {
2461
+ latestConnectIndex = index;
2462
+ break;
2463
+ }
2464
+ }
2465
+ if (latestConnectIndex <= 0) {
2466
+ return { messages: [...messages], dropped: 0 };
2467
+ }
2468
+ const deduped = messages.filter((message, index) => index >= latestConnectIndex || (message.kind !== "text" || !isConnectHandshakeRequest(message.text)));
2469
+ return {
2470
+ messages: deduped,
2471
+ dropped: messages.length - deduped.length
2472
+ };
2473
+ }
2474
+ function prunePendingGatewayMessagesForFreshDemand(messages) {
2475
+ if (messages.length === 0) {
2476
+ return { messages: [], dropped: 0 };
2477
+ }
2478
+ let latestConnectIndex = -1;
2479
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
2480
+ const message = messages[index];
2481
+ if (message?.kind === "text" && isConnectHandshakeRequest(message.text)) {
2482
+ latestConnectIndex = index;
2483
+ break;
2484
+ }
2485
+ }
2486
+ if (latestConnectIndex === -1) {
2487
+ return { messages: [], dropped: messages.length };
2488
+ }
2489
+ const kept = messages.slice(latestConnectIndex);
2490
+ return {
2491
+ messages: kept,
2492
+ dropped: messages.length - kept.length
2493
+ };
2494
+ }
2495
+ function patchConnectRequestGatewayAuth(text, openClawInfo) {
2496
+ if (openClawInfo.authMode !== "password" || !openClawInfo.password) {
2497
+ return { text, injected: false };
2498
+ }
2499
+ try {
2500
+ const parsed = JSON.parse(text);
2501
+ if (parsed.type !== "req" || parsed.method !== "connect" && parsed.method !== "connect.start") {
2502
+ return { text, injected: false };
2503
+ }
2504
+ const params = parsed.params && typeof parsed.params === "object" ? { ...parsed.params } : {};
2505
+ const auth = params.auth && typeof params.auth === "object" ? { ...params.auth } : {};
2506
+ const existingPassword = typeof auth.password === "string" ? auth.password.trim() : "";
2507
+ if (existingPassword) {
2508
+ return { text, injected: false };
2509
+ }
2510
+ auth.password = openClawInfo.password;
2511
+ params.auth = auth;
2512
+ return {
2513
+ text: JSON.stringify({
2514
+ ...parsed,
2515
+ params
2516
+ }),
2517
+ injected: true
2518
+ };
2519
+ } catch {
2520
+ return { text, injected: false };
2521
+ }
2522
+ }
2523
+ function formatConnectHandshakeMetaForLog(meta) {
2524
+ if (!meta)
2525
+ return "";
2526
+ return ` method=${meta.method} reqId=${meta.id ?? "<none>"} noncePresent=${meta.noncePresent} nonceLength=${meta.nonceLength ?? 0} authFields=${meta.authFields.length > 0 ? meta.authFields.join(",") : "<none>"}`;
2527
+ }
2528
+ function parseBootstrapRequestPayload(payload) {
2529
+ if (!payload) {
2530
+ return {
2531
+ ok: false,
2532
+ code: "invalid_request",
2533
+ message: "bootstrap.request payload is required"
2534
+ };
2535
+ }
2536
+ const deviceId = readRequiredString(payload.deviceId);
2537
+ const publicKey = readRequiredString(payload.publicKey);
2538
+ const role = readRequiredString(payload.role);
2539
+ const scopes = normalizeScopeList(payload.scopes);
2540
+ if (!deviceId) {
2541
+ return { ok: false, code: "invalid_request", message: "payload.deviceId is required" };
2542
+ }
2543
+ if (!publicKey) {
2544
+ return { ok: false, code: "invalid_request", message: "payload.publicKey is required" };
2545
+ }
2546
+ if (!role) {
2547
+ return { ok: false, code: "invalid_request", message: "payload.role is required" };
2548
+ }
2549
+ if (scopes.length === 0) {
2550
+ return { ok: false, code: "invalid_request", message: "payload.scopes must contain at least one scope" };
2551
+ }
2552
+ return {
2553
+ ok: true,
2554
+ value: {
2555
+ deviceId,
2556
+ publicKey,
2557
+ role,
2558
+ scopes
2559
+ }
2560
+ };
2561
+ }
2562
+ function readRequiredString(value) {
2563
+ return typeof value === "string" ? value.trim() : "";
2564
+ }
2565
+ function normalizeScopeList(value) {
2566
+ if (!Array.isArray(value))
2567
+ return [];
2568
+ const scopes = /* @__PURE__ */ new Set();
2569
+ for (const item of value) {
2570
+ if (typeof item !== "string")
2571
+ continue;
2572
+ const trimmed = item.trim();
2573
+ if (trimmed) {
2574
+ scopes.add(trimmed);
2575
+ }
2576
+ }
2577
+ return [...scopes].sort();
2578
+ }
2579
+ function buildRelayWsUrl(config) {
2580
+ const base = new URL(config.relayUrl);
2581
+ if (!base.pathname || base.pathname === "/") {
2582
+ base.pathname = "/ws";
2583
+ }
2584
+ base.searchParams.delete("token");
2585
+ base.searchParams.set("gatewayId", config.gatewayId);
2586
+ base.searchParams.set("role", "gateway");
2587
+ base.searchParams.set("clientId", config.instanceId);
2588
+ return base.toString();
2589
+ }
2590
+ function buildRelayWsHeaders(config) {
2591
+ return {
2592
+ Authorization: `Bearer ${config.relaySecret}`
2593
+ };
2594
+ }
2595
+ function redactRelayWsUrl(rawUrl) {
2596
+ const parsed = new URL(rawUrl);
2597
+ if (parsed.username) {
2598
+ parsed.username = "<redacted>";
2599
+ }
2600
+ if (parsed.password) {
2601
+ parsed.password = "<redacted>";
2602
+ }
2603
+ if (parsed.searchParams.has("token")) {
2604
+ parsed.searchParams.set("token", "<redacted>");
2605
+ }
2606
+ return parsed.toString();
2607
+ }
2608
+ function redactAuthorizationHeader(value) {
2609
+ const trimmed = value?.trim() ?? "";
2610
+ if (!trimmed)
2611
+ return "<none>";
2612
+ return /^Bearer\s+/i.test(trimmed) ? "Bearer <redacted>" : "<redacted>";
2613
+ }
2614
+ function normalizeText(data) {
2615
+ if (typeof data === "string")
2616
+ return data;
2617
+ if (Buffer.isBuffer(data))
2618
+ return data.toString("utf8");
2619
+ if (Array.isArray(data))
2620
+ return Buffer.concat(data).toString("utf8");
2621
+ if (data instanceof ArrayBuffer)
2622
+ return Buffer.from(data).toString("utf8");
2623
+ return null;
2624
+ }
2625
+ function normalizeBinary(data) {
2626
+ if (Buffer.isBuffer(data))
2627
+ return data;
2628
+ if (typeof data === "string")
2629
+ return Buffer.from(data, "utf8");
2630
+ if (Array.isArray(data))
2631
+ return Buffer.concat(data);
2632
+ return Buffer.from(data);
2633
+ }
2634
+
2635
+ // src/diagnostics.ts
2636
+ function readRecentCliLogs(input) {
2637
+ const { logPath, errorLogPath } = getServicePaths();
2638
+ const lines = clampLines(input?.lines ?? 200);
2639
+ const lookbackMs = input?.lastMs ?? null;
2640
+ const cutoff = lookbackMs != null ? Date.now() - lookbackMs : null;
2641
+ const sources = [logPath];
2642
+ if (input?.includeErrorLog) {
2643
+ sources.push(errorLogPath);
2644
+ }
2645
+ const entries = sources.flatMap((path) => readLogFile(path));
2646
+ const filtered = cutoff == null ? entries : entries.filter((entry) => entry.ts != null && entry.ts >= cutoff);
2647
+ return filtered.slice(-lines).map((entry) => entry.raw);
2648
+ }
2649
+ async function buildDoctorReport() {
2650
+ const config = readPairingConfig();
2651
+ const service = getServiceStatus();
2652
+ const openclaw = readOpenClawInfo();
2653
+ const localGatewayUrl = resolveGatewayUrl();
2654
+ const localGatewayReachable = await checkGatewayReachable(localGatewayUrl);
2655
+ return {
2656
+ paired: Boolean(config),
2657
+ gatewayId: config?.gatewayId ?? null,
2658
+ serverUrl: config?.serverUrl ?? null,
2659
+ relayUrl: config?.relayUrl ?? null,
2660
+ instanceId: config?.instanceId ?? null,
2661
+ serviceInstalled: service.installed,
2662
+ serviceRunning: service.running,
2663
+ serviceMethod: service.method,
2664
+ servicePath: service.servicePath,
2665
+ logPath: service.logPath,
2666
+ errorLogPath: service.errorLogPath,
2667
+ openclawConfigDir: getOpenClawConfigDir(),
2668
+ openclawMediaDir: getOpenClawMediaDir(),
2669
+ openclawConfigFound: openclaw.configFound,
2670
+ openclawAuthMode: openclaw.authMode,
2671
+ openclawTokenFound: Boolean(openclaw.token),
2672
+ openclawPasswordFound: Boolean(openclaw.password),
2673
+ localGatewayUrl,
2674
+ localGatewayReachable
2675
+ };
2676
+ }
2677
+ async function ensurePairPrerequisites() {
2678
+ const report = await buildDoctorReport();
2679
+ const failures = listPairPrerequisiteFailures(report);
2680
+ if (failures.length > 0) {
2681
+ throw new Error([
2682
+ "Cannot complete `clawket pair` because local OpenClaw prerequisites are not ready.",
2683
+ ...failures.map((item) => `- ${item}`),
2684
+ "Run `clawket doctor` for more details, or use `clawket pair --force` only if you intentionally want to bypass this safety check."
2685
+ ].join("\n"));
2686
+ }
2687
+ return report;
2688
+ }
2689
+ function listPairPrerequisiteFailures(report) {
2690
+ const failures = [];
2691
+ if (!report.openclawConfigFound) {
2692
+ failures.push(`OpenClaw config was not found under ${formatOpenClawConfigLocations()}.`);
2693
+ }
2694
+ if (report.openclawTokenFound && report.openclawPasswordFound && report.openclawAuthMode == null) {
2695
+ failures.push("OpenClaw has both gateway token and password configured, but gateway.auth.mode is unset.");
2696
+ }
2697
+ if (!report.openclawTokenFound && !report.openclawPasswordFound) {
2698
+ failures.push("OpenClaw gateway auth is missing (token or password).");
2699
+ }
2700
+ if (report.openclawAuthMode === "token" && !report.openclawTokenFound) {
2701
+ failures.push("OpenClaw gateway token is missing.");
2702
+ }
2703
+ if (report.openclawAuthMode === "password" && !report.openclawPasswordFound) {
2704
+ failures.push("OpenClaw gateway password is missing.");
2705
+ }
2706
+ if (!report.localGatewayReachable) {
2707
+ failures.push(`Local OpenClaw Gateway is not reachable at ${report.localGatewayUrl}.`);
2708
+ }
2709
+ return failures;
2710
+ }
2711
+ function formatOpenClawConfigLocations() {
2712
+ const seen = /* @__PURE__ */ new Set();
2713
+ return [homedir4(), "/root"].map((home) => `${home.trim()}/.openclaw`).filter((path) => path !== "/.openclaw").filter((path) => {
2714
+ if (seen.has(path)) return false;
2715
+ seen.add(path);
2716
+ return true;
2717
+ }).join(" or ");
2718
+ }
2719
+ function readLogFile(path) {
2720
+ try {
2721
+ const raw = readFileSync4(path, "utf8");
2722
+ return raw.split(/\r?\n/).filter(Boolean).map((line) => ({
2723
+ raw: line,
2724
+ ts: parseTimestamp(line)
2725
+ }));
2726
+ } catch {
2727
+ return [];
2728
+ }
2729
+ }
2730
+ function parseTimestamp(line) {
2731
+ const matched = line.match(/^\[(\d{13})\]\s/);
2732
+ if (!matched) return null;
2733
+ const value = Number(matched[1]);
2734
+ return Number.isFinite(value) ? value : null;
2735
+ }
2736
+ function clampLines(value) {
2737
+ if (!Number.isFinite(value)) return 200;
2738
+ return Math.max(1, Math.min(2e3, Math.floor(value)));
2739
+ }
2740
+ async function checkGatewayReachable(gatewayUrl) {
2741
+ try {
2742
+ const parsed = new URL(gatewayUrl);
2743
+ const host = parsed.hostname || "127.0.0.1";
2744
+ const port = parsed.port ? Number(parsed.port) : parsed.protocol === "wss:" ? 443 : 80;
2745
+ await new Promise((resolve4, reject) => {
2746
+ const socket = new Socket();
2747
+ socket.setTimeout(900);
2748
+ socket.once("connect", () => {
2749
+ socket.destroy();
2750
+ resolve4();
2751
+ });
2752
+ socket.once("timeout", () => {
2753
+ socket.destroy();
2754
+ reject(new Error("timeout"));
2755
+ });
2756
+ socket.once("error", (error) => {
2757
+ socket.destroy();
2758
+ reject(error);
2759
+ });
2760
+ socket.connect(port, host);
2761
+ });
2762
+ return true;
2763
+ } catch {
2764
+ return false;
2765
+ }
2766
+ }
2767
+
2768
+ // src/log-parse.ts
2769
+ function parseLookbackToMs(input) {
2770
+ const trimmed = input?.trim();
2771
+ if (!trimmed) return null;
2772
+ const matched = trimmed.match(/^(\d+)(ms|s|m|h|d)$/i);
2773
+ if (!matched) {
2774
+ throw new Error(`Invalid --last value "${trimmed}". Use values like 30s, 2m, 1h, or 1d.`);
2775
+ }
2776
+ const value = Number(matched[1]);
2777
+ const unit = matched[2].toLowerCase();
2778
+ const factor = unit === "ms" ? 1 : unit === "s" ? 1e3 : unit === "m" ? 6e4 : unit === "h" ? 36e5 : 864e5;
2779
+ return value * factor;
2780
+ }
2781
+
2782
+ // src/local-pair.ts
2783
+ import { networkInterfaces } from "os";
2784
+ var BLOCKED_INTERFACE_TOKENS = [
2785
+ "utun",
2786
+ "tun",
2787
+ "tap",
2788
+ "tailscale",
2789
+ "wireguard",
2790
+ "wg",
2791
+ "vpn",
2792
+ "ipsec",
2793
+ "docker",
2794
+ "veth",
2795
+ "vmnet",
2796
+ "vbox",
2797
+ "loopback",
2798
+ " lo",
2799
+ "lo0",
2800
+ "awdl",
2801
+ "llw",
2802
+ "bridge",
2803
+ "br-",
2804
+ "ppp"
2805
+ ];
2806
+ function buildGatewayControlUiOrigin(gatewayUrl) {
2807
+ const parsed = new URL(normalizeExplicitGatewayUrl(gatewayUrl));
2808
+ const scheme = parsed.protocol === "wss:" ? "https:" : "http:";
2809
+ const port = parsed.port || (scheme === "https:" ? "443" : "80");
2810
+ return `${scheme}//${parsed.hostname}:${port}`;
2811
+ }
2812
+ function buildLocalPairingInfo(input) {
2813
+ const auth = resolveLocalPairAuth(input);
2814
+ const gatewayUrl = resolveLocalPairGatewayUrl({
2815
+ explicitUrl: input.explicitUrl,
2816
+ defaultGatewayUrl: input.defaultGatewayUrl
2817
+ });
2818
+ const expiresAt = input.expiresAt ?? Date.now() + 10 * 60 * 1e3;
2819
+ return {
2820
+ gatewayUrl,
2821
+ expiresAt,
2822
+ authMode: auth.mode,
2823
+ qrPayload: buildGatewayQrPayload({
2824
+ gatewayUrl,
2825
+ token: auth.token,
2826
+ password: auth.password,
2827
+ expiresAt
2828
+ })
2829
+ };
2830
+ }
2831
+ function resolveLocalPairGatewayUrl(input) {
2832
+ const explicit = input?.explicitUrl?.trim();
2833
+ if (explicit) {
2834
+ return normalizeExplicitGatewayUrl(explicit);
2835
+ }
2836
+ const baseGatewayUrl = input?.defaultGatewayUrl?.trim() || resolveGatewayUrl();
2837
+ const lanIp = detectLanIp();
2838
+ if (!lanIp) {
2839
+ throw new Error("Failed to determine a LAN IP address. Pass --url to specify a custom gateway URL.");
2840
+ }
2841
+ return rewriteGatewayHost(baseGatewayUrl, lanIp);
2842
+ }
2843
+ function normalizeExplicitGatewayUrl(url) {
2844
+ const trimmed = url.trim();
2845
+ const withScheme = /^[a-z]+:\/\//i.test(trimmed) ? trimmed : `ws://${trimmed}`;
2846
+ return normalizeGatewayQrUrl(withScheme).url;
2847
+ }
2848
+ function rewriteGatewayHost(gatewayUrl, nextHost) {
2849
+ const trimmed = gatewayUrl.trim();
2850
+ const withScheme = /^[a-z]+:\/\//i.test(trimmed) ? trimmed : `ws://${trimmed}`;
2851
+ const parsed = new URL(withScheme);
2852
+ parsed.hostname = nextHost;
2853
+ return normalizeGatewayQrUrl(parsed.toString()).url;
2854
+ }
2855
+ function detectLanIp() {
2856
+ const interfaces = networkInterfaces();
2857
+ let best = null;
2858
+ for (const [name, addresses] of Object.entries(interfaces)) {
2859
+ for (const address of addresses ?? []) {
2860
+ if (address.family !== "IPv4") continue;
2861
+ const score = scoreLanCandidate(name, address.address);
2862
+ if (score === 0) continue;
2863
+ if (!best || score > best.score) {
2864
+ best = { score, ip: address.address };
2865
+ }
2866
+ }
2867
+ }
2868
+ return best?.ip ?? null;
2869
+ }
2870
+ function scoreLanCandidate(name, ip) {
2871
+ if (!isLanIpv4(ip)) {
2872
+ return 0;
2873
+ }
2874
+ const lower = name.toLowerCase();
2875
+ if (BLOCKED_INTERFACE_TOKENS.some((token) => lower.includes(token))) {
2876
+ return 0;
2877
+ }
2878
+ let score = isRfc1918(ip) ? 120 : isCgnat(ip) ? 90 : 40;
2879
+ if (lower.startsWith("en") || lower.startsWith("eth") || lower.startsWith("wlan") || lower.startsWith("wl") || lower.includes("wifi") || lower.includes("wi-fi")) {
2880
+ score += 20;
2881
+ }
2882
+ return score;
2883
+ }
2884
+ function resolveLocalPairAuth(input) {
2885
+ if (input.gatewayToken?.trim()) {
2886
+ return { mode: "token", token: input.gatewayToken.trim(), password: null };
2887
+ }
2888
+ if (input.gatewayPassword?.trim()) {
2889
+ return { mode: "password", token: null, password: input.gatewayPassword.trim() };
2890
+ }
2891
+ throw new Error("OpenClaw gateway auth is missing (token or password).");
2892
+ }
2893
+ function isLanIpv4(ip) {
2894
+ if (!isValidIpv4(ip)) return false;
2895
+ if (ip === "0.0.0.0") return false;
2896
+ const [a, b, c, d] = ip.split(".").map(Number);
2897
+ if (a === 127) return false;
2898
+ if (a === 169 && b === 254) return false;
2899
+ if (a >= 224 && a <= 239) return false;
2900
+ if (a === 255 && b === 255 && c === 255 && d === 255) return false;
2901
+ if (a === 198 && (b === 18 || b === 19)) return false;
2902
+ return isRfc1918(ip) || isCgnat(ip);
2903
+ }
2904
+ function isRfc1918(ip) {
2905
+ const [a, b] = ip.split(".").map(Number);
2906
+ return a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
2907
+ }
2908
+ function isCgnat(ip) {
2909
+ const [a, b] = ip.split(".").map(Number);
2910
+ return a === 100 && b >= 64 && b <= 127;
2911
+ }
2912
+ function isValidIpv4(ip) {
2913
+ const parts = ip.split(".");
2914
+ return parts.length === 4 && parts.every((part) => {
2915
+ if (!/^\d+$/.test(part)) return false;
2916
+ const value = Number(part);
2917
+ return value >= 0 && value <= 255;
2918
+ });
2919
+ }
2920
+
2921
+ // src/metadata.ts
2922
+ import { readFileSync as readFileSync5 } from "fs";
2923
+ import { dirname as dirname3, resolve as resolve2 } from "path";
2924
+ import { fileURLToPath } from "url";
2925
+ function readCliVersion() {
2926
+ const here = dirname3(fileURLToPath(import.meta.url));
2927
+ const packageJsonPath = resolve2(here, "../package.json");
2928
+ const raw = readFileSync5(packageJsonPath, "utf8");
2929
+ const parsed = JSON.parse(raw);
2930
+ return parsed.version ?? "unknown";
2931
+ }
2932
+
2933
+ // src/pairing-output.ts
2934
+ function buildPairingJson(paired, qrImagePath, service, message) {
2935
+ return {
2936
+ ok: true,
2937
+ action: paired.action,
2938
+ message,
2939
+ gatewayId: paired.config.gatewayId,
2940
+ relayUrl: paired.config.relayUrl,
2941
+ serverUrl: paired.config.serverUrl,
2942
+ instanceId: paired.config.instanceId,
2943
+ accessCode: paired.accessCode,
2944
+ accessCodeExpiresAt: paired.accessCodeExpiresAt,
2945
+ qrImagePath,
2946
+ service: {
2947
+ installed: service.installed,
2948
+ running: service.running,
2949
+ method: service.method,
2950
+ servicePath: service.servicePath,
2951
+ logPath: service.logPath,
2952
+ errorLogPath: service.errorLogPath,
2953
+ pid: service.pid
2954
+ }
2955
+ };
2956
+ }
2957
+ function buildLocalPairingJson(input) {
2958
+ return {
2959
+ ok: true,
2960
+ action: "local",
2961
+ message: input.message,
2962
+ gatewayUrl: input.gatewayUrl,
2963
+ authMode: input.authMode,
2964
+ expiresAt: input.expiresAt,
2965
+ qrImagePath: input.qrImagePath,
2966
+ configUpdated: input.configUpdated ?? false,
2967
+ controlUiOrigin: input.controlUiOrigin ?? null,
2968
+ gatewayRestartAction: input.gatewayRestartAction ?? "unchanged",
2969
+ customUrl: input.customUrl ?? false
2970
+ };
2971
+ }
2972
+
2973
+ // src/qr-file.ts
2974
+ import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
2975
+ import { dirname as dirname4, isAbsolute, join as join4, resolve as resolve3 } from "path";
2976
+ import QRCode from "qrcode";
2977
+ var DEFAULT_QR_DIR = getOpenClawMediaDir();
2978
+ async function writePairingQrPng(paired, outputPath) {
2979
+ const targetPath = resolveQrOutputPath(paired.config.gatewayId, outputPath);
2980
+ return writeQrPng(paired.qrPayload, targetPath);
2981
+ }
2982
+ async function writeRawQrPng(payload, fileStem, outputPath) {
2983
+ const targetPath = resolveQrOutputPath(fileStem, outputPath);
2984
+ return writeQrPng(payload, targetPath);
2985
+ }
2986
+ async function writeQrPng(payload, targetPath) {
2987
+ mkdirSync3(dirname4(targetPath), { recursive: true });
2988
+ const dataUrl = await QRCode.toDataURL(payload, {
2989
+ type: "image/png",
2990
+ errorCorrectionLevel: "M",
2991
+ margin: 1,
2992
+ width: 720
2993
+ });
2994
+ const encoded = dataUrl.replace(/^data:image\/png;base64,/, "");
2995
+ writeFileSync3(targetPath, Buffer.from(encoded, "base64"));
2996
+ return targetPath;
2997
+ }
2998
+ function resolveQrOutputPath(fileStem, outputPath) {
2999
+ const trimmed = outputPath?.trim();
3000
+ if (trimmed) {
3001
+ return isAbsolute(trimmed) ? trimmed : resolve3(trimmed);
3002
+ }
3003
+ return join4(DEFAULT_QR_DIR, `${fileStem}.png`);
3004
+ }
3005
+
3006
+ // src/service-decision.ts
3007
+ function decidePairServiceAction(paired, service) {
3008
+ if (!service.installed) {
3009
+ return "install";
3010
+ }
3011
+ if (!service.running) {
3012
+ return "restart";
3013
+ }
3014
+ if (paired.action === "registered") {
3015
+ return "restart";
3016
+ }
3017
+ return "noop";
3018
+ }
3019
+
3020
+ // src/index.ts
3021
+ async function main() {
3022
+ const [, , command = "help", ...args] = process.argv;
3023
+ const isServiceMode = hasFlag(args, "--service");
3024
+ const jsonOutput = hasFlag(args, "--json");
3025
+ if (command === "pair") {
3026
+ const pairSubcommand = readPairSubcommand(args);
3027
+ const localPair = pairSubcommand === "local" || hasFlag(args, "--local");
3028
+ if (localPair) {
3029
+ const gatewayAuth2 = resolveGatewayAuth();
3030
+ if ("error" in gatewayAuth2) {
3031
+ throw new Error(gatewayAuth2.error);
3032
+ }
3033
+ const qrFile2 = readFlag(args, "--qr-file");
3034
+ const explicitLocalUrl = readFlag(args, "--url");
3035
+ const local = buildLocalPairingInfo({
3036
+ explicitUrl: explicitLocalUrl,
3037
+ gatewayToken: gatewayAuth2.token,
3038
+ gatewayPassword: gatewayAuth2.password
3039
+ });
3040
+ let message = "Generated a local gateway pairing QR.";
3041
+ let configUpdated = false;
3042
+ let controlUiOrigin = null;
3043
+ let gatewayRestartAction = "unchanged";
3044
+ if (!explicitLocalUrl) {
3045
+ controlUiOrigin = buildGatewayControlUiOrigin(local.gatewayUrl);
3046
+ if (!jsonOutput) {
3047
+ console.log("\u23F3 Updating OpenClaw config for LAN access...");
3048
+ }
3049
+ const lanConfig = await configureOpenClawLanAccess({ controlUiOrigin });
3050
+ configUpdated = lanConfig.bindChanged || lanConfig.allowedOriginAdded;
3051
+ if (configUpdated) {
3052
+ if (!jsonOutput) {
3053
+ console.log("\u23F3 Restarting OpenClaw Gateway...");
3054
+ }
3055
+ const restart = await restartOpenClawGateway();
3056
+ gatewayRestartAction = restart.action;
3057
+ if (!jsonOutput) {
3058
+ console.log("\u2705 Gateway is ready.");
3059
+ }
3060
+ } else if (!jsonOutput) {
3061
+ console.log("\u2705 Gateway already allows LAN pairing.");
3062
+ }
3063
+ message = configUpdated ? "Configured OpenClaw for LAN access, restarted the Gateway, and generated a local gateway pairing QR." : "OpenClaw already allowed LAN pairing. Generated a local gateway pairing QR.";
3064
+ }
3065
+ const qrImagePath2 = await writeRawQrPng(local.qrPayload, "clawket-local-pair", qrFile2);
3066
+ if (jsonOutput) {
3067
+ printJson(buildLocalPairingJson({
3068
+ gatewayUrl: local.gatewayUrl,
3069
+ authMode: local.authMode,
3070
+ expiresAt: local.expiresAt,
3071
+ qrImagePath: qrImagePath2,
3072
+ message,
3073
+ configUpdated,
3074
+ controlUiOrigin,
3075
+ gatewayRestartAction,
3076
+ customUrl: Boolean(explicitLocalUrl)
3077
+ }));
3078
+ } else {
3079
+ printLocalPairingInfo(local.gatewayUrl, local.authMode, local.expiresAt, local.qrPayload, qrImagePath2, explicitLocalUrl);
3080
+ }
3081
+ return;
3082
+ }
3083
+ const forcePair = hasFlag(args, "--force");
3084
+ if (!forcePair) {
3085
+ await ensurePairPrerequisites();
3086
+ }
3087
+ const gatewayAuth = resolveGatewayAuth();
3088
+ if ("error" in gatewayAuth) {
3089
+ throw new Error(gatewayAuth.error);
3090
+ }
3091
+ const server = readFlag(args, "--server") ?? readFlag(args, "-s") ?? "https://registry.clawket.ai";
3092
+ const name = readFlag(args, "--name") ?? readFlag(args, "-n") ?? getDefaultBridgeDisplayName();
3093
+ const qrFile = readFlag(args, "--qr-file");
3094
+ const paired = await pairGateway({
3095
+ serverUrl: server,
3096
+ displayName: name,
3097
+ gatewayToken: gatewayAuth.token,
3098
+ gatewayPassword: gatewayAuth.password
3099
+ });
3100
+ const qrImagePath = await writePairingQrPng(paired, qrFile);
3101
+ const currentService = getServiceStatus();
3102
+ const serviceAction = decidePairServiceAction(paired, currentService);
3103
+ if (serviceAction === "noop") {
3104
+ const runtimeProcesses = listRuntimeProcesses();
3105
+ if (runtimeProcesses.length > 1) {
3106
+ stopRuntimeProcesses();
3107
+ const status = restartService();
3108
+ const message = "Detected duplicate bridge runtimes. Restarted the background service cleanly.";
3109
+ if (jsonOutput) {
3110
+ printJson(buildPairingJson(paired, qrImagePath, status, message));
3111
+ } else {
3112
+ printPairingInfo(paired, qrImagePath);
3113
+ printServiceResult(message, status);
3114
+ }
3115
+ return;
3116
+ }
3117
+ if (jsonOutput) {
3118
+ printJson(buildPairingJson(paired, qrImagePath, currentService, "Background service already running. Left unchanged."));
3119
+ } else {
3120
+ printPairingInfo(paired, qrImagePath);
3121
+ console.log("Background service already running. Left unchanged.");
3122
+ printServiceResult(null, currentService);
3123
+ }
3124
+ return;
3125
+ }
3126
+ try {
3127
+ stopRuntimeProcesses();
3128
+ const status = serviceAction === "install" ? installService() : restartService();
3129
+ const message = serviceAction === "install" ? "Auto-installed background service." : paired.action === "registered" ? "Bridge identity changed. Restarted background service to load the new pairing." : "Background service was installed but stopped. Restarted it.";
3130
+ if (jsonOutput) {
3131
+ printJson(buildPairingJson(paired, qrImagePath, status, message));
3132
+ } else {
3133
+ printPairingInfo(paired, qrImagePath);
3134
+ printServiceResult(message, status);
3135
+ }
3136
+ } catch (error) {
3137
+ if (isAutostartUnsupportedError(error)) {
3138
+ const status = await startTransientRuntime();
3139
+ const message = buildUnsupportedAutostartMessage(status);
3140
+ if (jsonOutput) {
3141
+ printJson(buildPairingJson(paired, qrImagePath, status, message));
3142
+ } else {
3143
+ printPairingInfo(paired, qrImagePath);
3144
+ printServiceResult(message, status);
3145
+ }
3146
+ return;
3147
+ }
3148
+ console.error(`Pairing succeeded, but service activation failed: ${formatError2(error)}`);
3149
+ console.error('You can still run "clawket install" or "clawket run" manually.');
3150
+ process.exitCode = 1;
3151
+ }
3152
+ return;
3153
+ }
3154
+ if (command === "refresh-code") {
3155
+ const qrFile = readFlag(args, "--qr-file");
3156
+ const gatewayAuth = resolveGatewayAuth();
3157
+ if ("error" in gatewayAuth) {
3158
+ throw new Error(gatewayAuth.error);
3159
+ }
3160
+ const paired = await refreshAccessCode({
3161
+ gatewayToken: gatewayAuth.token,
3162
+ gatewayPassword: gatewayAuth.password
3163
+ });
3164
+ const qrImagePath = await writePairingQrPng(paired, qrFile);
3165
+ if (jsonOutput) {
3166
+ printJson(buildPairingJson(paired, qrImagePath, getServiceStatus(), "Pairing code refreshed."));
3167
+ } else {
3168
+ printPairingInfo(paired, qrImagePath);
3169
+ }
3170
+ return;
3171
+ }
3172
+ if (command === "install" || command === "start") {
3173
+ const config = requirePairingConfig();
3174
+ stopRuntimeProcesses();
3175
+ const status = installService();
3176
+ console.log(`Installed background service for gateway ${config.gatewayId}.`);
3177
+ printServiceResult(null, status);
3178
+ return;
3179
+ }
3180
+ if (command === "restart") {
3181
+ const config = requirePairingConfig();
3182
+ stopRuntimeProcesses();
3183
+ const status = restartService();
3184
+ console.log(`Restarted background service for gateway ${config.gatewayId}.`);
3185
+ printServiceResult(null, status);
3186
+ return;
3187
+ }
3188
+ if (command === "stop") {
3189
+ const status = stopService();
3190
+ stopRuntimeProcesses();
3191
+ console.log("Stopped background service.");
3192
+ printServiceResult(null, status);
3193
+ return;
3194
+ }
3195
+ if (command === "uninstall") {
3196
+ const status = uninstallService();
3197
+ stopRuntimeProcesses();
3198
+ console.log("Removed background service registration.");
3199
+ printServiceResult(null, status);
3200
+ return;
3201
+ }
3202
+ if (command === "reset") {
3203
+ stopRuntimeProcesses();
3204
+ stopService();
3205
+ deletePairingConfig();
3206
+ console.log(`Cleared pairing config: ${getPairingConfigPath()}`);
3207
+ return;
3208
+ }
3209
+ if (command === "status") {
3210
+ printStatus();
3211
+ return;
3212
+ }
3213
+ if (command === "logs") {
3214
+ const lines = Number(readFlag(args, "--lines") ?? "200");
3215
+ const lastMs = parseLookbackToMs(readFlag(args, "--last") ?? readFlag(args, "-l"));
3216
+ const recent = readRecentCliLogs({
3217
+ lines,
3218
+ lastMs,
3219
+ includeErrorLog: hasFlag(args, "--errors")
3220
+ });
3221
+ if (jsonOutput) {
3222
+ printJson({ ok: true, lines: recent });
3223
+ } else if (recent.length === 0) {
3224
+ console.log("No matching CLI logs found.");
3225
+ } else {
3226
+ console.log(recent.join("\n"));
3227
+ }
3228
+ return;
3229
+ }
3230
+ if (command === "doctor") {
3231
+ const report = await buildDoctorReport();
3232
+ if (jsonOutput) {
3233
+ printJson(report);
3234
+ } else {
3235
+ printDoctorReport(report);
3236
+ }
3237
+ return;
3238
+ }
3239
+ if (command === "run") {
3240
+ const config = requirePairingConfig();
3241
+ const replaceExisting = hasFlag(args, "--replace");
3242
+ const existingRuntimePids = listRuntimeProcesses().map((entry) => entry.pid);
3243
+ if (existingRuntimePids.length > 0) {
3244
+ if (!replaceExisting) {
3245
+ console.error(
3246
+ `Another Clawket bridge runtime is already running (pid${existingRuntimePids.length > 1 ? "s" : ""}: ${existingRuntimePids.join(", ")}). Run "clawket stop" first, or rerun with "--replace" to take over.`
3247
+ );
3248
+ process.exit(1);
3249
+ }
3250
+ stopRuntimeProcesses();
3251
+ }
3252
+ const gatewayUrl = resolveGatewayUrl(readFlag(args, "--gateway-url") ?? readFlag(args, "-g"));
3253
+ const emitRuntimeLine = (line) => {
3254
+ console.log(`[${Date.now()}] ${line}`);
3255
+ };
3256
+ if (!isServiceMode) {
3257
+ console.log(`Gateway ID: ${config.gatewayId}`);
3258
+ console.log(`Instance ID: ${config.instanceId}`);
3259
+ console.log(`Gateway URL: ${gatewayUrl}`);
3260
+ console.log("");
3261
+ console.log("Starting bridge runtime. Press Ctrl+C to stop.");
3262
+ console.log("");
3263
+ } else {
3264
+ emitRuntimeLine(`Starting Clawket service runtime for gateway ${config.gatewayId}`);
3265
+ }
3266
+ if (isServiceMode) {
3267
+ writeServiceState();
3268
+ }
3269
+ const runtime = new BridgeRuntime({
3270
+ config,
3271
+ gatewayUrl,
3272
+ onLog: (line) => {
3273
+ emitRuntimeLine(`[clawket] ${line}`);
3274
+ },
3275
+ onStatus: (snapshot) => {
3276
+ if (snapshot.lastError) {
3277
+ emitRuntimeLine(`[status] relay=${snapshot.relayConnected ? "up" : "down"} gateway=${snapshot.gatewayConnected ? "up" : "down"} clients=${snapshot.clientCount} error=${snapshot.lastError}`);
3278
+ return;
3279
+ }
3280
+ emitRuntimeLine(`[status] relay=${snapshot.relayConnected ? "up" : "down"} gateway=${snapshot.gatewayConnected ? "up" : "down"} clients=${snapshot.clientCount}`);
3281
+ },
3282
+ onPendingPairRequest: (request) => {
3283
+ emitRuntimeLine(`[pair-request] requestId=${request.requestId} deviceId=${request.deviceId || "<unknown>"} name=${request.displayName ?? "<unknown>"}`);
3284
+ }
3285
+ });
3286
+ runtime.start();
3287
+ registerRuntimeProcess({
3288
+ gatewayId: config.gatewayId,
3289
+ instanceId: config.instanceId,
3290
+ serviceMode: isServiceMode
3291
+ });
3292
+ const shutdown = async () => {
3293
+ process.off("SIGINT", shutdown);
3294
+ process.off("SIGTERM", shutdown);
3295
+ await runtime.stop();
3296
+ unregisterRuntimeProcess(process.pid);
3297
+ if (isServiceMode) {
3298
+ clearServiceState(process.pid);
3299
+ }
3300
+ process.exit(0);
3301
+ };
3302
+ process.on("SIGINT", shutdown);
3303
+ process.on("SIGTERM", shutdown);
3304
+ await new Promise(() => {
3305
+ });
3306
+ }
3307
+ printHelp();
3308
+ }
3309
+ function printPairingInfo(paired, qrImagePath) {
3310
+ if (paired.action === "refreshed") {
3311
+ console.log("Bridge already paired. Refreshed the pairing code.");
3312
+ }
3313
+ console.log(`Gateway ID: ${paired.config.gatewayId}`);
3314
+ console.log("\nScan this QR code in the Clawket app:\n");
3315
+ qrcodeTerminal.generate(paired.qrPayload, { small: true });
3316
+ console.log(`Expires: ${formatLocalTime(paired.accessCodeExpiresAt)}`);
3317
+ console.log(`QR image: ${qrImagePath}`);
3318
+ }
3319
+ function printLocalPairingInfo(gatewayUrl, authMode, expiresAt, qrPayload, qrImagePath, customUrl) {
3320
+ console.log(`Gateway URL: ${gatewayUrl}`);
3321
+ console.log(`Auth mode: ${authMode}`);
3322
+ console.log(customUrl ? "\nScan this custom gateway QR in the Clawket app:\n" : "\nScan this local gateway QR in the Clawket app:\n");
3323
+ qrcodeTerminal.generate(qrPayload, { small: true });
3324
+ console.log(`Expires: ${new Date(expiresAt).toLocaleString()}`);
3325
+ console.log(`QR image: ${qrImagePath}`);
3326
+ }
3327
+ function printStatus() {
3328
+ const config = readPairingConfig();
3329
+ const service = getServiceStatus();
3330
+ const { logPath, errorLogPath } = getServicePaths();
3331
+ const version = readCliVersion();
3332
+ console.log(`Version: ${version}`);
3333
+ if (!config) {
3334
+ console.log(`Config: not paired (${getPairingConfigPath()})`);
3335
+ } else {
3336
+ console.log(`Config: paired`);
3337
+ console.log(`Gateway ID: ${config.gatewayId}`);
3338
+ console.log(`Instance: ${config.instanceId}`);
3339
+ console.log(`Server URL: ${config.serverUrl}`);
3340
+ console.log(`Name: ${config.displayName ?? "-"}`);
3341
+ }
3342
+ console.log(`Gateway: ${resolveGatewayUrl()}`);
3343
+ console.log(`Service: ${service.installed ? "installed" : "not installed"} (${service.method})`);
3344
+ console.log(`Running: ${service.running ? "yes" : "no"}`);
3345
+ console.log(`Path: ${service.servicePath || "-"}`);
3346
+ console.log(`Log: ${logPath}`);
3347
+ console.log(`Error Log: ${errorLogPath}`);
3348
+ if (!config) {
3349
+ process.exitCode = 1;
3350
+ }
3351
+ }
3352
+ function printServiceResult(message, status) {
3353
+ if (message) {
3354
+ console.log(message);
3355
+ }
3356
+ console.log(`Service: ${status.installed ? status.running ? "installed, running" : "installed, stopped" : "not installed"}`);
3357
+ console.log(`Service path: ${status.servicePath || "-"}`);
3358
+ }
3359
+ function printDoctorReport(report) {
3360
+ console.log(`Paired: ${report.paired ? "yes" : "no"}`);
3361
+ console.log(`Gateway ID: ${report.gatewayId ?? "-"}`);
3362
+ console.log(`Server URL: ${report.serverUrl ?? "-"}`);
3363
+ console.log(`Relay URL: ${report.relayUrl ?? "-"}`);
3364
+ console.log(`Instance ID: ${report.instanceId ?? "-"}`);
3365
+ console.log(`Service: ${report.serviceInstalled ? "installed" : "not installed"} (${report.serviceMethod})`);
3366
+ console.log(`Service running: ${report.serviceRunning ? "yes" : "no"}`);
3367
+ console.log(`Service path: ${report.servicePath || "-"}`);
3368
+ console.log(`Log path: ${report.logPath}`);
3369
+ console.log(`Error log path: ${report.errorLogPath}`);
3370
+ console.log(`OpenClaw dir: ${report.openclawConfigDir}`);
3371
+ console.log(`OpenClaw media: ${report.openclawMediaDir}`);
3372
+ console.log(`OpenClaw config: ${report.openclawConfigFound ? "found" : "missing"}`);
3373
+ console.log(`OpenClaw token: ${report.openclawTokenFound ? "found" : "missing"}`);
3374
+ console.log(`Gateway URL: ${report.localGatewayUrl}`);
3375
+ console.log(`Gateway reachable: ${report.localGatewayReachable ? "yes" : "no"}`);
3376
+ }
3377
+ function requirePairingConfig() {
3378
+ const config = readPairingConfig();
3379
+ if (!config) {
3380
+ console.error(`Not paired. Run "clawket pair" first. Config path: ${getPairingConfigPath()}`);
3381
+ process.exit(1);
3382
+ }
3383
+ return config;
3384
+ }
3385
+ function readFlag(args, name) {
3386
+ const index = args.indexOf(name);
3387
+ if (index < 0) return null;
3388
+ const value = args[index + 1];
3389
+ return value?.trim() ? value.trim() : null;
3390
+ }
3391
+ function hasFlag(args, name) {
3392
+ return args.includes(name);
3393
+ }
3394
+ function readPairSubcommand(args) {
3395
+ for (const arg of args) {
3396
+ if (!arg.startsWith("-")) {
3397
+ return arg.trim() || null;
3398
+ }
3399
+ }
3400
+ return null;
3401
+ }
3402
+ function printHelp() {
3403
+ console.log([
3404
+ "clawket pair [--server <url>] [--name <displayName>] [--qr-file <path>] [--json] [--force]",
3405
+ "clawket pair local [--url <ws://host:port>] [--qr-file <path>] [--json]",
3406
+ "clawket pair --local [--url <ws://host:port>] [--qr-file <path>] [--json]",
3407
+ "clawket refresh-code [--qr-file <path>] [--json]",
3408
+ "clawket start",
3409
+ "clawket install",
3410
+ "clawket restart",
3411
+ "clawket stop",
3412
+ "clawket uninstall",
3413
+ "clawket reset",
3414
+ "clawket status",
3415
+ "clawket logs [--last <2m>] [--lines <200>] [--errors] [--json]",
3416
+ "clawket doctor [--json]",
3417
+ "clawket run [--gateway-url <ws://127.0.0.1:18789>] [--replace]"
3418
+ ].join("\n"));
3419
+ }
3420
+ function buildUnsupportedAutostartMessage(status) {
3421
+ if (status.running) {
3422
+ return "Started the bridge runtime, but this host does not support automatic startup registration. Use your container or process manager to restart Clawket on reboot.";
3423
+ }
3424
+ return "This host does not support automatic startup registration, and the bridge runtime could not be started automatically. Use your container or process manager to run Clawket.";
3425
+ }
3426
+ function formatLocalTime(iso) {
3427
+ const d = new Date(iso);
3428
+ if (Number.isNaN(d.getTime())) return iso;
3429
+ return d.toLocaleString();
3430
+ }
3431
+ function formatError2(error) {
3432
+ return error instanceof Error ? error.message : String(error);
3433
+ }
3434
+ function printJson(value) {
3435
+ console.log(JSON.stringify(value, null, 2));
3436
+ }
3437
+ main().catch((error) => {
3438
+ console.error(formatError2(error));
3439
+ process.exit(1);
3440
+ });