@wujie-shell/core 3.0.0 → 3.0.2

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 (41) hide show
  1. package/dist/bin/wujie-shell.mjs +1 -1
  2. package/dist/src/agents/bundled-agent-skills.mjs +1 -1
  3. package/dist/src/agents/bundled-agents.mjs +1 -1
  4. package/dist/src/chat/media-archive.mjs +1 -1
  5. package/dist/src/chat/queue.mjs +1 -1
  6. package/dist/src/common/diagnostics.mjs +1 -1
  7. package/dist/src/common/logging.mjs +1 -1
  8. package/dist/src/common/runtime-logger.mjs +1 -1
  9. package/dist/src/common/user-events.mjs +1 -1
  10. package/dist/src/common/utils.mjs +1 -1
  11. package/dist/src/config/controller.mjs +1 -1
  12. package/dist/src/connectors/config-utils.mjs +1 -1
  13. package/dist/src/connectors/constants.mjs +1 -1
  14. package/dist/src/connectors/controller.mjs +1 -1
  15. package/dist/src/connectors/kdocs-cli.mjs +1 -1
  16. package/dist/src/electron/main.mjs +1 -1
  17. package/dist/src/electron/preload.mjs +1 -1
  18. package/dist/src/files/generated-files-store.mjs +1 -1
  19. package/dist/src/files/handlers.mjs +1 -1
  20. package/dist/src/gateway/chat-delta.mjs +1 -1
  21. package/dist/src/gateway/controller.mjs +1 -1
  22. package/dist/src/gateway/ws-client.mjs +1 -1
  23. package/dist/src/index.mjs +1 -1
  24. package/dist/src/log-reporting/handlers.mjs +1 -1
  25. package/dist/src/log-reporting/report-logs.mjs +1 -1
  26. package/dist/src/models/handlers.mjs +1 -1
  27. package/dist/src/preferences/store.mjs +1 -1
  28. package/dist/src/runtime/index.mjs +1 -1
  29. package/dist/src/runtime/patch-channel-plugin-runtime.mjs +1 -1
  30. package/dist/src/runtime/patch-chat-history-mixed-tool-content.mjs +1 -1
  31. package/dist/src/runtime/patch-session-store-sqlite.mjs +1 -1
  32. package/dist/src/runtime/plugin-sync.mjs +1 -1
  33. package/dist/src/sessions/agent-sessions-map-store.mjs +1 -1
  34. package/dist/src/sessions/runtime-bridge.mjs +1 -1
  35. package/dist/src/sessions/session-sqlite-store.mjs +1 -1
  36. package/dist/src/skills/import.mjs +1 -1
  37. package/dist/src/skills/market.mjs +1 -1
  38. package/dist/src/terminal/manager.mjs +1 -1
  39. package/dist/src/updates/controller.mjs +1 -1
  40. package/dist/src/updates/loader.mjs +1 -0
  41. package/package.json +4 -3
