diff --git a/core/historiographer.js b/core/historiographer.js index 9979fec..5d28ff7 100644 --- a/core/historiographer.js +++ b/core/historiographer.js @@ -1 +1 @@ -const _0x246793=_0x474b;(function(_0xfdad77,_0x4bc066){const _0x306435=_0x474b,_0x372095=_0xfdad77();while(!![]){try{const _0x515e16=-parseInt(_0x306435(0xc1))/0x1+-parseInt(_0x306435(0x10c))/0x2*(parseInt(_0x306435(0xe0))/0x3)+-parseInt(_0x306435(0xe8))/0x4+-parseInt(_0x306435(0xf7))/0x5+-parseInt(_0x306435(0x10d))/0x6*(parseInt(_0x306435(0x11d))/0x7)+parseInt(_0x306435(0xc9))/0x8+parseInt(_0x306435(0xa2))/0x9;if(_0x515e16===_0x4bc066)break;else _0x372095['push'](_0x372095['shift']());}catch(_0xb77fb){_0x372095['push'](_0x372095['shift']());}}}(_0x3ea8,0x4c826));import{getContext,extension_settings}from'/scripts/extensions.js';import{characters}from'/script.js';import{world_names,loadWorldInfo,createNewWorldInfo,createWorldInfoEntry,saveWorldInfo}from'/scripts/world-info.js';import{extensionName}from'../utils/settings.js';import{getChatIdentifier}from'./lore.js';let isExpeditionRunning=![],manualStopRequested=![];async function callAmily2Model(_0x4378d3){const _0x4cf82f=_0x474b,_0x57d578=extension_settings[extensionName],{apiUrl:_0x29f12d,apiKey:_0x4a87d2,model:_0x4e2d5e,temperature:_0x42bf7d,maxTokens:_0x11166a}=_0x57d578;if(!_0x29f12d||!_0x4e2d5e)return toastr['error']('API\x20URL或模型未配置,大史官无法召唤模型B。',_0x4cf82f(0x9f)),null;let _0x2e65fe=_0x29f12d[_0x4cf82f(0xa0)]();try{const _0xa7f7e0=new URL(_0x2e65fe),_0x4ffeae=_0xa7f7e0['pathname'][_0x4cf82f(0xdb)](_0x4cf82f(0xa7))||_0xa7f7e0[_0x4cf82f(0x108)][_0x4cf82f(0xdb)]('/v1beta/openai');if(!_0x4ffeae){let _0x4d2d2a=_0xa7f7e0['pathname'];if(_0x4d2d2a[_0x4cf82f(0xdb)](_0x4cf82f(0xb8)))_0x4d2d2a=_0x4d2d2a[_0x4cf82f(0xad)](0x0,-0x1);else _0x4d2d2a[_0x4cf82f(0xdb)]('/v1')&&(_0x4d2d2a=_0x4d2d2a[_0x4cf82f(0xad)](0x0,-0x2));_0xa7f7e0[_0x4cf82f(0x108)]=_0x4d2d2a[_0x4cf82f(0xc2)](/\/$/,'')+_0x4cf82f(0xa7);}_0x2e65fe=_0xa7f7e0[_0x4cf82f(0xd6)];}catch(_0x5b6387){return console[_0x4cf82f(0xf0)](_0x4cf82f(0xc3),_0x5b6387),toastr[_0x4cf82f(0xf0)](_0x4cf82f(0xe9),_0x4cf82f(0x11f)),null;}console[_0x4cf82f(0x113)](_0x4cf82f(0xec)+new Date()['toLocaleTimeString']()),console[_0x4cf82f(0xf2)]('【目标地址】:\x20'+_0x2e65fe),console[_0x4cf82f(0xf2)]('【信函参数】',{'model':_0x4e2d5e,'temperature':_0x42bf7d,'maxTokens':_0x11166a}),console['log']('【信函正文\x20(messages)】:'),console[_0x4cf82f(0xcd)](_0x4378d3),console[_0x4cf82f(0x122)]();try{const _0x600e22=await fetch(_0x2e65fe,{'method':'POST','headers':{'Content-Type':_0x4cf82f(0xb1),'Authorization':_0x4cf82f(0x102)+_0x4a87d2},'body':JSON[_0x4cf82f(0xcc)]({'model':_0x4e2d5e,'messages':_0x4378d3,'temperature':_0x42bf7d,'max_tokens':_0x11166a,'stream':![]})});if(!_0x600e22['ok']){const _0x5cb74e=await _0x600e22[_0x4cf82f(0xa3)]();console['error'](_0x4cf82f(0xfa),_0x600e22[_0x4cf82f(0x118)],_0x5cb74e);throw new Error(_0x4cf82f(0xed)+_0x600e22[_0x4cf82f(0x118)]+_0x4cf82f(0xf1)+_0x5cb74e);}const _0x57cc62=await _0x600e22[_0x4cf82f(0xa4)]();return _0x57cc62[_0x4cf82f(0x116)][0x0]['message'][_0x4cf82f(0xa1)];}catch(_0x495bed){return console[_0x4cf82f(0xf0)](_0x4cf82f(0xaa),_0x495bed),toastr['error'](_0x4cf82f(0xe3)+_0x495bed[_0x4cf82f(0x10e)],_0x4cf82f(0xe4)),null;}}const RUNNING_LOG_COMMENT=_0x246793(0xe7),PROGRESS_SEAL_REGEX=/本条勿动【前(\d+)楼总结已完成】否则后续总结无法进行。$/;function _0x474b(_0x2cace1,_0x539d52){const _0x3ea814=_0x3ea8();return _0x474b=function(_0x474b6a,_0x385b51){_0x474b6a=_0x474b6a-0x9f;let _0x2aa9ab=_0x3ea814[_0x474b6a];return _0x2aa9ab;},_0x474b(_0x2cace1,_0x539d52);}async function readGoldenLedgerProgress(_0x384e55){const _0x438b3b=_0x246793;if(!_0x384e55)return 0x0;try{const _0x43eb57=await loadWorldInfo(_0x384e55);if(!_0x43eb57||!_0x43eb57[_0x438b3b(0x11c)])return 0x0;const _0x4e12e0=Object[_0x438b3b(0xeb)](_0x43eb57['entries'])[_0x438b3b(0xe1)](_0x2ea678=>_0x2ea678[_0x438b3b(0xd8)]===RUNNING_LOG_COMMENT&&!_0x2ea678[_0x438b3b(0x106)]);if(!_0x4e12e0)return 0x0;const _0x2dbee7=_0x4e12e0[_0x438b3b(0xa1)]['match'](PROGRESS_SEAL_REGEX);return _0x2dbee7?parseInt(_0x2dbee7[0x1],0xa):0x0;}catch(_0x376f80){return console[_0x438b3b(0xf0)](_0x438b3b(0xd1)+_0x384e55+_0x438b3b(0xdd),_0x376f80),0x0;}}export async function checkAndTriggerAutoSummary(){const _0x285901=_0x246793,_0x4d2581=extension_settings[extensionName];if(!_0x4d2581[_0x285901(0x105)])return;const _0x48912d=getContext();let _0x20b54e=null;switch(_0x4d2581['lorebookTarget']){case'character_main':_0x20b54e=characters[_0x48912d['characterId']]?.[_0x285901(0x121)]?.[_0x285901(0xd9)]?.[_0x285901(0xd5)];break;case _0x285901(0xb7):const _0x22c44c=await getChatIdentifier();_0x20b54e=_0x285901(0x100)+_0x22c44c;break;default:return;}if(!_0x20b54e)return;const _0x9ccd6d=await readGoldenLedgerProgress(_0x20b54e),_0x2e5290=_0x48912d[_0x285901(0xba)][_0x285901(0x10b)],_0x1fc8b3=_0x2e5290-_0x9ccd6d;if(_0x1fc8b3>=_0x4d2581['historiographySmallTriggerThreshold']){const _0x12636e=_0x9ccd6d+0x1,_0x4977c7=_0x2e5290;await executeManualSummary(_0x12636e,_0x4977c7,!![]);}}export async function getAvailableWorldbooks(){return[...world_names];}export async function getLoresForWorldbook(_0x4a2929){const _0x2c94be=_0x246793;if(!_0x4a2929)return[];try{const _0x3cbdb5=await loadWorldInfo(_0x4a2929);if(!_0x3cbdb5||!_0x3cbdb5[_0x2c94be(0x11c)])return[];return Object[_0x2c94be(0x11c)](_0x3cbdb5['entries'])[_0x2c94be(0xc5)](([,_0x3ae959])=>!_0x3ae959['disable'])[_0x2c94be(0xff)](([_0x59cdb3,_0x4eadac])=>({'key':_0x59cdb3,'comment':_0x4eadac[_0x2c94be(0xd8)]||_0x2c94be(0x10f)}));}catch(_0x1049c1){return console['error'](_0x2c94be(0x109)+_0x4a2929+_0x2c94be(0xd7),_0x1049c1),[];}}export async function executeManualSummary(_0x4daf44,_0x5d7ccf,_0x2eae69=![]){const _0x128c00=_0x246793,_0x500f9c=_0x2eae69?_0x128c00(0x111):_0x128c00(0xc8);toastr['info'](_0x128c00(0xe5)+_0x4daf44+_0x128c00(0xf9)+_0x5d7ccf+_0x128c00(0x110),_0x500f9c);const _0x10bdbf=getContext(),_0x2e0c8e=_0x10bdbf[_0x128c00(0xba)],_0x1376a0=extension_settings[extensionName],_0x2a90a9=_0x2e0c8e['slice'](_0x4daf44,_0x5d7ccf+0x1);if(_0x2a90a9[_0x128c00(0x10b)]===0x0){toastr['warning'](_0x128c00(0xef),_0x128c00(0x11f));return;}const _0xe57255=_0x10bdbf[_0x128c00(0xae)]||'用户',_0x24a47e=_0x10bdbf['name2']||'角色',_0x13b345=_0x2a90a9[_0x128c00(0xff)](_0x513968=>{const _0x277ae8=_0x128c00,_0x4e44d5=_0x513968['is_user']?_0xe57255:_0x24a47e;return _0x4e44d5+':\x20'+_0x513968[_0x277ae8(0xbb)][_0x277ae8(0xa0)]();})[_0x128c00(0xa5)]('\x0a'),_0x42acf0=[{'role':_0x128c00(0x11e),'content':_0x1376a0[_0x128c00(0xd2)]},{'role':_0x128c00(0x11e),'content':_0x1376a0[_0x128c00(0xac)]},{'role':'user','content':'请严格根据以下“对话记录”中的内容进行总结,不要添加任何额外信息。\x0a\x0a<对话记录>\x0a'+_0x13b345+_0x128c00(0xfb)}],_0x508bfc=await callAmily2Model(_0x42acf0);if(!_0x508bfc)return;try{let _0x488b1d=null;switch(_0x1376a0[_0x128c00(0x104)]){case _0x128c00(0xb0):_0x488b1d=characters[_0x10bdbf[_0x128c00(0x117)]]?.[_0x128c00(0x121)]?.[_0x128c00(0xd9)]?.[_0x128c00(0xd5)];if(!_0x488b1d){toastr[_0x128c00(0xf0)](_0x128c00(0xcb),_0x128c00(0xce));return;}break;case _0x128c00(0xb7):const _0x4b1880=await getChatIdentifier();_0x488b1d=_0x128c00(0x100)+_0x4b1880;!world_names[_0x128c00(0xde)](_0x488b1d)&&await createNewWorldInfo(_0x488b1d);break;default:toastr[_0x128c00(0xf0)](_0x128c00(0xaf),_0x128c00(0x10a));return;}const _0x5c703f=await loadWorldInfo(_0x488b1d),_0xf344ca=Object[_0x128c00(0xeb)](_0x5c703f[_0x128c00(0x11c)])['find'](_0xc74eeb=>_0xc74eeb[_0x128c00(0xd8)]===RUNNING_LOG_COMMENT&&!_0xc74eeb['disable']),_0xff3489=_0x128c00(0xd0)+_0x5d7ccf+_0x128c00(0xab),_0x994677=_0x128c00(0xb2)+_0x4daf44+'楼至'+_0x5d7ccf+'楼详细总结记录】\x0a'+_0x508bfc;if(_0xf344ca){const _0x51a454=_0xf344ca['content'][_0x128c00(0xc2)](PROGRESS_SEAL_REGEX,'')[_0x128c00(0xa0)]();_0xf344ca[_0x128c00(0xa1)]=_0x51a454+_0x994677+_0xff3489;}else{const _0x3b8b56='以下是依照顺序已发生剧情'+_0x994677,_0x275bb4=createWorldInfoEntry(_0x488b1d,_0x5c703f),_0x22eade=_0x1376a0[_0x128c00(0xe2)][_0x128c00(0xb4)](',')['map'](_0x521b7f=>_0x521b7f[_0x128c00(0xa0)]())[_0x128c00(0xc5)](Boolean),_0x415d40=_0x1376a0['loreActivationMode']===_0x128c00(0x101),_0x67087d={'before_char':0x0,'after_char':0x1,'before_an':0x2,'after_an':0x3,'at_depth':0x4};Object[_0x128c00(0xf4)](_0x275bb4,{'comment':RUNNING_LOG_COMMENT,'content':_0x3b8b56+_0xff3489,'key':_0x22eade,'constant':_0x415d40,'position':_0x67087d[_0x1376a0[_0x128c00(0xf8)]]??0x4,'depth':_0x1376a0[_0x128c00(0xf5)],'disable':![]});}await saveWorldInfo(_0x488b1d,_0x5c703f,!![]),toastr[_0x128c00(0xb5)](_0x128c00(0xf3),_0x500f9c+'完毕');}catch(_0x41f8b8){console[_0x128c00(0xf0)]('[大史官]\x20'+_0x500f9c+_0x128c00(0xe6),_0x41f8b8),toastr[_0x128c00(0xf0)]('写入'+_0x500f9c+'时发生错误。',_0x128c00(0xce));}}export async function executeRefinement(_0x61c44c,_0x4f3f6b){const _0x5866a1=_0x246793;toastr[_0x5866a1(0xb6)]('遵旨!正在为您重铸《'+_0x61c44c+_0x5866a1(0xbd),'宏史卷重铸');try{const _0x368166=await loadWorldInfo(_0x61c44c),_0x123024=_0x368166?.[_0x5866a1(0x11c)][_0x4f3f6b];if(!_0x123024){toastr[_0x5866a1(0xf0)](_0x5866a1(0xf6),_0x5866a1(0x11f));return;}const _0x29dd07=_0x123024[_0x5866a1(0xa1)],_0x2f8679=extension_settings[extensionName];let _0x44d445=_0x29dd07,_0x22b236='',_0x48b7d4=0x0;const _0x2b2d95=_0x29dd07[_0x5866a1(0xea)](PROGRESS_SEAL_REGEX);_0x2b2d95&&(_0x22b236=_0x2b2d95[0x0],_0x48b7d4=parseInt(_0x2b2d95[0x1],0xa),_0x44d445=_0x29dd07['replace'](PROGRESS_SEAL_REGEX,'')[_0x5866a1(0xa0)]());if(!_0x44d445[_0x5866a1(0xa0)]()){toastr[_0x5866a1(0x120)](_0x5866a1(0x114),_0x5866a1(0xbe));return;}const _0x184201=[{'role':_0x5866a1(0x11e),'content':_0x2f8679[_0x5866a1(0xca)]},{'role':_0x5866a1(0x11e),'content':_0x2f8679[_0x5866a1(0xa9)]},{'role':'user','content':_0x5866a1(0x11a)+_0x44d445}],_0x2f320d=await callAmily2Model(_0x184201);if(!_0x2f320d)return;const _0x27d8fd=_0x5866a1(0xbf)+_0x48b7d4+_0x5866a1(0xc7),_0x29a594=_0x27d8fd+_0x2f320d;_0x123024[_0x5866a1(0xa1)]=_0x29a594+('\x0a\x0a'+_0x22b236),_0x123024['comment']=_0x123024[_0x5866a1(0xd8)][_0x5866a1(0xc2)](/\s*\(已精炼\)|\s*\(宏史卷重铸\)/g,''),_0x123024['comment']+=_0x5866a1(0x107),await saveWorldInfo(_0x61c44c,_0x368166,!![]),toastr[_0x5866a1(0xb5)]('史册已成功重铸,并保存于《'+_0x61c44c+'》!',_0x5866a1(0xfd));}catch(_0x26c21f){console[_0x5866a1(0xf0)](_0x5866a1(0xda),_0x26c21f),toastr['error'](_0x5866a1(0xfe),_0x5866a1(0xce));}}function _0x3ea8(){const _0x15a5c5=['4iuJQXP','426qGrapY','message','无标题条目','\x20层的对话历史...','微言录\x20(自动)','远征失败','groupCollapsed','史册条目中无可供重铸的内容。','远征已在准备阶段遵令暂停!','choices','characterId','status','远征军已开拔!目标:','请将以下多个零散的“详细总结记录”提炼并融合成一段连贯的章节历史。原文如下:\x0a\x0a','dispatchEvent','entries','19523YIKzXq','system','圣谕有误','warning','data','groupEnd','通讯中断','trim','content','20270682IDrUSX','text','json','join','[大史官-远征失败]','/v1/chat/completions','鸣金收兵','historiographyLargeRefinePrompt','[大史官-通讯异常]','楼总结已完成】否则后续总结无法进行。','historiographySmallSummaryPrompt','slice','name1','未知的史册写入指令','character_main','application/json','\x0a\x0a---\x0a\x0a【','远征已遵从您的敕令暂停!随时可以【继续远征】。','split','success','info','dedicated','/v1/','停战敕令已下达!远征军将在完成当前批次的任务后休整。','chat','mes','historiographySmallTriggerThreshold','》中的【微言录合集】...','国库空虚','以下内容是【1楼-','国史已是最新,远征军无需出动。','573149QSrxEX','replace','[大史官-通讯异常]\x20您提供的API\x20URL格式不正确,无法解析。','远征军已在营中,无需下达停战敕令。','filter','amily2-expedition-state-change','楼】已发生的剧情回顾。\x0a\x0a---\x0a\x0a','微言录\x20(手动)','197832KCXZni','historiographyLargeJailbreakPrompt','当前角色未绑定主世界书,无法写入总结。','stringify','table','国史馆','圣谕传达','\x0a\x0a本条勿动【前','[大史官]\x20阅览《','historiographySmallJailbreakPrompt','\x20层历史,分\x20','远征途中遭遇重大挫折,任务中止!您可以随时【继续远征】。','world','href','》时出错:','comment','extensions','[大史官]\x20重铸任务失败:','endsWith','远征完毕','》天机时出错:','includes','远征军已在途中,无需重复下令。','911724sfQWBU','find','loreKeywords','与模型B通讯时发生异常:\x20','通讯异常','遵旨!正在为您熔铸\x20','写入失败:','【敕史局】对话流水总帐','1696084fImbHj','API\x20URL格式错误,大史官无法出征。','match','values','[Amily2-大史官]\x20准备向模型B发送机密信函...\x20@\x20','模型B召唤失败:\x20','min','选定的楼层范围内无有效对话。','error','\x20-\x20','log','编年史已成功更新!','assign','loreDepth','找不到指定的史册条目,重铸任务中止。','803200ZEPFZJ','loreInsertionPosition','\x20至\x20','[大史官-通讯失败]','\x0a','圣谕悉知','宏史卷重铸完毕','重铸史册时发生错误。','map','Amily2-Lore-','always','Bearer\x20','当前角色未绑定主世界书,远征军无法开拔!','lorebookTarget','historiographySmallAutoEnable','disable','\x20(宏史卷重铸)','pathname','[大史官]\x20检阅《','圣谕不明','length'];_0x3ea8=function(){return _0x15a5c5;};return _0x3ea8();}export async function executeExpedition(){const _0x466ee1=_0x246793;if(isExpeditionRunning){toastr[_0x466ee1(0xb6)](_0x466ee1(0xdf),_0x466ee1(0xfc));return;}isExpeditionRunning=!![],manualStopRequested=![],document[_0x466ee1(0x11b)](new CustomEvent(_0x466ee1(0xc6),{'detail':{'isRunning':!![]}}));try{const _0x276a84=extension_settings[extensionName],_0x2117db=getContext();let _0x17fed4=null;switch(_0x276a84[_0x466ee1(0x104)]){case'character_main':_0x17fed4=characters[_0x2117db[_0x466ee1(0x117)]]?.['data']?.['extensions']?.['world'];if(!_0x17fed4){toastr[_0x466ee1(0xf0)](_0x466ee1(0x103),_0x466ee1(0x10a)),isExpeditionRunning=![],document['dispatchEvent'](new CustomEvent(_0x466ee1(0xc6),{'detail':{'isRunning':![],'manualStop':![]}}));return;}break;case _0x466ee1(0xb7):const _0xd5a2c2=await getChatIdentifier();_0x17fed4=_0x466ee1(0x100)+_0xd5a2c2;break;default:toastr[_0x466ee1(0xf0)]('未知的史册写入目标,远征军无法开拔!',_0x466ee1(0x10a)),isExpeditionRunning=![],document[_0x466ee1(0x11b)](new CustomEvent(_0x466ee1(0xc6),{'detail':{'isRunning':![],'manualStop':![]}}));return;}const _0x3a2af6=await readGoldenLedgerProgress(_0x17fed4),_0x3e48ac=_0x2117db['chat'][_0x466ee1(0x10b)],_0x5ac9b2=_0x3e48ac-_0x3a2af6;if(_0x5ac9b2<=0x0){toastr['info'](_0x466ee1(0xc0),'凯旋'),isExpeditionRunning=![],document[_0x466ee1(0x11b)](new CustomEvent(_0x466ee1(0xc6),{'detail':{'isRunning':![],'manualStop':![]}}));return;}const _0x5deb27=_0x276a84[_0x466ee1(0xbc)],_0x19598d=Math['ceil'](_0x5ac9b2/_0x5deb27);toastr[_0x466ee1(0xb6)](_0x466ee1(0x119)+_0x5ac9b2+_0x466ee1(0xd3)+_0x19598d+'\x20批次征服!','远征开始');let _0x45260c=_0x3a2af6;for(let _0x439965=0x0;_0x439965<_0x19598d;_0x439965++){if(manualStopRequested){toastr[_0x466ee1(0x120)](_0x466ee1(0xb3),_0x466ee1(0xa8));break;}const _0x4a92d7=_0x45260c+0x1,_0xe9e01a=Math[_0x466ee1(0xee)](_0x45260c+_0x5deb27,_0x3e48ac),_0x4d83a2='远征战役\x20('+(_0x439965+0x1)+'/'+_0x19598d+')',_0x519c9c=0x7d0;_0x439965>0x0&&(toastr['info']('第\x20'+(_0x439965+0x1)+'\x20批次战役准备中...\x20('+_0x519c9c/0x3e8+'秒后接敌)',_0x4d83a2),await new Promise(_0x50f050=>setTimeout(_0x50f050,_0x519c9c)));if(manualStopRequested){toastr[_0x466ee1(0x120)](_0x466ee1(0x115),_0x466ee1(0xa8));break;}await executeManualSummary(_0x4a92d7,_0xe9e01a,!![]),_0x45260c=_0xe9e01a;}!manualStopRequested&&toastr['success']('凯旋!远征大捷!所有未载之史均已化为帝国永恒的记忆!',_0x466ee1(0xdc));}catch(_0x41ce96){console['error'](_0x466ee1(0xa6),_0x41ce96),toastr[_0x466ee1(0xf0)](_0x466ee1(0xd4),_0x466ee1(0x112));}finally{isExpeditionRunning=![],document[_0x466ee1(0x11b)](new CustomEvent(_0x466ee1(0xc6),{'detail':{'isRunning':![],'manualStop':manualStopRequested}}));}}export function stopExpedition(){const _0x2d7915=_0x246793;isExpeditionRunning?(manualStopRequested=!![],toastr[_0x2d7915(0xb6)](_0x2d7915(0xb9),_0x2d7915(0xcf))):toastr[_0x2d7915(0x120)](_0x2d7915(0xc4),_0x2d7915(0xfc));} +const _0x1b223=_0x33d1;(function(_0x5ae857,_0x53c7b3){const _0x549198=_0x33d1,_0x30ad6c=_0x5ae857();while(!![]){try{const _0x137551=-parseInt(_0x549198(0x93))/0x1+parseInt(_0x549198(0x74))/0x2*(-parseInt(_0x549198(0x9a))/0x3)+parseInt(_0x549198(0xb1))/0x4+-parseInt(_0x549198(0x9d))/0x5*(parseInt(_0x549198(0x6e))/0x6)+-parseInt(_0x549198(0x69))/0x7*(parseInt(_0x549198(0x81))/0x8)+parseInt(_0x549198(0x6d))/0x9*(-parseInt(_0x549198(0x7e))/0xa)+parseInt(_0x549198(0xef))/0xb*(parseInt(_0x549198(0xa3))/0xc);if(_0x137551===_0x53c7b3)break;else _0x30ad6c['push'](_0x30ad6c['shift']());}catch(_0x1d555f){_0x30ad6c['push'](_0x30ad6c['shift']());}}}(_0x5b12,0x81610));import{getContext,extension_settings}from'/scripts/extensions.js';import{characters}from'/script.js';import{world_names,loadWorldInfo,createNewWorldInfo,createWorldInfoEntry,saveWorldInfo}from'/scripts/world-info.js';function _0x33d1(_0x394ac5,_0x185de0){const _0x5b12b8=_0x5b12();return _0x33d1=function(_0x33d1d5,_0x2c3d73){_0x33d1d5=_0x33d1d5-0x64;let _0x2dc757=_0x5b12b8[_0x33d1d5];return _0x2dc757;},_0x33d1(_0x394ac5,_0x185de0);}import{extensionName}from'../utils/settings.js';import{getChatIdentifier}from'./lore.js';import{isGoogleEndpoint,convertToGoogleRequest,parseGoogleResponse,buildGoogleApiUrl}from'../core/utils/googleAdapter.js';import{intelligentPoll,createGooglePollingTask}from'../core/utils/pollingManager.js';let isExpeditionRunning=![],manualStopRequested=![];async function callAmily2Model(_0x35396f){const _0x4b1e30=_0x33d1,_0x5cd49c=extension_settings[extensionName],{apiUrl:_0x4ebb72,apiKey:_0x24ccf1,model:_0x221b75,temperature:_0x35ac0c,maxTokens:_0x1032a8}=_0x5cd49c;if(!_0x4ebb72||!_0x221b75)return toastr[_0x4b1e30(0x8a)](_0x4b1e30(0xc6),_0x4b1e30(0x7b)),null;const _0x2b35f3=isGoogleEndpoint(_0x4ebb72);try{let _0x1711ea;if(_0x2b35f3)_0x1711ea=buildGoogleApiUrl(_0x4ebb72,_0x221b75),console['log']('[大史官-Google外交部]\x20修正后的API地址:\x20'+_0x1711ea);else{const _0x7a8d7f=new URL(_0x4ebb72),_0x4b0602=_0x7a8d7f[_0x4b1e30(0xb0)][_0x4b1e30(0xa4)](_0x4b1e30(0xb4))||_0x7a8d7f[_0x4b1e30(0xb0)][_0x4b1e30(0xa4)]('/v1beta/openai');if(_0x4b0602)_0x1711ea=_0x4ebb72;else{let _0x446b78=_0x7a8d7f[_0x4b1e30(0xb0)];if(_0x446b78[_0x4b1e30(0xa4)](_0x4b1e30(0xd6)))_0x446b78=_0x446b78[_0x4b1e30(0xcd)](0x0,-0x1);else{if(_0x446b78[_0x4b1e30(0xa4)](_0x4b1e30(0xbf)))_0x446b78=_0x446b78[_0x4b1e30(0xcd)](0x0,-0x2);}_0x7a8d7f['pathname']=_0x446b78['replace'](/\/$/,'')+_0x4b1e30(0xb4),_0x1711ea=_0x7a8d7f[_0x4b1e30(0x7a)];}}console['groupCollapsed'](_0x4b1e30(0x75)+new Date()[_0x4b1e30(0xe8)]()),console[_0x4b1e30(0x96)](_0x4b1e30(0xe5)+_0x1711ea),console['log'](_0x4b1e30(0x9f),{'model':_0x221b75,'temperature':_0x35ac0c,'maxTokens':_0x1032a8}),console[_0x4b1e30(0x96)](_0x4b1e30(0xc2)),console[_0x4b1e30(0x91)](_0x35396f),console[_0x4b1e30(0xda)]();let _0x512bdb={'Content-Type':_0x4b1e30(0xa0)};_0x2b35f3?_0x4ebb72[_0x4b1e30(0x8b)](_0x4b1e30(0xaf))||_0x4ebb72[_0x4b1e30(0x8b)](_0x4b1e30(0x6c))?_0x512bdb[_0x4b1e30(0x8c)]=_0x4b1e30(0xe3)+_0x24ccf1:_0x512bdb['X-goog-api-key']=_0x24ccf1:_0x512bdb[_0x4b1e30(0x8c)]=_0x4b1e30(0xe3)+_0x24ccf1;let _0x48d187;_0x2b35f3?_0x48d187=JSON['stringify'](convertToGoogleRequest({'model':_0x221b75,'messages':_0x35396f,'temperature':_0x35ac0c,'max_tokens':_0x1032a8})):_0x48d187=JSON[_0x4b1e30(0xa8)]({'model':_0x221b75,'messages':_0x35396f,'temperature':_0x35ac0c,'max_tokens':_0x1032a8,'stream':![]});const _0x535fb5=await fetch(_0x1711ea,{'method':_0x4b1e30(0xaa),'headers':_0x512bdb,'body':_0x48d187});if(!_0x535fb5['ok']){const _0xaada5b=await _0x535fb5[_0x4b1e30(0xa5)]();console[_0x4b1e30(0x8a)](_0x4b1e30(0xb5),_0x535fb5['status'],_0xaada5b);throw new Error('模型B召唤失败:\x20'+_0x535fb5[_0x4b1e30(0x9e)]+_0x4b1e30(0xdf)+_0xaada5b);}let _0x2f6f43=await _0x535fb5['json']();if(_0x2b35f3&&_0x2f6f43[_0x4b1e30(0xd5)]&&_0x2f6f43[_0x4b1e30(0x66)]){console[_0x4b1e30(0x96)]('[大史官-Google外交部]\x20收到异步操作ID,启用轮询机制...');let _0x24dc49;try{const _0x228c3b=new URL(_0x4ebb72);_0x24dc49=_0x228c3b['protocol']+'//'+_0x228c3b[_0x4b1e30(0x80)];}catch{_0x24dc49=_0x4ebb72;}const _0x4f0108=createGooglePollingTask(_0x2f6f43['name'],_0x24dc49,_0x512bdb),_0x4cd3c2={'maxAttempts':0x5,'baseDelay':0xbb8,'shouldStop':_0x4af811=>_0x4af811[_0x4b1e30(0xb9)],'onError':_0x213489=>console[_0x4b1e30(0x8a)](_0x4b1e30(0xd4),_0x213489)},_0xd1abce=await intelligentPoll(_0x4f0108,_0x4cd3c2);if(!_0xd1abce['response'])throw new Error('轮询完成但未获得有效响应');_0x2f6f43=_0xd1abce['response'];}const _0x1211bf=_0x2b35f3?parseGoogleResponse(_0x2f6f43)?.[_0x4b1e30(0x7c)]?.[0x0]?.[_0x4b1e30(0xf4)]?.[_0x4b1e30(0xba)]:_0x2f6f43?.['choices']?.[0x0]?.['message']?.[_0x4b1e30(0xba)];return _0x1211bf;}catch(_0x3ea0a9){return console[_0x4b1e30(0x8a)]('[大史官-通讯异常]',_0x3ea0a9),toastr[_0x4b1e30(0x8a)](_0x4b1e30(0x79)+_0x3ea0a9[_0x4b1e30(0xf4)],_0x4b1e30(0xd8)),null;}}const RUNNING_LOG_COMMENT=_0x1b223(0xa6),PROGRESS_SEAL_REGEX=/本条勿动【前(\d+)楼总结已完成】否则后续总结无法进行。$/;async function readGoldenLedgerProgress(_0x80252c){const _0x4de2f6=_0x1b223;if(!_0x80252c)return 0x0;try{const _0x2c05c5=await loadWorldInfo(_0x80252c);if(!_0x2c05c5||!_0x2c05c5['entries'])return 0x0;const _0x2fa05d=Object[_0x4de2f6(0xca)](_0x2c05c5[_0x4de2f6(0xf5)])[_0x4de2f6(0xec)](_0x28ebf7=>_0x28ebf7[_0x4de2f6(0xd3)]===RUNNING_LOG_COMMENT&&!_0x28ebf7[_0x4de2f6(0x99)]);if(!_0x2fa05d)return 0x0;const _0x2e0a84=_0x2fa05d[_0x4de2f6(0xba)][_0x4de2f6(0xab)](PROGRESS_SEAL_REGEX);return _0x2e0a84?parseInt(_0x2e0a84[0x1],0xa):0x0;}catch(_0x594109){return console[_0x4de2f6(0x8a)]('[大史官]\x20阅览《'+_0x80252c+'》天机时出错:',_0x594109),0x0;}}export async function checkAndTriggerAutoSummary(){const _0x7f2617=_0x1b223,_0x239f3b=extension_settings[extensionName];if(!_0x239f3b['historiographySmallAutoEnable'])return;const _0x48963e=getContext();let _0x4ea88c=null;switch(_0x239f3b['lorebookTarget']){case _0x7f2617(0xc5):_0x4ea88c=characters[_0x48963e[_0x7f2617(0x95)]]?.[_0x7f2617(0x72)]?.[_0x7f2617(0x9c)]?.[_0x7f2617(0x76)];break;case _0x7f2617(0xc8):const _0x509dd0=await getChatIdentifier();_0x4ea88c=_0x7f2617(0x8d)+_0x509dd0;break;default:return;}if(!_0x4ea88c)return;const _0x74deaf=await readGoldenLedgerProgress(_0x4ea88c),_0x2decd8=_0x48963e['chat'][_0x7f2617(0x90)],_0x35b295=_0x2decd8-_0x74deaf;if(_0x35b295>=_0x239f3b[_0x7f2617(0xf3)]){const _0x235374=_0x74deaf+0x1,_0x5652f1=_0x2decd8;await executeManualSummary(_0x235374,_0x5652f1,!![]);}}export async function getAvailableWorldbooks(){return[...world_names];}export async function getLoresForWorldbook(_0x550acc){const _0x134eef=_0x1b223;if(!_0x550acc)return[];try{const _0x1c9534=await loadWorldInfo(_0x550acc);if(!_0x1c9534||!_0x1c9534['entries'])return[];return Object[_0x134eef(0xf5)](_0x1c9534[_0x134eef(0xf5)])[_0x134eef(0x92)](([,_0x4c44c6])=>!_0x4c44c6['disable'])[_0x134eef(0x68)](([_0x74230e,_0x497957])=>({'key':_0x74230e,'comment':_0x497957[_0x134eef(0xd3)]||_0x134eef(0xeb)}));}catch(_0x3e9021){return console['error'](_0x134eef(0x88)+_0x550acc+'》时出错:',_0x3e9021),[];}}function _0x5b12(){const _0xd1d25c=['split','凯旋!远征大捷!所有未载之史均已化为帝国永恒的记忆!','loreInsertionPosition','Bearer\x20','未知的史册写入目标,远征军无法开拔!','【目标地址】:\x20','遵旨!正在为您重铸《','warning','toLocaleTimeString','loreDepth','success','无标题条目','find','史册条目中无可供重铸的内容。','停战敕令已下达!远征军将在完成当前批次的任务后休整。','11rmYVdA','宏史卷重铸完毕','ceil','国库空虚','historiographySmallTriggerThreshold','message','entries','找不到指定的史册条目,重铸任务中止。','远征军已在途中,无需重复下令。','metadata','国史馆','map','14wORVKr','loreActivationMode','国史已是最新,远征军无需出动。','us-central1','3934422fpVdlE','5485938MrnoPW','远征已遵从您的敕令暂停!随时可以【继续远征】。','微言录\x20(手动)','historiographySmallJailbreakPrompt','data','historiographySmallSummaryPrompt','243562tbODhy','[Amily2-大史官]\x20准备向模型B发送机密信函...\x20@\x20','world','dispatchEvent','鸣金收兵','与模型B通讯时发生异常:\x20','href','通讯中断','choices','is_user','10poYBam','远征失败','host','1607248TjJDEM','史册已成功重铸,并保存于《','远征开始','join','以下内容是【1楼-','chat','楼总结已完成】否则后续总结无法进行。','[大史官]\x20检阅《','loreKeywords','error','includes','Authorization','Amily2-Lore-','重铸史册时发生错误。','lorebookTarget','length','table','filter','1009730CacNtP','请严格根据以下“对话记录”中的内容进行总结,不要添加任何额外信息。\x0a\x0a<对话记录>\x0a','characterId','log','user','》中的【微言录合集】...','disable','6TZWYKv','name1','extensions','5yApkOj','status','【信函参数】','application/json','historiographyLargeRefinePrompt','圣谕不明','30915744KqWPYY','endsWith','text','【敕史局】对话流水总帐','远征已在准备阶段遵令暂停!','stringify','宏史卷重铸','POST','match','mes','远征军已在营中,无需下达停战敕令。','楼详细总结记录】\x0a','aiplatform.googleapis.com','pathname','3840836JtLNMt','遵旨!正在为您熔铸\x20','assign','/v1/chat/completions','[大史官-通讯失败]','当前角色未绑定主世界书,无法写入总结。','system','圣谕悉知','done','content','圣谕有误','\x20批次战役准备中...\x20(','远征军已开拔!目标:','选定的楼层范围内无有效对话。','/v1','未知的史册写入指令','amily2-expedition-state-change','【信函正文\x20(messages)】:','当前角色未绑定主世界书,远征军无法开拔!','\x20层历史,分\x20','character_main','API\x20URL或模型未配置,大史官无法召唤模型B。','info','dedicated','min','values','编年史已成功更新!','trim','slice','楼】已发生的剧情回顾。\x0a\x0a---\x0a\x0a','\x20至\x20','\x20(宏史卷重铸)','远征途中遭遇重大挫折,任务中止!您可以随时【继续远征】。','name2','comment','[轮询错误]','name','/v1/','远征完毕','通讯异常','[大史官-远征失败]','groupEnd','replace','\x0a','always','请将以下多个零散的“详细总结记录”提炼并融合成一段连贯的章节历史。原文如下:\x0a\x0a','\x20-\x20'];_0x5b12=function(){return _0xd1d25c;};return _0x5b12();}export async function executeManualSummary(_0x28e250,_0x23ae7c,_0x5e36e4=![]){const _0x1c9345=_0x1b223,_0x3db757=_0x5e36e4?'微言录\x20(自动)':_0x1c9345(0x70);toastr[_0x1c9345(0xc7)](_0x1c9345(0xb2)+_0x28e250+_0x1c9345(0xcf)+_0x23ae7c+'\x20层的对话历史...',_0x3db757);const _0x194b9f=getContext(),_0x208b28=_0x194b9f[_0x1c9345(0x86)],_0x1ffab7=extension_settings[extensionName],_0x4bdac9=_0x208b28['slice'](_0x28e250,_0x23ae7c+0x1);if(_0x4bdac9[_0x1c9345(0x90)]===0x0){toastr[_0x1c9345(0xe7)](_0x1c9345(0xbe),_0x1c9345(0xbb));return;}const _0x283662=_0x194b9f[_0x1c9345(0x9b)]||'用户',_0x4889b5=_0x194b9f[_0x1c9345(0xd2)]||'角色',_0x5bf0d4=_0x4bdac9[_0x1c9345(0x68)](_0x5b4452=>{const _0x1c2c75=_0x1c9345,_0x5daef2=_0x5b4452[_0x1c2c75(0x7d)]?_0x283662:_0x4889b5;return _0x5daef2+':\x20'+_0x5b4452[_0x1c2c75(0xac)]['trim']();})[_0x1c9345(0x84)]('\x0a'),_0x20325f=[{'role':_0x1c9345(0xb7),'content':_0x1ffab7[_0x1c9345(0x71)]},{'role':'system','content':_0x1ffab7[_0x1c9345(0x73)]},{'role':_0x1c9345(0x97),'content':_0x1c9345(0x94)+_0x5bf0d4+_0x1c9345(0xdc)}],_0x1b059c=await callAmily2Model(_0x20325f);if(!_0x1b059c)return;try{let _0x13c3a1=null;switch(_0x1ffab7[_0x1c9345(0x8f)]){case _0x1c9345(0xc5):_0x13c3a1=characters[_0x194b9f[_0x1c9345(0x95)]]?.['data']?.[_0x1c9345(0x9c)]?.[_0x1c9345(0x76)];if(!_0x13c3a1){toastr[_0x1c9345(0x8a)](_0x1c9345(0xb6),_0x1c9345(0x67));return;}break;case'dedicated':const _0x1a4585=await getChatIdentifier();_0x13c3a1=_0x1c9345(0x8d)+_0x1a4585;!world_names[_0x1c9345(0x8b)](_0x13c3a1)&&await createNewWorldInfo(_0x13c3a1);break;default:toastr[_0x1c9345(0x8a)](_0x1c9345(0xc0),'圣谕不明');return;}const _0x408da9=await loadWorldInfo(_0x13c3a1),_0x46abc0=Object[_0x1c9345(0xca)](_0x408da9[_0x1c9345(0xf5)])['find'](_0x577970=>_0x577970[_0x1c9345(0xd3)]===RUNNING_LOG_COMMENT&&!_0x577970['disable']),_0x1e18a6='\x0a\x0a本条勿动【前'+_0x23ae7c+_0x1c9345(0x87),_0x203112='\x0a\x0a---\x0a\x0a【'+_0x28e250+'楼至'+_0x23ae7c+_0x1c9345(0xae)+_0x1b059c;if(_0x46abc0){const _0x2b0a45=_0x46abc0[_0x1c9345(0xba)]['replace'](PROGRESS_SEAL_REGEX,'')['trim']();_0x46abc0[_0x1c9345(0xba)]=_0x2b0a45+_0x203112+_0x1e18a6;}else{const _0x3c3700='以下是依照顺序已发生剧情'+_0x203112,_0x847f4a=createWorldInfoEntry(_0x13c3a1,_0x408da9),_0x38d49b=_0x1ffab7[_0x1c9345(0x89)][_0x1c9345(0xe0)](',')[_0x1c9345(0x68)](_0xa5fe5d=>_0xa5fe5d[_0x1c9345(0xcc)]())['filter'](Boolean),_0x2b86d8=_0x1ffab7[_0x1c9345(0x6a)]===_0x1c9345(0xdd),_0x467286={'before_char':0x0,'after_char':0x1,'before_an':0x2,'after_an':0x3,'at_depth':0x4};Object[_0x1c9345(0xb3)](_0x847f4a,{'comment':RUNNING_LOG_COMMENT,'content':_0x3c3700+_0x1e18a6,'key':_0x38d49b,'constant':_0x2b86d8,'position':_0x467286[_0x1ffab7[_0x1c9345(0xe2)]]??0x4,'depth':_0x1ffab7[_0x1c9345(0xe9)],'disable':![]});}await saveWorldInfo(_0x13c3a1,_0x408da9,!![]),toastr['success'](_0x1c9345(0xcb),_0x3db757+'完毕');}catch(_0x530b8f){console[_0x1c9345(0x8a)]('[大史官]\x20'+_0x3db757+'写入失败:',_0x530b8f),toastr[_0x1c9345(0x8a)]('写入'+_0x3db757+'时发生错误。','国史馆');}}export async function executeRefinement(_0x58918f,_0x1499f6){const _0x66408f=_0x1b223;toastr['info'](_0x66408f(0xe6)+_0x58918f+_0x66408f(0x98),_0x66408f(0xa9));try{const _0x2bcd90=await loadWorldInfo(_0x58918f),_0x4d5b8c=_0x2bcd90?.[_0x66408f(0xf5)][_0x1499f6];if(!_0x4d5b8c){toastr[_0x66408f(0x8a)](_0x66408f(0x64),'圣谕有误');return;}const _0x8348fd=_0x4d5b8c[_0x66408f(0xba)],_0xd03294=extension_settings[extensionName];let _0x5ae79c=_0x8348fd,_0x4d00d0='',_0x2e5972=0x0;const _0x2e3991=_0x8348fd[_0x66408f(0xab)](PROGRESS_SEAL_REGEX);_0x2e3991&&(_0x4d00d0=_0x2e3991[0x0],_0x2e5972=parseInt(_0x2e3991[0x1],0xa),_0x5ae79c=_0x8348fd[_0x66408f(0xdb)](PROGRESS_SEAL_REGEX,'')[_0x66408f(0xcc)]());if(!_0x5ae79c[_0x66408f(0xcc)]()){toastr['warning'](_0x66408f(0xed),_0x66408f(0xf2));return;}const _0x184763=[{'role':_0x66408f(0xb7),'content':_0xd03294['historiographyLargeJailbreakPrompt']},{'role':_0x66408f(0xb7),'content':_0xd03294[_0x66408f(0xa1)]},{'role':_0x66408f(0x97),'content':_0x66408f(0xde)+_0x5ae79c}],_0x40d287=await callAmily2Model(_0x184763);if(!_0x40d287)return;const _0x1a2897=_0x66408f(0x85)+_0x2e5972+_0x66408f(0xce),_0x47df96=_0x1a2897+_0x40d287;_0x4d5b8c[_0x66408f(0xba)]=_0x47df96+('\x0a\x0a'+_0x4d00d0),_0x4d5b8c['comment']=_0x4d5b8c['comment'][_0x66408f(0xdb)](/\s*\(已精炼\)|\s*\(宏史卷重铸\)/g,''),_0x4d5b8c[_0x66408f(0xd3)]+=_0x66408f(0xd0),await saveWorldInfo(_0x58918f,_0x2bcd90,!![]),toastr[_0x66408f(0xea)](_0x66408f(0x82)+_0x58918f+'》!',_0x66408f(0xf0));}catch(_0x5367bf){console[_0x66408f(0x8a)]('[大史官]\x20重铸任务失败:',_0x5367bf),toastr['error'](_0x66408f(0x8e),_0x66408f(0x67));}}export async function executeExpedition(){const _0x5eaeab=_0x1b223;if(isExpeditionRunning){toastr[_0x5eaeab(0xc7)](_0x5eaeab(0x65),'圣谕悉知');return;}isExpeditionRunning=!![],manualStopRequested=![],document[_0x5eaeab(0x77)](new CustomEvent('amily2-expedition-state-change',{'detail':{'isRunning':!![]}}));try{const _0x6bd9c8=extension_settings[extensionName],_0x38a61d=getContext();let _0xc17733=null;switch(_0x6bd9c8[_0x5eaeab(0x8f)]){case _0x5eaeab(0xc5):_0xc17733=characters[_0x38a61d['characterId']]?.[_0x5eaeab(0x72)]?.[_0x5eaeab(0x9c)]?.['world'];if(!_0xc17733){toastr[_0x5eaeab(0x8a)](_0x5eaeab(0xc3),_0x5eaeab(0xa2)),isExpeditionRunning=![],document[_0x5eaeab(0x77)](new CustomEvent(_0x5eaeab(0xc1),{'detail':{'isRunning':![],'manualStop':![]}}));return;}break;case'dedicated':const _0x277d09=await getChatIdentifier();_0xc17733=_0x5eaeab(0x8d)+_0x277d09;break;default:toastr[_0x5eaeab(0x8a)](_0x5eaeab(0xe4),_0x5eaeab(0xa2)),isExpeditionRunning=![],document['dispatchEvent'](new CustomEvent('amily2-expedition-state-change',{'detail':{'isRunning':![],'manualStop':![]}}));return;}const _0x1d0237=await readGoldenLedgerProgress(_0xc17733),_0x23edd8=_0x38a61d[_0x5eaeab(0x86)][_0x5eaeab(0x90)],_0x2a3830=_0x23edd8-_0x1d0237;if(_0x2a3830<=0x0){toastr[_0x5eaeab(0xc7)](_0x5eaeab(0x6b),'凯旋'),isExpeditionRunning=![],document[_0x5eaeab(0x77)](new CustomEvent('amily2-expedition-state-change',{'detail':{'isRunning':![],'manualStop':![]}}));return;}const _0x330cd0=_0x6bd9c8[_0x5eaeab(0xf3)],_0x483dc1=Math[_0x5eaeab(0xf1)](_0x2a3830/_0x330cd0);toastr[_0x5eaeab(0xc7)](_0x5eaeab(0xbd)+_0x2a3830+_0x5eaeab(0xc4)+_0x483dc1+'\x20批次征服!',_0x5eaeab(0x83));let _0x23d349=_0x1d0237;for(let _0x146248=0x0;_0x146248<_0x483dc1;_0x146248++){if(manualStopRequested){toastr[_0x5eaeab(0xe7)](_0x5eaeab(0x6f),_0x5eaeab(0x78));break;}const _0x3ad2d0=_0x23d349+0x1,_0x2c8b9c=Math[_0x5eaeab(0xc9)](_0x23d349+_0x330cd0,_0x23edd8),_0x3f17a6='远征战役\x20('+(_0x146248+0x1)+'/'+_0x483dc1+')',_0x11084a=0x7d0;_0x146248>0x0&&(toastr['info']('第\x20'+(_0x146248+0x1)+_0x5eaeab(0xbc)+_0x11084a/0x3e8+'秒后接敌)',_0x3f17a6),await new Promise(_0x5a590e=>setTimeout(_0x5a590e,_0x11084a)));if(manualStopRequested){toastr[_0x5eaeab(0xe7)](_0x5eaeab(0xa7),_0x5eaeab(0x78));break;}await executeManualSummary(_0x3ad2d0,_0x2c8b9c,!![]),_0x23d349=_0x2c8b9c;}!manualStopRequested&&toastr['success'](_0x5eaeab(0xe1),_0x5eaeab(0xd7));}catch(_0x5166a5){console[_0x5eaeab(0x8a)](_0x5eaeab(0xd9),_0x5166a5),toastr[_0x5eaeab(0x8a)](_0x5eaeab(0xd1),_0x5eaeab(0x7f));}finally{isExpeditionRunning=![],document[_0x5eaeab(0x77)](new CustomEvent(_0x5eaeab(0xc1),{'detail':{'isRunning':![],'manualStop':manualStopRequested}}));}}export function stopExpedition(){const _0x45692d=_0x1b223;isExpeditionRunning?(manualStopRequested=!![],toastr[_0x45692d(0xc7)](_0x45692d(0xee),'圣谕传达')):toastr[_0x45692d(0xe7)](_0x45692d(0xad),_0x45692d(0xb8));}