export function toDisplayAgentName(_0x12fdab,{fallback:fallback='Unknown'}={}){const _0x5d32bd=String(_0x12fdab||'')['trim']()['toLowerCase']();if(!_0x5d32bd)return fallback;return _0x5d32bd['charAt'](0x0)['toUpperCase']()+_0x5d32bd['slice'](0x1);}export function escapeRegExp(_0x277eea){return String(_0x277eea)['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&');}export function compareJudgmentsForAliasOrder(_0x43b739,_0x5b9e22){const _0x3457df=String(_0x43b739?.['createdAt']||''),_0x3bffc2=String(_0x5b9e22?.['createdAt']||'');if(_0x3457df!==_0x3bffc2)return _0x3457df['localeCompare'](_0x3bffc2);return String(_0x43b739?.['taskId']||'')['localeCompare'](String(_0x5b9e22?.['taskId']||''));}export function parseJudgeAliasNumber(_0x35c64e,_0x567ecd){const _0x3ba592=typeof _0x35c64e==='string'?_0x35c64e['trim']():'',_0x4280f1=toDisplayAgentName(_0x567ecd,{'fallback':''});if(!_0x3ba592||!_0x4280f1)return null;const _0x1ecb56=_0x3ba592['toLowerCase'](),_0x1ca0fc=_0x4280f1['toLowerCase']();if(_0x1ecb56===_0x1ca0fc||_0x1ecb56===_0x1ca0fc+'\x20judge')return 0x1;const _0x114a73=[new RegExp('^'+escapeRegExp(_0x4280f1)+'\x5cs+(\x5cd+)$','i'),new RegExp('^'+escapeRegExp(_0x4280f1)+'\x5cs+Judge\x5cs+(\x5cd+)$','i')];for(const _0x567124 of _0x114a73){const _0x5747c2=_0x3ba592['match'](_0x567124);if(_0x5747c2){const _0x1a3f49=Number(_0x5747c2[0x1]);if(Number['isInteger'](_0x1a3f49)&&_0x1a3f49>0x0)return _0x1a3f49;}}return null;}export function formatJudgeDisplayName({alias:_0x40ce34,agent:_0x426f2e,number:number=null,hasDuplicates:hasDuplicates=![]}={}){const _0x3413af=toDisplayAgentName(_0x426f2e,{'fallback':'Judge'}),_0x3427c6=typeof _0x40ce34==='string'?_0x40ce34['trim']():'';if(Number['isInteger'](number)&&number>0x0)return _0x3413af+'\x20Judge\x20'+number;if(_0x3427c6)return/\bjudge\b/i['test'](_0x3427c6)?_0x3427c6:_0x3427c6+'\x20Judge';if(hasDuplicates)return _0x3413af+'\x20Judge';return _0x3413af==='Judge'?_0x3413af:_0x3413af+'\x20Judge';}export function buildJudgmentDisplayNameMap(_0xe13120=[]){const _0x1117ba=Array['isArray'](_0xe13120)?_0xe13120['filter'](Boolean):[],_0x5bbc12=new Map();_0x1117ba['forEach'](_0x156de7=>{const _0x282934=_0x156de7?.['judgeAgent']||_0x156de7?.['envVars']?.['CODER_AGENT']||'unknown',_0x586f42=String(_0x282934||'')['trim']()['toLowerCase']()||'unknown';!_0x5bbc12['has'](_0x586f42)&&_0x5bbc12['set'](_0x586f42,[]),_0x5bbc12['get'](_0x586f42)['push'](_0x156de7);});const _0x37fa53=new Map();return _0x5bbc12['forEach'](_0x13d9d6=>{const _0x3c6825=[..._0x13d9d6]['sort'](compareJudgmentsForAliasOrder),_0x50fa99=_0x3c6825['length']>0x1,_0x5435db=new Set(),_0x3f6de5=new Map();_0x50fa99&&_0x3c6825['forEach'](_0x5a7a62=>{const _0x16d2d4=parseJudgeAliasNumber(_0x5a7a62?.['judgeAlias'],_0x5a7a62?.['judgeAgent']);if(!Number['isInteger'](_0x16d2d4)||_0x16d2d4<=0x0||_0x5435db['has'](_0x16d2d4))return;_0x3f6de5['set'](_0x5a7a62['taskId'],_0x16d2d4),_0x5435db['add'](_0x16d2d4);});let _0x57290e=0x1;const _0x219b03=()=>{while(_0x5435db['has'](_0x57290e)){_0x57290e+=0x1;}return _0x5435db['add'](_0x57290e),_0x57290e;};_0x3c6825['forEach'](_0x34a05d=>{let _0x9b9b74=_0x3f6de5['get'](_0x34a05d['taskId'])||null;_0x50fa99&&_0x9b9b74===null&&!String(_0x34a05d?.['judgeAlias']||'')['trim']()&&(_0x9b9b74=_0x219b03()),_0x37fa53['set'](_0x34a05d['taskId'],formatJudgeDisplayName({'alias':_0x34a05d?.['judgeAlias']||null,'agent':_0x34a05d?.['judgeAgent']||_0x34a05d?.['envVars']?.['CODER_AGENT']||'unknown','number':_0x9b9b74,'hasDuplicates':_0x50fa99}));});}),_0x37fa53;}export function buildTaskNavigationHref(_0x349c22,{currentUrl:_0x4332c4,groupedTaskIds:groupedTaskIds=[],groupId:groupId=null}={}){const _0x54591e=new URL(_0x4332c4),_0x16ed9b=String(_0x349c22||'')['trim'](),_0x5629a5=String(groupId||'')['trim'](),_0x19e491=Array['isArray'](groupedTaskIds)?groupedTaskIds['map'](_0x45208a=>String(_0x45208a||'')['trim']())['filter'](Boolean):[],_0x3e0be3=Boolean(_0x5629a5)||_0x19e491['length']>0x1;if(!_0x3e0be3)return _0x16ed9b&&_0x54591e['searchParams']['set']('id',_0x16ed9b),_0x54591e['searchParams']['delete']('groupId'),_0x54591e['toString']();const _0x2e2537=_0x19e491['includes'](_0x16ed9b)?_0x19e491:[..._0x19e491,_0x16ed9b]['filter'](Boolean);if(_0x2e2537['length']>0x0)_0x54591e['searchParams']['set']('id',_0x2e2537['join'](','));else _0x16ed9b&&_0x54591e['searchParams']['set']('id',_0x16ed9b);return _0x5629a5?_0x54591e['searchParams']['set']('groupId',_0x5629a5):_0x54591e['searchParams']['delete']('groupId'),_0x54591e['toString']();}