@@ -1 +1 @@
1
- (function(_0x52fe09,_0x1061fe){const _0x23ea29=_0x5b67,_0x44f0f3=_0x52fe09();while(!![]){try{const _0x2dd34e=parseInt(_0x23ea29(0x291))/0x1*(-parseInt(_0x23ea29(0x294))/0x2)+-parseInt(_0x23ea29(0x28e))/0x3+-parseInt(_0x23ea29(0x180))/0x4*(-parseInt(_0x23ea29(0x2e1))/0x5)+parseInt(_0x23ea29(0x2fd))/0x6*(parseInt(_0x23ea29(0x161))/0x7)+parseInt(_0x23ea29(0x1e5))/0x8+-parseInt(_0x23ea29(0x2cb))/0x9*(parseInt(_0x23ea29(0x282))/0xa)+parseInt(_0x23ea29(0x17e))/0xb*(-parseInt(_0x23ea29(0x31a))/0xc);if(_0x2dd34e===_0x1061fe)break;else _0x44f0f3['push'](_0x44f0f3['shift']());}catch(_0xa38f31){_0x44f0f3['push'](_0x44f0f3['shift']());}}}(_0x1e26,0x23527));import{spawn}from'node:child_process';import{randomUUID}from'node:crypto';import{mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';import{homedir}from'node:os';function _0x5b67(_0x4ccb49,_0x3e19b3){_0x4ccb49=_0x4ccb49-0x152;const _0x1e26af=_0x1e26();let _0x5b67b5=_0x1e26af[_0x4ccb49];return _0x5b67b5;}import{dirname,join}from'node:path';import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'../common/utils.mjs';import{DEFAULT_FEISHU_REGISTRATION_ENV,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS,DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS,DINGTALK_DOC_MCP_SERVER_NAME,FEISHU_DOC_CONNECTOR_PLUGIN_ID,FEISHU_REGISTRATION_ENV_URLS,KDOCS_SKILL_ID,NETEASE_MAIL_CONNECTOR_PLUGIN_ID,QQBOT_PLUGIN_ID,QQ_MAIL_CONNECTOR_PLUGIN_ID,TENCENT_DOCS_SKILL_ID,TENCENT_DOCS_TOKEN_ENV,TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,WECOM_PLUGIN_ID,WECHAT_PLUGIN_ID}from'./constants.mjs';import{applyFeishuChannelConfig,createConnectorPluginEntry,createDingtalkDocMcpServerConfig,normalizeFeishuDmPolicy,normalizeFeishuGroupPolicy,readOpenClawMcpServersFromConfig,writeOpenClawMcpServersToConfig}from'./config-utils.mjs';const KDOCS_CLI_STEP_TIMEOUT_MS=0x2bf20,KDOCS_CLI_AUTH_POLL_INTERVAL_MS=0x5dc,FEISHU_DOC_CLI_STEP_TIMEOUT_MS=0xa*0x3c*0x3e8;function safeString(_0x26f466){const _0x2514bd=_0x5b67;return typeof _0x26f466===_0x2514bd(0x267)?_0x26f466[_0x2514bd(0x186)]():'';}function findDingtalkDocMcpServer(_0x2e58de){const _0x29647a=_0x5b67,_0x38657b=asRecord(_0x2e58de[DINGTALK_DOC_MCP_SERVER_NAME]);if(Object['keys'](_0x38657b)['length']>0x0)return _0x38657b;for(const [_0x4baaa1,_0x392805]of Object['entries'](_0x2e58de)){const _0x1c2abe=asRecord(_0x392805),_0x27af99=getTrimmedString(_0x4baaa1)[_0x29647a(0x2d3)+_0x29647a(0x31c)](),_0x3159f3=getTrimmedString(_0x1c2abe[_0x29647a(0x273)])[_0x29647a(0x2d3)+_0x29647a(0x31c)]();if(_0x27af99[_0x29647a(0x274)](_0x29647a(0x1c6))||_0x27af99[_0x29647a(0x274)]('dingding')||_0x27af99['includes']('钉钉')||_0x3159f3[_0x29647a(0x274)](_0x29647a(0x1c6))||_0x3159f3[_0x29647a(0x274)](_0x29647a(0x25e)))return _0x1c2abe;}return{};}function createFeishuRegistrationClient(){const _0x4f21e3=_0x5b67,_0x20197a=FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV];if(!_0x20197a)throw new Error(_0x4f21e3(0x189)+'ted\x20Feis'+'hu\x20regis'+_0x4f21e3(0x175)+_0x4f21e3(0x21c)+DEFAULT_FEISHU_REGISTRATION_ENV);return{'baseUrl':_0x20197a,'headers':{'Content-Type':_0x4f21e3(0x16e)+'ion/x-ww'+_0x4f21e3(0x2d2)+_0x4f21e3(0x1c5)+'d'},'timeoutMs':DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS};}async function postFeishuRegistration(_0x5c68d1,_0xf821e9){const _0x3411a8=_0x5b67,_0x36125a=await fetch(_0x5c68d1['baseUrl']+(_0x3411a8(0x331)+_0x3411a8(0x227)+_0x3411a8(0x24d)+'on'),{'method':_0x3411a8(0x1f3),'headers':_0x5c68d1[_0x3411a8(0x25f)],'body':new URLSearchParams(_0xf821e9)[_0x3411a8(0x18d)](),'signal':AbortSignal[_0x3411a8(0x178)](_0x5c68d1[_0x3411a8(0x2f7)+'s'])}),_0x20421a=await _0x36125a[_0x3411a8(0x27e)]()[_0x3411a8(0x249)](()=>({}));if(!_0x36125a['ok']){const _0x37f8f6=new Error('HTTP\x20'+_0x36125a[_0x3411a8(0x2cf)]);_0x37f8f6[_0x3411a8(0x1be)+'Data']=_0x20421a;throw _0x37f8f6;}return asRecord(_0x20421a);}function _0x1e26(){const _0x53d350=['fresh','enied','pollInte','search','function','oc\x20CLI\x20s','启动成功','stdin','client_i','\x20connect','mcp','WujieAI',',请先连接','all_prox','授权码\x20is\x20r','https:','name','feishu','feishu\x20c','tokenSta','verifyTi','read','请在浏览器完成金','eCode','\x20专用应用凭据缺','飞书应用已创建,','i\x20auth\x20l','access_d','ready','catch','wecom','ctor\x20del','full','gistrati','setPlugi','--force-','请输入有效的钉钉','otRaw','EXPIRED','onfig\x20de','dated','--app-id','smtp.qq.','扫码成功','check',',请先完成\x20kd','ion_uri_','1.0.0','mer','ERROR','dingding','headers','already\x20','--domain','cliAppSe','orizatio','正在验证金山文档','data','once','string','leted','map','with\x20cod','tateDir','led','authoriz','docs-cli','open_id','\x20config\x20','wechat-l','client','url','includes','find','ecret','red','end','wujie.ai','器人绑定','deleteSk','QR_READY','ill\x20conn','json','<empty>','金山文档已连接','\x20plugin\x20','10abuJhH','channelI','企微助手\x20Bot','Channel\x20','exmail','p\x20URL','ail.qq.c','正在初始化飞书\x20','complete','飞书\x20CLI\x20执','ill\x20','ted','253431qbNsZP','lient','\x20已安装','2PaIMrS','失败,请确认\x20k','身份要求:\x20','27938biBOcl','smtp.exm','openExte','error_de','entries','http:','environm','is\x20requi','Agent','n\x20not\x20fo','token','tionUriC','HTTPS_PR','kdocs','--no-wai','dmPolicy','HTTP_PRO','id\x20is\x20re','ired','enabled','连接成功','connecti','等待飞书用户授权','qqbot','\x20doc\x20mcp','appPollC','pSecret\x20','device_c','now','-weixin','QQ\x20邮箱','验证超时','sage','mail','channel','boolean','s\x20requir','stdout','ion_uri','et\x20auth.','hint','update','ttp\x20URL\x20','slice','found','n\x20respon','init','bind','scanned','resolveS','rver','entry','ccess','apiKey','protocol','146592LFeUWt','已连接过','managedB','prototyp','status','d\x20is\x20req','begin','w-form-u','toLowerC','connecto','ethods','kill','onMode','poll','cret-std','spawn','gin\x20upda','r-log','authStat','object','cess','tion_uri','2325AEUQzP','.com','esAt','utf8','wechat-s','latest','ror:\x20','qqbot\x20ch','setMcpSe','annelCon','quired','飞书\x20CLI\x20授','飞书\x20CLI\x20应','ID\x20is\x20re','重新生成','CLI\x20用户身份','errorMes','当前客户端未内置','client_s','timer','完成应用创建','/page/sc','timeoutM','le-http','rcode','e_code:\x20','飞书\x20CLI\x20未','onfig\x20up','1380lbSVHc','ion_url','ationUri','wechat-q','e\x20or\x20dev','netease_','kdocs\x20sk','dAt','feishu\x20d','ector','n\x20update','share','飞书机器人','message','operty','expire_i','ll\x20updat','websocke','gin\x20save','Kdocs\x20CL','接失败','plugins','port\x20cli',':user','nConfig','r\x20plugin','delete','deleteMc','writeCon','41952SACYUV','footer','ase','r\x20\x22','export','cliAppId','ation_pe','channel\x20','ret\x20is\x20r','appTimer','uired','appId','Local\x20lo','open','usStarte','onnector','channels','match','ector\x20de','钉钉文档\x20Str','金山文档尚未授权','und','飞书机器人\x20Ap','/oauth/v','onSucces','login','oc-cli','com','clientSe','fig','Connecto','openId','登录成功','se.','startedA','无需重复连接','expired_','exists','ot\x20found','lePath','max','usTimer','lugin\x20de','code','deleteCh','scope_au','filter','deviceCo','expired','Invalid\x20','I\x20sessio','accounts','i:keycha','search:d','purpose','netease\x20','已扫描','Data','授权页','env','andledIn','\x20chars)','transpor','error','accountN','飞书开放平台未返','hasOwnPr','connecte','xOf','close','parse','pID\x20is\x20r','77LvbQuk','nfig\x20del','imap.qq.','verify','请在飞书开放平台','igRaw','plugin','验证失败','返回授权\x20URL','values','user_inf','needs_re','ice_code','applicat','Failed','nding','kdocs-cl','pending','山文档授权','ation_ur','tration\x20','-code','onfig','timeout','get','qq\x20mail\x20','lark-cli','SCANNED','账号\x20is\x20re','11NeVleR','docs','1300HJPuvG','keys','verifica','allow','环境不支持创建\x20','mableHtt','trim','exmail\x20c','d_auth_m','Unsuppor','腾讯文档','igSnapsh','腾讯文档\x20Key','toString','secret','or\x20plugi','equired','hannel\x20c','scriptPa','valid','set','join','isArray','\x22\x20not\x20fo','annel\x20co','ion\x20not\x20','ession\x20i','feishu_c','_id','required','Feishu\x20r','cliHostC','ve,markd','Bin','_complet','botId','Feishu\x20d','ated','eted','_doc','Entry','tencent_','pluginId','test','call','disabled','appDevic','\x20channel','qq_mail','markConf','--channe','create','stderr','rvalMs','飞书用户身份','tion_url','Spawn\x20er','cret','onfigPat','skills','--app-se','setChann','response','executab','tatus',',请重新连接','ession\x20n',',sheets,','illEntry','rlencode','dingtalk','\x20not\x20sup','account','toISOStr','的新版客户端','flow_id','skill','onFailur','\x20updated','push','assign','金山文档授权状态','飞书用户身份授权','ill\x20enab','output','正在验证飞书授权','ll\x20conne','ALL_PROX','then','appExpir','login\x20--','163\x20邮箱','groupAll','wecom\x20ch','resolve','user','appPollI','ctor\x20plu','mail\x20con','http_pro','tencent\x20','985784vdjqSo','正在检查飞书\x20C','thorizat','权状态验证超时','飞书应用创建失败','Current\x20','n?flow_i','elConfig','zationCo','sessionI','.json','企微助手\x20Sec','rnal','imap.163','POST','gin\x20dele','nfig\x20upd','docs\x20ski','ode','split','length','nodeExec','wechat','enclaw\x20c','ion\x20sess','openclaw','logout','doc_conn','ntervalM','二维码已过期,请','金山文档登录启动','deleted','interval','飞书应用创建超时','supporte','lastInde','\x20deleted','availabl','飞书\x20CLI\x20连','support@','oxy','logged\x20i','nector\x20p','行失败','权状态验证失败','feishu_d','li_user','正在进入用户授权','icy','setSkill','expiresA','https_pr','auth','process','企微助手','env:\x20','权状态不符合用户','slow_dow','clear','config','--brand','igWriteH','腾讯企业邮箱','ocs-cli\x20','omplete','indexOf','1/app/re','oc\x20conne','\x20is\x20requ','phase','用户已取消飞书机'];_0x1e26=function(){return _0x53d350;};return _0x1e26();}async function initFeishuRegistration(_0x209021){const _0x34bd4a=_0x5b67;return postFeishuRegistration(_0x209021,{'action':_0x34bd4a(0x2c2)});}async function beginFeishuRegistration(_0x4402ce){const _0x1856dd=_0x5b67;return postFeishuRegistration(_0x4402ce,{'action':_0x1856dd(0x2d1),'archetype':'Personal'+_0x1856dd(0x29c),'auth_method':_0x1856dd(0x2f3)+'ecret','request_user_info':_0x1856dd(0x26f)});}async function pollFeishuRegistration(_0x33d69f,_0x15a4a7){const _0xe21f46=_0x5b67;try{return await postFeishuRegistration(_0x33d69f,{'action':_0xe21f46(0x2d8),'device_code':_0x15a4a7});}catch(_0x1e0031){if(_0x1e0031?.[_0xe21f46(0x1be)+_0xe21f46(0x152)]&&typeof _0x1e0031[_0xe21f46(0x1be)+_0xe21f46(0x152)]===_0xe21f46(0x2de))return asRecord(_0x1e0031[_0xe21f46(0x1be)+_0xe21f46(0x152)]);throw _0x1e0031;}}function extractFeishuRegistrationAuthorizationUri(_0x24d0e0){const _0x592479=_0x5b67,_0x244ee0=getTrimmedString(_0x24d0e0[_0x592479(0x26d)+'ation_ur'+'i_comple'+'te'])||getTrimmedString(_0x24d0e0['authoriz'+'ation_ur'+'i'])||getTrimmedString(_0x24d0e0[_0x592479(0x347)+_0x592479(0x1e7)+_0x592479(0x25a)+_0x592479(0x28a)])||getTrimmedString(_0x24d0e0[_0x592479(0x347)+_0x592479(0x1e7)+_0x592479(0x2ba)])||getTrimmedString(_0x24d0e0['scope_au'+_0x592479(0x1e7)+_0x592479(0x2fe)])||getTrimmedString(_0x24d0e0['authoriz'+_0x592479(0x174)+'l']);if(_0x244ee0)return _0x244ee0;const _0x267268=getTrimmedString(_0x24d0e0[_0x592479(0x1cb)])||getTrimmedString(_0x24d0e0[_0x592479(0x347)+_0x592479(0x1e7)+'ion_flow'+_0x592479(0x19c)]);return _0x267268?FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV]+(_0x592479(0x2f6)+'ope-auth'+_0x592479(0x263)+_0x592479(0x1eb)+'d=')+encodeURIComponent(_0x267268):null;}function serializeFeishuRegistrationSession(_0x922498){const _0x52105b=_0x5b67;return{'sessionId':_0x922498[_0x52105b(0x1ee)+'d'],'verificationUriComplete':_0x922498[_0x52105b(0x182)+_0x52105b(0x29f)+_0x52105b(0x225)],'expiresAt':new Date(_0x922498[_0x52105b(0x217)+'t'])[_0x52105b(0x1c9)+'ing'](),'pollIntervalMs':_0x922498[_0x52105b(0x22e)+'rvalMs'],'status':_0x922498['status'],'errorMessage':_0x922498[_0x52105b(0x2f1)+'sage'],'purpose':_0x922498[_0x52105b(0x350)],'authorizationUri':_0x922498['authoriz'+'ationUri']};}function extractFirstUrl(_0x330c8e){const _0x31fc6e=_0x5b67,_0x120cd8=_0x330c8e[_0x31fc6e(0x32b)](/https?:\/\/[^\s"'<>]+/i);return _0x120cd8?_0x120cd8[0x0]:null;}function isKdocsAuthStatusReady(_0x1b19d2){const _0x2e4204=_0x5b67,_0x3050dd=_0x1b19d2[_0x2e4204(0x2d3)+_0x2e4204(0x31c)]();if(/not\s+login|not\s+logged|unauth|未登录|未认证|未授权|失败/[_0x2e4204(0x1ab)](_0x3050dd))return![];return/login|logged|auth|valid|success|已登录|已认证|已授权|有效|成功/[_0x2e4204(0x1ab)](_0x3050dd);}function parseFeishuDocCliJson(_0x4e403d){const _0x500274=_0x5b67,_0xcc9337=_0x4e403d[_0x500274(0x186)]();if(!_0xcc9337)return{};try{return asRecord(JSON[_0x500274(0x15f)](_0xcc9337));}catch{for(let _0x19de11=_0xcc9337['indexOf']('{');_0x19de11>=0x0;_0x19de11=_0xcc9337[_0x500274(0x226)]('{',_0x19de11+0x1)){for(let _0x3a2053=_0xcc9337[_0x500274(0x208)+_0x500274(0x15d)]('}');_0x3a2053>_0x19de11;_0x3a2053=_0xcc9337[_0x500274(0x208)+_0x500274(0x15d)]('}',_0x3a2053-0x1)){try{return asRecord(JSON[_0x500274(0x15f)](_0xcc9337[_0x500274(0x2bf)](_0x19de11,_0x3a2053+0x1)));}catch{}}}return{};}}function summarizeCliOutput(_0x290688){const _0x5c7e1f=_0x5b67,_0x3b65fc=_0x290688['trim']();if(!_0x3b65fc)return _0x5c7e1f(0x27f);return _0x3b65fc['length']>0x320?_0x3b65fc[_0x5c7e1f(0x2bf)](0x0,0x320)+'...('+_0x3b65fc[_0x5c7e1f(0x1f9)]+_0x5c7e1f(0x156):_0x3b65fc;}function extractFeishuDocCliError(_0x3caf17,_0x442812){const _0x468e35=_0x5b67,_0x17ae34=parseFeishuDocCliJson(_0x3caf17),_0x5aa508=asRecord(_0x17ae34[_0x468e35(0x158)]),_0x29e0ef=getTrimmedString(_0x5aa508['message']),_0x1da21a=getTrimmedString(_0x5aa508[_0x468e35(0x2bc)]);if(_0x29e0ef&&_0x1da21a)return _0x29e0ef+'\x0a'+_0x1da21a;if(_0x29e0ef)return _0x29e0ef;return _0x3caf17[_0x468e35(0x186)]()||_0x442812;}function getFeishuDocCliFailureMessage(_0x3e6acf,_0x277956,_0x417108){const _0x1b5adf=_0x5b67,_0x476396=_0x277956[_0x1b5adf(0x186)]()[_0x1b5adf(0x1f8)]('\x0a')[_0x1b5adf(0x2bf)](-0x8)[_0x1b5adf(0x195)]('\x0a')['trim'](),_0x555661=_0x3e6acf==='create'?'飞书开放平台应用'+'创建失败':_0x3e6acf===_0x1b5adf(0x2c3)?_0x1b5adf(0x2ed)+'用绑定失败':_0x3e6acf===_0x1b5adf(0x219)?'飞书\x20CLI\x20用'+'户授权失败':_0x1b5adf(0x2ec)+'权状态验证失败';return _0x476396?_0x555661+':\x20'+_0x476396:_0x555661+':\x20'+_0x417108;}function ensureFeishuDocCliUserStatus(_0x135c7a){const _0x1e76bc=_0x5b67,_0x53279e=parseFeishuDocCliJson(_0x135c7a),_0xc51d9b=asRecord(_0x53279e['identiti'+'es']),_0x3ff86c=asRecord(_0xc51d9b[_0x1e76bc(0x1df)]),_0x4815b0=getTrimmedString(_0x53279e['identity']),_0x397d8f=getTrimmedString(_0x53279e[_0x1e76bc(0x23f)+'tus'])||getTrimmedString(_0x3ff86c[_0x1e76bc(0x23f)+'tus']),_0x37e401=getTrimmedString(_0x3ff86c[_0x1e76bc(0x2cf)]),_0xf2f5bd=_0x3ff86c[_0x1e76bc(0x20a)+'e']===!![];if(_0x4815b0!==_0x1e76bc(0x1df)||_0x37e401&&_0x37e401!==_0x1e76bc(0x248)||Object[_0x1e76bc(0x181)](_0x3ff86c)[_0x1e76bc(0x1f9)]>0x0&&!_0xf2f5bd||_0x397d8f!==_0x1e76bc(0x193)&&_0x397d8f!==_0x1e76bc(0x16c)+_0x1e76bc(0x22c))throw new Error(_0x1e76bc(0x2ec)+_0x1e76bc(0x21d)+_0x1e76bc(0x293)+_0x135c7a[_0x1e76bc(0x186)]());}function createKdocsCliStatus(_0x3c34c5){const _0x20abea=_0x5b67;return{'sessionId':_0x3c34c5['sessionI'+'d'],'status':_0x3c34c5[_0x20abea(0x2cf)],'phase':_0x3c34c5[_0x20abea(0x22a)],'url':_0x3c34c5['url'],'message':_0x3c34c5[_0x20abea(0x30a)],'errorMessage':_0x3c34c5[_0x20abea(0x2f1)+_0x20abea(0x2b4)]};}function createFeishuDocCliStatus(_0x29288c){const _0x6157c5=_0x5b67;return{'sessionId':_0x29288c[_0x6157c5(0x1ee)+'d'],'status':_0x29288c[_0x6157c5(0x2cf)],'phase':_0x29288c[_0x6157c5(0x22a)],'url':_0x29288c[_0x6157c5(0x273)],'message':_0x29288c['message'],'errorMessage':_0x29288c[_0x6157c5(0x2f1)+_0x6157c5(0x2b4)]};}export function createConnectorController({shellConfig:_0x18e04e,configController:_0x412d46,broadcast:_0x123727,shell:_0x486fb4,getRuntimeSpawnContext:_0x580328,openClawConfigHandlers:openClawConfigHandlers={},resolveRuntimeKdocsCliCommand:_0x3e29a0,resolveRuntimeLarkCliCommand:_0x3e47f3}){const _0x24a899=_0x5b67,_0x233939=new Map(),_0x5e533b=new Map(),_0x1157d5=new Map();let _0x10fd36=null;const _0x2822e1=()=>_0x412d46['readConf'+_0x24a899(0x166)]();async function _0x3fe752(_0x446126,_0x14b277){const _0x3d6993=_0x24a899;if(typeof openClawConfigHandlers['update']===_0x3d6993(0x230))return openClawConfigHandlers[_0x3d6993(0x2bd)](_0x107ea5=>{const _0x5cfdde=_0x3d6993;for(const _0x2a8c69 of Object[_0x5cfdde(0x181)](_0x107ea5)){!Object[_0x5cfdde(0x2ce)+'e'][_0x5cfdde(0x15b)+_0x5cfdde(0x30b)][_0x5cfdde(0x1ac)](_0x446126,_0x2a8c69)&&delete _0x107ea5[_0x2a8c69];}Object[_0x5cfdde(0x1d0)](_0x107ea5,_0x446126);},_0x14b277);return typeof _0x412d46['persistC'+_0x3d6993(0x177)]===_0x3d6993(0x230)?await _0x412d46['persistC'+_0x3d6993(0x177)](_0x446126,_0x14b277):(_0x412d46[_0x3d6993(0x1b1)+_0x3d6993(0x222)+_0x3d6993(0x155)+'ternally']?.(),await _0x412d46[_0x3d6993(0x319)+_0x3d6993(0x337)](_0x446126,_0x14b277)),{'ok':!![]};}function _0x1288c2(){const _0x4f3204=_0x24a899;return join(_0x412d46[_0x4f3204(0x2c5)+_0x4f3204(0x26b)](),'feishu-d'+_0x4f3204(0x334));}function _0x112860(){const _0x2aa6c4=_0x24a899;return join(_0x1288c2(),'.opencla'+'w',_0x2aa6c4(0x1fe)+_0x2aa6c4(0x1ef));}async function _0x584b8f(_0x3bc36e={}){return _0x580328(_0x18e04e['projectR'+'oot'],_0x3bc36e);}async function _0x2fbaca(_0x3c16fe,_0x5447da){const _0x5411d6=_0x24a899,{env:_0xf29f66,runtime:_0x52457c}=await _0x584b8f({'FORCE_COLOR':'0','HOME':homedir()}),_0x310226=await _0x3e29a0(_0x52457c);return _0x123727(_0x5411d6(0x2d4)+_0x5411d6(0x2dc),{'connector':_0x5411d6(0x2a1),'phase':_0x5411d6(0x2da),'message':_0x5411d6(0x171)+'i\x20'+_0x3c16fe['join']('\x20')}),new Promise((_0x276631,_0x196c15)=>{const _0x5034f2=_0x5411d6,_0x2d8602=spawn(_0x310226[_0x5034f2(0x1bf)+_0x5034f2(0x341)],_0x3c16fe,{'cwd':homedir(),'env':_0xf29f66});let _0x1b9485='';const _0x5203d4=_0x3e0181=>{const _0x3bc71a=_0x5034f2,_0x2dc5a4=_0x3e0181[_0x3bc71a(0x18d)](_0x3bc71a(0x2e4));_0x1b9485+=_0x2dc5a4,_0x123727(_0x3bc71a(0x2d4)+_0x3bc71a(0x2dc),{'connector':_0x3bc71a(0x2a1),'phase':_0x3bc71a(0x1d4),'message':_0x2dc5a4});};_0x2d8602['stdout']['on'](_0x5034f2(0x265),_0x5203d4),_0x2d8602[_0x5034f2(0x1b4)]['on'](_0x5034f2(0x265),_0x5203d4),_0x2d8602[_0x5034f2(0x266)](_0x5034f2(0x158),_0x196c15),_0x2d8602[_0x5034f2(0x266)](_0x5034f2(0x15e),_0x41240c=>_0x276631({'code':_0x41240c,'output':_0x1b9485}));if(typeof _0x5447da===_0x5034f2(0x267))_0x2d8602[_0x5034f2(0x233)][_0x5034f2(0x278)](_0x5447da);else _0x2d8602[_0x5034f2(0x233)][_0x5034f2(0x278)]();});}async function _0xad0bd2(){const _0x43e7a1=_0x24a899,_0x365af8=await _0x2822e1(),_0x157c3d=asRecord(_0x365af8[_0x43e7a1(0x1bb)]),_0x311784=asRecord(_0x157c3d[_0x43e7a1(0x298)]),_0x58e0c2={...asRecord(_0x311784[KDOCS_SKILL_ID]),'enabled':!![]};if(typeof openClawConfigHandlers['setSkill'+_0x43e7a1(0x1a8)]===_0x43e7a1(0x230)){await openClawConfigHandlers[_0x43e7a1(0x216)+_0x43e7a1(0x1a8)]({'skillId':KDOCS_SKILL_ID,'entry':_0x58e0c2,'reason':'kdocs\x20sk'+_0x43e7a1(0x1d3)+_0x43e7a1(0x26c)});return;}_0x311784[KDOCS_SKILL_ID]=_0x58e0c2,_0x157c3d['entries']=_0x311784,_0x365af8[_0x43e7a1(0x1bb)]=_0x157c3d,await _0x3fe752(_0x365af8,_0x43e7a1(0x303)+'ill\x20enab'+_0x43e7a1(0x26c));}async function _0x68acac(_0x352bc9){const _0x2040a1=_0x24a899,_0x5a964b=await _0x2822e1(),_0x1288b3=asRecord(_0x5a964b['skills']),_0x44131e=asRecord(_0x1288b3[_0x2040a1(0x298)]),_0x5f57e9={...asRecord(_0x44131e[KDOCS_SKILL_ID]),'enabled':Boolean(_0x352bc9)};if(typeof openClawConfigHandlers[_0x2040a1(0x216)+'Entry']===_0x2040a1(0x230)){await openClawConfigHandlers[_0x2040a1(0x216)+_0x2040a1(0x1a8)]({'skillId':KDOCS_SKILL_ID,'entry':_0x5f57e9,'reason':'kdocs\x20sk'+'ill\x20'+(_0x352bc9?_0x2040a1(0x2a7):_0x2040a1(0x1ad))});return;}_0x44131e[KDOCS_SKILL_ID]=_0x5f57e9,_0x1288b3[_0x2040a1(0x298)]=_0x44131e,_0x5a964b[_0x2040a1(0x1bb)]=_0x1288b3,await _0x3fe752(_0x5a964b,_0x2040a1(0x303)+_0x2040a1(0x28c)+(_0x352bc9?_0x2040a1(0x2a7):_0x2040a1(0x1ad)));}async function _0x1a0ffd(){const _0x46df8d=_0x24a899;if(typeof openClawConfigHandlers['deleteSk'+_0x46df8d(0x1c4)]===_0x46df8d(0x230)){await openClawConfigHandlers[_0x46df8d(0x27b)+_0x46df8d(0x1c4)]({'skillId':KDOCS_SKILL_ID,'reason':'kdocs\x20sk'+'ill\x20conn'+_0x46df8d(0x32c)+_0x46df8d(0x268)});return;}const _0x3493ed=await _0x2822e1(),_0x11e67e=asRecord(_0x3493ed['skills']),_0x5419be=asRecord(_0x11e67e[_0x46df8d(0x298)]);delete _0x5419be[KDOCS_SKILL_ID],_0x11e67e[_0x46df8d(0x298)]=_0x5419be,_0x3493ed['skills']=_0x11e67e,await _0x3fe752(_0x3493ed,_0x46df8d(0x303)+_0x46df8d(0x27d)+_0x46df8d(0x32c)+_0x46df8d(0x268));}async function _0x2e6b44(){const _0x11eecf=_0x24a899;if(!await _0x28ce23())throw new Error(_0x11eecf(0x32e)+_0x11eecf(0x259)+_0x11eecf(0x224)+'连接');return await _0xad0bd2(),{'ok':!![]};}async function _0x28ce23(){const _0x29f1ea=_0x24a899,_0x2a43b7=await _0x2fbaca([_0x29f1ea(0x219),_0x29f1ea(0x2cf)])['catch'](()=>({'code':null,'output':''}));return _0x2a43b7[_0x29f1ea(0x345)]===0x0&&isKdocsAuthStatusReady(_0x2a43b7[_0x29f1ea(0x1d4)]);}async function _0x515416({appId:_0x302946,appSecret:_0x157393,userInfo:userInfo=null}){const _0x457d89=_0x24a899,_0xbcc3bd=await _0x2822e1();applyFeishuChannelConfig(_0xbcc3bd,{'appId':_0x302946,'appSecret':_0x157393,'userInfo':userInfo});const _0x3ca643=asRecord(_0xbcc3bd[_0x457d89(0x32a)]);if(typeof openClawConfigHandlers[_0x457d89(0x1bd)+_0x457d89(0x1ec)]===_0x457d89(0x230))return openClawConfigHandlers[_0x457d89(0x1bd)+_0x457d89(0x1ec)]({'channelId':_0x457d89(0x23d),'channel':asRecord(_0x3ca643[_0x457d89(0x23d)]),'pluginId':_0x457d89(0x23d),'pluginEnabled':!![],'reason':_0x457d89(0x23e)+'hannel\x20c'+'onfig\x20up'+'dated'});await _0x3fe752(_0xbcc3bd,'feishu\x20c'+_0x457d89(0x191)+_0x457d89(0x2fc)+_0x457d89(0x254));}async function _0x217a1e({appId:_0x15303b,appSecret:_0x392382,userInfo:userInfo=null,configPath:_0xc14547}){const _0x20d418=_0x24a899,_0x133d9a=getTrimmedString(userInfo?.[_0x20d418(0x339)]),_0x3d9653={'channels':{'feishu':{'enabled':![],'appId':_0x15303b,'appSecret':_0x392382,'domain':'feishu','connectionMode':_0x20d418(0x30e)+'t','requireMention':!![],'dmPolicy':_0x133d9a?'allowlis'+'t':'disabled','groupPolicy':_0x20d418(0x1ad),'streaming':!![],'allowFrom':_0x133d9a?[_0x133d9a]:[],'groupAllowFrom':[]}},'plugins':{'entries':{},'allow':[]},'tools':{'profile':_0x20d418(0x24c)}};await mkdir(dirname(_0xc14547),{'recursive':!![]}),await writeFile(_0xc14547,JSON['stringif'+'y'](_0x3d9653,null,0x2)+'\x0a',_0x20d418(0x2e4));}async function _0x3a99fc(_0x94186c={}){const _0x53297c=_0x24a899,_0x3118e8=safeString(_0x94186c[_0x53297c(0x325)]),_0x383ef5=safeString(_0x94186c['appSecre'+'t']);if(!_0x3118e8)throw new Error(_0x53297c(0x330)+_0x53297c(0x160)+'equired');if(!_0x383ef5)throw new Error(_0x53297c(0x330)+_0x53297c(0x2ae)+_0x53297c(0x29b)+_0x53297c(0x277));return await _0x515416({'appId':_0x3118e8,'appSecret':_0x383ef5,'userInfo':null}),{'ok':!![]};}async function _0x311af6(_0x1c9d8a={}){const _0x8ef5e=_0x24a899,_0x31ef3b=safeString(_0x1c9d8a['appId']),_0x506432=safeString(_0x1c9d8a['clientSe'+_0x8ef5e(0x1b9)]);if(!_0x31ef3b)throw new Error('QQ机器人\x20Ap'+_0x8ef5e(0x160)+_0x8ef5e(0x190));if(!_0x506432)throw new Error('QQ机器人\x20Ap'+_0x8ef5e(0x2ae)+_0x8ef5e(0x29b)+_0x8ef5e(0x277));const _0x461c2f=await _0x2822e1(),_0x533c8d=asRecord(_0x461c2f[_0x8ef5e(0x32a)]),_0x14ba09=asRecord(_0x533c8d[_0x8ef5e(0x2ab)]),_0x2cd4b5={'enabled':typeof _0x14ba09['enabled']==='boolean'?_0x14ba09[_0x8ef5e(0x2a7)]:!![],'allowFrom':['*'],'appId':_0x31ef3b,'clientSecret':_0x506432};if(typeof openClawConfigHandlers['setChann'+_0x8ef5e(0x1ec)]==='function')return openClawConfigHandlers[_0x8ef5e(0x1bd)+'elConfig']({'channelId':_0x8ef5e(0x2ab),'channel':_0x2cd4b5,'pluginId':QQBOT_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x8ef5e(0x2e8)+_0x8ef5e(0x198)+'nfig\x20upd'+'ated'});_0x533c8d['qqbot']=_0x2cd4b5,_0x461c2f['channels']=_0x533c8d;const _0x5d69a5=asRecord(_0x461c2f[_0x8ef5e(0x312)]),_0x24ccec=asRecord(_0x5d69a5[_0x8ef5e(0x298)]);return _0x24ccec[QQBOT_PLUGIN_ID]={...asRecord(_0x24ccec[QQBOT_PLUGIN_ID]),'enabled':!![]},_0x5d69a5[_0x8ef5e(0x298)]=_0x24ccec,_0x5d69a5[_0x8ef5e(0x183)]=dedupeStrings([...asStringArray(_0x5d69a5[_0x8ef5e(0x183)]),QQBOT_PLUGIN_ID]),_0x461c2f[_0x8ef5e(0x312)]=_0x5d69a5,await _0x3fe752(_0x461c2f,_0x8ef5e(0x2e8)+_0x8ef5e(0x198)+_0x8ef5e(0x1f5)+_0x8ef5e(0x1a5)),{'ok':!![]};}async function _0x53d4e6(_0x51d209={}){const _0x5a7144=_0x24a899,_0x3619de=safeString(_0x51d209[_0x5a7144(0x1a3)]),_0xf968f6=safeString(_0x51d209[_0x5a7144(0x18e)]);if(!_0x3619de)throw new Error(_0x5a7144(0x284)+_0x5a7144(0x2ee)+_0x5a7144(0x2eb));if(!_0xf968f6)throw new Error(_0x5a7144(0x1f0)+_0x5a7144(0x322)+_0x5a7144(0x190));const _0x731aa5=await _0x2822e1(),_0x2d0970=asRecord(_0x731aa5[_0x5a7144(0x32a)]),_0x4658df=asRecord(_0x2d0970[_0x5a7144(0x24a)]),_0x5349e1={..._0x4658df,'enabled':typeof _0x4658df['enabled']===_0x5a7144(0x2b7)?_0x4658df['enabled']:!![],'name':getTrimmedString(_0x4658df[_0x5a7144(0x23c)])||_0x5a7144(0x21b),'connectionMode':getTrimmedString(_0x4658df[_0x5a7144(0x2a9)+_0x5a7144(0x2d7)])||_0x5a7144(0x30e)+'t','dmPolicy':normalizeFeishuDmPolicy(_0x4658df[_0x5a7144(0x2a3)])??_0x5a7144(0x327),'groupPolicy':normalizeFeishuGroupPolicy(_0x4658df['groupPol'+_0x5a7144(0x215)])??'open','allowFrom':asStringArray(_0x4658df['allowFro'+'m']),'groupAllowFrom':asStringArray(_0x4658df[_0x5a7144(0x1dc)+'owFrom']),'botId':_0x3619de,'secret':_0xf968f6};if(typeof openClawConfigHandlers[_0x5a7144(0x1bd)+_0x5a7144(0x1ec)]===_0x5a7144(0x230))return openClawConfigHandlers[_0x5a7144(0x1bd)+_0x5a7144(0x1ec)]({'channelId':'wecom','channel':_0x5349e1,'pluginId':WECOM_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x5a7144(0x1dd)+_0x5a7144(0x198)+_0x5a7144(0x1f5)+_0x5a7144(0x1a5)});_0x2d0970['wecom']=_0x5349e1,_0x731aa5[_0x5a7144(0x32a)]=_0x2d0970;const _0x4847ec=asRecord(_0x731aa5[_0x5a7144(0x312)]),_0x1b7c1e=asRecord(_0x4847ec[_0x5a7144(0x298)]);return _0x1b7c1e[WECOM_PLUGIN_ID]={...asRecord(_0x1b7c1e[WECOM_PLUGIN_ID]),'enabled':!![]},_0x4847ec[_0x5a7144(0x298)]=_0x1b7c1e,_0x4847ec[_0x5a7144(0x183)]=dedupeStrings([...asStringArray(_0x4847ec[_0x5a7144(0x183)]),WECOM_PLUGIN_ID]),_0x731aa5[_0x5a7144(0x312)]=_0x4847ec,await _0x3fe752(_0x731aa5,'wecom\x20ch'+'annel\x20co'+_0x5a7144(0x1f5)+_0x5a7144(0x1a5)),{'ok':!![]};}async function _0x3562d3(_0x21243e,_0x25c5a4,_0x46e299,_0x560504){const _0x467b95=_0x24a899,_0xd79549=safeString(_0x25c5a4[_0x467b95(0x1c8)]),_0x4e28b5=String(_0x25c5a4[_0x467b95(0x26d)+'ationCod'+'e']||'')['replace'](/\s+/g,'');if(!_0xd79549)throw new Error(_0x560504+(_0x467b95(0x17d)+'quired'));if(!_0x4e28b5)throw new Error(_0x560504+(_0x467b95(0x23a)+'equired'));const _0x37786d=await _0x2822e1(),_0x409e7e=asRecord(_0x37786d[_0x467b95(0x312)]),_0x76f0fc=asRecord(_0x409e7e[_0x467b95(0x298)]),_0x1528af=createConnectorPluginEntry(_0x21243e,_0x76f0fc[_0x21243e],!![],{'account':_0xd79549,'authorizationCode':_0x4e28b5,..._0x46e299});if(typeof openClawConfigHandlers[_0x467b95(0x24e)+_0x467b95(0x315)]===_0x467b95(0x230))return openClawConfigHandlers[_0x467b95(0x24e)+_0x467b95(0x315)]({'pluginId':_0x21243e,'enabled':!![],'config':asRecord(_0x1528af['config']),'reason':_0x21243e+(_0x467b95(0x235)+_0x467b95(0x18f)+'n\x20update'+'d')});return _0x76f0fc[_0x21243e]=_0x1528af,_0x409e7e[_0x467b95(0x298)]=_0x76f0fc,_0x409e7e[_0x467b95(0x183)]=dedupeStrings([...asStringArray(_0x409e7e[_0x467b95(0x183)]),_0x21243e]),_0x37786d['plugins']=_0x409e7e,await _0x3fe752(_0x37786d,_0x21243e+('\x20connect'+_0x467b95(0x18f)+_0x467b95(0x307)+'d')),{'ok':!![]};}const _0x2f179d=_0x3beada=>_0x3562d3(QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x3beada,{'imapHost':_0x24a899(0x163)+_0x24a899(0x335),'imapPort':0x3e1,'smtpHost':_0x24a899(0x256)+'com','smtpPort':0x1d1,'secure':!![]},_0x24a899(0x2b2)),_0x4fda1e=_0x2f48d4=>_0x3562d3(NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x2f48d4,{'imapHost':_0x24a899(0x1f2)+_0x24a899(0x2e2),'imapPort':0x3e1,'smtpHost':'smtp.163'+_0x24a899(0x2e2),'smtpPort':0x1d1,'imapClientName':_0x24a899(0x237),'imapClientVersion':_0x24a899(0x25b),'imapClientVendor':_0x24a899(0x237),'imapClientSupportEmail':_0x24a899(0x20c)+_0x24a899(0x279),'secure':!![]},_0x24a899(0x1db)),_0x231841=_0x3e75c2=>_0x3562d3(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x3e75c2,{'imapHost':'imap.exm'+_0x24a899(0x288)+'om','imapPort':0x3e1,'smtpHost':_0x24a899(0x295)+_0x24a899(0x288)+'om','smtpPort':0x1d1,'secure':!![]},_0x24a899(0x223));async function _0x4fde7e(_0x26fdfa={}){const _0x5575ae=_0x24a899,_0x176e2a=safeString(_0x26fdfa[_0x5575ae(0x159)+'ame'])||_0x5575ae(0x1b6),_0x17c931=await _0x2822e1(),_0x59124f=asRecord(_0x17c931['plugins']),_0x5bcbf2=asRecord(_0x59124f[_0x5575ae(0x298)]),_0xab28ec=createConnectorPluginEntry(FEISHU_DOC_CONNECTOR_PLUGIN_ID,_0x5bcbf2[FEISHU_DOC_CONNECTOR_PLUGIN_ID],!![],{'authMode':_0x5575ae(0x1df),'accountName':_0x176e2a});if(typeof openClawConfigHandlers['setPlugi'+_0x5575ae(0x315)]==='function')return openClawConfigHandlers[_0x5575ae(0x24e)+_0x5575ae(0x315)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':!![],'config':asRecord(_0xab28ec['config']),'reason':_0x5575ae(0x305)+'oc\x20conne'+'ctor\x20plu'+_0x5575ae(0x2db)+_0x5575ae(0x28d)});return _0x5bcbf2[FEISHU_DOC_CONNECTOR_PLUGIN_ID]=_0xab28ec,_0x59124f[_0x5575ae(0x298)]=_0x5bcbf2,_0x59124f[_0x5575ae(0x183)]=dedupeStrings([...asStringArray(_0x59124f[_0x5575ae(0x183)]),FEISHU_DOC_CONNECTOR_PLUGIN_ID]),_0x17c931['plugins']=_0x59124f,await _0x3fe752(_0x17c931,'feishu\x20d'+'oc\x20conne'+_0x5575ae(0x1e1)+_0x5575ae(0x2db)+_0x5575ae(0x28d)),{'ok':!![]};}async function _0x1dc7c8(_0x5e4b0e={}){const _0x5d70e2=_0x24a899,_0x20a724=safeString(_0x5e4b0e[_0x5d70e2(0x2c9)]);if(!_0x20a724)throw new Error(_0x5d70e2(0x18c)+_0x5d70e2(0x229)+_0x5d70e2(0x2a6));const _0x4176d0=await _0x2822e1(),_0x47abcf=asRecord(_0x4176d0[_0x5d70e2(0x1bb)]),_0x3f3251=asRecord(_0x47abcf['entries']),_0x55af99=asRecord(_0x3f3251[TENCENT_DOCS_SKILL_ID]),_0x44a3c2={..._0x55af99,'enabled':!![],'env':{...asRecord(_0x55af99[_0x5d70e2(0x154)]),[TENCENT_DOCS_TOKEN_ENV]:_0x20a724}};if(typeof openClawConfigHandlers[_0x5d70e2(0x216)+_0x5d70e2(0x1a8)]===_0x5d70e2(0x230))return openClawConfigHandlers[_0x5d70e2(0x216)+_0x5d70e2(0x1a8)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':_0x44a3c2,'reason':'tencent\x20'+'docs\x20ski'+'ll\x20updat'+'ed'});return _0x3f3251[TENCENT_DOCS_SKILL_ID]=_0x44a3c2,_0x47abcf[_0x5d70e2(0x298)]=_0x3f3251,_0x4176d0[_0x5d70e2(0x1bb)]=_0x47abcf,await _0x3fe752(_0x4176d0,_0x5d70e2(0x1e4)+_0x5d70e2(0x1f6)+_0x5d70e2(0x30d)+'ed'),{'ok':!![]};}async function _0x3603d3(_0x2fbdb1={}){const _0x1b22f7=_0x24a899,_0x446ac3=safeString(_0x2fbdb1[_0x1b22f7(0x273)]);if(!_0x446ac3)throw new Error(_0x1b22f7(0x32d)+'eamableH'+_0x1b22f7(0x2be)+_0x1b22f7(0x29b)+_0x1b22f7(0x277));try{const _0xd4f71d=new URL(_0x446ac3);if(![_0x1b22f7(0x299),_0x1b22f7(0x23b)][_0x1b22f7(0x274)](_0xd4f71d[_0x1b22f7(0x2ca)]))throw new Error(_0x1b22f7(0x34b)+_0x1b22f7(0x2ca));}catch{throw new Error(_0x1b22f7(0x250)+'文档\x20Strea'+_0x1b22f7(0x185)+_0x1b22f7(0x287));}if(typeof openClawConfigHandlers[_0x1b22f7(0x2e9)+_0x1b22f7(0x2c6)]===_0x1b22f7(0x230))return openClawConfigHandlers[_0x1b22f7(0x2e9)+_0x1b22f7(0x2c6)]({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'server':createDingtalkDocMcpServerConfig(_0x446ac3),'reason':_0x1b22f7(0x1c6)+_0x1b22f7(0x2ac)+'\x20updated'});const _0x500343=await _0x2822e1(),_0x1f0757=readOpenClawMcpServersFromConfig(_0x500343);return _0x1f0757[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x446ac3),writeOpenClawMcpServersToConfig(_0x500343,_0x1f0757),await _0x3fe752(_0x500343,_0x1b22f7(0x1c6)+_0x1b22f7(0x2ac)+_0x1b22f7(0x1ce)),{'ok':!![]};}async function _0x2f3f6f(){const _0x4ccfd1=_0x24a899,_0x240eb3=await _0x2822e1(),_0x19be1c=asRecord(_0x240eb3[_0x4ccfd1(0x312)]),_0x44e563=asRecord(_0x19be1c[_0x4ccfd1(0x298)]),_0x365005=asRecord(_0x240eb3[_0x4ccfd1(0x1bb)]),_0x4684d7=asRecord(_0x365005[_0x4ccfd1(0x298)]),_0x4c6440={},_0x392588=_0x4e15b4=>{const _0xe7029=_0x4ccfd1,_0x3fe3c5=asRecord(_0x44e563[_0x4e15b4]);return{'entry':_0x3fe3c5,'config':asRecord(_0x3fe3c5[_0xe7029(0x220)])};},_0x9b6976=(_0x38e94f,_0x46dfb8,_0x494ef2)=>{const _0xf4bbdf=_0x4ccfd1,{entry:_0x37c124,config:_0x44dea0}=_0x392588(_0x46dfb8),_0x4c2b25=getTrimmedString(_0x44dea0[_0xf4bbdf(0x1c8)]);if(!_0x4c2b25)return;_0x4c6440[_0x38e94f]={'provider':_0x38e94f,'sourceType':_0xf4bbdf(0x167),'adapter':_0x46dfb8,'enabled':_0x37c124[_0xf4bbdf(0x2a7)]!==![]&&_0x44dea0[_0xf4bbdf(0x2a7)]!==![],'account':_0x4c2b25,'credentialRef':_0x46dfb8+(':authori'+_0xf4bbdf(0x1ed)+'de'),'name':_0x494ef2};};_0x9b6976(_0x4ccfd1(0x1b0),QQ_MAIL_CONNECTOR_PLUGIN_ID,'QQ\x20邮箱'),_0x9b6976(_0x4ccfd1(0x302)+'mail',NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x4ccfd1(0x1db)),_0x9b6976('tencent_'+_0x4ccfd1(0x286),TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x4ccfd1(0x223));const _0x5806ca=_0x392588(FEISHU_DOC_CONNECTOR_PLUGIN_ID),_0x4f376f=getTrimmedString(_0x5806ca[_0x4ccfd1(0x220)]['accountN'+'ame']);_0x4f376f&&(_0x4c6440[_0x4ccfd1(0x23d)]={'provider':_0x4ccfd1(0x23d),'sourceType':_0x4ccfd1(0x17b),'adapter':_0x4ccfd1(0x19b)+_0x4ccfd1(0x213),'enabled':_0x5806ca[_0x4ccfd1(0x2c7)][_0x4ccfd1(0x2a7)]!==![]&&_0x5806ca[_0x4ccfd1(0x220)][_0x4ccfd1(0x2a7)]!==![],'authMode':_0x4ccfd1(0x1df),'accountName':_0x4f376f,'account':_0x4f376f,'credentialRef':FEISHU_DOC_CONNECTOR_PLUGIN_ID+_0x4ccfd1(0x314),'capabilities':[_0x4ccfd1(0x2e6),_0x4ccfd1(0x22f),_0x4ccfd1(0x1b3),_0x4ccfd1(0x241),_0x4ccfd1(0x2bd),'delete',_0x4ccfd1(0x31e)]});const _0x3e9174=asRecord(_0x4684d7[TENCENT_DOCS_SKILL_ID]),_0x1e2a1d=asRecord(_0x3e9174['env']),_0x4d9968=getTrimmedString(_0x1e2a1d[TENCENT_DOCS_TOKEN_ENV]);_0x4d9968&&(_0x4c6440[_0x4ccfd1(0x1a9)+_0x4ccfd1(0x17f)]={'provider':_0x4ccfd1(0x1a9)+_0x4ccfd1(0x17f),'sourceType':_0x4ccfd1(0x1cc),'adapter':TENCENT_DOCS_SKILL_ID,'enabled':_0x3e9174[_0x4ccfd1(0x2a7)]!==![],'account':_0x4ccfd1(0x18a),'credentialRef':TENCENT_DOCS_SKILL_ID+':'+TENCENT_DOCS_TOKEN_ENV,'capabilities':[_0x4ccfd1(0x1b3),'read',_0x4ccfd1(0x2bd),_0x4ccfd1(0x317),'import',_0x4ccfd1(0x31e),'ocr']});const _0x1e7a1d=asRecord(_0x4684d7[KDOCS_SKILL_ID]);Object['keys'](_0x1e7a1d)[_0x4ccfd1(0x1f9)]>0x0&&await _0x28ce23()&&(_0x4c6440['kdocs']={'provider':_0x4ccfd1(0x2a1),'sourceType':_0x4ccfd1(0x1cc),'adapter':KDOCS_SKILL_ID,'enabled':_0x1e7a1d['enabled']!==![],'account':'金山文档','credentialRef':_0x4ccfd1(0x171)+_0x4ccfd1(0x34e)+'in','capabilities':['create',_0x4ccfd1(0x241),_0x4ccfd1(0x2bd),_0x4ccfd1(0x22f),_0x4ccfd1(0x308),'import','export']});const _0x557e34=readOpenClawMcpServersFromConfig(_0x240eb3),_0x3aa0a6=findDingtalkDocMcpServer(_0x557e34),_0x23099d=getTrimmedString(_0x3aa0a6[_0x4ccfd1(0x273)]);return _0x23099d&&(_0x4c6440[_0x4ccfd1(0x1c6)+_0x4ccfd1(0x1a7)]={'provider':_0x4ccfd1(0x1c6)+_0x4ccfd1(0x1a7),'sourceType':_0x4ccfd1(0x236),'adapter':DINGTALK_DOC_MCP_SERVER_NAME,'enabled':_0x3aa0a6['enabled']!==![],'url':_0x23099d,'transport':getTrimmedString(_0x3aa0a6[_0x4ccfd1(0x157)+'t'])||'streamab'+_0x4ccfd1(0x2f8)}),_0x4c6440;}async function _0x404ef6(){const _0x2ef23b=_0x24a899,_0x313709=await _0x412d46['readConf'+_0x2ef23b(0x18b)+_0x2ef23b(0x251)]();return{..._0x313709,'connectors':{...asRecord(_0x313709['connecto'+'rs']),...await _0x2f3f6f()}};}function _0x1026ae(_0x4cc1eb){const _0x11d1f3=_0x24a899;if(!_0x4cc1eb[_0x11d1f3(0x240)+_0x11d1f3(0x25c)])return;clearTimeout(_0x4cc1eb[_0x11d1f3(0x240)+_0x11d1f3(0x25c)]),_0x4cc1eb[_0x11d1f3(0x240)+_0x11d1f3(0x25c)]=null;}function _0xb5fb2f(_0x350e75,_0x133de1=KDOCS_CLI_AUTH_POLL_INTERVAL_MS){const _0xb22744=_0x24a899;if(_0x350e75['status']!=='pending')return;_0x1026ae(_0x350e75),_0x350e75[_0xb22744(0x240)+_0xb22744(0x25c)]=setTimeout(()=>void _0x3297f3(_0x350e75),_0x133de1);}async function _0x3297f3(_0x4c8e47){const _0x286878=_0x24a899;if(_0x4c8e47[_0x286878(0x2cf)]!==_0x286878(0x172))return;_0x4c8e47[_0x286878(0x22a)]=_0x286878(0x164),_0x4c8e47[_0x286878(0x30a)]=_0x286878(0x264)+'授权状态';try{const _0x3d4862=await _0x2fbaca(['auth',_0x286878(0x2cf)]);_0x4c8e47[_0x286878(0x1d4)]=_0x3d4862[_0x286878(0x1d4)];if(_0x3d4862[_0x286878(0x345)]===0x0&&isKdocsAuthStatusReady(_0x3d4862[_0x286878(0x1d4)])){_0x1026ae(_0x4c8e47),await _0xad0bd2(),_0x4c8e47[_0x286878(0x22a)]='complete'+'d',_0x4c8e47[_0x286878(0x2cf)]=_0x286878(0x28a)+'d',_0x4c8e47['message']=_0x286878(0x280);return;}if(Date['now']()-_0x4c8e47[_0x286878(0x33c)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x4c8e47[_0x286878(0x2cf)]='error',_0x4c8e47[_0x286878(0x2f1)+_0x286878(0x2b4)]=_0x286878(0x1d1)+_0x286878(0x2b3);return;}_0xb5fb2f(_0x4c8e47);}catch(_0x579a49){if(Date[_0x286878(0x2b0)]()-_0x4c8e47['startedA'+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x4c8e47[_0x286878(0x2cf)]=_0x286878(0x158),_0x4c8e47[_0x286878(0x2f1)+_0x286878(0x2b4)]=_0x579a49 instanceof Error?_0x579a49[_0x286878(0x30a)]:'金山文档授权状态'+_0x286878(0x168);return;}_0xb5fb2f(_0x4c8e47);}}async function _0x2b3ba9(){const _0x301116=_0x24a899,_0x30d724=randomUUID(),_0x2d3b38={'sessionId':_0x30d724,'status':'pending','phase':_0x301116(0x258),'url':null,'message':'正在启动金山文档'+'登录','errorMessage':null,'output':'','process':null,'verifyTimer':null,'startedAt':Date[_0x301116(0x2b0)]()};return _0x233939['set'](_0x30d724,_0x2d3b38),void _0x584b8f({'FORCE_COLOR':'0','HOME':homedir()})[_0x301116(0x1d8)](async({env:_0x1eba4c,runtime:_0x44c239})=>{const _0x883cbb=_0x301116,_0x219d6a=await _0x3e29a0(_0x44c239);_0x123727('connecto'+'r-log',{'connector':_0x883cbb(0x2a1),'phase':_0x883cbb(0x2da),'message':_0x883cbb(0x171)+_0x883cbb(0x246)+'ogin'});const _0x1d80a2=spawn(_0x219d6a['executab'+_0x883cbb(0x341)],[_0x883cbb(0x219),_0x883cbb(0x333)],{'cwd':homedir(),'env':_0x1eba4c});_0x2d3b38['process']=_0x1d80a2;const _0xf805=setTimeout(()=>{const _0x491aca=_0x883cbb;if(_0x2d3b38['status']!=='pending')return;_0x1d80a2[_0x491aca(0x2d6)](),_0x2d3b38[_0x491aca(0x2cf)]=_0x491aca(0x158),_0x2d3b38[_0x491aca(0x2f1)+_0x491aca(0x2b4)]=_0x491aca(0x203)+'超时',_0x2d3b38['process']=null;},KDOCS_CLI_STEP_TIMEOUT_MS),_0x538227=_0x632d6b=>{const _0x1cf3fd=_0x883cbb,_0x55bb3f=_0x632d6b[_0x1cf3fd(0x18d)](_0x1cf3fd(0x2e4));_0x2d3b38[_0x1cf3fd(0x1d4)]+=_0x55bb3f,_0x123727(_0x1cf3fd(0x2d4)+_0x1cf3fd(0x2dc),{'connector':_0x1cf3fd(0x2a1),'phase':'output','message':_0x55bb3f});const _0x2272d0=extractFirstUrl(_0x2d3b38[_0x1cf3fd(0x1d4)]);_0x2272d0&&!_0x2d3b38[_0x1cf3fd(0x273)]&&(_0x2d3b38['url']=_0x2272d0,_0x2d3b38[_0x1cf3fd(0x22a)]=_0x1cf3fd(0x219),_0x2d3b38[_0x1cf3fd(0x30a)]=_0x1cf3fd(0x242)+_0x1cf3fd(0x173),_0xb5fb2f(_0x2d3b38,0x1f4),void _0x486fb4[_0x1cf3fd(0x296)+'rnal'](_0x2272d0)[_0x1cf3fd(0x249)](()=>{}));};_0x1d80a2[_0x883cbb(0x2b9)]['on'](_0x883cbb(0x265),_0x538227),_0x1d80a2['stderr']['on'](_0x883cbb(0x265),_0x538227),_0x1d80a2[_0x883cbb(0x233)]['end'](),_0x1d80a2[_0x883cbb(0x266)](_0x883cbb(0x158),_0x41e32d=>{const _0x209fa1=_0x883cbb;clearTimeout(_0xf805),_0x2d3b38[_0x209fa1(0x2cf)]=_0x209fa1(0x158),_0x2d3b38[_0x209fa1(0x2f1)+_0x209fa1(0x2b4)]=_0x41e32d instanceof Error?_0x41e32d[_0x209fa1(0x30a)]:_0x209fa1(0x203)+_0x209fa1(0x292)+_0x209fa1(0x26e)+_0x209fa1(0x290),_0x2d3b38[_0x209fa1(0x21a)]=null,_0x123727(_0x209fa1(0x2d4)+'r-log',{'connector':_0x209fa1(0x2a1),'phase':'error','message':_0x2d3b38['errorMes'+_0x209fa1(0x2b4)]});}),_0x1d80a2[_0x883cbb(0x266)](_0x883cbb(0x15e),_0x9d2a0f=>{const _0x52b65f=_0x883cbb;clearTimeout(_0xf805),_0x2d3b38[_0x52b65f(0x21a)]=null;if(_0x2d3b38['status']!==_0x52b65f(0x172))return;const _0x4b67b4=extractFirstUrl(_0x2d3b38[_0x52b65f(0x1d4)]);if(_0x4b67b4&&!_0x2d3b38[_0x52b65f(0x273)]){_0x2d3b38[_0x52b65f(0x273)]=_0x4b67b4,_0x2d3b38['phase']='auth',_0x2d3b38[_0x52b65f(0x30a)]=_0x52b65f(0x242)+_0x52b65f(0x173),_0xb5fb2f(_0x2d3b38,0x1f4);return;}if(_0x9d2a0f!==0x0){_0x2d3b38['status']=_0x52b65f(0x158),_0x2d3b38['errorMes'+'sage']=_0x2d3b38[_0x52b65f(0x1d4)][_0x52b65f(0x186)]()||'金山文档登录启动'+_0x52b65f(0x292)+_0x52b65f(0x26e)+_0x52b65f(0x290),_0x123727(_0x52b65f(0x2d4)+_0x52b65f(0x2dc),{'connector':_0x52b65f(0x2a1),'phase':_0x52b65f(0x158),'message':_0x2d3b38[_0x52b65f(0x2f1)+_0x52b65f(0x2b4)]});return;}_0x2d3b38[_0x52b65f(0x22a)]='verify',_0x2d3b38[_0x52b65f(0x30a)]='正在验证金山文档'+'授权状态',_0xb5fb2f(_0x2d3b38,0x1f4);});})[_0x301116(0x249)](_0x5b871d=>{const _0x28055c=_0x301116;_0x2d3b38[_0x28055c(0x2cf)]=_0x28055c(0x158),_0x2d3b38['errorMes'+_0x28055c(0x2b4)]=_0x5b871d instanceof Error?_0x5b871d['message']:_0x28055c(0x203)+_0x28055c(0x292)+_0x28055c(0x26e)+_0x28055c(0x290),_0x123727(_0x28055c(0x2d4)+'r-log',{'connector':_0x28055c(0x2a1),'phase':_0x28055c(0x158),'message':_0x2d3b38[_0x28055c(0x2f1)+_0x28055c(0x2b4)]});}),createKdocsCliStatus(_0x2d3b38);}function _0xc233bb(_0xd05f4f={}){const _0x358ad5=_0x24a899,_0x153215=safeString(_0xd05f4f[_0x358ad5(0x1ee)+'d']);if(!_0x153215)throw new Error(_0x358ad5(0x310)+_0x358ad5(0x34c)+'n\x20id\x20is\x20'+_0x358ad5(0x19d));const _0x3bb179=_0x233939['get'](_0x153215);if(!_0x3bb179)throw new Error(_0x358ad5(0x310)+_0x358ad5(0x34c)+_0x358ad5(0x29d)+'und');return createKdocsCliStatus(_0x3bb179);}function _0x220bef(_0x28543d={}){const _0x143117=_0x24a899,_0x595654=safeString(_0x28543d[_0x143117(0x1ee)+'d']);if(!_0x595654)return{'ok':!![]};const _0x3b7d1a=_0x233939['get'](_0x595654);if(!_0x3b7d1a)return{'ok':!![]};return _0x1026ae(_0x3b7d1a),_0x3b7d1a[_0x143117(0x21a)]?.['kill'](),_0x233939['delete'](_0x595654),{'ok':!![]};}function _0x2c1018(_0x2dfacc){const _0x3decb6=_0x24a899;if(!_0x2dfacc[_0x3decb6(0x2f4)])return;clearTimeout(_0x2dfacc[_0x3decb6(0x2f4)]),_0x2dfacc[_0x3decb6(0x2f4)]=null;}function _0x59f376(_0x544a2c){const _0x482f30=_0x24a899,_0x41eed7=_0x5e533b[_0x482f30(0x179)](_0x544a2c);if(!_0x41eed7||_0x41eed7[_0x482f30(0x2cf)]!==_0x482f30(0x172))return;_0x2c1018(_0x41eed7),_0x41eed7[_0x482f30(0x2f4)]=setTimeout(()=>void _0xf8c4a8(_0x544a2c),_0x41eed7['pollInte'+_0x482f30(0x1b5)]);}async function _0xf8c4a8(_0x2a58f1){const _0x1265c5=_0x24a899,_0x2c85f7=_0x5e533b[_0x1265c5(0x179)](_0x2a58f1);if(!_0x2c85f7||_0x2c85f7[_0x1265c5(0x2cf)]!==_0x1265c5(0x172))return;if(Date[_0x1265c5(0x2b0)]()>=_0x2c85f7['expiresA'+'t']){_0x2c85f7[_0x1265c5(0x2cf)]=_0x1265c5(0x34a),_0x2c85f7[_0x1265c5(0x2f1)+'sage']=_0x1265c5(0x202)+_0x1265c5(0x2ef),_0x2c1018(_0x2c85f7);return;}try{const _0xc74fb9=await pollFeishuRegistration(_0x2c85f7[_0x1265c5(0x272)],_0x2c85f7['deviceCo'+'de']),_0x228919=getTrimmedString(_0xc74fb9[_0x1265c5(0x234)+'d']),_0x58e135=getTrimmedString(_0xc74fb9[_0x1265c5(0x2f3)+'ecret']),_0x3ba9d1=getTrimmedString(_0xc74fb9['error']),_0x5ae1bf=extractFeishuRegistrationAuthorizationUri(_0xc74fb9)||_0x2c85f7[_0x1265c5(0x26d)+'ationUri'];if(_0x5ae1bf!==_0x2c85f7[_0x1265c5(0x26d)+_0x1265c5(0x2ff)])_0x2c85f7[_0x1265c5(0x26d)+_0x1265c5(0x2ff)]=_0x5ae1bf;if(_0x228919&&_0x58e135){const _0xb9b1c1=asRecord(_0xc74fb9[_0x1265c5(0x16b)+'o']);await _0x515416({'appId':_0x228919,'appSecret':_0x58e135,'userInfo':{'openId':getTrimmedString(_0xb9b1c1[_0x1265c5(0x26f)])||null}}),_0x2c85f7[_0x1265c5(0x2cf)]=_0x1265c5(0x28a)+'d',_0x2c85f7[_0x1265c5(0x2f1)+_0x1265c5(0x2b4)]=null,_0x2c1018(_0x2c85f7);return;}if(!_0x3ba9d1||_0x3ba9d1===_0x1265c5(0x26d)+'ation_pe'+_0x1265c5(0x170)){_0x59f376(_0x2a58f1);return;}if(_0x3ba9d1===_0x1265c5(0x21e)+'n'){_0x2c85f7[_0x1265c5(0x22e)+'rvalMs']+=0x1388,_0x59f376(_0x2a58f1);return;}if(_0x3ba9d1===_0x1265c5(0x33e)+_0x1265c5(0x29e)){_0x2c85f7[_0x1265c5(0x2cf)]='expired',_0x2c85f7[_0x1265c5(0x2f1)+_0x1265c5(0x2b4)]=_0x1265c5(0x202)+'重新生成',_0x2c1018(_0x2c85f7);return;}_0x2c85f7['status']=_0x1265c5(0x158),_0x2c85f7[_0x1265c5(0x2f1)+'sage']=getTrimmedString(_0xc74fb9[_0x1265c5(0x297)+'scriptio'+'n'])||(_0x3ba9d1===_0x1265c5(0x247)+_0x1265c5(0x22d)?_0x1265c5(0x22b)+_0x1265c5(0x27a):'飞书绑定失败:'+_0x3ba9d1),_0x2c1018(_0x2c85f7);}catch(_0x1a4f5d){_0x2c85f7[_0x1265c5(0x2cf)]=_0x1265c5(0x158),_0x2c85f7[_0x1265c5(0x2f1)+_0x1265c5(0x2b4)]=_0x1a4f5d instanceof Error?_0x1a4f5d['message']:'飞书绑定失败',_0x2c1018(_0x2c85f7);}}async function _0x4c0ac7(_0x589bb3={}){const _0x2c3623=_0x24a899,_0x2f204b=_0x589bb3[_0x2c3623(0x350)]===_0x2c3623(0x200)+'ector'?_0x2c3623(0x200)+_0x2c3623(0x306):_0x2c3623(0x2b6),_0x189229=createFeishuRegistrationClient(),_0x4e2747=await initFeishuRegistration(_0x189229),_0x427bba=Array[_0x2c3623(0x196)](_0x4e2747[_0x2c3623(0x207)+'d_auth_m'+'ethods'])?_0x4e2747['supporte'+'d_auth_m'+_0x2c3623(0x2d5)]['map'](getTrimmedString)['filter'](Boolean):[];if(!_0x427bba[_0x2c3623(0x274)](_0x2c3623(0x2f3)+_0x2c3623(0x276)))throw new Error(_0x2c3623(0x1ea)+_0x2c3623(0x29a)+'ent\x20does'+_0x2c3623(0x1c7)+_0x2c3623(0x313)+'ent_secr'+_0x2c3623(0x2bb));const _0x2349c9=await beginFeishuRegistration(_0x189229),_0x49031e=getTrimmedString(_0x2349c9[_0x2c3623(0x182)+_0x2c3623(0x2e0)+_0x2c3623(0x1a2)+'e']),_0x639e63=extractFeishuRegistrationAuthorizationUri(_0x2349c9),_0x17d4c5=getTrimmedString(_0x2349c9['device_c'+_0x2c3623(0x1f7)]),_0x114057=Number(_0x2349c9[_0x2c3623(0x30c)+'n'])||0x258,_0x406418=Number(_0x2349c9[_0x2c3623(0x205)])||0x5;if(!_0x49031e||!_0x17d4c5)throw new Error('Missing\x20'+_0x2c3623(0x182)+_0x2c3623(0x2e0)+_0x2c3623(0x1a2)+_0x2c3623(0x301)+_0x2c3623(0x16d)+'\x20in\x20begi'+_0x2c3623(0x2c1)+_0x2c3623(0x33b));const _0x54fd51=randomUUID(),_0x3b9cb4={'sessionId':_0x54fd51,'purpose':_0x2f204b,'client':_0x189229,'deviceCode':_0x17d4c5,'verificationUriComplete':_0x49031e,'authorizationUri':_0x639e63,'expiresAt':Date[_0x2c3623(0x2b0)]()+_0x114057*0x3e8,'pollIntervalMs':Math[_0x2c3623(0x342)](_0x406418*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'status':_0x2c3623(0x172),'errorMessage':null,'timer':null};return _0x5e533b[_0x2c3623(0x194)](_0x54fd51,_0x3b9cb4),_0x59f376(_0x54fd51),serializeFeishuRegistrationSession(_0x3b9cb4);}function _0x2fe6d5(_0x258fbe={}){const _0x2ea0ca=_0x24a899,_0x170387=safeString(_0x258fbe['sessionI'+'d']);if(!_0x170387)throw new Error(_0x2ea0ca(0x19e)+'egistrat'+_0x2ea0ca(0x1fd)+'ion\x20id\x20i'+_0x2ea0ca(0x2b8)+'ed');const _0x5e6b9f=_0x5e533b[_0x2ea0ca(0x179)](_0x170387);if(!_0x5e6b9f)throw new Error('Feishu\x20r'+'egistrat'+_0x2ea0ca(0x1fd)+_0x2ea0ca(0x199)+_0x2ea0ca(0x2c0));return serializeFeishuRegistrationSession(_0x5e6b9f);}function _0x2474f2(_0x326ad9={}){const _0x1e2c94=_0x24a899,_0x410329=safeString(_0x326ad9[_0x1e2c94(0x1ee)+'d']);if(!_0x410329)return{'ok':!![]};const _0x16246c=_0x5e533b[_0x1e2c94(0x179)](_0x410329);if(!_0x16246c)return{'ok':!![]};return _0x2c1018(_0x16246c),_0x5e533b[_0x1e2c94(0x317)](_0x410329),{'ok':!![]};}async function _0x5eb400(_0x48a53b,_0x36f7ad){const _0x405b3e=_0x24a899,_0x35f76c=_0x1288c2(),{env:_0x115469,runtime:_0x22ba5}=await _0x584b8f({'FORCE_COLOR':'0','HOME':homedir(),'LARK_CLI_NO_PROXY':'1','OPENCLAW_HOME':_0x35f76c,'OPENCLAW_CONFIG_PATH':_0x48a53b[_0x405b3e(0x19f)+_0x405b3e(0x1ba)+'h']});await mkdir(_0x35f76c,{'recursive':!![]});const _0x69f0a=await _0x3e47f3(_0x22ba5);for(const _0x47aad4 of[_0x405b3e(0x2a4)+'XY',_0x405b3e(0x2a0)+'OXY',_0x405b3e(0x1d7)+'Y',_0x405b3e(0x1e3)+'xy',_0x405b3e(0x218)+_0x405b3e(0x20d),_0x405b3e(0x239)+'y']){delete _0x115469[_0x47aad4];}return new Promise((_0x545809,_0x5302c1)=>{const _0x1d9461=_0x405b3e;_0x123727(_0x1d9461(0x2d4)+'r-log',{'connector':'feishu_d'+'oc','phase':_0x1d9461(0x2da),'message':_0x1d9461(0x17b)+'\x20'+_0x36f7ad[_0x1d9461(0x195)]('\x20')});const _0x292fe9=spawn(_0x69f0a[_0x1d9461(0x1fa)+'utable'],[_0x69f0a[_0x1d9461(0x192)+'th'],..._0x36f7ad],{'cwd':_0x35f76c,'env':_0x115469});let _0x46388e=![];_0x292fe9['once']('spawn',()=>{_0x46388e=!![],_0x545809(_0x292fe9);}),_0x292fe9[_0x1d9461(0x266)](_0x1d9461(0x158),_0xe41115=>{if(_0x46388e)return;_0x5302c1(_0xe41115);});});}function _0x51f3bd(_0xdefeeb,_0x15618a,_0x3ea61e){const _0x797658=_0x24a899;_0xdefeeb[_0x797658(0x22a)]=_0x3ea61e[_0x797658(0x22a)],_0xdefeeb[_0x797658(0x30a)]=_0x3ea61e['message'];if(_0x3ea61e['phase']!==_0x797658(0x164))_0xdefeeb['url']=null;_0xdefeeb[_0x797658(0x1d4)]='',void _0x5eb400(_0xdefeeb,_0x15618a)[_0x797658(0x1d8)](_0x43f539=>{const _0x30ec63=_0x797658;_0xdefeeb[_0x30ec63(0x21a)]=_0x43f539;const _0x30f02f=setTimeout(()=>{const _0x67625f=_0x30ec63;if(_0xdefeeb['status']!==_0x67625f(0x172))return;_0x43f539[_0x67625f(0x2d6)](),_0xdefeeb[_0x67625f(0x2cf)]=_0x67625f(0x158),_0xdefeeb[_0x67625f(0x2f1)+_0x67625f(0x2b4)]=_0x3ea61e['message']+'超时',_0xdefeeb[_0x67625f(0x21a)]=null;},FEISHU_DOC_CLI_STEP_TIMEOUT_MS),_0x2c7a62=_0x2255f9=>{const _0x20bba0=_0x30ec63,_0x2de0f1=_0x2255f9['toString'](_0x20bba0(0x2e4));_0xdefeeb['output']+=_0x2de0f1,_0x123727(_0x20bba0(0x2d4)+_0x20bba0(0x2dc),{'connector':'feishu_d'+'oc','phase':_0x3ea61e[_0x20bba0(0x22a)],'message':_0x2de0f1});};_0x43f539['stdout']['on'](_0x30ec63(0x265),_0x2c7a62),_0x43f539[_0x30ec63(0x1b4)]['on'](_0x30ec63(0x265),_0x2c7a62);if(typeof _0x3ea61e['stdin']==='string')_0x43f539[_0x30ec63(0x233)][_0x30ec63(0x278)](_0x3ea61e['stdin']);else _0x43f539[_0x30ec63(0x233)]['end']();_0x43f539['on'](_0x30ec63(0x158),_0x5df17c=>{const _0x4b5c07=_0x30ec63;clearTimeout(_0x30f02f),_0xdefeeb[_0x4b5c07(0x2cf)]='error',_0xdefeeb['errorMes'+_0x4b5c07(0x2b4)]=_0x5df17c instanceof Error?_0x5df17c['message']:_0x4b5c07(0x28b)+_0x4b5c07(0x210),_0xdefeeb['process']=null,_0x123727(_0x4b5c07(0x2d4)+_0x4b5c07(0x2dc),{'connector':_0x4b5c07(0x212)+'oc','phase':'error','message':_0xdefeeb[_0x4b5c07(0x2f1)+_0x4b5c07(0x2b4)]});}),_0x43f539['on']('close',_0x22d3ac=>{const _0xded051=_0x30ec63;clearTimeout(_0x30f02f),_0xdefeeb[_0xded051(0x21a)]=null;if(_0xdefeeb[_0xded051(0x2cf)]!==_0xded051(0x172))return;if(_0x22d3ac!==0x0){if(_0x3ea61e['onFailur'+'e']){void Promise['resolve'](_0x3ea61e[_0xded051(0x1cd)+'e'](_0x22d3ac,_0xdefeeb[_0xded051(0x1d4)]))[_0xded051(0x249)](_0x57f5a6=>{const _0x1f3891=_0xded051;_0xdefeeb[_0x1f3891(0x2cf)]='error',_0xdefeeb['errorMes'+_0x1f3891(0x2b4)]=_0x57f5a6 instanceof Error?_0x57f5a6[_0x1f3891(0x30a)]:_0x1f3891(0x20b)+_0x1f3891(0x311);});return;}_0xdefeeb[_0xded051(0x2cf)]='error',_0xdefeeb[_0xded051(0x2f1)+_0xded051(0x2b4)]=getFeishuDocCliFailureMessage(_0x3ea61e[_0xded051(0x22a)],extractFeishuDocCliError(_0xdefeeb['output'],_0xded051(0x17b)+'\x20'+_0x15618a['join']('\x20')+('\x20exited\x20'+_0xded051(0x26a)+'e\x20')+_0x22d3ac),'lark-cli'+'\x20'+_0x15618a['join']('\x20')+('\x20exited\x20'+'with\x20cod'+'e\x20')+_0x22d3ac),_0x123727(_0xded051(0x2d4)+_0xded051(0x2dc),{'connector':_0xded051(0x212)+'oc','phase':_0xded051(0x158),'message':_0xdefeeb[_0xded051(0x2f1)+'sage']});return;}void Promise[_0xded051(0x1de)](_0x3ea61e[_0xded051(0x332)+'s']())[_0xded051(0x249)](_0x264908=>{const _0x1b03de=_0xded051;_0xdefeeb[_0x1b03de(0x2cf)]=_0x1b03de(0x158),_0xdefeeb[_0x1b03de(0x2f1)+_0x1b03de(0x2b4)]=_0x264908 instanceof Error?_0x264908['message']:_0x1b03de(0x20b)+_0x1b03de(0x311);});});})['catch'](_0x3fd8e1=>{const _0x2b92af=_0x797658;_0xdefeeb[_0x2b92af(0x2cf)]=_0x2b92af(0x158),_0xdefeeb['errorMes'+_0x2b92af(0x2b4)]=_0x3fd8e1 instanceof Error?_0x3fd8e1[_0x2b92af(0x30a)]:'飞书\x20CLI\x20执'+_0x2b92af(0x210),_0xdefeeb['process']=null,_0x123727(_0x2b92af(0x2d4)+_0x2b92af(0x2dc),{'connector':_0x2b92af(0x212)+'oc','phase':'error','message':_0xdefeeb[_0x2b92af(0x2f1)+_0x2b92af(0x2b4)]});});}function _0x8ad4db(_0x292f75){const _0x33d99a=_0x24a899;if(!_0x292f75[_0x33d99a(0x323)])return;clearTimeout(_0x292f75[_0x33d99a(0x323)]),_0x292f75[_0x33d99a(0x323)]=null;}function _0x530fd0(_0xc2f4b){const _0x55daba=_0x24a899;if(!_0xc2f4b[_0x55daba(0x2dd)+'usTimer'])return;clearTimeout(_0xc2f4b[_0x55daba(0x2dd)+_0x55daba(0x343)]),_0xc2f4b[_0x55daba(0x2dd)+_0x55daba(0x343)]=null;}function _0x27200f(_0x28cac5,_0x3c06a1=0x7d0){const _0x5e16e3=_0x24a899;if(_0x28cac5[_0x5e16e3(0x2cf)]!=='pending')return;_0x530fd0(_0x28cac5),_0x28cac5[_0x5e16e3(0x2dd)+_0x5e16e3(0x343)]=setTimeout(()=>{const _0x2ff326=_0x5e16e3;_0x51f3bd(_0x28cac5,['auth',_0x2ff326(0x2cf)],{'phase':'verify','message':_0x2ff326(0x1d5)+'状态','onFailure':(_0x12f2e9,_0x4c7260)=>{const _0xaeacf6=_0x2ff326;if(Date[_0xaeacf6(0x2b0)]()-_0x28cac5[_0xaeacf6(0x2dd)+_0xaeacf6(0x328)+'dAt']>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x28cac5[_0xaeacf6(0x2cf)]=_0xaeacf6(0x158),_0x28cac5['errorMes'+_0xaeacf6(0x2b4)]=getFeishuDocCliFailureMessage(_0xaeacf6(0x164),extractFeishuDocCliError(_0x4c7260,_0xaeacf6(0x2ec)+_0xaeacf6(0x1e8)),_0xaeacf6(0x2ec)+_0xaeacf6(0x1e8));return;}_0x27200f(_0x28cac5);},'onSuccess':()=>{const _0x5919f1=_0x2ff326;try{ensureFeishuDocCliUserStatus(_0x28cac5[_0x5919f1(0x1d4)]);}catch(_0x450369){if(Date[_0x5919f1(0x2b0)]()-_0x28cac5['authStat'+_0x5919f1(0x328)+_0x5919f1(0x304)]>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x28cac5[_0x5919f1(0x2cf)]='error',_0x28cac5[_0x5919f1(0x2f1)+_0x5919f1(0x2b4)]=_0x450369 instanceof Error?_0x450369[_0x5919f1(0x30a)]:_0x5919f1(0x2ec)+_0x5919f1(0x211);return;}_0x27200f(_0x28cac5);return;}return _0x530fd0(_0x28cac5),_0x4d8717(_0x28cac5);}});},_0x3c06a1);}function _0x7b928a(_0xe0f413){const _0x2895de=_0x24a899;if(!_0xe0f413[_0x2895de(0x31f)]||!_0xe0f413[_0x2895de(0x262)+_0x2895de(0x1b9)]){_0xe0f413[_0x2895de(0x2cf)]=_0x2895de(0x158),_0xe0f413[_0x2895de(0x2f1)+'sage']='飞书文档\x20CLI'+_0x2895de(0x244)+'失,无法初始化';return;}const _0x5da9b5=_0xe0f413[_0x2895de(0x31f)],_0x4d1868=_0xe0f413[_0x2895de(0x262)+_0x2895de(0x1b9)];_0x51f3bd(_0xe0f413,['--versio'+'n'],{'phase':_0x2895de(0x2c3),'message':_0x2895de(0x1e6)+'LI','onSuccess':()=>{const _0x257a93=_0x2895de;_0x51f3bd(_0xe0f413,[_0x257a93(0x220),_0x257a93(0x2c2),_0x257a93(0x24f)+_0x257a93(0x2c2),_0x257a93(0x255),_0x5da9b5,_0x257a93(0x1bc)+_0x257a93(0x2d9)+'in',_0x257a93(0x221),_0x257a93(0x23d)],{'phase':_0x257a93(0x2c3),'message':_0x257a93(0x289)+_0x257a93(0x2f0)+'应用','stdin':_0x4d1868,'onSuccess':()=>{const _0x352ae6=_0x257a93;_0x51f3bd(_0xe0f413,[_0x352ae6(0x219),_0x352ae6(0x333),_0x352ae6(0x261),'docs,dri'+_0x352ae6(0x1a0)+'own,wiki'+_0x352ae6(0x1c3)+'slides,b'+_0x352ae6(0x31c),'--scope',_0x352ae6(0x34f)+'ocs:read',_0x352ae6(0x2a2)+'t'],{'phase':_0x352ae6(0x219),'message':'正在打开飞书用户'+_0x352ae6(0x153),'onSuccess':()=>{const _0x17b595=_0x352ae6,_0x2800b2=parseFeishuDocCliJson(_0xe0f413[_0x17b595(0x1d4)]),_0x59cca5=getTrimmedString(_0x2800b2[_0x17b595(0x182)+_0x17b595(0x2e0)+_0x17b595(0x1a2)+'e'])||getTrimmedString(_0x2800b2[_0x17b595(0x182)+_0x17b595(0x1b7)])||getTrimmedString(_0x2800b2[_0x17b595(0x182)+_0x17b595(0x2e0)]),_0xfb1854=getTrimmedString(_0x2800b2[_0x17b595(0x2af)+_0x17b595(0x1f7)]);if(!_0x59cca5||!_0xfb1854){_0xe0f413[_0x17b595(0x2cf)]=_0x17b595(0x158),_0xe0f413[_0x17b595(0x2f1)+_0x17b595(0x2b4)]=_0x17b595(0x2fb)+_0x17b595(0x169)+'\x20或\x20devic'+_0x17b595(0x2fa)+summarizeCliOutput(_0xe0f413[_0x17b595(0x1d4)]);return;}_0xe0f413[_0x17b595(0x273)]=_0x59cca5,_0xe0f413[_0x17b595(0x349)+'de']=_0xfb1854,void _0x486fb4[_0x17b595(0x296)+_0x17b595(0x1f1)](_0x59cca5)[_0x17b595(0x249)](()=>{}),_0x51f3bd(_0xe0f413,['auth',_0x17b595(0x333),'--device'+_0x17b595(0x176),_0xfb1854],{'phase':_0x17b595(0x164),'message':_0x17b595(0x2aa)+'完成','onSuccess':()=>{const _0x29cf66=_0x17b595;_0xe0f413[_0x29cf66(0x2dd)+_0x29cf66(0x328)+'dAt']=Date[_0x29cf66(0x2b0)](),_0x27200f(_0xe0f413,0x1f4);}});}});}});}});}function _0x93507d(_0x1e6a84){const _0x1e2b14=_0x24a899;if(_0x1e6a84['status']!==_0x1e2b14(0x172))return;_0x8ad4db(_0x1e6a84),_0x1e6a84[_0x1e2b14(0x323)]=setTimeout(()=>void _0x21de16(_0x1e6a84),_0x1e6a84[_0x1e2b14(0x1e0)+_0x1e2b14(0x201)+'s']);}async function _0x21de16(_0x58752e){const _0x1c09d7=_0x24a899;if(_0x58752e['status']!=='pending'||_0x58752e['phase']!=='create'||!_0x58752e['appPollC'+'lient']||!_0x58752e[_0x1c09d7(0x1ae)+_0x1c09d7(0x243)])return;if(Date[_0x1c09d7(0x2b0)]()>=_0x58752e[_0x1c09d7(0x1d9)+_0x1c09d7(0x2e3)]){_0x58752e[_0x1c09d7(0x2cf)]=_0x1c09d7(0x158),_0x58752e[_0x1c09d7(0x2f1)+'sage']=_0x1c09d7(0x206)+_0x1c09d7(0x1c1),_0x8ad4db(_0x58752e);return;}try{const _0x4f813d=await pollFeishuRegistration(_0x58752e[_0x1c09d7(0x2ad)+_0x1c09d7(0x28f)],_0x58752e[_0x1c09d7(0x1ae)+'eCode']),_0x16bab4=getTrimmedString(_0x4f813d[_0x1c09d7(0x234)+'d']),_0x186967=getTrimmedString(_0x4f813d['client_s'+_0x1c09d7(0x276)]),_0x57834e=getTrimmedString(_0x4f813d['error']);if(_0x16bab4&&_0x186967){const _0x119c08=asRecord(_0x4f813d['user_inf'+'o']);await _0x217a1e({'appId':_0x16bab4,'appSecret':_0x186967,'userInfo':{'openId':getTrimmedString(_0x119c08[_0x1c09d7(0x26f)])||null},'configPath':_0x58752e['cliHostC'+'onfigPat'+'h']}),_0x58752e[_0x1c09d7(0x31f)]=_0x16bab4,_0x58752e[_0x1c09d7(0x262)+_0x1c09d7(0x1b9)]=_0x186967,_0x8ad4db(_0x58752e),_0x58752e[_0x1c09d7(0x30a)]=_0x1c09d7(0x245)+_0x1c09d7(0x214),_0x7b928a(_0x58752e);return;}if(!_0x57834e||_0x57834e===_0x1c09d7(0x26d)+_0x1c09d7(0x320)+_0x1c09d7(0x170)){_0x93507d(_0x58752e);return;}if(_0x57834e===_0x1c09d7(0x21e)+'n'){_0x58752e[_0x1c09d7(0x1e0)+_0x1c09d7(0x201)+'s']+=0x1388,_0x93507d(_0x58752e);return;}_0x58752e[_0x1c09d7(0x2cf)]=_0x1c09d7(0x158),_0x58752e[_0x1c09d7(0x2f1)+_0x1c09d7(0x2b4)]=getTrimmedString(_0x4f813d['error_de'+'scriptio'+'n'])||_0x1c09d7(0x1e9)+':'+_0x57834e,_0x8ad4db(_0x58752e);}catch(_0x2c8277){_0x58752e[_0x1c09d7(0x2cf)]=_0x1c09d7(0x158),_0x58752e['errorMes'+_0x1c09d7(0x2b4)]=_0x2c8277 instanceof Error?_0x2c8277['message']:_0x1c09d7(0x1e9),_0x8ad4db(_0x58752e);}}async function _0x4d8717(_0x462adb){const _0x53280c=_0x24a899;await _0x4fde7e({'accountName':_0x53280c(0x1b6)}),_0x462adb['status']=_0x53280c(0x28a)+'d',_0x462adb[_0x53280c(0x22a)]=_0x53280c(0x28a)+'d',_0x462adb[_0x53280c(0x30a)]=_0x53280c(0x1d2)+'完成',_0x462adb[_0x53280c(0x2f1)+_0x53280c(0x2b4)]=null;}async function _0x2691d0(){const _0x40517a=_0x24a899,_0x558f91=createFeishuRegistrationClient(),_0x2875c6=await initFeishuRegistration(_0x558f91),_0x4728f0=Array[_0x40517a(0x196)](_0x2875c6['supporte'+_0x40517a(0x188)+_0x40517a(0x2d5)])?_0x2875c6['supporte'+_0x40517a(0x188)+_0x40517a(0x2d5)][_0x40517a(0x269)](getTrimmedString)[_0x40517a(0x348)](Boolean):[];if(!_0x4728f0['includes'](_0x40517a(0x2f3)+'ecret'))throw new Error('当前飞书开放平台'+_0x40517a(0x184)+_0x40517a(0x2f3)+'ecret\x20应用');const _0x1a9349=await beginFeishuRegistration(_0x558f91),_0x2e3fa0=getTrimmedString(_0x1a9349[_0x40517a(0x182)+_0x40517a(0x2e0)+_0x40517a(0x1a2)+'e']),_0x487947=getTrimmedString(_0x1a9349[_0x40517a(0x2af)+_0x40517a(0x1f7)]),_0x730e63=Number(_0x1a9349['expire_i'+'n'])||0x258,_0xe63718=Number(_0x1a9349[_0x40517a(0x205)])||0x5;if(!_0x2e3fa0||!_0x487947)throw new Error(_0x40517a(0x15a)+'回应用创建页面或'+'\x20device_'+'code,请重试');const _0x2c8aff=randomUUID(),_0x3c35a4={'sessionId':_0x2c8aff,'status':_0x40517a(0x172),'phase':_0x40517a(0x1b3),'url':_0x2e3fa0,'appDeviceCode':_0x487947,'appPollClient':_0x558f91,'appPollIntervalMs':Math[_0x40517a(0x342)](_0xe63718*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'appExpiresAt':Date[_0x40517a(0x2b0)]()+_0x730e63*0x3e8,'appTimer':null,'authStatusTimer':null,'authStatusStartedAt':0x0,'deviceCode':null,'message':_0x40517a(0x165)+_0x40517a(0x2f5),'errorMessage':null,'process':null,'output':'','cliHostConfigPath':_0x112860(),'cliAppId':null,'cliAppSecret':null};return _0x1157d5[_0x40517a(0x194)](_0x2c8aff,_0x3c35a4),_0x93507d(_0x3c35a4),createFeishuDocCliStatus(_0x3c35a4);}function _0x1f6720(_0x448e7d={}){const _0x4657ce=_0x24a899,_0xf4c949=safeString(_0x448e7d['sessionI'+'d']);if(!_0xf4c949)throw new Error(_0x4657ce(0x1a4)+_0x4657ce(0x231)+_0x4657ce(0x19a)+_0x4657ce(0x2d0)+_0x4657ce(0x324));const _0x5ec704=_0x1157d5['get'](_0xf4c949);if(!_0x5ec704)throw new Error(_0x4657ce(0x1a4)+_0x4657ce(0x231)+_0x4657ce(0x1c2)+'ot\x20found');return createFeishuDocCliStatus(_0x5ec704);}function _0x4939c(_0x496cc7={}){const _0x210aa4=_0x24a899,_0x32a405=safeString(_0x496cc7[_0x210aa4(0x1ee)+'d']);if(!_0x32a405)return{'ok':!![]};const _0x2d2c89=_0x1157d5[_0x210aa4(0x179)](_0x32a405);if(!_0x2d2c89)return{'ok':!![]};return _0x8ad4db(_0x2d2c89),_0x530fd0(_0x2d2c89),_0x2d2c89[_0x210aa4(0x21a)]?.['kill'](),_0x1157d5['delete'](_0x32a405),{'ok':!![]};}function _0x5ff8aa(_0x2628a7={}){const _0x4c9aa7=_0x24a899,_0x1d5f14=safeString(_0x2628a7['sessionI'+'d']);if(!_0x1d5f14)throw new Error('Feishu\x20d'+_0x4c9aa7(0x231)+_0x4c9aa7(0x19a)+_0x4c9aa7(0x2d0)+'uired');const _0x198b3a=_0x1157d5[_0x4c9aa7(0x179)](_0x1d5f14);if(!_0x198b3a)throw new Error(_0x4c9aa7(0x1a4)+'oc\x20CLI\x20s'+_0x4c9aa7(0x1c2)+_0x4c9aa7(0x340));if(_0x198b3a[_0x4c9aa7(0x2cf)]===_0x4c9aa7(0x158))throw new Error(_0x198b3a[_0x4c9aa7(0x2f1)+'sage']||'飞书\x20CLI\x20连'+'接失败');return{'ok':!![]};}async function _0x3e5afe(_0x3c8c6b){const _0x4eebea=_0x24a899,_0x58df34=asRecord(_0x3c8c6b['plugins']),_0x25a579=asRecord(_0x58df34[_0x4eebea(0x298)]),_0x32a68f=asStringArray(_0x58df34['allow']),_0x1dea81=asRecord(_0x25a579[WECHAT_PLUGIN_ID]),_0x4806e5=_0x1dea81[_0x4eebea(0x2a7)]===!![]||_0x32a68f[_0x4eebea(0x274)](WECHAT_PLUGIN_ID),_0x307a57=join(_0x412d46[_0x4eebea(0x2c5)+_0x4eebea(0x26b)](),WECHAT_PLUGIN_ID),_0x1e36bd=join(_0x307a57,'accounts'+_0x4eebea(0x1ef));let _0x2e4f7f=![];try{const _0x665264=(await readFile(_0x1e36bd,_0x4eebea(0x2e4)))[_0x4eebea(0x186)]();if(_0x665264){const _0x37260e=JSON[_0x4eebea(0x15f)](_0x665264);_0x2e4f7f=Array[_0x4eebea(0x196)](_0x37260e)?_0x37260e['length']>0x0:Object[_0x4eebea(0x181)](asRecord(_0x37260e))[_0x4eebea(0x1f9)]>0x0;}}catch{}if(!_0x2e4f7f)try{_0x2e4f7f=(await readdir(join(_0x307a57,'accounts')))[_0x4eebea(0x1f9)]>0x0;}catch{}return{'exists':_0x4806e5||_0x2e4f7f,'enabled':_0x4806e5,'connected':_0x4806e5&&_0x2e4f7f};}async function _0x409144(){const _0x34fc3e=_0x24a899,_0x564aa1=await _0x2822e1(),_0xf4faa0=asRecord(_0x564aa1['channels']),_0x33db9f=[],_0x16583b=await _0x3e5afe(_0x564aa1);_0x16583b[_0x34fc3e(0x33f)]&&_0x33db9f['push']({'id':WECHAT_PLUGIN_ID,'type':_0x34fc3e(0x1fb),'name':'微信','enabled':_0x16583b[_0x34fc3e(0x2a7)],'connected':_0x16583b[_0x34fc3e(0x15c)+'d']});const _0x29dbb0=asRecord(_0xf4faa0['qqbot']),_0x2647a6=getTrimmedString(_0x29dbb0['appId']),_0xf87ce0=getTrimmedString(_0x29dbb0[_0x34fc3e(0x336)+_0x34fc3e(0x1b9)]);_0x2647a6&&_0xf87ce0&&_0x33db9f[_0x34fc3e(0x1cf)]({'id':_0x34fc3e(0x2ab),'type':_0x34fc3e(0x2ab),'name':'QQ助手','enabled':_0x29dbb0[_0x34fc3e(0x2a7)]!==![],'appId':_0x2647a6,'clientSecret':_0xf87ce0});const _0x1a311a=asRecord(_0xf4faa0[_0x34fc3e(0x24a)]),_0x113a8b=getTrimmedString(_0x1a311a[_0x34fc3e(0x1a3)]),_0xfb3cf4=getTrimmedString(_0x1a311a[_0x34fc3e(0x18e)]);_0x113a8b&&_0xfb3cf4&&_0x33db9f[_0x34fc3e(0x1cf)]({'id':_0x34fc3e(0x24a),'type':_0x34fc3e(0x24a),'name':_0x34fc3e(0x21b),'enabled':_0x1a311a[_0x34fc3e(0x2a7)]!==![],'botId':_0x113a8b,'secret':_0xfb3cf4});const _0x30cf5d=asRecord(_0xf4faa0[_0x34fc3e(0x23d)]),_0x1cbc60=getTrimmedString(_0x30cf5d[_0x34fc3e(0x325)]),_0x5a7257=getTrimmedString(_0x30cf5d['appSecre'+'t']);return _0x1cbc60&&_0x5a7257&&getTrimmedString(_0x30cf5d['managedB'+'y'])!==FEISHU_DOC_CONNECTOR_PLUGIN_ID&&_0x33db9f[_0x34fc3e(0x1cf)]({'id':'feishu','type':_0x34fc3e(0x23d),'name':_0x34fc3e(0x309),'enabled':_0x30cf5d[_0x34fc3e(0x2a7)]!==![],'appId':_0x1cbc60,'appSecret':_0x5a7257}),_0x33db9f;}async function _0x110d66(_0x709709){const _0x1fb01b=_0x24a899;if(typeof openClawConfigHandlers[_0x1fb01b(0x24e)+'nConfig']==='function')return openClawConfigHandlers[_0x1fb01b(0x24e)+'nConfig']({'pluginId':WECHAT_PLUGIN_ID,'enabled':Boolean(_0x709709),'reason':WECHAT_PLUGIN_ID+_0x1fb01b(0x281)+(_0x709709?_0x1fb01b(0x2a7):'disabled')});const _0x1be272=await _0x2822e1(),_0x27dce2=asRecord(_0x1be272['plugins']),_0x55ddc0=asRecord(_0x27dce2[_0x1fb01b(0x298)]);return _0x55ddc0[WECHAT_PLUGIN_ID]={...asRecord(_0x55ddc0[WECHAT_PLUGIN_ID]),'enabled':Boolean(_0x709709)},_0x27dce2[_0x1fb01b(0x298)]=_0x55ddc0,_0x27dce2['allow']=_0x709709?dedupeStrings([...asStringArray(_0x27dce2[_0x1fb01b(0x183)]),WECHAT_PLUGIN_ID]):asStringArray(_0x27dce2['allow'])[_0x1fb01b(0x348)](_0x45efe2=>_0x45efe2!==WECHAT_PLUGIN_ID),_0x1be272[_0x1fb01b(0x312)]=_0x27dce2,await _0x3fe752(_0x1be272,WECHAT_PLUGIN_ID+_0x1fb01b(0x281)+(_0x709709?_0x1fb01b(0x2a7):_0x1fb01b(0x1ad))),{'ok':!![]};}async function _0x2d19b1(_0xce3f07={}){const _0x252685=_0x24a899,_0x3199b4=safeString(_0xce3f07['channelI'+'d']||_0xce3f07['id']);if(!_0x3199b4)throw new Error(_0x252685(0x285)+'id\x20is\x20re'+'quired');const _0x5cfd37=await _0x2822e1(),_0x589675=asRecord(_0x5cfd37[_0x252685(0x32a)]),_0x5de844=asRecord(_0x5cfd37[_0x252685(0x312)]),_0x4daa91=asRecord(_0x5de844['entries']),_0x459232=_0x1ed1e0=>{const _0x18968c=_0x252685;_0x4daa91[_0x1ed1e0]=createConnectorPluginEntry(_0x1ed1e0,_0x4daa91[_0x1ed1e0],![],{}),_0x5de844['allow']=asStringArray(_0x5de844[_0x18968c(0x183)])[_0x18968c(0x348)](_0x4f661c=>_0x4f661c!==_0x1ed1e0),_0x5de844[_0x18968c(0x298)]=_0x4daa91,_0x5cfd37[_0x18968c(0x312)]=_0x5de844;};if(_0x3199b4==='feishu_d'+'oc')return _0x459232(FEISHU_DOC_CONNECTOR_PLUGIN_ID),getTrimmedString(asRecord(_0x589675['feishu'])[_0x252685(0x2cd)+'y'])===FEISHU_DOC_CONNECTOR_PLUGIN_ID&&(delete _0x589675['feishu'],_0x5cfd37['channels']=_0x589675),await rm(_0x1288c2(),{'recursive':!![],'force':!![]})['catch'](()=>{}),_0x3fe752(_0x5cfd37,_0x252685(0x305)+_0x252685(0x228)+_0x252685(0x1e1)+_0x252685(0x1f4)+'ted');if(_0x3199b4===_0x252685(0x1b0)){if(typeof openClawConfigHandlers[_0x252685(0x24e)+_0x252685(0x315)]===_0x252685(0x230))return openClawConfigHandlers['setPlugi'+_0x252685(0x315)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':'qq\x20mail\x20'+_0x252685(0x2d4)+_0x252685(0x316)+_0x252685(0x209)});return _0x459232(QQ_MAIL_CONNECTOR_PLUGIN_ID),_0x3fe752(_0x5cfd37,_0x252685(0x17a)+'connecto'+_0x252685(0x316)+'\x20deleted');}if(_0x3199b4===_0x252685(0x302)+_0x252685(0x2b5)){if(typeof openClawConfigHandlers[_0x252685(0x24e)+_0x252685(0x315)]===_0x252685(0x230))return openClawConfigHandlers[_0x252685(0x24e)+_0x252685(0x315)]({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x252685(0x351)+_0x252685(0x1e2)+_0x252685(0x20f)+_0x252685(0x344)+_0x252685(0x268)});return _0x459232(NETEASE_MAIL_CONNECTOR_PLUGIN_ID),_0x3fe752(_0x5cfd37,_0x252685(0x351)+_0x252685(0x1e2)+'nector\x20p'+'lugin\x20de'+_0x252685(0x268));}if(_0x3199b4===_0x252685(0x1a9)+'exmail'){if(typeof openClawConfigHandlers[_0x252685(0x24e)+_0x252685(0x315)]===_0x252685(0x230))return openClawConfigHandlers[_0x252685(0x24e)+_0x252685(0x315)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':'tencent\x20'+_0x252685(0x187)+_0x252685(0x329)+_0x252685(0x281)+'deleted'});return _0x459232(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID),_0x3fe752(_0x5cfd37,_0x252685(0x1e4)+_0x252685(0x187)+_0x252685(0x329)+_0x252685(0x281)+_0x252685(0x204));}if(_0x3199b4==='tencent_'+_0x252685(0x17f)){if(typeof openClawConfigHandlers['deleteSk'+_0x252685(0x1c4)]==='function')return openClawConfigHandlers[_0x252685(0x27b)+_0x252685(0x1c4)]({'skillId':TENCENT_DOCS_SKILL_ID,'reason':'tencent\x20'+_0x252685(0x1f6)+_0x252685(0x1d6)+_0x252685(0x24b)+'eted'});const _0x25a9d6=asRecord(_0x5cfd37['skills']),_0x2b04ef=asRecord(_0x25a9d6[_0x252685(0x298)]);return delete _0x2b04ef[TENCENT_DOCS_SKILL_ID],_0x25a9d6[_0x252685(0x298)]=_0x2b04ef,_0x5cfd37[_0x252685(0x1bb)]=_0x25a9d6,_0x3fe752(_0x5cfd37,_0x252685(0x1e4)+_0x252685(0x1f6)+_0x252685(0x1d6)+'ctor\x20del'+_0x252685(0x1a6));}if(_0x3199b4===_0x252685(0x2a1))return await _0x2fbaca(['auth',_0x252685(0x1ff)])[_0x252685(0x249)](()=>({'code':null,'output':''})),await _0x1a0ffd(),{'ok':!![]};if(_0x3199b4===_0x252685(0x1c6)+_0x252685(0x1a7)){if(typeof openClawConfigHandlers['deleteMc'+'pServer']===_0x252685(0x230))return openClawConfigHandlers[_0x252685(0x318)+'pServer']({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'reason':_0x252685(0x1c6)+_0x252685(0x2ac)+_0x252685(0x209)});const _0x489d58=readOpenClawMcpServersFromConfig(_0x5cfd37);return delete _0x489d58[DINGTALK_DOC_MCP_SERVER_NAME],writeOpenClawMcpServersToConfig(_0x5cfd37,_0x489d58),_0x3fe752(_0x5cfd37,'dingtalk'+'\x20doc\x20mcp'+_0x252685(0x209));}if(_0x3199b4===WECHAT_PLUGIN_ID||_0x3199b4===_0x252685(0x1fe)+_0x252685(0x2b1)){_0x4daa91[WECHAT_PLUGIN_ID]={...asRecord(_0x4daa91[WECHAT_PLUGIN_ID]),'enabled':![]},_0x5de844[_0x252685(0x298)]=_0x4daa91,_0x5de844[_0x252685(0x183)]=asStringArray(_0x5de844[_0x252685(0x183)])[_0x252685(0x348)](_0x58542a=>_0x58542a!==WECHAT_PLUGIN_ID&&_0x58542a!==_0x252685(0x1fe)+_0x252685(0x2b1)),_0x5cfd37[_0x252685(0x312)]=_0x5de844;const _0x1a7820=join(_0x412d46[_0x252685(0x2c5)+_0x252685(0x26b)](),WECHAT_PLUGIN_ID);return await rm(join(_0x1a7820,_0x252685(0x34d)+_0x252685(0x1ef)),{'force':!![]})['catch'](()=>{}),await rm(join(_0x1a7820,'accounts'),{'recursive':!![],'force':!![]})[_0x252685(0x249)](()=>{}),_0x3fe752(_0x5cfd37,_0x3199b4+(_0x252685(0x1af)+_0x252685(0x270)+'deleted'));}if(_0x3199b4==='feishu'){if(typeof openClawConfigHandlers[_0x252685(0x346)+_0x252685(0x2ea)+_0x252685(0x337)]==='function')return openClawConfigHandlers[_0x252685(0x346)+_0x252685(0x2ea)+_0x252685(0x337)]({'channelId':_0x252685(0x23d),'pluginId':_0x252685(0x23d),'reason':_0x252685(0x23e)+_0x252685(0x191)+'onfig\x20de'+_0x252685(0x268)});return delete _0x589675[_0x252685(0x23d)],_0x5cfd37['channels']=_0x589675,_0x4daa91[_0x252685(0x23d)]={...asRecord(_0x4daa91[_0x252685(0x23d)]),'enabled':![]},_0x5de844[_0x252685(0x298)]=_0x4daa91,_0x5de844[_0x252685(0x183)]=asStringArray(_0x5de844[_0x252685(0x183)])[_0x252685(0x348)](_0x38838c=>_0x38838c!==_0x252685(0x23d)),_0x5cfd37[_0x252685(0x312)]=_0x5de844,_0x3fe752(_0x5cfd37,_0x252685(0x23e)+_0x252685(0x191)+_0x252685(0x253)+_0x252685(0x268));}if(_0x3199b4===_0x252685(0x2ab)){if(typeof openClawConfigHandlers[_0x252685(0x346)+_0x252685(0x2ea)+_0x252685(0x337)]===_0x252685(0x230))return openClawConfigHandlers[_0x252685(0x346)+'annelCon'+'fig']({'channelId':_0x252685(0x2ab),'pluginId':QQBOT_PLUGIN_ID,'reason':_0x252685(0x2e8)+'annel\x20co'+_0x252685(0x162)+_0x252685(0x1a6)});delete _0x589675['qqbot'],_0x4daa91[QQBOT_PLUGIN_ID]={...asRecord(_0x4daa91[QQBOT_PLUGIN_ID]),'enabled':![]},_0x5de844['allow']=asStringArray(_0x5de844[_0x252685(0x183)])[_0x252685(0x348)](_0xf82751=>_0xf82751!==QQBOT_PLUGIN_ID);}if(_0x3199b4===_0x252685(0x24a)){if(typeof openClawConfigHandlers[_0x252685(0x346)+_0x252685(0x2ea)+_0x252685(0x337)]===_0x252685(0x230))return openClawConfigHandlers['deleteCh'+_0x252685(0x2ea)+_0x252685(0x337)]({'channelId':_0x252685(0x24a),'pluginId':WECOM_PLUGIN_ID,'reason':_0x252685(0x1dd)+_0x252685(0x198)+_0x252685(0x162)+'eted'});delete _0x589675[_0x252685(0x24a)],_0x4daa91[WECOM_PLUGIN_ID]={...asRecord(_0x4daa91[WECOM_PLUGIN_ID]),'enabled':![]},_0x5de844[_0x252685(0x183)]=asStringArray(_0x5de844[_0x252685(0x183)])[_0x252685(0x348)](_0x3513ea=>_0x3513ea!==WECOM_PLUGIN_ID);}return _0x5cfd37[_0x252685(0x32a)]=_0x589675,_0x5de844[_0x252685(0x298)]=_0x4daa91,_0x5cfd37[_0x252685(0x312)]=_0x5de844,_0x3fe752(_0x5cfd37,_0x3199b4+(_0x252685(0x1af)+_0x252685(0x270)+_0x252685(0x204)));}async function _0x398c5f(_0x526246={}){const _0x2f62e2=_0x24a899,_0x4b4e6b=safeString(_0x526246[_0x2f62e2(0x283)+'d']||_0x526246['id']);if(!_0x4b4e6b)throw new Error(_0x2f62e2(0x285)+_0x2f62e2(0x2a5)+'quired');const _0x3116d1=_0x526246[_0x2f62e2(0x2a7)]===!![],_0x5b35b1=await _0x2822e1(),_0x180dca=asRecord(_0x5b35b1[_0x2f62e2(0x312)]),_0x174892=asRecord(_0x180dca[_0x2f62e2(0x298)]),_0x52ad92=_0x4ad035=>{const _0x45dc0e=_0x2f62e2;_0x174892[_0x4ad035]=createConnectorPluginEntry(_0x4ad035,_0x174892[_0x4ad035],_0x3116d1,{},{'preserveExistingConfig':!![]}),_0x180dca['allow']=_0x3116d1?dedupeStrings([...asStringArray(_0x180dca[_0x45dc0e(0x183)]),_0x4ad035]):asStringArray(_0x180dca[_0x45dc0e(0x183)])[_0x45dc0e(0x348)](_0x1c1ea4=>_0x1c1ea4!==_0x4ad035),_0x180dca['entries']=_0x174892,_0x5b35b1[_0x45dc0e(0x312)]=_0x180dca;};if(_0x4b4e6b==='feishu_d'+'oc'){const _0x4cb647=asRecord(_0x174892[FEISHU_DOC_CONNECTOR_PLUGIN_ID]);if(Object[_0x2f62e2(0x181)](_0x4cb647)['length']===0x0)throw new Error(_0x2f62e2(0x338)+'r\x20\x22'+_0x4b4e6b+('\x22\x20not\x20fo'+'und'));if(typeof openClawConfigHandlers[_0x2f62e2(0x24e)+_0x2f62e2(0x315)]===_0x2f62e2(0x230))return openClawConfigHandlers['setPlugi'+_0x2f62e2(0x315)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':_0x3116d1,'reason':_0x4b4e6b+(_0x2f62e2(0x1af)+'\x20config\x20')+(_0x3116d1?'enabled':'disabled')});_0x52ad92(FEISHU_DOC_CONNECTOR_PLUGIN_ID);}else{if(_0x4b4e6b===_0x2f62e2(0x1b0)){if(typeof openClawConfigHandlers[_0x2f62e2(0x24e)+_0x2f62e2(0x315)]===_0x2f62e2(0x230))return openClawConfigHandlers[_0x2f62e2(0x24e)+_0x2f62e2(0x315)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x3116d1,'reason':_0x4b4e6b+(_0x2f62e2(0x1af)+'\x20config\x20')+(_0x3116d1?_0x2f62e2(0x2a7):_0x2f62e2(0x1ad))});_0x52ad92(QQ_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x4b4e6b===_0x2f62e2(0x302)+_0x2f62e2(0x2b5)){if(typeof openClawConfigHandlers['setPlugi'+_0x2f62e2(0x315)]===_0x2f62e2(0x230))return openClawConfigHandlers[_0x2f62e2(0x24e)+'nConfig']({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x3116d1,'reason':_0x4b4e6b+(_0x2f62e2(0x1af)+_0x2f62e2(0x270))+(_0x3116d1?_0x2f62e2(0x2a7):_0x2f62e2(0x1ad))});_0x52ad92(NETEASE_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x4b4e6b==='tencent_'+_0x2f62e2(0x286)){if(typeof openClawConfigHandlers[_0x2f62e2(0x24e)+_0x2f62e2(0x315)]==='function')return openClawConfigHandlers[_0x2f62e2(0x24e)+_0x2f62e2(0x315)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x3116d1,'reason':_0x4b4e6b+(_0x2f62e2(0x1af)+_0x2f62e2(0x270))+(_0x3116d1?'enabled':_0x2f62e2(0x1ad))});_0x52ad92(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x4b4e6b===_0x2f62e2(0x1a9)+_0x2f62e2(0x17f)){const _0x29e6da=asRecord(_0x5b35b1[_0x2f62e2(0x1bb)]),_0x51dba0=asRecord(_0x29e6da[_0x2f62e2(0x298)]),_0x185540=asRecord(_0x51dba0[TENCENT_DOCS_SKILL_ID]);if(typeof openClawConfigHandlers[_0x2f62e2(0x216)+_0x2f62e2(0x1a8)]===_0x2f62e2(0x230))return openClawConfigHandlers[_0x2f62e2(0x216)+_0x2f62e2(0x1a8)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':{..._0x185540,'enabled':_0x3116d1},'reason':_0x4b4e6b+(_0x2f62e2(0x1af)+'\x20config\x20')+(_0x3116d1?_0x2f62e2(0x2a7):_0x2f62e2(0x1ad))});_0x51dba0[TENCENT_DOCS_SKILL_ID]={..._0x185540,'enabled':_0x3116d1},_0x29e6da[_0x2f62e2(0x298)]=_0x51dba0,_0x5b35b1[_0x2f62e2(0x1bb)]=_0x29e6da;}else{if(_0x4b4e6b===_0x2f62e2(0x2a1)){if(_0x3116d1&&!await _0x28ce23())throw new Error(_0x2f62e2(0x32e)+_0x2f62e2(0x238));return await _0x68acac(_0x3116d1),{'ok':!![]};}else{if(_0x4b4e6b==='dingtalk'+_0x2f62e2(0x1a7)){const _0x5e3428=readOpenClawMcpServersFromConfig(_0x5b35b1),_0x44a738=findDingtalkDocMcpServer(_0x5e3428);if(!getTrimmedString(_0x44a738['url']))throw new Error(_0x2f62e2(0x338)+_0x2f62e2(0x31d)+_0x4b4e6b+(_0x2f62e2(0x197)+_0x2f62e2(0x32f)));_0x5e3428[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x44a738[_0x2f62e2(0x273)],{'enabled':_0x3116d1}),writeOpenClawMcpServersToConfig(_0x5b35b1,_0x5e3428);}else{const _0x199957=asRecord(_0x5b35b1[_0x2f62e2(0x32a)]),_0x226931=asRecord(_0x199957[_0x4b4e6b]);if(Object[_0x2f62e2(0x181)](_0x226931)[_0x2f62e2(0x1f9)]===0x0)throw new Error(_0x2f62e2(0x285)+'\x22'+_0x4b4e6b+(_0x2f62e2(0x197)+_0x2f62e2(0x32f)));_0x226931['enabled']=_0x3116d1;let _0x73aa3d=null;_0x4b4e6b===_0x2f62e2(0x23d)&&(_0x73aa3d=_0x2f62e2(0x23d),_0x3116d1&&(_0x226931['streamin'+'g']=!![],delete _0x226931[_0x2f62e2(0x31b)]));if(_0x4b4e6b===_0x2f62e2(0x2ab))_0x73aa3d=QQBOT_PLUGIN_ID;if(_0x4b4e6b==='wecom')_0x73aa3d=WECOM_PLUGIN_ID;if(_0x73aa3d&&typeof openClawConfigHandlers['setChann'+_0x2f62e2(0x1ec)]===_0x2f62e2(0x230))return openClawConfigHandlers['setChann'+_0x2f62e2(0x1ec)]({'channelId':_0x4b4e6b,'channel':_0x226931,'pluginId':_0x73aa3d,'pluginEnabled':_0x3116d1,'reason':_0x4b4e6b+(_0x2f62e2(0x1af)+_0x2f62e2(0x270))+(_0x3116d1?_0x2f62e2(0x2a7):'disabled')});_0x199957[_0x4b4e6b]=_0x226931,_0x5b35b1['channels']=_0x199957;if(_0x4b4e6b===_0x2f62e2(0x23d))_0x52ad92('feishu');if(_0x4b4e6b===_0x2f62e2(0x2ab))_0x52ad92(QQBOT_PLUGIN_ID);if(_0x4b4e6b===_0x2f62e2(0x24a))_0x52ad92(WECOM_PLUGIN_ID);}}}}}}}return _0x3fe752(_0x5b35b1,_0x4b4e6b+(_0x2f62e2(0x1af)+_0x2f62e2(0x270))+(_0x3116d1?_0x2f62e2(0x2a7):_0x2f62e2(0x1ad)));}async function _0x274c15({gatewayPort:_0x365ac6,gatewayToken:_0x1dbbbe}={}){const _0x16fc21=_0x24a899;_0x10fd36&&(_0x10fd36[_0x16fc21(0x2d6)](),_0x10fd36=null);const {cwd:_0x1170fa,env:_0x1996dd,runtime:_0xbc88fc}=await _0x584b8f({'FORCE_COLOR':'0',..._0x365ac6?{'OPENCLAW_GATEWAY_PORT':String(_0x365ac6)}:{},..._0x1dbbbe?{'OPENCLAW_GATEWAY_TOKEN':_0x1dbbbe}:{}}),_0x5bc4cd=_0xbc88fc[_0x16fc21(0x312)][_0x16fc21(0x275)](_0x5ae1f3=>_0x5ae1f3[_0x16fc21(0x1aa)]===WECHAT_PLUGIN_ID);if(!_0x5bc4cd){const _0x47e3ec=_0x16fc21(0x2f2)+'微信连接插件,请'+'安装包含微信插件'+_0x16fc21(0x1ca);return _0x123727('wechat-s'+_0x16fc21(0x1c0),'ERROR'),_0x123727(_0x16fc21(0x271)+'og',_0x47e3ec),{'ok':![],'error':_0x47e3ec};}await _0x110d66(!![]),_0x123727(_0x16fc21(0x271)+'og','spawn\x20op'+_0x16fc21(0x1fc)+'hannels\x20'+_0x16fc21(0x1da)+_0x16fc21(0x321)+_0x5bc4cd[_0x16fc21(0x1aa)]),_0x10fd36=spawn(_0xbc88fc[_0x16fc21(0x1fa)+'utable'],[_0xbc88fc[_0x16fc21(0x1fe)+_0x16fc21(0x1a1)],'channels',_0x16fc21(0x333),_0x16fc21(0x1b2)+'l',_0x5bc4cd['pluginId']],{'cwd':_0x1170fa,'env':_0x1996dd});let _0xb891b6='',_0x133955=![],_0x1c534f=![];const _0x55e78b=_0x438ff0=>{const _0x2d62fe=_0x16fc21,_0x591410=_0x438ff0[_0x2d62fe(0x18d)]();_0xb891b6+=_0x591410;if(!_0x133955){const _0x3d32f1=_0xb891b6[_0x2d62fe(0x32b)](/(https:\/\/(?:[a-zA-Z0-9-]+\.)*weixin\.qq\.com\S+)/i);_0x3d32f1?.[0x1]&&(_0x133955=!![],_0x123727(_0x2d62fe(0x300)+_0x2d62fe(0x2f9),_0x3d32f1[0x1]),_0x123727('wechat-s'+'tatus',_0x2d62fe(0x27c)));}if(_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x352))||_0x591410[_0x2d62fe(0x274)]('Scan\x20suc'+_0x2d62fe(0x2df))||_0x591410['includes'](_0x2d62fe(0x2c4)))_0x123727(_0x2d62fe(0x2e5)+_0x2d62fe(0x1c0),_0x2d62fe(0x17c));else{if(_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x33a))||_0x591410['includes'](_0x2d62fe(0x2a8))||_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x257))||_0x591410['includes'](_0x2d62fe(0x20e)+'n')||_0x591410[_0x2d62fe(0x274)]('Login\x20su'+_0x2d62fe(0x2c8))||_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x232))||_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x2cc))||_0x591410['includes'](_0x2d62fe(0x33d))||_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x260)+_0x2d62fe(0x15c)+'d')||_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x326)+_0x2d62fe(0x30f)+'d\x20auth'))_0x1c534f=!![],_0x123727(_0x2d62fe(0x2e5)+_0x2d62fe(0x1c0),'SUCCESS'),setTimeout(()=>{const _0x3f98bd=_0x2d62fe;_0x10fd36&&(_0x10fd36[_0x3f98bd(0x2d6)](),_0x10fd36=null);},0xbb8);else{if(_0x591410['includes']('过期')||_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x34a)))_0x123727(_0x2d62fe(0x2e5)+_0x2d62fe(0x1c0),_0x2d62fe(0x252));else(_0x591410['includes']('失败')||_0x591410[_0x2d62fe(0x274)](_0x2d62fe(0x16f))||_0x591410[_0x2d62fe(0x274)]('Error'))&&_0x123727('wechat-s'+_0x2d62fe(0x1c0),_0x2d62fe(0x25d));}}_0x123727('wechat-l'+'og',_0x591410);};return _0x10fd36[_0x16fc21(0x2b9)]?.['on'](_0x16fc21(0x265),_0x55e78b),_0x10fd36[_0x16fc21(0x1b4)]?.['on'](_0x16fc21(0x265),_0x55e78b),_0x10fd36['on']('error',_0x41c2a9=>{const _0x1b1642=_0x16fc21;_0x10fd36=null,_0x123727('wechat-s'+_0x1b1642(0x1c0),_0x1b1642(0x25d)),_0x123727('wechat-l'+'og',_0x1b1642(0x1b8)+_0x1b1642(0x2e7)+_0x41c2a9[_0x1b1642(0x30a)]);}),_0x10fd36['on'](_0x16fc21(0x15e),_0x3784a5=>{const _0x41506a=_0x16fc21;_0x10fd36=null,_0x1c534f?_0x110d66(!![])[_0x41506a(0x249)](()=>{}):(_0x110d66(![])[_0x41506a(0x249)](()=>{}),_0x123727(_0x41506a(0x2e5)+_0x41506a(0x1c0),_0x3784a5===0x0?'CLOSED':_0x41506a(0x25d)));}),{'ok':!![]};}function _0x363459(){const _0x1dd325=_0x24a899;return _0x10fd36&&(_0x10fd36[_0x1dd325(0x2d6)](),_0x10fd36=null),{'ok':!![]};}function _0xaafe85(){const _0x4496dc=_0x24a899;for(const _0x19dc4c of _0x233939[_0x4496dc(0x16a)]()){_0x1026ae(_0x19dc4c),_0x19dc4c[_0x4496dc(0x21a)]?.[_0x4496dc(0x2d6)]();}_0x233939[_0x4496dc(0x21f)]();for(const _0x36881b of _0x5e533b[_0x4496dc(0x16a)]()){_0x2c1018(_0x36881b);}_0x5e533b[_0x4496dc(0x21f)]();for(const _0x2cfc3a of _0x1157d5[_0x4496dc(0x16a)]()){_0x8ad4db(_0x2cfc3a),_0x530fd0(_0x2cfc3a),_0x2cfc3a[_0x4496dc(0x21a)]?.[_0x4496dc(0x2d6)]();}_0x1157d5['clear'](),_0x10fd36&&(_0x10fd36[_0x4496dc(0x2d6)](),_0x10fd36=null);}return{'saveFeishuChannelConfig':_0x3a99fc,'saveQqbotChannelConfig':_0x311af6,'saveWecomChannelConfig':_0x53d4e6,'saveQqMailConnectorConfig':_0x2f179d,'saveNetEaseMailConnectorConfig':_0x4fda1e,'saveTencentExmailConnectorConfig':_0x231841,'saveFeishuDocConnectorConfig':_0x4fde7e,'saveTencentDocsConnectorConfig':_0x1dc7c8,'saveKdocsConnectorConfig':_0x2e6b44,'saveDingtalkDocConnectorConfig':_0x3603d3,'readConfigSnapshot':_0x404ef6,'startKdocsCliConnectSession':_0x2b3ba9,'getKdocsCliConnectStatus':_0xc233bb,'cancelKdocsCliConnectSession':_0x220bef,'startFeishuDocCliConnectSession':_0x2691d0,'getFeishuDocCliConnectStatus':_0x1f6720,'cancelFeishuDocCliConnectSession':_0x4939c,'completeFeishuDocCliConnectSession':_0x5ff8aa,'startFeishuRegistrationSession':_0x4c0ac7,'getFeishuRegistrationStatus':_0x2fe6d5,'cancelFeishuRegistrationSession':_0x2474f2,'listImChannelConfigs':_0x409144,'deleteImChannelConfig':_0x2d19b1,'setImChannelEnabled':_0x398c5f,'startWechatChannelSession':_0x274c15,'cancelWechatChannelSession':_0x363459,'dispose':_0xaafe85};}
1
+ (function(_0x565231,_0x5afe9a){const _0x3fe3d5=_0x2fb2,_0x4badbe=_0x565231();while(!![]){try{const _0x216e03=-parseInt(_0x3fe3d5(0x23d))/0x1*(-parseInt(_0x3fe3d5(0x23c))/0x2)+parseInt(_0x3fe3d5(0x3e0))/0x3+-parseInt(_0x3fe3d5(0x358))/0x4+parseInt(_0x3fe3d5(0x252))/0x5+-parseInt(_0x3fe3d5(0x32c))/0x6+-parseInt(_0x3fe3d5(0x34a))/0x7*(-parseInt(_0x3fe3d5(0x35d))/0x8)+-parseInt(_0x3fe3d5(0x267))/0x9;if(_0x216e03===_0x5afe9a)break;else _0x4badbe['push'](_0x4badbe['shift']());}catch(_0x3cbcbe){_0x4badbe['push'](_0x4badbe['shift']());}}}(_0x2fd5,0x2f07f));import{spawn}from'node:child_process';import{randomUUID}from'node:crypto';import{mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';import{homedir}from'node:os';import{dirname,join}from'node:path';import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'../common/utils.mjs';import{DEFAULT_FEISHU_REGISTRATION_ENV,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS,DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS,DINGTALK_DOC_MCP_SERVER_NAME,FEISHU_DOC_CONNECTOR_PLUGIN_ID,FEISHU_REGISTRATION_ENV_URLS,KDOCS_SKILL_ID,NETEASE_MAIL_CONNECTOR_PLUGIN_ID,QQBOT_PLUGIN_ID,QQ_MAIL_CONNECTOR_PLUGIN_ID,TENCENT_DOCS_SKILL_ID,TENCENT_DOCS_TOKEN_ENV,TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,WECOM_PLUGIN_ID,WECHAT_PLUGIN_ID}from'./constants.mjs';import{applyFeishuChannelConfig,createConnectorPluginEntry,createDingtalkDocMcpServerConfig,normalizeFeishuDmPolicy,normalizeFeishuGroupPolicy,readOpenClawMcpServersFromConfig,writeOpenClawMcpServersToConfig}from'./config-utils.mjs';const KDOCS_CLI_STEP_TIMEOUT_MS=0x2bf20,KDOCS_CLI_AUTH_POLL_INTERVAL_MS=0x5dc,FEISHU_DOC_CLI_STEP_TIMEOUT_MS=0xa*0x3c*0x3e8;function safeString(_0x22e38b){const _0x166d8d=_0x2fb2;return typeof _0x22e38b===_0x166d8d(0x2a0)?_0x22e38b[_0x166d8d(0x310)]():'';}function findDingtalkDocMcpServer(_0x5487fc){const _0xaf8acc=_0x2fb2,_0x2a418c=asRecord(_0x5487fc[DINGTALK_DOC_MCP_SERVER_NAME]);if(Object[_0xaf8acc(0x32d)](_0x2a418c)[_0xaf8acc(0x2d3)]>0x0)return _0x2a418c;for(const [_0x5ebe71,_0x3e1681]of Object[_0xaf8acc(0x2f9)](_0x5487fc)){const _0x3cb885=asRecord(_0x3e1681),_0x1f3239=getTrimmedString(_0x5ebe71)['toLowerC'+'ase'](),_0x364fdf=getTrimmedString(_0x3cb885[_0xaf8acc(0x348)])[_0xaf8acc(0x268)+'ase']();if(_0x1f3239[_0xaf8acc(0x3f2)](_0xaf8acc(0x318))||_0x1f3239[_0xaf8acc(0x3f2)](_0xaf8acc(0x293))||_0x1f3239[_0xaf8acc(0x3f2)]('钉钉')||_0x364fdf['includes'](_0xaf8acc(0x318))||_0x364fdf[_0xaf8acc(0x3f2)]('dingding'))return _0x3cb885;}return{};}function createFeishuRegistrationClient(){const _0x35420f=_0x2fb2,_0x5618bc=FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV];if(!_0x5618bc)throw new Error(_0x35420f(0x340)+_0x35420f(0x2d2)+_0x35420f(0x382)+_0x35420f(0x3be)+_0x35420f(0x39f)+DEFAULT_FEISHU_REGISTRATION_ENV);return{'baseUrl':_0x5618bc,'headers':{'Content-Type':_0x35420f(0x212)+'ion/x-ww'+'w-form-u'+'rlencode'+'d'},'timeoutMs':DEFAULT_FEISHU_REGISTRATION_TIMEOUT_MS};}async function postFeishuRegistration(_0x12b5a7,_0x473565){const _0x158c64=_0x2fb2,_0x41854a=await fetch(_0x12b5a7['baseUrl']+(_0x158c64(0x296)+'1/app/re'+'gistrati'+'on'),{'method':'POST','headers':_0x12b5a7[_0x158c64(0x224)],'body':new URLSearchParams(_0x473565)[_0x158c64(0x298)](),'signal':AbortSignal[_0x158c64(0x221)](_0x12b5a7['timeoutM'+'s'])}),_0x389197=await _0x41854a[_0x158c64(0x2a6)]()[_0x158c64(0x34f)](()=>({}));if(!_0x41854a['ok']){const _0x73072d=new Error('HTTP\x20'+_0x41854a['status']);_0x73072d['response'+_0x158c64(0x39b)]=_0x389197;throw _0x73072d;}return asRecord(_0x389197);}async function initFeishuRegistration(_0xbbe77f){const _0x27eacd=_0x2fb2;return postFeishuRegistration(_0xbbe77f,{'action':_0x27eacd(0x35a)});}async function beginFeishuRegistration(_0x10af71){const _0x4e1610=_0x2fb2;return postFeishuRegistration(_0x10af71,{'action':_0x4e1610(0x290),'archetype':_0x4e1610(0x362)+_0x4e1610(0x205),'auth_method':_0x4e1610(0x30b)+'ecret','request_user_info':_0x4e1610(0x375)});}async function pollFeishuRegistration(_0x15d592,_0x5e9c5f){const _0x4f3691=_0x2fb2;try{return await postFeishuRegistration(_0x15d592,{'action':_0x4f3691(0x39c),'device_code':_0x5e9c5f});}catch(_0x3d8ad9){if(_0x3d8ad9?.[_0x4f3691(0x238)+_0x4f3691(0x39b)]&&typeof _0x3d8ad9[_0x4f3691(0x238)+'Data']===_0x4f3691(0x3a7))return asRecord(_0x3d8ad9[_0x4f3691(0x238)+_0x4f3691(0x39b)]);throw _0x3d8ad9;}}function extractFeishuRegistrationAuthorizationUri(_0x572e56){const _0x4e25ba=_0x2fb2,_0x4f3978=getTrimmedString(_0x572e56[_0x4e25ba(0x21e)+_0x4e25ba(0x3e4)+'i_comple'+'te'])||getTrimmedString(_0x572e56['authoriz'+_0x4e25ba(0x3e4)+'i'])||getTrimmedString(_0x572e56[_0x4e25ba(0x24a)+_0x4e25ba(0x23f)+'ion_uri_'+_0x4e25ba(0x39d)])||getTrimmedString(_0x572e56[_0x4e25ba(0x24a)+'thorizat'+_0x4e25ba(0x2c9)])||getTrimmedString(_0x572e56['scope_au'+_0x4e25ba(0x23f)+'ion_url'])||getTrimmedString(_0x572e56[_0x4e25ba(0x21e)+'ation_ur'+'l']);if(_0x4f3978)return _0x4f3978;const _0x4f0039=getTrimmedString(_0x572e56[_0x4e25ba(0x255)])||getTrimmedString(_0x572e56[_0x4e25ba(0x24a)+_0x4e25ba(0x23f)+_0x4e25ba(0x1f8)+_0x4e25ba(0x2ff)]);return _0x4f0039?FEISHU_REGISTRATION_ENV_URLS[DEFAULT_FEISHU_REGISTRATION_ENV]+('/page/sc'+_0x4e25ba(0x23b)+_0x4e25ba(0x209)+_0x4e25ba(0x2fc)+'d=')+encodeURIComponent(_0x4f0039):null;}function serializeFeishuRegistrationSession(_0x4a96b6){const _0x30922e=_0x2fb2;return{'sessionId':_0x4a96b6[_0x30922e(0x1f5)+'d'],'verificationUriComplete':_0x4a96b6['verifica'+_0x30922e(0x2da)+'omplete'],'expiresAt':new Date(_0x4a96b6['expiresA'+'t'])[_0x30922e(0x1f1)+'ing'](),'pollIntervalMs':_0x4a96b6[_0x30922e(0x2b9)+_0x30922e(0x328)],'status':_0x4a96b6[_0x30922e(0x399)],'errorMessage':_0x4a96b6[_0x30922e(0x2c6)+_0x30922e(0x2b8)],'purpose':_0x4a96b6[_0x30922e(0x380)],'authorizationUri':_0x4a96b6[_0x30922e(0x21e)+_0x30922e(0x3af)]};}function extractFirstUrl(_0x1444de){const _0x5402e2=_0x2fb2,_0x3e55e8=_0x1444de[_0x5402e2(0x25b)](/https?:\/\/[^\s"'<>]+/i);return _0x3e55e8?_0x3e55e8[0x0]:null;}function _0x2fd5(){const _0x3d697d=['markConf','\x20deleted','all_prox','authoriz','cliHostC','r-log','timeout','egistrat','accounts','headers','deviceCo','led','message','output','client_i','lugin\x20de',':user','onSucces','isArray','owFrom','stderr','的新版客户端','飞书用户身份','gin\x20upda','n\x20id\x20is\x20','prototyp','oot','ion\x20sess','openExte','response','setPlugi','config','ope-auth','78846jlRkpx','2kOidYa','Feishu\x20d','thorizat','clientSe','权状态验证超时','kill','失败,请确认\x20k','wechat-l','d\x20is\x20req','le-http','deleted','qqbot\x20ch','openId','scope_au','ase','exmail\x20c','--channe','ation_pe','ethods','allowlis','check','1694540DpLNSb','imap.163','auth','flow_id','tokenSta','skills','verifyTi','飞书绑定失败','wujie.ai','match','supporte','code','doc_conn','clear','正在验证金山文档','\x20已安装','kdocs','飞书开放平台未返','nfig\x20upd','red','已扫描','3944178bKjnyG','toLowerC','persistC','\x20updated','token','dmPolicy','usStarte','oc\x20CLI\x20s','slice','授权状态','search:d','openclaw','Kdocs\x20CL','user','enied','\x20config\x20','docs,dri','kdocs\x20sk','飞书\x20CLI\x20用','resolve','-code','appId','feishu-d','operty','QQ机器人\x20Ap','otRaw','expiresA','get','environm','uired','ll\x20updat','hint','tencent_','ent\x20does','igSnapsh','飞书开放平台应用','--device','docs\x20ski','expired','验证失败','ERROR','begin','cret','share','dingding','plugin','用户已取消飞书机','/oauth/v','验证超时','toString','gin\x20save','HTTP_PRO','zationCo','ctor\x20plu','account','ocr','授权页','string','ctor\x20del','exists','ogin','scriptPa','imap.qq.','json','docs','allow','ession\x20n','icy','金山文档已连接','wecom','Error','腾讯文档','mcp','connecto','wecom\x20ch','mableHtt','e_code:\x20','smtp.qq.','cess','飞书用户身份授权','https:','sage','pollInte','join','close','channel\x20','create','values','igWriteH','Local\x20lo','e\x20or\x20dev','then','\x20channel','器人绑定','.json','errorMes','onfig\x20de','device_c','ion_uri','wechat-s','access_d','WujieAI','\x20not\x20sup','飞书\x20CLI\x20连','tus','exmail','163\x20邮箱','ted\x20Feis','length','groupPol','tatus','oc-cli','search','annel\x20co','filter','tionUriC','com','streamin','权状态不符合用户','...(','timer','elConfig','connecti','setSkill','kdocs-cl','readConf','ated','--app-id','docs-cli','igRaw','--brand','正在进入用户授权','stdout','Missing\x20','OXY','\x20plugin\x20','now','飞书文档\x20CLI','managedB','process','企微助手\x20Sec','setChann','push','QR_READY','channels','feishu\x20d','entries','leted','EXPIRED','n?flow_i','飞书应用已创建,','--domain','_id','1.0.0','is\x20requi','error_de','skill','pluginId','ocs-cli\x20','feishu','imap.exm','ve,markd','nodeExec','已连接过','client_s','微信连接插件,请','split','illEntry','http:','trim','onfig','botId','function','Login\x20su','ent_secr','feishu_c','ttp\x20URL\x20','dingtalk','ecret','\x20专用应用凭据缺','cliAppId','feishu\x20c','ill\x20enab','行失败','footer','appSecre','ret\x20is\x20r','dated','ession\x20i','mail\x20con','id\x20is\x20re','oxy','interval','rvalMs','创建失败','onfigPat','logged\x20i','859812SwZPxr','keys','金山文档授权状态','deleteMc','und','valid','set','mail','identity','.com','-weixin','appDevic','_doc','or\x20plugi','disabled','ot\x20found','equired','pID\x20is\x20r','onMode','Feishu\x20r','Unsuppor','--no-wai','失,无法初始化','用绑定失败','<empty>','quired','appPollI','availabl','url','--scope','43477YNnpwX','env','delete','once','nfig\x20del','catch','Current\x20','setMcpSe','user_inf','qq\x20mail\x20','ector\x20de','金山文档','required','netease\x20','279164lSzDcn','.opencla','init','\x20doc\x20mcp','error','296LjXLuQ','mer','安装包含微信插件','plugins','金山文档登录启动','Personal','腾讯文档\x20Key','qq_mail','--app-se','onnector','ail.qq.c','enabled','max','lePath','回应用创建页面或','飞书应用创建超时','ame','boolean','扫码成功','export','接失败','bind','\x20connect','utable','open_id','websocke','nConfig','spawn','d_auth_m','Entry','重新生成','https_pr','飞书机器人','utf8','_complet','purpose','Connecto','hu\x20regis','connecte','当前飞书开放平台','ired','test','data','r\x20\x22','protocol','assign','ill\x20','enclaw\x20c','账号\x20is\x20re','n\x20update','tencent\x20',',sheets,','ll\x20conne','n\x20not\x20fo','山文档授权','appTimer','onfig\x20up','scriptio','name','wechat','status','netease_','Data','poll','complete','\x22\x20not\x20fo','env:\x20','d\x20auth','飞书\x20CLI\x20执','secret','slow_dow','gin\x20dele','r\x20plugin','连接成功','object','rcode','resolveS','飞书\x20CLI\x20授','QQ\x20邮箱','ternally','scanned','nector\x20p','ationUri','fig','无需重复连接','\x20exited\x20','ror:\x20','ready','HTTPS_PR','rnal','CLI\x20用户身份','腾讯企业邮箱','tateDir','qqbot','authStat','annelCon','identiti','tration\x20','飞书机器人\x20Ap','startedA','企微助手','appPollC','map','onFailur','feishu_d','xOf','eted','esAt','正在打开飞书用户','stdin','启动成功','read','with\x20cod','ode','end','--versio','verify','update','环境不支持创建\x20','http_pro','lark-cli','lastInde','ted','CLOSED','open','login','ntervalM','verifica','replace','expire_i','call','589239wOaxvr','cret-std','dAt','ector','ation_ur','projectR','文档\x20Strea','apiKey','\x20chars)','pSecret\x20','slides,b','eCode','lient','ion\x20not\x20','pServer','cliAppSe','usTimer','phase','includes','nding',',请先连接','streamab','pending','already\x20','import','toISOStr','channelI','正在验证飞书授权','请在浏览器完成金','sessionI','飞书\x20CLI\x20未','飞书\x20CLI\x20应','ion_flow','oc\x20conne','tion_uri','expired_','port\x20cli','QQ助手','deleteSk','钉钉文档\x20Str','Invalid\x20','ill\x20conn','own,wiki','accountN','eamableH','Agent','logout','andledIn','完成应用创建','orizatio','rver','login\x20--','stringif','ecret\x20应用','ocs:read','Bin','hannel\x20c','Channel\x20','applicat','\x20is\x20requ','parse','wechat-q','fresh','deleteCh','二维码已过期,请','权状态验证失败','p\x20URL'];_0x2fd5=function(){return _0x3d697d;};return _0x2fd5();}function _0x2fb2(_0x26110b,_0x33f8f2){_0x26110b=_0x26110b-0x1f0;const _0x2fd529=_0x2fd5();let _0x2fb2c1=_0x2fd529[_0x26110b];return _0x2fb2c1;}function isKdocsAuthStatusReady(_0x3a05a9){const _0x426fd4=_0x2fb2,_0xea0434=_0x3a05a9[_0x426fd4(0x268)+_0x426fd4(0x24b)]();if(/not\s+login|not\s+logged|unauth|未登录|未认证|未授权|失败/[_0x426fd4(0x386)](_0xea0434))return![];return/login|logged|auth|valid|success|已登录|已认证|已授权|有效|成功/[_0x426fd4(0x386)](_0xea0434);}function parseFeishuDocCliJson(_0x4656ef){const _0x154c33=_0x2fb2,_0x52562d=_0x4656ef['trim']();if(!_0x52562d)return{};try{return asRecord(JSON[_0x154c33(0x214)](_0x52562d));}catch{for(let _0x511736=_0x52562d['indexOf']('{');_0x511736>=0x0;_0x511736=_0x52562d['indexOf']('{',_0x511736+0x1)){for(let _0x3ae191=_0x52562d['lastInde'+_0x154c33(0x3c6)]('}');_0x3ae191>_0x511736;_0x3ae191=_0x52562d[_0x154c33(0x3d6)+_0x154c33(0x3c6)]('}',_0x3ae191-0x1)){try{return asRecord(JSON[_0x154c33(0x214)](_0x52562d[_0x154c33(0x26f)](_0x511736,_0x3ae191+0x1)));}catch{}}}return{};}}function summarizeCliOutput(_0x6dc7f6){const _0x3a0889=_0x2fb2,_0x81a45c=_0x6dc7f6[_0x3a0889(0x310)]();if(!_0x81a45c)return _0x3a0889(0x344);return _0x81a45c[_0x3a0889(0x2d3)]>0x320?_0x81a45c[_0x3a0889(0x26f)](0x0,0x320)+_0x3a0889(0x2de)+_0x81a45c[_0x3a0889(0x2d3)]+_0x3a0889(0x3e8):_0x81a45c;}function extractFeishuDocCliError(_0x2fcb20,_0x3a7aa7){const _0x122273=_0x2fb2,_0x280582=parseFeishuDocCliJson(_0x2fcb20),_0x5760a5=asRecord(_0x280582[_0x122273(0x35c)]),_0x269ff3=getTrimmedString(_0x5760a5[_0x122273(0x227)]),_0x54194b=getTrimmedString(_0x5760a5[_0x122273(0x286)]);if(_0x269ff3&&_0x54194b)return _0x269ff3+'\x0a'+_0x54194b;if(_0x269ff3)return _0x269ff3;return _0x2fcb20[_0x122273(0x310)]()||_0x3a7aa7;}function getFeishuDocCliFailureMessage(_0xb67d1f,_0x11205d,_0x2c7fca){const _0x36dab5=_0x2fb2,_0x1a54fa=_0x11205d[_0x36dab5(0x310)]()[_0x36dab5(0x30d)]('\x0a')[_0x36dab5(0x26f)](-0x8)[_0x36dab5(0x2ba)]('\x0a')['trim'](),_0x4c9da6=_0xb67d1f==='create'?_0x36dab5(0x28a)+_0x36dab5(0x329):_0xb67d1f===_0x36dab5(0x372)?_0x36dab5(0x1f7)+_0x36dab5(0x343):_0xb67d1f===_0x36dab5(0x254)?_0x36dab5(0x279)+'户授权失败':_0x36dab5(0x3aa)+_0x36dab5(0x219);return _0x1a54fa?_0x4c9da6+':\x20'+_0x1a54fa:_0x4c9da6+':\x20'+_0x2c7fca;}function ensureFeishuDocCliUserStatus(_0x145a6c){const _0x2d7b84=_0x2fb2,_0x746aeb=parseFeishuDocCliJson(_0x145a6c),_0x36e19=asRecord(_0x746aeb[_0x2d7b84(0x3bd)+'es']),_0x57d971=asRecord(_0x36e19['user']),_0x1a154f=getTrimmedString(_0x746aeb[_0x2d7b84(0x334)]),_0x3d26d1=getTrimmedString(_0x746aeb[_0x2d7b84(0x256)+_0x2d7b84(0x2cf)])||getTrimmedString(_0x57d971[_0x2d7b84(0x256)+_0x2d7b84(0x2cf)]),_0x267a16=getTrimmedString(_0x57d971[_0x2d7b84(0x399)]),_0x3fc405=_0x57d971[_0x2d7b84(0x347)+'e']===!![];if(_0x1a154f!==_0x2d7b84(0x274)||_0x267a16&&_0x267a16!==_0x2d7b84(0x3b4)||Object[_0x2d7b84(0x32d)](_0x57d971)[_0x2d7b84(0x2d3)]>0x0&&!_0x3fc405||_0x3d26d1!==_0x2d7b84(0x331)&&_0x3d26d1!=='needs_re'+_0x2d7b84(0x216))throw new Error(_0x2d7b84(0x3aa)+_0x2d7b84(0x2dd)+'身份要求:\x20'+_0x145a6c['trim']());}function createKdocsCliStatus(_0x4e951d){const _0x45a157=_0x2fb2;return{'sessionId':_0x4e951d[_0x45a157(0x1f5)+'d'],'status':_0x4e951d[_0x45a157(0x399)],'phase':_0x4e951d[_0x45a157(0x3f1)],'url':_0x4e951d[_0x45a157(0x348)],'message':_0x4e951d[_0x45a157(0x227)],'errorMessage':_0x4e951d['errorMes'+_0x45a157(0x2b8)]};}function createFeishuDocCliStatus(_0x208b72){const _0x27516e=_0x2fb2;return{'sessionId':_0x208b72[_0x27516e(0x1f5)+'d'],'status':_0x208b72[_0x27516e(0x399)],'phase':_0x208b72['phase'],'url':_0x208b72['url'],'message':_0x208b72[_0x27516e(0x227)],'errorMessage':_0x208b72[_0x27516e(0x2c6)+_0x27516e(0x2b8)]};}export function createConnectorController({shellConfig:_0x17cd65,configController:_0x5724ce,broadcast:_0x221e70,shell:_0x1e09a3,getRuntimeSpawnContext:_0x3e8899,openClawConfigHandlers:openClawConfigHandlers={},resolveRuntimeKdocsCliCommand:_0x414266,resolveRuntimeLarkCliCommand:_0x3f4fc3}){const _0x5f22af=_0x2fb2,_0x46aac2=new Map(),_0x222366=new Map(),_0x2c64a9=new Map();let _0x560f0f=null;const _0x29d527=()=>_0x5724ce['readConf'+_0x5f22af(0x2e8)]();async function _0x5b1448(_0x3d7888,_0x5b8434){const _0x58dad7=_0x5f22af;if(typeof openClawConfigHandlers[_0x58dad7(0x3d2)]==='function')return openClawConfigHandlers[_0x58dad7(0x3d2)](_0x5040b9=>{const _0x1aee72=_0x58dad7;for(const _0x2309ec of Object[_0x1aee72(0x32d)](_0x5040b9)){!Object[_0x1aee72(0x234)+'e']['hasOwnPr'+_0x1aee72(0x27e)][_0x1aee72(0x3df)](_0x3d7888,_0x2309ec)&&delete _0x5040b9[_0x2309ec];}Object[_0x1aee72(0x38a)](_0x5040b9,_0x3d7888);},_0x5b8434);return typeof _0x5724ce[_0x58dad7(0x269)+_0x58dad7(0x311)]===_0x58dad7(0x313)?await _0x5724ce[_0x58dad7(0x269)+_0x58dad7(0x311)](_0x3d7888,_0x5b8434):(_0x5724ce[_0x58dad7(0x21b)+_0x58dad7(0x2bf)+_0x58dad7(0x207)+_0x58dad7(0x3ac)]?.(),await _0x5724ce['writeCon'+_0x58dad7(0x3b0)](_0x3d7888,_0x5b8434)),{'ok':!![]};}function _0x2467ad(){const _0x3aacac=_0x5f22af;return join(_0x5724ce['resolveS'+_0x3aacac(0x3b9)](),_0x3aacac(0x27d)+_0x3aacac(0x2d6));}function _0x54ab32(){const _0x164798=_0x5f22af;return join(_0x2467ad(),_0x164798(0x359)+'w',_0x164798(0x272)+'.json');}async function _0x54f4d7(_0x25e42f={}){const _0x4686eb=_0x5f22af;return _0x3e8899(_0x17cd65[_0x4686eb(0x3e5)+_0x4686eb(0x235)],_0x25e42f);}async function _0x14158d(_0x417984,_0xc01e37){const _0x1028c3=_0x5f22af,{env:_0x4e6a39,runtime:_0x141b51}=await _0x54f4d7({'FORCE_COLOR':'0','HOME':homedir()}),_0x1e85f8=await _0x414266(_0x141b51);return _0x221e70(_0x1028c3(0x2b0)+_0x1028c3(0x220),{'connector':_0x1028c3(0x262),'phase':_0x1028c3(0x378),'message':'kdocs-cl'+'i\x20'+_0x417984['join']('\x20')}),new Promise((_0x4d28bf,_0x13d3c2)=>{const _0xc93ac0=_0x1028c3,_0x963ff8=spawn(_0x1e85f8['executab'+_0xc93ac0(0x36a)],_0x417984,{'cwd':homedir(),'env':_0x4e6a39});let _0x1fd6d7='';const _0x287d86=_0xbc5d61=>{const _0x1766fe=_0xc93ac0,_0x5dcd31=_0xbc5d61[_0x1766fe(0x298)]('utf8');_0x1fd6d7+=_0x5dcd31,_0x221e70(_0x1766fe(0x2b0)+_0x1766fe(0x220),{'connector':_0x1766fe(0x262),'phase':'output','message':_0x5dcd31});};_0x963ff8[_0xc93ac0(0x2eb)]['on'](_0xc93ac0(0x387),_0x287d86),_0x963ff8[_0xc93ac0(0x22f)]['on'](_0xc93ac0(0x387),_0x287d86),_0x963ff8[_0xc93ac0(0x34d)](_0xc93ac0(0x35c),_0x13d3c2),_0x963ff8[_0xc93ac0(0x34d)](_0xc93ac0(0x2bb),_0x56191c=>_0x4d28bf({'code':_0x56191c,'output':_0x1fd6d7}));if(typeof _0xc01e37===_0xc93ac0(0x2a0))_0x963ff8['stdin'][_0xc93ac0(0x3cf)](_0xc01e37);else _0x963ff8[_0xc93ac0(0x3ca)][_0xc93ac0(0x3cf)]();});}async function _0x2a0edb(){const _0x5ae097=_0x5f22af,_0x12ca0d=await _0x29d527(),_0x51d979=asRecord(_0x12ca0d[_0x5ae097(0x257)]),_0x3bca29=asRecord(_0x51d979[_0x5ae097(0x2f9)]),_0x2ef088={...asRecord(_0x3bca29[KDOCS_SKILL_ID]),'enabled':!![]};if(typeof openClawConfigHandlers[_0x5ae097(0x2e2)+'Entry']===_0x5ae097(0x313)){await openClawConfigHandlers['setSkill'+_0x5ae097(0x37a)]({'skillId':KDOCS_SKILL_ID,'entry':_0x2ef088,'reason':_0x5ae097(0x278)+'ill\x20enab'+_0x5ae097(0x226)});return;}_0x3bca29[KDOCS_SKILL_ID]=_0x2ef088,_0x51d979['entries']=_0x3bca29,_0x12ca0d[_0x5ae097(0x257)]=_0x51d979,await _0x5b1448(_0x12ca0d,_0x5ae097(0x278)+_0x5ae097(0x31d)+_0x5ae097(0x226));}async function _0x23b6d7(_0x1ed6de){const _0x277015=_0x5f22af,_0xbf15d4=await _0x29d527(),_0x5e973a=asRecord(_0xbf15d4[_0x277015(0x257)]),_0x3ad336=asRecord(_0x5e973a[_0x277015(0x2f9)]),_0x5d6cc9={...asRecord(_0x3ad336[KDOCS_SKILL_ID]),'enabled':Boolean(_0x1ed6de)};if(typeof openClawConfigHandlers['setSkill'+_0x277015(0x37a)]===_0x277015(0x313)){await openClawConfigHandlers[_0x277015(0x2e2)+_0x277015(0x37a)]({'skillId':KDOCS_SKILL_ID,'entry':_0x5d6cc9,'reason':'kdocs\x20sk'+_0x277015(0x38b)+(_0x1ed6de?'enabled':'disabled')});return;}_0x3ad336[KDOCS_SKILL_ID]=_0x5d6cc9,_0x5e973a[_0x277015(0x2f9)]=_0x3ad336,_0xbf15d4[_0x277015(0x257)]=_0x5e973a,await _0x5b1448(_0xbf15d4,_0x277015(0x278)+_0x277015(0x38b)+(_0x1ed6de?_0x277015(0x368):_0x277015(0x33a)));}async function _0x381203(){const _0x17cc7a=_0x5f22af;if(typeof openClawConfigHandlers[_0x17cc7a(0x1fe)+'illEntry']===_0x17cc7a(0x313)){await openClawConfigHandlers[_0x17cc7a(0x1fe)+_0x17cc7a(0x30e)]({'skillId':KDOCS_SKILL_ID,'reason':'kdocs\x20sk'+_0x17cc7a(0x201)+_0x17cc7a(0x354)+_0x17cc7a(0x2fa)});return;}const _0x43507d=await _0x29d527(),_0x2d3149=asRecord(_0x43507d[_0x17cc7a(0x257)]),_0x2ab3e=asRecord(_0x2d3149[_0x17cc7a(0x2f9)]);delete _0x2ab3e[KDOCS_SKILL_ID],_0x2d3149[_0x17cc7a(0x2f9)]=_0x2ab3e,_0x43507d[_0x17cc7a(0x257)]=_0x2d3149,await _0x5b1448(_0x43507d,_0x17cc7a(0x278)+_0x17cc7a(0x201)+_0x17cc7a(0x354)+_0x17cc7a(0x2fa));}async function _0x1407c8(){const _0x309b5c=_0x5f22af;if(!await _0x449207())throw new Error('金山文档尚未授权'+',请先完成\x20kd'+_0x309b5c(0x305)+'连接');return await _0x2a0edb(),{'ok':!![]};}async function _0x449207(){const _0x56684e=_0x5f22af,_0x298346=await _0x14158d(['auth',_0x56684e(0x399)])[_0x56684e(0x34f)](()=>({'code':null,'output':''}));return _0x298346[_0x56684e(0x25d)]===0x0&&isKdocsAuthStatusReady(_0x298346[_0x56684e(0x228)]);}async function _0x10c787({appId:_0x3bfe26,appSecret:_0xb7c60b,userInfo:userInfo=null}){const _0x4eb51b=_0x5f22af,_0x458121=await _0x29d527();applyFeishuChannelConfig(_0x458121,{'appId':_0x3bfe26,'appSecret':_0xb7c60b,'userInfo':userInfo});const _0x1e5260=asRecord(_0x458121[_0x4eb51b(0x2f7)]);if(typeof openClawConfigHandlers[_0x4eb51b(0x2f4)+_0x4eb51b(0x2e0)]==='function')return openClawConfigHandlers[_0x4eb51b(0x2f4)+_0x4eb51b(0x2e0)]({'channelId':'feishu','channel':asRecord(_0x1e5260[_0x4eb51b(0x306)]),'pluginId':_0x4eb51b(0x306),'pluginEnabled':!![],'reason':_0x4eb51b(0x31c)+_0x4eb51b(0x210)+'onfig\x20up'+'dated'});await _0x5b1448(_0x458121,'feishu\x20c'+_0x4eb51b(0x210)+_0x4eb51b(0x395)+_0x4eb51b(0x322));}async function _0x57bef3({appId:_0x526f90,appSecret:_0x1e238c,userInfo:userInfo=null,configPath:_0x9b41c0}){const _0x51a86b=_0x5f22af,_0x315ab9=getTrimmedString(userInfo?.[_0x51a86b(0x249)]),_0x6aab28={'channels':{'feishu':{'enabled':![],'appId':_0x526f90,'appSecret':_0x1e238c,'domain':_0x51a86b(0x306),'connectionMode':_0x51a86b(0x376)+'t','requireMention':!![],'dmPolicy':_0x315ab9?_0x51a86b(0x250)+'t':_0x51a86b(0x33a),'groupPolicy':_0x51a86b(0x33a),'streaming':!![],'allowFrom':_0x315ab9?[_0x315ab9]:[],'groupAllowFrom':[]}},'plugins':{'entries':{},'allow':[]},'tools':{'profile':'full'}};await mkdir(dirname(_0x9b41c0),{'recursive':!![]}),await writeFile(_0x9b41c0,JSON[_0x51a86b(0x20c)+'y'](_0x6aab28,null,0x2)+'\x0a',_0x51a86b(0x37e));}async function _0x3320d5(_0x52145d={}){const _0x3b809b=_0x5f22af,_0x58bae0=safeString(_0x52145d['appId']),_0x50487d=safeString(_0x52145d[_0x3b809b(0x320)+'t']);if(!_0x58bae0)throw new Error('飞书机器人\x20Ap'+'pID\x20is\x20r'+'equired');if(!_0x50487d)throw new Error(_0x3b809b(0x3bf)+_0x3b809b(0x3e9)+'is\x20requi'+_0x3b809b(0x265));return await _0x10c787({'appId':_0x58bae0,'appSecret':_0x50487d,'userInfo':null}),{'ok':!![]};}async function _0x4e3614(_0x35ae32={}){const _0x129eb0=_0x5f22af,_0x4c92d8=safeString(_0x35ae32[_0x129eb0(0x27c)]),_0x1adda6=safeString(_0x35ae32[_0x129eb0(0x240)+_0x129eb0(0x291)]);if(!_0x4c92d8)throw new Error(_0x129eb0(0x27f)+_0x129eb0(0x33d)+_0x129eb0(0x33c));if(!_0x1adda6)throw new Error(_0x129eb0(0x27f)+_0x129eb0(0x3e9)+_0x129eb0(0x301)+_0x129eb0(0x265));const _0x4ec584=await _0x29d527(),_0x47e2a7=asRecord(_0x4ec584[_0x129eb0(0x2f7)]),_0x13684b=asRecord(_0x47e2a7[_0x129eb0(0x3ba)]),_0x2e5f0e={'enabled':typeof _0x13684b[_0x129eb0(0x368)]===_0x129eb0(0x36e)?_0x13684b[_0x129eb0(0x368)]:!![],'allowFrom':['*'],'appId':_0x4c92d8,'clientSecret':_0x1adda6};if(typeof openClawConfigHandlers['setChann'+_0x129eb0(0x2e0)]==='function')return openClawConfigHandlers['setChann'+'elConfig']({'channelId':'qqbot','channel':_0x2e5f0e,'pluginId':QQBOT_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x129eb0(0x248)+_0x129eb0(0x2d8)+_0x129eb0(0x264)+_0x129eb0(0x2e5)});_0x47e2a7['qqbot']=_0x2e5f0e,_0x4ec584[_0x129eb0(0x2f7)]=_0x47e2a7;const _0x4ae28e=asRecord(_0x4ec584[_0x129eb0(0x360)]),_0x2d4fcb=asRecord(_0x4ae28e[_0x129eb0(0x2f9)]);return _0x2d4fcb[QQBOT_PLUGIN_ID]={...asRecord(_0x2d4fcb[QQBOT_PLUGIN_ID]),'enabled':!![]},_0x4ae28e[_0x129eb0(0x2f9)]=_0x2d4fcb,_0x4ae28e['allow']=dedupeStrings([...asStringArray(_0x4ae28e[_0x129eb0(0x2a8)]),QQBOT_PLUGIN_ID]),_0x4ec584[_0x129eb0(0x360)]=_0x4ae28e,await _0x5b1448(_0x4ec584,'qqbot\x20ch'+'annel\x20co'+_0x129eb0(0x264)+_0x129eb0(0x2e5)),{'ok':!![]};}async function _0x54ed61(_0x4795ba={}){const _0x4919db=_0x5f22af,_0x2c2eee=safeString(_0x4795ba[_0x4919db(0x312)]),_0x2a4375=safeString(_0x4795ba[_0x4919db(0x3a2)]);if(!_0x2c2eee)throw new Error('企微助手\x20Bot'+'ID\x20is\x20re'+'quired');if(!_0x2a4375)throw new Error(_0x4919db(0x2f3)+_0x4919db(0x321)+_0x4919db(0x33c));const _0x1e36f5=await _0x29d527(),_0x13a0c0=asRecord(_0x1e36f5[_0x4919db(0x2f7)]),_0x52b292=asRecord(_0x13a0c0['wecom']),_0x17262a={..._0x52b292,'enabled':typeof _0x52b292[_0x4919db(0x368)]==='boolean'?_0x52b292[_0x4919db(0x368)]:!![],'name':getTrimmedString(_0x52b292[_0x4919db(0x397)])||_0x4919db(0x3c1),'connectionMode':getTrimmedString(_0x52b292[_0x4919db(0x2e1)+_0x4919db(0x33e)])||_0x4919db(0x376)+'t','dmPolicy':normalizeFeishuDmPolicy(_0x52b292[_0x4919db(0x26c)])??_0x4919db(0x3d9),'groupPolicy':normalizeFeishuGroupPolicy(_0x52b292[_0x4919db(0x2d4)+_0x4919db(0x2aa)])??_0x4919db(0x3d9),'allowFrom':asStringArray(_0x52b292['allowFro'+'m']),'groupAllowFrom':asStringArray(_0x52b292['groupAll'+_0x4919db(0x22e)]),'botId':_0x2c2eee,'secret':_0x2a4375};if(typeof openClawConfigHandlers[_0x4919db(0x2f4)+'elConfig']==='function')return openClawConfigHandlers[_0x4919db(0x2f4)+'elConfig']({'channelId':_0x4919db(0x2ac),'channel':_0x17262a,'pluginId':WECOM_PLUGIN_ID,'pluginEnabled':!![],'reason':_0x4919db(0x2b1)+_0x4919db(0x2d8)+_0x4919db(0x264)+_0x4919db(0x2e5)});_0x13a0c0[_0x4919db(0x2ac)]=_0x17262a,_0x1e36f5[_0x4919db(0x2f7)]=_0x13a0c0;const _0x5ace1c=asRecord(_0x1e36f5[_0x4919db(0x360)]),_0x182b94=asRecord(_0x5ace1c['entries']);return _0x182b94[WECOM_PLUGIN_ID]={...asRecord(_0x182b94[WECOM_PLUGIN_ID]),'enabled':!![]},_0x5ace1c[_0x4919db(0x2f9)]=_0x182b94,_0x5ace1c[_0x4919db(0x2a8)]=dedupeStrings([...asStringArray(_0x5ace1c['allow']),WECOM_PLUGIN_ID]),_0x1e36f5[_0x4919db(0x360)]=_0x5ace1c,await _0x5b1448(_0x1e36f5,_0x4919db(0x2b1)+_0x4919db(0x2d8)+_0x4919db(0x264)+_0x4919db(0x2e5)),{'ok':!![]};}async function _0x41774e(_0x31b665,_0x4739b8,_0x25b9d0,_0x5c56ee){const _0xc739fe=_0x5f22af,_0x12b3f1=safeString(_0x4739b8[_0xc739fe(0x29d)]),_0x46c222=String(_0x4739b8[_0xc739fe(0x21e)+'ationCod'+'e']||'')[_0xc739fe(0x3dd)](/\s+/g,'');if(!_0x12b3f1)throw new Error(_0x5c56ee+(_0xc739fe(0x38d)+'quired'));if(!_0x46c222)throw new Error(_0x5c56ee+('授权码\x20is\x20r'+_0xc739fe(0x33c)));const _0x78b454=await _0x29d527(),_0xa2121e=asRecord(_0x78b454[_0xc739fe(0x360)]),_0x2a37e0=asRecord(_0xa2121e[_0xc739fe(0x2f9)]),_0x1339e0=createConnectorPluginEntry(_0x31b665,_0x2a37e0[_0x31b665],!![],{'account':_0x12b3f1,'authorizationCode':_0x46c222,..._0x25b9d0});if(typeof openClawConfigHandlers['setPlugi'+_0xc739fe(0x377)]===_0xc739fe(0x313))return openClawConfigHandlers[_0xc739fe(0x239)+_0xc739fe(0x377)]({'pluginId':_0x31b665,'enabled':!![],'config':asRecord(_0x1339e0['config']),'reason':_0x31b665+(_0xc739fe(0x373)+_0xc739fe(0x339)+_0xc739fe(0x38e)+'d')});return _0x2a37e0[_0x31b665]=_0x1339e0,_0xa2121e[_0xc739fe(0x2f9)]=_0x2a37e0,_0xa2121e[_0xc739fe(0x2a8)]=dedupeStrings([...asStringArray(_0xa2121e['allow']),_0x31b665]),_0x78b454[_0xc739fe(0x360)]=_0xa2121e,await _0x5b1448(_0x78b454,_0x31b665+('\x20connect'+_0xc739fe(0x339)+_0xc739fe(0x38e)+'d')),{'ok':!![]};}const _0x372ecf=_0x50eb1b=>_0x41774e(QQ_MAIL_CONNECTOR_PLUGIN_ID,_0x50eb1b,{'imapHost':_0x5f22af(0x2a5)+_0x5f22af(0x2db),'imapPort':0x3e1,'smtpHost':_0x5f22af(0x2b4)+_0x5f22af(0x2db),'smtpPort':0x1d1,'secure':!![]},_0x5f22af(0x3ab)),_0x27b808=_0x492343=>_0x41774e(NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x492343,{'imapHost':_0x5f22af(0x253)+_0x5f22af(0x335),'imapPort':0x3e1,'smtpHost':'smtp.163'+_0x5f22af(0x335),'smtpPort':0x1d1,'imapClientName':_0x5f22af(0x2cc),'imapClientVersion':_0x5f22af(0x300),'imapClientVendor':'WujieAI','imapClientSupportEmail':'support@'+_0x5f22af(0x25a),'secure':!![]},_0x5f22af(0x2d1)),_0x48b0d6=_0x134dd1=>_0x41774e(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x134dd1,{'imapHost':_0x5f22af(0x307)+_0x5f22af(0x367)+'om','imapPort':0x3e1,'smtpHost':'smtp.exm'+_0x5f22af(0x367)+'om','smtpPort':0x1d1,'secure':!![]},_0x5f22af(0x3b8));async function _0x108fc7(_0x25bd44={}){const _0x2fe5f6=_0x5f22af,_0x2e7c13=safeString(_0x25bd44[_0x2fe5f6(0x203)+_0x2fe5f6(0x36d)])||'飞书用户身份',_0x414ccb=await _0x29d527(),_0x106182=asRecord(_0x414ccb[_0x2fe5f6(0x360)]),_0x4979b1=asRecord(_0x106182[_0x2fe5f6(0x2f9)]),_0x2add94=createConnectorPluginEntry(FEISHU_DOC_CONNECTOR_PLUGIN_ID,_0x4979b1[FEISHU_DOC_CONNECTOR_PLUGIN_ID],!![],{'authMode':_0x2fe5f6(0x274),'accountName':_0x2e7c13});if(typeof openClawConfigHandlers[_0x2fe5f6(0x239)+'nConfig']===_0x2fe5f6(0x313))return openClawConfigHandlers[_0x2fe5f6(0x239)+_0x2fe5f6(0x377)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':!![],'config':asRecord(_0x2add94['config']),'reason':_0x2fe5f6(0x2f8)+_0x2fe5f6(0x1f9)+_0x2fe5f6(0x29c)+_0x2fe5f6(0x232)+_0x2fe5f6(0x3d7)});return _0x4979b1[FEISHU_DOC_CONNECTOR_PLUGIN_ID]=_0x2add94,_0x106182[_0x2fe5f6(0x2f9)]=_0x4979b1,_0x106182[_0x2fe5f6(0x2a8)]=dedupeStrings([...asStringArray(_0x106182[_0x2fe5f6(0x2a8)]),FEISHU_DOC_CONNECTOR_PLUGIN_ID]),_0x414ccb[_0x2fe5f6(0x360)]=_0x106182,await _0x5b1448(_0x414ccb,'feishu\x20d'+_0x2fe5f6(0x1f9)+'ctor\x20plu'+_0x2fe5f6(0x232)+_0x2fe5f6(0x3d7)),{'ok':!![]};}async function _0x46ce45(_0x4be341={}){const _0x4f4a66=_0x5f22af,_0x7dcf99=safeString(_0x4be341[_0x4f4a66(0x3e7)]);if(!_0x7dcf99)throw new Error(_0x4f4a66(0x363)+_0x4f4a66(0x213)+_0x4f4a66(0x385));const _0x4f2f38=await _0x29d527(),_0x5bc89b=asRecord(_0x4f2f38[_0x4f4a66(0x257)]),_0x4135d1=asRecord(_0x5bc89b[_0x4f4a66(0x2f9)]),_0x301d54=asRecord(_0x4135d1[TENCENT_DOCS_SKILL_ID]),_0x1f2406={..._0x301d54,'enabled':!![],'env':{...asRecord(_0x301d54[_0x4f4a66(0x34b)]),[TENCENT_DOCS_TOKEN_ENV]:_0x7dcf99}};if(typeof openClawConfigHandlers[_0x4f4a66(0x2e2)+_0x4f4a66(0x37a)]===_0x4f4a66(0x313))return openClawConfigHandlers[_0x4f4a66(0x2e2)+_0x4f4a66(0x37a)]({'skillId':TENCENT_DOCS_SKILL_ID,'entry':_0x1f2406,'reason':_0x4f4a66(0x38f)+_0x4f4a66(0x28c)+_0x4f4a66(0x285)+'ed'});return _0x4135d1[TENCENT_DOCS_SKILL_ID]=_0x1f2406,_0x5bc89b[_0x4f4a66(0x2f9)]=_0x4135d1,_0x4f2f38[_0x4f4a66(0x257)]=_0x5bc89b,await _0x5b1448(_0x4f2f38,_0x4f4a66(0x38f)+_0x4f4a66(0x28c)+_0x4f4a66(0x285)+'ed'),{'ok':!![]};}async function _0x4fb3b7(_0x243377={}){const _0xd0e4ff=_0x5f22af,_0x5b0e71=safeString(_0x243377['url']);if(!_0x5b0e71)throw new Error(_0xd0e4ff(0x1ff)+_0xd0e4ff(0x204)+_0xd0e4ff(0x317)+'is\x20requi'+'red');try{const _0x197393=new URL(_0x5b0e71);if(![_0xd0e4ff(0x30f),_0xd0e4ff(0x2b7)]['includes'](_0x197393[_0xd0e4ff(0x389)]))throw new Error(_0xd0e4ff(0x200)+_0xd0e4ff(0x389));}catch{throw new Error('请输入有效的钉钉'+_0xd0e4ff(0x3e6)+_0xd0e4ff(0x2b2)+_0xd0e4ff(0x21a));}if(typeof openClawConfigHandlers['setMcpSe'+_0xd0e4ff(0x20a)]===_0xd0e4ff(0x313))return openClawConfigHandlers[_0xd0e4ff(0x351)+_0xd0e4ff(0x20a)]({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'server':createDingtalkDocMcpServerConfig(_0x5b0e71),'reason':'dingtalk'+_0xd0e4ff(0x35b)+_0xd0e4ff(0x26a)});const _0x367d0c=await _0x29d527(),_0x335bf4=readOpenClawMcpServersFromConfig(_0x367d0c);return _0x335bf4[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x5b0e71),writeOpenClawMcpServersToConfig(_0x367d0c,_0x335bf4),await _0x5b1448(_0x367d0c,'dingtalk'+'\x20doc\x20mcp'+_0xd0e4ff(0x26a)),{'ok':!![]};}async function _0x2bd9e0(){const _0x23ed7a=_0x5f22af,_0x433a84=await _0x29d527(),_0x57a12a=asRecord(_0x433a84[_0x23ed7a(0x360)]),_0x3d9c77=asRecord(_0x57a12a[_0x23ed7a(0x2f9)]),_0x5461e8=asRecord(_0x433a84['skills']),_0x4ef583=asRecord(_0x5461e8[_0x23ed7a(0x2f9)]),_0x1cf88f={},_0x20c5fb=_0xc3ca=>{const _0x517f4f=_0x23ed7a,_0xf691e0=asRecord(_0x3d9c77[_0xc3ca]);return{'entry':_0xf691e0,'config':asRecord(_0xf691e0[_0x517f4f(0x23a)])};},_0x4b0294=(_0x3e8a2a,_0x4d517,_0xaf7955)=>{const _0x59405e=_0x23ed7a,{entry:_0x158c01,config:_0x3b88e9}=_0x20c5fb(_0x4d517),_0x1151f8=getTrimmedString(_0x3b88e9[_0x59405e(0x29d)]);if(!_0x1151f8)return;_0x1cf88f[_0x3e8a2a]={'provider':_0x3e8a2a,'sourceType':_0x59405e(0x294),'adapter':_0x4d517,'enabled':_0x158c01['enabled']!==![]&&_0x3b88e9['enabled']!==![],'account':_0x1151f8,'credentialRef':_0x4d517+(':authori'+_0x59405e(0x29b)+'de'),'name':_0xaf7955};};_0x4b0294(_0x23ed7a(0x364),QQ_MAIL_CONNECTOR_PLUGIN_ID,'QQ\x20邮箱'),_0x4b0294(_0x23ed7a(0x39a)+_0x23ed7a(0x333),NETEASE_MAIL_CONNECTOR_PLUGIN_ID,_0x23ed7a(0x2d1)),_0x4b0294(_0x23ed7a(0x287)+_0x23ed7a(0x2d0),TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,_0x23ed7a(0x3b8));const _0x5d188e=_0x20c5fb(FEISHU_DOC_CONNECTOR_PLUGIN_ID),_0x12a8e3=getTrimmedString(_0x5d188e['config'][_0x23ed7a(0x203)+_0x23ed7a(0x36d)]);_0x12a8e3&&(_0x1cf88f[_0x23ed7a(0x306)]={'provider':_0x23ed7a(0x306),'sourceType':_0x23ed7a(0x3d5),'adapter':_0x23ed7a(0x316)+'li_user','enabled':_0x5d188e['entry']['enabled']!==![]&&_0x5d188e['config'][_0x23ed7a(0x368)]!==![],'authMode':'user','accountName':_0x12a8e3,'account':_0x12a8e3,'credentialRef':FEISHU_DOC_CONNECTOR_PLUGIN_ID+_0x23ed7a(0x22b),'capabilities':['latest',_0x23ed7a(0x2d7),'create',_0x23ed7a(0x3cc),'update','delete','export']});const _0x39535c=asRecord(_0x4ef583[TENCENT_DOCS_SKILL_ID]),_0x5c7644=asRecord(_0x39535c[_0x23ed7a(0x34b)]),_0x4c9de1=getTrimmedString(_0x5c7644[TENCENT_DOCS_TOKEN_ENV]);_0x4c9de1&&(_0x1cf88f[_0x23ed7a(0x287)+'docs']={'provider':_0x23ed7a(0x287)+_0x23ed7a(0x2a7),'sourceType':_0x23ed7a(0x303),'adapter':TENCENT_DOCS_SKILL_ID,'enabled':_0x39535c[_0x23ed7a(0x368)]!==![],'account':_0x23ed7a(0x2ae),'credentialRef':TENCENT_DOCS_SKILL_ID+':'+TENCENT_DOCS_TOKEN_ENV,'capabilities':[_0x23ed7a(0x2bd),'read',_0x23ed7a(0x3d2),'delete','import',_0x23ed7a(0x370),_0x23ed7a(0x29e)]});const _0x3b9463=asRecord(_0x4ef583[KDOCS_SKILL_ID]);Object[_0x23ed7a(0x32d)](_0x3b9463)[_0x23ed7a(0x2d3)]>0x0&&await _0x449207()&&(_0x1cf88f[_0x23ed7a(0x262)]={'provider':_0x23ed7a(0x262),'sourceType':_0x23ed7a(0x303),'adapter':KDOCS_SKILL_ID,'enabled':_0x3b9463[_0x23ed7a(0x368)]!==![],'account':_0x23ed7a(0x355),'credentialRef':_0x23ed7a(0x2e3)+'i:keycha'+'in','capabilities':['create','read',_0x23ed7a(0x3d2),'search',_0x23ed7a(0x292),_0x23ed7a(0x1f0),_0x23ed7a(0x370)]});const _0x29c199=readOpenClawMcpServersFromConfig(_0x433a84),_0x34b2c0=findDingtalkDocMcpServer(_0x29c199),_0x1e5407=getTrimmedString(_0x34b2c0['url']);return _0x1e5407&&(_0x1cf88f[_0x23ed7a(0x318)+_0x23ed7a(0x338)]={'provider':_0x23ed7a(0x318)+_0x23ed7a(0x338),'sourceType':_0x23ed7a(0x2af),'adapter':DINGTALK_DOC_MCP_SERVER_NAME,'enabled':_0x34b2c0[_0x23ed7a(0x368)]!==![],'url':_0x1e5407,'transport':getTrimmedString(_0x34b2c0['transpor'+'t'])||_0x23ed7a(0x3f5)+_0x23ed7a(0x246)}),_0x1cf88f;}async function _0x49252a(){const _0x56c3f2=_0x5f22af,_0x38fa01=await _0x5724ce[_0x56c3f2(0x2e4)+_0x56c3f2(0x289)+_0x56c3f2(0x280)]();return{..._0x38fa01,'connectors':{...asRecord(_0x38fa01[_0x56c3f2(0x2b0)+'rs']),...await _0x2bd9e0()}};}function _0x461263(_0x14dc2c){const _0x1491ed=_0x5f22af;if(!_0x14dc2c[_0x1491ed(0x258)+_0x1491ed(0x35e)])return;clearTimeout(_0x14dc2c['verifyTi'+_0x1491ed(0x35e)]),_0x14dc2c['verifyTi'+'mer']=null;}function _0x35b0f4(_0x2492e4,_0x334efa=KDOCS_CLI_AUTH_POLL_INTERVAL_MS){const _0x5f353c=_0x5f22af;if(_0x2492e4[_0x5f353c(0x399)]!==_0x5f353c(0x3f6))return;_0x461263(_0x2492e4),_0x2492e4['verifyTi'+_0x5f353c(0x35e)]=setTimeout(()=>void _0x4b69f6(_0x2492e4),_0x334efa);}async function _0x4b69f6(_0x4f8f77){const _0x45c967=_0x5f22af;if(_0x4f8f77[_0x45c967(0x399)]!==_0x45c967(0x3f6))return;_0x4f8f77['phase']=_0x45c967(0x3d1),_0x4f8f77[_0x45c967(0x227)]=_0x45c967(0x260)+'授权状态';try{const _0x19ea6f=await _0x14158d(['auth',_0x45c967(0x399)]);_0x4f8f77[_0x45c967(0x228)]=_0x19ea6f[_0x45c967(0x228)];if(_0x19ea6f['code']===0x0&&isKdocsAuthStatusReady(_0x19ea6f[_0x45c967(0x228)])){_0x461263(_0x4f8f77),await _0x2a0edb(),_0x4f8f77['phase']='complete'+'d',_0x4f8f77[_0x45c967(0x399)]='complete'+'d',_0x4f8f77[_0x45c967(0x227)]=_0x45c967(0x2ab);return;}if(Date[_0x45c967(0x2ef)]()-_0x4f8f77[_0x45c967(0x3c0)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x4f8f77[_0x45c967(0x399)]=_0x45c967(0x35c),_0x4f8f77[_0x45c967(0x2c6)+'sage']='金山文档授权状态'+_0x45c967(0x297);return;}_0x35b0f4(_0x4f8f77);}catch(_0x4854bf){if(Date[_0x45c967(0x2ef)]()-_0x4f8f77[_0x45c967(0x3c0)+'t']>KDOCS_CLI_STEP_TIMEOUT_MS){_0x4f8f77[_0x45c967(0x399)]=_0x45c967(0x35c),_0x4f8f77[_0x45c967(0x2c6)+_0x45c967(0x2b8)]=_0x4854bf instanceof Error?_0x4854bf['message']:_0x45c967(0x32e)+_0x45c967(0x28e);return;}_0x35b0f4(_0x4f8f77);}}async function _0x59756d(){const _0x1bb8ce=_0x5f22af,_0x22c599=randomUUID(),_0x954378={'sessionId':_0x22c599,'status':_0x1bb8ce(0x3f6),'phase':_0x1bb8ce(0x251),'url':null,'message':'正在启动金山文档'+'登录','errorMessage':null,'output':'','process':null,'verifyTimer':null,'startedAt':Date['now']()};return _0x46aac2[_0x1bb8ce(0x332)](_0x22c599,_0x954378),void _0x54f4d7({'FORCE_COLOR':'0','HOME':homedir()})[_0x1bb8ce(0x2c2)](async({env:_0xd6a38e,runtime:_0x430266})=>{const _0x34f640=_0x1bb8ce,_0x552038=await _0x414266(_0x430266);_0x221e70(_0x34f640(0x2b0)+_0x34f640(0x220),{'connector':_0x34f640(0x262),'phase':_0x34f640(0x378),'message':_0x34f640(0x2e3)+'i\x20auth\x20l'+_0x34f640(0x2a3)});const _0x3b4e51=spawn(_0x552038['executab'+_0x34f640(0x36a)],[_0x34f640(0x254),_0x34f640(0x3da)],{'cwd':homedir(),'env':_0xd6a38e});_0x954378[_0x34f640(0x2f2)]=_0x3b4e51;const _0x4ba9e7=setTimeout(()=>{const _0x164ff3=_0x34f640;if(_0x954378[_0x164ff3(0x399)]!=='pending')return;_0x3b4e51[_0x164ff3(0x242)](),_0x954378['status']='error',_0x954378[_0x164ff3(0x2c6)+_0x164ff3(0x2b8)]=_0x164ff3(0x361)+'超时',_0x954378[_0x164ff3(0x2f2)]=null;},KDOCS_CLI_STEP_TIMEOUT_MS),_0x37c4cb=_0x51784f=>{const _0x336656=_0x34f640,_0x3434b3=_0x51784f['toString'](_0x336656(0x37e));_0x954378[_0x336656(0x228)]+=_0x3434b3,_0x221e70(_0x336656(0x2b0)+_0x336656(0x220),{'connector':_0x336656(0x262),'phase':_0x336656(0x228),'message':_0x3434b3});const _0x52e0b8=extractFirstUrl(_0x954378[_0x336656(0x228)]);_0x52e0b8&&!_0x954378['url']&&(_0x954378[_0x336656(0x348)]=_0x52e0b8,_0x954378[_0x336656(0x3f1)]='auth',_0x954378['message']=_0x336656(0x1f4)+_0x336656(0x393),_0x35b0f4(_0x954378,0x1f4),void _0x1e09a3[_0x336656(0x237)+_0x336656(0x3b6)](_0x52e0b8)[_0x336656(0x34f)](()=>{}));};_0x3b4e51[_0x34f640(0x2eb)]['on']('data',_0x37c4cb),_0x3b4e51['stderr']['on'](_0x34f640(0x387),_0x37c4cb),_0x3b4e51[_0x34f640(0x3ca)][_0x34f640(0x3cf)](),_0x3b4e51[_0x34f640(0x34d)](_0x34f640(0x35c),_0x5e8472=>{const _0x5acf0e=_0x34f640;clearTimeout(_0x4ba9e7),_0x954378[_0x5acf0e(0x399)]=_0x5acf0e(0x35c),_0x954378[_0x5acf0e(0x2c6)+_0x5acf0e(0x2b8)]=_0x5e8472 instanceof Error?_0x5e8472[_0x5acf0e(0x227)]:_0x5acf0e(0x361)+_0x5acf0e(0x243)+_0x5acf0e(0x2e7)+_0x5acf0e(0x261),_0x954378[_0x5acf0e(0x2f2)]=null,_0x221e70(_0x5acf0e(0x2b0)+_0x5acf0e(0x220),{'connector':_0x5acf0e(0x262),'phase':_0x5acf0e(0x35c),'message':_0x954378[_0x5acf0e(0x2c6)+_0x5acf0e(0x2b8)]});}),_0x3b4e51['once']('close',_0x2a138b=>{const _0x1861f8=_0x34f640;clearTimeout(_0x4ba9e7),_0x954378[_0x1861f8(0x2f2)]=null;if(_0x954378[_0x1861f8(0x399)]!==_0x1861f8(0x3f6))return;const _0x290faa=extractFirstUrl(_0x954378[_0x1861f8(0x228)]);if(_0x290faa&&!_0x954378[_0x1861f8(0x348)]){_0x954378[_0x1861f8(0x348)]=_0x290faa,_0x954378[_0x1861f8(0x3f1)]=_0x1861f8(0x254),_0x954378[_0x1861f8(0x227)]='请在浏览器完成金'+_0x1861f8(0x393),_0x35b0f4(_0x954378,0x1f4);return;}if(_0x2a138b!==0x0){_0x954378[_0x1861f8(0x399)]=_0x1861f8(0x35c),_0x954378[_0x1861f8(0x2c6)+_0x1861f8(0x2b8)]=_0x954378[_0x1861f8(0x228)][_0x1861f8(0x310)]()||_0x1861f8(0x361)+_0x1861f8(0x243)+_0x1861f8(0x2e7)+'\x20已安装',_0x221e70(_0x1861f8(0x2b0)+_0x1861f8(0x220),{'connector':_0x1861f8(0x262),'phase':_0x1861f8(0x35c),'message':_0x954378[_0x1861f8(0x2c6)+_0x1861f8(0x2b8)]});return;}_0x954378[_0x1861f8(0x3f1)]=_0x1861f8(0x3d1),_0x954378[_0x1861f8(0x227)]=_0x1861f8(0x260)+_0x1861f8(0x270),_0x35b0f4(_0x954378,0x1f4);});})['catch'](_0xcbb611=>{const _0x7c5572=_0x1bb8ce;_0x954378['status']=_0x7c5572(0x35c),_0x954378[_0x7c5572(0x2c6)+_0x7c5572(0x2b8)]=_0xcbb611 instanceof Error?_0xcbb611[_0x7c5572(0x227)]:_0x7c5572(0x361)+_0x7c5572(0x243)+'docs-cli'+_0x7c5572(0x261),_0x221e70(_0x7c5572(0x2b0)+'r-log',{'connector':_0x7c5572(0x262),'phase':'error','message':_0x954378['errorMes'+_0x7c5572(0x2b8)]});}),createKdocsCliStatus(_0x954378);}function _0x334d82(_0x504523={}){const _0x1f6a7c=_0x5f22af,_0x1b861a=safeString(_0x504523[_0x1f6a7c(0x1f5)+'d']);if(!_0x1b861a)throw new Error('Kdocs\x20CL'+'I\x20sessio'+_0x1f6a7c(0x233)+_0x1f6a7c(0x356));const _0xfd3564=_0x46aac2['get'](_0x1b861a);if(!_0xfd3564)throw new Error(_0x1f6a7c(0x273)+'I\x20sessio'+_0x1f6a7c(0x392)+'und');return createKdocsCliStatus(_0xfd3564);}function _0x99803b(_0x15a33d={}){const _0x3ad6a9=_0x5f22af,_0xdea030=safeString(_0x15a33d[_0x3ad6a9(0x1f5)+'d']);if(!_0xdea030)return{'ok':!![]};const _0x337da1=_0x46aac2['get'](_0xdea030);if(!_0x337da1)return{'ok':!![]};return _0x461263(_0x337da1),_0x337da1[_0x3ad6a9(0x2f2)]?.['kill'](),_0x46aac2[_0x3ad6a9(0x34c)](_0xdea030),{'ok':!![]};}function _0x1d676b(_0x1df5ed){const _0x4ebcf1=_0x5f22af;if(!_0x1df5ed['timer'])return;clearTimeout(_0x1df5ed[_0x4ebcf1(0x2df)]),_0x1df5ed[_0x4ebcf1(0x2df)]=null;}function _0x33a0d6(_0x516856){const _0x165ef8=_0x5f22af,_0x42b1ae=_0x222366[_0x165ef8(0x282)](_0x516856);if(!_0x42b1ae||_0x42b1ae[_0x165ef8(0x399)]!=='pending')return;_0x1d676b(_0x42b1ae),_0x42b1ae[_0x165ef8(0x2df)]=setTimeout(()=>void _0x4ca4e8(_0x516856),_0x42b1ae[_0x165ef8(0x2b9)+_0x165ef8(0x328)]);}async function _0x4ca4e8(_0x2ac278){const _0x22b86a=_0x5f22af,_0x3b40d3=_0x222366[_0x22b86a(0x282)](_0x2ac278);if(!_0x3b40d3||_0x3b40d3[_0x22b86a(0x399)]!==_0x22b86a(0x3f6))return;if(Date[_0x22b86a(0x2ef)]()>=_0x3b40d3[_0x22b86a(0x281)+'t']){_0x3b40d3['status']='expired',_0x3b40d3[_0x22b86a(0x2c6)+_0x22b86a(0x2b8)]=_0x22b86a(0x218)+_0x22b86a(0x37b),_0x1d676b(_0x3b40d3);return;}try{const _0x508538=await pollFeishuRegistration(_0x3b40d3['client'],_0x3b40d3['deviceCo'+'de']),_0x3d7570=getTrimmedString(_0x508538[_0x22b86a(0x229)+'d']),_0x293bf7=getTrimmedString(_0x508538[_0x22b86a(0x30b)+_0x22b86a(0x319)]),_0x46e181=getTrimmedString(_0x508538[_0x22b86a(0x35c)]),_0x617e38=extractFeishuRegistrationAuthorizationUri(_0x508538)||_0x3b40d3[_0x22b86a(0x21e)+_0x22b86a(0x3af)];if(_0x617e38!==_0x3b40d3[_0x22b86a(0x21e)+'ationUri'])_0x3b40d3[_0x22b86a(0x21e)+'ationUri']=_0x617e38;if(_0x3d7570&&_0x293bf7){const _0x42b601=asRecord(_0x508538[_0x22b86a(0x352)+'o']);await _0x10c787({'appId':_0x3d7570,'appSecret':_0x293bf7,'userInfo':{'openId':getTrimmedString(_0x42b601['open_id'])||null}}),_0x3b40d3[_0x22b86a(0x399)]=_0x22b86a(0x39d)+'d',_0x3b40d3[_0x22b86a(0x2c6)+_0x22b86a(0x2b8)]=null,_0x1d676b(_0x3b40d3);return;}if(!_0x46e181||_0x46e181===_0x22b86a(0x21e)+'ation_pe'+_0x22b86a(0x3f3)){_0x33a0d6(_0x2ac278);return;}if(_0x46e181===_0x22b86a(0x3a3)+'n'){_0x3b40d3[_0x22b86a(0x2b9)+_0x22b86a(0x328)]+=0x1388,_0x33a0d6(_0x2ac278);return;}if(_0x46e181===_0x22b86a(0x1fb)+_0x22b86a(0x26b)){_0x3b40d3[_0x22b86a(0x399)]='expired',_0x3b40d3[_0x22b86a(0x2c6)+_0x22b86a(0x2b8)]=_0x22b86a(0x218)+_0x22b86a(0x37b),_0x1d676b(_0x3b40d3);return;}_0x3b40d3[_0x22b86a(0x399)]=_0x22b86a(0x35c),_0x3b40d3['errorMes'+'sage']=getTrimmedString(_0x508538['error_de'+_0x22b86a(0x396)+'n'])||(_0x46e181===_0x22b86a(0x2cb)+_0x22b86a(0x275)?_0x22b86a(0x295)+_0x22b86a(0x2c4):'飞书绑定失败:'+_0x46e181),_0x1d676b(_0x3b40d3);}catch(_0x40e322){_0x3b40d3[_0x22b86a(0x399)]=_0x22b86a(0x35c),_0x3b40d3[_0x22b86a(0x2c6)+_0x22b86a(0x2b8)]=_0x40e322 instanceof Error?_0x40e322['message']:_0x22b86a(0x259),_0x1d676b(_0x3b40d3);}}async function _0x5935c8(_0x2cda7d={}){const _0x266260=_0x5f22af,_0x13d128=_0x2cda7d[_0x266260(0x380)]===_0x266260(0x25e)+'ector'?_0x266260(0x25e)+_0x266260(0x3e3):'channel',_0x1ab4c4=createFeishuRegistrationClient(),_0x396257=await initFeishuRegistration(_0x1ab4c4),_0x10141a=Array[_0x266260(0x22d)](_0x396257[_0x266260(0x25c)+_0x266260(0x379)+'ethods'])?_0x396257['supporte'+_0x266260(0x379)+_0x266260(0x24f)][_0x266260(0x3c3)](getTrimmedString)['filter'](Boolean):[];if(!_0x10141a[_0x266260(0x3f2)]('client_s'+_0x266260(0x319)))throw new Error(_0x266260(0x350)+_0x266260(0x283)+_0x266260(0x288)+_0x266260(0x2cd)+_0x266260(0x1fc)+_0x266260(0x315)+'et\x20auth.');const _0x7c0943=await beginFeishuRegistration(_0x1ab4c4),_0x3adf6b=getTrimmedString(_0x7c0943[_0x266260(0x3dc)+_0x266260(0x1fa)+_0x266260(0x37f)+'e']),_0x2b0c51=extractFeishuRegistrationAuthorizationUri(_0x7c0943),_0xb7763d=getTrimmedString(_0x7c0943[_0x266260(0x2c8)+_0x266260(0x3ce)]),_0x17c478=Number(_0x7c0943[_0x266260(0x3de)+'n'])||0x258,_0x256df7=Number(_0x7c0943[_0x266260(0x327)])||0x5;if(!_0x3adf6b||!_0xb7763d)throw new Error(_0x266260(0x2ec)+_0x266260(0x3dc)+_0x266260(0x1fa)+_0x266260(0x37f)+_0x266260(0x2c1)+'ice_code'+'\x20in\x20begi'+'n\x20respon'+'se.');const _0x4d732b=randomUUID(),_0x322b1d={'sessionId':_0x4d732b,'purpose':_0x13d128,'client':_0x1ab4c4,'deviceCode':_0xb7763d,'verificationUriComplete':_0x3adf6b,'authorizationUri':_0x2b0c51,'expiresAt':Date['now']()+_0x17c478*0x3e8,'pollIntervalMs':Math[_0x266260(0x369)](_0x256df7*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'status':'pending','errorMessage':null,'timer':null};return _0x222366[_0x266260(0x332)](_0x4d732b,_0x322b1d),_0x33a0d6(_0x4d732b),serializeFeishuRegistrationSession(_0x322b1d);}function _0x461c31(_0x417959={}){const _0x45b169=_0x5f22af,_0x76b32=safeString(_0x417959['sessionI'+'d']);if(!_0x76b32)throw new Error(_0x45b169(0x33f)+_0x45b169(0x222)+_0x45b169(0x236)+'ion\x20id\x20i'+'s\x20requir'+'ed');const _0x3f9fb6=_0x222366[_0x45b169(0x282)](_0x76b32);if(!_0x3f9fb6)throw new Error(_0x45b169(0x33f)+'egistrat'+_0x45b169(0x236)+_0x45b169(0x3ed)+'found');return serializeFeishuRegistrationSession(_0x3f9fb6);}function _0x25607d(_0x47f4d2={}){const _0x4d41ee=_0x5f22af,_0x1065ce=safeString(_0x47f4d2[_0x4d41ee(0x1f5)+'d']);if(!_0x1065ce)return{'ok':!![]};const _0x5720e7=_0x222366[_0x4d41ee(0x282)](_0x1065ce);if(!_0x5720e7)return{'ok':!![]};return _0x1d676b(_0x5720e7),_0x222366[_0x4d41ee(0x34c)](_0x1065ce),{'ok':!![]};}async function _0x2fcc81(_0x5181d9,_0xa9dee7){const _0x2c0e2=_0x5f22af,_0x289157=_0x2467ad(),{env:_0x4b165d,runtime:_0x5004b1}=await _0x54f4d7({'FORCE_COLOR':'0','HOME':homedir(),'LARK_CLI_NO_PROXY':'1','OPENCLAW_HOME':_0x289157,'OPENCLAW_CONFIG_PATH':_0x5181d9['cliHostC'+'onfigPat'+'h']});await mkdir(_0x289157,{'recursive':!![]});const _0xfc6880=await _0x3f4fc3(_0x5004b1);for(const _0x317070 of[_0x2c0e2(0x29a)+'XY',_0x2c0e2(0x3b5)+_0x2c0e2(0x2ed),'ALL_PROX'+'Y',_0x2c0e2(0x3d4)+'xy',_0x2c0e2(0x37c)+_0x2c0e2(0x326),_0x2c0e2(0x21d)+'y']){delete _0x4b165d[_0x317070];}return new Promise((_0x371522,_0x449ceb)=>{const _0x2f23a2=_0x2c0e2;_0x221e70('connecto'+_0x2f23a2(0x220),{'connector':'feishu_d'+'oc','phase':'spawn','message':_0x2f23a2(0x3d5)+'\x20'+_0xa9dee7[_0x2f23a2(0x2ba)]('\x20')});const _0x2801f6=spawn(_0xfc6880[_0x2f23a2(0x309)+_0x2f23a2(0x374)],[_0xfc6880[_0x2f23a2(0x2a4)+'th'],..._0xa9dee7],{'cwd':_0x289157,'env':_0x4b165d});let _0x4e7462=![];_0x2801f6[_0x2f23a2(0x34d)](_0x2f23a2(0x378),()=>{_0x4e7462=!![],_0x371522(_0x2801f6);}),_0x2801f6[_0x2f23a2(0x34d)](_0x2f23a2(0x35c),_0x10ec72=>{if(_0x4e7462)return;_0x449ceb(_0x10ec72);});});}function _0x3b5223(_0x2bc2f2,_0x166458,_0x45cab7){const _0x3a832a=_0x5f22af;_0x2bc2f2[_0x3a832a(0x3f1)]=_0x45cab7[_0x3a832a(0x3f1)],_0x2bc2f2[_0x3a832a(0x227)]=_0x45cab7[_0x3a832a(0x227)];if(_0x45cab7[_0x3a832a(0x3f1)]!==_0x3a832a(0x3d1))_0x2bc2f2[_0x3a832a(0x348)]=null;_0x2bc2f2[_0x3a832a(0x228)]='',void _0x2fcc81(_0x2bc2f2,_0x166458)[_0x3a832a(0x2c2)](_0x4f44af=>{const _0xd442da=_0x3a832a;_0x2bc2f2[_0xd442da(0x2f2)]=_0x4f44af;const _0x4f3ef4=setTimeout(()=>{const _0x50c307=_0xd442da;if(_0x2bc2f2[_0x50c307(0x399)]!==_0x50c307(0x3f6))return;_0x4f44af[_0x50c307(0x242)](),_0x2bc2f2[_0x50c307(0x399)]=_0x50c307(0x35c),_0x2bc2f2[_0x50c307(0x2c6)+_0x50c307(0x2b8)]=_0x45cab7[_0x50c307(0x227)]+'超时',_0x2bc2f2[_0x50c307(0x2f2)]=null;},FEISHU_DOC_CLI_STEP_TIMEOUT_MS),_0x2675ad=_0x53f573=>{const _0x5be926=_0xd442da,_0x3909a1=_0x53f573[_0x5be926(0x298)]('utf8');_0x2bc2f2[_0x5be926(0x228)]+=_0x3909a1,_0x221e70(_0x5be926(0x2b0)+_0x5be926(0x220),{'connector':_0x5be926(0x3c5)+'oc','phase':_0x45cab7['phase'],'message':_0x3909a1});};_0x4f44af[_0xd442da(0x2eb)]['on'](_0xd442da(0x387),_0x2675ad),_0x4f44af[_0xd442da(0x22f)]['on'](_0xd442da(0x387),_0x2675ad);if(typeof _0x45cab7[_0xd442da(0x3ca)]===_0xd442da(0x2a0))_0x4f44af[_0xd442da(0x3ca)][_0xd442da(0x3cf)](_0x45cab7['stdin']);else _0x4f44af[_0xd442da(0x3ca)][_0xd442da(0x3cf)]();_0x4f44af['on'](_0xd442da(0x35c),_0x55c2c4=>{const _0x4f9b96=_0xd442da;clearTimeout(_0x4f3ef4),_0x2bc2f2[_0x4f9b96(0x399)]=_0x4f9b96(0x35c),_0x2bc2f2[_0x4f9b96(0x2c6)+'sage']=_0x55c2c4 instanceof Error?_0x55c2c4['message']:'飞书\x20CLI\x20执'+_0x4f9b96(0x31e),_0x2bc2f2['process']=null,_0x221e70(_0x4f9b96(0x2b0)+'r-log',{'connector':_0x4f9b96(0x3c5)+'oc','phase':_0x4f9b96(0x35c),'message':_0x2bc2f2[_0x4f9b96(0x2c6)+_0x4f9b96(0x2b8)]});}),_0x4f44af['on'](_0xd442da(0x2bb),_0x38f5d9=>{const _0x3a04e5=_0xd442da;clearTimeout(_0x4f3ef4),_0x2bc2f2[_0x3a04e5(0x2f2)]=null;if(_0x2bc2f2[_0x3a04e5(0x399)]!==_0x3a04e5(0x3f6))return;if(_0x38f5d9!==0x0){if(_0x45cab7[_0x3a04e5(0x3c4)+'e']){void Promise['resolve'](_0x45cab7['onFailur'+'e'](_0x38f5d9,_0x2bc2f2[_0x3a04e5(0x228)]))[_0x3a04e5(0x34f)](_0x37a28f=>{const _0x4c8b6f=_0x3a04e5;_0x2bc2f2[_0x4c8b6f(0x399)]=_0x4c8b6f(0x35c),_0x2bc2f2[_0x4c8b6f(0x2c6)+_0x4c8b6f(0x2b8)]=_0x37a28f instanceof Error?_0x37a28f['message']:_0x4c8b6f(0x2ce)+_0x4c8b6f(0x371);});return;}_0x2bc2f2[_0x3a04e5(0x399)]=_0x3a04e5(0x35c),_0x2bc2f2[_0x3a04e5(0x2c6)+_0x3a04e5(0x2b8)]=getFeishuDocCliFailureMessage(_0x45cab7[_0x3a04e5(0x3f1)],extractFeishuDocCliError(_0x2bc2f2[_0x3a04e5(0x228)],_0x3a04e5(0x3d5)+'\x20'+_0x166458[_0x3a04e5(0x2ba)]('\x20')+(_0x3a04e5(0x3b2)+_0x3a04e5(0x3cd)+'e\x20')+_0x38f5d9),'lark-cli'+'\x20'+_0x166458[_0x3a04e5(0x2ba)]('\x20')+('\x20exited\x20'+'with\x20cod'+'e\x20')+_0x38f5d9),_0x221e70(_0x3a04e5(0x2b0)+_0x3a04e5(0x220),{'connector':_0x3a04e5(0x3c5)+'oc','phase':'error','message':_0x2bc2f2['errorMes'+_0x3a04e5(0x2b8)]});return;}void Promise[_0x3a04e5(0x27a)](_0x45cab7[_0x3a04e5(0x22c)+'s']())[_0x3a04e5(0x34f)](_0x3e6948=>{const _0x457381=_0x3a04e5;_0x2bc2f2[_0x457381(0x399)]=_0x457381(0x35c),_0x2bc2f2[_0x457381(0x2c6)+'sage']=_0x3e6948 instanceof Error?_0x3e6948['message']:_0x457381(0x2ce)+_0x457381(0x371);});});})[_0x3a832a(0x34f)](_0x59a630=>{const _0x2dcceb=_0x3a832a;_0x2bc2f2[_0x2dcceb(0x399)]=_0x2dcceb(0x35c),_0x2bc2f2[_0x2dcceb(0x2c6)+'sage']=_0x59a630 instanceof Error?_0x59a630[_0x2dcceb(0x227)]:_0x2dcceb(0x3a1)+_0x2dcceb(0x31e),_0x2bc2f2[_0x2dcceb(0x2f2)]=null,_0x221e70('connecto'+_0x2dcceb(0x220),{'connector':_0x2dcceb(0x3c5)+'oc','phase':_0x2dcceb(0x35c),'message':_0x2bc2f2['errorMes'+_0x2dcceb(0x2b8)]});});}function _0x4a2a9b(_0x850a43){const _0x443cf2=_0x5f22af;if(!_0x850a43[_0x443cf2(0x394)])return;clearTimeout(_0x850a43[_0x443cf2(0x394)]),_0x850a43[_0x443cf2(0x394)]=null;}function _0x5d4363(_0x302e28){const _0x401f93=_0x5f22af;if(!_0x302e28[_0x401f93(0x3bb)+_0x401f93(0x3f0)])return;clearTimeout(_0x302e28[_0x401f93(0x3bb)+_0x401f93(0x3f0)]),_0x302e28[_0x401f93(0x3bb)+_0x401f93(0x3f0)]=null;}function _0x43e960(_0x17be66,_0x51f001=0x7d0){const _0x4f1a98=_0x5f22af;if(_0x17be66[_0x4f1a98(0x399)]!=='pending')return;_0x5d4363(_0x17be66),_0x17be66[_0x4f1a98(0x3bb)+_0x4f1a98(0x3f0)]=setTimeout(()=>{const _0x460b19=_0x4f1a98;_0x3b5223(_0x17be66,[_0x460b19(0x254),'status'],{'phase':_0x460b19(0x3d1),'message':_0x460b19(0x1f3)+'状态','onFailure':(_0x22df04,_0x3a5c8a)=>{const _0xcc0806=_0x460b19;if(Date['now']()-_0x17be66[_0xcc0806(0x3bb)+_0xcc0806(0x26d)+'dAt']>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x17be66[_0xcc0806(0x399)]='error',_0x17be66[_0xcc0806(0x2c6)+'sage']=getFeishuDocCliFailureMessage(_0xcc0806(0x3d1),extractFeishuDocCliError(_0x3a5c8a,_0xcc0806(0x3aa)+_0xcc0806(0x241)),'飞书\x20CLI\x20授'+'权状态验证超时');return;}_0x43e960(_0x17be66);},'onSuccess':()=>{const _0xd3040c=_0x460b19;try{ensureFeishuDocCliUserStatus(_0x17be66[_0xd3040c(0x228)]);}catch(_0xd9622b){if(Date[_0xd3040c(0x2ef)]()-_0x17be66[_0xd3040c(0x3bb)+_0xd3040c(0x26d)+'dAt']>FEISHU_DOC_CLI_STEP_TIMEOUT_MS){_0x17be66['status']=_0xd3040c(0x35c),_0x17be66['errorMes'+_0xd3040c(0x2b8)]=_0xd9622b instanceof Error?_0xd9622b[_0xd3040c(0x227)]:_0xd3040c(0x3aa)+'权状态验证失败';return;}_0x43e960(_0x17be66);return;}return _0x5d4363(_0x17be66),_0x2c58aa(_0x17be66);}});},_0x51f001);}function _0x1d1667(_0x2b1fd1){const _0x4a6b92=_0x5f22af;if(!_0x2b1fd1['cliAppId']||!_0x2b1fd1[_0x4a6b92(0x3ef)+'cret']){_0x2b1fd1[_0x4a6b92(0x399)]=_0x4a6b92(0x35c),_0x2b1fd1[_0x4a6b92(0x2c6)+'sage']=_0x4a6b92(0x2f0)+_0x4a6b92(0x31a)+_0x4a6b92(0x342);return;}const _0x13b2b3=_0x2b1fd1[_0x4a6b92(0x31b)],_0x429c30=_0x2b1fd1[_0x4a6b92(0x3ef)+_0x4a6b92(0x291)];_0x3b5223(_0x2b1fd1,[_0x4a6b92(0x3d0)+'n'],{'phase':_0x4a6b92(0x372),'message':'正在检查飞书\x20C'+'LI','onSuccess':()=>{const _0x5bf402=_0x4a6b92;_0x3b5223(_0x2b1fd1,[_0x5bf402(0x23a),_0x5bf402(0x35a),'--force-'+_0x5bf402(0x35a),_0x5bf402(0x2e6),_0x13b2b3,_0x5bf402(0x365)+_0x5bf402(0x3e1)+'in',_0x5bf402(0x2e9),_0x5bf402(0x306)],{'phase':_0x5bf402(0x372),'message':'正在初始化飞书\x20'+_0x5bf402(0x3b7)+'应用','stdin':_0x429c30,'onSuccess':()=>{const _0x2755bb=_0x5bf402;_0x3b5223(_0x2b1fd1,[_0x2755bb(0x254),_0x2755bb(0x3da),_0x2755bb(0x2fe),_0x2755bb(0x277)+_0x2755bb(0x308)+_0x2755bb(0x202)+_0x2755bb(0x390)+_0x2755bb(0x3ea)+_0x2755bb(0x24b),_0x2755bb(0x349),_0x2755bb(0x271)+_0x2755bb(0x20e),_0x2755bb(0x341)+'t'],{'phase':'auth','message':_0x2755bb(0x3c9)+_0x2755bb(0x29f),'onSuccess':()=>{const _0x4114f1=_0x2755bb,_0x50ce64=parseFeishuDocCliJson(_0x2b1fd1[_0x4114f1(0x228)]),_0x227f9c=getTrimmedString(_0x50ce64[_0x4114f1(0x3dc)+_0x4114f1(0x1fa)+_0x4114f1(0x37f)+'e'])||getTrimmedString(_0x50ce64[_0x4114f1(0x3dc)+'tion_url'])||getTrimmedString(_0x50ce64[_0x4114f1(0x3dc)+_0x4114f1(0x1fa)]),_0x370981=getTrimmedString(_0x50ce64[_0x4114f1(0x2c8)+_0x4114f1(0x3ce)]);if(!_0x227f9c||!_0x370981){_0x2b1fd1[_0x4114f1(0x399)]=_0x4114f1(0x35c),_0x2b1fd1[_0x4114f1(0x2c6)+_0x4114f1(0x2b8)]=_0x4114f1(0x1f6)+'返回授权\x20URL'+'\x20或\x20devic'+_0x4114f1(0x2b3)+summarizeCliOutput(_0x2b1fd1[_0x4114f1(0x228)]);return;}_0x2b1fd1[_0x4114f1(0x348)]=_0x227f9c,_0x2b1fd1[_0x4114f1(0x225)+'de']=_0x370981,void _0x1e09a3[_0x4114f1(0x237)+_0x4114f1(0x3b6)](_0x227f9c)['catch'](()=>{}),_0x3b5223(_0x2b1fd1,[_0x4114f1(0x254),_0x4114f1(0x3da),_0x4114f1(0x28b)+_0x4114f1(0x27b),_0x370981],{'phase':_0x4114f1(0x3d1),'message':'等待飞书用户授权'+'完成','onSuccess':()=>{const _0x884a18=_0x4114f1;_0x2b1fd1['authStat'+_0x884a18(0x26d)+_0x884a18(0x3e2)]=Date[_0x884a18(0x2ef)](),_0x43e960(_0x2b1fd1,0x1f4);}});}});}});}});}function _0x5bd48c(_0x545a81){const _0x21897a=_0x5f22af;if(_0x545a81[_0x21897a(0x399)]!==_0x21897a(0x3f6))return;_0x4a2a9b(_0x545a81),_0x545a81[_0x21897a(0x394)]=setTimeout(()=>void _0x2e8010(_0x545a81),_0x545a81[_0x21897a(0x346)+_0x21897a(0x3db)+'s']);}async function _0x2e8010(_0x37bb3c){const _0x25f04c=_0x5f22af;if(_0x37bb3c['status']!=='pending'||_0x37bb3c['phase']!==_0x25f04c(0x2bd)||!_0x37bb3c[_0x25f04c(0x3c2)+_0x25f04c(0x3ec)]||!_0x37bb3c[_0x25f04c(0x337)+_0x25f04c(0x3eb)])return;if(Date[_0x25f04c(0x2ef)]()>=_0x37bb3c['appExpir'+_0x25f04c(0x3c8)]){_0x37bb3c[_0x25f04c(0x399)]=_0x25f04c(0x35c),_0x37bb3c[_0x25f04c(0x2c6)+_0x25f04c(0x2b8)]=_0x25f04c(0x36c)+',请重新连接',_0x4a2a9b(_0x37bb3c);return;}try{const _0x3e94b3=await pollFeishuRegistration(_0x37bb3c['appPollC'+_0x25f04c(0x3ec)],_0x37bb3c['appDevic'+_0x25f04c(0x3eb)]),_0x19cf2b=getTrimmedString(_0x3e94b3['client_i'+'d']),_0x4bd919=getTrimmedString(_0x3e94b3['client_s'+_0x25f04c(0x319)]),_0x2d826c=getTrimmedString(_0x3e94b3[_0x25f04c(0x35c)]);if(_0x19cf2b&&_0x4bd919){const _0x496e7a=asRecord(_0x3e94b3[_0x25f04c(0x352)+'o']);await _0x57bef3({'appId':_0x19cf2b,'appSecret':_0x4bd919,'userInfo':{'openId':getTrimmedString(_0x496e7a['open_id'])||null},'configPath':_0x37bb3c[_0x25f04c(0x21f)+_0x25f04c(0x32a)+'h']}),_0x37bb3c['cliAppId']=_0x19cf2b,_0x37bb3c['cliAppSe'+_0x25f04c(0x291)]=_0x4bd919,_0x4a2a9b(_0x37bb3c),_0x37bb3c[_0x25f04c(0x227)]=_0x25f04c(0x2fd)+_0x25f04c(0x2ea),_0x1d1667(_0x37bb3c);return;}if(!_0x2d826c||_0x2d826c===_0x25f04c(0x21e)+_0x25f04c(0x24e)+_0x25f04c(0x3f3)){_0x5bd48c(_0x37bb3c);return;}if(_0x2d826c===_0x25f04c(0x3a3)+'n'){_0x37bb3c[_0x25f04c(0x346)+'ntervalM'+'s']+=0x1388,_0x5bd48c(_0x37bb3c);return;}_0x37bb3c[_0x25f04c(0x399)]=_0x25f04c(0x35c),_0x37bb3c[_0x25f04c(0x2c6)+'sage']=getTrimmedString(_0x3e94b3[_0x25f04c(0x302)+_0x25f04c(0x396)+'n'])||'飞书应用创建失败'+':'+_0x2d826c,_0x4a2a9b(_0x37bb3c);}catch(_0x32c0df){_0x37bb3c[_0x25f04c(0x399)]=_0x25f04c(0x35c),_0x37bb3c[_0x25f04c(0x2c6)+_0x25f04c(0x2b8)]=_0x32c0df instanceof Error?_0x32c0df[_0x25f04c(0x227)]:'飞书应用创建失败',_0x4a2a9b(_0x37bb3c);}}async function _0x2c58aa(_0x32c109){const _0x589f3d=_0x5f22af;await _0x108fc7({'accountName':_0x589f3d(0x231)}),_0x32c109['status']=_0x589f3d(0x39d)+'d',_0x32c109[_0x589f3d(0x3f1)]=_0x589f3d(0x39d)+'d',_0x32c109[_0x589f3d(0x227)]=_0x589f3d(0x2b6)+'完成',_0x32c109[_0x589f3d(0x2c6)+_0x589f3d(0x2b8)]=null;}async function _0x2642c0(){const _0x331132=_0x5f22af,_0x53ece4=createFeishuRegistrationClient(),_0xe9fa88=await initFeishuRegistration(_0x53ece4),_0x11ee96=Array[_0x331132(0x22d)](_0xe9fa88['supporte'+_0x331132(0x379)+'ethods'])?_0xe9fa88['supporte'+_0x331132(0x379)+_0x331132(0x24f)][_0x331132(0x3c3)](getTrimmedString)[_0x331132(0x2d9)](Boolean):[];if(!_0x11ee96[_0x331132(0x3f2)](_0x331132(0x30b)+_0x331132(0x319)))throw new Error(_0x331132(0x384)+_0x331132(0x3d3)+_0x331132(0x30b)+_0x331132(0x20d));const _0x169ae5=await beginFeishuRegistration(_0x53ece4),_0x1ea97b=getTrimmedString(_0x169ae5[_0x331132(0x3dc)+'tion_uri'+'_complet'+'e']),_0x2e300c=getTrimmedString(_0x169ae5['device_c'+_0x331132(0x3ce)]),_0x4df434=Number(_0x169ae5[_0x331132(0x3de)+'n'])||0x258,_0x97c578=Number(_0x169ae5[_0x331132(0x327)])||0x5;if(!_0x1ea97b||!_0x2e300c)throw new Error(_0x331132(0x263)+_0x331132(0x36b)+'\x20device_'+'code,请重试');const _0x1d5372=randomUUID(),_0x51b9a2={'sessionId':_0x1d5372,'status':'pending','phase':_0x331132(0x2bd),'url':_0x1ea97b,'appDeviceCode':_0x2e300c,'appPollClient':_0x53ece4,'appPollIntervalMs':Math[_0x331132(0x369)](_0x97c578*0x3e8,DEFAULT_FEISHU_REGISTRATION_INTERVAL_MS),'appExpiresAt':Date[_0x331132(0x2ef)]()+_0x4df434*0x3e8,'appTimer':null,'authStatusTimer':null,'authStatusStartedAt':0x0,'deviceCode':null,'message':'请在飞书开放平台'+_0x331132(0x208),'errorMessage':null,'process':null,'output':'','cliHostConfigPath':_0x54ab32(),'cliAppId':null,'cliAppSecret':null};return _0x2c64a9[_0x331132(0x332)](_0x1d5372,_0x51b9a2),_0x5bd48c(_0x51b9a2),createFeishuDocCliStatus(_0x51b9a2);}function _0x53ee11(_0x3773b1={}){const _0x169054=_0x5f22af,_0x2cc831=safeString(_0x3773b1[_0x169054(0x1f5)+'d']);if(!_0x2cc831)throw new Error('Feishu\x20d'+'oc\x20CLI\x20s'+_0x169054(0x323)+'d\x20is\x20req'+_0x169054(0x284));const _0xfe720f=_0x2c64a9[_0x169054(0x282)](_0x2cc831);if(!_0xfe720f)throw new Error(_0x169054(0x23e)+_0x169054(0x26e)+'ession\x20n'+_0x169054(0x33b));return createFeishuDocCliStatus(_0xfe720f);}function _0x56a326(_0x162533={}){const _0x2ade34=_0x5f22af,_0x47e36f=safeString(_0x162533[_0x2ade34(0x1f5)+'d']);if(!_0x47e36f)return{'ok':!![]};const _0x3c9c46=_0x2c64a9[_0x2ade34(0x282)](_0x47e36f);if(!_0x3c9c46)return{'ok':!![]};return _0x4a2a9b(_0x3c9c46),_0x5d4363(_0x3c9c46),_0x3c9c46[_0x2ade34(0x2f2)]?.[_0x2ade34(0x242)](),_0x2c64a9['delete'](_0x47e36f),{'ok':!![]};}function _0x3792c0(_0x5b735c={}){const _0x3bf7dd=_0x5f22af,_0x13cbde=safeString(_0x5b735c[_0x3bf7dd(0x1f5)+'d']);if(!_0x13cbde)throw new Error(_0x3bf7dd(0x23e)+_0x3bf7dd(0x26e)+_0x3bf7dd(0x323)+_0x3bf7dd(0x245)+_0x3bf7dd(0x284));const _0x1745e5=_0x2c64a9[_0x3bf7dd(0x282)](_0x13cbde);if(!_0x1745e5)throw new Error(_0x3bf7dd(0x23e)+_0x3bf7dd(0x26e)+_0x3bf7dd(0x2a9)+_0x3bf7dd(0x33b));if(_0x1745e5[_0x3bf7dd(0x399)]==='error')throw new Error(_0x1745e5['errorMes'+_0x3bf7dd(0x2b8)]||_0x3bf7dd(0x2ce)+_0x3bf7dd(0x371));return{'ok':!![]};}async function _0x274c30(_0x28dba0){const _0x8df1f2=_0x5f22af,_0x438aeb=asRecord(_0x28dba0[_0x8df1f2(0x360)]),_0x2c5951=asRecord(_0x438aeb['entries']),_0x4a9b4e=asStringArray(_0x438aeb[_0x8df1f2(0x2a8)]),_0x1e9c46=asRecord(_0x2c5951[WECHAT_PLUGIN_ID]),_0x3c5366=_0x1e9c46[_0x8df1f2(0x368)]===!![]||_0x4a9b4e['includes'](WECHAT_PLUGIN_ID),_0x537125=join(_0x5724ce[_0x8df1f2(0x3a9)+_0x8df1f2(0x3b9)](),WECHAT_PLUGIN_ID),_0x2d4c3e=join(_0x537125,_0x8df1f2(0x223)+'.json');let _0x370148=![];try{const _0x21e84e=(await readFile(_0x2d4c3e,_0x8df1f2(0x37e)))['trim']();if(_0x21e84e){const _0x2beb42=JSON['parse'](_0x21e84e);_0x370148=Array[_0x8df1f2(0x22d)](_0x2beb42)?_0x2beb42[_0x8df1f2(0x2d3)]>0x0:Object[_0x8df1f2(0x32d)](asRecord(_0x2beb42))[_0x8df1f2(0x2d3)]>0x0;}}catch{}if(!_0x370148)try{_0x370148=(await readdir(join(_0x537125,'accounts')))[_0x8df1f2(0x2d3)]>0x0;}catch{}return{'exists':_0x3c5366||_0x370148,'enabled':_0x3c5366,'connected':_0x3c5366&&_0x370148};}async function _0x20f0d1(){const _0x3397eb=_0x5f22af,_0x12f096=await _0x29d527(),_0x234179=asRecord(_0x12f096[_0x3397eb(0x2f7)]),_0x560969=[],_0x18d021=await _0x274c30(_0x12f096);_0x18d021[_0x3397eb(0x2a2)]&&_0x560969[_0x3397eb(0x2f5)]({'id':WECHAT_PLUGIN_ID,'type':_0x3397eb(0x398),'name':'微信','enabled':_0x18d021['enabled'],'connected':_0x18d021[_0x3397eb(0x383)+'d']});const _0x1d13b4=asRecord(_0x234179[_0x3397eb(0x3ba)]),_0x58742d=getTrimmedString(_0x1d13b4[_0x3397eb(0x27c)]),_0x1c71e2=getTrimmedString(_0x1d13b4[_0x3397eb(0x240)+_0x3397eb(0x291)]);_0x58742d&&_0x1c71e2&&_0x560969['push']({'id':'qqbot','type':_0x3397eb(0x3ba),'name':_0x3397eb(0x1fd),'enabled':_0x1d13b4['enabled']!==![],'appId':_0x58742d,'clientSecret':_0x1c71e2});const _0x2070ce=asRecord(_0x234179[_0x3397eb(0x2ac)]),_0x27fa7d=getTrimmedString(_0x2070ce[_0x3397eb(0x312)]),_0x4e4692=getTrimmedString(_0x2070ce[_0x3397eb(0x3a2)]);_0x27fa7d&&_0x4e4692&&_0x560969['push']({'id':_0x3397eb(0x2ac),'type':'wecom','name':_0x3397eb(0x3c1),'enabled':_0x2070ce[_0x3397eb(0x368)]!==![],'botId':_0x27fa7d,'secret':_0x4e4692});const _0x280f95=asRecord(_0x234179[_0x3397eb(0x306)]),_0x3a7067=getTrimmedString(_0x280f95[_0x3397eb(0x27c)]),_0xc573a2=getTrimmedString(_0x280f95[_0x3397eb(0x320)+'t']);return _0x3a7067&&_0xc573a2&&getTrimmedString(_0x280f95[_0x3397eb(0x2f1)+'y'])!==FEISHU_DOC_CONNECTOR_PLUGIN_ID&&_0x560969['push']({'id':_0x3397eb(0x306),'type':_0x3397eb(0x306),'name':_0x3397eb(0x37d),'enabled':_0x280f95[_0x3397eb(0x368)]!==![],'appId':_0x3a7067,'appSecret':_0xc573a2}),_0x560969;}async function _0x2217b4(_0x45f7aa){const _0x48e3f2=_0x5f22af;if(typeof openClawConfigHandlers[_0x48e3f2(0x239)+'nConfig']==='function')return openClawConfigHandlers[_0x48e3f2(0x239)+_0x48e3f2(0x377)]({'pluginId':WECHAT_PLUGIN_ID,'enabled':Boolean(_0x45f7aa),'reason':WECHAT_PLUGIN_ID+_0x48e3f2(0x2ee)+(_0x45f7aa?_0x48e3f2(0x368):'disabled')});const _0x308d06=await _0x29d527(),_0xb29689=asRecord(_0x308d06[_0x48e3f2(0x360)]),_0x414b4a=asRecord(_0xb29689[_0x48e3f2(0x2f9)]);return _0x414b4a[WECHAT_PLUGIN_ID]={...asRecord(_0x414b4a[WECHAT_PLUGIN_ID]),'enabled':Boolean(_0x45f7aa)},_0xb29689['entries']=_0x414b4a,_0xb29689[_0x48e3f2(0x2a8)]=_0x45f7aa?dedupeStrings([...asStringArray(_0xb29689[_0x48e3f2(0x2a8)]),WECHAT_PLUGIN_ID]):asStringArray(_0xb29689[_0x48e3f2(0x2a8)])['filter'](_0x11dcee=>_0x11dcee!==WECHAT_PLUGIN_ID),_0x308d06[_0x48e3f2(0x360)]=_0xb29689,await _0x5b1448(_0x308d06,WECHAT_PLUGIN_ID+_0x48e3f2(0x2ee)+(_0x45f7aa?_0x48e3f2(0x368):_0x48e3f2(0x33a))),{'ok':!![]};}async function _0x46a5ef(_0xb69513={}){const _0x25a462=_0x5f22af,_0xb1e74a=safeString(_0xb69513[_0x25a462(0x1f2)+'d']||_0xb69513['id']);if(!_0xb1e74a)throw new Error('Channel\x20'+_0x25a462(0x325)+_0x25a462(0x345));const _0x58a02b=await _0x29d527(),_0x17964a=asRecord(_0x58a02b[_0x25a462(0x2f7)]),_0x390274=asRecord(_0x58a02b[_0x25a462(0x360)]),_0x286460=asRecord(_0x390274[_0x25a462(0x2f9)]),_0x1d4323=_0x2c3f94=>{const _0x17bddc=_0x25a462;_0x286460[_0x2c3f94]=createConnectorPluginEntry(_0x2c3f94,_0x286460[_0x2c3f94],![],{}),_0x390274['allow']=asStringArray(_0x390274[_0x17bddc(0x2a8)])[_0x17bddc(0x2d9)](_0xe3073a=>_0xe3073a!==_0x2c3f94),_0x390274[_0x17bddc(0x2f9)]=_0x286460,_0x58a02b[_0x17bddc(0x360)]=_0x390274;};if(_0xb1e74a==='feishu_d'+'oc')return _0x1d4323(FEISHU_DOC_CONNECTOR_PLUGIN_ID),getTrimmedString(asRecord(_0x17964a['feishu'])[_0x25a462(0x2f1)+'y'])===FEISHU_DOC_CONNECTOR_PLUGIN_ID&&(delete _0x17964a[_0x25a462(0x306)],_0x58a02b['channels']=_0x17964a),await rm(_0x2467ad(),{'recursive':!![],'force':!![]})['catch'](()=>{}),_0x5b1448(_0x58a02b,_0x25a462(0x2f8)+'oc\x20conne'+_0x25a462(0x29c)+_0x25a462(0x3a4)+'ted');if(_0xb1e74a==='qq_mail'){if(typeof openClawConfigHandlers[_0x25a462(0x239)+_0x25a462(0x377)]===_0x25a462(0x313))return openClawConfigHandlers[_0x25a462(0x239)+_0x25a462(0x377)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x25a462(0x353)+_0x25a462(0x2b0)+'r\x20plugin'+_0x25a462(0x21c)});return _0x1d4323(QQ_MAIL_CONNECTOR_PLUGIN_ID),_0x5b1448(_0x58a02b,_0x25a462(0x353)+_0x25a462(0x2b0)+_0x25a462(0x3a5)+_0x25a462(0x21c));}if(_0xb1e74a===_0x25a462(0x39a)+_0x25a462(0x333)){if(typeof openClawConfigHandlers[_0x25a462(0x239)+_0x25a462(0x377)]===_0x25a462(0x313))return openClawConfigHandlers[_0x25a462(0x239)+'nConfig']({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x25a462(0x357)+_0x25a462(0x324)+_0x25a462(0x3ae)+_0x25a462(0x22a)+_0x25a462(0x2fa)});return _0x1d4323(NETEASE_MAIL_CONNECTOR_PLUGIN_ID),_0x5b1448(_0x58a02b,'netease\x20'+'mail\x20con'+_0x25a462(0x3ae)+'lugin\x20de'+_0x25a462(0x2fa));}if(_0xb1e74a===_0x25a462(0x287)+_0x25a462(0x2d0)){if(typeof openClawConfigHandlers[_0x25a462(0x239)+_0x25a462(0x377)]===_0x25a462(0x313))return openClawConfigHandlers['setPlugi'+_0x25a462(0x377)]({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':![],'config':{},'reason':_0x25a462(0x38f)+_0x25a462(0x24c)+_0x25a462(0x366)+_0x25a462(0x2ee)+_0x25a462(0x247)});return _0x1d4323(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID),_0x5b1448(_0x58a02b,'tencent\x20'+_0x25a462(0x24c)+_0x25a462(0x366)+_0x25a462(0x2ee)+_0x25a462(0x247));}if(_0xb1e74a===_0x25a462(0x287)+_0x25a462(0x2a7)){if(typeof openClawConfigHandlers['deleteSk'+'illEntry']===_0x25a462(0x313))return openClawConfigHandlers[_0x25a462(0x1fe)+_0x25a462(0x30e)]({'skillId':TENCENT_DOCS_SKILL_ID,'reason':'tencent\x20'+_0x25a462(0x28c)+_0x25a462(0x391)+'ctor\x20del'+_0x25a462(0x3c7)});const _0x5c285b=asRecord(_0x58a02b['skills']),_0x546729=asRecord(_0x5c285b[_0x25a462(0x2f9)]);return delete _0x546729[TENCENT_DOCS_SKILL_ID],_0x5c285b[_0x25a462(0x2f9)]=_0x546729,_0x58a02b[_0x25a462(0x257)]=_0x5c285b,_0x5b1448(_0x58a02b,_0x25a462(0x38f)+_0x25a462(0x28c)+'ll\x20conne'+_0x25a462(0x2a1)+_0x25a462(0x3c7));}if(_0xb1e74a===_0x25a462(0x262))return await _0x14158d([_0x25a462(0x254),_0x25a462(0x206)])['catch'](()=>({'code':null,'output':''})),await _0x381203(),{'ok':!![]};if(_0xb1e74a===_0x25a462(0x318)+'_doc'){if(typeof openClawConfigHandlers[_0x25a462(0x32f)+_0x25a462(0x3ee)]===_0x25a462(0x313))return openClawConfigHandlers['deleteMc'+'pServer']({'serverName':DINGTALK_DOC_MCP_SERVER_NAME,'reason':_0x25a462(0x318)+_0x25a462(0x35b)+_0x25a462(0x21c)});const _0x5f3f45=readOpenClawMcpServersFromConfig(_0x58a02b);return delete _0x5f3f45[DINGTALK_DOC_MCP_SERVER_NAME],writeOpenClawMcpServersToConfig(_0x58a02b,_0x5f3f45),_0x5b1448(_0x58a02b,'dingtalk'+'\x20doc\x20mcp'+'\x20deleted');}if(_0xb1e74a===WECHAT_PLUGIN_ID||_0xb1e74a===_0x25a462(0x272)+_0x25a462(0x336)){_0x286460[WECHAT_PLUGIN_ID]={...asRecord(_0x286460[WECHAT_PLUGIN_ID]),'enabled':![]},_0x390274[_0x25a462(0x2f9)]=_0x286460,_0x390274[_0x25a462(0x2a8)]=asStringArray(_0x390274['allow'])['filter'](_0x2f47d5=>_0x2f47d5!==WECHAT_PLUGIN_ID&&_0x2f47d5!==_0x25a462(0x272)+_0x25a462(0x336)),_0x58a02b[_0x25a462(0x360)]=_0x390274;const _0x205d7d=join(_0x5724ce['resolveS'+_0x25a462(0x3b9)](),WECHAT_PLUGIN_ID);return await rm(join(_0x205d7d,'accounts'+_0x25a462(0x2c5)),{'force':!![]})[_0x25a462(0x34f)](()=>{}),await rm(join(_0x205d7d,_0x25a462(0x223)),{'recursive':!![],'force':!![]})[_0x25a462(0x34f)](()=>{}),_0x5b1448(_0x58a02b,_0xb1e74a+(_0x25a462(0x2c3)+_0x25a462(0x276)+'deleted'));}if(_0xb1e74a===_0x25a462(0x306)){if(typeof openClawConfigHandlers[_0x25a462(0x217)+_0x25a462(0x3bc)+_0x25a462(0x3b0)]===_0x25a462(0x313))return openClawConfigHandlers['deleteCh'+_0x25a462(0x3bc)+_0x25a462(0x3b0)]({'channelId':_0x25a462(0x306),'pluginId':'feishu','reason':_0x25a462(0x31c)+_0x25a462(0x210)+_0x25a462(0x2c7)+_0x25a462(0x2fa)});return delete _0x17964a[_0x25a462(0x306)],_0x58a02b[_0x25a462(0x2f7)]=_0x17964a,_0x286460[_0x25a462(0x306)]={...asRecord(_0x286460[_0x25a462(0x306)]),'enabled':![]},_0x390274[_0x25a462(0x2f9)]=_0x286460,_0x390274[_0x25a462(0x2a8)]=asStringArray(_0x390274[_0x25a462(0x2a8)])[_0x25a462(0x2d9)](_0x4dac9a=>_0x4dac9a!==_0x25a462(0x306)),_0x58a02b[_0x25a462(0x360)]=_0x390274,_0x5b1448(_0x58a02b,_0x25a462(0x31c)+_0x25a462(0x210)+'onfig\x20de'+'leted');}if(_0xb1e74a==='qqbot'){if(typeof openClawConfigHandlers[_0x25a462(0x217)+'annelCon'+_0x25a462(0x3b0)]===_0x25a462(0x313))return openClawConfigHandlers[_0x25a462(0x217)+_0x25a462(0x3bc)+'fig']({'channelId':_0x25a462(0x3ba),'pluginId':QQBOT_PLUGIN_ID,'reason':_0x25a462(0x248)+_0x25a462(0x2d8)+_0x25a462(0x34e)+_0x25a462(0x3c7)});delete _0x17964a[_0x25a462(0x3ba)],_0x286460[QQBOT_PLUGIN_ID]={...asRecord(_0x286460[QQBOT_PLUGIN_ID]),'enabled':![]},_0x390274[_0x25a462(0x2a8)]=asStringArray(_0x390274[_0x25a462(0x2a8)])['filter'](_0x34df7b=>_0x34df7b!==QQBOT_PLUGIN_ID);}if(_0xb1e74a===_0x25a462(0x2ac)){if(typeof openClawConfigHandlers[_0x25a462(0x217)+_0x25a462(0x3bc)+'fig']==='function')return openClawConfigHandlers[_0x25a462(0x217)+_0x25a462(0x3bc)+'fig']({'channelId':_0x25a462(0x2ac),'pluginId':WECOM_PLUGIN_ID,'reason':'wecom\x20ch'+'annel\x20co'+'nfig\x20del'+_0x25a462(0x3c7)});delete _0x17964a[_0x25a462(0x2ac)],_0x286460[WECOM_PLUGIN_ID]={...asRecord(_0x286460[WECOM_PLUGIN_ID]),'enabled':![]},_0x390274[_0x25a462(0x2a8)]=asStringArray(_0x390274[_0x25a462(0x2a8)])[_0x25a462(0x2d9)](_0x24b995=>_0x24b995!==WECOM_PLUGIN_ID);}return _0x58a02b[_0x25a462(0x2f7)]=_0x17964a,_0x390274[_0x25a462(0x2f9)]=_0x286460,_0x58a02b[_0x25a462(0x360)]=_0x390274,_0x5b1448(_0x58a02b,_0xb1e74a+(_0x25a462(0x2c3)+'\x20config\x20'+_0x25a462(0x247)));}async function _0x4c454d(_0x531dda={}){const _0xef1a92=_0x5f22af,_0x5dbdff=safeString(_0x531dda[_0xef1a92(0x1f2)+'d']||_0x531dda['id']);if(!_0x5dbdff)throw new Error(_0xef1a92(0x211)+_0xef1a92(0x325)+_0xef1a92(0x345));const _0x573c4e=_0x531dda[_0xef1a92(0x368)]===!![],_0x527e10=await _0x29d527(),_0x13e1e7=asRecord(_0x527e10[_0xef1a92(0x360)]),_0x3322cf=asRecord(_0x13e1e7[_0xef1a92(0x2f9)]),_0x356b55=_0x1872cc=>{const _0x356be8=_0xef1a92;_0x3322cf[_0x1872cc]=createConnectorPluginEntry(_0x1872cc,_0x3322cf[_0x1872cc],_0x573c4e,{},{'preserveExistingConfig':!![]}),_0x13e1e7['allow']=_0x573c4e?dedupeStrings([...asStringArray(_0x13e1e7[_0x356be8(0x2a8)]),_0x1872cc]):asStringArray(_0x13e1e7[_0x356be8(0x2a8)])[_0x356be8(0x2d9)](_0x1e48d9=>_0x1e48d9!==_0x1872cc),_0x13e1e7[_0x356be8(0x2f9)]=_0x3322cf,_0x527e10[_0x356be8(0x360)]=_0x13e1e7;};if(_0x5dbdff===_0xef1a92(0x3c5)+'oc'){const _0x36cc48=asRecord(_0x3322cf[FEISHU_DOC_CONNECTOR_PLUGIN_ID]);if(Object[_0xef1a92(0x32d)](_0x36cc48)['length']===0x0)throw new Error(_0xef1a92(0x381)+_0xef1a92(0x388)+_0x5dbdff+(_0xef1a92(0x39e)+_0xef1a92(0x330)));if(typeof openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]({'pluginId':FEISHU_DOC_CONNECTOR_PLUGIN_ID,'enabled':_0x573c4e,'reason':_0x5dbdff+(_0xef1a92(0x2c3)+'\x20config\x20')+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x356b55(FEISHU_DOC_CONNECTOR_PLUGIN_ID);}else{if(_0x5dbdff===_0xef1a92(0x364)){if(typeof openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]({'pluginId':QQ_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x573c4e,'reason':_0x5dbdff+(_0xef1a92(0x2c3)+_0xef1a92(0x276))+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x356b55(QQ_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5dbdff===_0xef1a92(0x39a)+'mail'){if(typeof openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]({'pluginId':NETEASE_MAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x573c4e,'reason':_0x5dbdff+('\x20channel'+_0xef1a92(0x276))+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x356b55(NETEASE_MAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5dbdff===_0xef1a92(0x287)+_0xef1a92(0x2d0)){if(typeof openClawConfigHandlers[_0xef1a92(0x239)+_0xef1a92(0x377)]===_0xef1a92(0x313))return openClawConfigHandlers['setPlugi'+'nConfig']({'pluginId':TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID,'enabled':_0x573c4e,'reason':_0x5dbdff+(_0xef1a92(0x2c3)+'\x20config\x20')+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x356b55(TENCENT_EXMAIL_CONNECTOR_PLUGIN_ID);}else{if(_0x5dbdff==='tencent_'+_0xef1a92(0x2a7)){const _0x423f97=asRecord(_0x527e10[_0xef1a92(0x257)]),_0x5c9f30=asRecord(_0x423f97[_0xef1a92(0x2f9)]),_0x3f6314=asRecord(_0x5c9f30[TENCENT_DOCS_SKILL_ID]);if(typeof openClawConfigHandlers[_0xef1a92(0x2e2)+_0xef1a92(0x37a)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x2e2)+'Entry']({'skillId':TENCENT_DOCS_SKILL_ID,'entry':{..._0x3f6314,'enabled':_0x573c4e},'reason':_0x5dbdff+(_0xef1a92(0x2c3)+'\x20config\x20')+(_0x573c4e?_0xef1a92(0x368):'disabled')});_0x5c9f30[TENCENT_DOCS_SKILL_ID]={..._0x3f6314,'enabled':_0x573c4e},_0x423f97[_0xef1a92(0x2f9)]=_0x5c9f30,_0x527e10[_0xef1a92(0x257)]=_0x423f97;}else{if(_0x5dbdff===_0xef1a92(0x262)){if(_0x573c4e&&!await _0x449207())throw new Error('金山文档尚未授权'+_0xef1a92(0x3f4));return await _0x23b6d7(_0x573c4e),{'ok':!![]};}else{if(_0x5dbdff===_0xef1a92(0x318)+_0xef1a92(0x338)){const _0x6edb2d=readOpenClawMcpServersFromConfig(_0x527e10),_0x40e348=findDingtalkDocMcpServer(_0x6edb2d);if(!getTrimmedString(_0x40e348[_0xef1a92(0x348)]))throw new Error(_0xef1a92(0x381)+_0xef1a92(0x388)+_0x5dbdff+(_0xef1a92(0x39e)+'und'));_0x6edb2d[DINGTALK_DOC_MCP_SERVER_NAME]=createDingtalkDocMcpServerConfig(_0x40e348['url'],{'enabled':_0x573c4e}),writeOpenClawMcpServersToConfig(_0x527e10,_0x6edb2d);}else{const _0x1b71f7=asRecord(_0x527e10['channels']),_0x191d0d=asRecord(_0x1b71f7[_0x5dbdff]);if(Object['keys'](_0x191d0d)[_0xef1a92(0x2d3)]===0x0)throw new Error(_0xef1a92(0x211)+'\x22'+_0x5dbdff+(_0xef1a92(0x39e)+'und'));_0x191d0d[_0xef1a92(0x368)]=_0x573c4e;let _0x221b95=null;_0x5dbdff===_0xef1a92(0x306)&&(_0x221b95=_0xef1a92(0x306),_0x573c4e&&(_0x191d0d[_0xef1a92(0x2dc)+'g']=!![],delete _0x191d0d[_0xef1a92(0x31f)]));if(_0x5dbdff===_0xef1a92(0x3ba))_0x221b95=QQBOT_PLUGIN_ID;if(_0x5dbdff===_0xef1a92(0x2ac))_0x221b95=WECOM_PLUGIN_ID;if(_0x221b95&&typeof openClawConfigHandlers[_0xef1a92(0x2f4)+_0xef1a92(0x2e0)]===_0xef1a92(0x313))return openClawConfigHandlers[_0xef1a92(0x2f4)+_0xef1a92(0x2e0)]({'channelId':_0x5dbdff,'channel':_0x191d0d,'pluginId':_0x221b95,'pluginEnabled':_0x573c4e,'reason':_0x5dbdff+(_0xef1a92(0x2c3)+'\x20config\x20')+(_0x573c4e?_0xef1a92(0x368):_0xef1a92(0x33a))});_0x1b71f7[_0x5dbdff]=_0x191d0d,_0x527e10[_0xef1a92(0x2f7)]=_0x1b71f7;if(_0x5dbdff===_0xef1a92(0x306))_0x356b55(_0xef1a92(0x306));if(_0x5dbdff===_0xef1a92(0x3ba))_0x356b55(QQBOT_PLUGIN_ID);if(_0x5dbdff===_0xef1a92(0x2ac))_0x356b55(WECOM_PLUGIN_ID);}}}}}}}return _0x5b1448(_0x527e10,_0x5dbdff+(_0xef1a92(0x2c3)+_0xef1a92(0x276))+(_0x573c4e?_0xef1a92(0x368):'disabled'));}async function _0x8a0a63({gatewayPort:_0x39a064,gatewayToken:_0x2d473d}={}){const _0x5483b3=_0x5f22af;_0x560f0f&&(_0x560f0f[_0x5483b3(0x242)](),_0x560f0f=null);const {cwd:_0x1a9bbf,env:_0x15cba2,runtime:_0x31ff63}=await _0x54f4d7({'FORCE_COLOR':'0',..._0x39a064?{'OPENCLAW_GATEWAY_PORT':String(_0x39a064)}:{},..._0x2d473d?{'OPENCLAW_GATEWAY_TOKEN':_0x2d473d}:{}}),_0x54567b=_0x31ff63[_0x5483b3(0x360)]['find'](_0x4b8cc8=>_0x4b8cc8[_0x5483b3(0x304)]===WECHAT_PLUGIN_ID);if(!_0x54567b){const _0x505839='当前客户端未内置'+_0x5483b3(0x30c)+_0x5483b3(0x35f)+_0x5483b3(0x230);return _0x221e70(_0x5483b3(0x2ca)+_0x5483b3(0x2d5),'ERROR'),_0x221e70(_0x5483b3(0x244)+'og',_0x505839),{'ok':![],'error':_0x505839};}await _0x2217b4(!![]),_0x221e70(_0x5483b3(0x244)+'og','spawn\x20op'+_0x5483b3(0x38c)+'hannels\x20'+_0x5483b3(0x20b)+_0x5483b3(0x2bc)+_0x54567b['pluginId']),_0x560f0f=spawn(_0x31ff63[_0x5483b3(0x309)+_0x5483b3(0x374)],[_0x31ff63[_0x5483b3(0x272)+_0x5483b3(0x20f)],_0x5483b3(0x2f7),_0x5483b3(0x3da),_0x5483b3(0x24d)+'l',_0x54567b[_0x5483b3(0x304)]],{'cwd':_0x1a9bbf,'env':_0x15cba2});let _0x5b4ad3='',_0xcac917=![],_0x37749=![];const _0x2858a7=_0x343887=>{const _0x150efb=_0x5483b3,_0x1adcd4=_0x343887['toString']();_0x5b4ad3+=_0x1adcd4;if(!_0xcac917){const _0x365d4a=_0x5b4ad3['match'](/(https:\/\/(?:[a-zA-Z0-9-]+\.)*weixin\.qq\.com\S+)/i);_0x365d4a?.[0x1]&&(_0xcac917=!![],_0x221e70(_0x150efb(0x215)+_0x150efb(0x3a8),_0x365d4a[0x1]),_0x221e70(_0x150efb(0x2ca)+'tatus',_0x150efb(0x2f6)));}if(_0x1adcd4['includes'](_0x150efb(0x266))||_0x1adcd4[_0x150efb(0x3f2)]('Scan\x20suc'+_0x150efb(0x2b5))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3ad)))_0x221e70(_0x150efb(0x2ca)+_0x150efb(0x2d5),'SCANNED');else{if(_0x1adcd4[_0x150efb(0x3f2)]('登录成功')||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3a6))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x36f))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x32b)+'n')||_0x1adcd4['includes'](_0x150efb(0x314)+'ccess')||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3cb))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x30a))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3b1))||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x3f7)+_0x150efb(0x383)+'d')||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x2c0)+_0x150efb(0x299)+_0x150efb(0x3a0)))_0x37749=!![],_0x221e70(_0x150efb(0x2ca)+_0x150efb(0x2d5),'SUCCESS'),setTimeout(()=>{const _0x29c56f=_0x150efb;_0x560f0f&&(_0x560f0f[_0x29c56f(0x242)](),_0x560f0f=null);},0xbb8);else{if(_0x1adcd4[_0x150efb(0x3f2)]('过期')||_0x1adcd4[_0x150efb(0x3f2)](_0x150efb(0x28d)))_0x221e70('wechat-s'+_0x150efb(0x2d5),_0x150efb(0x2fb));else(_0x1adcd4[_0x150efb(0x3f2)]('失败')||_0x1adcd4[_0x150efb(0x3f2)]('Failed')||_0x1adcd4['includes'](_0x150efb(0x2ad)))&&_0x221e70(_0x150efb(0x2ca)+_0x150efb(0x2d5),_0x150efb(0x28f));}}_0x221e70('wechat-l'+'og',_0x1adcd4);};return _0x560f0f[_0x5483b3(0x2eb)]?.['on'](_0x5483b3(0x387),_0x2858a7),_0x560f0f[_0x5483b3(0x22f)]?.['on'](_0x5483b3(0x387),_0x2858a7),_0x560f0f['on']('error',_0x295a85=>{const _0x5ef32a=_0x5483b3;_0x560f0f=null,_0x221e70('wechat-s'+_0x5ef32a(0x2d5),'ERROR'),_0x221e70(_0x5ef32a(0x244)+'og','Spawn\x20er'+_0x5ef32a(0x3b3)+_0x295a85[_0x5ef32a(0x227)]);}),_0x560f0f['on']('close',_0x1d46ff=>{const _0x2b34a6=_0x5483b3;_0x560f0f=null,_0x37749?_0x2217b4(!![])['catch'](()=>{}):(_0x2217b4(![])[_0x2b34a6(0x34f)](()=>{}),_0x221e70(_0x2b34a6(0x2ca)+'tatus',_0x1d46ff===0x0?_0x2b34a6(0x3d8):_0x2b34a6(0x28f)));}),{'ok':!![]};}function _0x547634(){const _0xbc2945=_0x5f22af;return _0x560f0f&&(_0x560f0f[_0xbc2945(0x242)](),_0x560f0f=null),{'ok':!![]};}function _0x4e9a23(){const _0x8ce216=_0x5f22af;for(const _0x1ee22a of _0x46aac2[_0x8ce216(0x2be)]()){_0x461263(_0x1ee22a),_0x1ee22a[_0x8ce216(0x2f2)]?.[_0x8ce216(0x242)]();}_0x46aac2[_0x8ce216(0x25f)]();for(const _0x25c457 of _0x222366[_0x8ce216(0x2be)]()){_0x1d676b(_0x25c457);}_0x222366['clear']();for(const _0x24407a of _0x2c64a9['values']()){_0x4a2a9b(_0x24407a),_0x5d4363(_0x24407a),_0x24407a['process']?.[_0x8ce216(0x242)]();}_0x2c64a9[_0x8ce216(0x25f)](),_0x560f0f&&(_0x560f0f['kill'](),_0x560f0f=null);}return{'saveFeishuChannelConfig':_0x3320d5,'saveQqbotChannelConfig':_0x4e3614,'saveWecomChannelConfig':_0x54ed61,'saveQqMailConnectorConfig':_0x372ecf,'saveNetEaseMailConnectorConfig':_0x27b808,'saveTencentExmailConnectorConfig':_0x48b0d6,'saveFeishuDocConnectorConfig':_0x108fc7,'saveTencentDocsConnectorConfig':_0x46ce45,'saveKdocsConnectorConfig':_0x1407c8,'saveDingtalkDocConnectorConfig':_0x4fb3b7,'readConfigSnapshot':_0x49252a,'startKdocsCliConnectSession':_0x59756d,'getKdocsCliConnectStatus':_0x334d82,'cancelKdocsCliConnectSession':_0x99803b,'startFeishuDocCliConnectSession':_0x2642c0,'getFeishuDocCliConnectStatus':_0x53ee11,'cancelFeishuDocCliConnectSession':_0x56a326,'completeFeishuDocCliConnectSession':_0x3792c0,'startFeishuRegistrationSession':_0x5935c8,'getFeishuRegistrationStatus':_0x461c31,'cancelFeishuRegistrationSession':_0x25607d,'listImChannelConfigs':_0x20f0d1,'deleteImChannelConfig':_0x46a5ef,'setImChannelEnabled':_0x4c454d,'startWechatChannelSession':_0x8a0a63,'cancelWechatChannelSession':_0x547634,'dispose':_0x4e9a23};}
@@ -1 +1 @@
1
- const _0x1bca2b=_0x507c;(function(_0x51ce63,_0x3f366c){const _0x227c0c=_0x507c,_0x890841=_0x51ce63();while(!![]){try{const _0x46737d=-parseInt(_0x227c0c(0x12c))/0x1+-parseInt(_0x227c0c(0x158))/0x2*(parseInt(_0x227c0c(0x127))/0x3)+-parseInt(_0x227c0c(0x171))/0x4+parseInt(_0x227c0c(0x126))/0x5*(-parseInt(_0x227c0c(0x16c))/0x6)+-parseInt(_0x227c0c(0x142))/0x7*(parseInt(_0x227c0c(0x125))/0x8)+-parseInt(_0x227c0c(0x146))/0x9*(parseInt(_0x227c0c(0x137))/0xa)+-parseInt(_0x227c0c(0x16f))/0xb*(-parseInt(_0x227c0c(0x118))/0xc);if(_0x46737d===_0x3f366c)break;else _0x890841['push'](_0x890841['shift']());}catch(_0x563066){_0x890841['push'](_0x890841['shift']());}}}(_0x4d90,0x66de8));import{existsSync,readdirSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{get}from'node:https';import{pipeline}from'node:stream/promises';const KDOCS_CLI_CDN_BASE=(process.env.KDOCS_CLI_CDN??_0x1bca2b(0x170)+_0x1bca2b(0x13d)+_0x1bca2b(0x14c)+_0x1bca2b(0x132)+_0x1bca2b(0x12e))[_0x1bca2b(0x113)](/\/$/,''),DOWNLOAD_TIMEOUT_MS=0xf*0x3c*0x3e8;async function runProcess(_0x3da158,_0x7799f5,_0x3e24bd={}){const _0x448836=_0x1bca2b,{spawn:_0x2f5787}=await import('node:chi'+_0x448836(0x112)+'ss'),_0xa62b2e=_0x3e24bd[_0x448836(0x110)]||[_0x3da158,..._0x7799f5][_0x448836(0x154)]('\x20'),_0x186028=_0x3e24bd[_0x448836(0x16b)+'s']??DOWNLOAD_TIMEOUT_MS;return await new Promise((_0x44b8d0,_0x481f03)=>{const _0x517b0f=_0x448836,_0x4cbd30=_0x2f5787(_0x3da158,_0x7799f5,{'cwd':_0x3e24bd[_0x517b0f(0x15d)],'env':_0x3e24bd[_0x517b0f(0x150)],'stdio':[_0x517b0f(0x16a),_0x517b0f(0x169),_0x517b0f(0x169)]});let _0x4b6eb4='',_0x2523e2='';const _0x26997a=setTimeout(()=>{const _0x442439=_0x517b0f;_0x4cbd30[_0x442439(0x117)]('SIGTERM'),_0x481f03(new Error(_0xa62b2e+(_0x442439(0x15e)+_0x442439(0x176)+'\x20')+_0x186028+'ms'));},_0x186028);_0x4cbd30[_0x517b0f(0x166)]['on']('data',_0xa3e2f6=>{_0x4b6eb4+=_0xa3e2f6['toString']();}),_0x4cbd30[_0x517b0f(0x10d)]['on'](_0x517b0f(0x12f),_0x4b5835=>{_0x2523e2+=_0x4b5835['toString']();}),_0x4cbd30['on'](_0x517b0f(0x14d),_0x1d3604=>{clearTimeout(_0x26997a),_0x481f03(_0x1d3604);}),_0x4cbd30['on'](_0x517b0f(0x10e),_0x27cc99=>{const _0x38d33a=_0x517b0f;clearTimeout(_0x26997a);if(_0x27cc99===0x0)_0x44b8d0({'stdout':_0x4b6eb4,'stderr':_0x2523e2,'code':_0x27cc99});else _0x481f03(new Error(_0xa62b2e+(_0x38d33a(0x174)+_0x38d33a(0x124)+'e\x20')+_0x27cc99+':\x20'+(_0x2523e2||_0x4b6eb4)));});});}async function downloadFile(_0x1a6bfe,_0x20c02d){await mkdir(dirname(_0x20c02d),{'recursive':!![]});const _0x5ba6c7=await new Promise((_0x24525d,_0x12641c)=>{const _0x42dbba=_0x507c,_0x1be01e=get(_0x1a6bfe,_0x400e5c=>{const _0x47c7a8=_0x507c;if([0x12d,0x12e,0x12f,0x133,0x134][_0x47c7a8(0x12b)](_0x400e5c[_0x47c7a8(0x160)+'de']||0x0)&&_0x400e5c['headers'][_0x47c7a8(0x147)]){_0x400e5c[_0x47c7a8(0x141)](),downloadFile(new URL(_0x400e5c[_0x47c7a8(0x15b)][_0x47c7a8(0x147)],_0x1a6bfe)[_0x47c7a8(0x16d)],_0x20c02d)[_0x47c7a8(0x157)](()=>_0x24525d(null))[_0x47c7a8(0x15c)](_0x12641c);return;}if((_0x400e5c[_0x47c7a8(0x160)+'de']||0x0)>=0x190){_0x400e5c['resume'](),_0x12641c(new Error(_0x47c7a8(0x167)+_0x47c7a8(0x174)+_0x400e5c['statusCo'+'de']+':\x20'+_0x1a6bfe));return;}_0x24525d(_0x400e5c);});_0x1be01e['on'](_0x42dbba(0x14d),_0x12641c);});if(!_0x5ba6c7)return;await pipeline(_0x5ba6c7,createWriteStream(_0x20c02d));}async function findRuntimeKdocsCliBin(_0x5a12a2){const _0x18a9af=_0x1bca2b,_0x2daf88=join(_0x5a12a2[_0x18a9af(0x130)+_0x18a9af(0x136)+'ir'],_0x18a9af(0x114),_0x18a9af(0x151)+'i'),_0x5a5fdf=join(_0x2daf88,process[_0x18a9af(0x145)]===_0x18a9af(0x133)?_0x18a9af(0x151)+_0x18a9af(0x159):_0x18a9af(0x151)+'i');return{'installDir':_0x2daf88,'binPath':existsSync(_0x5a5fdf)?_0x5a5fdf:null};}export async function resolveRuntimeKdocsCliCommand(_0x20e2f6){const _0x520460=_0x1bca2b,{installDir:_0x13ff88,binPath:_0xd7dcc}=await findRuntimeKdocsCliBin(_0x20e2f6);if(!_0xd7dcc||!existsSync(_0xd7dcc))throw new Error(_0x520460(0x156)+_0x520460(0x151)+_0x520460(0x14b)+_0x520460(0x12d)+_0x520460(0x179)+'aw\x20runti'+_0x520460(0x115)+_0x13ff88+(_0x520460(0x10c)+_0x520460(0x153)+_0x520460(0x11f)+'re\x22\x20to\x20r'+'ebuild\x20t'+'he\x20runti'+_0x520460(0x15a)));return{'executablePath':_0xd7dcc,'installDir':_0x13ff88};}function toKdocsCliPlatform(_0xed4b49){const _0x4751b3=_0x1bca2b;if(_0xed4b49===_0x4751b3(0x133))return'windows';return _0xed4b49;}function _0x4d90(){const _0x46565d=['now','rsion\x20fr','/release','li-extra','endsWith','wpsai.wp','\x20not\x20fou','runtimeL','push','resume','2048074dGMsNs','wujie-sh','ory','platform','108aighSq','location','llPaths','o\x20resolv','nd\x20in\x20ar','i\x20is\x20mis','scdn.cn/','error','name','y\x20instal','env','kdocs-cl','om\x20','ujie-she','join','e\x20kdocs\x20','Bundled\x20','then','39436yRaSwv','i.exe','me.','headers','catch','cwd','\x20timed\x20o','utf8','statusCo','i\x20versio','amd64','i\x20binary','oot','ime\x0a','stdout','download','test','pipe','ignore','timeoutM','6alfLdS','href','ogger','4558961UPFigU','https://','2426564lqcJJf','info','.cache','\x20failed\x20','[wujie-s','ut\x20after','runtimeR','tar','m\x20OpenCl','ct-','.\x20Run\x20\x22w','stderr','close','led','label','match','ld_proce','replace','tools','me:\x20','i\x20alread','kill','72eUWwra','Unable\x20t','pid','.zip','trim','resolved','extract\x20','ll\x20prepa','chive:\x20','hell:run','arch','-xzf','with\x20cod','8TVEDrZ','2787155iHaXia','9RLrDXw','SKILL.md','x64','time]\x20do','includes','381162kHDpBw','sing\x20fro','/pro','data','openclaw','log','skillhub','win32','windows','map','WorkingD','140320JfIUkk'];_0x4d90=function(){return _0x46565d;};return _0x4d90();}function toKdocsCliArch(_0x5aac16){const _0x4aadad=_0x1bca2b;if(_0x5aac16===_0x4aadad(0x129))return _0x4aadad(0x162);return _0x5aac16;}async function resolveKdocsSkillVersion(_0xf68246){const _0x4cf8d2=_0x1bca2b,_0x2a7121=_0xf68246[_0x4cf8d2(0x130)][_0x4cf8d2(0x11d)+'LocalSki'+_0x4cf8d2(0x148)]??[],_0x52287d=[];for(const _0xee438c of _0x2a7121){if(!existsSync(_0xee438c))continue;_0x52287d['push'](join(_0xee438c,'SKILL.md')),_0x52287d[_0x4cf8d2(0x140)](...(await readdir(_0xee438c,{'withFileTypes':!![]}))['filter'](_0x15da82=>_0x15da82['isDirect'+_0x4cf8d2(0x144)]())[_0x4cf8d2(0x135)](_0x278ca3=>join(_0xee438c,_0x278ca3[_0x4cf8d2(0x14e)],_0x4cf8d2(0x128))));}for(const _0x41289d of _0x52287d){if(!existsSync(_0x41289d))continue;const _0x4add52=await readFile(_0x41289d,'utf8');if(!/^name:\s*kdocs\s*$/m[_0x4cf8d2(0x168)](_0x4add52))continue;const _0x13060c=_0x4add52[_0x4cf8d2(0x111)](/^version:\s*"?([^"\s]+)"?\s*$/m);if(_0x13060c?.[0x1])return _0x13060c[0x1];}throw new Error(_0x4cf8d2(0x119)+_0x4cf8d2(0x149)+_0x4cf8d2(0x155)+'skill\x20ve'+_0x4cf8d2(0x139)+_0x4cf8d2(0x152)+_0x2a7121[_0x4cf8d2(0x154)](',\x20'));}export const __test__={'resolveKdocsSkillVersion':resolveKdocsSkillVersion};function _0x507c(_0x11d444,_0x3c3360){_0x11d444=_0x11d444-0x10c;const _0x4d906d=_0x4d90();let _0x507c3a=_0x4d906d[_0x11d444];return _0x507c3a;}function findFileByName(_0xf3e222,_0x5819d2){const _0x13a6e1=_0x1bca2b;if(!existsSync(_0xf3e222))return null;for(const _0x3d2494 of readdirSync(_0xf3e222,{'withFileTypes':!![]})){const _0x1765f2=join(_0xf3e222,_0x3d2494['name']);if(_0x3d2494['isDirect'+_0x13a6e1(0x144)]()){const _0x5c4d76=findFileByName(_0x1765f2,_0x5819d2);if(_0x5c4d76)return _0x5c4d76;continue;}if(_0x3d2494['isFile']()&&_0x3d2494[_0x13a6e1(0x14e)]===_0x5819d2)return _0x1765f2;}return null;}export async function installKdocsCliBinary(_0x76fdee,_0x499955,_0x1e92d6={}){const _0x58144a=_0x1bca2b,_0x28d9a9=await resolveKdocsSkillVersion(_0x76fdee),_0x46e0eb=toKdocsCliPlatform(process[_0x58144a(0x145)]),_0x363c95=toKdocsCliArch(process[_0x58144a(0x122)]),_0x8f2b87=process[_0x58144a(0x145)]===_0x58144a(0x133)?_0x58144a(0x151)+_0x58144a(0x159):'kdocs-cl'+'i',_0x163d84=join(_0x499955[_0x58144a(0x130)+_0x58144a(0x136)+'ir'],'tools',_0x58144a(0x151)+'i'),_0x47a828=join(_0x163d84,_0x8f2b87);if(existsSync(_0x47a828))try{const _0x15404a=(await runProcess(_0x47a828,['version'],{'label':_0x58144a(0x151)+_0x58144a(0x161)+'n','timeoutMs':0x7530}))[_0x58144a(0x166)][_0x58144a(0x11c)]();if(_0x15404a===_0x28d9a9){_0x1e92d6[_0x58144a(0x13f)+_0x58144a(0x16e)]?.[_0x58144a(0x172)]('kdocs-cl'+_0x58144a(0x116)+_0x58144a(0x14f)+_0x58144a(0x10f),{'version':_0x28d9a9,'installDir':_0x163d84});return;}}catch{}const _0x59dff3=_0x46e0eb===_0x58144a(0x134)?_0x58144a(0x11b):'.tar.gz',_0xe3f41f=_0x58144a(0x151)+'i-'+_0x28d9a9+'-'+_0x46e0eb+'-'+_0x363c95+_0x59dff3,_0xd1f88b=join(_0x499955[_0x58144a(0x177)+_0x58144a(0x164)],_0x58144a(0x173)),_0xa52deb=join(_0xd1f88b,_0xe3f41f),_0x3f172b=join(_0x499955[_0x58144a(0x177)+_0x58144a(0x164)],'.kdocs-c'+_0x58144a(0x13b)+_0x58144a(0x17a)+process[_0x58144a(0x11a)]+'-'+Date[_0x58144a(0x138)]()),_0x5b01db=KDOCS_CLI_CDN_BASE+'/v'+_0x28d9a9+(_0x58144a(0x13a)+'s/')+_0xe3f41f;await mkdir(_0xd1f88b,{'recursive':!![]});!existsSync(_0xa52deb)&&(console[_0x58144a(0x131)](_0x58144a(0x175)+_0x58144a(0x121)+_0x58144a(0x12a)+'wnloadin'+'g\x20'+_0x5b01db),await downloadFile(_0x5b01db,_0xa52deb));await rm(_0x3f172b,{'recursive':!![],'force':!![]}),await mkdir(_0x3f172b,{'recursive':!![]});_0xa52deb[_0x58144a(0x13c)](_0x58144a(0x11b))?await runProcess('unzip',['-q',_0xa52deb,'-d',_0x3f172b],{'label':_0x58144a(0x11e)+_0xe3f41f}):await runProcess(_0x58144a(0x178),[_0x58144a(0x123),_0xa52deb,'-C',_0x3f172b],{'label':_0x58144a(0x11e)+_0xe3f41f});const _0x2df99f=findFileByName(_0x3f172b,_0x8f2b87);if(!_0x2df99f)throw new Error('kdocs-cl'+_0x58144a(0x163)+_0x58144a(0x13e)+_0x58144a(0x14a)+_0x58144a(0x120)+_0xe3f41f);await rm(_0x163d84,{'recursive':!![],'force':!![]}),await mkdir(_0x163d84,{'recursive':!![]}),await cp(_0x2df99f,_0x47a828);if(process[_0x58144a(0x145)]!==_0x58144a(0x133))await chmod(_0x47a828,0x1ed);await writeFile(join(_0x163d84,'.source'),_0x58144a(0x143)+'ell-runt'+_0x58144a(0x165),_0x58144a(0x15f)),await rm(_0x3f172b,{'recursive':!![],'force':!![]}),_0x1e92d6[_0x58144a(0x13f)+_0x58144a(0x16e)]?.[_0x58144a(0x172)]('kdocs-cl'+'i\x20instal'+_0x58144a(0x10f),{'version':_0x28d9a9,'installDir':_0x163d84,'binPath':_0x47a828});}
1
+ const _0x13ecdf=_0x947d;function _0x58b2(){const _0x6d8e97=['hell:run','with\x20cod','runtimeR','join','trim','ory','isFile','i\x20alread','resume','e\x20kdocs\x20','ld_proce','2976530pOrWil','resolved','info','download','then','ime\x0a','ebuild\x20t','isDirect','.zip','catch','endsWith','772884FEAvWt','1224sQaJXy','om\x20','ut\x20after','i\x20instal','\x20failed\x20','sing\x20fro','6780036HOGAQL','pipe','llPaths','scdn.cn/','includes','toString','close','o\x20resolv','extract\x20','statusCo','me.','cwd','wujie-sh','rsion\x20fr','\x20timed\x20o','re\x22\x20to\x20r','ell-runt','now','windows','[wujie-s','platform','map','label','1261344guAQtH','tools','filter','/pro','node:chi','40KUIkzT','.kdocs-c','Unable\x20t','led','win32','stdout','time]\x20do','SIGTERM','test','\x20not\x20fou','816UMQuGH','.cache','oot','m\x20OpenCl','data','match','arch','Bundled\x20','y\x20instal','https://','i.exe','ll\x20prepa','wnloadin','wpsai.wp','SKILL.md','8778294buqwuQ','skill\x20ve','skillhub','pid','push','aw\x20runti','runtimeL','212821hrcXjV','env','utf8','href','he\x20runti','.source','error','ogger','me:\x20','name','openclaw','ct-','location','x64','kill','kdocs-cl'];_0x58b2=function(){return _0x6d8e97;};return _0x58b2();}(function(_0x4fa877,_0x56a0e5){const _0x933734=_0x947d,_0x558061=_0x4fa877();while(!![]){try{const _0x1a01b6=parseInt(_0x933734(0x16b))/0x1*(-parseInt(_0x933734(0x12e))/0x2)+parseInt(_0x933734(0x11f))/0x3+parseInt(_0x933734(0x108))/0x4+parseInt(_0x933734(0x15f))/0x5+-parseInt(_0x933734(0x16a))/0x6+parseInt(_0x933734(0x144))/0x7*(-parseInt(_0x933734(0x124))/0x8)+-parseInt(_0x933734(0x13d))/0x9;if(_0x1a01b6===_0x56a0e5)break;else _0x558061['push'](_0x558061['shift']());}catch(_0xa2f193){_0x558061['push'](_0x558061['shift']());}}}(_0x58b2,0xe9328));import{existsSync,readdirSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rm,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{get}from'node:https';import{pipeline}from'node:stream/promises';const KDOCS_CLI_CDN_BASE=(process.env.KDOCS_CLI_CDN??_0x13ecdf(0x137)+_0x13ecdf(0x13b)+_0x13ecdf(0x10b)+_0x13ecdf(0x13f)+_0x13ecdf(0x122))['replace'](/\/$/,''),DOWNLOAD_TIMEOUT_MS=0xf*0x3c*0x3e8;async function runProcess(_0x323d2d,_0x31bf5b,_0x3dbd43={}){const _0x1cb69e=_0x13ecdf,{spawn:_0x461733}=await import(_0x1cb69e(0x123)+_0x1cb69e(0x15e)+'ss'),_0x571309=_0x3dbd43[_0x1cb69e(0x11e)]||[_0x323d2d,..._0x31bf5b][_0x1cb69e(0x157)]('\x20'),_0x484f04=_0x3dbd43['timeoutM'+'s']??DOWNLOAD_TIMEOUT_MS;return await new Promise((_0x3ace23,_0x3dd830)=>{const _0x4db07e=_0x1cb69e,_0x4d3360=_0x461733(_0x323d2d,_0x31bf5b,{'cwd':_0x3dbd43[_0x4db07e(0x113)],'env':_0x3dbd43[_0x4db07e(0x145)],'stdio':['ignore',_0x4db07e(0x109),_0x4db07e(0x109)]});let _0x2fbef8='',_0x335271='';const _0x4a601b=setTimeout(()=>{const _0x24a9d8=_0x4db07e;_0x4d3360[_0x24a9d8(0x152)](_0x24a9d8(0x12b)),_0x3dd830(new Error(_0x571309+(_0x24a9d8(0x116)+_0x24a9d8(0x16d)+'\x20')+_0x484f04+'ms'));},_0x484f04);_0x4d3360[_0x4db07e(0x129)]['on'](_0x4db07e(0x132),_0x593a56=>{const _0x40e852=_0x4db07e;_0x2fbef8+=_0x593a56[_0x40e852(0x10d)]();}),_0x4d3360['stderr']['on'](_0x4db07e(0x132),_0x2e27e=>{const _0x133e69=_0x4db07e;_0x335271+=_0x2e27e[_0x133e69(0x10d)]();}),_0x4d3360['on'](_0x4db07e(0x14a),_0x4fd02d=>{clearTimeout(_0x4a601b),_0x3dd830(_0x4fd02d);}),_0x4d3360['on'](_0x4db07e(0x10e),_0x51c46d=>{const _0x4da958=_0x4db07e;clearTimeout(_0x4a601b);if(_0x51c46d===0x0)_0x3ace23({'stdout':_0x2fbef8,'stderr':_0x335271,'code':_0x51c46d});else _0x3dd830(new Error(_0x571309+(_0x4da958(0x16f)+_0x4da958(0x155)+'e\x20')+_0x51c46d+':\x20'+(_0x335271||_0x2fbef8)));});});}async function downloadFile(_0x1adc2b,_0x286dfa){await mkdir(dirname(_0x286dfa),{'recursive':!![]});const _0x253145=await new Promise((_0x1d67e8,_0x4ea09b)=>{const _0x1fe997=_0x947d,_0x124ba1=get(_0x1adc2b,_0x65eb7b=>{const _0x43850a=_0x947d;if([0x12d,0x12e,0x12f,0x133,0x134][_0x43850a(0x10c)](_0x65eb7b[_0x43850a(0x111)+'de']||0x0)&&_0x65eb7b['headers'][_0x43850a(0x150)]){_0x65eb7b[_0x43850a(0x15c)](),downloadFile(new URL(_0x65eb7b['headers'][_0x43850a(0x150)],_0x1adc2b)[_0x43850a(0x147)],_0x286dfa)[_0x43850a(0x163)](()=>_0x1d67e8(null))[_0x43850a(0x168)](_0x4ea09b);return;}if((_0x65eb7b[_0x43850a(0x111)+'de']||0x0)>=0x190){_0x65eb7b[_0x43850a(0x15c)](),_0x4ea09b(new Error(_0x43850a(0x162)+_0x43850a(0x16f)+_0x65eb7b[_0x43850a(0x111)+'de']+':\x20'+_0x1adc2b));return;}_0x1d67e8(_0x65eb7b);});_0x124ba1['on'](_0x1fe997(0x14a),_0x4ea09b);});if(!_0x253145)return;await pipeline(_0x253145,createWriteStream(_0x286dfa));}async function findRuntimeKdocsCliBin(_0x1a9b3e){const _0x5f35aa=_0x13ecdf,_0xd261d6=join(_0x1a9b3e[_0x5f35aa(0x14e)+'WorkingD'+'ir'],_0x5f35aa(0x120),_0x5f35aa(0x153)+'i'),_0x5ee446=join(_0xd261d6,process['platform']===_0x5f35aa(0x128)?_0x5f35aa(0x153)+'i.exe':_0x5f35aa(0x153)+'i');return{'installDir':_0xd261d6,'binPath':existsSync(_0x5ee446)?_0x5ee446:null};}export async function resolveRuntimeKdocsCliCommand(_0x562358){const _0x1a5e64=_0x13ecdf,{installDir:_0x243a15,binPath:_0x2cfc75}=await findRuntimeKdocsCliBin(_0x562358);if(!_0x2cfc75||!existsSync(_0x2cfc75))throw new Error(_0x1a5e64(0x135)+'kdocs-cl'+'i\x20is\x20mis'+_0x1a5e64(0x170)+_0x1a5e64(0x131)+_0x1a5e64(0x142)+_0x1a5e64(0x14c)+_0x243a15+('.\x20Run\x20\x22w'+'ujie-she'+_0x1a5e64(0x139)+_0x1a5e64(0x117)+_0x1a5e64(0x165)+_0x1a5e64(0x148)+_0x1a5e64(0x112)));return{'executablePath':_0x2cfc75,'installDir':_0x243a15};}function toKdocsCliPlatform(_0x331cae){const _0x4cbb2d=_0x13ecdf;if(_0x331cae===_0x4cbb2d(0x128))return _0x4cbb2d(0x11a);return _0x331cae;}function _0x947d(_0x104463,_0x15c9e1){_0x104463=_0x104463-0x108;const _0x58b26b=_0x58b2();let _0x947df5=_0x58b26b[_0x104463];return _0x947df5;}function toKdocsCliArch(_0x34186d){const _0x37134a=_0x13ecdf;if(_0x34186d===_0x37134a(0x151))return'amd64';return _0x34186d;}async function resolveKdocsSkillVersion(_0x1db4ae){const _0x14082f=_0x13ecdf,_0x332772=_0x1db4ae['openclaw']['resolved'+'LocalSki'+_0x14082f(0x10a)]??[],_0x5d09b5=[];for(const _0x6eb84c of _0x332772){if(!existsSync(_0x6eb84c))continue;_0x5d09b5[_0x14082f(0x141)](join(_0x6eb84c,_0x14082f(0x13c))),_0x5d09b5['push'](...(await readdir(_0x6eb84c,{'withFileTypes':!![]}))[_0x14082f(0x121)](_0x4a5679=>_0x4a5679[_0x14082f(0x166)+_0x14082f(0x159)]())[_0x14082f(0x11d)](_0x281ef4=>join(_0x6eb84c,_0x281ef4['name'],_0x14082f(0x13c))));}for(const _0x58400a of _0x5d09b5){if(!existsSync(_0x58400a))continue;const _0x19abe9=await readFile(_0x58400a,_0x14082f(0x146));if(!/^name:\s*kdocs\s*$/m[_0x14082f(0x12c)](_0x19abe9))continue;const _0x438fc0=_0x19abe9[_0x14082f(0x133)](/^version:\s*"?([^"\s]+)"?\s*$/m);if(_0x438fc0?.[0x1])return _0x438fc0[0x1];}throw new Error(_0x14082f(0x126)+_0x14082f(0x10f)+_0x14082f(0x15d)+_0x14082f(0x13e)+_0x14082f(0x115)+_0x14082f(0x16c)+_0x332772[_0x14082f(0x157)](',\x20'));}export async function hasConfiguredKdocsSkill(_0x56a05c){const _0x5714d9=_0x13ecdf,_0x1cd371=_0x56a05c[_0x5714d9(0x14e)][_0x5714d9(0x160)+'LocalSki'+_0x5714d9(0x10a)]??[],_0xed1c1f=[];for(const _0x1c484a of _0x1cd371){if(!existsSync(_0x1c484a))continue;_0xed1c1f[_0x5714d9(0x141)](join(_0x1c484a,_0x5714d9(0x13c))),_0xed1c1f[_0x5714d9(0x141)](...(await readdir(_0x1c484a,{'withFileTypes':!![]}))['filter'](_0x1c3936=>_0x1c3936['isDirect'+'ory']())[_0x5714d9(0x11d)](_0x400181=>join(_0x1c484a,_0x400181[_0x5714d9(0x14d)],'SKILL.md')));}for(const _0x11a987 of _0xed1c1f){if(!existsSync(_0x11a987))continue;const _0x2a8e0c=await readFile(_0x11a987,'utf8');if(/^name:\s*kdocs\s*$/m[_0x5714d9(0x12c)](_0x2a8e0c))return!![];}return![];}export const __test__={'hasConfiguredKdocsSkill':hasConfiguredKdocsSkill,'resolveKdocsSkillVersion':resolveKdocsSkillVersion};function findFileByName(_0x4a0d9f,_0x26252d){const _0x16f700=_0x13ecdf;if(!existsSync(_0x4a0d9f))return null;for(const _0x464a9c of readdirSync(_0x4a0d9f,{'withFileTypes':!![]})){const _0x2bf650=join(_0x4a0d9f,_0x464a9c[_0x16f700(0x14d)]);if(_0x464a9c[_0x16f700(0x166)+_0x16f700(0x159)]()){const _0x23f160=findFileByName(_0x2bf650,_0x26252d);if(_0x23f160)return _0x23f160;continue;}if(_0x464a9c[_0x16f700(0x15a)]()&&_0x464a9c['name']===_0x26252d)return _0x2bf650;}return null;}export async function installKdocsCliBinary(_0x2605b3,_0x406969,_0x445f1b={}){const _0x4692d4=_0x13ecdf,_0x3f681a=await resolveKdocsSkillVersion(_0x2605b3),_0x32b3f7=toKdocsCliPlatform(process[_0x4692d4(0x11c)]),_0xceb8d5=toKdocsCliArch(process[_0x4692d4(0x134)]),_0x3c147a=process['platform']===_0x4692d4(0x128)?'kdocs-cl'+_0x4692d4(0x138):_0x4692d4(0x153)+'i',_0x8d9e15=join(_0x406969[_0x4692d4(0x14e)+'WorkingD'+'ir'],_0x4692d4(0x120),_0x4692d4(0x153)+'i'),_0x3e3372=join(_0x8d9e15,_0x3c147a);if(existsSync(_0x3e3372))try{const _0x1c8fec=(await runProcess(_0x3e3372,['version'],{'label':_0x4692d4(0x153)+'i\x20versio'+'n','timeoutMs':0x7530}))[_0x4692d4(0x129)][_0x4692d4(0x158)]();if(_0x1c8fec===_0x3f681a){_0x445f1b[_0x4692d4(0x143)+_0x4692d4(0x14b)]?.[_0x4692d4(0x161)](_0x4692d4(0x153)+_0x4692d4(0x15b)+_0x4692d4(0x136)+_0x4692d4(0x127),{'version':_0x3f681a,'installDir':_0x8d9e15});return;}}catch{}const _0x2552fd=_0x32b3f7==='windows'?_0x4692d4(0x167):'.tar.gz',_0x3337d1=_0x4692d4(0x153)+'i-'+_0x3f681a+'-'+_0x32b3f7+'-'+_0xceb8d5+_0x2552fd,_0xbe01a=join(_0x406969[_0x4692d4(0x156)+'oot'],_0x4692d4(0x12f)),_0x1fadf8=join(_0xbe01a,_0x3337d1),_0x53d12d=join(_0x406969[_0x4692d4(0x156)+_0x4692d4(0x130)],_0x4692d4(0x125)+'li-extra'+_0x4692d4(0x14f)+process[_0x4692d4(0x140)]+'-'+Date[_0x4692d4(0x119)]()),_0x422295=KDOCS_CLI_CDN_BASE+'/v'+_0x3f681a+('/release'+'s/')+_0x3337d1;await mkdir(_0xbe01a,{'recursive':!![]});!existsSync(_0x1fadf8)&&(console['log'](_0x4692d4(0x11b)+_0x4692d4(0x154)+_0x4692d4(0x12a)+_0x4692d4(0x13a)+'g\x20'+_0x422295),await downloadFile(_0x422295,_0x1fadf8));await rm(_0x53d12d,{'recursive':!![],'force':!![]}),await mkdir(_0x53d12d,{'recursive':!![]});_0x1fadf8[_0x4692d4(0x169)](_0x4692d4(0x167))?await runProcess('unzip',['-q',_0x1fadf8,'-d',_0x53d12d],{'label':_0x4692d4(0x110)+_0x3337d1}):await runProcess('tar',['-xzf',_0x1fadf8,'-C',_0x53d12d],{'label':_0x4692d4(0x110)+_0x3337d1});const _0x2832b6=findFileByName(_0x53d12d,_0x3c147a);if(!_0x2832b6)throw new Error('kdocs-cl'+'i\x20binary'+_0x4692d4(0x12d)+'nd\x20in\x20ar'+'chive:\x20'+_0x3337d1);await rm(_0x8d9e15,{'recursive':!![],'force':!![]}),await mkdir(_0x8d9e15,{'recursive':!![]}),await cp(_0x2832b6,_0x3e3372);if(process[_0x4692d4(0x11c)]!==_0x4692d4(0x128))await chmod(_0x3e3372,0x1ed);await writeFile(join(_0x8d9e15,_0x4692d4(0x149)),_0x4692d4(0x114)+_0x4692d4(0x118)+_0x4692d4(0x164),_0x4692d4(0x146)),await rm(_0x53d12d,{'recursive':!![],'force':!![]}),_0x445f1b[_0x4692d4(0x143)+_0x4692d4(0x14b)]?.['info'](_0x4692d4(0x153)+_0x4692d4(0x16e)+'led',{'version':_0x3f681a,'installDir':_0x8d9e15,'binPath':_0x3e3372});}