tim-wx-sdk.js 504 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168
  1. module.exports = function () {
  2. var __MODS__ = {};
  3. var __DEFINE__ = function (modId, func, req) {
  4. var m = {
  5. exports: {},
  6. _tempexports: {}
  7. };
  8. __MODS__[modId] = {
  9. status: 0,
  10. func: func,
  11. req: req,
  12. m: m
  13. };
  14. };
  15. var __REQUIRE__ = function (modId, source) {
  16. if (!__MODS__[modId]) return require(source);
  17. if (!__MODS__[modId].status) {
  18. var m = __MODS__[modId].m;
  19. m._exports = m._tempexports;
  20. var desp = Object.getOwnPropertyDescriptor(m, "exports");
  21. if (desp && desp.configurable) Object.defineProperty(m, "exports", {
  22. set: function (val) {
  23. if (typeof val === "object" && val !== m._exports) {
  24. m._exports.__proto__ = val.__proto__;
  25. Object.keys(val).forEach(function (k) {
  26. m._exports[k] = val[k];
  27. });
  28. }
  29. m._tempexports = val;
  30. },
  31. get: function () {
  32. return m._tempexports;
  33. }
  34. });
  35. __MODS__[modId].status = 1;
  36. __MODS__[modId].func(__MODS__[modId].req, m, m.exports);
  37. }
  38. return __MODS__[modId].m.exports;
  39. };
  40. var __REQUIRE_WILDCARD__ = function (obj) {
  41. if (obj && obj.__esModule) {
  42. return obj;
  43. } else {
  44. var newObj = {};
  45. if (obj != null) {
  46. for (var k in obj) {
  47. if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k];
  48. }
  49. }
  50. newObj.default = obj;
  51. return newObj;
  52. }
  53. };
  54. var __REQUIRE_DEFAULT__ = function (obj) {
  55. return obj && obj.__esModule ? obj.default : obj;
  56. };
  57. __DEFINE__(1611536305607, function (require, module, exports) {
  58. !function (e, t) {
  59. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = e || self).TIM = t();
  60. }(this, function () {
  61. var e = {
  62. SDK_READY: "sdkStateReady",
  63. SDK_NOT_READY: "sdkStateNotReady",
  64. SDK_DESTROY: "sdkDestroy",
  65. MESSAGE_RECEIVED: "onMessageReceived",
  66. MESSAGE_REVOKED: "onMessageRevoked",
  67. MESSAGE_READ_BY_PEER: "onMessageReadByPeer",
  68. CONVERSATION_LIST_UPDATED: "onConversationListUpdated",
  69. GROUP_LIST_UPDATED: "onGroupListUpdated",
  70. GROUP_SYSTEM_NOTICE_RECEIVED: "receiveGroupSystemNotice",
  71. PROFILE_UPDATED: "onProfileUpdated",
  72. BLACKLIST_UPDATED: "blacklistUpdated",
  73. KICKED_OUT: "kickedOut",
  74. ERROR: "error",
  75. NET_STATE_CHANGE: "netStateChange",
  76. SDK_RELOAD: "sdkReload"
  77. },
  78. t = {
  79. MSG_TEXT: "TIMTextElem",
  80. MSG_IMAGE: "TIMImageElem",
  81. MSG_SOUND: "TIMSoundElem",
  82. MSG_AUDIO: "TIMSoundElem",
  83. MSG_FILE: "TIMFileElem",
  84. MSG_FACE: "TIMFaceElem",
  85. MSG_VIDEO: "TIMVideoFileElem",
  86. MSG_GEO: "TIMLocationElem",
  87. MSG_GRP_TIP: "TIMGroupTipElem",
  88. MSG_GRP_SYS_NOTICE: "TIMGroupSystemNoticeElem",
  89. MSG_CUSTOM: "TIMCustomElem",
  90. MSG_PRIORITY_HIGH: "High",
  91. MSG_PRIORITY_NORMAL: "Normal",
  92. MSG_PRIORITY_LOW: "Low",
  93. MSG_PRIORITY_LOWEST: "Lowest",
  94. CONV_C2C: "C2C",
  95. CONV_GROUP: "GROUP",
  96. CONV_SYSTEM: "@TIM#SYSTEM",
  97. CONV_AT_ME: 1,
  98. CONV_AT_ALL: 2,
  99. CONV_AT_ALL_AT_ME: 3,
  100. GRP_PRIVATE: "Private",
  101. GRP_WORK: "Private",
  102. GRP_PUBLIC: "Public",
  103. GRP_CHATROOM: "ChatRoom",
  104. GRP_MEETING: "ChatRoom",
  105. GRP_AVCHATROOM: "AVChatRoom",
  106. GRP_MBR_ROLE_OWNER: "Owner",
  107. GRP_MBR_ROLE_ADMIN: "Admin",
  108. GRP_MBR_ROLE_MEMBER: "Member",
  109. GRP_TIP_MBR_JOIN: 1,
  110. GRP_TIP_MBR_QUIT: 2,
  111. GRP_TIP_MBR_KICKED_OUT: 3,
  112. GRP_TIP_MBR_SET_ADMIN: 4,
  113. GRP_TIP_MBR_CANCELED_ADMIN: 5,
  114. GRP_TIP_GRP_PROFILE_UPDATED: 6,
  115. GRP_TIP_MBR_PROFILE_UPDATED: 7,
  116. MSG_REMIND_ACPT_AND_NOTE: "AcceptAndNotify",
  117. MSG_REMIND_ACPT_NOT_NOTE: "AcceptNotNotify",
  118. MSG_REMIND_DISCARD: "Discard",
  119. GENDER_UNKNOWN: "Gender_Type_Unknown",
  120. GENDER_FEMALE: "Gender_Type_Female",
  121. GENDER_MALE: "Gender_Type_Male",
  122. KICKED_OUT_MULT_ACCOUNT: "multipleAccount",
  123. KICKED_OUT_MULT_DEVICE: "multipleDevice",
  124. KICKED_OUT_USERSIG_EXPIRED: "userSigExpired",
  125. ALLOW_TYPE_ALLOW_ANY: "AllowType_Type_AllowAny",
  126. ALLOW_TYPE_NEED_CONFIRM: "AllowType_Type_NeedConfirm",
  127. ALLOW_TYPE_DENY_ANY: "AllowType_Type_DenyAny",
  128. FORBID_TYPE_NONE: "AdminForbid_Type_None",
  129. FORBID_TYPE_SEND_OUT: "AdminForbid_Type_SendOut",
  130. JOIN_OPTIONS_FREE_ACCESS: "FreeAccess",
  131. JOIN_OPTIONS_NEED_PERMISSION: "NeedPermission",
  132. JOIN_OPTIONS_DISABLE_APPLY: "DisableApply",
  133. JOIN_STATUS_SUCCESS: "JoinedSuccess",
  134. JOIN_STATUS_ALREADY_IN_GROUP: "AlreadyInGroup",
  135. JOIN_STATUS_WAIT_APPROVAL: "WaitAdminApproval",
  136. GRP_PROFILE_OWNER_ID: "ownerID",
  137. GRP_PROFILE_CREATE_TIME: "createTime",
  138. GRP_PROFILE_LAST_INFO_TIME: "lastInfoTime",
  139. GRP_PROFILE_MEMBER_NUM: "memberNum",
  140. GRP_PROFILE_MAX_MEMBER_NUM: "maxMemberNum",
  141. GRP_PROFILE_JOIN_OPTION: "joinOption",
  142. GRP_PROFILE_INTRODUCTION: "introduction",
  143. GRP_PROFILE_NOTIFICATION: "notification",
  144. GRP_PROFILE_MUTE_ALL_MBRS: "muteAllMembers",
  145. NET_STATE_CONNECTED: "connected",
  146. NET_STATE_CONNECTING: "connecting",
  147. NET_STATE_DISCONNECTED: "disconnected",
  148. MSG_AT_ALL: "__kImSDK_MesssageAtALL__"
  149. };
  150. function n(e) {
  151. return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
  152. return typeof e;
  153. } : function (e) {
  154. return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  155. })(e);
  156. }
  157. function o(e, t) {
  158. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
  159. }
  160. function r(e, t) {
  161. for (var n = 0; n < t.length; n++) {
  162. var o = t[n];
  163. o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
  164. }
  165. }
  166. function i(e, t, n) {
  167. return t && r(e.prototype, t), n && r(e, n), e;
  168. }
  169. function s(e, t, n) {
  170. return t in e ? Object.defineProperty(e, t, {
  171. value: n,
  172. enumerable: !0,
  173. configurable: !0,
  174. writable: !0
  175. }) : e[t] = n, e;
  176. }
  177. function a(e, t) {
  178. var n = Object.keys(e);
  179. if (Object.getOwnPropertySymbols) {
  180. var o = Object.getOwnPropertySymbols(e);
  181. t && (o = o.filter(function (t) {
  182. return Object.getOwnPropertyDescriptor(e, t).enumerable;
  183. })), n.push.apply(n, o);
  184. }
  185. return n;
  186. }
  187. function u(e) {
  188. for (var t = 1; t < arguments.length; t++) {
  189. var n = null != arguments[t] ? arguments[t] : {};
  190. t % 2 ? a(Object(n), !0).forEach(function (t) {
  191. s(e, t, n[t]);
  192. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : a(Object(n)).forEach(function (t) {
  193. Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
  194. });
  195. }
  196. return e;
  197. }
  198. function c(e, t) {
  199. if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
  200. e.prototype = Object.create(t && t.prototype, {
  201. constructor: {
  202. value: e,
  203. writable: !0,
  204. configurable: !0
  205. }
  206. }), t && p(e, t);
  207. }
  208. function l(e) {
  209. return (l = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
  210. return e.__proto__ || Object.getPrototypeOf(e);
  211. })(e);
  212. }
  213. function p(e, t) {
  214. return (p = Object.setPrototypeOf || function (e, t) {
  215. return e.__proto__ = t, e;
  216. })(e, t);
  217. }
  218. function g() {
  219. if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  220. if (Reflect.construct.sham) return !1;
  221. if ("function" == typeof Proxy) return !0;
  222. try {
  223. return Date.prototype.toString.call(Reflect.construct(Date, [], function () {})), !0;
  224. } catch (e) {
  225. return !1;
  226. }
  227. }
  228. function h(e, t, n) {
  229. return (h = g() ? Reflect.construct : function (e, t, n) {
  230. var o = [null];
  231. o.push.apply(o, t);
  232. var r = new (Function.bind.apply(e, o))();
  233. return n && p(r, n.prototype), r;
  234. }).apply(null, arguments);
  235. }
  236. function d(e) {
  237. var t = "function" == typeof Map ? new Map() : void 0;
  238. return (d = function (e) {
  239. if (null === e || (n = e, -1 === Function.toString.call(n).indexOf("[native code]"))) return e;
  240. var n;
  241. if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
  242. if (void 0 !== t) {
  243. if (t.has(e)) return t.get(e);
  244. t.set(e, o);
  245. }
  246. function o() {
  247. return h(e, arguments, l(this).constructor);
  248. }
  249. return o.prototype = Object.create(e.prototype, {
  250. constructor: {
  251. value: o,
  252. enumerable: !1,
  253. writable: !0,
  254. configurable: !0
  255. }
  256. }), p(o, e);
  257. })(e);
  258. }
  259. function m(e, t) {
  260. if (null == e) return {};
  261. var n,
  262. o,
  263. r = function (e, t) {
  264. if (null == e) return {};
  265. var n,
  266. o,
  267. r = {},
  268. i = Object.keys(e);
  269. for (o = 0; o < i.length; o++) n = i[o], t.indexOf(n) >= 0 || (r[n] = e[n]);
  270. return r;
  271. }(e, t);
  272. if (Object.getOwnPropertySymbols) {
  273. var i = Object.getOwnPropertySymbols(e);
  274. for (o = 0; o < i.length; o++) n = i[o], t.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
  275. }
  276. return r;
  277. }
  278. function f(e) {
  279. if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  280. return e;
  281. }
  282. function _(e, t) {
  283. return !t || "object" != typeof t && "function" != typeof t ? f(e) : t;
  284. }
  285. function v(e) {
  286. var t = g();
  287. return function () {
  288. var n,
  289. o = l(e);
  290. if (t) {
  291. var r = l(this).constructor;
  292. n = Reflect.construct(o, arguments, r);
  293. } else n = o.apply(this, arguments);
  294. return _(this, n);
  295. };
  296. }
  297. function y(e, t) {
  298. return M(e) || function (e, t) {
  299. if ("undefined" == typeof Symbol || !(Symbol.iterator in Object(e))) return;
  300. var n = [],
  301. o = !0,
  302. r = !1,
  303. i = void 0;
  304. try {
  305. for (var s, a = e[Symbol.iterator](); !(o = (s = a.next()).done) && (n.push(s.value), !t || n.length !== t); o = !0);
  306. } catch (u) {
  307. r = !0, i = u;
  308. } finally {
  309. try {
  310. o || null == a.return || a.return();
  311. } finally {
  312. if (r) throw i;
  313. }
  314. }
  315. return n;
  316. }(e, t) || E(e, t) || D();
  317. }
  318. function I(e) {
  319. return function (e) {
  320. if (Array.isArray(e)) return T(e);
  321. }(e) || C(e) || E(e) || function () {
  322. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  323. }();
  324. }
  325. function M(e) {
  326. if (Array.isArray(e)) return e;
  327. }
  328. function C(e) {
  329. if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e);
  330. }
  331. function E(e, t) {
  332. if (e) {
  333. if ("string" == typeof e) return T(e, t);
  334. var n = Object.prototype.toString.call(e).slice(8, -1);
  335. return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? T(e, t) : void 0;
  336. }
  337. }
  338. function T(e, t) {
  339. (null == t || t > e.length) && (t = e.length);
  340. for (var n = 0, o = new Array(t); n < t; n++) o[n] = e[n];
  341. return o;
  342. }
  343. function D() {
  344. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  345. }
  346. function S(e, t) {
  347. var n;
  348. if ("undefined" == typeof Symbol || null == e[Symbol.iterator]) {
  349. if (Array.isArray(e) || (n = E(e)) || t && e && "number" == typeof e.length) {
  350. n && (e = n);
  351. var o = 0,
  352. r = function () {};
  353. return {
  354. s: r,
  355. n: function () {
  356. return o >= e.length ? {
  357. done: !0
  358. } : {
  359. done: !1,
  360. value: e[o++]
  361. };
  362. },
  363. e: function (e) {
  364. throw e;
  365. },
  366. f: r
  367. };
  368. }
  369. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  370. }
  371. var i,
  372. s = !0,
  373. a = !1;
  374. return {
  375. s: function () {
  376. n = e[Symbol.iterator]();
  377. },
  378. n: function () {
  379. var e = n.next();
  380. return s = e.done, e;
  381. },
  382. e: function (e) {
  383. a = !0, i = e;
  384. },
  385. f: function () {
  386. try {
  387. s || null == n.return || n.return();
  388. } finally {
  389. if (a) throw i;
  390. }
  391. }
  392. };
  393. }
  394. var k = function () {
  395. function e() {
  396. o(this, e), this.cache = [], this.options = null;
  397. }
  398. return i(e, [{
  399. key: "use",
  400. value: function (e) {
  401. if ("function" != typeof e) throw "middleware must be a function";
  402. return this.cache.push(e), this;
  403. }
  404. }, {
  405. key: "next",
  406. value: function (e) {
  407. if (this.middlewares && this.middlewares.length > 0) return this.middlewares.shift().call(this, this.options, this.next.bind(this));
  408. }
  409. }, {
  410. key: "run",
  411. value: function (e) {
  412. return this.middlewares = this.cache.map(function (e) {
  413. return e;
  414. }), this.options = e, this.next();
  415. }
  416. }]), e;
  417. }(),
  418. A = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
  419. function O(e, t) {
  420. return e(t = {
  421. exports: {}
  422. }, t.exports), t.exports;
  423. }
  424. var R,
  425. N,
  426. L,
  427. w,
  428. P = O(function (e, t) {
  429. var n, o, r, i, s, a, u, c, l, p, g, h, d, m, f, _, v, y;
  430. e.exports = (n = "function" == typeof Promise, o = "object" == typeof self ? self : A, r = "undefined" != typeof Symbol, i = "undefined" != typeof Map, s = "undefined" != typeof Set, a = "undefined" != typeof WeakMap, u = "undefined" != typeof WeakSet, c = "undefined" != typeof DataView, l = r && void 0 !== Symbol.iterator, p = r && void 0 !== Symbol.toStringTag, g = s && "function" == typeof Set.prototype.entries, h = i && "function" == typeof Map.prototype.entries, d = g && Object.getPrototypeOf(new Set().entries()), m = h && Object.getPrototypeOf(new Map().entries()), f = l && "function" == typeof Array.prototype[Symbol.iterator], _ = f && Object.getPrototypeOf([][Symbol.iterator]()), v = l && "function" == typeof String.prototype[Symbol.iterator], y = v && Object.getPrototypeOf(""[Symbol.iterator]()), function (e) {
  431. var t = typeof e;
  432. if ("object" !== t) return t;
  433. if (null === e) return "null";
  434. if (e === o) return "global";
  435. if (Array.isArray(e) && (!1 === p || !(Symbol.toStringTag in e))) return "Array";
  436. if ("object" == typeof window && null !== window) {
  437. if ("object" == typeof window.location && e === window.location) return "Location";
  438. if ("object" == typeof window.document && e === window.document) return "Document";
  439. if ("object" == typeof window.navigator) {
  440. if ("object" == typeof window.navigator.mimeTypes && e === window.navigator.mimeTypes) return "MimeTypeArray";
  441. if ("object" == typeof window.navigator.plugins && e === window.navigator.plugins) return "PluginArray";
  442. }
  443. if (("function" == typeof window.HTMLElement || "object" == typeof window.HTMLElement) && e instanceof window.HTMLElement) {
  444. if ("BLOCKQUOTE" === e.tagName) return "HTMLQuoteElement";
  445. if ("TD" === e.tagName) return "HTMLTableDataCellElement";
  446. if ("TH" === e.tagName) return "HTMLTableHeaderCellElement";
  447. }
  448. }
  449. var r = p && e[Symbol.toStringTag];
  450. if ("string" == typeof r) return r;
  451. var l = Object.getPrototypeOf(e);
  452. return l === RegExp.prototype ? "RegExp" : l === Date.prototype ? "Date" : n && l === Promise.prototype ? "Promise" : s && l === Set.prototype ? "Set" : i && l === Map.prototype ? "Map" : u && l === WeakSet.prototype ? "WeakSet" : a && l === WeakMap.prototype ? "WeakMap" : c && l === DataView.prototype ? "DataView" : i && l === m ? "Map Iterator" : s && l === d ? "Set Iterator" : f && l === _ ? "Array Iterator" : v && l === y ? "String Iterator" : null === l ? "Object" : Object.prototype.toString.call(e).slice(8, -1);
  453. });
  454. }),
  455. G = "undefined" != typeof window,
  456. b = "undefined" != typeof uni && "function" == typeof uni.getSystemInfoSync,
  457. U = "undefined" != typeof qq && "function" == typeof qq.getSystemInfoSync,
  458. q = "undefined" != typeof tt && "function" == typeof tt.getSystemInfoSync,
  459. F = "undefined" != typeof swan && "function" == typeof swan.getSystemInfoSync,
  460. x = "undefined" != typeof my && "function" == typeof my.getSystemInfoSync,
  461. V = b || U || q || F || x,
  462. K = U ? qq : q ? tt : F ? swan : x ? my : b ? uni : {},
  463. H = (R = "web", oe ? R = "wechat" : U ? R = "qqmp" : q ? R = "ttmp" : F ? R = "baidump" : x ? R = "alipaymp" : b && (R = "wxmp"), R),
  464. B = G && window.navigator && window.navigator.userAgent || "",
  465. j = /AppleWebKit\/([\d.]+)/i.exec(B),
  466. $ = (j && parseFloat(j.pop()), /iPad/i.test(B)),
  467. Y = /iPhone/i.test(B) && !$,
  468. z = /iPod/i.test(B),
  469. W = Y || $ || z,
  470. J = ((N = B.match(/OS (\d+)_/i)) && N[1] && N[1], /Android/i.test(B)),
  471. X = function () {
  472. var e = B.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  473. if (!e) return null;
  474. var t = e[1] && parseFloat(e[1]),
  475. n = e[2] && parseFloat(e[2]);
  476. return t && n ? parseFloat(e[1] + "." + e[2]) : t || null;
  477. }(),
  478. Q = (J && /webkit/i.test(B), /Firefox/i.test(B), /Edge/i.test(B)),
  479. Z = !Q && /Chrome/i.test(B),
  480. ee = (function () {
  481. var e = B.match(/Chrome\/(\d+)/);
  482. e && e[1] && parseFloat(e[1]);
  483. }(), /MSIE/.test(B)),
  484. te = (/MSIE\s8\.0/.test(B), function () {
  485. var e = /MSIE\s(\d+)\.\d/.exec(B),
  486. t = e && parseFloat(e[1]);
  487. return !t && /Trident\/7.0/i.test(B) && /rv:11.0/.test(B) && (t = 11), t;
  488. }()),
  489. ne = (/Safari/i.test(B), /TBS\/\d+/i.test(B)),
  490. oe = (function () {
  491. var e = B.match(/TBS\/(\d+)/i);
  492. if (e && e[1]) e[1];
  493. }(), !ne && /MQQBrowser\/\d+/i.test(B), !ne && / QQBrowser\/\d+/i.test(B), /(micromessenger|webbrowser)/i.test(B)),
  494. re = /Windows/i.test(B),
  495. ie = /MAC OS X/i.test(B),
  496. se = (/MicroMessenger/i.test(B), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
  497. L = "undefined" != typeof console ? console : void 0 !== se && se.console ? se.console : "undefined" != typeof window && window.console ? window.console : {};
  498. for (var ae = function () {}, ue = ["assert", "clear", "count", "debug", "dir", "dirxml", "error", "exception", "group", "groupCollapsed", "groupEnd", "info", "log", "markTimeline", "profile", "profileEnd", "table", "time", "timeEnd", "timeStamp", "trace", "warn"], ce = ue.length; ce--;) w = ue[ce], console[w] || (L[w] = ae);
  499. L.methods = ue;
  500. var le = L,
  501. pe = 0,
  502. ge = new Map();
  503. function he() {
  504. var e = new Date();
  505. return "TIM " + e.toLocaleTimeString("en-US", {
  506. hour12: !1
  507. }) + "." + function (e) {
  508. var t;
  509. switch (e.toString().length) {
  510. case 1:
  511. t = "00" + e;
  512. break;
  513. case 2:
  514. t = "0" + e;
  515. break;
  516. default:
  517. t = e;
  518. }
  519. return t;
  520. }(e.getMilliseconds()) + ":";
  521. }
  522. var de = {
  523. arguments2String: function (e) {
  524. var t;
  525. if (1 === e.length) t = he() + e[0];else {
  526. t = he();
  527. for (var n = 0, o = e.length; n < o; n++) Ce(e[n]) ? Te(e[n]) ? t += Re(e[n]) : t += JSON.stringify(e[n]) : t += e[n], t += " ";
  528. }
  529. return t;
  530. },
  531. debug: function () {
  532. if (pe <= -1) {
  533. var e = this.arguments2String(arguments);
  534. le.debug(e);
  535. }
  536. },
  537. log: function () {
  538. if (pe <= 0) {
  539. var e = this.arguments2String(arguments);
  540. le.log(e);
  541. }
  542. },
  543. info: function () {
  544. if (pe <= 1) {
  545. var e = this.arguments2String(arguments);
  546. le.info(e);
  547. }
  548. },
  549. warn: function () {
  550. if (pe <= 2) {
  551. var e = this.arguments2String(arguments);
  552. le.warn(e);
  553. }
  554. },
  555. error: function () {
  556. if (pe <= 3) {
  557. var e = this.arguments2String(arguments);
  558. le.error(e);
  559. }
  560. },
  561. time: function (e) {
  562. ge.set(e, Ae.now());
  563. },
  564. timeEnd: function (e) {
  565. if (ge.has(e)) {
  566. var t = Ae.now() - ge.get(e);
  567. return ge.delete(e), t;
  568. }
  569. return le.warn("未找到对应label: ".concat(e, ", 请在调用 logger.timeEnd 前,调用 logger.time")), 0;
  570. },
  571. setLevel: function (e) {
  572. e < 4 && le.log(he() + "set level from " + pe + " to " + e), pe = e;
  573. }
  574. },
  575. me = function (e) {
  576. return "file" === De(e);
  577. },
  578. fe = function (e) {
  579. return null !== e && ("number" == typeof e && !isNaN(e - 0) || "object" === n(e) && e.constructor === Number);
  580. },
  581. _e = function (e) {
  582. return "string" == typeof e;
  583. },
  584. ve = function (e) {
  585. return null !== e && "object" === n(e);
  586. },
  587. ye = function (e) {
  588. if ("object" !== n(e) || null === e) return !1;
  589. var t = Object.getPrototypeOf(e);
  590. if (null === t) return !0;
  591. for (var o = t; null !== Object.getPrototypeOf(o);) o = Object.getPrototypeOf(o);
  592. return t === o;
  593. },
  594. Ie = function (e) {
  595. return "function" == typeof Array.isArray ? Array.isArray(e) : "array" === De(e);
  596. },
  597. Me = function (e) {
  598. return void 0 === e;
  599. },
  600. Ce = function (e) {
  601. return Ie(e) || ve(e);
  602. },
  603. Ee = function (e) {
  604. return "function" == typeof e;
  605. },
  606. Te = function (e) {
  607. return e instanceof Error;
  608. },
  609. De = function (e) {
  610. return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase();
  611. },
  612. Se = function (e) {
  613. if ("string" != typeof e) return !1;
  614. var t = e[0];
  615. return !/[^a-zA-Z0-9]/.test(t);
  616. },
  617. ke = 0;
  618. Date.now || (Date.now = function () {
  619. return new Date().getTime();
  620. });
  621. var Ae = {
  622. now: function () {
  623. 0 === ke && (ke = Date.now() - 1);
  624. var e = Date.now() - ke;
  625. return e > 4294967295 ? (ke += 4294967295, Date.now() - ke) : e;
  626. },
  627. utc: function () {
  628. return Math.round(Date.now() / 1e3);
  629. }
  630. },
  631. Oe = function e(t, n, o, r) {
  632. if (!Ce(t) || !Ce(n)) return 0;
  633. for (var i, s = 0, a = Object.keys(n), u = 0, c = a.length; u < c; u++) if (i = a[u], !(Me(n[i]) || o && o.includes(i))) if (Ce(t[i]) && Ce(n[i])) s += e(t[i], n[i], o, r);else {
  634. if (r && r.includes(n[i])) continue;
  635. t[i] !== n[i] && (t[i] = n[i], s += 1);
  636. }
  637. return s;
  638. },
  639. Re = function (e) {
  640. return JSON.stringify(e, ["message", "code"]);
  641. },
  642. Ne = function () {
  643. var e = new Date(),
  644. t = e.toISOString(),
  645. n = e.getTimezoneOffset() / 60,
  646. o = "";
  647. return o = n < 0 ? n > -10 ? "+0" + Math.abs(100 * n) : "+" + Math.abs(100 * n) : n >= 10 ? "-" + 100 * n : "-0" + 100 * n, t.replace("Z", o);
  648. },
  649. Le = function (e) {
  650. if (0 === e.length) return 0;
  651. for (var t = 0, n = 0, o = "undefined" != typeof document && void 0 !== document.characterSet ? document.characterSet : "UTF-8"; void 0 !== e[t];) n += e[t++].charCodeAt[t] <= 255 ? 1 : !1 === o ? 3 : 2;
  652. return n;
  653. },
  654. we = function (e) {
  655. var t = e || 99999999;
  656. return Math.round(Math.random() * t);
  657. },
  658. Pe = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
  659. Ge = Pe.length,
  660. be = function (e, t) {
  661. for (var n in e) if (e[n] === t) return !0;
  662. return !1;
  663. },
  664. Ue = {},
  665. qe = function () {
  666. if (V) return "https:";
  667. var e = window.location.protocol;
  668. return ["http:", "https:"].indexOf(e) < 0 && (e = "http:"), e;
  669. },
  670. Fe = function (e) {
  671. return -1 === e.indexOf("http://") || -1 === e.indexOf("https://") ? "https://" + e : e.replace(/https|http/, "https");
  672. };
  673. function xe(e, t) {
  674. Ie(e) && Ie(t) ? t.forEach(function (t) {
  675. var n = t.key,
  676. o = t.value,
  677. r = e.find(function (e) {
  678. return e.key === n;
  679. });
  680. r ? r.value = o : e.push({
  681. key: n,
  682. value: o
  683. });
  684. }) : de.warn("updateCustomField target 或 source 不是数组,忽略此次更新。");
  685. }
  686. var Ve = function (e) {
  687. return e === t.GRP_WORK;
  688. },
  689. Ke = function (e) {
  690. return e === t.GRP_PUBLIC;
  691. },
  692. He = function (e) {
  693. return e === t.GRP_MEETING;
  694. },
  695. Be = function (e) {
  696. return e === t.GRP_AVCHATROOM;
  697. },
  698. je = function (e) {
  699. return _e(e) && e === t.CONV_SYSTEM;
  700. };
  701. function $e(e, t) {
  702. var n = {};
  703. return Object.keys(e).forEach(function (o) {
  704. n[o] = t(e[o], o);
  705. }), n;
  706. }
  707. function Ye() {
  708. function e() {
  709. return (65536 * (1 + Math.random()) | 0).toString(16).substring(1);
  710. }
  711. return "".concat(e() + e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e());
  712. }
  713. function ze(e) {
  714. var t = e.originUrl,
  715. n = void 0 === t ? void 0 : t,
  716. o = e.originWidth,
  717. r = e.originHeight,
  718. i = e.min,
  719. s = void 0 === i ? 198 : i,
  720. a = parseInt(o),
  721. u = parseInt(r),
  722. c = {
  723. url: void 0,
  724. width: 0,
  725. height: 0
  726. };
  727. return (a <= u ? a : u) <= s ? (c.url = n, c.width = a, c.height = u) : (u <= a ? (c.width = Math.ceil(a * s / u), c.height = s) : (c.width = s, c.height = Math.ceil(u * s / a)), c.url = "".concat(n, 198 === s ? "?imageView2/3/w/198/h/198" : "?imageView2/3/w/720/h/720")), Me(n) ? m(c, ["url"]) : c;
  728. }
  729. function We(e) {
  730. var t = e[2];
  731. e[2] = e[1], e[1] = t;
  732. for (var n = 0; n < e.length; n++) e[n].setSizeType(n + 1), e[n].setType(n);
  733. }
  734. var Je = Object.prototype.hasOwnProperty;
  735. function Xe(e) {
  736. if (null == e) return !0;
  737. if ("boolean" == typeof e) return !1;
  738. if ("number" == typeof e) return 0 === e;
  739. if ("string" == typeof e) return 0 === e.length;
  740. if ("function" == typeof e) return 0 === e.length;
  741. if (Array.isArray(e)) return 0 === e.length;
  742. if (e instanceof Error) return "" === e.message;
  743. if (ye(e)) {
  744. for (var t in e) if (Je.call(e, t)) return !1;
  745. return !0;
  746. }
  747. return !("map" !== De(e) && !function (e) {
  748. return "set" === De(e);
  749. }(e) && !me(e)) && 0 === e.size;
  750. }
  751. function Qe(e, t, n) {
  752. if (void 0 === t) return !0;
  753. var o = !0;
  754. if ("object" === P(t).toLowerCase()) Object.keys(t).forEach(function (r) {
  755. var i = 1 === e.length ? e[0][r] : void 0;
  756. o = !!Ze(i, t[r], n, r) && o;
  757. });else if ("array" === P(t).toLowerCase()) for (var r = 0; r < t.length; r++) o = !!Ze(e[r], t[r], n, t[r].name) && o;
  758. if (o) return o;
  759. throw new Error("Params validate failed.");
  760. }
  761. function Ze(e, t, n, o) {
  762. if (void 0 === t) return !0;
  763. var r = !0;
  764. return t.required && Xe(e) && (le.error("TIM [".concat(n, '] Missing required params: "').concat(o, '".')), r = !1), Xe(e) || P(e).toLowerCase() === t.type.toLowerCase() || (le.error("TIM [".concat(n, '] Invalid params: type check failed for "').concat(o, '".Expected ').concat(t.type, ".")), r = !1), t.validator && !t.validator(e) && (le.error("TIM [".concat(n, "] Invalid params: custom validator check failed for params.")), r = !1), r;
  765. }
  766. var et = {
  767. SUCCESS: "JoinedSuccess",
  768. WAIT_APPROVAL: "WaitAdminApproval"
  769. },
  770. nt = {
  771. SUCCESS: 0
  772. },
  773. ot = {
  774. IS_LOGIN: 1,
  775. IS_NOT_LOGIN: 0
  776. },
  777. rt = {
  778. UNSEND: "unSend",
  779. SUCCESS: "success",
  780. FAIL: "fail"
  781. },
  782. it = {
  783. NOT_START: "notStart",
  784. PENDING: "pengding",
  785. RESOLVED: "resolved",
  786. REJECTED: "rejected"
  787. },
  788. st = function () {
  789. function e(n) {
  790. o(this, e), this.type = t.MSG_TEXT, this.content = {
  791. text: n.text || ""
  792. };
  793. }
  794. return i(e, [{
  795. key: "setText",
  796. value: function (e) {
  797. this.content.text = e;
  798. }
  799. }, {
  800. key: "sendable",
  801. value: function () {
  802. return 0 !== this.content.text.length;
  803. }
  804. }]), e;
  805. }(),
  806. at = {
  807. JSON: {
  808. TYPE: {
  809. C2C: {
  810. NOTICE: 1,
  811. COMMON: 9,
  812. EVENT: 10
  813. },
  814. GROUP: {
  815. COMMON: 3,
  816. TIP: 4,
  817. SYSTEM: 5,
  818. TIP2: 6
  819. },
  820. FRIEND: {
  821. NOTICE: 7
  822. },
  823. PROFILE: {
  824. NOTICE: 8
  825. }
  826. },
  827. SUBTYPE: {
  828. C2C: {
  829. COMMON: 0,
  830. READED: 92,
  831. KICKEDOUT: 96
  832. },
  833. GROUP: {
  834. COMMON: 0,
  835. LOVEMESSAGE: 1,
  836. TIP: 2,
  837. REDPACKET: 3
  838. }
  839. },
  840. OPTIONS: {
  841. GROUP: {
  842. JOIN: 1,
  843. QUIT: 2,
  844. KICK: 3,
  845. SET_ADMIN: 4,
  846. CANCEL_ADMIN: 5,
  847. MODIFY_GROUP_INFO: 6,
  848. MODIFY_MEMBER_INFO: 7
  849. }
  850. }
  851. },
  852. PROTOBUF: {},
  853. IMAGE_TYPES: {
  854. ORIGIN: 1,
  855. LARGE: 2,
  856. SMALL: 3
  857. },
  858. IMAGE_FORMAT: {
  859. JPG: 1,
  860. JPEG: 1,
  861. GIF: 2,
  862. PNG: 3,
  863. BMP: 4,
  864. UNKNOWN: 255
  865. }
  866. },
  867. ut = 1,
  868. ct = 2,
  869. lt = 3,
  870. pt = 4,
  871. gt = 5,
  872. ht = 7,
  873. dt = 8,
  874. mt = 9,
  875. ft = 10,
  876. _t = 15,
  877. vt = 255,
  878. yt = 2,
  879. It = 0,
  880. Mt = 1,
  881. Ct = {
  882. NICK: "Tag_Profile_IM_Nick",
  883. GENDER: "Tag_Profile_IM_Gender",
  884. BIRTHDAY: "Tag_Profile_IM_BirthDay",
  885. LOCATION: "Tag_Profile_IM_Location",
  886. SELFSIGNATURE: "Tag_Profile_IM_SelfSignature",
  887. ALLOWTYPE: "Tag_Profile_IM_AllowType",
  888. LANGUAGE: "Tag_Profile_IM_Language",
  889. AVATAR: "Tag_Profile_IM_Image",
  890. MESSAGESETTINGS: "Tag_Profile_IM_MsgSettings",
  891. ADMINFORBIDTYPE: "Tag_Profile_IM_AdminForbidType",
  892. LEVEL: "Tag_Profile_IM_Level",
  893. ROLE: "Tag_Profile_IM_Role"
  894. },
  895. Et = {
  896. UNKNOWN: "Gender_Type_Unknown",
  897. FEMALE: "Gender_Type_Female",
  898. MALE: "Gender_Type_Male"
  899. },
  900. Tt = {
  901. NONE: "AdminForbid_Type_None",
  902. SEND_OUT: "AdminForbid_Type_SendOut"
  903. },
  904. Dt = {
  905. NEED_CONFIRM: "AllowType_Type_NeedConfirm",
  906. ALLOW_ANY: "AllowType_Type_AllowAny",
  907. DENY_ANY: "AllowType_Type_DenyAny"
  908. },
  909. St = function () {
  910. function e(n) {
  911. o(this, e), this._imageMemoryURL = "", this._file = n.file, V ? this.createImageDataASURLInWXMiniApp(n.file) : this.createImageDataASURLInWeb(n.file), this._initImageInfoModel(), this.type = t.MSG_IMAGE, this._percent = 0, this.content = {
  912. imageFormat: n.imageFormat || at.IMAGE_FORMAT.UNKNOWN,
  913. uuid: n.uuid,
  914. imageInfoArray: []
  915. }, this.initImageInfoArray(n.imageInfoArray), this._defaultImage = "http://imgcache.qq.com/open/qcloud/video/act/webim-images/default.jpg", this._autoFixUrl();
  916. }
  917. return i(e, [{
  918. key: "_initImageInfoModel",
  919. value: function () {
  920. var e = this;
  921. this._ImageInfoModel = function (t) {
  922. this.instanceID = we(9999999), this.sizeType = t.type || 0, this.type = 0, this.size = t.size || 0, this.width = t.width || 0, this.height = t.height || 0, this.imageUrl = t.url || "", this.url = t.url || e._imageMemoryURL || e._defaultImage;
  923. }, this._ImageInfoModel.prototype = {
  924. setSizeType: function (e) {
  925. this.sizeType = e;
  926. },
  927. setType: function (e) {
  928. this.type = e;
  929. },
  930. setImageUrl: function (e) {
  931. e && (this.imageUrl = e);
  932. },
  933. getImageUrl: function () {
  934. return this.imageUrl;
  935. }
  936. };
  937. }
  938. }, {
  939. key: "initImageInfoArray",
  940. value: function (e) {
  941. for (var t = 0, n = null, o = null; t <= 2;) o = Me(e) || Me(e[t]) ? {
  942. type: 0,
  943. size: 0,
  944. width: 0,
  945. height: 0,
  946. url: ""
  947. } : e[t], (n = new this._ImageInfoModel(o)).setSizeType(t + 1), n.setType(t), this.addImageInfo(n), t++;
  948. this.updateAccessSideImageInfoArray();
  949. }
  950. }, {
  951. key: "updateImageInfoArray",
  952. value: function (e) {
  953. for (var t, n = this.content.imageInfoArray.length, o = 0; o < n; o++) t = this.content.imageInfoArray[o], e[o].size && (t.size = e[o].size), e[o].url && t.setImageUrl(e[o].url), e[o].width && (t.width = e[o].width), e[o].height && (t.height = e[o].height);
  954. }
  955. }, {
  956. key: "_autoFixUrl",
  957. value: function () {
  958. for (var e = this.content.imageInfoArray.length, t = "", n = "", o = ["http", "https"], r = null, i = 0; i < e; i++) this.content.imageInfoArray[i].url && "" !== (r = this.content.imageInfoArray[i]).imageUrl && (n = r.imageUrl.slice(0, r.imageUrl.indexOf("://") + 1), t = r.imageUrl.slice(r.imageUrl.indexOf("://") + 1), o.indexOf(n) < 0 && (n = "https:"), this.content.imageInfoArray[i].setImageUrl([n, t].join("")));
  959. }
  960. }, {
  961. key: "updatePercent",
  962. value: function (e) {
  963. this._percent = e, this._percent > 1 && (this._percent = 1);
  964. }
  965. }, {
  966. key: "updateImageFormat",
  967. value: function (e) {
  968. this.content.imageFormat = at.IMAGE_FORMAT[e.toUpperCase()] || at.IMAGE_FORMAT.UNKNOWN;
  969. }
  970. }, {
  971. key: "createImageDataASURLInWeb",
  972. value: function (e) {
  973. void 0 !== e && e.files.length > 0 && (this._imageMemoryURL = window.URL.createObjectURL(e.files[0]));
  974. }
  975. }, {
  976. key: "createImageDataASURLInWXMiniApp",
  977. value: function (e) {
  978. e && e.url && (this._imageMemoryURL = e.url);
  979. }
  980. }, {
  981. key: "replaceImageInfo",
  982. value: function (e, t) {
  983. this.content.imageInfoArray[t] instanceof this._ImageInfoModel || (this.content.imageInfoArray[t] = e);
  984. }
  985. }, {
  986. key: "addImageInfo",
  987. value: function (e) {
  988. this.content.imageInfoArray.length >= 3 || this.content.imageInfoArray.push(e);
  989. }
  990. }, {
  991. key: "updateAccessSideImageInfoArray",
  992. value: function () {
  993. var e = this.content.imageInfoArray,
  994. t = e[0],
  995. n = t.width,
  996. o = void 0 === n ? 0 : n,
  997. r = t.height,
  998. i = void 0 === r ? 0 : r;
  999. 0 !== o && 0 !== i && (We(e), Object.assign(e[2], ze({
  1000. originWidth: o,
  1001. originHeight: i,
  1002. min: 720
  1003. })));
  1004. }
  1005. }, {
  1006. key: "sendable",
  1007. value: function () {
  1008. return 0 !== this.content.imageInfoArray.length && "" !== this.content.imageInfoArray[0].imageUrl && 0 !== this.content.imageInfoArray[0].size;
  1009. }
  1010. }]), e;
  1011. }(),
  1012. kt = function () {
  1013. function e(n) {
  1014. o(this, e), this.type = t.MSG_FACE, this.content = n || null;
  1015. }
  1016. return i(e, [{
  1017. key: "sendable",
  1018. value: function () {
  1019. return null !== this.content;
  1020. }
  1021. }]), e;
  1022. }(),
  1023. At = function () {
  1024. function e(n) {
  1025. o(this, e), this.type = t.MSG_AUDIO, this._percent = 0, this.content = {
  1026. downloadFlag: 2,
  1027. second: n.second,
  1028. size: n.size,
  1029. url: n.url,
  1030. remoteAudioUrl: "",
  1031. uuid: n.uuid
  1032. };
  1033. }
  1034. return i(e, [{
  1035. key: "updatePercent",
  1036. value: function (e) {
  1037. this._percent = e, this._percent > 1 && (this._percent = 1);
  1038. }
  1039. }, {
  1040. key: "updateAudioUrl",
  1041. value: function (e) {
  1042. this.content.remoteAudioUrl = e;
  1043. }
  1044. }, {
  1045. key: "sendable",
  1046. value: function () {
  1047. return "" !== this.content.remoteAudioUrl;
  1048. }
  1049. }]), e;
  1050. }(),
  1051. Ot = {
  1052. from: !0,
  1053. groupID: !0,
  1054. groupName: !0,
  1055. to: !0
  1056. },
  1057. Rt = function () {
  1058. function e(n) {
  1059. o(this, e), this.type = t.MSG_GRP_TIP, this.content = {}, this._initContent(n);
  1060. }
  1061. return i(e, [{
  1062. key: "_initContent",
  1063. value: function (e) {
  1064. var t = this;
  1065. Object.keys(e).forEach(function (n) {
  1066. switch (n) {
  1067. case "remarkInfo":
  1068. break;
  1069. case "groupProfile":
  1070. t.content.groupProfile = {}, t._initGroupProfile(e[n]);
  1071. break;
  1072. case "operatorInfo":
  1073. case "memberInfoList":
  1074. break;
  1075. case "msgMemberInfo":
  1076. t.content.memberList = e[n], Object.defineProperty(t.content, "msgMemberInfo", {
  1077. get: function () {
  1078. return de.warn("!!! 禁言的群提示消息中的 payload.msgMemberInfo 属性即将废弃,请使用 payload.memberList 属性替代。 \n", "msgMemberInfo 中的 shutupTime 属性对应更改为 memberList 中的 muteTime 属性,表示禁言时长。 \n", "参考:群提示消息 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/Message.html#.GroupTipPayload"), t.content.memberList.map(function (e) {
  1079. return {
  1080. userID: e.userID,
  1081. shutupTime: e.muteTime
  1082. };
  1083. });
  1084. }
  1085. });
  1086. break;
  1087. case "onlineMemberInfo":
  1088. break;
  1089. case "memberNum":
  1090. t.content[n] = e[n], t.content.memberCount = e[n];
  1091. break;
  1092. default:
  1093. t.content[n] = e[n];
  1094. }
  1095. }), this.content.userIDList || (this.content.userIDList = [this.content.operatorID]);
  1096. }
  1097. }, {
  1098. key: "_initGroupProfile",
  1099. value: function (e) {
  1100. for (var t = Object.keys(e), n = 0; n < t.length; n++) {
  1101. var o = t[n];
  1102. Ot[o] && (this.content.groupProfile[o] = e[o]);
  1103. }
  1104. }
  1105. }]), e;
  1106. }(),
  1107. Nt = {
  1108. from: !0,
  1109. groupID: !0,
  1110. name: !0,
  1111. to: !0
  1112. },
  1113. Lt = function () {
  1114. function e(n) {
  1115. o(this, e), this.type = t.MSG_GRP_SYS_NOTICE, this.content = {}, this._initContent(n);
  1116. }
  1117. return i(e, [{
  1118. key: "_initContent",
  1119. value: function (e) {
  1120. var t = this;
  1121. Object.keys(e).forEach(function (n) {
  1122. switch (n) {
  1123. case "memberInfoList":
  1124. break;
  1125. case "remarkInfo":
  1126. t.content.handleMessage = e[n];
  1127. break;
  1128. case "groupProfile":
  1129. t.content.groupProfile = {}, t._initGroupProfile(e[n]);
  1130. break;
  1131. default:
  1132. t.content[n] = e[n];
  1133. }
  1134. });
  1135. }
  1136. }, {
  1137. key: "_initGroupProfile",
  1138. value: function (e) {
  1139. for (var t = Object.keys(e), n = 0; n < t.length; n++) {
  1140. var o = t[n];
  1141. Nt[o] && (this.content.groupProfile[o] = e[o]);
  1142. }
  1143. }
  1144. }]), e;
  1145. }(),
  1146. wt = "https://cloud.tencent.com/document/product/",
  1147. Pt = "您可以在即时通信 IM 控制台的【开发辅助工具(https://console.cloud.tencent.com/im-detail/tool-usersig)】页面校验 UserSig。",
  1148. Gt = "UserSig 非法,请使用官网提供的 API 重新生成 UserSig(".concat(wt, "269/32688)。"),
  1149. bt = {
  1150. 70001: "UserSig 已过期,请重新生成。建议 UserSig 有效期设置不小于24小时。",
  1151. 70002: "UserSig 长度为0,请检查传入的 UserSig 是否正确。",
  1152. 70003: Gt,
  1153. 70005: Gt,
  1154. 70009: "UserSig 验证失败,可能因为生成 UserSig 时混用了其他 SDKAppID 的私钥或密钥导致,请使用对应 SDKAppID 下的私钥或密钥重新生成 UserSig(".concat(wt, "269/32688)。"),
  1155. 70013: "请求中的 UserID 与生成 UserSig 时使用的 UserID 不匹配。".concat(Pt),
  1156. 70014: "请求中的 SDKAppID 与生成 UserSig 时使用的 SDKAppID 不匹配。".concat(Pt),
  1157. 70016: "密钥不存在,UserSig 验证失败,请在即时通信 IM 控制台获取密钥(".concat(wt, "269/32578#.E8.8E.B7.E5.8F.96.E5.AF.86.E9.92.A5)。"),
  1158. 70020: "SDKAppID 未找到,请在即时通信 IM 控制台确认应用信息。",
  1159. 70050: "UserSig 验证次数过于频繁。请检查 UserSig 是否正确,并于1分钟后重新验证。".concat(Pt),
  1160. 70051: "帐号被拉入黑名单。",
  1161. 70052: "UserSig 已经失效,请重新生成,再次尝试。",
  1162. 70107: "因安全原因被限制登录,请不要频繁登录。",
  1163. 70169: "请求的用户帐号不存在。",
  1164. 70114: "".concat("服务端内部超时,请稍后重试。"),
  1165. 70202: "".concat("服务端内部超时,请稍后重试。"),
  1166. 70206: "请求中批量数量不合法。",
  1167. 70402: "参数非法,请检查必填字段是否填充,或者字段的填充是否满足协议要求。",
  1168. 70403: "请求失败,需要 App 管理员权限。",
  1169. 70398: "帐号数超限。如需创建多于100个帐号,请将应用升级为专业版,具体操作指引请参见购买指引(".concat(wt, "269/32458)。"),
  1170. 70500: "".concat("服务端内部错误,请重试。"),
  1171. 71e3: "删除帐号失败。仅支持删除体验版帐号,您当前应用为专业版,暂不支持帐号删除。",
  1172. 20001: "请求包非法。",
  1173. 20002: "UserSig 或 A2 失效。",
  1174. 20003: "消息发送方或接收方 UserID 无效或不存在,请检查 UserID 是否已导入即时通信 IM。",
  1175. 20004: "网络异常,请重试。",
  1176. 20005: "".concat("服务端内部错误,请重试。"),
  1177. 20006: "触发发送".concat("单聊消息", "之前回调,App 后台返回禁止下发该消息。"),
  1178. 20007: "发送".concat("单聊消息", ",被对方拉黑,禁止发送。消息发送状态默认展示为失败,您可以登录控制台修改该场景下的消息发送状态展示结果,具体操作请参见消息保留设置(").concat(wt, "269/38656)。"),
  1179. 20009: "消息发送双方互相不是好友,禁止发送(配置".concat("单聊消息", "校验好友关系才会出现)。"),
  1180. 20010: "发送".concat("单聊消息", ",自己不是对方的好友(单向关系),禁止发送。"),
  1181. 20011: "发送".concat("单聊消息", ",对方不是自己的好友(单向关系),禁止发送。"),
  1182. 20012: "发送方被禁言,该条消息被禁止发送。",
  1183. 20016: "消息撤回超过了时间限制(默认2分钟)。",
  1184. 20018: "删除漫游内部错误。",
  1185. 90001: "JSON 格式解析失败,请检查请求包是否符合 JSON 规范。",
  1186. 90002: "".concat("JSON 格式请求包体", "中 MsgBody 不符合消息格式描述,或者 MsgBody 不是 Array 类型,请参考 TIMMsgElement 对象的定义(").concat(wt, "269/2720#.E6.B6.88.E6.81.AF.E5.85.83.E7.B4.A0-timmsgelement)。"),
  1187. 90003: "".concat("JSON 格式请求包体", "中缺少 To_Account 字段或者 To_Account 帐号不存在。"),
  1188. 90005: "".concat("JSON 格式请求包体", "中缺少 MsgRandom 字段或者 MsgRandom 字段不是 Integer 类型。"),
  1189. 90006: "".concat("JSON 格式请求包体", "中缺少 MsgTimeStamp 字段或者 MsgTimeStamp 字段不是 Integer 类型。"),
  1190. 90007: "".concat("JSON 格式请求包体", "中 MsgBody 类型不是 Array 类型,请将其修改为 Array 类型。"),
  1191. 90008: "".concat("JSON 格式请求包体", "中缺少 From_Account 字段或者 From_Account 帐号不存在。"),
  1192. 90009: "请求需要 App 管理员权限。",
  1193. 90010: "".concat("JSON 格式请求包体", "不符合消息格式描述,请参考 TIMMsgElement 对象的定义(").concat(wt, "269/2720#.E6.B6.88.E6.81.AF.E5.85.83.E7.B4.A0-timmsgelement)。"),
  1194. 90011: "批量发消息目标帐号超过500,请减少 To_Account 中目标帐号数量。",
  1195. 90012: "To_Account 没有注册或不存在,请确认 To_Account 是否导入即时通信 IM 或者是否拼写错误。",
  1196. 90026: "消息离线存储时间错误(最多不能超过7天)。",
  1197. 90031: "".concat("JSON 格式请求包体", "中 SyncOtherMachine 字段不是 Integer 类型。"),
  1198. 90044: "".concat("JSON 格式请求包体", "中 MsgLifeTime 字段不是 Integer 类型。"),
  1199. 90048: "请求的用户帐号不存在。",
  1200. 90054: "撤回请求中的 MsgKey 不合法。",
  1201. 90994: "".concat("服务端内部错误,请重试。"),
  1202. 90995: "".concat("服务端内部错误,请重试。"),
  1203. 91e3: "".concat("服务端内部错误,请重试。"),
  1204. 90992: "".concat("服务端内部错误,请重试。", "如果所有请求都返回该错误码,且 App 配置了第三方回调,请检查 App 服务端是否正常向即时通信 IM 后台服务端返回回调结果。"),
  1205. 93e3: "JSON 数据包超长,消息包体请不要超过8k。",
  1206. 91101: "Web 端长轮询被踢(Web 端同时在线实例个数超出限制)。",
  1207. 10002: "".concat("服务端内部错误,请重试。"),
  1208. 10003: "请求中的接口名称错误,请核对接口名称并重试。",
  1209. 10004: "参数非法,请根据错误描述检查请求是否正确。",
  1210. 10005: "请求包体中携带的帐号数量过多。",
  1211. 10006: "操作频率限制,请尝试降低调用的频率。",
  1212. 10007: "操作权限不足,例如 Work ".concat("群组", "中普通成员尝试执行踢人操作,但只有 App 管理员才有权限。"),
  1213. 10008: "请求非法,可能是请求中携带的签名信息验证不正确,请再次尝试。",
  1214. 10009: "该群不允许群主主动退出。",
  1215. 10010: "".concat("群组", "不存在,或者曾经存在过,但是目前已经被解散。"),
  1216. 10011: "解析 JSON 包体失败,请检查包体的格式是否符合 JSON 格式。",
  1217. 10012: "发起操作的 UserID 非法,请检查发起操作的用户 UserID 是否填写正确。",
  1218. 10013: "被邀请加入的用户已经是群成员。",
  1219. 10014: "群已满员,无法将请求中的用户加入".concat("群组", ",如果是批量加人,可以尝试减少加入用户的数量。"),
  1220. 10015: "找不到指定 ID 的".concat("群组", "。"),
  1221. 10016: "App 后台通过第三方回调拒绝本次操作。",
  1222. 10017: "因被禁言而不能发送消息,请检查发送者是否被设置禁言。",
  1223. 10018: "应答包长度超过最大包长(1MB),请求的内容过多,请尝试减少单次请求的数据量。",
  1224. 10019: "请求的用户帐号不存在。",
  1225. 10021: "".concat("群组", " ID 已被使用,请选择其他的").concat("群组", " ID。"),
  1226. 10023: "发消息的频率超限,请延长两次发消息时间的间隔。",
  1227. 10024: "此邀请或者申请请求已经被处理。",
  1228. 10025: "".concat("群组", " ID 已被使用,并且操作者为群主,可以直接使用。"),
  1229. 10026: "该 SDKAppID 请求的命令字已被禁用。",
  1230. 10030: "请求撤回的消息不存在。",
  1231. 10031: "消息撤回超过了时间限制(默认2分钟)。",
  1232. 10032: "请求撤回的消息不支持撤回操作。",
  1233. 10033: "".concat("群组", "类型不支持消息撤回操作。"),
  1234. 10034: "该消息类型不支持删除操作。",
  1235. 10035: "直播群和在线成员广播大群不支持删除消息。",
  1236. 10036: "直播群创建数量超过了限制,请参考价格说明(".concat(wt, "269/11673)购买预付费套餐“IM直播群”。"),
  1237. 10037: "单个用户可创建和加入的".concat("群组", "数量超过了限制,请参考价格说明(").concat(wt, "269/11673)购买或升级预付费套餐“单人可创建与加入").concat("群组", "数”。"),
  1238. 10038: "群成员数量超过限制,请参考价格说明(".concat(wt, "269/11673)购买或升级预付费套餐“扩展群人数上限”。"),
  1239. 10041: "该应用(SDKAppID)已配置不支持群消息撤回。"
  1240. },
  1241. Ut = function (e) {
  1242. c(n, e);
  1243. var t = v(n);
  1244. function n(e) {
  1245. var r;
  1246. return o(this, n), (r = t.call(this)).code = e.code, r.message = bt[e.code] || e.message, r.data = e.data || {}, r;
  1247. }
  1248. return n;
  1249. }(d(Error)),
  1250. qt = {
  1251. NO_SDKAPPID: 2e3,
  1252. NO_ACCOUNT_TYPE: 2001,
  1253. NO_IDENTIFIER: 2002,
  1254. NO_USERSIG: 2003,
  1255. NO_TINYID: 2022,
  1256. NO_A2KEY: 2023,
  1257. USER_NOT_LOGGED_IN: 2024,
  1258. COS_UNDETECTED: 2040,
  1259. MESSAGE_SEND_FAIL: 2100,
  1260. MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS: 2103,
  1261. MESSAGE_SEND_NEED_MESSAGE_INSTANCE: 2105,
  1262. MESSAGE_SEND_INVALID_CONVERSATION_TYPE: 2106,
  1263. MESSAGE_FILE_IS_EMPTY: 2108,
  1264. MESSAGE_ONPROGRESS_FUNCTION_ERROR: 2109,
  1265. MESSAGE_REVOKE_FAIL: 2110,
  1266. MESSAGE_IMAGE_SELECT_FILE_FIRST: 2251,
  1267. MESSAGE_IMAGE_TYPES_LIMIT: 2252,
  1268. MESSAGE_IMAGE_SIZE_LIMIT: 2253,
  1269. MESSAGE_AUDIO_UPLOAD_FAIL: 2300,
  1270. MESSAGE_AUDIO_SIZE_LIMIT: 2301,
  1271. MESSAGE_VIDEO_UPLOAD_FAIL: 2350,
  1272. MESSAGE_VIDEO_SIZE_LIMIT: 2351,
  1273. MESSAGE_VIDEO_TYPES_LIMIT: 2352,
  1274. MESSAGE_FILE_UPLOAD_FAIL: 2400,
  1275. MESSAGE_FILE_SELECT_FILE_FIRST: 2401,
  1276. MESSAGE_FILE_SIZE_LIMIT: 2402,
  1277. MESSAGE_FILE_URL_IS_EMPTY: 2403,
  1278. CONVERSATION_NOT_FOUND: 2500,
  1279. USER_OR_GROUP_NOT_FOUND: 2501,
  1280. CONVERSATION_UN_RECORDED_TYPE: 2502,
  1281. ILLEGAL_GROUP_TYPE: 2600,
  1282. CANNOT_JOIN_WORK: 2601,
  1283. CANNOT_CHANGE_OWNER_IN_AVCHATROOM: 2620,
  1284. CANNOT_CHANGE_OWNER_TO_SELF: 2621,
  1285. CANNOT_DISMISS_Work: 2622,
  1286. JOIN_GROUP_FAIL: 2660,
  1287. CANNOT_ADD_MEMBER_IN_AVCHATROOM: 2661,
  1288. CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN: 2662,
  1289. CANNOT_KICK_MEMBER_IN_AVCHATROOM: 2680,
  1290. NOT_OWNER: 2681,
  1291. CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM: 2682,
  1292. INVALID_MEMBER_ROLE: 2683,
  1293. CANNOT_SET_SELF_MEMBER_ROLE: 2684,
  1294. CANNOT_MUTE_SELF: 2685,
  1295. DEL_FRIEND_INVALID_PARAM: 2700,
  1296. UPDATE_PROFILE_INVALID_PARAM: 2721,
  1297. UPDATE_PROFILE_NO_KEY: 2722,
  1298. ADD_BLACKLIST_INVALID_PARAM: 2740,
  1299. DEL_BLACKLIST_INVALID_PARAM: 2741,
  1300. CANNOT_ADD_SELF_TO_BLACKLIST: 2742,
  1301. NETWORK_ERROR: 2800,
  1302. NETWORK_TIMEOUT: 2801,
  1303. NETWORK_BASE_OPTIONS_NO_URL: 2802,
  1304. NETWORK_UNDEFINED_SERVER_NAME: 2803,
  1305. NETWORK_PACKAGE_UNDEFINED: 2804,
  1306. NO_NETWORK: 2805,
  1307. CONVERTOR_IRREGULAR_PARAMS: 2900,
  1308. NOTICE_RUNLOOP_UNEXPECTED_CONDITION: 2901,
  1309. NOTICE_RUNLOOP_OFFSET_LOST: 2902,
  1310. UNCAUGHT_ERROR: 2903,
  1311. GET_LONGPOLL_ID_FAILED: 2904,
  1312. INVALID_OPERATION: 2905,
  1313. SDK_IS_NOT_READY: 2999,
  1314. LONG_POLL_KICK_OUT: 91101,
  1315. MESSAGE_A2KEY_EXPIRED: 20002,
  1316. ACCOUNT_A2KEY_EXPIRED: 70001,
  1317. LONG_POLL_API_PARAM_ERROR: 90001
  1318. },
  1319. Ft = "无 SDKAppID",
  1320. xt = "无 accountType",
  1321. Vt = "无 userID",
  1322. Kt = "无 userSig",
  1323. Ht = "无 tinyID",
  1324. Bt = "无 a2key",
  1325. jt = "用户未登录",
  1326. $t = "未检测到 COS 上传插件",
  1327. Yt = "消息发送失败",
  1328. zt = "MessageController.constructor() 需要参数 options",
  1329. Wt = "需要 Message 的实例",
  1330. Jt = 'Message.conversationType 只能为 "C2C" 或 "GROUP"',
  1331. Xt = "无法发送空文件",
  1332. Qt = "回调函数运行时遇到错误,请检查接入侧代码",
  1333. Zt = "消息撤回失败",
  1334. en = "请先选择一个图片",
  1335. tn = "只允许上传 jpg png jpeg gif bmp格式的图片",
  1336. nn = "图片大小超过20M,无法发送",
  1337. on = "语音上传失败",
  1338. rn = "语音大小大于20M,无法发送",
  1339. sn = "视频上传失败",
  1340. an = "视频大小超过100M,无法发送",
  1341. un = "只允许上传 mp4 格式的视频",
  1342. cn = "文件上传失败",
  1343. ln = "请先选择一个文件",
  1344. pn = "文件大小超过100M,无法发送 ",
  1345. gn = "缺少必要的参数文件 URL",
  1346. hn = "没有找到相应的会话,请检查传入参数",
  1347. dn = "没有找到相应的用户或群组,请检查传入参数",
  1348. mn = "未记录的会话类型",
  1349. fn = "非法的群类型,请检查传入参数",
  1350. _n = "不能加入 Work 类型的群组",
  1351. vn = "AVChatRoom 类型的群组不能转让群主",
  1352. yn = "不能把群主转让给自己",
  1353. In = "不能解散 Work 类型的群组",
  1354. Mn = "加群失败,请检查传入参数或重试",
  1355. Cn = "AVChatRoom 类型的群不支持邀请群成员",
  1356. En = "非 AVChatRoom 类型的群组不允许匿名加群,请先登录后再加群",
  1357. Tn = "不能在 AVChatRoom 类型的群组踢人",
  1358. Dn = "你不是群主,只有群主才有权限操作",
  1359. Sn = "不能在 Work / AVChatRoom 类型的群中设置群成员身份",
  1360. kn = "不合法的群成员身份,请检查传入参数",
  1361. An = "不能设置自己的群成员身份,请检查传入参数",
  1362. On = "不能将自己禁言,请检查传入参数",
  1363. Rn = "传入 deleteFriend 接口的参数无效",
  1364. Nn = "传入 updateMyProfile 接口的参数无效",
  1365. Ln = "updateMyProfile 无标配资料字段或自定义资料字段",
  1366. wn = "传入 addToBlacklist 接口的参数无效",
  1367. Pn = "传入 removeFromBlacklist 接口的参数无效",
  1368. Gn = "不能拉黑自己",
  1369. bn = "网络层初始化错误,缺少 URL 参数",
  1370. Un = "打包错误,未定义的 serverName",
  1371. qn = "未定义的 packageConfig",
  1372. Fn = "未连接到网络",
  1373. xn = "不规范的参数名称",
  1374. Vn = "_syncOffset 丢失",
  1375. Kn = "获取 longpolling id 失败",
  1376. Hn = "无效操作,如调用了未定义或者未实现的方法等",
  1377. Bn = "接口需要 SDK 处于 ready 状态后才能调用",
  1378. jn = ["jpg", "jpeg", "gif", "png", "bmp"],
  1379. $n = ["mp4"],
  1380. Yn = function () {
  1381. function e(n) {
  1382. o(this, e);
  1383. var r = this._check(n);
  1384. if (r instanceof Ut) throw r;
  1385. this.type = t.MSG_FILE, this._percent = 0;
  1386. var i = this._getFileInfo(n);
  1387. this.content = {
  1388. downloadFlag: 2,
  1389. fileUrl: n.url || "",
  1390. uuid: n.uuid,
  1391. fileName: i.name || "",
  1392. fileSize: i.size || 0
  1393. };
  1394. }
  1395. return i(e, [{
  1396. key: "_getFileInfo",
  1397. value: function (e) {
  1398. if (e.fileName && e.fileSize) return {
  1399. size: e.fileSize,
  1400. name: e.fileName
  1401. };
  1402. if (V) return {};
  1403. var t = e.file.files[0];
  1404. return {
  1405. size: t.size,
  1406. name: t.name,
  1407. type: t.type.slice(t.type.lastIndexOf("/") + 1).toLowerCase()
  1408. };
  1409. }
  1410. }, {
  1411. key: "updatePercent",
  1412. value: function (e) {
  1413. this._percent = e, this._percent > 1 && (this._percent = 1);
  1414. }
  1415. }, {
  1416. key: "updateFileUrl",
  1417. value: function (e) {
  1418. this.content.fileUrl = e;
  1419. }
  1420. }, {
  1421. key: "_check",
  1422. value: function (e) {
  1423. if (e.size > 104857600) return new Ut({
  1424. code: qt.MESSAGE_FILE_SIZE_LIMIT,
  1425. message: "".concat(pn, ": ").concat(104857600, " bytes")
  1426. });
  1427. }
  1428. }, {
  1429. key: "sendable",
  1430. value: function () {
  1431. return "" !== this.content.fileUrl && "" !== this.content.fileName && 0 !== this.content.fileSize;
  1432. }
  1433. }]), e;
  1434. }(),
  1435. zn = function () {
  1436. function e(n) {
  1437. o(this, e), this.type = t.MSG_CUSTOM, this.content = {
  1438. data: n.data || "",
  1439. description: n.description || "",
  1440. extension: n.extension || ""
  1441. };
  1442. }
  1443. return i(e, [{
  1444. key: "setData",
  1445. value: function (e) {
  1446. return this.content.data = e, this;
  1447. }
  1448. }, {
  1449. key: "setDescription",
  1450. value: function (e) {
  1451. return this.content.description = e, this;
  1452. }
  1453. }, {
  1454. key: "setExtension",
  1455. value: function (e) {
  1456. return this.content.extension = e, this;
  1457. }
  1458. }, {
  1459. key: "sendable",
  1460. value: function () {
  1461. return 0 !== this.content.data.length || 0 !== this.content.description.length || 0 !== this.content.extension.length;
  1462. }
  1463. }]), e;
  1464. }(),
  1465. Wn = function () {
  1466. function e(n) {
  1467. o(this, e), this.type = t.MSG_VIDEO, this._percent = 0, this.content = {
  1468. remoteVideoUrl: n.remoteVideoUrl,
  1469. videoFormat: n.videoFormat,
  1470. videoSecond: parseInt(n.videoSecond, 10),
  1471. videoSize: n.videoSize,
  1472. videoUrl: n.videoUrl,
  1473. videoDownloadFlag: 2,
  1474. videoUUID: n.videoUUID,
  1475. thumbUUID: n.thumbUUID,
  1476. thumbFormat: n.thumbFormat,
  1477. thumbWidth: n.thumbWidth,
  1478. thumbHeight: n.thumbHeight,
  1479. thumbSize: n.thumbSize,
  1480. thumbDownloadFlag: 2,
  1481. thumbUrl: n.thumbUrl
  1482. };
  1483. }
  1484. return i(e, [{
  1485. key: "updatePercent",
  1486. value: function (e) {
  1487. this._percent = e, this._percent > 1 && (this._percent = 1);
  1488. }
  1489. }, {
  1490. key: "updateVideoUrl",
  1491. value: function (e) {
  1492. e && (this.content.remoteVideoUrl = e);
  1493. }
  1494. }, {
  1495. key: "sendable",
  1496. value: function () {
  1497. return "" !== this.content.remoteVideoUrl;
  1498. }
  1499. }]), e;
  1500. }(),
  1501. Jn = function e(n) {
  1502. o(this, e), this.type = t.MSG_GEO, this.content = n;
  1503. },
  1504. Xn = {
  1505. 1: t.MSG_PRIORITY_HIGH,
  1506. 2: t.MSG_PRIORITY_NORMAL,
  1507. 3: t.MSG_PRIORITY_LOW,
  1508. 4: t.MSG_PRIORITY_LOWEST
  1509. },
  1510. Qn = function () {
  1511. function e(n) {
  1512. o(this, e), this.ID = "", this.conversationID = n.conversationID || null, this.conversationType = n.conversationType || t.CONV_C2C, this.conversationSubType = n.conversationSubType, this.time = n.time || Math.ceil(Date.now() / 1e3), this.sequence = n.sequence || 0, this.clientSequence = n.clientSequence || n.sequence || 0, this.random = n.random || we(), this.priority = this._computePriority(n.priority), this.nick = "", this.avatar = "", this.isPeerRead = !1, this.nameCard = "", this._elements = [], this.isPlaceMessage = n.isPlaceMessage || 0, this.isRevoked = 2 === n.isPlaceMessage || 8 === n.msgFlagBits, this.geo = {}, this.from = n.from || null, this.to = n.to || null, this.flow = "", this.isSystemMessage = n.isSystemMessage || !1, this.protocol = n.protocol || "JSON", this.isResend = !1, this.isRead = !1, this.status = n.status || rt.SUCCESS, this._onlineOnlyFlag = !1, this._groupAtInfoList = [], this.atUserList = [], this.reInitialize(n.currentUser), this.extractGroupInfo(n.groupProfile || null), this.handleGroupAtInfo(n);
  1513. }
  1514. return i(e, [{
  1515. key: "getElements",
  1516. value: function () {
  1517. return this._elements;
  1518. }
  1519. }, {
  1520. key: "extractGroupInfo",
  1521. value: function (e) {
  1522. if (null !== e) {
  1523. _e(e.fromAccountNick) && (this.nick = e.fromAccountNick), _e(e.fromAccountHeadurl) && (this.avatar = e.fromAccountHeadurl);
  1524. var t = e.messageFromAccountExtraInformation;
  1525. ye(t) && _e(t.nameCard) && (this.nameCard = t.nameCard);
  1526. }
  1527. }
  1528. }, {
  1529. key: "handleGroupAtInfo",
  1530. value: function (e) {
  1531. var n = this;
  1532. e.payload && e.payload.atUserList && e.payload.atUserList.forEach(function (e) {
  1533. e !== t.MSG_AT_ALL ? (n._groupAtInfoList.push({
  1534. groupAtAllFlag: 0,
  1535. groupAtUserID: e
  1536. }), n.atUserList.push(e)) : (n._groupAtInfoList.push({
  1537. groupAtAllFlag: 1
  1538. }), n.atUserList.push(t.MSG_AT_ALL));
  1539. }), Ie(e.groupAtInfo) && e.groupAtInfo.forEach(function (e) {
  1540. 1 === e.groupAtAllFlag ? n.atUserList.push(e.groupAtUserID) : 2 === e.groupAtAllFlag && n.atUserList.push(t.MSG_AT_ALL);
  1541. });
  1542. }
  1543. }, {
  1544. key: "getGroupAtInfoList",
  1545. value: function () {
  1546. return this._groupAtInfoList;
  1547. }
  1548. }, {
  1549. key: "_initProxy",
  1550. value: function () {
  1551. this.payload = this._elements[0].content, this.type = this._elements[0].type;
  1552. }
  1553. }, {
  1554. key: "reInitialize",
  1555. value: function (e) {
  1556. e && (this.status = this.from ? rt.SUCCESS : rt.UNSEND, !this.from && (this.from = e)), this._initFlow(e), this._initielizeSequence(e), this._concactConversationID(e), this.generateMessageID(e);
  1557. }
  1558. }, {
  1559. key: "isSendable",
  1560. value: function () {
  1561. return 0 !== this._elements.length && ("function" != typeof this._elements[0].sendable ? (de.warn("".concat(this._elements[0].type, ' need "boolean : sendable()" method')), !1) : this._elements[0].sendable());
  1562. }
  1563. }, {
  1564. key: "_initTo",
  1565. value: function (e) {
  1566. this.conversationType === t.CONV_GROUP && (this.to = e.groupID);
  1567. }
  1568. }, {
  1569. key: "_initielizeSequence",
  1570. value: function (e) {
  1571. 0 === this.clientSequence && e && (this.clientSequence = function (e) {
  1572. if (!e) return de.error("autoincrementIndex(string: key) need key parameter"), !1;
  1573. if (void 0 === Ue[e]) {
  1574. var t = new Date(),
  1575. n = "3".concat(t.getHours()).slice(-2),
  1576. o = "0".concat(t.getMinutes()).slice(-2),
  1577. r = "0".concat(t.getSeconds()).slice(-2);
  1578. Ue[e] = parseInt([n, o, r, "0001"].join("")), n = null, o = null, r = null, de.warn("utils.autoincrementIndex() create new sequence : ".concat(e, " = ").concat(Ue[e]));
  1579. }
  1580. return Ue[e]++;
  1581. }(e)), 0 === this.sequence && this.conversationType === t.CONV_C2C && (this.sequence = this.clientSequence);
  1582. }
  1583. }, {
  1584. key: "generateMessageID",
  1585. value: function (e) {
  1586. var t = e === this.from ? 1 : 0,
  1587. n = this.sequence > 0 ? this.sequence : this.clientSequence;
  1588. this.ID = "".concat(this.conversationID, "-").concat(n, "-").concat(this.random, "-").concat(t);
  1589. }
  1590. }, {
  1591. key: "_initFlow",
  1592. value: function (e) {
  1593. "" !== e && (e === this.from ? (this.flow = "out", this.isRead = !0) : this.flow = "in");
  1594. }
  1595. }, {
  1596. key: "_concactConversationID",
  1597. value: function (e) {
  1598. var n = this.to,
  1599. o = "",
  1600. r = this.conversationType;
  1601. r !== t.CONV_SYSTEM ? (o = r === t.CONV_C2C ? e === this.from ? n : this.from : this.to, this.conversationID = "".concat(r).concat(o)) : this.conversationID = t.CONV_SYSTEM;
  1602. }
  1603. }, {
  1604. key: "isElement",
  1605. value: function (e) {
  1606. return e instanceof st || e instanceof St || e instanceof kt || e instanceof At || e instanceof Yn || e instanceof Wn || e instanceof Rt || e instanceof Lt || e instanceof zn || e instanceof Jn;
  1607. }
  1608. }, {
  1609. key: "setElement",
  1610. value: function (e) {
  1611. var n = this;
  1612. if (this.isElement(e)) return this._elements = [e], void this._initProxy();
  1613. var o = function (e) {
  1614. switch (e.type) {
  1615. case t.MSG_TEXT:
  1616. n.setTextElement(e.content);
  1617. break;
  1618. case t.MSG_IMAGE:
  1619. n.setImageElement(e.content);
  1620. break;
  1621. case t.MSG_AUDIO:
  1622. n.setAudioElement(e.content);
  1623. break;
  1624. case t.MSG_FILE:
  1625. n.setFileElement(e.content);
  1626. break;
  1627. case t.MSG_VIDEO:
  1628. n.setVideoElement(e.content);
  1629. break;
  1630. case t.MSG_CUSTOM:
  1631. n.setCustomElement(e.content);
  1632. break;
  1633. case t.MSG_GEO:
  1634. n.setGEOElement(e.content);
  1635. break;
  1636. case t.MSG_GRP_TIP:
  1637. n.setGroupTipElement(e.content);
  1638. break;
  1639. case t.MSG_GRP_SYS_NOTICE:
  1640. n.setGroupSystemNoticeElement(e.content);
  1641. break;
  1642. case t.MSG_FACE:
  1643. n.setFaceElement(e.content);
  1644. break;
  1645. default:
  1646. de.warn(e.type, e.content, "no operation......");
  1647. }
  1648. };
  1649. if (Ie(e)) for (var r = 0; r < e.length; r++) o(e[r]);else o(e);
  1650. this._initProxy();
  1651. }
  1652. }, {
  1653. key: "setTextElement",
  1654. value: function (e) {
  1655. var t = "string" == typeof e ? e : e.text,
  1656. n = new st({
  1657. text: t
  1658. });
  1659. this._elements.push(n);
  1660. }
  1661. }, {
  1662. key: "setImageElement",
  1663. value: function (e) {
  1664. var t = new St(e);
  1665. this._elements.push(t);
  1666. }
  1667. }, {
  1668. key: "setAudioElement",
  1669. value: function (e) {
  1670. var t = new At(e);
  1671. this._elements.push(t);
  1672. }
  1673. }, {
  1674. key: "setFileElement",
  1675. value: function (e) {
  1676. var t = new Yn(e);
  1677. this._elements.push(t);
  1678. }
  1679. }, {
  1680. key: "setVideoElement",
  1681. value: function (e) {
  1682. var t = new Wn(e);
  1683. this._elements.push(t);
  1684. }
  1685. }, {
  1686. key: "setGEOElement",
  1687. value: function (e) {
  1688. var t = new Jn(e);
  1689. this._elements.push(t);
  1690. }
  1691. }, {
  1692. key: "setCustomElement",
  1693. value: function (e) {
  1694. var t = new zn(e);
  1695. this._elements.push(t);
  1696. }
  1697. }, {
  1698. key: "setGroupTipElement",
  1699. value: function (e) {
  1700. var n = {},
  1701. o = e.operationType;
  1702. Xe(e.memberInfoList) || o !== t.GRP_TIP_MBR_JOIN && o !== t.GRP_TIP_MBR_KICKED_OUT ? e.operatorInfo && (n = e.operatorInfo) : n = e.memberInfoList[0];
  1703. var r = n,
  1704. i = r.nick,
  1705. s = r.avatar;
  1706. _e(i) && (this.nick = i), _e(s) && (this.avatar = s);
  1707. var a = new Rt(e);
  1708. this._elements.push(a);
  1709. }
  1710. }, {
  1711. key: "setGroupSystemNoticeElement",
  1712. value: function (e) {
  1713. var t = new Lt(e);
  1714. this._elements.push(t);
  1715. }
  1716. }, {
  1717. key: "setFaceElement",
  1718. value: function (e) {
  1719. var t = new kt(e);
  1720. this._elements.push(t);
  1721. }
  1722. }, {
  1723. key: "setIsRead",
  1724. value: function (e) {
  1725. this.isRead = e;
  1726. }
  1727. }, {
  1728. key: "setOnlineOnlyFlag",
  1729. value: function (e) {
  1730. this._onlineOnlyFlag = e;
  1731. }
  1732. }, {
  1733. key: "getOnlineOnlyFlag",
  1734. value: function () {
  1735. return this._onlineOnlyFlag;
  1736. }
  1737. }, {
  1738. key: "_computePriority",
  1739. value: function (e) {
  1740. if (Me(e)) return t.MSG_PRIORITY_NORMAL;
  1741. if (_e(e) && -1 !== Object.values(Xn).indexOf(e)) return e;
  1742. if (fe(e)) {
  1743. var n = "" + e;
  1744. if (-1 !== Object.keys(Xn).indexOf(n)) return Xn[n];
  1745. }
  1746. return t.MSG_PRIORITY_NORMAL;
  1747. }
  1748. }, {
  1749. key: "elements",
  1750. get: function () {
  1751. return de.warn("!!!Message 实例的 elements 属性即将废弃,请尽快修改。使用 type 和 payload 属性处理单条消息,兼容组合消息使用 _elements 属性!!!"), this._elements;
  1752. }
  1753. }]), e;
  1754. }(),
  1755. Zn = function (e) {
  1756. return !!e && (!!(function (e) {
  1757. return _e(e) && e.slice(0, 3) === t.CONV_C2C;
  1758. }(e) || function (e) {
  1759. return _e(e) && e.slice(0, 5) === t.CONV_GROUP;
  1760. }(e) || je(e)) || (console.warn("非法的会话 ID:".concat(e, "。会话 ID 组成方式:C2C + userID(单聊)GROUP + groupID(群聊)@TIM#SYSTEM(系统通知会话)")), !1));
  1761. },
  1762. eo = "请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#",
  1763. to = function (e) {
  1764. return e.param ? "".concat(e.api, " ").concat(e.param, " ").concat(e.desc, "。").concat(eo).concat(e.api) : "".concat(e.api, " ").concat(e.desc, "。").concat(eo).concat(e.api);
  1765. },
  1766. no = {
  1767. type: "String",
  1768. required: !0
  1769. },
  1770. oo = {
  1771. type: "Array",
  1772. required: !0
  1773. },
  1774. ro = {
  1775. type: "Object",
  1776. required: !0
  1777. },
  1778. io = {
  1779. login: {
  1780. userID: no,
  1781. userSig: no
  1782. },
  1783. addToBlacklist: {
  1784. userIDList: oo
  1785. },
  1786. on: [{
  1787. name: "eventName",
  1788. type: "String",
  1789. validator: function (e) {
  1790. return "string" == typeof e && 0 !== e.length || (console.warn(to({
  1791. api: "on",
  1792. param: "eventName",
  1793. desc: "类型必须为 String,且不能为空"
  1794. })), !1);
  1795. }
  1796. }, {
  1797. name: "handler",
  1798. type: "Function",
  1799. validator: function (e) {
  1800. return "function" != typeof e ? (console.warn(to({
  1801. api: "on",
  1802. param: "handler",
  1803. desc: "参数必须为 Function"
  1804. })), !1) : ("" === e.name && console.warn("on 接口的 handler 参数推荐使用具名函数。具名函数可以使用 off 接口取消订阅,匿名函数无法取消订阅。"), !0);
  1805. }
  1806. }],
  1807. once: [{
  1808. name: "eventName",
  1809. type: "String",
  1810. validator: function (e) {
  1811. return "string" == typeof e && 0 !== e.length || (console.warn(to({
  1812. api: "once",
  1813. param: "eventName",
  1814. desc: "类型必须为 String,且不能为空"
  1815. })), !1);
  1816. }
  1817. }, {
  1818. name: "handler",
  1819. type: "Function",
  1820. validator: function (e) {
  1821. return "function" != typeof e ? (console.warn(to({
  1822. api: "once",
  1823. param: "handler",
  1824. desc: "参数必须为 Function"
  1825. })), !1) : ("" === e.name && console.warn("once 接口的 handler 参数推荐使用具名函数。"), !0);
  1826. }
  1827. }],
  1828. off: [{
  1829. name: "eventName",
  1830. type: "String",
  1831. validator: function (e) {
  1832. return "string" == typeof e && 0 !== e.length || (console.warn(to({
  1833. api: "off",
  1834. param: "eventName",
  1835. desc: "类型必须为 String,且不能为空"
  1836. })), !1);
  1837. }
  1838. }, {
  1839. name: "handler",
  1840. type: "Function",
  1841. validator: function (e) {
  1842. return "function" != typeof e ? (console.warn(to({
  1843. api: "off",
  1844. param: "handler",
  1845. desc: "参数必须为 Function"
  1846. })), !1) : ("" === e.name && console.warn("off 接口无法为匿名函数取消监听事件。"), !0);
  1847. }
  1848. }],
  1849. sendMessage: [u({
  1850. name: "message"
  1851. }, ro)],
  1852. getMessageList: {
  1853. conversationID: u(u({}, no), {}, {
  1854. validator: function (e) {
  1855. return Zn(e);
  1856. }
  1857. }),
  1858. nextReqMessageID: {
  1859. type: "String"
  1860. },
  1861. count: {
  1862. type: "Number",
  1863. validator: function (e) {
  1864. return !(!Me(e) && !/^[1-9][0-9]*$/.test(e)) || (console.warn(to({
  1865. api: "getMessageList",
  1866. param: "count",
  1867. desc: "必须为正整数"
  1868. })), !1);
  1869. }
  1870. }
  1871. },
  1872. setMessageRead: {
  1873. conversationID: u(u({}, no), {}, {
  1874. validator: function (e) {
  1875. return Zn(e);
  1876. }
  1877. })
  1878. },
  1879. getConversationProfile: [u(u({
  1880. name: "conversationID"
  1881. }, no), {}, {
  1882. validator: function (e) {
  1883. return Zn(e);
  1884. }
  1885. })],
  1886. deleteConversation: [u(u({
  1887. name: "conversationID"
  1888. }, no), {}, {
  1889. validator: function (e) {
  1890. return Zn(e);
  1891. }
  1892. })],
  1893. getGroupList: {
  1894. groupProfileFilter: {
  1895. type: "Array"
  1896. }
  1897. },
  1898. getGroupProfile: {
  1899. groupID: no,
  1900. groupCustomFieldFilter: {
  1901. type: "Array"
  1902. },
  1903. memberCustomFieldFilter: {
  1904. type: "Array"
  1905. }
  1906. },
  1907. getGroupProfileAdvance: {
  1908. groupIDList: oo
  1909. },
  1910. createGroup: {
  1911. name: no
  1912. },
  1913. joinGroup: {
  1914. groupID: no,
  1915. type: {
  1916. type: "String"
  1917. },
  1918. applyMessage: {
  1919. type: "String"
  1920. }
  1921. },
  1922. quitGroup: [u({
  1923. name: "groupID"
  1924. }, no)],
  1925. handleApplication: {
  1926. message: ro,
  1927. handleAction: no,
  1928. handleMessage: {
  1929. type: "String"
  1930. }
  1931. },
  1932. changeGroupOwner: {
  1933. groupID: no,
  1934. newOwnerID: no
  1935. },
  1936. updateGroupProfile: {
  1937. groupID: no,
  1938. muteAllMembers: {
  1939. type: "Boolean"
  1940. }
  1941. },
  1942. dismissGroup: [u({
  1943. name: "groupID"
  1944. }, no)],
  1945. searchGroupByID: [u({
  1946. name: "groupID"
  1947. }, no)],
  1948. getGroupMemberList: {
  1949. groupID: no,
  1950. offset: {
  1951. type: "Number"
  1952. },
  1953. count: {
  1954. type: "Number"
  1955. }
  1956. },
  1957. getGroupMemberProfile: {
  1958. groupID: no,
  1959. userIDList: oo,
  1960. memberCustomFieldFilter: {
  1961. type: "Array"
  1962. }
  1963. },
  1964. addGroupMemeber: {
  1965. groupID: no,
  1966. userIDList: oo
  1967. },
  1968. setGroupMemberRole: {
  1969. groupID: no,
  1970. userID: no,
  1971. role: no
  1972. },
  1973. setGroupMemberMuteTime: {
  1974. groupID: no,
  1975. userID: no,
  1976. muteTime: {
  1977. type: "Number",
  1978. validator: function (e) {
  1979. return e >= 0;
  1980. }
  1981. }
  1982. },
  1983. setGroupMemberNameCard: {
  1984. groupID: no,
  1985. userID: {
  1986. type: "String"
  1987. },
  1988. nameCard: u(u({}, no), {}, {
  1989. validator: function (e) {
  1990. return !0 !== /^\s+$/.test(e);
  1991. }
  1992. })
  1993. },
  1994. setMessageRemindType: {
  1995. groupID: no,
  1996. messageRemindType: no
  1997. },
  1998. setGroupMemberCustomField: {
  1999. groupID: no,
  2000. userID: {
  2001. type: "String"
  2002. },
  2003. memberCustomField: oo
  2004. },
  2005. deleteGroupMember: {
  2006. groupID: no
  2007. },
  2008. createTextMessage: {
  2009. to: no,
  2010. conversationType: no,
  2011. payload: u(u({}, ro), {}, {
  2012. validator: function (e) {
  2013. return ye(e) ? _e(e.text) ? 0 !== e.text.length || (console.warn(to({
  2014. api: "createTextMessage",
  2015. desc: "消息内容不能为空"
  2016. })), !1) : (console.warn(to({
  2017. api: "createTextMessage",
  2018. param: "payload.text",
  2019. desc: "类型必须为 String"
  2020. })), !1) : (console.warn(to({
  2021. api: "createTextMessage",
  2022. param: "payload",
  2023. desc: "类型必须为 plain object"
  2024. })), !1);
  2025. }
  2026. })
  2027. },
  2028. createTextAtMessage: {
  2029. to: no,
  2030. conversationType: no,
  2031. payload: u(u({}, ro), {}, {
  2032. validator: function (e) {
  2033. return ye(e) ? _e(e.text) ? 0 === e.text.length ? (console.warn(to({
  2034. api: "createTextAtMessage",
  2035. desc: "消息内容不能为空"
  2036. })), !1) : !(e.atUserList && !Ie(e.atUserList)) || (console.warn(to({
  2037. api: "createTextAtMessage",
  2038. desc: "payload.atUserList 类型必须为数组"
  2039. })), !1) : (console.warn(to({
  2040. api: "createTextAtMessage",
  2041. param: "payload.text",
  2042. desc: "类型必须为 String"
  2043. })), !1) : (console.warn(to({
  2044. api: "createTextAtMessage",
  2045. param: "payload",
  2046. desc: "类型必须为 plain object"
  2047. })), !1);
  2048. }
  2049. })
  2050. },
  2051. createCustomMessage: {
  2052. to: no,
  2053. conversationType: no,
  2054. payload: u(u({}, ro), {}, {
  2055. validator: function (e) {
  2056. return ye(e) ? e.data && !_e(e.data) ? (console.warn(to({
  2057. api: "createCustomMessage",
  2058. param: "payload.data",
  2059. desc: "类型必须为 String"
  2060. })), !1) : e.description && !_e(e.description) ? (console.warn(to({
  2061. api: "createCustomMessage",
  2062. param: "payload.description",
  2063. desc: "类型必须为 String"
  2064. })), !1) : !(e.extension && !_e(e.extension)) || (console.warn(to({
  2065. api: "createCustomMessage",
  2066. param: "payload.extension",
  2067. desc: "类型必须为 String"
  2068. })), !1) : (console.warn(to({
  2069. api: "createCustomMessage",
  2070. param: "payload",
  2071. desc: "类型必须为 plain object"
  2072. })), !1);
  2073. }
  2074. })
  2075. },
  2076. createImageMessage: {
  2077. to: no,
  2078. conversationType: no,
  2079. payload: u(u({}, ro), {}, {
  2080. validator: function (e) {
  2081. if (!ye(e)) return console.warn(to({
  2082. api: "createImageMessage",
  2083. param: "payload",
  2084. desc: "类型必须为 plain object"
  2085. })), !1;
  2086. if (Me(e.file)) return console.warn(to({
  2087. api: "createImageMessage",
  2088. param: "payload.file",
  2089. desc: "不能为 undefined"
  2090. })), !1;
  2091. if (G) {
  2092. if (!(e.file instanceof HTMLInputElement || me(e.file))) return console.warn(to({
  2093. api: "createImageMessage",
  2094. param: "payload.file",
  2095. desc: "类型必须是 HTMLInputElement 或 File"
  2096. })), !1;
  2097. if (e.file instanceof HTMLInputElement && 0 === e.file.files.length) return console.warn(to({
  2098. api: "createImageMessage",
  2099. param: "payload.file",
  2100. desc: "您没有选择文件,无法发送"
  2101. })), !1;
  2102. }
  2103. return !0;
  2104. },
  2105. onProgress: {
  2106. type: "Function",
  2107. required: !1,
  2108. validator: function (e) {
  2109. return Me(e) && console.warn(to({
  2110. api: "createImageMessage",
  2111. desc: "没有 onProgress 回调,您将无法获取上传进度"
  2112. })), !0;
  2113. }
  2114. }
  2115. })
  2116. },
  2117. createAudioMessage: {
  2118. to: no,
  2119. conversationType: no,
  2120. payload: u(u({}, ro), {}, {
  2121. validator: function (e) {
  2122. return !!ye(e) || (console.warn(to({
  2123. api: "createAudioMessage",
  2124. param: "payload",
  2125. desc: "类型必须为 plain object"
  2126. })), !1);
  2127. }
  2128. }),
  2129. onProgress: {
  2130. type: "Function",
  2131. required: !1,
  2132. validator: function (e) {
  2133. return Me(e) && console.warn(to({
  2134. api: "createAudioMessage",
  2135. desc: "没有 onProgress 回调,您将无法获取上传进度"
  2136. })), !0;
  2137. }
  2138. }
  2139. },
  2140. createVideoMessage: {
  2141. to: no,
  2142. conversationType: no,
  2143. payload: u(u({}, ro), {}, {
  2144. validator: function (e) {
  2145. if (!ye(e)) return console.warn(to({
  2146. api: "createVideoMessage",
  2147. param: "payload",
  2148. desc: "类型必须为 plain object"
  2149. })), !1;
  2150. if (Me(e.file)) return console.warn(to({
  2151. api: "createVideoMessage",
  2152. param: "payload.file",
  2153. desc: "不能为 undefined"
  2154. })), !1;
  2155. if (G) {
  2156. if (!(e.file instanceof HTMLInputElement || me(e.file))) return console.warn(to({
  2157. api: "createVideoMessage",
  2158. param: "payload.file",
  2159. desc: "类型必须是 HTMLInputElement 或 File"
  2160. })), !1;
  2161. if (e.file instanceof HTMLInputElement && 0 === e.file.files.length) return console.warn(to({
  2162. api: "createVideoMessage",
  2163. param: "payload.file",
  2164. desc: "您没有选择文件,无法发送"
  2165. })), !1;
  2166. }
  2167. return !0;
  2168. }
  2169. }),
  2170. onProgress: {
  2171. type: "Function",
  2172. required: !1,
  2173. validator: function (e) {
  2174. return Me(e) && console.warn(to({
  2175. api: "createVideoMessage",
  2176. desc: "没有 onProgress 回调,您将无法获取上传进度"
  2177. })), !0;
  2178. }
  2179. }
  2180. },
  2181. createFaceMessage: {
  2182. to: no,
  2183. conversationType: no,
  2184. payload: u(u({}, ro), {}, {
  2185. validator: function (e) {
  2186. return ye(e) ? fe(e.index) ? !!_e(e.data) || (console.warn(to({
  2187. api: "createFaceMessage",
  2188. param: "payload.data",
  2189. desc: "类型必须为 String"
  2190. })), !1) : (console.warn(to({
  2191. api: "createFaceMessage",
  2192. param: "payload.index",
  2193. desc: "类型必须为 Number"
  2194. })), !1) : (console.warn(to({
  2195. api: "createFaceMessage",
  2196. param: "payload",
  2197. desc: "类型必须为 plain object"
  2198. })), !1);
  2199. }
  2200. })
  2201. },
  2202. createFileMessage: {
  2203. to: no,
  2204. conversationType: no,
  2205. payload: u(u({}, ro), {}, {
  2206. validator: function (e) {
  2207. if (!ye(e)) return console.warn(to({
  2208. api: "createFileMessage",
  2209. param: "payload",
  2210. desc: "类型必须为 plain object"
  2211. })), !1;
  2212. if (Me(e.file)) return console.warn(to({
  2213. api: "createFileMessage",
  2214. param: "payload.file",
  2215. desc: "不能为 undefined"
  2216. })), !1;
  2217. if (G) {
  2218. if (!(e.file instanceof HTMLInputElement || me(e.file))) return console.warn(to({
  2219. api: "createFileMessage",
  2220. param: "payload.file",
  2221. desc: "类型必须是 HTMLInputElement 或 File"
  2222. })), !1;
  2223. if (e.file instanceof HTMLInputElement && 0 === e.file.files.length) return console.warn(to({
  2224. api: "createFileMessage",
  2225. desc: "您没有选择文件,无法发送"
  2226. })), !1;
  2227. }
  2228. return !0;
  2229. }
  2230. }),
  2231. onProgress: {
  2232. type: "Function",
  2233. required: !1,
  2234. validator: function (e) {
  2235. return Me(e) && console.warn(to({
  2236. api: "createFileMessage",
  2237. desc: "没有 onProgress 回调,您将无法获取上传进度"
  2238. })), !0;
  2239. }
  2240. }
  2241. },
  2242. revokeMessage: [u(u({
  2243. name: "message"
  2244. }, ro), {}, {
  2245. validator: function (e) {
  2246. return e instanceof Qn ? e.conversationType === t.CONV_SYSTEM ? (console.warn("revokeMessage 不能撤回系统会话消息,只能撤回单聊消息或群消息"), !1) : !0 !== e.isRevoked || (console.warn("revokeMessage 消息已经被撤回,请勿重复操作"), !1) : (console.warn("revokeMessage 参数 message 必须为 Message(".concat(eo, "Message.html) 实例。")), !1);
  2247. }
  2248. })],
  2249. getUserProfile: {
  2250. userIDList: {
  2251. type: "Array",
  2252. validator: function (e) {
  2253. return Ie(e) ? (0 === e.length && console.warn(to({
  2254. api: "getUserProfile",
  2255. param: "userIDList",
  2256. desc: "不能为空数组"
  2257. })), !0) : (console.warn(to({
  2258. api: "getUserProfile",
  2259. param: "userIDList",
  2260. desc: "必须为数组"
  2261. })), !1);
  2262. }
  2263. }
  2264. },
  2265. updateMyProfile: {
  2266. profileCustomField: {
  2267. type: "Array",
  2268. validator: function (e) {
  2269. return !!Me(e) || !!Ie(e) || (console.warn(to({
  2270. api: "updateMyProfile",
  2271. param: "profileCustomField",
  2272. desc: "必须为数组"
  2273. })), !1);
  2274. }
  2275. }
  2276. }
  2277. },
  2278. so = {
  2279. login: "login",
  2280. logout: "logout",
  2281. on: "on",
  2282. once: "once",
  2283. off: "off",
  2284. setLogLevel: "setLogLevel",
  2285. registerPlugin: "registerPlugin",
  2286. destroy: "destroy",
  2287. createTextMessage: "createTextMessage",
  2288. createTextAtMessage: "createTextAtMessage",
  2289. createImageMessage: "createImageMessage",
  2290. createAudioMessage: "createAudioMessage",
  2291. createVideoMessage: "createVideoMessage",
  2292. createCustomMessage: "createCustomMessage",
  2293. createFaceMessage: "createFaceMessage",
  2294. createFileMessage: "createFileMessage",
  2295. sendMessage: "sendMessage",
  2296. resendMessage: "resendMessage",
  2297. getMessageList: "getMessageList",
  2298. setMessageRead: "setMessageRead",
  2299. revokeMessage: "revokeMessage",
  2300. getConversationList: "getConversationList",
  2301. getConversationProfile: "getConversationProfile",
  2302. deleteConversation: "deleteConversation",
  2303. getGroupList: "getGroupList",
  2304. getGroupProfile: "getGroupProfile",
  2305. createGroup: "createGroup",
  2306. joinGroup: "joinGroup",
  2307. updateGroupProfile: "updateGroupProfile",
  2308. quitGroup: "quitGroup",
  2309. dismissGroup: "dismissGroup",
  2310. changeGroupOwner: "changeGroupOwner",
  2311. searchGroupByID: "searchGroupByID",
  2312. setMessageRemindType: "setMessageRemindType",
  2313. handleGroupApplication: "handleGroupApplication",
  2314. getGroupMemberProfile: "getGroupMemberProfile",
  2315. getGroupMemberList: "getGroupMemberList",
  2316. addGroupMember: "addGroupMember",
  2317. deleteGroupMember: "deleteGroupMember",
  2318. setGroupMemberNameCard: "setGroupMemberNameCard",
  2319. setGroupMemberMuteTime: "setGroupMemberMuteTime",
  2320. setGroupMemberRole: "setGroupMemberRole",
  2321. setGroupMemberCustomField: "setGroupMemberCustomField",
  2322. getGroupOnlineMemberCount: "getGroupOnlineMemberCount",
  2323. getMyProfile: "getMyProfile",
  2324. getUserProfile: "getUserProfile",
  2325. updateMyProfile: "updateMyProfile",
  2326. getBlacklist: "getBlacklist",
  2327. addToBlacklist: "addToBlacklist",
  2328. removeFromBlacklist: "removeFromBlacklist",
  2329. getFriendList: "getFriendList",
  2330. callExperimentalAPI: "callExperimentalAPI"
  2331. },
  2332. ao = "1.7.3",
  2333. uo = "537048168",
  2334. co = "10",
  2335. lo = "protobuf",
  2336. po = "json",
  2337. go = 1,
  2338. ho = 2,
  2339. mo = 3,
  2340. fo = 4,
  2341. _o = {
  2342. HOST: {
  2343. CURRENT: {
  2344. COMMON: "https://webim.tim.qq.com",
  2345. PIC: "https://pic.tim.qq.com",
  2346. COS: "https://yun.tim.qq.com"
  2347. },
  2348. PRODUCTION: {
  2349. COMMON: "https://webim.tim.qq.com",
  2350. PIC: "https://pic.tim.qq.com",
  2351. COS: "https://yun.tim.qq.com"
  2352. },
  2353. OVERSEA_PRODUCTION: {
  2354. COMMON: "https://api.im.qcloud.com",
  2355. PIC: "https://api.im.qcloud.com",
  2356. COS: "https://api.im.qcloud.com"
  2357. },
  2358. SANDBOX: {
  2359. COMMON: "https://events.tim.qq.com",
  2360. PIC: "https://pic.tim.qq.com",
  2361. COS: "https://yun.tim.qq.com"
  2362. },
  2363. TEST: {
  2364. COMMON: "https://test.tim.qq.com",
  2365. PIC: "https://pic.tim.qq.com",
  2366. COS: "https://test.tim.qq.com"
  2367. },
  2368. setCurrent: function () {
  2369. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 3;
  2370. e === go ? this.CURRENT = this.SANDBOX : e === ho ? this.CURRENT = this.TEST : e === mo ? this.CURRENT = this.PRODUCTION : e === fo && (this.CURRENT = this.OVERSEA_PRODUCTION);
  2371. }
  2372. },
  2373. NAME: {
  2374. OPEN_IM: "openim",
  2375. GROUP: "group_open_http_svc",
  2376. FRIEND: "sns",
  2377. PROFILE: "profile",
  2378. RECENT_CONTACT: "recentcontact",
  2379. PIC: "openpic",
  2380. BIG_GROUP_NO_AUTH: "group_open_http_noauth_svc",
  2381. BIG_GROUP_LONG_POLLING: "group_open_long_polling_http_svc",
  2382. BIG_GROUP_LONG_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc",
  2383. IM_OPEN_STAT: "imopenstat",
  2384. WEB_IM: "webim",
  2385. IM_COS_SIGN: "im_cos_sign_svr"
  2386. },
  2387. CMD: {
  2388. ACCESS_LAYER: "accesslayer",
  2389. LOGIN: "login",
  2390. LOGOUT_LONG_POLL: "longpollinglogout",
  2391. LOGOUT_ALL: "logout",
  2392. PORTRAIT_GET: "portrait_get_all",
  2393. PORTRAIT_SET: "portrait_set",
  2394. GET_LONG_POLL_ID: "getlongpollingid",
  2395. LONG_POLL: "longpolling",
  2396. AVCHATROOM_LONG_POLL: "get_msg",
  2397. FRIEND_ADD: "friend_add",
  2398. FRIEND_GET_ALL: "friend_get_all",
  2399. FRIEND_DELETE: "friend_delete",
  2400. RESPONSE_PENDENCY: "friend_response",
  2401. GET_PENDENCY: "pendency_get",
  2402. DELETE_PENDENCY: "pendency_delete",
  2403. GET_GROUP_PENDENCY: "get_pendency",
  2404. GET_BLACKLIST: "black_list_get",
  2405. ADD_BLACKLIST: "black_list_add",
  2406. DELETE_BLACKLIST: "black_list_delete",
  2407. CREATE_GROUP: "create_group",
  2408. GET_JOINED_GROUPS: "get_joined_group_list",
  2409. SEND_MESSAGE: "sendmsg",
  2410. REVOKE_C2C_MESSAGE: "msgwithdraw",
  2411. SEND_GROUP_MESSAGE: "send_group_msg",
  2412. REVOKE_GROUP_MESSAGE: "group_msg_recall",
  2413. GET_GROUP_INFO: "get_group_info",
  2414. GET_GROUP_MEMBER_INFO: "get_specified_group_member_info",
  2415. GET_GROUP_MEMBER_LIST: "get_group_member_info",
  2416. QUIT_GROUP: "quit_group",
  2417. CHANGE_GROUP_OWNER: "change_group_owner",
  2418. DESTROY_GROUP: "destroy_group",
  2419. ADD_GROUP_MEMBER: "add_group_member",
  2420. DELETE_GROUP_MEMBER: "delete_group_member",
  2421. SEARCH_GROUP_BY_ID: "get_group_public_info",
  2422. APPLY_JOIN_GROUP: "apply_join_group",
  2423. HANDLE_APPLY_JOIN_GROUP: "handle_apply_join_group",
  2424. MODIFY_GROUP_INFO: "modify_group_base_info",
  2425. MODIFY_GROUP_MEMBER_INFO: "modify_group_member_info",
  2426. DELETE_GROUP_SYSTEM_MESSAGE: "deletemsg",
  2427. DELETE_GROUP_AT_TIPS: "deletemsg",
  2428. GET_CONVERSATION_LIST: "get",
  2429. PAGING_GET_CONVERSATION_LIST: "page_get",
  2430. DELETE_CONVERSATION: "delete",
  2431. GET_MESSAGES: "getmsg",
  2432. GET_C2C_ROAM_MESSAGES: "getroammsg",
  2433. GET_GROUP_ROAM_MESSAGES: "group_msg_get",
  2434. SET_C2C_MESSAGE_READ: "msgreaded",
  2435. GET_PEER_READ_TIME: "get_peer_read_time",
  2436. SET_GROUP_MESSAGE_READ: "msg_read_report",
  2437. FILE_READ_AND_WRITE_AUTHKEY: "authkey",
  2438. FILE_UPLOAD: "pic_up",
  2439. COS_SIGN: "cos",
  2440. TIM_WEB_REPORT: "tim_web_report",
  2441. BIG_DATA_HALLWAY_AUTH_KEY: "authkey",
  2442. GET_ONLINE_MEMBER_NUM: "get_online_member_num"
  2443. },
  2444. CHANNEL: {
  2445. SOCKET: 1,
  2446. XHR: 2,
  2447. AUTO: 0
  2448. },
  2449. NAME_VERSION: {
  2450. openim: "v4",
  2451. group_open_http_svc: "v4",
  2452. sns: "v4",
  2453. profile: "v4",
  2454. recentcontact: "v4",
  2455. openpic: "v4",
  2456. group_open_http_noauth_svc: "v4",
  2457. group_open_long_polling_http_svc: "v4",
  2458. group_open_long_polling_http_noauth_svc: "v4",
  2459. imopenstat: "v4",
  2460. im_cos_sign_svr: "v4",
  2461. webim: "v4"
  2462. }
  2463. };
  2464. _o.HOST.setCurrent(mo);
  2465. var vo = {
  2466. request: {
  2467. toAccount: "To_Account",
  2468. fromAccount: "From_Account",
  2469. to: "To_Account",
  2470. from: "From_Account",
  2471. groupID: "GroupId",
  2472. avatar: "FaceUrl",
  2473. groupAtUserID: "GroupAt_Account"
  2474. },
  2475. response: {
  2476. GroupId: "groupID",
  2477. Member_Account: "userID",
  2478. MsgList: "messageList",
  2479. SyncFlag: "syncFlag",
  2480. To_Account: "to",
  2481. From_Account: "from",
  2482. MsgSeq: "sequence",
  2483. MsgRandom: "random",
  2484. MsgTimeStamp: "time",
  2485. MsgContent: "content",
  2486. MsgBody: "elements",
  2487. GroupWithdrawInfoArray: "revokedInfos",
  2488. WithdrawC2cMsgNotify: "c2cMessageRevokedNotify",
  2489. C2cWithdrawInfoArray: "revokedInfos",
  2490. C2cReadedReceipt: "c2cMessageReadReceipt",
  2491. LastReadTime: "peerReadTime",
  2492. MsgRand: "random",
  2493. MsgType: "type",
  2494. MsgShow: "messageShow",
  2495. NextMsgSeq: "nextMessageSeq",
  2496. FaceUrl: "avatar",
  2497. ProfileDataMod: "profileModify",
  2498. Profile_Account: "userID",
  2499. ValueBytes: "value",
  2500. ValueNum: "value",
  2501. NoticeSeq: "noticeSequence",
  2502. NotifySeq: "notifySequence",
  2503. MsgFrom_AccountExtraInfo: "messageFromAccountExtraInformation",
  2504. Operator_Account: "operatorID",
  2505. OpType: "operationType",
  2506. ReportType: "operationType",
  2507. UserId: "userID",
  2508. User_Account: "userID",
  2509. List_Account: "userIDList",
  2510. MsgOperatorMemberExtraInfo: "operatorInfo",
  2511. MsgMemberExtraInfo: "memberInfoList",
  2512. ImageUrl: "avatar",
  2513. NickName: "nick",
  2514. MsgGroupNewInfo: "newGroupProfile",
  2515. MsgAppDefinedData: "groupCustomField",
  2516. Owner_Account: "ownerID",
  2517. GroupName: "name",
  2518. GroupFaceUrl: "avatar",
  2519. GroupIntroduction: "introduction",
  2520. GroupNotification: "notification",
  2521. GroupApplyJoinOption: "joinOption",
  2522. MsgKey: "messageKey",
  2523. GroupInfo: "groupProfile",
  2524. ShutupTime: "muteTime",
  2525. Desc: "description",
  2526. Ext: "extension",
  2527. GroupAt_Account: "groupAtUserID"
  2528. },
  2529. ignoreKeyWord: ["C2C", "ID", "USP"]
  2530. },
  2531. yo = "_contextWasUpdated",
  2532. Io = "_contextWasReset",
  2533. Mo = "_a2KeyAndTinyIDUpdated",
  2534. Co = "_specifiedConfigUpdated",
  2535. Eo = "_noticeIsSynchronizing",
  2536. To = "_noticeIsSynchronized",
  2537. Do = "_messageSent",
  2538. So = "_syncMessageProcessing",
  2539. ko = "_syncMessageFinished",
  2540. Ao = "_receiveInstantMessage",
  2541. Oo = "_receiveGroupInstantMessage",
  2542. Ro = "_receveGroupSystemNotice",
  2543. No = "_messageRevoked",
  2544. Lo = "_longPollGetIDFailed",
  2545. wo = "_longPollRequestFailed",
  2546. Po = "_longPollResponseOK",
  2547. Go = "_longPollKickedOut",
  2548. bo = "_longPollMitipuleDeviceKickedOut",
  2549. Uo = "_longPollGetNewC2CNotice",
  2550. qo = "_longPollGetNewGroupMessages",
  2551. Fo = "_longPollGetNewGroupTips",
  2552. xo = "_longPollGetNewGroupAtTips",
  2553. Vo = "_longPollGetNewGroupNotice",
  2554. Ko = "_longPollGetNewFriendMessages",
  2555. Ho = "_longPollProfileModified",
  2556. Bo = " _longpollGroupMessageRevoked",
  2557. jo = "_longpollC2CMessageRevoked",
  2558. $o = "_longpollC2CMessageReadReceipt",
  2559. Yo = "_avlongPollRequestFailed",
  2560. zo = "_avlongPollResponseOK",
  2561. Wo = "_onGroupListUpdated",
  2562. Jo = "_loginSuccess",
  2563. Xo = "_signLogoutExcuting",
  2564. Qo = "_logoutSuccess",
  2565. Zo = "_a2keyExpired",
  2566. er = "_errorHasBeenDetected",
  2567. tr = "_onConversationListUpdated",
  2568. nr = "_onConversationListProfileUpdated",
  2569. or = "_conversationDeleted",
  2570. rr = "onProfileUpdated",
  2571. ir = "joinAVChatRoomSuccess",
  2572. sr = "joinAVChatRoomSuccessNoAuth",
  2573. ar = "_sdkStateReady",
  2574. ur = "_sdkReload";
  2575. function cr(e, t) {
  2576. if ("string" != typeof e && !Array.isArray(e)) throw new TypeError("Expected the input to be `string | string[]`");
  2577. t = Object.assign({
  2578. pascalCase: !1
  2579. }, t);
  2580. var n;
  2581. return 0 === (e = Array.isArray(e) ? e.map(function (e) {
  2582. return e.trim();
  2583. }).filter(function (e) {
  2584. return e.length;
  2585. }).join("-") : e.trim()).length ? "" : 1 === e.length ? t.pascalCase ? e.toUpperCase() : e.toLowerCase() : (e !== e.toLowerCase() && (e = lr(e)), e = e.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, function (e, t) {
  2586. return t.toUpperCase();
  2587. }).replace(/\d+(\w|$)/g, function (e) {
  2588. return e.toUpperCase();
  2589. }), n = e, t.pascalCase ? n.charAt(0).toUpperCase() + n.slice(1) : n);
  2590. }
  2591. var lr = function (e) {
  2592. for (var t = !1, n = !1, o = !1, r = 0; r < e.length; r++) {
  2593. var i = e[r];
  2594. t && /[a-zA-Z]/.test(i) && i.toUpperCase() === i ? (e = e.slice(0, r) + "-" + e.slice(r), t = !1, o = n, n = !0, r++) : n && o && /[a-zA-Z]/.test(i) && i.toLowerCase() === i ? (e = e.slice(0, r - 1) + "-" + e.slice(r - 1), o = n, n = !1, t = !0) : (t = i.toLowerCase() === i && i.toUpperCase() !== i, o = n, n = i.toUpperCase() === i && i.toLowerCase() !== i);
  2595. }
  2596. return e;
  2597. };
  2598. function pr(e, t, n) {
  2599. var o = [],
  2600. r = 0,
  2601. i = function e(t, n) {
  2602. if (++r > 10) return r--, t;
  2603. if (Ie(t)) {
  2604. var i = t.map(function (t) {
  2605. return ve(t) ? e(t, n) : t;
  2606. });
  2607. return r--, i;
  2608. }
  2609. if (ve(t)) {
  2610. var s = (a = t, u = function (e, t) {
  2611. if (!Se(t)) return !1;
  2612. if ((s = t) !== cr(s)) {
  2613. for (var r = !0, i = 0; i < vo.ignoreKeyWord.length; i++) if (t.includes(vo.ignoreKeyWord[i])) {
  2614. r = !1;
  2615. break;
  2616. }
  2617. r && o.push(t);
  2618. }
  2619. var s;
  2620. return Me(n[t]) ? function (e) {
  2621. return "OPPOChannelID" === e ? e : e[0].toUpperCase() + cr(e).slice(1);
  2622. }(t) : n[t];
  2623. }, c = Object.create(null), Object.keys(a).forEach(function (e) {
  2624. var t = u(a[e], e);
  2625. t && (c[t] = a[e]);
  2626. }), c);
  2627. return s = $e(s, function (t, o) {
  2628. return Ie(t) || ve(t) ? e(t, n) : t;
  2629. }), r--, s;
  2630. }
  2631. var a, u, c;
  2632. }(e, t = u(u({}, vo.request), t));
  2633. return o.length > 0 && n.innerEmitter.emit(er, {
  2634. code: qt.CONVERTOR_IRREGULAR_PARAMS,
  2635. message: xn
  2636. }), i;
  2637. }
  2638. function gr(e, t) {
  2639. if (t = u(u({}, vo.response), t), Ie(e)) return e.map(function (e) {
  2640. return ve(e) ? gr(e, t) : e;
  2641. });
  2642. if (ve(e)) {
  2643. var n = (o = e, r = function (e, n) {
  2644. return Me(t[n]) ? cr(n) : t[n];
  2645. }, i = {}, Object.keys(o).forEach(function (e) {
  2646. i[r(o[e], e)] = o[e];
  2647. }), i);
  2648. return n = $e(n, function (e) {
  2649. return Ie(e) || ve(e) ? gr(e, t) : e;
  2650. });
  2651. }
  2652. var o, r, i;
  2653. }
  2654. var hr = function () {
  2655. function e(t) {
  2656. var n = this;
  2657. o(this, e), this.url = "", this.requestData = null, this.method = t.method || "POST", this.callback = function (e) {
  2658. return gr(e = t.decode(e), n._getResponseMap(t));
  2659. }, this._initializeServerMap(), this._initializeURL(t), this._initializeRequestData(t);
  2660. }
  2661. return i(e, [{
  2662. key: "_initializeServerMap",
  2663. value: function () {
  2664. this._serverMap = Object.create(null);
  2665. var e = "";
  2666. for (var t in _o.NAME) if (Object.prototype.hasOwnProperty.call(_o.NAME, t)) switch (e = _o.NAME[t]) {
  2667. case _o.NAME.PIC:
  2668. this._serverMap[e] = _o.HOST.CURRENT.PIC;
  2669. break;
  2670. case _o.NAME.IM_COS_SIGN:
  2671. this._serverMap[e] = _o.HOST.CURRENT.COS;
  2672. break;
  2673. default:
  2674. this._serverMap[e] = _o.HOST.CURRENT.COMMON;
  2675. }
  2676. }
  2677. }, {
  2678. key: "_getHost",
  2679. value: function (e) {
  2680. if (void 0 !== this._serverMap[e]) return this._serverMap[e];
  2681. throw new Ut({
  2682. code: qt.NETWORK_UNDEFINED_SERVER_NAME,
  2683. message: Un
  2684. });
  2685. }
  2686. }, {
  2687. key: "_initializeURL",
  2688. value: function (e) {
  2689. var t = e.serverName,
  2690. n = e.cmd,
  2691. o = this._getHost(t),
  2692. r = "".concat(o, "/").concat(_o.NAME_VERSION[t], "/").concat(t, "/").concat(n);
  2693. r += "?".concat(this._getQueryString(e.queryString)), this.url = r;
  2694. }
  2695. }, {
  2696. key: "getUrl",
  2697. value: function () {
  2698. return this.url.replace(/&reqtime=(\d+)/, "&reqtime=".concat(Math.ceil(+new Date() / 1e3)));
  2699. }
  2700. }, {
  2701. key: "_initializeRequestData",
  2702. value: function (e) {
  2703. var t,
  2704. n = e.requestData;
  2705. t = this._requestDataCleaner(n), this.requestData = e.encode(t);
  2706. }
  2707. }, {
  2708. key: "_requestDataCleaner",
  2709. value: function (e) {
  2710. var t = Array.isArray(e) ? [] : Object.create(null);
  2711. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && Se(o) && null !== e[o] && ("object" !== n(e[o]) ? t[o] = e[o] : t[o] = this._requestDataCleaner.bind(this)(e[o]));
  2712. return t;
  2713. }
  2714. }, {
  2715. key: "_getQueryString",
  2716. value: function (e) {
  2717. var t = [];
  2718. for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && ("function" != typeof e[n] ? t.push("".concat(n, "=").concat(e[n])) : t.push("".concat(n, "=").concat(e[n]())));
  2719. return t.join("&");
  2720. }
  2721. }, {
  2722. key: "_getResponseMap",
  2723. value: function (e) {
  2724. if (e.keyMaps && e.keyMaps.response && Object.keys(e.keyMaps.response).length > 0) return e.keyMaps.response;
  2725. }
  2726. }]), e;
  2727. }();
  2728. function dr(e) {
  2729. this.mixin(e);
  2730. }
  2731. dr.mixin = function (e) {
  2732. var t = e.prototype || e;
  2733. t._isReady = !1, t.ready = function (e) {
  2734. var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
  2735. if (e) return this._isReady ? void (t ? e.call(this) : setTimeout(e, 1)) : (this._readyQueue = this._readyQueue || [], void this._readyQueue.push(e));
  2736. }, t.triggerReady = function () {
  2737. var e = this;
  2738. this._isReady = !0, setTimeout(function () {
  2739. var t = e._readyQueue;
  2740. e._readyQueue = [], t && t.length > 0 && t.forEach(function (e) {
  2741. e.call(this);
  2742. }, e);
  2743. }, 1);
  2744. }, t.resetReady = function () {
  2745. this._isReady = !1, this._readyQueue = [];
  2746. }, t.isReady = function () {
  2747. return this._isReady;
  2748. };
  2749. };
  2750. var mr = function () {
  2751. function e(t) {
  2752. o(this, e), dr.mixin(this), this.tim = t;
  2753. }
  2754. return i(e, [{
  2755. key: "isLoggedIn",
  2756. value: function () {
  2757. return this.tim.context.login === ot.IS_LOGIN || !!this.tim.context.a2Key;
  2758. }
  2759. }, {
  2760. key: "createTransportCapsule",
  2761. value: function (e) {
  2762. var t = this.tim.packageConfig.get(e);
  2763. return t ? new hr(t) : null;
  2764. }
  2765. }, {
  2766. key: "request",
  2767. value: function (e) {
  2768. var t = this.createTransportCapsule(e);
  2769. return t || de.error("unknown transport capsule, please check!", e), this.tim.connectionController.request(t);
  2770. }
  2771. }, {
  2772. key: "emitInnerEvent",
  2773. value: function (e, t) {
  2774. this.tim.innerEmitter.emit(e, t);
  2775. }
  2776. }, {
  2777. key: "emitOuterEvent",
  2778. value: function (e, t) {
  2779. this.tim.outerEmitter.emit(e, t);
  2780. }
  2781. }, {
  2782. key: "reset",
  2783. value: function () {
  2784. de.warn(["method: IMController.reset() method must be implemented"].join());
  2785. }
  2786. }, {
  2787. key: "probeNetwork",
  2788. value: function () {
  2789. return this.tim.netMonitor.probe();
  2790. }
  2791. }, {
  2792. key: "getNetworkType",
  2793. value: function () {
  2794. return this.tim.netMonitor.getNetworkType();
  2795. }
  2796. }, {
  2797. key: "getPlatform",
  2798. value: function () {
  2799. return H;
  2800. }
  2801. }]), e;
  2802. }(),
  2803. fr = function () {
  2804. function e(t, n) {
  2805. o(this, e), this.data = t, this._innerEmitter = n, this.defaultData = {}, Object.assign(this.defaultData, t), this.initGetterAndSetter();
  2806. }
  2807. return i(e, [{
  2808. key: "initGetterAndSetter",
  2809. value: function () {
  2810. var e = this,
  2811. t = function (t) {
  2812. Object.defineProperty(e, t, {
  2813. enumerable: !0,
  2814. configurable: !0,
  2815. get: function () {
  2816. return e.data[t];
  2817. },
  2818. set: function (n) {
  2819. e.data[t] !== n && (e.data[t] = n, e.onChange.bind(e)(t, n));
  2820. }
  2821. });
  2822. };
  2823. for (var n in e.data) Object.prototype.hasOwnProperty.call(e.data, n) && t(n);
  2824. }
  2825. }, {
  2826. key: "onChange",
  2827. value: function (e, t) {
  2828. this._innerEmitter.emit(yo, {
  2829. key: e,
  2830. value: t
  2831. });
  2832. }
  2833. }, {
  2834. key: "reset",
  2835. value: function () {
  2836. for (var e in de.log("Context.reset"), this.data) Object.prototype.hasOwnProperty.call(this.data, e) && (this.data[e] = this.defaultData.hasOwnProperty(e) ? this.defaultData[e] : null);
  2837. }
  2838. }]), e;
  2839. }(),
  2840. _r = function (e) {
  2841. c(n, e);
  2842. var t = v(n);
  2843. function n(e) {
  2844. var r;
  2845. o(this, n);
  2846. var i = (r = t.call(this, e)).tim.loginInfo;
  2847. return r._context = new fr({
  2848. login: ot.IS_NOT_LOGIN,
  2849. SDKAppID: i.SDKAppID,
  2850. appIDAt3rd: null,
  2851. accountType: i.accountType,
  2852. identifier: i.identifier,
  2853. tinyID: null,
  2854. identifierNick: i.identifierNick,
  2855. userSig: i.userSig,
  2856. a2Key: null,
  2857. contentType: "json",
  2858. apn: 1,
  2859. unlimitedAVChatRoom: i.unlimitedAVChatRoom,
  2860. scene: i.scene,
  2861. oversea: i.oversea,
  2862. instanceID: i.instanceID
  2863. }, r.tim.innerEmitter), r._initListener(), r;
  2864. }
  2865. return i(n, [{
  2866. key: "reset",
  2867. value: function () {
  2868. this._context.reset(), this.emitInnerEvent(Io);
  2869. }
  2870. }, {
  2871. key: "_initListener",
  2872. value: function () {
  2873. this.tim.innerEmitter.on(yo, this._onContextMemberChange, this), this.tim.innerEmitter.on(Jo, this._updateA2KeyAndTinyID, this);
  2874. }
  2875. }, {
  2876. key: "_updateA2KeyAndTinyID",
  2877. value: function (e) {
  2878. var t = e.data,
  2879. n = t.a2Key,
  2880. o = t.tinyID;
  2881. this._context.a2Key = n, this._context.tinyID = o, this.emitInnerEvent(Mo), this.triggerReady();
  2882. }
  2883. }, {
  2884. key: "getContext",
  2885. value: function () {
  2886. return this._context;
  2887. }
  2888. }, {
  2889. key: "_onContextMemberChange",
  2890. value: function (e) {
  2891. var t = e.data,
  2892. n = t.key,
  2893. o = t.value;
  2894. ("tinyID" === n || "a2Key" === n) && (o.length <= 0 ? this._context.login = ot.IS_NOT_LOGIN : this._context.login = null !== this._context.a2Key ? ot.IS_LOGIN : ot.IS_NOT_LOGIN);
  2895. }
  2896. }]), n;
  2897. }(mr),
  2898. vr = function e(t) {
  2899. o(this, e), this.code = 0, this.data = t || {};
  2900. },
  2901. yr = null,
  2902. Ir = function (e) {
  2903. yr = e;
  2904. },
  2905. Mr = function (e) {
  2906. return e instanceof vr ? (de.warn("IMPromise.resolve 此函数会自动用options创建IMResponse实例,调用侧不需创建,建议修改!"), Promise.resolve(e)) : Promise.resolve(new vr(e));
  2907. },
  2908. Cr = function (t) {
  2909. var n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
  2910. if (t instanceof Ut) return n && null !== yr && yr.emit(e.ERROR, t), Promise.reject(t);
  2911. if (t instanceof Error) {
  2912. var o = new Ut({
  2913. code: qt.UNCAUGHT_ERROR,
  2914. message: t.message
  2915. });
  2916. return n && null !== yr && yr.emit(e.ERROR, o), Promise.reject(o);
  2917. }
  2918. if (Me(t) || Me(t.code) || Me(t.message)) de.error("IMPromise.reject 必须指定code(错误码)和message(错误信息)!!!");else {
  2919. if (fe(t.code) && _e(t.message)) {
  2920. var r = new Ut(t);
  2921. return n && null !== yr && yr.emit(e.ERROR, r), Promise.reject(r);
  2922. }
  2923. de.error("IMPromise.reject code(错误码)必须为数字,message(错误信息)必须为字符串!!!");
  2924. }
  2925. },
  2926. Er = "sdkReady",
  2927. Tr = "login",
  2928. Dr = "longpolling",
  2929. Sr = "longpollingAV",
  2930. kr = "sendMessage",
  2931. Ar = "sendMessageC2C",
  2932. Or = "sendMessageGroupWork",
  2933. Rr = "sendMessageGroupPublic",
  2934. Nr = "sendMessageGroupMeeting",
  2935. Lr = "sendMessageGroupAV",
  2936. wr = "messageReceived",
  2937. Pr = "messageReceivedAV",
  2938. Gr = "initConversationList",
  2939. br = "initGroupList",
  2940. Ur = "upload",
  2941. qr = function () {
  2942. function e(t) {
  2943. o(this, e), this.SDKAppID = "", this.version = "", this.tinyID = "", this.userID = "", this.platform = "", this.method = t, this.time = "", this.startts = Date.now(), this.endts = 0, this.timespan = 0, this.codeint = 0, this.message = "", this.text = "", this.msgType = "", this.networkType = "", this.platform = "", this.scene = "", this._sentFlag = !1, this.instanceID = "", this.host = function () {
  2944. var e = "unknown";
  2945. if (ie && (e = "mac"), re && (e = "windows"), W && (e = "ios"), J && (e = "android"), V) try {
  2946. var t = K.getSystemInfoSync().platform;
  2947. void 0 !== t && (e = t);
  2948. } catch (n) {}
  2949. return e;
  2950. }(), this.mpLibVersion = function () {
  2951. if (V) try {
  2952. var e;
  2953. return void 0 === (e = x ? my.getSystemInfoSync().version : K.getSystemInfoSync().SDKVersion) ? "-" : e;
  2954. } catch (t) {
  2955. return "-";
  2956. }
  2957. return "-";
  2958. }();
  2959. }
  2960. return i(e, [{
  2961. key: "setCommonInfo",
  2962. value: function (e) {
  2963. var t = e.SDKAppID,
  2964. n = e.version,
  2965. o = e.tinyID,
  2966. r = e.userID,
  2967. i = e.platform,
  2968. s = e.scene,
  2969. a = e.instanceID;
  2970. this.SDKAppID = "".concat(t), this.version = "".concat(n), this.tinyID = o, this.userID = r, this.platform = i, this.scene = s, this.time = Ne(), this.instanceID = a, this.startts && this.endts && !this.timespan && (this.timespan = Math.abs(this.endts - this.startts));
  2971. }
  2972. }, {
  2973. key: "setEnd",
  2974. value: function () {
  2975. var e = this,
  2976. t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
  2977. this._sentFlag || (this.endts = Date.now(), t ? (this._sentFlag = !0, this._eventStatController.pushIn(this)) : setTimeout(function () {
  2978. e._sentFlag = !0, e._eventStatController.pushIn(e);
  2979. }, 0));
  2980. }
  2981. }, {
  2982. key: "setError",
  2983. value: function (e, t, n) {
  2984. return e instanceof Error ? (this._sentFlag || (this.setNetworkType(n), t ? (e.code && this.setCode(e.code), e.message && this.setMessage(e.message)) : (this.setCode(qt.NO_NETWORK), this.setMessage(Fn))), this) : (de.warn("SSOLogData.setError value not instanceof Error, please check!"), this);
  2985. }
  2986. }, {
  2987. key: "setCode",
  2988. value: function (e) {
  2989. return Me(e) || this._sentFlag || ("ECONNABORTED" === e && (this.codeint = 103), fe(e) ? this.codeint = e : de.warn("SSOLogData.setCode value not a number, please check!", e, n(e))), this;
  2990. }
  2991. }, {
  2992. key: "setMessage",
  2993. value: function (e) {
  2994. return Me(e) || this._sentFlag ? this : _e(e) ? (this.message = e, this) : this;
  2995. }
  2996. }, {
  2997. key: "setText",
  2998. value: function (e) {
  2999. return fe(e) ? this.text = e.toString() : _e(e) && (this.text = e), this;
  3000. }
  3001. }, {
  3002. key: "setMessageType",
  3003. value: function (e) {
  3004. return this.msgType = e, this;
  3005. }
  3006. }, {
  3007. key: "setNetworkType",
  3008. value: function (e) {
  3009. return Me(e) ? de.warn("SSOLogData.setNetworkType value is undefined, please check!") : this.networkType = e, this;
  3010. }
  3011. }], [{
  3012. key: "bindController",
  3013. value: function (t) {
  3014. e.prototype._eventStatController = t;
  3015. }
  3016. }]), e;
  3017. }(),
  3018. Fr = "sdkConstruct",
  3019. xr = "sdkReady",
  3020. Vr = "accessLayer",
  3021. Kr = "login",
  3022. Hr = "logout",
  3023. Br = "kickedOut",
  3024. jr = "registerPlugin",
  3025. $r = "getCosAuthKey",
  3026. Yr = "upload",
  3027. zr = "sendMessage",
  3028. Wr = "sendComboMessage",
  3029. Jr = "getC2CRoamingMessages",
  3030. Xr = "getGroupRoamingMessages",
  3031. Qr = "revokeMessage",
  3032. Zr = "setC2CMessageRead",
  3033. ei = "setGroupMessageRead",
  3034. ti = "emptyMessageBody",
  3035. ni = "getPeerReadTime",
  3036. oi = "getConversationList",
  3037. ri = "getConversationProfile",
  3038. ii = "deleteConversation",
  3039. si = "getConversationListInStorage",
  3040. ai = "syncConversationList",
  3041. ui = "createGroup",
  3042. ci = "applyJoinGroup",
  3043. li = "joinAVChatRoomSilently",
  3044. pi = "quitGroup",
  3045. gi = "searchGroupByID",
  3046. hi = "changeGroupOwner",
  3047. di = "handleGroupApplication",
  3048. mi = "setMessageRemindType",
  3049. fi = "dismissGroup",
  3050. _i = "updateGroupProfile",
  3051. vi = "getGroupList",
  3052. yi = "getGroupProfile",
  3053. Ii = "getGroupListInStorage",
  3054. Mi = "getGroupLastSequence",
  3055. Ci = "getGroupMemberList",
  3056. Ei = "getGroupMemberProfile",
  3057. Ti = "addGroupMember",
  3058. Di = "deleteGroupMember",
  3059. Si = "setGroupMemberMuteTime",
  3060. ki = "setGroupMemberNameCard",
  3061. Ai = "setGroupMemberRole",
  3062. Oi = "setGroupMemberCustomField",
  3063. Ri = "getGroupOnlineMemberCount",
  3064. Ni = "getLongPollID",
  3065. Li = "longPollingError",
  3066. wi = "networkJitter",
  3067. Pi = "sdkReload",
  3068. Gi = "messageLoss",
  3069. bi = "messageStacked",
  3070. Ui = "getUserProfile",
  3071. qi = "updateMyProfile",
  3072. Fi = "getBlacklist",
  3073. xi = "addToBlacklist",
  3074. Vi = "removeFromBlacklist",
  3075. Ki = "mpHideToShow",
  3076. Hi = "callbackFunctionError",
  3077. Bi = "exceptionError",
  3078. ji = function (n) {
  3079. c(s, n);
  3080. var r = v(s);
  3081. function s(e) {
  3082. var t;
  3083. return o(this, s), !0 === (t = r.call(this, e)).tim.context.oversea && _o.HOST.setCurrent(fo), t._initializeListener(), t;
  3084. }
  3085. return i(s, [{
  3086. key: "login",
  3087. value: function (e) {
  3088. if (this.isLoggedIn()) {
  3089. var t = "您已经登录账号".concat(e.identifier, "!如需切换账号登录,请先调用 logout 接口登出,再调用 login 接口登录。");
  3090. return de.warn(t), Mr({
  3091. actionStatus: "OK",
  3092. errorCode: 0,
  3093. errorInfo: t,
  3094. repeatLogin: !0
  3095. });
  3096. }
  3097. de.log("SignController.login userID=".concat(e.identifier)), de.time(Tr);
  3098. var n = this._checkLoginInfo(e);
  3099. return Xe(n) ? (this.tim.context.identifier = e.identifier, this.tim.context.userSig = e.userSig, this.tim.context.identifier && this.tim.context.userSig ? this._accessLayer() : void 0) : Cr(n);
  3100. }
  3101. }, {
  3102. key: "_isLoginCurrentUser",
  3103. value: function (e) {
  3104. return this.tim.context.identifier === e;
  3105. }
  3106. }, {
  3107. key: "_initializeListener",
  3108. value: function () {
  3109. var e = this.tim.innerEmitter;
  3110. e.on(Go, this._onMultipleAccountKickedOut, this), e.on(bo, this._onMultipleDeviceKickedOut, this), e.on(Zo, this._onUserSigExpired, this);
  3111. }
  3112. }, {
  3113. key: "_accessLayer",
  3114. value: function () {
  3115. var e = this,
  3116. t = new qr(Vr);
  3117. return de.log("SignController._accessLayer."), this.request({
  3118. name: "accessLayer",
  3119. action: "query"
  3120. }).then(function (n) {
  3121. return t.setNetworkType(e.getNetworkType()).setText(n.data.webImAccessLayer).setEnd(), de.log("SignController._accessLayer ok. webImAccessLayer=".concat(n.data.webImAccessLayer)), e.tim.context.oversea || n.data.webImAccessLayer !== go || _o.HOST.setCurrent(n.data.webImAccessLayer), e._login();
  3122. }).catch(function (n) {
  3123. return e.probeNetwork().then(function (o) {
  3124. var r = y(o, 2),
  3125. i = r[0],
  3126. s = r[1];
  3127. t.setError(n, i, s).setEnd(!0), e.tim.eventStatController.reportAtOnce();
  3128. }), de.error("SignController._accessLayer failed. error:", n), Cr(n);
  3129. });
  3130. }
  3131. }, {
  3132. key: "_login",
  3133. value: function () {
  3134. var e = this,
  3135. t = new qr(Kr);
  3136. return this.request({
  3137. name: "login",
  3138. action: "query"
  3139. }).then(function (n) {
  3140. var o = null;
  3141. if (!n.data.tinyID) throw o = new Ut({
  3142. code: qt.NO_TINYID,
  3143. message: Ht
  3144. }), t.setError(o, !0, e.getNetworkType()).setEnd(), o;
  3145. if (!n.data.a2Key) throw o = new Ut({
  3146. code: qt.NO_A2KEY,
  3147. message: Bt
  3148. }), t.setError(o, !0, e.getNetworkType()).setEnd(), o;
  3149. return t.setNetworkType(e.getNetworkType()).setText("".concat(e.tim.loginInfo.identifier)).setEnd(), de.log("SignController.login ok. userID=".concat(e.tim.loginInfo.identifier, " loginCost=").concat(de.timeEnd(Tr), "ms")), e.emitInnerEvent(Jo, {
  3150. a2Key: n.data.a2Key,
  3151. tinyID: n.data.tinyID
  3152. }), Mr(n.data);
  3153. }).catch(function (n) {
  3154. return e.probeNetwork().then(function (e) {
  3155. var o = y(e, 2),
  3156. r = o[0],
  3157. i = o[1];
  3158. t.setError(n, r, i).setEnd(!0);
  3159. }), de.error("SignController.login failed. error:", n), Cr(n);
  3160. });
  3161. }
  3162. }, {
  3163. key: "logout",
  3164. value: function () {
  3165. return this.isLoggedIn() ? (new qr(Hr).setNetworkType(this.getNetworkType()).setText("userID=".concat(this.tim.loginInfo.identifier, " type=").concat("longPollLogout")).setEnd(!0), de.info("SignController.logout"), this.emitInnerEvent(Xo), this._logout(Mt).then(this._emitLogoutSuccess.bind(this)).catch(this._emitLogoutSuccess.bind(this))) : Cr({
  3166. code: qt.USER_NOT_LOGGED_IN,
  3167. message: jt
  3168. });
  3169. }
  3170. }, {
  3171. key: "_logout",
  3172. value: function (e) {
  3173. var t = this.tim.notificationController,
  3174. n = e === It ? "logout" : "longPollLogout",
  3175. o = e === It ? {
  3176. name: n,
  3177. action: "query"
  3178. } : {
  3179. name: n,
  3180. action: "query",
  3181. param: {
  3182. longPollID: t.getLongPollID()
  3183. }
  3184. };
  3185. return this.request(o).catch(function (e) {
  3186. return de.error("SignController._logout error:", e), Cr(e);
  3187. });
  3188. }
  3189. }, {
  3190. key: "_checkLoginInfo",
  3191. value: function (e) {
  3192. var t = 0,
  3193. n = "";
  3194. return null === e.SDKAppID ? (t = qt.NO_SDKAPPID, n = Ft) : null === e.accountType ? (t = qt.NO_ACCOUNT_TYPE, n = xt) : null === e.identifier ? (t = qt.NO_IDENTIFIER, n = Vt) : null === e.userSig && (t = qt.NO_USERSIG, n = Kt), Xe(t) || Xe(n) ? {} : {
  3195. code: t,
  3196. message: n
  3197. };
  3198. }
  3199. }, {
  3200. key: "_emitLogoutSuccess",
  3201. value: function () {
  3202. return this.emitInnerEvent(Qo), Mr({});
  3203. }
  3204. }, {
  3205. key: "_onMultipleAccountKickedOut",
  3206. value: function () {
  3207. var n = this;
  3208. new qr(Br).setNetworkType(this.getNetworkType()).setText(t.KICKED_OUT_MULT_ACCOUNT).setEnd(!0), de.warn("SignController._onMultipleAccountKickedOut kicked out. userID=".concat(this.tim.loginInfo.identifier)), this.tim.logout().then(function () {
  3209. n.emitOuterEvent(e.KICKED_OUT, {
  3210. type: t.KICKED_OUT_MULT_ACCOUNT
  3211. });
  3212. });
  3213. }
  3214. }, {
  3215. key: "_onMultipleDeviceKickedOut",
  3216. value: function () {
  3217. var n = this;
  3218. new qr(Br).setNetworkType(this.getNetworkType()).setText(t.KICKED_OUT_MULT_DEVICE).setEnd(!0), de.warn("SignController._onMultipleDeviceKickedOut kicked out. userID=".concat(this.tim.loginInfo.identifier)), this.tim.logout().then(function () {
  3219. n.emitOuterEvent(e.KICKED_OUT, {
  3220. type: t.KICKED_OUT_MULT_DEVICE
  3221. });
  3222. });
  3223. }
  3224. }, {
  3225. key: "_onUserSigExpired",
  3226. value: function () {
  3227. new qr(Br).setNetworkType(this.getNetworkType()).setText(t.KICKED_OUT_USERSIG_EXPIRED).setEnd(!0), de.warn("SignController._onUserSigExpired: userSig 签名过期被踢下线"), this.emitOuterEvent(e.KICKED_OUT, {
  3228. type: t.KICKED_OUT_USERSIG_EXPIRED
  3229. }), this.tim.resetSDK();
  3230. }
  3231. }, {
  3232. key: "reset",
  3233. value: function () {
  3234. de.info("SignController.reset");
  3235. }
  3236. }]), s;
  3237. }(mr),
  3238. $i = function e() {
  3239. o(this, e);
  3240. },
  3241. Yi = function (e) {
  3242. c(n, e);
  3243. var t = v(n);
  3244. function n() {
  3245. var e;
  3246. return o(this, n), (e = t.call(this)).retry = 2, e._request = e.promisify(K.request), e;
  3247. }
  3248. return i(n, [{
  3249. key: "request",
  3250. value: function (e) {
  3251. return this._checkOptions(e), this._initOptions(e), e = u(u({}, e), {}, {
  3252. responseType: "text"
  3253. }), this._requestWithRetry(e);
  3254. }
  3255. }, {
  3256. key: "_requestWithRetry",
  3257. value: function (e) {
  3258. var t = this,
  3259. n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
  3260. return this._request(e).then(this._handleResolve).catch(function (o) {
  3261. if (_e(o.errMsg)) {
  3262. if (o.errMsg.includes("abort")) return Mr({});
  3263. if (o.errMsg.includes("timeout")) return t.retry > 0 && n < t.retry ? t._requestWithRetry(e, ++n) : Cr(new Ut({
  3264. code: qt.NETWORK_TIMEOUT,
  3265. message: o.errMsg
  3266. }));
  3267. if (o.errMsg.includes("fail")) return t.retry > 0 && n < t.retry ? t._requestWithRetry(e, ++n) : Cr(new Ut({
  3268. code: qt.NETWORK_ERROR,
  3269. message: o.errMsg
  3270. }));
  3271. }
  3272. return Cr(new Ut(u({
  3273. code: qt.UNCAUGHT_ERROR,
  3274. message: o.message
  3275. }, o)));
  3276. });
  3277. }
  3278. }, {
  3279. key: "_handleResolve",
  3280. value: function (e) {
  3281. var t = e.data,
  3282. n = t.error_code,
  3283. o = t.ErrorCode;
  3284. return fe(n) && (o = n), o !== nt.SUCCESS && (e.data.ErrorCode = Number("".concat(o))), e;
  3285. }
  3286. }, {
  3287. key: "promisify",
  3288. value: function (e) {
  3289. return function (t) {
  3290. return new Promise(function (n, o) {
  3291. var r = e(Object.assign({}, t, {
  3292. success: n,
  3293. fail: o
  3294. }));
  3295. t.updateAbort && t.updateAbort(function () {
  3296. r && Ee(r.abort) && r.abort();
  3297. });
  3298. });
  3299. };
  3300. }
  3301. }]), n;
  3302. }(function () {
  3303. function e() {
  3304. o(this, e);
  3305. }
  3306. return i(e, [{
  3307. key: "request",
  3308. value: function (e) {
  3309. console.warn("请注意: ConnectionBase.request() 方法必须被派生类重写:");
  3310. }
  3311. }, {
  3312. key: "_checkOptions",
  3313. value: function (e) {
  3314. if (!1 == !!e.url) throw new Ut({
  3315. code: qt.NETWORK_BASE_OPTIONS_NO_URL,
  3316. message: bn
  3317. });
  3318. }
  3319. }, {
  3320. key: "_initOptions",
  3321. value: function (e) {
  3322. e.method = ["POST", "GET", "PUT", "DELETE", "OPTION"].indexOf(e.method) >= 0 ? e.method : "POST", e.dataType = e.dataType || "json", e.responseType = e.responseType || "json";
  3323. }
  3324. }]), e;
  3325. }()),
  3326. zi = function e() {
  3327. o(this, e);
  3328. },
  3329. Wi = function () {
  3330. function e() {
  3331. o(this, e), this.request = 0, this.success = 0, this.fail = 0, this.reportRate = 10, this.requestTimeCost = [];
  3332. }
  3333. return i(e, [{
  3334. key: "report",
  3335. value: function () {
  3336. if (1 !== this.request) {
  3337. if (this.request % this.reportRate != 0) return null;
  3338. var e = this.avgRequestTime(),
  3339. t = "runLoop reports: success=".concat(this.success, ",fail=").concat(this.fail, ",total=").concat(this.request, ",avg=").concat(e, ",cur=").concat(this.requestTimeCost[this.requestTimeCost.length - 1], ",max=").concat(Math.max.apply(null, this.requestTimeCost), ",min=").concat(Math.min.apply(null, this.requestTimeCost));
  3340. de.log(t);
  3341. }
  3342. }
  3343. }, {
  3344. key: "setRequestTime",
  3345. value: function (e, t) {
  3346. var n = Math.abs(t - e);
  3347. 100 === this.requestTimeCost.length && this.requestTimeCost.shift(), this.requestTimeCost.push(n);
  3348. }
  3349. }, {
  3350. key: "avgRequestTime",
  3351. value: function () {
  3352. for (var e, t = this.requestTimeCost.length, n = 0, o = 0; o < t; o++) n += this.requestTimeCost[o];
  3353. return e = n / t, Math.round(100 * e) / 100;
  3354. }
  3355. }]), e;
  3356. }(),
  3357. Ji = function () {
  3358. function e(t) {
  3359. o(this, e), this._initializeOptions(t), this._initializeMembers(), this.status = new Wi();
  3360. }
  3361. return i(e, [{
  3362. key: "destructor",
  3363. value: function () {
  3364. clearTimeout(this._seedID);
  3365. var e = this._index();
  3366. for (var t in this) Object.prototype.hasOwnProperty.call(this, t) && (this[t] = null);
  3367. return e;
  3368. }
  3369. }, {
  3370. key: "setIndex",
  3371. value: function (e) {
  3372. this._index = e;
  3373. }
  3374. }, {
  3375. key: "isRunning",
  3376. value: function () {
  3377. return !this._stoped;
  3378. }
  3379. }, {
  3380. key: "getIndex",
  3381. value: function () {
  3382. return this._index;
  3383. }
  3384. }, {
  3385. key: "_initializeOptions",
  3386. value: function (e) {
  3387. this.options = e;
  3388. }
  3389. }, {
  3390. key: "_initializeMembers",
  3391. value: function () {
  3392. this._index = -1, this._seedID = 0, this._requestStatus = !1, this._stoped = !1, this._intervalTime = 0, this._intervalIncreaseStep = 1e3, this._intervalDecreaseStep = 1e3, this._intervalTimeMax = 5e3, this._protectTimeout = 3e3, this._getNoticeSeq = this.options.getNoticeSeq, this._retryCount = 0, this._responseTime = Date.now(), this._responseTimeThreshold = 2e3, this.requestor = new Yi(), this.abort = null;
  3393. }
  3394. }, {
  3395. key: "start",
  3396. value: function () {
  3397. 0 === this._seedID ? (this._stoped = !1, this._send()) : de.log('WXRunLoop.start(): WXRunLoop is running now, if you want to restart runLoop , please run "stop()" first.');
  3398. }
  3399. }, {
  3400. key: "_reset",
  3401. value: function () {
  3402. de.log("WXRunLoop.reset(), long poll _intervalMaxRate", this._intervalMaxRate), this.stop(), this.start();
  3403. }
  3404. }, {
  3405. key: "_intervalTimeIncrease",
  3406. value: function () {
  3407. this._intervalTime !== this._responseTimeThreshold && (this._intervalTime < this._responseTimeThreshold && (this._intervalTime += this._intervalIncreaseStep), this._intervalTime > this._responseTimeThreshold && (this._intervalTime = this._responseTimeThreshold));
  3408. }
  3409. }, {
  3410. key: "_intervalTimeDecrease",
  3411. value: function () {
  3412. 0 !== this._intervalTime && (this._intervalTime > 0 && (this._intervalTime -= this._intervalDecreaseStep), this._intervalTime < 0 && (this._intervalTime = 0));
  3413. }
  3414. }, {
  3415. key: "_intervalTimeAdjustment",
  3416. value: function () {
  3417. var e = Date.now();
  3418. 100 * Math.floor((e - this._responseTime) / 100) <= this._responseTimeThreshold ? this._intervalTimeIncrease() : this._intervalTimeDecrease(), this._responseTime = e;
  3419. }
  3420. }, {
  3421. key: "_intervalTimeAdjustmentBaseOnResponseData",
  3422. value: function (e) {
  3423. e.ErrorCode === nt.SUCCESS ? this._intervalTimeDecrease() : this._intervalTimeIncrease();
  3424. }
  3425. }, {
  3426. key: "_send",
  3427. value: function () {
  3428. var e = this;
  3429. if (!0 !== this._requestStatus) {
  3430. var t = this;
  3431. this._requestStatus = !0, this.status.request++, "function" == typeof this.options.before && this.options.before(t.options.pack.requestData);
  3432. var n = Date.now(),
  3433. o = 0;
  3434. this.requestor.request({
  3435. url: t.options.pack.getUrl(),
  3436. data: t.options.pack.requestData,
  3437. method: t.options.pack.method,
  3438. updateAbort: function (t) {
  3439. e.abort = t;
  3440. }
  3441. }).then(function (r) {
  3442. if (t._intervalTimeAdjustmentBaseOnResponseData.bind(e)(r.data), t._retryCount > 0 && (t._retryCount = 0), e.status.success++, o = Date.now(), e.status.setRequestTime(n, o), r.data.timecost = o - n, "function" == typeof t.options.success) try {
  3443. e.options.success({
  3444. pack: e.options.pack,
  3445. error: !1,
  3446. data: e.options.pack.callback(r.data)
  3447. });
  3448. } catch (i) {
  3449. de.warn("WXRunLoop._send(), error:", i);
  3450. }
  3451. t._requestStatus = !1, !1 === t._stoped && (t._seedID = setTimeout(t._send.bind(t), t._intervalTime)), e.status.report();
  3452. }).catch(function (r) {
  3453. if (e.status.fail++, t._retryCount++, t._intervalTimeAdjustment.bind(e)(), !1 === t._stoped && (t._seedID = setTimeout(t._send.bind(t), t._intervalTime)), t._requestStatus = !1, "function" == typeof t.options.fail) try {
  3454. e.options.fail({
  3455. pack: e.options.pack,
  3456. error: r,
  3457. data: !1
  3458. });
  3459. } catch (i) {
  3460. de.warn("WXRunLoop._send(), fail callback error:", i), de.error(i);
  3461. }
  3462. o = Date.now(), e.status.setRequestTime(n, o), e.status.report();
  3463. });
  3464. }
  3465. }
  3466. }, {
  3467. key: "stop",
  3468. value: function () {
  3469. this._clearAllTimeOut(), this._stoped = !0;
  3470. }
  3471. }, {
  3472. key: "_clearAllTimeOut",
  3473. value: function () {
  3474. clearTimeout(this._seedID), this._seedID = 0;
  3475. }
  3476. }]), e;
  3477. }(),
  3478. Xi = function () {
  3479. function e(t) {
  3480. o(this, e), this.tim = t, this.httpConnection = V ? new Yi() : new $i(), this.keepAliveConnections = [];
  3481. }
  3482. return i(e, [{
  3483. key: "initializeListener",
  3484. value: function () {
  3485. this.tim.innerEmitter.on(Xo, this._stopAllRunLoop, this);
  3486. }
  3487. }, {
  3488. key: "request",
  3489. value: function (e) {
  3490. var t = {
  3491. url: e.url,
  3492. data: e.requestData,
  3493. method: e.method,
  3494. callback: e.callback
  3495. };
  3496. return this.httpConnection.request(t).then(function (t) {
  3497. return t.data = e.callback(t.data), t.data.errorCode !== nt.SUCCESS ? Cr(new Ut({
  3498. code: t.data.errorCode,
  3499. message: t.data.errorInfo
  3500. })) : t;
  3501. });
  3502. }
  3503. }, {
  3504. key: "createRunLoop",
  3505. value: function (e) {
  3506. var t = this.createKeepAliveConnection(e);
  3507. return t.setIndex(this.keepAliveConnections.push(t) - 1), t;
  3508. }
  3509. }, {
  3510. key: "stopRunLoop",
  3511. value: function (e) {
  3512. e.stop();
  3513. }
  3514. }, {
  3515. key: "_stopAllRunLoop",
  3516. value: function () {
  3517. for (var e = this.keepAliveConnections.length, t = 0; t < e; t++) this.keepAliveConnections[t].stop();
  3518. }
  3519. }, {
  3520. key: "destroyRunLoop",
  3521. value: function (e) {
  3522. e.stop();
  3523. var t = e.destructor();
  3524. this.keepAliveConnections.slice(t, 1);
  3525. }
  3526. }, {
  3527. key: "startRunLoopExclusive",
  3528. value: function (e) {
  3529. for (var t = e.getIndex(), n = 0; n < this.keepAliveConnections.length; n++) n !== t && this.keepAliveConnections[n].stop();
  3530. e.start();
  3531. }
  3532. }, {
  3533. key: "createKeepAliveConnection",
  3534. value: function (e) {
  3535. return V ? new Ji(e) : (this.tim.options.runLoopNetType === yt || this.tim.options.runLoopNetType, new zi(e));
  3536. }
  3537. }, {
  3538. key: "clearAll",
  3539. value: function () {
  3540. this.conn.cancelAll();
  3541. }
  3542. }, {
  3543. key: "reset",
  3544. value: function () {
  3545. this.keepAliveConnections = [];
  3546. }
  3547. }]), e;
  3548. }(),
  3549. Qi = function () {
  3550. function t(e) {
  3551. o(this, t), this.tim = e, this.tim.innerEmitter.on(er, this._onErrorDetected, this);
  3552. }
  3553. return i(t, [{
  3554. key: "_onErrorDetected",
  3555. value: function (t) {
  3556. var n = t.data;
  3557. new qr(Bi).setText("code=".concat(n.code, " message=").concat(n.message)).setNetworkType(this.tim.netMonitor.getNetworkType()).setEnd(), n.code ? de.warn("Oops! code:".concat(n.code, " message:").concat(n.message)) : de.warn("Oops! message:".concat(n.message, " stack:").concat(n.stack)), this.tim.outerEmitter.emit(e.ERROR, n);
  3558. }
  3559. }]), t;
  3560. }(),
  3561. Zi = function () {
  3562. function e(n) {
  3563. var r = this;
  3564. o(this, e), Xe(n) || (this.userID = n.userID || "", this.nick = n.nick || "", this.gender = n.gender || "", this.birthday = n.birthday || 0, this.location = n.location || "", this.selfSignature = n.selfSignature || "", this.allowType = n.allowType || t.ALLOW_TYPE_ALLOW_ANY, this.language = n.language || 0, this.avatar = n.avatar || "", this.messageSettings = n.messageSettings || 0, this.adminForbidType = n.adminForbidType || t.FORBID_TYPE_NONE, this.level = n.level || 0, this.role = n.role || 0, this.lastUpdatedTime = 0, this.profileCustomField = [], Xe(n.profileCustomField) || n.profileCustomField.forEach(function (e) {
  3565. r.profileCustomField.push({
  3566. key: e.key,
  3567. value: e.value
  3568. });
  3569. }));
  3570. }
  3571. return i(e, [{
  3572. key: "validate",
  3573. value: function (e) {
  3574. var t = !0,
  3575. n = "";
  3576. if (Xe(e)) return {
  3577. valid: !1,
  3578. tips: "empty options"
  3579. };
  3580. if (e.profileCustomField) for (var o = e.profileCustomField.length, r = null, i = 0; i < o; i++) {
  3581. if (r = e.profileCustomField[i], !_e(r.key) || -1 === r.key.indexOf("Tag_Profile_Custom")) return {
  3582. valid: !1,
  3583. tips: "自定义资料字段的前缀必须是 Tag_Profile_Custom"
  3584. };
  3585. if (!_e(r.value)) return {
  3586. valid: !1,
  3587. tips: "自定义资料字段的 value 必须是字符串"
  3588. };
  3589. }
  3590. for (var s in e) if (Object.prototype.hasOwnProperty.call(e, s)) {
  3591. if ("profileCustomField" === s) continue;
  3592. if (Xe(e[s]) && !_e(e[s]) && !fe(e[s])) {
  3593. n = "key:" + s + ", invalid value:" + e[s], t = !1;
  3594. continue;
  3595. }
  3596. switch (s) {
  3597. case "nick":
  3598. _e(e[s]) || (n = "nick should be a string", t = !1), Le(e[s]) > 500 && (n = "nick name limited: must less than or equal to ".concat(500, " bytes, current size: ").concat(Le(e[s]), " bytes"), t = !1);
  3599. break;
  3600. case "gender":
  3601. be(Et, e.gender) || (n = "key:gender, invalid value:" + e.gender, t = !1);
  3602. break;
  3603. case "birthday":
  3604. fe(e.birthday) || (n = "birthday should be a number", t = !1);
  3605. break;
  3606. case "location":
  3607. _e(e.location) || (n = "location should be a string", t = !1);
  3608. break;
  3609. case "selfSignature":
  3610. _e(e.selfSignature) || (n = "selfSignature should be a string", t = !1);
  3611. break;
  3612. case "allowType":
  3613. be(Dt, e.allowType) || (n = "key:allowType, invalid value:" + e.allowType, t = !1);
  3614. break;
  3615. case "language":
  3616. fe(e.language) || (n = "language should be a number", t = !1);
  3617. break;
  3618. case "avatar":
  3619. _e(e.avatar) || (n = "avatar should be a string", t = !1);
  3620. break;
  3621. case "messageSettings":
  3622. 0 !== e.messageSettings && 1 !== e.messageSettings && (n = "messageSettings should be 0 or 1", t = !1);
  3623. break;
  3624. case "adminForbidType":
  3625. be(Tt, e.adminForbidType) || (n = "key:adminForbidType, invalid value:" + e.adminForbidType, t = !1);
  3626. break;
  3627. case "level":
  3628. fe(e.level) || (n = "level should be a number", t = !1);
  3629. break;
  3630. case "role":
  3631. fe(e.role) || (n = "role should be a number", t = !1);
  3632. break;
  3633. default:
  3634. n = "unknown key:" + s + " " + e[s], t = !1;
  3635. }
  3636. }
  3637. return {
  3638. valid: t,
  3639. tips: n
  3640. };
  3641. }
  3642. }]), e;
  3643. }(),
  3644. es = function () {
  3645. function t(e) {
  3646. o(this, t), this.userController = e, this.TAG = "profile", this.Actions = {
  3647. Q: "query",
  3648. U: "update"
  3649. }, this.accountProfileMap = new Map(), this.expirationTime = 864e5;
  3650. }
  3651. return i(t, [{
  3652. key: "setExpirationTime",
  3653. value: function (e) {
  3654. this.expirationTime = e;
  3655. }
  3656. }, {
  3657. key: "getUserProfile",
  3658. value: function (e) {
  3659. var t = this,
  3660. n = e.userIDList;
  3661. e.fromAccount = this.userController.getMyAccount(), n.length > 100 && (de.warn("ProfileHandler.getUserProfile 获取用户资料人数不能超过100人"), n.length = 100);
  3662. for (var o, r = [], i = [], s = 0, a = n.length; s < a; s++) o = n[s], this.userController.isMyFriend(o) && this._containsAccount(o) ? i.push(this._getProfileFromMap(o)) : r.push(o);
  3663. if (0 === r.length) return Mr(i);
  3664. e.toAccount = r;
  3665. var u = e.bFromGetMyProfile || !1,
  3666. c = [];
  3667. e.toAccount.forEach(function (e) {
  3668. c.push({
  3669. toAccount: e,
  3670. standardSequence: 0,
  3671. customSequence: 0
  3672. });
  3673. }), e.userItem = c;
  3674. var l = new qr(Ui);
  3675. l.setText(n.length > 5 ? "userIDList.length=".concat(n.length) : "userIDList=".concat(n));
  3676. var p = this.userController.generateConfig(this.TAG, this.Actions.Q, e);
  3677. return this.userController.request(p).then(function (e) {
  3678. l.setNetworkType(t.userController.getNetworkType()).setEnd(), de.info("ProfileHandler.getUserProfile ok");
  3679. var n = t._handleResponse(e).concat(i);
  3680. return u ? (t.userController.onGotMyProfile(), new vr(n[0])) : new vr(n);
  3681. }).catch(function (e) {
  3682. return t.userController.probeNetwork().then(function (t) {
  3683. var n = y(t, 2),
  3684. o = n[0],
  3685. r = n[1];
  3686. l.setError(e, o, r).setEnd();
  3687. }), de.error("ProfileHandler.getUserProfile error:", e), Cr(e);
  3688. });
  3689. }
  3690. }, {
  3691. key: "getMyProfile",
  3692. value: function () {
  3693. var e = this.userController.getMyAccount();
  3694. if (de.log("ProfileHandler.getMyProfile myAccount=" + e), this._fillMap(), this._containsAccount(e)) {
  3695. var t = this._getProfileFromMap(e);
  3696. return de.debug("ProfileHandler.getMyProfile from cache, myProfile:" + JSON.stringify(t)), this.userController.onGotMyProfile(), Mr(t);
  3697. }
  3698. return this.getUserProfile({
  3699. fromAccount: e,
  3700. userIDList: [e],
  3701. bFromGetMyProfile: !0
  3702. });
  3703. }
  3704. }, {
  3705. key: "_handleResponse",
  3706. value: function (e) {
  3707. for (var t, n, o = Ae.now(), r = e.data.userProfileItem, i = [], s = 0, a = r.length; s < a; s++) "@TLS#NOT_FOUND" !== r[s].to && "" !== r[s].to && (t = r[s].to, n = this._updateMap(t, this._getLatestProfileFromResponse(t, r[s].profileItem)), i.push(n));
  3708. return de.log("ProfileHandler._handleResponse cost " + (Ae.now() - o) + " ms"), i;
  3709. }
  3710. }, {
  3711. key: "_getLatestProfileFromResponse",
  3712. value: function (e, t) {
  3713. var n = {};
  3714. if (n.userID = e, n.profileCustomField = [], !Xe(t)) for (var o = 0, r = t.length; o < r; o++) if (t[o].tag.indexOf("Tag_Profile_Custom") > -1) n.profileCustomField.push({
  3715. key: t[o].tag,
  3716. value: t[o].value
  3717. });else switch (t[o].tag) {
  3718. case Ct.NICK:
  3719. n.nick = t[o].value;
  3720. break;
  3721. case Ct.GENDER:
  3722. n.gender = t[o].value;
  3723. break;
  3724. case Ct.BIRTHDAY:
  3725. n.birthday = t[o].value;
  3726. break;
  3727. case Ct.LOCATION:
  3728. n.location = t[o].value;
  3729. break;
  3730. case Ct.SELFSIGNATURE:
  3731. n.selfSignature = t[o].value;
  3732. break;
  3733. case Ct.ALLOWTYPE:
  3734. n.allowType = t[o].value;
  3735. break;
  3736. case Ct.LANGUAGE:
  3737. n.language = t[o].value;
  3738. break;
  3739. case Ct.AVATAR:
  3740. n.avatar = t[o].value;
  3741. break;
  3742. case Ct.MESSAGESETTINGS:
  3743. n.messageSettings = t[o].value;
  3744. break;
  3745. case Ct.ADMINFORBIDTYPE:
  3746. n.adminForbidType = t[o].value;
  3747. break;
  3748. case Ct.LEVEL:
  3749. n.level = t[o].value;
  3750. break;
  3751. case Ct.ROLE:
  3752. n.role = t[o].value;
  3753. break;
  3754. default:
  3755. de.warn("ProfileHandler._handleResponse unkown tag->", t[o].tag, t[o].value);
  3756. }
  3757. return n;
  3758. }
  3759. }, {
  3760. key: "updateMyProfile",
  3761. value: function (t) {
  3762. var n = this,
  3763. o = new qr(qi);
  3764. o.setText(JSON.stringify(t));
  3765. var r = new Zi().validate(t);
  3766. if (!r.valid) return o.setCode(qt.UPDATE_PROFILE_INVALID_PARAM).setMessage("ProfileHandler.updateMyProfile info:".concat(r.tips)).setNetworkType(this.userController.getNetworkType()).setEnd(), de.error("ProfileHandler.updateMyProfile info:".concat(r.tips, ",请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#updateMyProfile")), Cr({
  3767. code: qt.UPDATE_PROFILE_INVALID_PARAM,
  3768. message: Nn
  3769. });
  3770. var i = [];
  3771. for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && ("profileCustomField" === s ? t.profileCustomField.forEach(function (e) {
  3772. i.push({
  3773. tag: e.key,
  3774. value: e.value
  3775. });
  3776. }) : i.push({
  3777. tag: Ct[s.toUpperCase()],
  3778. value: t[s]
  3779. }));
  3780. if (0 === i.length) return o.setCode(qt.UPDATE_PROFILE_NO_KEY).setMessage(Ln).setNetworkType(this.userController.getNetworkType()).setEnd(), de.error("ProfileHandler.updateMyProfile info:".concat(Ln, ",请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#updateMyProfile")), Cr({
  3781. code: qt.UPDATE_PROFILE_NO_KEY,
  3782. message: Ln
  3783. });
  3784. var a = this.userController.generateConfig(this.TAG, this.Actions.U, {
  3785. fromAccount: this.userController.getMyAccount(),
  3786. profileItem: i
  3787. });
  3788. return this.userController.request(a).then(function (r) {
  3789. o.setNetworkType(n.userController.getNetworkType()).setEnd(), de.info("ProfileHandler.updateMyProfile ok");
  3790. var i = n._updateMap(n.userController.getMyAccount(), t);
  3791. return n.userController.emitOuterEvent(e.PROFILE_UPDATED, [i]), Mr(i);
  3792. }).catch(function (e) {
  3793. return n.userController.probeNetwork().then(function (t) {
  3794. var n = y(t, 2),
  3795. r = n[0],
  3796. i = n[1];
  3797. o.setError(e, r, i).setEnd();
  3798. }), de.error("ProfileHandler.updateMyProfile error:", e), Cr(e);
  3799. });
  3800. }
  3801. }, {
  3802. key: "onProfileModified",
  3803. value: function (t) {
  3804. var n = t.data;
  3805. if (!Xe(n)) {
  3806. var o,
  3807. r,
  3808. i = n.length;
  3809. de.info("ProfileHandler.onProfileModified length=" + i);
  3810. for (var s = [], a = 0; a < i; a++) o = n[a].userID, r = this._updateMap(o, this._getLatestProfileFromResponse(o, n[a].profileList)), s.push(r);
  3811. this.userController.emitInnerEvent(rr, s), this.userController.emitOuterEvent(e.PROFILE_UPDATED, s);
  3812. }
  3813. }
  3814. }, {
  3815. key: "_fillMap",
  3816. value: function () {
  3817. if (0 === this.accountProfileMap.size) {
  3818. for (var e = this._getCachedProfiles(), t = Date.now(), n = 0, o = e.length; n < o; n++) t - e[n].lastUpdatedTime < this.expirationTime && this.accountProfileMap.set(e[n].userID, e[n]);
  3819. de.log("ProfileHandler._fillMap from cache, map.size=" + this.accountProfileMap.size);
  3820. }
  3821. }
  3822. }, {
  3823. key: "_updateMap",
  3824. value: function (e, t) {
  3825. var n,
  3826. o = Date.now();
  3827. return this._containsAccount(e) ? (n = this._getProfileFromMap(e), t.profileCustomField && xe(n.profileCustomField, t.profileCustomField), Oe(n, t, ["profileCustomField"]), n.lastUpdatedTime = o) : (n = new Zi(t), (this.userController.isMyFriend(e) || e === this.userController.getMyAccount()) && (n.lastUpdatedTime = o, this.accountProfileMap.set(e, n))), this._flushMap(e === this.userController.getMyAccount()), n;
  3828. }
  3829. }, {
  3830. key: "_flushMap",
  3831. value: function (e) {
  3832. var t = I(this.accountProfileMap.values()),
  3833. n = this.userController.tim.storage;
  3834. de.debug("ProfileHandler._flushMap length=".concat(t.length, " flushAtOnce=").concat(e)), n.setItem(this.TAG, t, e);
  3835. }
  3836. }, {
  3837. key: "_containsAccount",
  3838. value: function (e) {
  3839. return this.accountProfileMap.has(e);
  3840. }
  3841. }, {
  3842. key: "_getProfileFromMap",
  3843. value: function (e) {
  3844. return this.accountProfileMap.get(e);
  3845. }
  3846. }, {
  3847. key: "_getCachedProfiles",
  3848. value: function () {
  3849. var e = this.userController.tim.storage.getItem(this.TAG);
  3850. return Xe(e) ? [] : e;
  3851. }
  3852. }, {
  3853. key: "onConversationsProfileUpdated",
  3854. value: function (e) {
  3855. for (var t, n, o, r = [], i = 0, s = e.length; i < s; i++) n = (t = e[i]).userID, this.userController.isMyFriend(n) && (this._containsAccount(n) ? (o = this._getProfileFromMap(n), Oe(o, t) > 0 && r.push(n)) : r.push(t.userID));
  3856. 0 !== r.length && (de.info("ProfileHandler.onConversationsProfileUpdated toAccount:", r), this.getUserProfile({
  3857. userIDList: r
  3858. }));
  3859. }
  3860. }, {
  3861. key: "reset",
  3862. value: function () {
  3863. this._flushMap(!0), this.accountProfileMap.clear();
  3864. }
  3865. }]), t;
  3866. }(),
  3867. ts = function () {
  3868. function e(t) {
  3869. o(this, e), this.options = t ? t.options : {
  3870. enablePointer: !0
  3871. }, this.pointsList = {}, this.reportText = {}, this.maxNameLen = 0, this.gapChar = "-", this.log = console.log, this.currentTask = "";
  3872. }
  3873. return i(e, [{
  3874. key: "newTask",
  3875. value: function (e) {
  3876. !1 !== this.options.enablePointer && (e || (e = ["task", this._timeFormat()].join("-")), this.pointsList[e] = [], this.currentTask = e, console.log("Pointer new Task : ".concat(this.currentTask)));
  3877. }
  3878. }, {
  3879. key: "deleteTask",
  3880. value: function (e) {
  3881. !1 !== this.options.enablePointer && (e || (e = this.currentTask), this.pointsList[e].length = 0, delete this.pointsList[e]);
  3882. }
  3883. }, {
  3884. key: "dot",
  3885. value: function () {
  3886. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
  3887. t = arguments.length > 1 ? arguments[1] : void 0;
  3888. if (!1 !== this.options.enablePointer) {
  3889. t = t || this.currentTask;
  3890. var n = +new Date();
  3891. this.maxNameLen = this.maxNameLen < e.length ? e.length : this.maxNameLen, this.flen = this.maxNameLen + 10, this.pointsList[t].push({
  3892. pointerName: e,
  3893. time: n
  3894. });
  3895. }
  3896. }
  3897. }, {
  3898. key: "_analisys",
  3899. value: function (e) {
  3900. if (!1 !== this.options.enablePointer) {
  3901. e = e || this.currentTask;
  3902. for (var t = this.pointsList[e], n = t.length, o = [], r = [], i = 0; i < n; i++) 0 !== i && (r = this._analisysTowPoints(t[i - 1], t[i]), o.push(r.join("")));
  3903. return r = this._analisysTowPoints(t[0], t[n - 1], !0), o.push(r.join("")), o.join("");
  3904. }
  3905. }
  3906. }, {
  3907. key: "_analisysTowPoints",
  3908. value: function (e, t) {
  3909. var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
  3910. if (!1 !== this.options.enablePointer) {
  3911. var o = this.flen,
  3912. r = t.time - e.time,
  3913. i = r.toString(),
  3914. s = e.pointerName + this.gapChar.repeat(o - e.pointerName.length),
  3915. a = t.pointerName + this.gapChar.repeat(o - t.pointerName.length),
  3916. u = this.gapChar.repeat(4 - i.length) + i,
  3917. c = n ? ["%c", s, a, u, "ms\n%c"] : [s, a, u, "ms\n"];
  3918. return c;
  3919. }
  3920. }
  3921. }, {
  3922. key: "report",
  3923. value: function (e) {
  3924. if (!1 !== this.options.enablePointer) {
  3925. e = e || this.currentTask;
  3926. var t = this._analisys(e);
  3927. this.pointsList = [];
  3928. var n = this._timeFormat(),
  3929. o = "Pointer[".concat(e, "(").concat(n, ")]"),
  3930. r = 4 * this.maxNameLen,
  3931. i = (r - o.length) / 2;
  3932. console.log(["-".repeat(i), o, "-".repeat(i)].join("")), console.log("%c" + t, "color:#66a", "color:red", "color:#66a"), console.log("-".repeat(r));
  3933. }
  3934. }
  3935. }, {
  3936. key: "_timeFormat",
  3937. value: function () {
  3938. var e = new Date(),
  3939. t = this.zeroFix(e.getMonth() + 1, 2),
  3940. n = this.zeroFix(e.getDate(), 2);
  3941. return "".concat(t, "-").concat(n, " ").concat(e.getHours(), ":").concat(e.getSeconds(), ":").concat(e.getMinutes(), "~").concat(e.getMilliseconds());
  3942. }
  3943. }, {
  3944. key: "zeroFix",
  3945. value: function (e, t) {
  3946. return ("000000000" + e).slice(-t);
  3947. }
  3948. }, {
  3949. key: "reportAll",
  3950. value: function () {
  3951. if (!1 !== this.options.enablePointer) for (var e in this.pointsList) Object.prototype.hasOwnProperty.call(this.pointsList, e) && this.eport(e);
  3952. }
  3953. }]), e;
  3954. }(),
  3955. ns = function e(t, n) {
  3956. o(this, e), this.userID = t;
  3957. var r = {};
  3958. if (r.userID = t, !Xe(n)) for (var i = 0, s = n.length; i < s; i++) switch (n[i].tag) {
  3959. case Ct.NICK:
  3960. r.nick = n[i].value;
  3961. break;
  3962. case Ct.GENDER:
  3963. r.gender = n[i].value;
  3964. break;
  3965. case Ct.BIRTHDAY:
  3966. r.birthday = n[i].value;
  3967. break;
  3968. case Ct.LOCATION:
  3969. r.location = n[i].value;
  3970. break;
  3971. case Ct.SELFSIGNATURE:
  3972. r.selfSignature = n[i].value;
  3973. break;
  3974. case Ct.ALLOWTYPE:
  3975. r.allowType = n[i].value;
  3976. break;
  3977. case Ct.LANGUAGE:
  3978. r.language = n[i].value;
  3979. break;
  3980. case Ct.AVATAR:
  3981. r.avatar = n[i].value;
  3982. break;
  3983. case Ct.MESSAGESETTINGS:
  3984. r.messageSettings = n[i].value;
  3985. break;
  3986. case Ct.ADMINFORBIDTYPE:
  3987. r.adminForbidType = n[i].value;
  3988. break;
  3989. case Ct.LEVEL:
  3990. r.level = n[i].value;
  3991. break;
  3992. case Ct.ROLE:
  3993. r.role = n[i].value;
  3994. break;
  3995. default:
  3996. de.debug("snsProfileItem unkown tag->", n[i].tag);
  3997. }
  3998. this.profile = new Zi(r);
  3999. },
  4000. os = function () {
  4001. function e(t) {
  4002. o(this, e), this.userController = t, this.TAG = "friend", this.Actions = {
  4003. G: "get",
  4004. D: "delete"
  4005. }, this.friends = new Map(), this.pointer = new ts();
  4006. }
  4007. return i(e, [{
  4008. key: "isMyFriend",
  4009. value: function (e) {
  4010. var t = this.friends.has(e);
  4011. return t || de.debug("FriendHandler.isMyFriend " + e + " is not my friend"), t;
  4012. }
  4013. }, {
  4014. key: "_transformFriendList",
  4015. value: function (e) {
  4016. if (!Xe(e) && !Xe(e.infoItem)) {
  4017. de.info("FriendHandler._transformFriendList friendNum=" + e.friendNum);
  4018. for (var t, n, o = e.infoItem, r = 0, i = o.length; r < i; r++) n = o[r].infoAccount, t = new ns(n, o[r].snsProfileItem), this.friends.set(n, t);
  4019. }
  4020. }
  4021. }, {
  4022. key: "_friends2map",
  4023. value: function (e) {
  4024. var t = new Map();
  4025. for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.set(n, e[n]);
  4026. return t;
  4027. }
  4028. }, {
  4029. key: "getFriendList",
  4030. value: function () {
  4031. var e = this,
  4032. t = {};
  4033. t.fromAccount = this.userController.getMyAccount(), de.info("FriendHandler.getFriendList myAccount=" + t.fromAccount);
  4034. var n = this.userController.generateConfig(this.TAG, this.Actions.G, t);
  4035. return this.userController.request(n).then(function (t) {
  4036. de.info("FriendHandler.getFriendList ok"), e._transformFriendList(t.data);
  4037. var n = I(e.friends.values());
  4038. return Mr(n);
  4039. }).catch(function (e) {
  4040. return de.error("FriendHandler.getFriendList error:", e), Cr(e);
  4041. });
  4042. }
  4043. }, {
  4044. key: "deleteFriend",
  4045. value: function (e) {
  4046. if (!Array.isArray(e.toAccount)) return de.error("FriendHandler.deleteFriend options.toAccount 必需是数组"), Cr({
  4047. code: qt.DEL_FRIEND_INVALID_PARAM,
  4048. message: Rn
  4049. });
  4050. e.toAccount.length > 1e3 && (de.warn("FriendHandler.deleteFriend 删除好友人数不能超过1000人"), e.toAccount.length = 1e3);
  4051. var t = this.userController.generateConfig(this.TAG, this.Actions.D, e);
  4052. return this.userController.request(t).then(function (e) {
  4053. return de.info("FriendHandler.deleteFriend ok"), Mr();
  4054. }).catch(function (e) {
  4055. return de.error("FriendHandler.deleteFriend error:", e), Cr(e);
  4056. });
  4057. }
  4058. }]), e;
  4059. }(),
  4060. rs = function e(t) {
  4061. o(this, e), Xe || (this.userID = t.userID || "", this.timeStamp = t.timeStamp || 0);
  4062. },
  4063. is = function () {
  4064. function t(e) {
  4065. o(this, t), this.userController = e, this.TAG = "blacklist", this.Actions = {
  4066. G: "get",
  4067. C: "create",
  4068. D: "delete"
  4069. }, this.blacklistMap = new Map(), this.startIndex = 0, this.maxLimited = 100, this.curruentSequence = 0;
  4070. }
  4071. return i(t, [{
  4072. key: "getBlacklist",
  4073. value: function () {
  4074. var e = this,
  4075. t = {};
  4076. t.fromAccount = this.userController.getMyAccount(), t.maxLimited = this.maxLimited, t.startIndex = 0, t.lastSequence = this.curruentSequence;
  4077. var n = new qr(Fi),
  4078. o = this.userController.generateConfig(this.TAG, this.Actions.G, t);
  4079. return this.userController.request(o).then(function (t) {
  4080. var o = Xe(t.data.blackListItem) ? 0 : t.data.blackListItem.length;
  4081. return n.setNetworkType(e.userController.getNetworkType()).setText(o).setEnd(), de.info("BlacklistHandler.getBlacklist ok"), e.curruentSequence = t.data.curruentSequence, e._handleResponse(t.data.blackListItem, !0), e._onBlacklistUpdated();
  4082. }).catch(function (t) {
  4083. return e.userController.probeNetwork().then(function (e) {
  4084. var o = y(e, 2),
  4085. r = o[0],
  4086. i = o[1];
  4087. n.setError(t, r, i).setEnd();
  4088. }), de.error("BlacklistHandler.getBlacklist error:", t), Cr(t);
  4089. });
  4090. }
  4091. }, {
  4092. key: "addBlacklist",
  4093. value: function (e) {
  4094. var t = this,
  4095. n = new qr(xi);
  4096. if (!Ie(e.userIDList)) return n.setCode(qt.ADD_BLACKLIST_INVALID_PARAM).setMessage("BlacklistHandler.addBlacklist options.userIDList 必需是数组").setNetworkType(this.userController.getNetworkType()).setEnd(), de.error("BlacklistHandler.addBlacklist options.userIDList 必需是数组"), Cr({
  4097. code: qt.ADD_BLACKLIST_INVALID_PARAM,
  4098. message: wn
  4099. });
  4100. var o = this.userController.tim.loginInfo.identifier;
  4101. if (1 === e.userIDList.length && e.userIDList[0] === o) return n.setCode(qt.CANNOT_ADD_SELF_TO_BLACKLIST).setMessage(Gn).setNetworkType(this.userController.getNetworkType()).setEnd(), de.error("BlacklistHandler.addBlacklist 不能把自己拉黑"), Cr({
  4102. code: qt.CANNOT_ADD_SELF_TO_BLACKLIST,
  4103. message: Gn
  4104. });
  4105. e.userIDList.includes(o) && (e.userIDList = e.userIDList.filter(function (e) {
  4106. return e !== o;
  4107. }), de.warn("BlacklistHandler.addBlacklist 不能把自己拉黑,已过滤")), e.fromAccount = this.userController.getMyAccount(), e.toAccount = e.userIDList;
  4108. var r = this.userController.generateConfig(this.TAG, this.Actions.C, e);
  4109. return this.userController.request(r).then(function (o) {
  4110. return n.setNetworkType(t.userController.getNetworkType()).setText(e.userIDList.length > 5 ? "userIDList.length=".concat(e.userIDList.length) : "userIDList=".concat(e.userIDList)).setEnd(), de.info("BlacklistHandler.addBlacklist ok"), t._handleResponse(o.data.resultItem, !0), t._onBlacklistUpdated();
  4111. }).catch(function (e) {
  4112. return t.userController.probeNetwork().then(function (t) {
  4113. var o = y(t, 2),
  4114. r = o[0],
  4115. i = o[1];
  4116. n.setError(e, r, i).setEnd();
  4117. }), de.error("BlacklistHandler.addBlacklist error:", e), Cr(e);
  4118. });
  4119. }
  4120. }, {
  4121. key: "_handleResponse",
  4122. value: function (e, t) {
  4123. if (!Xe(e)) for (var n, o, r, i = 0, s = e.length; i < s; i++) o = e[i].to, r = e[i].resultCode, (Me(r) || 0 === r) && (t ? ((n = this.blacklistMap.has(o) ? this.blacklistMap.get(o) : new rs()).userID = o, !Xe(e[i].addBlackTimeStamp) && (n.timeStamp = e[i].addBlackTimeStamp), this.blacklistMap.set(o, n)) : this.blacklistMap.has(o) && (n = this.blacklistMap.get(o), this.blacklistMap.delete(o)));
  4124. de.log("BlacklistHandler._handleResponse total=" + this.blacklistMap.size + " bAdd=" + t);
  4125. }
  4126. }, {
  4127. key: "deleteBlacklist",
  4128. value: function (e) {
  4129. var t = this,
  4130. n = new qr(Vi);
  4131. if (!Ie(e.userIDList)) return n.setCode(qt.DEL_BLACKLIST_INVALID_PARAM).setMessage("BlacklistHandler.deleteBlacklist options.userIDList 必需是数组").setNetworkType(this.userController.getNetworkType()).setEnd(), de.error("BlacklistHandler.deleteBlacklist options.userIDList 必需是数组"), Cr({
  4132. code: qt.DEL_BLACKLIST_INVALID_PARAM,
  4133. message: Pn
  4134. });
  4135. e.fromAccount = this.userController.getMyAccount(), e.toAccount = e.userIDList;
  4136. var o = this.userController.generateConfig(this.TAG, this.Actions.D, e);
  4137. return this.userController.request(o).then(function (o) {
  4138. return n.setNetworkType(t.userController.getNetworkType()).setText(e.userIDList.length > 5 ? "userIDList.length=".concat(e.userIDList.length) : "userIDList=".concat(e.userIDList)).setEnd(), de.info("BlacklistHandler.deleteBlacklist ok"), t._handleResponse(o.data.resultItem, !1), t._onBlacklistUpdated();
  4139. }).catch(function (e) {
  4140. return t.userController.probeNetwork().then(function (t) {
  4141. var o = y(t, 2),
  4142. r = o[0],
  4143. i = o[1];
  4144. n.setError(e, r, i).setEnd();
  4145. }), de.error("BlacklistHandler.deleteBlacklist error:", e), Cr(e);
  4146. });
  4147. }
  4148. }, {
  4149. key: "_onBlacklistUpdated",
  4150. value: function () {
  4151. var t = I(this.blacklistMap.keys());
  4152. return this.userController.emitOuterEvent(e.BLACKLIST_UPDATED, t), Mr(t);
  4153. }
  4154. }, {
  4155. key: "handleBlackListDelAccount",
  4156. value: function (t) {
  4157. for (var n, o = [], r = 0, i = t.length; r < i; r++) n = t[r], this.blacklistMap.has(n) && (this.blacklistMap.delete(n), o.push(n));
  4158. o.length > 0 && (de.log("BlacklistHandler.handleBlackListDelAccount delCount=" + o.length + " : " + o.join(",")), this.userController.emitOuterEvent(e.BLACKLIST_UPDATED, I(this.blacklistMap.keys())));
  4159. }
  4160. }, {
  4161. key: "handleBlackListAddAccount",
  4162. value: function (t) {
  4163. for (var n, o = [], r = 0, i = t.length; r < i; r++) n = t[r], this.blacklistMap.has(n) || (this.blacklistMap.set(n, new rs({
  4164. userID: n
  4165. })), o.push(n));
  4166. o.length > 0 && (de.log("BlacklistHandler.handleBlackListAddAccount addCount=" + o.length + " : " + o.join(",")), this.userController.emitOuterEvent(e.BLACKLIST_UPDATED, I(this.blacklistMap.keys())));
  4167. }
  4168. }, {
  4169. key: "reset",
  4170. value: function () {
  4171. this.blacklistMap.clear(), this.startIndex = 0, this.maxLimited = 100, this.curruentSequence = 0;
  4172. }
  4173. }]), t;
  4174. }(),
  4175. ss = function () {
  4176. function e(t) {
  4177. o(this, e), this.userController = t, this.TAG = "applyC2C", this.Actions = {
  4178. C: "create",
  4179. G: "get",
  4180. D: "delete",
  4181. U: "update"
  4182. };
  4183. }
  4184. return i(e, [{
  4185. key: "applyAddFriend",
  4186. value: function (e) {
  4187. var t = this,
  4188. n = this.userController.generateConfig(this.TAG, this.Actions.C, e),
  4189. o = this.userController.request(n);
  4190. return o.then(function (e) {
  4191. t.userController.isActionSuccessful("applyAddFriend", t.Actions.C, e);
  4192. }).catch(function (e) {}), o;
  4193. }
  4194. }, {
  4195. key: "getPendency",
  4196. value: function (e) {
  4197. var t = this,
  4198. n = this.userController.generateConfig(this.TAG, this.Actions.G, e),
  4199. o = this.userController.request(n);
  4200. return o.then(function (e) {
  4201. t.userController.isActionSuccessful("getPendency", t.Actions.G, e);
  4202. }).catch(function (e) {}), o;
  4203. }
  4204. }, {
  4205. key: "deletePendency",
  4206. value: function (e) {
  4207. var t = this,
  4208. n = this.userController.generateConfig(this.TAG, this.Actions.D, e),
  4209. o = this.userController.request(n);
  4210. return o.then(function (e) {
  4211. t.userController.isActionSuccessful("deletePendency", t.Actions.D, e);
  4212. }).catch(function (e) {}), o;
  4213. }
  4214. }, {
  4215. key: "replyPendency",
  4216. value: function () {
  4217. var e = this,
  4218. t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
  4219. n = this.userController.generateConfig(this.TAG, this.Actions.U, t),
  4220. o = this.userController.request(n);
  4221. return o.then(function (t) {
  4222. e.userController.isActionSuccessful("replyPendency", e.Actions.U, t);
  4223. }).catch(function (e) {}), o;
  4224. }
  4225. }]), e;
  4226. }(),
  4227. as = function (e) {
  4228. c(n, e);
  4229. var t = v(n);
  4230. function n(e) {
  4231. var r;
  4232. return o(this, n), (r = t.call(this, e)).profileHandler = new es(f(r)), r.friendHandler = new os(f(r)), r.blacklistHandler = new is(f(r)), r.applyC2CHandler = new ss(f(r)), r._initializeListener(), r;
  4233. }
  4234. return i(n, [{
  4235. key: "_initializeListener",
  4236. value: function (e) {
  4237. var t = this.tim.innerEmitter;
  4238. t.on(Mo, this.onContextUpdated, this), t.on(Ho, this.onProfileModified, this), t.on(Ko, this.onNewFriendMessages, this), t.on(nr, this.onConversationsProfileUpdated, this);
  4239. }
  4240. }, {
  4241. key: "onContextUpdated",
  4242. value: function (e) {
  4243. var t = this.tim.context;
  4244. !1 != !!t.a2Key && !1 != !!t.tinyID && (this.profileHandler.getMyProfile(), this.friendHandler.getFriendList(), this.blacklistHandler.getBlacklist());
  4245. }
  4246. }, {
  4247. key: "onGotMyProfile",
  4248. value: function () {
  4249. this.triggerReady();
  4250. }
  4251. }, {
  4252. key: "onProfileModified",
  4253. value: function (e) {
  4254. this.profileHandler.onProfileModified(e);
  4255. }
  4256. }, {
  4257. key: "onNewFriendMessages",
  4258. value: function (e) {
  4259. de.debug("onNewFriendMessages", JSON.stringify(e.data)), Xe(e.data.blackListDelAccount) || this.blacklistHandler.handleBlackListDelAccount(e.data.blackListDelAccount), Xe(e.data.blackListAddAccount) || this.blacklistHandler.handleBlackListAddAccount(e.data.blackListAddAccount);
  4260. }
  4261. }, {
  4262. key: "onConversationsProfileUpdated",
  4263. value: function (e) {
  4264. this.profileHandler.onConversationsProfileUpdated(e.data);
  4265. }
  4266. }, {
  4267. key: "getMyAccount",
  4268. value: function () {
  4269. return this.tim.context.identifier;
  4270. }
  4271. }, {
  4272. key: "isMyFriend",
  4273. value: function (e) {
  4274. return this.friendHandler.isMyFriend(e);
  4275. }
  4276. }, {
  4277. key: "generateConfig",
  4278. value: function (e, t, n) {
  4279. return {
  4280. name: e,
  4281. action: t,
  4282. param: n
  4283. };
  4284. }
  4285. }, {
  4286. key: "getMyProfile",
  4287. value: function () {
  4288. return this.profileHandler.getMyProfile();
  4289. }
  4290. }, {
  4291. key: "getUserProfile",
  4292. value: function (e) {
  4293. return this.profileHandler.getUserProfile(e);
  4294. }
  4295. }, {
  4296. key: "updateMyProfile",
  4297. value: function (e) {
  4298. return this.profileHandler.updateMyProfile(e);
  4299. }
  4300. }, {
  4301. key: "getFriendList",
  4302. value: function () {
  4303. return this.friendHandler.getFriendList();
  4304. }
  4305. }, {
  4306. key: "deleteFriend",
  4307. value: function (e) {
  4308. return this.friendHandler.deleteFriend(e);
  4309. }
  4310. }, {
  4311. key: "getBlacklist",
  4312. value: function () {
  4313. return this.blacklistHandler.getBlacklist();
  4314. }
  4315. }, {
  4316. key: "addBlacklist",
  4317. value: function (e) {
  4318. return this.blacklistHandler.addBlacklist(e);
  4319. }
  4320. }, {
  4321. key: "deleteBlacklist",
  4322. value: function (e) {
  4323. return this.blacklistHandler.deleteBlacklist(e);
  4324. }
  4325. }, {
  4326. key: "applyAddFriend",
  4327. value: function (e) {
  4328. return this.applyC2CHandler.applyAddFriend(e);
  4329. }
  4330. }, {
  4331. key: "getPendency",
  4332. value: function (e) {
  4333. return this.applyC2CHandler.getPendency(e);
  4334. }
  4335. }, {
  4336. key: "deletePendency",
  4337. value: function (e) {
  4338. return this.applyC2CHandler.deletePendency(e);
  4339. }
  4340. }, {
  4341. key: "replyPendency",
  4342. value: function (e) {
  4343. return this.applyC2CHandler.replyPendency(e);
  4344. }
  4345. }, {
  4346. key: "reset",
  4347. value: function () {
  4348. de.info("UserController.reset"), this.resetReady(), this.profileHandler.reset(), this.blacklistHandler.reset(), this.checkTimes = 0;
  4349. }
  4350. }]), n;
  4351. }(mr),
  4352. us = ["groupID", "name", "avatar", "type", "introduction", "notification", "ownerID", "selfInfo", "createTime", "infoSequence", "lastInfoTime", "lastMessage", "nextMessageSeq", "memberNum", "maxMemberNum", "memberList", "joinOption", "groupCustomField", "muteAllMembers"],
  4353. cs = function () {
  4354. function e(t) {
  4355. o(this, e), this.groupID = "", this.name = "", this.avatar = "", this.type = "", this.introduction = "", this.notification = "", this.ownerID = "", this.createTime = "", this.infoSequence = "", this.lastInfoTime = "", this.selfInfo = {
  4356. messageRemindType: "",
  4357. joinTime: "",
  4358. nameCard: "",
  4359. role: ""
  4360. }, this.lastMessage = {
  4361. lastTime: "",
  4362. lastSequence: "",
  4363. fromAccount: "",
  4364. messageForShow: ""
  4365. }, this.nextMessageSeq = "", this.memberNum = "", this.memberCount = "", this.maxMemberNum = "", this.maxMemberCount = "", this.joinOption = "", this.groupCustomField = [], this.muteAllMembers = void 0, this._initGroup(t);
  4366. }
  4367. return i(e, [{
  4368. key: "_initGroup",
  4369. value: function (e) {
  4370. for (var t in e) us.indexOf(t) < 0 || ("selfInfo" !== t ? ("memberNum" === t && (this.memberCount = e[t]), "maxMemberNum" === t && (this.maxMemberCount = e[t]), this[t] = e[t]) : this.updateSelfInfo(e[t]));
  4371. }
  4372. }, {
  4373. key: "updateGroup",
  4374. value: function (e) {
  4375. var t = JSON.parse(JSON.stringify(e));
  4376. t.lastMsgTime && (this.lastMessage.lastTime = t.lastMsgTime), Me(t.muteAllMembers) || ("On" === t.muteAllMembers ? t.muteAllMembers = !0 : t.muteAllMembers = !1), t.groupCustomField && xe(this.groupCustomField, t.groupCustomField), Me(t.memberNum) || (this.memberCount = t.memberNum), Me(t.maxMemberNum) || (this.maxMemberCount = t.maxMemberNum), Oe(this, t, ["members", "errorCode", "lastMsgTime", "groupCustomField", "memberNum", "maxMemberNum"]);
  4377. }
  4378. }, {
  4379. key: "updateSelfInfo",
  4380. value: function (e) {
  4381. var t = e.nameCard,
  4382. n = e.joinTime,
  4383. o = e.role,
  4384. r = e.messageRemindType;
  4385. Oe(this.selfInfo, {
  4386. nameCard: t,
  4387. joinTime: n,
  4388. role: o,
  4389. messageRemindType: r
  4390. }, [], ["", null, void 0, 0, NaN]);
  4391. }
  4392. }, {
  4393. key: "setSelfNameCard",
  4394. value: function (e) {
  4395. this.selfInfo.nameCard = e;
  4396. }
  4397. }, {
  4398. key: "memberNum",
  4399. set: function (e) {},
  4400. get: function () {
  4401. return de.warn("!!!v2.8.0起弃用memberNum,请使用 memberCount"), this.memberCount;
  4402. }
  4403. }, {
  4404. key: "maxMemberNum",
  4405. set: function (e) {},
  4406. get: function () {
  4407. return de.warn("!!!v2.8.0起弃用maxMemberNum,请使用 maxMemberCount"), this.maxMemberCount;
  4408. }
  4409. }]), e;
  4410. }(),
  4411. ls = function (e, n) {
  4412. if (Me(n)) return "";
  4413. switch (e) {
  4414. case t.MSG_TEXT:
  4415. return n.text;
  4416. case t.MSG_IMAGE:
  4417. return "[图片]";
  4418. case t.MSG_GEO:
  4419. return "[位置]";
  4420. case t.MSG_AUDIO:
  4421. return "[语音]";
  4422. case t.MSG_VIDEO:
  4423. return "[视频]";
  4424. case t.MSG_FILE:
  4425. return "[文件]";
  4426. case t.MSG_CUSTOM:
  4427. return "[自定义消息]";
  4428. case t.MSG_GRP_TIP:
  4429. return "[群提示消息]";
  4430. case t.MSG_GRP_SYS_NOTICE:
  4431. return "[群系统通知]";
  4432. case t.MSG_FACE:
  4433. return "[动画表情]";
  4434. default:
  4435. return "";
  4436. }
  4437. },
  4438. ps = function (e) {
  4439. return Me(e) ? {
  4440. lastTime: 0,
  4441. lastSequence: 0,
  4442. fromAccount: 0,
  4443. messageForShow: "",
  4444. payload: null,
  4445. type: "",
  4446. isRevoked: !1
  4447. } : e instanceof Qn ? {
  4448. lastTime: e.time || 0,
  4449. lastSequence: e.sequence || 0,
  4450. fromAccount: e.from || "",
  4451. messageForShow: ls(e.type, e.payload),
  4452. payload: e.payload || null,
  4453. type: e.type || null,
  4454. isRevoked: !1
  4455. } : u(u({}, e), {}, {
  4456. isRevoked: !1,
  4457. messageForShow: ls(e.type, e.payload)
  4458. });
  4459. },
  4460. gs = function () {
  4461. function e(t) {
  4462. o(this, e), this.conversationID = t.conversationID || "", this.unreadCount = t.unreadCount || 0, this.type = t.type || "", this.lastMessage = ps(t.lastMessage), t.lastMsgTime && (this.lastMessage.lastTime = t.lastMsgTime), this._isInfoCompleted = !1, this.peerReadTime = t.peerReadTime || 0, this.groupAtInfoList = [], this._initProfile(t);
  4463. }
  4464. return i(e, [{
  4465. key: "_initProfile",
  4466. value: function (e) {
  4467. var n = this;
  4468. Object.keys(e).forEach(function (t) {
  4469. switch (t) {
  4470. case "userProfile":
  4471. n.userProfile = e.userProfile;
  4472. break;
  4473. case "groupProfile":
  4474. n.groupProfile = e.groupProfile;
  4475. }
  4476. }), Me(this.userProfile) && this.type === t.CONV_C2C ? this.userProfile = new Zi({
  4477. userID: e.conversationID.replace("C2C", "")
  4478. }) : Me(this.groupProfile) && this.type === t.CONV_GROUP && (this.groupProfile = new cs({
  4479. groupID: e.conversationID.replace("GROUP", "")
  4480. }));
  4481. }
  4482. }, {
  4483. key: "updateUnreadCount",
  4484. value: function (e, n) {
  4485. Me(e) || (He(this.subType) || Be(this.subType) ? this.unreadCount = 0 : n && this.type === t.CONV_GROUP ? this.unreadCount = e : this.unreadCount = this.unreadCount + e);
  4486. }
  4487. }, {
  4488. key: "updateLastMessage",
  4489. value: function (e) {
  4490. this.lastMessage = ps(e);
  4491. }
  4492. }, {
  4493. key: "updateGroupAtInfoList",
  4494. value: function (e) {
  4495. var n,
  4496. o = (M(n = e.groupAtType) || C(n) || E(n) || D()).slice(0);
  4497. -1 !== o.indexOf(t.CONV_AT_ME) && -1 !== o.indexOf(t.CONV_AT_ALL) && (o = [t.CONV_AT_ALL_AT_ME]);
  4498. var r = {
  4499. from: e.from,
  4500. groupID: e.groupID,
  4501. messageSequence: e.sequence,
  4502. atTypeArray: o,
  4503. __random: e.__random,
  4504. __sequence: e.__sequence
  4505. };
  4506. this.groupAtInfoList.push(r), de.debug("Conversation.updateGroupAtInfoList conversationID=".concat(this.conversationID), this.groupAtInfoList);
  4507. }
  4508. }, {
  4509. key: "clearGroupAtInfoList",
  4510. value: function () {
  4511. this.groupAtInfoList.length = 0;
  4512. }
  4513. }, {
  4514. key: "reduceUnreadCount",
  4515. value: function () {
  4516. this.unreadCount >= 1 && (this.unreadCount -= 1);
  4517. }
  4518. }, {
  4519. key: "isLastMessageRevoked",
  4520. value: function (e) {
  4521. var n = e.sequence,
  4522. o = e.time;
  4523. return this.type === t.CONV_C2C && n === this.lastMessage.lastSequence && o === this.lastMessage.lastTime || this.type === t.CONV_GROUP && n === this.lastMessage.lastSequence;
  4524. }
  4525. }, {
  4526. key: "setLastMessageRevoked",
  4527. value: function (e) {
  4528. this.lastMessage.isRevoked = e;
  4529. }
  4530. }, {
  4531. key: "toAccount",
  4532. get: function () {
  4533. return this.conversationID.replace("C2C", "").replace("GROUP", "");
  4534. }
  4535. }, {
  4536. key: "subType",
  4537. get: function () {
  4538. return this.groupProfile ? this.groupProfile.type : "";
  4539. }
  4540. }]), e;
  4541. }(),
  4542. hs = function (n) {
  4543. c(s, n);
  4544. var r = v(s);
  4545. function s(e) {
  4546. var t;
  4547. return o(this, s), (t = r.call(this, e)).pagingStatus = it.NOT_START, t.pagingTimeStamp = 0, t.conversationMap = new Map(), t.tempGroupList = [], t.tempGroupAtTipsList = [], t._initListeners(), t;
  4548. }
  4549. return i(s, [{
  4550. key: "hasLocalConversationMap",
  4551. value: function () {
  4552. return this.conversationMap.size > 0;
  4553. }
  4554. }, {
  4555. key: "_createLocalConversation",
  4556. value: function (e) {
  4557. return this.conversationMap.has(e) ? this.conversationMap.get(e) : (de.log("ConversationController._createLocalConversation conversationID:".concat(e)), new gs({
  4558. conversationID: e,
  4559. type: e.slice(0, 3) === t.CONV_C2C ? t.CONV_C2C : t.CONV_GROUP
  4560. }));
  4561. }
  4562. }, {
  4563. key: "hasLocalConversation",
  4564. value: function (e) {
  4565. return this.conversationMap.has(e);
  4566. }
  4567. }, {
  4568. key: "getConversationList",
  4569. value: function () {
  4570. var e = this;
  4571. de.log("ConversationController.getConversationList."), this.pagingStatus === it.REJECTED && (de.log("ConversationController.getConversationList. continue to sync conversationList"), this._syncConversationList());
  4572. var t = new qr(oi);
  4573. return this.request({
  4574. name: "conversation",
  4575. action: "query"
  4576. }).then(function (n) {
  4577. var o = n.data.conversations,
  4578. r = void 0 === o ? [] : o,
  4579. i = e._getConversationOptions(r);
  4580. return e._updateLocalConversationList(i, !0), e._setStorageConversationList(), e._handleC2CPeerReadTime(), t.setText(r.length).setNetworkType(e.getNetworkType()).setEnd(), de.log("ConversationController.getConversationList ok."), Mr({
  4581. conversationList: e.getLocalConversationList()
  4582. });
  4583. }).catch(function (n) {
  4584. return e.probeNetwork().then(function (e) {
  4585. var o = y(e, 2),
  4586. r = o[0],
  4587. i = o[1];
  4588. t.setError(n, r, i).setEnd();
  4589. }), de.error("ConversationController.getConversationList error:", n), Cr(n);
  4590. });
  4591. }
  4592. }, {
  4593. key: "_syncConversationList",
  4594. value: function () {
  4595. var e = this,
  4596. t = new qr(ai);
  4597. return this.pagingStatus === it.NOT_START && this.conversationMap.clear(), this._autoPagingSyncConversationList().then(function (n) {
  4598. return e.pagingStatus = it.RESOLVED, e._setStorageConversationList(), e._handleC2CPeerReadTime(), t.setText("".concat(e.conversationMap.size)).setNetworkType(e.getNetworkType()).setEnd(), n;
  4599. }).catch(function (n) {
  4600. return e.pagingStatus = it.REJECTED, t.setText(e.pagingTimeStamp), e.probeNetwork().then(function (e) {
  4601. var o = y(e, 2),
  4602. r = o[0],
  4603. i = o[1];
  4604. t.setError(n, r, i).setEnd();
  4605. }), Cr(n);
  4606. });
  4607. }
  4608. }, {
  4609. key: "_autoPagingSyncConversationList",
  4610. value: function () {
  4611. var e = this;
  4612. return this.pagingStatus = it.PENDING, this.request({
  4613. name: "conversation",
  4614. action: "pagingQuery",
  4615. param: {
  4616. fromAccount: this.tim.context.identifier,
  4617. timeStamp: this.pagingTimeStamp,
  4618. orderType: 1
  4619. }
  4620. }).then(function (t) {
  4621. var n = t.data,
  4622. o = n.completeFlag,
  4623. r = n.conversations,
  4624. i = void 0 === r ? [] : r,
  4625. s = n.timeStamp;
  4626. if (de.log("ConversationController._autoPagingSyncConversationList completeFlag=".concat(o, " nums=").concat(i.length)), i.length > 0) {
  4627. var a = e._getConversationOptions(i);
  4628. e._updateLocalConversationList(a, !0);
  4629. }
  4630. if (e._isReady) e._emitConversationUpdate();else {
  4631. if (!e.isLoggedIn()) return Mr();
  4632. e.triggerReady();
  4633. }
  4634. return e.pagingTimeStamp = s, 1 !== o ? e._autoPagingSyncConversationList() : (e._handleGroupAtTipsList(), Mr());
  4635. }).catch(function (t) {
  4636. throw e.isLoggedIn() && (e._isReady || (de.warn("ConversationController._autoPagingSyncConversationList failed. error:".concat(Re(t))), e.triggerReady())), t;
  4637. });
  4638. }
  4639. }, {
  4640. key: "_handleC2CPeerReadTime",
  4641. value: function () {
  4642. var e,
  4643. n = this.tim.messageController,
  4644. o = S(this.conversationMap);
  4645. try {
  4646. for (o.s(); !(e = o.n()).done;) {
  4647. var r = y(e.value, 2),
  4648. i = r[0],
  4649. s = r[1];
  4650. s.type === t.CONV_C2C && (de.debug("ConversationController._handleC2CPeerReadTime", i, s.peerReadTime), n.recordPeerReadTime(i, s.peerReadTime));
  4651. }
  4652. } catch (a) {
  4653. o.e(a);
  4654. } finally {
  4655. o.f();
  4656. }
  4657. }
  4658. }, {
  4659. key: "getConversationProfile",
  4660. value: function (e) {
  4661. var n = this,
  4662. o = this.conversationMap.has(e) ? this.conversationMap.get(e) : this._createLocalConversation(e);
  4663. if (o._isInfoCompleted || o.type === t.CONV_SYSTEM) return Mr({
  4664. conversation: o
  4665. });
  4666. var r = new qr(ri);
  4667. return de.log("ConversationController.getConversationProfile. conversationID:".concat(e, " lastMessage:"), o.lastMessage), this._updateUserOrGroupProfileCompletely(o).then(function (t) {
  4668. return r.setNetworkType(n.getNetworkType()).setText("conversationID=".concat(e, " unreadCount=").concat(t.data.conversation.unreadCount)).setEnd(), de.log("ConversationController.getConversationProfile ok. conversationID:", e), t;
  4669. }).catch(function (t) {
  4670. return n.probeNetwork().then(function (n) {
  4671. var o = y(n, 2),
  4672. i = o[0],
  4673. s = o[1];
  4674. r.setError(t, i, s).setText("conversationID=".concat(e)).setEnd();
  4675. }), de.error("ConversationController.getConversationProfile error:", t), Cr(t);
  4676. });
  4677. }
  4678. }, {
  4679. key: "deleteConversation",
  4680. value: function (e) {
  4681. var n = this,
  4682. o = {};
  4683. if (!this.conversationMap.has(e)) {
  4684. var r = new Ut({
  4685. code: qt.CONVERSATION_NOT_FOUND,
  4686. message: hn
  4687. });
  4688. return Cr(r);
  4689. }
  4690. switch (this.conversationMap.get(e).type) {
  4691. case t.CONV_C2C:
  4692. o.type = 1, o.toAccount = e.replace(t.CONV_C2C, "");
  4693. break;
  4694. case t.CONV_GROUP:
  4695. o.type = 2, o.toGroupID = e.replace(t.CONV_GROUP, "");
  4696. break;
  4697. case t.CONV_SYSTEM:
  4698. return this.tim.groupController.deleteGroupSystemNotice({
  4699. messageList: this.tim.messageController.getLocalMessageList(e)
  4700. }), this.deleteLocalConversation(e), Mr({
  4701. conversationID: e
  4702. });
  4703. default:
  4704. var i = new Ut({
  4705. code: qt.CONVERSATION_UN_RECORDED_TYPE,
  4706. message: mn
  4707. });
  4708. return Cr(i);
  4709. }
  4710. var s = new qr(ii);
  4711. return s.setText("conversationID=".concat(e)), de.log("ConversationController.deleteConversation. conversationID=".concat(e)), this.tim.setMessageRead({
  4712. conversationID: e
  4713. }).then(function () {
  4714. return n.request({
  4715. name: "conversation",
  4716. action: "delete",
  4717. param: o
  4718. });
  4719. }).then(function () {
  4720. return s.setNetworkType(n.getNetworkType()).setEnd(), de.log("ConversationController.deleteConversation ok."), n.deleteLocalConversation(e), Mr({
  4721. conversationID: e
  4722. });
  4723. }).catch(function (e) {
  4724. return n.probeNetwork().then(function (t) {
  4725. var n = y(t, 2),
  4726. o = n[0],
  4727. r = n[1];
  4728. s.setError(e, o, r).setEnd();
  4729. }), de.error("ConversationController.deleteConversation error:", e), Cr(e);
  4730. });
  4731. }
  4732. }, {
  4733. key: "getLocalConversationList",
  4734. value: function () {
  4735. return I(this.conversationMap.values());
  4736. }
  4737. }, {
  4738. key: "getLocalConversation",
  4739. value: function (e) {
  4740. return this.conversationMap.get(e);
  4741. }
  4742. }, {
  4743. key: "_initLocalConversationList",
  4744. value: function () {
  4745. var e = new qr(si);
  4746. de.time(Gr), de.log("ConversationController._initLocalConversationList.");
  4747. var t = this._getStorageConversationList();
  4748. if (t) {
  4749. for (var n = t.length, o = 0; o < n; o++) this.conversationMap.set(t[o].conversationID, new gs(t[o]));
  4750. this._emitConversationUpdate(!0, !1), e.setNetworkType(this.getNetworkType()).setText(n).setEnd();
  4751. } else e.setNetworkType(this.getNetworkType()).setText(0).setEnd();
  4752. this._syncConversationList();
  4753. }
  4754. }, {
  4755. key: "_getStorageConversationList",
  4756. value: function () {
  4757. return this.tim.storage.getItem("conversationMap");
  4758. }
  4759. }, {
  4760. key: "_setStorageConversationList",
  4761. value: function () {
  4762. var e = this.getLocalConversationList().slice(0, 20).map(function (e) {
  4763. return {
  4764. conversationID: e.conversationID,
  4765. type: e.type,
  4766. subType: e.subType,
  4767. lastMessage: e.lastMessage,
  4768. groupProfile: e.groupProfile,
  4769. userProfile: e.userProfile
  4770. };
  4771. });
  4772. this.tim.storage.setItem("conversationMap", e);
  4773. }
  4774. }, {
  4775. key: "_initListeners",
  4776. value: function () {
  4777. var e = this;
  4778. this.tim.innerEmitter.once(Mo, this._initLocalConversationList, this), this.tim.innerEmitter.on(Do, this._onSendOrReceiveMessage, this), this.tim.innerEmitter.on(So, this._handleSyncMessages, this), this.tim.innerEmitter.on(ko, this._handleSyncMessages, this), this.tim.innerEmitter.on(Ao, this._onSendOrReceiveMessage, this), this.tim.innerEmitter.on(Oo, this._onSendOrReceiveMessage, this), this.tim.innerEmitter.on(Ro, this._onSendOrReceiveMessage, this), this.tim.innerEmitter.on(Wo, this._onGroupListUpdated, this), this.tim.innerEmitter.on(rr, this._updateConversationUserProfile, this), this.tim.innerEmitter.on(No, this._onMessageRevoked, this), this.tim.innerEmitter.on(xo, this._onReceiveGroupAtTips, this), this.ready(function () {
  4779. e.tempGroupList.length > 0 && (e._updateConversationGroupProfile(e.tempGroupList), e.tempGroupList.length = 0);
  4780. });
  4781. }
  4782. }, {
  4783. key: "_onGroupListUpdated",
  4784. value: function (e) {
  4785. this._updateConversationGroupProfile(e.data);
  4786. }
  4787. }, {
  4788. key: "_updateConversationGroupProfile",
  4789. value: function (e) {
  4790. var t = this;
  4791. Ie(e) && 0 === e.length || (this.hasLocalConversationMap() ? (e.forEach(function (e) {
  4792. var n = "GROUP".concat(e.groupID);
  4793. if (t.conversationMap.has(n)) {
  4794. var o = t.conversationMap.get(n);
  4795. o.groupProfile = e, o.lastMessage.lastSequence < e.nextMessageSeq && (o.lastMessage.lastSequence = e.nextMessageSeq - 1), o.subType || (o.subType = e.type);
  4796. }
  4797. }), this._emitConversationUpdate(!0, !1)) : this.tempGroupList = e);
  4798. }
  4799. }, {
  4800. key: "_updateConversationUserProfile",
  4801. value: function (e) {
  4802. var t = this;
  4803. e.data.forEach(function (e) {
  4804. var n = "C2C".concat(e.userID);
  4805. t.conversationMap.has(n) && (t.conversationMap.get(n).userProfile = e);
  4806. }), this._emitConversationUpdate(!0, !1);
  4807. }
  4808. }, {
  4809. key: "_onMessageRevoked",
  4810. value: function (e) {
  4811. var t = this,
  4812. n = e.data;
  4813. if (0 !== n.length) {
  4814. var o = null,
  4815. r = !1;
  4816. n.forEach(function (e) {
  4817. (o = t.conversationMap.get(e.conversationID)) && o.isLastMessageRevoked(e) && (r = !0, o.setLastMessageRevoked(!0));
  4818. }), r && this._emitConversationUpdate(!0, !1);
  4819. }
  4820. }
  4821. }, {
  4822. key: "_onReceiveGroupAtTips",
  4823. value: function (e) {
  4824. var t = this,
  4825. n = e.data,
  4826. o = null;
  4827. n.forEach(function (e) {
  4828. e.groupAtTips ? o = e.groupAtTips : e.elements && (o = e.elements), o.__random = e.random, o.__sequence = e.clientSequence, t.tempGroupAtTipsList.push(o);
  4829. }), de.debug("ConversationController._onReceiveGroupAtTips isReady=".concat(this._isReady), this.tempGroupAtTipsList), this._isReady && this._handleGroupAtTipsList();
  4830. }
  4831. }, {
  4832. key: "_handleGroupAtTipsList",
  4833. value: function () {
  4834. var e = this;
  4835. if (0 !== this.tempGroupAtTipsList.length) {
  4836. var n = !1;
  4837. this.tempGroupAtTipsList.forEach(function (o) {
  4838. var r = o.groupID;
  4839. if (o.from !== e.tim.context.identifier) {
  4840. var i = e.conversationMap.get("".concat(t.CONV_GROUP).concat(r));
  4841. i && (i.updateGroupAtInfoList(o), n = !0);
  4842. }
  4843. }), n && this._emitConversationUpdate(!0, !1), this.tempGroupAtTipsList.length = 0;
  4844. }
  4845. }
  4846. }, {
  4847. key: "deleteGroupAtTips",
  4848. value: function (e) {
  4849. de.log("ConversationController.deleteGroupAtTips");
  4850. var t = this.conversationMap.get(e);
  4851. if (!t) return Promise.resolve();
  4852. var n = t.groupAtInfoList;
  4853. if (0 === n.length) return Promise.resolve();
  4854. var o = this.tim.context.identifier;
  4855. return this.request({
  4856. name: "conversation",
  4857. action: "deleteGroupAtTips",
  4858. param: {
  4859. messageListToDelete: n.map(function (e) {
  4860. return {
  4861. from: e.from,
  4862. to: o,
  4863. messageSeq: e.__sequence,
  4864. messageRandom: e.__random,
  4865. groupID: e.groupID
  4866. };
  4867. })
  4868. }
  4869. }).then(function () {
  4870. return de.log("ConversationController.deleteGroupAtTips ok. nums=".concat(n.length)), t.clearGroupAtInfoList(), Promise.resolve();
  4871. }).catch(function (e) {
  4872. return de.error("ConversationController.deleteGroupAtTips error:", e), Cr(e);
  4873. });
  4874. }
  4875. }, {
  4876. key: "_handleSyncMessages",
  4877. value: function (e) {
  4878. this._onSendOrReceiveMessage(e, !0);
  4879. }
  4880. }, {
  4881. key: "_onSendOrReceiveMessage",
  4882. value: function (e) {
  4883. var t = this,
  4884. n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
  4885. o = e.data.eventDataList;
  4886. this._isReady ? 0 !== o.length && (this._getPeerReadTime(o), this._updateLocalConversationList(o, !1, n), this._setStorageConversationList(), this._emitConversationUpdate()) : this.ready(function () {
  4887. t._onSendOrReceiveMessage(e, n);
  4888. });
  4889. }
  4890. }, {
  4891. key: "_getPeerReadTime",
  4892. value: function (e) {
  4893. var n = this,
  4894. o = [];
  4895. e.forEach(function (e) {
  4896. n.conversationMap.has(e.conversationID) || e.type !== t.CONV_C2C || o.push(e.conversationID.replace(t.CONV_C2C, ""));
  4897. }), o.length > 0 && (de.debug("ConversationController._getPeerReadTime userIDList:".concat(o)), this.tim.messageController.getPeerReadTime(o));
  4898. }
  4899. }, {
  4900. key: "_updateLocalConversationList",
  4901. value: function (e, t, n) {
  4902. var o;
  4903. o = this._updateTempConversations(e, t, n), this.conversationMap = new Map(this._sortConversations([].concat(I(o.conversations), I(this.conversationMap)))), t || this._updateUserOrGroupProfile(o.newerConversations);
  4904. }
  4905. }, {
  4906. key: "_updateTempConversations",
  4907. value: function (e, n, o) {
  4908. for (var r = [], i = [], s = 0, a = e.length; s < a; s++) {
  4909. var u = new gs(e[s]),
  4910. c = this.conversationMap.get(u.conversationID);
  4911. if (this.conversationMap.has(u.conversationID)) {
  4912. var l = ["unreadCount", "allowType", "adminForbidType", "payload"];
  4913. o && l.push("lastMessage"), Oe(c, u, l, [null, void 0, "", 0, NaN]), c.updateUnreadCount(u.unreadCount, n), o || (c.lastMessage.payload = e[s].lastMessage.payload), this.conversationMap.delete(c.conversationID), r.push([c.conversationID, c]);
  4914. } else {
  4915. if (u.type === t.CONV_GROUP) {
  4916. var p = u.groupProfile.groupID,
  4917. g = this.tim.groupController.getLocalGroupProfile(p);
  4918. g && (u.groupProfile = g, u.updateUnreadCount(0));
  4919. }
  4920. i.push(u), r.push([u.conversationID, u]);
  4921. }
  4922. }
  4923. return {
  4924. conversations: r,
  4925. newerConversations: i
  4926. };
  4927. }
  4928. }, {
  4929. key: "_sortConversations",
  4930. value: function (e) {
  4931. return e.sort(function (e, t) {
  4932. return t[1].lastMessage.lastTime - e[1].lastMessage.lastTime;
  4933. });
  4934. }
  4935. }, {
  4936. key: "_updateUserOrGroupProfile",
  4937. value: function (e) {
  4938. var n = this;
  4939. if (0 !== e.length) {
  4940. var o = [],
  4941. r = [];
  4942. e.forEach(function (e) {
  4943. if (e.type === t.CONV_C2C) o.push(e.toAccount);else if (e.type === t.CONV_GROUP) {
  4944. var i = e.toAccount;
  4945. n.tim.groupController.hasLocalGroup(i) ? e.groupProfile = n.tim.groupController.getLocalGroupProfile(i) : r.push(i);
  4946. }
  4947. }), o.length > 0 && this.tim.getUserProfile({
  4948. userIDList: o
  4949. }).then(function (e) {
  4950. var t = e.data;
  4951. Ie(t) ? t.forEach(function (e) {
  4952. n.conversationMap.get("C2C".concat(e.userID)).userProfile = e;
  4953. }) : n.conversationMap.get("C2C".concat(t.userID)).userProfile = t;
  4954. }), r.length > 0 && this.tim.groupController.getGroupProfileAdvance({
  4955. groupIDList: r,
  4956. responseFilter: {
  4957. groupBaseInfoFilter: ["Type", "Name", "FaceUrl"]
  4958. }
  4959. }).then(function (e) {
  4960. e.data.successGroupList.forEach(function (e) {
  4961. var t = "GROUP".concat(e.groupID);
  4962. if (n.conversationMap.has(t)) {
  4963. var o = n.conversationMap.get(t);
  4964. Oe(o.groupProfile, e, [], [null, void 0, "", 0, NaN]), !o.subType && e.type && (o.subType = e.type);
  4965. }
  4966. });
  4967. });
  4968. }
  4969. }
  4970. }, {
  4971. key: "_updateUserOrGroupProfileCompletely",
  4972. value: function (e) {
  4973. var n = this;
  4974. return e.type === t.CONV_C2C ? this.tim.getUserProfile({
  4975. userIDList: [e.toAccount]
  4976. }).then(function (t) {
  4977. var o = t.data;
  4978. return 0 === o.length ? Cr(new Ut({
  4979. code: qt.USER_OR_GROUP_NOT_FOUND,
  4980. message: dn
  4981. })) : (e.userProfile = o[0], e._isInfoCompleted = !0, n._unshiftConversation(e), Mr({
  4982. conversation: e
  4983. }));
  4984. }) : this.tim.getGroupProfile({
  4985. groupID: e.toAccount
  4986. }).then(function (t) {
  4987. return e.groupProfile = t.data.group, e._isInfoCompleted = !0, n._unshiftConversation(e), Mr({
  4988. conversation: e
  4989. });
  4990. });
  4991. }
  4992. }, {
  4993. key: "_unshiftConversation",
  4994. value: function (e) {
  4995. e instanceof gs && !this.conversationMap.has(e.conversationID) && (this.conversationMap = new Map([[e.conversationID, e]].concat(I(this.conversationMap))), this._setStorageConversationList(), this._emitConversationUpdate(!0, !1));
  4996. }
  4997. }, {
  4998. key: "deleteLocalConversation",
  4999. value: function (e) {
  5000. this.conversationMap.delete(e), this._setStorageConversationList(), this.emitInnerEvent(or, e), this._emitConversationUpdate(!0, !1);
  5001. }
  5002. }, {
  5003. key: "_getConversationOptions",
  5004. value: function (e) {
  5005. var t = [],
  5006. n = e.filter(function (e) {
  5007. var t = e.lastMsg;
  5008. return ye(t);
  5009. }).map(function (e) {
  5010. if (1 === e.type) {
  5011. var n = {
  5012. userID: e.userID,
  5013. nick: e.c2CNick,
  5014. avatar: e.c2CImage
  5015. };
  5016. return t.push(n), {
  5017. conversationID: "C2C".concat(e.userID),
  5018. type: "C2C",
  5019. lastMessage: {
  5020. lastTime: e.time,
  5021. lastSequence: e.sequence,
  5022. fromAccount: e.lastC2CMsgFromAccount,
  5023. messageForShow: e.messageShow,
  5024. type: e.lastMsg.elements[0] ? e.lastMsg.elements[0].type : null,
  5025. payload: e.lastMsg.elements[0] ? e.lastMsg.elements[0].content : null
  5026. },
  5027. userProfile: new Zi(n),
  5028. peerReadTime: e.c2cPeerReadTime
  5029. };
  5030. }
  5031. return {
  5032. conversationID: "GROUP".concat(e.groupID),
  5033. type: "GROUP",
  5034. lastMessage: {
  5035. lastTime: e.time,
  5036. lastSequence: e.messageReadSeq + e.unreadCount,
  5037. fromAccount: e.msgGroupFromAccount,
  5038. messageForShow: e.messageShow,
  5039. type: e.lastMsg.elements[0] ? e.lastMsg.elements[0].type : null,
  5040. payload: e.lastMsg.elements[0] ? e.lastMsg.elements[0].content : null
  5041. },
  5042. groupProfile: new cs({
  5043. groupID: e.groupID,
  5044. name: e.groupNick,
  5045. avatar: e.groupImage
  5046. }),
  5047. unreadCount: e.unreadCount,
  5048. peerReadTime: 0
  5049. };
  5050. });
  5051. return t.length > 0 && this.emitInnerEvent(nr, t), n;
  5052. }
  5053. }, {
  5054. key: "_emitConversationUpdate",
  5055. value: function () {
  5056. var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
  5057. n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],
  5058. o = I(this.conversationMap.values());
  5059. n && this.emitInnerEvent(tr, o), t && this.emitOuterEvent(e.CONVERSATION_LIST_UPDATED, o);
  5060. }
  5061. }, {
  5062. key: "_conversationMapTreeShaking",
  5063. value: function (e) {
  5064. var n = this,
  5065. o = new Map(I(this.conversationMap));
  5066. e.forEach(function (e) {
  5067. return o.delete(e.conversationID);
  5068. }), o.has(t.CONV_SYSTEM) && o.delete(t.CONV_SYSTEM);
  5069. var r = this.tim.groupController.getJoinedAVChatRoom();
  5070. r && r.forEach(function (e) {
  5071. o.delete("".concat(t.CONV_GROUP).concat(e));
  5072. }), I(o.keys()).forEach(function (e) {
  5073. return n.conversationMap.delete(e);
  5074. });
  5075. }
  5076. }, {
  5077. key: "reset",
  5078. value: function () {
  5079. this.pagingStatus = it.NOT_START, this.pagingTimeStamp = 0, this.conversationMap.clear(), this.tempGroupAtTipsList.length = 0, this.resetReady(), this.tim.innerEmitter.once(Mo, this._initLocalConversationList, this);
  5080. }
  5081. }]), s;
  5082. }(mr),
  5083. ds = function () {
  5084. function e(t) {
  5085. if (o(this, e), void 0 === t) throw new Ut({
  5086. code: qt.MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS,
  5087. message: zt
  5088. });
  5089. if (void 0 === t.tim) throw new Ut({
  5090. code: qt.MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS,
  5091. message: "".concat(zt, ".tim")
  5092. });
  5093. this.list = new Map(), this.tim = t.tim, this._initializeOptions(t);
  5094. }
  5095. return i(e, [{
  5096. key: "getLocalOldestMessageByConversationID",
  5097. value: function (e) {
  5098. if (!e) return null;
  5099. if (!this.list.has(e)) return null;
  5100. var t = this.list.get(e).values();
  5101. return t ? t.next().value : null;
  5102. }
  5103. }, {
  5104. key: "_initializeOptions",
  5105. value: function (e) {
  5106. this.options = {};
  5107. var t = {
  5108. memory: {
  5109. maxDatasPerKey: 100,
  5110. maxBytesPerData: 256,
  5111. maxKeys: 0
  5112. },
  5113. cache: {
  5114. maxDatasPerKey: 10,
  5115. maxBytesPerData: 256,
  5116. maxKeys: 0
  5117. }
  5118. };
  5119. for (var n in t) if (Object.prototype.hasOwnProperty.call(t, n)) {
  5120. if (void 0 === e[n]) {
  5121. this.options[n] = t[n];
  5122. continue;
  5123. }
  5124. var o = t[n];
  5125. for (var r in o) if (Object.prototype.hasOwnProperty.call(o, r)) {
  5126. if (void 0 === e[n][r]) {
  5127. this.options[n][r] = o[r];
  5128. continue;
  5129. }
  5130. this.options[n][r] = e[n][r];
  5131. }
  5132. }
  5133. }
  5134. }, {
  5135. key: "pushIn",
  5136. value: function (e) {
  5137. var t = e.conversationID,
  5138. n = e.ID,
  5139. o = !0;
  5140. return this.list.has(t) || this.list.set(t, new Map()), this.list.has(t) && this.list.get(t).has(n) ? o = !1 : this.list.get(t).set(n, e), o;
  5141. }
  5142. }, {
  5143. key: "unshift",
  5144. value: function (e) {
  5145. Ie(e) ? e.length > 0 && this._unshiftMultipleMessages(e) : this._unshiftSingleMessage(e);
  5146. }
  5147. }, {
  5148. key: "_unshiftSingleMessage",
  5149. value: function (e) {
  5150. var t = e.conversationID,
  5151. n = e.ID;
  5152. if (!this.list.has(t)) return this.list.set(t, new Map()), void this.list.get(t).set(n, e);
  5153. var o = Array.from(this.list.get(t));
  5154. o.unshift([n, e]), this.list.set(t, new Map(o));
  5155. }
  5156. }, {
  5157. key: "_unshiftMultipleMessages",
  5158. value: function (e) {
  5159. for (var t = e.length, n = [], o = e[0].conversationID, r = this.list.has(o) ? Array.from(this.list.get(o)) : [], i = 0; i < t; i++) n.push([e[i].ID, e[i]]);
  5160. this.list.set(o, new Map(n.concat(r)));
  5161. }
  5162. }, {
  5163. key: "remove",
  5164. value: function (e) {
  5165. var t = e.conversationID,
  5166. n = e.ID;
  5167. this.list.has(t) && this.list.get(t).delete(n);
  5168. }
  5169. }, {
  5170. key: "revoke",
  5171. value: function (e, t, n) {
  5172. if (de.debug("revoke message", e, t, n), this.list.has(e)) {
  5173. var o,
  5174. r = S(this.list.get(e));
  5175. try {
  5176. for (r.s(); !(o = r.n()).done;) {
  5177. var i = y(o.value, 2)[1];
  5178. if (i.sequence === t && !i.isRevoked && (Me(n) || i.random === n)) return i.isRevoked = !0, i;
  5179. }
  5180. } catch (s) {
  5181. r.e(s);
  5182. } finally {
  5183. r.f();
  5184. }
  5185. }
  5186. return null;
  5187. }
  5188. }, {
  5189. key: "removeByConversationID",
  5190. value: function (e) {
  5191. this.list.has(e) && this.list.delete(e);
  5192. }
  5193. }, {
  5194. key: "updateMessageIsPeerReadProperty",
  5195. value: function (e, t) {
  5196. var n = [];
  5197. if (this.list.has(e)) {
  5198. var o,
  5199. r = S(this.list.get(e));
  5200. try {
  5201. for (r.s(); !(o = r.n()).done;) {
  5202. var i = y(o.value, 2)[1];
  5203. i.time <= t && !i.isPeerRead && "out" === i.flow && (i.isPeerRead = !0, n.push(i));
  5204. }
  5205. } catch (s) {
  5206. r.e(s);
  5207. } finally {
  5208. r.f();
  5209. }
  5210. de.log("MessagesList.updateMessageIsPeerReadProperty conversationID=".concat(e, " peerReadTime=").concat(t, " count=").concat(n.length));
  5211. }
  5212. return n;
  5213. }
  5214. }, {
  5215. key: "hasLocalMessageList",
  5216. value: function (e) {
  5217. return this.list.has(e);
  5218. }
  5219. }, {
  5220. key: "getLocalMessageList",
  5221. value: function (e) {
  5222. return this.hasLocalMessageList(e) ? I(this.list.get(e).values()) : [];
  5223. }
  5224. }, {
  5225. key: "hasLocalMessage",
  5226. value: function (e, t) {
  5227. return !!this.hasLocalMessageList(e) && this.list.get(e).has(t);
  5228. }
  5229. }, {
  5230. key: "getLocalMessage",
  5231. value: function (e, t) {
  5232. return this.hasLocalMessage(e, t) ? this.list.get(e).get(t) : null;
  5233. }
  5234. }, {
  5235. key: "reset",
  5236. value: function () {
  5237. this.list.clear();
  5238. }
  5239. }]), e;
  5240. }(),
  5241. ms = function () {
  5242. function e(t) {
  5243. o(this, e), this.tim = t;
  5244. }
  5245. return i(e, [{
  5246. key: "setMessageRead",
  5247. value: function (e) {
  5248. var n = e.conversationID,
  5249. o = e.messageID,
  5250. r = this.tim.conversationController,
  5251. i = r.getLocalConversation(n);
  5252. if (de.log("ReadReportHandler.setMessageRead conversationID=".concat(n, " unreadCount=").concat(i ? i.unreadCount : 0)), !i) return Mr();
  5253. if (i.type !== t.CONV_GROUP || Xe(i.groupAtInfoList) || r.deleteGroupAtTips(n), 0 === i.unreadCount) return Mr();
  5254. var s = o ? this.tim.messageController.getLocalMessage(n, o) : null;
  5255. switch (i.type) {
  5256. case t.CONV_C2C:
  5257. return this._setC2CMessageRead({
  5258. conversationID: n,
  5259. lastMessageTime: s ? s.time : i.lastMessage.lastTime
  5260. });
  5261. case t.CONV_GROUP:
  5262. return this._setGroupMessageRead({
  5263. conversationID: n,
  5264. lastMessageSeq: s ? s.sequence : i.lastMessage.lastSequence
  5265. });
  5266. case t.CONV_SYSTEM:
  5267. return i.unreadCount = 0, Mr();
  5268. default:
  5269. return Mr();
  5270. }
  5271. }
  5272. }, {
  5273. key: "_setC2CMessageRead",
  5274. value: function (e) {
  5275. var t = this,
  5276. n = e.conversationID,
  5277. o = e.lastMessageTime;
  5278. de.log("ReadReportHandler._setC2CMessageRead conversationID=".concat(n, " lastMessageTime=").concat(o)), fe(o) || de.warn("ReadReportHandler._setC2CMessageRead 请勿修改 Conversation.lastMessage.lastTime,否则可能会导致已读上报结果不准确");
  5279. var r = new qr(Zr);
  5280. return r.setText("".concat(n, "-").concat(o)), this.tim.messageController.request({
  5281. name: "conversation",
  5282. action: "setC2CMessageRead",
  5283. param: {
  5284. C2CMsgReaded: {
  5285. cookie: "",
  5286. C2CMsgReadedItem: [{
  5287. toAccount: n.replace("C2C", ""),
  5288. lastMessageTime: o,
  5289. receipt: 1
  5290. }]
  5291. }
  5292. }
  5293. }).then(function () {
  5294. return r.setNetworkType(t.tim.netMonitor.getNetworkType()).setEnd(), de.log("ReadReportHandler._setC2CMessageRead ok."), t._updateIsReadAfterReadReport({
  5295. conversationID: n,
  5296. lastMessageTime: o
  5297. }), t._updateUnreadCount(n), new vr();
  5298. }).catch(function (e) {
  5299. return t.tim.netMonitor.probe().then(function (t) {
  5300. var n = y(t, 2),
  5301. o = n[0],
  5302. i = n[1];
  5303. r.setError(e, o, i).setEnd();
  5304. }), de.log("ReadReportHandler._setC2CMessageRead failed. ".concat(Re(e))), Cr(e);
  5305. });
  5306. }
  5307. }, {
  5308. key: "_setGroupMessageRead",
  5309. value: function (e) {
  5310. var t = this,
  5311. n = e.conversationID,
  5312. o = e.lastMessageSeq;
  5313. de.log("ReadReportHandler._setGroupMessageRead conversationID=".concat(n, " lastMessageSeq=").concat(o)), fe(o) || de.warn("ReadReportHandler._setGroupMessageRead 请勿修改 Conversation.lastMessage.lastSequence,否则可能会导致已读上报结果不准确");
  5314. var r = new qr(ei);
  5315. return r.setText("".concat(n, "-").concat(o)), this.tim.messageController.request({
  5316. name: "conversation",
  5317. action: "setGroupMessageRead",
  5318. param: {
  5319. groupID: n.replace("GROUP", ""),
  5320. messageReadSeq: o
  5321. }
  5322. }).then(function () {
  5323. return r.setNetworkType(t.tim.netMonitor.getNetworkType()).setEnd(), de.log("ReadReportHandler._setGroupMessageRead ok."), t._updateIsReadAfterReadReport({
  5324. conversationID: n,
  5325. lastMessageSeq: o
  5326. }), t._updateUnreadCount(n), new vr();
  5327. }).catch(function (e) {
  5328. return t.tim.netMonitor.probe().then(function (t) {
  5329. var n = y(t, 2),
  5330. o = n[0],
  5331. i = n[1];
  5332. r.setError(e, o, i).setEnd();
  5333. }), de.log("ReadReportHandler._setGroupMessageRead failed. ".concat(Re(e))), Cr(e);
  5334. });
  5335. }
  5336. }, {
  5337. key: "_updateUnreadCount",
  5338. value: function (e) {
  5339. var t = this.tim,
  5340. n = t.conversationController,
  5341. o = t.messageController,
  5342. r = n.getLocalConversation(e),
  5343. i = o.getLocalMessageList(e);
  5344. r && (r.unreadCount = i.filter(function (e) {
  5345. return !e.isRead && !e.getOnlineOnlyFlag();
  5346. }).length, de.log("ReadReportHandler._updateUnreadCount conversationID=".concat(r.conversationID, " unreadCount=").concat(r.unreadCount)));
  5347. }
  5348. }, {
  5349. key: "_updateIsReadAfterReadReport",
  5350. value: function (e) {
  5351. var t = e.conversationID,
  5352. n = e.lastMessageSeq,
  5353. o = e.lastMessageTime,
  5354. r = this.tim.messageController.getLocalMessageList(t);
  5355. if (0 !== r.length) for (var i, s = r.length - 1; s >= 0; s--) if (i = r[s], !(o && i.time > o || n && i.sequence > n)) {
  5356. if ("in" === i.flow && i.isRead) break;
  5357. i.setIsRead(!0);
  5358. }
  5359. }
  5360. }, {
  5361. key: "updateIsRead",
  5362. value: function (e) {
  5363. var n = this.tim,
  5364. o = n.conversationController,
  5365. r = n.messageController,
  5366. i = o.getLocalConversation(e),
  5367. s = r.getLocalMessageList(e);
  5368. if (i && 0 !== s.length && !je(i.type)) {
  5369. for (var a = [], u = 0; u < s.length; u++) "in" !== s[u].flow ? "out" !== s[u].flow || s[u].isRead || s[u].setIsRead(!0) : a.push(s[u]);
  5370. var c = 0;
  5371. if (i.type === t.CONV_C2C) {
  5372. var l = a.slice(-i.unreadCount).filter(function (e) {
  5373. return e.isRevoked;
  5374. }).length;
  5375. c = a.length - i.unreadCount - l;
  5376. } else c = a.length - i.unreadCount;
  5377. for (var p = 0; p < c && !a[p].isRead; p++) a[p].setIsRead(!0);
  5378. }
  5379. }
  5380. }]), e;
  5381. }(),
  5382. fs = function () {
  5383. function e(t) {
  5384. var n = t.tim,
  5385. r = t.messageController;
  5386. o(this, e), this.tim = n, this.messageController = r, this.completedMap = new Map(), this._initListener();
  5387. }
  5388. return i(e, [{
  5389. key: "getMessageList",
  5390. value: function (e) {
  5391. var t = this,
  5392. n = e.conversationID,
  5393. o = e.nextReqMessageID,
  5394. r = e.count;
  5395. if (this.tim.groupController.checkJoinedAVChatRoomByID(n.replace("GROUP", ""))) return de.log("GetMessageHandler.getMessageList not available in avchatroom. conversationID=".concat(n)), Mr({
  5396. messageList: [],
  5397. nextReqMessageID: "",
  5398. isCompleted: !0
  5399. });
  5400. (Me(r) || r > 15) && (r = 15);
  5401. var i = this._computeLeftCount({
  5402. conversationID: n,
  5403. nextReqMessageID: o
  5404. });
  5405. return de.log("GetMessageHandler.getMessageList. conversationID=".concat(n, " leftCount=").concat(i, " count=").concat(r, " nextReqMessageID=").concat(o)), this._needGetHistory({
  5406. conversationID: n,
  5407. leftCount: i,
  5408. count: r
  5409. }) ? this.messageController.getHistoryMessages({
  5410. conversationID: n,
  5411. count: 20
  5412. }).then(function () {
  5413. return i = t._computeLeftCount({
  5414. conversationID: n,
  5415. nextReqMessageID: o
  5416. }), new vr(t._computeResult({
  5417. conversationID: n,
  5418. nextReqMessageID: o,
  5419. count: r,
  5420. leftCount: i
  5421. }));
  5422. }) : (de.log("GetMessageHandler.getMessageList. get messagelist from memory"), Mr(this._computeResult({
  5423. conversationID: n,
  5424. nextReqMessageID: o,
  5425. count: r,
  5426. leftCount: i
  5427. })));
  5428. }
  5429. }, {
  5430. key: "setCompleted",
  5431. value: function (e) {
  5432. de.log("GetMessageHandler.setCompleted. conversationID=".concat(e)), this.completedMap.set(e, !0);
  5433. }
  5434. }, {
  5435. key: "deleteCompletedItem",
  5436. value: function (e) {
  5437. de.log("GetMessageHandler.deleteCompletedItem. conversationID=".concat(e)), this.completedMap.delete(e);
  5438. }
  5439. }, {
  5440. key: "_initListener",
  5441. value: function () {
  5442. var e = this;
  5443. this.tim.innerEmitter.on(ar, function () {
  5444. e.setCompleted(t.CONV_SYSTEM);
  5445. }), this.tim.innerEmitter.on(ir, function (n) {
  5446. var o = n.data;
  5447. e.setCompleted("".concat(t.CONV_GROUP).concat(o));
  5448. });
  5449. }
  5450. }, {
  5451. key: "_getMessageListSize",
  5452. value: function (e) {
  5453. return this.messageController.getLocalMessageList(e).length;
  5454. }
  5455. }, {
  5456. key: "_needGetHistory",
  5457. value: function (e) {
  5458. var n = e.conversationID,
  5459. o = e.leftCount,
  5460. r = e.count,
  5461. i = this.tim.conversationController.getLocalConversation(n),
  5462. s = !!i && i.type === t.CONV_SYSTEM,
  5463. a = !!i && i.subType === t.GRP_AVCHATROOM;
  5464. return !s && !a && o < r && !this.completedMap.has(n);
  5465. }
  5466. }, {
  5467. key: "_computeResult",
  5468. value: function (e) {
  5469. var t = e.conversationID,
  5470. n = e.nextReqMessageID,
  5471. o = e.count,
  5472. r = e.leftCount,
  5473. i = this._computeMessageList({
  5474. conversationID: t,
  5475. nextReqMessageID: n,
  5476. count: o
  5477. }),
  5478. s = this._computeIsCompleted({
  5479. conversationID: t,
  5480. leftCount: r,
  5481. count: o
  5482. }),
  5483. a = this._computeNextReqMessageID({
  5484. messageList: i,
  5485. isCompleted: s,
  5486. conversationID: t
  5487. });
  5488. return de.log("GetMessageHandler._computeResult. conversationID=".concat(t, " leftCount=").concat(r, " count=").concat(o, " nextReqMessageID=").concat(a, " nums=").concat(i.length, " isCompleted=").concat(s)), {
  5489. messageList: i,
  5490. nextReqMessageID: a,
  5491. isCompleted: s
  5492. };
  5493. }
  5494. }, {
  5495. key: "_computeNextReqMessageID",
  5496. value: function (e) {
  5497. var t = e.messageList,
  5498. n = e.isCompleted,
  5499. o = e.conversationID;
  5500. if (!n) return 0 === t.length ? "" : t[0].ID;
  5501. var r = this.messageController.getLocalMessageList(o);
  5502. return 0 === r.length ? "" : r[0].ID;
  5503. }
  5504. }, {
  5505. key: "_computeMessageList",
  5506. value: function (e) {
  5507. var t = e.conversationID,
  5508. n = e.nextReqMessageID,
  5509. o = e.count,
  5510. r = this.messageController.getLocalMessageList(t),
  5511. i = this._computeIndexEnd({
  5512. nextReqMessageID: n,
  5513. messageList: r
  5514. }),
  5515. s = this._computeIndexStart({
  5516. indexEnd: i,
  5517. count: o
  5518. });
  5519. return r.slice(s, i);
  5520. }
  5521. }, {
  5522. key: "_computeIndexEnd",
  5523. value: function (e) {
  5524. var t = e.messageList,
  5525. n = void 0 === t ? [] : t,
  5526. o = e.nextReqMessageID;
  5527. return o ? n.findIndex(function (e) {
  5528. return e.ID === o;
  5529. }) : n.length;
  5530. }
  5531. }, {
  5532. key: "_computeIndexStart",
  5533. value: function (e) {
  5534. var t = e.indexEnd,
  5535. n = e.count;
  5536. return t > n ? t - n : 0;
  5537. }
  5538. }, {
  5539. key: "_computeLeftCount",
  5540. value: function (e) {
  5541. var t = e.conversationID,
  5542. n = e.nextReqMessageID;
  5543. return n ? this.messageController.getLocalMessageList(t).findIndex(function (e) {
  5544. return e.ID === n;
  5545. }) : this._getMessageListSize(t);
  5546. }
  5547. }, {
  5548. key: "_computeIsCompleted",
  5549. value: function (e) {
  5550. var t = e.conversationID;
  5551. return !!(e.leftCount <= e.count && this.completedMap.has(t));
  5552. }
  5553. }, {
  5554. key: "reset",
  5555. value: function () {
  5556. de.log("GetMessageHandler.reset"), this.completedMap.clear();
  5557. }
  5558. }]), e;
  5559. }(),
  5560. _s = function e(t) {
  5561. o(this, e), this.value = t, this.next = null;
  5562. },
  5563. vs = function () {
  5564. function e(t) {
  5565. o(this, e), this.MAX_LENGTH = t, this.pTail = null, this.pNodeToDel = null, this.map = new Map(), de.log("SinglyLinkedList init MAX_LENGTH=".concat(this.MAX_LENGTH));
  5566. }
  5567. return i(e, [{
  5568. key: "pushIn",
  5569. value: function (e) {
  5570. var t = new _s(e);
  5571. if (this.map.size < this.MAX_LENGTH) null === this.pTail ? (this.pTail = t, this.pNodeToDel = t) : (this.pTail.next = t, this.pTail = t), this.map.set(e, 1);else {
  5572. var n = this.pNodeToDel;
  5573. this.pNodeToDel = this.pNodeToDel.next, this.map.delete(n.value), n.next = null, n = null, this.pTail.next = t, this.pTail = t, this.map.set(e, 1);
  5574. }
  5575. }
  5576. }, {
  5577. key: "has",
  5578. value: function (e) {
  5579. return this.map.has(e);
  5580. }
  5581. }, {
  5582. key: "tail",
  5583. value: function () {
  5584. return this.pTail;
  5585. }
  5586. }, {
  5587. key: "size",
  5588. value: function () {
  5589. return this.map.size;
  5590. }
  5591. }, {
  5592. key: "data",
  5593. value: function () {
  5594. return Array.from(this.map.keys());
  5595. }
  5596. }, {
  5597. key: "reset",
  5598. value: function () {
  5599. for (var e; null !== this.pNodeToDel;) e = this.pNodeToDel, this.pNodeToDel = this.pNodeToDel.next, e.next = null, e = null;
  5600. this.pTail = null, this.map.clear();
  5601. }
  5602. }]), e;
  5603. }(),
  5604. ys = function () {
  5605. function e(t) {
  5606. o(this, e), this.tim = t;
  5607. }
  5608. return i(e, [{
  5609. key: "upload",
  5610. value: function (e) {
  5611. switch (e.type) {
  5612. case t.MSG_IMAGE:
  5613. return this._uploadImage(e);
  5614. case t.MSG_FILE:
  5615. return this._uploadFile(e);
  5616. case t.MSG_AUDIO:
  5617. return this._uploadAudio(e);
  5618. case t.MSG_VIDEO:
  5619. return this._uploadVideo(e);
  5620. default:
  5621. return Promise.resolve();
  5622. }
  5623. }
  5624. }, {
  5625. key: "_uploadImage",
  5626. value: function (e) {
  5627. var t = this.tim,
  5628. n = t.uploadController,
  5629. o = t.messageController,
  5630. r = e.getElements()[0],
  5631. i = o.getMessageOptionByID(e.messageID);
  5632. return n.uploadImage({
  5633. file: i.payload.file,
  5634. to: i.to,
  5635. onProgress: function (e) {
  5636. if (r.updatePercent(e), Ee(i.onProgress)) try {
  5637. i.onProgress(e);
  5638. } catch (t) {
  5639. return Cr(new Ut({
  5640. code: qt.MESSAGE_ONPROGRESS_FUNCTION_ERROR,
  5641. message: "".concat(Qt)
  5642. }));
  5643. }
  5644. }
  5645. }).then(function (t) {
  5646. var n = t.location,
  5647. o = t.fileType,
  5648. i = t.fileSize,
  5649. s = t.width,
  5650. a = t.height,
  5651. c = Fe(n);
  5652. r.updateImageFormat(o);
  5653. var l = ze({
  5654. originUrl: c,
  5655. originWidth: s,
  5656. originHeight: a,
  5657. min: 198
  5658. }),
  5659. p = ze({
  5660. originUrl: c,
  5661. originWidth: s,
  5662. originHeight: a,
  5663. min: 720
  5664. });
  5665. return r.updateImageInfoArray([{
  5666. size: i,
  5667. url: c,
  5668. width: s,
  5669. height: a
  5670. }, u({}, p), u({}, l)]), e;
  5671. });
  5672. }
  5673. }, {
  5674. key: "_uploadFile",
  5675. value: function (e) {
  5676. var t = this.tim,
  5677. n = t.uploadController,
  5678. o = t.messageController,
  5679. r = e.getElements()[0],
  5680. i = o.getMessageOptionByID(e.messageID);
  5681. return n.uploadFile({
  5682. file: i.payload.file,
  5683. to: i.to,
  5684. onProgress: function (e) {
  5685. if (r.updatePercent(e), Ee(i.onProgress)) try {
  5686. i.onProgress(e);
  5687. } catch (t) {
  5688. return Cr(new Ut({
  5689. code: qt.MESSAGE_ONPROGRESS_FUNCTION_ERROR,
  5690. message: "".concat(Qt)
  5691. }));
  5692. }
  5693. }
  5694. }).then(function (t) {
  5695. var n = t.location,
  5696. o = Fe(n);
  5697. return r.updateFileUrl(o), e;
  5698. });
  5699. }
  5700. }, {
  5701. key: "_uploadAudio",
  5702. value: function (e) {
  5703. var t = this.tim,
  5704. n = t.uploadController,
  5705. o = t.messageController,
  5706. r = e.getElements()[0],
  5707. i = o.getMessageOptionByID(e.messageID);
  5708. return n.uploadAudio({
  5709. file: i.payload.file,
  5710. to: i.to,
  5711. onProgress: function (e) {
  5712. if (r.updatePercent(e), Ee(i.onProgress)) try {
  5713. i.onProgress(e);
  5714. } catch (t) {
  5715. return Cr(new Ut({
  5716. code: qt.MESSAGE_ONPROGRESS_FUNCTION_ERROR,
  5717. message: "".concat(Qt)
  5718. }));
  5719. }
  5720. }
  5721. }).then(function (t) {
  5722. var n = t.location,
  5723. o = Fe(n);
  5724. return r.updateAudioUrl(o), e;
  5725. });
  5726. }
  5727. }, {
  5728. key: "_uploadVideo",
  5729. value: function (e) {
  5730. var t = this.tim,
  5731. n = t.uploadController,
  5732. o = t.messageController,
  5733. r = e.getElements()[0],
  5734. i = o.getMessageOptionByID(e.messageID);
  5735. return n.uploadVideo({
  5736. file: i.payload.file,
  5737. to: i.to,
  5738. onProgress: function (e) {
  5739. if (r.updatePercent(e), Ee(i.onProgress)) try {
  5740. i.onProgress(e);
  5741. } catch (t) {
  5742. return Cr(new Ut({
  5743. code: qt.MESSAGE_ONPROGRESS_FUNCTION_ERROR,
  5744. message: "".concat(Qt)
  5745. }));
  5746. }
  5747. }
  5748. }).then(function (t) {
  5749. var n = Fe(t.location);
  5750. return r.updateVideoUrl(n), e;
  5751. });
  5752. }
  5753. }]), e;
  5754. }(),
  5755. Is = function (n) {
  5756. c(s, n);
  5757. var r = v(s);
  5758. function s(e) {
  5759. var t;
  5760. return o(this, s), (t = r.call(this, e))._initializeMembers(), t._initializeListener(), t._initializeHandlers(), t.messageOptionMap = new Map(), t;
  5761. }
  5762. return i(s, [{
  5763. key: "_initializeMembers",
  5764. value: function () {
  5765. this.messagesList = new ds({
  5766. tim: this.tim
  5767. }), this.currentMessageKey = {}, this.singlyLinkedList = new vs(100), this._peerReadTimeMap = new Map();
  5768. }
  5769. }, {
  5770. key: "_initializeHandlers",
  5771. value: function () {
  5772. this.readReportHandler = new ms(this.tim, this), this.getMessageHandler = new fs({
  5773. messageController: this,
  5774. tim: this.tim
  5775. }), this.uploadFileHandler = new ys(this.tim);
  5776. }
  5777. }, {
  5778. key: "reset",
  5779. value: function () {
  5780. this.messagesList.reset(), this.currentMessageKey = {}, this.getMessageHandler.reset(), this.singlyLinkedList.reset(), this._peerReadTimeMap.clear(), this.messageOptionMap.clear();
  5781. }
  5782. }, {
  5783. key: "_initializeListener",
  5784. value: function () {
  5785. var e = this.tim.innerEmitter;
  5786. e.on(Uo, this._onReceiveC2CMessage, this), e.on(Eo, this._onSyncMessagesProcessing, this), e.on(To, this._onSyncMessagesFinished, this), e.on(qo, this._onReceiveGroupMessage, this), e.on(Fo, this._onReceiveGroupTips, this), e.on(Vo, this._onReceiveSystemNotice, this), e.on(Bo, this._onReceiveGroupMessageRevokedNotice, this), e.on(jo, this._onReceiveC2CMessageRevokedNotice, this), e.on($o, this._onC2CMessageReadReceipt, this), e.on(or, this._clearConversationMessages, this);
  5787. }
  5788. }, {
  5789. key: "_guardForAVChatRoom",
  5790. value: function (e) {
  5791. if (e.conversationType === t.CONV_GROUP) {
  5792. var n = this.tim.groupController,
  5793. o = e.to;
  5794. return n.hasLocalGroup(o) ? Promise.resolve() : n.getGroupProfile({
  5795. groupID: o
  5796. }).then(function (n) {
  5797. var r = n.data.group.type;
  5798. if (de.log("MessageController._guardForAVChatRoom. groupID=".concat(o, " type=").concat(r)), r === t.GRP_AVCHATROOM) {
  5799. var i = "userId=".concat(e.from, " 未加入群 groupID=").concat(o, "。发消息前先使用 joinGroup 接口申请加群,详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#joinGroup");
  5800. return de.warn("MessageController._guardForAVChatRoom sendMessage not allowed. ".concat(i)), Cr(new Ut({
  5801. code: qt.MESSAGE_SEND_FAIL,
  5802. message: i,
  5803. data: {
  5804. message: e
  5805. }
  5806. }));
  5807. }
  5808. return Promise.resolve();
  5809. });
  5810. }
  5811. return Promise.resolve();
  5812. }
  5813. }, {
  5814. key: "sendMessageInstance",
  5815. value: function (e, n) {
  5816. var o,
  5817. r = this,
  5818. i = null;
  5819. switch (e.conversationType) {
  5820. case t.CONV_C2C:
  5821. i = this._handleOnSendC2CMessageSuccess.bind(this);
  5822. break;
  5823. case t.CONV_GROUP:
  5824. i = this._handleOnSendGroupMessageSuccess.bind(this);
  5825. break;
  5826. default:
  5827. return Cr(new Ut({
  5828. code: qt.MESSAGE_SEND_INVALID_CONVERSATION_TYPE,
  5829. message: Jt
  5830. }));
  5831. }
  5832. return this.singlyLinkedList.pushIn(e.random), this.uploadFileHandler.upload(e).then(function () {
  5833. return r._guardForAVChatRoom(e).then(function () {
  5834. var i = null;
  5835. return e.isSendable() ? (r._addSendMessageTotalCount(e), o = Date.now(), e.conversationType === t.CONV_C2C ? i = r._createC2CMessagePack(e, n) : e.conversationType === t.CONV_GROUP && (i = r._createGroupMessagePack(e, n)), r.request(i)) : Cr({
  5836. code: qt.MESSAGE_FILE_URL_IS_EMPTY,
  5837. message: gn
  5838. });
  5839. }).then(function (s) {
  5840. return r._addSendMessageSuccessCount(e, o), e.conversationType === t.CONV_GROUP && (e.sequence = s.data.sequence, e.time = s.data.time, e.generateMessageID(r.tim.context.identifier)), r.messagesList.pushIn(e), i(e, s.data), r.messageOptionMap.delete(e.messageID), r._isOnlineMessage(e, n) ? e.setOnlineOnlyFlag(!0) : r.emitInnerEvent(Do, {
  5841. eventDataList: [{
  5842. conversationID: e.conversationID,
  5843. unreadCount: 0,
  5844. type: e.conversationType,
  5845. subType: e.conversationSubType,
  5846. lastMessage: e
  5847. }]
  5848. }), "TIMImageElem" === e.type && We(e.payload.imageInfoArray), new vr({
  5849. message: e
  5850. });
  5851. }).catch(function (t) {
  5852. e.status = rt.FAIL;
  5853. var n = new qr(zr);
  5854. return n.setMessageType(e.type).setText("".concat(r._generateTjgID(e), "-").concat(e.type, "-").concat(e.from, "-").concat(e.to)), r.probeNetwork().then(function (e) {
  5855. var o = y(e, 2),
  5856. r = o[0],
  5857. i = o[1];
  5858. n.setError(t, r, i).setEnd();
  5859. }), de.error("MessageController.sendMessageInstance error:", t), Cr(new Ut({
  5860. code: t && t.code ? t.code : qt.MESSAGE_SEND_FAIL,
  5861. message: t && t.message ? t.message : Yt,
  5862. data: {
  5863. message: e
  5864. }
  5865. }));
  5866. });
  5867. });
  5868. }
  5869. }, {
  5870. key: "_getSendMessageSpecifiedKey",
  5871. value: function (e) {
  5872. if (e.conversationType === t.CONV_C2C) return Ar;
  5873. if (e.conversationType === t.CONV_GROUP) {
  5874. var n = this.tim.groupController.getLocalGroupProfile(e.to);
  5875. if (!n) return;
  5876. var o = n.type;
  5877. if (Ve(o)) return Or;
  5878. if (Ke(o)) return Rr;
  5879. if (He(o)) return Nr;
  5880. if (Be(o)) return Lr;
  5881. }
  5882. }
  5883. }, {
  5884. key: "_addSendMessageTotalCount",
  5885. value: function (e) {
  5886. var t = this.tim.sumStatController;
  5887. t.addTotalCount(kr);
  5888. var n = this._getSendMessageSpecifiedKey(e);
  5889. n && t.addTotalCount(n);
  5890. }
  5891. }, {
  5892. key: "_addSendMessageSuccessCount",
  5893. value: function (e, t) {
  5894. var n = this.tim.sumStatController,
  5895. o = Math.abs(Date.now() - t);
  5896. n.addSuccessCount(kr), n.addCost(kr, o);
  5897. var r = this._getSendMessageSpecifiedKey(e);
  5898. r && (n.addSuccessCount(r), n.addCost(r, o));
  5899. }
  5900. }, {
  5901. key: "resendMessage",
  5902. value: function (e) {
  5903. return e.isResend = !0, e.status = rt.UNSEND, this.sendMessageInstance(e);
  5904. }
  5905. }, {
  5906. key: "_isFileLikeMessage",
  5907. value: function (e) {
  5908. return [t.MSG_IMAGE, t.MSG_FILE, t.MSG_AUDIO, t.MSG_VIDEO].indexOf(e.type) >= 0;
  5909. }
  5910. }, {
  5911. key: "_resendBinaryTypeMessage",
  5912. value: function () {}
  5913. }, {
  5914. key: "_canIUseOnlineOnlyFlag",
  5915. value: function (e) {
  5916. var n = this.tim.groupController.getJoinedAVChatRoom();
  5917. return !n || !n.includes(e.to) || e.conversationType !== t.CONV_GROUP;
  5918. }
  5919. }, {
  5920. key: "_isOnlineMessage",
  5921. value: function (e, t) {
  5922. return !(!this._canIUseOnlineOnlyFlag(e) || !t || !0 !== t.onlineUserOnly);
  5923. }
  5924. }, {
  5925. key: "_createC2CMessagePack",
  5926. value: function (e, t) {
  5927. var n = null;
  5928. return t && (t.offlinePushInfo && (n = t.offlinePushInfo), !0 === t.onlineUserOnly && (n ? n.disablePush = !0 : n = {
  5929. disablePush: !0
  5930. })), {
  5931. name: "c2cMessage",
  5932. action: "create",
  5933. tjgID: this._generateTjgID(e),
  5934. param: {
  5935. toAccount: e.to,
  5936. msgBody: e.getElements(),
  5937. msgSeq: e.sequence,
  5938. msgRandom: e.random,
  5939. msgLifeTime: this._isOnlineMessage(e, t) ? 0 : void 0,
  5940. offlinePushInfo: n ? {
  5941. pushFlag: !0 === n.disablePush ? 1 : 0,
  5942. title: n.title || "",
  5943. desc: n.description || "",
  5944. ext: n.extension || "",
  5945. apnsInfo: {
  5946. badgeMode: !0 === n.ignoreIOSBadge ? 1 : 0
  5947. },
  5948. androidInfo: {
  5949. OPPOChannelID: n.androidOPPOChannelID || ""
  5950. }
  5951. } : void 0
  5952. }
  5953. };
  5954. }
  5955. }, {
  5956. key: "_handleOnSendC2CMessageSuccess",
  5957. value: function (e, t) {
  5958. e.status = rt.SUCCESS, e.time = t.time;
  5959. }
  5960. }, {
  5961. key: "_createGroupMessagePack",
  5962. value: function (e, n) {
  5963. var o = null;
  5964. n && n.offlinePushInfo && (o = n.offlinePushInfo);
  5965. var r = e.getGroupAtInfoList();
  5966. return {
  5967. name: "groupMessage",
  5968. action: "create",
  5969. tjgID: this._generateTjgID(e),
  5970. param: {
  5971. groupID: e.to,
  5972. msgBody: e.getElements(),
  5973. random: e.random,
  5974. priority: e.priority,
  5975. clientSequence: e.clientSequence,
  5976. groupAtInfo: e.type !== t.MSG_TEXT || Xe(r) ? void 0 : r,
  5977. onlineOnlyFlag: this._isOnlineMessage(e, n) ? 1 : 0,
  5978. offlinePushInfo: o ? {
  5979. pushFlag: !0 === o.disablePush ? 1 : 0,
  5980. title: o.title || "",
  5981. desc: o.description || "",
  5982. ext: o.extension || "",
  5983. apnsInfo: {
  5984. badgeMode: !0 === o.ignoreIOSBadge ? 1 : 0
  5985. },
  5986. androidInfo: {
  5987. OPPOChannelID: o.androidOPPOChannelID || ""
  5988. }
  5989. } : void 0
  5990. }
  5991. };
  5992. }
  5993. }, {
  5994. key: "_handleOnSendGroupMessageSuccess",
  5995. value: function (e, t) {
  5996. e.sequence = t.sequence, e.time = t.time, e.status = rt.SUCCESS;
  5997. }
  5998. }, {
  5999. key: "_onReceiveC2CMessage",
  6000. value: function (n) {
  6001. de.debug("MessageController._onReceiveC2CMessage nums=".concat(n.data.length));
  6002. var o = Date.now(),
  6003. r = this._newC2CMessageStoredAndSummary({
  6004. notifiesList: n.data,
  6005. type: t.CONV_C2C,
  6006. C2CRemainingUnreadList: n.C2CRemainingUnreadList
  6007. }),
  6008. i = r.eventDataList,
  6009. s = r.result;
  6010. if (i.length > 0 && this.emitInnerEvent(Ao, {
  6011. eventDataList: i,
  6012. result: s
  6013. }), s.length > 0) {
  6014. var a = this.tim.sumStatController;
  6015. a.addTotalCount(wr), a.addSuccessCount(wr), a.addCost(wr, Date.now() - o), this.emitOuterEvent(e.MESSAGE_RECEIVED, s);
  6016. }
  6017. }
  6018. }, {
  6019. key: "_onReceiveGroupMessage",
  6020. value: function (t) {
  6021. de.debug("MessageController._onReceiveGroupMessage nums=".concat(t.data.length));
  6022. var n = Date.now(),
  6023. o = this.newGroupMessageStoredAndSummary(t.data),
  6024. r = o.eventDataList,
  6025. i = o.result;
  6026. if (r.length > 0 && this.emitInnerEvent(Oo, {
  6027. eventDataList: r,
  6028. result: i,
  6029. isGroupTip: !1
  6030. }), i.length > 0) {
  6031. var s = this.tim.sumStatController;
  6032. s.addTotalCount(wr), s.addSuccessCount(wr), s.addCost(wr, Date.now() - n), this.emitOuterEvent(e.MESSAGE_RECEIVED, i);
  6033. }
  6034. }
  6035. }, {
  6036. key: "_onReceiveGroupTips",
  6037. value: function (t) {
  6038. var n = Date.now(),
  6039. o = t.data;
  6040. de.debug("MessageController._onReceiveGroupTips nums=".concat(o.length));
  6041. var r = this.newGroupTipsStoredAndSummary(o),
  6042. i = r.eventDataList,
  6043. s = r.result;
  6044. if (i.length > 0 && this.emitInnerEvent(Oo, {
  6045. eventDataList: i,
  6046. result: s,
  6047. isGroupTip: !0
  6048. }), s.length > 0) {
  6049. var a = this.tim.sumStatController;
  6050. a.addTotalCount(wr), a.addSuccessCount(wr), a.addCost(wr, Date.now() - n), this.emitOuterEvent(e.MESSAGE_RECEIVED, s);
  6051. }
  6052. }
  6053. }, {
  6054. key: "_onReceiveSystemNotice",
  6055. value: function (t) {
  6056. var n = Date.now(),
  6057. o = t.data,
  6058. r = o.groupSystemNotices,
  6059. i = o.type;
  6060. de.debug("MessageController._onReceiveSystemNotice nums=".concat(r.length));
  6061. var s = this.newSystemNoticeStoredAndSummary({
  6062. notifiesList: r,
  6063. type: i
  6064. }),
  6065. a = s.eventDataList,
  6066. u = s.result;
  6067. if (a.length > 0 && this.emitInnerEvent(Ro, {
  6068. eventDataList: a,
  6069. result: u,
  6070. type: i
  6071. }), u.length > 0 && "poll" === i) {
  6072. var c = this.tim.sumStatController;
  6073. c.addTotalCount(wr), c.addSuccessCount(wr), c.addCost(wr, Date.now() - n), this.emitOuterEvent(e.MESSAGE_RECEIVED, u);
  6074. }
  6075. }
  6076. }, {
  6077. key: "_onReceiveGroupMessageRevokedNotice",
  6078. value: function (t) {
  6079. var n = this;
  6080. de.debug("MessageController._onReceiveGroupMessageRevokedNotice nums=".concat(t.data.length));
  6081. var o = [],
  6082. r = null;
  6083. t.data.forEach(function (e) {
  6084. e.elements.revokedInfos.forEach(function (e) {
  6085. (r = n.messagesList.revoke("GROUP".concat(e.groupID), e.sequence)) && o.push(r);
  6086. });
  6087. }), 0 !== o.length && (this.emitInnerEvent(No, o), this.emitOuterEvent(e.MESSAGE_REVOKED, o));
  6088. }
  6089. }, {
  6090. key: "_onReceiveC2CMessageRevokedNotice",
  6091. value: function (t) {
  6092. var n = this;
  6093. de.debug("MessageController._onReceiveC2CMessageRevokedNotice nums=".concat(t.data.length));
  6094. var o = [],
  6095. r = null;
  6096. t.data.forEach(function (e) {
  6097. e.c2cMessageRevokedNotify.revokedInfos.forEach(function (e) {
  6098. var t = n.tim.context.identifier === e.from ? "C2C".concat(e.to) : "C2C".concat(e.from);
  6099. (r = n.messagesList.revoke(t, e.sequence, e.random)) && o.push(r);
  6100. });
  6101. }), 0 !== o.length && (this.emitInnerEvent(No, o), this.emitOuterEvent(e.MESSAGE_REVOKED, o));
  6102. }
  6103. }, {
  6104. key: "_onC2CMessageReadReceipt",
  6105. value: function (e) {
  6106. var t = this;
  6107. e.data.forEach(function (e) {
  6108. if (!Xe(e.c2cMessageReadReceipt)) {
  6109. var n = e.c2cMessageReadReceipt.to;
  6110. e.c2cMessageReadReceipt.uinPairReadArray.forEach(function (e) {
  6111. var o = e.peerReadTime;
  6112. de.debug("MessageController._onC2CMessageReadReceipt to=".concat(n, " peerReadTime=").concat(o));
  6113. var r = "C2C".concat(n);
  6114. t.recordPeerReadTime(r, o), t._updateMessageIsPeerReadProperty(r, o);
  6115. });
  6116. }
  6117. });
  6118. }
  6119. }, {
  6120. key: "_updateMessageIsPeerReadProperty",
  6121. value: function (n, o) {
  6122. if (n.startsWith(t.CONV_C2C) && o > 0) {
  6123. var r = this.messagesList.updateMessageIsPeerReadProperty(n, o);
  6124. r.length > 0 && this.emitOuterEvent(e.MESSAGE_READ_BY_PEER, r);
  6125. }
  6126. }
  6127. }, {
  6128. key: "getPeerReadTime",
  6129. value: function (e) {
  6130. var t = this;
  6131. if (!Xe(e)) {
  6132. var n = new qr(ni);
  6133. return de.log("MessageController.getPeerReadTime userIDList:".concat(e)), this.request({
  6134. name: "c2cPeerReadTime",
  6135. action: "get",
  6136. param: {
  6137. userIDList: e
  6138. }
  6139. }).then(function (o) {
  6140. var r = o.data.peerReadTimeList;
  6141. de.log("MessageController.getPeerReadTime ok. peerReadTimeList:".concat(r));
  6142. for (var i = "", s = 0; s < e.length; s++) i += "".concat(e[s], "-").concat(r[s], " "), r[s] > 0 && t.recordPeerReadTime("C2C".concat(e[s]), r[s]);
  6143. n.setNetworkType(t.getNetworkType()).setText(i).setEnd();
  6144. }).catch(function (e) {
  6145. t.probeNetwork().then(function (t) {
  6146. var o = y(t, 2),
  6147. r = o[0],
  6148. i = o[1];
  6149. n.setError(e, r, i).setEnd();
  6150. }), de.warn("MessageController.getPeerReadTime failed. error:", e);
  6151. });
  6152. }
  6153. }
  6154. }, {
  6155. key: "recordPeerReadTime",
  6156. value: function (e, t) {
  6157. this._peerReadTimeMap.has(e) ? this._peerReadTimeMap.get(e) < t && this._peerReadTimeMap.set(e, t) : this._peerReadTimeMap.set(e, t);
  6158. }
  6159. }, {
  6160. key: "_clearConversationMessages",
  6161. value: function (e) {
  6162. var t = e.data;
  6163. this.messagesList.removeByConversationID(t), this.getMessageHandler.deleteCompletedItem(t);
  6164. }
  6165. }, {
  6166. key: "_pushIntoNoticeResult",
  6167. value: function (e, t) {
  6168. return !(!this.messagesList.pushIn(t) || this.singlyLinkedList.has(t.random)) && (e.push(t), !0);
  6169. }
  6170. }, {
  6171. key: "_newC2CMessageStoredAndSummary",
  6172. value: function (e) {
  6173. for (var n = e.notifiesList, o = e.type, r = e.C2CRemainingUnreadList, i = e.isFromSync, s = null, a = [], u = [], c = {}, l = this.tim.bigDataHallwayController, p = 0, g = n.length; p < g; p++) {
  6174. var h = n[p];
  6175. if (h.currentUser = this.tim.context.identifier, h.conversationType = o, h.isSystemMessage = !!h.isSystemMessage, s = new Qn(h), h.elements = l.parseElements(h.elements, h.from), s.setElement(h.elements), !i) if (!this._pushIntoNoticeResult(u, s)) continue;
  6176. 0 !== h.msgLifeTime ? void 0 === c[s.conversationID] ? c[s.conversationID] = a.push({
  6177. conversationID: s.conversationID,
  6178. unreadCount: "out" === s.flow ? 0 : 1,
  6179. type: s.conversationType,
  6180. subType: s.conversationSubType,
  6181. lastMessage: s
  6182. }) - 1 : (a[c[s.conversationID]].type = s.conversationType, a[c[s.conversationID]].subType = s.conversationSubType, a[c[s.conversationID]].lastMessage = s, "in" === s.flow && a[c[s.conversationID]].unreadCount++) : s.setOnlineOnlyFlag(!0);
  6183. }
  6184. if (Ie(r)) for (var d = function (e, n) {
  6185. var o = a.find(function (t) {
  6186. return t.conversationID === "C2C".concat(r[e].from);
  6187. });
  6188. o ? o.unreadCount += r[e].count : a.push({
  6189. conversationID: "C2C".concat(r[e].from),
  6190. unreadCount: r[e].count,
  6191. type: t.CONV_C2C,
  6192. lastMsgTime: r[e].lastMsgTime
  6193. });
  6194. }, m = 0, f = r.length; m < f; m++) d(m);
  6195. return {
  6196. eventDataList: a,
  6197. result: u
  6198. };
  6199. }
  6200. }, {
  6201. key: "newGroupMessageStoredAndSummary",
  6202. value: function (e) {
  6203. var n = null,
  6204. o = [],
  6205. r = {},
  6206. i = [],
  6207. s = t.CONV_GROUP,
  6208. a = this.tim.bigDataHallwayController,
  6209. u = e.length;
  6210. u > 1 && e.sort(function (e, t) {
  6211. return e.sequence - t.sequence;
  6212. });
  6213. for (var c = 0; c < u; c++) {
  6214. var l = e[c];
  6215. if (l.currentUser = this.tim.context.identifier, l.conversationType = s, l.isSystemMessage = !!l.isSystemMessage, n = new Qn(l), l.elements = a.parseElements(l.elements, l.from), n.setElement(l.elements), !this._isMessageFromAVChatroom(n)) this._pushIntoNoticeResult(i, n) && (1 !== l.onlineOnlyFlag ? void 0 === r[n.conversationID] ? r[n.conversationID] = o.push({
  6216. conversationID: n.conversationID,
  6217. unreadCount: "out" === n.flow ? 0 : 1,
  6218. type: n.conversationType,
  6219. subType: n.conversationSubType,
  6220. lastMessage: n
  6221. }) - 1 : (o[r[n.conversationID]].type = n.conversationType, o[r[n.conversationID]].subType = n.conversationSubType, o[r[n.conversationID]].lastMessage = n, "in" === n.flow && o[r[n.conversationID]].unreadCount++) : n.setOnlineOnlyFlag(!0));
  6222. }
  6223. return {
  6224. eventDataList: o,
  6225. result: i
  6226. };
  6227. }
  6228. }, {
  6229. key: "_isMessageFromAVChatroom",
  6230. value: function (e) {
  6231. var t = e.conversationID.slice(5);
  6232. return this.tim.groupController.checkJoinedAVChatRoomByID(t);
  6233. }
  6234. }, {
  6235. key: "newGroupTipsStoredAndSummary",
  6236. value: function (e) {
  6237. for (var n = null, o = [], r = [], i = {}, s = 0, a = e.length; s < a; s++) {
  6238. var c = e[s];
  6239. if (c.currentUser = this.tim.context.identifier, c.conversationType = t.CONV_GROUP, (n = new Qn(c)).setElement({
  6240. type: t.MSG_GRP_TIP,
  6241. content: u(u({}, c.elements), {}, {
  6242. groupProfile: c.groupProfile
  6243. })
  6244. }), n.isSystemMessage = !1, !this._isMessageFromAVChatroom(n)) this._pushIntoNoticeResult(r, n) && (void 0 === i[n.conversationID] ? i[n.conversationID] = o.push({
  6245. conversationID: n.conversationID,
  6246. unreadCount: "out" === n.flow ? 0 : 1,
  6247. type: n.conversationType,
  6248. subType: n.conversationSubType,
  6249. lastMessage: n
  6250. }) - 1 : (o[i[n.conversationID]].type = n.conversationType, o[i[n.conversationID]].subType = n.conversationSubType, o[i[n.conversationID]].lastMessage = n, "in" === n.flow && o[i[n.conversationID]].unreadCount++));
  6251. }
  6252. return {
  6253. eventDataList: o,
  6254. result: r
  6255. };
  6256. }
  6257. }, {
  6258. key: "newSystemNoticeStoredAndSummary",
  6259. value: function (e) {
  6260. var n = e.notifiesList,
  6261. o = e.type,
  6262. r = null,
  6263. i = n.length,
  6264. s = 0,
  6265. a = [],
  6266. c = {
  6267. conversationID: t.CONV_SYSTEM,
  6268. unreadCount: 0,
  6269. type: t.CONV_SYSTEM,
  6270. subType: null,
  6271. lastMessage: null
  6272. };
  6273. for (s = 0; s < i; s++) {
  6274. var l = n[s];
  6275. if (l.elements.operationType !== _t) l.currentUser = this.tim.context.identifier, l.conversationType = t.CONV_SYSTEM, l.conversationID = t.CONV_SYSTEM, (r = new Qn(l)).setElement({
  6276. type: t.MSG_GRP_SYS_NOTICE,
  6277. content: u(u({}, l.elements), {}, {
  6278. groupProfile: l.groupProfile
  6279. })
  6280. }), r.isSystemMessage = !0, (1 === r.sequence && 1 === r.random || 2 === r.sequence && 2 === r.random) && (r.sequence = we(), r.random = we(), r.generateMessageID(l.currentUser), de.log("MessageController.newSystemNoticeStoredAndSummary sequence and random maybe duplicated, regenerate. ID=".concat(r.ID))), this._pushIntoNoticeResult(a, r) && ("poll" === o ? c.unreadCount++ : "sync" === o && r.setIsRead(!0), c.subType = r.conversationSubType);
  6281. }
  6282. return c.lastMessage = a[a.length - 1], {
  6283. eventDataList: a.length > 0 ? [c] : [],
  6284. result: a
  6285. };
  6286. }
  6287. }, {
  6288. key: "_onSyncMessagesProcessing",
  6289. value: function (e) {
  6290. var n = this._newC2CMessageStoredAndSummary({
  6291. notifiesList: e.data,
  6292. type: t.CONV_C2C,
  6293. isFromSync: !0,
  6294. C2CRemainingUnreadList: e.C2CRemainingUnreadList
  6295. }),
  6296. o = n.eventDataList,
  6297. r = n.result;
  6298. this.emitInnerEvent(So, {
  6299. eventDataList: o,
  6300. result: r
  6301. });
  6302. }
  6303. }, {
  6304. key: "_onSyncMessagesFinished",
  6305. value: function (e) {
  6306. this.triggerReady();
  6307. var n = this._newC2CMessageStoredAndSummary({
  6308. notifiesList: e.data.messageList,
  6309. type: t.CONV_C2C,
  6310. isFromSync: !0,
  6311. C2CRemainingUnreadList: e.data.C2CRemainingUnreadList
  6312. }),
  6313. o = n.eventDataList,
  6314. r = n.result;
  6315. this.emitInnerEvent(ko, {
  6316. eventDataList: o,
  6317. result: r
  6318. });
  6319. }
  6320. }, {
  6321. key: "getHistoryMessages",
  6322. value: function (e) {
  6323. if (e.conversationID === t.CONV_SYSTEM) return Mr();
  6324. !e.count && (e.count = 15), e.count > 20 && (e.count = 20);
  6325. var n = this.messagesList.getLocalOldestMessageByConversationID(e.conversationID);
  6326. n || ((n = {}).time = 0, n.sequence = 0, 0 === e.conversationID.indexOf(t.CONV_C2C) ? (n.to = e.conversationID.replace(t.CONV_C2C, ""), n.conversationType = t.CONV_C2C) : 0 === e.conversationID.indexOf(t.CONV_GROUP) && (n.to = e.conversationID.replace(t.CONV_GROUP, ""), n.conversationType = t.CONV_GROUP));
  6327. var o = "";
  6328. switch (n.conversationType) {
  6329. case t.CONV_C2C:
  6330. return o = e.conversationID.replace(t.CONV_C2C, ""), this.getC2CRoamMessages({
  6331. conversationID: e.conversationID,
  6332. peerAccount: o,
  6333. count: e.count,
  6334. lastMessageTime: void 0 === this.currentMessageKey[e.conversationID] ? 0 : n.time
  6335. });
  6336. case t.CONV_GROUP:
  6337. return this.getGroupRoamMessages({
  6338. conversationID: e.conversationID,
  6339. groupID: n.to,
  6340. count: e.count,
  6341. sequence: n.sequence - 1
  6342. });
  6343. default:
  6344. return Mr();
  6345. }
  6346. }
  6347. }, {
  6348. key: "getC2CRoamMessages",
  6349. value: function (e) {
  6350. var n = this,
  6351. o = e.conversationID,
  6352. r = void 0 !== this.currentMessageKey[o] ? this.currentMessageKey[o] : "";
  6353. de.log("MessageController.getC2CRoamMessages toAccount=".concat(e.peerAccount, " count=").concat(e.count || 15, " lastMessageTime=").concat(e.lastMessageTime || 0, " messageKey=").concat(r));
  6354. var i = new qr(Jr);
  6355. return this.request({
  6356. name: "c2cMessage",
  6357. action: "query",
  6358. param: {
  6359. peerAccount: e.peerAccount,
  6360. count: e.count || 15,
  6361. lastMessageTime: e.lastMessageTime || 0,
  6362. messageKey: r
  6363. }
  6364. }).then(function (s) {
  6365. var a = s.data,
  6366. u = a.complete,
  6367. c = a.messageList;
  6368. Me(c) ? de.log("MessageController.getC2CRoamMessages ok. complete=".concat(u, " but messageList is undefined!")) : de.log("MessageController.getC2CRoamMessages ok. complete=".concat(u, " nums=").concat(c.length)), i.setNetworkType(n.getNetworkType()).setText("".concat(e.peerAccount, "-").concat(e.count || 15, "-").concat(e.lastMessageTime || 0, "-").concat(r, "-").concat(u, "-").concat(c ? c.length : "undefined")).setEnd(), 1 === u && n.getMessageHandler.setCompleted(o);
  6369. var l = n._roamMessageStore(c, t.CONV_C2C, o);
  6370. n.readReportHandler.updateIsRead(o), n.currentMessageKey[o] = s.data.messageKey;
  6371. var p = n._peerReadTimeMap.get(o);
  6372. if (de.log("MessageController.getC2CRoamMessages update isPeerRead property. conversationID=".concat(o, " peerReadTime=").concat(p)), p) n._updateMessageIsPeerReadProperty(o, p);else {
  6373. var g = o.replace(t.CONV_C2C, "");
  6374. n.getPeerReadTime([g]).then(function () {
  6375. n._updateMessageIsPeerReadProperty(o, n._peerReadTimeMap.get(o));
  6376. });
  6377. }
  6378. return l;
  6379. }).catch(function (t) {
  6380. return n.probeNetwork().then(function (n) {
  6381. var o = y(n, 2),
  6382. s = o[0],
  6383. a = o[1];
  6384. i.setError(t, s, a).setText("".concat(e.peerAccount, "-").concat(e.count || 15, "-").concat(e.lastMessageTime || 0, "-").concat(r)).setEnd();
  6385. }), de.warn("MessageController.getC2CRoamMessages failed. ".concat(t)), Cr(t);
  6386. });
  6387. }
  6388. }, {
  6389. key: "_computeLastSequence",
  6390. value: function (e) {
  6391. return e.sequence >= 0 ? Promise.resolve(e.sequence) : this.tim.groupController.getGroupLastSequence(e.groupID);
  6392. }
  6393. }, {
  6394. key: "getGroupRoamMessages",
  6395. value: function (e) {
  6396. var n = this,
  6397. o = new qr(Xr),
  6398. r = 0;
  6399. return this._computeLastSequence(e).then(function (t) {
  6400. return r = t, de.log("MessageController.getGroupRoamMessages groupID=".concat(e.groupID, " lastSequence=").concat(r)), n.request({
  6401. name: "groupMessage",
  6402. action: "query",
  6403. param: {
  6404. groupID: e.groupID,
  6405. count: 21,
  6406. sequence: r
  6407. }
  6408. });
  6409. }).then(function (i) {
  6410. var s = i.data,
  6411. a = s.messageList,
  6412. u = s.complete;
  6413. Me(a) ? de.log("MessageController.getGroupRoamMessages ok. complete=".concat(u, " but messageList is undefined!")) : de.log("MessageController.getGroupRoamMessages ok. complete=".concat(u, " nums=").concat(a.length)), o.setNetworkType(n.getNetworkType()).setText("".concat(e.groupID, "-").concat(r, "-").concat(u, "-").concat(a ? a.length : "undefined")).setEnd();
  6414. var c = "GROUP".concat(e.groupID);
  6415. if (2 === u || Xe(a)) return n.getMessageHandler.setCompleted(c), [];
  6416. var l = n._roamMessageStore(a, t.CONV_GROUP, c);
  6417. return n.readReportHandler.updateIsRead(c), n._patchConversationLastMessage(c), l;
  6418. }).catch(function (t) {
  6419. return n.probeNetwork().then(function (n) {
  6420. var i = y(n, 2),
  6421. s = i[0],
  6422. a = i[1];
  6423. o.setError(t, s, a).setText("".concat(e.groupID, "-").concat(r)).setEnd();
  6424. }), de.warn("MessageController.getGroupRoamMessages failed. ".concat(t)), Cr(t);
  6425. });
  6426. }
  6427. }, {
  6428. key: "_patchConversationLastMessage",
  6429. value: function (e) {
  6430. var t = this.tim.conversationController.getLocalConversation(e);
  6431. if (t) {
  6432. var n = t.lastMessage,
  6433. o = n.messageForShow,
  6434. r = n.payload;
  6435. if (Xe(o) || Xe(r)) {
  6436. var i = this.messagesList.getLocalMessageList(e);
  6437. if (0 === i.length) return;
  6438. var s = i[i.length - 1];
  6439. de.log("MessageController._patchConversationLastMessage conversationID:".concat(e, " payload:"), s.payload), t.updateLastMessage(s);
  6440. }
  6441. }
  6442. }
  6443. }, {
  6444. key: "_roamMessageStore",
  6445. value: function () {
  6446. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
  6447. n = arguments.length > 1 ? arguments[1] : void 0,
  6448. o = arguments.length > 2 ? arguments[2] : void 0,
  6449. r = null,
  6450. i = [],
  6451. s = 0,
  6452. a = e.length,
  6453. c = null,
  6454. l = n === t.CONV_GROUP,
  6455. p = this.tim.bigDataHallwayController,
  6456. g = function () {
  6457. s = l ? e.length - 1 : 0, a = l ? 0 : e.length;
  6458. },
  6459. h = function () {
  6460. l ? --s : ++s;
  6461. },
  6462. d = function () {
  6463. return l ? s >= a : s < a;
  6464. };
  6465. for (g(); d(); h()) if (l && 1 === e[s].sequence && this.getMessageHandler.setCompleted(o), 1 !== e[s].isPlaceMessage) if ((r = new Qn(e[s])).to = e[s].to, r.isSystemMessage = !!e[s].isSystemMessage, r.conversationType = n, e[s].event === at.JSON.TYPE.GROUP.TIP ? c = {
  6466. type: t.MSG_GRP_TIP,
  6467. content: u(u({}, e[s].elements), {}, {
  6468. groupProfile: e[s].groupProfile
  6469. })
  6470. } : (e[s].elements = p.parseElements(e[s].elements, e[s].from), c = e[s].elements), Xe(c)) {
  6471. var m = new qr(ti);
  6472. m.setText("from:".concat(r.from, " to:").concat(r.to, " sequence:").concat(r.sequence, " event:").concat(e[s].event)), m.setNetworkType(this.getNetworkType()).setEnd();
  6473. } else r.setElement(c), r.reInitialize(this.tim.context.identifier), i.push(r);
  6474. return this.messagesList.unshift(i), g = h = d = null, i;
  6475. }
  6476. }, {
  6477. key: "getLocalMessageList",
  6478. value: function (e) {
  6479. return this.messagesList.getLocalMessageList(e);
  6480. }
  6481. }, {
  6482. key: "getLocalMessage",
  6483. value: function (e, t) {
  6484. return this.messagesList.getLocalMessage(e, t);
  6485. }
  6486. }, {
  6487. key: "hasLocalMessage",
  6488. value: function (e, t) {
  6489. return this.messagesList.hasLocalMessage(e, t);
  6490. }
  6491. }, {
  6492. key: "deleteLocalMessage",
  6493. value: function (e) {
  6494. e instanceof Qn && this.messagesList.remove(e);
  6495. }
  6496. }, {
  6497. key: "revokeMessage",
  6498. value: function (e) {
  6499. var n,
  6500. o = this;
  6501. e.conversationType === t.CONV_C2C ? n = {
  6502. name: "c2cMessageWillBeRevoked",
  6503. action: "create",
  6504. param: {
  6505. msgInfo: {
  6506. fromAccount: e.from,
  6507. toAccount: e.to,
  6508. msgSeq: e.sequence,
  6509. msgRandom: e.random,
  6510. msgTimeStamp: e.time
  6511. }
  6512. }
  6513. } : e.conversationType === t.CONV_GROUP && (n = {
  6514. name: "groupMessageWillBeRevoked",
  6515. action: "create",
  6516. param: {
  6517. to: e.to,
  6518. msgSeqList: [{
  6519. msgSeq: e.sequence
  6520. }]
  6521. }
  6522. });
  6523. var r = new qr(Qr);
  6524. return r.setMessageType(e.type).setText("".concat(this._generateTjgID(e), "-").concat(e.type, "-").concat(e.from, "-").concat(e.to)), this.request(n).then(function (t) {
  6525. var n = t.data.recallRetList;
  6526. if (!Xe(n) && 0 !== n[0].retCode) {
  6527. var i = new Ut({
  6528. code: n[0].retCode,
  6529. message: bt[n[0].retCode] || Zt,
  6530. data: {
  6531. message: e
  6532. }
  6533. });
  6534. return r.setCode(i.code).setMessage(i.message).setEnd(), Cr(i);
  6535. }
  6536. return de.info("MessageController.revokeMessage ok. ID=".concat(e.ID)), e.isRevoked = !0, r.setEnd(), o.emitInnerEvent(No, [e]), new vr({
  6537. message: e
  6538. });
  6539. }).catch(function (t) {
  6540. o.probeNetwork().then(function (e) {
  6541. var n = y(e, 2),
  6542. o = n[0],
  6543. i = n[1];
  6544. r.setError(t, o, i).setEnd();
  6545. });
  6546. var n = new Ut({
  6547. code: t && t.code ? t.code : qt.MESSAGE_REVOKE_FAIL,
  6548. message: t && t.message ? t.message : Zt,
  6549. data: {
  6550. message: e
  6551. }
  6552. });
  6553. return de.warn("MessageController.revokeMessage failed. ID=".concat(e.ID, " code=").concat(n.code, " message=").concat(n.message)), Cr(n);
  6554. });
  6555. }
  6556. }, {
  6557. key: "setMessageRead",
  6558. value: function (e) {
  6559. var t = this;
  6560. return new Promise(function (n, o) {
  6561. t.ready(function () {
  6562. t.readReportHandler.setMessageRead(e).then(n).catch(o);
  6563. });
  6564. });
  6565. }
  6566. }, {
  6567. key: "getMessageList",
  6568. value: function (e) {
  6569. return this.getMessageHandler.getMessageList(e);
  6570. }
  6571. }, {
  6572. key: "createTextMessage",
  6573. value: function (e) {
  6574. e.currentUser = this.tim.context.identifier;
  6575. var t = new Qn(e),
  6576. n = "string" == typeof e.payload ? e.payload : e.payload.text,
  6577. o = new st({
  6578. text: n
  6579. });
  6580. return t.setElement(o), t;
  6581. }
  6582. }, {
  6583. key: "createCustomMessage",
  6584. value: function (e) {
  6585. e.currentUser = this.tim.context.identifier;
  6586. var t = new Qn(e),
  6587. n = new zn({
  6588. data: e.payload.data,
  6589. description: e.payload.description,
  6590. extension: e.payload.extension
  6591. });
  6592. return t.setElement(n), t;
  6593. }
  6594. }, {
  6595. key: "createImageMessage",
  6596. value: function (e) {
  6597. e.currentUser = this.tim.context.identifier;
  6598. var t = new Qn(e);
  6599. if (V) {
  6600. var n = e.payload.file;
  6601. if (me(n)) return void de.warn("小程序环境下调用 createImageMessage 接口时,payload.file 不支持传入 File 对象");
  6602. var o = n.tempFilePaths[0],
  6603. r = {
  6604. url: o,
  6605. name: o.slice(o.lastIndexOf("/") + 1),
  6606. size: n.tempFiles[0].size,
  6607. type: o.slice(o.lastIndexOf(".") + 1).toLowerCase()
  6608. };
  6609. e.payload.file = r;
  6610. } else if (G && me(e.payload.file)) {
  6611. var i = e.payload.file;
  6612. e.payload.file = {
  6613. files: [i]
  6614. };
  6615. }
  6616. var s = new St({
  6617. imageFormat: at.IMAGE_FORMAT.UNKNOWN,
  6618. uuid: this._generateUUID(),
  6619. file: e.payload.file
  6620. });
  6621. return t.setElement(s), this.messageOptionMap.set(t.messageID, e), t;
  6622. }
  6623. }, {
  6624. key: "createFileMessage",
  6625. value: function (e) {
  6626. if (!V) {
  6627. if (G && me(e.payload.file)) {
  6628. var t = e.payload.file;
  6629. e.payload.file = {
  6630. files: [t]
  6631. };
  6632. }
  6633. e.currentUser = this.tim.context.identifier;
  6634. var n = new Qn(e),
  6635. o = new Yn({
  6636. uuid: this._generateUUID(),
  6637. file: e.payload.file
  6638. });
  6639. return n.setElement(o), this.messageOptionMap.set(n.messageID, e), n;
  6640. }
  6641. de.warn("小程序目前不支持选择文件, createFileMessage 接口不可用!");
  6642. }
  6643. }, {
  6644. key: "createAudioMessage",
  6645. value: function (e) {
  6646. if (V) {
  6647. var t = e.payload.file;
  6648. if (V) {
  6649. var n = {
  6650. url: t.tempFilePath,
  6651. name: t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/") + 1),
  6652. size: t.fileSize,
  6653. second: parseInt(t.duration) / 1e3,
  6654. type: t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".") + 1).toLowerCase()
  6655. };
  6656. e.payload.file = n;
  6657. }
  6658. e.currentUser = this.tim.context.identifier;
  6659. var o = new Qn(e),
  6660. r = new At({
  6661. second: Math.floor(t.duration / 1e3),
  6662. size: t.fileSize,
  6663. url: t.tempFilePath,
  6664. uuid: this._generateUUID()
  6665. });
  6666. return o.setElement(r), this.messageOptionMap.set(o.messageID, e), o;
  6667. }
  6668. de.warn("createAudioMessage 目前只支持小程序环境下发语音消息");
  6669. }
  6670. }, {
  6671. key: "createVideoMessage",
  6672. value: function (e) {
  6673. e.currentUser = this.tim.context.identifier, e.payload.file.thumbUrl = "https://webim-1252463788.cos.ap-shanghai.myqcloud.com/assets/images/transparent.png", e.payload.file.thumbSize = 1668;
  6674. var t = {};
  6675. if (V) {
  6676. if (me(e.payload.file)) return void de.warn("小程序环境下调用 createVideoMessage 接口时,payload.file 不支持传入 File 对象");
  6677. var n = e.payload.file;
  6678. t.url = n.tempFilePath, t.name = n.tempFilePath.slice(n.tempFilePath.lastIndexOf("/") + 1), t.size = n.size, t.second = n.duration, t.type = n.tempFilePath.slice(n.tempFilePath.lastIndexOf(".") + 1).toLowerCase();
  6679. } else if (G) {
  6680. if (me(e.payload.file)) {
  6681. var o = e.payload.file;
  6682. e.payload.file.files = [o];
  6683. }
  6684. var r = e.payload.file;
  6685. t.url = window.URL.createObjectURL(r.files[0]), t.name = r.files[0].name, t.size = r.files[0].size, t.second = r.files[0].duration || 0, t.type = r.files[0].type.split("/")[1];
  6686. }
  6687. e.payload.file.videoFile = t;
  6688. var i = new Qn(e),
  6689. s = new Wn({
  6690. videoFormat: t.type,
  6691. videoSecond: Number(t.second.toFixed(0)),
  6692. videoSize: t.size,
  6693. remoteVideoUrl: "",
  6694. videoUrl: t.url,
  6695. videoUUID: this._generateUUID(),
  6696. thumbUUID: this._generateUUID(),
  6697. thumbWidth: e.payload.file.width || 200,
  6698. thumbHeight: e.payload.file.height || 200,
  6699. thumbUrl: e.payload.file.thumbUrl,
  6700. thumbSize: e.payload.file.thumbSize,
  6701. thumbFormat: e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".") + 1).toLowerCase()
  6702. });
  6703. return i.setElement(s), this.messageOptionMap.set(i.messageID, e), i;
  6704. }
  6705. }, {
  6706. key: "createFaceMessage",
  6707. value: function (e) {
  6708. e.currentUser = this.tim.context.identifier;
  6709. var t = new Qn(e),
  6710. n = new kt(e.payload);
  6711. return t.setElement(n), t;
  6712. }
  6713. }, {
  6714. key: "_generateUUID",
  6715. value: function () {
  6716. var e = this.tim.context;
  6717. return "".concat(e.SDKAppID, "-").concat(e.identifier, "-").concat(function () {
  6718. for (var e = "", t = 32; t > 0; --t) e += Pe[Math.floor(Math.random() * Ge)];
  6719. return e;
  6720. }());
  6721. }
  6722. }, {
  6723. key: "_generateTjgID",
  6724. value: function (e) {
  6725. return this.tim.context.tinyID + "-" + e.random;
  6726. }
  6727. }, {
  6728. key: "getMessageOptionByID",
  6729. value: function (e) {
  6730. return this.messageOptionMap.get(e);
  6731. }
  6732. }, {
  6733. key: "isMessageSentByCurrentInstance",
  6734. value: function (e) {
  6735. return !(!this.messagesList.hasLocalMessage(e.conversationID, e.ID) && !this.singlyLinkedList.has(e.random));
  6736. }
  6737. }, {
  6738. key: "pushToMessageList",
  6739. value: function (e) {
  6740. this.messagesList.pushIn(e);
  6741. }
  6742. }]), s;
  6743. }(mr),
  6744. Ms = function () {
  6745. function e(t) {
  6746. o(this, e), this.userID = "", this.avatar = "", this.nick = "", this.role = "", this.joinTime = "", this.lastSendMsgTime = "", this.nameCard = "", this.muteUntil = 0, this.memberCustomField = [], this._initMember(t);
  6747. }
  6748. return i(e, [{
  6749. key: "_initMember",
  6750. value: function (e) {
  6751. this.updateMember(e);
  6752. }
  6753. }, {
  6754. key: "updateMember",
  6755. value: function (e) {
  6756. var t = [null, void 0, "", 0, NaN];
  6757. e.memberCustomField && xe(this.memberCustomField, e.memberCustomField), Oe(this, e, ["memberCustomField"], t);
  6758. }
  6759. }, {
  6760. key: "updateRole",
  6761. value: function (e) {
  6762. ["Owner", "Admin", "Member"].indexOf(e) < 0 || (this.role = e);
  6763. }
  6764. }, {
  6765. key: "updateMuteUntil",
  6766. value: function (e) {
  6767. Me(e) || (this.muteUntil = Math.floor((Date.now() + 1e3 * e) / 1e3));
  6768. }
  6769. }, {
  6770. key: "updateNameCard",
  6771. value: function (e) {
  6772. Me(e) || (this.nameCard = e);
  6773. }
  6774. }, {
  6775. key: "updateMemberCustomField",
  6776. value: function (e) {
  6777. e && xe(this.memberCustomField, e);
  6778. }
  6779. }]), e;
  6780. }(),
  6781. Cs = function () {
  6782. function e(t) {
  6783. o(this, e), this.tim = t.tim, this.groupController = t.groupController, this._initListeners();
  6784. }
  6785. return i(e, [{
  6786. key: "_initListeners",
  6787. value: function () {
  6788. this.tim.innerEmitter.on(Oo, this._onReceivedGroupTips, this);
  6789. }
  6790. }, {
  6791. key: "_onReceivedGroupTips",
  6792. value: function (e) {
  6793. var t = this,
  6794. n = e.data,
  6795. o = n.result;
  6796. n.isGroupTip && o.forEach(function (e) {
  6797. switch (e.payload.operationType) {
  6798. case 1:
  6799. t._onNewMemberComeIn(e);
  6800. break;
  6801. case 2:
  6802. t._onMemberQuit(e);
  6803. break;
  6804. case 3:
  6805. t._onMemberKickedOut(e);
  6806. break;
  6807. case 4:
  6808. t._onMemberSetAdmin(e);
  6809. break;
  6810. case 5:
  6811. t._onMemberCancelledAdmin(e);
  6812. break;
  6813. case 6:
  6814. t._onGroupProfileModified(e);
  6815. break;
  6816. case 7:
  6817. t._onMemberInfoModified(e);
  6818. break;
  6819. default:
  6820. de.warn("GroupTipsHandler._onReceivedGroupTips Unhandled groupTips. operationType=", e.payload.operationType);
  6821. }
  6822. });
  6823. }
  6824. }, {
  6825. key: "_onNewMemberComeIn",
  6826. value: function (e) {
  6827. var t = e.payload,
  6828. n = t.memberNum,
  6829. o = t.groupProfile.groupID,
  6830. r = this.groupController.getLocalGroupProfile(o);
  6831. r && fe(n) && (r.memberNum = n);
  6832. }
  6833. }, {
  6834. key: "_onMemberQuit",
  6835. value: function (e) {
  6836. var t = e.payload,
  6837. n = t.memberNum,
  6838. o = t.groupProfile.groupID,
  6839. r = this.groupController.getLocalGroupProfile(o);
  6840. r && fe(n) && (r.memberNum = n), this.groupController.deleteLocalGroupMembers(o, e.payload.userIDList);
  6841. }
  6842. }, {
  6843. key: "_onMemberKickedOut",
  6844. value: function (e) {
  6845. var t = e.payload,
  6846. n = t.memberNum,
  6847. o = t.groupProfile.groupID,
  6848. r = this.groupController.getLocalGroupProfile(o);
  6849. r && fe(n) && (r.memberNum = n), this.groupController.deleteLocalGroupMembers(o, e.payload.userIDList);
  6850. }
  6851. }, {
  6852. key: "_onMemberSetAdmin",
  6853. value: function (e) {
  6854. var n = this,
  6855. o = e.payload.groupProfile.groupID;
  6856. e.payload.userIDList.forEach(function (e) {
  6857. var r = n.groupController.getLocalGroupMemberInfo(o, e);
  6858. r && r.updateRole(t.GRP_MBR_ROLE_ADMIN);
  6859. });
  6860. }
  6861. }, {
  6862. key: "_onMemberCancelledAdmin",
  6863. value: function (e) {
  6864. var n = this,
  6865. o = e.payload.groupProfile.groupID;
  6866. e.payload.userIDList.forEach(function (e) {
  6867. var r = n.groupController.getLocalGroupMemberInfo(o, e);
  6868. r && r.updateRole(t.GRP_MBR_ROLE_MEMBER);
  6869. });
  6870. }
  6871. }, {
  6872. key: "_onGroupProfileModified",
  6873. value: function (e) {
  6874. var t = this,
  6875. n = e.payload.newGroupProfile,
  6876. o = e.payload.groupProfile.groupID,
  6877. r = this.groupController.getLocalGroupProfile(o);
  6878. Object.keys(n).forEach(function (e) {
  6879. switch (e) {
  6880. case "ownerID":
  6881. t._ownerChaged(r, n);
  6882. break;
  6883. default:
  6884. r[e] = n[e];
  6885. }
  6886. }), this.groupController.emitGroupListUpdate(!0, !0);
  6887. }
  6888. }, {
  6889. key: "_ownerChaged",
  6890. value: function (e, n) {
  6891. var o = e.groupID,
  6892. r = this.groupController.getLocalGroupProfile(o),
  6893. i = this.tim.context.identifier;
  6894. if (i === n.ownerID) {
  6895. r.updateGroup({
  6896. selfInfo: {
  6897. role: t.GRP_MBR_ROLE_OWNER
  6898. }
  6899. });
  6900. var s = this.groupController.getLocalGroupMemberInfo(o, i),
  6901. a = this.groupController.getLocalGroupProfile(o).ownerID,
  6902. u = this.groupController.getLocalGroupMemberInfo(o, a);
  6903. s && s.updateRole(t.GRP_MBR_ROLE_OWNER), u && u.updateRole(t.GRP_MBR_ROLE_MEMBER);
  6904. }
  6905. }
  6906. }, {
  6907. key: "_onMemberInfoModified",
  6908. value: function (e) {
  6909. var t = this,
  6910. n = e.payload.groupProfile.groupID;
  6911. e.payload.memberList.forEach(function (e) {
  6912. var o = t.groupController.getLocalGroupMemberInfo(n, e.userID);
  6913. o && e.muteTime && o.updateMuteUntil(e.muteTime);
  6914. });
  6915. }
  6916. }]), e;
  6917. }(),
  6918. Es = function () {
  6919. function n(e) {
  6920. o(this, n), this.groupController = e.groupController, this.tim = e.tim, this.pendencyMap = new Map(), this._initLiceners();
  6921. }
  6922. return i(n, [{
  6923. key: "_initLiceners",
  6924. value: function () {
  6925. this.tim.innerEmitter.on(Ro, this._onReceivedGroupSystemNotice, this), this.tim.innerEmitter.on(To, this._clearGroupSystemNotice, this);
  6926. }
  6927. }, {
  6928. key: "_clearGroupSystemNotice",
  6929. value: function () {
  6930. var e = this;
  6931. this.getPendencyList().then(function (n) {
  6932. n.forEach(function (t) {
  6933. e.pendencyMap.set("".concat(t.from, "_").concat(t.groupID, "_").concat(t.to), t);
  6934. });
  6935. var o = e.tim.messageController.getLocalMessageList(t.CONV_SYSTEM),
  6936. r = [];
  6937. o.forEach(function (t) {
  6938. var n = t.payload,
  6939. o = n.operatorID,
  6940. i = n.operationType,
  6941. s = n.groupProfile;
  6942. if (i === ut) {
  6943. var a = "".concat(o, "_").concat(s.groupID, "_").concat(s.to),
  6944. u = e.pendencyMap.get(a);
  6945. u && fe(u.handled) && 0 !== u.handled && r.push(t);
  6946. }
  6947. }), e.groupController.deleteGroupSystemNotice({
  6948. messageList: r
  6949. });
  6950. });
  6951. }
  6952. }, {
  6953. key: "getPendencyList",
  6954. value: function (e) {
  6955. var t = this;
  6956. return this.groupController.request({
  6957. name: "group",
  6958. action: "getGroupPendency",
  6959. param: {
  6960. startTime: e && e.startTime ? e.startTime : 0,
  6961. limit: e && e.limit ? e.limit : 10,
  6962. handleAccount: this.tim.context.identifier
  6963. }
  6964. }).then(function (e) {
  6965. var n = e.data,
  6966. o = n.pendencyList;
  6967. return 0 !== n.nextStartTime ? t.getPendencyList({
  6968. startTime: n.nextStartTime
  6969. }).then(function (e) {
  6970. return [].concat(I(o), I(e));
  6971. }) : o;
  6972. });
  6973. }
  6974. }, {
  6975. key: "_onReceivedGroupSystemNotice",
  6976. value: function (t) {
  6977. var n = this,
  6978. o = t.data,
  6979. r = o.result;
  6980. "sync" !== o.type && r.forEach(function (t) {
  6981. switch (t.payload.operationType) {
  6982. case 1:
  6983. n._onApplyGroupRequest(t);
  6984. break;
  6985. case 2:
  6986. n._onApplyGroupRequestAgreed(t);
  6987. break;
  6988. case 3:
  6989. n._onApplyGroupRequestRefused(t);
  6990. break;
  6991. case 4:
  6992. n._onMemberKicked(t);
  6993. break;
  6994. case 5:
  6995. n._onGroupDismissed(t);
  6996. break;
  6997. case 6:
  6998. break;
  6999. case 7:
  7000. n._onInviteGroup(t);
  7001. break;
  7002. case 8:
  7003. n._onQuitGroup(t);
  7004. break;
  7005. case 9:
  7006. n._onSetManager(t);
  7007. break;
  7008. case 10:
  7009. n._onDeleteManager(t);
  7010. break;
  7011. case 11:
  7012. case 12:
  7013. case 15:
  7014. break;
  7015. case 255:
  7016. n.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7017. message: t,
  7018. type: vt
  7019. });
  7020. }
  7021. });
  7022. }
  7023. }, {
  7024. key: "_onApplyGroupRequest",
  7025. value: function (t) {
  7026. this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7027. message: t,
  7028. type: ut
  7029. });
  7030. }
  7031. }, {
  7032. key: "_onApplyGroupRequestAgreed",
  7033. value: function (t) {
  7034. var n = this,
  7035. o = t.payload.groupProfile.groupID;
  7036. this.groupController.hasLocalGroup(o) || this.groupController.getGroupProfile({
  7037. groupID: o
  7038. }).then(function (e) {
  7039. var t = e.data.group;
  7040. t && (n.groupController.updateGroupMap([t]), n.groupController.emitGroupListUpdate());
  7041. }), this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7042. message: t,
  7043. type: ct
  7044. });
  7045. }
  7046. }, {
  7047. key: "_onApplyGroupRequestRefused",
  7048. value: function (t) {
  7049. this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7050. message: t,
  7051. type: lt
  7052. });
  7053. }
  7054. }, {
  7055. key: "_onMemberKicked",
  7056. value: function (t) {
  7057. var n = t.payload.groupProfile.groupID;
  7058. this.groupController.hasLocalGroup(n) && this.groupController.deleteLocalGroupAndConversation(n), this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7059. message: t,
  7060. type: pt
  7061. });
  7062. }
  7063. }, {
  7064. key: "_onGroupDismissed",
  7065. value: function (t) {
  7066. var n = t.payload.groupProfile.groupID,
  7067. o = this.groupController.hasLocalGroup(n),
  7068. r = this.groupController.AVChatRoomHandler;
  7069. o && this.groupController.deleteLocalGroupAndConversation(n), r.checkJoinedAVChatRoomByID(n) && r.reset(n), this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7070. message: t,
  7071. type: gt
  7072. });
  7073. }
  7074. }, {
  7075. key: "_onInviteGroup",
  7076. value: function (t) {
  7077. var n = this,
  7078. o = t.payload.groupProfile.groupID;
  7079. this.groupController.hasLocalGroup(o) || this.groupController.getGroupProfile({
  7080. groupID: o
  7081. }).then(function (e) {
  7082. var t = e.data.group;
  7083. t && (n.groupController.updateGroupMap([t]), n.groupController.emitGroupListUpdate());
  7084. }), this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7085. message: t,
  7086. type: ht
  7087. });
  7088. }
  7089. }, {
  7090. key: "_onQuitGroup",
  7091. value: function (t) {
  7092. var n = t.payload.groupProfile.groupID;
  7093. this.groupController.hasLocalGroup(n) && this.groupController.deleteLocalGroupAndConversation(n), this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7094. message: t,
  7095. type: dt
  7096. });
  7097. }
  7098. }, {
  7099. key: "_onSetManager",
  7100. value: function (n) {
  7101. var o = n.payload.groupProfile,
  7102. r = o.to,
  7103. i = o.groupID,
  7104. s = this.groupController.getLocalGroupMemberInfo(i, r);
  7105. s && s.updateRole(t.GRP_MBR_ROLE_ADMIN), this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7106. message: n,
  7107. type: mt
  7108. });
  7109. }
  7110. }, {
  7111. key: "_onDeleteManager",
  7112. value: function (n) {
  7113. var o = n.payload.groupProfile,
  7114. r = o.to,
  7115. i = o.groupID,
  7116. s = this.groupController.getLocalGroupMemberInfo(i, r);
  7117. s && s.updateRole(t.GRP_MBR_ROLE_MEMBER), this.groupController.emitOuterEvent(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
  7118. message: n,
  7119. type: ft
  7120. });
  7121. }
  7122. }, {
  7123. key: "reset",
  7124. value: function () {
  7125. this.pendencyMap.clear();
  7126. }
  7127. }]), n;
  7128. }(),
  7129. Ts = {
  7130. 3: !0,
  7131. 4: !0,
  7132. 5: !0,
  7133. 6: !0
  7134. },
  7135. Ds = function () {
  7136. function n(e) {
  7137. var t = e.tim,
  7138. r = e.groupController;
  7139. o(this, n), this.tim = t, this.groupController = r, this.sequencesLinkedList = new vs(100), this.receivedMessageCount = 0, this._pollingRequestInfoMap = new Map(), this._pollingInstanceMap = new Map(), this._joinedGroupMap = new Map(), this._reportMessageStackedCount = 0, this._onlineMemberCountMap = new Map(), this.DEFAULT_EXPIRE_TIME = 60;
  7140. }
  7141. return i(n, [{
  7142. key: "hasJoinedAVChatRoom",
  7143. value: function () {
  7144. return this._joinedGroupMap.size > 0;
  7145. }
  7146. }, {
  7147. key: "checkJoinedAVChatRoomByID",
  7148. value: function (e) {
  7149. return this._joinedGroupMap.has(e);
  7150. }
  7151. }, {
  7152. key: "getJoinedAVChatRoom",
  7153. value: function () {
  7154. return this._joinedGroupMap.size > 0 ? I(this._joinedGroupMap.keys()) : null;
  7155. }
  7156. }, {
  7157. key: "start",
  7158. value: function (e) {
  7159. var t = this._pollingRequestInfoMap.get(e),
  7160. n = {
  7161. key: t.key,
  7162. startSeq: t.startSeq
  7163. };
  7164. if (this._pollingInstanceMap.has(e)) {
  7165. var o = this._pollingInstanceMap.get(e);
  7166. o.isRunning() || o.start();
  7167. } else {
  7168. var r = this.groupController.createTransportCapsule({
  7169. name: "AVChatRoom",
  7170. action: "startLongPoll",
  7171. param: n
  7172. }),
  7173. i = this.tim.connectionController.createRunLoop({
  7174. pack: r,
  7175. before: this._updateRequestData.bind(this, e),
  7176. success: this._handleSuccess.bind(this, e),
  7177. fail: this._handleFailure.bind(this),
  7178. isAVChatRoomLoop: !0
  7179. });
  7180. i.start(), this._pollingInstanceMap.set(e, i), de.log("AVChatRoomHandler.start message channel started. groupID=".concat(e));
  7181. }
  7182. }
  7183. }, {
  7184. key: "stop",
  7185. value: function (e) {
  7186. var t = this._pollingInstanceMap.get(e);
  7187. t && t.isRunning() && (t.abort(), t.stop(), de.log("AVChatRoomHandler.stop message channel stopped. groupID=".concat(e)));
  7188. }
  7189. }, {
  7190. key: "startRunLoop",
  7191. value: function (e) {
  7192. var t = this;
  7193. return this._precheck().then(function () {
  7194. var n = e.longPollingKey,
  7195. o = e.group,
  7196. r = o.groupID;
  7197. return t._pollingRequestInfoMap.set(r, {
  7198. key: n,
  7199. startSeq: 0
  7200. }), t._joinedGroupMap.set(r, o), t._addAVChatRoomID(r), t.groupController.updateGroupMap([o]), t.groupController.emitGroupListUpdate(!0, !1), t.start(r), t.groupController.isLoggedIn() ? Mr({
  7201. status: et.SUCCESS,
  7202. group: o
  7203. }) : Mr({
  7204. status: et.SUCCESS
  7205. });
  7206. });
  7207. }
  7208. }, {
  7209. key: "joinWithoutAuth",
  7210. value: function (e) {
  7211. var t = this;
  7212. return this.groupController.request({
  7213. name: "group",
  7214. action: "applyJoinAVChatRoom",
  7215. param: e
  7216. }).then(function (n) {
  7217. var o = n.data.longPollingKey;
  7218. if (Me(o)) return Cr(new Ut({
  7219. code: qt.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN,
  7220. message: En
  7221. }));
  7222. de.log("AVChatRoomHandler.joinWithoutAuth ok. groupID:".concat(e.groupID)), t.groupController.emitInnerEvent(sr), t.groupController.emitInnerEvent(ir, e.groupID);
  7223. var r = new cs({
  7224. groupID: e.groupID
  7225. });
  7226. return t.startRunLoop({
  7227. group: r,
  7228. longPollingKey: o
  7229. }), new vr({
  7230. status: et.SUCCESS
  7231. });
  7232. }).catch(function (t) {
  7233. return de.error("AVChatRoomHandler.joinWithoutAuth error:".concat(Re(t), ". groupID:").concat(e.groupID)), Cr(t);
  7234. });
  7235. }
  7236. }, {
  7237. key: "_precheck",
  7238. value: function () {
  7239. if (this.tim.context.unlimitedAVChatRoom) return Promise.resolve();
  7240. if (!this.hasJoinedAVChatRoom()) return Promise.resolve();
  7241. var e = y(this._joinedGroupMap.entries().next().value, 2),
  7242. n = e[0],
  7243. o = e[1];
  7244. if (this.groupController.isLoggedIn()) {
  7245. if (!(o.selfInfo.role === t.GRP_MBR_ROLE_OWNER || o.ownerID === this.tim.loginInfo.identifier)) return this.groupController.quitGroup(n);
  7246. this.groupController.deleteLocalGroupAndConversation(n);
  7247. } else this.groupController.deleteLocalGroupAndConversation(n);
  7248. return this.reset(n), Promise.resolve();
  7249. }
  7250. }, {
  7251. key: "_updateRequestData",
  7252. value: function (e, t) {
  7253. var n = this._pollingRequestInfoMap.get(e),
  7254. o = n.key,
  7255. r = n.startSeq;
  7256. t.StartSeq = r, t.Key = o, this.tim.sumStatController.addTotalCount(Sr);
  7257. }
  7258. }, {
  7259. key: "_handleSuccess",
  7260. value: function (e, t) {
  7261. this.tim.sumStatController.addSuccessCount(Sr), this.tim.sumStatController.addCost(Sr, t.data.timecost);
  7262. var n = t.data,
  7263. o = n.errorCode,
  7264. r = n.errorInfo,
  7265. i = n.key,
  7266. s = n.nextSeq,
  7267. a = n.rspMsgList;
  7268. if (o !== nt.SUCCESS) {
  7269. var u = this._pollingRequestInfoMap.get(e),
  7270. c = new qr(Li),
  7271. l = u ? "".concat(u.key, "-").concat(u.startSeq) : "requestInfo is undefined";
  7272. c.setMessage("".concat(e, "-").concat(l, "-").concat(r || JSON.stringify(t.data))).setCode(o).setNetworkType(this.groupController.getNetworkType()).setEnd(!0);
  7273. } else _e(i) && fe(s) && this._pollingRequestInfoMap.set(e, {
  7274. key: i,
  7275. startSeq: s
  7276. }), Ie(a) && a.length > 0 && (a.forEach(function (e) {
  7277. e.to = e.groupID;
  7278. }), this._dispatchNotice(a));
  7279. this.groupController.emitInnerEvent(zo);
  7280. }
  7281. }, {
  7282. key: "_handleFailure",
  7283. value: function (e) {
  7284. if (e.error) if ("ECONNABORTED" === e.error.code || e.error.code === qt.NETWORK_TIMEOUT) {
  7285. if (e.error.config) {
  7286. var t = e.error.config.url,
  7287. n = e.error.config.data;
  7288. de.log("AVChatRoomHandler._handleFailure request timed out. url=".concat(t, " data=").concat(n));
  7289. } else de.log("AVChatRoomHandler._handleFailure request timed out");
  7290. } else de.log("AVChatRoomHandler._handleFailure request failed due to network error");
  7291. this.groupController.emitInnerEvent(Yo);
  7292. }
  7293. }, {
  7294. key: "_dispatchNotice",
  7295. value: function (n) {
  7296. if (Ie(n) && 0 !== n.length) {
  7297. var o = Date.now(),
  7298. r = null,
  7299. i = [],
  7300. s = [],
  7301. a = n.length;
  7302. a > 1 && n.sort(function (e, t) {
  7303. return e.sequence - t.sequence;
  7304. });
  7305. for (var u = 0; u < a; u++) if (Ts[n[u].event]) {
  7306. if (this.receivedMessageCount += 1, r = this.packMessage(n[u], n[u].event), this.tim.context.unlimitedAVChatRoom || !this.sequencesLinkedList.has(r.sequence)) {
  7307. var c = r.conversationID;
  7308. if (this.receivedMessageCount % 40 == 0 && this.tim.messageLossController.detectMessageLoss(c, this.sequencesLinkedList.data()), null !== this.sequencesLinkedList.tail()) {
  7309. var l = this.sequencesLinkedList.tail().value,
  7310. p = r.sequence - l;
  7311. p > 1 && p <= 20 ? this.tim.messageLossController.onMessageMaybeLost(c, l + 1, p - 1) : p < -1 && p >= -20 && this.tim.messageLossController.onMessageMaybeLost(c, r.sequence + 1, Math.abs(p) - 1);
  7312. }
  7313. this.sequencesLinkedList.pushIn(r.sequence), this._isMessageSentByCurrentInstance(r) || (r.conversationType === t.CONV_SYSTEM && s.push(r), i.push(r));
  7314. }
  7315. } else de.warn("AVChatRoomHandler._dispatchMessage 未处理的 event 类型: ".concat(n[u].event));
  7316. if (s.length > 0 && this.groupController.emitInnerEvent(Ro, {
  7317. result: s,
  7318. eventDataList: [],
  7319. type: "poll"
  7320. }), 0 !== i.length) {
  7321. var g = this.packConversationOption(i);
  7322. g.length > 0 && this.groupController.emitInnerEvent(Oo, {
  7323. eventDataList: g,
  7324. type: "poll"
  7325. }), de.debug("AVChatRoomHandler._dispatchNotice nums=".concat(i.length));
  7326. var h = this.tim.sumStatController;
  7327. h.addTotalCount(Pr), h.addSuccessCount(Pr), h.addCost(Pr, Date.now() - o), this._checkMessageStacked(i), this.groupController.emitOuterEvent(e.MESSAGE_RECEIVED, i);
  7328. }
  7329. }
  7330. }
  7331. }, {
  7332. key: "_checkMessageStacked",
  7333. value: function (e) {
  7334. var t = e.length;
  7335. t >= 100 && (de.warn("AVChatRoomHandler.checkMessageStacked 直播群消息堆积数:".concat(e.length, '!可能会导致微信小程序渲染时遇到 "Dom limit exceeded" 的错误,建议接入侧此时只渲染最近的10条消息')), this._reportMessageStackedCount < 5 && (new qr(bi).setNetworkType(this.groupController.getNetworkType()).setText("nums=".concat(t, " groupID=").concat(I(this._joinedGroupMap.keys()))).setEnd(), this._reportMessageStackedCount += 1));
  7336. }
  7337. }, {
  7338. key: "_isMessageSentByCurrentInstance",
  7339. value: function (e) {
  7340. return !!this.tim.messageController.isMessageSentByCurrentInstance(e);
  7341. }
  7342. }, {
  7343. key: "packMessage",
  7344. value: function (e, n) {
  7345. e.currentUser = this.tim.context.identifier, e.conversationType = 5 === n ? t.CONV_SYSTEM : t.CONV_GROUP, e.isSystemMessage = !!e.isSystemMessage;
  7346. var o = new Qn(e),
  7347. r = this.packElements(e, n);
  7348. return o.setElement(r), o;
  7349. }
  7350. }, {
  7351. key: "packElements",
  7352. value: function (e, n) {
  7353. return 4 === n || 6 === n ? (this._updateMemberCountByGroupTips(e), {
  7354. type: t.MSG_GRP_TIP,
  7355. content: u(u({}, e.elements), {}, {
  7356. groupProfile: e.groupProfile
  7357. })
  7358. }) : 5 === n ? {
  7359. type: t.MSG_GRP_SYS_NOTICE,
  7360. content: u(u({}, e.elements), {}, {
  7361. groupProfile: e.groupProfile
  7362. })
  7363. } : this.tim.bigDataHallwayController.parseElements(e.elements, e.from);
  7364. }
  7365. }, {
  7366. key: "packConversationOption",
  7367. value: function (e) {
  7368. for (var t = new Map(), n = 0; n < e.length; n++) {
  7369. var o = e[n],
  7370. r = o.conversationID;
  7371. if (t.has(r)) {
  7372. var i = t.get(r);
  7373. i.lastMessage = o, "in" === o.flow && i.unreadCount++;
  7374. } else t.set(r, {
  7375. conversationID: o.conversationID,
  7376. unreadCount: "out" === o.flow ? 0 : 1,
  7377. type: o.conversationType,
  7378. subType: o.conversationSubType,
  7379. lastMessage: o
  7380. });
  7381. }
  7382. return I(t.values());
  7383. }
  7384. }, {
  7385. key: "_addAVChatRoomID",
  7386. value: function (e) {
  7387. var t = this.tim.loginInfo.avchatroomIDList || [];
  7388. t.includes(e) || (this.tim.context.unlimitedAVChatRoom ? t.push(e) : t.splice(0, 1, e), this.tim.loginInfo.avchatroomIDList = t);
  7389. }
  7390. }, {
  7391. key: "_deleteAVChatRoomID",
  7392. value: function (e) {
  7393. var t = this.tim.loginInfo.avchatroomIDList || [],
  7394. n = t.indexOf(e);
  7395. -1 !== n && (t.splice(n, 1), this.tim.loginInfo.avchatroomIDList = t);
  7396. }
  7397. }, {
  7398. key: "joinAVChatRoomSilently",
  7399. value: function () {
  7400. var e = this,
  7401. t = this.tim.loginInfo.avchatroomIDList || [];
  7402. if (0 !== t.length) {
  7403. var n = new qr(li);
  7404. t.forEach(function (t) {
  7405. e.groupController.joinGroup({
  7406. groupID: t
  7407. }).then(function (o) {
  7408. de.warn("AVChatRoomHandler.joinAVChatRoomSilently silently join group ok:".concat(t)), n.setCode(o.code).setText("groupID=".concat(t)).setNetworkType(e.groupController.getNetworkType()).setEnd(!0);
  7409. }).catch(function (o) {
  7410. de.warn("AVChatRoomHandler.joinAVChatRoomSilently silently join group failed:".concat(Re(o))), n.setMessage("".concat(t, "-").concat(JSON.stringify(o))).setCode(o.code).setNetworkType(e.groupController.getNetworkType()).setEnd(!0);
  7411. });
  7412. });
  7413. }
  7414. }
  7415. }, {
  7416. key: "getGroupOnlineMemberCount",
  7417. value: function (e) {
  7418. var t = this._onlineMemberCountMap.get(e) || {},
  7419. n = Date.now();
  7420. return Xe(t) || n - t.lastSyncTime > 1e3 * t.expireTime && n - t.latestUpdateTime > 1e4 && n - t.lastReqTime > 3e3 ? (t.lastReqTime = n, this._onlineMemberCountMap.set(e, t), this._getGroupOnlineMemberCount(e).then(function (e) {
  7421. return new vr({
  7422. memberCount: e.memberCount
  7423. });
  7424. }).catch(function (e) {
  7425. return Cr(e);
  7426. })) : Mr({
  7427. memberCount: t.memberCount
  7428. });
  7429. }
  7430. }, {
  7431. key: "_getGroupOnlineMemberCount",
  7432. value: function (e) {
  7433. var t = this;
  7434. return this.groupController.request({
  7435. name: "group",
  7436. action: "getOnlineMemberNum",
  7437. param: {
  7438. groupID: e
  7439. }
  7440. }).then(function (n) {
  7441. var o = t._onlineMemberCountMap.get(e) || {},
  7442. r = n.data,
  7443. i = r.onlineMemberNum,
  7444. s = void 0 === i ? 0 : i,
  7445. a = r.expireTime,
  7446. u = void 0 === a ? t.DEFAULT_EXPIRE_TIME : a;
  7447. de.log("AVChatRoomHandler._getGroupOnlineMemberCount ok. groupID=".concat(e, " memberCount=").concat(s, " expireTime=").concat(u));
  7448. var c = Date.now();
  7449. return Xe(o) && (o.lastReqTime = c), t._onlineMemberCountMap.set(e, Object.assign(o, {
  7450. lastSyncTime: c,
  7451. latestUpdateTime: c,
  7452. memberCount: s,
  7453. expireTime: u
  7454. })), {
  7455. memberCount: s
  7456. };
  7457. }).catch(function (n) {
  7458. return de.warn("AVChatRoomHandler._getGroupOnlineMemberCount failed. error:".concat(Re(n))), new qr(Ri).setCode(n.code).setMessage("".concat(e, "-").concat(JSON.stringify(n))).setNetworkType(t.groupController.getNetworkType()).setEnd(), Promise.reject(n);
  7459. });
  7460. }
  7461. }, {
  7462. key: "_updateMemberCountByGroupTips",
  7463. value: function (e) {
  7464. var t = e.groupProfile.groupID,
  7465. n = e.elements.onlineMemberInfo,
  7466. o = void 0 === n ? void 0 : n;
  7467. if (void 0 !== o) {
  7468. var r = o.onlineMemberNum,
  7469. i = void 0 === r ? 0 : r,
  7470. s = o.expireTime,
  7471. a = void 0 === s ? this.DEFAULT_EXPIRE_TIME : s,
  7472. u = this._onlineMemberCountMap.get(t) || {},
  7473. c = Date.now();
  7474. Xe(u) ? Object.assign(u, {
  7475. lastReqTime: 0,
  7476. lastSyncTime: 0,
  7477. latestUpdateTime: c,
  7478. memberCount: i,
  7479. expireTime: a
  7480. }) : (u.latestUpdateTime = c, u.memberCount = i), de.debug("AVChatRoomHandler._updateMemberCountByGroupTips info:", u), this._onlineMemberCountMap.set(t, u);
  7481. }
  7482. }
  7483. }, {
  7484. key: "reset",
  7485. value: function (e) {
  7486. if (0 !== this._pollingInstanceMap.size) {
  7487. if (e) de.log("AVChatRoomHandler.reset groupID=".concat(e)), this.stop(e), this._pollingInstanceMap.delete(e), this._joinedGroupMap.delete(e), this._pollingRequestInfoMap.delete(e), this._onlineMemberCountMap.delete(e);else {
  7488. de.log("AVChatRoomHandler.reset all");
  7489. var t,
  7490. n = S(this._pollingInstanceMap.keys());
  7491. try {
  7492. for (n.s(); !(t = n.n()).done;) {
  7493. var o = t.value;
  7494. this.stop(o);
  7495. }
  7496. } catch (r) {
  7497. n.e(r);
  7498. } finally {
  7499. n.f();
  7500. }
  7501. this._pollingInstanceMap.clear(), this._joinedGroupMap.clear(), this._pollingRequestInfoMap.clear(), this._onlineMemberCountMap.clear();
  7502. }
  7503. this.sequencesLinkedList.reset(), this.receivedMessageCount = 0, this._reportMessageStackedCount = 0, this._deleteAVChatRoomID(e);
  7504. }
  7505. }
  7506. }]), n;
  7507. }(),
  7508. Ss = "GroupController",
  7509. ks = function (n) {
  7510. c(s, n);
  7511. var r = v(s);
  7512. function s(e) {
  7513. var t;
  7514. return o(this, s), (t = r.call(this, e)).groupMap = new Map(), t.groupMemberListMap = new Map(), t.groupNoticeHandler = new Es({
  7515. tim: e,
  7516. groupController: f(t)
  7517. }), t.groupTipsHandler = new Cs({
  7518. tim: e,
  7519. groupController: f(t)
  7520. }), t.AVChatRoomHandler = new Ds({
  7521. tim: e,
  7522. groupController: f(t)
  7523. }), t._initListeners(), t;
  7524. }
  7525. return i(s, [{
  7526. key: "createGroup",
  7527. value: function (e) {
  7528. var n = this,
  7529. o = "".concat(Ss, ".createGroup");
  7530. if (!["Public", "Private", "ChatRoom", "AVChatRoom"].includes(e.type)) {
  7531. var r = new Ut({
  7532. code: qt.ILLEGAL_GROUP_TYPE,
  7533. message: fn
  7534. });
  7535. return Cr(r);
  7536. }
  7537. Be(e.type) && !Me(e.memberList) && e.memberList.length > 0 && (de.warn("".concat(o, "创建AVChatRoom时不能添加群成员,自动忽略该字段")), e.memberList = void 0), Ke(e.type) || Me(e.joinOption) || (de.warn("".concat(o, " 创建Work/Meeting/AVChatRoom群时不能设置字段:joinOption,自动忽略该字段")), e.joinOption = void 0);
  7538. var i = new qr(ui);
  7539. return de.log("".concat(o)), this.request({
  7540. name: "group",
  7541. action: "create",
  7542. param: e
  7543. }).then(function (r) {
  7544. if (i.setNetworkType(n.getNetworkType()).setText("groupType=".concat(e.type, " groupID=").concat(r.data.groupID)).setEnd(), de.log("".concat(o, " ok. groupID:"), r.data.groupID), e.type === t.GRP_AVCHATROOM) return n.getGroupProfile({
  7545. groupID: r.data.groupID
  7546. });
  7547. n.updateGroupMap([u(u({}, e), {}, {
  7548. groupID: r.data.groupID
  7549. })]);
  7550. var s = n.tim.createCustomMessage({
  7551. to: r.data.groupID,
  7552. conversationType: t.CONV_GROUP,
  7553. payload: {
  7554. data: "group_create",
  7555. extension: "".concat(n.tim.context.identifier, "创建群组")
  7556. }
  7557. });
  7558. return n.tim.sendMessage(s), n.emitGroupListUpdate(), n.getGroupProfile({
  7559. groupID: r.data.groupID
  7560. });
  7561. }).then(function (e) {
  7562. var n = e.data.group;
  7563. return n.selfInfo.messageRemindType = t.MSG_REMIND_ACPT_AND_NOTE, n.selfInfo.role = t.GRP_MBR_ROLE_OWNER, e;
  7564. }).catch(function (t) {
  7565. return i.setText("groupType=".concat(e.type)), n.probeNetwork().then(function (e) {
  7566. var n = y(e, 2),
  7567. o = n[0],
  7568. r = n[1];
  7569. i.setError(t, o, r).setEnd();
  7570. }), de.error("".concat(o, " error:"), t), Cr(t);
  7571. });
  7572. }
  7573. }, {
  7574. key: "joinGroup",
  7575. value: function (e) {
  7576. var n = this,
  7577. o = e.groupID,
  7578. r = e.type,
  7579. i = "".concat(Ss, ".joinGroup");
  7580. if (r === t.GRP_WORK) {
  7581. var s = new Ut({
  7582. code: qt.CANNOT_JOIN_WORK,
  7583. message: _n
  7584. });
  7585. return Cr(s);
  7586. }
  7587. if (this.hasLocalGroup(o)) {
  7588. if (!this.isLoggedIn()) return Mr({
  7589. status: t.JOIN_STATUS_ALREADY_IN_GROUP
  7590. });
  7591. var a = new qr(ci);
  7592. return this.getGroupProfile({
  7593. groupID: o
  7594. }).then(function (e) {
  7595. return a.setNetworkType(n.getNetworkType()).setText("groupID=".concat(o, " joinedStatus=").concat(t.JOIN_STATUS_ALREADY_IN_GROUP)).setEnd(), Mr({
  7596. status: t.JOIN_STATUS_ALREADY_IN_GROUP
  7597. });
  7598. }).catch(function (t) {
  7599. return a.setNetworkType(n.getNetworkType()).setText("groupID=".concat(o, " unjoined")).setEnd(), de.warn("".concat(i, " ").concat(o, " was unjoined, now join!")), n.groupMap.delete(o), n.applyJoinGroup(e);
  7600. });
  7601. }
  7602. return de.log("".concat(i, " groupID:"), o), this.isLoggedIn() ? this.applyJoinGroup(e) : this.AVChatRoomHandler.joinWithoutAuth(e);
  7603. }
  7604. }, {
  7605. key: "quitGroup",
  7606. value: function (e) {
  7607. var t = this,
  7608. n = "".concat(Ss, ".quitGroup");
  7609. de.log("".concat(n, " groupID:"), e);
  7610. var o = this.AVChatRoomHandler.checkJoinedAVChatRoomByID(e);
  7611. if (o && !this.isLoggedIn()) return de.log("".concat(n, " anonymously ok. groupID:"), e), this.deleteLocalGroupAndConversation(e), this.AVChatRoomHandler.reset(e), Mr({
  7612. groupID: e
  7613. });
  7614. var r = new qr(pi);
  7615. return this.request({
  7616. name: "group",
  7617. action: "quitGroup",
  7618. param: {
  7619. groupID: e
  7620. }
  7621. }).then(function () {
  7622. return r.setNetworkType(t.getNetworkType()).setText("groupID=".concat(e)).setEnd(), de.log("".concat(n, " ok. groupID:"), e), o && t.AVChatRoomHandler.reset(e), t.deleteLocalGroupAndConversation(e), new vr({
  7623. groupID: e
  7624. });
  7625. }).catch(function (o) {
  7626. return r.setText("groupID=".concat(e)), t.probeNetwork().then(function (e) {
  7627. var t = y(e, 2),
  7628. n = t[0],
  7629. i = t[1];
  7630. r.setError(o, n, i).setEnd();
  7631. }), de.error("".concat(n, " error. error:").concat(Re(o), " groupID:").concat(e)), Cr(o);
  7632. });
  7633. }
  7634. }, {
  7635. key: "changeGroupOwner",
  7636. value: function (e) {
  7637. var n = this,
  7638. o = "".concat(Ss, ".changeGroupOwner");
  7639. if (this.hasLocalGroup(e.groupID) && this.getLocalGroupProfile(e.groupID).type === t.GRP_AVCHATROOM) return Cr(new Ut({
  7640. code: qt.CANNOT_CHANGE_OWNER_IN_AVCHATROOM,
  7641. message: vn
  7642. }));
  7643. if (e.newOwnerID === this.tim.loginInfo.identifier) return Cr(new Ut({
  7644. code: qt.CANNOT_CHANGE_OWNER_TO_SELF,
  7645. message: yn
  7646. }));
  7647. var r = new qr(hi);
  7648. return de.log("".concat(o, " groupID:"), e.groupID), this.request({
  7649. name: "group",
  7650. action: "changeGroupOwner",
  7651. param: e
  7652. }).then(function () {
  7653. r.setNetworkType(n.getNetworkType()).setText("groupID=".concat(e.groupID)).setEnd(), de.log("".concat(o, " ok. groupID:"), e.groupID);
  7654. var t = e.groupID,
  7655. i = e.newOwnerID;
  7656. n.groupMap.get(t).ownerID = i;
  7657. var s = n.groupMemberListMap.get(t);
  7658. if (s instanceof Map) {
  7659. var a = s.get(n.tim.loginInfo.identifier);
  7660. Me(a) || (a.updateRole("Member"), n.groupMap.get(t).selfInfo.role = "Member");
  7661. var u = s.get(i);
  7662. Me(u) || u.updateRole("Owner");
  7663. }
  7664. return n.emitGroupListUpdate(!0, !1), new vr({
  7665. group: n.groupMap.get(t)
  7666. });
  7667. }).catch(function (t) {
  7668. return r.setText("groupID=".concat(e.groupID)), n.probeNetwork().then(function (e) {
  7669. var n = y(e, 2),
  7670. o = n[0],
  7671. i = n[1];
  7672. r.setError(t, o, i).setEnd();
  7673. }), de.error("".concat(o, " error:").concat(Re(t), " groupID:").concat(e.groupID)), Cr(t);
  7674. });
  7675. }
  7676. }, {
  7677. key: "dismissGroup",
  7678. value: function (e) {
  7679. var n = this,
  7680. o = "".concat(Ss, ".dismissGroup");
  7681. if (this.hasLocalGroup(e) && this.getLocalGroupProfile(e).type === t.GRP_WORK) return Cr(new Ut({
  7682. code: qt.CANNOT_DISMISS_WORK,
  7683. message: In
  7684. }));
  7685. var r = new qr(fi);
  7686. return de.log("".concat(o, " groupID:").concat(e)), this.request({
  7687. name: "group",
  7688. action: "destroyGroup",
  7689. param: {
  7690. groupID: e
  7691. }
  7692. }).then(function () {
  7693. return r.setNetworkType(n.getNetworkType()).setText("groupID=".concat(e)).setEnd(), de.log("".concat(o, " ok. groupID:").concat(e)), n.deleteLocalGroupAndConversation(e), n.checkJoinedAVChatRoomByID(e) && n.AVChatRoomHandler.reset(e), new vr({
  7694. groupID: e
  7695. });
  7696. }).catch(function (t) {
  7697. return r.setText("groupID=".concat(e)), n.probeNetwork().then(function (e) {
  7698. var n = y(e, 2),
  7699. o = n[0],
  7700. i = n[1];
  7701. r.setError(t, o, i).setEnd();
  7702. }), de.error("".concat(o, " error:").concat(Re(t), " groupID:").concat(e)), Cr(t);
  7703. });
  7704. }
  7705. }, {
  7706. key: "updateGroupProfile",
  7707. value: function (e) {
  7708. var t = this,
  7709. n = "".concat(Ss, ".updateGroupProfile");
  7710. !this.hasLocalGroup(e.groupID) || Ke(this.getLocalGroupProfile(e.groupID).type) || Me(e.joinOption) || (de.warn("".concat(n, " Work/Meeting/AVChatRoom群不能设置字段:joinOption,自动忽略该字段")), e.joinOption = void 0), Me(e.muteAllMembers) || (e.muteAllMembers ? e.muteAllMembers = "On" : e.muteAllMembers = "Off");
  7711. var o = new qr(_i);
  7712. return o.setText(JSON.stringify(e)), de.log("".concat(n, " groupID:"), e.groupID), this.request({
  7713. name: "group",
  7714. action: "updateGroupProfile",
  7715. param: e
  7716. }).then(function () {
  7717. (o.setNetworkType(t.getNetworkType()).setEnd(), de.log("".concat(n, " ok. groupID:"), e.groupID), t.hasLocalGroup(e.groupID)) && (t.groupMap.get(e.groupID).updateGroup(e), t._setStorageGroupList());
  7718. return new vr({
  7719. group: t.groupMap.get(e.groupID)
  7720. });
  7721. }).catch(function (r) {
  7722. return t.probeNetwork().then(function (e) {
  7723. var t = y(e, 2),
  7724. n = t[0],
  7725. i = t[1];
  7726. o.setError(r, n, i).setEnd();
  7727. }), de.log("".concat(n, " failed. error:").concat(Re(r), " groupID:").concat(e.groupID)), Cr(r);
  7728. });
  7729. }
  7730. }, {
  7731. key: "setGroupMemberRole",
  7732. value: function (e) {
  7733. var n = this,
  7734. o = "".concat(Ss, ".setGroupMemberRole"),
  7735. r = e.groupID,
  7736. i = e.userID,
  7737. s = e.role,
  7738. a = this.groupMap.get(r);
  7739. if (a.selfInfo.role !== t.GRP_MBR_ROLE_OWNER) return Cr(new Ut({
  7740. code: qt.NOT_OWNER,
  7741. message: Dn
  7742. }));
  7743. if ([t.GRP_WORK, t.GRP_AVCHATROOM].includes(a.type)) return Cr(new Ut({
  7744. code: qt.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM,
  7745. message: Sn
  7746. }));
  7747. if ([t.GRP_MBR_ROLE_ADMIN, t.GRP_MBR_ROLE_MEMBER].indexOf(s) < 0) return Cr(new Ut({
  7748. code: qt.INVALID_MEMBER_ROLE,
  7749. message: kn
  7750. }));
  7751. if (i === this.tim.loginInfo.identifier) return Cr(new Ut({
  7752. code: qt.CANNOT_SET_SELF_MEMBER_ROLE,
  7753. message: An
  7754. }));
  7755. var u = new qr(Ai);
  7756. return u.setText("groupID=".concat(r, " userID=").concat(i, " role=").concat(s)), de.log("".concat(o, " groupID:").concat(r, ". userID: ").concat(i)), this._modifyGroupMemberInfo({
  7757. groupID: r,
  7758. userID: i,
  7759. role: s
  7760. }).then(function (e) {
  7761. return u.setNetworkType(n.getNetworkType()).setEnd(), de.log("".concat(o, " ok. groupID:").concat(r, ". userID: ").concat(i)), new vr({
  7762. group: a,
  7763. member: e
  7764. });
  7765. }).catch(function (e) {
  7766. return n.probeNetwork().then(function (t) {
  7767. var n = y(t, 2),
  7768. o = n[0],
  7769. r = n[1];
  7770. u.setError(e, o, r).setEnd();
  7771. }), de.error("".concat(o, " error:").concat(Re(e), " groupID:").concat(r, " userID:").concat(i)), Cr(e);
  7772. });
  7773. }
  7774. }, {
  7775. key: "setGroupMemberMuteTime",
  7776. value: function (e) {
  7777. var t = this,
  7778. n = e.groupID,
  7779. o = e.userID,
  7780. r = e.muteTime,
  7781. i = "".concat(Ss, ".setGroupMemberMuteTime");
  7782. if (o === this.tim.loginInfo.identifier) return Cr(new Ut({
  7783. code: qt.CANNOT_MUTE_SELF,
  7784. message: On
  7785. }));
  7786. de.log("".concat(i, " groupID:").concat(n, ". userID: ").concat(o));
  7787. var s = new qr(Si);
  7788. return s.setText("groupID=".concat(n, " userID=").concat(o, " muteTime=").concat(r)), this._modifyGroupMemberInfo({
  7789. groupID: n,
  7790. userID: o,
  7791. muteTime: r
  7792. }).then(function (e) {
  7793. return s.setNetworkType(t.getNetworkType()).setEnd(), de.log("".concat(i, " ok. groupID:").concat(n, ". userID: ").concat(o)), new vr({
  7794. group: t.getLocalGroupProfile(n),
  7795. member: e
  7796. });
  7797. }).catch(function (e) {
  7798. return t.probeNetwork().then(function (t) {
  7799. var n = y(t, 2),
  7800. o = n[0],
  7801. r = n[1];
  7802. s.setError(e, o, r).setEnd();
  7803. }), de.error("".concat(i, " error:").concat(Re(e), " groupID:").concat(n, " userID:").concat(o)), Cr(e);
  7804. });
  7805. }
  7806. }, {
  7807. key: "setMessageRemindType",
  7808. value: function (e) {
  7809. var t = this,
  7810. n = "".concat(Ss, ".setMessageRemindType"),
  7811. o = new qr(mi);
  7812. o.setText("groupID=".concat(e.groupID, " userID=").concat(e.userID || this.tim.loginInfo.identifier)), de.log("".concat(n, " groupID:").concat(e.groupID, ". userID: ").concat(e.userID || this.tim.loginInfo.identifier));
  7813. var r = e.groupID,
  7814. i = e.messageRemindType;
  7815. return this._modifyGroupMemberInfo({
  7816. groupID: r,
  7817. messageRemindType: i,
  7818. userID: this.tim.loginInfo.identifier
  7819. }).then(function () {
  7820. o.setNetworkType(t.getNetworkType()).setEnd(), de.log("".concat(n, " ok. groupID:").concat(e.groupID, " userID:").concat(e.userID || t.tim.loginInfo.identifier));
  7821. var r = t.getLocalGroupProfile(e.groupID);
  7822. return r && (r.selfInfo.messageRemindType = i), new vr({
  7823. group: r
  7824. });
  7825. }).catch(function (r) {
  7826. return t.probeNetwork().then(function (e) {
  7827. var t = y(e, 2),
  7828. n = t[0],
  7829. i = t[1];
  7830. o.setError(r, n, i).setEnd();
  7831. }), de.error("".concat(n, " error:").concat(Re(r), " groupID:").concat(e.groupID, " userID:").concat(e.userID || t.tim.loginInfo.identifier)), Cr(r);
  7832. });
  7833. }
  7834. }, {
  7835. key: "setGroupMemberNameCard",
  7836. value: function (e) {
  7837. var t = this,
  7838. n = "".concat(Ss, ".setGroupMemberNameCard"),
  7839. o = e.groupID,
  7840. r = e.userID,
  7841. i = void 0 === r ? this.tim.loginInfo.identifier : r,
  7842. s = e.nameCard;
  7843. de.log("".concat(n, " groupID:").concat(o, ". userID: ").concat(i));
  7844. var a = new qr(ki);
  7845. return a.setText("groupID=".concat(o, " userID=").concat(i, " nameCard=").concat(s)), this._modifyGroupMemberInfo({
  7846. groupID: o,
  7847. userID: i,
  7848. nameCard: s
  7849. }).then(function (e) {
  7850. de.log("".concat(n, " ok. groupID:").concat(o, ". userID: ").concat(i)), a.setNetworkType(t.getNetworkType()).setEnd();
  7851. var r = t.getLocalGroupProfile(o);
  7852. return i === t.tim.loginInfo.identifier && r && r.setSelfNameCard(s), new vr({
  7853. group: r,
  7854. member: e
  7855. });
  7856. }).catch(function (e) {
  7857. return t.probeNetwork().then(function (t) {
  7858. var n = y(t, 2),
  7859. o = n[0],
  7860. r = n[1];
  7861. a.setError(e, o, r).setEnd();
  7862. }), de.error("".concat(n, " error:").concat(Re(e), " groupID:").concat(o, " userID:").concat(i)), Cr(e);
  7863. });
  7864. }
  7865. }, {
  7866. key: "setGroupMemberCustomField",
  7867. value: function (e) {
  7868. var t = this,
  7869. n = "".concat(Ss, ".setGroupMemberCustomField"),
  7870. o = e.groupID,
  7871. r = e.userID,
  7872. i = void 0 === r ? this.tim.loginInfo.identifier : r,
  7873. s = e.memberCustomField;
  7874. de.log("".concat(n, " groupID:").concat(o, ". userID: ").concat(i));
  7875. var a = new qr(Oi);
  7876. return a.setText("groupID=".concat(o, " userID=").concat(i, " memberCustomField=").concat(s)), this._modifyGroupMemberInfo({
  7877. groupID: o,
  7878. userID: i,
  7879. memberCustomField: s
  7880. }).then(function (e) {
  7881. return a.setNetworkType(t.getNetworkType()).setEnd(), de.log("".concat(n, " ok. groupID:").concat(o, ". userID: ").concat(i)), new vr({
  7882. group: t.groupMap.get(o),
  7883. member: e
  7884. });
  7885. }).catch(function (e) {
  7886. return t.probeNetwork().then(function (t) {
  7887. var n = y(t, 2),
  7888. o = n[0],
  7889. r = n[1];
  7890. a.setError(e, o, r).setEnd();
  7891. }), de.error("".concat(n, " error:").concat(Re(e), " groupID:").concat(o, " userID:").concat(i)), Cr(e);
  7892. });
  7893. }
  7894. }, {
  7895. key: "getGroupList",
  7896. value: function (e) {
  7897. var t = this,
  7898. n = "".concat(Ss, ".getGroupList"),
  7899. o = new qr(vi);
  7900. de.log("".concat(n));
  7901. var r = {
  7902. introduction: "Introduction",
  7903. notification: "Notification",
  7904. createTime: "CreateTime",
  7905. ownerID: "Owner_Account",
  7906. lastInfoTime: "LastInfoTime",
  7907. memberNum: "MemberNum",
  7908. maxMemberNum: "MaxMemberNum",
  7909. joinOption: "ApplyJoinOption",
  7910. muteAllMembers: "ShutUpAllMember"
  7911. },
  7912. i = ["Type", "Name", "FaceUrl", "NextMsgSeq", "LastMsgTime"];
  7913. return e && e.groupProfileFilter && e.groupProfileFilter.forEach(function (e) {
  7914. r[e] && i.push(r[e]);
  7915. }), this.request({
  7916. name: "group",
  7917. action: "list",
  7918. param: {
  7919. responseFilter: {
  7920. groupBaseInfoFilter: i,
  7921. selfInfoFilter: ["Role", "JoinTime", "MsgFlag"]
  7922. }
  7923. }
  7924. }).then(function (e) {
  7925. var r = e.data.groups;
  7926. return de.log("".concat(n, " ok. nums=").concat(r.length)), t._groupListTreeShaking(r), t.updateGroupMap(r), o.setNetworkType(t.getNetworkType()).setText("".concat(r.length, "-afterTreeshaking-").concat(t.groupMap.size)).setEnd(), t.tempConversationList && (de.log("".concat(n, " update last message with tempConversationList, nums=").concat(t.tempConversationList.length)), t._handleUpdateGroupLastMessage({
  7927. data: t.tempConversationList
  7928. }), t.tempConversationList = null), t.emitGroupListUpdate(), new vr({
  7929. groupList: t.getLocalGroups()
  7930. });
  7931. }).catch(function (e) {
  7932. return t.probeNetwork().then(function (t) {
  7933. var n = y(t, 2),
  7934. r = n[0],
  7935. i = n[1];
  7936. o.setError(e, r, i).setEnd();
  7937. }), de.error("".concat(n, " error:"), e), Cr(e);
  7938. });
  7939. }
  7940. }, {
  7941. key: "getGroupMemberList",
  7942. value: function (e) {
  7943. var t = this,
  7944. n = e.groupID,
  7945. o = e.offset,
  7946. r = void 0 === o ? 0 : o,
  7947. i = e.count,
  7948. s = void 0 === i ? 15 : i,
  7949. a = "".concat(Ss, ".getGroupMemberList"),
  7950. u = new qr(Ci);
  7951. de.log("".concat(a, " groupID: ").concat(n, " offset: ").concat(r, " count: ").concat(s));
  7952. var c = [];
  7953. return this.request({
  7954. name: "group",
  7955. action: "getGroupMemberList",
  7956. param: {
  7957. groupID: n,
  7958. offset: r,
  7959. limit: s > 100 ? 100 : s,
  7960. memberInfoFilter: ["Role", "NameCard", "ShutUpUntil"]
  7961. }
  7962. }).then(function (e) {
  7963. var o = e.data,
  7964. r = o.members,
  7965. i = o.memberNum;
  7966. return Ie(r) && 0 !== r.length ? (t.hasLocalGroup(n) && (t.getLocalGroupProfile(n).memberNum = i), c = t._updateLocalGroupMemberMap(n, r), t.tim.getUserProfile({
  7967. userIDList: r.map(function (e) {
  7968. return e.userID;
  7969. }),
  7970. tagList: [Ct.NICK, Ct.AVATAR]
  7971. })) : Promise.resolve([]);
  7972. }).then(function (e) {
  7973. var o = e.data;
  7974. if (!Ie(o) || 0 === o.length) return Mr({
  7975. memberList: []
  7976. });
  7977. var i = o.map(function (e) {
  7978. return {
  7979. userID: e.userID,
  7980. nick: e.nick,
  7981. avatar: e.avatar
  7982. };
  7983. });
  7984. return t._updateLocalGroupMemberMap(n, i), u.setNetworkType(t.getNetworkType()).setText("groupID=".concat(n, " offset=").concat(r, " count=").concat(s)).setEnd(), de.log("".concat(a, " ok.")), new vr({
  7985. memberList: c
  7986. });
  7987. }).catch(function (e) {
  7988. return t.probeNetwork().then(function (t) {
  7989. var n = y(t, 2),
  7990. o = n[0],
  7991. r = n[1];
  7992. u.setError(e, o, r).setEnd();
  7993. }), de.error("".concat(a, " error:"), e), Cr(e);
  7994. });
  7995. }
  7996. }, {
  7997. key: "getLocalGroups",
  7998. value: function () {
  7999. return I(this.groupMap.values());
  8000. }
  8001. }, {
  8002. key: "getLocalGroupProfile",
  8003. value: function (e) {
  8004. return this.groupMap.get(e);
  8005. }
  8006. }, {
  8007. key: "hasLocalGroup",
  8008. value: function (e) {
  8009. return this.groupMap.has(e);
  8010. }
  8011. }, {
  8012. key: "getLocalGroupMemberInfo",
  8013. value: function (e, t) {
  8014. return this.groupMemberListMap.has(e) ? this.groupMemberListMap.get(e).get(t) : null;
  8015. }
  8016. }, {
  8017. key: "setLocalGroupMember",
  8018. value: function (e, t) {
  8019. if (this.groupMemberListMap.has(e)) this.groupMemberListMap.get(e).set(t.userID, t);else {
  8020. var n = new Map().set(t.userID, t);
  8021. this.groupMemberListMap.set(e, n);
  8022. }
  8023. }
  8024. }, {
  8025. key: "hasLocalGroupMember",
  8026. value: function (e, t) {
  8027. return this.groupMemberListMap.has(e) && this.groupMemberListMap.get(e).has(t);
  8028. }
  8029. }, {
  8030. key: "hasLocalGroupMemberMap",
  8031. value: function (e) {
  8032. return this.groupMemberListMap.has(e);
  8033. }
  8034. }, {
  8035. key: "getGroupProfile",
  8036. value: function (e) {
  8037. var t = this,
  8038. n = "".concat(Ss, ".getGroupProfile"),
  8039. o = new qr(yi);
  8040. de.log("".concat(n, " groupID:"), e.groupID);
  8041. var r = e.groupID,
  8042. i = e.groupCustomFieldFilter,
  8043. s = {
  8044. groupIDList: [r],
  8045. responseFilter: {
  8046. groupBaseInfoFilter: ["Type", "Name", "Introduction", "Notification", "FaceUrl", "Owner_Account", "CreateTime", "InfoSeq", "LastInfoTime", "LastMsgTime", "MemberNum", "MaxMemberNum", "ApplyJoinOption", "NextMsgSeq", "ShutUpAllMember"],
  8047. groupCustomFieldFilter: i
  8048. }
  8049. };
  8050. return this.getGroupProfileAdvance(s).then(function (i) {
  8051. var s,
  8052. a = i.data,
  8053. u = a.successGroupList,
  8054. c = a.failureGroupList;
  8055. return de.log("".concat(n, " ok. groupID:").concat(e.groupID)), c.length > 0 ? Cr(c[0]) : (Be(u[0].type) && !t.hasLocalGroup(r) ? s = new cs(u[0]) : (t.updateGroupMap(u), s = t.getLocalGroupProfile(r)), o.setNetworkType(t.getNetworkType()).setText("groupID=".concat(s.groupID, " type=").concat(s.type, " muteAllMembers=").concat(s.muteAllMembers, " ownerID=").concat(s.ownerID)).setEnd(), s && s.selfInfo && !s.selfInfo.nameCard ? t.updateSelfInfo(s).then(function (e) {
  8056. return new vr({
  8057. group: e
  8058. });
  8059. }) : new vr({
  8060. group: s
  8061. }));
  8062. }).catch(function (r) {
  8063. return t.probeNetwork().then(function (t) {
  8064. var n = y(t, 2),
  8065. i = n[0],
  8066. s = n[1];
  8067. o.setError(r, i, s).setText("groupID=".concat(e.groupID)).setEnd();
  8068. }), de.error("".concat(n, " error:").concat(Re(r), " groupID:").concat(e.groupID)), Cr(r);
  8069. });
  8070. }
  8071. }, {
  8072. key: "getGroupMemberProfile",
  8073. value: function (e) {
  8074. var t = this,
  8075. n = "".concat(Ss, ".getGroupMemberProfile"),
  8076. o = new qr(Ei);
  8077. o.setText(e.userIDList.length > 5 ? "userIDList.length=".concat(e.userIDList.length) : "userIDList=".concat(e.userIDList)), de.log("".concat(n, " groupID:").concat(e.groupID, " userIDList:").concat(e.userIDList.join(","))), e.userIDList.length > 50 && (e.userIDList = e.userIDList.slice(0, 50));
  8078. var r = e.groupID,
  8079. i = e.userIDList;
  8080. return this._getGroupMemberProfileAdvance(u(u({}, e), {}, {
  8081. userIDList: i
  8082. })).then(function (e) {
  8083. var n = e.data.members;
  8084. return Ie(n) && 0 !== n.length ? (t._updateLocalGroupMemberMap(r, n), t.tim.getUserProfile({
  8085. userIDList: n.map(function (e) {
  8086. return e.userID;
  8087. }),
  8088. tagList: [Ct.NICK, Ct.AVATAR]
  8089. })) : Mr([]);
  8090. }).then(function (e) {
  8091. var n = e.data.map(function (e) {
  8092. return {
  8093. userID: e.userID,
  8094. nick: e.nick,
  8095. avatar: e.avatar
  8096. };
  8097. });
  8098. t._updateLocalGroupMemberMap(r, n);
  8099. var s = i.filter(function (e) {
  8100. return t.hasLocalGroupMember(r, e);
  8101. }).map(function (e) {
  8102. return t.getLocalGroupMemberInfo(r, e);
  8103. });
  8104. return o.setNetworkType(t.getNetworkType()).setEnd(), new vr({
  8105. memberList: s
  8106. });
  8107. });
  8108. }
  8109. }, {
  8110. key: "_getGroupMemberProfileAdvance",
  8111. value: function (e) {
  8112. return this.request({
  8113. name: "group",
  8114. action: "getGroupMemberProfile",
  8115. param: u(u({}, e), {}, {
  8116. memberInfoFilter: e.memberInfoFilter ? e.memberInfoFilter : ["Role", "JoinTime", "NameCard", "ShutUpUntil"]
  8117. })
  8118. });
  8119. }
  8120. }, {
  8121. key: "updateSelfInfo",
  8122. value: function (e) {
  8123. var t = "".concat(Ss, ".updateSelfInfo"),
  8124. n = e.groupID;
  8125. de.log("".concat(t, " groupID:"), n);
  8126. var o = {
  8127. groupID: n,
  8128. userIDList: [this.tim.loginInfo.identifier]
  8129. };
  8130. return this.getGroupMemberProfile(o).then(function (o) {
  8131. var r = o.data.memberList;
  8132. return de.log("".concat(t, " ok. groupID:"), n), e && 0 !== r.length && e.updateSelfInfo(r[0]), e;
  8133. });
  8134. }
  8135. }, {
  8136. key: "addGroupMember",
  8137. value: function (e) {
  8138. var t = this,
  8139. n = "".concat(Ss, ".addGroupMember"),
  8140. o = new qr(Ti);
  8141. o.setText("groupID=".concat(e.groupID));
  8142. var r = this.getLocalGroupProfile(e.groupID);
  8143. if (Be(r.type)) {
  8144. var i = new Ut({
  8145. code: qt.CANNOT_ADD_MEMBER_IN_AVCHATROOM,
  8146. message: Cn
  8147. });
  8148. return o.setCode(qt.CANNOT_ADD_MEMBER_IN_AVCHATROOM).setMessage(Cn).setNetworkType(this.getNetworkType()).setText("groupID=".concat(e.groupID, " groupType=").concat(r.type)).setEnd(), Cr(i);
  8149. }
  8150. return e.userIDList = e.userIDList.map(function (e) {
  8151. return {
  8152. userID: e
  8153. };
  8154. }), de.log("".concat(n, " groupID:"), e.groupID), this.request({
  8155. name: "group",
  8156. action: "addGroupMember",
  8157. param: e
  8158. }).then(function (i) {
  8159. var s = i.data.members;
  8160. o.setNetworkType(t.getNetworkType()).setText("groupID=".concat(e.groupID)).setEnd(), de.log("".concat(n, " ok. groupID:"), e.groupID);
  8161. var a = s.filter(function (e) {
  8162. return 1 === e.result;
  8163. }).map(function (e) {
  8164. return e.userID;
  8165. }),
  8166. u = s.filter(function (e) {
  8167. return 0 === e.result;
  8168. }).map(function (e) {
  8169. return e.userID;
  8170. }),
  8171. c = s.filter(function (e) {
  8172. return 2 === e.result;
  8173. }).map(function (e) {
  8174. return e.userID;
  8175. });
  8176. return 0 === a.length ? new vr({
  8177. successUserIDList: a,
  8178. failureUserIDList: u,
  8179. existedUserIDList: c
  8180. }) : (r.memberNum += a.length, new vr({
  8181. successUserIDList: a,
  8182. failureUserIDList: u,
  8183. existedUserIDList: c,
  8184. group: r
  8185. }));
  8186. }).catch(function (r) {
  8187. return t.probeNetwork().then(function (t) {
  8188. var n = y(t, 2),
  8189. i = n[0],
  8190. s = n[1];
  8191. o.setError(r, i, s).setText("groupID=".concat(e.groupID)).setEnd();
  8192. }), de.error("".concat(n, " error:").concat(Re(r), " groupID:").concat(e.groupID)), Cr(r);
  8193. });
  8194. }
  8195. }, {
  8196. key: "deleteGroupMember",
  8197. value: function (e) {
  8198. var n = this,
  8199. o = "".concat(Ss, ".deleteGroupMember"),
  8200. r = new qr(Di);
  8201. r.setText(e.userIDList.length > 5 ? "userIDList.length=".concat(e.userIDList.length) : "userIDList=".concat(e.userIDList)), de.log("".concat(o, " groupID:").concat(e.groupID, " userIDList:").concat(e.userIDList));
  8202. var i = this.getLocalGroupProfile(e.groupID);
  8203. return i.type === t.GRP_AVCHATROOM ? Cr(new Ut({
  8204. code: qt.CANNOT_KICK_MEMBER_IN_AVCHATROOM,
  8205. message: Tn
  8206. })) : this.request({
  8207. name: "group",
  8208. action: "deleteGroupMember",
  8209. param: e
  8210. }).then(function () {
  8211. return r.setNetworkType(n.getNetworkType()).setEnd(), de.log("".concat(o, " ok")), i.memberNum--, n.deleteLocalGroupMembers(e.groupID, e.userIDList), new vr({
  8212. group: i,
  8213. userIDList: e.userIDList
  8214. });
  8215. }).catch(function (t) {
  8216. return n.probeNetwork().then(function (n) {
  8217. var o = y(n, 2),
  8218. i = o[0],
  8219. s = o[1];
  8220. r.setError(t, i, s).setText("groupID=".concat(e.groupID)).setEnd();
  8221. }), de.error("".concat(o, " error:").concat(Re(t), " groupID:").concat(e.groupID)), Cr(t);
  8222. });
  8223. }
  8224. }, {
  8225. key: "searchGroupByID",
  8226. value: function (e) {
  8227. var t = this,
  8228. n = "".concat(Ss, ".searchGroupByID"),
  8229. o = {
  8230. groupIDList: [e]
  8231. },
  8232. r = new qr(gi);
  8233. return r.setText("groupID=".concat(e)), de.log("".concat(n, " groupID:").concat(e)), this.request({
  8234. name: "group",
  8235. action: "searchGroupByID",
  8236. param: o
  8237. }).then(function (o) {
  8238. var i = o.data.groupProfile;
  8239. if (i[0].errorCode !== nt.SUCCESS) throw new Ut({
  8240. code: i[0].errorCode,
  8241. message: i[0].errorInfo
  8242. });
  8243. return r.setNetworkType(t.getNetworkType()).setEnd(), de.log("".concat(n, " ok. groupID:").concat(e)), new vr({
  8244. group: new cs(i[0])
  8245. });
  8246. }).catch(function (o) {
  8247. return t.probeNetwork().then(function (e) {
  8248. var t = y(e, 2),
  8249. n = t[0],
  8250. i = t[1];
  8251. r.setError(o, n, i).setEnd();
  8252. }), de.warn("".concat(n, " error:").concat(Re(o), " groupID:").concat(e)), Cr(o);
  8253. });
  8254. }
  8255. }, {
  8256. key: "applyJoinGroup",
  8257. value: function (e) {
  8258. var t = this,
  8259. n = "".concat(Ss, ".applyJoinGroup"),
  8260. o = new qr(ci);
  8261. return this.request({
  8262. name: "group",
  8263. action: "applyJoinGroup",
  8264. param: e
  8265. }).then(function (r) {
  8266. var i = r.data,
  8267. s = i.joinedStatus,
  8268. a = i.longPollingKey;
  8269. switch (o.setNetworkType(t.getNetworkType()).setText("groupID=".concat(e.groupID, " joinedStatus=").concat(s)).setEnd(), de.log("".concat(n, " ok. groupID:").concat(e.groupID, " joinedStatus:").concat(s, " longPollingKey:").concat(a)), s) {
  8270. case et.WAIT_APPROVAL:
  8271. return new vr({
  8272. status: et.WAIT_APPROVAL
  8273. });
  8274. case et.SUCCESS:
  8275. return t.getGroupProfile({
  8276. groupID: e.groupID
  8277. }).then(function (n) {
  8278. var o = n.data.group,
  8279. r = {
  8280. status: et.SUCCESS,
  8281. group: o
  8282. };
  8283. return Me(a) ? (t.emitGroupListUpdate(!0, !1), new vr(r)) : (t.emitInnerEvent(ir, e.groupID), t.AVChatRoomHandler.startRunLoop({
  8284. longPollingKey: a,
  8285. group: o
  8286. }));
  8287. });
  8288. default:
  8289. var u = new Ut({
  8290. code: qt.JOIN_GROUP_FAIL,
  8291. message: Mn
  8292. });
  8293. return de.error("".concat(n, " error:").concat(Re(u), " groupID:").concat(e.groupID)), Cr(u);
  8294. }
  8295. }).catch(function (r) {
  8296. return o.setText("groupID=".concat(e.groupID)), t.probeNetwork().then(function (e) {
  8297. var t = y(e, 2),
  8298. n = t[0],
  8299. i = t[1];
  8300. o.setError(r, n, i).setEnd();
  8301. }), de.error("".concat(n, " error:").concat(Re(r), " groupID:").concat(e.groupID)), Cr(r);
  8302. });
  8303. }
  8304. }, {
  8305. key: "applyJoinAVChatRoom",
  8306. value: function (e) {
  8307. return this.AVChatRoomHandler.applyJoinAVChatRoom(e);
  8308. }
  8309. }, {
  8310. key: "handleGroupApplication",
  8311. value: function (e) {
  8312. var t = this,
  8313. n = "".concat(Ss, ".handleGroupApplication"),
  8314. o = e.message.payload,
  8315. r = o.groupProfile.groupID,
  8316. i = o.authentication,
  8317. s = o.messageKey,
  8318. a = o.operatorID,
  8319. c = new qr(di);
  8320. return c.setText("groupID=".concat(r)), de.log("".concat(n, " groupID:"), r), this.request({
  8321. name: "group",
  8322. action: "handleApplyJoinGroup",
  8323. param: u(u({}, e), {}, {
  8324. applicant: a,
  8325. groupID: r,
  8326. authentication: i,
  8327. messageKey: s
  8328. })
  8329. }).then(function () {
  8330. return c.setNetworkType(t.getNetworkType()).setEnd(), de.log("".concat(n, " ok. groupID:"), r), t.deleteGroupSystemNotice({
  8331. messageList: [e.message]
  8332. }), new vr({
  8333. group: t.getLocalGroupProfile(r)
  8334. });
  8335. }).catch(function (e) {
  8336. return t.probeNetwork().then(function (t) {
  8337. var n = y(t, 2),
  8338. o = n[0],
  8339. r = n[1];
  8340. c.setError(e, o, r).setEnd();
  8341. }), de.error("".concat(n, " error. error:").concat(Re(e), " groupID:").concat(r)), Cr(e);
  8342. });
  8343. }
  8344. }, {
  8345. key: "deleteGroupSystemNotice",
  8346. value: function (e) {
  8347. var n = this,
  8348. o = "".concat(Ss, ".deleteGroupSystemNotice");
  8349. return Ie(e.messageList) && 0 !== e.messageList.length ? (de.log("".concat(o) + e.messageList.map(function (e) {
  8350. return e.ID;
  8351. })), this.request({
  8352. name: "group",
  8353. action: "deleteGroupSystemNotice",
  8354. param: {
  8355. messageListToDelete: e.messageList.map(function (e) {
  8356. return {
  8357. from: t.CONV_SYSTEM,
  8358. messageSeq: e.clientSequence,
  8359. messageRandom: e.random
  8360. };
  8361. })
  8362. }
  8363. }).then(function () {
  8364. return de.log("".concat(o, " ok")), e.messageList.forEach(function (e) {
  8365. n.tim.messageController.deleteLocalMessage(e);
  8366. }), new vr();
  8367. }).catch(function (e) {
  8368. return de.error("".concat(o, " error:"), e), Cr(e);
  8369. })) : Mr();
  8370. }
  8371. }, {
  8372. key: "getGroupProfileAdvance",
  8373. value: function (e) {
  8374. var t = "".concat(Ss, ".getGroupProfileAdvance");
  8375. return Ie(e.groupIDList) && e.groupIDList.length > 50 && (de.warn("".concat(t, " 获取群资料的数量不能超过50个")), e.groupIDList.length = 50), de.log("".concat(t, " groupIDList:"), e.groupIDList), this.request({
  8376. name: "group",
  8377. action: "query",
  8378. param: e
  8379. }).then(function (e) {
  8380. de.log("".concat(t, " ok."));
  8381. var n = e.data.groups,
  8382. o = n.filter(function (e) {
  8383. return Me(e.errorCode) || e.errorCode === nt.SUCCESS;
  8384. }),
  8385. r = n.filter(function (e) {
  8386. return e.errorCode && e.errorCode !== nt.SUCCESS;
  8387. }).map(function (e) {
  8388. return new Ut({
  8389. code: e.errorCode,
  8390. message: e.errorInfo,
  8391. data: {
  8392. groupID: e.groupID
  8393. }
  8394. });
  8395. });
  8396. return new vr({
  8397. successGroupList: o,
  8398. failureGroupList: r
  8399. });
  8400. }).catch(function (n) {
  8401. return de.error("".concat(t, " error:").concat(Re(n), " groupIDList:").concat(e.groupIDList)), Cr(n);
  8402. });
  8403. }
  8404. }, {
  8405. key: "_deleteLocalGroup",
  8406. value: function (e) {
  8407. return this.groupMap.delete(e), this.groupMemberListMap.delete(e), this._setStorageGroupList(), this.groupMap.has(e) && this.groupMemberListMap.has(e);
  8408. }
  8409. }, {
  8410. key: "_initGroupList",
  8411. value: function () {
  8412. var e = this,
  8413. t = "".concat(Ss, "._initGroupList"),
  8414. n = new qr(Ii);
  8415. de.time(br), de.log("".concat(t));
  8416. var o = this._getStorageGroupList();
  8417. Ie(o) && o.length > 0 ? (o.forEach(function (t) {
  8418. e.groupMap.set(t.groupID, new cs(t));
  8419. }), this.emitGroupListUpdate(!0, !1), n.setNetworkType(this.getNetworkType()).setText(this.groupMap.size).setEnd()) : n.setNetworkType(this.getNetworkType()).setText(0).setEnd(), this.triggerReady(), de.log("".concat(t, " ok. initCost=").concat(de.timeEnd(br), "ms")), this.getGroupList();
  8420. }
  8421. }, {
  8422. key: "_initListeners",
  8423. value: function () {
  8424. var e = this.tim.innerEmitter;
  8425. e.once(Mo, this._initGroupList, this), e.on(tr, this._handleUpdateGroupLastMessage, this), e.on(Oo, this._handleReceivedGroupMessage, this), e.on(rr, this._handleProfileUpdated, this);
  8426. }
  8427. }, {
  8428. key: "emitGroupListUpdate",
  8429. value: function () {
  8430. var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
  8431. n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],
  8432. o = this.getLocalGroups(),
  8433. r = JSON.parse(JSON.stringify(o));
  8434. n && this.emitInnerEvent(Wo, r), t && this.emitOuterEvent(e.GROUP_LIST_UPDATED, o);
  8435. }
  8436. }, {
  8437. key: "_handleReceivedGroupMessage",
  8438. value: function (e) {
  8439. var n = this,
  8440. o = e.data.eventDataList;
  8441. Array.isArray(o) && o.forEach(function (e) {
  8442. var o = e.conversationID.replace(t.CONV_GROUP, "");
  8443. n.groupMap.has(o) && (n.groupMap.get(o).nextMessageSeq = e.lastMessage.sequence + 1);
  8444. });
  8445. }
  8446. }, {
  8447. key: "_onReceivedGroupSystemNotice",
  8448. value: function (e) {
  8449. var t = e.data;
  8450. this.groupNoticeHandler._onReceivedGroupNotice(t);
  8451. }
  8452. }, {
  8453. key: "_handleUpdateGroupLastMessage",
  8454. value: function (e) {
  8455. var n = "".concat(Ss, "._handleUpdateGroupLastMessage"),
  8456. o = e.data;
  8457. if (de.log("".concat(n, " convNums=").concat(o.length, " groupNums=").concat(this.groupMap.size)), 0 !== this.groupMap.size) {
  8458. for (var r, i, s, a = !1, u = 0, c = o.length; u < c; u++) (r = o[u]).conversationID && r.type !== t.CONV_GROUP && (i = r.conversationID.split(/^GROUP/)[1], (s = this.getLocalGroupProfile(i)) && (s.lastMessage = r.lastMessage, a = !0));
  8459. a && (this.groupMap = this._sortLocalGroupList(this.groupMap), this.emitGroupListUpdate(!0, !1));
  8460. } else this.tempConversationList = o;
  8461. }
  8462. }, {
  8463. key: "_sortLocalGroupList",
  8464. value: function (e) {
  8465. var t = I(e).filter(function (e) {
  8466. var t = y(e, 2);
  8467. t[0];
  8468. return !Xe(t[1].lastMessage);
  8469. });
  8470. return t.sort(function (e, t) {
  8471. return t[1].lastMessage.lastTime - e[1].lastMessage.lastTime;
  8472. }), new Map([].concat(I(t), I(e)));
  8473. }
  8474. }, {
  8475. key: "_getStorageGroupList",
  8476. value: function () {
  8477. return this.tim.storage.getItem("groupMap");
  8478. }
  8479. }, {
  8480. key: "_setStorageGroupList",
  8481. value: function () {
  8482. var e = this.getLocalGroups().filter(function (e) {
  8483. var t = e.type;
  8484. return !Be(t);
  8485. }).slice(0, 20).map(function (e) {
  8486. return {
  8487. groupID: e.groupID,
  8488. name: e.name,
  8489. avatar: e.avatar,
  8490. type: e.type
  8491. };
  8492. });
  8493. this.tim.storage.setItem("groupMap", e);
  8494. }
  8495. }, {
  8496. key: "updateGroupMap",
  8497. value: function (e) {
  8498. var t = this;
  8499. e.forEach(function (e) {
  8500. t.groupMap.has(e.groupID) ? t.groupMap.get(e.groupID).updateGroup(e) : t.groupMap.set(e.groupID, new cs(e));
  8501. }), this._setStorageGroupList();
  8502. }
  8503. }, {
  8504. key: "_updateLocalGroupMemberMap",
  8505. value: function (e, t) {
  8506. var n = this;
  8507. return Ie(t) && 0 !== t.length ? t.map(function (t) {
  8508. return n.hasLocalGroupMember(e, t.userID) ? n.getLocalGroupMemberInfo(e, t.userID).updateMember(t) : n.setLocalGroupMember(e, new Ms(t)), n.getLocalGroupMemberInfo(e, t.userID);
  8509. }) : [];
  8510. }
  8511. }, {
  8512. key: "deleteLocalGroupMembers",
  8513. value: function (e, t) {
  8514. var n = this.groupMemberListMap.get(e);
  8515. n && t.forEach(function (e) {
  8516. n.delete(e);
  8517. });
  8518. }
  8519. }, {
  8520. key: "_modifyGroupMemberInfo",
  8521. value: function (e) {
  8522. var t = this,
  8523. n = e.groupID,
  8524. o = e.userID;
  8525. return this.request({
  8526. name: "group",
  8527. action: "modifyGroupMemberInfo",
  8528. param: e
  8529. }).then(function () {
  8530. if (t.hasLocalGroupMember(n, o)) {
  8531. var r = t.getLocalGroupMemberInfo(n, o);
  8532. return Me(e.muteTime) || r.updateMuteUntil(e.muteTime), Me(e.role) || r.updateRole(e.role), Me(e.nameCard) || r.updateNameCard(e.nameCard), Me(e.memberCustomField) || r.updateMemberCustomField(e.memberCustomField), r;
  8533. }
  8534. return t.getGroupMemberProfile({
  8535. groupID: n,
  8536. userIDList: [o]
  8537. }).then(function (e) {
  8538. return y(e.data.memberList, 1)[0];
  8539. });
  8540. });
  8541. }
  8542. }, {
  8543. key: "_groupListTreeShaking",
  8544. value: function (e) {
  8545. for (var t = new Map(I(this.groupMap)), n = 0, o = e.length; n < o; n++) t.delete(e[n].groupID);
  8546. this.AVChatRoomHandler.hasJoinedAVChatRoom() && this.AVChatRoomHandler.getJoinedAVChatRoom().forEach(function (e) {
  8547. t.delete(e);
  8548. });
  8549. for (var r = I(t.keys()), i = 0, s = r.length; i < s; i++) this.groupMap.delete(r[i]);
  8550. }
  8551. }, {
  8552. key: "_handleProfileUpdated",
  8553. value: function (e) {
  8554. for (var t = this, n = e.data, o = function (e) {
  8555. var o = n[e];
  8556. t.groupMemberListMap.forEach(function (e) {
  8557. e.has(o.userID) && e.get(o.userID).updateMember({
  8558. nick: o.nick,
  8559. avatar: o.avatar
  8560. });
  8561. });
  8562. }, r = 0; r < n.length; r++) o(r);
  8563. }
  8564. }, {
  8565. key: "getJoinedAVChatRoom",
  8566. value: function () {
  8567. return this.AVChatRoomHandler.getJoinedAVChatRoom();
  8568. }
  8569. }, {
  8570. key: "deleteLocalGroupAndConversation",
  8571. value: function (e) {
  8572. this._deleteLocalGroup(e), this.tim.conversationController.deleteLocalConversation("GROUP".concat(e)), this.emitGroupListUpdate(!0, !1);
  8573. }
  8574. }, {
  8575. key: "checkJoinedAVChatRoomByID",
  8576. value: function (e) {
  8577. return this.AVChatRoomHandler.checkJoinedAVChatRoomByID(e);
  8578. }
  8579. }, {
  8580. key: "getGroupLastSequence",
  8581. value: function (e) {
  8582. var t = this,
  8583. n = "".concat(Ss, ".getGroupLastSequence"),
  8584. o = new qr(Mi),
  8585. r = 0;
  8586. if (this.hasLocalGroup(e)) {
  8587. var i = this.getLocalGroupProfile(e);
  8588. if (i.lastMessage.lastSequence > 0) return r = i.lastMessage.lastSequence, de.log("".concat(n, " got lastSequence=").concat(r, " from local group profile[lastMessage.lastSequence]. groupID=").concat(e)), o.setNetworkType(this.getNetworkType()).setText("got lastSequence=".concat(r, " from local group profile[lastMessage.lastSequence]. groupID=").concat(e)).setEnd(), Promise.resolve(r);
  8589. if (i.nextMessageSeq > 1) return r = i.nextMessageSeq - 1, de.log("".concat(n, " got lastSequence=").concat(r, " from local group profile[nextMessageSeq]. groupID=").concat(e)), o.setNetworkType(this.getNetworkType()).setText("got lastSequence=".concat(r, " from local group profile[nextMessageSeq]. groupID=").concat(e)).setEnd(), Promise.resolve(r);
  8590. }
  8591. var s = "GROUP".concat(e),
  8592. a = this.tim.conversationController.getLocalConversation(s);
  8593. if (a && a.lastMessage.lastSequence) return r = a.lastMessage.lastSequence, de.log("".concat(n, " got lastSequence=").concat(r, " from local conversation profile[lastMessage.lastSequence]. groupID=").concat(e)), o.setNetworkType(this.getNetworkType()).setText("got lastSequence=".concat(r, " from local conversation profile[lastMessage.lastSequence]. groupID=").concat(e)).setEnd(), Promise.resolve(r);
  8594. var u = {
  8595. groupIDList: [e],
  8596. responseFilter: {
  8597. groupBaseInfoFilter: ["NextMsgSeq"]
  8598. }
  8599. };
  8600. return this.getGroupProfileAdvance(u).then(function (i) {
  8601. var s = i.data.successGroupList;
  8602. return Xe(s) ? de.log("".concat(n, " successGroupList is empty. groupID=").concat(e)) : (r = s[0].nextMessageSeq - 1, de.log("".concat(n, " got lastSequence=").concat(r, " from getGroupProfileAdvance. groupID=").concat(e))), o.setNetworkType(t.getNetworkType()).setText("got lastSequence=".concat(r, " from getGroupProfileAdvance. groupID=").concat(e)).setEnd(), r;
  8603. }).catch(function (r) {
  8604. return t.probeNetwork().then(function (t) {
  8605. var n = y(t, 2),
  8606. i = n[0],
  8607. s = n[1];
  8608. o.setError(r, i, s).setText("get lastSequence failed from getGroupProfileAdvance. groupID=".concat(e)).setEnd();
  8609. }), de.warn("".concat(n, " failed. ").concat(r)), Cr(r);
  8610. });
  8611. }
  8612. }, {
  8613. key: "getGroupOnlineMemberCount",
  8614. value: function (e) {
  8615. return this.AVChatRoomHandler.checkJoinedAVChatRoomByID(e) ? this.AVChatRoomHandler.getGroupOnlineMemberCount(e) : Mr({
  8616. memberCount: 0
  8617. });
  8618. }
  8619. }, {
  8620. key: "reset",
  8621. value: function () {
  8622. this.groupMap.clear(), this.groupMemberListMap.clear(), this.resetReady(), this.groupNoticeHandler.reset(), this.AVChatRoomHandler.reset(), this.tim.innerEmitter.once(Mo, this._initGroupList, this);
  8623. }
  8624. }]), s;
  8625. }(mr),
  8626. As = function (n) {
  8627. c(s, n);
  8628. var r = v(s);
  8629. function s(e) {
  8630. var n;
  8631. o(this, s), (n = r.call(this, e)).REALTIME_MESSAGE_TIMEOUT = 3e5, n.LONGPOLLING_ID_TIMEOUT = 3e5, n._currentState = t.NET_STATE_CONNECTED, n._status = {
  8632. OPENIM: {
  8633. lastResponseReceivedTime: 0,
  8634. jitterCount: 0,
  8635. failedCount: 0
  8636. },
  8637. AVCHATROOM: {
  8638. lastResponseReceivedTime: 0,
  8639. jitterCount: 0,
  8640. failedCount: 0
  8641. }
  8642. };
  8643. var i = n.tim.innerEmitter;
  8644. return i.on(Lo, n._onGetLongPollIDFailed, f(n)), i.on(Po, n._onOpenIMResponseOK, f(n)), i.on(wo, n._onOpenIMRequestFailed, f(n)), i.on(zo, n._onAVChatroomResponseOK, f(n)), i.on(Yo, n._onAVChatroomRequestFailed, f(n)), n;
  8645. }
  8646. return i(s, [{
  8647. key: "_onGetLongPollIDFailed",
  8648. value: function () {
  8649. this._currentState !== t.NET_STATE_DISCONNECTED && this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED);
  8650. }
  8651. }, {
  8652. key: "_onOpenIMResponseOK",
  8653. value: function () {
  8654. this._onResponseOK("OPENIM");
  8655. }
  8656. }, {
  8657. key: "_onOpenIMRequestFailed",
  8658. value: function () {
  8659. this._onRequestFailed("OPENIM");
  8660. }
  8661. }, {
  8662. key: "_onAVChatroomResponseOK",
  8663. value: function () {
  8664. this.isLoggedIn() || this._onResponseOK("AVCHATROOM");
  8665. }
  8666. }, {
  8667. key: "_onAVChatroomRequestFailed",
  8668. value: function () {
  8669. this.isLoggedIn() || this._onRequestFailed("AVCHATROOM");
  8670. }
  8671. }, {
  8672. key: "_onResponseOK",
  8673. value: function (e) {
  8674. var n = this._status[e],
  8675. o = Date.now();
  8676. if (0 !== n.lastResponseReceivedTime) {
  8677. var r = o - n.lastResponseReceivedTime;
  8678. de.debug("StatusController._onResponseOK key=".concat(e, " currentState=").concat(this._currentState, " interval=").concat(r, " failedCount=").concat(n.failedCount, " jitterCount=").concat(n.jitterCount)), n.failedCount > 0 && (n.failedCount = 0, n.jitterCount += 1, this._currentState !== t.NET_STATE_CONNECTED && this._emitNetStateChangeEvent(t.NET_STATE_CONNECTED));
  8679. r <= this.LONGPOLLING_ID_TIMEOUT ? n.jitterCount >= 3 && (new qr(wi).setText("".concat(e, "-").concat(r, "-").concat(n.jitterCount)).setNetworkType(this.getNetworkType()).setEnd(), n.jitterCount = 0) : (new qr(Pi).setText("".concat(e, "-").concat(r)).setNetworkType(this.getNetworkType()).setEnd(), de.warn("StatusController._onResponseOK, sdk reload. key=".concat(e, " interval=").concat(r, "ms. https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/module-EVENT.html#.SDK_RELOAD")), this.emitInnerEvent(ur)), n.lastResponseReceivedTime = o;
  8680. } else n.lastResponseReceivedTime = o;
  8681. }
  8682. }, {
  8683. key: "_onRequestFailed",
  8684. value: function (e) {
  8685. var n = this,
  8686. o = this._status[e];
  8687. Date.now() - o.lastResponseReceivedTime >= this.LONGPOLLING_ID_TIMEOUT ? this._currentState !== t.NET_STATE_DISCONNECTED && (de.warn("StatusController._onRequestFailed, disconnected, longpolling unavailable more than 5min. key=".concat(e, " networkType=").concat(this.getNetworkType())), this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED)) : (o.failedCount += 1, o.failedCount > 5 ? this.probeNetwork().then(function (r) {
  8688. var i = y(r, 2),
  8689. s = i[0],
  8690. a = i[1];
  8691. s ? (n._currentState !== t.NET_STATE_CONNECTING && n._emitNetStateChangeEvent(t.NET_STATE_CONNECTING), de.warn("StatusController._onRequestFailed, connecting, network jitter. key=".concat(e, " networkType=").concat(a))) : (n._currentState !== t.NET_STATE_DISCONNECTED && n._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED), de.warn("StatusController._onRequestFailed, disconnected, longpolling unavailable. key=".concat(e, " networkType=").concat(a))), o.failedCount = 0, o.jitterCount = 0;
  8692. }) : this._currentState === t.NET_STATE_CONNECTED && this._emitNetStateChangeEvent(t.NET_STATE_CONNECTING));
  8693. }
  8694. }, {
  8695. key: "_emitNetStateChangeEvent",
  8696. value: function (t) {
  8697. de.log("StatusController._emitNetStateChangeEvent net state changed from ".concat(this._currentState, " to ").concat(t)), this._currentState = t, this.emitOuterEvent(e.NET_STATE_CHANGE, {
  8698. state: t
  8699. });
  8700. }
  8701. }, {
  8702. key: "reset",
  8703. value: function () {
  8704. de.log("StatusController.reset"), this._currentState = t.NET_STATE_CONNECTED, this._status = {
  8705. OPENIM: {
  8706. lastResponseReceivedTime: 0,
  8707. jitterCount: 0,
  8708. failedCount: 0
  8709. },
  8710. AVCHATROOM: {
  8711. lastResponseReceivedTime: 0,
  8712. jitterCount: 0,
  8713. failedCount: 0
  8714. }
  8715. };
  8716. }
  8717. }]), s;
  8718. }(mr);
  8719. function Os() {
  8720. return null;
  8721. }
  8722. var Rs = function () {
  8723. function e(t) {
  8724. o(this, e), this.tim = t, this.storageQueue = new Map(), this.checkTimes = 0, this.checkTimer = setInterval(this._onCheckTimer.bind(this), 1e3), this._errorTolerantHandle();
  8725. }
  8726. return i(e, [{
  8727. key: "_errorTolerantHandle",
  8728. value: function () {
  8729. !V && Me(window.localStorage) && (this.getItem = Os, this.setItem = Os, this.removeItem = Os, this.clear = Os);
  8730. }
  8731. }, {
  8732. key: "_onCheckTimer",
  8733. value: function () {
  8734. if (this.checkTimes++, this.checkTimes % 20 == 0) {
  8735. if (0 === this.storageQueue.size) return;
  8736. this._doFlush();
  8737. }
  8738. }
  8739. }, {
  8740. key: "_doFlush",
  8741. value: function () {
  8742. try {
  8743. var e,
  8744. t = S(this.storageQueue);
  8745. try {
  8746. for (t.s(); !(e = t.n()).done;) {
  8747. var n = y(e.value, 2),
  8748. o = n[0],
  8749. r = n[1];
  8750. this._setStorageSync(this._getKey(o), r);
  8751. }
  8752. } catch (i) {
  8753. t.e(i);
  8754. } finally {
  8755. t.f();
  8756. }
  8757. this.storageQueue.clear();
  8758. } catch (s) {
  8759. de.warn("Storage._doFlush error", s);
  8760. }
  8761. }
  8762. }, {
  8763. key: "_getPrefix",
  8764. value: function () {
  8765. var e = this.tim.loginInfo,
  8766. t = e.SDKAppID,
  8767. n = e.identifier;
  8768. return "TIM_".concat(t, "_").concat(n, "_");
  8769. }
  8770. }, {
  8771. key: "getItem",
  8772. value: function (e) {
  8773. var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
  8774. try {
  8775. var n = t ? this._getKey(e) : e;
  8776. return this._getStorageSync(n);
  8777. } catch (o) {
  8778. return de.warn("Storage.getItem error:", o), {};
  8779. }
  8780. }
  8781. }, {
  8782. key: "setItem",
  8783. value: function (e, t) {
  8784. var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
  8785. o = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3];
  8786. if (n) {
  8787. var r = o ? this._getKey(e) : e;
  8788. this._setStorageSync(r, t);
  8789. } else this.storageQueue.set(e, t);
  8790. }
  8791. }, {
  8792. key: "clear",
  8793. value: function () {
  8794. try {
  8795. V ? K.clearStorageSync() : localStorage.clear();
  8796. } catch (e) {
  8797. de.warn("Storage.clear error:", e);
  8798. }
  8799. }
  8800. }, {
  8801. key: "removeItem",
  8802. value: function (e) {
  8803. var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
  8804. try {
  8805. var n = t ? this._getKey(e) : e;
  8806. this._removeStorageSync(n);
  8807. } catch (o) {
  8808. de.warn("Storage.removeItem error:", o);
  8809. }
  8810. }
  8811. }, {
  8812. key: "getSize",
  8813. value: function (e) {
  8814. var t = this,
  8815. n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "b";
  8816. try {
  8817. var o = {
  8818. size: 0,
  8819. limitSize: 5242880,
  8820. unit: n
  8821. };
  8822. if (Object.defineProperty(o, "leftSize", {
  8823. enumerable: !0,
  8824. get: function () {
  8825. return o.limitSize - o.size;
  8826. }
  8827. }), V && (o.limitSize = 1024 * K.getStorageInfoSync().limitSize), e) o.size = JSON.stringify(this.getItem(e)).length + this._getKey(e).length;else if (V) {
  8828. var r = K.getStorageInfoSync(),
  8829. i = r.keys;
  8830. i.forEach(function (e) {
  8831. o.size += JSON.stringify(t._getStorageSync(e)).length + t._getKey(e).length;
  8832. });
  8833. } else for (var s in localStorage) localStorage.hasOwnProperty(s) && (o.size += localStorage.getItem(s).length + s.length);
  8834. return this._convertUnit(o);
  8835. } catch (a) {
  8836. de.warn("Storage.getSize error:", a);
  8837. }
  8838. }
  8839. }, {
  8840. key: "_convertUnit",
  8841. value: function (e) {
  8842. var t = {},
  8843. n = e.unit;
  8844. for (var o in t.unit = n, e) "number" == typeof e[o] && ("kb" === n.toLowerCase() ? t[o] = Math.round(e[o] / 1024) : "mb" === n.toLowerCase() ? t[o] = Math.round(e[o] / 1024 / 1024) : t[o] = e[o]);
  8845. return t;
  8846. }
  8847. }, {
  8848. key: "_getKey",
  8849. value: function (e) {
  8850. return "".concat(this._getPrefix()).concat(e);
  8851. }
  8852. }, {
  8853. key: "_setStorageSync",
  8854. value: function (e, t) {
  8855. V ? x ? my.setStorageSync({
  8856. key: e,
  8857. data: t
  8858. }) : K.setStorageSync(e, t) : localStorage.setItem(e, JSON.stringify(t));
  8859. }
  8860. }, {
  8861. key: "_getStorageSync",
  8862. value: function (e) {
  8863. return V ? x ? my.getStorageSync({
  8864. key: e
  8865. }).data : K.getStorageSync(e) : JSON.parse(localStorage.getItem(e));
  8866. }
  8867. }, {
  8868. key: "_removeStorageSync",
  8869. value: function (e) {
  8870. V ? x ? my.removeStorageSync({
  8871. key: e
  8872. }) : K.removeStorageSync(e) : localStorage.removeItem(e);
  8873. }
  8874. }, {
  8875. key: "reset",
  8876. value: function () {
  8877. this._doFlush(), this.checkTimes = 0;
  8878. }
  8879. }]), e;
  8880. }(),
  8881. Ns = O(function (e) {
  8882. var t = Object.prototype.hasOwnProperty,
  8883. n = "~";
  8884. function o() {}
  8885. function r(e, t, n) {
  8886. this.fn = e, this.context = t, this.once = n || !1;
  8887. }
  8888. function i(e, t, o, i, s) {
  8889. if ("function" != typeof o) throw new TypeError("The listener must be a function");
  8890. var a = new r(o, i || e, s),
  8891. u = n ? n + t : t;
  8892. return e._events[u] ? e._events[u].fn ? e._events[u] = [e._events[u], a] : e._events[u].push(a) : (e._events[u] = a, e._eventsCount++), e;
  8893. }
  8894. function s(e, t) {
  8895. 0 == --e._eventsCount ? e._events = new o() : delete e._events[t];
  8896. }
  8897. function a() {
  8898. this._events = new o(), this._eventsCount = 0;
  8899. }
  8900. Object.create && (o.prototype = Object.create(null), new o().__proto__ || (n = !1)), a.prototype.eventNames = function () {
  8901. var e,
  8902. o,
  8903. r = [];
  8904. if (0 === this._eventsCount) return r;
  8905. for (o in e = this._events) t.call(e, o) && r.push(n ? o.slice(1) : o);
  8906. return Object.getOwnPropertySymbols ? r.concat(Object.getOwnPropertySymbols(e)) : r;
  8907. }, a.prototype.listeners = function (e) {
  8908. var t = n ? n + e : e,
  8909. o = this._events[t];
  8910. if (!o) return [];
  8911. if (o.fn) return [o.fn];
  8912. for (var r = 0, i = o.length, s = new Array(i); r < i; r++) s[r] = o[r].fn;
  8913. return s;
  8914. }, a.prototype.listenerCount = function (e) {
  8915. var t = n ? n + e : e,
  8916. o = this._events[t];
  8917. return o ? o.fn ? 1 : o.length : 0;
  8918. }, a.prototype.emit = function (e, t, o, r, i, s) {
  8919. var a = n ? n + e : e;
  8920. if (!this._events[a]) return !1;
  8921. var u,
  8922. c,
  8923. l = this._events[a],
  8924. p = arguments.length;
  8925. if (l.fn) {
  8926. switch (l.once && this.removeListener(e, l.fn, void 0, !0), p) {
  8927. case 1:
  8928. return l.fn.call(l.context), !0;
  8929. case 2:
  8930. return l.fn.call(l.context, t), !0;
  8931. case 3:
  8932. return l.fn.call(l.context, t, o), !0;
  8933. case 4:
  8934. return l.fn.call(l.context, t, o, r), !0;
  8935. case 5:
  8936. return l.fn.call(l.context, t, o, r, i), !0;
  8937. case 6:
  8938. return l.fn.call(l.context, t, o, r, i, s), !0;
  8939. }
  8940. for (c = 1, u = new Array(p - 1); c < p; c++) u[c - 1] = arguments[c];
  8941. l.fn.apply(l.context, u);
  8942. } else {
  8943. var g,
  8944. h = l.length;
  8945. for (c = 0; c < h; c++) switch (l[c].once && this.removeListener(e, l[c].fn, void 0, !0), p) {
  8946. case 1:
  8947. l[c].fn.call(l[c].context);
  8948. break;
  8949. case 2:
  8950. l[c].fn.call(l[c].context, t);
  8951. break;
  8952. case 3:
  8953. l[c].fn.call(l[c].context, t, o);
  8954. break;
  8955. case 4:
  8956. l[c].fn.call(l[c].context, t, o, r);
  8957. break;
  8958. default:
  8959. if (!u) for (g = 1, u = new Array(p - 1); g < p; g++) u[g - 1] = arguments[g];
  8960. l[c].fn.apply(l[c].context, u);
  8961. }
  8962. }
  8963. return !0;
  8964. }, a.prototype.on = function (e, t, n) {
  8965. return i(this, e, t, n, !1);
  8966. }, a.prototype.once = function (e, t, n) {
  8967. return i(this, e, t, n, !0);
  8968. }, a.prototype.removeListener = function (e, t, o, r) {
  8969. var i = n ? n + e : e;
  8970. if (!this._events[i]) return this;
  8971. if (!t) return s(this, i), this;
  8972. var a = this._events[i];
  8973. if (a.fn) a.fn !== t || r && !a.once || o && a.context !== o || s(this, i);else {
  8974. for (var u = 0, c = [], l = a.length; u < l; u++) (a[u].fn !== t || r && !a[u].once || o && a[u].context !== o) && c.push(a[u]);
  8975. c.length ? this._events[i] = 1 === c.length ? c[0] : c : s(this, i);
  8976. }
  8977. return this;
  8978. }, a.prototype.removeAllListeners = function (e) {
  8979. var t;
  8980. return e ? (t = n ? n + e : e, this._events[t] && s(this, t)) : (this._events = new o(), this._eventsCount = 0), this;
  8981. }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = n, a.EventEmitter = a, e.exports = a;
  8982. });
  8983. function Ls(e) {
  8984. var t = e.context || null;
  8985. return {
  8986. platform: co,
  8987. websdkappid: uo,
  8988. v: ao,
  8989. a2: t && t.a2Key || void 0,
  8990. tinyid: t && t.tinyID || void 0,
  8991. sdkappid: t && t.SDKAppID || 0,
  8992. contentType: t && t.contentType || 0,
  8993. apn: t && t.apn || 1,
  8994. accounttype: t && t.accountType || 0
  8995. };
  8996. }
  8997. var ws = function () {
  8998. function e(t) {
  8999. o(this, e), this.tim = t, this.tim.innerEmitter.on(yo, this._update, this), this.tim.innerEmitter.on(Io, this._update, this), this.tim.innerEmitter.on(Co, this._updateSpecifiedConfig, this), this._initConfig();
  9000. }
  9001. return i(e, [{
  9002. key: "_update",
  9003. value: function (e) {
  9004. this._initConfig();
  9005. }
  9006. }, {
  9007. key: "_updateSpecifiedConfig",
  9008. value: function (e) {
  9009. var t = this;
  9010. e.data.forEach(function (e) {
  9011. t._set(e);
  9012. });
  9013. }
  9014. }, {
  9015. key: "get",
  9016. value: function (e) {
  9017. var t = e.name,
  9018. o = e.action,
  9019. r = e.param,
  9020. i = e.tjgID;
  9021. if (Me(this.config[t]) || Me(this.config[t][o])) throw new Ut({
  9022. code: qt.NETWORK_PACKAGE_UNDEFINED,
  9023. message: "".concat(qn, ": PackageConfig.").concat(t)
  9024. });
  9025. var s = function e(t) {
  9026. if (0 === Object.getOwnPropertyNames(t).length) return Object.create(null);
  9027. var o = Array.isArray(t) ? [] : Object.create(null),
  9028. r = "";
  9029. for (var i in t) null !== t[i] ? void 0 !== t[i] ? (r = n(t[i]), ["string", "number", "function", "boolean"].indexOf(r) >= 0 ? o[i] = t[i] : o[i] = e(t[i])) : o[i] = void 0 : o[i] = null;
  9030. return o;
  9031. }(this.config[t][o]);
  9032. return s.requestData = this._initRequestData(r, s), s.encode = this._initEncoder(s), s.decode = this._initDecoder(s), i && (s.queryString.tjg_id = i), s;
  9033. }
  9034. }, {
  9035. key: "_set",
  9036. value: function (e) {
  9037. var t = e.key,
  9038. o = e.value;
  9039. if (!1 != !!t) {
  9040. var r = t.split(".");
  9041. if (!(r.length <= 0)) {
  9042. !function e(t, o, r, i) {
  9043. var s = o[r];
  9044. "object" === n(t[s]) ? e(t[s], o, r + 1, i) : t[s] = i;
  9045. }(this.config, r, 0, o);
  9046. }
  9047. }
  9048. }
  9049. }, {
  9050. key: "_initConfig",
  9051. value: function () {
  9052. var e;
  9053. this.config = {}, this.config.accessLayer = (e = this.tim, {
  9054. create: null,
  9055. query: {
  9056. serverName: _o.NAME.WEB_IM,
  9057. cmd: _o.CMD.ACCESS_LAYER,
  9058. channel: _o.CHANNEL.XHR,
  9059. protocol: po,
  9060. method: "POST",
  9061. queryString: u(u({}, Ls(e)), {}, {
  9062. identifier: e.context.identifier,
  9063. usersig: e.context.userSig
  9064. }),
  9065. requestData: {}
  9066. },
  9067. update: null,
  9068. delete: null
  9069. }), this.config.login = function (e) {
  9070. return {
  9071. create: null,
  9072. query: {
  9073. serverName: _o.NAME.OPEN_IM,
  9074. cmd: _o.CMD.LOGIN,
  9075. channel: _o.CHANNEL.XHR,
  9076. protocol: po,
  9077. method: "POST",
  9078. queryString: u(u({}, Ls(e)), {}, {
  9079. identifier: e.loginInfo.identifier,
  9080. usersig: e.loginInfo.userSig,
  9081. sdkappid: e.loginInfo.SDKAppID,
  9082. accounttype: e.loginInfo.accountType,
  9083. reqtime: +new Date() / 1e3
  9084. }),
  9085. requestData: {
  9086. state: "Online"
  9087. },
  9088. keyMaps: {
  9089. request: {
  9090. tinyID: "tinyId"
  9091. },
  9092. response: {
  9093. TinyId: "tinyID"
  9094. }
  9095. }
  9096. },
  9097. update: null,
  9098. delete: null
  9099. };
  9100. }(this.tim), this.config.logout = function (e) {
  9101. return {
  9102. create: null,
  9103. query: {
  9104. serverName: _o.NAME.OPEN_IM,
  9105. cmd: _o.CMD.LOGOUT_ALL,
  9106. channel: _o.CHANNEL.XHR,
  9107. protocol: po,
  9108. method: "POST",
  9109. queryString: u(u({}, Ls(e)), {}, {
  9110. reqtime: +new Date() / 1e3
  9111. }),
  9112. requestData: {}
  9113. },
  9114. update: null,
  9115. delete: null
  9116. };
  9117. }(this.tim), this.config.longPollLogout = function (e) {
  9118. return {
  9119. create: null,
  9120. query: {
  9121. serverName: _o.NAME.OPEN_IM,
  9122. cmd: _o.CMD.LOGOUT_LONG_POLL,
  9123. channel: _o.CHANNEL.XHR,
  9124. protocol: po,
  9125. method: "POST",
  9126. queryString: u(u({}, Ls(e)), {}, {
  9127. reqtime: +new Date()
  9128. }),
  9129. requestData: {
  9130. longPollID: ""
  9131. },
  9132. keyMaps: {
  9133. request: {
  9134. longPollID: "LongPollingId"
  9135. }
  9136. }
  9137. },
  9138. update: null,
  9139. delete: null
  9140. };
  9141. }(this.tim), this.config.profile = function (e) {
  9142. var t = Ls(e),
  9143. n = {
  9144. serverName: _o.NAME.PROFILE,
  9145. channel: _o.CHANNEL.XHR,
  9146. protocol: po,
  9147. method: "POST",
  9148. queryString: t
  9149. };
  9150. return {
  9151. query: u(u({}, n), {}, {
  9152. cmd: _o.CMD.PORTRAIT_GET,
  9153. requestData: {
  9154. fromAccount: "",
  9155. userItem: []
  9156. },
  9157. keyMaps: {
  9158. request: {
  9159. toAccount: "To_Account",
  9160. standardSequence: "StandardSequence",
  9161. customSequence: "CustomSequence"
  9162. }
  9163. }
  9164. }),
  9165. update: u(u({}, n), {}, {
  9166. cmd: _o.CMD.PORTRAIT_SET,
  9167. requestData: {
  9168. fromAccount: "",
  9169. profileItem: [{
  9170. tag: Ct.NICK,
  9171. value: ""
  9172. }, {
  9173. tag: Ct.GENDER,
  9174. value: ""
  9175. }, {
  9176. tag: Ct.ALLOWTYPE,
  9177. value: ""
  9178. }, {
  9179. tag: Ct.AVATAR,
  9180. value: ""
  9181. }]
  9182. }
  9183. })
  9184. };
  9185. }(this.tim), this.config.group = function (e) {
  9186. var n = _o.NAME.GROUP,
  9187. o = Ls(e);
  9188. if (e.context.login !== ot.IS_LOGIN || !e.context.a2Key) {
  9189. n = _o.NAME.BIG_GROUP_NO_AUTH;
  9190. var r = Ls(e);
  9191. r.a2, r.tinyid;
  9192. o = m(r, ["a2", "tinyid"]);
  9193. }
  9194. var i = {
  9195. request: {
  9196. ownerID: "Owner_Account",
  9197. userID: "Member_Account",
  9198. newOwnerID: "NewOwner_Account",
  9199. maxMemberNum: "MaxMemberCount",
  9200. groupCustomField: "AppDefinedData",
  9201. memberCustomField: "AppMemberDefinedData",
  9202. groupCustomFieldFilter: "AppDefinedDataFilter_Group",
  9203. memberCustomFieldFilter: "AppDefinedDataFilter_GroupMember",
  9204. messageRemindType: "MsgFlag",
  9205. userIDList: "MemberList",
  9206. groupIDList: "GroupIdList",
  9207. applyMessage: "ApplyMsg",
  9208. muteTime: "ShutUpTime",
  9209. muteAllMembers: "ShutUpAllMember",
  9210. joinOption: "ApplyJoinOption"
  9211. },
  9212. response: {
  9213. GroupIdList: "groups",
  9214. MsgFlag: "messageRemindType",
  9215. AppDefinedData: "groupCustomField",
  9216. AppMemberDefinedData: "memberCustomField",
  9217. AppDefinedDataFilter_Group: "groupCustomFieldFilter",
  9218. AppDefinedDataFilter_GroupMember: "memberCustomFieldFilter",
  9219. InfoSeq: "infoSequence",
  9220. MemberList: "members",
  9221. GroupInfo: "groups",
  9222. ShutUpUntil: "muteUntil",
  9223. ShutUpAllMember: "muteAllMembers",
  9224. ApplyJoinOption: "joinOption"
  9225. }
  9226. },
  9227. s = {
  9228. serverName: _o.NAME.GROUP,
  9229. channel: _o.CHANNEL.XHR,
  9230. protocol: po,
  9231. queryString: o
  9232. };
  9233. return {
  9234. create: u(u({}, s), {}, {
  9235. cmd: _o.CMD.CREATE_GROUP,
  9236. requestData: {
  9237. type: t.GRP_WORK,
  9238. name: void 0,
  9239. groupID: void 0,
  9240. ownerID: e.loginInfo.identifier,
  9241. introduction: void 0,
  9242. notification: void 0,
  9243. avatar: void 0,
  9244. maxMemberNum: void 0,
  9245. joinOption: void 0,
  9246. memberList: void 0,
  9247. groupCustomField: void 0
  9248. },
  9249. keyMaps: i
  9250. }),
  9251. list: u(u({}, s), {}, {
  9252. cmd: _o.CMD.GET_JOINED_GROUPS,
  9253. requestData: {
  9254. userID: e.loginInfo.identifier,
  9255. limit: void 0,
  9256. offset: void 0,
  9257. groupType: void 0,
  9258. responseFilter: void 0
  9259. },
  9260. keyMaps: i
  9261. }),
  9262. query: u(u({}, s), {}, {
  9263. cmd: _o.CMD.GET_GROUP_INFO,
  9264. requestData: {
  9265. groupIDList: void 0,
  9266. responseFilter: void 0
  9267. },
  9268. keyMaps: i
  9269. }),
  9270. getGroupMemberProfile: u(u({}, s), {}, {
  9271. cmd: _o.CMD.GET_GROUP_MEMBER_INFO,
  9272. requestData: {
  9273. groupID: void 0,
  9274. userIDList: void 0,
  9275. memberInfoFilter: void 0,
  9276. memberCustomFieldFilter: void 0
  9277. },
  9278. keyMaps: {
  9279. request: u(u({}, i.request), {}, {
  9280. userIDList: "Member_List_Account"
  9281. }),
  9282. response: i.response
  9283. }
  9284. }),
  9285. getGroupMemberList: u(u({}, s), {}, {
  9286. cmd: _o.CMD.GET_GROUP_MEMBER_LIST,
  9287. requestData: {
  9288. groupID: void 0,
  9289. limit: 0,
  9290. offset: 0,
  9291. memberRoleFilter: void 0,
  9292. memberInfoFilter: void 0
  9293. },
  9294. keyMaps: i
  9295. }),
  9296. quitGroup: u(u({}, s), {}, {
  9297. cmd: _o.CMD.QUIT_GROUP,
  9298. requestData: {
  9299. groupID: void 0
  9300. }
  9301. }),
  9302. changeGroupOwner: u(u({}, s), {}, {
  9303. cmd: _o.CMD.CHANGE_GROUP_OWNER,
  9304. queryString: o,
  9305. requestData: {
  9306. groupID: void 0,
  9307. newOwnerID: void 0
  9308. },
  9309. keyMaps: i
  9310. }),
  9311. destroyGroup: u(u({}, s), {}, {
  9312. cmd: _o.CMD.DESTROY_GROUP,
  9313. requestData: {
  9314. groupID: void 0
  9315. }
  9316. }),
  9317. updateGroupProfile: u(u({}, s), {}, {
  9318. cmd: _o.CMD.MODIFY_GROUP_INFO,
  9319. requestData: {
  9320. groupID: void 0,
  9321. name: void 0,
  9322. introduction: void 0,
  9323. notification: void 0,
  9324. avatar: void 0,
  9325. maxMemberNum: void 0,
  9326. joinOption: void 0,
  9327. groupCustomField: void 0,
  9328. muteAllMembers: void 0
  9329. },
  9330. keyMaps: {
  9331. request: u(u({}, i.request), {}, {
  9332. groupCustomField: "AppDefinedData"
  9333. }),
  9334. response: i.response
  9335. }
  9336. }),
  9337. modifyGroupMemberInfo: u(u({}, s), {}, {
  9338. cmd: _o.CMD.MODIFY_GROUP_MEMBER_INFO,
  9339. requestData: {
  9340. groupID: void 0,
  9341. userID: void 0,
  9342. messageRemindType: void 0,
  9343. nameCard: void 0,
  9344. role: void 0,
  9345. memberCustomField: void 0,
  9346. muteTime: void 0
  9347. },
  9348. keyMaps: i
  9349. }),
  9350. addGroupMember: u(u({}, s), {}, {
  9351. cmd: _o.CMD.ADD_GROUP_MEMBER,
  9352. requestData: {
  9353. groupID: void 0,
  9354. silence: void 0,
  9355. userIDList: void 0
  9356. },
  9357. keyMaps: i
  9358. }),
  9359. deleteGroupMember: u(u({}, s), {}, {
  9360. cmd: _o.CMD.DELETE_GROUP_MEMBER,
  9361. requestData: {
  9362. groupID: void 0,
  9363. userIDList: void 0,
  9364. reason: void 0
  9365. },
  9366. keyMaps: {
  9367. request: {
  9368. userIDList: "MemberToDel_Account"
  9369. }
  9370. }
  9371. }),
  9372. searchGroupByID: u(u({}, s), {}, {
  9373. cmd: _o.CMD.SEARCH_GROUP_BY_ID,
  9374. requestData: {
  9375. groupIDList: void 0,
  9376. responseFilter: {
  9377. groupBasePublicInfoFilter: ["Type", "Name", "Introduction", "Notification", "FaceUrl", "CreateTime", "Owner_Account", "LastInfoTime", "LastMsgTime", "NextMsgSeq", "MemberNum", "MaxMemberNum", "ApplyJoinOption"]
  9378. }
  9379. },
  9380. keyMaps: {
  9381. request: {
  9382. groupIDList: "GroupIdList"
  9383. }
  9384. }
  9385. }),
  9386. applyJoinGroup: u(u({}, s), {}, {
  9387. cmd: _o.CMD.APPLY_JOIN_GROUP,
  9388. requestData: {
  9389. groupID: void 0,
  9390. applyMessage: void 0,
  9391. userDefinedField: void 0
  9392. },
  9393. keyMaps: i
  9394. }),
  9395. applyJoinAVChatRoom: u(u({}, s), {}, {
  9396. serverName: _o.NAME.BIG_GROUP_NO_AUTH,
  9397. cmd: _o.CMD.APPLY_JOIN_GROUP,
  9398. requestData: {
  9399. groupID: void 0,
  9400. applyMessage: void 0,
  9401. userDefinedField: void 0
  9402. },
  9403. keyMaps: i
  9404. }),
  9405. handleApplyJoinGroup: u(u({}, s), {}, {
  9406. cmd: _o.CMD.HANDLE_APPLY_JOIN_GROUP,
  9407. requestData: {
  9408. groupID: void 0,
  9409. applicant: void 0,
  9410. handleAction: void 0,
  9411. handleMessage: void 0,
  9412. authentication: void 0,
  9413. messageKey: void 0,
  9414. userDefinedField: void 0
  9415. },
  9416. keyMaps: {
  9417. request: {
  9418. applicant: "Applicant_Account",
  9419. handleAction: "HandleMsg",
  9420. handleMessage: "ApprovalMsg",
  9421. messageKey: "MsgKey"
  9422. },
  9423. response: {
  9424. MsgKey: "messageKey"
  9425. }
  9426. }
  9427. }),
  9428. deleteGroupSystemNotice: u(u({}, s), {}, {
  9429. serverName: _o.NAME.OPEN_IM,
  9430. cmd: _o.CMD.DELETE_GROUP_SYSTEM_MESSAGE,
  9431. requestData: {
  9432. messageListToDelete: void 0
  9433. },
  9434. keyMaps: {
  9435. request: {
  9436. messageListToDelete: "DelMsgList",
  9437. messageSeq: "MsgSeq",
  9438. messageRandom: "MsgRandom"
  9439. }
  9440. }
  9441. }),
  9442. getGroupPendency: u(u({}, s), {}, {
  9443. cmd: _o.CMD.GET_GROUP_PENDENCY,
  9444. requestData: {
  9445. startTime: void 0,
  9446. limit: void 0,
  9447. handleAccount: void 0
  9448. },
  9449. keyMaps: {
  9450. request: {
  9451. handleAccount: "Handle_Account"
  9452. }
  9453. }
  9454. }),
  9455. getOnlineMemberNum: {
  9456. serverName: n,
  9457. cmd: _o.CMD.GET_ONLINE_MEMBER_NUM,
  9458. channel: _o.CHANNEL.XHR,
  9459. protocol: po,
  9460. queryString: o,
  9461. requestData: {
  9462. groupID: void 0
  9463. }
  9464. }
  9465. };
  9466. }(this.tim), this.config.longPollID = function (e) {
  9467. return {
  9468. create: {},
  9469. query: {
  9470. serverName: _o.NAME.OPEN_IM,
  9471. cmd: _o.CMD.GET_LONG_POLL_ID,
  9472. channel: _o.CHANNEL.XHR,
  9473. protocol: po,
  9474. queryString: u(u({}, Ls(e)), {}, {
  9475. instanceid: e.context.instanceID,
  9476. reqtime: +new Date() / 1e3
  9477. }),
  9478. requestData: {},
  9479. keyMaps: {
  9480. response: {
  9481. LongPollingId: "longPollingID"
  9482. }
  9483. }
  9484. },
  9485. update: {},
  9486. delete: {}
  9487. };
  9488. }(this.tim), this.config.longPoll = function (e) {
  9489. var t = u(u({}, Ls(e)), {}, {
  9490. instanceid: e.context.instanceID,
  9491. reqtime: Math.ceil(+new Date() / 1e3)
  9492. });
  9493. return {
  9494. create: {},
  9495. query: {
  9496. serverName: _o.NAME.OPEN_IM,
  9497. cmd: _o.CMD.LONG_POLL,
  9498. channel: _o.CHANNEL.AUTO,
  9499. protocol: po,
  9500. queryString: t,
  9501. requestData: {
  9502. timeout: null,
  9503. cookie: {
  9504. notifySeq: 0,
  9505. noticeSeq: 0,
  9506. longPollingID: 0
  9507. }
  9508. },
  9509. keyMaps: {
  9510. response: {
  9511. C2cMsgArray: "C2CMessageArray",
  9512. GroupMsgArray: "groupMessageArray",
  9513. GroupTips: "groupTips",
  9514. C2cNotifyMsgArray: "C2CNotifyMessageArray",
  9515. ClientSeq: "clientSequence",
  9516. MsgPriority: "priority",
  9517. NoticeSeq: "noticeSequence",
  9518. MsgContent: "content",
  9519. MsgType: "type",
  9520. MsgBody: "elements",
  9521. ToGroupId: "to",
  9522. Desc: "description",
  9523. Ext: "extension"
  9524. }
  9525. }
  9526. },
  9527. update: {},
  9528. delete: {}
  9529. };
  9530. }(this.tim), this.config.applyC2C = function (e) {
  9531. var t = Ls(e),
  9532. n = {
  9533. serverName: _o.NAME.FRIEND,
  9534. channel: _o.CHANNEL.XHR,
  9535. protocol: po,
  9536. queryString: t
  9537. };
  9538. return {
  9539. create: u(u({}, n), {}, {
  9540. cmd: _o.CMD.FRIEND_ADD,
  9541. requestData: {
  9542. fromAccount: "",
  9543. addFriendItem: []
  9544. }
  9545. }),
  9546. get: u(u({}, n), {}, {
  9547. cmd: _o.CMD.GET_PENDENCY,
  9548. requestData: {
  9549. fromAccount: "",
  9550. pendencyType: "Pendency_Type_ComeIn"
  9551. }
  9552. }),
  9553. update: u(u({}, n), {}, {
  9554. cmd: _o.CMD.RESPONSE_PENDENCY,
  9555. requestData: {
  9556. fromAccount: "",
  9557. responseFriendItem: []
  9558. }
  9559. }),
  9560. delete: u(u({}, n), {}, {
  9561. cmd: _o.CMD.DELETE_PENDENCY,
  9562. requestData: {
  9563. fromAccount: "",
  9564. toAccount: [],
  9565. pendencyType: "Pendency_Type_ComeIn"
  9566. }
  9567. })
  9568. };
  9569. }(this.tim), this.config.friend = function (e) {
  9570. var t = u(u({}, Ls(e)), {}, {
  9571. reqtime: function () {
  9572. return +new Date();
  9573. }
  9574. }),
  9575. n = {
  9576. serverName: _o.NAME.FRIEND,
  9577. channel: _o.CHANNEL.XHR,
  9578. protocol: po,
  9579. method: "POST",
  9580. queryString: t
  9581. };
  9582. return {
  9583. get: u(u({}, n), {}, {
  9584. cmd: _o.CMD.FRIEND_GET_ALL,
  9585. requestData: {
  9586. fromAccount: "",
  9587. timeStamp: 0,
  9588. tagList: [Ct.NICK, "Tag_SNS_IM_Remark", Ct.AVATAR]
  9589. },
  9590. keyMaps: {
  9591. request: {},
  9592. response: {}
  9593. }
  9594. }),
  9595. delete: u(u({}, n), {}, {
  9596. cmd: _o.CMD.FRIEND_DELETE,
  9597. requestData: {
  9598. fromAccount: "",
  9599. toAccount: [],
  9600. deleteType: "Delete_Type_Single"
  9601. }
  9602. })
  9603. };
  9604. }(this.tim), this.config.blacklist = function (e) {
  9605. var t = Ls(e),
  9606. n = {
  9607. serverName: _o.NAME.FRIEND,
  9608. channel: _o.CHANNEL.XHR,
  9609. protocol: po,
  9610. method: "POST",
  9611. queryString: t
  9612. };
  9613. return {
  9614. create: u(u({}, n), {}, {
  9615. cmd: _o.CMD.ADD_BLACKLIST,
  9616. requestData: {
  9617. fromAccount: "",
  9618. toAccount: []
  9619. }
  9620. }),
  9621. get: u(u({}, n), {}, {
  9622. cmd: _o.CMD.GET_BLACKLIST,
  9623. requestData: {
  9624. fromAccount: "",
  9625. startIndex: 0,
  9626. maxLimited: 30,
  9627. lastSequence: 0
  9628. }
  9629. }),
  9630. delete: u(u({}, n), {}, {
  9631. cmd: _o.CMD.DELETE_BLACKLIST,
  9632. requestData: {
  9633. fromAccount: "",
  9634. toAccount: []
  9635. }
  9636. }),
  9637. update: {}
  9638. };
  9639. }(this.tim), this.config.c2cMessage = function (e) {
  9640. var t = u(u({}, Ls(e)), {}, {
  9641. reqtime: function () {
  9642. return +new Date();
  9643. }
  9644. }),
  9645. n = {
  9646. request: {
  9647. fromAccount: "From_Account",
  9648. toAccount: "To_Account",
  9649. msgTimeStamp: "MsgTimeStamp",
  9650. msgSeq: "MsgSeq",
  9651. msgRandom: "MsgRandom",
  9652. msgBody: "MsgBody",
  9653. count: "MaxCnt",
  9654. lastMessageTime: "LastMsgTime",
  9655. messageKey: "MsgKey",
  9656. peerAccount: "Peer_Account",
  9657. data: "Data",
  9658. description: "Desc",
  9659. extension: "Ext",
  9660. type: "MsgType",
  9661. content: "MsgContent",
  9662. sizeType: "Type",
  9663. uuid: "UUID",
  9664. imageUrl: "URL",
  9665. fileUrl: "Url",
  9666. remoteAudioUrl: "Url",
  9667. remoteVideoUrl: "VideoUrl",
  9668. thumbUUID: "ThumbUUID",
  9669. videoUUID: "VideoUUID",
  9670. videoUrl: "",
  9671. downloadFlag: "Download_Flag"
  9672. },
  9673. response: {
  9674. MsgContent: "content",
  9675. MsgTime: "time",
  9676. Data: "data",
  9677. Desc: "description",
  9678. Ext: "extension",
  9679. MsgKey: "messageKey",
  9680. MsgType: "type",
  9681. MsgBody: "elements",
  9682. Download_Flag: "downloadFlag",
  9683. ThumbUUID: "thumbUUID",
  9684. VideoUUID: "videoUUID"
  9685. }
  9686. },
  9687. o = {
  9688. serverName: _o.NAME.OPEN_IM,
  9689. channel: _o.CHANNEL.XHR,
  9690. protocol: po,
  9691. method: "POST",
  9692. queryString: t
  9693. };
  9694. return {
  9695. create: u(u({}, o), {}, {
  9696. cmd: _o.CMD.SEND_MESSAGE,
  9697. requestData: {
  9698. fromAccount: e.loginInfo.identifier,
  9699. toAccount: "",
  9700. msgTimeStamp: Math.ceil(+new Date() / 1e3),
  9701. msgSeq: 0,
  9702. msgRandom: 0,
  9703. msgBody: [],
  9704. msgLifeTime: void 0,
  9705. offlinePushInfo: {
  9706. pushFlag: 0,
  9707. title: "",
  9708. desc: "",
  9709. ext: "",
  9710. apnsInfo: {
  9711. badgeMode: 0
  9712. },
  9713. androidInfo: {
  9714. OPPOChannelID: ""
  9715. }
  9716. }
  9717. },
  9718. keyMaps: n
  9719. }),
  9720. query: u(u({}, o), {}, {
  9721. cmd: _o.CMD.GET_C2C_ROAM_MESSAGES,
  9722. requestData: {
  9723. peerAccount: "",
  9724. count: 15,
  9725. lastMessageTime: 0,
  9726. messageKey: "",
  9727. withRecalledMsg: 1
  9728. },
  9729. keyMaps: n
  9730. })
  9731. };
  9732. }(this.tim), this.config.c2cMessageWillBeRevoked = function (e) {
  9733. var t = u(u({}, Ls(e)), {}, {
  9734. reqtime: function () {
  9735. return +new Date();
  9736. }
  9737. });
  9738. return {
  9739. create: {
  9740. serverName: _o.NAME.OPEN_IM,
  9741. cmd: _o.CMD.REVOKE_C2C_MESSAGE,
  9742. channel: _o.CHANNEL.XHR,
  9743. protocol: po,
  9744. method: "POST",
  9745. queryString: t,
  9746. requestData: {
  9747. msgInfo: {
  9748. fromAccount: "",
  9749. toAccount: "",
  9750. msgTimeStamp: Math.ceil(+new Date() / 1e3),
  9751. msgSeq: 0,
  9752. msgRandom: 0
  9753. }
  9754. },
  9755. keyMaps: {
  9756. request: {
  9757. msgInfo: "MsgInfo",
  9758. fromAccount: "From_Account",
  9759. toAccount: "To_Account",
  9760. msgTimeStamp: "MsgTimeStamp",
  9761. msgSeq: "MsgSeq",
  9762. msgRandom: "MsgRandom",
  9763. msgBody: "MsgBody"
  9764. }
  9765. }
  9766. }
  9767. };
  9768. }(this.tim), this.config.c2cPeerReadTime = function (e) {
  9769. var t = u(u({}, Ls(e)), {}, {
  9770. reqtime: function () {
  9771. return +new Date();
  9772. }
  9773. });
  9774. return {
  9775. get: {
  9776. serverName: _o.NAME.OPEN_IM,
  9777. cmd: _o.CMD.GET_PEER_READ_TIME,
  9778. channel: _o.CHANNEL.XHR,
  9779. protocol: po,
  9780. method: "POST",
  9781. queryString: t,
  9782. requestData: {
  9783. userIDList: void 0
  9784. },
  9785. keyMaps: {
  9786. request: {
  9787. userIDList: "To_Account"
  9788. },
  9789. response: {
  9790. ReadTime: "peerReadTimeList"
  9791. }
  9792. }
  9793. }
  9794. };
  9795. }(this.tim), this.config.groupMessage = function (e) {
  9796. var t = u(u({}, Ls(e)), {}, {
  9797. reqtime: function () {
  9798. return +new Date();
  9799. }
  9800. }),
  9801. n = {
  9802. request: {
  9803. to: "GroupId",
  9804. extension: "Ext",
  9805. data: "Data",
  9806. description: "Desc",
  9807. random: "Random",
  9808. sequence: "ReqMsgSeq",
  9809. count: "ReqMsgNumber",
  9810. type: "MsgType",
  9811. priority: "MsgPriority",
  9812. content: "MsgContent",
  9813. elements: "MsgBody",
  9814. sizeType: "Type",
  9815. uuid: "UUID",
  9816. imageUrl: "URL",
  9817. fileUrl: "Url",
  9818. remoteAudioUrl: "Url",
  9819. remoteVideoUrl: "VideoUrl",
  9820. thumbUUID: "ThumbUUID",
  9821. videoUUID: "VideoUUID",
  9822. videoUrl: "",
  9823. downloadFlag: "Download_Flag",
  9824. clientSequence: "ClientSeq"
  9825. },
  9826. response: {
  9827. Random: "random",
  9828. MsgTime: "time",
  9829. MsgSeq: "sequence",
  9830. ReqMsgSeq: "sequence",
  9831. RspMsgList: "messageList",
  9832. IsPlaceMsg: "isPlaceMessage",
  9833. IsSystemMsg: "isSystemMessage",
  9834. ToGroupId: "to",
  9835. EnumFrom_AccountType: "fromAccountType",
  9836. EnumTo_AccountType: "toAccountType",
  9837. GroupCode: "groupCode",
  9838. MsgPriority: "priority",
  9839. MsgBody: "elements",
  9840. MsgType: "type",
  9841. MsgContent: "content",
  9842. IsFinished: "complete",
  9843. Download_Flag: "downloadFlag",
  9844. ClientSeq: "clientSequence",
  9845. ThumbUUID: "thumbUUID",
  9846. VideoUUID: "videoUUID"
  9847. }
  9848. },
  9849. o = {
  9850. serverName: _o.NAME.GROUP,
  9851. channel: _o.CHANNEL.XHR,
  9852. protocol: po,
  9853. method: "POST",
  9854. queryString: t
  9855. };
  9856. return {
  9857. create: u(u({}, o), {}, {
  9858. cmd: _o.CMD.SEND_GROUP_MESSAGE,
  9859. requestData: {
  9860. groupID: "",
  9861. fromAccount: e.loginInfo.identifier,
  9862. random: 0,
  9863. clientSequence: 0,
  9864. priority: "",
  9865. msgBody: [],
  9866. onlineOnlyFlag: 0,
  9867. offlinePushInfo: {
  9868. pushFlag: 0,
  9869. title: "",
  9870. desc: "",
  9871. ext: "",
  9872. apnsInfo: {
  9873. badgeMode: 0
  9874. },
  9875. androidInfo: {
  9876. OPPOChannelID: ""
  9877. }
  9878. },
  9879. groupAtInfo: []
  9880. },
  9881. keyMaps: n
  9882. }),
  9883. query: u(u({}, o), {}, {
  9884. cmd: _o.CMD.GET_GROUP_ROAM_MESSAGES,
  9885. requestData: {
  9886. withRecalledMsg: 1,
  9887. groupID: "",
  9888. count: 15,
  9889. sequence: ""
  9890. },
  9891. keyMaps: n
  9892. }),
  9893. update: null,
  9894. delete: null
  9895. };
  9896. }(this.tim), this.config.groupMessageWillBeRevoked = function (e) {
  9897. var t = u(u({}, Ls(e)), {}, {
  9898. reqtime: function () {
  9899. return +new Date();
  9900. }
  9901. });
  9902. return {
  9903. create: {
  9904. serverName: _o.NAME.GROUP,
  9905. cmd: _o.CMD.REVOKE_GROUP_MESSAGE,
  9906. channel: _o.CHANNEL.XHR,
  9907. protocol: po,
  9908. method: "POST",
  9909. queryString: t,
  9910. requestData: {
  9911. to: "",
  9912. msgSeqList: []
  9913. },
  9914. keyMaps: {
  9915. request: {
  9916. to: "GroupId",
  9917. msgSeqList: "MsgSeqList",
  9918. msgSeq: "MsgSeq"
  9919. }
  9920. }
  9921. }
  9922. };
  9923. }(this.tim), this.config.conversation = function (e) {
  9924. var t = Ls(e),
  9925. n = {
  9926. serverName: _o.NAME.RECENT_CONTACT,
  9927. channel: _o.CHANNEL.XHR,
  9928. protocol: po,
  9929. method: "POST",
  9930. queryString: t
  9931. };
  9932. return {
  9933. query: u(u({}, n), {}, {
  9934. cmd: _o.CMD.GET_CONVERSATION_LIST,
  9935. requestData: {
  9936. fromAccount: e.loginInfo.identifier,
  9937. count: 0
  9938. },
  9939. keyMaps: {
  9940. request: {},
  9941. response: {
  9942. SessionItem: "conversations",
  9943. ToAccount: "groupID",
  9944. To_Account: "userID",
  9945. UnreadMsgCount: "unreadCount",
  9946. MsgGroupReadedSeq: "messageReadSeq"
  9947. }
  9948. }
  9949. }),
  9950. pagingQuery: u(u({}, n), {}, {
  9951. cmd: _o.CMD.PAGING_GET_CONVERSATION_LIST,
  9952. requestData: {
  9953. fromAccount: void 0,
  9954. timeStamp: void 0,
  9955. orderType: void 0
  9956. },
  9957. keyMaps: {
  9958. request: {},
  9959. response: {
  9960. SessionItem: "conversations",
  9961. ToAccount: "groupID",
  9962. To_Account: "userID",
  9963. UnreadMsgCount: "unreadCount",
  9964. MsgGroupReadedSeq: "messageReadSeq",
  9965. C2cPeerReadTime: "c2cPeerReadTime"
  9966. }
  9967. }
  9968. }),
  9969. delete: u(u({}, n), {}, {
  9970. cmd: _o.CMD.DELETE_CONVERSATION,
  9971. requestData: {
  9972. fromAccount: e.loginInfo.identifier,
  9973. toAccount: void 0,
  9974. type: 1,
  9975. toGroupID: void 0
  9976. },
  9977. keyMaps: {
  9978. request: {
  9979. toGroupID: "ToGroupid"
  9980. }
  9981. }
  9982. }),
  9983. setC2CMessageRead: u(u({}, n), {}, {
  9984. serverName: _o.NAME.OPEN_IM,
  9985. cmd: _o.CMD.SET_C2C_MESSAGE_READ,
  9986. requestData: {
  9987. C2CMsgReaded: void 0
  9988. },
  9989. keyMaps: {
  9990. request: {
  9991. lastMessageTime: "LastedMsgTime"
  9992. }
  9993. }
  9994. }),
  9995. setGroupMessageRead: u(u({}, n), {}, {
  9996. serverName: _o.NAME.GROUP,
  9997. cmd: _o.CMD.SET_GROUP_MESSAGE_READ,
  9998. requestData: {
  9999. groupID: void 0,
  10000. messageReadSeq: void 0
  10001. },
  10002. keyMaps: {
  10003. request: {
  10004. messageReadSeq: "MsgReadedSeq"
  10005. }
  10006. }
  10007. }),
  10008. deleteGroupAtTips: u(u({}, n), {}, {
  10009. serverName: _o.NAME.OPEN_IM,
  10010. cmd: _o.CMD.DELETE_GROUP_AT_TIPS,
  10011. requestData: {
  10012. messageListToDelete: void 0
  10013. },
  10014. keyMaps: {
  10015. request: {
  10016. messageListToDelete: "DelMsgList",
  10017. messageSeq: "MsgSeq",
  10018. messageRandom: "MsgRandom"
  10019. }
  10020. }
  10021. })
  10022. };
  10023. }(this.tim), this.config.syncMessage = function (e) {
  10024. var t = u(u({}, Ls(e)), {}, {
  10025. reqtime: function () {
  10026. return [Math.ceil(+new Date()), Math.random()].join("");
  10027. }
  10028. });
  10029. return {
  10030. create: null,
  10031. query: {
  10032. serverName: _o.NAME.OPEN_IM,
  10033. cmd: _o.CMD.GET_MESSAGES,
  10034. channel: _o.CHANNEL.XHR,
  10035. protocol: po,
  10036. method: "POST",
  10037. queryString: t,
  10038. requestData: {
  10039. cookie: "",
  10040. syncFlag: 0,
  10041. needAbstract: 1
  10042. },
  10043. keyMaps: {
  10044. request: {
  10045. fromAccount: "From_Account",
  10046. toAccount: "To_Account",
  10047. from: "From_Account",
  10048. to: "To_Account",
  10049. time: "MsgTimeStamp",
  10050. sequence: "MsgSeq",
  10051. random: "MsgRandom",
  10052. elements: "MsgBody"
  10053. },
  10054. response: {
  10055. MsgList: "messageList",
  10056. SyncFlag: "syncFlag",
  10057. To_Account: "to",
  10058. From_Account: "from",
  10059. ClientSeq: "clientSequence",
  10060. MsgSeq: "sequence",
  10061. NoticeSeq: "noticeSequence",
  10062. NotifySeq: "notifySequence",
  10063. MsgRandom: "random",
  10064. MsgTimeStamp: "time",
  10065. MsgContent: "content",
  10066. ToGroupId: "groupID",
  10067. MsgKey: "messageKey",
  10068. GroupTips: "groupTips",
  10069. MsgBody: "elements",
  10070. MsgType: "type",
  10071. C2CRemainingUnreadCount: "C2CRemainingUnreadList"
  10072. }
  10073. }
  10074. },
  10075. update: null,
  10076. delete: null
  10077. };
  10078. }(this.tim), this.config.AVChatRoom = function (e) {
  10079. var t = _o.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,
  10080. n = u(u({}, Ls(e)), {}, {
  10081. accounttype: "792",
  10082. reqtime: function () {
  10083. return +new Date();
  10084. }
  10085. });
  10086. return (e.context.login === ot.IS_LOGIN || e.context.a2Key) && (t = _o.NAME.BIG_GROUP_LONG_POLLING), {
  10087. startLongPoll: {
  10088. serverName: t,
  10089. cmd: _o.CMD.AVCHATROOM_LONG_POLL,
  10090. channel: _o.CHANNEL.XHR,
  10091. protocol: po,
  10092. method: "POST",
  10093. queryString: n,
  10094. requestData: {
  10095. USP: 1,
  10096. startSeq: 1,
  10097. holdTime: 90,
  10098. key: void 0
  10099. },
  10100. keyMaps: {
  10101. request: {
  10102. USP: "USP"
  10103. },
  10104. response: {
  10105. ToGroupId: "groupID",
  10106. MsgPriority: "priority"
  10107. }
  10108. }
  10109. }
  10110. };
  10111. }(this.tim), this.config.cosUpload = function (e) {
  10112. var t = u(u({}, Ls(e)), {}, {
  10113. reqtime: function () {
  10114. return +new Date();
  10115. }
  10116. });
  10117. return {
  10118. create: {
  10119. serverName: _o.NAME.OPEN_IM,
  10120. cmd: _o.CMD.FILE_UPLOAD,
  10121. channel: _o.CHANNEL.XHR,
  10122. protocol: po,
  10123. method: "POST",
  10124. queryString: t,
  10125. requestData: {
  10126. appVersion: "2.1",
  10127. fromAccount: "",
  10128. toAccount: "",
  10129. sequence: 0,
  10130. time: function () {
  10131. return Math.ceil(Date.now() / 1e3);
  10132. },
  10133. random: function () {
  10134. return we();
  10135. },
  10136. fileStrMd5: "",
  10137. fileSize: "",
  10138. serverVer: 1,
  10139. authKey: "",
  10140. busiId: 1,
  10141. pkgFlag: 1,
  10142. sliceOffset: 0,
  10143. sliceSize: 0,
  10144. sliceData: "",
  10145. contentType: "application/x-www-form-urlencoded"
  10146. },
  10147. keyMaps: {
  10148. request: {},
  10149. response: {}
  10150. }
  10151. },
  10152. update: null,
  10153. delete: null
  10154. };
  10155. }(this.tim), this.config.cosSig = function (e) {
  10156. var t = {
  10157. sdkappid: e.loginInfo.SDKAppID,
  10158. identifier: e.loginInfo.identifier,
  10159. userSig: e.context.userSig
  10160. };
  10161. return {
  10162. create: null,
  10163. query: {
  10164. serverName: _o.NAME.IM_COS_SIGN,
  10165. cmd: _o.CMD.COS_SIGN,
  10166. channel: _o.CHANNEL.XHR,
  10167. protocol: po,
  10168. method: "POST",
  10169. queryString: t,
  10170. requestData: {
  10171. cmd: "open_im_cos_svc",
  10172. subCmd: "get_cos_token",
  10173. duration: 300,
  10174. version: 2
  10175. },
  10176. keyMaps: {
  10177. request: {
  10178. userSig: "usersig",
  10179. subCmd: "sub_cmd",
  10180. cmd: "cmd",
  10181. duration: "duration",
  10182. version: "version"
  10183. },
  10184. response: {
  10185. expired_time: "expiredTime",
  10186. bucket_name: "bucketName",
  10187. session_token: "sessionToken",
  10188. tmp_secret_id: "secretId",
  10189. tmp_secret_key: "secretKey"
  10190. }
  10191. }
  10192. },
  10193. update: null,
  10194. delete: null
  10195. };
  10196. }(this.tim), this.config.bigDataHallwayAuthKey = function (e) {
  10197. return {
  10198. create: null,
  10199. query: {
  10200. serverName: _o.NAME.OPEN_IM,
  10201. cmd: _o.CMD.BIG_DATA_HALLWAY_AUTH_KEY,
  10202. channel: _o.CHANNEL.XHR,
  10203. protocol: po,
  10204. method: "POST",
  10205. queryString: u(u({}, Ls(e)), {}, {
  10206. accounttype: "792",
  10207. reqtime: function () {
  10208. return +new Date();
  10209. }
  10210. }),
  10211. requestData: {}
  10212. }
  10213. };
  10214. }(this.tim), this.config.ssoEventStat = function (e) {
  10215. var t = {
  10216. sdkappid: e.loginInfo.SDKAppID,
  10217. reqtime: Math.ceil(+new Date() / 1e3)
  10218. };
  10219. return {
  10220. create: {
  10221. serverName: _o.NAME.IM_OPEN_STAT,
  10222. cmd: _o.CMD.TIM_WEB_REPORT,
  10223. channel: _o.CHANNEL.AUTO,
  10224. protocol: po,
  10225. queryString: t,
  10226. requestData: {
  10227. table: "",
  10228. report: []
  10229. },
  10230. keyMaps: {
  10231. request: {
  10232. table: "table",
  10233. report: "report",
  10234. SDKAppID: "sdkappid",
  10235. version: "version",
  10236. tinyID: "tinyid",
  10237. userID: "userid",
  10238. platform: "platform",
  10239. method: "method",
  10240. time: "time",
  10241. start: "start",
  10242. end: "end",
  10243. cost: "cost",
  10244. status: "status",
  10245. codeint: "codeint",
  10246. message: "message",
  10247. pointer: "pointer",
  10248. text: "text",
  10249. msgType: "msgtype",
  10250. networkType: "networktype",
  10251. startts: "startts",
  10252. endts: "endts",
  10253. timespan: "timespan"
  10254. }
  10255. }
  10256. },
  10257. query: {},
  10258. update: {},
  10259. delete: {}
  10260. };
  10261. }(this.tim), this.config.ssoSumStat = function (e) {
  10262. var t = null;
  10263. null !== e.context && (t = {
  10264. sdkappid: e.context.SDKAppID,
  10265. reqtime: Math.ceil(+new Date() / 1e3)
  10266. });
  10267. return {
  10268. create: {
  10269. serverName: _o.NAME.IM_OPEN_STAT,
  10270. cmd: _o.CMD.TIM_WEB_REPORT,
  10271. channel: _o.CHANNEL.AUTO,
  10272. protocol: po,
  10273. queryString: t,
  10274. requestData: {
  10275. table: "",
  10276. report: []
  10277. },
  10278. keyMaps: {
  10279. request: {
  10280. table: "table",
  10281. report: "report",
  10282. SDKAppID: "sdkappid",
  10283. version: "version",
  10284. tinyID: "tinyid",
  10285. userID: "userid",
  10286. item: "item",
  10287. lpID: "lpid",
  10288. platform: "platform",
  10289. scene: "scene",
  10290. networkType: "networktype",
  10291. total: "total",
  10292. successRate: "successrate",
  10293. avg: "avg",
  10294. timespan: "timespan",
  10295. time: "time"
  10296. }
  10297. }
  10298. },
  10299. query: {},
  10300. update: {},
  10301. delete: {}
  10302. };
  10303. }(this.tim);
  10304. }
  10305. }, {
  10306. key: "_initRequestData",
  10307. value: function (e, t) {
  10308. if (void 0 === e) return pr(t.requestData, this._getRequestMap(t), this.tim);
  10309. var n = t.requestData,
  10310. o = Object.create(null);
  10311. for (var r in n) if (Object.prototype.hasOwnProperty.call(n, r)) {
  10312. if (o[r] = "function" == typeof n[r] ? n[r]() : n[r], void 0 === e[r]) continue;
  10313. o[r] = e[r];
  10314. }
  10315. return o = pr(o, this._getRequestMap(t), this.tim);
  10316. }
  10317. }, {
  10318. key: "_getRequestMap",
  10319. value: function (e) {
  10320. if (e.keyMaps && e.keyMaps.request && Object.keys(e.keyMaps.request).length > 0) return e.keyMaps.request;
  10321. }
  10322. }, {
  10323. key: "_initEncoder",
  10324. value: function (e) {
  10325. switch (e.protocol) {
  10326. case po:
  10327. return function (e) {
  10328. if ("string" === n(e)) try {
  10329. return JSON.parse(e);
  10330. } catch (t) {
  10331. return e;
  10332. }
  10333. return e;
  10334. };
  10335. case lo:
  10336. return function (e) {
  10337. return e;
  10338. };
  10339. default:
  10340. return function (e) {
  10341. return de.warn("PackageConfig._initEncoder(), unknow response type, data: ", JSON.stringify(e)), e;
  10342. };
  10343. }
  10344. }
  10345. }, {
  10346. key: "_initDecoder",
  10347. value: function (e) {
  10348. switch (e.protocol) {
  10349. case po:
  10350. return function (e) {
  10351. if ("string" === n(e)) try {
  10352. return JSON.parse(e);
  10353. } catch (t) {
  10354. return e;
  10355. }
  10356. return e;
  10357. };
  10358. case lo:
  10359. return function (e) {
  10360. return e;
  10361. };
  10362. default:
  10363. return function (e) {
  10364. return de.warn("PackageConfig._initDecoder(), unknow response type, data: ", e), e;
  10365. };
  10366. }
  10367. }
  10368. }]), e;
  10369. }(),
  10370. Ps = function () {
  10371. for (var e = [], t = Gs(arguments), n = 0; n < arguments.length; n++) Number.isInteger(arguments[n]) ? e.push(arguments[n]) : e.push(!0 == !!arguments[n] ? "1" : "0");
  10372. return e.join(t);
  10373. },
  10374. Gs = function (e) {
  10375. var t = e.length,
  10376. n = e[t - 1];
  10377. if ("string" != typeof n) return "";
  10378. if (n.length > 1) return "";
  10379. var o = e[t - 1];
  10380. return delete e[t - 1], e.length -= t === e.length ? 1 : 0, o;
  10381. },
  10382. bs = {
  10383. C2CMessageArray: 1,
  10384. groupMessageArray: 1,
  10385. groupTips: 1,
  10386. C2CNotifyMessageArray: 1,
  10387. profileModify: 1,
  10388. friendListMod: 1
  10389. },
  10390. Us = function (e) {
  10391. c(n, e);
  10392. var t = v(n);
  10393. function n(e) {
  10394. var r;
  10395. return o(this, n), (r = t.call(this, e))._initialization(), r;
  10396. }
  10397. return i(n, [{
  10398. key: "_initialization",
  10399. value: function () {
  10400. this._syncOffset = "", this._syncNoticeList = [], this._syncEventArray = [], this._syncMessagesIsRunning = !1, this._syncMessagesFinished = !1, this._isLongPoll = !1, this._longPollID = "0", this._noticeSequence = 0, this._initializeListener(), this._runLoop = null, this._initShuntChannels();
  10401. }
  10402. }, {
  10403. key: "_initShuntChannels",
  10404. value: function () {
  10405. this._shuntChannels = Object.create(null), this._shuntChannels.C2CMessageArray = this._C2CMessageArrayChannel.bind(this), this._shuntChannels.groupMessageArray = this._groupMessageArrayChannel.bind(this), this._shuntChannels.groupTips = this._groupTipsChannel.bind(this), this._shuntChannels.C2CNotifyMessageArray = this._C2CNotifyMessageArrayChannel.bind(this), this._shuntChannels.profileModify = this._profileModifyChannel.bind(this), this._shuntChannels.friendListMod = this._friendListModChannel.bind(this);
  10406. }
  10407. }, {
  10408. key: "_C2CMessageArrayChannel",
  10409. value: function (e, t, n) {
  10410. this.emitInnerEvent(Uo, t);
  10411. }
  10412. }, {
  10413. key: "_groupMessageArrayChannel",
  10414. value: function (e, t, n) {
  10415. this.emitInnerEvent(qo, t);
  10416. }
  10417. }, {
  10418. key: "_groupTipsChannel",
  10419. value: function (e, t, n) {
  10420. var o = this;
  10421. switch (e) {
  10422. case 4:
  10423. case 6:
  10424. this.emitInnerEvent(Fo, t);
  10425. break;
  10426. case 5:
  10427. t.forEach(function (e) {
  10428. Ie(e.elements.revokedInfos) ? o.emitInnerEvent(Bo, t) : o.emitInnerEvent(Vo, {
  10429. groupSystemNotices: t,
  10430. type: n
  10431. });
  10432. });
  10433. break;
  10434. case 12:
  10435. this.emitInnerEvent(xo, t);
  10436. break;
  10437. default:
  10438. de.log("NotificationController._groupTipsChannel unknown event=".concat(e, " type=").concat(n), t);
  10439. }
  10440. }
  10441. }, {
  10442. key: "_C2CNotifyMessageArrayChannel",
  10443. value: function (e, t, n) {
  10444. if (t[0]) {
  10445. var o = t[0];
  10446. o.hasOwnProperty("kickoutMsgNotify") ? this.emitInnerEvent(bo) : o.hasOwnProperty("c2cMessageRevokedNotify") ? this.emitInnerEvent(jo, t) : o.hasOwnProperty("c2cMessageReadReceipt") && this.emitInnerEvent($o, t);
  10447. }
  10448. }
  10449. }, {
  10450. key: "_profileModifyChannel",
  10451. value: function (e, t, n) {
  10452. this.emitInnerEvent(Ho, t);
  10453. }
  10454. }, {
  10455. key: "_friendListModChannel",
  10456. value: function (e, t, n) {
  10457. this.emitInnerEvent(Ko, t);
  10458. }
  10459. }, {
  10460. key: "_dispatchNotice",
  10461. value: function (e) {
  10462. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "poll";
  10463. if (Ie(e)) for (var n = null, o = null, r = "", i = 0, s = 0, a = e.length; s < a; s++) i = (n = e[s]).event, r = Object.keys(n).find(function (e) {
  10464. return void 0 !== bs[e];
  10465. }), Ee(this._shuntChannels[r]) ? (o = n[r], "poll" === t && this._updatenoticeSequence(o), this._shuntChannels[r](i, o, t)) : ("poll" === t && this._updatenoticeSequence(), de.log("NotificationController._dispatchNotice unknown eventItem=", n));
  10466. }
  10467. }, {
  10468. key: "getLongPollID",
  10469. value: function () {
  10470. return this._longPollID;
  10471. }
  10472. }, {
  10473. key: "_IAmReady",
  10474. value: function () {
  10475. this.triggerReady();
  10476. }
  10477. }, {
  10478. key: "reset",
  10479. value: function () {
  10480. this._noticeSequence = 0, this._resetSync(), this.closeNoticeChannel();
  10481. }
  10482. }, {
  10483. key: "_resetSync",
  10484. value: function () {
  10485. this._syncOffset = "", this._syncNoticeList = [], this._syncEventArray = [], this._syncMessagesIsRunning = !1, this._syncMessagesFinished = !1;
  10486. }
  10487. }, {
  10488. key: "_setNoticeSeqInRequestData",
  10489. value: function (e) {
  10490. e.Cookie.NoticeSeq = this._noticeSequence, this.tim.sumStatController.addTotalCount(Dr);
  10491. }
  10492. }, {
  10493. key: "_updatenoticeSequence",
  10494. value: function (e) {
  10495. if (e) {
  10496. var t = e[e.length - 1].noticeSequence;
  10497. t && "number" == typeof t ? t <= this._noticeSequence || (this._noticeSequence = t) : this._noticeSequence++;
  10498. } else this._noticeSequence++;
  10499. }
  10500. }, {
  10501. key: "_initializeListener",
  10502. value: function () {
  10503. var e = this.tim.innerEmitter;
  10504. e.on(Mo, this._startSyncMessages, this), e.on(Qo, this.closeNoticeChannel, this);
  10505. }
  10506. }, {
  10507. key: "openNoticeChannel",
  10508. value: function () {
  10509. de.log("NotificationController.openNoticeChannel"), this._getLongPollID();
  10510. }
  10511. }, {
  10512. key: "closeNoticeChannel",
  10513. value: function () {
  10514. de.log("NotificationController.closeNoticeChannel"), (this._runLoop instanceof zi || this._runLoop instanceof Ji) && (this._runLoop.abort(), this._runLoop.stop()), this._longPollID = "0", this._isLongPoll = !1;
  10515. }
  10516. }, {
  10517. key: "_getLongPollID",
  10518. value: function () {
  10519. var e = this;
  10520. if ("0" === this._longPollID) {
  10521. var t = new qr(Ni);
  10522. this.request({
  10523. name: "longPollID",
  10524. action: "query"
  10525. }).then(function (n) {
  10526. var o = n.data.longPollingID;
  10527. e._onGetLongPollIDSuccess(o), t.setText("longPollingID=".concat(o)).setNetworkType(e.getNetworkType()).setEnd();
  10528. }).catch(function (n) {
  10529. var o = new Ut({
  10530. code: n.code || qt.GET_LONGPOLL_ID_FAILED,
  10531. message: n.message || Kn
  10532. });
  10533. e.emitInnerEvent(Lo), e.emitInnerEvent(er, o), e.probeNetwork().then(function (e) {
  10534. var n = y(e, 2),
  10535. r = n[0],
  10536. i = n[1];
  10537. t.setError(o, r, i).setEnd();
  10538. });
  10539. });
  10540. } else this._onGetLongPollIDSuccess(this._longPollID);
  10541. }
  10542. }, {
  10543. key: "_onGetLongPollIDSuccess",
  10544. value: function (e) {
  10545. this.emitInnerEvent(Co, [{
  10546. key: "long_poll_logout.query.requestData.longPollingID",
  10547. value: e
  10548. }, {
  10549. key: "longPoll.query.requestData.cookie.longPollingID",
  10550. value: e
  10551. }]), this._longPollID = e, this._startLongPoll(), this._IAmReady(), this.tim.sumStatController.recordLongPollingID(this._longPollID);
  10552. }
  10553. }, {
  10554. key: "_startLongPoll",
  10555. value: function () {
  10556. if (!0 !== this._isLongPoll) {
  10557. de.log("NotificationController._startLongPoll...");
  10558. var e = this.tim.connectionController,
  10559. t = this.createTransportCapsule({
  10560. name: "longPoll",
  10561. action: "query"
  10562. });
  10563. this._isLongPoll = !0, this._runLoop = e.createRunLoop({
  10564. pack: t,
  10565. before: this._setNoticeSeqInRequestData.bind(this),
  10566. success: this._onNoticeReceived.bind(this),
  10567. fail: this._onNoticeFail.bind(this)
  10568. }), this._runLoop.start();
  10569. } else de.log("NotificationController._startLongPoll is running...");
  10570. }
  10571. }, {
  10572. key: "_onNoticeReceived",
  10573. value: function (e) {
  10574. var t = e.data;
  10575. t.errorCode !== nt.SUCCESS ? (new qr(Li).setMessage(t.errorInfo || JSON.stringify(t)).setCode(t.errorCode).setNetworkType(this.getNetworkType()).setEnd(!0), this._onResponseError(t)) : this.emitInnerEvent(Po);
  10576. this.tim.sumStatController.addSuccessCount(Dr), this.tim.sumStatController.addCost(Dr, t.timecost), e.data.eventArray && this._dispatchNotice(e.data.eventArray);
  10577. }
  10578. }, {
  10579. key: "_onResponseError",
  10580. value: function (e) {
  10581. switch (e.errorCode) {
  10582. case qt.LONG_POLL_KICK_OUT:
  10583. de.warn("NotificationController._onResponseError, longPollingID=".concat(this._longPollID, " was kicked out")), this.emitInnerEvent(Go), this.closeNoticeChannel();
  10584. break;
  10585. case qt.MESSAGE_A2KEY_EXPIRED:
  10586. case qt.ACCOUNT_A2KEY_EXPIRED:
  10587. this.emitInnerEvent(Zo);
  10588. break;
  10589. default:
  10590. Me(e.errorCode) || Me(e.errorInfo) ? de.log("NotificationController._onResponseError, errorCode or errorInfo undefined!", e) : this.emitInnerEvent(er, new Ut({
  10591. code: e.errorCode,
  10592. message: e.errorInfo
  10593. }));
  10594. }
  10595. }
  10596. }, {
  10597. key: "_onNoticeFail",
  10598. value: function (e) {
  10599. if (e.error) if ("ECONNABORTED" === e.error.code || e.error.code === qt.NETWORK_TIMEOUT) {
  10600. if (e.error.config) {
  10601. var t = e.error.config.url,
  10602. n = e.error.config.data;
  10603. de.log("NotificationController._onNoticeFail request timed out. url=".concat(t, " data=").concat(n));
  10604. } else de.log("NotificationController._onNoticeFail request timed out.");
  10605. } else de.log("NotificationController._onNoticeFail request failed due to network error");
  10606. this.emitInnerEvent(wo);
  10607. }
  10608. }, {
  10609. key: "_startSyncMessages",
  10610. value: function (e) {
  10611. !0 !== this._syncMessagesFinished && this.syncMessage();
  10612. }
  10613. }, {
  10614. key: "syncMessage",
  10615. value: function () {
  10616. var e = this,
  10617. t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
  10618. n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
  10619. this._syncMessagesIsRunning = !0, this.request({
  10620. name: "syncMessage",
  10621. action: "query",
  10622. param: {
  10623. cookie: t,
  10624. syncFlag: n
  10625. }
  10626. }).then(function (t) {
  10627. var n = t.data;
  10628. switch (Ps(n.cookie, n.syncFlag)) {
  10629. case "00":
  10630. case "01":
  10631. e.emitInnerEvent(er, {
  10632. code: qt.NOTICE_RUNLOOP_OFFSET_LOST,
  10633. message: Vn
  10634. });
  10635. break;
  10636. case "10":
  10637. case "11":
  10638. n.eventArray && e._dispatchNotice(n.eventArray, "sync"), e._syncNoticeList = e._syncNoticeList.concat(n.messageList), e.emitInnerEvent(Eo, {
  10639. data: n.messageList,
  10640. C2CRemainingUnreadList: n.C2CRemainingUnreadList
  10641. }), e._syncOffset = n.cookie, e.syncMessage(n.cookie, n.syncFlag);
  10642. break;
  10643. case "12":
  10644. n.eventArray && e._dispatchNotice(n.eventArray, "sync"), e.openNoticeChannel(), e._syncNoticeList = e._syncNoticeList.concat(n.messageList), e.emitInnerEvent(To, {
  10645. messageList: n.messageList,
  10646. C2CRemainingUnreadList: n.C2CRemainingUnreadList
  10647. }), e._syncOffset = n.cookie, e._syncNoticeList = [], e._syncMessagesIsRunning = !1, e._syncMessagesFinished = !0;
  10648. }
  10649. }).catch(function (t) {
  10650. e._syncMessagesIsRunning = !1, de.error("NotificationController.syncMessage failed. error:", t);
  10651. });
  10652. }
  10653. }]), n;
  10654. }(mr),
  10655. qs = function (e) {
  10656. c(n, e);
  10657. var t = v(n);
  10658. function n(e) {
  10659. var r;
  10660. return o(this, n), (r = t.call(this, e)).COSSDK = null, r._cosUploadMethod = null, r.expiredTimeLimit = 600, r.appid = 0, r.bucketName = "", r.ciUrl = "", r.directory = "", r.downloadUrl = "", r.uploadUrl = "", r.expiredTimeOut = r.expiredTimeLimit, r.region = "ap-shanghai", r.cos = null, r.cosOptions = {
  10661. secretId: "",
  10662. secretKey: "",
  10663. sessionToken: "",
  10664. expiredTime: 0
  10665. }, r._timer = 0, r.tim.innerEmitter.on(Mo, r._init, f(r)), r.triggerReady(), r;
  10666. }
  10667. return i(n, [{
  10668. key: "_expiredTimer",
  10669. value: function () {
  10670. var e = this;
  10671. this._timer = setInterval(function () {
  10672. Math.ceil(Date.now() / 1e3) >= e.cosOptions.expiredTime - 120 && (e._getAuthorizationKey(), clearInterval(e._timer));
  10673. }, 6e4);
  10674. }
  10675. }, {
  10676. key: "_init",
  10677. value: function () {
  10678. var e = V ? "cos-wx-sdk" : "cos-js-sdk";
  10679. this.COSSDK = this.tim.getPlugin(e), this.COSSDK ? this._getAuthorizationKey() : de.warn("UploadController._init 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#registerPlugin");
  10680. }
  10681. }, {
  10682. key: "_getAuthorizationKey",
  10683. value: function () {
  10684. var e = this,
  10685. t = Math.ceil(Date.now() / 1e3),
  10686. n = new qr($r);
  10687. this.request({
  10688. name: "cosSig",
  10689. action: "query",
  10690. param: {
  10691. duration: this.expiredTimeLimit
  10692. }
  10693. }).then(function (o) {
  10694. de.log("UploadController._getAuthorizationKey ok. data:", o.data);
  10695. var r = o.data,
  10696. i = r.expiredTime - t;
  10697. n.setText("requestId=".concat(r.requestId, " requestTime=").concat(t, " expiredTime=").concat(r.expiredTime, " timeout=").concat(i, "s")).setNetworkType(e.getNetworkType()).setEnd(), !V && r.region && (e.region = r.region), e.appid = r.appid, e.bucketName = r.bucketName, e.ciUrl = r.ciUrl, e.directory = r.directory, e.downloadUrl = r.downloadUrl, e.uploadUrl = r.uploadUrl, e.expiredTimeOut = i, e.cosOptions = {
  10698. secretId: r.secretId,
  10699. secretKey: r.secretKey,
  10700. sessionToken: r.sessionToken,
  10701. expiredTime: r.expiredTime
  10702. }, de.log("UploadController._getAuthorizationKey cos.config:", "region=".concat(e.region, ",bucketName=").concat(e.bucketName)), e._initUploaderMethod(), e._expiredTimer();
  10703. }).catch(function (t) {
  10704. e.probeNetwork().then(function (e) {
  10705. var o = y(e, 2),
  10706. r = o[0],
  10707. i = o[1];
  10708. n.setError(t, r, i).setEnd();
  10709. }), de.warn("UploadController._getAuthorizationKey failed. error:", t);
  10710. });
  10711. }
  10712. }, {
  10713. key: "_initUploaderMethod",
  10714. value: function () {
  10715. var e = this;
  10716. this.appid && (this.cos = V ? new this.COSSDK({
  10717. ForcePathStyle: !0,
  10718. getAuthorization: this._getAuthorization.bind(this)
  10719. }) : new this.COSSDK({
  10720. getAuthorization: this._getAuthorization.bind(this)
  10721. }), this._cosUploadMethod = V ? function (t, n) {
  10722. e.cos.postObject(t, n);
  10723. } : function (t, n) {
  10724. e.cos.uploadFiles(t, n);
  10725. });
  10726. }
  10727. }, {
  10728. key: "_getAuthorization",
  10729. value: function (e, t) {
  10730. t({
  10731. TmpSecretId: this.cosOptions.secretId,
  10732. TmpSecretKey: this.cosOptions.secretKey,
  10733. XCosSecurityToken: this.cosOptions.sessionToken,
  10734. ExpiredTime: this.cosOptions.expiredTime
  10735. });
  10736. }
  10737. }, {
  10738. key: "uploadImage",
  10739. value: function (e) {
  10740. if (!e.file) return Cr(new Ut({
  10741. code: qt.MESSAGE_IMAGE_SELECT_FILE_FIRST,
  10742. message: en
  10743. }));
  10744. var t = this._checkImageType(e.file);
  10745. if (!0 !== t) return t;
  10746. var n = this._checkImageMime(e.file);
  10747. if (!0 !== n) return n;
  10748. var o = this._checkImageSize(e.file);
  10749. if (!0 !== o) return o;
  10750. var r = null;
  10751. return this.upload(e).then(function (e) {
  10752. return r = e, t = "https://".concat(e.location), V ? new Promise(function (e, n) {
  10753. K.getImageInfo({
  10754. src: t,
  10755. success: function (t) {
  10756. e({
  10757. width: t.width,
  10758. height: t.height
  10759. });
  10760. },
  10761. fail: function () {
  10762. e({
  10763. width: 0,
  10764. height: 0
  10765. });
  10766. }
  10767. });
  10768. }) : ee && 9 === te ? Promise.resolve({
  10769. width: 0,
  10770. height: 0
  10771. }) : new Promise(function (e, n) {
  10772. var o = new Image();
  10773. o.onload = function () {
  10774. e({
  10775. width: this.width,
  10776. height: this.height
  10777. }), o = null;
  10778. }, o.onerror = function () {
  10779. e({
  10780. width: 0,
  10781. height: 0
  10782. }), o = null;
  10783. }, o.src = t;
  10784. });
  10785. var t;
  10786. }).then(function (e) {
  10787. return r.width = e.width, r.height = e.height, Promise.resolve(r);
  10788. });
  10789. }
  10790. }, {
  10791. key: "_checkImageType",
  10792. value: function (e) {
  10793. var t = "";
  10794. return t = V ? e.url.slice(e.url.lastIndexOf(".") + 1) : e.files[0].name.slice(e.files[0].name.lastIndexOf(".") + 1), jn.indexOf(t.toLowerCase()) >= 0 || Cr(new Ut({
  10795. coe: qt.MESSAGE_IMAGE_TYPES_LIMIT,
  10796. message: tn
  10797. }));
  10798. }
  10799. }, {
  10800. key: "_checkImageMime",
  10801. value: function (e) {
  10802. return !0;
  10803. }
  10804. }, {
  10805. key: "_checkImageSize",
  10806. value: function (e) {
  10807. var t = 0;
  10808. return 0 === (t = V ? e.size : e.files[0].size) ? Cr(new Ut({
  10809. code: qt.MESSAGE_FILE_IS_EMPTY,
  10810. message: "".concat(Xt)
  10811. })) : t < 20971520 || Cr(new Ut({
  10812. coe: qt.MESSAGE_IMAGE_SIZE_LIMIT,
  10813. message: "".concat(nn)
  10814. }));
  10815. }
  10816. }, {
  10817. key: "uploadFile",
  10818. value: function (e) {
  10819. var t = null;
  10820. return e.file ? e.file.files[0].size > 104857600 ? (t = new Ut({
  10821. code: qt.MESSAGE_FILE_SIZE_LIMIT,
  10822. message: pn
  10823. }), Cr(t)) : 0 === e.file.files[0].size ? (t = new Ut({
  10824. code: qt.MESSAGE_FILE_IS_EMPTY,
  10825. message: "".concat(Xt)
  10826. }), Cr(t)) : this.upload(e) : (t = new Ut({
  10827. code: qt.MESSAGE_FILE_SELECT_FILE_FIRST,
  10828. message: ln
  10829. }), Cr(t));
  10830. }
  10831. }, {
  10832. key: "uploadVideo",
  10833. value: function (e) {
  10834. return e.file.videoFile.size > 104857600 ? Cr(new Ut({
  10835. code: qt.MESSAGE_VIDEO_SIZE_LIMIT,
  10836. message: "".concat(an)
  10837. })) : 0 === e.file.videoFile.size ? Cr(new Ut({
  10838. code: qt.MESSAGE_FILE_IS_EMPTY,
  10839. message: "".concat(Xt)
  10840. })) : -1 === $n.indexOf(e.file.videoFile.type) ? Cr(new Ut({
  10841. code: qt.MESSAGE_VIDEO_TYPES_LIMIT,
  10842. message: "".concat(un)
  10843. })) : V ? this.handleVideoUpload({
  10844. file: e.file.videoFile
  10845. }) : G ? this.handleVideoUpload(e) : void 0;
  10846. }
  10847. }, {
  10848. key: "handleVideoUpload",
  10849. value: function (e) {
  10850. var t = this;
  10851. return new Promise(function (n, o) {
  10852. t.upload(e).then(function (e) {
  10853. n(e);
  10854. }).catch(function () {
  10855. t.upload(e).then(function (e) {
  10856. n(e);
  10857. }).catch(function () {
  10858. o(new Ut({
  10859. code: qt.MESSAGE_VIDEO_UPLOAD_FAIL,
  10860. message: sn
  10861. }));
  10862. });
  10863. });
  10864. });
  10865. }
  10866. }, {
  10867. key: "uploadAudio",
  10868. value: function (e) {
  10869. return e.file ? e.file.size > 20971520 ? Cr(new Ut({
  10870. code: qt.MESSAGE_AUDIO_SIZE_LIMIT,
  10871. message: "".concat(rn)
  10872. })) : 0 === e.file.size ? Cr(new Ut({
  10873. code: qt.MESSAGE_FILE_IS_EMPTY,
  10874. message: "".concat(Xt)
  10875. })) : this.upload(e) : Cr(new Ut({
  10876. code: qt.MESSAGE_AUDIO_UPLOAD_FAIL,
  10877. message: on
  10878. }));
  10879. }
  10880. }, {
  10881. key: "upload",
  10882. value: function (e) {
  10883. var t = this;
  10884. if (!Ee(this._cosUploadMethod)) return de.warn("UploadController.upload 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#registerPlugin"), Cr(new Ut({
  10885. code: qt.COS_UNDETECTED,
  10886. message: $t
  10887. }));
  10888. var n = new qr(Yr);
  10889. de.time(Ur);
  10890. var o = V ? e.file : e.file.files[0];
  10891. return new Promise(function (r, i) {
  10892. var s = V ? t._createCosOptionsWXMiniApp(e) : t._createCosOptionsWeb(e),
  10893. a = t;
  10894. t._cosUploadMethod(s, function (e, s) {
  10895. var u = Object.create(null);
  10896. if (s) {
  10897. if (e || Ie(s.files) && s.files[0].error) {
  10898. var c = new Ut({
  10899. code: qt.MESSAGE_FILE_UPLOAD_FAIL,
  10900. message: cn
  10901. });
  10902. return n.setError(c, !0, t.getNetworkType()).setEnd(), de.log("UploadController.upload failed, error:", s.files[0].error), 403 === s.files[0].error.statusCode && (de.warn("UploadController.upload failed. cos AccessKeyId was invalid, regain auth key!"), t._getAuthorizationKey()), void i(c);
  10903. }
  10904. u.fileName = o.name, u.fileSize = o.size, u.fileType = o.type.slice(o.type.indexOf("/") + 1).toLowerCase(), u.location = V ? s.Location : s.files[0].data.Location;
  10905. var l = de.timeEnd(Ur),
  10906. p = a._formatFileSize(o.size),
  10907. g = a._formatSpeed(1e3 * o.size / l),
  10908. h = "size=".concat(p, ",time=").concat(l, "ms,speed=").concat(g);
  10909. return de.log("UploadController.upload success name=".concat(o.name, ",").concat(h)), r(u), void n.setNetworkType(t.getNetworkType()).setText(h).setEnd();
  10910. }
  10911. var d = new Ut({
  10912. code: qt.MESSAGE_FILE_UPLOAD_FAIL,
  10913. message: cn
  10914. });
  10915. n.setError(d, !0, a.getNetworkType()).setEnd(), de.warn("UploadController.upload failed, error:", e), 403 === e.statusCode && (de.warn("UploadController.upload failed. cos AccessKeyId was invalid, regain auth key!"), t._getAuthorizationKey()), i(d);
  10916. });
  10917. });
  10918. }
  10919. }, {
  10920. key: "_formatFileSize",
  10921. value: function (e) {
  10922. return e < 1024 ? e + "B" : e < 1048576 ? Math.floor(e / 1024) + "KB" : Math.floor(e / 1048576) + "MB";
  10923. }
  10924. }, {
  10925. key: "_formatSpeed",
  10926. value: function (e) {
  10927. return e <= 1048576 ? (e / 1024).toFixed(1) + "KB/s" : (e / 1048576).toFixed(1) + "MB/s";
  10928. }
  10929. }, {
  10930. key: "_createCosOptionsWeb",
  10931. value: function (e) {
  10932. var t = this.tim.context.identifier,
  10933. n = this._genFileName(t, e.to, e.file.files[0].name);
  10934. return {
  10935. files: [{
  10936. Bucket: "".concat(this.bucketName, "-").concat(this.appid),
  10937. Region: this.region,
  10938. Key: "".concat(this.directory, "/").concat(n),
  10939. Body: e.file.files[0]
  10940. }],
  10941. SliceSize: 1048576,
  10942. onProgress: function (t) {
  10943. if ("function" == typeof e.onProgress) try {
  10944. e.onProgress(t.percent);
  10945. } catch (n) {
  10946. de.warn("onProgress callback error:", n), de.error(n);
  10947. }
  10948. },
  10949. onFileFinish: function (e, t, n) {}
  10950. };
  10951. }
  10952. }, {
  10953. key: "_createCosOptionsWXMiniApp",
  10954. value: function (e) {
  10955. var t = this.tim.context.identifier,
  10956. n = this._genFileName(t, e.to, e.file.name),
  10957. o = e.file.url;
  10958. return {
  10959. Bucket: "".concat(this.bucketName, "-").concat(this.appid),
  10960. Region: this.region,
  10961. Key: "".concat(this.directory, "/").concat(n),
  10962. FilePath: o,
  10963. onProgress: function (t) {
  10964. if (de.log(JSON.stringify(t)), "function" == typeof e.onProgress) try {
  10965. e.onProgress(t.percent);
  10966. } catch (n) {
  10967. de.warn("onProgress callback error:", n), de.error(n);
  10968. }
  10969. }
  10970. };
  10971. }
  10972. }, {
  10973. key: "_genFileName",
  10974. value: function (e, t, n) {
  10975. return "".concat(e, "-").concat(t, "-").concat(we(99999), "-").concat(n);
  10976. }
  10977. }, {
  10978. key: "reset",
  10979. value: function () {
  10980. this._timer && (clearInterval(this._timer), this._timer = 0);
  10981. }
  10982. }]), n;
  10983. }(mr),
  10984. Fs = function (e) {
  10985. c(r, e);
  10986. var n = v(r);
  10987. function r(e) {
  10988. var t;
  10989. return o(this, r), (t = n.call(this, e)).FILETYPE = {
  10990. SOUND: 2106,
  10991. FILE: 2107,
  10992. VIDEO: 2113
  10993. }, t._bdh_download_server = "grouptalk.c2c.qq.com", t._BDHBizID = 10001, t._authKey = "", t._expireTime = 0, t.tim.innerEmitter.on(Mo, t._getAuthKey, f(t)), t;
  10994. }
  10995. return i(r, [{
  10996. key: "_getAuthKey",
  10997. value: function () {
  10998. var e = this;
  10999. this.request({
  11000. name: "bigDataHallwayAuthKey",
  11001. action: "query"
  11002. }).then(function (t) {
  11003. t.data.authKey && (e._authKey = t.data.authKey, e._expireTime = parseInt(t.data.expireTime));
  11004. });
  11005. }
  11006. }, {
  11007. key: "_isFromOlderVersion",
  11008. value: function (e) {
  11009. return 2 !== e.content.downloadFlag;
  11010. }
  11011. }, {
  11012. key: "parseElements",
  11013. value: function (e, t) {
  11014. if (!Ie(e) || !t) return [];
  11015. for (var n = [], o = null, r = 0; r < e.length; r++) o = e[r], this._needParse(o) ? n.push(this._parseElement(o, t)) : n.push(e[r]);
  11016. return n;
  11017. }
  11018. }, {
  11019. key: "_needParse",
  11020. value: function (e) {
  11021. return !(!this._isFromOlderVersion(e) || e.type !== t.MSG_AUDIO && e.type !== t.MSG_FILE && e.type !== t.MSG_VIDEO);
  11022. }
  11023. }, {
  11024. key: "_parseElement",
  11025. value: function (e, n) {
  11026. switch (e.type) {
  11027. case t.MSG_AUDIO:
  11028. return this._parseAudioElement(e, n);
  11029. case t.MSG_FILE:
  11030. return this._parseFileElement(e, n);
  11031. case t.MSG_VIDEO:
  11032. return this._parseVideoElement(e, n);
  11033. }
  11034. }
  11035. }, {
  11036. key: "_parseAudioElement",
  11037. value: function (e, t) {
  11038. return e.content.url = this._genAudioUrl(e.content.uuid, t), e;
  11039. }
  11040. }, {
  11041. key: "_parseFileElement",
  11042. value: function (e, t) {
  11043. return e.content.url = this._genFileUrl(e.content.uuid, t, e.content.fileName), e;
  11044. }
  11045. }, {
  11046. key: "_parseVideoElement",
  11047. value: function (e, t) {
  11048. return e.content.url = this._genVideoUrl(e.content.uuid, t), e;
  11049. }
  11050. }, {
  11051. key: "_genAudioUrl",
  11052. value: function (e, t) {
  11053. return "" === this._authKey ? (de.warn("BigDataHallwayController._genAudioUrl no authKey!"), "") : "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(this.tim.context.SDKAppID, "&fileid=").concat(e, "&filetype=").concat(this.FILETYPE.SOUND, "&openid=").concat(t, "&ver=0");
  11054. }
  11055. }, {
  11056. key: "_genFileUrl",
  11057. value: function (e, t, n) {
  11058. return "" === this._authKey ? (de.warn("BigDataHallwayController._genFileUrl no authKey!"), "") : (n || (n = "".concat(Math.floor(1e5 * Math.random()), "-").concat(Date.now())), "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(this.tim.context.SDKAppID, "&fileid=").concat(e, "&filetype=").concat(this.FILETYPE.FILE, "&openid=").concat(t, "&ver=0&filename=").concat(encodeURIComponent(n)));
  11059. }
  11060. }, {
  11061. key: "_genVideoUrl",
  11062. value: function (e, t) {
  11063. return "" === this._authKey ? (de.warn("BigDataHallwayController._genVideoUrl no authKey!"), "") : "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(this.tim.context.SDKAppID, "&fileid=").concat(e, "&filetype=").concat(this.FILETYPE.VIDEO, "&openid=").concat(t, "&ver=0");
  11064. }
  11065. }, {
  11066. key: "reset",
  11067. value: function () {
  11068. this._authKey = "", this.expireTime = 0;
  11069. }
  11070. }]), r;
  11071. }(mr);
  11072. var xs = {
  11073. app_id: "",
  11074. event_id: "",
  11075. api_base: "https://pingtas.qq.com/pingd",
  11076. prefix: "_mta_",
  11077. version: "1.3.9",
  11078. stat_share_app: !1,
  11079. stat_pull_down_fresh: !1,
  11080. stat_reach_bottom: !1,
  11081. stat_param: !0
  11082. };
  11083. function Vs() {
  11084. try {
  11085. var e = "s" + Ks();
  11086. return uni.setStorageSync(xs.prefix + "ssid", e), e;
  11087. } catch (t) {}
  11088. }
  11089. function Ks(e) {
  11090. for (var t = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], n = 10; 1 < n; n--) {
  11091. var o = Math.floor(10 * Math.random()),
  11092. r = t[o];
  11093. t[o] = t[n - 1], t[n - 1] = r;
  11094. }
  11095. for (n = o = 0; 5 > n; n++) o = 10 * o + t[n];
  11096. return (e || "") + (o + "") + +new Date();
  11097. }
  11098. function Hs() {
  11099. try {
  11100. var e = getCurrentPages(),
  11101. t = "/";
  11102. return 0 < e.length && (t = e.pop().__route__), t;
  11103. } catch (n) {
  11104. console.log("get current page path error:" + n);
  11105. }
  11106. }
  11107. function Bs() {
  11108. var e,
  11109. t = {
  11110. dm: "wechat.apps.xx",
  11111. url: encodeURIComponent(Hs() + Ys(zs.Data.pageQuery)),
  11112. pvi: "",
  11113. si: "",
  11114. ty: 0
  11115. };
  11116. return t.pvi = ((e = function () {
  11117. try {
  11118. return uni.getStorageSync(xs.prefix + "auid");
  11119. } catch (t) {}
  11120. }()) || (e = function () {
  11121. try {
  11122. var t = Ks();
  11123. return uni.setStorageSync(xs.prefix + "auid", t), t;
  11124. } catch (e) {}
  11125. }(), t.ty = 1), e), t.si = function () {
  11126. var e = function () {
  11127. try {
  11128. return uni.getStorageSync(xs.prefix + "ssid");
  11129. } catch (e) {}
  11130. }();
  11131. return e || (e = Vs()), e;
  11132. }(), t;
  11133. }
  11134. function js() {
  11135. var e = function () {
  11136. var e = uni.getSystemInfoSync();
  11137. return {
  11138. adt: encodeURIComponent(e.model),
  11139. scl: e.pixelRatio,
  11140. scr: e.windowWidth + "x" + e.windowHeight,
  11141. lg: e.language,
  11142. fl: e.version,
  11143. jv: encodeURIComponent(e.system),
  11144. tz: encodeURIComponent(e.platform)
  11145. };
  11146. }();
  11147. return function (e) {
  11148. uni.getNetworkType({
  11149. success: function (t) {
  11150. e(t.networkType);
  11151. }
  11152. });
  11153. }(function (e) {
  11154. try {
  11155. uni.setStorageSync(xs.prefix + "ntdata", e);
  11156. } catch (t) {}
  11157. }), e.ct = uni.getStorageSync(xs.prefix + "ntdata") || "4g", e;
  11158. }
  11159. function $s() {
  11160. var e,
  11161. t = zs.Data.userInfo,
  11162. n = [];
  11163. for (e in t) t.hasOwnProperty(e) && n.push(e + "=" + t[e]);
  11164. return t = n.join(";"), {
  11165. r2: xs.app_id,
  11166. r4: "wx",
  11167. ext: "v=" + xs.version + (null !== t && "" !== t ? ";ui=" + encodeURIComponent(t) : "")
  11168. };
  11169. }
  11170. function Ys(e) {
  11171. if (!xs.stat_param || !e) return "";
  11172. e = function (e) {
  11173. if (1 > xs.ignore_params.length) return e;
  11174. var t,
  11175. n = {};
  11176. for (t in e) 0 <= xs.ignore_params.indexOf(t) || (n[t] = e[t]);
  11177. return n;
  11178. }(e);
  11179. var t,
  11180. n = [];
  11181. for (t in e) n.push(t + "=" + e[t]);
  11182. return 0 < n.length ? "?" + n.join("&") : "";
  11183. }
  11184. var zs = {
  11185. App: {
  11186. init: function (e) {
  11187. "appID" in e && (xs.app_id = e.appID), "eventID" in e && (xs.event_id = e.eventID), "statShareApp" in e && (xs.stat_share_app = e.statShareApp), "statPullDownFresh" in e && (xs.stat_pull_down_fresh = e.statPullDownFresh), "statReachBottom" in e && (xs.stat_reach_bottom = e.statReachBottom), "ignoreParams" in e && (xs.ignore_params = e.ignoreParams), "statParam" in e && (xs.stat_param = e.statParam), Vs();
  11188. try {
  11189. "lauchOpts" in e && (zs.Data.lanchInfo = e.lauchOpts, zs.Data.lanchInfo.landing = 1);
  11190. } catch (t) {}
  11191. "autoReport" in e && e.autoReport && function () {
  11192. var e = Page;
  11193. Page = function (t) {
  11194. var n = t.onLoad;
  11195. t.onLoad = function (e) {
  11196. n && n.call(this, e), zs.Data.lastPageQuery = zs.Data.pageQuery, zs.Data.pageQuery = e, zs.Data.lastPageUrl = zs.Data.pageUrl, zs.Data.pageUrl = Hs(), zs.Data.show = !1, zs.Page.init();
  11197. }, e(t);
  11198. };
  11199. }();
  11200. }
  11201. },
  11202. Page: {
  11203. init: function () {
  11204. var e,
  11205. t = getCurrentPages()[getCurrentPages().length - 1];
  11206. t.onShow && (e = t.onShow, t.onShow = function () {
  11207. if (!0 === zs.Data.show) {
  11208. var t = zs.Data.lastPageQuery;
  11209. zs.Data.lastPageQuery = zs.Data.pageQuery, zs.Data.pageQuery = t, zs.Data.lastPageUrl = zs.Data.pageUrl, zs.Data.pageUrl = Hs();
  11210. }
  11211. zs.Data.show = !0, zs.Page.stat(), e.apply(this, arguments);
  11212. }), xs.stat_pull_down_fresh && t.onPullDownRefresh && function () {
  11213. var e = t.onPullDownRefresh;
  11214. t.onPullDownRefresh = function () {
  11215. zs.Event.stat(xs.prefix + "pulldownfresh", {
  11216. url: t.__route__
  11217. }), e.apply(this, arguments);
  11218. };
  11219. }(), xs.stat_reach_bottom && t.onReachBottom && function () {
  11220. var e = t.onReachBottom;
  11221. t.onReachBottom = function () {
  11222. zs.Event.stat(xs.prefix + "reachbottom", {
  11223. url: t.__route__
  11224. }), e.apply(this, arguments);
  11225. };
  11226. }(), xs.stat_share_app && t.onShareAppMessage && function () {
  11227. var e = t.onShareAppMessage;
  11228. t.onShareAppMessage = function () {
  11229. return zs.Event.stat(xs.prefix + "shareapp", {
  11230. url: t.__route__
  11231. }), e.apply(this, arguments);
  11232. };
  11233. }();
  11234. },
  11235. multiStat: function (e, t) {
  11236. if (1 == t) zs.Page.stat(e);else {
  11237. var n = getCurrentPages()[getCurrentPages().length - 1];
  11238. n.onShow && function () {
  11239. var t = n.onShow;
  11240. n.onShow = function () {
  11241. zs.Page.stat(e), t.call(this, arguments);
  11242. };
  11243. }();
  11244. }
  11245. },
  11246. stat: function (e) {
  11247. if ("" != xs.app_id) {
  11248. var t = [],
  11249. n = $s();
  11250. if (e && (n.r2 = e), e = [Bs(), n, js()], zs.Data.lanchInfo) {
  11251. e.push({
  11252. ht: zs.Data.lanchInfo.scene
  11253. }), zs.Data.pageQuery && zs.Data.pageQuery._mta_ref_id && e.push({
  11254. rarg: zs.Data.pageQuery._mta_ref_id
  11255. });
  11256. try {
  11257. 1 == zs.Data.lanchInfo.landing && (n.ext += ";lp=1", zs.Data.lanchInfo.landing = 0);
  11258. } catch (i) {}
  11259. }
  11260. e.push({
  11261. rdm: "/",
  11262. rurl: 0 >= zs.Data.lastPageUrl.length ? zs.Data.pageUrl + Ys(zs.Data.lastPageQuery) : encodeURIComponent(zs.Data.lastPageUrl + Ys(zs.Data.lastPageQuery))
  11263. }), e.push({
  11264. rand: +new Date()
  11265. }), n = 0;
  11266. for (var o = e.length; n < o; n++) for (var r in e[n]) e[n].hasOwnProperty(r) && t.push(r + "=" + (void 0 === e[n][r] ? "" : e[n][r]));
  11267. uni.request({
  11268. url: xs.api_base + "?" + t.join("&").toLowerCase()
  11269. });
  11270. }
  11271. }
  11272. },
  11273. Event: {
  11274. stat: function (e, t) {
  11275. if ("" != xs.event_id) {
  11276. var n = [],
  11277. o = Bs(),
  11278. r = $s();
  11279. o.dm = "wxapps.click", o.url = e, r.r2 = xs.event_id;
  11280. var i,
  11281. s = void 0 === t ? {} : t,
  11282. a = [];
  11283. for (i in s) s.hasOwnProperty(i) && a.push(encodeURIComponent(i) + "=" + encodeURIComponent(s[i]));
  11284. for (s = a.join(";"), r.r5 = s, s = 0, r = (o = [o, r, js(), {
  11285. rand: +new Date()
  11286. }]).length; s < r; s++) for (var u in o[s]) o[s].hasOwnProperty(u) && n.push(u + "=" + (void 0 === o[s][u] ? "" : o[s][u]));
  11287. uni.request({
  11288. url: xs.api_base + "?" + n.join("&").toLowerCase()
  11289. });
  11290. }
  11291. }
  11292. },
  11293. Data: {
  11294. userInfo: null,
  11295. lanchInfo: null,
  11296. pageQuery: null,
  11297. lastPageQuery: null,
  11298. pageUrl: "",
  11299. lastPageUrl: "",
  11300. show: !1
  11301. }
  11302. },
  11303. Ws = zs,
  11304. Js = function () {
  11305. function e() {
  11306. o(this, e);
  11307. try {
  11308. Ws.App.init({
  11309. appID: "500690995",
  11310. eventID: "500691014",
  11311. autoReport: !1,
  11312. statParam: !0
  11313. });
  11314. } catch (t) {}
  11315. }
  11316. return i(e, [{
  11317. key: "report",
  11318. value: function (e, t) {
  11319. try {
  11320. Ws.Event.stat(e, t);
  11321. } catch (n) {}
  11322. }
  11323. }, {
  11324. key: "stat",
  11325. value: function () {
  11326. try {
  11327. Ws.Page.stat();
  11328. } catch (e) {}
  11329. }
  11330. }]), e;
  11331. }(),
  11332. Xs = function (e) {
  11333. c(n, e);
  11334. var t = v(n);
  11335. function n(e) {
  11336. var r;
  11337. o(this, n), (r = t.call(this, e)).MTA = new Js();
  11338. var i = r.tim.innerEmitter;
  11339. return i.on(ar, r._stat, f(r)), i.on(sr, r._stat, f(r)), r;
  11340. }
  11341. return i(n, [{
  11342. key: "_stat",
  11343. value: function () {
  11344. this.MTA.report("sdkappid", {
  11345. value: this.tim.context.SDKAppID
  11346. }), this.MTA.report("version", {
  11347. value: "2.9.1"
  11348. }), this.MTA.stat();
  11349. }
  11350. }]), n;
  11351. }(mr),
  11352. Qs = function () {
  11353. function e(t) {
  11354. o(this, e), this._table = "timwebii", this._report = [];
  11355. }
  11356. return i(e, [{
  11357. key: "pushIn",
  11358. value: function (e) {
  11359. de.debug("SSOLogBody.pushIn", this._report.length, e), this._report.push(e);
  11360. }
  11361. }, {
  11362. key: "backfill",
  11363. value: function (e) {
  11364. var t;
  11365. Ie(e) && 0 !== e.length && (de.debug("SSOLogBody.backfill", this._report.length, e.length), (t = this._report).unshift.apply(t, I(e)));
  11366. }
  11367. }, {
  11368. key: "getLogsNumInMemory",
  11369. value: function () {
  11370. return this._report.length;
  11371. }
  11372. }, {
  11373. key: "isEmpty",
  11374. value: function () {
  11375. return 0 === this._report.length;
  11376. }
  11377. }, {
  11378. key: "_reset",
  11379. value: function () {
  11380. this._report.length = 0, this._report = [];
  11381. }
  11382. }, {
  11383. key: "getTable",
  11384. value: function () {
  11385. return this._table;
  11386. }
  11387. }, {
  11388. key: "getLogsInMemory",
  11389. value: function () {
  11390. var e = this._report.slice();
  11391. return this._reset(), e;
  11392. }
  11393. }]), e;
  11394. }(),
  11395. Zs = function (e) {
  11396. c(n, e);
  11397. var t = v(n);
  11398. function n(e) {
  11399. var r;
  11400. return o(this, n), (r = t.call(this, e)).TAG = "im-ssolog-event", r._reportBody = new Qs(), r._version = "2.9.1", r.MIN_THRESHOLD = 20, r.MAX_THRESHOLD = 100, r.WAITING_TIME = 6e4, r.INTERVAL = 2e4, r._timerID = 0, r._resetLastReportTime(), r._startReportTimer(), r._retryCount = 0, r.MAX_RETRY_COUNT = 3, r.tim.innerEmitter.on(Jo, r._onLoginSuccess, f(r)), r;
  11401. }
  11402. return i(n, [{
  11403. key: "reportAtOnce",
  11404. value: function () {
  11405. de.debug("EventStatController.reportAtOnce"), this._report();
  11406. }
  11407. }, {
  11408. key: "_onLoginSuccess",
  11409. value: function () {
  11410. var e = this,
  11411. t = this.tim.storage,
  11412. n = t.getItem(this.TAG, !1);
  11413. !Xe(n) && Ee(n.forEach) && (de.log("EventStatController._onLoginSuccess get ssolog in storage, nums=" + n.length), n.forEach(function (t) {
  11414. e._reportBody.pushIn(t);
  11415. }), t.removeItem(this.TAG, !1));
  11416. }
  11417. }, {
  11418. key: "pushIn",
  11419. value: function (e) {
  11420. e instanceof qr && (e.setCommonInfo({
  11421. SDKAppID: this.tim.context.SDKAppID,
  11422. version: this._version,
  11423. tinyID: this.tim.context.tinyID,
  11424. userID: this.tim.loginInfo.identifier,
  11425. platform: this.getPlatform(),
  11426. scene: this.tim.context.scene,
  11427. instanceID: this.tim.context.instanceID
  11428. }), this._reportBody.pushIn(e), this._reportBody.getLogsNumInMemory() >= this.MIN_THRESHOLD && this._report());
  11429. }
  11430. }, {
  11431. key: "_resetLastReportTime",
  11432. value: function () {
  11433. this._lastReportTime = Date.now();
  11434. }
  11435. }, {
  11436. key: "_startReportTimer",
  11437. value: function () {
  11438. var e = this;
  11439. this._timerID = setInterval(function () {
  11440. Date.now() < e._lastReportTime + e.WAITING_TIME || e._reportBody.isEmpty() || e._report();
  11441. }, this.INTERVAL);
  11442. }
  11443. }, {
  11444. key: "_stopReportTimer",
  11445. value: function () {
  11446. this._timerID > 0 && (clearInterval(this._timerID), this._timerID = 0);
  11447. }
  11448. }, {
  11449. key: "_report",
  11450. value: function () {
  11451. var e = this;
  11452. if (!this._reportBody.isEmpty()) {
  11453. var t = this._reportBody.getLogsInMemory();
  11454. this.request({
  11455. name: "ssoEventStat",
  11456. action: "create",
  11457. param: {
  11458. table: this._reportBody.getTable(),
  11459. report: t
  11460. }
  11461. }).then(function () {
  11462. e._resetLastReportTime(), e._retryCount > 0 && (de.debug("EventStatController.report retry success"), e._retryCount = 0);
  11463. }).catch(function (n) {
  11464. if (de.warn("EventStatController.report, networkType:".concat(e.getNetworkType(), " error:").concat(Re(n))), e._reportBody.backfill(t), e._reportBody.getLogsNumInMemory() > e.MAX_THRESHOLD || e._retryCount === e.MAX_RETRY_COUNT || 0 === e._timerID) return e._retryCount = 0, void e._flushAtOnce();
  11465. e._retryCount += 1;
  11466. });
  11467. }
  11468. }
  11469. }, {
  11470. key: "_flushAtOnce",
  11471. value: function () {
  11472. var e = this.tim.storage,
  11473. t = e.getItem(this.TAG, !1),
  11474. n = this._reportBody.getLogsInMemory();
  11475. if (Xe(t)) de.log("EventStatController._flushAtOnce nums=" + n.length), e.setItem(this.TAG, n, !0, !1);else {
  11476. var o = n.concat(t);
  11477. o.length > this.MAX_THRESHOLD && (o = o.slice(0, this.MAX_THRESHOLD)), de.log("EventStatController._flushAtOnce nums=" + o.length), e.setItem(this.TAG, o, !0, !1);
  11478. }
  11479. }
  11480. }, {
  11481. key: "reset",
  11482. value: function () {
  11483. de.log("EventStatController.reset"), this._stopReportTimer(), this._report();
  11484. }
  11485. }]), n;
  11486. }(mr),
  11487. ea = "none",
  11488. ta = "online",
  11489. na = function () {
  11490. function e() {
  11491. o(this, e), this._networkType = "", this.maxWaitTime = 3e3;
  11492. }
  11493. return i(e, [{
  11494. key: "start",
  11495. value: function () {
  11496. var e = this;
  11497. V ? (K.getNetworkType({
  11498. success: function (t) {
  11499. e._networkType = t.networkType, t.networkType === ea ? de.warn("NetMonitor no network, please check!") : de.info("NetMonitor networkType:".concat(t.networkType));
  11500. }
  11501. }), K.onNetworkStatusChange(this._onNetworkStatusChange.bind(this))) : this._networkType = ta;
  11502. }
  11503. }, {
  11504. key: "_onNetworkStatusChange",
  11505. value: function (e) {
  11506. this._networkType = e.networkType, e.isConnected ? de.info("NetMonitor networkType:".concat(e.networkType)) : de.warn("NetMonitor no network, please check!");
  11507. }
  11508. }, {
  11509. key: "probe",
  11510. value: function () {
  11511. var e = this;
  11512. return new Promise(function (t, n) {
  11513. if (V) K.getNetworkType({
  11514. success: function (n) {
  11515. e._networkType = n.networkType, n.networkType === ea ? (de.warn("NetMonitor no network, please check!"), t([!1, n.networkType])) : (de.info("NetMonitor networkType:".concat(n.networkType)), t([!0, n.networkType]));
  11516. }
  11517. });else if (window && window.fetch) fetch("".concat(qe(), "//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=").concat(Math.random())).then(function (e) {
  11518. e.ok ? t([!0, ta]) : t([!1, ea]);
  11519. }).catch(function (e) {
  11520. t([!1, ea]);
  11521. });else {
  11522. var o = new XMLHttpRequest(),
  11523. r = setTimeout(function () {
  11524. de.warn("NetMonitor fetch timeout. Probably no network, please check!"), o.abort(), e._networkType = ea, t([!1, ea]);
  11525. }, e.maxWaitTime);
  11526. o.onreadystatechange = function () {
  11527. 4 === o.readyState && (clearTimeout(r), 200 === o.status || 304 === o.status ? (this._networkType = ta, t([!0, ta])) : (de.warn("NetMonitor fetch status:".concat(o.status, ". Probably no network, please check!")), this._networkType = ea, t([!1, ea])));
  11528. }, o.open("GET", "".concat(qe(), "//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=").concat(Math.random())), o.send();
  11529. }
  11530. });
  11531. }
  11532. }, {
  11533. key: "getNetworkType",
  11534. value: function () {
  11535. return this._networkType;
  11536. }
  11537. }, {
  11538. key: "reset",
  11539. value: function () {
  11540. this._networkType = "";
  11541. }
  11542. }]), e;
  11543. }(),
  11544. oa = function () {
  11545. function e(t) {
  11546. var n = this;
  11547. o(this, e), Ie(t) ? (this._map = new Map(), t.forEach(function (e) {
  11548. n._map.set(e, []);
  11549. })) : de.warn("AverageCalculator.constructor need keys");
  11550. }
  11551. return i(e, [{
  11552. key: "push",
  11553. value: function (e, t) {
  11554. return !(Me(e) || !this._map.has(e) || !fe(t)) && (this._map.get(e).push(t), !0);
  11555. }
  11556. }, {
  11557. key: "getSize",
  11558. value: function (e) {
  11559. return Me(e) || !this._map.has(e) ? -1 : this._map.get(e).length;
  11560. }
  11561. }, {
  11562. key: "getAvg",
  11563. value: function (e) {
  11564. if (Me(e) || !this._map.has(e)) return -1;
  11565. var t = this._map.get(e),
  11566. n = t.length;
  11567. if (0 === n) return 0;
  11568. var o = 0;
  11569. return t.forEach(function (e) {
  11570. o += e;
  11571. }), t.length = 0, this._map.set(e, []), parseInt(o / n);
  11572. }
  11573. }, {
  11574. key: "getMax",
  11575. value: function (e) {
  11576. return Me(e) || !this._map.has(e) ? -1 : Math.max.apply(null, this._map.get(e));
  11577. }
  11578. }, {
  11579. key: "getMin",
  11580. value: function (e) {
  11581. return Me(e) || !this._map.has(e) ? -1 : Math.min.apply(null, this._map.get(e));
  11582. }
  11583. }, {
  11584. key: "reset",
  11585. value: function () {
  11586. this._map.forEach(function (e) {
  11587. e.length = 0;
  11588. });
  11589. }
  11590. }]), e;
  11591. }(),
  11592. ra = function () {
  11593. function e(t) {
  11594. var n = this;
  11595. o(this, e), Ie(t) ? (this._map = new Map(), t.forEach(function (e) {
  11596. n._map.set(e, {
  11597. totalCount: 0,
  11598. successCount: 0
  11599. });
  11600. })) : de.warn("SuccessRateCalculator.constructor need keys");
  11601. }
  11602. return i(e, [{
  11603. key: "addTotalCount",
  11604. value: function (e) {
  11605. return !(Me(e) || !this._map.has(e)) && (this._map.get(e).totalCount += 1, !0);
  11606. }
  11607. }, {
  11608. key: "addSuccessCount",
  11609. value: function (e) {
  11610. return !(Me(e) || !this._map.has(e)) && (this._map.get(e).successCount += 1, !0);
  11611. }
  11612. }, {
  11613. key: "getSuccessRate",
  11614. value: function (e) {
  11615. if (Me(e) || !this._map.has(e)) return -1;
  11616. var t = this._map.get(e);
  11617. if (0 === t.totalCount) return 1;
  11618. var n = parseFloat((t.successCount / t.totalCount).toFixed(2));
  11619. return n > 1 && (n = 1), t.totalCount = t.successCount = 0, n;
  11620. }
  11621. }, {
  11622. key: "getTotalCount",
  11623. value: function (e) {
  11624. return Me(e) || !this._map.has(e) ? -1 : this._map.get(e).totalCount;
  11625. }
  11626. }, {
  11627. key: "reset",
  11628. value: function () {
  11629. this._map.forEach(function (e) {
  11630. e.totalCount = 0, e.successCount = 0;
  11631. });
  11632. }
  11633. }]), e;
  11634. }(),
  11635. ia = function (e) {
  11636. c(n, e);
  11637. var t = v(n);
  11638. function n(e) {
  11639. var r;
  11640. return o(this, n), (r = t.call(this, e)).TABLE = "timwebsum", r.TAG = "im-ssolog-sumstat", r._items = [Dr, Sr, kr, Ar, Or, Rr, Nr, Lr, wr, Pr], r._thresholdMap = new Map(), r._thresholdMap.set(Dr, 100), r._thresholdMap.set(Sr, 150), r._thresholdMap.set(kr, 15), r._thresholdMap.set(Ar, 6), r._thresholdMap.set(Or, 6), r._thresholdMap.set(Rr, 6), r._thresholdMap.set(Nr, 6), r._thresholdMap.set(Lr, 6), r._thresholdMap.set(wr, 50), r._thresholdMap.set(Pr, 50), r._lpID = "", r._platform = r.getPlatform(), r._lastReportTime = 0, r._statInfoArr = [], r._retryCount = 0, r._avgCalc = new oa(r._items), r._successRateCalc = new ra(r._items), r.tim.innerEmitter.on(Jo, r._onLoginSuccess, f(r)), r;
  11641. }
  11642. return i(n, [{
  11643. key: "_onLoginSuccess",
  11644. value: function () {
  11645. var e = this,
  11646. t = this.tim.storage,
  11647. n = t.getItem(this.TAG, !1);
  11648. !Xe(n) && Ee(n.forEach) && (de.log("SumStatController._onLoginSuccess get sumstatlog in storage, nums=" + n.length), n.forEach(function (t) {
  11649. e._statInfoArr.push(t);
  11650. }), t.removeItem(this.TAG, !1));
  11651. }
  11652. }, {
  11653. key: "recordLongPollingID",
  11654. value: function (e) {
  11655. this._lpID = e;
  11656. }
  11657. }, {
  11658. key: "addTotalCount",
  11659. value: function (e) {
  11660. this._successRateCalc.addTotalCount(e) ? 1 === this._successRateCalc.getTotalCount(e) && (this._lastReportTime = Date.now()) : de.warn("SumStatController.addTotalCount invalid key:", e);
  11661. }
  11662. }, {
  11663. key: "addSuccessCount",
  11664. value: function (e) {
  11665. this._successRateCalc.addSuccessCount(e) || de.warn("SumStatController.addSuccessCount invalid key:", e);
  11666. }
  11667. }, {
  11668. key: "addCost",
  11669. value: function (e, t) {
  11670. this._avgCalc.push(e, t) ? (de.debug("SumStatController.addCost", e, t, this._avgCalc.getSize(e)), this._avgCalc.getSize(e) >= this._thresholdMap.get(e) && this._report(e)) : de.warn("SumStatController.addCost invalid key or cost:", e, t);
  11671. }
  11672. }, {
  11673. key: "_getItemNum",
  11674. value: function (e) {
  11675. switch (e) {
  11676. case Dr:
  11677. return 1;
  11678. case Sr:
  11679. return 2;
  11680. case kr:
  11681. return 3;
  11682. case wr:
  11683. return 4;
  11684. case Pr:
  11685. return 5;
  11686. case Ar:
  11687. return 6;
  11688. case Or:
  11689. return 7;
  11690. case Rr:
  11691. return 8;
  11692. case Nr:
  11693. return 9;
  11694. case Lr:
  11695. return 10;
  11696. default:
  11697. return 100;
  11698. }
  11699. }
  11700. }, {
  11701. key: "_getStatInfo",
  11702. value: function (e) {
  11703. var t = null;
  11704. return this._avgCalc.getSize(e) > 0 && (t = {
  11705. SDKAppID: "".concat(this.tim.context.SDKAppID),
  11706. version: "".concat("2.9.1"),
  11707. tinyID: this.tim.context.tinyID,
  11708. userID: this.tim.loginInfo.identifier,
  11709. item: this._getItemNum(e),
  11710. lpID: e === Dr ? this._lpID : "",
  11711. platform: this._platform,
  11712. scene: this.tim.context.scene,
  11713. networkType: this.getNetworkType(),
  11714. total: this._successRateCalc.getTotalCount(e),
  11715. successRate: this._successRateCalc.getSuccessRate(e),
  11716. avg: this._avgCalc.getAvg(e),
  11717. timespan: Date.now() - this._lastReportTime,
  11718. time: Ne()
  11719. }), t;
  11720. }
  11721. }, {
  11722. key: "_report",
  11723. value: function (e) {
  11724. var t = this,
  11725. n = [],
  11726. o = null;
  11727. Me(e) ? this._items.forEach(function (e) {
  11728. null !== (o = t._getStatInfo(e)) && n.push(o);
  11729. }) : null !== (o = this._getStatInfo(e)) && n.push(o), de.debug("SumStatController._report", n), this._statInfoArr.length > 0 && (n = n.concat(this.statInfoArr), this._statInfoArr = []), this._doReport(n);
  11730. }
  11731. }, {
  11732. key: "_doReport",
  11733. value: function (e) {
  11734. var t = this;
  11735. Xe(e) ? de.warn("SumStatController._doReport statInfoArr is empty, do nothing") : this.request({
  11736. name: "ssoSumStat",
  11737. action: "create",
  11738. param: {
  11739. table: this.TABLE,
  11740. report: e
  11741. }
  11742. }).then(function () {
  11743. t._lastReportTime = Date.now(), t._retryCount > 0 && (de.debug("SumStatController._doReport retry success"), t._retryCount = 0);
  11744. }).catch(function (n) {
  11745. de.warn("SumStatController._doReport, online:".concat(t.getNetworkType(), " error:").concat(Re(n)), e), t._retryCount <= 1 ? setTimeout(function () {
  11746. de.info("SumStatController._doReport retry", e), t._retryCount += 1, t._doReport(e);
  11747. }, 5e3) : (t._retryCount = 0, t._statInfoArr = t._statInfoArr.concat(e), t._flushAtOnce());
  11748. });
  11749. }
  11750. }, {
  11751. key: "_flushAtOnce",
  11752. value: function () {
  11753. var e = this.tim.storage,
  11754. t = e.getItem(this.TAG, !1),
  11755. n = this._statInfoArr;
  11756. if (Xe(t)) de.log("SumStatController._flushAtOnce nums=" + n.length), e.setItem(this.TAG, n, !0, !1);else {
  11757. var o = n.concat(t);
  11758. o.length > 10 && (o = o.slice(0, 10)), de.log("SumStatController._flushAtOnce nums=" + o.length), e.setItem(this.TAG, o, !0, !1);
  11759. }
  11760. this._statInfoArr = [];
  11761. }
  11762. }, {
  11763. key: "reset",
  11764. value: function () {
  11765. de.info("SumStatController.reset"), this._report(), this._avgCalc.reset(), this._successRateCalc.reset();
  11766. }
  11767. }]), n;
  11768. }(mr),
  11769. sa = function () {
  11770. function t() {
  11771. o(this, t), this._funcMap = new Map();
  11772. }
  11773. return i(t, [{
  11774. key: "defense",
  11775. value: function (e, t) {
  11776. var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
  11777. if ("string" != typeof e) return null;
  11778. if (0 === e.length) return null;
  11779. if ("function" != typeof t) return null;
  11780. if (this._funcMap.has(e) && this._funcMap.get(e).has(t)) return this._funcMap.get(e).get(t);
  11781. this._funcMap.has(e) || this._funcMap.set(e, new Map());
  11782. var o = null;
  11783. return this._funcMap.get(e).has(t) ? o = this._funcMap.get(e).get(t) : (o = this._pack(e, t, n), this._funcMap.get(e).set(t, o)), o;
  11784. }
  11785. }, {
  11786. key: "defenseOnce",
  11787. value: function (e, t) {
  11788. var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
  11789. return "function" != typeof t ? null : this._pack(e, t, n);
  11790. }
  11791. }, {
  11792. key: "find",
  11793. value: function (e, t) {
  11794. return "string" != typeof e || 0 === e.length || "function" != typeof t ? null : this._funcMap.has(e) ? this._funcMap.get(e).has(t) ? this._funcMap.get(e).get(t) : (de.log("SafetyCallback.find: 找不到 func —— ".concat(e, "/").concat("" !== t.name ? t.name : "[anonymous]")), null) : (de.log("SafetyCallback.find: 找不到 eventName-".concat(e, " 对应的 func")), null);
  11795. }
  11796. }, {
  11797. key: "delete",
  11798. value: function (e, t) {
  11799. return "function" == typeof t && !!this._funcMap.has(e) && !!this._funcMap.get(e).has(t) && (this._funcMap.get(e).delete(t), 0 === this._funcMap.get(e).size && this._funcMap.delete(e), !0);
  11800. }
  11801. }, {
  11802. key: "_pack",
  11803. value: function (t, n, o) {
  11804. return function () {
  11805. try {
  11806. n.apply(o, Array.from(arguments));
  11807. } catch (a) {
  11808. var r = Object.values(e).indexOf(t);
  11809. if (-1 !== r) {
  11810. var i = Object.keys(e)[r];
  11811. de.warn("接入侧事件 TIM.EVENT.".concat(i, " 对应的回调函数逻辑存在问题,请检查!"), a);
  11812. }
  11813. var s = new qr(Hi);
  11814. s.setText("eventName=".concat(t)).setMessage(a.message).setEnd();
  11815. }
  11816. };
  11817. }
  11818. }]), t;
  11819. }(),
  11820. aa = function (e) {
  11821. c(n, e);
  11822. var t = v(n);
  11823. function n(e) {
  11824. var r;
  11825. return o(this, n), (r = t.call(this, e))._maybeLostSequencesMap = new Map(), r;
  11826. }
  11827. return i(n, [{
  11828. key: "onMessageMaybeLost",
  11829. value: function (e, t, n) {
  11830. this._maybeLostSequencesMap.has(e) || this._maybeLostSequencesMap.set(e, []);
  11831. for (var o = this._maybeLostSequencesMap.get(e), r = 0; r < n; r++) o.push(t + r);
  11832. de.debug("MessageLossController.onMessageMaybeLost. maybeLostSequences:".concat(o));
  11833. }
  11834. }, {
  11835. key: "detectMessageLoss",
  11836. value: function (e, t) {
  11837. var n = this._maybeLostSequencesMap.get(e);
  11838. if (!Xe(n) && !Xe(t)) {
  11839. var o = t.filter(function (e) {
  11840. return -1 !== n.indexOf(e);
  11841. });
  11842. if (de.debug("MessageLossController.detectMessageLoss. matchedSequences:".concat(o)), n.length === o.length) de.info("MessageLossController.detectMessageLoss no message loss. conversationID=".concat(e));else {
  11843. var r,
  11844. i = n.filter(function (e) {
  11845. return -1 === o.indexOf(e);
  11846. }),
  11847. s = i.length;
  11848. s <= 5 ? r = e + "-" + i.join("-") : (i.sort(function (e, t) {
  11849. return e - t;
  11850. }), r = e + " start:" + i[0] + " end:" + i[s - 1] + " count:" + s), new qr(Gi).setText(r).setNetworkType(this.getNetworkType()).setEnd(), de.warn("MessageLossController.detectMessageLoss message loss detected. conversationID:".concat(e, " lostSequences:").concat(i));
  11851. }
  11852. n.length = 0;
  11853. }
  11854. }
  11855. }, {
  11856. key: "reset",
  11857. value: function () {
  11858. de.log("MessageLossController.reset"), this._maybeLostSequencesMap.clear();
  11859. }
  11860. }]), n;
  11861. }(mr),
  11862. ua = function (e) {
  11863. c(r, e);
  11864. var n = v(r);
  11865. function r(e) {
  11866. var t;
  11867. return o(this, r), (t = n.call(this, e))._request = V ? new Yi() : new $i(), t;
  11868. }
  11869. return i(r, [{
  11870. key: "sendMessage",
  11871. value: function (e) {
  11872. var t = this,
  11873. n = this._constructMessageInstance(e);
  11874. if (null === n) return Cr({
  11875. code: qt.MESSAGE_SEND_FAIL,
  11876. message: Yt
  11877. });
  11878. var o = Date.now(),
  11879. r = Xe(e.GroupId) ? "openim/sendmsg" : "group_open_http_svc/send_group_msg",
  11880. i = this.tim.context,
  11881. s = i.a2Key,
  11882. a = i.tinyID,
  11883. u = i.SDKAppID,
  11884. c = i.identifier,
  11885. l = {
  11886. url: "https://" + (!0 === this.tim.context.oversea ? "api.im.qcloud.com" : "webim.tim.qq.com") + "/v4/" + r + "?platform=10&websdkappid=537048168&v=1.7.3&a2=" + s + "&tinyid=" + a + "&sdkappid=" + u + "&contentType=json&apn=1&reqtime=" + Date.now() + "tjg_id=" + this._generateTjgID(n),
  11887. data: e,
  11888. method: "POST"
  11889. };
  11890. this._addSendMessageTotalCount(n);
  11891. var p = new qr(Wr);
  11892. return p.setText("".concat(this._generateTjgID(n), "-").concat(n.from, "-").concat(n.to, "-").concat(n.getElements().length)), this._request.request(l).then(function (e) {
  11893. var r = e.data,
  11894. i = r.ErrorCode,
  11895. s = r.ErrorInfo;
  11896. if (0 !== i) return p.setCode(i).setMessage(s).setNetworkType(t.getNetworkType()).setEnd(), n.status = rt.FAIL, Cr(new Ut({
  11897. code: i,
  11898. message: s || Yt,
  11899. data: {
  11900. message: n
  11901. }
  11902. }));
  11903. t._addSendMessageSuccessCount(n, o), n.status = rt.SUCCESS;
  11904. var a = e.data,
  11905. u = a.MsgTime,
  11906. l = a.MsgSeq;
  11907. return n.time = u, l && (n.sequence = l), n.generateMessageID(c), t.tim.messageController.pushToMessageList(n), t.emitInnerEvent(Do, {
  11908. eventDataList: [{
  11909. conversationID: n.conversationID,
  11910. unreadCount: 0,
  11911. type: n.conversationType,
  11912. subType: n.conversationSubType,
  11913. lastMessage: n
  11914. }]
  11915. }), Mr(n);
  11916. }).catch(function (e) {
  11917. return t.probeNetwork().then(function (t) {
  11918. var n = y(t, 2),
  11919. o = n[0],
  11920. r = n[1];
  11921. p.setError(e, o, r).setEnd();
  11922. }), de.warn("ComboMessageController.sendMessage failed. error:", e), n.status = rt.FAIL, Cr(new Ut({
  11923. code: qt.MESSAGE_SEND_FAIL,
  11924. message: Yt,
  11925. data: {
  11926. message: n
  11927. }
  11928. }));
  11929. });
  11930. }
  11931. }, {
  11932. key: "_constructMessageInstance",
  11933. value: function (e) {
  11934. var n = null;
  11935. try {
  11936. var o = this.tim.context.identifier,
  11937. r = {};
  11938. r.currentUser = o, r.from = e.From_Account || o, e.GroupId ? (r.conversationID = "".concat(t.CONV_GROUP).concat(e.GroupId), r.conversationType = t.CONV_GROUP, r.to = e.GroupId) : e.To_Account && (r.conversationID = "".concat(t.CONV_C2C).concat(e.To_Account), r.conversationType = t.CONV_C2C, r.to = e.To_Account), r.time = e.MsgTimeStamp || 0, r.random = e.Random || e.MsgRandom || 0, r.priority = e.MsgPriority, (n = new Qn(r)).status = rt.UNSEND;
  11939. for (var i, s = e.MsgBody.length, a = 0; a < s; a++) "TIMTextElem" === (i = e.MsgBody[a]).MsgType ? n.setTextElement(i.MsgContent.Text) : "TIMCustomElem" === i.MsgType ? n.setCustomElement({
  11940. data: i.MsgContent.Data || "",
  11941. description: i.MsgContent.Desc || "",
  11942. extension: i.MsgContent.Ext || ""
  11943. }) : "TIMFaceElem" === i.MsgType && n.setFaceElement({
  11944. index: i.MsgContent.Index,
  11945. data: i.MsgContent.Data
  11946. });
  11947. var u = n.getElements();
  11948. n.payload = u[0].content, n.type = u[0].type;
  11949. } catch (c) {
  11950. n = null, de.error("ComboMessageController._constructMessageInstance failed. error:", c);
  11951. }
  11952. return n;
  11953. }
  11954. }, {
  11955. key: "_addSendMessageSuccessCount",
  11956. value: function (e, t) {
  11957. var n = this.tim.sumStatController,
  11958. o = Math.abs(Date.now() - t);
  11959. n.addSuccessCount(kr), n.addCost(kr, o);
  11960. var r = this._getSendMessageSpecifiedKey(e);
  11961. r && (n.addSuccessCount(r), n.addCost(r, o));
  11962. }
  11963. }, {
  11964. key: "_addSendMessageTotalCount",
  11965. value: function (e) {
  11966. var t = this.tim.sumStatController;
  11967. t.addTotalCount(kr);
  11968. var n = this._getSendMessageSpecifiedKey(e);
  11969. n && t.addTotalCount(n);
  11970. }
  11971. }, {
  11972. key: "_getSendMessageSpecifiedKey",
  11973. value: function (e) {
  11974. if (e.conversationType === t.CONV_C2C) return Ar;
  11975. if (e.conversationType === t.CONV_GROUP) {
  11976. var n = this.tim.groupController.getLocalGroupProfile(e.to);
  11977. if (!n) return;
  11978. var o = n.type;
  11979. if (Ve(o)) return Or;
  11980. if (Ke(o)) return Rr;
  11981. if (He(o)) return Nr;
  11982. if (Be(o)) return Lr;
  11983. }
  11984. }
  11985. }, {
  11986. key: "_generateTjgID",
  11987. value: function (e) {
  11988. return this.tim.context.tinyID + "-" + e.random;
  11989. }
  11990. }, {
  11991. key: "reset",
  11992. value: function () {
  11993. de.info("ComboMessageController.reset");
  11994. }
  11995. }]), r;
  11996. }(mr),
  11997. ca = function () {
  11998. function t(e) {
  11999. o(this, t);
  12000. var n = new qr(Fr);
  12001. dr.mixin(this), this._initOptions(e), this._initMemberVariables(), this._initControllers(), this._initListener(), qr.bindController(this.eventStatController), n.setText("instanceID=".concat(this.loginInfo.instanceID, "-oversea=").concat(this.loginInfo.oversea, "-mp=").concat(V, "-ua=").concat(B)).setEnd(), de.info("SDK instanceID:".concat(this.loginInfo.instanceID, " oversea:").concat(this.loginInfo.oversea, " inMiniApp:").concat(V, ", SDKAppID:").concat(e.SDKAppID, ", UserAgent:").concat(B)), this._safetyCallbackFactory = new sa();
  12002. }
  12003. return i(t, [{
  12004. key: "login",
  12005. value: function (e) {
  12006. return de.time(Er), this._ssoLog = new qr(xr), this.netMonitor.start(), this.loginInfo.identifier = e.identifier || e.userID, this.loginInfo.userSig = e.userSig, this.signController.login(this.loginInfo);
  12007. }
  12008. }, {
  12009. key: "logout",
  12010. value: function () {
  12011. var e = this.signController.logout();
  12012. return this.resetSDK(), e;
  12013. }
  12014. }, {
  12015. key: "on",
  12016. value: function (t, n, o) {
  12017. t === e.GROUP_SYSTEM_NOTICE_RECEIVED && de.warn("!!!TIM.EVENT.GROUP_SYSTEM_NOTICE_RECEIVED v2.6.0起弃用,为了更好的体验,请在 TIM.EVENT.MESSAGE_RECEIVED 事件回调内接收处理群系统通知,详细请参考:https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/Message.html#.GroupSystemNoticePayload"), de.debug("on", "eventName:".concat(t)), this.outerEmitter.on(t, this._safetyCallbackFactory.defense(t, n, o), o);
  12018. }
  12019. }, {
  12020. key: "once",
  12021. value: function (e, t, n) {
  12022. de.debug("once", "eventName:".concat(e)), this.outerEmitter.once(e, this._safetyCallbackFactory.defenseOnce(e, t, n), n || this);
  12023. }
  12024. }, {
  12025. key: "off",
  12026. value: function (e, t, n, o) {
  12027. de.debug("off", "eventName:".concat(e));
  12028. var r = this._safetyCallbackFactory.find(e, t);
  12029. null !== r && (this.outerEmitter.off(e, r, n, o), this._safetyCallbackFactory.delete(e, t));
  12030. }
  12031. }, {
  12032. key: "registerPlugin",
  12033. value: function (e) {
  12034. var t = this;
  12035. this.plugins || (this.plugins = {}), Object.keys(e).forEach(function (n) {
  12036. t.plugins[n] = e[n];
  12037. }), new qr(jr).setText("key=".concat(Object.keys(e))).setEnd();
  12038. }
  12039. }, {
  12040. key: "getPlugin",
  12041. value: function (e) {
  12042. return this.plugins[e] || void 0;
  12043. }
  12044. }, {
  12045. key: "setLogLevel",
  12046. value: function (e) {
  12047. if (e <= 0) {
  12048. console.log(["", " ________ ______ __ __ __ __ ________ _______", "| \\| \\| \\ / \\| \\ _ | \\| \\| \\", " \\$$$$$$$$ \\$$$$$$| $$\\ / $$| $$ / \\ | $$| $$$$$$$$| $$$$$$$\\", " | $$ | $$ | $$$\\ / $$$| $$/ $\\| $$| $$__ | $$__/ $$", " | $$ | $$ | $$$$\\ $$$$| $$ $$$\\ $$| $$ \\ | $$ $$", " | $$ | $$ | $$\\$$ $$ $$| $$ $$\\$$\\$$| $$$$$ | $$$$$$$\\", " | $$ _| $$_ | $$ \\$$$| $$| $$$$ \\$$$$| $$_____ | $$__/ $$", " | $$ | $$ \\| $$ \\$ | $$| $$$ \\$$$| $$ \\| $$ $$", " \\$$ \\$$$$$$ \\$$ \\$$ \\$$ \\$$ \\$$$$$$$$ \\$$$$$$$", "", ""].join("\n")), console.log("%cIM 智能客服,随时随地解决您的问题 →_→ https://cloud.tencent.com/act/event/smarty-service?from=im-doc", "color:#ff0000");
  12049. console.log(["", "参考以下文档,会更快解决问题哦!(#^.^#)\n", "SDK 更新日志: https://cloud.tencent.com/document/product/269/38492\n", "SDK 接口文档: https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html\n", "常见问题: https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/tutorial-01-faq.html\n", "反馈问题?戳我提 issue: https://github.com/tencentyun/TIMSDK/issues\n", "如果您需要在生产环境关闭上面的日志,请 tim.setLogLevel(1)\n"].join("\n"));
  12050. }
  12051. de.setLevel(e);
  12052. }
  12053. }, {
  12054. key: "destroy",
  12055. value: function () {
  12056. var t = this;
  12057. return this.logout().finally(function () {
  12058. t.outerEmitter.emit(e.SDK_DESTROY, {
  12059. SDKAppID: t.loginInfo.SDKAppID
  12060. });
  12061. });
  12062. }
  12063. }, {
  12064. key: "createTextMessage",
  12065. value: function (e) {
  12066. return this.messageController.createTextMessage(e);
  12067. }
  12068. }, {
  12069. key: "createTextAtMessage",
  12070. value: function (e) {
  12071. return this.messageController.createTextMessage(e);
  12072. }
  12073. }, {
  12074. key: "createImageMessage",
  12075. value: function (e) {
  12076. return this.messageController.createImageMessage(e);
  12077. }
  12078. }, {
  12079. key: "createAudioMessage",
  12080. value: function (e) {
  12081. return this.messageController.createAudioMessage(e);
  12082. }
  12083. }, {
  12084. key: "createVideoMessage",
  12085. value: function (e) {
  12086. return this.messageController.createVideoMessage(e);
  12087. }
  12088. }, {
  12089. key: "createCustomMessage",
  12090. value: function (e) {
  12091. return this.messageController.createCustomMessage(e);
  12092. }
  12093. }, {
  12094. key: "createFaceMessage",
  12095. value: function (e) {
  12096. return this.messageController.createFaceMessage(e);
  12097. }
  12098. }, {
  12099. key: "createFileMessage",
  12100. value: function (e) {
  12101. return this.messageController.createFileMessage(e);
  12102. }
  12103. }, {
  12104. key: "sendMessage",
  12105. value: function (e, t) {
  12106. return e instanceof Qn ? this.messageController.sendMessageInstance(e, t) : Cr(new Ut({
  12107. code: qt.MESSAGE_SEND_NEED_MESSAGE_INSTANCE,
  12108. message: Wt
  12109. }));
  12110. }
  12111. }, {
  12112. key: "callExperimentalAPI",
  12113. value: function (e, t) {
  12114. return "sendComboMessage" === e ? this.comboMessageController.sendMessage(t) : Cr(new Ut({
  12115. code: qt.INVALID_OPERATION,
  12116. message: Hn
  12117. }));
  12118. }
  12119. }, {
  12120. key: "revokeMessage",
  12121. value: function (e) {
  12122. return this.messageController.revokeMessage(e);
  12123. }
  12124. }, {
  12125. key: "resendMessage",
  12126. value: function (e) {
  12127. return this.messageController.resendMessage(e);
  12128. }
  12129. }, {
  12130. key: "getMessageList",
  12131. value: function (e) {
  12132. return this.messageController.getMessageList(e);
  12133. }
  12134. }, {
  12135. key: "setMessageRead",
  12136. value: function (e) {
  12137. return this.messageController.setMessageRead(e);
  12138. }
  12139. }, {
  12140. key: "getConversationList",
  12141. value: function () {
  12142. return this.conversationController.getConversationList();
  12143. }
  12144. }, {
  12145. key: "getConversationProfile",
  12146. value: function (e) {
  12147. return this.conversationController.getConversationProfile(e);
  12148. }
  12149. }, {
  12150. key: "deleteConversation",
  12151. value: function (e) {
  12152. return this.conversationController.deleteConversation(e);
  12153. }
  12154. }, {
  12155. key: "getMyProfile",
  12156. value: function () {
  12157. return this.userController.getMyProfile();
  12158. }
  12159. }, {
  12160. key: "getUserProfile",
  12161. value: function (e) {
  12162. return this.userController.getUserProfile(e);
  12163. }
  12164. }, {
  12165. key: "updateMyProfile",
  12166. value: function (e) {
  12167. return this.userController.updateMyProfile(e);
  12168. }
  12169. }, {
  12170. key: "getFriendList",
  12171. value: function () {
  12172. return this.userController.getFriendList();
  12173. }
  12174. }, {
  12175. key: "deleteFriend",
  12176. value: function (e) {
  12177. return this.userController.deleteFriend(e);
  12178. }
  12179. }, {
  12180. key: "getBlacklist",
  12181. value: function () {
  12182. return this.userController.getBlacklist();
  12183. }
  12184. }, {
  12185. key: "addToBlacklist",
  12186. value: function (e) {
  12187. return this.userController.addBlacklist(e);
  12188. }
  12189. }, {
  12190. key: "removeFromBlacklist",
  12191. value: function (e) {
  12192. return this.userController.deleteBlacklist(e);
  12193. }
  12194. }, {
  12195. key: "getGroupList",
  12196. value: function (e) {
  12197. return this.groupController.getGroupList(e);
  12198. }
  12199. }, {
  12200. key: "getGroupProfile",
  12201. value: function (e) {
  12202. return this.groupController.getGroupProfile(e);
  12203. }
  12204. }, {
  12205. key: "createGroup",
  12206. value: function (e) {
  12207. return this.groupController.createGroup(e);
  12208. }
  12209. }, {
  12210. key: "dismissGroup",
  12211. value: function (e) {
  12212. return this.groupController.dismissGroup(e);
  12213. }
  12214. }, {
  12215. key: "updateGroupProfile",
  12216. value: function (e) {
  12217. return this.groupController.updateGroupProfile(e);
  12218. }
  12219. }, {
  12220. key: "joinGroup",
  12221. value: function (e) {
  12222. return this.groupController.joinGroup(e);
  12223. }
  12224. }, {
  12225. key: "quitGroup",
  12226. value: function (e) {
  12227. return this.groupController.quitGroup(e);
  12228. }
  12229. }, {
  12230. key: "searchGroupByID",
  12231. value: function (e) {
  12232. return this.groupController.searchGroupByID(e);
  12233. }
  12234. }, {
  12235. key: "changeGroupOwner",
  12236. value: function (e) {
  12237. return this.groupController.changeGroupOwner(e);
  12238. }
  12239. }, {
  12240. key: "handleGroupApplication",
  12241. value: function (e) {
  12242. return this.groupController.handleGroupApplication(e);
  12243. }
  12244. }, {
  12245. key: "setMessageRemindType",
  12246. value: function (e) {
  12247. return this.groupController.setMessageRemindType(e);
  12248. }
  12249. }, {
  12250. key: "getGroupMemberList",
  12251. value: function (e) {
  12252. return this.groupController.getGroupMemberList(e);
  12253. }
  12254. }, {
  12255. key: "getGroupMemberProfile",
  12256. value: function (e) {
  12257. return this.groupController.getGroupMemberProfile(e);
  12258. }
  12259. }, {
  12260. key: "getGroupOnlineMemberCount",
  12261. value: function (e) {
  12262. return this.groupController.getGroupOnlineMemberCount(e);
  12263. }
  12264. }, {
  12265. key: "addGroupMember",
  12266. value: function (e) {
  12267. return this.groupController.addGroupMember(e);
  12268. }
  12269. }, {
  12270. key: "deleteGroupMember",
  12271. value: function (e) {
  12272. return this.groupController.deleteGroupMember(e);
  12273. }
  12274. }, {
  12275. key: "setGroupMemberMuteTime",
  12276. value: function (e) {
  12277. return this.groupController.setGroupMemberMuteTime(e);
  12278. }
  12279. }, {
  12280. key: "setGroupMemberRole",
  12281. value: function (e) {
  12282. return this.groupController.setGroupMemberRole(e);
  12283. }
  12284. }, {
  12285. key: "setGroupMemberNameCard",
  12286. value: function (e) {
  12287. return this.groupController.setGroupMemberNameCard(e);
  12288. }
  12289. }, {
  12290. key: "setGroupMemberCustomField",
  12291. value: function (e) {
  12292. return this.groupController.setGroupMemberCustomField(e);
  12293. }
  12294. }, {
  12295. key: "_initOptions",
  12296. value: function (e) {
  12297. this.plugins = {}, this._sdkReloadFlag = !1;
  12298. var t = e.SDKAppID || 0,
  12299. n = we();
  12300. this.context = {
  12301. SDKAppID: t,
  12302. accountType: n
  12303. }, this.loginInfo = {
  12304. SDKAppID: t,
  12305. accountType: n,
  12306. identifier: null,
  12307. userSig: null,
  12308. unlimitedAVChatRoom: e.unlimitedAVChatRoom || !1,
  12309. scene: e.scene || "",
  12310. oversea: e.oversea || !1,
  12311. avchatroomIDList: [],
  12312. instanceID: Ye()
  12313. }, this.options = {
  12314. runLoopNetType: e.runLoopNetType || yt,
  12315. enablePointer: e.enablePointer || !1
  12316. };
  12317. }
  12318. }, {
  12319. key: "_initMemberVariables",
  12320. value: function () {
  12321. this.innerEmitter = new Ns(), this.outerEmitter = new Ns(), Ir(this.outerEmitter), this.packageConfig = new ws(this), this.storage = new Rs(this), this.netMonitor = new na(), this.outerEmitter._emit = this.outerEmitter.emit, this.outerEmitter.emit = function (e, t) {
  12322. var n = arguments[0],
  12323. o = [n, {
  12324. name: arguments[0],
  12325. data: arguments[1]
  12326. }];
  12327. this.outerEmitter._emit.apply(this.outerEmitter, o);
  12328. }.bind(this), this.innerEmitter._emit = this.innerEmitter.emit, this.innerEmitter.emit = function (e, t) {
  12329. var n;
  12330. ye(arguments[1]) && arguments[1].data ? (de.warn("inner eventData has data property, please check!"), n = [e, {
  12331. name: arguments[0],
  12332. data: arguments[1].data
  12333. }]) : n = [e, {
  12334. name: arguments[0],
  12335. data: arguments[1]
  12336. }], this.innerEmitter._emit.apply(this.innerEmitter, n);
  12337. }.bind(this);
  12338. }
  12339. }, {
  12340. key: "_initControllers",
  12341. value: function () {
  12342. this.exceptionController = new Qi(this), this.connectionController = new Xi(this), this.contextController = new _r(this), this.context = this.contextController.getContext(), this.signController = new ji(this), this.messageController = new Is(this), this.comboMessageController = new ua(this), this.conversationController = new hs(this), this.userController = new as(this), this.groupController = new ks(this), this.notificationController = new Us(this), this.bigDataHallwayController = new Fs(this), this.statusController = new As(this), this.uploadController = new qs(this), this.messageLossController = new aa(this), this.eventStatController = new Zs(this), this.sumStatController = new ia(this), this.mtaReportController = new Xs(this), this._initReadyListener();
  12343. }
  12344. }, {
  12345. key: "_initListener",
  12346. value: function () {
  12347. var e = this;
  12348. if (this.innerEmitter.on(ur, this._onSDKReload, this), V && "function" == typeof K.onAppShow && "function" == typeof K.onAppHide) {
  12349. var t = null;
  12350. K.onAppHide(function () {
  12351. t = new qr(Ki);
  12352. }), K.onAppShow(function () {
  12353. null !== t && t.setNetworkType(e.netMonitor.getNetworkType()).setEnd();
  12354. });
  12355. }
  12356. }
  12357. }, {
  12358. key: "_initReadyListener",
  12359. value: function () {
  12360. for (var e = this, t = this.readyList, n = 0, o = t.length; n < o; n++) this[t[n]].ready(function () {
  12361. return e._readyHandle();
  12362. });
  12363. }
  12364. }, {
  12365. key: "_onSDKReload",
  12366. value: function () {
  12367. var e = this;
  12368. de.log("sdk reloading..."), this.resetSDK(), this.login(this.loginInfo).then(function (t) {
  12369. e._sdkReloadFlag = !0;
  12370. });
  12371. }
  12372. }, {
  12373. key: "resetSDK",
  12374. value: function () {
  12375. var t = this;
  12376. this.initList.forEach(function (e) {
  12377. t[e].reset && t[e].reset();
  12378. }), this.netMonitor.reset(), this.storage.reset(), this.resetReady(), this._initReadyListener(), this.outerEmitter.emit(e.SDK_NOT_READY);
  12379. }
  12380. }, {
  12381. key: "_readyHandle",
  12382. value: function () {
  12383. for (var t = this.readyList, n = !0, o = 0, r = t.length; o < r; o++) if (!this[t[o]].isReady()) {
  12384. n = !1;
  12385. break;
  12386. }
  12387. if (n) {
  12388. var i = de.timeEnd(Er);
  12389. de.warn("SDK is ready. cost=".concat(i, "ms")), this.triggerReady(), this.innerEmitter.emit(ar), this.outerEmitter.emit(e.SDK_READY), this._sdkReloadFlag && (this.outerEmitter.emit(e.SDK_RELOAD), this.groupController.AVChatRoomHandler.joinAVChatRoomSilently(), this._sdkReloadFlag = !1), this._ssoLog.setNetworkType(this.netMonitor.getNetworkType()).setText(i).setEnd();
  12390. }
  12391. }
  12392. }]), t;
  12393. }();
  12394. ca.prototype.readyList = ["conversationController"], ca.prototype.initList = ["exceptionController", "connectionController", "signController", "contextController", "messageController", "comboMessageController", "conversationController", "userController", "groupController", "notificationController", "eventStatController", "sumStatController", "messageLossController", "statusController"];
  12395. var la = {
  12396. login: "login",
  12397. logout: "logout",
  12398. destroy: "destroy",
  12399. on: "on",
  12400. off: "off",
  12401. ready: "ready",
  12402. setLogLevel: "setLogLevel",
  12403. joinGroup: "joinGroup",
  12404. quitGroup: "quitGroup",
  12405. registerPlugin: "registerPlugin",
  12406. getGroupOnlineMemberCount: "getGroupOnlineMemberCount"
  12407. };
  12408. function pa(e, t) {
  12409. return !(!e.isReady() && void 0 === la[t]) || (e.innerEmitter.emit(er, new Ut({
  12410. code: qt.SDK_IS_NOT_READY,
  12411. message: "".concat(t, " ").concat(Bn, ",请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/module-EVENT.html#.SDK_READY")
  12412. })), !1);
  12413. }
  12414. var ga = {},
  12415. ha = {};
  12416. return ha.create = function (t) {
  12417. if (t.SDKAppID && ga[t.SDKAppID]) return ga[t.SDKAppID];
  12418. de.log("TIM.create");
  12419. var n = new ca(t);
  12420. n.on(e.SDK_DESTROY, function (e) {
  12421. ga[e.data.SDKAppID] = null, delete ga[e.data.SDKAppID];
  12422. });
  12423. var o = function (e) {
  12424. var t = Object.create(null);
  12425. return Object.keys(so).forEach(function (n) {
  12426. if (e[n]) {
  12427. var o = so[n],
  12428. r = new k();
  12429. t[o] = function () {
  12430. var t = Array.from(arguments);
  12431. return r.use(function (t, o) {
  12432. return pa(e, n) ? o() : Cr(new Ut({
  12433. code: qt.SDK_IS_NOT_READY,
  12434. message: "".concat(n, " ").concat(Bn, "。")
  12435. }));
  12436. }).use(function (e, t) {
  12437. if (!0 === Qe(e, io[n], o)) return t();
  12438. }).use(function (t, o) {
  12439. return e[n].apply(e, t);
  12440. }), r.run(t);
  12441. };
  12442. }
  12443. }), t;
  12444. }(n);
  12445. return ga[t.SDKAppID] = o, de.log("TIM.create ok"), o;
  12446. }, ha.TYPES = t, ha.EVENT = e, ha.VERSION = "2.9.1", de.log("TIM.VERSION: ".concat(ha.VERSION)), ha;
  12447. });
  12448. }, function (modId) {
  12449. var map = {};
  12450. return __REQUIRE__(map[modId], modId);
  12451. });
  12452. return __REQUIRE__(1611536305607);
  12453. }(); //# sourceMappingURL=index.js.map