@univer-cli/daemon 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x134627=_0x4677;(function(_0x500a51,_0x2098ed){const _0x5f0cf2=_0x4677,_0x530860=_0x500a51();while(!![]){try{const _0x387cdd=parseInt(_0x5f0cf2(0x190))/0x1+-parseInt(_0x5f0cf2(0x1b9))/0x2*(parseInt(_0x5f0cf2(0x15e))/0x3)+-parseInt(_0x5f0cf2(0x1cf))/0x4+parseInt(_0x5f0cf2(0x1ba))/0x5*(parseInt(_0x5f0cf2(0x161))/0x6)+parseInt(_0x5f0cf2(0x181))/0x7*(parseInt(_0x5f0cf2(0x1a1))/0x8)+-parseInt(_0x5f0cf2(0x1a3))/0x9+parseInt(_0x5f0cf2(0x178))/0xa*(parseInt(_0x5f0cf2(0x172))/0xb);if(_0x387cdd===_0x2098ed)break;else _0x530860['push'](_0x530860['shift']());}catch(_0x2cb4d8){_0x530860['push'](_0x530860['shift']());}}}(_0x4286,0xb32a7));import{randomUUID as _0xabd625}from'node:crypto';import{spawn as _0x33d48a}from'node:child_process';import{connect as _0x4036c4,createServer as _0x14014b}from'node:net';import{fileURLToPath as _0x1c32d5}from'node:url';import{lstat as _0x788b84,mkdir as _0xdb7fc4,unlink as _0x20e081}from'node:fs/promises';import{dirname as _0x39395e}from'node:path';function l(_0x536662){return JSON['stringify'](_0x536662)+'\x0a';}function u(_0x768e07){let _0x5ec578='';return{'end'(){const _0x27e59b=_0x4677;_0x5ec578[_0x27e59b(0x19d)]()[_0x27e59b(0x1c3)]>0x0&&_0x768e07(_0x5ec578),_0x5ec578='';},'push'(_0x166fb9){const _0x1b502d=_0x4677;for(_0x5ec578+=_0x166fb9[_0x1b502d(0x17b)](_0x1b502d(0x1d8));;){let _0x56461a=_0x5ec578[_0x1b502d(0x1a9)]('\x0a');if(_0x56461a<0x0)return;let _0x388eb2=_0x5ec578[_0x1b502d(0x1a8)](0x0,_0x56461a);_0x5ec578=_0x5ec578[_0x1b502d(0x1a8)](_0x56461a+0x1),_0x388eb2['trim']()[_0x1b502d(0x1c3)]>0x0&&_0x768e07(_0x388eb2);}}};}var d=_0x134627(0x166);async function f(_0x5eb5a8){const _0x33deda=_0x134627;_0x33d48a(process[_0x33deda(0x1d6)],[_0x1c32d5(_0x5eb5a8[_0x33deda(0x17d)])],{'detached':!0x0,'env':{...process.env,..._0x5eb5a8[_0x33deda(0x167)][_0x33deda(0x15d)],[d]:_0x5eb5a8['options'][_0x33deda(0x1bb)]},'stdio':_0x33deda(0x1cb)})[_0x33deda(0x1be)]();let _0x478098=Date[_0x33deda(0x168)]();for(;Date['now']()-_0x478098<_0x5eb5a8[_0x33deda(0x1d1)];){try{return await _0x5eb5a8[_0x33deda(0x16e)]();}catch(_0x4351e1){if(!h(_0x4351e1))throw _0x4351e1;}await new Promise(_0x1452c0=>setTimeout(_0x1452c0,0x19));}throw Object['assign'](Error('Daemon\x20did\x20not\x20start\x20within\x20'+String(_0x5eb5a8[_0x33deda(0x1d1)])+'ms'),{'code':_0x33deda(0x171)});}function p(_0x1714d3,_0x4166df,_0x422a2d,_0x2cad13){return new Promise((_0x3d299e,_0x4bfa4a)=>{const _0x12ee43=_0x4677;let _0x239f27=_0x4036c4(_0x1714d3),_0x1f2a6b=_0xabd625(),_0x1fc9f4=!0x1,_0x3ffd69=setTimeout(()=>{const _0x458f45=_0x4677;_0x239f27[_0x458f45(0x18f)](),_0x4bfa4a(Object[_0x458f45(0x169)](Error(_0x458f45(0x1b5)+String(_0x2cad13)+'ms'),{'code':_0x458f45(0x1c8)}));},_0x2cad13),_0x3fe520=_0x43426d=>{_0x1fc9f4||(_0x1fc9f4=!0x0,clearTimeout(_0x3ffd69),_0x43426d());},_0x58f736=u(_0x5593f0=>{try{let _0x15fc3a=_(_0x5593f0,_0x1f2a6b);_0x3fe520(()=>{const _0x49b06a=_0x4677;_0x239f27[_0x49b06a(0x1c4)](),_0x15fc3a[_0x49b06a(0x1c2)]===_0x49b06a(0x1cc)?_0x4bfa4a(v(_0x15fc3a[_0x49b06a(0x1cc)])):_0x3d299e(_0x15fc3a[_0x49b06a(0x1af)]);});}catch(_0x575376){_0x3fe520(()=>{const _0x400aa5=_0x4677;_0x239f27[_0x400aa5(0x18f)](),_0x4bfa4a(_0x575376);});}});_0x239f27[_0x12ee43(0x1ab)](_0x12ee43(0x1cc),_0x2a65ec=>_0x3fe520(()=>{_0x239f27['destroy'](),_0x4bfa4a(_0x2a65ec);})),_0x239f27['on'](_0x12ee43(0x1b1),_0x1b432f=>_0x58f736[_0x12ee43(0x1c1)](_0x1b432f)),_0x239f27['on']('end',()=>{_0x58f736['end'](),_0x3fe520(()=>{const _0x333d15=_0x4677;_0x239f27[_0x333d15(0x18f)](),_0x4bfa4a(g());});}),_0x239f27['on'](_0x12ee43(0x174),()=>_0x3fe520(()=>{_0x239f27['destroy'](),_0x4bfa4a(g());})),_0x239f27[_0x12ee43(0x1ab)](_0x12ee43(0x17f),()=>{const _0x292c9f=_0x12ee43;_0x239f27[_0x292c9f(0x16f)](l({'id':_0x1f2a6b,'method':_0x4166df,'payload':_0x422a2d}));});});}function m(_0xb91dea){const _0xf34523=_0x134627;let _0x1aad9a=_0xb91dea instanceof URL?_0xb91dea[_0xf34523(0x1d5)]:_0xb91dea;try{let _0x7afd82=new URL(_0x1aad9a);if(_0x7afd82[_0xf34523(0x199)]!==_0xf34523(0x163))throw Error();return _0x7afd82[_0xf34523(0x1d5)];}catch{throw Error(_0xf34523(0x17e));}}function h(_0x3e940e){const _0x5038c8=_0x134627;return y(_0x3e940e)?_0x3e940e[_0x5038c8(0x1aa)]===_0x5038c8(0x1ad)||_0x3e940e[_0x5038c8(0x1aa)]===_0x5038c8(0x1b0):!0x1;}function g(){const _0x18d0c0=_0x134627;return Object[_0x18d0c0(0x169)](Error(_0x18d0c0(0x179)),{'code':_0x18d0c0(0x162)});}function _(_0xdb6bbb,_0x5f86d0){const _0x2b41e1=_0x134627;let _0x58b45f=JSON[_0x2b41e1(0x184)](_0xdb6bbb);if(!y(_0x58b45f)||_0x58b45f['id']!==_0x5f86d0)throw Error(_0x2b41e1(0x165));if(_0x58b45f['type']===_0x2b41e1(0x1af)&&_0x2b41e1(0x1af)in _0x58b45f||_0x58b45f['type']===_0x2b41e1(0x1cc)&&y(_0x58b45f[_0x2b41e1(0x1cc)]))return _0x58b45f;throw Error(_0x2b41e1(0x165));}function v(_0x2eecc9){const _0x33e3a2=_0x134627;let _0x31098e=Error(_0x2eecc9[_0x33e3a2(0x1b2)]);return _0x2eecc9[_0x33e3a2(0x1aa)]!==void 0x0&&Object[_0x33e3a2(0x169)](_0x31098e,{'code':_0x2eecc9[_0x33e3a2(0x1aa)]}),_0x31098e[_0x33e3a2(0x19f)]=_0x2eecc9['name'],_0x31098e;}function y(_0x1ffb04){const _0x454f53=_0x134627;return typeof _0x1ffb04==_0x454f53(0x16d)&&!!_0x1ffb04&&!Array[_0x454f53(0x1db)](_0x1ffb04);}function _0x4677(_0x52cfc9,_0x23f491){_0x52cfc9=_0x52cfc9-0x15d;const _0x4286d2=_0x4286();let _0x4677ec=_0x4286d2[_0x52cfc9];return _0x4677ec;}function b(_0x231328){const _0xbf296e=_0x134627;S(_0x231328['id'],_0xbf296e(0x185)),S(_0x231328[_0xbf296e(0x17a)],_0xbf296e(0x176)),_0x231328['buildId']!==void 0x0&&S(_0x231328[_0xbf296e(0x1b6)],_0xbf296e(0x175));}function x(_0x1033f6){const _0x10cf7e=_0x134627;return ee(_0x1033f6)&&typeof _0x1033f6['id']==_0x10cf7e(0x1bc)&&_0x1033f6['id'][_0x10cf7e(0x1c3)]>0x0&&typeof _0x1033f6[_0x10cf7e(0x17a)]==_0x10cf7e(0x1bc)&&_0x1033f6[_0x10cf7e(0x17a)][_0x10cf7e(0x1c3)]>0x0&&(_0x1033f6[_0x10cf7e(0x1b6)]===void 0x0||typeof _0x1033f6[_0x10cf7e(0x1b6)]==_0x10cf7e(0x1bc)&&_0x1033f6[_0x10cf7e(0x1b6)]['length']>0x0);}function S(_0x59df72,_0x6f3185){const _0x3c6815=_0x134627;if(_0x59df72[_0x3c6815(0x1c3)]===0x0)throw Error(_0x6f3185+_0x3c6815(0x193));}function ee(_0x4ddbac){const _0x2bb0ad=_0x134627;return typeof _0x4ddbac=='object'&&!!_0x4ddbac&&!Array[_0x2bb0ad(0x1db)](_0x4ddbac);}var C=0x1,w='daemon.status',T=_0x134627(0x173);function E(_0x5a9a11){const _0x589146=_0x134627;return _0x5a9a11[_0x589146(0x164)](_0x589146(0x170));}var D=0x2710,O=0x19;function k(_0x131cab){const _0xc49d44=_0x134627;b(_0x131cab['identity']);let _0xa2b07d=m(_0x131cab[_0xc49d44(0x17d)]),_0x1aca68=_0x131cab[_0xc49d44(0x1dc)]??0x7530,_0x3b22d1=_0x131cab[_0xc49d44(0x183)]??0x2710,_0x423afb=_0x131cab[_0xc49d44(0x1b8)]??D;z(_0x1aca68,_0xc49d44(0x1dc)),z(_0x3b22d1,_0xc49d44(0x183)),z(_0x423afb,_0xc49d44(0x1b8));let _0x44cae8=()=>({'socketPath':_0x131cab[_0xc49d44(0x1bb)],'state':_0xc49d44(0x194)}),_0x35dd8e=async()=>{const _0x1b70e1=_0xc49d44;try{let _0x412a1d=N(await p(_0x131cab[_0x1b70e1(0x1bb)],w,null,_0x1aca68),_0x131cab[_0x1b70e1(0x1bb)]),_0xf46d7f=te(_0x131cab[_0x1b70e1(0x16c)],_0x412a1d);return _0xf46d7f===void 0x0?_0x412a1d:ne(_0x131cab['identity'],_0x412a1d,_0xf46d7f,_0x131cab[_0x1b70e1(0x1bb)]);}catch(_0x2a0e86){if(h(_0x2a0e86))return _0x44cae8();let _0x33330f=L(_0x2a0e86);return _0x33330f['code']===_0x1b70e1(0x192)?j(_0x131cab[_0x1b70e1(0x16c)],_0x1b70e1(0x1ca),_0x131cab['socketPath'],_0x33330f):_0x33330f[_0x1b70e1(0x1aa)]==='DAEMON_CONTROL_INVALID_RESPONSE'?j(_0x131cab['identity'],'invalid-health',_0x131cab['socketPath'],_0x33330f):{'diagnostic':_0x33330f,'socketPath':_0x131cab['socketPath'],'state':_0x1b70e1(0x16b)};}},_0x1c3814=async()=>{const _0x56a032=_0xc49d44;let _0x5cec44=await _0x35dd8e();if(_0x5cec44['state']==='running')return{..._0x5cec44,'started':!0x1};if(_0x5cec44[_0x56a032(0x1d2)]!=='stopped')throw M(_0x5cec44);return{...await f({'entry':_0xa2b07d,'options':_0x131cab,'ready':async()=>{const _0x2bddbb=_0x56a032;let _0x3713d5=await _0x35dd8e();if(_0x3713d5[_0x2bddbb(0x1d2)]===_0x2bddbb(0x194))throw F(_0x131cab[_0x2bddbb(0x1bb)]);if(_0x3713d5[_0x2bddbb(0x1d2)]!==_0x2bddbb(0x1a5))throw M(_0x3713d5);return _0x3713d5;},'timeoutMs':_0x3b22d1}),'started':!0x0};},_0x92d335=async()=>{const _0x40d6d0=_0xc49d44;let _0x17272e=await _0x35dd8e();if(_0x17272e[_0x40d6d0(0x1d2)]===_0x40d6d0(0x194))return{..._0x17272e,'stopped':!0x1};if(_0x17272e[_0x40d6d0(0x1d2)]!=='running'&&!A(_0x17272e))throw M(_0x17272e);try{await p(_0x131cab[_0x40d6d0(0x1bb)],T,null,_0x1aca68);}catch(_0x5176c7){if(!I(_0x5176c7))throw _0x5176c7;}return await P(_0x35dd8e,_0x423afb),{..._0x44cae8(),'stopped':!0x0};};return{async 'restart'(){const _0x5a2b32=_0xc49d44;let _0x4b1b64=await _0x35dd8e();if(_0x4b1b64[_0x5a2b32(0x1d2)]!==_0x5a2b32(0x1a5)&&_0x4b1b64[_0x5a2b32(0x1d2)]!==_0x5a2b32(0x194)&&!A(_0x4b1b64))throw M(_0x4b1b64);(_0x4b1b64['state']===_0x5a2b32(0x1a5)||A(_0x4b1b64))&&await _0x92d335();let _0x513ca1=await _0x1c3814(),_0x3d5064=_0x4b1b64[_0x5a2b32(0x1d2)]===_0x5a2b32(0x1a5)?_0x4b1b64[_0x5a2b32(0x1a2)]:A(_0x4b1b64)?_0x4b1b64[_0x5a2b32(0x1d3)][_0x5a2b32(0x1a2)]:void 0x0;return{'identity':_0x513ca1['identity'],'pid':_0x513ca1[_0x5a2b32(0x1a2)],..._0x3d5064===void 0x0?{}:{'previousPid':_0x3d5064},'restarted':_0x4b1b64[_0x5a2b32(0x1d2)]!==_0x5a2b32(0x194),'protocolVersion':_0x513ca1[_0x5a2b32(0x1d0)],'socketPath':_0x513ca1[_0x5a2b32(0x1bb)],'startedAt':_0x513ca1['startedAt'],'state':'running'};},'start':_0x1c3814,'status':_0x35dd8e,'stop':_0x92d335};}function A(_0x3403a0){const _0x9646a7=_0x134627;return _0x3403a0[_0x9646a7(0x1d2)]===_0x9646a7(0x182)&&_0x3403a0['actual']!==void 0x0&&(_0x3403a0[_0x9646a7(0x1ae)]===_0x9646a7(0x196)||_0x3403a0[_0x9646a7(0x1ae)]===_0x9646a7(0x17c));}function te(_0x8d23,_0x1a0f5c){const _0x11a6b1=_0x134627;if(_0x1a0f5c[_0x11a6b1(0x1d0)]!==0x1)return _0x11a6b1(0x186);if(_0x1a0f5c[_0x11a6b1(0x16c)]['id']!==_0x8d23['id'])return _0x11a6b1(0x1d9);if(_0x1a0f5c[_0x11a6b1(0x16c)][_0x11a6b1(0x17a)]!==_0x8d23[_0x11a6b1(0x17a)])return _0x11a6b1(0x196);if(_0x8d23['buildId']!==void 0x0&&_0x1a0f5c[_0x11a6b1(0x16c)]['buildId']!==_0x8d23['buildId'])return _0x11a6b1(0x17c);}function ne(_0x4580f5,_0x376269,_0x48dc4b,_0x46a74b){const _0x2a9cf0=_0x134627;return{'actual':{'identity':_0x376269[_0x2a9cf0(0x16c)],'pid':_0x376269['pid'],'protocolVersion':_0x376269[_0x2a9cf0(0x1d0)],'socketPath':_0x376269[_0x2a9cf0(0x1bb)],'startedAt':_0x376269[_0x2a9cf0(0x180)]},'expected':{'identity':_0x4580f5,'protocolVersion':0x1},'reason':_0x48dc4b,'socketPath':_0x46a74b,'state':_0x2a9cf0(0x182)};}function j(_0x2e6695,_0x5d2cba,_0x10106e,_0x22db7c){return{'diagnostic':_0x22db7c,'expected':{'identity':_0x2e6695,'protocolVersion':0x1},'reason':_0x5d2cba,'socketPath':_0x10106e,'state':'incompatible'};}function M(_0x2576d4){const _0x3cba3c=_0x134627;let _0x54717f=_0x2576d4['state']==='incompatible'?_0x2576d4[_0x3cba3c(0x1ae)]:_0x2576d4[_0x3cba3c(0x197)][_0x3cba3c(0x1b2)];return R(_0x2576d4[_0x3cba3c(0x1d2)]===_0x3cba3c(0x182)?_0x3cba3c(0x1bd):_0x3cba3c(0x187),_0x3cba3c(0x16a)+_0x54717f);}function N(_0x3fc9e1,_0x282fcb){const _0x558217=_0x134627;if(!B(_0x3fc9e1)||_0x3fc9e1['state']!=='running'||_0x3fc9e1['socketPath']!==_0x282fcb||!x(_0x3fc9e1[_0x558217(0x16c)])||typeof _0x3fc9e1[_0x558217(0x1a2)]!='number'||!Number[_0x558217(0x18e)](_0x3fc9e1[_0x558217(0x1a2)])||_0x3fc9e1['pid']<=0x0||typeof _0x3fc9e1[_0x558217(0x1d0)]!=_0x558217(0x198)||!Number[_0x558217(0x18e)](_0x3fc9e1[_0x558217(0x1d0)])||_0x3fc9e1['protocolVersion']<=0x0||typeof _0x3fc9e1[_0x558217(0x180)]!='string'||Number[_0x558217(0x189)](Date['parse'](_0x3fc9e1[_0x558217(0x180)])))throw R(_0x558217(0x1c0),_0x558217(0x1d7));return{'identity':_0x3fc9e1[_0x558217(0x16c)],'pid':_0x3fc9e1[_0x558217(0x1a2)],'protocolVersion':_0x3fc9e1['protocolVersion'],'socketPath':_0x282fcb,'startedAt':_0x3fc9e1[_0x558217(0x180)],'state':_0x558217(0x1a5)};}async function P(_0xda592b,_0x1b7ab5){const _0x47897a=_0x134627;let _0x18ca03=Date['now']();for(;Date[_0x47897a(0x168)]()-_0x18ca03<_0x1b7ab5;){if((await _0xda592b())['state']===_0x47897a(0x194))return;await new Promise(_0x16f697=>setTimeout(_0x16f697,O));}throw R('DAEMON_STOP_TIMEOUT','Daemon\x20did\x20not\x20stop\x20within\x20'+String(_0x1b7ab5)+'ms');}function F(_0x396d5b){const _0x37ee72=_0x134627;return Object[_0x37ee72(0x169)](Error('Daemon\x20is\x20not\x20listening\x20on\x20'+_0x396d5b),{'code':_0x37ee72(0x1b0)});}function I(_0x189620){const _0x3b5221=_0x134627;return h(_0x189620)||B(_0x189620)&&(_0x189620[_0x3b5221(0x1aa)]==='DAEMON_CONNECTION_CLOSED'||_0x189620[_0x3b5221(0x1aa)]===_0x3b5221(0x1a7)||_0x189620[_0x3b5221(0x1aa)]===_0x3b5221(0x19c)||_0x189620[_0x3b5221(0x1aa)]===_0x3b5221(0x19b));}function L(_0x552244){const _0x445de7=_0x134627;let _0x23f9c2=_0x552244 instanceof Error?_0x552244['message']:String(_0x552244);return B(_0x552244)&&typeof _0x552244[_0x445de7(0x1aa)]==_0x445de7(0x1bc)?{'code':_0x552244[_0x445de7(0x1aa)],'message':_0x23f9c2}:{'message':_0x23f9c2};}function R(_0x40ffb4,_0x42de7f){const _0x40804f=_0x134627;return Object[_0x40804f(0x169)](Error(_0x42de7f),{'code':_0x40ffb4});}function _0x4286(){const _0x180f99=['data','message','toISOString','exitCode','Daemon\x20request\x20timed\x20out\x20after\x20','buildId','start','stopTimeoutMs','1686722Rqgwvw','26480PAgsRq','socketPath','string','DAEMON_INCOMPATIBLE','unref','Refusing\x20to\x20replace\x20non-socket\x20path\x20','DAEMON_CONTROL_INVALID_RESPONSE','push','type','length','end','unknown','delete','status','DAEMON_REQUEST_TIMEOUT','DAEMON_INVALID_REQUEST','legacy-protocol','ignore','error','catch','Daemon\x20method\x20namespace\x20is\x20reserved:\x20','2546596cgUThI','protocolVersion','timeoutMs','state','actual','listen','href','execPath','Daemon\x20status\x20response\x20is\x20invalid','utf8','identity-mismatch','Daemon\x20server\x20has\x20not\x20started\x20listening','isArray','requestTimeoutMs','\x20must\x20be\x20a\x20finite\x20positive\x20number','env','3dRHrhO','shutdown','isSocket','534INDYVu','DAEMON_CONNECTION_CLOSED','file:','startsWith','Invalid\x20daemon\x20response','UNIVER_CLI_SDK_DAEMON_SOCKET','options','now','assign','Daemon\x20is\x20not\x20ready:\x20','unreachable','identity','object','ready','write','daemon.','DAEMON_START_TIMEOUT','55YvBPuC','daemon.shutdown','close','identity.buildId','identity.version','isFinite','2842480fDaPXf','Daemon\x20connection\x20closed\x20before\x20a\x20response\x20was\x20received','version','toString','build-id-mismatch','entry','Daemon\x20entry\x20must\x20be\x20an\x20absolute\x20file\x20URL','connect','startedAt','2178659JHlfuK','incompatible','startTimeoutMs','parse','identity.id','protocol-mismatch','DAEMON_UNREACHABLE','Error','isNaN','Daemon\x20method\x20','EADDRINUSE','payload','socketPath\x20must\x20not\x20be\x20empty','isSafeInteger','destroy','644413IZYehR','A\x20daemon\x20is\x20already\x20listening\x20on\x20','DAEMON_METHOD_NOT_FOUND','\x20must\x20not\x20be\x20empty','stopped','has','version-mismatch','diagnostic','number','protocol','Daemon\x20method\x20must\x20not\x20be\x20empty','EPIPE','ENOTCONN','trim','method','name','get','16jFlEZa','pid','8510382bGjKMf','Unknown\x20daemon\x20method\x20','running','Daemon\x20server\x20is\x20closed','ECONNRESET','slice','indexOf','code','once','daemon.status','ENOENT','reason','result','ECONNREFUSED'];_0x4286=function(){return _0x180f99;};return _0x4286();}function z(_0x57ac30,_0x382e39){const _0x441790=_0x134627;if(!Number[_0x441790(0x177)](_0x57ac30)||_0x57ac30<=0x0)throw Error(_0x382e39+_0x441790(0x1dd));}function B(_0x573140){const _0x17a07e=_0x134627;return typeof _0x573140==_0x17a07e(0x16d)&&!!_0x573140&&!Array[_0x17a07e(0x1db)](_0x573140);}function V(_0x320b56){const _0x40195a=_0x134627;let _0x505d1a=_0x320b56[_0x40195a(0x1dc)]??0x7530,_0x27b685=k(_0x320b56),_0x11a1cf,_0x45178a=async()=>{const _0x48ee24=_0x40195a;let _0x439a36=await _0x27b685['status']();if(_0x439a36['state']==='running')return _0x439a36;if(_0x439a36[_0x48ee24(0x1d2)]!==_0x48ee24(0x194))throw M(_0x439a36);let _0x39c7e6=_0x11a1cf??=_0x27b685[_0x48ee24(0x1b7)]();try{return await _0x39c7e6;}finally{_0x11a1cf===_0x39c7e6&&(_0x11a1cf=void 0x0);}};return{async 'request'(_0xeb1d04,_0x1861a9){const _0x291546=_0x40195a;if(_0xeb1d04[_0x291546(0x1c3)]===0x0)throw Error(_0x291546(0x19a));await _0x45178a();try{return await p(_0x320b56['socketPath'],_0xeb1d04,_0x1861a9,_0x505d1a);}catch(_0x34ad77){if(!h(_0x34ad77))throw _0x34ad77;}return await _0x45178a(),await p(_0x320b56[_0x291546(0x1bb)],_0xeb1d04,_0x1861a9,_0x505d1a);}};}function H(_0x982d83){const _0x24eb51=_0x134627;oe(_0x982d83['socketPath']),b(_0x982d83[_0x24eb51(0x16c)]);let _0x3df210=new Map(),_0x41ee46=new Set(),_0x56fc63,_0x1cd720=!0x1,_0x1a4414,_0x3e3f0a,_0x3caab5={async 'close'(){_0x1a4414??=_0x4aa409(),await _0x1a4414;},'handle'(_0x16c0d9,_0x17fd64){const _0x35c851=_0x24eb51;if(_0x1cd720)throw Error('Daemon\x20handlers\x20must\x20be\x20registered\x20before\x20listen()');if(_0x16c0d9[_0x35c851(0x1c3)]===0x0)throw Error(_0x35c851(0x19a));if(E(_0x16c0d9))throw Error(_0x35c851(0x1ce)+_0x16c0d9);if(_0x3df210[_0x35c851(0x195)](_0x16c0d9))throw Error(_0x35c851(0x18a)+_0x16c0d9+'\x20is\x20already\x20registered');_0x3df210['set'](_0x16c0d9,_0x17fd64);},async 'listen'(){const _0x142f22=_0x24eb51;if(!_0x1cd720){if(_0x1a4414)throw Error(_0x142f22(0x1a6));await _0xdb7fc4(_0x39395e(_0x982d83[_0x142f22(0x1bb)]),{'recursive':!0x0}),await Y(_0x982d83[_0x142f22(0x1bb)]),_0x56fc63=_0x14014b(_0x24e544=>U(_0x24e544,_0x3df210,_0x41ee46,{'shutdown':()=>{const _0x2f7917=_0x142f22;_0x3caab5[_0x2f7917(0x174)]()[_0x2f7917(0x1cd)](()=>{const _0x570f7a=_0x2f7917;process[_0x570f7a(0x1b4)]=0x1;});},'status':()=>G(_0x982d83[_0x142f22(0x16c)],_0x982d83[_0x142f22(0x1bb)],_0x3e3f0a)})),await new Promise((_0x3c003b,_0xe70a47)=>{const _0xac6c83=_0x142f22;let _0x2e5d64=_0x56fc63,_0x879623=_0x516555=>_0xe70a47(ae(_0x516555)?Z(_0x982d83[_0xac6c83(0x1bb)]):_0x516555);_0x2e5d64['once'](_0xac6c83(0x1cc),_0x879623),_0x2e5d64[_0xac6c83(0x1d4)](_0x982d83['socketPath'],()=>{const _0x38d324=_0xac6c83;_0x2e5d64['off'](_0x38d324(0x1cc),_0x879623),_0x1cd720=!0x0,_0x3e3f0a=new Date()[_0x38d324(0x1b3)](),_0x3c003b();});});}}};return _0x3caab5;async function _0x4aa409(){const _0x44fa54=_0x24eb51;for(let _0x1eea59 of _0x41ee46)_0x1eea59[_0x44fa54(0x18f)]();_0x41ee46['clear'](),_0x56fc63&&_0x1cd720&&await new Promise((_0x45a2d8,_0x4e752c)=>{const _0x481fe3=_0x44fa54;_0x56fc63[_0x481fe3(0x174)](_0x3fb295=>_0x3fb295?_0x4e752c(_0x3fb295):_0x45a2d8());}),_0x1cd720=!0x1;try{await _0x982d83['onShutdown']?.();}finally{await re(_0x982d83['socketPath']);}}}function U(_0x2e5010,_0x4487a6,_0x15e9e9,_0x2ef75a){const _0x37cc65=_0x134627;_0x15e9e9['add'](_0x2e5010);let _0x1a8ec9=!0x1,_0x2ddfaa=u(_0x222577=>{_0x1a8ec9||(_0x1a8ec9=!0x0,W(_0x2e5010,_0x222577,_0x4487a6,_0x2ef75a));});_0x2e5010['on']('data',_0x180bef=>_0x2ddfaa[_0x37cc65(0x1c1)](_0x180bef)),_0x2e5010['on'](_0x37cc65(0x1c4),()=>_0x2ddfaa[_0x37cc65(0x1c4)]()),_0x2e5010['on'](_0x37cc65(0x174),()=>_0x15e9e9[_0x37cc65(0x1c6)](_0x2e5010)),_0x2e5010['on'](_0x37cc65(0x1cc),()=>_0x2e5010[_0x37cc65(0x18f)]());}async function W(_0xbb5ce2,_0x3c2f45,_0x3054b5,_0x18298d){const _0xd21628=_0x134627;let _0x33c3b4=_0xd21628(0x1c5),_0x5d79a6,_0x282688=!0x1;try{let _0x42b652=K(_0x3c2f45);_0x33c3b4=_0x42b652['id'];let _0x4f2c1f;if(_0x42b652[_0xd21628(0x19e)]===_0xd21628(0x1ac)){let _0x215032=_0x18298d[_0xd21628(0x1c7)]();_0x4f2c1f={'identity':{..._0x215032['identity']['buildId']===void 0x0?{}:{'buildId':_0x215032[_0xd21628(0x16c)][_0xd21628(0x1b6)]},'id':_0x215032[_0xd21628(0x16c)]['id'],'version':_0x215032[_0xd21628(0x16c)][_0xd21628(0x17a)]},'pid':_0x215032[_0xd21628(0x1a2)],'protocolVersion':_0x215032[_0xd21628(0x1d0)],'socketPath':_0x215032[_0xd21628(0x1bb)],'startedAt':_0x215032['startedAt'],'state':_0x215032[_0xd21628(0x1d2)]};}else{if(_0x42b652['method']===_0xd21628(0x173))_0x4f2c1f=null,_0x282688=!0x0;else{let _0xa0f3dc=_0x3054b5[_0xd21628(0x1a0)](_0x42b652[_0xd21628(0x19e)]);if(!_0xa0f3dc)throw J(_0xd21628(0x192),_0xd21628(0x1a4)+_0x42b652['method']);_0x4f2c1f=await _0xa0f3dc(_0x42b652[_0xd21628(0x18c)]);}}_0x5d79a6={'id':_0x33c3b4,'result':_0x4f2c1f,'type':'result'};}catch(_0x3b9276){_0x5d79a6={'error':q(_0x3b9276),'id':_0x33c3b4,'type':_0xd21628(0x1cc)};}_0xbb5ce2[_0xd21628(0x1c4)](l(_0x5d79a6),()=>{const _0x1b0d8c=_0xd21628;_0x282688&&_0x18298d[_0x1b0d8c(0x15f)]();});}function G(_0x35505d,_0xdf44e,_0x444b18){const _0x31fad9=_0x134627;if(_0x444b18===void 0x0)throw Error(_0x31fad9(0x1da));return{'identity':_0x35505d,'pid':process[_0x31fad9(0x1a2)],'protocolVersion':0x1,'socketPath':_0xdf44e,'startedAt':_0x444b18,'state':_0x31fad9(0x1a5)};}function K(_0x527b85){const _0x4e000b=_0x134627;let _0x37ac89=JSON['parse'](_0x527b85);if(!$(_0x37ac89)||typeof _0x37ac89['id']!=_0x4e000b(0x1bc)||typeof _0x37ac89[_0x4e000b(0x19e)]!=_0x4e000b(0x1bc)||!(_0x4e000b(0x18c)in _0x37ac89))throw J(_0x4e000b(0x1c9),'Invalid\x20daemon\x20request');return _0x37ac89;}function q(_0x1c86e6){const _0x36ade5=_0x134627;if(_0x1c86e6 instanceof Error){let _0x1a08eb=_0x1c86e6[_0x36ade5(0x1aa)];return{...typeof _0x1a08eb==_0x36ade5(0x1bc)?{'code':_0x1a08eb}:{},'message':_0x1c86e6[_0x36ade5(0x1b2)],'name':_0x1c86e6[_0x36ade5(0x19f)]};}return{'message':String(_0x1c86e6),'name':_0x36ade5(0x188)};}function J(_0x5301f8,_0x4455e5){const _0x28d8f0=_0x134627;return Object[_0x28d8f0(0x169)](Error(_0x4455e5),{'code':_0x5301f8});}async function Y(_0x16c283){const _0x2b3796=_0x134627;try{if(!(await _0x788b84(_0x16c283))[_0x2b3796(0x160)]())throw Error(_0x2b3796(0x1bf)+_0x16c283);if(await X(_0x16c283))throw Z(_0x16c283);await _0x20e081(_0x16c283);}catch(_0x4bdae4){if(Q(_0x4bdae4))return;throw _0x4bdae4;}}function X(_0x3dacec){return new Promise((_0x4f399c,_0xc4002b)=>{const _0x273912=_0x4677;let _0x44cca3=_0x4036c4(_0x3dacec);_0x44cca3[_0x273912(0x1ab)](_0x273912(0x17f),()=>{const _0x1656cb=_0x273912;_0x44cca3[_0x1656cb(0x18f)](),_0x4f399c(!0x0);}),_0x44cca3['once']('error',_0xe74bd5=>{const _0x30eac3=_0x273912;_0x44cca3[_0x30eac3(0x18f)](),ie(_0xe74bd5)||Q(_0xe74bd5)?_0x4f399c(!0x1):_0xc4002b(_0xe74bd5);});});}function Z(_0x5b860b){const _0x9e6fe0=_0x134627;return Object[_0x9e6fe0(0x169)](Error(_0x9e6fe0(0x191)+_0x5b860b),{'code':'DAEMON_ALREADY_RUNNING'});}async function re(_0x4566f6){const _0xf727d=_0x134627;try{(await _0x788b84(_0x4566f6))[_0xf727d(0x160)]()&&await _0x20e081(_0x4566f6);}catch(_0x1c724d){if(!Q(_0x1c724d))throw _0x1c724d;}}function Q(_0x2fa2da){const _0x15fe10=_0x134627;return $(_0x2fa2da)&&_0x2fa2da[_0x15fe10(0x1aa)]===_0x15fe10(0x1ad);}function ie(_0x2cbc13){const _0x202fb1=_0x134627;return $(_0x2cbc13)&&_0x2cbc13['code']===_0x202fb1(0x1b0);}function ae(_0x922ec1){const _0x869d7=_0x134627;return $(_0x922ec1)&&_0x922ec1[_0x869d7(0x1aa)]===_0x869d7(0x18b);}function oe(_0x46f296){const _0x138d83=_0x134627;if(_0x46f296[_0x138d83(0x1c3)]===0x0)throw Error(_0x138d83(0x18d));}function $(_0x2f66bb){const _0x1ef578=_0x134627;return typeof _0x2f66bb==_0x1ef578(0x16d)&&!!_0x2f66bb&&!Array[_0x1ef578(0x1db)](_0x2f66bb);}export{C as DAEMON_PROTOCOL_VERSION,T as DAEMON_SHUTDOWN_METHOD,d as DAEMON_SOCKET_ENV,w as DAEMON_STATUS_METHOD,V as createDaemonClient,k as createDaemonControl,H as createDaemonServer};
|
|
1
|
+
const _0x333881=_0x26d6;(function(_0x1e8667,_0x1cfbe4){const _0x3974be=_0x26d6,_0x357cf8=_0x1e8667();while(!![]){try{const _0x192813=parseInt(_0x3974be(0x1c3))/0x1+parseInt(_0x3974be(0x1e7))/0x2*(-parseInt(_0x3974be(0x1f0))/0x3)+parseInt(_0x3974be(0x1c5))/0x4*(-parseInt(_0x3974be(0x1c4))/0x5)+parseInt(_0x3974be(0x1ce))/0x6+-parseInt(_0x3974be(0x1e2))/0x7+-parseInt(_0x3974be(0x1d7))/0x8+-parseInt(_0x3974be(0x1ef))/0x9*(-parseInt(_0x3974be(0x1b5))/0xa);if(_0x192813===_0x1cfbe4)break;else _0x357cf8['push'](_0x357cf8['shift']());}catch(_0x1d00de){_0x357cf8['push'](_0x357cf8['shift']());}}}(_0x51a8,0x3d443));import{randomUUID as _0x48e76c}from'node:crypto';import{spawn as _0x42a8a9}from'node:child_process';function _0x51a8(){const _0x211140=['clear','131105EaoZBA','15kaZqIQ','226132TuqmYJ','Daemon\x20status\x20response\x20is\x20invalid','exitCode','unknown','diagnostic','data','error','catch','method','1288842ZBCWPT','stopTimeoutMs','name','ENOTCONN','slice','stopped','options','Daemon\x20connection\x20closed\x20before\x20a\x20response\x20was\x20received','off','2909144beHVaK','Daemon\x20is\x20not\x20listening\x20on\x20','Daemon\x20method\x20','daemon.','Daemon\x20method\x20must\x20not\x20be\x20empty','incompatible','legacy-protocol','string','message','pid','invalid-health','323134FwshMq','protocol-mismatch','ECONNREFUSED','type','onShutdown','224KZnxpO','buildId','identity.buildId','\x20must\x20not\x20be\x20empty','ECONNRESET','once','push','Daemon\x20did\x20not\x20stop\x20within\x20','9VIQOhQ','1917fUMyVP','close','isSafeInteger','destroy','isArray','DAEMON_CONTROL_INVALID_RESPONSE','Daemon\x20server\x20has\x20not\x20started\x20listening','isSocket','daemon.shutdown','file:','stringify','Daemon\x20entry\x20must\x20be\x20an\x20absolute\x20file\x20URL','assign','Daemon\x20method\x20namespace\x20is\x20reserved:\x20','identity-mismatch','object','code','add','reason','requestTimeoutMs','startTimeoutMs','isNaN','version','ignore','toString','startsWith','write','version-mismatch','DAEMON_INCOMPATIBLE','actual','trim','identity','timeoutMs','build-id-mismatch','Error','set','A\x20daemon\x20is\x20already\x20listening\x20on\x20','DAEMON_CONNECTION_CLOSED','status','unreachable','running','protocolVersion','entry','socketPath','state','delete','ready','utf8','Refusing\x20to\x20replace\x20non-socket\x20path\x20','unref','daemon.status','ENOENT','Invalid\x20daemon\x20request','now','Daemon\x20is\x20not\x20ready:\x20','connect','toISOString','number','start','Invalid\x20daemon\x20response','startedAt','listen','5560070BViDby','\x20is\x20already\x20registered','isFinite','socketPath\x20must\x20not\x20be\x20empty','length','parse','payload','protocol','end','DAEMON_INVALID_REQUEST','DAEMON_METHOD_NOT_FOUND','href','result'];_0x51a8=function(){return _0x211140;};return _0x51a8();}import{connect as _0x2e03ba,createServer as _0x365daf}from'node:net';import{fileURLToPath as _0x4fb046}from'node:url';import{lstat as _0xb83add,mkdir as _0x2456d4,unlink as _0x9e2f07}from'node:fs/promises';import{dirname as _0x409e46}from'node:path';function l(_0x3832cb){const _0x254705=_0x26d6;return JSON[_0x254705(0x1fa)](_0x3832cb)+'\x0a';}function u(_0x1c55b6){let _0x531818='';return{'end'(){const _0x4f7f83=_0x26d6;_0x531818[_0x4f7f83(0x20e)]()[_0x4f7f83(0x1b9)]>0x0&&_0x1c55b6(_0x531818),_0x531818='';},'push'(_0x4e6b23){const _0x1c7d9c=_0x26d6;for(_0x531818+=_0x4e6b23[_0x1c7d9c(0x208)](_0x1c7d9c(0x21f));;){let _0x34b41f=_0x531818['indexOf']('\x0a');if(_0x34b41f<0x0)return;let _0x4542f0=_0x531818[_0x1c7d9c(0x1d2)](0x0,_0x34b41f);_0x531818=_0x531818[_0x1c7d9c(0x1d2)](_0x34b41f+0x1),_0x4542f0[_0x1c7d9c(0x20e)]()['length']>0x0&&_0x1c55b6(_0x4542f0);}}};}var d='UNIVER_CLI_SDK_DAEMON_SOCKET';async function f(_0x4284e5){const _0x420a9c=_0x26d6;_0x42a8a9(process['execPath'],[_0x4fb046(_0x4284e5[_0x420a9c(0x21a)])],{'detached':!0x0,'env':{...process.env,..._0x4284e5[_0x420a9c(0x1d4)]['env'],[d]:_0x4284e5[_0x420a9c(0x1d4)][_0x420a9c(0x21b)]},'stdio':_0x420a9c(0x207)})[_0x420a9c(0x221)]();let _0x1907e8=Date['now']();for(;Date[_0x420a9c(0x225)]()-_0x1907e8<_0x4284e5[_0x420a9c(0x210)];){try{return await _0x4284e5[_0x420a9c(0x21e)]();}catch(_0x523c0d){if(!h(_0x523c0d))throw _0x523c0d;}await new Promise(_0x5bd9a8=>setTimeout(_0x5bd9a8,0x19));}throw Object[_0x420a9c(0x1fc)](Error('Daemon\x20did\x20not\x20start\x20within\x20'+String(_0x4284e5[_0x420a9c(0x210)])+'ms'),{'code':'DAEMON_START_TIMEOUT'});}function p(_0x50f788,_0x1f72e3,_0x3c317a,_0x55d15d){return new Promise((_0x11ba18,_0x172fd7)=>{const _0x1dd93c=_0x26d6;let _0x5967b7=_0x2e03ba(_0x50f788),_0x6f0b94=_0x48e76c(),_0x59d4eb=!0x1,_0x23dc1a=setTimeout(()=>{const _0xffbf60=_0x26d6;_0x5967b7['destroy'](),_0x172fd7(Object[_0xffbf60(0x1fc)](Error('Daemon\x20request\x20timed\x20out\x20after\x20'+String(_0x55d15d)+'ms'),{'code':'DAEMON_REQUEST_TIMEOUT'}));},_0x55d15d),_0x1b80f6=_0x9cca5b=>{_0x59d4eb||(_0x59d4eb=!0x0,clearTimeout(_0x23dc1a),_0x9cca5b());},_0x5a6414=u(_0x36e1f4=>{try{let _0x18db5a=_(_0x36e1f4,_0x6f0b94);_0x1b80f6(()=>{const _0x432071=_0x26d6;_0x5967b7['end'](),_0x18db5a[_0x432071(0x1e5)]===_0x432071(0x1cb)?_0x172fd7(v(_0x18db5a[_0x432071(0x1cb)])):_0x11ba18(_0x18db5a['result']);});}catch(_0x3e4d12){_0x1b80f6(()=>{const _0x36b1e2=_0x26d6;_0x5967b7[_0x36b1e2(0x1f3)](),_0x172fd7(_0x3e4d12);});}});_0x5967b7[_0x1dd93c(0x1ec)]('error',_0x580b21=>_0x1b80f6(()=>{const _0x3cfb7d=_0x1dd93c;_0x5967b7[_0x3cfb7d(0x1f3)](),_0x172fd7(_0x580b21);})),_0x5967b7['on'](_0x1dd93c(0x1ca),_0x458cf1=>_0x5a6414[_0x1dd93c(0x1ed)](_0x458cf1)),_0x5967b7['on'](_0x1dd93c(0x1bd),()=>{const _0x322983=_0x1dd93c;_0x5a6414[_0x322983(0x1bd)](),_0x1b80f6(()=>{const _0x535608=_0x322983;_0x5967b7[_0x535608(0x1f3)](),_0x172fd7(g());});}),_0x5967b7['on'](_0x1dd93c(0x1f1),()=>_0x1b80f6(()=>{_0x5967b7['destroy'](),_0x172fd7(g());})),_0x5967b7[_0x1dd93c(0x1ec)](_0x1dd93c(0x227),()=>{const _0x335ae8=_0x1dd93c;_0x5967b7[_0x335ae8(0x20a)](l({'id':_0x6f0b94,'method':_0x1f72e3,'payload':_0x3c317a}));});});}function m(_0x1edea0){const _0x163e52=_0x26d6;let _0x68805a=_0x1edea0 instanceof URL?_0x1edea0[_0x163e52(0x1c0)]:_0x1edea0;try{let _0x585dc0=new URL(_0x68805a);if(_0x585dc0[_0x163e52(0x1bc)]!==_0x163e52(0x1f9))throw Error();return _0x585dc0['href'];}catch{throw Error(_0x163e52(0x1fb));}}function h(_0x18a542){const _0x5e23da=_0x26d6;return y(_0x18a542)?_0x18a542[_0x5e23da(0x200)]===_0x5e23da(0x223)||_0x18a542[_0x5e23da(0x200)]===_0x5e23da(0x1e4):!0x1;}function g(){const _0x7f5347=_0x26d6;return Object[_0x7f5347(0x1fc)](Error(_0x7f5347(0x1d5)),{'code':_0x7f5347(0x215)});}function _(_0x4025ef,_0xde3d1f){const _0x3bf3d3=_0x26d6;let _0xfaa7b3=JSON[_0x3bf3d3(0x1ba)](_0x4025ef);if(!y(_0xfaa7b3)||_0xfaa7b3['id']!==_0xde3d1f)throw Error('Invalid\x20daemon\x20response');if(_0xfaa7b3[_0x3bf3d3(0x1e5)]===_0x3bf3d3(0x1c1)&&_0x3bf3d3(0x1c1)in _0xfaa7b3||_0xfaa7b3[_0x3bf3d3(0x1e5)]===_0x3bf3d3(0x1cb)&&y(_0xfaa7b3[_0x3bf3d3(0x1cb)]))return _0xfaa7b3;throw Error(_0x3bf3d3(0x22b));}function v(_0x2702c3){const _0x5e2fdc=_0x26d6;let _0x3efedb=Error(_0x2702c3[_0x5e2fdc(0x1df)]);return _0x2702c3[_0x5e2fdc(0x200)]!==void 0x0&&Object[_0x5e2fdc(0x1fc)](_0x3efedb,{'code':_0x2702c3[_0x5e2fdc(0x200)]}),_0x3efedb[_0x5e2fdc(0x1d0)]=_0x2702c3[_0x5e2fdc(0x1d0)],_0x3efedb;}function y(_0x41386c){const _0x1d0ffc=_0x26d6;return typeof _0x41386c=='object'&&!!_0x41386c&&!Array[_0x1d0ffc(0x1f4)](_0x41386c);}function b(_0x188c3d){const _0x108ca7=_0x26d6;S(_0x188c3d['id'],'identity.id'),S(_0x188c3d['version'],'identity.version'),_0x188c3d[_0x108ca7(0x1e8)]!==void 0x0&&S(_0x188c3d[_0x108ca7(0x1e8)],_0x108ca7(0x1e9));}function x(_0x317a64){const _0x89d228=_0x26d6;return ee(_0x317a64)&&typeof _0x317a64['id']=='string'&&_0x317a64['id']['length']>0x0&&typeof _0x317a64[_0x89d228(0x206)]=='string'&&_0x317a64[_0x89d228(0x206)][_0x89d228(0x1b9)]>0x0&&(_0x317a64[_0x89d228(0x1e8)]===void 0x0||typeof _0x317a64['buildId']==_0x89d228(0x1de)&&_0x317a64[_0x89d228(0x1e8)][_0x89d228(0x1b9)]>0x0);}function S(_0x3784c3,_0x22506f){const _0x23bc23=_0x26d6;if(_0x3784c3[_0x23bc23(0x1b9)]===0x0)throw Error(_0x22506f+_0x23bc23(0x1ea));}function ee(_0x269b24){const _0x28cb7c=_0x26d6;return typeof _0x269b24==_0x28cb7c(0x1ff)&&!!_0x269b24&&!Array[_0x28cb7c(0x1f4)](_0x269b24);}var C=0x1,w=_0x333881(0x222),T='daemon.shutdown';function E(_0x1e2172){const _0x2773e0=_0x333881;return _0x1e2172[_0x2773e0(0x209)](_0x2773e0(0x1da));}var D=0x2710,O=0x19;function k(_0x1842e0){const _0x20af7c=_0x333881;b(_0x1842e0['identity']);let _0x154702=m(_0x1842e0[_0x20af7c(0x21a)]),_0x2c4c52=_0x1842e0[_0x20af7c(0x203)]??0x7530,_0x282b43=_0x1842e0[_0x20af7c(0x204)]??0x2710,_0x3815a2=_0x1842e0[_0x20af7c(0x1cf)]??D;z(_0x2c4c52,_0x20af7c(0x203)),z(_0x282b43,'startTimeoutMs'),z(_0x3815a2,_0x20af7c(0x1cf));let _0x5c2364=()=>({'socketPath':_0x1842e0['socketPath'],'state':_0x20af7c(0x1d3)}),_0x208360=async()=>{const _0x44d33c=_0x20af7c;try{let _0x3bf8c8=N(await p(_0x1842e0[_0x44d33c(0x21b)],w,null,_0x2c4c52),_0x1842e0[_0x44d33c(0x21b)]),_0x3e36fb=te(_0x1842e0['identity'],_0x3bf8c8);return _0x3e36fb===void 0x0?_0x3bf8c8:ne(_0x1842e0[_0x44d33c(0x20f)],_0x3bf8c8,_0x3e36fb,_0x1842e0[_0x44d33c(0x21b)]);}catch(_0x5a9d96){if(h(_0x5a9d96))return _0x5c2364();let _0xd821e6=L(_0x5a9d96);return _0xd821e6[_0x44d33c(0x200)]===_0x44d33c(0x1bf)?j(_0x1842e0[_0x44d33c(0x20f)],_0x44d33c(0x1dd),_0x1842e0[_0x44d33c(0x21b)],_0xd821e6):_0xd821e6[_0x44d33c(0x200)]===_0x44d33c(0x1f5)?j(_0x1842e0[_0x44d33c(0x20f)],_0x44d33c(0x1e1),_0x1842e0[_0x44d33c(0x21b)],_0xd821e6):{'diagnostic':_0xd821e6,'socketPath':_0x1842e0[_0x44d33c(0x21b)],'state':_0x44d33c(0x217)};}},_0x50f20a=async()=>{const _0x4507a2=_0x20af7c;let _0x2903a3=await _0x208360();if(_0x2903a3['state']===_0x4507a2(0x218))return{..._0x2903a3,'started':!0x1};if(_0x2903a3[_0x4507a2(0x21c)]!=='stopped')throw M(_0x2903a3);return{...await f({'entry':_0x154702,'options':_0x1842e0,'ready':async()=>{const _0x29e6c5=_0x4507a2;let _0x496fe9=await _0x208360();if(_0x496fe9[_0x29e6c5(0x21c)]==='stopped')throw F(_0x1842e0['socketPath']);if(_0x496fe9[_0x29e6c5(0x21c)]!==_0x29e6c5(0x218))throw M(_0x496fe9);return _0x496fe9;},'timeoutMs':_0x282b43}),'started':!0x0};},_0x5b4261=async()=>{const _0x1f655f=_0x20af7c;let _0x3416f0=await _0x208360();if(_0x3416f0[_0x1f655f(0x21c)]==='stopped')return{..._0x3416f0,'stopped':!0x1};if(_0x3416f0[_0x1f655f(0x21c)]!==_0x1f655f(0x218)&&!A(_0x3416f0))throw M(_0x3416f0);try{await p(_0x1842e0[_0x1f655f(0x21b)],T,null,_0x2c4c52);}catch(_0x37cead){if(!I(_0x37cead))throw _0x37cead;}return await P(_0x208360,_0x3815a2),{..._0x5c2364(),'stopped':!0x0};};return{async 'restart'(){const _0x3e2312=_0x20af7c;let _0x432fea=await _0x208360();if(_0x432fea[_0x3e2312(0x21c)]!==_0x3e2312(0x218)&&_0x432fea[_0x3e2312(0x21c)]!==_0x3e2312(0x1d3)&&!A(_0x432fea))throw M(_0x432fea);(_0x432fea['state']===_0x3e2312(0x218)||A(_0x432fea))&&await _0x5b4261();let _0x3b5613=await _0x50f20a(),_0x27a25a=_0x432fea[_0x3e2312(0x21c)]===_0x3e2312(0x218)?_0x432fea[_0x3e2312(0x1e0)]:A(_0x432fea)?_0x432fea[_0x3e2312(0x20d)][_0x3e2312(0x1e0)]:void 0x0;return{'identity':_0x3b5613['identity'],'pid':_0x3b5613['pid'],..._0x27a25a===void 0x0?{}:{'previousPid':_0x27a25a},'restarted':_0x432fea['state']!==_0x3e2312(0x1d3),'protocolVersion':_0x3b5613[_0x3e2312(0x219)],'socketPath':_0x3b5613['socketPath'],'startedAt':_0x3b5613[_0x3e2312(0x22c)],'state':'running'};},'start':_0x50f20a,'status':_0x208360,'stop':_0x5b4261};}function A(_0x1a35b8){const _0x451aa9=_0x333881;return _0x1a35b8[_0x451aa9(0x21c)]==='incompatible'&&_0x1a35b8['actual']!==void 0x0&&(_0x1a35b8['reason']===_0x451aa9(0x20b)||_0x1a35b8['reason']===_0x451aa9(0x211));}function te(_0x10855d,_0x516f0c){const _0x50165c=_0x333881;if(_0x516f0c[_0x50165c(0x219)]!==0x1)return _0x50165c(0x1e3);if(_0x516f0c[_0x50165c(0x20f)]['id']!==_0x10855d['id'])return _0x50165c(0x1fe);if(_0x516f0c[_0x50165c(0x20f)][_0x50165c(0x206)]!==_0x10855d[_0x50165c(0x206)])return _0x50165c(0x20b);if(_0x10855d['buildId']!==void 0x0&&_0x516f0c[_0x50165c(0x20f)]['buildId']!==_0x10855d[_0x50165c(0x1e8)])return _0x50165c(0x211);}function ne(_0x56c255,_0x1f4d3d,_0x3c307d,_0x8714da){const _0x5c852c=_0x333881;return{'actual':{'identity':_0x1f4d3d[_0x5c852c(0x20f)],'pid':_0x1f4d3d[_0x5c852c(0x1e0)],'protocolVersion':_0x1f4d3d[_0x5c852c(0x219)],'socketPath':_0x1f4d3d[_0x5c852c(0x21b)],'startedAt':_0x1f4d3d[_0x5c852c(0x22c)]},'expected':{'identity':_0x56c255,'protocolVersion':0x1},'reason':_0x3c307d,'socketPath':_0x8714da,'state':_0x5c852c(0x1dc)};}function j(_0x58226f,_0x5db83c,_0x31d747,_0xe51fad){const _0x452a9d=_0x333881;return{'diagnostic':_0xe51fad,'expected':{'identity':_0x58226f,'protocolVersion':0x1},'reason':_0x5db83c,'socketPath':_0x31d747,'state':_0x452a9d(0x1dc)};}function M(_0x1bb324){const _0x525ad4=_0x333881;let _0x4826f7=_0x1bb324[_0x525ad4(0x21c)]==='incompatible'?_0x1bb324[_0x525ad4(0x202)]:_0x1bb324[_0x525ad4(0x1c9)][_0x525ad4(0x1df)];return R(_0x1bb324[_0x525ad4(0x21c)]==='incompatible'?_0x525ad4(0x20c):'DAEMON_UNREACHABLE',_0x525ad4(0x226)+_0x4826f7);}function N(_0x4ceb32,_0x3b1956){const _0x3f0c2e=_0x333881;if(!B(_0x4ceb32)||_0x4ceb32[_0x3f0c2e(0x21c)]!==_0x3f0c2e(0x218)||_0x4ceb32['socketPath']!==_0x3b1956||!x(_0x4ceb32[_0x3f0c2e(0x20f)])||typeof _0x4ceb32[_0x3f0c2e(0x1e0)]!=_0x3f0c2e(0x229)||!Number[_0x3f0c2e(0x1f2)](_0x4ceb32[_0x3f0c2e(0x1e0)])||_0x4ceb32[_0x3f0c2e(0x1e0)]<=0x0||typeof _0x4ceb32['protocolVersion']!='number'||!Number['isSafeInteger'](_0x4ceb32['protocolVersion'])||_0x4ceb32[_0x3f0c2e(0x219)]<=0x0||typeof _0x4ceb32['startedAt']!=_0x3f0c2e(0x1de)||Number[_0x3f0c2e(0x205)](Date['parse'](_0x4ceb32[_0x3f0c2e(0x22c)])))throw R(_0x3f0c2e(0x1f5),_0x3f0c2e(0x1c6));return{'identity':_0x4ceb32[_0x3f0c2e(0x20f)],'pid':_0x4ceb32[_0x3f0c2e(0x1e0)],'protocolVersion':_0x4ceb32[_0x3f0c2e(0x219)],'socketPath':_0x3b1956,'startedAt':_0x4ceb32['startedAt'],'state':'running'};}function _0x26d6(_0x383b56,_0x4929db){_0x383b56=_0x383b56-0x1b5;const _0x51a825=_0x51a8();let _0x26d69e=_0x51a825[_0x383b56];return _0x26d69e;}async function P(_0x5338ec,_0x3552fb){const _0x5dd2f0=_0x333881;let _0x3af9cf=Date['now']();for(;Date[_0x5dd2f0(0x225)]()-_0x3af9cf<_0x3552fb;){if((await _0x5338ec())[_0x5dd2f0(0x21c)]===_0x5dd2f0(0x1d3))return;await new Promise(_0x14cd54=>setTimeout(_0x14cd54,O));}throw R('DAEMON_STOP_TIMEOUT',_0x5dd2f0(0x1ee)+String(_0x3552fb)+'ms');}function F(_0x367b2f){const _0xfe1113=_0x333881;return Object[_0xfe1113(0x1fc)](Error(_0xfe1113(0x1d8)+_0x367b2f),{'code':'ECONNREFUSED'});}function I(_0x4757dc){const _0xf2107d=_0x333881;return h(_0x4757dc)||B(_0x4757dc)&&(_0x4757dc[_0xf2107d(0x200)]==='DAEMON_CONNECTION_CLOSED'||_0x4757dc[_0xf2107d(0x200)]===_0xf2107d(0x1eb)||_0x4757dc['code']===_0xf2107d(0x1d1)||_0x4757dc[_0xf2107d(0x200)]==='EPIPE');}function L(_0x16339a){const _0x5e26d8=_0x333881;let _0x4b1e90=_0x16339a instanceof Error?_0x16339a[_0x5e26d8(0x1df)]:String(_0x16339a);return B(_0x16339a)&&typeof _0x16339a['code']=='string'?{'code':_0x16339a[_0x5e26d8(0x200)],'message':_0x4b1e90}:{'message':_0x4b1e90};}function R(_0x12de89,_0x4dd80d){const _0xb02d42=_0x333881;return Object[_0xb02d42(0x1fc)](Error(_0x4dd80d),{'code':_0x12de89});}function z(_0x143f93,_0x56bfca){const _0x433ee5=_0x333881;if(!Number[_0x433ee5(0x1b7)](_0x143f93)||_0x143f93<=0x0)throw Error(_0x56bfca+'\x20must\x20be\x20a\x20finite\x20positive\x20number');}function B(_0x24d152){const _0x14fce8=_0x333881;return typeof _0x24d152=='object'&&!!_0x24d152&&!Array[_0x14fce8(0x1f4)](_0x24d152);}function V(_0xa6ad40){const _0x256026=_0x333881;let _0x111bfb=_0xa6ad40[_0x256026(0x203)]??0x7530,_0x438c53=k(_0xa6ad40),_0x4c9a92,_0x24aa40=async()=>{const _0x145b7b=_0x256026;let _0x19a5ac=await _0x438c53[_0x145b7b(0x216)]();if(_0x19a5ac[_0x145b7b(0x21c)]===_0x145b7b(0x218))return _0x19a5ac;if(_0x19a5ac['state']!==_0x145b7b(0x1d3))throw M(_0x19a5ac);let _0x5a3a88=_0x4c9a92??=_0x438c53[_0x145b7b(0x22a)]();try{return await _0x5a3a88;}finally{_0x4c9a92===_0x5a3a88&&(_0x4c9a92=void 0x0);}};return{async 'request'(_0x4cda8a,_0x1e279f){const _0x1a7a8b=_0x256026;if(_0x4cda8a[_0x1a7a8b(0x1b9)]===0x0)throw Error('Daemon\x20method\x20must\x20not\x20be\x20empty');await _0x24aa40();try{return await p(_0xa6ad40['socketPath'],_0x4cda8a,_0x1e279f,_0x111bfb);}catch(_0x272766){if(!h(_0x272766))throw _0x272766;}return await _0x24aa40(),await p(_0xa6ad40[_0x1a7a8b(0x21b)],_0x4cda8a,_0x1e279f,_0x111bfb);}};}function H(_0x41ac3f){const _0x566f56=_0x333881;oe(_0x41ac3f[_0x566f56(0x21b)]),b(_0x41ac3f[_0x566f56(0x20f)]);let _0xecfa14=new Map(),_0x4d7fc8=new Set(),_0x33ba34,_0x84f171=!0x1,_0x19ff78,_0x592822,_0x38d902={async 'close'(){_0x19ff78??=_0x59594d(),await _0x19ff78;},'handle'(_0x431be6,_0x21ea9d){const _0x292051=_0x566f56;if(_0x84f171)throw Error('Daemon\x20handlers\x20must\x20be\x20registered\x20before\x20listen()');if(_0x431be6['length']===0x0)throw Error(_0x292051(0x1db));if(E(_0x431be6))throw Error(_0x292051(0x1fd)+_0x431be6);if(_0xecfa14['has'](_0x431be6))throw Error(_0x292051(0x1d9)+_0x431be6+_0x292051(0x1b6));_0xecfa14[_0x292051(0x213)](_0x431be6,_0x21ea9d);},async 'listen'(){const _0x480113=_0x566f56;if(!_0x84f171){if(_0x19ff78)throw Error('Daemon\x20server\x20is\x20closed');await _0x2456d4(_0x409e46(_0x41ac3f[_0x480113(0x21b)]),{'recursive':!0x0}),await Y(_0x41ac3f[_0x480113(0x21b)]),_0x33ba34=_0x365daf(_0x56cacb=>U(_0x56cacb,_0xecfa14,_0x4d7fc8,{'shutdown':()=>{const _0x16acd0=_0x480113;_0x38d902[_0x16acd0(0x1f1)]()[_0x16acd0(0x1cc)](()=>{const _0x3f9e22=_0x16acd0;process[_0x3f9e22(0x1c7)]=0x1;});},'status':()=>G(_0x41ac3f[_0x480113(0x20f)],_0x41ac3f[_0x480113(0x21b)],_0x592822)})),await new Promise((_0x514b7a,_0x49d42d)=>{const _0x45e68f=_0x480113;let _0x24b3fe=_0x33ba34,_0x4d4323=_0x27b0fe=>_0x49d42d(ae(_0x27b0fe)?Z(_0x41ac3f[_0x45e68f(0x21b)]):_0x27b0fe);_0x24b3fe[_0x45e68f(0x1ec)](_0x45e68f(0x1cb),_0x4d4323),_0x24b3fe[_0x45e68f(0x22d)](_0x41ac3f[_0x45e68f(0x21b)],()=>{const _0xeeee12=_0x45e68f;_0x24b3fe[_0xeeee12(0x1d6)](_0xeeee12(0x1cb),_0x4d4323),_0x84f171=!0x0,_0x592822=new Date()[_0xeeee12(0x228)](),_0x514b7a();});});}}};return _0x38d902;async function _0x59594d(){const _0x4c40e5=_0x566f56;for(let _0x4f0db0 of _0x4d7fc8)_0x4f0db0[_0x4c40e5(0x1f3)]();_0x4d7fc8[_0x4c40e5(0x1c2)](),_0x33ba34&&_0x84f171&&await new Promise((_0x92b732,_0x56d57b)=>{const _0x57e104=_0x4c40e5;_0x33ba34[_0x57e104(0x1f1)](_0x3d6991=>_0x3d6991?_0x56d57b(_0x3d6991):_0x92b732());}),_0x84f171=!0x1;try{await _0x41ac3f[_0x4c40e5(0x1e6)]?.();}finally{await re(_0x41ac3f[_0x4c40e5(0x21b)]);}}}function U(_0x23cd9a,_0x38208b,_0xddffcf,_0x3f1dda){const _0x500f57=_0x333881;_0xddffcf[_0x500f57(0x201)](_0x23cd9a);let _0x1cb7d8=!0x1,_0x4d7c37=u(_0x3717e8=>{_0x1cb7d8||(_0x1cb7d8=!0x0,W(_0x23cd9a,_0x3717e8,_0x38208b,_0x3f1dda));});_0x23cd9a['on'](_0x500f57(0x1ca),_0x5c5b21=>_0x4d7c37[_0x500f57(0x1ed)](_0x5c5b21)),_0x23cd9a['on'](_0x500f57(0x1bd),()=>_0x4d7c37[_0x500f57(0x1bd)]()),_0x23cd9a['on']('close',()=>_0xddffcf[_0x500f57(0x21d)](_0x23cd9a)),_0x23cd9a['on'](_0x500f57(0x1cb),()=>_0x23cd9a['destroy']());}async function W(_0x22dbdb,_0x20a5d0,_0x4ea8ce,_0x1d1d05){const _0x374c1e=_0x333881;let _0x550264=_0x374c1e(0x1c8),_0x453e57,_0x533641=!0x1;try{let _0x2f2fc4=K(_0x20a5d0);_0x550264=_0x2f2fc4['id'];let _0x66fa88;if(_0x2f2fc4['method']==='daemon.status'){let _0x12f1f2=_0x1d1d05[_0x374c1e(0x216)]();_0x66fa88={'identity':{..._0x12f1f2[_0x374c1e(0x20f)]['buildId']===void 0x0?{}:{'buildId':_0x12f1f2['identity'][_0x374c1e(0x1e8)]},'id':_0x12f1f2[_0x374c1e(0x20f)]['id'],'version':_0x12f1f2[_0x374c1e(0x20f)][_0x374c1e(0x206)]},'pid':_0x12f1f2[_0x374c1e(0x1e0)],'protocolVersion':_0x12f1f2[_0x374c1e(0x219)],'socketPath':_0x12f1f2[_0x374c1e(0x21b)],'startedAt':_0x12f1f2[_0x374c1e(0x22c)],'state':_0x12f1f2[_0x374c1e(0x21c)]};}else{if(_0x2f2fc4[_0x374c1e(0x1cd)]===_0x374c1e(0x1f8))_0x66fa88=null,_0x533641=!0x0;else{let _0x534a48=_0x4ea8ce['get'](_0x2f2fc4[_0x374c1e(0x1cd)]);if(!_0x534a48)throw J(_0x374c1e(0x1bf),'Unknown\x20daemon\x20method\x20'+_0x2f2fc4[_0x374c1e(0x1cd)]);_0x66fa88=await _0x534a48(_0x2f2fc4[_0x374c1e(0x1bb)]);}}_0x453e57={'id':_0x550264,'result':_0x66fa88,'type':_0x374c1e(0x1c1)};}catch(_0x1d1f25){_0x453e57={'error':q(_0x1d1f25),'id':_0x550264,'type':_0x374c1e(0x1cb)};}_0x22dbdb[_0x374c1e(0x1bd)](l(_0x453e57),()=>{_0x533641&&_0x1d1d05['shutdown']();});}function G(_0x265ba4,_0x396db2,_0x72f792){const _0x4b015d=_0x333881;if(_0x72f792===void 0x0)throw Error(_0x4b015d(0x1f6));return{'identity':_0x265ba4,'pid':process[_0x4b015d(0x1e0)],'protocolVersion':0x1,'socketPath':_0x396db2,'startedAt':_0x72f792,'state':_0x4b015d(0x218)};}function K(_0x3fb70d){const _0x368168=_0x333881;let _0xa0a743=JSON[_0x368168(0x1ba)](_0x3fb70d);if(!$(_0xa0a743)||typeof _0xa0a743['id']!='string'||typeof _0xa0a743[_0x368168(0x1cd)]!=_0x368168(0x1de)||!(_0x368168(0x1bb)in _0xa0a743))throw J(_0x368168(0x1be),_0x368168(0x224));return _0xa0a743;}function q(_0x1464ed){const _0x4df87e=_0x333881;if(_0x1464ed instanceof Error){let _0x53ad4b=_0x1464ed[_0x4df87e(0x200)];return{...typeof _0x53ad4b==_0x4df87e(0x1de)?{'code':_0x53ad4b}:{},'message':_0x1464ed[_0x4df87e(0x1df)],'name':_0x1464ed[_0x4df87e(0x1d0)]};}return{'message':String(_0x1464ed),'name':_0x4df87e(0x212)};}function J(_0x267751,_0x30d86c){const _0x1ea80a=_0x333881;return Object[_0x1ea80a(0x1fc)](Error(_0x30d86c),{'code':_0x267751});}async function Y(_0x61f8c4){const _0x255caf=_0x333881;try{if(!(await _0xb83add(_0x61f8c4))[_0x255caf(0x1f7)]())throw Error(_0x255caf(0x220)+_0x61f8c4);if(await X(_0x61f8c4))throw Z(_0x61f8c4);await _0x9e2f07(_0x61f8c4);}catch(_0x2a4049){if(Q(_0x2a4049))return;throw _0x2a4049;}}function X(_0x1a7c2b){return new Promise((_0x253d59,_0x1a1fd5)=>{const _0x3e191e=_0x26d6;let _0x515232=_0x2e03ba(_0x1a7c2b);_0x515232[_0x3e191e(0x1ec)](_0x3e191e(0x227),()=>{_0x515232['destroy'](),_0x253d59(!0x0);}),_0x515232[_0x3e191e(0x1ec)]('error',_0x356e4f=>{_0x515232['destroy'](),ie(_0x356e4f)||Q(_0x356e4f)?_0x253d59(!0x1):_0x1a1fd5(_0x356e4f);});});}function Z(_0x115244){const _0x36b7b3=_0x333881;return Object['assign'](Error(_0x36b7b3(0x214)+_0x115244),{'code':'DAEMON_ALREADY_RUNNING'});}async function re(_0x3d67b7){const _0x336162=_0x333881;try{(await _0xb83add(_0x3d67b7))[_0x336162(0x1f7)]()&&await _0x9e2f07(_0x3d67b7);}catch(_0x1ecef7){if(!Q(_0x1ecef7))throw _0x1ecef7;}}function Q(_0x1d4456){const _0x36d469=_0x333881;return $(_0x1d4456)&&_0x1d4456[_0x36d469(0x200)]===_0x36d469(0x223);}function ie(_0x41cbb3){const _0x3133e4=_0x333881;return $(_0x41cbb3)&&_0x41cbb3['code']===_0x3133e4(0x1e4);}function ae(_0x5f24dc){const _0xf7135b=_0x333881;return $(_0x5f24dc)&&_0x5f24dc[_0xf7135b(0x200)]==='EADDRINUSE';}function oe(_0x4b5aac){const _0x14bf7d=_0x333881;if(_0x4b5aac['length']===0x0)throw Error(_0x14bf7d(0x1b8));}function $(_0x16f6c4){const _0x331c1d=_0x333881;return typeof _0x16f6c4=='object'&&!!_0x16f6c4&&!Array[_0x331c1d(0x1f4)](_0x16f6c4);}export{C as DAEMON_PROTOCOL_VERSION,T as DAEMON_SHUTDOWN_METHOD,d as DAEMON_SOCKET_ENV,w as DAEMON_STATUS_METHOD,V as createDaemonClient,k as createDaemonControl,H as createDaemonServer};
|