export function toDisplayAgentName(_0x507431,{fallback:fallback='Unknown'}={}){const _0x556f36=String(_0x507431||'')['trim']()['toLowerCase']();if(!_0x556f36)return fallback;return _0x556f36['charAt'](0x0)['toUpperCase']()+_0x556f36['slice'](0x1);}export function escapeRegExp(_0x3ce501){return String(_0x3ce501)['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&');}export function compareJudgmentsForAliasOrder(_0x3a3688,_0xd5010d){const _0x49f1f2=String(_0x3a3688?.['createdAt']||''),_0x595118=String(_0xd5010d?.['createdAt']||'');if(_0x49f1f2!==_0x595118)return _0x49f1f2['localeCompare'](_0x595118);return String(_0x3a3688?.['taskId']||'')['localeCompare'](String(_0xd5010d?.['taskId']||''));}export function parseJudgeAliasNumber(_0x548820,_0x46e0bf){const _0x46b667=typeof _0x548820==='string'?_0x548820['trim']():'',_0x32f88e=toDisplayAgentName(_0x46e0bf,{'fallback':''});if(!_0x46b667||!_0x32f88e)return null;const _0x29f19c=_0x46b667['toLowerCase'](),_0x31f280=_0x32f88e['toLowerCase']();if(_0x29f19c===_0x31f280||_0x29f19c===_0x31f280+'\x20judge')return 0x1;const _0x2ada55=[new RegExp('^'+escapeRegExp(_0x32f88e)+'\x5cs+(\x5cd+)$','i'),new RegExp('^'+escapeRegExp(_0x32f88e)+'\x5cs+Judge\x5cs+(\x5cd+)$','i')];for(const _0x380d42 of _0x2ada55){const _0x2e6479=_0x46b667['match'](_0x380d42);if(_0x2e6479){const _0x548a64=Number(_0x2e6479[0x1]);if(Number['isInteger'](_0x548a64)&&_0x548a64>0x0)return _0x548a64;}}return null;}export function formatJudgeDisplayName({alias:_0x23c6ef,agent:_0x32687a,number:number=null,hasDuplicates:hasDuplicates=![]}={}){const _0x438bb5=toDisplayAgentName(_0x32687a,{'fallback':'Judge'}),_0x9bc3e=typeof _0x23c6ef==='string'?_0x23c6ef['trim']():'';if(Number['isInteger'](number)&&number>0x0)return _0x438bb5+'\x20Judge\x20'+number;if(_0x9bc3e)return/\bjudge\b/i['test'](_0x9bc3e)?_0x9bc3e:_0x9bc3e+'\x20Judge';if(hasDuplicates)return _0x438bb5+'\x20Judge';return _0x438bb5==='Judge'?_0x438bb5:_0x438bb5+'\x20Judge';}export function buildJudgmentDisplayNameMap(_0x22a427=[]){const _0x105b63=Array['isArray'](_0x22a427)?_0x22a427['filter'](Boolean):[],_0x29c1a3=new Map();_0x105b63['forEach'](_0x1ee28b=>{const _0x58a1eb=_0x1ee28b?.['judgeAgent']||_0x1ee28b?.['envVars']?.['CODER_AGENT']||'unknown',_0x233647=String(_0x58a1eb||'')['trim']()['toLowerCase']()||'unknown';!_0x29c1a3['has'](_0x233647)&&_0x29c1a3['set'](_0x233647,[]),_0x29c1a3['get'](_0x233647)['push'](_0x1ee28b);});const _0x52ec82=new Map();return _0x29c1a3['forEach'](_0x173fe5=>{const _0x4c3337=[..._0x173fe5]['sort'](compareJudgmentsForAliasOrder),_0x987011=_0x4c3337['length']>0x1,_0x98a9b8=new Set(),_0x50e3e8=new Map();_0x987011&&_0x4c3337['forEach'](_0x12c17d=>{const _0x22149c=parseJudgeAliasNumber(_0x12c17d?.['judgeAlias'],_0x12c17d?.['judgeAgent']);if(!Number['isInteger'](_0x22149c)||_0x22149c<=0x0||_0x98a9b8['has'](_0x22149c))return;_0x50e3e8['set'](_0x12c17d['taskId'],_0x22149c),_0x98a9b8['add'](_0x22149c);});let _0x5b88de=0x1;const _0x596f85=()=>{while(_0x98a9b8['has'](_0x5b88de)){_0x5b88de+=0x1;}return _0x98a9b8['add'](_0x5b88de),_0x5b88de;};_0x4c3337['forEach'](_0x235eba=>{let _0x23abbc=_0x50e3e8['get'](_0x235eba['taskId'])||null;_0x987011&&_0x23abbc===null&&!String(_0x235eba?.['judgeAlias']||'')['trim']()&&(_0x23abbc=_0x596f85()),_0x52ec82['set'](_0x235eba['taskId'],formatJudgeDisplayName({'alias':_0x235eba?.['judgeAlias']||null,'agent':_0x235eba?.['judgeAgent']||_0x235eba?.['envVars']?.['CODER_AGENT']||'unknown','number':_0x23abbc,'hasDuplicates':_0x987011}));});}),_0x52ec82;}export function buildTaskNavigationHref(_0x1fcc0d,{currentUrl:_0x4fa560,groupedTaskIds:groupedTaskIds=[],groupId:groupId=null}={}){const _0x297582=new URL(_0x4fa560),_0x424bf2=String(_0x1fcc0d||'')['trim'](),_0x3e637b=String(groupId||'')['trim'](),_0x34ad91=Array['isArray'](groupedTaskIds)?groupedTaskIds['map'](_0x4b745c=>String(_0x4b745c||'')['trim']())['filter'](Boolean):[],_0x2c68d0=Boolean(_0x3e637b)||_0x34ad91['length']>0x1;if(!_0x2c68d0)return _0x424bf2&&_0x297582['searchParams']['set']('id',_0x424bf2),_0x297582['searchParams']['delete']('groupId'),_0x297582['toString']();const _0x4f3074=_0x34ad91['includes'](_0x424bf2)?_0x34ad91:[..._0x34ad91,_0x424bf2]['filter'](Boolean);if(_0x4f3074['length']>0x0)_0x297582['searchParams']['set']('id',_0x4f3074['join'](','));else _0x424bf2&&_0x297582['searchParams']['set']('id',_0x424bf2);return _0x3e637b?_0x297582['searchParams']['set']('groupId',_0x3e637b):_0x297582['searchParams']['delete']('groupId'),_0x297582['toString']();}