index.971264d4.js 602 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. var nu=Object.defineProperty,ru=Object.defineProperties;var iu=Object.getOwnPropertyDescriptors;var Ln=Object.getOwnPropertySymbols;var Jo=Object.prototype.hasOwnProperty,Wo=Object.prototype.propertyIsEnumerable;var zo=(n,e,t)=>e in n?nu(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,_t=(n,e)=>{for(var t in e||(e={}))Jo.call(e,t)&&zo(n,t,e[t]);if(Ln)for(var t of Ln(e))Wo.call(e,t)&&zo(n,t,e[t]);return n},kn=(n,e)=>ru(n,iu(e));var Zo=(n,e)=>{var t={};for(var r in n)Jo.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&Ln)for(var r of Ln(n))e.indexOf(r)<0&&Wo.call(n,r)&&(t[r]=n[r]);return t};import{d as ga,q as ir,c as Xo,w as es,u as ts,E as ou,r as su,o as ns,a as ci,b as au,z as cu,e as uu,f as du,m as lu,g as hu,h as ma,i as pu,j as fu,k as ct,l as gu,n as mu,s as _u,p as vu}from"./vendor.8df6bc42.js";function ah(){import("data:text/javascript,")}const Ru=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function t(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=t(i);fetch(i.href,o)}};Ru();if(typeof window!="undefined"){let n=function(){var e=document.body,t=document.getElementById("__svg__icons__dom__");t||(t=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.style.position="absolute",t.style.width="0",t.style.height="0",t.id="__svg__icons__dom__",t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("xmlns:link","http://www.w3.org/1999/xlink")),t.innerHTML='<symbol viewBox="0 0 74 68" id="icon-camera-status"><g fill="none" fill-rule="evenodd"><path d="M0 0h74v68H0z" /><g fill-rule="nonzero"><path d="M35 51c-9.968 0-18.625 5.672-23 14h46c-4.376-8.328-13.033-14-23-14Z" fill="#DCE1EB" /><path d="M36.016 51H36v14h23c-4.372-8.328-13.023-14-22.983-14Z" fill="#CDD2E1" /><path d="M9 31.5C9 46.136 20.864 58 35.5 58S62 46.136 62 31.5 50.136 5 35.5 5 9 16.864 9 31.5Z" fill="#FFF" /><path d="M35.5 58C50.136 58 62 46.136 62 31.5S50.136 5 35.5 5v53Z" fill="#E9EDF5" /><path d="M23 32c0 7.18 5.82 13 13 13s13-5.82 13-13-5.82-13-13-13-13 5.82-13 13Z" fill="#9196AA" /><path d="M36 45c7.18 0 13-5.82 13-13s-5.82-13-13-13v26Z" fill="#7E8596" /><path d="M27 31.5a8.5 8.5 0 1 0 17 0 8.5 8.5 0 0 0-17 0Z" fill="#555A66" /><path d="M35.5 40a8.5 8.5 0 1 0 0-17v17Z" fill="#333940" /><path d="M30 34a2 2 0 1 0 4 0 2 2 0 0 0-4 0Z" fill="#DCE1EB" /><path d="m4.381 12.098-4.2-.462a.203.203 0 0 1-.068-.385l3.79-1.87.461-4.2a.203.203 0 0 1 .385-.068l1.87 3.79 4.2.461a.203.203 0 0 1 .068.385l-3.789 1.87-.462 4.2a.203.203 0 0 1-.385.068l-1.87-3.789Z" fill="#E9EDF5" /><path d="m62.286 52.066-2.21-1.622a.186.186 0 0 1 .122-.336l2.735.178 1.622-2.211a.186.186 0 0 1 .336.122l-.177 2.737 2.21 1.622a.186.186 0 0 1-.123.336l-2.735-.178-1.623 2.211a.186.186 0 0 1-.335-.122l.177-2.737h.001Z" fill="#FEFEFF" /></g></g></symbol><symbol viewBox="0 0 18 18" id="icon-bar-arrow-down"><g fill="none" fill-rule="evenodd"><g fill="#888" fill-rule="nonzero"><path d="M5.124 8.652a.357.357 0 0 1-.002-.54c.164-.149.43-.15.596-.001l3.58 3.237c.165.149.165.39.001.54a.452.452 0 0 1-.595.001l-3.58-3.237Z" /><path d="M12.282 8.111a.452.452 0 0 1 .596.001c.163.15.163.391-.002.54l-3.58 3.237a.452.452 0 0 1-.595-.001.357.357 0 0 1 .001-.54l3.58-3.237Z" /></g><path d="M0 18V0h18v18z" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-beauty-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M2.52 17.094c-.1.8-.725 1.43-1.52 1.532 0 0 1.318.158 1.52 1.374 0 0 .306-1.32 1.371-1.374.05 0-1.218-.315-1.371-1.532ZM12.498 0c-.099.8-.724 1.43-1.52 1.532 0 0 1.318.157 1.52 1.374 0 0 .306-1.32 1.372-1.374.05 0-1.219-.316-1.372-1.532Zm5.54 1.906A2.484 2.484 0 0 1 15.87 4.06s1.858.216 2.168 1.997c0 0 .413-1.835 1.962-1.997 0 0-1.81-.415-1.962-2.154Zm-7.951 1.66c-4.562 0-8.26 3.717-8.26 8.302 0 4.585 3.698 8.302 8.26 8.302 4.562 0 8.26-3.717 8.26-8.302-.013-4.58-3.703-8.288-8.26-8.302Zm-3.51 9.132c-.6 0-1.034-.635-1.034-1.428 0-.793.488-1.478 1.033-1.478.545 0 1.033.636 1.033 1.478 0 .843-.438 1.428-1.033 1.428Zm6.306 2.906s-.582 1.245-2.552 1.245a3.581 3.581 0 0 1-2.557-1.112s-.636-1.246.586-.905a2.599 2.599 0 0 0 1.917 1.062 2.302 2.302 0 0 0 1.875-1.012s1.173-.32.744.743l-.013-.021Zm.74-2.906c-.583 0-1.058-.647-1.058-1.453 0-.805.475-1.453 1.058-1.453.582 0 1.007.648 1.007 1.453 0 .806-.475 1.453-1.007 1.453Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-beauty"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M2.52 17.094c-.1.8-.725 1.43-1.52 1.532 0 0 1.318.158 1.52 1.374 0 0 .306-1.32 1.371-1.374.05 0-1.218-.315-1.371-1.532ZM12.498 0c-.099.8-.724 1.43-1.52 1.532 0 0 1.318.157 1.52 1.374 0 0 .306-1.32 1.372-1.374.05 0-1.219-.316-1.372-1.532Zm5.54 1.906A2.484 2.484 0 0 1 15.87 4.06s1.858.216 2.168 1.997c0 0 .413-1.835 1.962-1.997 0 0-1.81-.415-1.962-2.154Zm-7.951 1.66c-4.562 0-8.26 3.717-8.26 8.302 0 4.585 3.698 8.302 8.26 8.302 4.562 0 8.26-3.717 8.26-8.302-.013-4.58-3.703-8.288-8.26-8.302Zm-3.51 9.132c-.6 0-1.034-.635-1.034-1.428 0-.793.488-1.478 1.033-1.478.545 0 1.033.636 1.033 1.478 0 .843-.438 1.428-1.033 1.428Zm6.306 2.906s-.582 1.245-2.552 1.245a3.581 3.581 0 0 1-2.557-1.112s-.636-1.246.586-.905a2.599 2.599 0 0 0 1.917 1.062 2.302 2.302 0 0 0 1.875-1.012s1.173-.32.744.743l-.013-.021Zm.74-2.906c-.583 0-1.058-.647-1.058-1.453 0-.805.475-1.453 1.058-1.453.582 0 1.007.648 1.007 1.453 0 .806-.475 1.453-1.007 1.453Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-camera-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><g transform="translate(3 2)"><path d="M15.829 7.667c0 2.887-1.553 5.405-3.843 6.717l-.232.128 1.365 2.436a.713.713 0 0 1 0 .697.676.676 0 0 1-.481.34l-.102.008L4.401 18a.671.671 0 0 1-.583-.348.713.713 0 0 1-.045-.602l.045-.095 1.337-2.402a7.408 7.408 0 0 1-1.236-.794l2.98-2.98c.456.238.971.373 1.516.373 1.857 0 3.37-1.565 3.37-3.485a3.56 3.56 0 0 0-.312-1.462l2.98-2.981a7.803 7.803 0 0 1 1.376 4.443ZM8.415 0c1.78 0 3.416.653 4.696 1.739l-2.95 2.95a3.266 3.266 0 0 0-1.746-.507c-1.857 0-3.37 1.565-3.37 3.485 0 .62.157 1.202.432 1.706l-2.948 2.95A7.796 7.796 0 0 1 1 7.667C1 3.44 4.326 0 8.415 0Zm2.022 7.667c0 1.155-.906 2.091-2.022 2.091-.153 0-.302-.018-.445-.05l2.432-2.43c.023.126.035.256.035.389ZM8.415 5.576c.254 0 .497.048.721.137L6.502 8.348a2.153 2.153 0 0 1-.11-.681c0-1.155.906-2.091 2.023-2.091Zm0-3.196a.686.686 0 0 0-.675.697c0 .384.304.697.675.697.37 0 .674-.313.674-.697a.688.688 0 0 0-.674-.697Z" fill="#FFF" fill-rule="nonzero" /><rect fill="#FF3D00" transform="rotate(45 8.485 9.778)" x="7.485" y="-1.222" width="2" height="22" rx="1" /></g></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-camera"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M11.415 2c4.088 0 7.414 3.44 7.414 7.667 0 2.983-1.658 5.572-4.075 6.845l1.365 2.436a.713.713 0 0 1 0 .697.671.671 0 0 1-.583.348L7.401 20a.671.671 0 0 1-.583-.348.713.713 0 0 1 0-.697l1.337-2.402C5.7 15.303 4 12.685 4 9.667 4 5.44 7.326 2 11.415 2Zm0 4.182c-1.857 0-3.37 1.565-3.37 3.485s1.513 3.485 3.37 3.485c1.857 0 3.37-1.565 3.37-3.485s-1.513-3.485-3.37-3.485Zm0 1.394c1.116 0 2.022.936 2.022 2.091 0 1.155-.906 2.091-2.022 2.091-1.117 0-2.023-.936-2.023-2.091 0-1.155.906-2.091 2.023-2.091Zm0-3.196a.686.686 0 0 0-.675.697c0 .384.304.697.675.697.37 0 .674-.313.674-.697a.688.688 0 0 0-.674-.697Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-mike-disabled"><defs><path d="M16.142 4.707 2.707 18.142a1 1 0 0 0 1.414 1.415L17.556 6.12a.999.999 0 0 0 0-1.414 1 1 0 0 0-1.414 0Z" id="icon-bar-mike-disabled_a" /></defs><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><g transform="translate(2 1)"><path d="M16.06 8.915c.522 0 .943.419.94.935 0 4.252-3.212 7.776-7.366 8.327v.703A1.13 1.13 0 0 1 8.5 20a1.13 1.13 0 0 1-1.133-1.12v-.703a8.511 8.511 0 0 1-2.921-.945l1.4-1.401a6.625 6.625 0 0 0 2.656.555c3.646 0 6.612-2.931 6.612-6.536a.94.94 0 0 1 .945-.935Zm-15.114 0a.94.94 0 0 1 .945.934c0 1.942.865 3.683 2.228 4.881L2.79 16.06C1.08 14.521 0 12.31 0 9.85c0-.517.424-.936.946-.936Zm12.587-.77v1.194c-.004 2.768-2.23 5.012-4.979 5.014a4.86 4.86 0 0 1-1.098-.133l6.077-6.075ZM8.555 0c2.748.001 4.975 2.246 4.978 5.015v.301l-7.988 7.989A5.008 5.008 0 0 1 3.58 9.338V5.015C3.582 2.247 5.81.003 8.555 0Zm0 1.614c-1.86 0-3.374 1.525-3.374 3.401v.718h6.75v-.718c-.002-1.878-1.513-3.399-3.376-3.401Z" fill="#FFF" /><use fill="#FF3D00" xlink:href="#icon-bar-mike-disabled_a" /></g></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-mike"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M19 10.85c0 4.252-3.214 7.776-7.368 8.327v.703c0 .616-.51 1.12-1.132 1.12a1.13 1.13 0 0 1-1.133-1.12v-.703C5.213 18.626 2 15.105 2 10.85a.94.94 0 0 1 .945-.935c.522 0 .946.419.946.935 0 3.605 2.965 6.536 6.611 6.536s6.611-2.931 6.611-6.536c0-.516.424-.935.946-.935s.943.419.941.935ZM5.579 6.015v4.324c.002 2.768 2.228 5.012 4.975 5.015 2.748-.002 4.975-2.246 4.979-5.015V6.015C15.53 3.246 13.302 1.002 10.554 1c-2.747.004-4.973 2.247-4.975 5.015Zm8.352 0v.719H7.18v-.719c0-1.875 1.514-3.401 3.374-3.401 1.864.002 3.374 1.523 3.377 3.401Z" fill="#FFF" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-screen-share-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M3.8 4c-.477 0-.935.188-1.273.523C2.19 4.858 2 5.313 2 5.786v8.928c0 .474.19.928.527 1.263.338.335.796.523 1.273.523h14.4c.477 0 .935-.188 1.273-.523.337-.335.527-.79.527-1.263V5.786c0-.474-.19-.928-.527-1.263A1.807 1.807 0 0 0 18.2 4H3.8Zm3.6 14.42c0-.154.062-.302.171-.41a.587.587 0 0 1 .414-.17h6.03c.323 0 .585.26.585.58 0 .32-.262.58-.585.58h-6.03a.587.587 0 0 1-.414-.17.578.578 0 0 1-.171-.41Zm3.754-11.258a.518.518 0 0 1 .32-.472.548.548 0 0 1 .575.093l2.377 2.108a.51.51 0 0 1-.027.788l-2.398 1.86a.548.548 0 0 1-.567.061.517.517 0 0 1-.301-.469l.007-1.418c-1.475.002-2.67 1.162-2.67 2.592 0 .286-.24.519-.535.519a.527.527 0 0 1-.535-.519c0-.962.394-1.886 1.096-2.566a3.804 3.804 0 0 1 2.647-1.063h.002l.009-1.514Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 21 17" id="icon-bar-screen-share-disabled2"><g fill="none" fill-rule="evenodd"><path d="M0 0h20v17H0z" /><g transform="translate(1 .536)"><path d="M12.015 14.304c.323 0 .585.26.585.58 0 .32-.262.58-.585.58h-6.03a.587.587 0 0 1-.414-.17.578.578 0 0 1 .414-.99h6.03Zm3.37-13.84-3.983 3.983-1.353-1.2a.547.547 0 0 0-.49-.12l-.084.028a.518.518 0 0 0-.321.472L9.145 5.14c-.994 0-1.947.383-2.649 1.063A3.574 3.574 0 0 0 5.4 8.77c0 .286.24.518.535.518a.527.527 0 0 0 .535-.518c0-1.43 1.195-2.591 2.67-2.593l-.003.534-6.253 6.253H1.8c-.418 0-.82-.144-1.14-.404l-.133-.119A1.779 1.779 0 0 1 0 11.18V2.25c0-.473.19-.928.527-1.263A1.807 1.807 0 0 1 1.8.464h13.585Zm2.19.635c.274.32.425.728.425 1.151v8.929c0 .473-.19.928-.527 1.262a1.807 1.807 0 0 1-1.273.523H5.713L17.556 1.121Z" fill="#FFF" fill-rule="nonzero" /><rect fill="#FF3D00" transform="rotate(45 11.132 8.132)" x="10.132" y="-2.368" width="2" height="21" rx="1" /></g></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-screen-share"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M3.8 4c-.477 0-.935.188-1.273.523C2.19 4.858 2 5.313 2 5.786v8.928c0 .474.19.928.527 1.263.338.335.796.523 1.273.523h14.4c.477 0 .935-.188 1.273-.523.337-.335.527-.79.527-1.263V5.786c0-.474-.19-.928-.527-1.263A1.807 1.807 0 0 0 18.2 4H3.8Zm3.6 14.42c0-.154.062-.302.171-.41a.587.587 0 0 1 .414-.17h6.03c.323 0 .585.26.585.58 0 .32-.262.58-.585.58h-6.03a.587.587 0 0 1-.414-.17.578.578 0 0 1-.171-.41Zm3.754-11.258a.518.518 0 0 1 .32-.472.548.548 0 0 1 .575.093l2.377 2.108a.51.51 0 0 1-.027.788l-2.398 1.86a.548.548 0 0 1-.567.061.517.517 0 0 1-.301-.469l.007-1.418c-1.475.002-2.67 1.162-2.67 2.592 0 .286-.24.519-.535.519a.527.527 0 0 1-.535-.519c0-.962.394-1.886 1.096-2.566a3.804 3.804 0 0 1 2.647-1.063h.002l.009-1.514Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-share-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M18.055 10.556a.945.945 0 0 0-.944.944 6.619 6.619 0 0 1-6.611 6.611A6.618 6.618 0 0 1 3.889 11.5 6.619 6.619 0 0 1 10.5 4.889.945.945 0 0 0 10.5 3C5.813 3 2 6.813 2 11.5c0 4.687 3.813 8.5 8.5 8.5 4.687 0 8.5-3.813 8.5-8.5a.945.945 0 0 0-.945-.944Z" fill="#FFF" fill-rule="nonzero" /><path d="m14.034 4.991 1.579-.007-5.324 5.32A.994.994 0 0 0 10.991 12a.99.99 0 0 0 .701-.294l5.323-5.32-.007 1.577a1 1 0 0 0 .996.995A1 1 0 0 0 19 7.963V3.995a.98.98 0 0 0-.077-.371c-.021-.05-.035-.091-.07-.126a.846.846 0 0 0-.35-.35.323.323 0 0 0-.127-.07.98.98 0 0 0-.372-.078h-3.97a1 1 0 0 0-.995.995 1 1 0 0 0 .995.996Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-share"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M18.055 10.556a.945.945 0 0 0-.944.944 6.619 6.619 0 0 1-6.611 6.611A6.618 6.618 0 0 1 3.889 11.5 6.619 6.619 0 0 1 10.5 4.889.945.945 0 0 0 10.5 3C5.813 3 2 6.813 2 11.5c0 4.687 3.813 8.5 8.5 8.5 4.687 0 8.5-3.813 8.5-8.5a.945.945 0 0 0-.945-.944Z" fill="#FFF" fill-rule="nonzero" /><path d="m14.034 4.991 1.579-.007-5.324 5.32A.994.994 0 0 0 10.991 12a.99.99 0 0 0 .701-.294l5.323-5.32-.007 1.577a1 1 0 0 0 .996.995A1 1 0 0 0 19 7.963V3.995a.98.98 0 0 0-.077-.371c-.021-.05-.035-.091-.07-.126a.846.846 0 0 0-.35-.35.323.323 0 0 0-.127-.07.98.98 0 0 0-.372-.078h-3.97a1 1 0 0 0-.995.995 1 1 0 0 0 .995.996Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-volume-disabled"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><g transform="translate(1 3.536)"><path d="m10.27 8.406.001 6.335c0 .678-.615.966-1.334.483l-3.243-2.242 4.576-4.576Zm6.242-6.243c.23.026.454.12.639.28A7.291 7.291 0 0 1 20 8.204a7.28 7.28 0 0 1-2.85 5.763 1.166 1.166 0 0 1-1.539 0 .802.802 0 0 1-.306-.629c0-.244.112-.475.306-.629a5.677 5.677 0 0 0 2.236-4.5 5.677 5.677 0 0 0-2.236-4.501.808.808 0 0 1-.266-.377ZM9.032.705c.615-.484 1.234-.195 1.239.483L10.27 5.58l-6.453 6.452-2.377.001-.066.002a1.392 1.392 0 0 1-.973-.4A1.338 1.338 0 0 1 0 10.678V5.194a1.34 1.34 0 0 1 .442-.94c.27-.244.626-.372.992-.357H4.41Zm4.863 4.077c.1.046.194.107.28.183a4.112 4.112 0 0 1 1.537 3.192 4.1 4.1 0 0 1-1.538 3.195 1.169 1.169 0 0 1-1.542 0 .802.802 0 0 1-.308-.63c0-.246.114-.477.308-.63a2.5 2.5 0 0 0 .924-1.935 2.5 2.5 0 0 0-.924-1.935.817.817 0 0 1-.091-.084Z" fill="#FFF" fill-rule="nonzero" /><rect fill="#FF3D00" transform="rotate(45 11.132 8.132)" x="10.132" y="-2.368" width="2" height="21" rx="1" /></g></g></symbol><symbol viewBox="0 0 22 22" id="icon-bar-volume"><g fill="none" fill-rule="evenodd"><path d="M0 0h22v22H0z" /><path d="M5.41 7.432H2.434a1.393 1.393 0 0 0-.992.357 1.34 1.34 0 0 0-.442.94v5.484c-.001.358.143.703.4.957.258.255.609.398.974.4l.066-.002h2.878l4.619 3.192c.72.483 1.334.194 1.334-.484V4.724c-.005-.678-.624-.967-1.239-.484L5.41 7.432Zm8.222 6.195a.802.802 0 0 0-.308.63c0 .245.114.477.308.63a1.169 1.169 0 0 0 1.542 0 4.1 4.1 0 0 0 1.538-3.195A4.101 4.101 0 0 0 15.169 8.5h.005a1.169 1.169 0 0 0-1.542 0 .802.802 0 0 0-.306.63c0 .243.112.475.306.628a2.5 2.5 0 0 1 .924 1.934 2.5 2.5 0 0 1-.924 1.935Zm2.98-7.645a.802.802 0 0 0-.309.63c0 .245.113.477.308.63a5.677 5.677 0 0 1 2.236 4.501 5.677 5.677 0 0 1-2.236 4.5.802.802 0 0 0-.306.63c0 .244.112.475.306.629a1.166 1.166 0 0 0 1.54 0A7.28 7.28 0 0 0 21 11.739a7.281 7.281 0 0 0-2.854-5.76h.005a1.169 1.169 0 0 0-1.54.003Z" fill="#FFF" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 16 13" id="icon-message-activeVoice"><path d="M3.594 2.995v7.007H1.197C.536 10.002 0 9.474 0 8.844V4.151c0-.638.53-1.156 1.197-1.156h2.397ZM7.426.192c.53-.387.959-.169.959.47v11.673c0 .646-.425.86-.958.47l-3.832-2.803V2.995L7.427.192Zm5.354 11.221c-.333-.32-.333-.745 0-1.065 2.11-2.024 2.11-5.22 0-7.243-.333-.32-.333-.747 0-1.066.333-.32.777-.32 1.11 0C15.223 3.318 16 4.915 16 6.62c0 1.705-.777 3.409-2.11 4.58a.868.868 0 0 1-.554.213c-.223.213-.445.107-.556 0Zm-2.22-1.171a.868.868 0 0 1-.556-.213c-.333-.32-.333-.746 0-1.066 1.332-1.278 1.332-3.195 0-4.474-.333-.32-.333-.745 0-1.065.333-.32.777-.32 1.11 0 1.999 1.81 1.999 4.688 0 6.498-.221.214-.333.32-.555.32Z" fill="currentColor" fill-rule="nonzero" /></symbol><symbol viewBox="0 0 20 20" id="icon-message-evenEtc"><g fill="none" fill-rule="evenodd"><path d="M0 0h20v20H0z" /><path d="M11.475 16.852c.017.09.025.184.025.28v.236c0 .583-.334 1.122-.875 1.413a1.86 1.86 0 0 1-1.75 0C8.333 18.49 8 17.951 8 17.368v-.237c0-.135.017-.266.051-.392C5.141 15.941 3 13.402 3 10.37c0-.48.382-.869.854-.869s.855.389.855.868c0 2.686 2.354 4.895 5.291 4.895 2.937 0 5.291-2.208 5.291-4.895 0-.48.383-.868.854-.868.473 0 .855.389.855.868 0 3.195-2.376 5.844-5.525 6.484ZM9.949 1h.102C13.017 1 14.5 2.49 14.5 5.468v4.063C14.5 12.51 13.017 14 10.051 14h-.102C6.983 14 5.5 12.51 5.5 9.53V5.468C5.5 2.49 6.983 1 9.949 1Z" fill="currentColor" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 20 20" id="icon-message-giveUp"><g fill="none" fill-rule="evenodd"><path d="M0 0h20v20H0z" /><path d="M5.941 7.478c.69 0 1.25.572 1.25 1.278v6.966c0 .706-.56 1.278-1.25 1.278H5.25C4.56 17 4 16.428 4 15.722V8.756c0-.706.56-1.278 1.25-1.278h.691Zm3.81-3.428c.14-1.47 1.564-.967 1.564-.967 2.246 1.398.651 4.761.513 5.121l.499.003v-.002h2.55c.029 0 .058.01.086.024l.607.007a.633.633 0 0 1 .43.607l-.563 7.477c0 .353-.281.64-.626.64l-7.124.025V7.822c1.984-.74 1.95-2.588 2.064-3.772Z" fill="currentColor" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 20 20" id="icon-message-look"><g fill="none" fill-rule="evenodd"><path d="M18.97 6.139c0-1.007-.672-1.421-1.492-.918l-1.873 1.125v-.888c0-1.333-1.083-2.458-2.43-2.458H3.43C2.112 3 1 4.096 1 5.458v8.084C1 14.875 2.083 16 3.43 16h9.746c1.317 0 2.429-1.096 2.429-2.458v-.947l1.932 1.184c.82.503 1.463.089 1.463-.918l-.03-6.722Zm-7.638 3.76L7.38 12.507c-.087.059-.175.059-.263.059a.516.516 0 0 1-.497-.503V6.879c0-.089.029-.177.058-.266.146-.237.44-.326.673-.178l3.951 2.606a.5.5 0 0 1 .176.178.46.46 0 0 1-.146.68Z" fill="currentColor" fill-rule="nonzero" /><path d="M0 0h20v20H0z" /></g></symbol><symbol viewBox="0 0 20 20" id="icon-message-message"><g fill="none" fill-rule="evenodd"><path d="M0 0h20v20H0z" /><path d="M17.55 9.161c.8 0 1.45.64 1.45 1.43v3.894c0 .789-.65 1.43-1.45 1.43h-1.025v.617c.008.252-.15.511-.449.462l-.13-.04-.175-.093-1.43-.947h-2.856c-.8 0-1.45-.64-1.45-1.43V10.59c0-.789.65-1.429 1.45-1.429h6.065ZM14.54 3c1.335 0 2.418 1.067 2.418 2.385V7.92h-5.706c-1.336 0-2.419 1.067-2.419 2.384v4.585l-1.447.958-.291.156-.216.066c-.498.082-.763-.351-.751-.77l.001-1.032H4.42C3.083 14.267 2 13.2 2 11.882V5.385C2 4.067 3.083 3 4.419 3h10.12Z" fill="currentColor" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 16 13" id="icon-message-voice"><path d="M3.594 2.995v7.007H1.197C.536 10.002 0 9.474 0 8.844V4.151c0-.638.53-1.156 1.197-1.156h2.397ZM7.426.192c.53-.387.959-.169.959.47v11.673c0 .646-.425.86-.958.47l-3.832-2.803V2.995L7.427.192Zm5.354 11.221c-.333-.32-.333-.745 0-1.065 2.11-2.024 2.11-5.22 0-7.243-.333-.32-.333-.747 0-1.066.333-.32.777-.32 1.11 0C15.223 3.318 16 4.915 16 6.62c0 1.705-.777 3.409-2.11 4.58a.868.868 0 0 1-.554.213c-.223.213-.445.107-.556 0Zm-2.22-1.171a.868.868 0 0 1-.556-.213c-.333-.32-.333-.746 0-1.066 1.332-1.278 1.332-3.195 0-4.474-.333-.32-.333-.745 0-1.065.333-.32.777-.32 1.11 0 1.999 1.81 1.999 4.688 0 6.498-.221.214-.333.32-.555.32Z" fill="currentColor" fill-rule="nonzero" /></symbol><symbol viewBox="0 0 126 89" id="icon-noData-no-join"><g fill="none" fill-rule="evenodd"><path d="M0 0h126v89H0z" /><path d="M62.304 59.08c-19.39 6.948-29.728 6.37-31.012-1.734-1.925-12.157 16.025-11.174 14.034-.562C44 63.86 39.508 68.724 31.854 71.38" stroke="currentColor" stroke-width="2" stroke-linecap="round" /><g fill-rule="nonzero"><path d="M76.577 44.006c0 6.243-5.01 11.304-11.19 11.304h-3.849c-6.18 0-11.19-5.06-11.19-11.304V27.304a11.359 11.359 0 0 1 3.277-7.994A11.13 11.13 0 0 1 61.538 16h3.848c6.18 0 11.19 5.061 11.19 11.304v16.702Z" fill="#979FCB" /><path d="M78.394 37.62v6.965c0 6.96-5.701 12.603-12.738 12.603h-4.382c-7.038 0-12.743-5.643-12.743-12.603v-6.964h-2.069v8.256c0 7.924 6.497 14.347 14.504 14.347h4.99c8.014 0 14.506-6.423 14.506-14.347v-8.256h-2.068Z" fill="#394B97" /><path fill="#394B97" d="M61.034 58.259h5.828v10.81h-5.828z" /><path d="M79.491 73v-.835c0-2.796-2.574-5.062-5.76-5.062H54.165c-3.178 0-5.76 2.27-5.76 5.062V73h31.086Z" fill="#394B97" /><path d="M65.033 25.828h11.544v2.601H65.033v-2.601Zm-14.685 0h11.543v2.601H50.348v-2.601Zm14.685 4.58h11.544v2.602H65.033v-2.602Zm-14.685 0h11.543v2.602H50.348v-2.602Zm14.685 4.94h11.544v2.606H65.033v-2.606Zm-14.685 0h11.543v2.606H50.348v-2.606Zm14.685 4.589h11.544v2.597H65.033v-2.597Zm-14.685 0h11.543v2.597H50.348v-2.597Z" fill="#5161A4" /></g><path d="M94.607 58.464a1 1 0 0 1 0 1.415l-2.122 2.12 2.122 2.122a1 1 0 1 1-1.415 1.415l-2.122-2.122-2.12 2.122a1 1 0 1 1-1.414-1.415L89.656 62l-2.12-2.12a1 1 0 0 1 1.414-1.415l2.12 2.121 2.122-2.12a1 1 0 0 1 1.415 0Z" fill="#FFF" /></g></symbol><symbol viewBox="0 0 126 89" id="icon-noData-no-message"><g fill="none" fill-rule="evenodd"><path d="M0 0h126v89H0z" /><g transform="translate(27 22)"><g fill-rule="nonzero"><path d="M47.821 0c2.484.003 4.497 2.028 4.5 4.526v4.527h-18C30.6 9.053 28 12.256 28 16v11h-2l-6.08 6.8a1.12 1.12 0 0 1-1.226.246A1.132 1.132 0 0 1 18 33v-6h-3c-2.484-.003-4.926-1.87-4.929-4.369V4.526c.003-2.498 2.016-4.523 4.5-4.526ZM23.932 11.488a2.24 2.24 0 0 0-2.452.49 2.273 2.273 0 0 0-.488 2.467 2.25 2.25 0 0 0 2.08 1.397 2.257 2.257 0 0 0 2.25-2.263c0-.915-.55-1.74-1.39-2.091Z" fill="#5161A4" /><path d="M65.365 11H34.777a4.715 4.715 0 0 0-4.706 4.714v18.857a4.715 4.715 0 0 0 4.706 4.715h11.278l4.36 4.369a1.175 1.175 0 0 0 1.665 0l4.36-4.37h8.925a4.715 4.715 0 0 0 4.706-4.714V15.714A4.715 4.715 0 0 0 65.365 11Z" fill="#979FCB" /><path d="M41.836 27.5a2.355 2.355 0 0 1-2.353-2.357 2.355 2.355 0 0 1 2.353-2.357c1.3 0 2.353 1.055 2.353 2.357a2.355 2.355 0 0 1-2.353 2.357ZM51.248 27.5c-.952 0-1.81-.574-2.174-1.455a2.36 2.36 0 0 1 .51-2.569 2.35 2.35 0 0 1 2.564-.51 2.357 2.357 0 0 1 1.452 2.177 2.355 2.355 0 0 1-2.352 2.357ZM60.66 27.5a2.355 2.355 0 0 1-2.354-2.357 2.355 2.355 0 0 1 2.353-2.357c1.3 0 2.353 1.055 2.353 2.357A2.355 2.355 0 0 1 60.66 27.5Z" fill="#FFF" /></g><circle fill="#FFF" cx="68.071" cy="12" r="4" /><path d="M10.607 33.464a1 1 0 0 1 0 1.415l-2.122 2.12 2.122 2.122a1 1 0 1 1-1.415 1.415L7.07 38.414l-2.12 2.122a1 1 0 0 1-1.414-1.415L5.656 37l-2.12-2.12a1 1 0 0 1 1.414-1.415l2.12 2.121 2.122-2.12a1 1 0 0 1 1.415 0Z" fill="#FFF" /></g></g></symbol><symbol viewBox="0 0 126 89" id="icon-noData-no-user"><defs><ellipse id="icon-noData-no-user_a" cx="11.241" cy="11.244" rx="11.241" ry="11.244" /></defs><g fill="none" fill-rule="evenodd"><path d="M0 0h126v89H0z" /><g transform="translate(32 27)"><rect fill="#979FCB" x="3.91" y="5.867" width="58.09" height="38.133" rx="3.911" /><path d="M48.739 0c.54 0 .977.438.977.977v2.934h2.932a.978.978 0 1 1 0 1.956l-2.933-.001.001 2.934a.977.977 0 0 1-1.955 0V5.866h-2.932a.978.978 0 0 1 0-1.955h2.931l.001-2.934c0-.54.438-.977.978-.977Z" fill="#FFF" /><g transform="translate(0 .978)"><mask id="icon-noData-no-user_b" fill="#fff"><use xlink:href="#icon-noData-no-user_a" /></mask><use fill="#FFF" xlink:href="#icon-noData-no-user_a" /><path d="M9.775-1.956c7.82 0 8.797 2.934 8.797 2.934s-.977 5.866-6.842 6.844v-3.91C9.123 9.125 4.887 10.755-.977 8.8-1.955 4.889 1.955-1.956 9.775-1.956Z" fill="#5161A4" mask="url(#icon-noData-no-user_b)" /></g><path d="M30.334 32.19V18.654a2.933 2.933 0 0 1 4.582-2.426l9.956 6.768a2.933 2.933 0 0 1 0 4.852l-9.956 6.768a2.933 2.933 0 0 1-4.582-2.426Z" fill="#5161A4" /><path d="M3.91 27.378h20.527c1.303 0 1.955-.652 1.955-1.956v-5.868a3.91 3.91 0 1 1 7.82 0V26.4c.326 5.867-3.177 8.8-10.508 8.8l1.1 8.8H7.82a3.911 3.911 0 0 1-3.911-3.911V27.378Z" fill="#FFF" /><path fill="#5161A4" d="M5.865 27.378H15.7l-4.422 7.782z" /><path d="M11.241 19.644c1.89 0 3.421-1.22 3.421-3.11H7.82c0 1.89 1.532 3.11 3.421 3.11Z" fill="#979FCB" /></g></g></symbol><symbol viewBox="0 0 128 100" id="icon-svg-dashboard"><path d="M27.429 63.638c0-2.508-.893-4.65-2.679-6.424-1.786-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.465 2.662-1.785 1.774-2.678 3.916-2.678 6.424 0 2.508.893 4.65 2.678 6.424 1.786 1.775 3.94 2.662 6.465 2.662 2.524 0 4.678-.887 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zm13.714-31.801c0-2.508-.893-4.65-2.679-6.424-1.785-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zM71.714 65.98l7.215-27.116c.285-1.23.107-2.378-.536-3.443-.643-1.064-1.56-1.762-2.75-2.094-1.19-.33-2.333-.177-3.429.462-1.095.639-1.81 1.573-2.143 2.804l-7.214 27.116c-2.857.237-5.405 1.266-7.643 3.088-2.238 1.822-3.738 4.152-4.5 6.992-.952 3.644-.476 7.098 1.429 10.364 1.905 3.265 4.69 5.37 8.357 6.317 3.667.947 7.143.474 10.429-1.42 3.285-1.892 5.404-4.66 6.357-8.305.762-2.84.619-5.607-.429-8.305-1.047-2.697-2.762-4.85-5.143-6.46zm47.143-2.342c0-2.508-.893-4.65-2.678-6.424-1.786-1.775-3.94-2.662-6.465-2.662-2.524 0-4.678.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.786 1.775 3.94 2.662 6.464 2.662 2.524 0 4.679-.887 6.465-2.662 1.785-1.775 2.678-3.916 2.678-6.424zm-45.714-45.43c0-2.509-.893-4.65-2.679-6.425C68.68 10.01 66.524 9.122 64 9.122c-2.524 0-4.679.887-6.464 2.661-1.786 1.775-2.679 3.916-2.679 6.425 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zm32 13.629c0-2.508-.893-4.65-2.679-6.424-1.785-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zM128 63.638c0 12.351-3.357 23.78-10.071 34.286-.905 1.372-2.19 2.058-3.858 2.058H13.93c-1.667 0-2.953-.686-3.858-2.058C3.357 87.465 0 76.037 0 63.638c0-8.613 1.69-16.847 5.071-24.703C8.452 31.08 13 24.312 18.714 18.634c5.715-5.68 12.524-10.199 20.429-13.559C47.048 1.715 55.333.035 64 .035c8.667 0 16.952 1.68 24.857 5.04 7.905 3.36 14.714 7.88 20.429 13.559 5.714 5.678 10.262 12.446 13.643 20.301 3.38 7.856 5.071 16.09 5.071 24.703z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-example"><path d="M96.258 57.462h31.421C124.794 27.323 100.426 2.956 70.287.07v31.422a32.856 32.856 0 0 1 25.971 25.97zm-38.796-25.97V.07C27.323 2.956 2.956 27.323.07 57.462h31.422a32.856 32.856 0 0 1 25.97-25.97zm12.825 64.766v31.421c30.46-2.885 54.507-27.253 57.713-57.712H96.579c-2.886 13.466-13.146 23.726-26.292 26.291zM31.492 70.287H.07c2.886 30.46 27.253 54.507 57.713 57.713V96.579c-13.466-2.886-23.726-13.146-26.291-26.292z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-svg-eye-open"><path d="M512 128q69.675 0 135.51 21.163t115.498 54.997 93.483 74.837 73.685 82.006 51.67 74.837 32.17 54.827L1024 512q-2.347 4.992-6.315 13.483T998.87 560.17t-31.658 51.669-44.331 59.99-56.832 64.34-69.504 60.16-82.347 51.5-94.848 34.687T512 896q-69.675 0-135.51-21.163t-115.498-54.826-93.483-74.326-73.685-81.493-51.67-74.496-32.17-54.997L0 513.707q2.347-4.992 6.315-13.483t18.816-34.816 31.658-51.84 44.331-60.33 56.832-64.683 69.504-60.331 82.347-51.84 94.848-34.816T512 128.085zm0 85.333q-46.677 0-91.648 12.331t-81.152 31.83-70.656 47.146-59.648 54.485-48.853 57.686-37.675 52.821-26.325 43.99q12.33 21.674 26.325 43.52t37.675 52.351 48.853 57.003 59.648 53.845T339.2 767.02t81.152 31.488T512 810.667t91.648-12.331 81.152-31.659 70.656-46.848 59.648-54.186 48.853-57.344 37.675-52.651T927.957 512q-12.33-21.675-26.325-43.648t-37.675-52.65-48.853-57.345-59.648-54.186-70.656-46.848-81.152-31.659T512 213.334zm0 128q70.656 0 120.661 50.006T682.667 512 632.66 632.661 512 682.667 391.339 632.66 341.333 512t50.006-120.661T512 341.333zm0 85.334q-35.328 0-60.33 25.002T426.666 512t25.002 60.33T512 597.334t60.33-25.002T597.334 512t-25.002-60.33T512 426.666z" /></symbol><symbol viewBox="0 0 128 64" id="icon-svg-eye"><path d="M127.072 7.994c1.37-2.208.914-5.152-.914-6.87-2.056-1.717-4.797-1.226-6.396.982-.229.245-25.586 32.382-55.74 32.382-29.24 0-55.74-32.382-55.968-32.627-1.6-1.963-4.57-2.208-6.397-.49C-.17 3.086-.399 6.275 1.2 8.238c.457.736 5.94 7.36 14.62 14.72L4.17 35.96c-1.828 1.963-1.6 5.152.228 6.87.457.98 1.6 1.471 2.742 1.471s2.284-.49 3.198-1.472l12.564-13.983c5.94 4.416 13.021 8.587 20.788 11.53l-4.797 17.418c-.685 2.699.686 5.397 3.198 6.133h1.37c2.057 0 3.884-1.472 4.341-3.68L52.6 42.83c3.655.736 7.538 1.227 11.422 1.227 3.883 0 7.767-.49 11.422-1.227l4.797 17.173c.457 2.208 2.513 3.68 4.34 3.68.457 0 .914 0 1.143-.246 2.513-.736 3.883-3.434 3.198-6.133l-4.797-17.172c7.767-2.944 14.848-7.114 20.788-11.53l12.336 13.738c.913.981 2.056 1.472 3.198 1.472s2.284-.49 3.198-1.472c1.828-1.963 1.828-4.906.228-6.87l-11.65-13.001c9.366-7.36 14.849-14.474 14.849-14.474z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-form"><path d="M84.068 23.784c-1.02 0-1.877-.32-2.572-.96a8.588 8.588 0 0 1-1.738-2.237 11.524 11.524 0 0 1-1.042-2.621c-.232-.895-.348-1.641-.348-2.238V0h.278c.834 0 1.622.085 2.363.256.742.17 1.645.575 2.711 1.214 1.066.64 2.363 1.535 3.892 2.686 1.53 1.15 3.453 2.664 5.77 4.54 2.502 2.045 4.494 3.771 5.977 5.178 1.483 1.406 2.618 2.6 3.406 3.58.787.98 1.274 1.812 1.46 2.494.185.682.277 1.278.277 1.79v2.046H84.068zM127.3 84.01c.278.682.464 1.535.556 2.558.093 1.023-.37 2.003-1.39 2.94-.463.427-.88.832-1.25 1.215-.372.384-.696.704-.974.96a6.69 6.69 0 0 1-.973.767l-11.816-10.741a44.331 44.331 0 0 0 1.877-1.535 31.028 31.028 0 0 1 1.737-1.406c1.112-.938 2.317-1.343 3.615-1.215 1.297.128 2.363.405 3.197.83.927.427 1.923 1.173 2.989 2.239 1.065 1.065 1.876 2.195 2.432 3.388zM78.23 95.902c2.038 0 3.752-.511 5.143-1.534l-26.969 25.83H18.037c-1.761 0-3.684-.47-5.77-1.407a24.549 24.549 0 0 1-5.838-3.709 21.373 21.373 0 0 1-4.518-5.306c-1.204-2.003-1.807-4.07-1.807-6.202V16.495c0-1.79.44-3.665 1.32-5.626A18.41 18.41 0 0 1 5.04 5.562a21.798 21.798 0 0 1 5.213-3.964C12.198.533 14.237 0 16.37 0h53.24v15.984c0 1.62.278 3.367.834 5.242a16.704 16.704 0 0 0 2.572 5.179c1.159 1.577 2.665 2.898 4.518 3.964 1.853 1.066 4.078 1.598 6.673 1.598h20.295v42.325L85.458 92.45c1.02-1.364 1.529-2.856 1.529-4.476 0-2.216-.857-4.113-2.572-5.69-1.714-1.577-3.776-2.366-6.186-2.366H26.1c-2.409 0-4.448.789-6.116 2.366-1.668 1.577-2.502 3.474-2.502 5.69 0 2.217.834 4.092 2.502 5.626 1.668 1.535 3.707 2.302 6.117 2.302h52.13zM26.1 47.951c-2.41 0-4.449.789-6.117 2.366-1.668 1.577-2.502 3.473-2.502 5.69 0 2.216.834 4.092 2.502 5.626 1.668 1.534 3.707 2.302 6.117 2.302h52.13c2.409 0 4.47-.768 6.185-2.302 1.715-1.534 2.572-3.41 2.572-5.626 0-2.217-.857-4.113-2.572-5.69-1.714-1.577-3.776-2.366-6.186-2.366H26.1zm52.407 64.063 1.807-1.663 3.476-3.196a479.75 479.75 0 0 0 4.587-4.284 500.757 500.757 0 0 1 5.004-4.667c3.985-3.666 8.48-7.758 13.485-12.276l11.677 10.741-13.485 12.404-5.004 4.603-4.587 4.22a179.46 179.46 0 0 0-3.267 3.068c-.88.853-1.367 1.322-1.46 1.407-.463.341-.973.703-1.529 1.087-.556.383-1.112.703-1.668.959-.556.256-1.413.575-2.572.959a83.5 83.5 0 0 1-3.545 1.087 72.2 72.2 0 0 1-3.475.895c-1.112.256-1.946.426-2.502.511-1.112.17-1.854.043-2.224-.383-.371-.426-.464-1.151-.278-2.174.092-.511.278-1.279.556-2.302.278-1.023.602-2.067.973-3.132l1.042-3.005c.325-.938.58-1.577.765-1.918a10.157 10.157 0 0 1 2.224-2.941z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-link"><path d="M115.625 127.937H.063V12.375h57.781v12.374H12.438v90.813h90.813V70.156h12.374z" /><path d="m116.426 2.821 8.753 8.753-56.734 56.734-8.753-8.745z" /><path d="M127.893 37.982h-12.375V12.375H88.706V0h39.187z" /></symbol><symbol viewBox="0 0 33 52" id="icon-svg-loading"><path d="M11.522 33.8c-.608 1.65-.357 3.564.83 4.99 1.766 2.13 4.931 2.383 7.083.557 2.143-1.826 2.452-5.03.686-7.159-1.506-1.816-4.025-2.266-6.07-1.23a3.02 3.02 0 0 1 2.923 1.025c1.081 1.309.898 3.272-.424 4.385-1.313 1.114-3.253.967-4.333-.342a3.036 3.036 0 0 1-.695-2.226Zm4.713 10.83c-5.003 0-9.059-4.096-9.059-9.14 0-5.045 4.056-9.141 9.059-9.141 5.003 0 9.059 4.096 9.059 9.14 0 5.055-4.056 9.141-9.06 9.141Zm5.62-24.83c6.126 2.337 10.484 8.372 10.484 15.453 0 9.099-7.208 16.487-16.104 16.487C7.339 51.74.13 44.362.13 35.253c0-7.839 5.342-14.397 12.5-16.067V2.935c0-1.096.865-1.978 1.937-1.978 5.897 0 10.693 4.867 10.693 10.882a11.015 11.015 0 0 1-3.405 7.962Zm-5.62 27.877c6.674 0 12.078-5.687 12.078-12.695 0-7.009-5.404-12.696-12.078-12.696-6.674 0-12.078 5.687-12.078 12.696 0 7.008 5.404 12.695 12.078 12.695Zm0-29.454c2.915-.838 5.032-3.482 5.032-6.601 0-3.12-2.117-5.754-5.032-6.602v13.203Z" fill="#01C1B5" fill-rule="evenodd" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-nested"><path d="M.002 9.2c0 5.044 3.58 9.133 7.998 9.133 4.417 0 7.997-4.089 7.997-9.133 0-5.043-3.58-9.132-7.997-9.132S.002 4.157.002 9.2zM31.997.066h95.981V18.33H31.997V.066zm0 45.669c0 5.044 3.58 9.132 7.998 9.132 4.417 0 7.997-4.088 7.997-9.132 0-3.263-1.524-6.278-3.998-7.91-2.475-1.63-5.524-1.63-7.998 0-2.475 1.632-4 4.647-4 7.91zM63.992 36.6h63.986v18.265H63.992V36.6zm-31.995 82.2c0 5.043 3.58 9.132 7.998 9.132 4.417 0 7.997-4.089 7.997-9.132 0-5.044-3.58-9.133-7.997-9.133s-7.998 4.089-7.998 9.133zm31.995-9.131h63.986v18.265H63.992V109.67zm0-27.404c0 5.044 3.58 9.133 7.998 9.133 4.417 0 7.997-4.089 7.997-9.133 0-3.263-1.524-6.277-3.998-7.909-2.475-1.631-5.524-1.631-7.998 0-2.475 1.632-4 4.646-4 7.91zm31.995-9.13h31.991V91.4H95.987V73.135z" /></symbol><symbol fill="curentColor" viewBox="0 0 128 128" id="icon-svg-password"><path d="M108.8 44.322H89.6v-5.36c0-9.04-3.308-24.163-25.6-24.163-23.145 0-25.6 16.881-25.6 24.162v5.361H19.2v-5.36C19.2 15.281 36.798 0 64 0c27.202 0 44.8 15.281 44.8 38.961v5.361zm-32 39.356c0-5.44-5.763-9.832-12.8-9.832-7.037 0-12.8 4.392-12.8 9.832 0 3.682 2.567 6.808 6.407 8.477v11.205c0 2.718 2.875 4.962 6.4 4.962 3.524 0 6.4-2.244 6.4-4.962V92.155c3.833-1.669 6.393-4.795 6.393-8.477zM128 64v49.201c0 8.158-8.645 14.799-19.2 14.799H19.2C8.651 128 0 121.359 0 113.201V64c0-8.153 8.645-14.799 19.2-14.799h89.6c10.555 0 19.2 6.646 19.2 14.799z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-table"><path d="M.006.064h127.988v31.104H.006V.064zm0 38.016h38.396v41.472H.006V38.08zm0 48.384h38.396v41.472H.006V86.464zM44.802 38.08h38.396v41.472H44.802V38.08zm0 48.384h38.396v41.472H44.802V86.464zM89.598 38.08h38.396v41.472H89.598zm0 48.384h38.396v41.472H89.598z" /><path d="M.006.064h127.988v31.104H.006V.064zm0 38.016h38.396v41.472H.006V38.08zm0 48.384h38.396v41.472H.006V86.464zM44.802 38.08h38.396v41.472H44.802V38.08zm0 48.384h38.396v41.472H44.802V86.464zM89.598 38.08h38.396v41.472H89.598zm0 48.384h38.396v41.472H89.598z" /></symbol><symbol viewBox="0 0 128 128" id="icon-svg-tree"><path d="M126.713 90.023c.858.985 1.287 2.134 1.287 3.447v29.553c0 1.423-.429 2.6-1.287 3.53-.858.93-1.907 1.395-3.146 1.395H97.824c-1.145 0-2.146-.465-3.004-1.395-.858-.93-1.287-2.107-1.287-3.53V93.47c0-.875.19-1.696.572-2.462.382-.766.906-1.368 1.573-1.806a3.84 3.84 0 0 1 2.146-.657h9.725V69.007a3.84 3.84 0 0 0-.43-1.806 3.569 3.569 0 0 0-1.143-1.313 2.714 2.714 0 0 0-1.573-.492h-36.47v23.149h9.725c1.144 0 2.145.492 3.004 1.478.858.985 1.287 2.134 1.287 3.447v29.553c0 .876-.191 1.696-.573 2.463-.38.766-.905 1.368-1.573 1.806a3.84 3.84 0 0 1-2.145.656H51.915a3.84 3.84 0 0 1-2.145-.656c-.668-.438-1.216-1.04-1.645-1.806a4.96 4.96 0 0 1-.644-2.463V93.47c0-1.313.43-2.462 1.288-3.447.858-.986 1.907-1.478 3.146-1.478h9.582v-23.15h-37.9c-.953 0-1.74.356-2.359 1.068-.62.711-.93 1.56-.93 2.544v19.538h9.726c1.239 0 2.264.492 3.074 1.478.81.985 1.216 2.134 1.216 3.447v29.553c0 1.423-.405 2.6-1.216 3.53-.81.93-1.835 1.395-3.074 1.395H4.29c-.476 0-.93-.082-1.358-.246a4.1 4.1 0 0 1-1.144-.657 4.658 4.658 0 0 1-.93-1.067 5.186 5.186 0 0 1-.643-1.395 5.566 5.566 0 0 1-.215-1.56V93.47c0-.437.048-.875.143-1.313a3.95 3.95 0 0 1 .429-1.15c.19-.328.429-.656.715-.984.286-.329.572-.602.858-.821.286-.22.62-.383 1.001-.493.382-.11.763-.164 1.144-.164h9.726V61.619c0-.985.31-1.833.93-2.544.619-.712 1.358-1.068 2.216-1.068h44.335V39.62h-9.582c-1.24 0-2.288-.492-3.146-1.477a5.09 5.09 0 0 1-1.287-3.448V5.14c0-1.423.429-2.627 1.287-3.612.858-.985 1.907-1.477 3.146-1.477h25.743c.763 0 1.478.246 2.145.739a5.17 5.17 0 0 1 1.573 1.888c.382.766.573 1.587.573 2.462v29.553c0 1.313-.43 2.463-1.287 3.448-.859.985-1.86 1.477-3.004 1.477h-9.725v18.389h42.762c.954 0 1.74.355 2.36 1.067.62.711.93 1.56.93 2.545v26.925h9.582c1.239 0 2.288.492 3.146 1.478z" /></symbol><symbol fill="curentColor" viewBox="0 0 130 130" id="icon-svg-user"><path d="M63.444 64.996c20.633 0 37.359-14.308 37.359-31.953 0-17.649-16.726-31.952-37.359-31.952-20.631 0-37.36 14.303-37.358 31.952 0 17.645 16.727 31.953 37.359 31.953zM80.57 75.65H49.434c-26.652 0-48.26 18.477-48.26 41.27v2.664c0 9.316 21.608 9.325 48.26 9.325H80.57c26.649 0 48.256-.344 48.256-9.325v-2.663c0-22.794-21.605-41.271-48.256-41.271z" stroke="currentColor" /></symbol>',e.insertBefore(t,e.lastChild)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n):n()}const Eu=ga({setup(n){const e=ir.parse(location.search),t=location.href.split("#/")[1],r=ir.parse(t.split("?")[1]),i=e.roomUid||r.roomUid||"";return i&&sessionStorage.setItem("roomUid",i),(o,s)=>{const u=su("router-view");return ns(),Xo(ts(ou),{locale:ts(cu),message:{max:1}},{default:es(()=>[ci(u,null,{default:es(({Component:d})=>[(ns(),Xo(au(d)))]),_:1})]),_:1},8,["locale"])}}}),Cu="modulepreload",rs={},yu="./",qr=function(e,t){return!t||t.length===0?e():Promise.all(t.map(r=>{if(r=`${yu}${r}`,r in rs)return;rs[r]=!0;const i=r.endsWith(".css"),o=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${o}`))return;const s=document.createElement("link");if(s.rel=i?"stylesheet":Cu,i||(s.as="script",s.crossOrigin=""),s.href=r,document.head.appendChild(s),i)return new Promise((u,d)=>{s.addEventListener("load",u),s.addEventListener("error",d)})})).then(()=>e())};function Tu(n){switch(n){case"../src/pages/404/index.tsx":return qr(()=>import("./index.0da1cc3f.js"),["assets/index.0da1cc3f.js","assets/index.49150f4c.css","assets/vendor.8df6bc42.js"]);case"../src/pages/home/index.tsx":return qr(()=>import("./index.29059490.js"),["assets/index.29059490.js","assets/index.ed5e518a.css","assets/vendor.8df6bc42.js"]);case"../src/pages/login/index.tsx":return qr(()=>import("./index.b615e3d7.js"),["assets/index.b615e3d7.js","assets/index.526ec19c.css","assets/vendor.8df6bc42.js"]);default:return new Promise(function(e,t){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(t.bind(null,new Error("Unknown variable dynamic import: "+n)))})}}const Un=n=>async()=>{let e=Promise.resolve(null);try{e=await Tu(`../src/pages/${n}/index.tsx`)}catch{e=Promise.reject()}return e};var Su=[{path:"/",component:Un("home")},{path:"/home",component:Un("home")},{path:"/login",component:Un("login")},{path:"/:pathMatch(.*)*",component:Un("404"),meta:{title:"404 Not Fund"}}],fn=uu({history:du(),routes:Su}),Iu=ga({name:"SvgIcon",props:{prefix:{type:String,default:"icon"},name:{type:String,required:!0},color:{type:String,default:"#333"}},render(){const{name:n,prefix:e,color:t}=this,r=`#${e}-${n}`;return ci("svg",lu(this.$attrs,{"aria-hidden":"true",style:{color:t}}),[ci("use",{href:r,fill:t},null)])}}),bu={install(n){n.component("SvgIcon",Iu)}};const ji="live_admin_token",_a=()=>sessionStorage.getItem(ji);function uh(n){return sessionStorage.setItem(ji,n)}function va(){return sessionStorage.removeItem(ji)}let cn=0,Ra;const Ou=n=>{if(cn===0){const e=Object.assign({lock:!0,text:"\u52A0\u8F7D\u4E2D...",background:"rgba(0, 0, 0, 0.7)"},n);Ra=hu.service(_t({},e))}cn++},Nu=()=>{cn<=0||(cn--,cn===0&&Ra.close())};var ui;(function(n){n[n.READ=1]="READ",n[n.LISTENED=2]="LISTENED",n[n.DOWNLOADED=4]="DOWNLOADED",n[n.RETRIEVED=8]="RETRIEVED",n[n.UNREAD=0]="UNREAD"})(ui||(ui={}));var at,Gr,gn=ui,wu=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],Mu=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],Au=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],is={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0},"RC:FileMsg":{isCounted:!0,isPersited:!0},"RC:HQVCMsg":{isCounted:!0,isPersited:!0},"RC:LBSMsg":{isCounted:!0,isPersited:!0},"RC:PSImgTxtMsg":{isCounted:!0,isPersited:!0},"RC:PSMultiImgTxtMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpOpendMsg":{isCounted:!0,isPersited:!0},"RC:CombineMsg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1}},Pu=["RC:TypSts","RC:InterceptMsg"];(function(n){n.WEBSOCKET="websocket",n.COMET="comet"})(at||(at={}));var Or=function(n){return Gr||(Gr={set:function(e,t){n.localStorage.setItem(e,JSON.stringify(t))},get:function(e){var t;try{t=JSON.parse(n.localStorage.getItem(e))}catch{t=null}return t},remove:function(e){return n.localStorage.removeItem(e)},getKeys:function(){var e=[];for(var t in n.localStorage)e.push(t);return e}}),Gr},Lu=function(){function n(e){this._caches={},e&&(this._caches=e)}return n.prototype.set=function(e,t){this._caches[e]=t},n.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},n.prototype.get=function(e){return this._caches[e]},n.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},n}(),os=function(){function n(e,t){var r,i=t?"RCV4-"+t:"RCV4-";this._rootStorage=Or(e);var o=this._rootStorage.get(i)||{};this._cache=new Lu(((r={})[i]=o,r)),this._storageKey=i}return n.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},n.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},n.prototype.set=function(e,t){var r=this._get();r[e]=t,this._set(r)},n.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},n.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},n.prototype.get=function(e){return this._get()[e]},n.prototype.getKeys=function(){var e=this._get(),t=[];for(var r in e)t.push(r);return t},n.prototype.getValues=function(){return this._get()||{}},n}(),Ea=function(n,e){return(Ea=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])})(n,e)};function Re(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}Ea(n,e),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var fe=function(){return(fe=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}).apply(this,arguments)};function D(n,e,t,r){return new(t||(t=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function u(l){try{d(r.throw(l))}catch(h){o(h)}}function d(l){var h;l.done?i(l.value):(h=l.value,h instanceof t?h:new t(function(a){a(h)})).then(s,u)}d((r=r.apply(n,e||[])).next())})}function x(n,e){var t,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(d){return function(l){return function(h){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(i=2&h[0]?r.return:h[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,h[1])).done)return i;switch(r=0,i&&(h=[2&h[0],i.value]),h[0]){case 0:case 1:i=h;break;case 4:return s.label++,{value:h[1],done:!1};case 5:s.label++,r=h[1],h=[0];continue;case 7:h=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||h[0]!==6&&h[0]!==2)){s=0;continue}if(h[0]===3&&(!i||h[1]>i[0]&&h[1]<i[3])){s.label=h[1];break}if(h[0]===6&&s.label<i[1]){s.label=i[1],i=h;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(h);break}i[2]&&s.ops.pop(),s.trys.pop();continue}h=e.call(n,s)}catch(a){h=[6,a],r=0}finally{t=i=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([d,l])}}}function yt(n,e){for(var t=0,r=e.length,i=n.length;t<r;t++,i++)n[i]=e[t];return n}var Te,or;(function(n){function e(t){return n.call(this,"TODO => "+t)||this}return Re(e,n),e})(Error);var ss=function(n,e,t){if(e===void 0||t===void 0)return n.toUpperCase();var r=n.slice(e,t);return n=n.replace(r,function(i){return i.toUpperCase()})},Ca=function(n,e){e===void 0&&(e="utf-8");var t,r=0;if(e==="utf-16")for(var i=0,o=n.length;i<o;i++)r+=(t=n.charCodeAt(i))<=65535?2:4;else for(i=0,o=n.length;i<o;i++)r+=(t=n.charCodeAt(i))<127?1:t<=2047?2:t<=65535?3:4;return r},Nr=function(n,e){if(n=n.replace(/\?$/,""),!e)return n;var t=Object.keys(e).map(function(r){return r+"="+e[r]}).filter(function(r){return!!r});return t.length?[n,t.join("&")].join("?"):n},Ki=function(n){return n.match(/\d+(\.\d+){2}/)[0]};(function(n){n[n.LOG=0]="LOG",n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.FATAL=4]="FATAL",n[n.NONE=1e3]="NONE"})(Te||(Te={})),function(n){n.IM="IM",n.RTC="RTC"}(or||(or={}));var Ut="RC_Logs";function ku(n){var e=n.target.result;n.oldVersion===1&&e.deleteObjectStore(Ut),function(t,r,i){var o;if(!t.objectStoreNames.contains(r)){var s=fe({},i.objectStoreParams);o=t.createObjectStore(r,s),i.indexs&&i.indexs.length>0&&i.indexs.forEach(function(u){o.createIndex(u.indexName,u.key,{unique:u.unique})})}}(e,Ut,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var di,qi=function(){function n(){}return n.init=function(){if(typeof window!="undefined"&&window&&window.indexedDB){var e=window.indexedDB.open("RC_ENGINE_DB",2);e.onerror=function(t){console.warn("open indexDB request failed "+t.target.error)},e.onsuccess=function(t){n._db=t.target.result,n._db&&(n._db.onclose=function(r){var i;console.warn("The database "+((i=n._db)===null||i===void 0?void 0:i.name)+" has unexpectedly closed.",r),n._db=null,n._instance=null},n._db.onerror=function(r){var i;console.warn("The database "+((i=n._db)===null||i===void 0?void 0:i.name)+" has opening error.",r),n._db=null,n._instance=null},n._db.onabort=function(r){var i;console.warn("The database "+((i=n._db)===null||i===void 0?void 0:i.name)+" has opening aborted.",r),n._db=null,n._instance=null}),n._instance=new n},e.onupgradeneeded=function(t){n._db=t.target.result,ku(t)}}else console.debug("IndexDB is not currently supported in the environment!")},n.getInstance=function(){return n._instance},n.prototype.addList=function(e,t){return new Promise(function(r){if(n._db){var i=n._db.transaction([e],"readwrite"),o=i.objectStore(e);t.forEach(function(s){o==null||o.add(s)}),i.oncomplete=function(s){r(!0)},i.onerror=function(s){r(!1)}}else r(!1)})},n.prototype.getRangeData=function(e,t,r,i){return new Promise(function(o){if(n._db){var s=n._db.transaction([e],"readwrite").objectStore(e),u=IDBKeyRange.bound(r,i),d=s.index(t),l=[],h=d.openCursor(u);h.onsuccess=function(a){var c=a.target.result;c?(l.push(c.value),c.continue()):o(l)},h.onerror=function(a){console.error(a),o([])}}else o([])})},n.prototype.getCount=function(e,t){return new Promise(function(r){if(n._db){var i=n._db.transaction([e],"readonly").objectStore(e).count();i.onsuccess=function(){r(i.result)},i.onerror=function(o){console.error(o),r(0)}}else r(0)})},n.prototype.removeFirstData=function(e,t,r){return new Promise(function(i){if(n._db){var o=n._db.transaction([e],"readwrite").objectStore(e),s=o.getAllKeys(IDBKeyRange.lowerBound(0),r);s.onsuccess=function(){var u=s.result;u.length>0&&(o.delete(IDBKeyRange.bound(u[0],u[u.length-1])).onsuccess=function(){i(!0)})}}else i(!1)})},n._db=null,n}(),ya=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var e=16*Math.random()|0;return(n==="x"?e:3&e|8).toString(16)})},Ta=function(){var n=ya();if(n=n.replace(/-/g,"")+"a",(n=function(r){var i="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),o=i.length+1,s=+r,u=[];do{var d=s%o;s=(s-d)/o,u.unshift(i[d])}while(s);return u.join("")}(n=parseInt(n,16))).length>22&&(n=n.slice(0,22)),n.length<22)for(var e=22-n.length,t=0;t<e;t++)n+="0";return n};(function(n){n[n.NONE=0]="NONE",n[n.PRIVATE=1]="PRIVATE",n[n.DISCUSSION=2]="DISCUSSION",n[n.GROUP=3]="GROUP",n[n.CHATROOM=4]="CHATROOM",n[n.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",n[n.SYSTEM=6]="SYSTEM",n[n.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",n[n.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",n[n.RTC_ROOM=12]="RTC_ROOM"})(di||(di={}));var li,J=di;(function(n){n[n.IMAGE=1]="IMAGE",n[n.AUDIO=2]="AUDIO",n[n.VIDEO=3]="VIDEO",n[n.FILE=4]="FILE",n[n.SIGHT=5]="SIGHT",n[n.COMBINE_HTML=6]="COMBINE_HTML"})(li||(li={}));var Nt,hi,Se=li,Be=function(n){return typeof n=="string"},sr=function(n){return typeof n=="boolean"},_e=function(n){return typeof n=="number"&&!isNaN(n)},De=function(n){return Object.prototype.toString.call(n).indexOf("Array")!==-1},Sa=function(n){return Object.prototype.toString.call(n)==="[object ArrayBuffer]"},Ve=function(n){return Be(n)&&n.length>0},Ne=function(n){return Object.prototype.toString.call(n)==="[object Object]"},ar=function(n){return Object.prototype.toString.call(n)==="[object Function]"},de=function(n){return n===void 0||Object.prototype.toString.call(n)==="[object Undefined]"},as=function(n){return Object.prototype.toString.call(n)==="[object Null]"},mn=function(n){return Be(n)&&/https?:\/\//.test(n)},un=function(n){for(var e in n)return!0;return!1},Uu=function(n){return _e(n)&&Object.prototype.hasOwnProperty.call(Se,n)},cs=((Nt={})[Te.DEBUG]=console.debug.bind(console),Nt[Te.INFO]=console.info.bind(console),Nt[Te.WARN]=console.warn.bind(console),Nt[Te.ERROR]=console.error.bind(console),Nt[Te.FATAL]=console.log.bind(console),Nt),us=function(n){return Be(n)||_e(n)||de(n)||sr(n)?n:n instanceof Error?JSON.stringify({name:n.name,message:n.message,stack:n.stack}):JSON.stringify(n)},gt=function(){function n(e,t,r){this.tag=e,this.type=t,this.initiator=r,this._outLevel=Te.WARN,this.debug=this.log.bind(this,Te.DEBUG),this.info=this.log.bind(this,Te.INFO),this.warn=this.log.bind(this,Te.WARN),this.error=this.log.bind(this,Te.ERROR),this.fatal=this.log.bind(this,Te.FATAL)}return n.init=function(e){n.userId=e},n.reset=function(){n.userId=""},n.prototype._defaultStdout=function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];cs[e].apply(cs,yt([t+":"],r))},n.prototype.__pushLocalLog=function(e,t,r){var i;i=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?or.RTC:or.IM;var o=Date.now();Ca(t)>=1e3&&(t=function(l,h,a){if(a===void 0&&(a="utf-8"),!l||!h)return"";var c=a==="utf-8"?3:2,p=0,f=0,m="";for(f=0;f<l.length;f++){if(l.charCodeAt(f)>255?p+=c:p++,p>h)return m;m+=l.charAt(f)}return l}(t,1e3));var s=JSON.stringify({message:t,userId:n.userId}).replace(/"/g,'""'),u=/^[\w]+-[\w]+-[\w]+?/.test(r)?r:(this.initiator||"L")+"-"+r+"-O",d={sessionId:n.sessionId,time:o,level:4-e,content:n.sessionId+","+Date.now()+","+i+","+(4-e)+","+u+',"'+s+`"
  2. `,userId:n.userId};n.databaseLogList.push(d),(n.databaseLogList.length>=100||e===Te.FATAL)&&this.__insertLogIntoDatabase()},n.prototype.__insertLogIntoDatabase=function(){return D(this,void 0,void 0,function(){var e,t,r;return x(this,function(i){switch(i.label){case 0:return e=yt([],n.databaseLogList),n.databaseLogList=[],(t=qi.getInstance())?[4,t.addList(Ut,e)]:[3,3];case 1:return r=i.sent(),[4,t.getCount(Ut,"time")];case 2:return i.sent()>1e5&&t.removeFirstData(Ut,"time",2e3),[2,r];case 3:return[2,!1]}})})},n.prototype.setLogLevel=function(e){this._outLevel=typeof e!="number"?Te.WARN:e},n.prototype.setLogStdout=function(e){this._logStdout=e},n.prototype.log=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(e>Te.DEBUG&&this.__pushLocalLog(e,t.map(us).join(" "),this.tag),!(e<this._outLevel)){var i=new Date().toISOString()+"["+this.tag+"]["+Te[e]+"]",o=i+" - "+t.map(us).join(" ");this._logStdout?this._logStdout(e,o):this._stdout?this._stdout(e,o):this._defaultStdout.apply(this,yt([e,i],t))}},n.prototype.reportLog=function(e,t,r){this.__pushLocalLog(4-e,r,t);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'+i+'"';var o={level:e,content:[n.sessionId,Date.now(),this.type,e,t,i].join()+`
  3. `};n.realTimeLogList.push(o),n.realTimeLogList.length>=600&&(n.realTimeLogList=n.realTimeLogList.slice(-500))},n.prototype.set=function(e,t){this.warn("logger.set has being deprecated!")},n.prototype.setStdout=function(e){this._stdout=e},n.prototype.__clearRealTimeLog=function(){n.realTimeLogList=[]},n.databaseLogList=[],n.realTimeLogList=[],n.sessionId=Ta(),n.userId="",n}(),j=new gt("RCLog"),In=function(){function n(){this._map={}}return n.prototype.on=function(e,t,r){var i=this._map[e]||(this._map[e]=[]);i.some(function(o){return o.listener===t&&o.target===r})||i.push({listener:t,target:r})},n.prototype.once=function(e,t,r){var i=this._map[e]||(this._map[e]=[]);i.some(function(o){return o.listener===t&&o.target===r})||i.push({listener:t,target:r,once:!0})},n.prototype.off=function(e,t,r){var i=this._map[e];i&&((i=i.filter(function(o){return o.listener!==t||o.target!==r})).length?this._map[e]=i:delete this._map[e])},n.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var i=this._map[e];if(i)for(var o=i.length-1;o>=0;o-=1){var s=i[o],u=s.target,d=s.once,l=s.listener;d&&i.splice(o,1);try{l.call.apply(l,yt([u],t))}catch(h){j.error(h)}}},n.prototype.removeAll=function(e){delete this._map[e]},n.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},n}();(function(n){n[n.SEND=1]="SEND",n[n.RECEIVE=2]="RECEIVE"})(hi||(hi={}));var pi,je=hi;(function(n){n[n.TIMEOUT=-1]="TIMEOUT",n[n.UNKNOWN=-2]="UNKNOWN",n[n.PARAMETER_ERROR=-3]="PARAMETER_ERROR",n[n.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",n[n.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",n[n.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",n[n.SUCCESS=0]="SUCCESS",n[n.RC_MSG_UNAUTHORIZED=20406]="RC_MSG_UNAUTHORIZED",n[n.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",n[n.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",n[n.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",n[n.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",n[n.RECALL_MESSAGE=25101]="RECALL_MESSAGE",n[n.NOT_IN_GROUP=22406]="NOT_IN_GROUP",n[n.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",n[n.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",n[n.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",n[n.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",n[n.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",n[n.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",n[n.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",n[n.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",n[n.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",n[n.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",n[n.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",n[n.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",n[n.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",n[n.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",n[n.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",n[n.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",n[n.INVITE_DICUSSION=21409]="INVITE_DICUSSION",n[n.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",n[n.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",n[n.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",n[n.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",n[n.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",n[n.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",n[n.RC_HTTP_REQ_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",n[n.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",n[n.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",n[n.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",n[n.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",n[n.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",n[n.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",n[n.RC_PING_SEND_FAIL=30012]="RC_PING_SEND_FAIL",n[n.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",n[n.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",n[n.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",n[n.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",n[n.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",n[n.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",n[n.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",n[n.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",n[n.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",n[n.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",n[n.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",n[n.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",n[n.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",n[n.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",n[n.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",n[n.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",n[n.RC_OTP_USED=31027]="RC_OTP_USED",n[n.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",n[n.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",n[n.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",n[n.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",n[n.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",n[n.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",n[n.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",n[n.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",n[n.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",n[n.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",n[n.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",n[n.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",n[n.TAG_EXISTS=33101]="TAG_EXISTS",n[n.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",n[n.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",n[n.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",n[n.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",n[n.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",n[n.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",n[n.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",n[n.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",n[n.CONVER_CLEAR_ERROR=34007]="CONVER_CLEAR_ERROR",n[n.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",n[n.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",n[n.CLEAR_HIS_TIME_ERROR=34011]="CLEAR_HIS_TIME_ERROR",n[n.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",n[n.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",n[n.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",n[n.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",n[n.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",n[n.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",n[n.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",n[n.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",n[n.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",n[n.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",n[n.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",n[n.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",n[n.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",n[n.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",n[n.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",n[n.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",n[n.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",n[n.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",n[n.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",n[n.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",n[n.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",n[n.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",n[n.NOT_SUPPORT=39002]="NOT_SUPPORT",n[n.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",n[n.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",n[n.COOKIE_ENABLE=51001]="COOKIE_ENABLE",n[n.GET_MESSAGE_BY_ID_ERROR=61001]="GET_MESSAGE_BY_ID_ERROR",n[n.HAVNODEVICEID=24001]="HAVNODEVICEID",n[n.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",n[n.FEILD=24009]="FEILD",n[n.VOIPISNULL=24013]="VOIPISNULL",n[n.NOENGINETYPE=24010]="NOENGINETYPE",n[n.NULLCHANNELNAME=24011]="NULLCHANNELNAME",n[n.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",n[n.NOVOIP=24014]="NOVOIP",n[n.INTERNALERRROR=24015]="INTERNALERRROR",n[n.VOIPCLOSE=24016]="VOIPCLOSE",n[n.CLOSE_BEFORE_OPEN=51001]="CLOSE_BEFORE_OPEN",n[n.ALREADY_IN_USE=51002]="ALREADY_IN_USE",n[n.INVALID_CHANNEL_NAME=51003]="INVALID_CHANNEL_NAME",n[n.VIDEO_CONTAINER_IS_NULL=51004]="VIDEO_CONTAINER_IS_NULL",n[n.DELETE_MESSAGE_ID_IS_NULL=61001]="DELETE_MESSAGE_ID_IS_NULL",n[n.CANCEL=1]="CANCEL",n[n.REJECT=2]="REJECT",n[n.HANGUP=3]="HANGUP",n[n.BUSYLINE=4]="BUSYLINE",n[n.NO_RESPONSE=5]="NO_RESPONSE",n[n.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",n[n.NETWORK_ERROR=7]="NETWORK_ERROR",n[n.REMOTE_CANCEL=11]="REMOTE_CANCEL",n[n.REMOTE_REJECT=12]="REMOTE_REJECT",n[n.REMOTE_HANGUP=13]="REMOTE_HANGUP",n[n.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",n[n.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",n[n.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",n[n.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",n[n.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",n[n.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",n[n.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT"})(pi||(pi={}));var fi,S=pi;(function(n){n[n.CONNECTED=0]="CONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.DISCONNECTED=2]="DISCONNECTED",n[n.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",n[n.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",n[n.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",n[n.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",n[n.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",n[n.BLOCKED=9]="BLOCKED",n[n.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",n[n.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",n[n.REDIRECT=14]="REDIRECT",n[n.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",n[n.ULTRALIMIT=1101]="ULTRALIMIT",n[n.REQUEST_NAVI=201]="REQUEST_NAVI",n[n.RESPONSE_NAVI=202]="RESPONSE_NAVI",n[n.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",n[n.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT"})(fi||(fi={}));var gi,ee=fi,we={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18};(function(n){n.TextMessage="RC:TxtMsg",n.VOICE="RC:VcMsg",n.HQ_VOICE="RC:HQVCMsg",n.IMAGE="RC:ImgMsg",n.GIF="RC:GIFMsg",n.RICH_CONTENT="RC:ImgTextMsg",n.LOCATION="RC:LBSMsg",n.FILE="RC:FileMsg",n.SIGHT="RC:SightMsg",n.COMBINE="RC:CombineMsg",n.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",n.LOG_COMMAND="RC:LogCmdMsg",n.EXPANSION_NOTIFY="RC:MsgExMsg",n.REFERENCE="RC:ReferenceMsg",n.RECALL="RC:RcCmd",n.READ_RECEIPT="RC:ReadNtf",n.READ_RECEIPT_REQUEST="RC:RRReqMsg",n.READ_RECEIPT_RESPONSE="RC:RRRspMsg",n.SYNC_READ_STATUS="RC:SRSMsg",n.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",n.CHATROOM_JOIN="RC:ChrmJoinNtf",n.CHATROOM_LEFT="RC:ChrmQuitNtf",n.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",n.TYPING_STATUS="RC:TypSts",n.INTERCEPT="RC:InterceptMsg"})(gi||(gi={}));var mi,Ae=gi;(function(n){n[n.OPEN=1]="OPEN",n[n.CLOSE=2]="CLOSE"})(mi||(mi={}));var _i,Pt=mi;(function(n){n[n.ALL=1]="ALL",n[n.SINGAL=2]="SINGAL"})(_i||(_i={}));var vi,Gi=_i;(function(n){n[n.QINIU=1]="QINIU",n[n.ALI=2]="ALI",n[n.AWS=3]="AWS",n[n.STC=4]="STC"})(vi||(vi={}));var Ri,Ue=vi;(function(n){n[n.UPDATE=1]="UPDATE",n[n.DELETE=2]="DELETE"})(Ri||(Ri={}));var Ei,xe=Ri;(function(n){n[n.QUIT=0]="QUIT",n[n.JOIN=1]="JOIN"})(Ei||(Ei={}));var ds,ls=Ei;(function(n){/*!
  4. 全局敏感词:命中了融云内置的全局敏感词
  5. */n[n.GLOBAL=1]="GLOBAL",n[n.CUSTOM=2]="CUSTOM",n[n.THIRD_PARTY=3]="THIRD_PARTY"})(ds||(ds={}));var Le,hs,ps;(function(n){n[n.RTC=0]="RTC",n[n.LIVE=2]="LIVE"})(Le||(Le={})),function(n){n[n.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",n[n.AUDIO=1]="AUDIO"}(hs||(hs={})),function(n){n[n.ANCHOR=1]="ANCHOR",n[n.AUDIENCE=2]="AUDIENCE"}(ps||(ps={}));var Xe,cr,Ci,Du={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};(function(n){n[n.ROOM=1]="ROOM",n[n.PERSON=2]="PERSON"})(Xe||(Xe={})),function(n){n[n.AnchorToViewer=1]="AnchorToViewer",n[n.ViewerToAnchor=2]="ViewerToAnchor"}(cr||(cr={})),function(n){n[n.KICK=0]="KICK",n[n.REFUSE=1]="REFUSE",n[n.COEXIST=2]="COEXIST"}(Ci||(Ci={}));var Qe,ye,Yr={engine:"5.1.1"},Tt=function(){function n(){}return n.add=function(e,t){Yr[e]=t},n.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return j.warn("The validation engine version '"+e+"' is invalid!"),!1;var r=t[0].split(".").map(function(i){return i.padStart(3,"0")}).join("");return Yr.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map(function(i){return i.padStart(3,"0")}).join("")>=r},n.getInfo=function(){return Yr},n}();(function(n){n[n.STRING=0]="STRING",n[n.ONLY_STRING=1]="ONLY_STRING",n[n.NUMBER=2]="NUMBER",n[n.BOOLEAN=3]="BOOLEAN",n[n.OBJECT=4]="OBJECT",n[n.ARRAY=5]="ARRAY",n[n.CALLBACK=6]="CALLBACK",n[n.CHANNEL_ID=7]="CHANNEL_ID"})(ye||(ye={}));var it,Me,Fe,St,Et,xu=((Qe={})[ye.STRING]=Ve,Qe[ye.ONLY_STRING]=Be,Qe[ye.NUMBER]=_e,Qe[ye.BOOLEAN]=function(n){return typeof n=="boolean"},Qe[ye.OBJECT]=Ne,Qe[ye.ARRAY]=De,Qe[ye.CALLBACK]=function(n){var e=!0;return Ne(n)||(e=!1),(n=n||{}).onSuccess&&!ar(n.onSuccess)&&(e=!1),n.onError&&!ar(n.onError)&&(e=!1),e},Qe[ye.CHANNEL_ID]=function(n){var e=!1;return Be(n)&&!/_/g.test(n)&&n.length<=20&&(e=!0),e},Qe),Vu=function(n){function e(t){var r=n.call(this,t)||this;return r.name="RCAssertError",r}return Re(e,n),e}(Error),Ie=function(n,e,t,r){if(r===void 0&&(r=!1),!me(n,e,t,r))throw new Vu("'"+n+"' is invalid: "+JSON.stringify(e))},me=function(n,e,t,r){r===void 0&&(r=!1),t=xu[t]||t;var i=r&&!t(e)||!r&&!(de(e)||e===null||t(e));return i&&j.error("'"+n+"' is invalid: "+JSON.stringify(e)),!i},He=function(n){if(!Ne(n)||n.low===void 0||n.high===void 0)return n;var e=n.low;return e<0&&(e+=4294967296),e=e.toString(16),parseInt(n.high.toString(16)+"00000000".replace(new RegExp("0{"+e.length+"}$"),e),16)},Bu=function(n,e){var t=Math.floor(1e3*Math.random()%1e4),r=ya(),i=function(d){d=d||"-";var l=new Date;return""+l.getFullYear()+d+(l.getMonth()+1)+d+l.getDate()}(),o=new Date().getTime(),s="";if(e){var u=e.split(".");s="."+u[u.length-1]}return n+"__RC-"+i+"_"+t+"_"+o+r+s},Fu=function(n,e){n===void 0&&(n={}),e===void 0&&(e={});var t=n.threadId,r=n.apnsCollapseId,i=n.category,o=n.richMediaUri,s=e.channelIdMi,u=e.channelIdHW,d=e.channelIdOPPO,l=e.typeVivo,h=e.googleConfig,a={};a["thread-id"]=t||"",a["apns-collapse-id"]=r||"",a.category=i||"",a.richMediaUri=o||"";var c={};c.collapse_key=h==null?void 0:h.collapseKey,c.imageUrl=h==null?void 0:h.imageUrl;var p=h==null?void 0:h.priority;p&&!["high","normal"].includes(p)&&(p="normal"),c.priority=p;var f=[{HW:{channelId:u||""}},{MI:{channelId:s||""}},{OPPO:{channelId:d||""}},{VIVO:{classification:l||""}},{APNS:a},{FCM:c}];return JSON.stringify(f)},fs=function(n,e){var t={},r={notificationId:e||""};if(!n)return{iOSConfig:t,androidConfig:r};try{var i=JSON.parse(n);i==null||i.forEach(function(o){var s,u,d,l,h=Object.keys(o);if(h.length!==0){var a=h[0];switch(a){case"HW":return void(r.channelIdHW=(s=o[a])===null||s===void 0?void 0:s.channelId);case"MI":return void(r.channelIdMi=(u=o[a])===null||u===void 0?void 0:u.channelId);case"OPPO":return void(r.channelIdOPPO=(d=o[a])===null||d===void 0?void 0:d.channelId);case"VIVO":return void(r.typeVivo=(l=o[a])===null||l===void 0?void 0:l.classification);case"APNS":return t.threadId=o[a]["thread-id"],t.apnsCollapseId=o[a]["apns-collapse-id"],t.category=o[a].category,void(t.richMediaUri=o[a].richMediaUri);case"FCM":r.googleConfig={collapseKey:o[a].collapse_key||"",imageUrl:o[a].imageUrl||"",priority:o[a].priority||""}}}})}catch{j.error("Wrong format for pushConfigs field! content: "+n)}return{iOSConfig:t,androidConfig:r}},wt=function(n){var e=/^[A-Za-z0-9_=+-]+$/.test(n),t=n.length;return e&&t<=128&&t>=1},zr=function(n){var e=n.length;return e<=4096&&e>=1},Ce=function(n,e,t){e=e||function(){};var r=(t=t||{}).isReverse;Ne(n)&&function(){for(var i in n)e(n[i],i,n)}(),(De(n)||Be(n))&&function(){if(r)for(var i=n.length-1;i>=0;i--)e(n[i],i);else for(var o=0,s=n.length;o<s;o++)e(n[o],o)}()},Dn=function(n,e){return Ce(n,function(t,r){n[r]=e(t,r)}),n},Hu=function(n,e){if(n.indexOf)return n.indexOf(e);var t=-1;return Ce(n,function(r,i){e===r&&(t=i)}),t},$u=function(n,e){var t=[];return Ce(n,function(r){t.push(r)}),Hu(t,e)!==-1},Qn=function(n){return JSON.parse(JSON.stringify(n))},gs=function(){return typeof RCCppEngine!="undefined"},ju=function(n){if(n.tag!=="browser")return{type:n.tag,version:"UnKonw"};var e,t,r=navigator.userAgent,i={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){t=o,e=s[1]||s[2];break}}return{type:t||"UnKonw",version:e||"UnKonw"}},Ia=function(n){switch(n){case we.SERVER_UNAVAILABLE:return S.SERVER_UNAVAILABLE;case we.TOKEN_INCORRECT:return S.RC_CONN_USER_OR_PASSWD_ERROR;case we.REDIRECT:return S.RC_CONN_REDIRECTED;case we.APP_BLOCK_OR_DELETE:return S.RC_CONN_APP_BLOCKED_OR_DELETED;case we.BLOCK:return S.RC_CONN_USER_BLOCKED;case we.TOKEN_EXPIRE:return S.RC_CONN_USER_OR_PASSWD_ERROR;case we.HOSTNAME_ERROR:return S.HOSTNAME_ERROR;case we.HASOHTERSAMECLIENTONLINE:return S.HAS_OHTER_SAME_CLIENT_ON_LINE;case we.APP_AUTH_NOT_PASS:return S.RC_APP_AUTH_NOT_PASS;case we.OTP_USED:return S.RC_OTP_USED;case we.PLATFORM_ERROR:return S.RC_PLATFORM_ERROR;default:return S.RC_NET_UNAVAILABLE}},ms=function(n){var e={},t=JSON.parse(n);return Ce(t,function(r,i){e[i]=r.v}),e},Lt={_delayTime:0,setTime:function(n){var e=new Date().getTime();Lt._delayTime=e-n},getTime:function(){var n=Lt._delayTime;return new Date().getTime()-n}},_s=function(n,e){var t=0;return n.isAutoDelete&&(t|=1),n.isOverwrite&&(t|=2),e===2&&(t|=4),t};(function(n){n[n.AT_MOST_ONCE=0]="AT_MOST_ONCE",n[n.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",n[n.EXACTLY_ONCE=2]="EXACTLY_ONCE",n[n.DEFAULT=3]="DEFAULT"})(it||(it={})),function(n){n[n.SYMMETRIC=0]="SYMMETRIC",n[n.CONNECT=1]="CONNECT",n[n.CONN_ACK=2]="CONN_ACK",n[n.PUBLISH=3]="PUBLISH",n[n.PUB_ACK=4]="PUB_ACK",n[n.QUERY=5]="QUERY",n[n.QUERY_ACK=6]="QUERY_ACK",n[n.QUERY_CONFIRM=7]="QUERY_CONFIRM",n[n.SUBSCRIBE=8]="SUBSCRIBE",n[n.SUB_ACK=9]="SUB_ACK",n[n.UNSUBSCRIBE=10]="UNSUBSCRIBE",n[n.UNSUB_ACK=11]="UNSUB_ACK",n[n.PING_REQ=12]="PING_REQ",n[n.PING_RESP=13]="PING_RESP",n[n.DISCONNECT=14]="DISCONNECT",n[n.RESERVER2=15]="RESERVER2"}(Me||(Me={})),function(n){n.CONN_ACK="ConnAckMessage",n.DISCONNECT="DisconnectMessage",n.PING_REQ="PingReqMessage",n.PING_RESP="PingRespMessage",n.PUBLISH="PublishMessage",n.PUB_ACK="PubAckMessage",n.QUERY="QueryMessage",n.QUERY_CON="QueryConMessage",n.QUERY_ACK="QueryAckMessage"}(Fe||(Fe={})),function(n){n.PUB="pub",n.QUERY="qry"}(St||(St={})),function(n){n[n.V4=4]="V4",n[n.V3=3]="V3"}(Et||(Et={}));var K,Yi=function(){function n(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=it.AT_LEAST_ONCE),i===void 0&&(i=!1),this._retain=!1,this.qos=it.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var o=e>0;e&&o&&arguments.length===1?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=(8&e)==8):(this.type=e,this._retain=t,this.qos=r,this._dup=i)}return n.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0},n}(),bn=function(){function n(){}return n.writeUTF=function(e,t){var r=[],i=0;if(Be(e))for(var o=0,s=e.length;o<s;o++){var u=e.charCodeAt(o);u>=0&&u<=127?(i+=1,r.push(u)):u>=128&&u<=2047?(i+=2,r.push(192|31&u>>6),r.push(128|63&u)):u>=2048&&u<=65535&&(i+=3,r.push(224|15&u>>12),r.push(128|63&u>>6),r.push(128|63&u))}for(o=0,s=r.length;o<s;o++)r[o]>255&&(r[o]&=255);return t?r:i<=255?[0,i].concat(r):[i>>8,255&i].concat(r)},n.readUTF=function(e){for(var t,r,i=[],o=-1,s=e,u="";++o<s.length;){var d=Number(s[o]);if(d===(127&d)||((240&d)==240?d=(d=(d=(d^=240)<<6|128^s[++o])<<6|128^s[++o])<<6|128^s[++o]:(224&d)==224?d=(d=(d^=224)<<6|128^s[++o])<<6|128^s[++o]:(192&d)==192&&(d=(d^=192)<<6|128^s[++o])),!isFinite(d)||d<0||d>1114111||Math.floor(d)!==d)throw RangeError("Invalid code point: "+d);d<=65535?i.push(d):(t=(d-=65536)>>10|55296,r=d%1024|56320,i.push(t,r)),(o+1===s.length||i.length>16384)&&(u+=String.fromCharCode.apply(null,i),i.length=0)}return u},n}(),Ku=function(){function n(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return n.prototype.check=function(){return this._position>=this._pool.length},n.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",r=0;r<2;r++){var i=e._pool[e._position++].toString(16);i.length===1&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},n.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",r=0;r<4;r++){var i=e._pool[e._position++].toString(16);i.length===1&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},n.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",r=0;r<8;r++){var i=e._pool[e._position++].toString(16);i.length===1&&(i="0"+i),t+=i}return parseInt(t,16)},n.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},n.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return bn.readUTF(t)},n.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},n}(),qu=function(){function n(){this._pool=[],this._position=0,this._writen=0}return n.prototype.write=function(e){return Object.prototype.toString.call(e).indexOf("Array")!==-1?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e},n.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},n.prototype.writeUTF=function(e){var t=bn.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},n.prototype.getBytesArray=function(){return this._pool},n}(),_n="UpStreamMessage",zi="PushExtra",wr="DownStreamMessage",vn="DownStreamMessages",Ji="SessionsAttQryInput",ba="SessionsAttOutput",Wi="SyncRequestMsg",Zi="ChrmPullMsg",ur="NotifyMsg",Qi="HistoryMsgInput",Rn="HistoryMsgOuput",dr="RelationQryInput",En="RelationsOutput",Xi="DeleteSessionsInput",eo="SessionInfo",Oa="DeleteSessionsOutput",to="RelationsInput",no="DeleteMsgInput",ro="CleanHisMsgInput",io="SessionMsgReadInput",oo="ChrmInput",so="ChrmOutput",ao="QueryChatRoomInfoInput",Mr="QueryChatRoomInfoOutput",lr="RtcInput",Ct="RtcUserListOutput",co="SetUserStatusInput",uo="RtcSetDataInput",hr="RtcUserSetDataInput",pr="RtcDataInput",lo="RtcSetOutDataInput",ho="MCFollowInput",Ar="RtcTokenOutput",Pr="RtcQryOutput",po="RtcQryUserOutDataInput",Na="RtcUserOutDataOutput",fo="RtcQueryListInput",wa="RtcRoomInfoOutput",$e="RtcValueInfo",go="RtcKeyDeleteInput",mo="GetQNupTokenInput",_o="GetQNupTokenOutput",vo="GetQNdownloadUrlInput",Ro="GetDownloadUrlInput",Eo="GetQNdownloadUrlOutput",Co="GetDownloadUrlOutput",yo="SetChrmKV",To="SetChrmKVS",Ma="DeleteChrmKVS",Dt="ChrmKVOutput",So="ChrmKVSOutput",Aa="ChrmKVSOutputEntity",Io="QueryChrmKV",Pa="SetUserSettingInput",xt="SetUserSettingOutput",bo="PullUserSettingInput",Lr="PullUserSettingOutput",kr="UserSettingNotification",Oo="SessionReq",Ur="SessionStates",fr="SessionState",gr="SessionStateItem",mr="SessionStateModifyReq",No="SessionStateModifyResp",_r="GrpReadReceiptMsg",La="GrpReadReceiptQryReq",Dr="GrpReadReceiptQryResp",ka="GrpMsgReadUser",wo="SessionTagAddInput",dn="SessionTagItem",Mo="SessionTagDelInput",Ao="SessionDisTagReq",Po="ReportSDKInput",Ua="ReportSDKOutput",Lo="RtcNotifyMsg",ko="RtcPullKV",xr="RtcKVOutput",Uo="RtcQueryUserJoinedInput",Vr="RtcQueryUserJoinedOutput",Da="RtcViewerJoinedOutput",Do="RtcInviteInput",xo="RtcCancelInviteInput",Vo="RtcInviteAnswerInput",Bo="RtcEndInviteInput",xa=((K={})[_n]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],K[vn]=["list","syncTime","finished"],K[wr]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"],K[zi]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],K[Ji]=["nothing"],K[ba]=["inboxTime","sendboxTime","totalUnreadCount"],K[Wi]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"],K[Zi]=["syncTime","count"],K[ur]=["type","time","chrmId"],K[Qi]=["targetId","time","count","order","busChannel"],K[Rn]=["list","syncTime","hasMsg"],K[dr]=["type","count","startTime","order"],K[En]=["info"],K[Xi]=["sessions"],K[eo]=["type","channelId","busChannel"],K[Oa]=["nothing"],K[to]=["type","msg","count","busChannel","startTime","endTime"],K[no]=["type","conversationId","msgs","busChannel"],K[ro]=["targetId","dataTime","conversationType","busChannel"],K[io]=["type","msgTime","channelId"],K[oo]=["nothing"],K[so]=["nothing","sessionId","joinTime"],K[ao]=["count","order"],K[Mr]=["userTotalNums","userInfos"],K[mo]=["type","key","httpMethod","queryString"],K[vo]=["type","key","fileName"],K[Ro]=["type","key","fileName"],K[_o]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],K[Eo]=["downloadUrl"],K[Co]=["downloadUrl"],K[yo]=["entry","bNotify","notification","type"],K[To]=["entry","bNotify","notification","type"],K[Ma]=["entry","bNotify","notification","type"],K[Dt]=["entries","bFullUpdate","syncTime"],K[So]=["timestamp","errorKeys"],K[Aa]=["key","errorCode"],K[Io]=["timestamp"],K[Pa]=["version","value"],K[xt]=["version","reserve"],K[bo]=["version","reserve"],K[Lr]=["items","version"],K.UserSettingItem=["targetId","type","key","value","version","status","tags"],K[Oo]=["time"],K[Ur]=["version","state"],K[fr]=["type","channelId","time","stateItem","busChannel"],K[gr]=["sessionStateType","value","tags"],K[mr]=["version","state"],K[No]=["version"],K[_r]=["msgId","busChannel"],K[La]=["msgId","busChannel"],K[Dr]=["totalMemberNum","list"],K[ka]=["readTime","userId"],K[wo]=["version","tags"],K[dn]=["tagId","name","createdTime","isTop"],K[Mo]=["version","tags"],K[Ao]=["tagId"],K[kr]=["version","reserve"],K[Po]=["sdkInfo"],K[Ua]=["nothing"],K[lr]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],K[Ct]=["users","token","sessionId","roomInfo"],K[co]=["status"],K[uo]=["interior","target","key","value","objectName","content"],K[hr]=["valueInfo","objectName","content"],K[pr]=["interior","target","key","objectName","content"],K[lo]=["target","valueInfo","objectName","content"],K[ho]=["state"],K[Ar]=["rtcToken"],K[Pr]=["outInfo"],K[po]=["userId"],K[Na]=["user"],K[fo]=["order"],K[wa]=["roomId","roomData","userCount","list"],K[$e]=["key","value"],K[go]=["key"],K[Lo]=["type","time","roomId"],K[ko]=["timestamp","roomId"],K[xr]=["entries","bFullUpdate","syncTime"],K[Uo]=["userId"],K[Vr]=["info"],K[Do]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],K[xo]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],K[Vo]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],K[Bo]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],K),Cn={},Gu=function(n){var e=xa[n];Cn[n]=function(){for(var t={},r={getArrayData:function(){return t}},i=function(s){var u=e[s],d="set"+ss(u,0,1);r[d]=function(l){t[u]=l}},o=0;o<e.length;o++)i(o);return r},Cn[n].decode=function(t){var r={};Be(t)&&(t=JSON.parse(t));var i=function(s){var u="get"+ss(s,0,1);r[s]=t[s],r[u]=function(){return t[s]}};for(var o in t)i(o);return r}};for(var Yu in xa)Gu(Yu);Cn.getModule=function(n){return Cn[n]()};var zu=`
  6. package Modules;
  7. message probuf {
  8. message `+co+`
  9. {
  10. optional int32 status=1;
  11. }
  12. message SetUserStatusOutput
  13. {
  14. optional int32 nothing=1;
  15. }
  16. message GetUserStatusInput
  17. {
  18. optional int32 nothing=1;
  19. }
  20. message GetUserStatusOutput
  21. {
  22. optional string status=1;
  23. optional string subUserId=2;
  24. }
  25. message SubUserStatusInput
  26. {
  27. repeated string userid =1;
  28. }
  29. message SubUserStatusOutput
  30. {
  31. optional int32 nothing=1;
  32. }
  33. message VoipDynamicInput
  34. {
  35. required int32 engineType = 1;
  36. required string channelName = 2;
  37. optional string channelExtra = 3;
  38. }
  39. message VoipDynamicOutput
  40. {
  41. required string dynamicKey=1;
  42. }
  43. message `+ur+` {
  44. required int32 type = 1;
  45. optional int64 time = 2;
  46. optional string chrmId=3;
  47. }
  48. message `+Wi+` {
  49. required int64 syncTime = 1;
  50. required bool ispolling = 2;
  51. optional bool isweb=3;
  52. optional bool isPullSend=4;
  53. optional bool isKeeping=5;
  54. optional int64 sendBoxSyncTime=6;
  55. }
  56. message `+_n+` {
  57. required int32 sessionId = 1;
  58. required string classname = 2;
  59. required bytes content = 3;
  60. optional string pushText = 4;
  61. optional string appData = 5;
  62. repeated string userId = 6;
  63. optional int64 delMsgTime = 7;
  64. optional string delMsgId = 8;
  65. optional int32 configFlag = 9;
  66. optional int64 clientUniqueId = 10;
  67. optional string extraContent = 11;
  68. optional PushExtra pushExt = 12;
  69. optional string busChannel = 13; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
  70. }
  71. message `+zi+` {
  72. optional string title = 1;
  73. optional int32 templateIdNoUse= 2;
  74. optional string pushId = 3;
  75. optional string pushConfigs = 4;
  76. optional string templateId = 5;
  77. }
  78. message `+vn+` {
  79. repeated DownStreamMessage list = 1;
  80. required int64 syncTime = 2;
  81. optional bool finished = 3;
  82. }
  83. message `+wr+` {
  84. required string fromUserId = 1;
  85. required ChannelType type = 2;
  86. optional string groupId = 3;
  87. required string classname = 4;
  88. required bytes content = 5;
  89. required int64 dataTime = 6;
  90. required int64 status = 7;
  91. optional int64 extra = 8;
  92. optional string msgId = 9;
  93. optional int32 direction = 10;
  94. optional int32 plantform =11;
  95. optional int32 isRemoved = 12;
  96. optional string source = 13;
  97. optional int64 clientUniqueId = 14;
  98. optional string extraContent = 15;
  99. optional string pushContent = 16;
  100. optional int32 configFlag = 17;
  101. optional PushExtra pushExt = 18;
  102. optional string busChannel = 19; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
  103. }
  104. enum ChannelType {
  105. PERSON = 1;
  106. PERSONS = 2;
  107. GROUP = 3;
  108. TEMPGROUP = 4;
  109. CUSTOMERSERVICE = 5;
  110. NOTIFY = 6;
  111. MC=7;
  112. MP=8;
  113. }
  114. message CreateDiscussionInput {
  115. optional string name = 1;
  116. }
  117. message CreateDiscussionOutput {
  118. required string id = 1;
  119. }
  120. message ChannelInvitationInput {
  121. repeated string users = 1;
  122. }
  123. message LeaveChannelInput {
  124. required int32 nothing = 1;
  125. }
  126. message ChannelEvictionInput {
  127. required string user = 1;
  128. }
  129. message RenameChannelInput {
  130. required string name = 1;
  131. }
  132. message ChannelInfoInput {
  133. required int32 nothing = 1;
  134. }
  135. message ChannelInfoOutput {
  136. required ChannelType type = 1;
  137. required string channelId = 2;
  138. required string channelName = 3;
  139. required string adminUserId = 4;
  140. repeated string firstTenUserIds = 5;
  141. required int32 openStatus = 6;
  142. }
  143. message ChannelInfosInput {
  144. required int32 page = 1;
  145. optional int32 number = 2;
  146. }
  147. message ChannelInfosOutput {
  148. repeated ChannelInfoOutput channels = 1;
  149. required int32 total = 2;
  150. }
  151. message MemberInfo {
  152. required string userId = 1;
  153. required string userName = 2;
  154. required string userPortrait = 3;
  155. required string extension = 4;
  156. }
  157. message GroupMembersInput {
  158. required int32 page = 1;
  159. optional int32 number = 2;
  160. }
  161. message GroupMembersOutput {
  162. repeated MemberInfo members = 1;
  163. required int32 total = 2;
  164. }
  165. message GetUserInfoInput {
  166. required int32 nothing = 1;
  167. }
  168. message GetUserInfoOutput {
  169. required string userId = 1;
  170. required string userName = 2;
  171. required string userPortrait = 3;
  172. }
  173. message GetSessionIdInput {
  174. required int32 nothing = 1;
  175. }
  176. message GetSessionIdOutput {
  177. required int32 sessionId = 1;
  178. }
  179. enum FileType {
  180. image = `+Se.IMAGE+`;
  181. audio = `+Se.AUDIO+`;
  182. video = `+Se.VIDEO+`;
  183. file = `+Se.FILE+`;
  184. }
  185. message `+mo+` {
  186. required FileType type = 1;
  187. optional string key = 2;
  188. optional string httpMethod = 3;
  189. optional string queryString = 4;
  190. }
  191. message `+vo+` {
  192. required FileType type = 1;
  193. required string key = 2;
  194. optional string fileName = 3;
  195. }
  196. message `+Ro+` {
  197. required FileType type = 1;
  198. required string key = 2;
  199. optional string fileName = 3;
  200. }
  201. message `+_o+` {
  202. required int64 deadline = 1;
  203. required string token = 2;
  204. optional string bosToken = 3;
  205. optional string bosDate = 4;
  206. optional string path = 5;
  207. optional string osskeyId = 6;
  208. optional string ossPolicy = 7;
  209. optional string ossSign = 8;
  210. optional string ossBucketName = 9;
  211. optional string s3Credential = 10;
  212. optional string s3Algorithm = 11;
  213. optional string s3Date = 12;
  214. optional string s3Policy = 13;
  215. optional string s3Signature = 14;
  216. optional string s3BucketName = 15;
  217. optional string stcAuthorization = 16;
  218. optional string stcContentSha256 = 17;
  219. optional string stcDate = 18;
  220. optional string stcBucketName = 19;
  221. }
  222. message `+Eo+` {
  223. required string downloadUrl = 1;
  224. }
  225. message `+Co+` {
  226. required string downloadUrl = 1;
  227. }
  228. message Add2BlackListInput {
  229. required string userId = 1;
  230. }
  231. message RemoveFromBlackListInput {
  232. required string userId = 1;
  233. }
  234. message QueryBlackListInput {
  235. required int32 nothing = 1;
  236. }
  237. message QueryBlackListOutput {
  238. repeated string userIds = 1;
  239. }
  240. message BlackListStatusInput {
  241. required string userId = 1;
  242. }
  243. message BlockPushInput {
  244. required string blockeeId = 1;
  245. }
  246. message ModifyPermissionInput {
  247. required int32 openStatus = 1;
  248. }
  249. message GroupInput {
  250. repeated GroupInfo groupInfo = 1;
  251. }
  252. message GroupOutput {
  253. required int32 nothing = 1;
  254. }
  255. message GroupInfo {
  256. required string id = 1;
  257. required string name = 2;
  258. }
  259. message GroupHashInput {
  260. required string userId = 1;
  261. required string groupHashCode = 2;
  262. }
  263. message GroupHashOutput {
  264. required GroupHashType result = 1;
  265. }
  266. enum GroupHashType {
  267. group_success = 0x00;
  268. group_failure = 0x01;
  269. }
  270. message `+oo+` {
  271. required int32 nothing = 1;
  272. }
  273. message `+so+` {
  274. required int32 nothing = 1;
  275. optional string sessionId = 2;
  276. optional int64 joinTime = 3;
  277. }
  278. message `+Zi+` {
  279. required int64 syncTime = 1;
  280. required int32 count = 2;
  281. }
  282. message ChrmPullMsgNew
  283. {
  284. required int32 count = 1;
  285. required int64 syncTime = 2;
  286. optional string chrmId=3;
  287. }
  288. message `+dr+`
  289. {
  290. optional ChannelType type = 1;
  291. optional int32 count = 2;
  292. optional int64 startTime = 3;
  293. optional int32 order = 4;
  294. }
  295. message `+to+`
  296. {
  297. required ChannelType type = 1;
  298. optional DownStreamMessage msg =2;
  299. optional int32 count = 3;
  300. optional string busChannel = 4;
  301. optional int64 startTime = 5;
  302. optional int64 endTime = 6;
  303. }
  304. message `+En+`
  305. {
  306. repeated RelationInfo info = 1;
  307. }
  308. message RelationInfo
  309. {
  310. required ChannelType type = 1;
  311. required string userId = 2;
  312. optional DownStreamMessage msg =3;
  313. optional int64 readMsgTime= 4;
  314. optional int64 unreadCount= 5;
  315. optional string busChannel = 6;//\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
  316. }
  317. message RelationInfoReadTime
  318. {
  319. required ChannelType type = 1;
  320. required int64 readMsgTime= 2;
  321. required string targetId = 3;
  322. }
  323. message `+ro+`
  324. {
  325. required string targetId = 1;
  326. required int64 dataTime = 2;
  327. optional int32 conversationType= 3;
  328. optional string busChannel = 4; //\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
  329. }
  330. message HistoryMessageInput
  331. {
  332. required string targetId = 1;
  333. required int64 dataTime =2;
  334. required int32 size = 3;
  335. }
  336. message HistoryMessagesOuput
  337. {
  338. repeated DownStreamMessage list = 1;
  339. required int64 syncTime = 2;
  340. required int32 hasMsg = 3;
  341. }
  342. message `+ao+`
  343. {
  344. required int32 count= 1;
  345. optional int32 order= 2;
  346. }
  347. message `+Mr+`
  348. {
  349. optional int32 userTotalNums = 1;
  350. repeated ChrmMember userInfos = 2;
  351. }
  352. message ChrmMember
  353. {
  354. required int64 time = 1;
  355. required string id = 2;
  356. }
  357. message MPFollowInput
  358. {
  359. required string id = 1;
  360. }
  361. message MPFollowOutput
  362. {
  363. required int32 nothing = 1;
  364. optional MpInfo info =2;
  365. }
  366. message `+ho+`
  367. {
  368. required string state = 1;
  369. }
  370. message MCFollowOutput
  371. {
  372. required int32 nothing = 1;
  373. optional MpInfo info =2;
  374. }
  375. message MpInfo
  376. {
  377. required string mpid=1;
  378. required string name = 2;
  379. required string type = 3;
  380. required int64 time=4;
  381. optional string portraitUrl=5;
  382. optional string extra =6;
  383. }
  384. message SearchMpInput
  385. {
  386. required int32 type=1;
  387. required string id=2;
  388. }
  389. message SearchMpOutput
  390. {
  391. required int32 nothing=1;
  392. repeated MpInfo info = 2;
  393. }
  394. message PullMpInput
  395. {
  396. required int64 time=1;
  397. required string mpid=2;
  398. }
  399. message PullMpOutput
  400. {
  401. required int32 status=1;
  402. repeated MpInfo info = 2;
  403. }
  404. message `+Qi+`
  405. {
  406. optional string targetId = 1;
  407. optional int64 time = 2;
  408. optional int32 count = 3;
  409. optional int32 order = 4;
  410. optional string busChannel = 5; //\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
  411. }
  412. message `+Rn+`
  413. {
  414. repeated DownStreamMessage list=1;
  415. required int64 syncTime=2;
  416. required int32 hasMsg=3;
  417. }
  418. message `+fo+`{
  419. optional int32 order=1;
  420. }
  421. message `+go+`{
  422. repeated string key=1;
  423. }
  424. message `+$e+`{
  425. required string key=1;
  426. required string value=2;
  427. }
  428. message RtcUserInfo{
  429. required string userId=1;
  430. repeated `+$e+` userData=2; //\u7528\u6237\u8D44\u6E90\u4FE1\u606F
  431. }
  432. message `+Ct+`{
  433. repeated RtcUserInfo users=1;
  434. optional string token=2;
  435. optional string sessionId=3;
  436. repeated RtcValueInfo roomInfo = 4; //\u623F\u95F4key value
  437. repeated RtcKVEntity entries = 5;//\u76F4\u64ADKV\u5C5E\u6027\u5BF9\u8C61\u96C6\u5408
  438. optional int64 syncTime = 6;//\u6240\u6709\u5C5E\u6027\u7684\u6700\u5927\u65F6\u95F4\u6233\uFF08\u4E0B\u6B21\u62C9\u53D6KV\u65F6\u7528\uFF09\u3002
  439. optional int32 offlineKickTime = 7;//server\u8D85\u65F6\u8E22\u4EBA\u65F6\u95F4\uFF0C\u9ED8\u8BA460s
  440. }
  441. message RtcRoomInfoOutput{
  442. optional string roomId = 1;
  443. repeated `+$e+` roomData = 2;
  444. optional int32 userCount = 3;
  445. repeated RtcUserInfo list=4;
  446. }
  447. message `+lr+`{
  448. required int32 roomType=1;
  449. optional int32 broadcastType=2;
  450. optional RtcValueInfo extraInnerData = 3;
  451. optional bool needSysChatroom = 4; //\u662F\u5426\u9700\u8981\u540C\u6B65\u804A\u5929\u5BA4
  452. optional IdentityChangeType identityChangeType = 5; //\u8EAB\u4EFD\u53D8\u66F4\u7C7B\u578B
  453. optional JoinType joinType = 6; // \u52A0\u5165\u623F\u95F4\u7C7B\u578B
  454. }
  455. enum JoinType {
  456. KICK = 0; //\u8E22\u524D\u4E00\u4E2A\u8BBE\u5907
  457. REFUSE = 1; //\u5F53\u524D\u52A0\u5165\u62D2\u7EDD
  458. COEXIST = 2; //\u4E24\u4E2A\u8BBE\u5907\u5171\u5B58
  459. }
  460. message RtcQryInput{
  461. required bool isInterior=1;
  462. required targetType target=2;
  463. repeated string key=3;
  464. }
  465. message `+Pr+`{
  466. repeated `+$e+` outInfo=1;
  467. }
  468. message RtcDelDataInput{
  469. repeated string key=1;
  470. required bool isInterior=2;
  471. required targetType target=3;
  472. }
  473. message `+pr+`{
  474. required bool interior=1;
  475. required targetType target=2;
  476. repeated string key=3;
  477. optional string objectName=4;
  478. optional string content=5;
  479. }
  480. message `+uo+`{
  481. required bool interior=1;
  482. required targetType target=2;
  483. required string key=3;
  484. required string value=4;
  485. optional string objectName=5;
  486. optional string content=6;
  487. }
  488. message `+hr+` {
  489. repeated `+$e+` valueInfo = 1;
  490. required string objectName = 2;
  491. repeated `+$e+` content = 3;
  492. }
  493. message RtcOutput
  494. {
  495. optional int32 nothing=1;
  496. }
  497. message `+Ar+`{
  498. required string rtcToken=1;
  499. }
  500. enum targetType {
  501. ROOM =1 ;
  502. PERSON = 2;
  503. }
  504. message `+lo+`{
  505. required targetType target=1;
  506. repeated `+$e+` valueInfo=2;
  507. optional string objectName=3;
  508. optional string content=4;
  509. }
  510. message `+po+`{
  511. repeated string userId = 1;
  512. }
  513. message `+Na+`{
  514. repeated RtcUserInfo user = 1;
  515. }
  516. message `+Ji+`{
  517. required int32 nothing = 1;
  518. }
  519. message `+ba+`{
  520. required int64 inboxTime = 1;
  521. required int64 sendboxTime = 2;
  522. required int64 totalUnreadCount = 3;
  523. }
  524. message `+io+`
  525. {
  526. required ChannelType type = 1;
  527. required int64 msgTime = 2;
  528. required string channelId = 3;
  529. }
  530. message SessionMsgReadOutput
  531. {
  532. optional int32 nothing=1;
  533. }
  534. message `+Xi+`
  535. {
  536. repeated SessionInfo sessions = 1;
  537. }
  538. message `+eo+`
  539. {
  540. required ChannelType type = 1;
  541. required string channelId = 2;
  542. optional string busChannel = 3;//\u6240\u5C5E\u4F1A\u8BDD\u4E1A\u52A1\u6807\u8BC6
  543. }
  544. message `+Oa+`
  545. {
  546. optional int32 nothing=1;
  547. }
  548. message `+no+`
  549. {
  550. optional ChannelType type = 1;
  551. optional string conversationId = 2;
  552. repeated DeleteMsg msgs = 3;
  553. optional string busChannel = 4; //\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6\uFF0C\u9650\u523620\u5B57\u7B26\u4EE5\u5185
  554. }
  555. message DeleteMsg
  556. {
  557. optional string msgId = 1;
  558. optional int64 msgDataTime = 2;
  559. optional int32 direct = 3;
  560. }
  561. message ChrmKVEntity {
  562. required string key = 1;
  563. required string value = 2;
  564. optional int32 status = 3;
  565. optional int64 timestamp = 4;
  566. optional string uid = 5;
  567. }
  568. message `+yo+` {
  569. required ChrmKVEntity entry = 1;
  570. optional bool bNotify = 2;
  571. optional UpStreamMessage notification = 3;
  572. optional ChannelType type = 4;
  573. }
  574. message `+To+` {
  575. repeated ChrmKVEntity entry = 1;
  576. optional bool bNotify = 2;
  577. optional UpStreamMessage notification = 3;
  578. optional ChannelType type = 4;
  579. }
  580. message `+Ma+` {
  581. repeated ChrmKVEntity entry = 1;
  582. optional bool bNotify = 2;
  583. optional UpStreamMessage notification = 3;
  584. optional ChannelType type = 4;
  585. }
  586. message `+Dt+` {
  587. repeated ChrmKVEntity entries = 1;
  588. optional bool bFullUpdate = 2;
  589. optional int64 syncTime = 3;
  590. }
  591. message `+So+` {
  592. repeated ChrmKVSOutputEntity errorKeys = 1;
  593. }
  594. message `+Aa+`
  595. {
  596. optional string key = 1;
  597. optional int32 errorCode = 2;
  598. }
  599. message `+Io+` {
  600. required int64 timestamp = 1;
  601. }
  602. message `+Pa+` {
  603. required int64 version=1;
  604. required string value=2;
  605. }
  606. message `+xt+` {
  607. required int64 version=1;
  608. required bool reserve=2;
  609. }
  610. message `+bo+` {
  611. required int64 version=1;
  612. optional bool reserve=2;
  613. }
  614. message `+Lr+` {
  615. repeated UserSettingItem items = 1;
  616. required int64 version=2;
  617. }
  618. message UserSettingItem {
  619. required string targetId= 1;
  620. required ChannelType type = 2;
  621. required string key = 4;
  622. required bytes value = 5;
  623. required int64 version=6;
  624. required int32 status=7;
  625. repeated SessionTagItem tags= 8;
  626. }
  627. message `+Oo+` {
  628. required int64 time = 1;
  629. }
  630. message `+Ur+` {
  631. required int64 version=1;
  632. repeated SessionState state= 2;
  633. }
  634. message `+fr+` {
  635. required ChannelType type = 1;
  636. required string channelId = 2;
  637. optional int64 time = 3;
  638. repeated SessionStateItem stateItem = 4;
  639. optional string busChannel = 5;//\u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
  640. }
  641. message `+gr+` {
  642. required SessionStateType sessionStateType = 1;
  643. required string value = 2;
  644. repeated SessionTagItem tags = 3;
  645. }
  646. enum SessionStateType {
  647. IsSilent = 1;
  648. IsTop = 2;
  649. Tags = 3;
  650. }
  651. message `+mr+` {
  652. required int64 version=1;
  653. repeated SessionState state= 2;
  654. }
  655. message `+No+` {
  656. required int64 version=1;
  657. }
  658. message `+_r+` {
  659. repeated string msgId=1; //\u5DF2\u8BFB\u6D88\u606FID
  660. optional string channelId = 2; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
  661. }
  662. message `+La+` {
  663. repeated string msgId=1; //\u5DF2\u8BFB\u6D88\u606FID
  664. optional string channelId = 2; // \u8BE5\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u7684\u4E1A\u52A1\u6807\u8BC6
  665. }
  666. message `+Dr+` {
  667. required int32 totalMemberNum = 1;//\u7FA4\u5185\u603B\u4EBA\u6570
  668. repeated GrpMsgReadUser list = 2;//\u5DF2\u8BFB\u7528\u6237\u5217\u8868\uFF08list\u590D\u7C7B\u578B\uFF09
  669. }
  670. message `+ka+` {
  671. required int64 readTime = 1;//\u5DF2\u8BFB\u65F6\u95F4
  672. required string userId = 2;//\u5DF2\u8BFB\u7528\u6237id
  673. }
  674. message `+wo+` {
  675. required int64 version=1;
  676. repeated SessionTagItem tags=2;
  677. }
  678. message `+dn+` {
  679. required string tagId=1;
  680. optional string name=2;
  681. optional int64 createdTime=3;
  682. optional bool isTop=4;
  683. }
  684. message `+Mo+` {
  685. required int64 version=1;
  686. repeated SessionTagItem tags=2;
  687. }
  688. message `+Ao+` {
  689. repeated string tagId=1;
  690. }
  691. message `+kr+` {
  692. required int64 version=1;
  693. required bool reserve=2;
  694. }
  695. message `+Po+` {
  696. required string sdkInfo=1; // \u7528\u6237\u96C6\u6210\u7684 sdk \u4FE1\u606F,json \u683C\u5F0F {"web-rtc": "4.0.3.7"}
  697. }
  698. message `+Ua+`
  699. {
  700. optional int32 nothing=1; //\u5360\u4F4D
  701. }
  702. message `+Lo+`
  703. {
  704. required int32 type= 1; //(\u901A\u77E5\u7C7B\u578B 1:rtc\u623F\u95F4\u72B6\u6001KV\u53D8\u66F4\u901A\u77E5)
  705. optional int64 time= 2; //\u6D88\u606F\u4EA7\u751F\u65F6\u95F4
  706. optional string roomId=3; //\u4E3B\u64AD\u623F\u95F4id
  707. }
  708. message `+ko+`
  709. {
  710. required int64 timestamp = 1;
  711. required string roomId = 2;
  712. }
  713. message `+xr+`
  714. {
  715. repeated RtcKVEntity entries = 1;
  716. optional bool bFullUpdate = 2;
  717. optional int64 syncTime = 3;
  718. }
  719. message RtcKVEntity
  720. {
  721. required string key = 1;
  722. required string value = 2;
  723. optional int32 status = 3;
  724. optional int64 timestamp = 4;
  725. optional string uid = 5;
  726. }
  727. enum IdentityChangeType
  728. {
  729. AnchorToViewer = 1; //1\u4E3A\u4E3B\u64AD\u53D8\u89C2\u4F17
  730. ViewerToAnchor = 2; //2\u4E3A\u89C2\u4F17\u53D8\u4E3B\u64AD
  731. }
  732. message `+Uo+`
  733. {
  734. required string userId = 1;
  735. }
  736. message `+Vr+`
  737. {
  738. repeated RtcJoinedInfo info = 1;
  739. }
  740. message RtcJoinedInfo
  741. {
  742. required string deviceId = 1; //\u8BBE\u5907ID
  743. required string roomId = 2; //\u52A0\u5165\u7684\u623F\u95F4ID
  744. optional int64 joinTime = 3; //\u52A0\u5165\u7684\u65F6\u95F4
  745. }
  746. message `+Da+`
  747. {
  748. required string rtcToken=1;
  749. repeated RtcKVEntity entries = 2;//KV\u5C5E\u6027\u5BF9\u8C61\u96C6\u5408
  750. optional int64 syncTime = 3;//\u6240\u6709\u5C5E\u6027\u7684\u6700\u5927\u65F6\u95F4\u6233\uFF08\u4E0B\u6B21\u62C9\u53D6KV\u65F6\u7528\uFF09\u3002
  751. }
  752. message `+Do+`
  753. {
  754. required string invitedUserId=1; //\u88AB\u9080\u8BF7\u7684\u4EBA\u7684uid
  755. optional int32 timeoutTime=2; //\u9080\u8BF7\u8D85\u65F6\u65F6\u95F4(\u79D2),\u9ED8\u8BA4\u4E09\u5341\u79D2
  756. required string invitedRoomId=3; //\u88AB\u9080\u8BF7\u7684\u623F\u95F4
  757. required string inviteInfo=4; //\u9080\u8BF7\u7684\u4FE1\u606F(\u5305\u542B\u9080\u8BF7\u4EBA,\u88AB\u9080\u8BF7\u4EBA,\u5404\u81EAuserid)\u5BA2\u6237\u7AEF\u5B9A\u4E49\u597D.\u534F\u8BAE\u6808\u548Cserver\u900F\u4F20
  758. required string inviteSessionId= 5; //\u5BA2\u6237\u7AEF\u4FDD\u8BC1\u552F\u4E00\u6027(\u5EFA\u8BAEroomid_userid_\u65F6\u95F4\u6233_\u968F\u673A\u6570)
  759. }
  760. message `+xo+`
  761. {
  762. required string invitedUserId=1; //\u88AB\u9080\u8BF7\u7684\u4EBA\u7684uid
  763. required string invitedRoomId=2; //\u88AB\u9080\u8BF7\u7684\u623F\u95F4
  764. required string inviteInfo=3; //\u53D6\u6D88\u9080\u8BF7\u7684\u4FE1\u606F(\u5305\u542B\u9080\u8BF7\u4EBA,\u88AB\u9080\u8BF7\u4EBA,\u5404\u81EAuserid)\u5BA2\u6237\u7AEF\u5B9A\u4E49\u597D.\u534F\u8BAE\u6808\u548Cserver\u900F\u4F20
  765. required string inviteSessionId=4; //\u9080\u8BF7\u7684sessionId,\u5BA2\u6237\u7AEF\u53D1\u8D77\u9080\u8BF7\u65F6\u4EA7\u751F
  766. }
  767. message `+Vo+`
  768. {
  769. required string inviteUserId=1; //\u9080\u8BF7\u7684\u4EBA\u7684uid
  770. required int32 answerCode=2; //\u662F\u5426\u63A5\u53D7\u8FDE\u9EA6\u9080\u8BF7.0\u4E3A\u62D2\u7EDD,1\u4E3A\u63A5\u53D7
  771. required string inviteRoomId=3; //\u9080\u8BF7\u7684\u623F\u95F4
  772. required string inviteSessionId=4; //\u9080\u8BF7\u7684sessionId
  773. required string content=5; //\u9700\u8981\u8F6C\u53D1\u7684content
  774. optional string key=6; //\u5982\u679C\u63A5\u53D7\u7684\u8BDD,\u9700\u8981\u52A0\u8FD9\u4E2A\u5B57\u6BB5,\u653E\u5728room\u7EA7\u522B\u7684k\u548Cv,\u65B0\u52A0\u5165\u623F\u95F4\u7684\u80FD\u62C9\u53D6\u5230
  775. optional string value=7; //\u5982\u679C\u63A5\u53D7\u7684\u8BDD,\u9700\u8981\u52A0\u8FD9\u4E2A\u5B57\u6BB5,\u653E\u5728room\u7EA7\u522B\u7684k\u548Cv,\u65B0\u52A0\u5165\u623F\u95F4\u7684\u80FD\u62C9\u53D6\u5230
  776. }
  777. message `+Bo+`
  778. {
  779. required string inviteRoomId=1; //\u9080\u8BF7\u7684\u623F\u95F4
  780. required string inviteSessionId=2; //\u9080\u8BF7\u7684sessionId
  781. required string inviteContent=3; //\u7ED3\u675F\u8FDE\u9EA6\u7684\u4FE1\u606F(\u9700\u8981\u900F\u4F20\u7ED9\u623F\u95F4\u5185\u5176\u4ED6\u4EBA)
  782. repeated string inviteRoomKeys=4; //\u9700\u8981\u5220\u9664\u8FDE\u9EA6\u7684\u4FE1\u606F\u7684key
  783. }
  784. }
  785. `,vs,Rs,Jt,Mt,Wt,yi=(vs=zu,function(n,e){var t,r,i={};return i.ByteBuffer=n,i.c=n,t=n,i.Long=e||null,i.VERSION="5.0.1",i.WIRE_TYPES={},i.WIRE_TYPES.VARINT=0,i.WIRE_TYPES.BITS64=1,i.WIRE_TYPES.LDELIM=2,i.WIRE_TYPES.STARTGROUP=3,i.WIRE_TYPES.ENDGROUP=4,i.WIRE_TYPES.BITS32=5,i.PACKABLE_WIRE_TYPES=[i.WIRE_TYPES.VARINT,i.WIRE_TYPES.BITS64,i.WIRE_TYPES.BITS32],i.TYPES={int32:{name:"int32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},uint64:{name:"uint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.UZERO:void 0},sint64:{name:"sint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},bool:{name:"bool",wireType:i.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:i.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:i.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.ZERO:void 0},float:{name:"float",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:i.WIRE_TYPES.STARTGROUP,defaultValue:null}},i.MAP_KEY_TYPES=[i.TYPES.int32,i.TYPES.sint32,i.TYPES.sfixed32,i.TYPES.uint32,i.TYPES.fixed32,i.TYPES.int64,i.TYPES.sint64,i.TYPES.sfixed64,i.TYPES.uint64,i.TYPES.fixed64,i.TYPES.bool,i.TYPES.string,i.TYPES.bytes],i.ID_MIN=1,i.ID_MAX=536870911,i.convertFieldsToCamelCase=!1,i.populateAccessors=!0,i.populateDefaults=!0,i.Util=function(){var o={};return o.IS_NODE=!(typeof process!="object"||process+""!="[object process]"||process.browser),o.XHR=function(){var s,u=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],d=null;for(s=0;s<u.length;s++){try{d=u[s]()}catch{continue}break}if(!d)throw Error("XMLHttpRequest is not supported");return d},o.fetch=function(s,u){if(u&&typeof u!="function"&&(u=null),o.IS_NODE)if(u)g.readFile(s,function(l,h){u(l?null:""+h)});else try{return g.readFileSync(s)}catch{return null}else{var d=o.XHR();if(d.open("GET",s,!!u),d.setRequestHeader("Accept","text/plain"),typeof d.overrideMimeType=="function"&&d.overrideMimeType("text/plain"),!u)return d.send(null),d.status==200||d.status==0&&typeof d.responseText=="string"?d.responseText:null;if(d.onreadystatechange=function(){d.readyState==4&&(d.status==200||d.status==0&&typeof d.responseText=="string"?u(d.responseText):u(null))},d.readyState==4)return;d.send(null)}},o.toCamelCase=function(s){return s.replace(/_([a-zA-Z])/g,function(u,d){return d.toUpperCase()})},o}(),i.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},i.DotProto=function(o,s){function u(m,_){var v=-1,R=1;if(m.charAt(0)=="-"&&(R=-1,m=m.substring(1)),s.NUMBER_DEC.test(m))v=parseInt(m);else if(s.NUMBER_HEX.test(m))v=parseInt(m.substring(2),16);else{if(!s.NUMBER_OCT.test(m))throw Error("illegal id value: "+(R<0?"-":"")+m);v=parseInt(m.substring(1),8)}if(v=0|R*v,!_&&v<0)throw Error("illegal id value: "+(R<0?"-":"")+m);return v}function d(m){var _=1;if(m.charAt(0)=="-"&&(_=-1,m=m.substring(1)),s.NUMBER_DEC.test(m))return _*parseInt(m,10);if(s.NUMBER_HEX.test(m))return _*parseInt(m.substring(2),16);if(s.NUMBER_OCT.test(m))return _*parseInt(m.substring(1),8);if(m==="inf")return 1/0*_;if(m==="nan")return NaN;if(s.NUMBER_FLT.test(m))return _*parseFloat(m);throw Error("illegal number value: "+(_<0?"-":"")+m)}function l(m,_,v){m[_]===void 0?m[_]=v:(Array.isArray(m[_])||(m[_]=[m[_]]),m[_].push(v))}var h,a,c={},p=function(m){this.source=m+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},f=p.prototype;return f._readString=function(){var m,_=this._stringOpen==='"'?s.STRING_DQ:s.STRING_SQ;if(_.lastIndex=this.index-1,!(m=_.exec(this.source)))throw Error("unterminated string");return this.index=_.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,m[1]},f.next=function(){var m,_,v,R,C;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(this._stringOpen!==null)return this._readString();do{for(m=!1;s.WHITESPACE.test(v=this.source.charAt(this.index));)if(v===`
  786. `&&++this.line,++this.index===this.source.length)return null;if(this.source.charAt(this.index)==="/")if(++this.index,this.source.charAt(this.index)==="/"){for(;this.source.charAt(++this.index)!==`
  787. `;)if(this.index==this.source.length)return null;++this.index,++this.line,m=!0}else{if((v=this.source.charAt(this.index))!=="*")return"/";do{if(v===`
  788. `&&++this.line,++this.index===this.source.length)return null;_=v,v=this.source.charAt(this.index)}while(_!=="*"||v!=="/");++this.index,m=!0}}while(m);if(this.index===this.source.length)return null;if(R=this.index,s.DELIM.lastIndex=0,!s.DELIM.test(this.source.charAt(R++)))for(;R<this.source.length&&!s.DELIM.test(this.source.charAt(R));)++R;return((C=this.source.substring(this.index,this.index=R))==='"'||C==="'")&&(this._stringOpen=C),C},f.peek=function(){if(this.stack.length===0){var m=this.next();if(m===null)return null;this.stack.push(m)}return this.stack[0]},f.skip=function(m){var _=this.next();if(_!==m)throw Error("illegal '"+_+"', '"+m+"' expected")},f.omit=function(m){return this.peek()===m&&(this.next(),!0)},f.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},c.Tokenizer=p,(a=(h=function(m){this.tn=new p(m),this.proto3=!1}).prototype).parse=function(){var m,_={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},v=!0;try{for(;m=this.tn.next();)switch(m){case"package":if(!v||_.package!==null)throw Error("unexpected 'package'");if(m=this.tn.next(),!s.TYPEREF.test(m))throw Error("illegal package name: "+m);this.tn.skip(";"),_.package=m;break;case"import":if(!v)throw Error("unexpected 'import'");(m=this.tn.peek())==="public"&&this.tn.next(),m=this._readString(),this.tn.skip(";"),_.imports.push(m);break;case"syntax":if(!v)throw Error("unexpected 'syntax'");this.tn.skip("="),(_.syntax=this._readString())==="proto3"&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(_,null),v=!1;break;case"enum":this._parseEnum(_),v=!1;break;case"option":this._parseOption(_);break;case"service":this._parseService(_);break;case"extend":this._parseExtend(_);break;default:throw Error("unexpected '"+m+"'")}}catch(R){throw R.message="Parse error at line "+this.tn.line+": "+R.message,R}return delete _.name,_},h.parse=function(m){return new h(m).parse()},a._readString=function(){var m,_,v="";do{if((_=this.tn.next())!=="'"&&_!=='"')throw Error("illegal string delimiter: "+_);v+=this.tn.next(),this.tn.skip(_),m=this.tn.peek()}while(m==='"'||m==='"');return v},a._readValue=function(m){var _=this.tn.peek();if(_==='"'||_==="'")return this._readString();if(this.tn.next(),s.NUMBER.test(_))return d(_);if(s.BOOL.test(_))return _.toLowerCase()==="true";if(m&&s.TYPEREF.test(_))return _;throw Error("illegal value: "+_)},a._parseOption=function(m,_){var v,R=this.tn.next(),C=!1;if(R==="("&&(C=!0,R=this.tn.next()),!s.TYPEREF.test(R))throw Error("illegal option name: "+R);v=R,C&&(this.tn.skip(")"),v="("+v+")",R=this.tn.peek(),s.FQTYPEREF.test(R)&&(v+=R,this.tn.next())),this.tn.skip("="),this._parseOptionValue(m,v),_||this.tn.skip(";")},a._parseOptionValue=function(m,_){var v=this.tn.peek();if(v!=="{")l(m.options,_,this._readValue(!0));else for(this.tn.skip("{");(v=this.tn.next())!=="}";){if(!s.NAME.test(v))throw Error("illegal option name: "+_+"."+v);this.tn.omit(":")?l(m.options,_+"."+v,this._readValue(!0)):this._parseOptionValue(m,_+"."+v)}},a._parseService=function(m){var _,v=this.tn.next();if(!s.NAME.test(v))throw Error("illegal service name at line "+this.tn.line+": "+v);for(_={name:v,rpc:{},options:{}},this.tn.skip("{");(v=this.tn.next())!=="}";)if(v==="option")this._parseOption(_);else{if(v!=="rpc")throw Error("illegal service token: "+v);this._parseServiceRPC(_)}this.tn.omit(";"),m.services.push(_)},a._parseServiceRPC=function(m){var _,v,R="rpc",C=this.tn.next();if(!s.NAME.test(C))throw Error("illegal rpc service method name: "+C);if(_=C,v={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),(C=this.tn.next()).toLowerCase()==="stream"&&(v.request_stream=!0,C=this.tn.next()),!s.TYPEREF.test(C))throw Error("illegal rpc service request type: "+C);if(v.request=C,this.tn.skip(")"),(C=this.tn.next()).toLowerCase()!=="returns")throw Error("illegal rpc service request type delimiter: "+C);if(this.tn.skip("("),(C=this.tn.next()).toLowerCase()==="stream"&&(v.response_stream=!0,C=this.tn.next()),v.response=C,this.tn.skip(")"),(C=this.tn.peek())==="{"){for(this.tn.next();(C=this.tn.next())!=="}";){if(C!=="option")throw Error("illegal rpc service token: "+C);this._parseOption(v)}this.tn.omit(";")}else this.tn.skip(";");m[R]===void 0&&(m[R]={}),m[R][_]=v},a._parseMessage=function(m,_){var v=!!_,R=this.tn.next(),C={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!s.NAME.test(R))throw Error("illegal "+(v?"group":"message")+" name: "+R);for(C.name=R,v&&(this.tn.skip("="),_.id=u(this.tn.next()),C.isGroup=!0),(R=this.tn.peek())==="["&&_&&this._parseFieldOptions(_),this.tn.skip("{");(R=this.tn.next())!=="}";)if(s.RULE.test(R))this._parseMessageField(C,R);else if(R==="oneof")this._parseMessageOneOf(C);else if(R==="enum")this._parseEnum(C);else if(R==="message")this._parseMessage(C);else if(R==="option")this._parseOption(C);else if(R==="service")this._parseService(C);else if(R==="extensions")C.extensions=this._parseExtensionRanges();else if(R==="reserved")this._parseIgnored();else if(R==="extend")this._parseExtend(C);else{if(!s.TYPEREF.test(R))throw Error("illegal message token: "+R);if(!this.proto3)throw Error("illegal field rule: "+R);this._parseMessageField(C,"optional",R)}return this.tn.omit(";"),m.messages.push(C),C},a._parseIgnored=function(){for(;this.tn.peek()!==";";)this.tn.next();this.tn.skip(";")},a._parseMessageField=function(m,_,v){var R,C,M;if(!s.RULE.test(_))throw Error("illegal message field rule: "+_);if(R={rule:_,type:"",name:"",options:{},id:0},_==="map"){if(v)throw Error("illegal type: "+v);if(this.tn.skip("<"),C=this.tn.next(),!s.TYPE.test(C)&&!s.TYPEREF.test(C))throw Error("illegal message field type: "+C);if(R.keytype=C,this.tn.skip(","),C=this.tn.next(),!s.TYPE.test(C)&&!s.TYPEREF.test(C))throw Error("illegal message field: "+C);if(R.type=C,this.tn.skip(">"),C=this.tn.next(),!s.NAME.test(C))throw Error("illegal message field name: "+C);R.name=C,this.tn.skip("="),R.id=u(this.tn.next()),(C=this.tn.peek())==="["&&this._parseFieldOptions(R),this.tn.skip(";")}else if((v=v!==void 0?v:this.tn.next())==="group"){if(M=this._parseMessage(m,R),!/^[A-Z]/.test(M.name))throw Error("illegal group name: "+M.name);R.type=M.name,R.name=M.name.toLowerCase(),this.tn.omit(";")}else{if(!s.TYPE.test(v)&&!s.TYPEREF.test(v))throw Error("illegal message field type: "+v);if(R.type=v,C=this.tn.next(),!s.NAME.test(C))throw Error("illegal message field name: "+C);R.name=C,this.tn.skip("="),R.id=u(this.tn.next()),(C=this.tn.peek())==="["&&this._parseFieldOptions(R),this.tn.skip(";")}return m.fields.push(R),R},a._parseMessageOneOf=function(m){var _,v,R,C=this.tn.next();if(!s.NAME.test(C))throw Error("illegal oneof name: "+C);for(v=C,R=[],this.tn.skip("{");(C=this.tn.next())!=="}";)(_=this._parseMessageField(m,"optional",C)).oneof=v,R.push(_.id);this.tn.omit(";"),m.oneofs[v]=R},a._parseFieldOptions=function(m){this.tn.skip("[");for(var _=!0;this.tn.peek()!=="]";)_||this.tn.skip(","),this._parseOption(m,!0),_=!1;this.tn.next()},a._parseEnum=function(m){var _,v={name:"",values:[],options:{}},R=this.tn.next();if(!s.NAME.test(R))throw Error("illegal name: "+R);for(v.name=R,this.tn.skip("{");(R=this.tn.next())!=="}";)if(R==="option")this._parseOption(v);else{if(!s.NAME.test(R))throw Error("illegal name: "+R);this.tn.skip("="),_={name:R,id:u(this.tn.next(),!0)},(R=this.tn.peek())==="["&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),v.values.push(_)}this.tn.omit(";"),m.enums.push(v)},a._parseExtensionRanges=function(){var m,_,v,R=[];do{for(_=[];;){switch(m=this.tn.next()){case"min":v=o.ID_MIN;break;case"max":v=o.ID_MAX;break;default:v=d(m)}if(_.push(v),_.length===2)break;if(this.tn.peek()!=="to"){_.push(v);break}this.tn.next()}R.push(_)}while(this.tn.omit(","));return this.tn.skip(";"),R},a._parseExtend=function(m){var _,v=this.tn.next();if(!s.TYPEREF.test(v))throw Error("illegal extend reference: "+v);for(_={ref:v,fields:[]},this.tn.skip("{");(v=this.tn.next())!=="}";)if(s.RULE.test(v))this._parseMessageField(_,v);else{if(!s.TYPEREF.test(v))throw Error("illegal extend token: "+v);if(!this.proto3)throw Error("illegal field rule: "+v);this._parseMessageField(_,"optional",v)}return this.tn.omit(";"),m.messages.push(_),_},a.toString=function(){return"Parser at line "+this.tn.line},c.Parser=h,c}(i,i.Lang),i.Reflect=function(o){function s(E,T){if(E&&typeof E.low=="number"&&typeof E.high=="number"&&typeof E.unsigned=="boolean"&&E.low==E.low&&E.high==E.high)return new o.Long(E.low,E.high,T===void 0?E.unsigned:T);if(typeof E=="string")return o.Long.fromString(E,T||!1,10);if(typeof E=="number")return o.Long.fromNumber(E,T||!1);throw Error("not convertible to Long")}function u(E,T){var N=T.readVarint32(),P=7&N,L=N>>>3;switch(P){case o.WIRE_TYPES.VARINT:do N=T.readUint8();while((128&N)==128);break;case o.WIRE_TYPES.BITS64:T.offset+=8;break;case o.WIRE_TYPES.LDELIM:N=T.readVarint32(),T.offset+=N;break;case o.WIRE_TYPES.STARTGROUP:u(L,T);break;case o.WIRE_TYPES.ENDGROUP:if(L===E)return!1;throw Error("Illegal GROUPEND after unknown group: "+L+" ("+E+" expected)");case o.WIRE_TYPES.BITS32:T.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+E+": "+P)}return!0}var d,l,h,a,c,p,f,m,_,v,R,C,M,A,O,y,w={},H=function(E,T,N){this.builder=E,this.parent=T,this.name=N,this.className},Y=H.prototype;return Y.fqn=function(){for(var E=this.name,T=this;(T=T.parent)!=null;)E=T.name+"."+E;return E},Y.toString=function(E){return(E?this.className+" ":"")+this.fqn()},Y.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},w.T=H,(l=(d=function(E,T,N,P,L){H.call(this,E,T,N),this.className="Namespace",this.children=[],this.options=P||{},this.syntax=L||"proto2"}).prototype=Object.create(H.prototype)).getChildren=function(E){var T,N,P;if((E=E||null)==null)return this.children.slice();for(T=[],N=0,P=this.children.length;P>N;++N)this.children[N]instanceof E&&T.push(this.children[N]);return T},l.addChild=function(E){var T;if(T=this.getChild(E.name))if(T instanceof c.Field&&T.name!==T.originalName&&this.getChild(T.originalName)===null)T.name=T.originalName;else{if(!(E instanceof c.Field&&E.name!==E.originalName&&this.getChild(E.originalName)===null))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+E.name);E.name=E.originalName}this.children.push(E)},l.getChild=function(E){var T,N,P=typeof E=="number"?"id":"name";for(T=0,N=this.children.length;N>T;++T)if(this.children[T][P]===E)return this.children[T];return null},l.resolve=function(E,T){var N,P=typeof E=="string"?E.split("."):E,L=this,V=0;if(P[V]===""){for(;L.parent!==null;)L=L.parent;V++}do{do{if(!(L instanceof w.Namespace)){L=null;break}if(!((N=L.getChild(P[V]))&&N instanceof w.T&&(!T||N instanceof w.Namespace))){L=null;break}L=N,V++}while(V<P.length);if(L!=null)break;if(this.parent!==null)return this.parent.resolve(E,T)}while(L!=null);return L},l.qn=function(E){var T,N,P=[],L=E;do P.unshift(L.name),L=L.parent;while(L!==null);for(T=1;T<=P.length;T++)if(N=P.slice(P.length-T),E===this.resolve(N,E instanceof w.Namespace))return N.join(".");return E.fqn()},l.build=function(){var E,T,N,P={},L=this.children;for(T=0,N=L.length;N>T;++T)(E=L[T])instanceof d&&(P[E.name]=E.build());return Object.defineProperty&&Object.defineProperty(P,"$options",{value:this.buildOpt()}),P},l.buildOpt=function(){var E,T,N,P,L={},V=Object.keys(this.options);for(E=0,T=V.length;T>E;++E)N=V[E],P=this.options[V[E]],L[N]=P;return L},l.getOption=function(E){return E===void 0?this.options:this.options[E]!==void 0?this.options[E]:null},w.Namespace=d,a=(h=function(E,T,N,P){if(this.type=E,this.resolvedType=T,this.isMapKey=N,this.syntax=P,N&&o.MAP_KEY_TYPES.indexOf(E)<0)throw Error("Invalid map key type: "+E.name)}).prototype,h.defaultFieldValue=function(E){if(typeof E=="string"&&(E=o.TYPES[E]),E.defaultValue===void 0)throw Error("default value for type "+E.name+" is not supported");return E==o.TYPES.bytes?new t(0):E.defaultValue},a.verifyValue=function(E){var T,N,P,L=function(V,F){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+V+" ("+F+")")}.bind(this);switch(this.type){case o.TYPES.int32:case o.TYPES.sint32:case o.TYPES.sfixed32:return(typeof E!="number"||E==E&&E%1!=0)&&L(typeof E,"not an integer"),E>4294967295?0|E:E;case o.TYPES.uint32:case o.TYPES.fixed32:return(typeof E!="number"||E==E&&E%1!=0)&&L(typeof E,"not an integer"),E<0?E>>>0:E;case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:if(o.Long)try{return s(E,!1)}catch(V){L(typeof E,V.message)}else L(typeof E,"requires Long.js");case o.TYPES.uint64:case o.TYPES.fixed64:if(o.Long)try{return s(E,!0)}catch(V){L(typeof E,V.message)}else L(typeof E,"requires Long.js");case o.TYPES.bool:return typeof E!="boolean"&&L(typeof E,"not a boolean"),E;case o.TYPES.float:case o.TYPES.double:return typeof E!="number"&&L(typeof E,"not a number"),E;case o.TYPES.string:return typeof E=="string"||E&&E instanceof String||L(typeof E,"not a string"),""+E;case o.TYPES.bytes:return n.isByteBuffer(E)?E:n.wrap(E);case o.TYPES.enum:for(T=this.resolvedType.getChildren(o.Reflect.Enum.Value),P=0;P<T.length;P++)if(T[P].name==E||T[P].id==E)return T[P].id;if(this.syntax==="proto3")return(typeof E!="number"||E==E&&E%1!=0)&&L(typeof E,"not an integer"),(E>4294967295||E<0)&&L(typeof E,"not in range for uint32"),E;L(E,"not a valid enum value");case o.TYPES.group:case o.TYPES.message:if(E&&typeof E=="object"||L(typeof E,"object expected"),E instanceof this.resolvedType.clazz)return E;if(E instanceof o.Builder.Message){for(P in N={},E)E.hasOwnProperty(P)&&(N[P]=E[P]);E=N}return new this.resolvedType.clazz(E)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+E+" (undefined type "+this.type+")")},a.calculateLength=function(E,T){if(T===null)return 0;var N;switch(this.type){case o.TYPES.int32:return T<0?t.calculateVarint64(T):t.calculateVarint32(T);case o.TYPES.uint32:return t.calculateVarint32(T);case o.TYPES.sint32:return t.calculateVarint32(t.zigZagEncode32(T));case o.TYPES.fixed32:case o.TYPES.sfixed32:case o.TYPES.float:return 4;case o.TYPES.int64:case o.TYPES.uint64:return t.calculateVarint64(T);case o.TYPES.sint64:return t.calculateVarint64(t.zigZagEncode64(T));case o.TYPES.fixed64:case o.TYPES.sfixed64:return 8;case o.TYPES.bool:return 1;case o.TYPES.enum:return t.calculateVarint32(T);case o.TYPES.double:return 8;case o.TYPES.string:return N=t.calculateUTF8Bytes(T),t.calculateVarint32(N)+N;case o.TYPES.bytes:if(T.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+T.remaining()+" bytes remaining");return t.calculateVarint32(T.remaining())+T.remaining();case o.TYPES.message:return N=this.resolvedType.calculate(T),t.calculateVarint32(N)+N;case o.TYPES.group:return(N=this.resolvedType.calculate(T))+t.calculateVarint32(E<<3|o.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+T+" (unknown type)")},a.encodeValue=function(E,T,N){var P,L;if(T===null)return N;switch(this.type){case o.TYPES.int32:T<0?N.writeVarint64(T):N.writeVarint32(T);break;case o.TYPES.uint32:N.writeVarint32(T);break;case o.TYPES.sint32:N.writeVarint32ZigZag(T);break;case o.TYPES.fixed32:N.writeUint32(T);break;case o.TYPES.sfixed32:N.writeInt32(T);break;case o.TYPES.int64:case o.TYPES.uint64:N.writeVarint64(T);break;case o.TYPES.sint64:N.writeVarint64ZigZag(T);break;case o.TYPES.fixed64:N.writeUint64(T);break;case o.TYPES.sfixed64:N.writeInt64(T);break;case o.TYPES.bool:typeof T=="string"?N.writeVarint32(T.toLowerCase()==="false"?0:!!T):N.writeVarint32(T?1:0);break;case o.TYPES.enum:N.writeVarint32(T);break;case o.TYPES.float:N.writeFloat32(T);break;case o.TYPES.double:N.writeFloat64(T);break;case o.TYPES.string:N.writeVString(T);break;case o.TYPES.bytes:if(T.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+T.remaining()+" bytes remaining");P=T.offset,N.writeVarint32(T.remaining()),N.append(T),T.offset=P;break;case o.TYPES.message:L=new t().LE(),this.resolvedType.encode(T,L),N.writeVarint32(L.offset),N.append(L.flip());break;case o.TYPES.group:this.resolvedType.encode(T,N),N.writeVarint32(E<<3|o.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+T+" (unknown type)")}return N},a.decode=function(E,T,N){if(T!=this.type.wireType)throw Error("Unexpected wire type for element");var P,L;switch(this.type){case o.TYPES.int32:return 0|E.readVarint32();case o.TYPES.uint32:return E.readVarint32()>>>0;case o.TYPES.sint32:return 0|E.readVarint32ZigZag();case o.TYPES.fixed32:return E.readUint32()>>>0;case o.TYPES.sfixed32:return 0|E.readInt32();case o.TYPES.int64:return E.readVarint64();case o.TYPES.uint64:return E.readVarint64().toUnsigned();case o.TYPES.sint64:return E.readVarint64ZigZag();case o.TYPES.fixed64:return E.readUint64();case o.TYPES.sfixed64:return E.readInt64();case o.TYPES.bool:return!!E.readVarint32();case o.TYPES.enum:return E.readVarint32();case o.TYPES.float:return E.readFloat();case o.TYPES.double:return E.readDouble();case o.TYPES.string:return E.readVString();case o.TYPES.bytes:if(L=E.readVarint32(),E.remaining()<L)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+L+" required but got only "+E.remaining());return(P=E.clone()).limit=P.offset+L,E.offset+=L,P;case o.TYPES.message:return L=E.readVarint32(),this.resolvedType.decode(E,L);case o.TYPES.group:return this.resolvedType.decode(E,-1,N)}throw Error("[INTERNAL] Illegal decode type")},a.valueFromString=function(E){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case o.TYPES.int32:case o.TYPES.sint32:case o.TYPES.sfixed32:case o.TYPES.uint32:case o.TYPES.fixed32:return this.verifyValue(parseInt(E));case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:case o.TYPES.uint64:case o.TYPES.fixed64:return this.verifyValue(E);case o.TYPES.bool:return E==="true";case o.TYPES.string:return this.verifyValue(E);case o.TYPES.bytes:return t.fromBinary(E)}},a.valueToString=function(E){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===o.TYPES.bytes?E.toString("binary"):E.toString()},w.Element=h,(p=(c=function(E,T,N,P,L,V){d.call(this,E,T,N,P,V),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!L,this._fields=null,this._fieldsById=null,this._fieldsByName=null}).prototype=Object.create(d.prototype)).build=function(E){var T,N,P,L;if(this.clazz&&!E)return this.clazz;for(T=function(V,F){function q(k,G,Q,te){var oe,pe,Pn,zt,jr,Kr,Ot;if(k===null||typeof k!="object")return te&&te instanceof V.Reflect.Enum&&(oe=V.Reflect.Enum.getName(te.object,k))!==null?oe:k;if(t.isByteBuffer(k))return G?k.toBase64():k.toBuffer();if(V.Long.isLong(k))return Q?k.toString():V.Long.fromValue(k);if(Array.isArray(k))return pe=[],k.forEach(function(eu,tu){pe[tu]=q(eu,G,Q,te)}),pe;if(pe={},k instanceof V.Map){for(zt=(Pn=k.entries()).next();!zt.done;zt=Pn.next())pe[k.keyElem.valueToString(zt.value[0])]=q(zt.value[1],G,Q,k.valueElem.resolvedType);return pe}for(Ot in jr=k.$type,Kr=void 0,k)k.hasOwnProperty(Ot)&&(pe[Ot]=jr&&(Kr=jr.getChild(Ot))?q(k[Ot],G,Q,Kr.resolvedType):q(k[Ot],G,Q));return pe}var z,ne,ae=F.getChildren(V.Reflect.Message.Field),se=F.getChildren(V.Reflect.Message.OneOf),re=function(k){var G,Q,te,oe;for(V.Builder.Message.call(this),G=0,Q=se.length;Q>G;++G)this[se[G].name]=null;for(G=0,Q=ae.length;Q>G;++G)this[(te=ae[G]).name]=te.repeated?[]:te.map?new V.Map(te):null,!te.required&&F.syntax!=="proto3"||te.defaultValue===null||(this[te.name]=te.defaultValue);if(arguments.length>0)if(arguments.length!==1||k===null||typeof k!="object"||!(typeof k.encode!="function"||k instanceof re)||Array.isArray(k)||k instanceof V.Map||t.isByteBuffer(k)||k instanceof ArrayBuffer||V.Long&&k instanceof V.Long)for(G=0,Q=arguments.length;Q>G;++G)(oe=arguments[G])!==void 0&&this.$set(ae[G].name,oe);else this.$set(k)},X=re.prototype=Object.create(V.Builder.Message.prototype);for(X.add=function(k,G,Q){var te=F._fieldsByName[k];if(!Q){if(!te)throw Error(this+"#"+k+" is undefined");if(!(te instanceof V.Reflect.Message.Field))throw Error(this+"#"+k+" is not a field: "+te.toString(!0));if(!te.repeated)throw Error(this+"#"+k+" is not a repeated field");G=te.verifyValue(G,!0)}return this[k]===null&&(this[k]=[]),this[k].push(G),this},X.$add=X.add,X.set=function(k,G,Q){var te,oe,pe;if(k&&typeof k=="object"){for(te in Q=G,k)k.hasOwnProperty(te)&&(G=k[te])!==void 0&&this.$set(te,G,Q);return this}if(oe=F._fieldsByName[k],Q)this[k]=G;else{if(!oe)throw Error(this+"#"+k+" is not a field: undefined");if(!(oe instanceof V.Reflect.Message.Field))throw Error(this+"#"+k+" is not a field: "+oe.toString(!0));this[oe.name]=G=oe.verifyValue(G)}return oe&&oe.oneof&&(pe=this[oe.oneof.name],G!==null?(pe!==null&&pe!==oe.name&&(this[pe]=null),this[oe.oneof.name]=oe.name):pe===k&&(this[oe.oneof.name]=null)),this},X.$set=X.set,X.get=function(k,G){if(G)return this[k];var Q=F._fieldsByName[k];if(!(Q&&Q instanceof V.Reflect.Message.Field))throw Error(this+"#"+k+" is not a field: undefined");if(!(Q instanceof V.Reflect.Message.Field))throw Error(this+"#"+k+" is not a field: "+Q.toString(!0));return this[Q.name]},X.$get=X.get,z=0;z<ae.length;z++)(ne=ae[z])instanceof V.Reflect.Message.ExtensionField||F.builder.options.populateAccessors&&function(k){var G,Q,te,oe=k.originalName.replace(/(_[a-zA-Z])/g,function(pe){return pe.toUpperCase().replace("_","")});oe=oe.substring(0,1).toUpperCase()+oe.substring(1),G=k.originalName.replace(/([A-Z])/g,function(pe){return"_"+pe}),Q=function(pe,Pn){return this[k.name]=Pn?pe:k.verifyValue(pe),this},te=function(){return this[k.name]},F.getChild("set"+oe)===null&&(X["set"+oe]=Q),F.getChild("set_"+G)===null&&(X["set_"+G]=Q),F.getChild("get"+oe)===null&&(X["get"+oe]=te),F.getChild("get_"+G)===null&&(X["get_"+G]=te)}(ne);return X.encode=function(k,G){var Q,te;typeof k=="boolean"&&(G=k,k=void 0),Q=!1,k||(k=new n,Q=!0),te=k.littleEndian;try{return F.encode(this,k.LE(),G),(Q?k.flip():k).LE(te)}catch(oe){throw k.LE(te),oe}},re.encode=function(k,G,Q){return new re(k).encode(G,Q)},X.calculate=function(){return F.calculate(this)},X.encodeDelimited=function(k){var G,Q=!1;return k||(k=new t,Q=!0),G=new t().LE(),F.encode(this,G).flip(),k.writeVarint32(G.remaining()),k.append(G),Q?k.flip():k},X.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(k){throw k.encoded&&(k.encoded=k.encoded.toArrayBuffer()),k}},X.toArrayBuffer=X.encodeAB,X.encodeNB=function(){try{return this.encode().toBuffer()}catch(k){throw k.encoded&&(k.encoded=k.encoded.toBuffer()),k}},X.toBuffer=X.encodeNB,X.encode64=function(){try{return this.encode().toBase64()}catch(k){throw k.encoded&&(k.encoded=k.encoded.toBase64()),k}},X.toBase64=X.encode64,X.encodeHex=function(){try{return this.encode().toHex()}catch(k){throw k.encoded&&(k.encoded=k.encoded.toHex()),k}},X.toHex=X.encodeHex,X.toRaw=function(k,G){return q(this,!!k,!!G,this.$type)},X.encodeJSON=function(){return JSON.stringify(q(this,!0,!0,this.$type))},re.decode=function(k,G){var Q,te;typeof k=="string"&&(k=t.wrap(k,G||"base64")),Q=(k=t.isByteBuffer(k)?k:t.wrap(k)).littleEndian;try{return te=F.decode(k.LE()),k.LE(Q),te}catch(oe){throw k.LE(Q),oe}},re.decodeDelimited=function(k,G){var Q,te,oe;if(typeof k=="string"&&(k=t.wrap(k,G||"base64")),(k=t.isByteBuffer(k)?k:t.wrap(k)).remaining()<1)return null;if(Q=k.offset,te=k.readVarint32(),k.remaining()<te)return k.offset=Q,null;try{return oe=F.decode(k.slice(k.offset,k.offset+te).LE()),k.offset+=te,oe}catch(pe){throw k.offset+=te,pe}},re.decode64=function(k){return re.decode(k,"base64")},re.decodeHex=function(k){return re.decode(k,"hex")},re.decodeJSON=function(k){return new re(JSON.parse(k))},X.toString=function(){return F.toString()},Object.defineProperty&&(Object.defineProperty(re,"$options",{value:F.buildOpt()}),Object.defineProperty(X,"$options",{value:re.$options}),Object.defineProperty(re,"$type",{value:F}),Object.defineProperty(X,"$type",{value:F})),re}(o,this),this._fields=[],this._fieldsById={},this._fieldsByName={},P=0,L=this.children.length;L>P;P++)if((N=this.children[P])instanceof R||N instanceof c||N instanceof A){if(T.hasOwnProperty(N.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+N.toString(!0)+" cannot override static property '"+N.name+"'");T[N.name]=N.build()}else if(N instanceof c.Field)N.build(),this._fields.push(N),this._fieldsById[N.id]=N,this._fieldsByName[N.name]=N;else if(!(N instanceof c.OneOf||N instanceof M))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[P].toString(!0));return this.clazz=T},p.encode=function(E,T,N){var P,L,V,F,q,z=null;for(V=0,F=this._fields.length;F>V;++V)L=E[(P=this._fields[V]).name],P.required&&L===null?z===null&&(z=P):P.encode(N?L:P.verifyValue(L),T,E);if(z!==null)throw(q=Error("Missing at least one required field for "+this.toString(!0)+": "+z)).encoded=T,q;return T},p.calculate=function(E){for(var T,N,P=0,L=0,V=this._fields.length;V>L;++L){if(N=E[(T=this._fields[L]).name],T.required&&N===null)throw Error("Missing at least one required field for "+this.toString(!0)+": "+T);P+=T.calculate(N,E)}return P},p.decode=function(E,T,N){var P,L,V,F,q,z,ne,ae,se,re,X,k;for(T=typeof T=="number"?T:-1,q=E.offset,z=new this.clazz;E.offset<q+T||T===-1&&E.remaining()>0;){if(V=(P=E.readVarint32())>>>3,(L=7&P)===o.WIRE_TYPES.ENDGROUP){if(V!==N)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+V+" ("+(N?N+" expected":"not a group")+")");break}if(F=this._fieldsById[V])F.repeated&&!F.options.packed?z[F.name].push(F.decode(L,E)):F.map?(ae=F.decode(L,E),z[F.name].set(ae[0],ae[1])):(z[F.name]=F.decode(L,E),F.oneof&&((se=z[F.oneof.name])!==null&&se!==F.name&&(z[se]=null),z[F.oneof.name]=F.name));else switch(L){case o.WIRE_TYPES.VARINT:E.readVarint32();break;case o.WIRE_TYPES.BITS32:E.offset+=4;break;case o.WIRE_TYPES.BITS64:E.offset+=8;break;case o.WIRE_TYPES.LDELIM:ne=E.readVarint32(),E.offset+=ne;break;case o.WIRE_TYPES.STARTGROUP:for(;u(V,E););break;default:throw Error("Illegal wire type for unknown field "+V+" in "+this.toString(!0)+"#decode: "+L)}}for(re=0,X=this._fields.length;X>re;++re)if(z[(F=this._fields[re]).name]===null)if(this.syntax==="proto3")z[F.name]=F.defaultValue;else{if(F.required)throw(k=Error("Missing at least one required field for "+this.toString(!0)+": "+F.name)).decoded=z,k;o.populateDefaults&&F.defaultValue!==null&&(z[F.name]=F.defaultValue)}return z},w.Message=c,(m=(f=function(E,T,N,P,L,V,F,q,z,ne){H.call(this,E,T,V),this.className="Message.Field",this.required=N==="required",this.repeated=N==="repeated",this.map=N==="map",this.keyType=P||null,this.type=L,this.resolvedType=null,this.id=F,this.options=q||{},this.defaultValue=null,this.oneof=z||null,this.syntax=ne||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof c.ExtensionField||(this.name=o.Util.toCamelCase(this.name))}).prototype=Object.create(H.prototype)).build=function(){this.element=new h(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new h(this.keyType,void 0,!0,this.syntax)),this.syntax!=="proto3"||this.repeated||this.map?this.options.default!==void 0&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=h.defaultFieldValue(this.type)},m.verifyValue=function(E,T){var N,P,L;if(T=T||!1,N=function(V,F){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+V+" ("+F+")")}.bind(this),E===null)return this.required&&N(typeof E,"required"),this.syntax==="proto3"&&this.type!==o.TYPES.message&&N(typeof E,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!T){for(Array.isArray(E)||(E=[E]),L=[],P=0;P<E.length;P++)L.push(this.element.verifyValue(E[P]));return L}return this.map&&!T?E instanceof o.Map?E:(E instanceof Object||N(typeof E,"expected ProtoBuf.Map or raw object for map field"),new o.Map(this,E)):(!this.repeated&&Array.isArray(E)&&N(typeof E,"no array expected"),this.element.verifyValue(E))},m.hasWirePresence=function(E,T){if(this.syntax!=="proto3")return E!==null;if(this.oneof&&T[this.oneof.name]===this.name)return!0;switch(this.type){case o.TYPES.int32:case o.TYPES.sint32:case o.TYPES.sfixed32:case o.TYPES.uint32:case o.TYPES.fixed32:return E!==0;case o.TYPES.int64:case o.TYPES.sint64:case o.TYPES.sfixed64:case o.TYPES.uint64:case o.TYPES.fixed64:return E.low!==0||E.high!==0;case o.TYPES.bool:return E;case o.TYPES.float:case o.TYPES.double:return E!==0;case o.TYPES.string:return E.length>0;case o.TYPES.bytes:return E.remaining()>0;case o.TYPES.enum:return E!==0;case o.TYPES.message:return E!==null;default:return!0}},m.encode=function(E,T,N){var P,L,V,F,q;if(this.type===null||typeof this.type!="object")throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(E===null||this.repeated&&E.length==0)return T;try{if(this.repeated)if(this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(T.writeVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),T.ensureCapacity(T.offset+=1),L=T.offset,P=0;P<E.length;P++)this.element.encodeValue(this.id,E[P],T);V=T.offset-L,(F=t.calculateVarint32(V))>1&&(q=T.slice(L,T.offset),L+=F-1,T.offset=L,T.append(q)),T.writeVarint32(V,L-F)}else for(P=0;P<E.length;P++)T.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,E[P],T);else this.map?E.forEach(function(z,ne){var ae=t.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,ne)+t.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,z);T.writeVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),T.writeVarint32(ae),T.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,ne,T),T.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,z,T)},this):this.hasWirePresence(E,N)&&(T.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,E,T))}catch(z){throw Error("Illegal value for "+this.toString(!0)+": "+E+" ("+z+")")}return T},m.calculate=function(E,T){var N,P,L;if(E=this.verifyValue(E),this.type===null||typeof this.type!="object")throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(E===null||this.repeated&&E.length==0)return 0;N=0;try{if(this.repeated)if(this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(N+=t.calculateVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),L=0,P=0;P<E.length;P++)L+=this.element.calculateLength(this.id,E[P]);N+=t.calculateVarint32(L),N+=L}else for(P=0;P<E.length;P++)N+=t.calculateVarint32(this.id<<3|this.type.wireType),N+=this.element.calculateLength(this.id,E[P]);else this.map?E.forEach(function(V,F){var q=t.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,F)+t.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,V);N+=t.calculateVarint32(this.id<<3|o.WIRE_TYPES.LDELIM),N+=t.calculateVarint32(q),N+=q},this):this.hasWirePresence(E,T)&&(N+=t.calculateVarint32(this.id<<3|this.type.wireType),N+=this.element.calculateLength(this.id,E))}catch(V){throw Error("Illegal value for "+this.toString(!0)+": "+E+" ("+V+")")}return N},m.decode=function(E,T,N){var P,L,V,F,q,z,ne;if(!(!this.map&&E==this.type.wireType||!N&&this.repeated&&this.options.packed&&E==o.WIRE_TYPES.LDELIM||this.map&&E==o.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+E+" ("+this.type.wireType+" expected)");if(E==o.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&o.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!N){for(L=T.readVarint32(),L=T.offset+L,V=[];T.offset<L;)V.push(this.decode(this.type.wireType,T,!0));return V}if(this.map){if(F=h.defaultFieldValue(this.keyType),P=h.defaultFieldValue(this.type),L=T.readVarint32(),T.remaining()<L)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+L+" required but got only "+T.remaining());for((q=T.clone()).limit=q.offset+L,T.offset+=L;q.remaining()>0;)if(E=7&(z=q.readVarint32()),(ne=z>>>3)==1)F=this.keyElement.decode(q,E,ne);else{if(ne!==2)throw Error("Unexpected tag in map field key/value submessage");P=this.element.decode(q,E,ne)}return[F,P]}return this.element.decode(T,E,this.id)},w.Message.Field=f,(_=function(E,T,N,P,L,V,F){f.call(this,E,T,N,null,P,L,V,F),this.extension}).prototype=Object.create(f.prototype),w.Message.ExtensionField=_,v=function(E,T,N){H.call(this,E,T,N),this.fields=[]},w.Message.OneOf=v,(R=function(E,T,N,P,L){d.call(this,E,T,N,P,L),this.className="Enum",this.object=null}).getName=function(E,T){var N,P,L=Object.keys(E);for(P=0;P<L.length;++P)if(E[N=L[P]]===T)return N;return null},(R.prototype=Object.create(d.prototype)).build=function(E){var T,N,P,L;if(this.object&&!E)return this.object;for(T=new o.Builder.Enum,P=0,L=(N=this.getChildren(R.Value)).length;L>P;++P)T[N[P].name]=N[P].id;return Object.defineProperty&&Object.defineProperty(T,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=T},w.Enum=R,(C=function(E,T,N,P){H.call(this,E,T,N),this.className="Enum.Value",this.id=P}).prototype=Object.create(H.prototype),w.Enum.Value=C,(M=function(E,T,N,P){H.call(this,E,T,N),this.field=P}).prototype=Object.create(H.prototype),w.Extension=M,((A=function(E,T,N,P){d.call(this,E,T,N,P),this.className="Service",this.clazz=null}).prototype=Object.create(d.prototype)).build=function(E){return this.clazz&&!E?this.clazz:this.clazz=function(T,N){var P,L=function(q){T.Builder.Service.call(this),this.rpcImpl=q||function(z,ne,ae){setTimeout(ae.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},V=L.prototype=Object.create(T.Builder.Service.prototype),F=N.getChildren(T.Reflect.Service.RPCMethod);for(P=0;P<F.length;P++)(function(q){V[q.name]=function(z,ne){try{try{z=q.resolvedRequestType.clazz.decode(t.wrap(z))}catch(ae){if(!(ae instanceof TypeError))throw ae}if(z===null||typeof z!="object")throw Error("Illegal arguments");z instanceof q.resolvedRequestType.clazz||(z=new q.resolvedRequestType.clazz(z)),this.rpcImpl(q.fqn(),z,function(ae,se){if(!ae){try{se=q.resolvedResponseType.clazz.decode(se)}catch{}return se&&se instanceof q.resolvedResponseType.clazz?void ne(null,se):void ne(Error("Illegal response type received in service method "+N.name+"#"+q.name))}ne(ae)})}catch(ae){setTimeout(ne.bind(this,ae),0)}},L[q.name]=function(z,ne,ae){new L(z)[q.name](ne,ae)},Object.defineProperty&&(Object.defineProperty(L[q.name],"$options",{value:q.buildOpt()}),Object.defineProperty(V[q.name],"$options",{value:L[q.name].$options}))})(F[P]);return Object.defineProperty&&(Object.defineProperty(L,"$options",{value:N.buildOpt()}),Object.defineProperty(V,"$options",{value:L.$options}),Object.defineProperty(L,"$type",{value:N}),Object.defineProperty(V,"$type",{value:N})),L}(o,this)},w.Service=A,((O=function(E,T,N,P){H.call(this,E,T,N),this.className="Service.Method",this.options=P||{}}).prototype=Object.create(H.prototype)).buildOpt=l.buildOpt,w.Service.Method=O,(y=function(E,T,N,P,L,V,F,q){O.call(this,E,T,N,q),this.className="Service.RPCMethod",this.requestName=P,this.responseName=L,this.requestStream=V,this.responseStream=F,this.resolvedRequestType=null,this.resolvedResponseType=null}).prototype=Object.create(O.prototype),w.Service.RPCMethod=y,w}(i),i.Builder=function(o,s,u){function d(a){a.messages&&a.messages.forEach(function(c){c.syntax=a.syntax,d(c)}),a.enums&&a.enums.forEach(function(c){c.syntax=a.syntax})}var l=function(a){this.ns=new u.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=a||{}},h=l.prototype;return l.isMessage=function(a){return typeof a.name=="string"&&a.values===void 0&&a.rpc===void 0},l.isMessageField=function(a){return typeof a.rule=="string"&&typeof a.name=="string"&&typeof a.type=="string"&&a.id!==void 0},l.isEnum=function(a){return typeof a.name=="string"&&!(a.values===void 0||!Array.isArray(a.values)||a.values.length===0)},l.isService=function(a){return!(typeof a.name!="string"||typeof a.rpc!="object"||!a.rpc)},l.isExtend=function(a){return typeof a.ref=="string"},h.reset=function(){return this.ptr=this.ns,this},h.define=function(a){if(typeof a!="string"||!s.TYPEREF.test(a))throw Error("illegal namespace: "+a);return a.split(".").forEach(function(c){var p=this.ptr.getChild(c);p===null&&this.ptr.addChild(p=new u.Namespace(this,this.ptr,c)),this.ptr=p},this),this},h.create=function(a){var c,p,f,m,_;if(!a)return this;if(Array.isArray(a)){if(a.length===0)return this;a=a.slice()}else a=[a];for(c=[a];c.length>0;){if(a=c.pop(),!Array.isArray(a))throw Error("not a valid namespace: "+JSON.stringify(a));for(;a.length>0;){if(p=a.shift(),l.isMessage(p)){if(f=new u.Message(this,this.ptr,p.name,p.options,p.isGroup,p.syntax),m={},p.oneofs&&Object.keys(p.oneofs).forEach(function(v){f.addChild(m[v]=new u.Message.OneOf(this,f,v))},this),p.fields&&p.fields.forEach(function(v){if(f.getChild(0|v.id)!==null)throw Error("duplicate or invalid field id in "+f.name+": "+v.id);if(v.options&&typeof v.options!="object")throw Error("illegal field options in "+f.name+"#"+v.name);var R=null;if(typeof v.oneof=="string"&&!(R=m[v.oneof]))throw Error("illegal oneof in "+f.name+"#"+v.name+": "+v.oneof);v=new u.Message.Field(this,f,v.rule,v.keytype,v.type,v.name,v.id,v.options,R,p.syntax),R&&R.fields.push(v),f.addChild(v)},this),_=[],p.enums&&p.enums.forEach(function(v){_.push(v)}),p.messages&&p.messages.forEach(function(v){_.push(v)}),p.services&&p.services.forEach(function(v){_.push(v)}),p.extensions&&(f.extensions=typeof p.extensions[0]=="number"?[p.extensions]:p.extensions),this.ptr.addChild(f),_.length>0){c.push(a),a=_,_=null,this.ptr=f,f=null;continue}_=null}else if(l.isEnum(p))f=new u.Enum(this,this.ptr,p.name,p.options,p.syntax),p.values.forEach(function(v){f.addChild(new u.Enum.Value(this,f,v.name,v.id))},this),this.ptr.addChild(f);else if(l.isService(p))f=new u.Service(this,this.ptr,p.name,p.options),Object.keys(p.rpc).forEach(function(v){var R=p.rpc[v];f.addChild(new u.Service.RPCMethod(this,f,v,R.request,R.response,!!R.request_stream,!!R.response_stream,R.options))},this),this.ptr.addChild(f);else{if(!l.isExtend(p))throw Error("not a valid definition: "+JSON.stringify(p));if(f=this.ptr.resolve(p.ref,!0))p.fields.forEach(function(v){var R,C,M,A;if(f.getChild(0|v.id)!==null)throw Error("duplicate extended field id in "+f.name+": "+v.id);if(f.extensions&&(R=!1,f.extensions.forEach(function(O){v.id>=O[0]&&v.id<=O[1]&&(R=!0)}),!R))throw Error("illegal extended field id in "+f.name+": "+v.id+" (not within valid ranges)");C=v.name,this.options.convertFieldsToCamelCase&&(C=o.Util.toCamelCase(C)),M=new u.Message.ExtensionField(this,f,v.rule,v.type,this.ptr.fqn()+"."+C,v.id,v.options),A=new u.Extension(this,this.ptr,v.name,M),M.extension=A,this.ptr.addChild(A),f.addChild(M)},this);else if(!/\.?google\.protobuf\./.test(p.ref))throw Error("extended message "+p.ref+" is not defined")}p=null,f=null}a=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},h.import=function(a,c){var p,f,m,_,v,R,C,M,A="/";if(typeof c=="string"){if(o.Util.IS_NODE,this.files[c]===!0)return this.reset();this.files[c]=!0}else if(typeof c=="object"){if(p=c.root,o.Util.IS_NODE,(p.indexOf("\\")>=0||c.file.indexOf("\\")>=0)&&(A="\\"),f=p+A+c.file,this.files[f]===!0)return this.reset();this.files[f]=!0}if(a.imports&&a.imports.length>0){for(_=!1,typeof c=="object"?(this.importRoot=c.root,_=!0,m=this.importRoot,c=c.file,(m.indexOf("\\")>=0||c.indexOf("\\")>=0)&&(A="\\")):typeof c=="string"?this.importRoot?m=this.importRoot:c.indexOf("/")>=0?(m=c.replace(/\/[^\/]*$/,""))===""&&(m="/"):c.indexOf("\\")>=0?(m=c.replace(/\\[^\\]*$/,""),A="\\"):m=".":m=null,v=0;v<a.imports.length;v++)if(typeof a.imports[v]=="string"){if(!m)throw Error("cannot determine import root");if((R=a.imports[v])==="google/protobuf/descriptor.proto"||(R=m+A+R,this.files[R]===!0))continue;if(/\.proto$/i.test(R)&&!o.DotProto&&(R=R.replace(/\.proto$/,".json")),(C=o.Util.fetch(R))===null)throw Error("failed to import '"+R+"' in '"+c+"': file not found");/\.json$/i.test(R)?this.import(JSON.parse(C+""),R):this.import(o.DotProto.Parser.parse(C),R)}else c?/\.(\w+)$/.test(c)?this.import(a.imports[v],c.replace(/^(.+)\.(\w+)$/,function(O,y,w){return y+"_import"+v+"."+w})):this.import(a.imports[v],c+"_import"+v):this.import(a.imports[v]);_&&(this.importRoot=null)}return a.package&&this.define(a.package),a.syntax&&d(a),M=this.ptr,a.options&&Object.keys(a.options).forEach(function(O){M.options[O]=a.options[O]}),a.messages&&(this.create(a.messages),this.ptr=M),a.enums&&(this.create(a.enums),this.ptr=M),a.services&&(this.create(a.services),this.ptr=M),a.extends&&this.create(a.extends),this.reset()},h.resolveAll=function(){var a;if(this.ptr==null||typeof this.ptr.type=="object")return this;if(this.ptr instanceof u.Namespace)this.ptr.children.forEach(function(c){this.ptr=c,this.resolveAll()},this);else if(this.ptr instanceof u.Message.Field){if(s.TYPE.test(this.ptr.type))this.ptr.type=o.TYPES[this.ptr.type];else{if(!s.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(a=(this.ptr instanceof u.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=a,a instanceof u.Enum){if(this.ptr.type=o.TYPES.enum,this.ptr.syntax==="proto3"&&a.syntax!=="proto3")throw Error("proto3 message cannot reference proto2 enum")}else{if(!(a instanceof u.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=a.isGroup?o.TYPES.group:o.TYPES.message}}if(this.ptr.map){if(!s.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=o.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof o.Reflect.Service.Method){if(!(this.ptr instanceof o.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((a=this.ptr.parent.resolve(this.ptr.requestName,!0))&&a instanceof o.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=a,!((a=this.ptr.parent.resolve(this.ptr.responseName,!0))&&a instanceof o.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=a}else if(!(this.ptr instanceof o.Reflect.Message.OneOf||this.ptr instanceof o.Reflect.Extension||this.ptr instanceof o.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},h.build=function(a){var c,p,f;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),this.result===null&&(this.result=this.ns.build()),!a)return this.result;for(c=typeof a=="string"?a.split("."):a,p=this.result,f=0;f<c.length;f++){if(!p[c[f]]){p=null;break}p=p[c[f]]}return p},h.lookup=function(a,c){return a?this.ns.resolve(a,c):this.ns},h.toString=function(){return"Builder"},l.Message=function(){},l.Enum=function(){},l.Service=function(){},l}(i,i.Lang,i.Reflect),i.Map=function(o,s){function u(h){var a=0;return{next:function(){return a<h.length?{done:!1,value:h[a++]}:{done:!0}}}}var d=function(h,a){var c,p,f,m;if(!h.map)throw Error("field is not a map");if(this.field=h,this.keyElem=new s.Element(h.keyType,null,!0,h.syntax),this.valueElem=new s.Element(h.type,h.resolvedType,!1,h.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),a)for(c=Object.keys(a),p=0;p<c.length;p++)f=this.keyElem.valueFromString(c[p]),m=this.valueElem.verifyValue(a[c[p]]),this.map[this.keyElem.valueToString(f)]={key:f,value:m}},l=d.prototype;return l.clear=function(){this.map={}},l.delete=function(h){var a=this.keyElem.valueToString(this.keyElem.verifyValue(h)),c=a in this.map;return delete this.map[a],c},l.entries=function(){var h,a,c=[],p=Object.keys(this.map);for(a=0;a<p.length;a++)c.push([(h=this.map[p[a]]).key,h.value]);return u(c)},l.keys=function(){var h,a=[],c=Object.keys(this.map);for(h=0;h<c.length;h++)a.push(this.map[c[h]].key);return u(a)},l.values=function(){var h,a=[],c=Object.keys(this.map);for(h=0;h<c.length;h++)a.push(this.map[c[h]].value);return u(a)},l.forEach=function(h,a){var c,p,f=Object.keys(this.map);for(p=0;p<f.length;p++)h.call(a,(c=this.map[f[p]]).value,c.key,this)},l.set=function(h,a){var c=this.keyElem.verifyValue(h),p=this.valueElem.verifyValue(a);return this.map[this.keyElem.valueToString(c)]={key:c,value:p},this},l.get=function(h){var a=this.keyElem.valueToString(this.keyElem.verifyValue(h));return a in this.map?this.map[a].value:void 0},l.has=function(h){return this.keyElem.valueToString(this.keyElem.verifyValue(h))in this.map},d}(0,i.Reflect),i.loadProto=function(o,s,u){return(typeof s=="string"||s&&typeof s.file=="string"&&typeof s.root=="string")&&(u=s,s=void 0),i.loadJson(i.DotProto.Parser.parse(o),s,u)},i.protoFromString=i.loadProto,i.loadProtoFile=function(o,s,u){if(s&&typeof s=="object"?(u=s,s=null):s&&typeof s=="function"||(s=null),s)return i.Util.fetch(typeof o=="string"?o:o.root+"/"+o.file,function(l){if(l!==null)try{s(null,i.loadProto(l,u,o))}catch(h){s(h)}else s(Error("Failed to fetch file"))});var d=i.Util.fetch(typeof o=="object"?o.root+"/"+o.file:o);return d===null?null:i.loadProto(d,u,o)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(o){return(o=o||{}).convertFieldsToCamelCase===void 0&&(o.convertFieldsToCamelCase=i.convertFieldsToCamelCase),o.populateAccessors===void 0&&(o.populateAccessors=i.populateAccessors),new i.Builder(o)},i.loadJson=function(o,s,u){return(typeof s=="string"||s&&typeof s.file=="string"&&typeof s.root=="string")&&(u=s,s=null),s&&typeof s=="object"||(s=i.newBuilder()),typeof o=="string"&&(o=JSON.parse(o)),s.import(o,u),s.resolveAll(),s},i.loadJsonFile=function(o,s,u){if(s&&typeof s=="object"?(u=s,s=null):s&&typeof s=="function"||(s=null),s)return i.Util.fetch(typeof o=="string"?o:o.root+"/"+o.file,function(l){if(l!==null)try{s(null,i.loadJson(JSON.parse(l),u,o))}catch(h){s(h)}else s(Error("Failed to fetch file"))});var d=i.Util.fetch(typeof o=="object"?o.root+"/"+o.file:o);return d===null?null:i.loadJson(JSON.parse(d),u,o)},r=vs,i.loadProto(r,void 0,"").build("Modules").probuf}(function(n){function e(a){var c=0;return function(){return c<a.length?a.charCodeAt(c++):null}}function t(){var a=[],c=[];return function(){return arguments.length===0?c.join("")+u.apply(String,a):(a.length+arguments.length>1024&&(c.push(u.apply(String,a)),a.length=0),void Array.prototype.push.apply(a,arguments))}}function r(a,c,p,f,m){var _,v,R=8*m-f-1,C=(1<<R)-1,M=C>>1,A=-7,O=p?m-1:0,y=p?-1:1,w=a[c+O];for(O+=y,_=w&(1<<-A)-1,w>>=-A,A+=R;A>0;_=256*_+a[c+O],O+=y,A-=8);for(v=_&(1<<-A)-1,_>>=-A,A+=f;A>0;v=256*v+a[c+O],O+=y,A-=8);if(_===0)_=1-M;else{if(_===C)return v?NaN:1/0*(w?-1:1);v+=Math.pow(2,f),_-=M}return(w?-1:1)*v*Math.pow(2,_-f)}function i(a,c,p,f,m,_){var v,R,C,M=8*_-m-1,A=(1<<M)-1,O=A>>1,y=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=f?0:_-1,H=f?1:-1,Y=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||1/0===c?(R=isNaN(c)?1:0,v=A):(v=Math.floor(Math.log(c)/Math.LN2),c*(C=Math.pow(2,-v))<1&&(v--,C*=2),(c+=v+O>=1?y/C:y*Math.pow(2,1-O))*C>=2&&(v++,C/=2),v+O>=A?(R=0,v=A):v+O>=1?(R=(c*C-1)*Math.pow(2,m),v+=O):(R=c*Math.pow(2,O-1)*Math.pow(2,m),v=0));m>=8;a[p+w]=255&R,w+=H,R/=256,m-=8);for(v=v<<m|R,M+=m;M>0;a[p+w]=255&v,w+=H,v/=256,M-=8);a[p+w-H]|=128*Y}var o,s,u,d,l,h=function(a,c,p){if(a===void 0&&(a=h.DEFAULT_CAPACITY),c===void 0&&(c=h.DEFAULT_ENDIAN),p===void 0&&(p=h.DEFAULT_NOASSERT),!p){if((a|=0)<0)throw RangeError("Illegal capacity");c=!!c,p=!!p}this.buffer=a===0?s:new ArrayBuffer(a),this.view=a===0?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=a,this.littleEndian=c,this.noAssert=p};return h.VERSION="5.0.1",h.LITTLE_ENDIAN=!0,h.BIG_ENDIAN=!1,h.DEFAULT_CAPACITY=16,h.DEFAULT_ENDIAN=h.BIG_ENDIAN,h.DEFAULT_NOASSERT=!1,h.Long=n||null,(o=h.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),u=String.fromCharCode,h.accessor=function(){return Uint8Array},h.allocate=function(a,c,p){return new h(a,c,p)},h.concat=function(a,c,p,f){var m,_,v,R,C,M;for((typeof c=="boolean"||typeof c!="string")&&(f=p,p=c,c=void 0),m=0,v=0,R=a.length;R>v;++v)h.isByteBuffer(a[v])||(a[v]=h.wrap(a[v],c)),(_=a[v].limit-a[v].offset)>0&&(m+=_);if(m===0)return new h(0,p,f);for(M=new h(m,p,f),v=0;R>v;)(_=(C=a[v++]).limit-C.offset)<=0||(M.view.set(C.view.subarray(C.offset,C.limit),M.offset),M.offset+=_);return M.limit=M.offset,M.offset=0,M},h.isByteBuffer=function(a){return(a&&a.__isByteBuffer__)===!0},h.type=function(){return ArrayBuffer},h.wrap=function(a,c,p,f){var m,_;if(typeof c!="string"&&(f=p,p=c,c=void 0),typeof a=="string")switch(c===void 0&&(c="utf8"),c){case"base64":return h.fromBase64(a,p);case"hex":return h.fromHex(a,p);case"binary":return h.fromBinary(a,p);case"utf8":return h.fromUTF8(a,p);case"debug":return h.fromDebug(a,p);default:throw Error("Unsupported encoding: "+c)}if(a===null||typeof a!="object")throw TypeError("Illegal buffer");if(h.isByteBuffer(a))return(m=o.clone.call(a)).markedOffset=-1,m;if(a instanceof Uint8Array)m=new h(0,p,f),a.length>0&&(m.buffer=a.buffer,m.offset=a.byteOffset,m.limit=a.byteOffset+a.byteLength,m.view=new Uint8Array(a.buffer));else if(a instanceof ArrayBuffer)m=new h(0,p,f),a.byteLength>0&&(m.buffer=a,m.offset=0,m.limit=a.byteLength,m.view=a.byteLength>0?new Uint8Array(a):null);else{if(Object.prototype.toString.call(a)!=="[object Array]")throw TypeError("Illegal buffer");for((m=new h(a.length,p,f)).limit=a.length,_=0;_<a.length;++_)m.view[_]=a[_]}return m},o.writeBitSet=function(a,c){var p,f,m,_,v,R,C=c===void 0;if(C&&(c=this.offset),!this.noAssert){if(!(a instanceof Array))throw TypeError("Illegal BitSet: Not an array");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}for(f=c,_=(m=a.length)>>3,v=0,c+=this.writeVarint32(m,c);_--;)p=1&!!a[v++]|(1&!!a[v++])<<1|(1&!!a[v++])<<2|(1&!!a[v++])<<3|(1&!!a[v++])<<4|(1&!!a[v++])<<5|(1&!!a[v++])<<6|(1&!!a[v++])<<7,this.writeByte(p,c++);if(m>v){for(R=0,p=0;m>v;)p|=(1&!!a[v++])<<R++;this.writeByte(p,c++)}return C?(this.offset=c,this):c-f},o.readBitSet=function(a){var c,p,f,m,_,v,R,C=a===void 0;for(C&&(a=this.offset),m=(f=(p=this.readVarint32(a)).value)>>3,_=0,v=[],a+=p.length;m--;)c=this.readByte(a++),v[_++]=!!(1&c),v[_++]=!!(2&c),v[_++]=!!(4&c),v[_++]=!!(8&c),v[_++]=!!(16&c),v[_++]=!!(32&c),v[_++]=!!(64&c),v[_++]=!!(128&c);if(f>_)for(R=0,c=this.readByte(a++);f>_;)v[_++]=!!(1&c>>R++);return C&&(this.offset=a),v},o.readBytes=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+"+a+") <= "+this.buffer.byteLength)}return p=this.slice(c,c+a),f&&(this.offset+=a),p},o.writeBytes=o.append,o.writeInt8=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=1)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=1,this.view[c]=a,f&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(a){var c,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}return(128&(c=this.view[a]))==128&&(c=-(255-c+1)),p&&(this.offset+=1),c},o.readByte=o.readInt8,o.writeUint8=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=1)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=1,this.view[c]=a,f&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(a){var c,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}return c=this.view[a],p&&(this.offset+=1),c},o.readUInt8=o.readUint8,o.writeInt16=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=2)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=2,this.littleEndian?(this.view[c+1]=(65280&a)>>>8,this.view[c]=255&a):(this.view[c]=(65280&a)>>>8,this.view[c+1]=255&a),f&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(a){var c,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength)}return c=0,this.littleEndian?(c=this.view[a],c|=this.view[a+1]<<8):(c=this.view[a]<<8,c|=this.view[a+1]),(32768&c)==32768&&(c=-(65535-c+1)),p&&(this.offset+=2),c},o.readShort=o.readInt16,o.writeUint16=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=2)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=2,this.littleEndian?(this.view[c+1]=(65280&a)>>>8,this.view[c]=255&a):(this.view[c]=(65280&a)>>>8,this.view[c+1]=255&a),f&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(a){var c,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+2) <= "+this.buffer.byteLength)}return c=0,this.littleEndian?(c=this.view[a],c|=this.view[a+1]<<8):(c=this.view[a]<<8,c|=this.view[a+1]),p&&(this.offset+=2),c},o.readUInt16=o.readUint16,o.writeInt32=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=4,this.littleEndian?(this.view[c+3]=255&a>>>24,this.view[c+2]=255&a>>>16,this.view[c+1]=255&a>>>8,this.view[c]=255&a):(this.view[c]=255&a>>>24,this.view[c+1]=255&a>>>16,this.view[c+2]=255&a>>>8,this.view[c+3]=255&a),f&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(a){var c,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength)}return c=0,this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0):(c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0),c|=0,p&&(this.offset+=4),c},o.readInt=o.readInt32,o.writeUint32=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=4,this.littleEndian?(this.view[c+3]=255&a>>>24,this.view[c+2]=255&a>>>16,this.view[c+1]=255&a>>>8,this.view[c]=255&a):(this.view[c]=255&a>>>24,this.view[c+1]=255&a>>>16,this.view[c+2]=255&a>>>8,this.view[c+3]=255&a),f&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(a){var c,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength)}return c=0,this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0):(c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0),p&&(this.offset+=4),c},o.readUInt32=o.readUint32,n&&(o.writeInt64=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),!this.noAssert){if(typeof a=="number")a=n.fromNumber(a);else if(typeof a=="string")a=n.fromString(a);else if(!(a&&a instanceof n))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return typeof a=="number"?a=n.fromNumber(a):typeof a=="string"&&(a=n.fromString(a)),(c+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=8,f=a.low,m=a.high,this.littleEndian?(this.view[c+3]=255&f>>>24,this.view[c+2]=255&f>>>16,this.view[c+1]=255&f>>>8,this.view[c]=255&f,c+=4,this.view[c+3]=255&m>>>24,this.view[c+2]=255&m>>>16,this.view[c+1]=255&m>>>8,this.view[c]=255&m):(this.view[c]=255&m>>>24,this.view[c+1]=255&m>>>16,this.view[c+2]=255&m>>>8,this.view[c+3]=255&m,c+=4,this.view[c]=255&f>>>24,this.view[c+1]=255&f>>>16,this.view[c+2]=255&f>>>8,this.view[c+3]=255&f),_&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(a){var c,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength)}return c=0,p=0,this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0,a+=4,p=this.view[a+2]<<16,p|=this.view[a+1]<<8,p|=this.view[a],p+=this.view[a+3]<<24>>>0):(p=this.view[a+1]<<16,p|=this.view[a+2]<<8,p|=this.view[a+3],p+=this.view[a]<<24>>>0,a+=4,c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0),f=new n(c,p,!1),m&&(this.offset+=8),f},o.readLong=o.readInt64,o.writeUint64=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),!this.noAssert){if(typeof a=="number")a=n.fromNumber(a);else if(typeof a=="string")a=n.fromString(a);else if(!(a&&a instanceof n))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return typeof a=="number"?a=n.fromNumber(a):typeof a=="string"&&(a=n.fromString(a)),(c+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=8,f=a.low,m=a.high,this.littleEndian?(this.view[c+3]=255&f>>>24,this.view[c+2]=255&f>>>16,this.view[c+1]=255&f>>>8,this.view[c]=255&f,c+=4,this.view[c+3]=255&m>>>24,this.view[c+2]=255&m>>>16,this.view[c+1]=255&m>>>8,this.view[c]=255&m):(this.view[c]=255&m>>>24,this.view[c+1]=255&m>>>16,this.view[c+2]=255&m>>>8,this.view[c+3]=255&m,c+=4,this.view[c]=255&f>>>24,this.view[c+1]=255&f>>>16,this.view[c+2]=255&f>>>8,this.view[c+3]=255&f),_&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(a){var c,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength)}return c=0,p=0,this.littleEndian?(c=this.view[a+2]<<16,c|=this.view[a+1]<<8,c|=this.view[a],c+=this.view[a+3]<<24>>>0,a+=4,p=this.view[a+2]<<16,p|=this.view[a+1]<<8,p|=this.view[a],p+=this.view[a+3]<<24>>>0):(p=this.view[a+1]<<16,p|=this.view[a+2]<<8,p|=this.view[a+3],p+=this.view[a]<<24>>>0,a+=4,c=this.view[a+1]<<16,c|=this.view[a+2]<<8,c|=this.view[a+3],c+=this.view[a]<<24>>>0),f=new n(c,p,!0),m&&(this.offset+=8),f},o.readUInt64=o.readUint64),o.writeFloat32=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number")throw TypeError("Illegal value: "+a+" (not a number)");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=4)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=4,i(this.view,a,c,this.littleEndian,23,4),f&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(a){var c,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength)}return c=r(this.view,a,this.littleEndian,23,4),p&&(this.offset+=4),c},o.readFloat=o.readFloat32,o.writeFloat64=function(a,c){var p,f=c===void 0;if(f&&(c=this.offset),!this.noAssert){if(typeof a!="number")throw TypeError("Illegal value: "+a+" (not a number)");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return(c+=8)>(p=this.buffer.byteLength)&&this.resize((p*=2)>c?p:c),c-=8,i(this.view,a,c,this.littleEndian,52,8),f&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(a){var c,p=a===void 0;if(p&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+8) <= "+this.buffer.byteLength)}return c=r(this.view,a,this.littleEndian,52,8),p&&(this.offset+=8),c},o.readDouble=o.readFloat64,h.MAX_VARINT32_BYTES=5,h.calculateVarint32=function(a){return(a>>>=0)<128?1:a<16384?2:1<<21>a?3:1<<28>a?4:5},h.zigZagEncode32=function(a){return((a|=0)<<1^a>>31)>>>0},h.zigZagDecode32=function(a){return 0|a>>>1^-(1&a)},o.writeVarint32=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}for((c+=f=h.calculateVarint32(a))>(m=this.buffer.byteLength)&&this.resize((m*=2)>c?m:c),c-=f,a>>>=0;a>=128;)p=128|127&a,this.view[c++]=p,a>>>=7;return this.view[c++]=a,_?(this.offset=c,this):f},o.writeVarint32ZigZag=function(a,c){return this.writeVarint32(h.zigZagEncode32(a),c)},o.readVarint32=function(a){var c,p,f,m,_=a===void 0;if(_&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}p=0,f=0;do{if(!this.noAssert&&a>this.limit)throw(m=Error("Truncated")).truncated=!0,m;c=this.view[a++],p<5&&(f|=(127&c)<<7*p),++p}while((128&c)!=0);return f|=0,_?(this.offset=a,f):{value:f,length:p}},o.readVarint32ZigZag=function(a){var c=this.readVarint32(a);return typeof c=="object"?c.value=h.zigZagDecode32(c.value):c=h.zigZagDecode32(c),c},n&&(h.MAX_VARINT64_BYTES=10,h.calculateVarint64=function(a){typeof a=="number"?a=n.fromNumber(a):typeof a=="string"&&(a=n.fromString(a));var c=a.toInt()>>>0,p=a.shiftRightUnsigned(28).toInt()>>>0,f=a.shiftRightUnsigned(56).toInt()>>>0;return f==0?p==0?c<16384?c<128?1:2:1<<21>c?3:4:p<16384?p<128?5:6:1<<21>p?7:8:f<128?9:10},h.zigZagEncode64=function(a){return typeof a=="number"?a=n.fromNumber(a,!1):typeof a=="string"?a=n.fromString(a,!1):a.unsigned!==!1&&(a=a.toSigned()),a.shiftLeft(1).xor(a.shiftRight(63)).toUnsigned()},h.zigZagDecode64=function(a){return typeof a=="number"?a=n.fromNumber(a,!1):typeof a=="string"?a=n.fromString(a,!1):a.unsigned!==!1&&(a=a.toSigned()),a.shiftRightUnsigned(1).xor(a.and(n.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(a,c){var p,f,m,_,v,R=c===void 0;if(R&&(c=this.offset),!this.noAssert){if(typeof a=="number")a=n.fromNumber(a);else if(typeof a=="string")a=n.fromString(a);else if(!(a&&a instanceof n))throw TypeError("Illegal value: "+a+" (not an integer or Long)");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}switch(typeof a=="number"?a=n.fromNumber(a,!1):typeof a=="string"?a=n.fromString(a,!1):a.unsigned!==!1&&(a=a.toSigned()),p=h.calculateVarint64(a),f=a.toInt()>>>0,m=a.shiftRightUnsigned(28).toInt()>>>0,_=a.shiftRightUnsigned(56).toInt()>>>0,(c+=p)>(v=this.buffer.byteLength)&&this.resize((v*=2)>c?v:c),c-=p,p){case 10:this.view[c+9]=1&_>>>7;case 9:this.view[c+8]=p!==9?128|_:127&_;case 8:this.view[c+7]=p!==8?128|m>>>21:127&m>>>21;case 7:this.view[c+6]=p!==7?128|m>>>14:127&m>>>14;case 6:this.view[c+5]=p!==6?128|m>>>7:127&m>>>7;case 5:this.view[c+4]=p!==5?128|m:127&m;case 4:this.view[c+3]=p!==4?128|f>>>21:127&f>>>21;case 3:this.view[c+2]=p!==3?128|f>>>14:127&f>>>14;case 2:this.view[c+1]=p!==2?128|f>>>7:127&f>>>7;case 1:this.view[c]=p!==1?128|f:127&f}return R?(this.offset+=p,this):p},o.writeVarint64ZigZag=function(a,c){return this.writeVarint64(h.zigZagEncode64(a),c)},o.readVarint64=function(a){var c,p,f,m,_,v,R=a===void 0;if(R&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}if(c=a,p=0,f=0,m=0,_=0,p=127&(_=this.view[a++]),128&_&&(p|=(127&(_=this.view[a++]))<<7,(128&_||this.noAssert&&_===void 0)&&(p|=(127&(_=this.view[a++]))<<14,(128&_||this.noAssert&&_===void 0)&&(p|=(127&(_=this.view[a++]))<<21,(128&_||this.noAssert&&_===void 0)&&(f=127&(_=this.view[a++]),(128&_||this.noAssert&&_===void 0)&&(f|=(127&(_=this.view[a++]))<<7,(128&_||this.noAssert&&_===void 0)&&(f|=(127&(_=this.view[a++]))<<14,(128&_||this.noAssert&&_===void 0)&&(f|=(127&(_=this.view[a++]))<<21,(128&_||this.noAssert&&_===void 0)&&(m=127&(_=this.view[a++]),(128&_||this.noAssert&&_===void 0)&&(m|=(127&(_=this.view[a++]))<<7,128&_||this.noAssert&&_===void 0))))))))))throw Error("Buffer overrun");return v=n.fromBits(p|f<<28,f>>>4|m<<24,!1),R?(this.offset=a,v):{value:v,length:a-c}},o.readVarint64ZigZag=function(a){var c=this.readVarint64(a);return c&&c.value instanceof n?c.value=h.zigZagDecode64(c.value):c=h.zigZagDecode64(c),c}),o.writeCString=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),f=a.length,!this.noAssert){if(typeof a!="string")throw TypeError("Illegal str: Not a string");for(p=0;f>p;++p)if(a.charCodeAt(p)===0)throw RangeError("Illegal str: Contains NULL-characters");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return f=l.calculateUTF16asUTF8(e(a))[1],c+=f+1,m=this.buffer.byteLength,c>m&&this.resize((m*=2)>c?m:c),c-=f+1,l.encodeUTF16toUTF8(e(a),function(v){this.view[c++]=v}.bind(this)),this.view[c++]=0,_?(this.offset=c,this):f},o.readCString=function(a){var c,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}return c=a,f=-1,l.decodeUTF8toUTF16(function(){if(f===0)return null;if(a>=this.limit)throw RangeError("Illegal range: Truncated data, "+a+" < "+this.limit);return(f=this.view[a++])===0?null:f}.bind(this),p=t(),!0),m?(this.offset=a,p()):{string:p(),length:a-c}},o.writeIString=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),!this.noAssert){if(typeof a!="string")throw TypeError("Illegal str: Not a string");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}if(f=c,p=l.calculateUTF16asUTF8(e(a),this.noAssert)[1],c+=4+p,m=this.buffer.byteLength,c>m&&this.resize((m*=2)>c?m:c),c-=4+p,this.littleEndian?(this.view[c+3]=255&p>>>24,this.view[c+2]=255&p>>>16,this.view[c+1]=255&p>>>8,this.view[c]=255&p):(this.view[c]=255&p>>>24,this.view[c+1]=255&p>>>16,this.view[c+2]=255&p>>>8,this.view[c+3]=255&p),c+=4,l.encodeUTF16toUTF8(e(a),function(v){this.view[c++]=v}.bind(this)),c!==f+4+p)throw RangeError("Illegal range: Truncated data, "+c+" == "+(c+4+p));return _?(this.offset=c,this):c-f},o.readIString=function(a){var c,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+4) <= "+this.buffer.byteLength)}return c=a,p=this.readUint32(a),f=this.readUTF8String(p,h.METRICS_BYTES,a+=4),a+=f.length,m?(this.offset=a,f.string):{string:f.string,length:a-c}},h.METRICS_CHARS="c",h.METRICS_BYTES="b",o.writeUTF8String=function(a,c){var p,f,m,_=c===void 0;if(_&&(c=this.offset),!this.noAssert){if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}return f=c,p=l.calculateUTF16asUTF8(e(a))[1],c+=p,m=this.buffer.byteLength,c>m&&this.resize((m*=2)>c?m:c),c-=p,l.encodeUTF16toUTF8(e(a),function(v){this.view[c++]=v}.bind(this)),_?(this.offset=c,this):c-f},o.writeString=o.writeUTF8String,h.calculateUTF8Chars=function(a){return l.calculateUTF16asUTF8(e(a))[0]},h.calculateUTF8Bytes=function(a){return l.calculateUTF16asUTF8(e(a))[1]},h.calculateString=h.calculateUTF8Bytes,o.readUTF8String=function(a,c,p){var f,m,_,v,R;if(typeof c=="number"&&(p=c,c=void 0),(f=p===void 0)&&(p=this.offset),c===void 0&&(c=h.METRICS_CHARS),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal length: "+a+" (not an integer)");if(a|=0,typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: "+p+" (not an integer)");if((p>>>=0)<0||p+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+p+" (+0) <= "+this.buffer.byteLength)}if(_=0,v=p,c===h.METRICS_CHARS){if(m=t(),l.decodeUTF8(function(){return a>_&&p<this.limit?this.view[p++]:null}.bind(this),function(C){++_,l.UTF8toUTF16(C,m)}),_!==a)throw RangeError("Illegal range: Truncated data, "+_+" == "+a);return f?(this.offset=p,m()):{string:m(),length:p-v}}if(c===h.METRICS_BYTES){if(!this.noAssert){if(typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: "+p+" (not an integer)");if((p>>>=0)<0||p+a>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+p+" (+"+a+") <= "+this.buffer.byteLength)}if(R=p+a,l.decodeUTF8toUTF16(function(){return R>p?this.view[p++]:null}.bind(this),m=t(),this.noAssert),p!==R)throw RangeError("Illegal range: Truncated data, "+p+" == "+R);return f?(this.offset=p,m()):{string:m(),length:p-v}}throw TypeError("Unsupported metrics: "+c)},o.readString=o.readUTF8String,o.writeVString=function(a,c){var p,f,m,_,v=c===void 0;if(v&&(c=this.offset),!this.noAssert){if(typeof a!="string")throw TypeError("Illegal str: Not a string");if(typeof c!="number"||c%1!=0)throw TypeError("Illegal offset: "+c+" (not an integer)");if((c>>>=0)<0||c+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+c+" (+0) <= "+this.buffer.byteLength)}if(m=c,p=l.calculateUTF16asUTF8(e(a),this.noAssert)[1],f=h.calculateVarint32(p),c+=f+p,_=this.buffer.byteLength,c>_&&this.resize((_*=2)>c?_:c),c-=f+p,c+=this.writeVarint32(p,c),l.encodeUTF16toUTF8(e(a),function(R){this.view[c++]=R}.bind(this)),c!==m+p+f)throw RangeError("Illegal range: Truncated data, "+c+" == "+(c+p+f));return v?(this.offset=c,this):c-m},o.readVString=function(a){var c,p,f,m=a===void 0;if(m&&(a=this.offset),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+1) <= "+this.buffer.byteLength)}return c=a,p=this.readVarint32(a),f=this.readUTF8String(p.value,h.METRICS_BYTES,a+=p.length),a+=f.length,m?(this.offset=a,f.string):{string:f.string,length:a-c}},o.append=function(a,c,p){var f,m,_;if((typeof c=="number"||typeof c!="string")&&(p=c,c=void 0),(f=p===void 0)&&(p=this.offset),!this.noAssert){if(typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: "+p+" (not an integer)");if((p>>>=0)<0||p+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+p+" (+0) <= "+this.buffer.byteLength)}return a instanceof h||(a=h.wrap(a,c)),(m=a.limit-a.offset)<=0||((p+=m)>(_=this.buffer.byteLength)&&this.resize((_*=2)>p?_:p),p-=m,this.view.set(a.view.subarray(a.offset,a.limit),p),a.offset+=m,f&&(this.offset+=m)),this},o.appendTo=function(a,c){return a.append(this,c),this},o.assert=function(a){return this.noAssert=!a,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(a){var c=new h(0,this.littleEndian,this.noAssert);return a?(c.buffer=new ArrayBuffer(this.buffer.byteLength),c.view=new Uint8Array(c.buffer)):(c.buffer=this.buffer,c.view=this.view),c.offset=this.offset,c.markedOffset=this.markedOffset,c.limit=this.limit,c},o.compact=function(a,c){var p,f,m;if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}return a===0&&c===this.buffer.byteLength?this:(p=c-a)==0?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=a),this.offset=0,this.limit=0,this):(f=new ArrayBuffer(p),(m=new Uint8Array(f)).set(this.view.subarray(a,c)),this.buffer=f,this.view=m,this.markedOffset>=0&&(this.markedOffset-=a),this.offset=0,this.limit=p,this)},o.copy=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}if(a===c)return new h(0,this.littleEndian,this.noAssert);var p=c-a,f=new h(p,this.littleEndian,this.noAssert);return f.offset=0,f.limit=p,f.markedOffset>=0&&(f.markedOffset-=a),this.copyTo(f,0,a,c),f},o.copyTo=function(a,c,p,f){var m,_,v;if(!this.noAssert&&!h.isByteBuffer(a))throw TypeError("Illegal target: Not a ByteBuffer");if(c=(_=c===void 0)?a.offset:0|c,p=(m=p===void 0)?this.offset:0|p,f=f===void 0?this.limit:0|f,c<0||c>a.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+c+" <= "+a.buffer.byteLength);if(p<0||f>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+p+" <= "+this.buffer.byteLength);return(v=f-p)==0?a:(a.ensureCapacity(c+v),a.view.set(this.view.subarray(p,f),c),m&&(this.offset+=v),_&&(a.offset+=v),this)},o.ensureCapacity=function(a){var c=this.buffer.byteLength;return a>c?this.resize((c*=2)>a?c:a):this},o.fill=function(a,c,p){var f=c===void 0;if(f&&(c=this.offset),typeof a=="string"&&a.length>0&&(a=a.charCodeAt(0)),c===void 0&&(c=this.offset),p===void 0&&(p=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal value: "+a+" (not an integer)");if(a|=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal begin: Not an integer");if(c>>>=0,typeof p!="number"||p%1!=0)throw TypeError("Illegal end: Not an integer");if(p>>>=0,c<0||c>p||p>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+c+" <= "+p+" <= "+this.buffer.byteLength)}if(c>=p)return this;for(;p>c;)this.view[c++]=a;return f&&(this.offset=c),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(a){if(a=a===void 0?this.offset:a,!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal offset: "+a+" (not an integer)");if((a>>>=0)<0||a+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+a+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=a,this},o.order=function(a){if(!this.noAssert&&typeof a!="boolean")throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!a,this},o.LE=function(a){return this.littleEndian=a===void 0||!!a,this},o.BE=function(a){return this.littleEndian=a!==void 0&&!a,this},o.prepend=function(a,c,p){var f,m,_,v,R;if((typeof c=="number"||typeof c!="string")&&(p=c,c=void 0),(f=p===void 0)&&(p=this.offset),!this.noAssert){if(typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: "+p+" (not an integer)");if((p>>>=0)<0||p+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+p+" (+0) <= "+this.buffer.byteLength)}return a instanceof h||(a=h.wrap(a,c)),(m=a.limit-a.offset)<=0||((_=m-p)>0?(v=new ArrayBuffer(this.buffer.byteLength+_),(R=new Uint8Array(v)).set(this.view.subarray(p,this.buffer.byteLength),m),this.buffer=v,this.view=R,this.offset+=_,this.markedOffset>=0&&(this.markedOffset+=_),this.limit+=_,p+=_):new Uint8Array(this.buffer),this.view.set(a.view.subarray(a.offset,a.limit),p-m),a.offset=a.limit,f&&(this.offset-=m)),this},o.prependTo=function(a,c){return a.prepend(this,c),this},o.printDebug=function(a){typeof a!="function"&&(a=console.log.bind(console)),a(this.toString()+`
  789. -------------------------------------------------------------------
  790. `+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(a){var c,p;if(!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal capacity: "+a+" (not an integer)");if((a|=0)<0)throw RangeError("Illegal capacity: 0 <= "+a)}return this.buffer.byteLength<a&&(c=new ArrayBuffer(a),(p=new Uint8Array(c)).set(this.view),this.buffer=c,this.view=p),this},o.reverse=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}return a===c||Array.prototype.reverse.call(this.view.subarray(a,c)),this},o.skip=function(a){if(!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal length: "+a+" (not an integer)");a|=0}var c=this.offset+a;if(!this.noAssert&&(c<0||c>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+a+" <= "+this.buffer.byteLength);return this.offset=c,this},o.slice=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}var p=this.clone();return p.offset=a,p.limit=c,p},o.toBuffer=function(a){var c,p=this.offset,f=this.limit;if(!this.noAssert){if(typeof p!="number"||p%1!=0)throw TypeError("Illegal offset: Not an integer");if(p>>>=0,typeof f!="number"||f%1!=0)throw TypeError("Illegal limit: Not an integer");if(f>>>=0,p<0||p>f||f>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+p+" <= "+f+" <= "+this.buffer.byteLength)}return a||p!==0||f!==this.buffer.byteLength?p===f?s:(c=new ArrayBuffer(f-p),new Uint8Array(c).set(new Uint8Array(this.buffer).subarray(p,f),0),c):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(a,c,p){if(a===void 0)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch(typeof a=="number"&&(p=c=a="utf8"),a){case"utf8":return this.toUTF8(c,p);case"base64":return this.toBase64(c,p);case"hex":return this.toHex(c,p);case"binary":return this.toBinary(c,p);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+a)}},d=function(){var a,c,p={},f=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],m=[];for(a=0,c=f.length;c>a;++a)m[f[a]]=a;return p.encode=function(_,v){for(var R,C;(R=_())!==null;)v(f[63&R>>2]),C=(3&R)<<4,(R=_())!==null?(v(f[63&((C|=15&R>>4)|15&R>>4)]),C=(15&R)<<2,(R=_())!==null?(v(f[63&(C|3&R>>6)]),v(f[63&R])):(v(f[63&C]),v(61))):(v(f[63&C]),v(61),v(61))},p.decode=function(_,v){function R(O){throw Error("Illegal character code: "+O)}for(var C,M,A;(C=_())!==null;)if((M=m[C])===void 0&&R(C),(C=_())!==null&&((A=m[C])===void 0&&R(C),v(M<<2>>>0|(48&A)>>4),(C=_())!==null)){if((M=m[C])===void 0){if(C===61)break;R(C)}if(v((15&A)<<4>>>0|(60&M)>>2),(C=_())!==null){if((A=m[C])===void 0){if(C===61)break;R(C)}v((3&M)<<6>>>0|A)}}},p.test=function(_){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(_)},p}(),o.toBase64=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),c|=0,(a|=0)<0||c>this.capacity||a>c)throw RangeError("begin, end");var p;return d.encode(function(){return c>a?this.view[a++]:null}.bind(this),p=t()),p()},h.fromBase64=function(a,c){if(typeof a!="string")throw TypeError("str");var p=new h(a.length/4*3,c),f=0;return d.decode(e(a),function(m){p.view[f++]=m}),p.limit=f,p},h.btoa=function(a){return h.fromBinary(a).toBase64()},h.atob=function(a){return h.fromBase64(a).toBinary()},o.toBinary=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),c|=0,(a|=0)<0||c>this.capacity()||a>c)throw RangeError("begin, end");if(a===c)return"";for(var p=[],f=[];c>a;)p.push(this.view[a++]),p.length>=1024&&(f.push(String.fromCharCode.apply(String,p)),p=[]);return f.join("")+String.fromCharCode.apply(String,p)},h.fromBinary=function(a,c){if(typeof a!="string")throw TypeError("str");for(var p,f=0,m=a.length,_=new h(m,c);m>f;){if((p=a.charCodeAt(f))>255)throw RangeError("illegal char code: "+p);_.view[f++]=p}return _.limit=m,_},o.toDebug=function(a){for(var c,p=-1,f=this.buffer.byteLength,m="",_="",v="";f>p;){if(p!==-1&&(m+=(c=this.view[p])<16?"0"+c.toString(16).toUpperCase():c.toString(16).toUpperCase(),a&&(_+=c>32&&c<127?String.fromCharCode(c):".")),++p,a&&p>0&&p%16==0&&p!==f){for(;m.length<51;)m+=" ";v+=m+_+`
  791. `,m=_=""}m+=p===this.offset&&p===this.limit?p===this.markedOffset?"!":"|":p===this.offset?p===this.markedOffset?"[":"<":p===this.limit?p===this.markedOffset?"]":">":p===this.markedOffset?"'":a||p!==0&&p!==f?" ":""}if(a&&m!==" "){for(;m.length<51;)m+=" ";v+=m+_+`
  792. `}return a?v:m},h.fromDebug=function(a,c,p){for(var f,m,_=a.length,v=new h(0|(_+1)/3,c,p),R=0,C=0,M=!1,A=!1,O=!1,y=!1,w=!1;_>R;){switch(f=a.charAt(R++)){case"!":if(!p){if(A||O||y){w=!0;break}A=O=y=!0}v.offset=v.markedOffset=v.limit=C,M=!1;break;case"|":if(!p){if(A||y){w=!0;break}A=y=!0}v.offset=v.limit=C,M=!1;break;case"[":if(!p){if(A||O){w=!0;break}A=O=!0}v.offset=v.markedOffset=C,M=!1;break;case"<":if(!p){if(A){w=!0;break}A=!0}v.offset=C,M=!1;break;case"]":if(!p){if(y||O){w=!0;break}y=O=!0}v.limit=v.markedOffset=C,M=!1;break;case">":if(!p){if(y){w=!0;break}y=!0}v.limit=C,M=!1;break;case"'":if(!p){if(O){w=!0;break}O=!0}v.markedOffset=C,M=!1;break;case" ":M=!1;break;default:if(!p&&M){w=!0;break}if(m=parseInt(f+a.charAt(R++),16),!p&&(isNaN(m)||m<0||m>255))throw TypeError("Illegal str: Not a debug encoded string");v.view[C++]=m,M=!0}if(w)throw TypeError("Illegal str: Invalid symbol at "+R)}if(!p){if(!A||!y)throw TypeError("Illegal str: Missing offset or limit");if(C<v.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+C+" < "+_)}return v},o.toHex=function(a,c){if(a=a===void 0?this.offset:a,c=c===void 0?this.limit:c,!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}for(var p,f=new Array(c-a);c>a;)(p=this.view[a++])<16?f.push("0",p.toString(16)):f.push(p.toString(16));return f.join("")},h.fromHex=function(a,c,p){var f,m,_,v,R;if(!p){if(typeof a!="string")throw TypeError("Illegal str: Not a string");if(a.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(m=a.length,_=new h(0|m/2,c),v=0,R=0;m>v;v+=2){if(f=parseInt(a.substring(v,v+2),16),!p&&(!isFinite(f)||f<0||f>255))throw TypeError("Illegal str: Contains non-hex characters");_.view[R++]=f}return _.limit=R,_},l=function(){var a={MAX_CODEPOINT:1114111,encodeUTF8:function(c,p){var f=null;for(typeof c=="number"&&(f=c,c=function(){return null});f!==null||(f=c())!==null;)f<128?p(127&f):f<2048?(p(192|31&f>>6),p(128|63&f)):f<65536?(p(224|15&f>>12),p(128|63&f>>6),p(128|63&f)):(p(240|7&f>>18),p(128|63&f>>12),p(128|63&f>>6),p(128|63&f)),f=null},decodeUTF8:function(c,p){for(var f,m,_,v,R=function(C){C=C.slice(0,C.indexOf(null));var M=Error(C.toString());throw M.name="TruncatedError",M.bytes=C,M};(f=c())!==null;)if((128&f)==0)p(f);else if((224&f)==192)(m=c())===null&&R([f,m]),p((31&f)<<6|63&m);else if((240&f)==224)((m=c())===null||(_=c())===null)&&R([f,m,_]),p((15&f)<<12|(63&m)<<6|63&_);else{if((248&f)!=240)throw RangeError("Illegal starting byte: "+f);((m=c())===null||(_=c())===null||(v=c())===null)&&R([f,m,_,v]),p((7&f)<<18|(63&m)<<12|(63&_)<<6|63&v)}},UTF16toUTF8:function(c,p){for(var f,m=null;(f=m!==null?m:c())!==null;)f>=55296&&f<=57343&&(m=c())!==null&&m>=56320&&m<=57343?(p(1024*(f-55296)+m-56320+65536),m=null):p(f);m!==null&&p(m)},UTF8toUTF16:function(c,p){var f=null;for(typeof c=="number"&&(f=c,c=function(){return null});f!==null||(f=c())!==null;)f<=65535?p(f):(p(55296+((f-=65536)>>10)),p(f%1024+56320)),f=null},encodeUTF16toUTF8:function(c,p){a.UTF16toUTF8(c,function(f){a.encodeUTF8(f,p)})},decodeUTF8toUTF16:function(c,p){a.decodeUTF8(c,function(f){a.UTF8toUTF16(f,p)})},calculateCodePoint:function(c){return c<128?1:c<2048?2:c<65536?3:4},calculateUTF8:function(c){for(var p,f=0;(p=c())!==null;)f+=p<128?1:p<2048?2:p<65536?3:4;return f},calculateUTF16asUTF8:function(c){var p=0,f=0;return a.UTF16toUTF8(c,function(m){++p,f+=m<128?1:m<2048?2:m<65536?3:4}),[p,f]}};return a}(),o.toUTF8=function(a,c){if(a===void 0&&(a=this.offset),c===void 0&&(c=this.limit),!this.noAssert){if(typeof a!="number"||a%1!=0)throw TypeError("Illegal begin: Not an integer");if(a>>>=0,typeof c!="number"||c%1!=0)throw TypeError("Illegal end: Not an integer");if(c>>>=0,a<0||a>c||c>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+a+" <= "+c+" <= "+this.buffer.byteLength)}var p;try{l.decodeUTF8toUTF16(function(){return c>a?this.view[a++]:null}.bind(this),p=t())}catch{if(a!==c)throw RangeError("Illegal range: Truncated data, "+a+" != "+c)}return p()},h.fromUTF8=function(a,c,p){if(!p&&typeof a!="string")throw TypeError("Illegal str: Not a string");var f=new h(l.calculateUTF16asUTF8(e(a),!0)[1],c,p),m=0;return l.encodeUTF16toUTF8(e(a),function(_){f.view[m++]=_}),f.limit=m,f},h}(Rs=function(){function n(y,w,H){this.low=0|y,this.high=0|w,this.unsigned=!!H}function e(y){return(y&&y.__isLong__)===!0}function t(y,w){var H,Y,E;return w?(E=(y>>>=0)>=0&&y<256)&&(Y=d[y])?Y:(H=i(y,(0|y)<0?-1:0,!0),E&&(d[y]=H),H):(E=(y|=0)>=-128&&y<128)&&(Y=u[y])?Y:(H=i(y,y<0?-1:0,!1),E&&(u[y]=H),H)}function r(y,w){if(isNaN(y)||!isFinite(y))return w?m:f;if(w){if(y<0)return m;if(y>=a)return M}else{if(-c>=y)return A;if(y+1>=c)return C}return y<0?r(-y,w).neg():i(0|y%h,0|y/h,w)}function i(y,w,H){return new n(y,w,H)}function o(y,w,H){var Y,E,T,N,P,L,V;if(y.length===0)throw Error("empty string");if(y==="NaN"||y==="Infinity"||y==="+Infinity"||y==="-Infinity")return f;if(typeof w=="number"?(H=w,w=!1):w=!!w,(H=H||10)<2||H>36)throw RangeError("radix");if((Y=y.indexOf("-"))>0)throw Error("interior hyphen");if(Y===0)return o(y.substring(1),w,H).neg();for(E=r(l(H,8)),T=f,N=0;N<y.length;N+=8)P=Math.min(8,y.length-N),L=parseInt(y.substring(N,N+P),H),P<8?(V=r(l(H,P)),T=T.mul(V).add(r(L))):T=(T=T.mul(E)).add(r(L));return T.unsigned=w,T}function s(y){return y instanceof n?y:typeof y=="number"?r(y):typeof y=="string"?o(y):i(y.low,y.high,y.unsigned)}var u,d,l,h,a,c,p,f,m,_,v,R,C,M,A,O;return n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),n.isLong=e,u={},d={},n.fromInt=t,n.fromNumber=r,n.fromBits=i,l=Math.pow,n.fromString=o,n.fromValue=s,c=(a=(h=4294967296)*h)/2,p=t(16777216),f=t(0),n.ZERO=f,m=t(0,!0),n.UZERO=m,_=t(1),n.ONE=_,v=t(1,!0),n.UONE=v,R=t(-1),n.NEG_ONE=R,C=i(-1,2147483647,!1),n.MAX_VALUE=C,M=i(-1,-1,!0),n.MAX_UNSIGNED_VALUE=M,A=i(0,-2147483648,!1),n.MIN_VALUE=A,(O=n.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},O.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},O.toString=function(y){var w,H,Y,E,T,N,P,L;if((y=y||10)<2||y>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(A)?(w=r(y),Y=(H=this.div(w)).mul(w).sub(this),H.toString(y)+Y.toInt().toString(y)):"-"+this.neg().toString(y);for(E=r(l(y,6),this.unsigned),T=this,N="";;){if(P=T.div(E),L=(T.sub(P.mul(E)).toInt()>>>0).toString(y),(T=P).isZero())return L+N;for(;L.length<6;)L="0"+L;N=""+L+N}},O.getHighBits=function(){return this.high},O.getHighBitsUnsigned=function(){return this.high>>>0},O.getLowBits=function(){return this.low},O.getLowBitsUnsigned=function(){return this.low>>>0},O.getNumBitsAbs=function(){var y,w;if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(y=this.high!=0?this.high:this.low,w=31;w>0&&(y&1<<w)==0;w--);return this.high!=0?w+33:w+1},O.isZero=function(){return this.high===0&&this.low===0},O.isNegative=function(){return!this.unsigned&&this.high<0},O.isPositive=function(){return this.unsigned||this.high>=0},O.isOdd=function(){return(1&this.low)==1},O.isEven=function(){return(1&this.low)==0},O.equals=function(y){return e(y)||(y=s(y)),(this.unsigned===y.unsigned||this.high>>>31!=1||y.high>>>31!=1)&&this.high===y.high&&this.low===y.low},O.eq=O.equals,O.notEquals=function(y){return!this.eq(y)},O.neq=O.notEquals,O.lessThan=function(y){return this.comp(y)<0},O.lt=O.lessThan,O.lessThanOrEqual=function(y){return this.comp(y)<=0},O.lte=O.lessThanOrEqual,O.greaterThan=function(y){return this.comp(y)>0},O.gt=O.greaterThan,O.greaterThanOrEqual=function(y){return this.comp(y)>=0},O.gte=O.greaterThanOrEqual,O.compare=function(y){if(e(y)||(y=s(y)),this.eq(y))return 0;var w=this.isNegative(),H=y.isNegative();return w&&!H?-1:!w&&H?1:this.unsigned?y.high>>>0>this.high>>>0||y.high===this.high&&y.low>>>0>this.low>>>0?-1:1:this.sub(y).isNegative()?-1:1},O.comp=O.compare,O.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(_)},O.neg=O.negate,O.add=function(y){var w,H,Y,E,T,N,P,L,V,F,q;return e(y)||(y=s(y)),w=this.high>>>16,H=65535&this.high,Y=this.low>>>16,E=65535&this.low,T=y.high>>>16,N=65535&y.high,P=y.low>>>16,L=0,V=0,F=0,q=0,F+=(q+=E+(65535&y.low))>>>16,V+=(F+=Y+P)>>>16,L+=(V+=H+N)>>>16,L+=w+T,i((F&=65535)<<16|(q&=65535),(L&=65535)<<16|(V&=65535),this.unsigned)},O.subtract=function(y){return e(y)||(y=s(y)),this.add(y.neg())},O.sub=O.subtract,O.multiply=function(y){var w,H,Y,E,T,N,P,L,V,F,q,z;return this.isZero()?f:(e(y)||(y=s(y)),y.isZero()?f:this.eq(A)?y.isOdd()?A:f:y.eq(A)?this.isOdd()?A:f:this.isNegative()?y.isNegative()?this.neg().mul(y.neg()):this.neg().mul(y).neg():y.isNegative()?this.mul(y.neg()).neg():this.lt(p)&&y.lt(p)?r(this.toNumber()*y.toNumber(),this.unsigned):(w=this.high>>>16,H=65535&this.high,Y=this.low>>>16,E=65535&this.low,T=y.high>>>16,N=65535&y.high,P=y.low>>>16,V=0,F=0,q=0,z=0,q+=(z+=E*(L=65535&y.low))>>>16,F+=(q+=Y*L)>>>16,q&=65535,F+=(q+=E*P)>>>16,V+=(F+=H*L)>>>16,F&=65535,V+=(F+=Y*P)>>>16,F&=65535,V+=(F+=E*N)>>>16,V+=w*L+H*P+Y*N+E*T,i((q&=65535)<<16|(z&=65535),(V&=65535)<<16|(F&=65535),this.unsigned)))},O.mul=O.multiply,O.divide=function(y){var w,H,Y,E,T,N,P;if(e(y)||(y=s(y)),y.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;if(this.unsigned){if(y.unsigned||(y=y.toUnsigned()),y.gt(this))return m;if(y.gt(this.shru(1)))return v;Y=m}else{if(this.eq(A))return y.eq(_)||y.eq(R)?A:y.eq(A)?_:(w=this.shr(1).div(y).shl(1)).eq(f)?y.isNegative()?_:R:(H=this.sub(y.mul(w)),Y=w.add(H.div(y)));if(y.eq(A))return this.unsigned?m:f;if(this.isNegative())return y.isNegative()?this.neg().div(y.neg()):this.neg().div(y).neg();if(y.isNegative())return this.div(y.neg()).neg();Y=f}for(H=this;H.gte(y);){for(w=Math.max(1,Math.floor(H.toNumber()/y.toNumber())),T=(E=Math.ceil(Math.log(w)/Math.LN2))<=48?1:l(2,E-48),P=(N=r(w)).mul(y);P.isNegative()||P.gt(H);)P=(N=r(w-=T,this.unsigned)).mul(y);N.isZero()&&(N=_),Y=Y.add(N),H=H.sub(P)}return Y},O.div=O.divide,O.modulo=function(y){return e(y)||(y=s(y)),this.sub(this.div(y).mul(y))},O.mod=O.modulo,O.not=function(){return i(~this.low,~this.high,this.unsigned)},O.and=function(y){return e(y)||(y=s(y)),i(this.low&y.low,this.high&y.high,this.unsigned)},O.or=function(y){return e(y)||(y=s(y)),i(this.low|y.low,this.high|y.high,this.unsigned)},O.xor=function(y){return e(y)||(y=s(y)),i(this.low^y.low,this.high^y.high,this.unsigned)},O.shiftLeft=function(y){return e(y)&&(y=y.toInt()),(y&=63)==0?this:y<32?i(this.low<<y,this.high<<y|this.low>>>32-y,this.unsigned):i(0,this.low<<y-32,this.unsigned)},O.shl=O.shiftLeft,O.shiftRight=function(y){return e(y)&&(y=y.toInt()),(y&=63)==0?this:y<32?i(this.low>>>y|this.high<<32-y,this.high>>y,this.unsigned):i(this.high>>y-32,this.high>=0?0:-1,this.unsigned)},O.shr=O.shiftRight,O.shiftRightUnsigned=function(y){var w;return e(y)&&(y=y.toInt()),(y&=63)==0?this:(w=this.high,y<32?i(this.low>>>y|w<<32-y,w>>>y,this.unsigned):i(y===32?w:w>>>y-32,0,this.unsigned))},O.shru=O.shiftRightUnsigned,O.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},O.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},O.toBytes=function(y){return y?this.toBytesLE():this.toBytesBE()},O.toBytesLE=function(){var y=this.high,w=this.low;return[255&w,255&w>>>8,255&w>>>16,255&w>>>24,255&y,255&y>>>8,255&y>>>16,255&y>>>24]},O.toBytesBE=function(){var y=this.high,w=this.low;return[255&y>>>24,255&y>>>16,255&y>>>8,255&y,255&w>>>24,255&w>>>16,255&w>>>8,255&w]},n}()),Rs));yi.getModule=function(n){var e=new yi[n];return e.getArrayData=function(){var t=e.toArrayBuffer();return t=Sa(t)?[].slice.call(new Int8Array(t)):t},e};var Ti,Ju="pgMsgP",Wu="chatMsg",Zu="pcMsgP",Qu={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Xu="delMsg",ed="joinChrm",td="joinChrmR",nd="exitChrm",rd="setKV",id="delKV",od="setKVS",sd="delKVS",Es="qryRelationR",ad="delRelation",cd="setSeAtt",xn={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Va="qryPMsg",ud="qryGMsg",Ba="qryCHMsg",dd="qryCMsg",ld="qrySMsg",hd=((Jt={}).ppMsgP=J.PRIVATE,Jt[Ju]=J.GROUP,Jt[Wu]=J.CHATROOM,Jt[Zu]=J.CUSTOMER_SERVICE,Jt),pd=((Mt={})[J.PRIVATE]=Va,Mt[J.GROUP]=ud,Mt[J.CHATROOM]=Ba,Mt[J.CUSTOMER_SERVICE]=dd,Mt[J.SYSTEM]=ld,Mt),fd=((Wt={})[J.PRIVATE]=xn.PRIVATE,Wt[J.GROUP]=xn.GROUP,Wt[J.CUSTOMER_SERVICE]=xn.CUSTOMER_SERVICE,Wt[J.SYSTEM]=xn.SYSTEM,Wt),Jr="1",gd="0",Cs=1,ys=2,Ts=3,md=function(){function n(e){this._codec=e==="websocket"?yi:Cn,this._connectType=e}return n.prototype.decodeByPBName=function(e,t,r){var i,o=this,s=e,u=((i={})[vn]=o._formatSyncMessages,i[wr]=o._formatReceivedMessage,i[_n]=o._formatSentMessage,i[Rn]=o._formatHistoryMessages,i[En]=o._formatConversationList,i[Mr]=o._formatChatRoomInfos,i[Ct]=o._formatRTCUserList,i[Pr]=o._formatRTCData,i[Dt]=o._formatChatRoomKVList,i[Lr]=o._formatUserSetting,i[Ur]=o._formatConversationStatus,i[Dr]=o._formatGrpReadReceiptQryResp,i[xt]=o._formatSetUserSettingOutput,i[kr]=o._formatUserSettingNotification,i[xr]=o._formatRTCRoomKVList,i[Ar]=o._formatRTCAuidenceJoinRoomData,i[Vr]=o._formatRTCJoinedUserInfo,i)[t];try{s=e.length>0&&o._codec[t].decode(e),Ne(s)&&(s=function(d){for(var l in d)Ne(d[l])&&(d[l]=He(d[l]));return d}(s)),ar(u)&&(s=u.call(this,s,r))}catch(d){j.error(`PB parse error
  793. `,d,e,t)}return s},n.prototype._readBytes=function(e){var t=e.offset,r=e.buffer,i=e.limit;if(t)try{var o=Sa(r)?new Uint8Array(r):r;return bn.readUTF(o.subarray(t,i))}catch(s){j.info(`readBytes error
  794. `,s)}return e},n.prototype._formatBytes=function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(r){j.info(`formatBytes error
  795. `,r)}return t||e},n.prototype._formatSyncMessages=function(e,t){t=t||{};var r=this,i=e.list,o=e.syncTime,s=e.finished;return(de(s)||s===null)&&(e.finished=!0),e.syncTime=He(o),e.list=Dn(i,function(u){return r._formatReceivedMessage(u,t)}),e},n.prototype._formatReceivedMessage=function(e,t){var r=(t=t||{}).currentUserId,i=t.connectedTime,o=e.content,s=e.fromUserId,u=e.type,d=e.groupId,l=e.status,h=e.dataTime,a=e.classname,c=e.msgId,p=e.extraContent,f=e.pushContent,m=e.pushExt,_=e.configFlag,v=(e.direction||je.RECEIVE)===je.SEND,R=function(re){var X=gn.READ;return{isPersited:!!(16&re),isCounted:!!(32&re),isMentioned:!!(64&re),disableNotification:!!(512&re),receivedStatus:X=2&re?gn.RETRIEVED:X,canIncludeExpansion:!!(1024&re)}}(l),C=R.isPersited,M=R.isCounted,A=R.isMentioned,O=R.disableNotification,y=R.receivedStatus,w=R.canIncludeExpansion,H=[J.GROUP,J.CHATROOM,J.RTC_ROOM].indexOf(u)>-1?d:s,Y=v?r:s,E=He(h),T=E<i,N=u===J.CHATROOM,P=this._formatBytes(o),L={};if(m&&(L=fs(m.pushConfigs,m.pushId)),P.user){var V=P.user,F=V.portrait,q=V.portraitUri,z=F||q;z&&(P.user.portrait=P.user.portraitUri=z)}var ne,ae=fe(fe({},L),{pushTitle:m==null?void 0:m.title,pushContent:f,pushData:f,disablePushTitle:!!_&&Boolean(4&_),forceShowDetailContent:!!_&&Boolean(8&_),templateId:m==null?void 0:m.templateId}),se=v?je.SEND:je.RECEIVE;return N&&s===r&&(se=je.SEND),p&&(ne={},ne=ms(p)),{conversationType:u,targetId:H,senderUserId:Y,messageType:a,messageUId:c,isPersited:C,isCounted:M,isMentioned:A,sentTime:E,isOffLineMessage:T,messageDirection:se,receivedTime:Lt.getTime(),disableNotification:O,receivedStatus:y,canIncludeExpansion:w,content:P,expansion:ne,configFlag:_,pushConfig:ae,channelId:e.busChannel||""}},n.prototype._formatSentMessage=function(e,t){var r,i=e.content,o=e.classname,s=e.sessionId,u=e.msgId,d=e.extraContent,l=e.pushExt,h=e.pushContent,a=e.configFlag,c=t.signal,p=t.currentUserId,f=c.date,m=c.topic,_=c.targetId,v=function(T){return{isPersited:!!(1&T),isCounted:!!(2&T),disableNotification:!!(32&T),canIncludeExpansion:!!(64&T)}}(s),R=v.isPersited,C=v.isCounted,M=v.disableNotification,A=v.canIncludeExpansion,O=hd[m]||J.PRIVATE,y=$u(Qu,m),w=this._formatBytes(i),H=_;o===Ae.RECALL&&(O=w.conversationType||O,H=w.targetId||_),d&&(r={},r=ms(d));var Y={};l&&(Y=fs(l.pushConfigs,l.pushId));var E=fe(fe({},Y),{pushTitle:l==null?void 0:l.title,pushContent:h,pushData:h,disablePushTitle:!!a&&Boolean(4&a),forceShowDetailContent:!!a&&Boolean(8&a),templateId:l==null?void 0:l.templateId});return{conversationType:O,targetId:H,messageType:o,messageUId:u,isPersited:R,isCounted:C,isStatusMessage:y,senderUserId:p,content:this._formatBytes(i),sentTime:1e3*f,receivedTime:Lt.getTime(),messageDirection:je.SEND,isOffLineMessage:!1,disableNotification:M,canIncludeExpansion:A,expansion:r,pushConfig:E,channelId:e.busChannel||""}},n.prototype._formatHistoryMessages=function(e,t){var r=this,i=t.conversation||{},o=e.list,s=e.hasMsg,u=i.targetId,d=He(e.syncTime),l=[];return Ce(o,function(h){var a=r._formatReceivedMessage(h,t);a.targetId=u,l.push(a)},{isReverse:!0}),{syncTime:d,list:l,hasMore:!!s}},n.prototype._formatConversationList=function(e,t){var r=this,i=e.info,o=t.afterDecode||function(){};return(i=Dn(i,function(s){var u=s.msg,d=s.userId,l=s.type,h=s.unreadCount,a=s.busChannel,c=null;u&&((c=r._formatReceivedMessage(u,t)).targetId=d);var p={targetId:d,conversationType:l,unreadMessageCount:h,latestMessage:c,channelId:a||""};return o(p)||p}))||[]},n.prototype._formatSetUserSettingOutput=function(e){return e},n.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,r=e.userInfos;return{userCount:t,userInfos:Dn(r,function(i){var o=i.id,s=i.time;return{id:o,time:He(s)}})}},n.prototype._formatChatRoomKVList=function(e){var t=e.entries,r=e.bFullUpdate,i=e.syncTime;return{kvEntries:t=Dn(t=t||[],function(o){var s=o.key,u=o.value,d=o.status,l=o.timestamp,h=o.uid,a=function(c){return{isAutoDelete:!!(1&c),isOverwrite:!!(2&c),type:4&c?xe.DELETE:xe.UPDATE}}(d);return{key:s,value:u,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:h,timestamp:He(l)}}),isFullUpdate:r,syncTime:i}},n.prototype._formatUserSetting=function(e){var t=this,r=e.items,i=e.version,o={};return Ce(r||[],function(s){var u=s.key,d=s.version,l=s.value;s.version=He(d),s.value=t._readBytes(l),u==="Tag"&&s.tags.forEach(function(h){h.createdTime=He(h.createdTime),h.tagName=h.name}),o[u]=s}),{settings:o,version:i}},n.prototype._formatConversationStatus=function(e){var t=e.state,r=[];return Ce(t,function(i){var o=i.type,s=i.channelId,u=i.time,d=i.stateItem,l=i.busChannel,h=Pt.CLOSE,a=!1,c=[];Ce(d,function(p){var f=p.sessionStateType,m=p.value,_=p.tags;switch(f){case Cs:h=m===Jr?Pt.OPEN:Pt.CLOSE;break;case ys:a=m===Jr;break;case Ts:c=_}}),r.push({conversationType:o,type:o,targetId:s,notificationStatus:h,isTop:a,updatedTime:He(u),tags:c,channelId:l||""})}),r},n.prototype._formatRTCUserList=function(e){var t=e.users,r=e.token,i=e.sessionId,o=e.roomInfo,s=e.entries,u={};return Ce(t,function(d){var l=d.userId,h=d.userData,a={};Ce(h,function(c){var p=c.key,f=c.value;a[p]=f}),u[l]=a}),{users:u,token:r,sessionId:i,roomInfo:o,kvEntries:s}},n.prototype._formatRTCData=function(e){var t=e.outInfo,r={};return Ce(t,function(i){r[i.key]=i.value}),r},n.prototype._formatRTCRoomInfo=function(e){var t=e.roomId,r=e.userCount,i=e.roomData,o={id:t,total:r};return Ce(i,function(s){o[s.key]=s.value}),o},n.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,r=e.list;return r.forEach(function(i){i.readTime=He(i.readTime)}),{totalMemberCount:t,list:r}},n.prototype._formatUserSettingNotification=function(e){return e},n.prototype._formatRTCRoomKVList=function(e){var t=e.entries,r=e.bFullUpdate,i=e.syncTime;return{kvEntries:t=(t=t||[]).map(function(o){var s=o.timestamp;return Object.assign(o,{timestamp:He(s)})}),isFullUpdate:r,syncTime:i}},n.prototype._formatRTCAuidenceJoinRoomData=function(e){return e},n.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map(function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:He(t.joinTime)}})},n.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Ji);return e.setNothing(1),e.getArrayData()},n.prototype._getUpMsgModule=function(e,t){var r,i,o,s=this._connectType==="comet",u=(e.conversationType,t.messageType),d=t.isMentioned,l=t.mentionedType,h=t.mentionedUserIdList,a=t.content,c=t.pushContent,p=t.pushData,f=t.directionalUserIdList,m=t.isFilerWhiteBlacklist,_=t.isVoipPush,v=t.canIncludeExpansion,R=t.expansion,C=t.pushConfig,M=t.channelId;J.GROUP;var A=this._codec.getModule(_n),O=function(se){var re=se.isStatusMessage,X=se.isPersited,k=se.isCounted;re&&(X=k=!1);var G=0;return X&&(G|=1),k&&(G|=2),se.isMentioned&&(G|=4),se.disableNotification&&(G|=32),se.canIncludeExpansion&&(G|=64),G}(t),y=C||{},w=y.pushTitle,H=y.pushContent,Y=y.pushData,E=y.iOSConfig,T=y.androidConfig,N=y.templateId,P=y.disablePushTitle,L=y.forceShowDetailContent,V=0;A.setSessionId(O),d&&a&&(a.mentionedInfo={userIdList:((r=a.mentionedInfo)===null||r===void 0?void 0:r.userIdList)||h||[],type:((i=a.mentionedInfo)===null||i===void 0?void 0:i.type)||l||Gi.ALL,mentionedContent:((o=a.mentionedInfo)===null||o===void 0?void 0:o.mentionedContent)||""});var F=H||c||"",q=Y||p||"";if(F&&A.setPushText(F),q&&A.setAppData(q),f&&A.setUserId(f),V|=_?1:0,V|=m?2:0,V|=P?4:0,V|=L?8:0,A.setConfigFlag(V),A.setClassname(u),a.user&&a.user.portraitUri&&(a.user.portrait=a.user.portraitUri),A.setContent(JSON.stringify(a)),v&&R){var z={};Ce(R,function(se,re){z[re]={v:se}}),A.setExtraContent(JSON.stringify(z))}if(C){var ne=this._codec.getModule(zi);if(w&&ne.setTitle(w),E&&T){var ae=Fu(E,T);ne.setPushConfigs(ae)}(T==null?void 0:T.notificationId)&&ne.setPushId(T==null?void 0:T.notificationId),ne.setTemplateId(N||""),A.setPushExt(s?ne.getArrayData():ne)}return de(M)||A.setBusChannel(M),A},n.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},n.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,r=e.inboxTime,i=this._codec.getModule(Wi);return i.setIspolling(!1),i.setIsPullSend(!0),i.setSendBoxSyncTime(t),i.setSyncTime(r),i.getArrayData()},n.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var r=this._codec.getModule(Zi);return r.setCount(t),r.setSyncTime(e),r.getArrayData()},n.prototype.encodeGetHistoryMsg=function(e,t){var r=t.count,i=t.order,o=t.timestamp,s=t.channelId,u=this._codec.getModule(Qi);return u.setTargetId(e),u.setTime(o),u.setCount(r),u.setOrder(i),u.setBusChannel(s||""),u.getArrayData()},n.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,r=e.startTime,i=this._codec.getModule(dr);return i.setType(1),i.setCount(t),i.setStartTime(r),i.getArrayData()},n.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,r=e.type,i=e.startTime,o=e.order;t=t||0,i=i||0,o=o||0;var s=this._codec.getModule(dr);return s.setType(r),s.setCount(t),s.setStartTime(i),s.setOrder(o),s.getArrayData()},n.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,r=e.channelId,i=this._codec.getModule(to);return i.setType(t),i.setBusChannel(r),i.getArrayData()},n.prototype.encodeRemoveConversationList=function(e){var t=this,r=this._codec.getModule(Xi),i=[];return Ce(e,function(o){var s=o.conversationType,u=o.targetId,d=t._codec.getModule(eo);d.setType(s),d.setChannelId(u),i.push(d)}),r.setSessions(i),r.getArrayData()},n.prototype.encodeDeleteMessages=function(e,t,r,i){var o=this._codec.getModule(no),s=[];return Ce(r,function(u){s.push({msgId:u.messageUId,msgDataTime:u.sentTime,direct:u.messageDirection})}),o.setType(e),o.setConversationId(t),o.setMsgs(s),o.setBusChannel(i),o.getArrayData()},n.prototype.encodeClearMessages=function(e,t,r){var i=this._codec.getModule(ro);return t=t||new Date().getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(r),i.getArrayData()},n.prototype.encodeClearUnreadCount=function(e,t){var r=e.conversationType,i=e.targetId,o=t.timestamp,s=this._codec.getModule(io);return o=o||+new Date,s.setType(r),s.setChannelId(i),s.setMsgTime(o),s.getArrayData()},n.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(oo);return e.setNothing(1),e.getArrayData()},n.prototype.encodeGetChatRoomInfo=function(e,t){var r=this._codec.getModule(ao);return r.setCount(e),r.setOrder(t),r.getArrayData()},n.prototype.encodeGetFileToken=function(e,t,r,i){var o=this._codec.getModule(mo);return o.setType(e),o.setKey(t),o.setHttpMethod(r),o.setQueryString(i),o.getArrayData()},n.prototype.encodeGetFileUrl=function(e,t,r,i){var o=this._codec.getModule(e);return o.setType(t),o.setKey(r),i&&o.setFileName(i),o.getArrayData()},n.prototype.encodeModifyChatRoomKV=function(e,t,r){var i=this._connectType==="comet",o=this._codec.getModule(yo),s=t.key,u=t.value,d=t.notificationExtra,l=t.isSendNotification,h=t.type||xe.UPDATE,a=_s(t,h),c={key:s,value:u||"",uid:r};if(de(a)||(c.status=a),o.setEntry(c),l){var p={conversationType:J.CHATROOM,targetId:e},f={key:s,value:u,extra:d,type:h},m=this._getUpMsgModule(p,{messageType:Ae.CHRM_KV_NOTIFY,content:f,isPersited:!1,isCounted:!1});i?o.setNotification(m.getArrayData()):o.setNotification(m),o.setBNotify(!0),o.setType(J.CHATROOM)}return o.getArrayData()},n.prototype.encodeModifyChatRoomKVS=function(e,t,r){this._connectType;var i=this._codec.getModule(To),o=t.entries,s=t.type||xe.UPDATE,u=_s(t,s),d=[];return o.forEach(function(l){var h={key:l.key,value:l.value||"",uid:r};de(u)||(h.status=u),d.push(h)}),i.setEntry(d),i.getArrayData()},n.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(Io);return t.setTimestamp(e),t.getArrayData()},n.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(bo);return t.setVersion(e),t.getArrayData()},n.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Oo);return t.setTime(e),t.getArrayData()},n.prototype.encodeSetConversationStatus=function(e){var t=this,r=this._connectType==="comet",i=this._codec.getModule(mr),o=Lt.getTime(),s=[];return Ce(e,function(u){var d=t._codec.getModule(fr),l=u.conversationType,h=u.targetId,a=u.notificationStatus,c=u.isTop,p=u.channelId,f=[];d.setType(l),d.setChannelId(h),d.setTime(o),d.setBusChannel(p);var m=a===Pt.OPEN,_={};de(a)||(_[Cs]=m),de(c)||(_[ys]=c),Ce(_,function(R,C){if(!de(R)){var M=t._codec.getModule(gr);R=R?Jr:gd,M.setSessionStateType(Number(C)),M.setValue(R);var A=r?M.getArrayData():M;f.push(A)}}),d.setStateItem(f);var v=r?d.getArrayData():d;s.push(v)}),i.setVersion(o),i.setState(s),i.getArrayData()},n.prototype.encodeReadReceipt=function(e,t){var r=this._codec.getModule(_r);return r.setMsgId(e),t&&r.setChannelId(t),r.getArrayData()},n.prototype.encodeCreateTag=function(e,t){var r=this,i=this._connectType==="comet",o=this._codec.getModule(wo),s=[];return e.forEach(function(u){var d=r._codec.getModule(dn);d.setTagId(u.tagId),d.setName(u.tagName),s.push(i?d.getArrayData():d)}),o.setTags(s),o.setVersion(t),o.getArrayData()},n.prototype.encodeMessageReader=function(e,t){var r=this._codec.getModule(_r);return r.setMsgId(e),t&&r.setChannelId(t),r.getArrayData()},n.prototype.encodeRemoveTag=function(e,t){var r=this,i=this._connectType==="comet",o=this._codec.getModule(Mo),s=[];return e.forEach(function(u){var d=r._codec.getModule(dn);d.setTagId(u),s.push(i?d.getArrayData():d)}),o.setTags(s),o.setVersion(t),o.getArrayData()},n.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(Ao);return t.setTagId(e),t.getArrayData()},n.prototype.encodeUpdateConversationTag=function(e,t){var r=this,i=this._connectType==="comet",o=this._codec.getModule(mr),s=[];return t.forEach(function(u){var d=r._codec.getModule(fr),l=r._codec.getModule(gr),h=[];e.forEach(function(a){var c=r._codec.getModule(dn);c.setTagId(a.tagId),de(a.isTop)||c.setIsTop(a.isTop),h.push(i?c.getArrayData():c)}),l.setSessionStateType(Ts),l.setValue(JSON.stringify(h)),l.setTags(h),d.setType(u.conversationType),d.setChannelId(u.targetId),d.setTime(Date.now()),d.setStateItem([i?l.getArrayData():l]),s.push(i?d.getArrayData():d)}),o.setState(s),o.setVersion(Lt.getTime()),o.getArrayData()},n.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Po);return t.setSdkInfo(e),t.getArrayData()},n.prototype.encodeJoinRTCRoom=function(e,t,r){var i=this._codec.getModule(lr);return e=e||0,i.setRoomType(e),de(t)||i.setBroadcastType(t),de(r)||i.setJoinType(r),i.getArrayData()},n.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(co).getArrayData()},n.prototype.encodeSetRTCData=function(e,t,r,i,o){var s=this._codec.getModule(uo);if(s.setInterior(r),s.setTarget(i),s.setKey(e),s.setValue(t),o){o.name&&s.setObjectName(o.name);var u=o.content;u&&(Ne(u)&&(u=JSON.stringify(u)),s.setContent(u))}return s.getArrayData()},n.prototype.encodeUserSetRTCData=function(e,t,r,i){var o=this,s=this._connectType==="comet",u=this._codec.getModule(hr);u.setObjectName(r);var d=this._codec.getModule($e);d.setKey(e.name),d.setValue(e.content),s?u.setContent([d.getArrayData()]):u.setContent(d);var l=[];return["uris","mcu_uris"].forEach(function(h){var a=o._codec.getModule($e);a.setKey(h);var c=h==="uris"?t:i;a.setValue(c),s?l.push(a.getArrayData()):l.push(a)}),u.setValueInfo(l),u.getArrayData()},n.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var r=this._codec.getModule(hr);r.setObjectName(e);var i=this._codec.getModule($e);return i.setKey("cdn_uris"),i.setValue(t),r.setValueInfo(i),r.getArrayData()},n.prototype.encodeGetRTCData=function(e,t,r){var i=this._codec.getModule(pr);return i.setInterior(t),i.setTarget(r),i.setKey(e),i.getArrayData()},n.prototype.encodeRemoveRTCData=function(e,t,r,i){var o=this._codec.getModule(pr);o.setInterior(t),o.setTarget(r),o.setKey(e);var s=(i=i||{}).name,u=i.content;return!de(s)&&o.setObjectName(s),de(u)||(Ne(u)&&(u=JSON.stringify(u)),o.setContent(u)),o.getArrayData()},n.prototype.encodeSetRTCOutData=function(e,t,r){var i=this._codec.getModule(lo);i.setTarget(t),De(e)||(e=[e]),Ce(e,function(u,d){u.key=u.key?u.key.toString():u.key,u.value=u.value?u.value.toString():u.value,e[d]=u}),i.setValueInfo(e);var o=(r=r||{}).name,s=r.content;return!de(o)&&i.setObjectName(o),de(s)||(Ne(s)&&(s=JSON.stringify(s)),i.setContent(s)),i.getArrayData()},n.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule(po);return t.setUserId(e),t.getArrayData()},n.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(ho);return t.setState(e),t.getArrayData()},n.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule(fo);return e.setOrder(2),e.getArrayData()},n.prototype.encodeSetRTCUserInfo=function(e,t){var r=this._codec.getModule($e);return r.setKey(e),r.setValue(t),r.getArrayData()},n.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule(go);return t.setKey(e),t.getArrayData()},n.prototype.encodeIdentityChangeInfo=function(e,t,r){r===void 0&&(r=!1);var i=this._codec.getModule(lr);return i.setRoomType(Le.LIVE),t&&i.setBroadcastType(t),i.setIdentityChangeType(e),i.setNeedSysChatroom(r),i.getArrayData()},n.prototype.encodePullRTCRoomKV=function(e,t){var r=this._codec.getModule(ko);return r.setTimestamp(t),r.setRoomId(e),r.getArrayData()},n.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(Uo);return t.setUserId(e),t.getArrayData()},n.prototype.encodeRequestRoomPK=function(e){var t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,o=e.inviteTimeout,s=e.inviteInfo,u=this._codec.getModule(Do);return u.setInvitedRoomId(t),u.setInvitedUserId(r),u.setInviteSessionId(i),u.setTimeoutTime(o),u.setInviteInfo(s),u.getArrayData()},n.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,o=e.inviteInfo,s=this._codec.getModule(xo);return s.setInvitedRoomId(t),s.setInvitedUserId(r),s.setInviteSessionId(i),s.setInviteInfo(o),s.getArrayData()},n.prototype.encodeResponseRoomPK=function(e){var t=e.inviteUserId,r=e.inviteRoomId,i=e.inviteSessionId,o=e.content,s=e.key,u=e.value,d=e.agree?1:0,l=this._codec.getModule(Vo);return l.setInviteUserId(t),l.setInviteRoomId(r),l.setInviteSessionId(i),l.setContent(o),l.setKey(s),l.setValue(u),l.setAnswerCode(d),l.getArrayData()},n.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,r=e.sessionId,i=e.content,o=e.keys,s=this._codec.getModule(Bo);return s.setInviteRoomId(t),s.setInviteSessionId(r),s.setInviteContent(i),s.setInviteRoomKeys(o),s.getArrayData()},n}(),Fa=function(n,e){this._watcher=e,this.codec=new md(n)},Ha=function(n,e){return n&&e?e+"_"+n:n||Date.now()},On=function(){function n(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return n.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Ha(e,t)},n.prototype.read=function(e,t,r){this.readMessage(e,t,r)},n.prototype.readMessage=function(e,t,r){return{stream:e,length:t}},n}(),$a=function(){function n(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Yi(e,!1,it.AT_MOST_ONCE,!1)}return n.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Ha(e,t)},n.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},n.prototype.setHeaderQos=function(e){this._header.qos=e},n.prototype.getHeaderFlag=function(){return this._header.encode()},n.prototype.getLengthSize=function(){return this.lengthSize},n.prototype.getBufferData=function(){var e=new qu;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},n.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},n}(),ja=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return Re(e,n),e.prototype.readMessage=function(t,r,i){if(t.readByte(),this.status=+t.readByte(),r<=e.MESSAGE_LENGTH)return{stream:t,length:r};if(i===Et.V4){var o=t.readByte();1&o&&(this.userId=t.readUTF()),2&o&&t.readUTF(),4&o&&(this.timestamp=t.readLong()),8&o&&(this.messageId=t.read2Byte())}else{this.userId=t.readUTF();var s=t.readUTF();j.debug("server sessionId -> "+s),this.timestamp=t.readLong()}return{stream:t,length:r}},e.MESSAGE_LENGTH=2,e}(On),Fo=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.DISCONNECT,t.status=0,t}return Re(e,n),e.prototype.readMessage=function(t,r){return t.readByte(),this.status=+t.readByte(),{stream:t,length:r}},e.MESSAGE_LENGTH=2,e}(On),_d=function(n){function e(){var t=n.call(this,Me.PING_REQ)||this;return t._name=Fe.PING_REQ,t}return Re(e,n),e.prototype.writeMessage=function(t){},e}($a),Ka=function(n){function e(t){var r=n.call(this,t)||this;return r._name=Fe.PING_RESP,r}return Re(e,n),e}(On),Ho=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t.messageId=0,t}return Re(e,n),e.prototype.readMessage=function(t,r){var i=256*t.readByte()+t.readByte();return this.messageId=parseInt(i.toString(),10),{stream:t,length:r}},e}(On),Br=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t.messageId=0,t}return Re(e,n),e.prototype.writeMessage=function(t){var r=this.messageId,i=255&r,o=(65280&r)>>8;t.write(o),t.write(i)},e}($a),yn=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=St.PUB,t}return Re(e,n),e.prototype.readMessage=function(t,r){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),n.prototype.readMessage.call(this,t,r),this.data=t.readAll(),{stream:t,length:r}},e}(Ho),Zt=function(n){function e(t,r,i){var o=n.call(this,Me.PUBLISH)||this;return o._name=Fe.PUBLISH,o.syncMsg=!1,o.identifier=St.PUB,o.topic=t,o.data=Be(r)?bn.writeUTF(r):r,o.targetId=i,o}return Re(e,n),e.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),n.prototype.writeMessage.call(this,t),t.write(this.data)},e}(Br),Si=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=St.PUB,t.topic="",t.targetId="",t}return Re(e,n),e.prototype.readMessage=function(t,r){return n.prototype.readMessage.call(this,t,r),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:r}},e}(Ho),qa=function(n){function e(t){var r=n.call(this,Me.PUB_ACK)||this;return r._name=Fe.PUB_ACK,r.status=0,r.date=0,r.millisecond=0,r.messageUId="",r.timestamp=0,r.messageId=t,r}return Re(e,n),e.prototype.writeMessage=function(t){n.prototype.writeMessage.call(this,t)},e}(Br),W=function(n){function e(t,r,i){var o=n.call(this,Me.QUERY)||this;return o.name=Fe.QUERY,o.identifier=St.QUERY,o.topic=t,o.data=Be(r)?bn.writeUTF(r):r,o.targetId=i,o}return Re(e,n),e.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),n.prototype.writeMessage.call(this,t),t.write(this.data)},e}(Br),Ga=function(n){function e(t){var r=n.call(this,Me.QUERY_CONFIRM)||this;return r._name=Fe.QUERY_CON,r.messageId=t,r}return Re(e,n),e}(Br),ln=function(n){function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._name=Fe.QUERY_ACK,t.status=0,t.identifier=St.QUERY,t.topic="",t.targetId="",t}return Re(e,n),e.prototype.readMessage=function(t,r){return n.prototype.readMessage.call(this,t,r),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:r}},e}(Ho),Ya=function(n){var e,t=n.type;switch(t){case Me.CONN_ACK:e=new ja(n);break;case Me.PUBLISH:(e=new yn(n)).syncMsg=n.syncMsg;break;case Me.PUB_ACK:e=new Si(n);break;case Me.QUERY_ACK:e=new ln(n);break;case Me.SUB_ACK:case Me.UNSUB_ACK:case Me.PING_RESP:e=new Ka(n);break;case Me.DISCONNECT:e=new Fo(n);break;default:e=new On(n),j.error("No support for deserializing "+t+" messages")}return e};(function(n){n[n.ppMsgP=1]="ppMsgP",n[n.ppMsgN=2]="ppMsgN",n[n.ppMsgS=3]="ppMsgS",n[n.pgMsgP=4]="pgMsgP",n[n.chatMsg=5]="chatMsg",n[n.pcMsgP=6]="pcMsgP",n[n.qryPMsg=7]="qryPMsg",n[n.qryGMsg=8]="qryGMsg",n[n.qryCHMsg=9]="qryCHMsg",n[n.qryCMsg=10]="qryCMsg",n[n.qrySMsg=11]="qrySMsg",n[n.recallMsg=12]="recallMsg",n[n.prMsgS=13]="prMsgS",n[n.rrMsg=14]="rrMsg",n[n.rrList=15]="rrList",n[n.s_ntf=16]="s_ntf",n[n.s_msg=17]="s_msg",n[n.s_stat=18]="s_stat",n[n.s_cmd=19]="s_cmd",n[n.s_us=20]="s_us",n[n.pullUS=21]="pullUS",n[n.pgMsgS=22]="pgMsgS",n[n.chatMsgS=23]="chatMsgS",n[n.qrySessionsAtt=24]="qrySessionsAtt",n[n.pullMsg=25]="pullMsg",n[n.qrySessions=26]="qrySessions",n[n.delSessions=27]="delSessions",n[n.delMsg=28]="delMsg",n[n.updRRTime=29]="updRRTime",n[n.chrmPull=30]="chrmPull",n[n.joinChrm=31]="joinChrm",n[n.joinChrmR=32]="joinChrmR",n[n.exitChrm=33]="exitChrm",n[n.queryChrmI=34]="queryChrmI",n[n.setKV=35]="setKV",n[n.delKV=36]="delKV",n[n.pullKV=37]="pullKV",n[n.qryRelation=38]="qryRelation",n[n.delRelation=39]="delRelation",n[n.pullSeAtts=40]="pullSeAtts",n[n.setSeAtt=41]="setSeAtt",n[n.qnTkn=42]="qnTkn",n[n.qnUrl=43]="qnUrl",n[n.aliUrl=44]="aliUrl",n[n.s3Url=45]="s3Url",n[n.stcUrl=46]="stcUrl",n[n.cleanPMsg=47]="cleanPMsg",n[n.cleanGMsg=48]="cleanGMsg",n[n.cleanCMsg=49]="cleanCMsg",n[n.cleanSMsg=50]="cleanSMsg",n[n.rtcRJoin_data=51]="rtcRJoin_data",n[n.rtcRExit=52]="rtcRExit",n[n.rtcPing=53]="rtcPing",n[n.rtcSetData=54]="rtcSetData",n[n.rtc_ntf=55]="rtc_ntf",n[n.viewerJoinR=56]="viewerJoinR",n[n.viewerExitR=57]="viewerExitR",n[n.rtcPullKv=58]="rtcPullKv",n[n.rtcIdentityChange=59]="rtcIdentityChange",n[n.userSetData=60]="userSetData",n[n.rtcQryData=61]="rtcQryData",n[n.rtcDelData=62]="rtcDelData",n[n.rtcSetOutData=63]="rtcSetOutData",n[n.rtcQryUserOutData=64]="rtcQryUserOutData",n[n.rtcToken=65]="rtcToken",n[n.rtcUserState=66]="rtcUserState",n[n.rtcRInfo=67]="rtcRInfo",n[n.rtcUData=68]="rtcUData",n[n.rtcUPut=69]="rtcUPut",n[n.rtcUDel=70]="rtcUDel",n[n.rtcUList=71]="rtcUList",n[n.rtcQueryJoined=72]="rtcQueryJoined",n[n.addSeTag=73]="addSeTag",n[n.delSeTag=74]="delSeTag",n[n.addTag=75]="addTag",n[n.delTag=76]="delTag",n[n.disTag=77]="disTag",n[n.reportsdk=78]="reportsdk",n[n.rtcInvite=79]="rtcInvite",n[n.rtcCancelInvite=80]="rtcCancelInvite",n[n.rtcInviteAnswer=81]="rtcInviteAnswer",n[n.rtcEndInvite=82]="rtcEndInvite"})(Ti||(Ti={}));var Je,U=Ti,za=function(n,e,t,r){return D(void 0,void 0,void 0,function(){var i;return x(this,function(o){return i=0,n.forEach(function(s){return D(void 0,void 0,void 0,function(){var u,d;return x(this,function(l){switch(l.label){case 0:return u=e+"://"+s+"/ping?r="+(a=9999,(h=1e3)+Math.floor(Math.random()*(a-h))),j.debug("start ping",u),[4,t.httpReq({url:u,timeout:5e3})];case 1:return d=l.sent(),j.debug("end ping",i,u,d.status),i++,r({finished:i===n.length,code:d.status,host:s}),[2]}var h,a})})}),[2]})})},Ja=function(n,e,t,r,i,o,s,u){return n+"://"+e+"/websocket?appId="+t+"&token="+encodeURIComponent(r)+"&sdkVer="+o+"&pid="+s+"&apiVer="+(i.isFromUniapp?"uniapp":"normal")+(i.connectPlatform?"&platform="+i.connectPlatform:"")+(u?"&protocolVer="+u:"")},Wa=function(n){return[U.ppMsgS,U.pgMsgS,U.chatMsgS].map(function(e){return U[e]}).indexOf(n)>=0};(function(n){n[n.REDIRECT=0]="REDIRECT",n[n.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",n[n.BLOCK=2]="BLOCK",n[n.REMOTE_CLOSE=3]="REMOTE_CLOSE",n[n.LOGOUT=4]="LOGOUT",n[n.BLOCK_NEW=5]="BLOCK_NEW",n[n.REDIRECT_NEW=6]="REDIRECT_NEW"})(Je||(Je={}));var We,Ss=function(n,e){j.info("websocket send -> messageId: "+n.messageId);var t=n.getBufferData();e.send(t.buffer)},jt=function(n){function e(t,r){var i=n.call(this,"websocket",r)||this;return i._runtime=t,i._socket=null,i._messageIds={},i._syncMessageIds={},i._failedCount=0,i.ALLOW_FAILED_TIMES=2,i._timer=null,i._idCount=0,i._generateMessageId=function(){return i._idCount>=65535&&(i._idCount=0),++i._idCount},i}return Re(e,n),e.prototype.connect=function(t,r,i,o,s,u){return D(this,void 0,void 0,function(){var d=this;return x(this,function(l){return[2,new Promise(function(h){var a=[],c=0,p=!1,f=!1,m=function(){return D(d,void 0,void 0,function(){var _;return x(this,function(v){switch(v.label){case 0:return a.length===0||p?[2]:(p=!0,[4,this._connect(t,r,a.shift(),o,s,u)]);case 1:if((_=v.sent())===S.SUCCESS)this._checkAlive(),h(_);else if(_===we.REDIRECT)h(_);else{if(f&&a.length===0)return h(Ia(_)),[2];p=!1,m()}return[2]}})})};s=Ki(s),d._watcher.status(ee.CONNECTING),za(i,o,d._runtime,function(_){var v=_.code,R=_.finished,C=_.host;f=R,v===200&&(a.push(C),c++,m()),R&&c===0&&(j.error("No valid websocket server hosts!"),h(S.RC_SOCKET_NOT_CREATED))})})]})})},e.prototype._connect=function(t,r,i,o,s,u){return D(this,void 0,void 0,function(){var d,l,h,a,c,p=this;return x(this,function(f){switch(f.label){case 0:return d=o.replace("http","ws"),l=Ja(d,i,t,r,this._runtime,s,"",u),j.debug("conenct start -> "+l),this.sendConnectTime=Date.now(),h=this._runtime.createWebSocket(l),a=function(m){p._timer&&(clearTimeout(p._timer),p._timer=null),p._socket===h&&(p._socket=null,p._watcher.status(m))},[4,new Promise(function(m){h.onMessage(function(_){if(Object.prototype.toString.call(_)==="[object ArrayBuffer]"){var v=function(C,M){var A=new Uint8Array(C),O=new Ku(A),y=O.readByte(),w=new Yi(y),H=Ya(w);return H.read(O,A.length-1,M),H}(_,u);if(v instanceof Ka&&p._pingResolve)return p._pingResolve(S.SUCCESS),void(p._pingResolve=void 0);if(v instanceof ja)return j.debug("recv connect ack -> "+v.status),v.status!==we.ACCEPTED?(j.warn("connect failed: "+v.status),void m(v.status)):(j.info("connect success -> "+l),p.connectedTime=v.timestamp,p.userId=v.userId||"",p._idCount=v.messageId,void m(S.SUCCESS));if(v instanceof Fo){var R=v.status;switch(j.warn("recv disconnect signal -> status: "+R),R){case Je.BLOCK:p._watcher.status(ee.BLOCKED);break;case Je.OTHER_DEVICE_LOGIN:p._watcher.status(ee.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Je.REDIRECT_NEW:case Je.REDIRECT:p._watcher.status(ee.REDIRECT);break;default:p._watcher.status(ee.DISCONNECT_BY_SERVER)}}else p._onReceiveSignal(v)}else j.error("Socket received invalid data:",_)}),h.onClose(function(_,v){for(var R in j.warn("websocket closed! code:",_,"reason:",v),a(ee.CONNECTION_CLOSED),p._messageIds){var C=p._messageIds[R];delete p._messageIds[R],C(S.RC_NET_CHANNEL_INVALID)}m(_)}),h.onError(function(_){var v;for(var R in j.error("websocket error!",(v=_)===null||v===void 0?void 0:v.stack),a(ee.WEBSOCKET_ERROR),p._messageIds){var C=p._messageIds[R];delete p._messageIds[R],C(S.RC_NET_CHANNEL_INVALID)}m(S.NETWORK_ERROR)}),h.onOpen(function(){return j.debug("websocket open =>",l)}),setTimeout(function(){m(S.TIMEOUT)},5e3)})];case 1:return(c=f.sent())===S.SUCCESS?this._socket=h:(j.warn("connect result -> code: "+c+", url: "+l),h.close()),[2,c]}})})},e.prototype._checkAlive=function(){var t;return D(this,void 0,void 0,function(){var r,i=this;return x(this,function(o){switch(o.label){case 0:return this._socket?(j.debug("send ping ->"),this.sendOnly(new _d),[4,new Promise(function(s){i._pingResolve=s,i._timer&&clearTimeout(i._timer),i._timer=setTimeout(function(){i._pingResolve=void 0,s(S.TIMEOUT)},15e3)})]):[2];case 1:return(r=o.sent())!==S.SUCCESS?(this._failedCount+=1,j.warn("ping failed count: "+this._failedCount+", code: "+r),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,j.warn("ping timeout, close current websocket to reconnect!"),(t=this._socket)===null||t===void 0||t.close(),this._watcher.status(ee.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(j.debug("recv pong <-"),this._failedCount=0,setTimeout(function(){return i._checkAlive()},15e3),[2])}})})},e.prototype._onReceiveSignal=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u,d,l=this;return x(this,function(h){switch(h.label){case 0:return r=t.messageId,t.header&&t.header.qos!==it.AT_MOST_ONCE&&(t instanceof yn&&!t.syncMsg&&(j.debug("send pubAck -> "+r),this.sendOnly(new qa(r))),t instanceof ln&&(j.debug("send queryCon -> "+r),this.sendOnly(new Ga(r)))),r>0&&(t instanceof Si||t instanceof ln)&&(j.debug("recv ack -> messageId: "+r),(i=this._messageIds[r])&&(i(t),delete this._messageIds[r]),(o=this._syncMessageIds[r])&&(delete this._syncMessageIds[r],o(t))),t instanceof yn?(s=t.syncMsg,(u=t.topic)===U[U.userSetData]?[2]:!s||Wa(u)?(this._watcher.signal(t),[2]):[4,new Promise(function(a){l._syncMessageIds[r]=a})]):[3,2];case 1:d=h.sent(),delete this._syncMessageIds[r],this._watcher.signal(t,d),h.label=2;case 2:return[2]}})})},e.prototype.sendOnly=function(t){this._socket&&Ss(t,this._socket)},e.prototype.send=function(t,r,i,o){return o===void 0&&(o=3e4),D(this,void 0,void 0,function(){var s,u,d,l=this;return x(this,function(h){switch(h.label){case 0:return this._socket?(s=this._generateMessageId(),t.messageId=s,Ss(t,this._socket),[4,new Promise(function(a){l._messageIds[s]=a,setTimeout(function(){l._messageIds[s]&&delete l._messageIds[s],a()},o)})]):[3,2];case 1:return(u=h.sent())?u instanceof ln||u instanceof Si?(d=r&&u.data?this.codec.decodeByPBName(u.data,r,i):u,u.status!==0?(j.warn("send failed -> message: "+s+", respPBName: "+r+", status: "+u.status),[2,{code:u.status,data:r&&u.data?d:null}]):[2,{code:S.SUCCESS,data:d}]):[2,{code:u}]:(j.warn("send timeout -> message: "+s+", respPBName: "+r+", timeout: "+o),[2,{code:S.TIMEOUT}]);case 2:return[2,{code:S.RC_NET_CHANNEL_INVALID}]}})})},e.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(ee.DISCONNECTED))},e}(Fa);(function(n){n.GET="GET",n.POST="POST"})(We||(We={}));var Kt=function(n){function e(t,r){var i=n.call(this,"comet",r)||this;return i._runtime=t,i._messageIds={},i._syncMessageIds={},i._idCount=0,i._generateMessageId=function(){return++i._idCount},i._pid=encodeURIComponent(new Date().getTime()+Math.random()+""),i}return Re(e,n),e.prototype.handleCometRes=function(t){var r=this;if(t.status!==200&&t.status!==202)return!1;var i=Be(t.data)?JSON.parse(t.data):t.data;return i?!De(i)||(Ce(i,function(o){return D(r,void 0,void 0,function(){var s,u,d,l,h,a,c,p,f,m,_,v=this;return x(this,function(R){switch(R.label){case 0:if((s=o.sessionid)&&(this._sessionid=s),u=function(C){var M=C.headerCode,A=new Yi(M),O=Ya(A);for(var y in C)O[y]=C[y];return O}(o),d=u.messageId,l=u._header,h=u.status,u.identifier,a=l&&l.qos!==it.AT_MOST_ONCE,d&&u.getIdentifier&&((c=this._messageIds[d])&&c(u),this._syncMessageIds[d]&&this._syncMessageIds[d](u)),a&&(u instanceof yn&&!u.syncMsg&&(p=new qa(d),this.sendOnly(p)),u instanceof ln&&(p=new Ga(d),this.sendOnly(p))),u instanceof Fo){switch(h){case Je.OTHER_DEVICE_LOGIN:this._watcher.status(ee.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Je.BLOCK:this._watcher.status(ee.BLOCKED);break;case Je.REDIRECT_NEW:case Je.REDIRECT:this._watcher.status(ee.REDIRECT);break;default:this._watcher.status(ee.DISCONNECT_BY_SERVER)}return[2]}return u instanceof yn?(f=u.syncMsg,m=u.topic,!f||Wa(m)?(this._watcher.signal(u),[2,!1]):[4,new Promise(function(C){v._syncMessageIds[d]=C})]):[3,2];case 1:_=R.sent(),delete this._syncMessageIds[d],this._watcher.signal(u,_),R.label=2;case 2:return[2]}})})}),!0):(j.error("received data is not a validJson",i),!1)},e.prototype._startPullSignal=function(t){return D(this,void 0,void 0,function(){var r,i,o,s;return x(this,function(u){switch(u.label){case 0:return r=new Date().getTime(),i=t+"://"+this._domain+"/pullmsg.js?sessionid="+this._sessionid+"&timestrap="+r+"&pid="+this._pid,[4,this._runtime.httpReq({url:i,body:{pid:this._pid},timeout:45e3})];case 1:return o=u.sent(),s=this.handleCometRes(o),this._isDisconnected||(s?this._startPullSignal(t):(this._isDisconnected=!0,this._watcher.status(ee.NETWORK_UNAVAILABLE))),[2]}})})},e.prototype.connect=function(t,r,i,o,s,u){return D(this,void 0,void 0,function(){var d,l,h,a,c=this;return x(this,function(p){return s=Ki(s),this._protocol=o,this._isDisconnected=!1,this._watcher.status(ee.CONNECTING),d=[],l=0,h=!1,a=!1,[2,new Promise(function(f){var m=function(){return D(c,void 0,void 0,function(){var _;return x(this,function(v){switch(v.label){case 0:return d.length===0||h?[2]:(h=!0,[4,this._connect(t,r,d.shift(),o,s)]);case 1:if((_=v.sent())===S.SUCCESS)this._startPullSignal(o),f(_);else if(_===we.REDIRECT)f(_);else{if(a&&d.length===0)return f(Ia(_)),[2];h=!1,m()}return[2]}})})};c._watcher.status(ee.CONNECTING),za(i,o,c._runtime,function(_){var v=_.code,R=_.finished,C=_.host;a=R,v===200&&(d.push(C),l++,m()),R&&l===0&&(j.error("No valid websocket server hosts!"),f(S.RC_SOCKET_NOT_CREATED))})})]})})},e.prototype._connect=function(t,r,i,o,s){return D(this,void 0,void 0,function(){var u,d,l,h;return x(this,function(a){switch(a.label){case 0:return u=function(c){return c.status!==200&&c.status!==202?(j.error("handle comet res -> res: "+JSON.stringify(c||{})),!1):!!c.data&&(function(p){if(Ne(p))return!0;var f=!1;try{var m=JSON.parse(p);f=JSON.stringify(m)===p}catch{f=!1}return f}(c.data)?Ne(c.data)?c.data:JSON.parse(c.data):(j.error("received data is not a validJson",c.data),!1))},d=Ja(o,i,t,r,this._runtime,s,this._pid),this.sendConnectTime=Date.now(),j.debug("conenct start -> "+d),[4,this._runtime.httpReq({url:d,body:{pid:this._pid},timeout:5e3})];case 1:return l=a.sent(),h=u(l),this._domain=i,h&&h.status===0?(this._sessionid=h.sessionid,this.userId=h.userId,this.connectedTime=h.timestamp):j.warn("connect result -> code: "+(h==null?void 0:h.status)+", url: "+d),[2,h==null?void 0:h.status]}})})},e.prototype.sendCometData=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a,c,p;return x(this,function(f){switch(f.label){case 0:return o=(i=this)._domain,s=i._sessionid,u=i._pid,d=t.messageId,l=t.topic,h=t.targetId,t.identifier,a=t.getHeaderFlag(),c=l?this._protocol+"://"+o+"/websocket?messageid="+d+"&header="+a+"&sessionid="+s+"&topic="+l+"&targetid="+h+"&pid="+u:this._protocol+"://"+o+"/websocket?messageid="+d+"&header="+a+"&sessionid="+s+"&pid="+u,[4,this._runtime.httpReq({url:c,method:We.POST,body:t.getCometData()})];case 1:return p=f.sent(),this.handleCometRes(p),[2]}})})},e.prototype.sendOnly=function(t){this.sendCometData(t)},e.prototype.send=function(t,r,i,o){return o===void 0&&(o=3e4),D(this,void 0,void 0,function(){var s,u,d,l=this;return x(this,function(h){switch(h.label){case 0:return s=this._generateMessageId(),t.messageId=s,this.sendCometData(t),[4,new Promise(function(a){l._messageIds[s]=a,setTimeout(function(){delete l._messageIds[s],a()},o)})];case 1:return(u=h.sent())?(d=r&&u.data?this.codec.decodeByPBName(u.data,r,i):u,u.status!==0?[2,{code:u.status,data:r&&u.data?d:null}]:[2,{code:S.SUCCESS,data:d}]):[2,{code:S.TIMEOUT}]}})})},e.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(ee.DISCONNECTED)},e}(Fa),vd=function(n,e,t){this.runtime=n,this._watcher=e,this._options=t,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()},Wr=function(n){return["navi",n].join("_")},Rd=function(){function n(e,t){this._runtime=e,this._options=t,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Ki(this._options.apiVersion)}return n.prototype.getInfo=function(e,t,r,i){return D(this,void 0,void 0,function(){var o,s;return x(this,function(u){switch(u.label){case 0:return r&&this._clear(e),(o=function(d,l,h){var a,c,p=Wr(d);try{var f=h.getItem(p);c=f?JSON.parse(f):[]}catch{c=[]}var m=Date.now();return c.length>0&&(c=c.filter(function(_){return m-_.timestamp<72e5})),c.length===0?h.removeItem(p):h.setItem(p,JSON.stringify(c)),((a=c.find(function(_){return _.token===l}))===null||a===void 0?void 0:a.naviInfo)||null}(this._appkey,e,this._runtime.localStorage))?(this._naviInfo=o,[2,o]):(s=this._options.navigators.slice(),t.length&&t.forEach(function(d){s.indexOf(d)<0&&s.unshift(d)}),[4,this._reqNavi(s,this._appkey,e,i)]);case 1:return(o=u.sent())?(this._naviInfo=o,this.setNaviInfo2Cache(e,o),[2,o]):[2,o]}})})},n.prototype.setNaviInfo2Cache=function(e,t){this._naviInfo=t,function(r,i,o,s){var u,d=Wr(r);try{var l=s.getItem(d);u=l?JSON.parse(l):[]}catch{u=[]}var h=Date.now();u.length>0&&(u=u.filter(function(a){return h-a.timestamp<72e5&&i!==a.token})),u.push({timestamp:h,naviInfo:o,token:i}),s.setItem(d,JSON.stringify(u))}(this._appkey,e,t,this._runtime.localStorage)},n.prototype.getInfoFromCache=function(e){return this._naviInfo},n.prototype._clear=function(e){(function(t,r,i){var o,s=Wr(t);try{var u=i.getItem(s);o=u?JSON.parse(u):[]}catch{o=[]}var d=Date.now();o.length>0&&(o=o.filter(function(l){return d-l.timestamp<72e5&&r!==l.token})),o.length===0?i.removeItem(s):i.setItem(s,JSON.stringify(o))})(this._appkey,e,this._runtime.localStorage)},n}(),Vn=function(n,e,t){return[n,e,t].join("_")},Ed=function(){function n(e,t){this._runtime=e,this._appkey=t,this._users={}}return n.prototype._getMemData=function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0})},n.prototype.setInboxTime=function(e,t){var r=this._getMemData(t);if(!(r.inboxTime>e)){r.inboxTime=e;var i=Vn("inbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},n.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(t.inboxTime===0){var r=Vn("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(r))||0}return t.inboxTime},n.prototype.setOutboxTime=function(e,t){var r=this._getMemData(t);if(!(r.outboxTime>=e)){r.outboxTime=e;var i=Vn("outbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},n.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(t.outboxTime===0){var r=Vn("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(r))||0}return t.outboxTime},n}(),Zr={_caches:{},set:function(n,e){this._caches[n]=e},get:function(n){return this._caches[n]||0},clear:function(n){this._caches[n]=0}},Cd=function(){function n(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}return n.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},n.prototype._remove=function(e){var t=e.key,r=this._kvCaches[t];r&&(r.isDeleted=!0,this._kvCaches[t]=r)},n.prototype._setEntry=function(e,t){var r=e.key,i=e.type,o=e.isOverwrite,s=e.userId,u=this._getSetUserId(r),d=i===xe.DELETE,l=u===s,h=!this._isExisted(r),a=d?this._remove:this._add;(t||o||l||h)&&a.call(this,e)},n.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},n.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},n.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},n.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},r=t.value,i=t.isDeleted;return r&&!i},n.prototype.setEntries=function(e){var t=this,r=e.kvEntries,i=e.isFullUpdate;r=r||[],(i=i||!1)&&this.clear(),r.forEach(function(o){t._setEntry(o,i)}),j.debug("end setEntries")},n.prototype.clear=function(){this._kvCaches={}},n}(),yd=function(){function n(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return n.prototype._startPull=function(){return D(this,void 0,void 0,function(){var e,t,r,i,o,s,u;return x(this,function(d){switch(d.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,r=e.timestamp,(i=Zr.get(t))>r?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,i)]);case 1:return o=d.sent(),s=o.code,u=o.data,this._isPulling=!1,s===S.SUCCESS?(Zr.set(t,u.syncTime||0),this._startPull()):this._startPull(),[2]}})})},n.prototype.reset=function(e){Zr.clear(e);var t=this._storeCaches[e];t&&t.clear()},n.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},n.prototype.setLocal=function(e,t,r){var i=this._storeCaches[e];un(i)||(i=new Cd(e,r)),i.setEntries(t),this._storeCaches[e]=i},n.prototype.getValue=function(e,t){var r=this._storeCaches[e];return r?r.getValue(t):null},n.prototype.getAll=function(e){var t=this._storeCaches[e],r={};return t&&(r=t.getAllValue()),r},n}(),Td=function(){function n(e,t,r,i){this._runtime=e,this._appkey=t,this._userId=r,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-"+this._appkey+"-"+this._userId}return n.prototype.set=function(e,t){t===void 0&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},n.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch{j.error("parse rejoined chrm infos error -> "+t),e={}}return e},n.prototype.remove=function(e){delete this._joinedChrmsInfo[e],un(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},n.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},n}(),Qr="converStatusChanged",Sd=function(){function n(e,t,r){this._eventEmitter=new In,this._pullQueue=[],this._isPulling=!1,this._storage=Or(e.runtime),this._appkey=t,this._currentUserId=r,this._engine=e,this._storagePullTimeKey="con-s-"+t+"-"+r}return n.prototype._set=function(e){var t=this;if(!de(e)&&Array.isArray(e)){var r=this._storage.get(this._storagePullTimeKey)||0,i=e.length;e.forEach(function(o,s){var u=o.updatedTime||0;r=u>r?u:r,o.conversationType=o.type,t._eventEmitter.emit(Qr,{statusItem:o,isLastPull:s===i-1})}),this._storage.set(this._storagePullTimeKey,r)}},n.prototype._startPull=function(){return D(this,void 0,void 0,function(){var e,t,r,i;return x(this,function(o){switch(o.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=o.sent(),r=t.code,i=t.data,r===S.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}})})},n.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||e===0)&&(this._pullQueue.push(t),this._startPull())},n.prototype.watch=function(e){this._eventEmitter.on(Qr,function(t){e(t)})},n.prototype.unwatch=function(){this._eventEmitter.off(Qr,function(e){})},n}(),Rt={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},Xn={};for(var Is in Rt){var Id=Rt[Is].keyName;Xn[Id]=Is}var Qt,bd=function(){function n(e,t,r){this._appkey=t,this._currentUserId=r;var i="con-"+t+"-"+r;this.storage=new os(e,i),this._localStore=new os(e,"CONVER-"+t+"-"+r)}return n.prototype._getStoreKey=function(e,t,r){return r+"_"+e+"_"+t},n.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var r=t.shift(),i=t.shift(),o=t.join("_");return{conversationType:Number(i),targetId:o,channelId:r}}return{conversationType:J.PRIVATE,targetId:"",channelId:""}},n.prototype.updateMentionedData=function(e){var t=this,r=e.conversationType,i=e.targetId,o=e.messageType,s=e.isMentioned,u=e.content,d=e.senderUserId,l=e.channelId,h=this._getStoreKey(r,i,l),a=this._localStore.get(h)||{},c=Xn.mentionedInfo,p=Xn.hasMentioned,f=a[c]||{},m=f.userIdList||[],_=u.mentionedInfo;if(_){if(s&&r===J.GROUP&&((_.userIdList||[]).forEach(function(R){R===t._currentUserId&&m.indexOf(d)<0&&m.push(d)}),_.type===Gi.ALL&&m.indexOf(d)<0&&m.push(d)),o===Ae.RECALL&&r===J.GROUP){var v=m.indexOf(d);v>=0&&m.splice(v,1)}_={userIdList:m,type:(_==null?void 0:_.type)||f.type},m.length!==0?(a[c]=_,a[p]=!0):(delete a[c],delete a[p]),un(a)?this._localStore.set(h,a):this._localStore.remove(h)}},n.prototype.set=function(e,t,r,i){var o=this._getStoreKey(e,t,i),s=this._localStore.get(o)||{};for(var u in r){var d=Xn[u],l=r[u];if(!de(d)&&!de(l)&&u!=="hasMentioned"&&u!=="MentionedInfo"){if(l===Rt[d].defaultVal||u==="tags"&&!un(l))delete s[d];else if(u==="tags"){var h=l;for(var a in h)h[a].isTop||delete h[a].isTop;s[d]=l}else s[d]=l;s.c||(delete s.t,delete s.hm,delete s.m,delete s.mc)}}un(s)?this._localStore.set(o,s):this._localStore.remove(o)},n.prototype.get=function(e,t,r){r===void 0&&(r="");var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{},s={};for(var u in Rt){var d=Rt[u],l=d.keyName,h=d.defaultVal;s[l]=o[u]||Qn(h)}return s},n.prototype.getValue=function(e){var t=this._localStore.getValues()||{},r=[];for(var i in t){var o=this._getConOptionByKey(i),s={conversationType:o.conversationType,targetId:o.targetId,channelId:o.channelId},u=t[i];for(var d in u){var l=Rt[d],h=l.keyName,a=l.defaultVal;s[h]=u[d]||Qn(a)}s=e?e(s):s,r.push(s)}return r},n.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var r in e){var i=this._getConOptionByKey(r),o=i.conversationType,s=i.targetId,u={},d=e[r];for(var l in d){var h=Rt[l],a=h.keyName,c=h.defaultVal;u[a]=d[l]||Qn(c)}for(var p in u.tags){de(t[p])&&(t[p]=[]);var f=Object.assign({},u,{conversationType:o,targetId:s});delete f.tags,t[p].push(f)}}return t},n.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(Object.keys(e).length===0)return;for(var t in e){var r="_"+t;this._localStore.set(r,e[t])}}catch(i){j.error("adaptOldStore error: "+i.message)}},n}(),Od=[J.PRIVATE,J.GROUP,J.SYSTEM,J.PUBLIC_SERVICE,J.APP_PUBLIC_SERVICE],bs="conversationChanged",Os="conTagStatusChanged",Nd=function(){function n(e,t,r,i,o){var s=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new In,this._draftMap={},this._appkey=t,this._loginUserId=r,this._store=new bd(e.runtime,t,r),this._statusManager=new Sd(e,t,r),this._statusManager.watch(function(u){var d=u.statusItem,l=u.isLastPull;s.addStatus(d,l)}),this._eventEmitter.on(bs,function(u){i(u)}),this._eventEmitter.on(Os,function(){o()})}return n.prototype._calcUnreadCount=function(e,t){var r=e.content,i=e.messageType,o=e.sentTime,s=e.isCounted,u=e.messageDirection,d=e.senderUserId,l=u===je.SEND&&d===this._loginUserId,h=i===Ae.RECALL,a=Ne(r),c=!1,p={},f=t.lastUnreadTime||0,m=t.unreadMessageCount||0;return f>o||l?{hasChanged:c,localConversation:t,updateItems:p}:(s&&(t.unreadMessageCount=m+1,t.lastUnreadTime=o,c=!0),h&&a&&f>=r.sentTime&&m&&(t.unreadMessageCount=m-1,c=!0),c&&(p.unreadMessageCount={val:t.unreadMessageCount,time:o}),{hasChanged:c,localConversation:t,updateItems:p})},n.prototype._calcMentionedInfo=function(e,t){var r=e.content,i=(e.messageDirection,e.isMentioned),o=e.sentTime;je.SEND;var s=Ne(r),u=!1,d={};return i&&s&&r.mentionedInfo&&(t.hasMentioned=!0,u=!0,d.hasMentioned={val:!0,time:o},d.mentionedInfo={val:r.mentionedInfo,time:o}),{hasChanged:u,localConversation:t,updateItems:d}},n.prototype._calcMentionedCount=function(e,t){var r=e.content,i=e.messageDirection,o=!1;if(e.isMentioned&&i===je.RECEIVE&&(r==null?void 0:r.mentionedInfo)){var s=r.mentionedInfo,u=s.type,d=s.userIdList;if(u===Gi.ALL||(d||[]).includes(this._loginUserId)){o=!0;var l=t.unreadMentionedCount||0;t.unreadMentionedCount=l+1}}return{hasChanged:o,localConversation:t}},n.prototype._setUpdatedConversation=function(e){if(Ne(e)){var t=e.conversationType,r=e.targetId,i=e.channelId,o=t+"_"+r,s=this._store.get(t,r,i)||{};this._updatedConversations[o]=Object.assign(s,e)}},n.prototype._setConTagStatusChanged=function(e,t,r,i){var o=(this._store.get(e,t,i)||{}).tags||{};if(Object.keys(o).length===Object.keys(r).length){for(var s in o)if(!r[s]||o[s].isTop!==r[s].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},n.prototype.addStatus=function(e,t){var r=e.conversationType,i=e.targetId,o=e.updatedTime,s=e.notificationStatus,u=e.isTop,d=e.tags,l=e.channelId,h={},a={};de(s)||(a.notificationStatus={time:o,val:s}),de(u)||(a.isTop={time:o,val:u}),de(d)||(a.tags={time:o,val:d},d==null||d.forEach(function(c){h[c.tagId]={isTop:c.isTop}})),this._setConTagStatusChanged(r,i,h,l),this._store.set(r,i,{notificationStatus:s,isTop:u,tags:h},l),this._setUpdatedConversation({conversationType:r,targetId:i,updatedItems:a,channelId:l}),t&&this._notifyConversationChanged()},n.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);e.length!==0&&(this._eventEmitter.emit(bs,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Os),this._conTagStatusChanged=!1))},n.prototype.setConversationCacheByMessage=function(e,t){var r=this,i=e.conversationType,o=e.isPersited,s=e.targetId,u=e.channelId;if(Od.indexOf(i)>=0){var d=!1,l=this._store.get(i,s,u),h={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach(function(p){var f=p.call(r,e,l),m=f.hasChanged,_=f.localConversation,v=f.updateItems;d=d||m,h=fe(fe({},h),v),l=Qn(_)}),d&&this._store.set(i,s,l,u),this._store.updateMentionedData(e),o){var a=this._store.get(i,s,u);a.updatedItems=fe({latestMessage:{time:e.sentTime,val:e}},h),a.latestMessage=e;var c=Object.assign(a,{conversationType:i,targetId:s,channelId:u});this._setUpdatedConversation(c)}(d||o)&&this._notifyConversationChanged()}},n.prototype.get=function(e,t,r){return r===void 0&&(r=""),this._store.get(e,t,r)},n.prototype.getAllUnreadCount=function(e,t,r){var i=this._store.getValue(),o=0;return i.forEach(function(s){var u=s.unreadMessageCount,d=s.notificationStatus,l=s.conversationType;u=u||0,(r||d!==1)&&(t.length>0?t.includes(Number(l))&&(o+=Number(u)):o+=Number(u))}),o},n.prototype.getUnreadCountByTag=function(e,t){var r=this._store.getValueForTag()[e]||[],i=0;return r.forEach(function(o){var s=o.unreadMessageCount,u=o.notificationStatus;(t||u!==1)&&(s=s||0,i+=Number(s))}),i},n.prototype.getUnreadCount=function(e,t,r){return this._store.get(e,t,r).unreadMessageCount||0},n.prototype.clearUnreadCount=function(e,t,r,i){i===void 0&&(i=!0);var o=this._store.get(e,t,r),s=o.unreadMessageCount,u=o.hasMentioned,d={};if(s&&(o.unreadMessageCount=0,d.unreadMessageCount={val:0,time:Date.now()}),u&&(o.hasMentioned=!1,o.unreadMentionedCount=0,o.mentionedInfo=void 0,d.hasMentioned={val:!1,time:Date.now()},d.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,o,r),i&&Object.keys(d).length!==0){var l=Object.assign(o,{conversationType:e,targetId:t,channelId:r,updatedItems:d});this._setUpdatedConversation(l),this._notifyConversationChanged()}},n.prototype.clearAllUnreadCount=function(){var e=this;this._store.getValue().forEach(function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,e._store.set(t.conversationType,t.targetId,t,t.channelId))})},n.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},n.prototype.setDraft=function(e,t,r,i){var o=e+"_"+t+"_"+i;this._draftMap[o]=r},n.prototype.getDraft=function(e,t,r){var i=e+"_"+t+"_"+r;return this._draftMap[i]},n.prototype.clearDraft=function(e,t,r){var i=e+"_"+t+"_"+r;delete this._draftMap[i]},n.prototype.addTagStatus=function(e,t,r,i){i===void 0&&(i="");var o=this._store.get(e,t,i).tags;o=Object.assign(o,r),this._store.set(e,t,{tags:o},i)},n.prototype.deleteTagStatus=function(e,t,r,i){i===void 0&&(i="");var o=this._store.get(e,t,i).tags;r.forEach(function(s){delete o[s]}),this._store.set(e,t,{tags:o},i)},n.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},n.prototype.getBlockConversationList=function(){return this._store.getValue().filter(function(e){return e.notificationStatus===Pt.OPEN}).map(function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}})},n.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter(function(e){return e.isTop}).map(function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}})},n.prototype.adaptOldStore=function(){this._store.adaptOldStore()},n.prototype.getUnreadMentionedCount=function(e,t,r){return e===void 0&&(e=""),this.get(t,r,e).unreadMentionedCount||0},n.prototype.getAllUnreadMentionedCount=function(){var e=this._store.getValue(),t=0;return e.forEach(function(r){var i=r.unreadMentionedCount;i=i||0,t+=Number(i)}),t},n}(),wd=function(){function n(e,t,r,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-"+t+"-"+r,this._storagePullTimeKey="us-s-"+t+"-"+r,this._storage=Or(e.runtime),this._engine=e,this._tagWatcherFunc=i}return n.prototype._updateTag=function(e){var t=e.tags,r={};t.forEach(function(i){r[i.tagId]={tagName:i.tagName,createdTime:i.createdTime}}),this._storage.set(this._storageTagKey,r),this._tagWatcherFunc()},n.prototype.addTag=function(e,t){var r=this._storage.get(this._storageTagKey)||{};e.forEach(function(i){var o,s=((o=r[i.tagId])===null||o===void 0?void 0:o.createdTime)||i.createdTime||0;r[i.tagId]={tagName:i.tagName,createdTime:s}}),this._storage.set(this._storageTagKey,r),this._storage.set(this._storagePullTimeKey,t)},n.prototype.deleteTag=function(e,t){var r=this._storage.get(this._storageTagKey)||{};e.forEach(function(i){delete r[i]}),this._storage.set(this._storageTagKey,r),this._storage.set(this._storagePullTimeKey,t)},n.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},n.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var r in e)t.push({tagId:r,tagName:e[r].tagName,createdTime:e[r].createdTime,conversationCount:0});return t.sort(function(i,o){return(i.createdTime||0)-(o.createdTime||0)})},n.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},n.prototype._startPull=function(){return D(this,void 0,void 0,function(){var e,t,r,i,o,s,u,d;return x(this,function(l){switch(l.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=l.sent(),r=t.code,i=t.data,r!==S.SUCCESS||de(i)?(this._isPulling=!1,this._startPull()):(s=(o=i).settings,u=o.version,d=s.Tag,de(d)||this._updateTag(d),this._storage.set(this._storagePullTimeKey,u),this._isPulling=!1,this._startPull()),[2]}})})},n.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||e===0)&&(this._pullQueue.push(t),this._startPull())},n.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},n}(),Md=function(n){function e(t,r){var i=n.call(this,t,r)||this;return i._miniConnectUrl="",i._connectType=r.connectionType,i}return Re(e,n),e.prototype._formatJSONPUrl=function(t,r,i,o){return t+"/"+(this._runtime.isSupportSocket()&&this._connectType==="websocket"?"navi":"cometnavi")+".js?appId="+i+"&token="+encodeURIComponent(r)+"&callBack="+o+"&v="+this._apiVersion+"&r="+Date.now()},e.prototype.getInfo=function(t,r,i){var o;return D(this,void 0,void 0,function(){var s;return x(this,function(u){return this._runtime.useNavi||(s=void 0,s=this._runtime.isSupportSocket()&&this._connectType==="websocket"?Mu.join(","):Au.join(","),this._miniConnectUrl=((o=this._options.miniCMPProxy)===null||o===void 0?void 0:o.length)?this._options.miniCMPProxy.join(","):s||"",r=[]),[2,n.prototype.getInfo.call(this,t,r,i)]})})},e.prototype._reqNavi=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p;return x(this,function(f){switch(f.label){case 0:o="getServerEndpoint",s=0,u=t.length,f.label=1;case 1:return s<u?(d=this._formatJSONPUrl(t[s],i,r,o),j.debug("req navi => "+d),[4,this._runtime.httpReq({url:d,timeout:1e4,dataType:"text"})]):[3,4];case 2:if((l=f.sent()).status!==200)return l.status===403?j.error("request navi error: "+S.RC_CONN_USER_OR_PASSWD_ERROR):l.status===401&&j.error("request navi error: "+S.RC_CONN_APP_BLOCKED_OR_DELETED),[3,3];try{return h=l.data.match(/{[\d\D]+}/),(a=h&&h[0]?h[0]:"").indexOf('{\\"code\\":')===0&&(a=JSON.parse('"'+a+'"')),p=JSON.parse(a),c=/^https/.test(d)?"https":"http",p.protocol=c,this._runtime.useNavi||(p.server="",p.backupServer=this._miniConnectUrl,p.logSwitch=0),[2,p]}catch(m){j.error("parse navi err =>",m)}f.label=3;case 3:return s+=1,[3,1];case 4:return this._runtime.useNavi?[2,null]:[2,p={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:0,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:this._miniConnectUrl}]}})})},e}(Rd),Ad=function(){function n(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return n.prototype._startPull=function(){return D(this,void 0,void 0,function(){var e,t,r,i,o,s,u;return x(this,function(d){switch(d.label){case 0:return this._isPulling||this._pullQueue.length===0?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,r=e.timestamp,(i=this._pullTime)>r?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,i)]);case 1:return o=d.sent(),s=o.code,u=o.data,s===S.SUCCESS?(this._isPulling=!1,this._pullTime=u.syncTime||0,this._startPull()):this._startPull(),[2]}})})},n.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},n.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},n}(),Xr=function(n,e){return["send_msg",n,e].join("_")},Pd=function(){function n(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return n.prototype.init=function(e){this._userId=e;var t=Xr(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},n.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch{return{}}},n.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var r=Xr(this._appkey,this._userId),i=this._getLocalInfo(r);i[e]=t,this._runtime.localStorage.setItem(r,JSON.stringify(i))},n.prototype.getSendMessageMap=function(){return this._sendMessageMap},n.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},n.prototype.removeByTimestamp=function(e){var t=Xr(this._appkey,this._userId),r=this._getLocalInfo(t);Object.keys(r).forEach(function(i){r[i]<e&&delete r[i]}),this._runtime.localStorage.setItem(t,JSON.stringify(r))},n}(),Za=function(n){var e="RCDeviceId",t=Or(n),r="",i=t.get(e);return i?r=i:(r=Ta(),t.set(e,r)),r};(Qt={})[J.PRIVATE]=U.qryPMsg,Qt[J.GROUP]=U.qryGMsg,Qt[J.CHATROOM]=U.qryCHMsg,Qt[J.CUSTOMER_SERVICE]=U.qryCMsg,Qt[J.SYSTEM]=U.qrySMsg;var Ld=[U[U.recallMsg],U[U.ppMsgS],U[U.pgMsgS],U[U.ppMsgP],U[U.pgMsgP],U[U.chatMsg],U[U.pcMsgP],U[U.prMsgS]],ei=function(n,e,t,r,i,o){return{conversationType:n,targetId:e,senderUserId:o,messageDirection:je.SEND,isCounted:!!t.isCounted,isMentioned:!!t.isMentioned,content:t.content,messageType:t.messageType,isOffLineMessage:!1,isPersited:!!t.isPersited,messageUId:r,sentTime:i,receivedTime:0,disableNotification:!!t.disableNotification,isStatusMessage:!!t.isStatusMessage,canIncludeExpansion:!!t.canIncludeExpansion,expansion:t.canIncludeExpansion?t.expansion:null,receivedStatus:gn.UNREAD,pushConfig:t.pushConfig,channelId:t.channelId}},kd=function(n){function e(t,r,i){var o=n.call(this,t,r,i)||this;return o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o._connectedTime=0,o._localConnectedTime=0,o._pullingMsg=!1,o._pullQueue=[],o._chrmsQueue={},o._latestSyncTimestamp=0,o._intervalTimer=-1,o._letterbox=new Ed(t,i.appkey),o._sendMessageStore=new Pd(t,i.appkey),o._chrmEntryHandler=new yd(o),o}return Re(e,n),e.prototype._createNavi=function(){return new Md(this.runtime,this._options)},e.prototype.getConnectedTime=function(){return this._connectedTime},e.prototype.connect=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d,l=this;return x(this,function(h){switch(h.label){case 0:return i=[],this._naviInfo=r,r.server?i.push(r.server):j.warn("navi.server is invalid"),(o=r.backupServer)&&o.split(",").forEach(function(a){i.indexOf(a)<0&&i.push(a)}),i.length===0?(j.error("navi invaild.",i),[2,S.UNKNOWN]):(s=this.runtime.createDataChannel({status:function(a){l._connectionStatusHandler(a,t,i,r.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),u=Et.V3,r.openAnti===1&&(u=Et.V4),[4,s.connect(this._appkey,t,i,r.protocol,this._apiVer,u)]);case 1:return(d=h.sent())===S.SUCCESS?(this._channel=s,this.currentUserId=s.userId,this._connectedTime=s.connectedTime,this._localConnectedTime=Math.floor((Date.now()+s.sendConnectTime)/2),this._watcher.status(ee.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new Nd(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new wd(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new Ad(this),this._joinedChrmManager=new Td(this.runtime,this._appkey,this.currentUserId,r.joinMChrm),this._startSyncInterval()):s.close(),[2,d]}})})},e.prototype._connectionStatusHandler=function(t,r,i,o){if(j.warn("connection status changed:",t),t!==ee.CONNECTING)if(t!==ee.CONNECTED){if(this._channel&&t!==ee.DISCONNECTED)return t===ee.BLOCKED||t===ee.KICKED_OFFLINE_BY_OTHER_CLIENT||t===ee.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(t)):void(t!==ee.REDIRECT?(this._watcher.status(t),this._try2Reconnect(r,i,o)):this._watcher.status(t));this._watcher.status(t)}else this._watcher.status(t);else this._watcher.status(t)},e.prototype._try2Reconnect=function(t,r,i){return D(this,void 0,void 0,function(){var o,s=this;return x(this,function(u){switch(u.label){case 0:return this._channel?(o=Et.V3,this._naviInfo.openAnti===1&&(o=Et.V4),[4,this._channel.connect(this._appkey,t,r,i,this._apiVer,o)]):[2];case 1:return u.sent()===S.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(ee.CONNECTED),this._rejoinChrm(),j.__insertLogIntoDatabase(),[2]):(this._watcher.status(ee.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout(function(){s._reconnectTimer=-1,s._try2Reconnect(t,r,i)},5e3),[2])}})})},e.prototype._signalHandler=function(t,r){var i=t.syncMsg,o=t.topic;if(i)this._receiveSyncMsg(t,r);else{var s=U[o];if(s)switch(s){case U.s_ntf:j.info("recv s_ntf -> signal.messageId: "+t.messageId),this._pullMsg(t);break;case U.s_msg:this._receiveMsg(t);break;case U.s_cmd:this._receiveStateNotify(t);break;case U.s_us:this._receiveSettingNotify(t);break;case U.rtc_ntf:this._receiveRtcKv(t)}else j.error("unknown topic:",o)}},e.prototype._receiveStateNotify=function(t){var r,i=(r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(t.data,ur),o=i.time,s=i.type,u=i.chrmId;switch(s){case 2:this._chrmEntryHandler.pullEntry(u,o);break;case 3:this._conversationManager.startPullConversationStatus(o);break;case 4:this._chrmEntryHandler.reset(u),this._watcher.chatroom({chatroomDestroyed:t.targetId})}},e.prototype._receiveSettingNotify=function(t){var r,i=((r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(t.data,kr)).version;this._userSettingManager.pullUserSettings(i)},e.prototype._receiveRtcKv=function(t){var r,i=(r=this._channel)===null||r===void 0?void 0:r.codec.decodeByPBName(t.data,Lo),o=i.time,s=i.type,u=i.roomId;switch(s){case 1:this._rtcKVManager.pullEntry(u,o)}},e.prototype._receiveMessageExpansion=function(t){var r=t.content,i=r.put,o=r.del,s=r.mid;i&&this._watcher.expansion({updatedExpansion:{messageUId:s,expansion:i}}),o&&this._watcher.expansion({deletedExpansion:{messageUId:s,deletedKeys:o}})},e.prototype._receiveSyncMsg=function(t,r){var i;if(Ld.includes(t.topic)){var o=(i=this._channel)===null||i===void 0?void 0:i.codec.decodeByPBName(t.data,_n,{currentUserId:this.currentUserId,signal:t});o=this._handleMsgProperties(o),r&&(o.sentTime=r.timestamp,o.messageUId=r.messageUId),this._pullingMsg?this._pullQueue.push((r==null?void 0:r.timestamp)||o.sentTime):(r&&this._sendMessageStore.setMessage(r.messageUId,r.timestamp),o.messageType!==Ae.EXPANSION_NOTIFY?(o.messageType===Ae.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(o.conversationType,o.targetId,o.channelId),this._conversationManager.setConversationCacheByMessage(o,!0),this._watcher.batchMessage([o])):this._receiveMessageExpansion(o))}},e.prototype._pullMsg=function(t){if(this._channel){var r=this._channel.codec.decodeByPBName(t.data,ur),i=r.type,o=r.chrmId,s=r.time;if(j.info("s_ntf -> type: "+i+", chrmId: "+o+", time: "+s),i===2){var u=this._chrmsQueue[o];if(!u)return;u.queue.push(s),this._pullChrmMsg(o)}else this._pullQueue.push(s),this._syncMsg()}},e.prototype._startSyncInterval=function(){var t=this;this._stopSyncInterval(),this._intervalTimer=setInterval(function(){Date.now()-t._latestSyncTimestamp>=18e4&&t._syncMsg()},3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},e.prototype._stopSyncInterval=function(){this._intervalTimer!==-1&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},e.prototype._syncMsg=function(){return D(this,void 0,void 0,function(){var t,r,i,o,s,u,d,l,h,a,c,p,f,m,_=this;return x(this,function(v){switch(v.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,t=this._letterbox.getOutboxTime(this.currentUserId),r=this._letterbox.getInboxTime(this.currentUserId),j.info("pullMsg -> sendboxTime: "+t+", inboxTime: "+r),i=this._channel.codec.encodeSyncMsg({sendboxTime:t,inboxTime:r}),o=new W(U[U.pullMsg],i,this.currentUserId),[4,this._channel.send(o,vn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=v.sent(),u=s.code,d=s.data,this._latestSyncTimestamp=Date.now(),u===S.SUCCESS&&d?(l=d.list,h=d.finished,a=d.syncTime,j.info("pullMsg success -> syncTime: "+a+", finished: "+h),c=0,p=[],l.forEach(function(R){if(R.messageDirection===je.SEND&&(c=Math.max(R.sentTime,c),_._sendMessageStore.getSendMessageMap()[R.messageUId]))return void _._sendMessageStore.removeByUID(R.messageUId);if(R.messageType!==Ae.EXPANSION_NOTIFY){if(R.messageType===Ae.SYNC_READ_STATUS){if(R.senderUserId!==_.currentUserId)return;_._conversationManager.clearUnreadCount(R.conversationType,R.targetId,R.channelId)}var C=_._handleMsgProperties(R);_._conversationManager.setConversationCacheByMessage(C,!0),p.push(C)}else _._receiveMessageExpansion(R)}),this._watcher.batchMessage(p),this._letterbox.setInboxTime(a,this.currentUserId),this._letterbox.setOutboxTime(c,this.currentUserId),this._sendMessageStore.removeByTimestamp(c),this._pullingMsg=!1,f=this._pullQueue.filter(function(R){return R>a}),this._pullQueue.length=0,(m=this._pullQueue).push.apply(m,f),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!h||f.length>0)&&this._syncMsg(),[2]):(j.warn("pullMsg failed -> code:",u,", data: ",d),this._pullingMsg=!1,[2])}})})},e.prototype._receiveMsg=function(t){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var r=this._channel.codec.decodeByPBName(t.data,wr,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});(r=this._handleMsgProperties(r)).senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(r.messageUId,r.sentTime),r.isStatusMessage||r.senderUserId===this.currentUserId||this._letterbox.setInboxTime(r.sentTime,this.currentUserId),r.messageType!==Ae.EXPANSION_NOTIFY?r.messageType===Ae.SYNC_READ_STATUS&&r.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(r,!0),this._watcher.batchMessage([r])):this._receiveMessageExpansion(r)}},e.prototype._handleMsgProperties=function(t,r){r===void 0&&(r=!1);var i,o=t.messageType,s=t.isCounted,u=t.isPersited,d=t.isStatusMessage,l=o in is,h=o in this._customMessageType;if(i=l?is[o]:h?this._customMessageType[o]:{isCounted:!as(s)&&s,isPersited:!as(u)&&u},Object.assign(t,{isCounted:i.isCounted,isPersited:i.isPersited,isStatusMessage:Pu.includes(o)}),r&&(t.isStatusMessage=d),!r){var a=t.content.user;if(a){var c=a.portrait,p=a.portraitUri,f=c||p;f&&(a.portrait=a.portraitUri=f)}}return t},e.prototype.getHistoryMessage=function(t,r,i,o,s,u){return u===void 0&&(u=""),D(this,void 0,void 0,function(){var d,l,h,a,c,p,f,m,_;return x(this,function(v){switch(v.label){case 0:return l=(d=this).currentUserId,h=d._channel,a=pd[t]||Va,c=o===1&&i===0,h?(p=h.codec.encodeGetHistoryMsg(r,{timestamp:i,count:c?2:o,order:s,channelId:u}),[4,h.send(new W(a,p,l),Rn,{currentUserId:l,connectedTime:h.connectedTime,conversation:{targetId:r}})]):[3,2];case 1:return f=v.sent(),(m=f.code)!==S.SUCCESS?[2,{code:m}]:(_=f.data,c&&_.list.length===2&&(_.hasMore=!0,s===0?_.list.shift():_.list.pop()),[2,{code:m,data:{list:_.list,hasMore:_.hasMore}}]);case 2:return[2,{code:S.RC_NET_CHANNEL_INVALID}]}})})},e.prototype.reportSDKInfo=function(t){var r=this.currentUserId,i=this._channel;if(i){j.debug("reportSDKInfo ->",t);var o=i.codec.encodeReportSDKInfo(JSON.stringify(t)),s=new W(U[U.reportsdk],o,r);i.send(s).then(function(u){var d=u.code;d!==S.SUCCESS&&j.warn("reportSDKInfo failed -> code: "+d)})}},e.prototype.deleteRemoteMessage=function(t,r,i,o){return D(this,void 0,void 0,function(){var s,u,d,l,h,a,c;return x(this,function(p){switch(p.label){case 0:return u=(s=this).currentUserId,(d=s._channel)?(l=d.codec.encodeDeleteMessages(t,r,i,o),h=new W(Xu,l,u),[4,d.send(h)]):[3,2];case 1:return a=p.sent(),c=a.code,S.SUCCESS,[2,c];case 2:return[2,S.RC_NET_CHANNEL_INVALID]}})})},e.prototype.deleteRemoteMessageByTimestamp=function(t,r,i,o){return D(this,void 0,void 0,function(){var s,u,d,l,h,a,c,p;return x(this,function(f){switch(f.label){case 0:return u=(s=this).currentUserId,(d=s._channel)?(l=d.codec.encodeClearMessages(r,i,o),h=fd[t],a=new W(h,l,u),[4,d.send(a)]):[3,2];case 1:return c=f.sent(),p=c.code,S.SUCCESS,[2,p];case 2:return[2,S.RC_NET_CHANNEL_INVALID]}})})},e.prototype.getConversationList=function(t,r,i,o,s){return t===void 0&&(t=300),D(this,void 0,void 0,function(){var u,d,l,h,a,c,p,f,m=this;return x(this,function(_){switch(_.label){case 0:return d=(u=this).currentUserId,l=u._channel,r=r||J.PRIVATE,l?(h=l.codec.encodeOldConversationList({count:t,type:r,startTime:i,order:o}),a=new W(Es,h,d),[4,l.send(a,En,{currentUserId:d,connectedTime:l.connectedTime,afterDecode:function(v){var R=v.conversationType,C=v.targetId,M=v.channelId,A=m._conversationManager.get(R,C,M);return Object.assign(v,A),v}})]):[3,2];case 1:return c=_.sent(),p=c.code,f=c.data,p!==S.SUCCESS?[2,{code:p}]:[2,{code:p,data:f}];case 2:return[2,{code:S.RC_NET_CHANNEL_INVALID}]}})})},e.prototype.removeConversation=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l;return x(this,function(h){switch(h.label){case 0:return(o=this._channel)?(s=o.codec.encodeRemoveOldConversationList({conversationType:t,channelId:i,targetId:r}),u=new W(ad,s,r),[4,o.send(u)]):[3,2];case 1:return d=h.sent(),j.info("RemoveConversation =>",d),l=d.code,S.SUCCESS,[2,l];case 2:return[2,S.RC_NET_CHANNEL_INVALID]}})})},e.prototype.getConversation=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l,h;return x(this,function(a){switch(a.label){case 0:return(o=this._conversationManager.get(t,r,i))?[4,this.getHistoryMessage(t,r,0,1,0)]:[2,{code:S.CONVER_GET_ERROR}];case 1:return s=a.sent(),u=s.code,d=s.data,u!==S.SUCCESS?[2,{code:S.CONVER_GET_ERROR}]:(l=(d==null?void 0:d.list[0])||null,h={conversationType:t,targetId:r,channelId:i,unreadMessageCount:o.unreadMessageCount||0,latestMessage:l,notificationStatus:o.notificationStatus||Pt.CLOSE,isTop:o.isTop||!1,lastUnreadTime:o.lastUnreadTime||0,unreadMentionedCount:o.unreadMentionedCount||0},[2,{code:S.SUCCESS,data:h}])}})})},e.prototype.getAllConversationUnreadCount=function(t,r,i){var o=this._conversationManager.getAllUnreadCount(t,r,i);return Promise.resolve({code:S.SUCCESS,data:o})},e.prototype.getConversationUnreadCount=function(t,r,i){var o=this._conversationManager.getUnreadCount(t,r,i);return Promise.resolve({code:S.SUCCESS,data:o})},e.prototype.clearConversationUnreadCount=function(t,r,i){return this._conversationManager.clearUnreadCount(t,r,i,!1),Promise.resolve(S.SUCCESS)},e.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(S.SUCCESS)},e.prototype.getFirstUnreadMessage=function(t,r){throw new Error("Method not implemented.")},e.prototype.saveConversationMessageDraft=function(t,r,i,o){return this._conversationManager.setDraft(t,r,i,o),Promise.resolve(S.SUCCESS)},e.prototype.getConversationMessageDraft=function(t,r,i){var o=this._conversationManager.getDraft(t,r,i);return Promise.resolve({code:S.SUCCESS,data:o})},e.prototype.clearConversationMessageDraft=function(t,r,i){return this._conversationManager.clearDraft(t,r,i),Promise.resolve(S.SUCCESS)},e.prototype.pullConversationStatus=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u,d,l,h;return x(this,function(a){switch(a.label){case 0:return i=(r=this)._channel,o=r.currentUserId,i?(s=i.codec.encodeGetConversationStatus(t),u=new W(U[U.pullSeAtts],s,o),[4,i.send(u,Ur)]):[3,2];case 1:return d=a.sent(),l=d.code,h=d.data,l!==S.SUCCESS?[2,{code:l}]:[2,{code:l,data:h}];case 2:return[2,{code:S.RC_NET_CHANNEL_INVALID}]}})})},e.prototype.batchSetConversationStatus=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u,d,l,h,a,c=this;return x(this,function(p){switch(p.label){case 0:return i=(r=this).currentUserId,(o=r._channel)?(s=o.codec.encodeSetConversationStatus(t),u=new W(cd,s,i),[4,o.send(u,No)]):[3,2];case 1:return d=p.sent(),l=d.code,h=d.data,l===S.SUCCESS?(a=h,t.forEach(function(f){c._conversationManager.addStatus(fe(fe({},f),{updatedTime:a.version}),!0)}),[2,l]):[2,l];case 2:return[2,S.RC_NET_CHANNEL_INVALID]}})})},e.prototype._joinChrm=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l,h,a;return x(this,function(c){switch(c.label){case 0:return(o=this._channel)?(s=o.codec.encodeJoinOrQuitChatRoom(),u=new W(i?td:ed,s,t),[4,o.send(u,so)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return d=c.sent(),l=d.code,h=d.data,l===S.SUCCESS&&(a=h.joinTime,this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,r,a),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,r)),[2,l]}})})},e.prototype._rejoinChrm=function(){return D(this,void 0,void 0,function(){var t,r,i,o,s,u;return x(this,function(d){switch(d.label){case 0:for(i in t=this._joinedChrmManager.get(),r=[],t)r.push(i);o=0,d.label=1;case 1:return o<r.length?(s=r[o],[4,this._joinChrm(s,t[s]||10,!0)]):[3,4];case 2:(u=d.sent())===S.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:s,count:t[s]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:s,errorCode:u}}),d.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype._pullChrmMsg=function(t,r,i){return r===void 0&&(r=10),i===void 0&&(i=0),D(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p,f,m,_;return x(this,function(v){switch(v.label){case 0:return this._channel?(o=this._chrmsQueue[t],s=o.pulling,u=o.timestamp,s?[2]:(o.pulling=!0,d=this._channel.codec.encodeChrmSyncMsg(u,r),l=new W(U[U.chrmPull],d,t),[4,this._channel.send(l,vn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return h=v.sent(),a=h.code,c=h.data,o.pulling=!1,a===S.SUCCESS&&c?(p=c.list,f=c.syncTime,m=c.finished,o.timestamp=i?Math.max(f,i):f,o.queue=o.queue.filter(function(R){return R>f}),_=[],p.forEach(function(R){R.sentTime<u||_.push(R)}),this._watcher.batchMessage(_),(!m||o.queue.length>0)&&this._pullChrmMsg(t),[2]):(j.warn("pull chatroom msg failed, code:",a,", data:",c),[2])}})})},e.prototype.joinChatroom=function(t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return[2,this._joinChrm(t,r,!1)]})})},e.prototype.joinExistChatroom=function(t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return[2,this._joinChrm(t,r,!0)]})})},e.prototype.quitChatroom=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u;return x(this,function(d){switch(d.label){case 0:return(r=this._channel)?(i=r.codec.encodeJoinOrQuitChatRoom(),o=new W(nd,i,t),[4,r.send(o)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return s=d.sent(),(u=s.code)===S.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),[2,u]}})})},e.prototype.getChatroomInfo=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l,h;return x(this,function(a){switch(a.label){case 0:return(o=this._channel)?(s=o.codec.encodeGetChatRoomInfo(r,i),u=new W(U[U.queryChrmI],s,t),[4,o.send(u,Mr)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return d=a.sent(),l=d.code,h=d.data,l!==S.SUCCESS?[2,{code:l}]:[2,{code:l,data:h}]}})})},e.prototype.getChatroomHistoryMessages=function(t,r,i,o){return D(this,void 0,void 0,function(){var s,u,d,l,h,a;return x(this,function(c){switch(c.label){case 0:return(s=this._channel)?(u=s.codec.encodeGetHistoryMsg(t,{timestamp:r,count:i,order:o}),d=new W(Ba,u,t),[4,s.send(d,Rn,{conversation:{targetId:t}})]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return l=c.sent(),h=l.code,a=l.data,h!==S.SUCCESS?[2,{code:h}]:[2,{code:h,data:{list:a.list,hasMore:a.hasMore}}]}})})},e.prototype._modifyChatroomKV=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a;return x(this,function(c){switch(c.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(u=o.codec.encodeModifyChatRoomKV(t,r,s),d=r.type===xe.UPDATE?rd:id,l=new W(d,u,t),[4,o.send(l)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return h=c.sent(),(a=h.code)===S.SUCCESS?(this._chrmEntryHandler.setLocal(t,{kvEntries:[r],syncTime:new Date().getTime()},s),[2,a]):[2,a]}})})},e.prototype._modifyChatroomKVS=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a,c,p,f,m;return x(this,function(_){switch(_.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(u=o.codec.encodeModifyChatRoomKVS(t,r,s),d=r.type===xe.UPDATE?od:sd,l=new W(d,u,t),[4,o.send(l,So)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return h=_.sent(),a=h.code,[S.SUCCESS,S.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(a)!==-1&&(p=[],delete(f=Object.assign({},r)).entries,r.entries.forEach(function(v){p.push(Object.assign({},v,f))}),a===S.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(m=h.data,j.warn("\u8BBE\u7F6E\u5931\u8D25\u7684\u5C5E\u6027\uFF1A",m.errorKeys),c=m.errorKeys,m&&Array.isArray(m.errorKeys)&&m.errorKeys.forEach(function(v){var R=p.findIndex(function(C){return v.key===C.key});R!==-1&&p.splice(R,1)})),j.warn("\u8BBE\u7F6E\u6210\u529F\u7684\u5C5E\u6027\uFF1A",p),this._chrmEntryHandler.setLocal(t,{kvEntries:p,syncTime:new Date().getTime()},s)),[2,{code:a,data:c}]}})})},e.prototype.setChatroomEntry=function(t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return r.type=xe.UPDATE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(t,r)]})})},e.prototype.setChatroomEntries=function(t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return r.type=xe.UPDATE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,r)]})})},e.prototype.forceSetChatroomEntry=function(t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return r.type=xe.UPDATE,r.isOverwrite=!0,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(t,r)]})})},e.prototype.removeChatroomEntry=function(t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return r.type=xe.DELETE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(t,r)]})})},e.prototype.removeChatroomEntries=function(t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return r.type=xe.DELETE,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,r)]})})},e.prototype.forceRemoveChatroomEntry=function(t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return r.type=xe.DELETE,r.isOverwrite=!0,r.userId=r.userId||this.currentUserId,[2,this._modifyChatroomKV(t,r)]})})},e.prototype.getChatroomEntry=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d,l,h;return x(this,function(a){switch(a.label){case 0:return(i=this._chrmEntryHandler.getValue(t,r))?[2,Promise.resolve({code:S.SUCCESS,data:i})]:[3,1];case 1:return(o=this._channel)?(s=o.codec.encodePullChatRoomKV(0),u=new W(U[U.pullKV],s,t),[4,o.send(u,Dt)]):[2,Promise.reject({code:S.RC_NET_CHANNEL_INVALID})];case 2:return d=a.sent(),(l=d.data||{})&&l.kvEntries&&l.kvEntries.length&&(h=l.kvEntries.find(function(c){return c.key===r}))!==void 0?[2,Promise.resolve({code:S.SUCCESS,data:h==null?void 0:h.value})]:[2,Promise.resolve({code:S.CHATROOM_KEY_NOT_EXIST})]}})})},e.prototype.getAllChatroomEntry=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u,d,l;return x(this,function(h){switch(h.label){case 0:return(r=this._chrmEntryHandler.getAll(t))&&Object.keys(r).length?[2,Promise.resolve({code:S.SUCCESS,data:r})]:[3,1];case 1:return(i=this._channel)?(o={},s=i.codec.encodePullChatRoomKV(0),u=new W(U[U.pullKV],s,t),[4,i.send(u,Dt)]):[2,Promise.reject({code:S.RC_NET_CHANNEL_INVALID})];case 2:return d=h.sent(),(l=d.data||{})&&l.kvEntries&&l.kvEntries.length&&l.kvEntries.forEach(function(a){a.key&&(o[a.key]=a.value||"")}),[2,Promise.resolve({code:S.SUCCESS,data:o})]}})})},e.prototype.pullChatroomEntry=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a,c,p;return x(this,function(f){switch(f.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(u=o.codec.encodePullChatRoomKV(r),d=new W(U[U.pullKV],u,t),[4,o.send(d,Dt)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return l=f.sent(),h=l.code,a=l.data,h===S.SUCCESS?(j.info("Pull success ChrmKV, "+JSON.stringify(l)),this._chrmEntryHandler.setLocal(t,a,s),j.info("Save into cache success!"),c=a.kvEntries,p=[],c.length>0&&(c.forEach(function(m){var _=m.key,v=m.value,R=m.type,C=m.timestamp;p.push({key:_,value:v,type:R,timestamp:C,chatroomId:t})}),this._watcher.chatroom({updatedEntries:p})),[2,{code:h,data:a}]):[2,{code:h}]}})})},e.prototype.sendMessage=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p,f;return x(this,function(m){switch(m.label){case 0:return this._channel?(i=function(_,v){return _.messageType==="RC:SRSMsg"&&Object.assign(_,{directionalUserIdList:[v]}),_}(i,this.currentUserId),i=this._handleMsgProperties(i,!0),o=!![J.PRIVATE,J.GROUP].includes(t)&&i.isStatusMessage,s=o?function(_){var v;return(v={},v[J.PRIVATE]=U.ppMsgS,v[J.GROUP]=U.pgMsgS,v)[_]}(t):function(_){var v;return(v={},v[J.PRIVATE]=U.ppMsgP,v[J.GROUP]=U.pgMsgP,v[J.CHATROOM]=U.chatMsg,v[J.CUSTOMER_SERVICE]=U.pcMsgP,v[J.RTC_ROOM]=U.prMsgS,v)[_]}(t)||U.ppMsgP,o&&(i.isPersited=!1,i.isCounted=!1),u=this._channel.codec.encodeUpMsg({conversationType:t,targetId:r},i),(d=new Zt(U[s],u,r)).setHeaderQos(it.AT_LEAST_ONCE),o?(this._channel.sendOnly(d),[2,{code:S.SUCCESS,data:ei(t,r,fe({},i),"",0,this.currentUserId)}]):(l=Date.now()-this._localConnectedTime+this._connectedTime,h=ei(t,r,fe({},i),"",l,this.currentUserId),[4,this._channel.send(d)])):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return a=m.sent(),c=a.code,p=a.data,c!==S.SUCCESS?[2,{code:c,data:h}]:(f=p,this._sendMessageStore.setMessage(f.messageUId,f.timestamp),h.sentTime=f.timestamp,h.messageUId=f.messageUId,this._conversationManager.setConversationCacheByMessage(h,!0),[2,{code:S.SUCCESS,data:h}])}})})},e.prototype.recallMsg=function(t,r,i,o,s){var u;return D(this,void 0,void 0,function(){var d,l,h,a,c,p,f,m,_,v;return x(this,function(R){switch(R.label){case 0:return this._channel?(d=s.user,l={content:{conversationType:t,targetId:r,messageUId:i,sentTime:o,user:d},messageType:"RC:RcCmd",disableNotification:s==null?void 0:s.disableNotification,pushConfig:s==null?void 0:s.pushConfig,pushContent:((u=s.pushConfig)===null||u===void 0?void 0:u.pushContent)||s.pushContent||"",channelId:s.channelId},h=U[U.recallMsg],a=this._channel.codec.encodeUpMsg({conversationType:t,targetId:r},l),(c=new Zt(h,a,this.currentUserId)).setHeaderQos(it.AT_LEAST_ONCE),[4,this._channel.send(c)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return p=R.sent(),f=p.code,m=p.data,f!==S.SUCCESS?[2,{code:f}]:(_=m,this._sendMessageStore.setMessage(_.messageUId,_.timestamp),v=ei(t,r,fe(fe({},l),{isPersited:!0}),_.messageUId,_.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:S.SUCCESS,data:v}])}})})},e.prototype.sendReadReceiptMessage=function(t,r,i){return D(this,void 0,void 0,function(){var o,s;return x(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeReadReceipt(r,i),s=new W(U[U.rrMsg],o,t),[4,this._channel.send(s)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return[2,u.sent()]}})})},e.prototype.getMessageReader=function(t,r,i){return D(this,void 0,void 0,function(){var o,s;return x(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeMessageReader(r,i),s=new W(U[U.rrList],o,t),[4,this._channel.send(s,Dr)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return[2,u.sent()]}})})},e.prototype.pullUserSettings=function(t){return D(this,void 0,void 0,function(){var r,i;return x(this,function(o){return this._channel?(r=this._channel.codec.encodePullUserSetting(t),i=new W(U[U.pullUS],r,this.currentUserId),[2,this._channel.send(i,Lr)]):[2,{code:S.RC_NET_CHANNEL_INVALID}]})})},e.prototype.getFileToken=function(t,r,i,o){return D(this,void 0,void 0,function(){var s,u,d,l,h,a;return x(this,function(c){switch(c.label){case 0:return this._channel?(s=o&&o!=="uploads"?r||"":Bu(t,r),u=this._channel.codec.encodeGetFileToken(t,s,i||"",o||""),d=new W(U[U.qnTkn],u,this.currentUserId),[4,this._channel.send(d,_o)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return l=c.sent(),h=l.code,a=l.data,a=Object.assign(a,{fileName:s}),h===S.SUCCESS?[2,{code:h,data:a}]:[2,{code:h}]}})})},e.prototype.getFileUrl=function(t,r,i,o){return D(this,void 0,void 0,function(){var s,u,d,l,h,a,c,p,f;return x(this,function(m){switch(m.label){case 0:return this._channel?(s="",u="",d="",r===Ue.QINIU?(u=vo,d=Eo):(u=Ro,d=Co),s=r===Ue.QINIU?U[U.qnUrl]:r===Ue.AWS?U[U.s3Url]:r===Ue.STC?U[U.stcUrl]:U[U.aliUrl],l=this._channel.codec.encodeGetFileUrl(u,t,i,o),h=new W(s,l,this.currentUserId),[4,this._channel.send(h,d)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return a=m.sent(),c=a.code,p=a.data,f=p,c===S.SUCCESS?[2,{code:c,data:f}]:[2,{code:c}]}})})},e.prototype.disconnect=function(){this._reconnectTimer!==-1&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._pullQueue.length=0,this._stopSyncInterval()},e.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},e.prototype.registerMessageType=function(t,r,i,o){this._customMessageType[t]={isPersited:r,isCounted:i}},e.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},e.prototype.getCurrentUserId=function(){return this.currentUserId},e.prototype.createTag=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u,d,l;return x(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeCreateTag([t],r),o=new W(U[U.addSeTag],i,this.currentUserId),[4,this._channel.send(o,xt)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),u=s.code,d=s.data,u!==S.SUCCESS?[2,{code:u}]:(l=d.version,this._userSettingManager.addTag([fe(fe({},t),{createdTime:l})],l),[2,{code:S.SUCCESS,data:d}])}})})},e.prototype.removeTag=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u,d,l;return x(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeRemoveTag([t],r),o=new W(U[U.delSeTag],i,this.currentUserId),[4,this._channel.send(o,xt)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),u=s.code,d=s.data,u!==S.SUCCESS?[2,{code:u}]:(l=d.version,this._userSettingManager.deleteTag([t],l),[2,{code:S.SUCCESS}])}})})},e.prototype.updateTag=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u,d,l;return x(this,function(h){switch(h.label){case 0:return this._channel?(r=this._userSettingManager.getVersion(),i=this._channel.codec.encodeCreateTag([t],r),o=new W(U[U.addSeTag],i,this.currentUserId),[4,this._channel.send(o,xt)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return s=h.sent(),u=s.code,d=s.data,u!==S.SUCCESS?[2,{code:u}]:(l=d.version,this._userSettingManager.addTag([t],l),[2,{code:S.SUCCESS,data:d}])}})})},e.prototype.getTagList=function(){return D(this,void 0,void 0,function(){var t,r;return x(this,function(i){return t=this._userSettingManager.getTags(),r=this._conversationManager.getConversationListForTag(),t.forEach(function(o){o.conversationCount=r[o.tagId]?r[o.tagId].length:0}),[2,{code:S.SUCCESS,data:t}]})})},e.prototype.addTagForConversations=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d=this;return x(this,function(l){switch(l.label){case 0:return this._channel?this._userSettingManager.getTagById(t)?(i=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],r),o=new W(U[U.addTag],i,this.currentUserId),[4,this._channel.send(o)]):[2,{code:S.TAG_NOT_EXIST}]:[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return(s=l.sent().code)!==S.SUCCESS?[2,{code:s}]:((u={})[t]={},r.forEach(function(h){d._conversationManager.addTagStatus(h.conversationType,h.targetId,u,h.channelId)}),[2,{code:S.SUCCESS}])}})})},e.prototype.removeTagForConversations=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u=this;return x(this,function(d){switch(d.label){case 0:return this._channel?(i=this._channel.codec.encodeUpdateConversationTag([{tagId:t}],r),o=new W(U[U.delTag],i,this.currentUserId),[4,this._channel.send(o)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return(s=d.sent().code)!==S.SUCCESS?[2,{code:s}]:(r.forEach(function(l){u._conversationManager.deleteTagStatus(l.conversationType,l.targetId,[t],l.channelId)}),[2,{code:S.SUCCESS}])}})})},e.prototype.removeTagsForConversation=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d,l,h;return x(this,function(a){switch(a.label){case 0:return this._channel?(i=t.conversationType,o=t.targetId,s=t.channelId,u=r.map(function(c){return{tagId:c}}),d=this._channel.codec.encodeUpdateConversationTag(u,[t]),l=new W(U[U.delTag],d,this.currentUserId),[4,this._channel.send(l)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return(h=a.sent().code)!==S.SUCCESS?[2,{code:h}]:(this._conversationManager.deleteTagStatus(i,o,r,s),[2,{code:S.SUCCESS}])}})})},e.prototype.getConversationListByTag=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p;return x(this,function(f){switch(f.label){case 0:return s=(o=this).currentUserId,(u=o._channel)?(d=u.codec.encodeOldConversationList({count:i,type:J.PRIVATE,startTime:r}),l=new W(Es,d,s),[4,u.send(l,En,{currentUserId:s,connectedTime:u.connectedTime})]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return h=f.sent(),a=h.code,c=h.data,p=this._conversationHasTagFilter(t,c),j.info("GetConversationListByTag",p),a!==S.SUCCESS?[2,{code:a}]:[2,{code:a,data:p}]}})})},e.prototype._conversationHasTagFilter=function(t,r){var i=this,o=[],s=[];function u(d,l){return d.latestMessage&&l.latestMessage?d.latestMessage.sentTime-l.latestMessage.sentTime:0}return r.forEach(function(d){var l=d.conversationType,h=d.targetId,a=d.channelId,c=i._conversationManager.get(l,h,a),p=c.hasMentioned,f=c.mentionedInfo,m=c.lastUnreadTime,_=c.notificationStatus,v=c.isTop,R=c.tags,C=c.unreadMessageCount,M=R&&R[t];if(M){var A=fe(fe({},d),{hasMentioned:p,mentionedInfo:f,lastUnreadTime:m,notificationStatus:_,isTop:v,unreadMessageCount:C});M.isTop?o.push(fe(fe({},A),{isTopInTag:!0})):s.push(fe(fe({},A),{isTopInTag:!1}))}}),yt(yt([],o.sort(u)),s.sort(u))},e.prototype.getUnreadCountByTag=function(t,r){return D(this,void 0,void 0,function(){var i;return x(this,function(o){return this._channel?(i=this._conversationManager.getUnreadCountByTag(t,r),[2,{code:S.SUCCESS,data:i}]):[2,{code:S.RC_NET_CHANNEL_INVALID}]})})},e.prototype.setConversationStatusInTag=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c,p,f;return x(this,function(m){switch(m.label){case 0:return this._channel?(o=r.targetId,s=r.conversationType,u=r.channelId,d=i.isTop,l=[{tagId:t,isTop:d}],(h=this._conversationManager.get(s,o,u)).tags&&Object.hasOwnProperty.call(h.tags,t)?(a=this._channel.codec.encodeUpdateConversationTag(l,[r]),c=new W(U[U.addTag],a,this.currentUserId),[4,this._channel.send(c)]):[2,{code:S.NO_TAG_IN_CONVER}]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return(p=m.sent().code)!==S.SUCCESS?[2,{code:p}]:((f={})[t]={},d&&(f[t].isTop=!0),this._conversationManager.addTagStatus(s,o,f,u),[2,{code:S.SUCCESS}])}})})},e.prototype.getTagsForConversation=function(t){var r;return D(this,void 0,void 0,function(){var i,o,s,u;return x(this,function(d){if(!this._channel)return[2,{code:S.RC_NET_CHANNEL_INVALID}];if(i=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),o=this._userSettingManager.getTagsInfo(),s=[],i.tags)for(u in i.tags)s.push({tagId:u,tagName:(r=o[u])===null||r===void 0?void 0:r.tagName});return[2,{code:S.SUCCESS,data:s}]})})},e.prototype.getBlockConversationList=function(){var t=this._conversationManager.getBlockConversationList();return Promise.resolve({code:S.SUCCESS,data:t})},e.prototype.getTopConversationList=function(){var t=this._conversationManager.getTopConversationList();return Promise.resolve({code:S.SUCCESS,data:t})},e.prototype.getUnreadMentionedCount=function(t){var r=this._conversationManager.getUnreadMentionedCount(t.channelId,t.conversationType,t.targetId);return Promise.resolve({code:S.SUCCESS,data:r})},e.prototype.getAllUnreadMentionedCount=function(){var t=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:S.SUCCESS,data:t})},e.prototype.joinRTCRoom=function(t,r,i,o){return D(this,void 0,void 0,function(){var s,u;return x(this,function(d){return this._channel?(s=this._channel.codec.encodeJoinRTCRoom(r,i,o),u=new W(U[U.rtcRJoin_data],s,t),[2,this._channel.send(u,Ct)]):[2,{code:S.RC_NET_CHANNEL_INVALID}]})})},e.prototype.quitRTCRoom=function(t){return D(this,void 0,void 0,function(){var r,i;return x(this,function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeQuitRTCRoom(),i=new W(U[U.rtcRExit],r,t),[4,this._channel.send(i)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}})})},e.prototype.rtcPing=function(t,r,i){return D(this,void 0,void 0,function(){var o,s;return x(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new W(U[U.rtcPing],o,t),[4,this._channel.send(s)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,u.sent().code]}})})},e.prototype.getRTCRoomInfo=function(t){return D(this,void 0,void 0,function(){var r,i;return x(this,function(o){return this._channel?(r=this._channel.codec.encodeGetRTCRoomInfo(),i=new W(U[U.rtcRInfo],r,t),[2,this._channel.send(i,wa)]):[2,{code:S.RC_NET_CHANNEL_INVALID}]})})},e.prototype.getRTCUserInfoList=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u;return x(this,function(d){switch(d.label){case 0:return this._channel?(r=this._channel.codec.encodeGetRTCRoomInfo(),i=new W(U[U.rtcUData],r,t),[4,this._channel.send(i,Ct)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return o=d.sent(),s=o.code,u=o.data,[2,{code:s,data:u&&{users:u.users}}]}})})},e.prototype.setRTCUserInfo=function(t,r,i){return D(this,void 0,void 0,function(){var o,s;return x(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeSetRTCUserInfo(r,i),s=new W(U[U.rtcUPut],o,t),[4,this._channel.send(s)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,u.sent().code]}})})},e.prototype.removeRTCUserInfo=function(t,r){return D(this,void 0,void 0,function(){var i,o;return x(this,function(s){switch(s.label){case 0:return this._channel?(i=this._channel.codec.encodeRemoveRTCUserInfo(r),o=new Zt(U[U.rtcUDel],i,t),[4,this._channel.send(o)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,s.sent().code]}})})},e.prototype.setRTCData=function(t,r,i,o,s,u){return D(this,void 0,void 0,function(){var d,l;return x(this,function(h){switch(h.label){case 0:return this._channel?(d=this._channel.codec.encodeSetRTCData(r,i,o,s,u),l=new Zt(U[U.rtcSetData],d,t),[4,this._channel.send(l)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,h.sent().code]}})})},e.prototype.setRTCTotalRes=function(t,r,i,o,s){return D(this,void 0,void 0,function(){var u,d;return x(this,function(l){switch(l.label){case 0:return this._channel?(u=this._channel.codec.encodeUserSetRTCData(r,i,o,s),d=new W(U[U.userSetData],u,t),[4,this._channel.send(d)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,l.sent().code]}})})},e.prototype.setRTCCDNUris=function(t,r,i){return D(this,void 0,void 0,function(){var o,s;return x(this,function(u){switch(u.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCCDNUris(r,i),s=new W(U[U.userSetData],o,t),[4,this._channel.send(s)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,u.sent().code]}})})},e.prototype.getRTCData=function(t,r,i,o){if(!this._channel)return Promise.resolve({code:S.RC_NET_CHANNEL_INVALID});var s=this._channel.codec.encodeGetRTCData(r,i,o),u=new W(U[U.rtcQryData],s,t);return this._channel.send(u,Pr)},e.prototype.removeRTCData=function(t,r,i,o,s){return D(this,void 0,void 0,function(){var u,d;return x(this,function(l){switch(l.label){case 0:return this._channel?(u=this._channel.codec.encodeRemoveRTCData(r,i,o,s),d=new Zt(U[U.rtcDelData],u,t),[4,this._channel.send(d)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,l.sent().code]}})})},e.prototype.setRTCOutData=function(t,r,i,o){throw new Error("JSEngine's method not implemented.")},e.prototype.getRTCOutData=function(t,r){throw new Error("JSEngine's method not implemented.")},e.prototype.getRTCToken=function(t,r,i){return D(this,void 0,void 0,function(){var o,s;return x(this,function(u){return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new W(U[U.rtcToken],o,t),[2,this._channel.send(s,Ar)]):[2,{code:S.RC_NET_CHANNEL_INVALID}]})})},e.prototype.setRTCState=function(t,r){return D(this,void 0,void 0,function(){var i,o;return x(this,function(s){switch(s.label){case 0:return this._channel?(i=this._channel.codec.encodeSetRTCState(r),o=new W(U[U.rtcUserState],i,t),[4,this._channel.send(o)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return[2,s.sent().code]}})})},e.prototype.getRTCUserInfo=function(t){return D(this,void 0,void 0,function(){return x(this,function(r){throw new Error("Method not implemented.")})})},e.prototype.getRTCUserList=function(t){if(!this._channel)return Promise.resolve({code:S.RC_NET_CHANNEL_INVALID});var r=this._channel.codec.encodeGetRTCRoomInfo(),i=new W(U[U.rtcUList],r,t);return this._channel.send(i,Ct)},e.prototype.joinLivingRoomAsAudience=function(t,r,i){return r===void 0&&(r=Le.LIVE),D(this,void 0,void 0,function(){var o,s,u,d,l,h,a,c;return x(this,function(p){switch(p.label){case 0:return this._channel?(o=this._channel.codec.encodeJoinRTCRoom(r,i),s=new W(U[U.viewerJoinR],o,t),[4,this._channel.send(s,Da)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return u=p.sent(),d=u.code,l=u.data,d!==S.SUCCESS?[2,{code:d}]:(a=(h=l).rtcToken,c=h.entries,[2,{code:d,data:{token:a,kvEntries:c}}])}})})},e.prototype.quitLivingRoomAsAudience=function(t){return D(this,void 0,void 0,function(){var r,i,o;return x(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeQuitRTCRoom(),i=new W(U[U.viewerExitR],r,t),[4,this._channel.send(i)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.rtcIdentityChange=function(t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l;return x(this,function(h){switch(h.label){case 0:return this._channel?(o=this._channel.codec.encodeIdentityChangeInfo(r,i),s=new W(U[U.rtcIdentityChange],o,t),[4,this._channel.send(s,Ct)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return u=h.sent(),d=u.code,l=u.data,d!==S.SUCCESS?[2,{code:d}]:[2,{code:d,data:l}]}})})},e.prototype.pullRTCRoomEntry=function(t,r){return D(this,void 0,void 0,function(){var i,o,s,u,d,l,h,a,c;return x(this,function(p){switch(p.label){case 0:return o=(i=this)._channel,s=i.currentUserId,o?(j.info("audience in room start pull KV"),u=o.codec.encodePullRTCRoomKV(t,0),d=new W(U[U.rtcPullKv],u,s),[4,o.send(d,xr)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return l=p.sent(),h=l.code,a=l.data,j.info("audience in room end pull KV, code: "+h+", data: "+JSON.stringify(a||{})),h===S.SUCCESS?(c=a.kvEntries,this._watcher.onRTCDataChange(c,t),[2,{code:h,data:a}]):[2,{code:h}]}})})},e.prototype.getRTCJoinedUserInfo=function(t){return D(this,void 0,void 0,function(){var r,i,o,s,u,d,l,h;return x(this,function(a){switch(a.label){case 0:return i=(r=this)._channel,o=r.currentUserId,i?(s=i.codec.encodeQueryUserJoinedInfo(t),u=new W(U[U.rtcQueryJoined],s,o),[4,i.send(u,Vr)]):[2,{code:S.RC_NET_CHANNEL_INVALID}];case 1:return d=a.sent(),l=d.code,h=d.data,l===S.SUCCESS?[2,{code:l,data:h}]:[2,{code:l}]}})})},e.prototype.getDeviceId=function(){return Za(this.runtime)},e.prototype.requestRoomPK=function(t){return D(this,void 0,void 0,function(){var r,i,o;return x(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeRequestRoomPK(t),i=new W(U[U.rtcInvite],r,t.roomId),[4,this._channel.send(i)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.cancelRoomPK=function(t){return D(this,void 0,void 0,function(){var r,i,o;return x(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeCancelRoomPK(t),i=new W(U[U.rtcCancelInvite],r,t.roomId),[4,this._channel.send(i)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.responseRoomPK=function(t){return D(this,void 0,void 0,function(){var r,i,o;return x(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeResponseRoomPK(t),i=new W(U[U.rtcInviteAnswer],r,t.roomId),[4,this._channel.send(i)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.endRoomPK=function(t){return D(this,void 0,void 0,function(){var r,i,o;return x(this,function(s){switch(s.label){case 0:return this._channel?(r=this._channel.codec.encodeEndRoomPK(t),i=new W(U[U.rtcEndInvite],r,t.roomId),[4,this._channel.send(i)]):[2,S.RC_NET_CHANNEL_INVALID];case 1:return o=s.sent().code,this._rtcKVManager.reset(),[2,o]}})})},e.prototype.callExtra=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return Promise.resolve({code:S.EXTRA_METHOD_UNDEFINED})},e.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},e.prototype.getConversationListWithAllChannelByPage=function(t,r){throw new Error("Method not implemented.")},e.prototype.clearConversations=function(){throw new Error("Method not implemented.")},e.prototype.setUserStatusListener=function(t,r){throw new Error("Method not implemented.")},e.prototype.setUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.subscribeUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.getUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.addToBlacklist=function(t){throw new Error("Method not implemented.")},e.prototype.removeFromBlacklist=function(t){throw new Error("Method not implemented.")},e.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},e.prototype.getBlacklistStatus=function(t){throw new Error("Method not implemented.")},e.prototype.insertMessage=function(t,r,i){throw new Error("Method not implemented.")},e.prototype.deleteMessages=function(t){throw new Error("Method not implemented.")},e.prototype.deleteMessagesByTimestamp=function(t,r,i,o,s){throw new Error("Method not implemented.")},e.prototype.clearMessages=function(t,r,i){throw new Error("Method not implemented.")},e.prototype.getMessage=function(t){throw new Error("Method not implemented.")},e.prototype.setMessageContent=function(t,r,i){throw new Error("Method not implemented.")},e.prototype.setMessageSearchField=function(t,r,i){throw new Error("Method not implemented.")},e.prototype.searchConversationByContent=function(t,r,i,o){throw new Error("Method not implemented.")},e.prototype.searchMessageByContent=function(t,r,i,o,s,u){throw new Error("Method not implemented.")},e.prototype.getUnreadMentionedMessages=function(t,r){throw new Error("Method not implemented.")},e.prototype.setMessageSentStatus=function(t,r){throw new Error("Method not implemented.")},e.prototype.setMessageReceivedStatus=function(t,r){throw new Error("Method not implemented.")},e.prototype.clearUnreadCountByTimestamp=function(t,r,i,o){throw new Error("Method not implemented.")},e.prototype.getConversationNotificationStatus=function(t,r,i){var o=this._conversationManager.get(t,r,i);return o?Promise.resolve({code:S.SUCCESS,data:o.notificationStatus}):Promise.resolve({code:S.CONVER_GET_ERROR})},e.prototype.getRemoteHistoryMessages=function(t,r,i,o,s,u){return this.getHistoryMessage(t,r,i,o,s,u)},e}(vd),Qa=function(){function n(e){this._context=e}return n.prototype.getCoreVersion=function(){return this._context.coreVersion},n.prototype.getAPIVersion=function(){return this._context.apiVersion},n.prototype.getAppkey=function(){return this._context.appkey},n.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},n.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},n.prototype.getDeviceId=function(){return this._context.getDeviceId()},n.prototype.sendMessage=function(e,t,r){return this._context.sendMessage(e,t,r)},n.prototype.registerMessageType=function(e,t,r,i){i===void 0&&(i=[]),this._context.registerMessageType(e,t,r,i)},n.prototype.getServerTime=function(){return this._context.getServerTime()},n.prototype.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},n}(),Ud=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return Re(e,n),e.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},e.prototype.joinRTCRoom=function(t,r,i,o){return this._context.joinRTCRoom(t,r,i,o)},e.prototype.quitRTCRoom=function(t){return this._context.quitRTCRoom(t)},e.prototype.rtcPing=function(t,r,i){return this._context.rtcPing(t,r,i)},e.prototype.getRTCRoomInfo=function(t){return this._context.getRTCRoomInfo(t)},e.prototype.getRTCUserInfoList=function(t){return this._context.getRTCUserInfoList(t)},e.prototype.getRTCUserInfo=function(t){return this._context.getRTCUserInfo(t)},e.prototype.setRTCUserInfo=function(t,r,i){return this._context.setRTCUserInfo(t,r,i)},e.prototype.removeRTCUserInfo=function(t,r){return this._context.removeRTCUserInfo(t,r)},e.prototype.setRTCData=function(t,r,i,o,s,u){return this._context.setRTCData(t,r,i,o,s,u)},e.prototype.setRTCTotalRes=function(t,r,i,o,s){return this._context.setRTCTotalRes(t,r,i,o,s)},e.prototype.setRTCCDNUris=function(t,r,i){return this._context.setRTCCDNUris(t,r,i)},e.prototype.getRTCData=function(t,r,i,o){return this._context.getRTCData(t,r,i,o)},e.prototype.removeRTCData=function(t,r,i,o,s){return this._context.removeRTCData(t,r,i,o,s)},e.prototype.setRTCOutData=function(t,r,i,o){return this._context.setRTCOutData(t,r,i,o)},e.prototype.getRTCOutData=function(t,r){return this._context.getRTCOutData(t,r)},e.prototype.getRTCToken=function(t,r,i){return this._context.getRTCToken(t,r,i)},e.prototype.setRTCState=function(t,r){return this._context.setRTCState(t,r)},e.prototype.getRTCUserList=function(t){return this._context.getRTCUserList(t)},e.prototype.joinLivingRoomAsAudience=function(t,r,i){return this._context.joinLivingRoomAsAudience(t,r,i)},e.prototype.quitLivingRoomAsAudience=function(t){return this._context.quitLivingRoomAsAudience(t)},e.prototype.rtcIdentityChange=function(t,r,i){return this._context.rtcIdentityChange(t,r,i)},e.prototype.requestRoomPK=function(t){return this._context.requestRoomPK(t)},e.prototype.cancelRoomPK=function(t){return this._context.cancelRoomPK(t)},e.prototype.responseRoomPK=function(t){return this._context.responseRoomPK(t)},e.prototype.endRoomPK=function(t){return this._context.endRoomPK(t)},e}(Qa),Ns=function(){function n(){}return n.compress=function(e){for(var t=this,r={},i=0;i<e.length-1;i++){var o=e.charAt(i)+e.charAt(i+1);r.hasOwnProperty(o)?r[o].push(i):r[o]=[i]}for(var s=[],u=[],d=function(){if(u.length>0){var _=u.join("");if(u=[],_.length>26){var v=t.numberEncode(_.length),R=String.fromCharCode(t.dataType.NormalExt|v.length);s.push(R+v)}else{var C=String.fromCharCode(t.dataType.Normal|_.length);s.push(C)}s.push(_)}},l=0;l<e.length;){var h=t.indexOf(r,e,l);if(h.length<2)u.push(e.charAt(l++));else if(h.length<4)u.push(e.substr(l,h.length)),l+=h.length;else{var a=t.numberEncode(l-h.offset),c=t.numberEncode(h.length);if(a.length+c.length>=h.length)u.push(e.substr(l,h.length)),l+=h.length;else{d();var p=String.fromCharCode(t.dataType.Compressed|a.length<<2|c.length);s.push(p+a+c),l+=h.length}}}d();var f=t.numberEncode(e.length),m=String.fromCharCode(t.dataType.Tail|f.length);return s.push(m+f),s.join("")},n.uncompress=function(e){var t=this,r=0,i="";e:do{var o=e.charCodeAt(r++),s=o&t.dataType.Mark,u=15&o,d=void 0;switch(s){case t.dataType.Compressed:var l=u>>2,h=3&u;if(l===0||h===0)throw new Error("Data parsing error,at "+r);var a=t.numberDecode(e.substr(r,l)),c=t.numberDecode(e.substr(r+=l,h));if((a=i.length-a)+c>i.length)throw new Error("Data parsing error,at "+r);r+=h,i+=i.substr(a,c);break;case t.dataType.Tail:if((d=t.numberDecode(e.substr(r,u)))!==i.length)throw console.log(i.length),console.log(d),new Error("Data parsing error,at "+r);r+=u;break e;case t.dataType.NormalExt:d=t.numberDecode(e.substr(r,u)),i+=e.substr(r+=u,d),r+=d;break;case t.dataType.Normal:i+=e.substr(r,u),r+=u;break;case t.dataType.Mark:if(u>10)throw new Error("Data parsing error,at "+r);i+=e.substr(r,16+u),r+=16+u;break;default:throw new Error("Data parsing error,at "+r+" header:"+s)}}while(r<e.length);return i},n.indexOf=function(e,t,r){var i={length:0,offset:-1};if(t.length,r>=t.length-1)return i;var o=e[t.charAt(r)+t.charAt(r+1)];if(o[0]===r)return i;for(var s=t.length-r,u=0,d=o.length;u<d;u++){var l=o[u],h=r-l;if(!(h>this.max)){var a=Math.min(s,h);if(a<=i.length)break;if(!(i.length>2&&t.charAt(l+i.length-1)!==t.charAt(r+i.length-1))){for(var c=2,p=c;p<a&&t.charAt(l+p)===t.charAt(r+p);p++)c++;c>=i.length&&(i.length=c,i.offset=l)}}}return i},n.numberEncode=function(e){var t=this,r=[],i=0;do i=e%t.scale,r.push(t.chars.charAt(i)),e=(e-i)/t.scale;while(e>0);return r.join("")},n.numberDecode=function(e){for(var t=0,r=0,i=e.length-1;i>=0;i--){if((r=this.chars.indexOf(e.charAt(i)))===-1)throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+r}return t},n.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},n.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",n.scale=n.chars.length,n.max=238327,n}(),Xt=1,en=!1,ws=typeof location!="undefined"&&location.protocol==="https://"?"https://":"http://",Bn=function(){function n(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=Za(e.runtime),this.logSwitch=e.logSwitch;var t=ju(e.runtime);this.deviceInfo=t.type+"|"+t.version+"|"+gt.sessionId,this.startReport()}return n.init=function(e){return en=!0,n._instance||(n._instance=new n(e)),n._instance},n.getInstance=function(){return n._instance},n.prototype.startReport=function(){var e=this;if(this.logSwitch&&en){var t=this.itv*Math.pow(2,Xt-1);Xt<this.times&&Xt++,setTimeout(function(){e.reportRealtimeLog()},1e3*t)}},n.prototype.reportRealtimeLog=function(){var e=this,t=gt.realTimeLogList.filter(function(o){return o.level<=e.level});if(t.length!==0){var r=Ns.compress(t.map(function(o){return o.content}).join("")),i=""+ws+this.logUrl+"?version="+this.info.version+"&appkey="+this.info.appkey+"&userId="+this.info.userId+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web";this.info.runtime.httpReq({method:"POST",url:i,body:r}).then(function(o){j.__clearRealTimeLog(),j.debug("report real-time log success");var s=o.data;s&&(s=JSON.parse(s),e.itv=s.nextTime,e.level=s.level,e.logSwitch=s.logSwitch,Xt=1),e.startReport()}).catch(function(o){j.debug("report real-time log error -> "+o),e.startReport()})}else this.startReport()},n.prototype.reportFullLog=function(e){return D(this,void 0,void 0,function(){var t,r,i,o,s,u,d,l,h,a,c=this;return x(this,function(p){switch(p.label){case 0:return t=e.startTime,r=e.endTime,i=e.platform,o=e.logId,s=e.uri,u=qi.getInstance(),j.debug("received report log msg, "+i.toLowerCase(),u),i.toLowerCase()==="web"&&u?t>r?(j.warn("report error: The start time("+t+") cannot be greater than the end time("+t+")"),[2]):[4,j.__insertLogIntoDatabase()]:[2];case 1:return p.sent(),[4,u.getRangeData(Ut,"time",t,r)];case 2:return d=(d=p.sent()).filter(function(f){return!f.userId||f.userId===c.info.userId}),l=Ns.compress(d.map(function(f){return f.content}).join("")||"no data"),h=1,(a=function(){if(!(h>3)&&en){var f=s||c.logUrl,m=""+ws+f+"?version="+c.info.version+"&appkey="+c.info.appkey+"&userId="+c.info.userId+"&logId="+o+"&deviceId="+c.deviceId+"&deviceInfo="+c.deviceInfo+"&platform=Web",_=5e3*(h-1);h++,setTimeout(function(){en&&c.info.runtime.httpReq({url:m,method:"POST",body:l}).then(function(){j.debug("report full log success!")}).catch(function(v){a(),j.warn("report full log error -> "+v)})},_)}})(),[2]}})})},n.prototype.distroy=function(){Xt=1,en=!1},n}();function Fn(n){return Object.assign({},n)}var Ms,Dd=function(){function n(e,t){var r;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.1.1",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=ee.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},t),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter(function(o){return/^https?:\/\//.test(o)}),this._options.navigators=this._options.navigators.map(function(o){return o.replace(/\/$/g,"")}),this._options.navigators.length===0&&(r=this._options.navigators).push.apply(r,wu);var i={status:this._connectionStatusListener.bind(this),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedListener.bind(this)};this._engine=gs()?new RCCppEngine(e,i,this._options):new kd(e,i,this._options)}return n.init=function(e,t){return j.setLogLevel(t.logLevel),j.setLogStdout(t.logStdout),(t.indexDBSwitch||de(t.indexDBSwitch))&&qi.init(),j.debug("APIContext.init =>",t.appkey,t.navigators),this._context?(j.error("Repeat initialize!"),this._context):(j.warn("RCEngine Commit:","41dbe38d1b376ca0a791b23ed94be291e3f92e81"),this._context=new n(e,t),j.__insertLogIntoDatabase(),this._context)},n.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},n.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return j.warn("Repeat install plugin: "+e.tag),this._pluginInstanseMap[e.tag];var r=e.tag==="RCRTC"?new Ud(this):new Qa(this),i=null;try{if(!e.verify(this._runtime))return null;i=e.setup(r,this._runtime,t)}catch(o){j.error(`install plugin error!
  796. `,o)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),i&&this._pluginContextQueue.push(r),i&&(this._pluginInstanseMap[e.tag]=i),i},n.prototype._handleRedirect=function(){return D(this,void 0,void 0,function(){var e=this;return x(this,function(t){switch(t.label){case 0:return j.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return t.sent().code!==S.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(),setTimeout(function(){e._handleRedirect()},5e3)),[2]}})})},n.prototype._connectionStatusListener=function(e){var t;return D(this,void 0,void 0,function(){return x(this,function(r){return e===ee.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(),this._handleRedirect()):e===ee.BLOCKED||e===ee.KICKED_OFFLINE_BY_OTHER_CLIENT||e===ee.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect()):e===ee.CONNECTING?this._handleConnecting():e===ee.CONNECTED?this._handleConnected():e===ee.DISCONNECTED?this._handleDisconnect():e===ee.NETWORK_UNAVAILABLE&&this._handleSuspend(),this._connectionStatus=e,((t=this._watcher.rtcInnerWatcher)===null||t===void 0?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach(function(i){i.onconnectionstatechange&&i.onconnectionstatechange(e)}),this._watcher.connectionState&&this._watcher.connectionState(e),[2]})})},n.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},n.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},n.prototype._handleDisconnect=function(){this._watcher.onDisconnect&&this._watcher.onDisconnect()},n.prototype._handleSuspend=function(){this._watcher.onSuspend&&this._watcher.onSuspend()},n.prototype._messageReceiver=function(e,t,r){var i,o,s;if((e.conversationType===J.RTC_ROOM||Object.prototype.hasOwnProperty.call(Du,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(Fn(e));else if(["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)===-1||typeof this._watcher.chatroomState!="function"){if(e.messageType!=="RC:ChrmMemChange"){if(e.messageType!==Ae.TYPING_STATUS||(this._addTypingInfo(Fn(e)),!this._watcher.typingState))if(e.messageType!==Ae.LOG_COMMAND||e.senderUserId!=="rongcloudsystem")if(e.messageType!==Ae.INTERCEPT){if(!this._pluginContextQueue.some(function(v){if(!v.onmessage)return!1;try{return v.onmessage(Fn(e))}catch(R){return j.error("plugin error =>",R),!1}}))if(e.messageType!=="RC:ReadNtf")if(e.messageType!=="RC:RRReqMsg"){if(e.messageType!=="RC:RRRspMsg")return this._watcher.message&&this._watcher.message(Fn(e),t,r),e;var u=(s=e.content)===null||s===void 0?void 0:s.receiptMessageDic;u&&Array.isArray(u[this._engine.currentUserId])&&typeof this._watcher.messageReceiptResponse=="function"&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,u[this._engine.currentUserId])}else typeof this._watcher.messageReceiptRequest=="function"&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else typeof this._watcher.readReceiptReceived=="function"&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId});else{var d=e.content,l=d.startTime,h=d.endTime,a=d.platform,c=d.logId,p=d.uri,f=d.packageName,m={startTime:parseInt(l),endTime:parseInt(h),platform:a,logId:c,uri:p,packageName:f};(o=Bn.getInstance())===null||o===void 0||o.reportFullLog(m)}}else if(typeof this._watcher.chatroomState=="function"){var _={};Array.isArray(e.content.userList)&&e.content.userList.forEach(function(v){_[v.userId]=v.status}),this._watcher.chatroomState({userChange:{users:_,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:(i={},i[e.senderUserId]=e.messageType==="RC:ChrmQuitNtf"?ls.QUIT:ls.JOIN,i),chatroomId:e.targetId}})},n.prototype._batchMessageReceiver=function(e,t,r){var i=this,o=[];e.forEach(function(s){var u=i._messageReceiver(s,t,r);u&&o.push(u)}),o.length&&this._watcher.batchMessage&&this._watcher.batchMessage(o)},n.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},n.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},n.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},n.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},n.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},n.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},n.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},n.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},n.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach(function(r){r.onrtcdatachange&&r.onrtcdatachange(e,t)})},n.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach(function(r){if(Object.prototype.hasOwnProperty.call(e,r)){var i=e[r];t._watcher[r]=ar(i)||Ne(i)?i:void 0}})},n.prototype.resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach(function(t){e._watcher[t]=void 0})},n.prototype._addTypingInfo=function(e){var t=e.senderUserId,r=e.conversationType,i=e.targetId,o=e.content,s=e.channelId,u=o.typingContentType,d=r+"#"+i+"#"+(s||"");this._typingInfo[d]||(this._typingInfo[d]=[]);var l=this._typingInfo[d].findIndex(function(h){return h.userId===t});l>=0&&this._typingInfo[d][l].messageType===u?this._typingInfo[d][l].timestamp=Date.now():(l>=0&&this._typingInfo[d].splice(l,1),this._typingInfo[d].push({userId:t,messageType:u,timestamp:Date.now()}),this._typingChangedList.includes(d)||this._typingChangedList.push(d),this._startCheckTypingInfo())},n.prototype._startCheckTypingInfo=function(){var e=this;this._typingInternalTimer===-1&&Object.keys(this._typingInfo).length!==0&&(this._typingInternalTimer=setInterval(function(){for(var t in e._typingInfo){var r=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter(function(o){return Date.now()-o.timestamp<e._typingExpireTime}),e._typingInfo[t].length===r||e._typingChangedList.includes(t)||e._typingChangedList.push(t),e._typingInfo[t].length===0&&delete e._typingInfo[t]}if(e._typingChangedList.length>0){var i=e._typingChangedList.map(function(o){return{conversationType:Number(o.split("#")[0]),targetId:o.split("#")[1],channelId:o.split("#")[2],list:e._typingInfo[o]||[]}});e._typingStatusListener(i),e._typingChangedList=[]}Object.keys(e._typingInfo).length===0&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)},500))},n.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},n.prototype.getServerTime=function(){return this._engine.getServerTime()},n.prototype.getDeviceId=function(){return this._engine.getDeviceId()},n.prototype.getCurrentUserId=function(){return this._engine.currentUserId},n.prototype.getConnectionStatus=function(){return this._connectionStatus},Object.defineProperty(n.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),n.prototype.connect=function(e,t){return t===void 0&&(t=!1),D(this,void 0,void 0,function(){var r,i,o,s,u,d;return x(this,function(l){switch(l.label){case 0:return this._connectionStatus===ee.CONNECTED?[2,{code:S.SUCCESS,userId:this._engine.currentUserId}]:this._connectionStatus===ee.CONNECTING?[2,{code:S.BIZ_ERROR_CONNECTING}]:typeof e!="string"||e.length===0?[2,{code:S.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,r=e.split("@"),i=r[1],o=i?i.split(";").map(function(h){return/^https?:/.test(h)?h:"https://"+h}):[],[4,this._engine.navi.getInfo(this._getTokenWithoutNavi(),o,t,this._options.checkCA)]);case 1:return(s=l.sent())?(s==null?void 0:s.type)===1?[2,{code:S.PACKAGE_ENVIRONMENT_ERROR}]:(u=Tt.getInfo(),[4,this._engine.connect(this._getTokenWithoutNavi(),s)]):[2,{code:S.RC_NAVI_RESOURCE_ERROR}];case 2:return d=l.sent(),j.__insertLogIntoDatabase(),d!==we.REDIRECT?[3,4]:(this._connectionStatus=ee.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,l.sent()];case 4:return d===S.SUCCESS&&(j.info("connect success, userId: "+this._engine.currentUserId),(s==null?void 0:s.type)!==1&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(u),Bn.init({runtime:this._runtime,logSwitch:(s==null?void 0:s.logSwitch)||0,logPolicy:JSON.parse((s==null?void 0:s.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),gt.init(this._engine.currentUserId),this._isInternalConnected=!0),d!==S.SUCCESS||gs()||s.openUS===1&&this._pullUserSettings(),d!==S.SUCCESS&&(this._connectionStatus=ee.CONNECTION_CLOSED),[2,{code:d,userId:this._engine.currentUserId}]}})})},n.prototype._pullUserSettings=function(){return D(this,void 0,void 0,function(){return x(this,function(e){return[2]})})},n.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,(e=Bn.getInstance())===null||e===void 0||e.distroy(),j.__insertLogIntoDatabase(),gt.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach(function(t){if(t.ondisconnect)try{t.ondisconnect()}catch(r){j.error("plugin error =>",r)}}),Promise.resolve()},n.prototype.reconnect=function(){return this._isInternalConnected?Promise.resolve({code:S.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi())},n.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},n.prototype.getInfoFromCache=function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())},n.prototype.registerMessageType=function(e,t,r,i){i===void 0&&(i=[]),this._engine.registerMessageType(e,t,r,i)},n.prototype.sendMessage=function(e,t,r,i){var o=this.getInfoFromCache();if(((o==null?void 0:o.grpRRVer)||0)===1&&r.messageType===Ae.READ_RECEIPT_RESPONSE)return Promise.resolve({code:S.READ_RECEIPT_ERROR});var s=JSON.stringify(r.content);return Ca(s)>131072?Promise.resolve({code:S.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,r,i)},n.prototype.sendExpansionMessage=function(e){return D(this,void 0,void 0,function(){var t,r,i,o,s,u,d,l,h,a,c,p,f,m;return x(this,function(_){switch(_.label){case 0:if(t=e.channelId,r=e.conversationType,i=e.targetId,o=e.messageUId,s=e.keys,u=e.expansion,d=e.removeAll,!e.canIncludeExpansion)return[2,{code:S.MESSAGE_KV_NOT_SUPPORT}];if(l=!1,h=!1,a=!1,Ne(u)){for(p in c=Object.keys(u).length,l=c>20,u)if(f=u[p],h=Be(p)&&!/^[A-Za-z0-9_=+-]+$/.test(p),(a=p.length>32||f.length>64)||h)break}return l||a?[2,{code:S.EXPANSION_LIMIT_EXCEET}]:h?[2,{code:S.BIZ_ERROR_INVALID_PARAMETER}]:(m={mid:o},u&&(m.put=u),s&&(m.del=s),d&&(m.removeAll=1),[4,this._engine.sendMessage(r,i,{content:m,messageType:Ae.EXPANSION_NOTIFY,channelId:t})]);case 1:return[2,{code:_.sent().code}]}})})},n.prototype.sendReadReceiptMessage=function(e,t,r){return D(this,void 0,void 0,function(){var i;return x(this,function(o){return i=this.getInfoFromCache(),((i==null?void 0:i.grpRRVer)||0)===0?[2,{code:S.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(e,t,r)]})})},n.prototype.getMessageReader=function(e,t,r){return D(this,void 0,void 0,function(){var i;return x(this,function(o){return i=this.getInfoFromCache(),((i==null?void 0:i.grpRRVer)||0)===0?[2,{code:S.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,r)]})})},n.prototype._destroy=function(){var e;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach(function(t){if(t.ondestroy)try{t.ondestroy()}catch(r){j.error("plugin error =>",r)}}),this._pluginContextQueue.length=0,this._pluginInstanseMap={},(e=Bn.getInstance())===null||e===void 0||e.distroy(),gt.reset()},n.prototype.getHistoryMessage=function(e,t,r,i,o,s,u){return r===void 0&&(r=0),i===void 0&&(i=20),o===void 0&&(o=0),s===void 0&&(s=""),u===void 0&&(u=""),this._engine.getHistoryMessage(e,t,r,i,o,s,u||"")},n.prototype.getConversationList=function(e,t,r,i,o){return e===void 0&&(e=300),o===void 0&&(o=""),this._engine.getConversationList(e,t,r,i,o)},n.prototype.getConversation=function(e,t,r){return this._engine.getConversation(e,t,r)},n.prototype.removeConversation=function(e,t,r){return r===void 0&&(r=""),this._engine.removeConversation(e,t,r)},n.prototype.clearUnreadCount=function(e,t,r){return r===void 0&&(r=""),this._engine.clearConversationUnreadCount(e,t,r)},n.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},n.prototype.getUnreadCount=function(e,t,r){return r===void 0&&(r=""),this._engine.getConversationUnreadCount(e,t,r)},n.prototype.getTotalUnreadCount=function(e,t,r){return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[J.PRIVATE,J.GROUP,J.SYSTEM,J.PUBLIC_SERVICE],!!r)},n.prototype.getFirstUnreadMessage=function(e,t,r){return r===void 0&&(r=""),this._engine.getFirstUnreadMessage(e,t,r)},n.prototype.setConversationStatus=function(e,t,r,i,o){o===void 0&&(o="");var s=[{conversationType:e,targetId:t,isTop:r,notificationStatus:i,channelId:o}];return this._engine.batchSetConversationStatus(s)},n.prototype.saveConversationMessageDraft=function(e,t,r,i){return i===void 0&&(i=""),this._engine.saveConversationMessageDraft(e,t,r,i)},n.prototype.getConversationMessageDraft=function(e,t,r){return r===void 0&&(r=""),this._engine.getConversationMessageDraft(e,t,r)},n.prototype.clearConversationMessageDraft=function(e,t,r){return r===void 0&&(r=""),this._engine.clearConversationMessageDraft(e,t,r)},n.prototype.recallMessage=function(e,t,r,i,o){return this._engine.recallMsg(e,t,r,i,o)},n.prototype.deleteRemoteMessage=function(e,t,r,i){return i===void 0&&(i=""),this._engine.deleteRemoteMessage(e,t,r,i)},n.prototype.deleteRemoteMessageByTimestamp=function(e,t,r,i){return i===void 0&&(i=""),this._engine.deleteRemoteMessageByTimestamp(e,t,r,i)},n.prototype.joinChatroom=function(e,t){return t===void 0&&(t=10),this._engine.joinChatroom(e,t)},n.prototype.joinExistChatroom=function(e,t){return t===void 0&&(t=10),this._engine.joinExistChatroom(e,t)},n.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},n.prototype.getChatroomInfo=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=0),this._engine.getChatroomInfo(e,t,r)},n.prototype.setChatroomEntry=function(e,t){var r=t.key,i=t.value;return wt(r)&&zr(i)?this._engine.setChatroomEntry(e,t):Promise.resolve(S.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.setChatroomEntries=function(e,t){for(var r=0;r<t.entries.length;r++){var i=t.entries[r],o=i.key,s=i.value;if(!wt(o)||!zr(s))return Promise.resolve({code:S.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)},n.prototype.forceSetChatroomEntry=function(e,t){var r=t.key,i=t.value;return wt(r)&&zr(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(S.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.removeChatroomEntry=function(e,t){var r=t.key;return wt(r)?this._engine.removeChatroomEntry(e,t):Promise.resolve(S.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.removeChatroomEntries=function(e,t){for(var r=0;r<t.entries.length;r++){var i=t.entries[r].key;if(!wt(i))return Promise.resolve({code:S.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},n.prototype.forceRemoveChatroomEntry=function(e,t){var r=t.key;return wt(r)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(S.BIZ_ERROR_INVALID_PARAMETER)},n.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},n.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},n.prototype.getChatroomHistoryMessages=function(e,t,r,i){return t===void 0&&(t=20),r===void 0&&(r=0),i===void 0&&(i=0),this._engine.getChatroomHistoryMessages(e,i,t,r)},n.prototype.getFileToken=function(e,t,r,i){return D(this,void 0,void 0,function(){var o,s,u,d,l,h,a;return x(this,function(c){switch(c.label){case 0:return o=this.getInfoFromCache(),s=(o==null?void 0:o.bosAddr)||"",u=(o==null?void 0:o.uploadServer)||"",d=(o==null?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(e,t,r,i)];case 1:return l=c.sent(),h=l.code,a=l.data,h===S.SUCCESS?[2,Promise.resolve(Object.assign(a,{bos:s,qiniu:u,ossConfig:d}))]:[2,Promise.reject(h)]}})})},n.prototype.getFileUrl=function(e,t,r,i,o){return o===void 0&&(o=Ue.QINIU),D(this,void 0,void 0,function(){var s,u,d;return x(this,function(l){switch(l.label){case 0:return(i==null?void 0:i.isBosRes)?[2,Promise.resolve(i)]:[4,this._engine.getFileUrl(e,o,t,r)];case 1:return s=l.sent(),u=s.code,d=s.data,u===S.SUCCESS?[2,Promise.resolve(d)]:[2,Promise.reject(u)]}})})},n.prototype.createTag=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.createTag(e)]})})},n.prototype.removeTag=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.removeTag(e)]})})},n.prototype.updateTag=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.updateTag(e)]})})},n.prototype.getTagList=function(){return D(this,void 0,void 0,function(){return x(this,function(e){return[2,this._engine.getTagList()]})})},n.prototype.addTagForConversations=function(e,t){return D(this,void 0,void 0,function(){return x(this,function(r){return t.length>1e3?[2,Promise.reject(S.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]})})},n.prototype.removeTagForConversations=function(e,t){return D(this,void 0,void 0,function(){return x(this,function(r){return[2,this._engine.removeTagForConversations(e,t)]})})},n.prototype.removeTagsForConversation=function(e,t){return D(this,void 0,void 0,function(){return x(this,function(r){return[2,this._engine.removeTagsForConversation(e,t)]})})},n.prototype.getConversationListByTag=function(e,t,r,i){return D(this,void 0,void 0,function(){return x(this,function(o){return[2,this._engine.getConversationListByTag(e,t,r,i)]})})},n.prototype.getUnreadCountByTag=function(e,t){return D(this,void 0,void 0,function(){return x(this,function(r){return[2,this._engine.getUnreadCountByTag(e,t)]})})},n.prototype.setConversationStatusInTag=function(e,t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return[2,this._engine.setConversationStatusInTag(e,t,r)]})})},n.prototype.getTagsForConversation=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.getTagsForConversation(e)]})})},n.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},n.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},n.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},n.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},n.prototype.callExtra=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,yt([e],r))},n.prototype.clearConversations=function(e,t){return D(this,void 0,void 0,function(){return x(this,function(r){switch(r.label){case 0:return[4,this._engine.clearConversations(e,t)];case 1:return[2,r.sent()]}})})},n.prototype.setUserStatusListener=function(e,t){return this._engine.setUserStatusListener(e,function(r){try{t(r)}catch(i){j.error(i)}})},n.prototype.addToBlacklist=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.addToBlacklist(e)]})})},n.prototype.removeFromBlacklist=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.removeFromBlacklist(e)]})})},n.prototype.getBlacklist=function(){return D(this,void 0,void 0,function(){return x(this,function(e){return[2,this._engine.getBlacklist()]})})},n.prototype.getBlacklistStatus=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.getBlacklistStatus(e)]})})},n.prototype.insertMessage=function(e,t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return[2,this._engine.insertMessage(e,t,r)]})})},n.prototype.deleteMessages=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.deleteMessages(e)]})})},n.prototype.deleteMessagesByTimestamp=function(e,t,r,i,o){return o===void 0&&(o=""),D(this,void 0,void 0,function(){return x(this,function(s){return[2,this._engine.deleteMessagesByTimestamp(e,t,r,i,o)]})})},n.prototype.clearMessages=function(e,t,r){return r===void 0&&(r=""),D(this,void 0,void 0,function(){return x(this,function(i){return[2,this._engine.clearMessages(e,t,r)]})})},n.prototype.getMessage=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.getMessage(e)]})})},n.prototype.setMessageContent=function(e,t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return[2,this._engine.setMessageContent(e,t,r)]})})},n.prototype.setMessageSearchField=function(e,t,r){return D(this,void 0,void 0,function(){return x(this,function(i){return[2,this._engine.setMessageSearchField(e,t,r)]})})},n.prototype.setMessageSentStatus=function(e,t){return D(this,void 0,void 0,function(){return x(this,function(r){return[2,this._engine.setMessageSentStatus(e,t)]})})},n.prototype.setMessageReceivedStatus=function(e,t){return D(this,void 0,void 0,function(){return x(this,function(r){return[2,this._engine.setMessageReceivedStatus(e,t)]})})},n.prototype.setUserStatus=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.setUserStatus(e)]})})},n.prototype.subscribeUserStatus=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.subscribeUserStatus(e)]})})},n.prototype.getUserStatus=function(e){return D(this,void 0,void 0,function(){return x(this,function(t){return[2,this._engine.getUserStatus(e)]})})},n.prototype.searchConversationByContent=function(e,t,r,i){return t===void 0&&(t=[]),r===void 0&&(r=""),D(this,void 0,void 0,function(){return x(this,function(o){return[2,this._engine.searchConversationByContent(e,t,r,i)]})})},n.prototype.searchMessageByContent=function(e,t,r,i,o,s,u){return u===void 0&&(u=""),D(this,void 0,void 0,function(){return x(this,function(d){return[2,this._engine.searchMessageByContent(e,t,r,i,o,s,u)]})})},n.prototype.getUnreadMentionedMessages=function(e,t,r){return r===void 0&&(r=""),this._engine.getUnreadMentionedMessages(e,t,r)},n.prototype.clearUnreadCountByTimestamp=function(e,t,r,i){return i===void 0&&(i=""),this._engine.clearUnreadCountByTimestamp(e,t,r,i)},n.prototype.getConversationNotificationStatus=function(e,t,r){return r===void 0&&(r=""),this._engine.getConversationNotificationStatus(e,t,r)},n.prototype.getRemoteHistoryMessages=function(e,t,r,i,o,s){return this._engine.getRemoteHistoryMessages(e,t,r,i,o,s)},n.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},n.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},n.prototype.joinRTCRoom=function(e,t,r,i){return this._engine.joinRTCRoom(e,t,r,i)},n.prototype.quitRTCRoom=function(e){return this._engine.quitRTCRoom(e)},n.prototype.rtcPing=function(e,t,r){return this._engine.rtcPing(e,t,r)},n.prototype.getRTCRoomInfo=function(e){return this._engine.getRTCRoomInfo(e)},n.prototype.getRTCUserInfoList=function(e){return this._engine.getRTCUserInfoList(e)},n.prototype.getRTCUserInfo=function(e){return this._engine.getRTCUserInfo(e)},n.prototype.setRTCUserInfo=function(e,t,r){return this._engine.setRTCUserInfo(e,t,r)},n.prototype.removeRTCUserInfo=function(e,t){return this._engine.removeRTCUserInfo(e,t)},n.prototype.setRTCData=function(e,t,r,i,o,s){return this._engine.setRTCData(e,t,r,i,o,s)},n.prototype.setRTCTotalRes=function(e,t,r,i,o){return o===void 0&&(o=""),this._engine.setRTCTotalRes(e,t,r,i,o)},n.prototype.setRTCCDNUris=function(e,t,r){return this._engine.setRTCCDNUris(e,t,r)},n.prototype.getRTCData=function(e,t,r,i){return this._engine.getRTCData(e,t,r,i)},n.prototype.removeRTCData=function(e,t,r,i,o){return this._engine.removeRTCData(e,t,r,i,o)},n.prototype.setRTCOutData=function(e,t,r,i){return this._engine.setRTCOutData(e,t,r,i)},n.prototype.getRTCOutData=function(e,t){return this._engine.getRTCOutData(e,t)},n.prototype.getRTCToken=function(e,t,r){return this._engine.getRTCToken(e,t,r)},n.prototype.setRTCState=function(e,t){return this._engine.setRTCState(e,t)},n.prototype.getRTCUserList=function(e){return this._engine.getRTCUserList(e)},n.prototype.joinLivingRoomAsAudience=function(e,t,r){return this._engine.joinLivingRoomAsAudience(e,t,r)},n.prototype.quitLivingRoomAsAudience=function(e){return this._engine.quitLivingRoomAsAudience(e)},n.prototype.rtcIdentityChange=function(e,t,r){return this._engine.rtcIdentityChange(e,t,r)},n.prototype.getRTCJoinedUserInfo=function(e){return this._engine.getRTCJoinedUserInfo(e)},n.prototype.requestRoomPK=function(e){return this._engine.requestRoomPK(e)},n.prototype.cancelRoomPK=function(e){return this._engine.cancelRoomPK(e)},n.prototype.responseRoomPK=function(e){return this._engine.responseRoomPK(e)},n.prototype.endRoomPK=function(e){return this._engine.endRoomPK(e)},n}();(function(n){n[n.add=1]="add",n[n.update=2]="update",n[n.delete=3]="delete"})(Ms||(Ms={}));/*! *****************************************************************************
  797. Copyright (c) Microsoft Corporation.
  798. Permission to use, copy, modify, and/or distribute this software for any
  799. purpose with or without fee is hereby granted.
  800. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  801. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  802. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  803. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  804. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  805. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  806. PERFORMANCE OF THIS SOFTWARE.
  807. ***************************************************************************** */var Ii=function(n,e){return Ii=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},Ii(n,e)},bi=function(){return bi=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var i in e=arguments[t])Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},bi.apply(this,arguments)};function Tn(n,e,t,r){return new(t||(t=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function u(l){try{d(r.throw(l))}catch(h){o(h)}}function d(l){var h;l.done?i(l.value):(h=l.value,h instanceof t?h:new t(function(a){a(h)})).then(s,u)}d((r=r.apply(n,e||[])).next())})}function Sn(n,e){var t,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(d){return function(l){return function(h){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(i=2&h[0]?r.return:h[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,h[1])).done)return i;switch(r=0,i&&(h=[2&h[0],i.value]),h[0]){case 0:case 1:i=h;break;case 4:return s.label++,{value:h[1],done:!1};case 5:s.label++,r=h[1],h=[0];continue;case 7:h=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||h[0]!==6&&h[0]!==2)){s=0;continue}if(h[0]===3&&(!i||h[1]>i[0]&&h[1]<i[3])){s.label=h[1];break}if(h[0]===6&&s.label<i[1]){s.label=i[1],i=h;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(h);break}i[2]&&s.ops.pop(),s.trys.pop();continue}h=e.call(n,s)}catch(a){h=[6,a],r=0}finally{t=i=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([d,l])}}}var ke=new gt("RCIM"),Nn=function(){return!(typeof uni=="undefined"||!function(n){for(var e=["canIUse","getSystemInfo"],t=0,r=e.length;t<r;t++)if(!n[e[t]])return!1;return!0}(uni))},xd=Nn(),Ee,As={tag:"browser",httpReq:function(n){var e=n.method||We.GET,t=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=Nr(n.url,i);return new Promise(function(u){var d,l=(d=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest,typeof XMLHttpRequest!="undefined"&&d?new XMLHttpRequest:typeof XDomainRequest!="undefined"?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),h=Object.prototype.toString.call(l)==="[object XDomainRequest]";if(l.open(e,s),r&&l.setRequestHeader)for(var a in r)l.setRequestHeader(a,r[a]);if(h){l.timeout=t,l.onload=function(){u({data:l.responseText,status:l.status||200})},l.onerror=function(){u({status:l.status||0})},l.ontimeout=function(){u({status:l.status||0})};var c=typeof o=="object"?JSON.stringify(o):o;l.send(c)}else l.onreadystatechange=function(){l.readyState===4&&u({data:l.responseText,status:l.status})},l.onerror=function(){u({status:l.status||0})},setTimeout(function(){return u({status:l.status||0})},t),l.send(o)})},localStorage:window==null?void 0:window.localStorage,sessionStorage:window==null?void 0:window.sessionStorage,isSupportSocket:function(){var n=typeof WebSocket!="undefined";return n||ke.warn("websocket not support"),n},useNavi:!0,connectPlatform:"",isFromUniapp:xd,createWebSocket:function(n,e){var t=new WebSocket(n,e);return t.binaryType="arraybuffer",{onClose:function(r){t.onclose=function(i){var o=i.code,s=i.reason;r(o,s)}},onError:function(r){t.onerror=r},onMessage:function(r){t.onmessage=function(i){r(i.data)}},onOpen:function(r){t.onopen=r},send:function(r){t.send(r)},close:function(r,i){t.close(r,i)}}},createDataChannel:function(n,e){return this.isSupportSocket()&&e==="websocket"?new jt(this,n):new Kt(this,n)}},Vd=Nn(),Hn=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return wx[n].apply(wx,e)}catch(r){ke.error(r)}}},Ps={setItem:Hn("setStorageSync"),getItem:Hn("getStorageSync"),removeItem:Hn("removeStorageSync"),clear:Hn("clearStorageSync")},Ls={tag:"wechat",httpReq:function(n){var e=n.method||We.GET,t=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=Nr(n.url,i);return new Promise(function(u){wx.request({url:s,method:e,headers:r,timeout:t,data:o,success:function(d){u({data:d.data,status:d.statusCode})},fail:function(){u({status:S.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:Ps,sessionStorage:Ps,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Vd,createWebSocket:function(n,e){var t=wx.connectSocket({url:n,protocols:e});return{onClose:function(r){t.onClose(function(i){r(i.code,i.reason)})},onError:function(r){t.onError(function(i){r(i.errMsg)})},onMessage:function(r){t.onMessage(function(i){r(i.data)})},onOpen:function(r){t.onOpen(r)},send:function(r){t.send({data:r})},close:function(r,i){t.close({code:r,reason:i})}}},createDataChannel:function(n,e){return e==="websocket"?new jt(this,n):new Kt(this,n)}},Bd=Nn(),$n=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return my[n].apply(my,e)}catch(r){ke.error(r)}}},ks={setItem:$n("setStorageSync"),getItem:$n("getStorageSync"),removeItem:$n("removeStorageSync"),clear:$n("clearStorageSync")},Us={tag:"alipay",httpReq:function(n){var e=n.method||We.GET,t=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=Nr(n.url,i),u=n.dataType||"json";return new Promise(function(d){my.request({url:s,method:e,headers:r,timeout:t,data:o,dataType:u,success:function(l){d({data:l.data,status:l.status})},fail:function(){d({status:S.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:ks,sessionStorage:ks,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Bd,createDataChannel:function(n,e){return e==="websocket"?new jt(this,n):new Kt(this,n)}},Fd=Nn(),jn=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return console.log("tt",tt),tt[n].apply(tt,e)}catch(r){ke.error(r)}}},Ds={setItem:jn("setStorageSync"),getItem:jn("getStorageSync"),removeItem:jn("removeStorageSync"),clear:jn("clearStorageSync")},xs={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Fd,localStorage:Ds,sessionStorage:Ds,httpReq:function(n){return new Promise(function(e,t){tt.request({url:n.url,data:n.body,header:n.headers,method:n.method,success:function(r){console.log("\u8C03\u7528\u6210\u529F",r.data);var i=(r==null?void 0:r.data)||{},o={data:JSON.stringify(i),status:r.statusCode};e(o)},fail:function(r){console.log("\u8C03\u7528\u5931\u8D25",r.errMsg),t({data:r.errMsg})}})})},createWebSocket:function(n,e){var t=tt.connectSocket({url:n,protocols:e});return{onOpen:function(r){t.onOpen(r)},onClose:function(r){t.onClose(function(i){return r(i.code,i.reason)})},onError:function(r){t.onError(function(i){return r(i.errMsg)})},onMessage:function(r){t.onMessage(function(i){return r(i.data)})},send:function(r){t.send({data:r})},close:function(r,i){t.close({code:r,reason:i})}}},createDataChannel:function(n,e){return e==="websocket"?new jt(this,n):new Kt(this,n)}},Hd=Nn(),Kn=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return console.log("swan",swan),swan[n].apply(swan,e)}catch(r){ke.error(r)}}},Vs={setItem:Kn("setStorageSync"),getItem:Kn("getStorageSync"),removeItem:Kn("removeStorageSync"),clear:Kn("clearStorageSync")},Bs={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Hd,localStorage:Vs,sessionStorage:Vs,httpReq:function(n){return new Promise(function(e,t){swan.request({url:n.url,data:n.body,header:n.headers,method:n.method,success:function(r){console.log("\u8C03\u7528\u6210\u529F",r.data);var i=(r==null?void 0:r.data)||{},o={data:JSON.stringify(i),status:r.statusCode};e(o)},fail:function(r){console.log("\u8C03\u7528\u5931\u8D25",r.errorCode),t({data:r.errorCode})}})})},createWebSocket:function(n,e){var t=swan.connectSocket({url:n,protocols:e});return{onOpen:function(r){t.onOpen(r)},onClose:function(r){t.onClose(function(i){return r(i.code,i.reason)})},onError:function(r){t.onError(function(i){return r(i.errMsg)})},onMessage:function(r){t.onMessage(function(i){return r(i.data)})},send:function(r){t.send({data:r})},close:function(r,i){t.close({code:r,reason:i})}}},createDataChannel:function(n,e){return e==="websocket"?new jt(this,n):new Kt(this,n)}},qn=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return uni[n].apply(uni,e)}catch(r){ke.error(r)}}},Fs={setItem:qn("setStorageSync"),getItem:qn("getStorageSync"),removeItem:qn("removeStorageSync"),clear:qn("clearStorageSync")},$d={tag:"uniapp",httpReq:function(n){var e=n.method||We.GET,t=n.timeout||6e4,r=n.headers,i=n.query,o=n.body,s=Nr(n.url,i);return new Promise(function(u){uni.request({url:s,method:e,headers:r,timeout:t,data:o,success:function(d){u({data:d.data,status:d.statusCode})},fail:function(){u({status:S.RC_HTTP_REQ_TIMEOUT})}})})},localStorage:Fs,sessionStorage:Fs,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(n,e){var t={complete:function(){},url:n,protocols:e},r=uni.connectSocket(t);return{onClose:function(i){r.onClose(function(o){i(o.code,o.reason)})},onError:function(i){r.onError(function(o){i(o.errMsg)})},onMessage:function(i){r.onMessage(function(o){i(o.data)})},onOpen:function(i){r.onOpen(i)},send:function(i){r.send({data:i})},close:function(i,o){r.close({code:i,reason:o})}}},createDataChannel:function(n,e){return e==="websocket"?new jt(this,n):new Kt(this,n)}},tn=function(n){return n&&n.canIUse&&n.getSystemInfo},jd=typeof uni!="undefined"&&tn(uni)?function(){switch({}.VUE_APP_PLATFORM){case"app-plus":return $d;case"mp-baidu":return Bs;case"mp-toutiao":return xs;case"mp-alipay":return Us;case"mp-weixin":return Ls;default:return As}}():typeof wx!="undefined"&&tn(wx)?Ls:typeof my!="undefined"&&tn(my)?Us:typeof tt!="undefined"&&tn(tt)?xs:typeof swan!="undefined"&&tn(swan)?Bs:As;function vr(n){var e=n.conversationType,t=n.channelId,r=n.messageType,i=n.content,o=n.senderUserId,s=n.targetId,u=n.sentTime,d=n.receivedTime,l=n.messageUId,h=n.messageDirection,a=n.isPersited,c=n.isCounted,p=n.isOffLineMessage,f=n.canIncludeExpansion,m=n.expansion,_=n.receivedStatus,v=n.disableNotification,R=n.isMentioned,C=n.isStatusMessage,M=n.readReceiptInfo,A=n.pushConfig,O=n.messageId;return _||(_=gn.UNREAD),{messageType:r,channelId:t||"",content:i,senderUserId:o,targetId:s,conversationType:e,sentTime:u,receivedTime:d,messageUId:l,messageDirection:h,isPersited:a,isCounted:c,isOffLineMessage:p,isMentioned:R,disableNotification:v,isStatusMessage:C,canIncludeExpansion:f,expansion:m,receivedStatus:_,readReceiptInfo:M,pushConfig:A,messageId:O}}(function(n){n.CONNECTING="CONNECTING",n.CONNECTED="CONNECTED",n.DISCONNECT="DISCONNECT",n.SUSPEND="SUSPEND",n.MESSAGES="MESSAGES",n.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",n.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",n.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",n.CONVERSATION="CONVERSATION",n.CHATROOM="CHATROOM",n.EXPANSION="EXPANSION",n.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",n.TAG="TAG",n.CONVERSATION_TAG="CONVERSATION_TAG",n.TYPING_STATUS="TYPING_STATUS",n.MESSAGE_BLOCKED="MESSAGE_BLOCKED"})(Ee||(Ee={}));var It,ze=function(n){function e(t){var r=n.call(this)||this;if(e.imClient)return ke.error("Please do not repeatedly perform the init method"),e.imClient;Ie("options.navigators",t.navigators,function(o){return De(o)&&(o.length===0||o.every(mn))});var i=t==null?void 0:t.connectType;return i?at.WEBSOCKET!==i&&at.COMET!==i&&(ke.warn("RongIMLib connectionType must be "+at.WEBSOCKET+" or "+at.COMET),i=at.WEBSOCKET):i=at.WEBSOCKET,r._context=Dd.init(jd,{appkey:t.appkey,apiVersion:"5.1.1",navigators:t.navigators||[],miniCMPProxy:t.customCMP||[],connectionType:i,logLevel:t.logLevel,logStdout:t.logStdout,indexDBSwitch:t.indexDBSwitch,checkCA:t.checkCA}),r.watch(),e.imClient=r,r}return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}Ii(t,r),t.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}(e,n),Object.defineProperty(e.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),e.prototype.watch=function(){var t=this,r={onConnecting:function(){t.emit(Ee.CONNECTING)},onConnected:function(){t.emit(Ee.CONNECTED)},onDisconnect:function(){t.emit(Ee.DISCONNECT)},onSuspend:function(){t.emit(Ee.SUSPEND)},batchMessage:function(i){t.emit(Ee.MESSAGES,{messages:i.map(function(o){return vr(o)})})},typingState:function(i){t.emit(Ee.TYPING_STATUS,{status:i})},readReceiptReceived:function(i,o,s){t.emit(Ee.READ_RECEIPT_RECEIVED,{conversation:i,messageUId:o,sentTime:s})},messageReceiptRequest:function(i,o,s){t.emit(Ee.MESSAGE_RECEIPT_REQUEST,{conversation:i,messageUId:o,senderUserId:s})},messageReceiptResponse:function(i,o,s){t.emit(Ee.MESSAGE_RECEIPT_RESPONSE,{conversation:i,receivedUserId:o,messageUIdList:s})},conversationState:function(i){var o=i.map(function(s){return{conversation:{conversationType:s.conversationType,latestMessage:s.latestMessage?vr(s.latestMessage):null,targetId:s.targetId,unreadMessageCount:s.unreadMessageCount,hasMentioned:s.hasMentioned,mentionedInfo:s.mentionedInfo,lastUnreadTime:s.lastUnreadTime,notificationStatus:s.notificationStatus,isTop:s.isTop,channelId:s.channelId,unreadMentionedCount:s.unreadMentionedCount},updatedItems:s.updatedItems}});t.emit(Ee.CONVERSATION,{conversationList:o})},chatroomState:function(i){t.emit(Ee.CHATROOM,i)},expansion:function(i){t.emit(Ee.EXPANSION,i)},pullFinished:function(){t.emit(Ee.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){t.emit(Ee.TAG)},conversationTagChanged:function(){t.emit(Ee.CONVERSATION_TAG)},messageBlocked:function(i){t.emit(Ee.MESSAGE_BLOCKED,i)}};this.context.assignWatcher(r)},e}(In),Rr={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:S.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},Ft={},Kd={};for(var Hs in Rr){var $s=Rr[Hs],js=$s.code;Ft[js]=Hs,Kd[js]=$s}Rr.ROAMING_SERVICE_UNAVAILABLE.code;var qd=function(n){It=It||new ze(n)};function Gd(n,e){return It==null?void 0:It.context.install(n,e)}function Yd(n){return Tn(this,void 0,void 0,function(){var e;return Sn(this,function(t){switch(t.label){case 0:return Ie("token",n,ye.STRING,!0),ke.warn("RongIMLib Version: 5.1.1, Commit: 756868a83166be55e30e49e5685b1644456ea30f"),[4,It.context.connect(n,!0)];case 1:return(e=t.sent()).code===S.SUCCESS?[2,{code:e.code,data:{userId:e.userId}}]:[2,{code:e.code,msg:Ft[e.code]}]}})})}function zd(){return It.context.disconnect()}function wn(n,e,t){It.on(n,e,t)}function Jd(n,e){return Tn(this,void 0,void 0,function(){var t,r;return Sn(this,function(i){switch(i.label){case 0:return Ie("options.count",e.count,ye.NUMBER,!0),t="id:"+n,ke.debug("join chatroom ->"+t),[4,ze.imClient.context.joinChatroom(n,e.count)];case 1:return(r=i.sent())!==S.SUCCESS?(ke.warn("join chatroom fail ->code+:"+Ft[r]+","+t),[2,{code:r,msg:Ft[r]}]):[2,{code:r}]}})})}var Xa=function(n,e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!0),this.messageType=n,this.content=e,this.isPersited=t,this.isCounted=r};function qe(n,e,t){return e===void 0&&(e=!0),t===void 0&&(t=!0),function(r){return new Xa(n,r,e,t)}}var ec,Oi,Wd=qe("RC:ImgMsg"),Zd=qe("RC:HQVCMsg"),Qd=qe("RC:SightMsg"),Xd=qe("RC:TxtMsg"),el=qe("RC:CombineMsg"),tl=qe("RC:FileMsg");qe("RC:GIFMsg");qe("RC:VcMsg");qe("RC:LBSMsg");qe("RC:ReferenceMsg");qe("RC:ImgTextMsg");var At={qiniu:function(n,e,t,r){var i,o="https://"+e.uploadHost.qiniu;i=nn()+he[0][1]||o,he.shift();var s=new XMLHttpRequest;s.upload&&e.support_options&&(s.upload.onprogress=function(u){t.onProgress(u.loaded,u.total)}),s.onreadystatechange=function(){if(s.readyState===4){var u=s.responseText||"{}";(u=JSON.parse(u)).filename=e.uniqueValue,u.uploadMethod=Ue?Ue.QINIU:"",s.status===200?t.onCompleted(u):he.length?At[he[0][0]](n,e,t,r):t.onError("upload fail")}},e.isChunk&&(i=function(u,d){var l="";return qs(d,function(h,a){h!=="token"&&(l+=(l?"&":"")+encodeURIComponent(h)+"="+encodeURIComponent(a))}),l&&(u+=(u.indexOf("?")>0?"&":"?")+l),u}(i+="/mkblk/"+n.size,e.multi_parmas)),s.open(e.method,i,!0),t.onOpen(s),e.stream&&s.setRequestHeader("authorization","UpToken "+e.multi_parmas.token),qs(e.headers,function(u,d){s.setRequestHeader(u,d)}),s.send(n)},baidu:function(n,e,t,r){if(console.log(r,e),r.size>Ks)throw new Error("the file size is over 5GB!");var i=e||{};e=e||Oi;var o=new XMLHttpRequest,s=nn();if(!(!i.uploadHost.bos&&!i.bosUploadPath)){var u=s+he[0][1]+i.bosUploadPath;he.shift();var d=i.bosHeader||{},l={filename:e.uniqueValue||r.uniqueName,name:r.name,downloadUrl:u,isBosRes:!0};o.upload&&e.support_options&&(o.upload.onprogress=function(h){t.onProgress(h.loaded,h.total,!0)}),o.onreadystatechange=function(){if(o.readyState===4){var h=o.responseText||"{}";(h=JSON.parse(h)).filename=e.uniqueValue,o.status===200?t.onCompleted(l,!0):he.length?At[he[0][0]](n,e,t,r):t.onError("upload fail")}},o.open(e.method,u,!0),o.setRequestHeader("authorization",d.bosToken),o.setRequestHeader("x-bce-date",d.bosDate),o.send(r)}},aliyun:function(n,e,t,r){if(r.size>Ks)throw new Error("the file size is over 5GB!");const i=new FormData;i.set("file",n.get("file")),i.set("key",n.get("key")),i.set("token",n.get("token"));const o=he[0][1];he.shift(),n=n||ec,e=(e=e||{})||Oi;var s=new XMLHttpRequest,u=nn()+e.ossBucketName+"."+o;s.upload&&e.support_options&&(s.upload.onprogress=function(l){t.onProgress(l.loaded,l.total)}),s.onreadystatechange=function(){if(s.readyState===4){var l=s.responseText||"{}";(l=JSON.parse(l)).name=e.uniqueValue,l.filename=e.uploadFileName,l.uploadMethod=Ue?Ue.ALI:"",s.status===200?t.onCompleted(l):he.length?At[he[0][0]](i,e,t,r):t.onError("upload fail")}},s.open(e.method,u,!0),console.log("ali:url",u);var d=e.aliHeader||{};n.set("OSSAccessKeyId",d.osskeyId),n.set("policy",d.ossPolicy),n.set("Signature",d.ossSign),n.set("success_action_status",200),n.delete("key"),n.append("key",e.uploadFileName),n.delete("file"),n.append("file",r),s.send(n)},s3:function(n,e,t,r){var i=new FormData,o=new XMLHttpRequest,s=nn();const u=he[0][1];var d=s+e.s3BucketName+"."+u;console.log("uploadS3:url",d),he.shift(),o.upload&&e.support_options&&(o.upload.onprogress=function(a){t.onProgress(a.loaded,a.total)}),o.onreadystatechange=function(){if(o.readyState===4){var a=o.responseText||"{}";if((a=JSON.parse(a)).name=e.uniqueValue,a.filename=e.uploadFileName,a.uploadMethod=Ue.AWS,console.log("UploadMethod:",Ue),o.status===200||o.status===204)t.onCompleted(a);else if(he.length){const c=new FormData;c.set("file",n.get("file")),c.set("key",n.get("key")),c.set("token",n.get("token")),At[he[0][0]](c,e,t,r)}else t.onError("upload fail")}},o.open(e.method,d,!0);var l=e?e.s3Header:{},h=r&&r.type;h==="text/html"?i.set("Content-Disposition","inline;"):i.set("Content-Disposition","attachment;"),i.set("Content-Type",h),i.set("x-amz-credential",l.s3Credential),i.set("x-amz-algorithm",l.s3Algorithm),i.set("x-amz-date",l.s3Date),i.set("policy",l.s3Policy),i.set("x-amz-signature",l.s3Signature),i.set("key",e.uploadFileName),i.set("file",r),o.send(i)},stc:function(n,e,t,r){new FormData;var i=new XMLHttpRequest;nn();var o="https://"+he[0][1]+"/"+e.stcBucketName+"/"+e.uploadFileName;he.shift(),i.upload&&e.support_options&&(i.upload.onprogress=function(u){t.onProgress(u.loaded,u.total)}),i.onreadystatechange=function(){if(i.readyState===4){var u=i.responseText||"{}";if((u=JSON.parse(u)).name=e.uniqueValue,u.filename=e.uploadFileName,u.uploadMethod=Ue?Ue.STC:"",i.status===200||i.status===204)t.onCompleted(u);else if(he.length){const d=new FormData;d.set("file",n.get("file")),d.set("key",n.get("key")),d.set("token",n.get("token")),At[he[0][0]](d,e,t,r)}else t.onError("upload fail")}},i.open("PUT",o,!0);var s=e?e.stcHeader:{};i.setRequestHeader("Content-Type",r.type),r.type==="text/html"?i.setRequestHeader("Content-Disposition","inline;"):i.setRequestHeader("Content-Disposition","attachment;"),i.setRequestHeader("Authorization",s.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",s.stcContentSha256),i.setRequestHeader("x-amz-date",s.stcDate),i.send(r)}},he=[],Ks=5368709120;function qs(n,e){for(var t in n)e(t,n[t])}function nn(){var n="https://";return location.protocol!=="http:"&&location.protocol!=="file:"||(n="http://"),n}function nl(n,e,t){var r,i,o=n&&n.type||"text/plain",s=o.indexOf("image")>-1?1:4,u=Math.ceil(n.size/e.stc_chunk_size),d=e&&JSON.parse(e.ossConfig?e.ossConfig:"");Array.isArray(d)||(d=[]);var l=d.find(m=>Object.keys(m).includes("stc")),h="uploads";ze.imClient.getFileToken(s,r,"POST",h).then(function(m){r=m.fileName,i="https://"+l.stc+"/"+e.stcBucketName+"/"+r,console.log("uploadStcMultipart:url",i);var _=new XMLHttpRequest;_.open("POST",i+"?"+h,!0),o==="text/html"?_.setRequestHeader("Content-Disposition","inline;"):_.setRequestHeader("Content-Disposition","attacshment;"),_.setRequestHeader("Authorization",m&&m.stcAuthorization),_.setRequestHeader("x-amz-content-sha256",m&&m.stcContentSha256),_.setRequestHeader("x-amz-date",m&&m.stcDate),_.setRequestHeader("Content-Type",o),_.send(),_.onreadystatechange=function(v){if(_.readyState===4){var R=_.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",R),_.status===200||_.status===204?function(C){for(var M=[],A=1;A<=u;A++)M.push(f(C,A));p(C,M)}(Array.isArray(R)&&R[1]):t.onError("uploadStcMultipart:did not get uploadId")}}},function(m){t.onError("uploadStcMultipart:"+m)});var a=[],c=new Map;function p(m,_){_&&Array.isArray(_)&&_.length!==0&&Promise.all(_).then(()=>{var v="uploadId="+m;if(c.size===u)ze.imClient.context.getFileToken(s,r,"POST",v).then(function(M){console.log("onSuccess",M),console.log("onSuccess:uploadId",m);var A=new XMLHttpRequest;A.open("POST",i+"?"+v,!0),A.setRequestHeader("Authorization",M&&M.stcAuthorization),A.setRequestHeader("x-amz-content-sha256",M&&M.stcContentSha256),A.setRequestHeader("x-amz-date",M&&M.stcDate),A.setRequestHeader("Content-Type",o);var O="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",y=Array.from(c.keys()||[]).sort((w,H)=>w-H);console.log("keys",y),y.map(w=>{O+=`<Part><ETag>${c.get(w)}</ETag><PartNumber>${w}</PartNumber></Part>`}),O+="</CompleteMultipartUpload>",A.send(O),console.log("xml",O),A.onreadystatechange=function(){if(A.readyState===4)if(A.status===200||A.status===204){var w={};w.name=n.name,w.filename=e.uploadFileName,w.uploadMethod=Ue.STC,t.onCompleted(w)}else t.onError("uploadStcMultipart:upload does not end")}},function(M){t.onError("uploadStcMultipart:"+M)});else{var R=[];for(var C of a)R.push(f(m,C));p(m,R)}},v=>{console.error(v),t.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var R=[];for(var C of a)R.push(f(m,C));p(m,R)})}function f(m,_){return new Promise((v,R)=>{var C="partNumber="+_+"&uploadId="+m;ze.imClient.context.getFileToken(s,r,"PUT",C).then(function(M){console.log("signature "+_+" onSuccess",M);var A=n&&n.slice((_-1)*e.stc_chunk_size,_*e.stc_chunk_size);console.log("fileChunk:size",A.size);var O=new XMLHttpRequest;O.open("PUT",i+"?"+C,!0),O.setRequestHeader("Authorization",M&&M.stcAuthorization),O.setRequestHeader("x-amz-content-sha256",M&&M.stcContentSha256),O.setRequestHeader("x-amz-date",M&&M.stcDate),O.setRequestHeader("Content-Type",o),O.send(A),O.onreadystatechange=function(){if(O.readyState===4)if(O.status===200||O.status===204){var y=O.getResponseHeader("etag");console.log("etag:"+_,y),c.set(_,y),v(y)}else a.includes(_)||a.push(_),R(_)}},function(M){console.log("getETags:\u7B7E\u540D\u9A8C\u8BC1\u5931\u8D25"),a.includes(_)||a.push(_),R(_)})})}}var tc={form:function(n,e){var t=new FormData;if(e.unique_key){var r=n.name.substr(n.name.lastIndexOf(".")),i=Ni()+r;t.append(e.unique_key,i),e.uniqueValue=i}return t.append(e.file_data_name,n),wi(e.multi_parmas,function(o,s){t.append(o,s)}),t},json:function(n,e){var t={};if(e.unique_key){var r=n.name.substr(n.name.lastIndexOf(".")),i=Ni()+r;t[e.unique_key]=i,e.uniqueValue=i}return t[e.file_data_name]=n,wi(e.multi_parmas,function(o,s){t[o]=s}),JSON.stringify(t)},data:function(n,e){return n}};function Ni(){var n=new Date().getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),(e==="x"?t:3&t|8).toString(16)})}function wi(n,e){for(var t in n)e(t,n[t])}var Gn,ti=0;function rl(n){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:tc.form,genUId:Ni};if(!e||!e.domain)throw new Error("domain is null");for(var r in e)t[r]=e[r];return t}(n),this.setOptions=function(e){var t=this;wi(e,function(r,i){t.options[r]=i})},console.log("options",n),this.upload=function(e,t){if(e){var r=this;(function(i,o,s){if(ec=i,Oi=o,he=[],o.ossConfig){const h=JSON.parse(o.ossConfig);let a,c,p="";const f=[];h.forEach(m=>{const _=Number(m.p)-1;for(const v in m)v==="aliyun"&&(p=m[v]),v==="s3"&&(a=m[v]),v==="stc"&&(c=m[v]),v!=="p"&&(f[_]=[v,m[v]])}),f.forEach(function(m){m&&he.push(m)}),h.length!==he.length&&(he=[["qiniu",o.domain],["baidu",o.uploadHost.bos],["aliyun",p],["s3",a],["stc",c]])}else he=[["qiniu",o.domain],["baidu",o.uploadHost.bos]];var u;if(o.ossConfig){var d=o&&JSON.parse(o.ossConfig);Array.isArray(d)||(d=[]),u=d.find(h=>Object.keys(h).includes("stc"))}if(u&&parseInt(u.p)===1&&i.size>=4194304)nl(i,o,s);else{var l=o.data(i,o);At[he[0][0]](l,o,s,i)}})(e,this.options,{onProgress:function(i,o,s){Gn=i,s?Gn=ti+i/o*(o-ti):ti=Gn,t.onProgress(Gn,o)},onCompleted:function(i){t.onCompleted(i)},onError:function(i){t.onError(i)},onOpen:function(i){r.xhr=i}})}else t.onError("upload file is null.")},this.cancel=function(){this.xhr&&this.xhr.abort()}}var Gs={init:function(n){return new rl(n)},dataType:tc,resize:function(n,e,t){n.type;var r=document.createElement("canvas"),i=new FileReader;i.readAsDataURL(n),i.onload=function(o){var s=o.target.result,u=new Image;u.src=s;var d=u.width,l=u.height,h=function(c,p){var f=1,m=c.width,_=p.maxWidth||0;_>0&&m>_&&(f=_/m);var v=c.height,R=p.maxHeight||0;if(R>0&&v>R){var C=R/v;f=Math.min(f,C)}var M=p.maxSize||0,A=Math.ceil(c.size/1e3);if(A>M){var O=M/A;f=Math.min(f,O)}return f}({width:d,height:l,size:o.total},e),a=s;h<1&&(a=function(c,p,f){r.width=p,r.height=f,r.getContext("2d").drawImage(c,0,0,p,f);var m="image/jpg";return r.toDataURL(m)}(u,d*h,l*h)),t(a)}}};const il=function(n,e,t){var r=document.createElement("canvas"),i=r.getContext("2d"),o=new Image;o.onload=function(){var s=function(l,h,a){var c,p,f,m=l<h,_=0,v=0;return(m?h/l:l/h)>a.scale?(m?(p=100,v=((f=h/(c=l/100))-a.maxHeight)/2):(f=100,_=((p=l/(c=h/100))-a.maxWidth)/2),{w:p,h:f,x:-_,y:-v}):(m?(c=h/a.maxHeight,f=a.maxHeight,p=l/c):(c=l/a.maxWidth,p=a.maxWidth,f=h/c),{w:p,h:f,x:-_,y:-v})}(o.width,o.height,e);r.width=s.w>e.maxWidth?e.maxWidth:s.w,r.height=s.h>e.maxHeight?e.maxHeight:s.h,i.drawImage(o,s.x,s.y,s.w,s.h);try{var u=r.toDataURL(n.type,e.quality),d=new RegExp("^data:image/[^;]+;base64,");u=u.replace(d,""),t(u)}catch(l){throw new Error(l)}},o.src=typeof n=="string"?"data:image/jpg;base64,"+n:function(s){var u=window.URL||window.webkitURL;return u?u.createObjectURL(s):""}(n)},ol=function(n,e){var t=n.file,r=n.compress;il(t,r,e)},nc=function(n,e){if(n.getToken)n.getToken(function(r,i){i=i||{},n.multi_parmas||(n.multi_parmas={}),n.multi_parmas.token=r,n.uploadHost||(n.uploadHost={}),n.uploadHost.bos=i.bos,n.ossConfig=i.ossConfig,n.bosHeader||(n.bosHeader={}),n.bosHeader.bosDate=i.bosDate,n.bosHeader.bosToken=i.bosToken,n.bosUploadPath=i.path,n.aliHeader={},n.aliHeader.osskeyId=i.osskeyId,n.aliHeader.ossPolicy=i.ossPolicy,n.aliHeader.ossSign=i.ossSign,n.ossBucketName=i.ossBucketName,n.uploadFileName=i.fileName,n.s3Header={},n.s3Header.s3Credential=i.s3Credential,n.s3Header.s3Algorithm=i.s3Algorithm,n.s3Header.s3Date=i.s3Date,n.s3Header.s3Policy=i.s3Policy,n.s3Header.s3Signature=i.s3Signature,n.s3BucketName=i.s3BucketName,n.stcHeader={},n.stcHeader.stcAuthorization=i.stcAuthorization,n.stcHeader.stcContentSha256=i.stcContentSha256,n.stcHeader.stcDate=i.stcDate,n.stcBucketName=i.stcBucketName,n.headers||(n.headers={}),n.base64&&(n.headers["Content-type"]="application/octet-stream",n.headers.Authorization="UpToken "+r),console.log("data",i);var o=Gs.init(n);e(o)});else{n.headers||(n.headers={}),n.base64&&(n.headers["Content-type"]="application/octet-stream");var t=Gs.init(n);e(t)}};var ni,Yn,rc=function(n,e,t){e.upload(n.file,{onError:function(r){t.onError(r)},onProgress:function(r,i){t.onProgress(r,i)},onCompleted:function(r){r.filename||(r.filename=r.hash);var i=n.compressThumbnail||ol;n.compress?i(n,function(o){r.thumbnail=o,t.onCompleted(r)}):t.onCompleted(r)}})},sl=function(n){var e=this;this.instance=n,this.upload=function(t,r){rc({file:t},e.instance,r)},this.cancel=function(){e.instance.cancel()}},al=function(n,e){var t=this;this.cfg=e,this.instance=n,this.upload=function(r,i){var o={file:r,compress:t.cfg};rc(o,t.instance,i)},this.cancel=function(){t.instance.cancel()}},cl=function(n,e){nc(n,function(t){var r={maxHeight:n.maxHeight||160,maxWidth:n.maxWidth||160,quality:n.quality||.5,scale:n.scale||2.4},i=new al(t,r);e(i)})},ul=function(n,e){nc(n,function(t){var r=new sl(t);e(r)})},dl=cl;function Ys(n){return ni=ni||new AudioContext,new Promise(function(e,t){ni.decodeAudioData(n,function(r){e({duration:r.duration,length:r.length})},t)})}function ll(n,e,t,r,i){return Ie("fileType",n,Uu,!0),Ie("filename",e,ye.STRING),Ie("saveName",t,ye.STRING),Ie("serverType",i,ye.NUMBER),new Promise(function(o){ze.imClient.context.getFileUrl(n,e,t,r,i).then(function(s){o({code:S.SUCCESS,data:s})}).catch(function(s){o({code:s})})})}function ic(n,e,t){return Tn(this,void 0,void 0,function(){var r,i,o,s,u,d,l,h,a;return Sn(this,function(c){switch(c.label){case 0:return t=t||{},e instanceof Xa?(Ie("conversation.channelId",n==null?void 0:n.channelId,ye.CHANNEL_ID),r=n.conversationType,i=n.targetId,o=n.channelId,s="conversationType:"+r+",targetId:"+i,ke.debug("send message ->"+s),(u=Object.assign(t,e)).channelId=o||"",[4,ze.imClient.context.sendMessage(r,i,u)]):(ke.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,Rr.ILLGAL_PARAMS]);case 1:return d=c.sent(),l=d.code,h=d.data,l===S.SUCCESS?(a=vr(h),[2,{code:l,data:a}]):(ke.warn("send message fail ->"+l+":"+Ft[l]+","+s),[2,{code:l,msg:Ft[l],data:vr({isMentioned:!!t.isMentioned,content:e.content,messageType:e.messageType,isPersited:e.isPersited||!1,isCounted:e.isCounted||!1,disableNotification:!!(t==null?void 0:t.disableNotification),canIncludeExpansion:!!(t==null?void 0:t.canIncludeExpansion),expansion:(t==null?void 0:t.expansion)||null,conversationType:r,targetId:i,channelId:o||"",senderUserId:ze.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:je.SEND,isOffLineMessage:!1,sentTime:(h==null?void 0:h.sentTime)||0,receivedTime:0,isStatusMessage:t.isStatusMessage||!1,receivedStatus:gn.UNREAD})}])}})})}function Mn(n,e){return function(t,r,i,o){return new Promise(function(s){var u;(function(d,l,h,a){var c,p=this;if(l===void 0&&(l=Se.FILE),c=l===Se.IMAGE?Se.IMAGE:Se.FILE,!Yn){Yn="upload.qiniup.com";var f=ze.imClient.context.getInfoFromCache();if(f&&f.ossConfig)try{var m=JSON.parse(f.ossConfig).find(function(v){return v.qiniu!==void 0});m&&(Yn=m.qiniu)}catch{}}var _=bi({domain:Yn,getToken:function(v){ze.imClient.context.getFileToken(c).then(function(R){v(R.token,R)}).catch(function(R){h.onFail(R)})}},a);(c===Se.IMAGE?dl:ul)(_,function(v){v.upload(d,{onProgress:function(R,C){var M,A=Math.floor(R/C*100);(M=h.onProgress)===null||M===void 0||M.call(h,A)},onCompleted:function(R){return Tn(p,void 0,void 0,function(){var C=this;return Sn(this,function(M){return ll(c,R.filename,R.name,R,R.uploadMethod).then(function(A){return Tn(C,void 0,void 0,function(){var O,y;return Sn(this,function(w){return A.code!==0?(h.onFail(A),[2]):((O=A.data).type=d.type,O.name=R.name||R.filename,l===Se.AUDIO?(typeof d.arrayBuffer=="function"?d.arrayBuffer().then(Ys).then(function(H){Object.assign(O,H),h.onSuccess(O)},function(){h.onSuccess(O)}):((y=new FileReader).onload=function(){y.result?Ys(y.result).then(function(H){Object.assign(O,H),h.onSuccess(O)},function(){h.onSuccess(O)}):h.onSuccess(O)},y.onerror=function(){O.duration=0,h.onSuccess(O)},y.readAsArrayBuffer(d)),[2]):(c===Se.IMAGE&&(O.thumbnail=R.thumbnail),h.onSuccess(O),[2]))})})}).catch(function(A){h.onFail(A)}),[2]})})},onError:function(R){h.onFail(R)}})})})(r.file,n,{onProgress:i==null?void 0:i.onProgress,onSuccess:function(d){var l,h=((l=i==null?void 0:i.onComplete)===null||l===void 0?void 0:l.call(i,{url:d.downloadUrl}))||e(d,r);ic(t,h,o).then(s)},onFail:function(d){s({code:S.UPLOAD_FILE_FAILED,msg:d||S[S.UPLOAD_FILE_FAILED]})}},((u=o)===null||u===void 0?void 0:u.thumbnailConfig)||{})})}}Mn(Se.FILE,function(n,e){return new tl({name:n.name,size:e.file.size,type:e.file.type,fileUrl:n.downloadUrl,user:e.user,extra:e.extra})});Mn(Se.IMAGE,function(n,e){return new Wd({content:n.thumbnail,imageUri:n.downloadUrl,user:e.user,extra:e.extra})});Mn(Se.AUDIO,function(n,e){return new Zd({remoteUrl:n.downloadUrl,duration:n.duration,type:n.type,user:e.user,extra:e.extra})});Mn(Se.SIGHT,function(n,e){return new Qd({sightUrl:n.downloadUrl,content:e.thumbnail,duration:e.duration,size:e.file.size||n.size,name:e.name||n.name,user:e.user,extra:e.extra})});function bt(n,e,t,r){return Ie("messageType",n,ye.STRING,!0),Ie("isPersited",e,ye.BOOLEAN,!0),Ie("isCounted",t,ye.BOOLEAN,!0),ze.imClient.context.registerMessageType(n,e,t,r),qe(n,e,t)}Mn(Se.COMBINE_HTML,function(n,e){return new el({remoteUrl:n.downloadUrl,nameList:e.nameList,summaryList:e.summaryList,conversationType:e.conversationType,user:e.user,extra:e.extra})});Tt.add("imlib","5.1.1"),Tt.validEngine("~5.1.1")||ke.error("The current engine version '"+Tt.getInfo().engine+"' error\uFF0Cimlib required engine version at least '~5.1.1'.");/*! *****************************************************************************
  808. Copyright (c) Microsoft Corporation.
  809. Permission to use, copy, modify, and/or distribute this software for any
  810. purpose with or without fee is hereby granted.
  811. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  812. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  813. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  814. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  815. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  816. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  817. PERFORMANCE OF THIS SOFTWARE.
  818. ***************************************************************************** */function B(n,e,t,r){return new(t||(t=Promise))(function(i,o){function s(l){try{d(r.next(l))}catch(h){o(h)}}function u(l){try{d(r.throw(l))}catch(h){o(h)}}function d(l){var h;l.done?i(l.value):(h=l.value,h instanceof t?h:new t(function(a){a(h)})).then(s,u)}d((r=r.apply(n,e||[])).next())})}const b=new gt("RCRTC");var I,Mi;(function(n){n[n.SUCCESS=1e4]="SUCCESS",n[n.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",n[n.PARAMS_ERROR=50001]="PARAMS_ERROR",n[n.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",n[n.NOT_IN_ROOM=50003]="NOT_IN_ROOM",n[n.SERVICE_INVALID=50004]="SERVICE_INVALID",n[n.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",n[n.SIGNAL_ERROR=53001]="SIGNAL_ERROR",n[n.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",n[n.REQUEST_FAILED=53004]="REQUEST_FAILED",n[n.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",n[n.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",n[n.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",n[n.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",n[n.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",n[n.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",n[n.PERMISSION_DENIED=53012]="PERMISSION_DENIED",n[n.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",n[n.INVALID_TAGS=53014]="INVALID_TAGS",n[n.INVALID_USER_ID=53015]="INVALID_USER_ID",n[n.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",n[n.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",n[n.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",n[n.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",n[n.TRACK_NOT_READY=53020]="TRACK_NOT_READY",n[n.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",n[n.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",n[n.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",n[n.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",n[n.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",n[n.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",n[n.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",n[n.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",n[n.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",n[n.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM"})(I||(I={})),function(n){n[n.JOIN_REFUSED=40032]="JOIN_REFUSED"}(Mi||(Mi={}));class oc{constructor(){this.queue=[],this.locked=!1}checkToStart(){return B(this,void 0,void 0,function*(){if(this.queue.length===0||this.locked)return;this.locked=!0;const{resolve:e,task:t,reject:r}=this.queue.shift();let i;try{i=yield t(),e(i)}catch(o){r(o)}this.locked=!1,this.checkToStart()})}push(e){const t=new Promise((r,i)=>{this.queue.push({resolve:r,task:e,reject:i})});return this.checkToStart(),t}}const hl=new oc,ve=n=>hl.push(n);let sc=!0,ac=!0;function rn(n,e,t){const r=n.match(e);return r&&r.length>=t&&parseInt(r[t],10)}function qt(n,e,t){if(!n.RTCPeerConnection)return;const r=n.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(s,u){if(s!==e)return i.apply(this,arguments);const d=l=>{const h=t(l);h&&(u.handleEvent?u.handleEvent(h):u(h))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(u,d),i.apply(this,[s,d])};const o=r.removeEventListener;r.removeEventListener=function(s,u){if(s!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(u))return o.apply(this,arguments);const d=this._eventMap[e].get(u);return this._eventMap[e].delete(u),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[s,d])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function pl(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(sc=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function fl(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(ac=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function $o(){if(typeof window=="object"){if(sc)return;typeof console!="undefined"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Fr(n,e){ac&&console.warn(n+" is deprecated, please use "+e+" instead.")}function zs(n){return Object.prototype.toString.call(n)==="[object Object]"}function cc(n){return zs(n)?Object.keys(n).reduce(function(e,t){const r=zs(n[t]),i=r?cc(n[t]):n[t],o=r&&!Object.keys(i).length;return i===void 0||o?e:Object.assign(e,{[t]:i})},{}):n}function Ai(n,e,t){e&&!t.has(e.id)&&(t.set(e.id,e),Object.keys(e).forEach(r=>{r.endsWith("Id")?Ai(n,n.get(e[r]),t):r.endsWith("Ids")&&e[r].forEach(i=>{Ai(n,n.get(i),t)})}))}function Js(n,e,t){const r=t?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const o=[];return n.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&o.push(s)}),o.forEach(s=>{n.forEach(u=>{u.type===r&&u.trackId===s.id&&Ai(n,u,i)})}),i}const Ws=$o;function uc(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const r=function(s){if(typeof s!="object"||s.mandatory||s.optional)return s;const u={};return Object.keys(s).forEach(d=>{if(d==="require"||d==="advanced"||d==="mediaSource")return;const l=typeof s[d]=="object"?s[d]:{ideal:s[d]};l.exact!==void 0&&typeof l.exact=="number"&&(l.min=l.max=l.exact);const h=function(a,c){return a?a+c.charAt(0).toUpperCase()+c.slice(1):c==="deviceId"?"sourceId":c};if(l.ideal!==void 0){u.optional=u.optional||[];let a={};typeof l.ideal=="number"?(a[h("min",d)]=l.ideal,u.optional.push(a),a={},a[h("max",d)]=l.ideal,u.optional.push(a)):(a[h("",d)]=l.ideal,u.optional.push(a))}l.exact!==void 0&&typeof l.exact!="number"?(u.mandatory=u.mandatory||{},u.mandatory[h("",d)]=l.exact):["min","max"].forEach(a=>{l[a]!==void 0&&(u.mandatory=u.mandatory||{},u.mandatory[h(a,d)]=l[a])})}),s.advanced&&(u.optional=(u.optional||[]).concat(s.advanced)),u},i=function(s,u){if(e.version>=61)return u(s);if((s=JSON.parse(JSON.stringify(s)))&&typeof s.audio=="object"){const d=function(l,h,a){h in l&&!(a in l)&&(l[a]=l[h],delete l[h])};d((s=JSON.parse(JSON.stringify(s))).audio,"autoGainControl","googAutoGainControl"),d(s.audio,"noiseSuppression","googNoiseSuppression"),s.audio=r(s.audio)}if(s&&typeof s.video=="object"){let d=s.video.facingMode;d=d&&(typeof d=="object"?d:{ideal:d});const l=e.version<66;if(d&&(d.exact==="user"||d.exact==="environment"||d.ideal==="user"||d.ideal==="environment")&&(!t.mediaDevices.getSupportedConstraints||!t.mediaDevices.getSupportedConstraints().facingMode||l)){let h;if(delete s.video.facingMode,d.exact==="environment"||d.ideal==="environment"?h=["back","rear"]:d.exact!=="user"&&d.ideal!=="user"||(h=["front"]),h)return t.mediaDevices.enumerateDevices().then(a=>{let c=(a=a.filter(p=>p.kind==="videoinput")).find(p=>h.some(f=>p.label.toLowerCase().includes(f)));return!c&&a.length&&h.includes("back")&&(c=a[a.length-1]),c&&(s.video.deviceId=d.exact?{exact:c.deviceId}:{ideal:c.deviceId}),s.video=r(s.video),Ws("chrome: "+JSON.stringify(s)),u(s)})}s.video=r(s.video)}return Ws("chrome: "+JSON.stringify(s)),u(s)},o=function(s){return e.version>=64?s:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[s.name]||s.name,message:s.message,constraint:s.constraint||s.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(t.getUserMedia=function(s,u,d){i(s,l=>{t.webkitGetUserMedia(l,u,h=>{d&&d(o(h))})})}.bind(t),t.mediaDevices.getUserMedia){const s=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(u){return i(u,d=>s(d).then(l=>{if(d.audio&&!l.getAudioTracks().length||d.video&&!l.getVideoTracks().length)throw l.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return l},l=>Promise.reject(o(l))))}}}function dc(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function lc(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",r=>{let i;i=n.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(s=>s.track&&s.track.id===r.track.id):{track:r.track};const o=new Event("track");o.track=r.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],this.dispatchEvent(o)}),t.stream.getTracks().forEach(r=>{let i;i=n.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(s=>s.track&&s.track.id===r.id):{track:r};const o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else qt(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function hc(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(i,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=i.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:i}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(s,u){let d=i.apply(this,arguments);return d||(d=e(this,s),this._senders.push(d)),d};const o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(s){o.apply(this,arguments);const u=this._senders.indexOf(s);u!==-1&&this._senders.splice(u,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(i){this._senders=this._senders||[],t.apply(this,[i]),i.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(i){this._senders=this._senders||[],r.apply(this,[i]),i.getTracks().forEach(o=>{const s=this._senders.find(u=>u.track===o);s&&this._senders.splice(this._senders.indexOf(s),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(r=>r._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function pc(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,r,i]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const o=function(u){const d={};return u.result().forEach(l=>{const h={id:l.id,timestamp:l.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[l.type]||l.type};l.names().forEach(a=>{h[a]=l.stat(a)}),d[h.id]=h}),d},s=function(u){return new Map(Object.keys(u).map(d=>[d,u[d]]))};if(arguments.length>=2){const u=function(d){r(s(o(d)))};return e.apply(this,[u,t])}return new Promise((u,d)=>{e.apply(this,[function(l){u(s(o(l)))},d])}).then(r,i)}}function fc(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const i=t.apply(this,[]);return i.forEach(o=>o._pc=this),i});const r=n.RTCPeerConnection.prototype.addTrack;r&&(n.RTCPeerConnection.prototype.addTrack=function(){const i=r.apply(this,arguments);return i._pc=this,i}),n.RTCRtpSender.prototype.getStats=function(){const i=this;return this._pc.getStats().then(o=>Js(o,i.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const r=t.apply(this,[]);return r.forEach(i=>i._pc=this),r}),qt(n,"track",r=>(r.receiver._pc=r.srcElement,r)),n.RTCRtpReceiver.prototype.getStats=function(){const r=this;return this._pc.getStats().then(i=>Js(i,r.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype)||!("getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let r,i,o;return this.getSenders().forEach(s=>{s.track===t&&(r?o=!0:r=s)}),this.getReceivers().forEach(s=>(s.track===t&&(i?o=!0:i=s),s.track===t)),o||r&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function gc(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,s){if(!s)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const u=e.apply(this,arguments);return this._shimmedLocalStreams[s.id]?this._shimmedLocalStreams[s.id].indexOf(u)===-1&&this._shimmedLocalStreams[s.id].push(u):this._shimmedLocalStreams[s.id]=[s,u],u};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(d=>{if(this.getSenders().find(l=>l.track===d))throw new DOMException("Track already exists.","InvalidAccessError")});const s=this.getSenders();t.apply(this,arguments);const u=this.getSenders().filter(d=>s.indexOf(d)===-1);this._shimmedLocalStreams[o.id]=[o].concat(u)};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],r.apply(this,arguments)};const i=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(s=>{const u=this._shimmedLocalStreams[s].indexOf(o);u!==-1&&this._shimmedLocalStreams[s].splice(u,1),this._shimmedLocalStreams[s].length===1&&delete this._shimmedLocalStreams[s]}),i.apply(this,arguments)}}function mc(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return gc(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const l=t.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(h=>this._reverseStreams[h.id])};const r=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(h=>{if(this.getSenders().find(a=>a.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const h=new n.MediaStream(l.getTracks());this._streams[l.id]=h,this._reverseStreams[h.id]=l,l=h}r.apply(this,[l])};const i=n.RTCPeerConnection.prototype.removeStream;function o(l,h){let a=h.sdp;return Object.keys(l._reverseStreams||[]).forEach(c=>{const p=l._reverseStreams[c],f=l._streams[p.id];a=a.replace(new RegExp(f.id,"g"),p.id)}),new RTCSessionDescription({type:h.type,sdp:a})}function s(l,h){let a=h.sdp;return Object.keys(l._reverseStreams||[]).forEach(c=>{const p=l._reverseStreams[c],f=l._streams[p.id];a=a.replace(new RegExp(p.id,"g"),f.id)}),new RTCSessionDescription({type:h.type,sdp:a})}n.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},n.RTCPeerConnection.prototype.addTrack=function(l,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const a=[].slice.call(arguments,1);if(a.length!==1||!a[0].getTracks().find(f=>f===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(f=>f.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const p=this._streams[h.id];if(p)p.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const f=new n.MediaStream([l]);this._streams[h.id]=f,this._reverseStreams[f.id]=h,this.addStream(f)}return this.getSenders().find(f=>f.track===l)},["createOffer","createAnswer"].forEach(function(l){const h=n.RTCPeerConnection.prototype[l],a={[l](){const c=arguments;return arguments.length&&typeof arguments[0]=="function"?h.apply(this,[p=>{const f=o(this,p);c[0].apply(null,[f])},p=>{c[1]&&c[1].apply(null,p)},arguments[2]]):h.apply(this,arguments).then(p=>o(this,p))}};n.RTCPeerConnection.prototype[l]=a[l]});const u=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=s(this,arguments[0]),u.apply(this,arguments)):u.apply(this,arguments)};const d=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const l=d.get.apply(this);return l.type===""?l:o(this,l)}}),n.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(l._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let h;this._streams=this._streams||{},Object.keys(this._streams).forEach(a=>{this._streams[a].getTracks().find(c=>l.track===c)&&(h=this._streams[a])}),h&&(h.getTracks().length===1?this.removeStream(this._reverseStreams[h.id]):h.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Pi(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const r=n.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=i[t]})}function _c(n,e){qt(n,"negotiationneeded",t=>{const r=t.target;if(!(e.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")||r.signalingState==="stable")return t})}var Zs=Object.freeze({__proto__:null,shimMediaStream:dc,shimOnTrack:lc,shimGetSendersWithDtmf:hc,shimGetStats:pc,shimSenderReceiverGetStats:fc,shimAddTrackRemoveTrackWithNative:gc,shimAddTrackRemoveTrack:mc,shimPeerConnection:Pi,fixNegotiationNeeded:_c,shimGetUserMedia:uc,shimGetDisplayMedia:function(n,e){n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||n.navigator.mediaDevices&&(typeof e=="function"?n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(r=>{const i=t.video&&t.video.width,o=t.video&&t.video.height,s=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:r,maxFrameRate:s||3}},i&&(t.video.mandatory.maxWidth=i),o&&(t.video.mandatory.maxHeight=o),n.navigator.mediaDevices.getUserMedia(t)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),Qs,ri,Z=(Qs=function(n){var e={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
  819. `).map(function(r){return r.trim()})},e.splitSections=function(t){return t.split(`
  820. m=`).map(function(r,i){return(i>0?"m="+r:r).trim()+`\r
  821. `})},e.getDescription=function(t){var r=e.splitSections(t);return r&&r[0]},e.getMediaSections=function(t){var r=e.splitSections(t);return r.shift(),r},e.matchPrefix=function(t,r){return e.splitLines(t).filter(function(i){return i.indexOf(r)===0})},e.parseCandidate=function(t){for(var r,i={foundation:(r=t.indexOf("a=candidate:")===0?t.substring(12).split(" "):t.substring(10).split(" "))[0],component:parseInt(r[1],10),protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]},o=8;o<r.length;o+=2)switch(r[o]){case"raddr":i.relatedAddress=r[o+1];break;case"rport":i.relatedPort=parseInt(r[o+1],10);break;case"tcptype":i.tcpType=r[o+1];break;case"ufrag":i.ufrag=r[o+1],i.usernameFragment=r[o+1];break;default:i[r[o]]=r[o+1]}return i},e.writeCandidate=function(t){var r=[];r.push(t.foundation),r.push(t.component),r.push(t.protocol.toUpperCase()),r.push(t.priority),r.push(t.address||t.ip),r.push(t.port);var i=t.type;return r.push("typ"),r.push(i),i!=="host"&&t.relatedAddress&&t.relatedPort&&(r.push("raddr"),r.push(t.relatedAddress),r.push("rport"),r.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(r.push("ufrag"),r.push(t.usernameFragment||t.ufrag)),"candidate:"+r.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){var r=t.substr(9).split(" "),i={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=parseInt(r[1],10),i.channels=r.length===3?parseInt(r[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(t){var r=t.payloadType;t.preferredPayloadType!==void 0&&(r=t.preferredPayloadType);var i=t.channels||t.numChannels||1;return"a=rtpmap:"+r+" "+t.name+"/"+t.clockRate+(i!==1?"/"+i:"")+`\r
  822. `},e.parseExtmap=function(t){var r=t.substr(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&t.direction!=="sendrecv"?"/"+t.direction:"")+" "+t.uri+`\r
  823. `},e.parseFmtp=function(t){for(var r,i={},o=t.substr(t.indexOf(" ")+1).split(";"),s=0;s<o.length;s++)i[(r=o[s].trim().split("="))[0].trim()]=r[1];return i},e.writeFmtp=function(t){var r="",i=t.payloadType;if(t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){var o=[];Object.keys(t.parameters).forEach(function(s){t.parameters[s]?o.push(s+"="+t.parameters[s]):o.push(s)}),r+="a=fmtp:"+i+" "+o.join(";")+`\r
  824. `}return r},e.parseRtcpFb=function(t){var r=t.substr(t.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},e.writeRtcpFb=function(t){var r="",i=t.payloadType;return t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(function(o){r+="a=rtcp-fb:"+i+" "+o.type+(o.parameter&&o.parameter.length?" "+o.parameter:"")+`\r
  825. `}),r},e.parseSsrcMedia=function(t){var r=t.indexOf(" "),i={ssrc:parseInt(t.substr(7,r-7),10)},o=t.indexOf(":",r);return o>-1?(i.attribute=t.substr(r+1,o-r-1),i.value=t.substr(o+1)):i.attribute=t.substr(r+1),i},e.parseSsrcGroup=function(t){var r=t.substr(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(function(i){return parseInt(i,10)})}},e.getMid=function(t){var r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)},e.parseFingerprint=function(t){var r=t.substr(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1]}},e.getDtlsParameters=function(t,r){return{role:"auto",fingerprints:e.matchPrefix(t+r,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,r){var i="a=setup:"+r+`\r
  826. `;return t.fingerprints.forEach(function(o){i+="a=fingerprint:"+o.algorithm+" "+o.value+`\r
  827. `}),i},e.parseCryptoLine=function(t){var r=t.substr(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+(typeof t.keyParams=="object"?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+`\r
  828. `},e.parseCryptoKeyParams=function(t){if(t.indexOf("inline:")!==0)return null;var r=t.substr(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},e.getCryptoParameters=function(t,r){return e.matchPrefix(t+r,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(t,r){var i=e.matchPrefix(t+r,"a=ice-ufrag:")[0],o=e.matchPrefix(t+r,"a=ice-pwd:")[0];return i&&o?{usernameFragment:i.substr(12),password:o.substr(10)}:null},e.writeIceParameters=function(t){return"a=ice-ufrag:"+t.usernameFragment+`\r
  829. a=ice-pwd:`+t.password+`\r
  830. `},e.parseRtpParameters=function(t){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=e.splitLines(t)[0].split(" "),o=3;o<i.length;o++){var s=i[o],u=e.matchPrefix(t,"a=rtpmap:"+s+" ")[0];if(u){var d=e.parseRtpMap(u),l=e.matchPrefix(t,"a=fmtp:"+s+" ");switch(d.parameters=l.length?e.parseFmtp(l[0]):{},d.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+s+" ").map(e.parseRtcpFb),r.codecs.push(d),d.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(d.name.toUpperCase())}}}return e.matchPrefix(t,"a=extmap:").forEach(function(h){r.headerExtensions.push(e.parseExtmap(h))}),r},e.writeRtpDescription=function(t,r){var i="";i+="m="+t+" ",i+=r.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=r.codecs.map(function(s){return s.preferredPayloadType!==void 0?s.preferredPayloadType:s.payloadType}).join(" ")+`\r
  831. `,i+=`c=IN IP4 0.0.0.0\r
  832. `,i+=`a=rtcp:9 IN IP4 0.0.0.0\r
  833. `,r.codecs.forEach(function(s){i+=e.writeRtpMap(s),i+=e.writeFmtp(s),i+=e.writeRtcpFb(s)});var o=0;return r.codecs.forEach(function(s){s.maxptime>o&&(o=s.maxptime)}),o>0&&(i+="a=maxptime:"+o+`\r
  834. `),i+=`a=rtcp-mux\r
  835. `,r.headerExtensions&&r.headerExtensions.forEach(function(s){i+=e.writeExtmap(s)}),i},e.parseRtpEncodingParameters=function(t){var r,i=[],o=e.parseRtpParameters(t),s=o.fecMechanisms.indexOf("RED")!==-1,u=o.fecMechanisms.indexOf("ULPFEC")!==-1,d=e.matchPrefix(t,"a=ssrc:").map(function(c){return e.parseSsrcMedia(c)}).filter(function(c){return c.attribute==="cname"}),l=d.length>0&&d[0].ssrc,h=e.matchPrefix(t,"a=ssrc-group:FID").map(function(c){return c.substr(17).split(" ").map(function(p){return parseInt(p,10)})});h.length>0&&h[0].length>1&&h[0][0]===l&&(r=h[0][1]),o.codecs.forEach(function(c){if(c.name.toUpperCase()==="RTX"&&c.parameters.apt){var p={ssrc:l,codecPayloadType:parseInt(c.parameters.apt,10)};l&&r&&(p.rtx={ssrc:r}),i.push(p),s&&((p=JSON.parse(JSON.stringify(p))).fec={ssrc:l,mechanism:u?"red+ulpfec":"red"},i.push(p))}}),i.length===0&&l&&i.push({ssrc:l});var a=e.matchPrefix(t,"b=");return a.length&&(a=a[0].indexOf("b=TIAS:")===0?parseInt(a[0].substr(7),10):a[0].indexOf("b=AS:")===0?1e3*parseInt(a[0].substr(5),10)*.95-16e3:void 0,i.forEach(function(c){c.maxBitrate=a})),i},e.parseRtcpParameters=function(t){var r={},i=e.matchPrefix(t,"a=ssrc:").map(function(u){return e.parseSsrcMedia(u)}).filter(function(u){return u.attribute==="cname"})[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var o=e.matchPrefix(t,"a=rtcp-rsize");r.reducedSize=o.length>0,r.compound=o.length===0;var s=e.matchPrefix(t,"a=rtcp-mux");return r.mux=s.length>0,r},e.parseMsid=function(t){var r,i=e.matchPrefix(t,"a=msid:");if(i.length===1)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var o=e.matchPrefix(t,"a=ssrc:").map(function(s){return e.parseSsrcMedia(s)}).filter(function(s){return s.attribute==="msid"});return o.length>0?{stream:(r=o[0].value.split(" "))[0],track:r[1]}:void 0},e.parseSctpDescription=function(t){var r,i=e.parseMLine(t),o=e.matchPrefix(t,"a=max-message-size:");o.length>0&&(r=parseInt(o[0].substr(19),10)),isNaN(r)&&(r=65536);var s=e.matchPrefix(t,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substr(12),10),protocol:i.fmt,maxMessageSize:r};if(e.matchPrefix(t,"a=sctpmap:").length>0){var u=e.matchPrefix(t,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(u[0],10),protocol:u[1],maxMessageSize:r}}},e.writeSctpDescription=function(t,r){var i=[];return i=t.protocol!=="DTLS/SCTP"?["m="+t.kind+" 9 "+t.protocol+" "+r.protocol+`\r
  836. `,`c=IN IP4 0.0.0.0\r
  837. `,"a=sctp-port:"+r.port+`\r
  838. `]:["m="+t.kind+" 9 "+t.protocol+" "+r.port+`\r
  839. `,`c=IN IP4 0.0.0.0\r
  840. `,"a=sctpmap:"+r.port+" "+r.protocol+` 65535\r
  841. `],r.maxMessageSize!==void 0&&i.push("a=max-message-size:"+r.maxMessageSize+`\r
  842. `),i.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(t,r,i){var o=r!==void 0?r:2;return`v=0\r
  843. o=`+(i||"thisisadapterortc")+" "+(t||e.generateSessionId())+" "+o+` IN IP4 127.0.0.1\r
  844. s=-\r
  845. t=0 0\r
  846. `},e.writeMediaSection=function(t,r,i,o){var s=e.writeRtpDescription(t.kind,r);if(s+=e.writeIceParameters(t.iceGatherer.getLocalParameters()),s+=e.writeDtlsParameters(t.dtlsTransport.getLocalParameters(),i==="offer"?"actpass":"active"),s+="a=mid:"+t.mid+`\r
  847. `,t.direction?s+="a="+t.direction+`\r
  848. `:t.rtpSender&&t.rtpReceiver?s+=`a=sendrecv\r
  849. `:t.rtpSender?s+=`a=sendonly\r
  850. `:t.rtpReceiver?s+=`a=recvonly\r
  851. `:s+=`a=inactive\r
  852. `,t.rtpSender){var u="msid:"+o.id+" "+t.rtpSender.track.id+`\r
  853. `;s+="a="+u,s+="a=ssrc:"+t.sendEncodingParameters[0].ssrc+" "+u,t.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" "+u,s+="a=ssrc-group:FID "+t.sendEncodingParameters[0].ssrc+" "+t.sendEncodingParameters[0].rtx.ssrc+`\r
  854. `)}return s+="a=ssrc:"+t.sendEncodingParameters[0].ssrc+" cname:"+e.localCName+`\r
  855. `,t.rtpSender&&t.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" cname:"+e.localCName+`\r
  856. `),s},e.getDirection=function(t,r){for(var i=e.splitLines(t),o=0;o<i.length;o++)switch(i[o]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[o].substr(2)}return r?e.getDirection(r):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substr(2)},e.isRejected=function(t){return t.split(" ",2)[1]==="0"},e.parseMLine=function(t){var r=e.splitLines(t)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},e.parseOLine=function(t){var r=e.matchPrefix(t,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},e.isValidSDP=function(t){if(typeof t!="string"||t.length===0)return!1;for(var r=e.splitLines(t),i=0;i<r.length;i++)if(r[i].length<2||r[i].charAt(1)!=="=")return!1;return!0},n.exports=e},Qs(ri={exports:{}},ri.exports),ri.exports);function Xs(n,e,t,r,i){var o=Z.writeRtpDescription(n.kind,e);if(o+=Z.writeIceParameters(n.iceGatherer.getLocalParameters()),o+=Z.writeDtlsParameters(n.dtlsTransport.getLocalParameters(),t==="offer"?"actpass":i||"active"),o+="a=mid:"+n.mid+`\r
  857. `,n.rtpSender&&n.rtpReceiver?o+=`a=sendrecv\r
  858. `:n.rtpSender?o+=`a=sendonly\r
  859. `:n.rtpReceiver?o+=`a=recvonly\r
  860. `:o+=`a=inactive\r
  861. `,n.rtpSender){var s=n.rtpSender._initialTrackId||n.rtpSender.track.id;n.rtpSender._initialTrackId=s;var u="msid:"+(r?r.id:"-")+" "+s+`\r
  862. `;o+="a="+u,o+="a=ssrc:"+n.sendEncodingParameters[0].ssrc+" "+u,n.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+n.sendEncodingParameters[0].rtx.ssrc+" "+u,o+="a=ssrc-group:FID "+n.sendEncodingParameters[0].ssrc+" "+n.sendEncodingParameters[0].rtx.ssrc+`\r
  863. `)}return o+="a=ssrc:"+n.sendEncodingParameters[0].ssrc+" cname:"+Z.localCName+`\r
  864. `,n.rtpSender&&n.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+n.sendEncodingParameters[0].rtx.ssrc+" cname:"+Z.localCName+`\r
  865. `),o}function zn(n,e){var t={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(o,s){o=parseInt(o,10);for(var u=0;u<s.length;u++)if(s[u].payloadType===o||s[u].preferredPayloadType===o)return s[u]},i=function(o,s,u,d){var l=r(o.parameters.apt,u),h=r(s.parameters.apt,d);return l&&h&&l.name.toLowerCase()===h.name.toLowerCase()};return n.codecs.forEach(function(o){for(var s=0;s<e.codecs.length;s++){var u=e.codecs[s];if(o.name.toLowerCase()===u.name.toLowerCase()&&o.clockRate===u.clockRate){if(o.name.toLowerCase()==="rtx"&&o.parameters&&u.parameters.apt&&!i(o,u,n.codecs,e.codecs))continue;(u=JSON.parse(JSON.stringify(u))).numChannels=Math.min(o.numChannels,u.numChannels),t.codecs.push(u),u.rtcpFeedback=u.rtcpFeedback.filter(function(d){for(var l=0;l<o.rtcpFeedback.length;l++)if(o.rtcpFeedback[l].type===d.type&&o.rtcpFeedback[l].parameter===d.parameter)return!0;return!1});break}}}),n.headerExtensions.forEach(function(o){for(var s=0;s<e.headerExtensions.length;s++){var u=e.headerExtensions[s];if(o.uri===u.uri){t.headerExtensions.push(u);break}}}),t}function ea(n,e,t){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[e][n].indexOf(t)!==-1}function ii(n,e){var t=n.getRemoteCandidates().find(function(r){return e.foundation===r.foundation&&e.ip===r.ip&&e.port===r.port&&e.priority===r.priority&&e.protocol===r.protocol&&e.type===r.type});return t||n.addRemoteCandidate(e),!t}function be(n,e){var t=new Error(e);return t.name=n,t.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[n],t}var gl=function(n,e){function t(s,u){u.addTrack(s),u.dispatchEvent(new n.MediaStreamTrackEvent("addtrack",{track:s}))}function r(s,u,d,l){var h=new Event("track");h.track=u,h.receiver=d,h.transceiver={receiver:d},h.streams=l,n.setTimeout(function(){s._dispatchEvent("track",h)})}var i=function(s){var u=this,d=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(h){u[h]=d[h].bind(d)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",s=JSON.parse(JSON.stringify(s||{})),this.usingBundle=s.bundlePolicy==="max-bundle",s.rtcpMuxPolicy==="negotiate")throw be("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(s.rtcpMuxPolicy||(s.rtcpMuxPolicy="require"),s.iceTransportPolicy){case"all":case"relay":break;default:s.iceTransportPolicy="all"}switch(s.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:s.bundlePolicy="balanced"}if(s.iceServers=function(h,a){var c=!1;return(h=JSON.parse(JSON.stringify(h))).filter(function(p){if(p&&(p.urls||p.url)){var f=p.urls||p.url;p.url&&!p.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var m=typeof f=="string";return m&&(f=[f]),f=f.filter(function(_){return _.indexOf("turn:")!==0||_.indexOf("transport=udp")===-1||_.indexOf("turn:[")!==-1||c?_.indexOf("stun:")===0&&a>=14393&&_.indexOf("?transport=udp")===-1:(c=!0,!0)}),delete p.url,p.urls=m?f[0]:f,!!f.length}})}(s.iceServers||[],e),this._iceGatherers=[],s.iceCandidatePoolSize)for(var l=s.iceCandidatePoolSize;l>0;l--)this._iceGatherers.push(new n.RTCIceGatherer({iceServers:s.iceServers,gatherPolicy:s.iceTransportPolicy}));else s.iceCandidatePoolSize=0;this._config=s,this.transceivers=[],this._sdpSessionId=Z.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(s,u){this._isClosed||(this.dispatchEvent(u),typeof this["on"+s]=="function"&&this["on"+s](u))},i.prototype._emitGatheringStateChange=function(){var s=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",s)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(s,u){var d=this.transceivers.length>0,l={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:s,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&d)l.iceTransport=this.transceivers[0].iceTransport,l.dtlsTransport=this.transceivers[0].dtlsTransport;else{var h=this._createIceAndDtlsTransports();l.iceTransport=h.iceTransport,l.dtlsTransport=h.dtlsTransport}return u||this.transceivers.push(l),l},i.prototype.addTrack=function(s,u){if(this._isClosed)throw be("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var d;if(this.transceivers.find(function(h){return h.track===s}))throw be("InvalidAccessError","Track already exists.");for(var l=0;l<this.transceivers.length;l++)this.transceivers[l].track||this.transceivers[l].kind!==s.kind||(d=this.transceivers[l]);return d||(d=this._createTransceiver(s.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(u)===-1&&this.localStreams.push(u),d.track=s,d.stream=u,d.rtpSender=new n.RTCRtpSender(s,d.dtlsTransport),d.rtpSender},i.prototype.addStream=function(s){var u=this;if(e>=15025)s.getTracks().forEach(function(l){u.addTrack(l,s)});else{var d=s.clone();s.getTracks().forEach(function(l,h){var a=d.getTracks()[h];l.addEventListener("enabled",function(c){a.enabled=c.enabled})}),d.getTracks().forEach(function(l){u.addTrack(l,d)})}},i.prototype.removeTrack=function(s){if(this._isClosed)throw be("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(s instanceof n.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var u=this.transceivers.find(function(l){return l.rtpSender===s});if(!u)throw be("InvalidAccessError","Sender was not created by this connection.");var d=u.stream;u.rtpSender.stop(),u.rtpSender=null,u.track=null,u.stream=null,this.transceivers.map(function(l){return l.stream}).indexOf(d)===-1&&this.localStreams.indexOf(d)>-1&&this.localStreams.splice(this.localStreams.indexOf(d),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(s){var u=this;s.getTracks().forEach(function(d){var l=u.getSenders().find(function(h){return h.track===d});l&&u.removeTrack(l)})},i.prototype.getSenders=function(){return this.transceivers.filter(function(s){return!!s.rtpSender}).map(function(s){return s.rtpSender})},i.prototype.getReceivers=function(){return this.transceivers.filter(function(s){return!!s.rtpReceiver}).map(function(s){return s.rtpReceiver})},i.prototype._createIceGatherer=function(s,u){var d=this;if(u&&s>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var l=new n.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(l,"state",{value:"new",writable:!0}),this.transceivers[s].bufferedCandidateEvents=[],this.transceivers[s].bufferCandidates=function(h){var a=!h.candidate||Object.keys(h.candidate).length===0;l.state=a?"completed":"gathering",d.transceivers[s].bufferedCandidateEvents!==null&&d.transceivers[s].bufferedCandidateEvents.push(h)},l.addEventListener("localcandidate",this.transceivers[s].bufferCandidates),l},i.prototype._gather=function(s,u){var d=this,l=this.transceivers[u].iceGatherer;if(!l.onlocalcandidate){var h=this.transceivers[u].bufferedCandidateEvents;this.transceivers[u].bufferedCandidateEvents=null,l.removeEventListener("localcandidate",this.transceivers[u].bufferCandidates),l.onlocalcandidate=function(a){if(!(d.usingBundle&&u>0)){var c=new Event("icecandidate");c.candidate={sdpMid:s,sdpMLineIndex:u};var p=a.candidate,f=!p||Object.keys(p).length===0;if(f)l.state!=="new"&&l.state!=="gathering"||(l.state="completed");else{l.state==="new"&&(l.state="gathering"),p.component=1,p.ufrag=l.getLocalParameters().usernameFragment;var m=Z.writeCandidate(p);c.candidate=Object.assign(c.candidate,Z.parseCandidate(m)),c.candidate.candidate=m,c.candidate.toJSON=function(){return{candidate:c.candidate.candidate,sdpMid:c.candidate.sdpMid,sdpMLineIndex:c.candidate.sdpMLineIndex,usernameFragment:c.candidate.usernameFragment}}}var _=Z.getMediaSections(d._localDescription.sdp);_[c.candidate.sdpMLineIndex]+=f?`a=end-of-candidates\r
  866. `:"a="+c.candidate.candidate+`\r
  867. `,d._localDescription.sdp=Z.getDescription(d._localDescription.sdp)+_.join("");var v=d.transceivers.every(function(R){return R.iceGatherer&&R.iceGatherer.state==="completed"});d.iceGatheringState!=="gathering"&&(d.iceGatheringState="gathering",d._emitGatheringStateChange()),f||d._dispatchEvent("icecandidate",c),v&&(d._dispatchEvent("icecandidate",new Event("icecandidate")),d.iceGatheringState="complete",d._emitGatheringStateChange())}},n.setTimeout(function(){h.forEach(function(a){l.onlocalcandidate(a)})},0)}},i.prototype._createIceAndDtlsTransports=function(){var s=this,u=new n.RTCIceTransport(null);u.onicestatechange=function(){s._updateIceConnectionState(),s._updateConnectionState()};var d=new n.RTCDtlsTransport(u);return d.ondtlsstatechange=function(){s._updateConnectionState()},d.onerror=function(){Object.defineProperty(d,"state",{value:"failed",writable:!0}),s._updateConnectionState()},{iceTransport:u,dtlsTransport:d}},i.prototype._disposeIceAndDtlsTransports=function(s){var u=this.transceivers[s].iceGatherer;u&&(delete u.onlocalcandidate,delete this.transceivers[s].iceGatherer);var d=this.transceivers[s].iceTransport;d&&(delete d.onicestatechange,delete this.transceivers[s].iceTransport);var l=this.transceivers[s].dtlsTransport;l&&(delete l.ondtlsstatechange,delete l.onerror,delete this.transceivers[s].dtlsTransport)},i.prototype._transceive=function(s,u,d){var l=zn(s.localCapabilities,s.remoteCapabilities);u&&s.rtpSender&&(l.encodings=s.sendEncodingParameters,l.rtcp={cname:Z.localCName,compound:s.rtcpParameters.compound},s.recvEncodingParameters.length&&(l.rtcp.ssrc=s.recvEncodingParameters[0].ssrc),s.rtpSender.send(l)),d&&s.rtpReceiver&&l.codecs.length>0&&(s.kind==="video"&&s.recvEncodingParameters&&e<15019&&s.recvEncodingParameters.forEach(function(h){delete h.rtx}),s.recvEncodingParameters.length?l.encodings=s.recvEncodingParameters:l.encodings=[{}],l.rtcp={compound:s.rtcpParameters.compound},s.rtcpParameters.cname&&(l.rtcp.cname=s.rtcpParameters.cname),s.sendEncodingParameters.length&&(l.rtcp.ssrc=s.sendEncodingParameters[0].ssrc),s.rtpReceiver.receive(l))},i.prototype.setLocalDescription=function(s){var u,d,l=this;if(["offer","answer"].indexOf(s.type)===-1)return Promise.reject(be("TypeError",'Unsupported type "'+s.type+'"'));if(!ea("setLocalDescription",s.type,l.signalingState)||l._isClosed)return Promise.reject(be("InvalidStateError","Can not set local "+s.type+" in state "+l.signalingState));if(s.type==="offer")u=Z.splitSections(s.sdp),d=u.shift(),u.forEach(function(a,c){var p=Z.parseRtpParameters(a);l.transceivers[c].localCapabilities=p}),l.transceivers.forEach(function(a,c){l._gather(a.mid,c)});else if(s.type==="answer"){u=Z.splitSections(l._remoteDescription.sdp),d=u.shift();var h=Z.matchPrefix(d,"a=ice-lite").length>0;u.forEach(function(a,c){var p=l.transceivers[c],f=p.iceGatherer,m=p.iceTransport,_=p.dtlsTransport,v=p.localCapabilities,R=p.remoteCapabilities;if(!(Z.isRejected(a)&&Z.matchPrefix(a,"a=bundle-only").length===0)&&!p.rejected){var C=Z.getIceParameters(a,d),M=Z.getDtlsParameters(a,d);h&&(M.role="server"),l.usingBundle&&c!==0||(l._gather(p.mid,c),m.state==="new"&&m.start(f,C,h?"controlling":"controlled"),_.state==="new"&&_.start(M));var A=zn(v,R);l._transceive(p,A.codecs.length>0,!1)}})}return l._localDescription={type:s.type,sdp:s.sdp},s.type==="offer"?l._updateSignalingState("have-local-offer"):l._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(s){var u=this;if(["offer","answer"].indexOf(s.type)===-1)return Promise.reject(be("TypeError",'Unsupported type "'+s.type+'"'));if(!ea("setRemoteDescription",s.type,u.signalingState)||u._isClosed)return Promise.reject(be("InvalidStateError","Can not set remote "+s.type+" in state "+u.signalingState));var d={};u.remoteStreams.forEach(function(m){d[m.id]=m});var l=[],h=Z.splitSections(s.sdp),a=h.shift(),c=Z.matchPrefix(a,"a=ice-lite").length>0,p=Z.matchPrefix(a,"a=group:BUNDLE ").length>0;u.usingBundle=p;var f=Z.matchPrefix(a,"a=ice-options:")[0];return u.canTrickleIceCandidates=!!f&&f.substr(14).split(" ").indexOf("trickle")>=0,h.forEach(function(m,_){var v=Z.splitLines(m),R=Z.getKind(m),C=Z.isRejected(m)&&Z.matchPrefix(m,"a=bundle-only").length===0,M=v[0].substr(2).split(" ")[2],A=Z.getDirection(m,a),O=Z.parseMsid(m),y=Z.getMid(m)||Z.generateIdentifier();if(C||R==="application"&&(M==="DTLS/SCTP"||M==="UDP/DTLS/SCTP"))u.transceivers[_]={mid:y,kind:R,protocol:M,rejected:!0};else{var w,H,Y,E,T,N,P,L,V;!C&&u.transceivers[_]&&u.transceivers[_].rejected&&(u.transceivers[_]=u._createTransceiver(R,!0));var F,q,z=Z.parseRtpParameters(m);C||(F=Z.getIceParameters(m,a),(q=Z.getDtlsParameters(m,a)).role="client"),P=Z.parseRtpEncodingParameters(m);var ne=Z.parseRtcpParameters(m),ae=Z.matchPrefix(m,"a=end-of-candidates",a).length>0,se=Z.matchPrefix(m,"a=candidate:").map(function(k){return Z.parseCandidate(k)}).filter(function(k){return k.component===1});if((s.type==="offer"||s.type==="answer")&&!C&&p&&_>0&&u.transceivers[_]&&(u._disposeIceAndDtlsTransports(_),u.transceivers[_].iceGatherer=u.transceivers[0].iceGatherer,u.transceivers[_].iceTransport=u.transceivers[0].iceTransport,u.transceivers[_].dtlsTransport=u.transceivers[0].dtlsTransport,u.transceivers[_].rtpSender&&u.transceivers[_].rtpSender.setTransport(u.transceivers[0].dtlsTransport),u.transceivers[_].rtpReceiver&&u.transceivers[_].rtpReceiver.setTransport(u.transceivers[0].dtlsTransport)),s.type!=="offer"||C)s.type==="answer"&&!C&&(H=(w=u.transceivers[_]).iceGatherer,Y=w.iceTransport,E=w.dtlsTransport,T=w.rtpReceiver,N=w.sendEncodingParameters,L=w.localCapabilities,u.transceivers[_].recvEncodingParameters=P,u.transceivers[_].remoteCapabilities=z,u.transceivers[_].rtcpParameters=ne,se.length&&Y.state==="new"&&(!c&&!ae||p&&_!==0?se.forEach(function(k){ii(w.iceTransport,k)}):Y.setRemoteCandidates(se)),p&&_!==0||(Y.state==="new"&&Y.start(H,F,"controlling"),E.state==="new"&&E.start(q)),!zn(w.localCapabilities,w.remoteCapabilities).codecs.filter(function(k){return k.name.toLowerCase()==="rtx"}).length&&w.sendEncodingParameters[0].rtx&&delete w.sendEncodingParameters[0].rtx,u._transceive(w,A==="sendrecv"||A==="recvonly",A==="sendrecv"||A==="sendonly"),!T||A!=="sendrecv"&&A!=="sendonly"?delete w.rtpReceiver:(V=T.track,O?(d[O.stream]||(d[O.stream]=new n.MediaStream),t(V,d[O.stream]),l.push([V,T,d[O.stream]])):(d.default||(d.default=new n.MediaStream),t(V,d.default),l.push([V,T,d.default]))));else{(w=u.transceivers[_]||u._createTransceiver(R)).mid=y,w.iceGatherer||(w.iceGatherer=u._createIceGatherer(_,p)),se.length&&w.iceTransport.state==="new"&&(!ae||p&&_!==0?se.forEach(function(k){ii(w.iceTransport,k)}):w.iceTransport.setRemoteCandidates(se)),L=n.RTCRtpReceiver.getCapabilities(R),e<15019&&(L.codecs=L.codecs.filter(function(k){return k.name!=="rtx"})),N=w.sendEncodingParameters||[{ssrc:1001*(2*_+2)}];var re,X=!1;A==="sendrecv"||A==="sendonly"?(X=!w.rtpReceiver,T=w.rtpReceiver||new n.RTCRtpReceiver(w.dtlsTransport,R),X&&(V=T.track,O&&O.stream==="-"||(O?(d[O.stream]||(d[O.stream]=new n.MediaStream,Object.defineProperty(d[O.stream],"id",{get:function(){return O.stream}})),Object.defineProperty(V,"id",{get:function(){return O.track}}),re=d[O.stream]):(d.default||(d.default=new n.MediaStream),re=d.default)),re&&(t(V,re),w.associatedRemoteMediaStreams.push(re)),l.push([V,T,re]))):w.rtpReceiver&&w.rtpReceiver.track&&(w.associatedRemoteMediaStreams.forEach(function(k){var G=k.getTracks().find(function(Q){return Q.id===w.rtpReceiver.track.id});G&&function(Q,te){te.removeTrack(Q),te.dispatchEvent(new n.MediaStreamTrackEvent("removetrack",{track:Q}))}(G,k)}),w.associatedRemoteMediaStreams=[]),w.localCapabilities=L,w.remoteCapabilities=z,w.rtpReceiver=T,w.rtcpParameters=ne,w.sendEncodingParameters=N,w.recvEncodingParameters=P,u._transceive(u.transceivers[_],!1,X)}}}),u._dtlsRole===void 0&&(u._dtlsRole=s.type==="offer"?"active":"passive"),u._remoteDescription={type:s.type,sdp:s.sdp},s.type==="offer"?u._updateSignalingState("have-remote-offer"):u._updateSignalingState("stable"),Object.keys(d).forEach(function(m){var _=d[m];if(_.getTracks().length){if(u.remoteStreams.indexOf(_)===-1){u.remoteStreams.push(_);var v=new Event("addstream");v.stream=_,n.setTimeout(function(){u._dispatchEvent("addstream",v)})}l.forEach(function(R){var C=R[0],M=R[1];_.id===R[2].id&&r(u,C,M,[_])})}}),l.forEach(function(m){m[2]||r(u,m[0],m[1],[])}),n.setTimeout(function(){u&&u.transceivers&&u.transceivers.forEach(function(m){m.iceTransport&&m.iceTransport.state==="new"&&m.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),m.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach(function(s){s.iceTransport&&s.iceTransport.stop(),s.dtlsTransport&&s.dtlsTransport.stop(),s.rtpSender&&s.rtpSender.stop(),s.rtpReceiver&&s.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(s){this.signalingState=s;var u=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",u)},i.prototype._maybeFireNegotiationNeeded=function(){var s=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,n.setTimeout(function(){if(s.needNegotiation){s.needNegotiation=!1;var u=new Event("negotiationneeded");s._dispatchEvent("negotiationneeded",u)}},0))},i.prototype._updateIceConnectionState=function(){var s,u={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(l){l.iceTransport&&!l.rejected&&u[l.iceTransport.state]++}),s="new",u.failed>0?s="failed":u.checking>0?s="checking":u.disconnected>0?s="disconnected":u.new>0?s="new":u.connected>0?s="connected":u.completed>0&&(s="completed"),s!==this.iceConnectionState){this.iceConnectionState=s;var d=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",d)}},i.prototype._updateConnectionState=function(){var s,u={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(l){l.iceTransport&&l.dtlsTransport&&!l.rejected&&(u[l.iceTransport.state]++,u[l.dtlsTransport.state]++)}),u.connected+=u.completed,s="new",u.failed>0?s="failed":u.connecting>0?s="connecting":u.disconnected>0?s="disconnected":u.new>0?s="new":u.connected>0&&(s="connected"),s!==this.connectionState){this.connectionState=s;var d=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",d)}},i.prototype.createOffer=function(){var s=this;if(s._isClosed)return Promise.reject(be("InvalidStateError","Can not call createOffer after close"));var u=s.transceivers.filter(function(c){return c.kind==="audio"}).length,d=s.transceivers.filter(function(c){return c.kind==="video"}).length,l=arguments[0];if(l){if(l.mandatory||l.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");l.offerToReceiveAudio!==void 0&&(u=l.offerToReceiveAudio===!0?1:l.offerToReceiveAudio===!1?0:l.offerToReceiveAudio),l.offerToReceiveVideo!==void 0&&(d=l.offerToReceiveVideo===!0?1:l.offerToReceiveVideo===!1?0:l.offerToReceiveVideo)}for(s.transceivers.forEach(function(c){c.kind==="audio"?--u<0&&(c.wantReceive=!1):c.kind==="video"&&--d<0&&(c.wantReceive=!1)});u>0||d>0;)u>0&&(s._createTransceiver("audio"),u--),d>0&&(s._createTransceiver("video"),d--);var h=Z.writeSessionBoilerplate(s._sdpSessionId,s._sdpSessionVersion++);s.transceivers.forEach(function(c,p){var f=c.track,m=c.kind,_=c.mid||Z.generateIdentifier();c.mid=_,c.iceGatherer||(c.iceGatherer=s._createIceGatherer(p,s.usingBundle));var v=n.RTCRtpSender.getCapabilities(m);e<15019&&(v.codecs=v.codecs.filter(function(C){return C.name!=="rtx"})),v.codecs.forEach(function(C){C.name==="H264"&&C.parameters["level-asymmetry-allowed"]===void 0&&(C.parameters["level-asymmetry-allowed"]="1"),c.remoteCapabilities&&c.remoteCapabilities.codecs&&c.remoteCapabilities.codecs.forEach(function(M){C.name.toLowerCase()===M.name.toLowerCase()&&C.clockRate===M.clockRate&&(C.preferredPayloadType=M.payloadType)})}),v.headerExtensions.forEach(function(C){(c.remoteCapabilities&&c.remoteCapabilities.headerExtensions||[]).forEach(function(M){C.uri===M.uri&&(C.id=M.id)})});var R=c.sendEncodingParameters||[{ssrc:1001*(2*p+1)}];f&&e>=15019&&m==="video"&&!R[0].rtx&&(R[0].rtx={ssrc:R[0].ssrc+1}),c.wantReceive&&(c.rtpReceiver=new n.RTCRtpReceiver(c.dtlsTransport,m)),c.localCapabilities=v,c.sendEncodingParameters=R}),s._config.bundlePolicy!=="max-compat"&&(h+="a=group:BUNDLE "+s.transceivers.map(function(c){return c.mid}).join(" ")+`\r
  868. `),h+=`a=ice-options:trickle\r
  869. `,s.transceivers.forEach(function(c,p){h+=Xs(c,c.localCapabilities,"offer",c.stream,s._dtlsRole),h+=`a=rtcp-rsize\r
  870. `,!c.iceGatherer||s.iceGatheringState==="new"||p!==0&&s.usingBundle||(c.iceGatherer.getLocalCandidates().forEach(function(f){f.component=1,h+="a="+Z.writeCandidate(f)+`\r
  871. `}),c.iceGatherer.state==="completed"&&(h+=`a=end-of-candidates\r
  872. `))});var a=new n.RTCSessionDescription({type:"offer",sdp:h});return Promise.resolve(a)},i.prototype.createAnswer=function(){var s=this;if(s._isClosed)return Promise.reject(be("InvalidStateError","Can not call createAnswer after close"));if(s.signalingState!=="have-remote-offer"&&s.signalingState!=="have-local-pranswer")return Promise.reject(be("InvalidStateError","Can not call createAnswer in signalingState "+s.signalingState));var u=Z.writeSessionBoilerplate(s._sdpSessionId,s._sdpSessionVersion++);s.usingBundle&&(u+="a=group:BUNDLE "+s.transceivers.map(function(h){return h.mid}).join(" ")+`\r
  873. `),u+=`a=ice-options:trickle\r
  874. `;var d=Z.getMediaSections(s._remoteDescription.sdp).length;s.transceivers.forEach(function(h,a){if(!(a+1>d)){if(h.rejected)return h.kind==="application"?h.protocol==="DTLS/SCTP"?u+=`m=application 0 DTLS/SCTP 5000\r
  875. `:u+="m=application 0 "+h.protocol+` webrtc-datachannel\r
  876. `:h.kind==="audio"?u+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r
  877. a=rtpmap:0 PCMU/8000\r
  878. `:h.kind==="video"&&(u+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r
  879. a=rtpmap:120 VP8/90000\r
  880. `),void(u+=`c=IN IP4 0.0.0.0\r
  881. a=inactive\r
  882. a=mid:`+h.mid+`\r
  883. `);var c;h.stream&&(h.kind==="audio"?c=h.stream.getAudioTracks()[0]:h.kind==="video"&&(c=h.stream.getVideoTracks()[0]),c&&e>=15019&&h.kind==="video"&&!h.sendEncodingParameters[0].rtx&&(h.sendEncodingParameters[0].rtx={ssrc:h.sendEncodingParameters[0].ssrc+1}));var p=zn(h.localCapabilities,h.remoteCapabilities);!p.codecs.filter(function(f){return f.name.toLowerCase()==="rtx"}).length&&h.sendEncodingParameters[0].rtx&&delete h.sendEncodingParameters[0].rtx,u+=Xs(h,p,"answer",h.stream,s._dtlsRole),h.rtcpParameters&&h.rtcpParameters.reducedSize&&(u+=`a=rtcp-rsize\r
  884. `)}});var l=new n.RTCSessionDescription({type:"answer",sdp:u});return Promise.resolve(l)},i.prototype.addIceCandidate=function(s){var u,d=this;return s&&s.sdpMLineIndex===void 0&&!s.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(l,h){if(!d._remoteDescription)return h(be("InvalidStateError","Can not add ICE candidate without a remote description"));if(s&&s.candidate!==""){var a=s.sdpMLineIndex;if(s.sdpMid){for(var c=0;c<d.transceivers.length;c++)if(d.transceivers[c].mid===s.sdpMid){a=c;break}}var p=d.transceivers[a];if(!p)return h(be("OperationError","Can not add ICE candidate"));if(p.rejected)return l();var f=Object.keys(s.candidate).length>0?Z.parseCandidate(s.candidate):{};if(f.protocol==="tcp"&&(f.port===0||f.port===9)||f.component&&f.component!==1)return l();if((a===0||a>0&&p.iceTransport!==d.transceivers[0].iceTransport)&&!ii(p.iceTransport,f))return h(be("OperationError","Can not add ICE candidate"));var m=s.candidate.trim();m.indexOf("a=")===0&&(m=m.substr(2)),(u=Z.getMediaSections(d._remoteDescription.sdp))[a]+="a="+(f.type?m:"end-of-candidates")+`\r
  885. `,d._remoteDescription.sdp=Z.getDescription(d._remoteDescription.sdp)+u.join("")}else for(var _=0;_<d.transceivers.length&&(d.transceivers[_].rejected||(d.transceivers[_].iceTransport.addRemoteCandidate({}),(u=Z.getMediaSections(d._remoteDescription.sdp))[_]+=`a=end-of-candidates\r
  886. `,d._remoteDescription.sdp=Z.getDescription(d._remoteDescription.sdp)+u.join(""),!d.usingBundle));_++);l()})},i.prototype.getStats=function(s){if(s&&s instanceof n.MediaStreamTrack){var u=null;if(this.transceivers.forEach(function(l){l.rtpSender&&l.rtpSender.track===s?u=l.rtpSender:l.rtpReceiver&&l.rtpReceiver.track===s&&(u=l.rtpReceiver)}),!u)throw be("InvalidAccessError","Invalid selector.");return u.getStats()}var d=[];return this.transceivers.forEach(function(l){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(h){l[h]&&d.push(l[h].getStats())})}),Promise.all(d).then(function(l){var h=new Map;return l.forEach(function(a){a.forEach(function(c){h.set(c.id,c)})}),h})},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(s){var u=n[s];if(u&&u.prototype&&u.prototype.getStats){var d=u.prototype.getStats;u.prototype.getStats=function(){return d.apply(this).then(function(l){var h=new Map;return Object.keys(l).forEach(function(a){var c;l[a].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(c=l[a]).type]||c.type,h.set(a,l[a])}),h})}}});var o=["createOffer","createAnswer"];return o.forEach(function(s){var u=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[0]=="function"||typeof d[1]=="function"?u.apply(this,[arguments[2]]).then(function(l){typeof d[0]=="function"&&d[0].apply(null,[l])},function(l){typeof d[1]=="function"&&d[1].apply(null,[l])}):u.apply(this,arguments)}}),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(s){var u=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[1]=="function"||typeof d[2]=="function"?u.apply(this,arguments).then(function(){typeof d[1]=="function"&&d[1].apply(null)},function(l){typeof d[2]=="function"&&d[2].apply(null,[l])}):u.apply(this,arguments)}}),["getStats"].forEach(function(s){var u=i.prototype[s];i.prototype[s]=function(){var d=arguments;return typeof d[1]=="function"?u.apply(this,arguments).then(function(){typeof d[1]=="function"&&d[1].apply(null)}):u.apply(this,arguments)}}),i};function vc(n){const e=n&&n.navigator,t=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(r){return t(r).catch(i=>Promise.reject(function(o){return{name:{PermissionDeniedError:"NotAllowedError"}[o.name]||o.name,message:o.message,constraint:o.constraint,toString(){return this.name}}}(i)))}}function Rc(n){"getDisplayMedia"in n.navigator&&n.navigator.mediaDevices&&(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||(n.navigator.mediaDevices.getDisplayMedia=n.navigator.getDisplayMedia.bind(n.navigator)))}function Li(n,e){if(n.RTCIceGatherer&&(n.RTCIceCandidate||(n.RTCIceCandidate=function(r){return r}),n.RTCSessionDescription||(n.RTCSessionDescription=function(r){return r}),e.version<15025)){const r=Object.getOwnPropertyDescriptor(n.MediaStreamTrack.prototype,"enabled");Object.defineProperty(n.MediaStreamTrack.prototype,"enabled",{set(i){r.set.call(this,i);const o=new Event("enabled");o.enabled=i,this.dispatchEvent(o)}})}n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)&&Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new n.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),n.RTCDtmfSender&&!n.RTCDTMFSender&&(n.RTCDTMFSender=n.RTCDtmfSender);const t=gl(n,e.version);n.RTCPeerConnection=function(r){return r&&r.iceServers&&(r.iceServers=function(i,o){let s=!1;return(i=JSON.parse(JSON.stringify(i))).filter(u=>{if(u&&(u.urls||u.url)){let d=u.urls||u.url;u.url&&!u.urls&&Fr("RTCIceServer.url","RTCIceServer.urls");const l=typeof d=="string";return l&&(d=[d]),d=d.filter(h=>{if(h.indexOf("stun:")===0)return!1;const a=h.startsWith("turn")&&!h.startsWith("turn:[")&&h.includes("transport=udp");return a&&!s?(s=!0,!0):a&&!s}),delete u.url,u.urls=l?d[0]:d,!!d.length}})}(r.iceServers,e.version),$o("ICE servers after filtering:",r.iceServers)),new t(r)},n.RTCPeerConnection.prototype=t.prototype}function Ec(n){n.RTCRtpSender&&!("replaceTrack"in n.RTCRtpSender.prototype)&&(n.RTCRtpSender.prototype.replaceTrack=n.RTCRtpSender.prototype.setTrack)}var ta=Object.freeze({__proto__:null,shimPeerConnection:Li,shimReplaceTrack:Ec,shimGetUserMedia:vc,shimGetDisplayMedia:Rc});function Cc(n,e){const t=n&&n.navigator,r=n&&n.MediaStreamTrack;if(t.getUserMedia=function(i,o,s){Fr("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),t.mediaDevices.getUserMedia(i).then(o,s)},!(e.version>55&&"autoGainControl"in t.mediaDevices.getSupportedConstraints())){const i=function(s,u,d){u in s&&!(d in s)&&(s[d]=s[u],delete s[u])},o=t.mediaDevices.getUserMedia.bind(t.mediaDevices);if(t.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),o(s)},r&&r.prototype.getSettings){const s=r.prototype.getSettings;r.prototype.getSettings=function(){const u=s.apply(this,arguments);return i(u,"mozAutoGainControl","autoGainControl"),i(u,"mozNoiseSuppression","noiseSuppression"),u}}if(r&&r.prototype.applyConstraints){const s=r.prototype.applyConstraints;r.prototype.applyConstraints=function(u){return this.kind==="audio"&&typeof u=="object"&&(u=JSON.parse(JSON.stringify(u)),i(u,"autoGainControl","mozAutoGainControl"),i(u,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[u])}}}}function yc(n){typeof n=="object"&&n.RTCTrackEvent&&"receiver"in n.RTCTrackEvent.prototype&&!("transceiver"in n.RTCTrackEvent.prototype)&&Object.defineProperty(n.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ki(n,e){if(typeof n!="object"||!n.RTCPeerConnection&&!n.mozRTCPeerConnection)return;!n.RTCPeerConnection&&n.mozRTCPeerConnection&&(n.RTCPeerConnection=n.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const o=n.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};n.RTCPeerConnection.prototype[i]=s[i]});const t={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[i,o,s]=arguments;return r.apply(this,[i||null]).then(u=>{if(e.version<53&&!o)try{u.forEach(d=>{d.type=t[d.type]||d.type})}catch(d){if(d.name!=="TypeError")throw d;u.forEach((l,h)=>{u.set(h,Object.assign({},l,{type:t[l.type]||l.type}))})}return u}).then(o,s)}}function Tc(n){if(typeof n!="object"||!n.RTCPeerConnection||!n.RTCRtpSender||n.RTCRtpSender&&"getStats"in n.RTCRtpSender.prototype)return;const e=n.RTCPeerConnection.prototype.getSenders;e&&(n.RTCPeerConnection.prototype.getSenders=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r});const t=n.RTCPeerConnection.prototype.addTrack;t&&(n.RTCPeerConnection.prototype.addTrack=function(){const r=t.apply(this,arguments);return r._pc=this,r}),n.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Sc(n){if(typeof n!="object"||!n.RTCPeerConnection||!n.RTCRtpSender||n.RTCRtpSender&&"getStats"in n.RTCRtpReceiver.prototype)return;const e=n.RTCPeerConnection.prototype.getReceivers;e&&(n.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach(r=>r._pc=this),t}),qt(n,"track",t=>(t.receiver._pc=t.srcElement,t)),n.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Ic(n){n.RTCPeerConnection&&!("removeStream"in n.RTCPeerConnection.prototype)&&(n.RTCPeerConnection.prototype.removeStream=function(e){Fr("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function bc(n){n.DataChannel&&!n.RTCDataChannel&&(n.RTCDataChannel=n.DataChannel)}function Oc(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.addTransceiver;e&&(n.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const t=arguments[1],r=t&&"sendEncodings"in t;r&&t.sendEncodings.forEach(o=>{if("rid"in o&&!/^[a-z0-9]{0,16}$/i.test(o.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in o&&!(parseFloat(o.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in o&&!(parseFloat(o.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const i=e.apply(this,arguments);if(r){const{sender:o}=i,s=o.getParameters();(!("encodings"in s)||s.encodings.length===1&&Object.keys(s.encodings[0]).length===0)&&(s.encodings=t.sendEncodings,o.sendEncodings=t.sendEncodings,this.setParametersPromises.push(o.setParameters(s).then(()=>{delete o.sendEncodings}).catch(()=>{delete o.sendEncodings})))}return i})}function Nc(n){if(typeof n!="object"||!n.RTCRtpSender)return;const e=n.RTCRtpSender.prototype.getParameters;e&&(n.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function wc(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function Mc(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.createAnswer;n.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var na=Object.freeze({__proto__:null,shimOnTrack:yc,shimPeerConnection:ki,shimSenderGetStats:Tc,shimReceiverGetStats:Sc,shimRemoveStream:Ic,shimRTCDataChannel:bc,shimAddTransceiver:Oc,shimGetParameters:Nc,shimCreateOffer:wc,shimCreateAnswer:Mc,shimGetUserMedia:Cc,shimGetDisplayMedia:function(n,e){n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||n.navigator.mediaDevices&&(n.navigator.mediaDevices.getDisplayMedia=function(t){if(!t||!t.video){const r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return t.video===!0?t.video={mediaSource:e}:t.video.mediaSource=e,n.navigator.mediaDevices.getUserMedia(t)})}});function Ac(n){if(typeof n=="object"&&n.RTCPeerConnection){if("getLocalStreams"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in n.RTCPeerConnection.prototype)){const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach(r=>e.call(this,r,t)),t.getVideoTracks().forEach(r=>e.call(this,r,t))},n.RTCPeerConnection.prototype.addTrack=function(t,...r){return r&&r.forEach(i=>{this._localStreams?this._localStreams.includes(i)||this._localStreams.push(i):this._localStreams=[i]}),e.apply(this,arguments)}}"removeStream"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach(i=>{r.includes(i.track)&&this.removeTrack(i)})})}}function Pc(n){if(typeof n=="object"&&n.RTCPeerConnection&&("getRemoteStreams"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in n.RTCPeerConnection.prototype))){Object.defineProperty(n.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=r=>{r.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,this.dispatchEvent(o)})})}});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(i=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(i)>=0)return;t._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,t.dispatchEvent(o)})}),e.apply(t,arguments)}}}function Lc(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype,t=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(d,l){const h=arguments.length>=2?arguments[2]:arguments[0],a=t.apply(this,[h]);return l?(a.then(d,l),Promise.resolve()):a},e.createAnswer=function(d,l){const h=arguments.length>=2?arguments[2]:arguments[0],a=r.apply(this,[h]);return l?(a.then(d,l),Promise.resolve()):a};let u=function(d,l,h){const a=i.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a};e.setLocalDescription=u,u=function(d,l,h){const a=o.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a},e.setRemoteDescription=u,u=function(d,l,h){const a=s.apply(this,[d]);return h?(a.then(l,h),Promise.resolve()):a},e.addIceCandidate=u}function kc(n){const e=n&&n.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,r=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=i=>r(Uc(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,r,i){e.mediaDevices.getUserMedia(t).then(r,i)}.bind(e))}function Uc(n){return n&&n.video!==void 0?Object.assign({},n,{video:cc(n.video)}):n}function Dc(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection;n.RTCPeerConnection=function(t,r){if(t&&t.iceServers){const i=[];for(let o=0;o<t.iceServers.length;o++){let s=t.iceServers[o];!s.hasOwnProperty("urls")&&s.hasOwnProperty("url")?(Fr("RTCIceServer.url","RTCIceServer.urls"),s=JSON.parse(JSON.stringify(s)),s.urls=s.url,delete s.url,i.push(s)):i.push(t.iceServers[o])}t.iceServers=i}return new e(t,r)},n.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(n.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function xc(n){typeof n=="object"&&n.RTCTrackEvent&&"receiver"in n.RTCTrackEvent.prototype&&!("transceiver"in n.RTCTrackEvent.prototype)&&Object.defineProperty(n.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Vc(n){const e=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(t){if(t){t.offerToReceiveAudio!==void 0&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const r=this.getTransceivers().find(o=>o.receiver.track.kind==="audio");t.offerToReceiveAudio===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):t.offerToReceiveAudio!==!0||r||this.addTransceiver("audio"),t.offerToReceiveVideo!==void 0&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const i=this.getTransceivers().find(o=>o.receiver.track.kind==="video");t.offerToReceiveVideo===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):t.offerToReceiveVideo!==!0||i||this.addTransceiver("video")}return e.apply(this,arguments)}}function Bc(n){typeof n!="object"||n.AudioContext||(n.AudioContext=n.webkitAudioContext)}var ra=Object.freeze({__proto__:null,shimLocalStreamsAPI:Ac,shimRemoteStreamsAPI:Pc,shimCallbacksAPI:Lc,shimGetUserMedia:kc,shimConstraints:Uc,shimRTCIceServerUrls:Dc,shimTrackEventTransceiver:xc,shimCreateOfferLegacy:Vc,shimAudioContext:Bc});function er(n){if(!n.RTCIceCandidate||n.RTCIceCandidate&&"foundation"in n.RTCIceCandidate.prototype)return;const e=n.RTCIceCandidate;n.RTCIceCandidate=function(t){if(typeof t=="object"&&t.candidate&&t.candidate.indexOf("a=")===0&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const r=new e(t),i=Z.parseCandidate(t.candidate),o=Object.assign(r,i);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new e(t)},n.RTCIceCandidate.prototype=e.prototype,qt(n,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new n.RTCIceCandidate(t.candidate),writable:"false"}),t))}function sn(n,e){if(!n.RTCPeerConnection)return;"sctp"in n.RTCPeerConnection.prototype||Object.defineProperty(n.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});const t=function(u){if(!u||!u.sdp)return!1;const d=Z.splitSections(u.sdp);return d.shift(),d.some(l=>{const h=Z.parseMLine(l);return h&&h.kind==="application"&&h.protocol.indexOf("SCTP")!==-1})},r=function(u){const d=u.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(d===null||d.length<2)return-1;const l=parseInt(d[1],10);return l!=l?-1:l},i=function(u){let d=65536;return e.browser==="firefox"&&(d=e.version<57?u===-1?16384:2147483637:e.version<60?e.version===57?65535:65536:2147483637),d},o=function(u,d){let l=65536;e.browser==="firefox"&&e.version===57&&(l=65535);const h=Z.matchPrefix(u.sdp,"a=max-message-size:");return h.length>0?l=parseInt(h[0].substr(19),10):e.browser==="firefox"&&d!==-1&&(l=2147483637),l},s=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:u}=this.getConfiguration();u==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(t(arguments[0])){const u=r(arguments[0]),d=i(u),l=o(arguments[0],u);let h;h=d===0&&l===0?Number.POSITIVE_INFINITY:d===0||l===0?Math.max(d,l):Math.min(d,l);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>h}),this._sctp=a}return s.apply(this,arguments)}}function an(n){if(!n.RTCPeerConnection||!("createDataChannel"in n.RTCPeerConnection.prototype))return;function e(r,i){const o=r.send;r.send=function(){const s=arguments[0],u=s.length||s.size||s.byteLength;if(r.readyState==="open"&&i.sctp&&u>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return o.apply(r,arguments)}}const t=n.RTCPeerConnection.prototype.createDataChannel;n.RTCPeerConnection.prototype.createDataChannel=function(){const r=t.apply(this,arguments);return e(r,this),r},qt(n,"datachannel",r=>(e(r.channel,r.target),r))}function Ui(n){if(!n.RTCPeerConnection||"connectionState"in n.RTCPeerConnection.prototype)return;const e=n.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const r=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const o=i.target;if(o._lastConnectionState!==o.connectionState){o._lastConnectionState=o.connectionState;const s=new Event("connectionstatechange",i);o.dispatchEvent(s)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function Di(n,e){if(!n.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const t=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(r){if(r&&r.sdp&&r.sdp.indexOf(`
  887. a=extmap-allow-mixed`)!==-1){const i=r.sdp.split(`
  888. `).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(`
  889. `);n.RTCSessionDescription&&r instanceof n.RTCSessionDescription?arguments[0]=new n.RTCSessionDescription({type:r.type,sdp:i}):r.sdp=i}return t.apply(this,arguments)}}function tr(n,e){if(!n.RTCPeerConnection||!n.RTCPeerConnection.prototype)return;const t=n.RTCPeerConnection.prototype.addIceCandidate;t&&t.length!==0&&(n.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var ml=Object.freeze({__proto__:null,shimRTCIceCandidate:er,shimMaxMessageSize:sn,shimSendThrowTypeError:an,shimConnectionState:Ui,removeExtmapAllowMixed:Di,shimAddIceCandidateNullOrEmpty:tr});const _l=function({window:n}={},e={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const t=$o,r=function(o){const s={browser:null,version:null};if(o===void 0||!o.navigator)return s.browser="Not a browser.",s;const{navigator:u}=o;if(u.mozGetUserMedia)s.browser="firefox",s.version=rn(u.userAgent,/Firefox\/(\d+)\./,1);else if(u.webkitGetUserMedia||o.isSecureContext===!1&&o.webkitRTCPeerConnection&&!o.RTCIceGatherer)s.browser="chrome",s.version=rn(u.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(u.mediaDevices&&u.userAgent.match(/Edge\/(\d+).(\d+)$/))s.browser="edge",s.version=rn(u.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!o.RTCPeerConnection||!u.userAgent.match(/AppleWebKit\/(\d+)\./))return s.browser="Not a supported browser.",s;s.browser="safari",s.version=rn(u.userAgent,/AppleWebKit\/(\d+)\./,1),s.supportsUnifiedPlan=o.RTCRtpTransceiver&&"currentDirection"in o.RTCRtpTransceiver.prototype}return s}(n),i={browserDetails:r,commonShim:ml,extractVersion:rn,disableLog:pl,disableWarnings:fl};switch(r.browser){case"chrome":if(!Zs||!Pi||!e.shimChrome)return t("Chrome shim is not included in this adapter release."),i;if(r.version===null)return t("Chrome shim can not determine version, not shimming."),i;t("adapter.js shimming chrome."),i.browserShim=Zs,tr(n,r),uc(n,r),dc(n),Pi(n,r),lc(n),mc(n,r),hc(n),pc(n),fc(n),_c(n,r),er(n),Ui(n),sn(n,r),an(n),Di(n,r);break;case"firefox":if(!na||!ki||!e.shimFirefox)return t("Firefox shim is not included in this adapter release."),i;t("adapter.js shimming firefox."),i.browserShim=na,tr(n,r),Cc(n,r),ki(n,r),yc(n),Ic(n),Tc(n),Sc(n),bc(n),Oc(n),Nc(n),wc(n),Mc(n),er(n),Ui(n),sn(n,r),an(n);break;case"edge":if(!ta||!Li||!e.shimEdge)return t("MS edge shim is not included in this adapter release."),i;t("adapter.js shimming edge."),i.browserShim=ta,vc(n),Rc(n),Li(n,r),Ec(n),sn(n,r),an(n);break;case"safari":if(!ra||!e.shimSafari)return t("Safari shim is not included in this adapter release."),i;t("adapter.js shimming safari."),i.browserShim=ra,tr(n,r),Dc(n),Vc(n),Lc(n),Ac(n),Pc(n),xc(n),kc(n),Bc(n),er(n),sn(n,r),an(n),Di(n,r);break;default:t("Unsupported browser!")}return i}({window:typeof window=="undefined"?void 0:window});var Ze,ge,le;(function(n){n.FPS_10="FPS_10",n.FPS_15="FPS_15",n.FPS_24="FPS_24",n.FPS_30="FPS_30"})(Ze||(Ze={})),function(n){n.W176_H132="W176_H132",n.W176_H144="W176_H144",n.W256_H144="W256_H144",n.W320_H180="W320_H180",n.W240_H240="W240_H240",n.W320_H240="W320_H240",n.W480_H360="W480_H360",n.W640_H360="W640_H360",n.W480_H480="W480_H480",n.W640_H480="W640_H480",n.W720_H480="W720_H480",n.W1280_H720="W1280_H720",n.W1920_H1080="W1920_H1080"}(ge||(ge={})),function(n){n[n.AUDIO_ONLY=0]="AUDIO_ONLY",n[n.VIDEO_ONLY=1]="VIDEO_ONLY",n[n.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(le||(le={}));const ia={[ge.W176_H132]:{width:176,height:132,maxBitrate:150,minBitrate:80},[ge.W176_H144]:{width:176,height:144,maxBitrate:160,minBitrate:80},[ge.W256_H144]:{width:256,height:144,maxBitrate:240,minBitrate:120},[ge.W320_H180]:{width:320,height:180,maxBitrate:280,minBitrate:120},[ge.W240_H240]:{width:240,height:240,maxBitrate:280,minBitrate:120},[ge.W320_H240]:{width:320,height:240,maxBitrate:400,minBitrate:120},[ge.W480_H360]:{width:480,height:360,maxBitrate:650,minBitrate:150},[ge.W640_H360]:{width:640,height:360,maxBitrate:800,minBitrate:180},[ge.W480_H480]:{width:480,height:480,maxBitrate:800,minBitrate:180},[ge.W640_H480]:{width:640,height:480,maxBitrate:900,minBitrate:200},[ge.W720_H480]:{width:720,height:480,maxBitrate:1e3,minBitrate:200},[ge.W1280_H720]:{width:1280,height:720,maxBitrate:2200,minBitrate:250},[ge.W1920_H1080]:{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}},Fc=(n,e)=>{const t=n*e;let r=Number.MAX_VALUE,i=null;for(const o in ia){const s=ia[o],u=Math.abs(s.width*s.height-t);u<r&&(i=s,r=u)}return i},oa={10:1,15:1,24:1.5,30:1.5},Hc=n=>{let e=Number.MAX_VALUE,t=1;for(const r in oa){const i=Math.abs(n-parseInt(r));i<e&&(e=i,t=oa[r])}return t},jo={getCameras:()=>B(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="videoinput")}),getMicrophones:()=>B(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="audioinput")}),getSpeakers:()=>B(void 0,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="audiooutput")})};class Ko extends In{constructor(e,t,r,i,o){super(),this._tag=e,this._userId=t,this._kind=r,this._isLocalTrack=i,this._roomId=o,this._localMuted=!1,this._remoteMuted=!1,this._streamId=[this._userId||this._roomId,this._tag].join("_"),this._id=[this._streamId,this.isAudioTrack()?0:1].join("_")}getStreamId(){return this._streamId}getTrackId(){return this._id}getUserId(){return this._userId}__innerGetMediaStreamTrack(){return this._msTrack}getTag(){return this._tag}isLocalTrack(){return this._isLocalTrack}isVideoTrack(){return this._kind==="video"}isAudioTrack(){return this._kind==="audio"}isReady(){var e;return((e=this._msTrack)===null||e===void 0?void 0:e.readyState)==="live"}__innerSetMediaStreamTrack(e){this._msTrack=e,this._setLocalMuted(this._localMuted);const t=this._msStream=this._msStream||new MediaStream,r=t.getTracks()[0];r&&t.removeTrack(r),e?t.addTrack(e):this._element&&(this._element.pause(),this._element.srcObject=null)}_setLocalMuted(e){this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e}mute(){b.info(`set ${this._id} enabled: false`),this._setLocalMuted(!0)}unmute(){b.info(`set ${this._id} enabled: true`),this._setLocalMuted(!1)}isLocalMuted(){return this._localMuted}isMCUTrack(){return Boolean(this._roomId)}isOwnerMuted(){return this._remoteMuted}play(e,t){return B(this,void 0,void 0,function*(){if(!this._msTrack)return b.warn(`the track is not ready to play -> id: ${this._id}`),{code:I.TRACK_NOT_READY};if(this._msTrack.readyState==="ended"&&b.warn(`the track's readyState is 'ended' -> id: ${this._id}`),t==null?void 0:t.volume){if(!_e(t==null?void 0:t.volume))return b.error(`${t==null?void 0:t.volume} is not a number, the valid range of options.volume is 0-100`),{code:I.PARAMS_ERROR};(t==null?void 0:t.volume)<0&&(t.volume=0,b.warn("the valid range of options.volume is 0-100, the value of volume has been set 0")),(t==null?void 0:t.volume)>100&&(t.volume=100,b.warn("the valid range of options.volume is 0-100, the value of volume has been set 100"))}if((t==null?void 0:t.audioDeviceId)&&!(yield jo.getSpeakers()).map(i=>i.deviceId).includes(t.audioDeviceId))return b.error(`the options.audioDeviceId is invalid --> ${t.audioDeviceId}`),{code:I.PARAMS_ERROR};const r=this.isVideoTrack();if(r&&(!e||!(e instanceof HTMLVideoElement)))return b.error(`the video track need an <video> to play -> id: ${this._id}`),{code:I.VIDEO_TRACK_MISS_MEDIA_ELEMENT};this._element=r?e:this._element||new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=i=>{var o;b.debug(`HTMLMediaElement onloadstart -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.ondurationchange=i=>{var o;b.debug(`HTMLMediaElement ondurationchange -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onloadedmetadata=i=>{var o;b.debug(`HTMLMediaElement onloadedmetadata -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onloadeddata=i=>{var o;b.debug(`HTMLMediaElement onloadeddata -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onabort=i=>{var o;b.info(`HTMLMediaElement onabort -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.oncanplay=i=>{var o;b.info(`HTMLMediaElement oncanplay -> id: ${(o=i.target)===null||o===void 0?void 0:o.id}, trackId: ${this._id}`)},this._element.onvolumechange=i=>{var o;const s=Math.floor(100*((o=i.target)===null||o===void 0?void 0:o.volume));b.info(`HTMLMediaElement onvolumechange -> volume: ${s}, trackId: ${this._id}`)},this._element.srcObject=this._msStream,this._element.autoplay=!0,r&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),r||!(t==null?void 0:t.volume)&&(t==null?void 0:t.volume)!==0||(this._element.volume=(t==null?void 0:t.volume)/100);try{(t==null?void 0:t.audioDeviceId)&&!r?yield this._element.setSinkId(t.audioDeviceId):this._element.play()}catch(i){return i.message==="No permission to use requested device"?(b.error(`setSinkId failed -> ${i.message}`),{code:I.NO_PERMISSION_TO_USE_REQUESTED_DEVICE}):(b.error(i),{code:I.TRACK_PLAY_ERROR})}return{code:I.SUCCESS}})}__innerDestroy(){this.__innerSetMediaStreamTrack(void 0)}__releaseMediaElement(){this._element&&(this._element.remove(),this._element.srcObject=null)}}class ue extends Ko{constructor(e,t,r,i){super(e,t,r,!0),this._isPublished=!1,this.__innerSetMediaStreamTrack(i),i.onended=()=>{i.onended=null,this.emit(ue.EVENT_LOCAL_TRACK_END,this),this.removeAll(ue.EVENT_LOCAL_TRACK_END)}}_setLocalMuted(e){const t=this._localMuted!==e;super._setLocalMuted(e),this._remoteMuted=this._localMuted,t&&this.emit(ue.__INNER_EVENT_MUTED_CHANGE__,this)}__innerSetPublished(e){this._isPublished=e}isPublished(){return this._isPublished}destroy(){var e;b.info(`track is destroyed -> trackId: ${this.getTrackId()}`),(e=this._msTrack)===null||e===void 0||e.stop(),super.__innerDestroy(),this.isAudioTrack()&&super.__releaseMediaElement(),this.emit(ue.__INNER_EVENT_DESTROY__,this)}setBitrate(e=0,t=0,r=0){!_e(e)||!_e(t)||!_e(r)||e<=0||t<=0||e<t?b.error("setBitrate params error ->"):this._bitrateInfo={max:e,min:t,start:r}}getBitrate(){var e,t;const{min:r,max:i}=this._msTrack?yl(this._msTrack):{min:0,max:0};return{min:((e=this._bitrateInfo)===null||e===void 0?void 0:e.min)||r,max:((t=this._bitrateInfo)===null||t===void 0?void 0:t.max)||i}}}ue.EVENT_LOCAL_TRACK_END="local-track-end",ue.__INNER_EVENT_MUTED_CHANGE__="inner-muted-change",ue.__INNER_EVENT_DESTROY__="inner-destroy";class xi extends ue{constructor(e,t,r){super(e,t,"audio",r)}setBitrate(e,t,r){b.warn("`setBitrate` invalid for audio track")}getBitrate(){return{start:32,max:32,min:32}}}class Ht extends ue{constructor(e,t,r,i=!1){super(e,t,"video",r),this._isTiny=i}__isTiny(){return this._isTiny}getStreamId(){const e=super.getStreamId();return this._isTiny?`${e}_tiny`:e}getTrackId(){const e=super.getTrackId();return this._isTiny?`${e}_tiny`:e}}class $t extends ue{constructor(e,t,r,i,o){super(e,t,r,i),this._resource=o,$t.__innerSetMapping(this.getTrackId(),o)}static __innerSetMapping(e,t){const r=this._mapping.get(t)||[];r.push(e),this._mapping.set(t,r)}static __innerRemoveMapping(e,t){var r,i;const o=(r=this._mapping.get(t))===null||r===void 0?void 0:r.filter(s=>s!==e);o&&o.length>0?this._mapping.set(t,o):(this._mapping.delete(t),t.pause(),t.src="",(i=t.parentNode)===null||i===void 0||i.removeChild(t))}destroy(){this.isAudioTrack()&&this.mute(),$t.__innerRemoveMapping(this.getTrackId(),this._resource),super.destroy()}}$t._mapping=new Map;class vl extends $t{constructor(e,t,r,i){super(e,t,"video",r,i)}}class Rl extends $t{constructor(e,t,r,i){super(e,t,"audio",r,i)}_setLocalMuted(e){this._resource&&(this._resource.muted=e),super._setLocalMuted(e)}play(){return this._setLocalMuted(!1),Promise.resolve({code:I.SUCCESS})}}class sa extends xi{}class aa extends Ht{}class El extends Ht{}class Oe extends Ko{constructor(e,t,r,i){super(e,t,r,!1,i),this._isSubscribed=!1}__innerSetRemoteMuted(e){this._remoteMuted=e}__innerSetSubscribed(e){this._isSubscribed=e}isSubscribed(){return this._isSubscribed}}class ut extends Oe{constructor(e,t,r){super(e,t,"audio",r)}}class dt extends Oe{constructor(e,t,r){super(e,t,"video",r)}}const Jn=(n,e)=>({name:n,content:JSON.stringify({uris:e,ignore:!0})}),vt=n=>JSON.stringify(n),st=n=>/^[a-zA-Z\d-=]+$/g.test(n),Cl=location.protocol!=="http:"||["localhost","127.0.0.1"].includes(location.hostname),oi=n=>{if(n===void 0)return 0;if(_e(n))return n;const e=n;return e.exact||e.ideal||e.max||0},qo=n=>{const e=n.getConstraints();return{width:oi(e.width),height:oi(e.height),frameRate:oi(e.frameRate)}},yl=n=>{const{width:e,height:t,frameRate:r}=qo(n),i=Fc(e,t),o=Hc(r);return{min:i.minBitrate*o,max:i.maxBitrate*o}},ce=n=>[n.msid,n.mediaType].join("_"),Pe=n=>{const e=n.split("_");return{mediaType:parseInt(e.pop()),tag:e.pop(),userId:e.join("_")}},si=(n,e)=>[n,e].join("_"),Wn=n=>n.map(e=>Object.assign({},e)),nr=(n,e,t=!1)=>{n=n.slice();const r=[],i=[],o=[];return e.forEach(s=>{const u=ce(s);let d=n.findIndex(h=>ce(h)===u);if(t&&(d=n.findIndex(h=>h.uri===s.uri)),d===-1)return void r.push(s);const l=n[d];l.uri!==s.uri?r.push(s):l.state!==s.state&&o.push(s),n.splice(d,1)}),i.push(...n),{publishedList:r,unpublishedList:i,modifiedList:o}},Tl=()=>{let n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=16*Math.random()|0;return(e==="x"?t:3&t|8).toString(16)});return n=n.replace(/-/g,"")+"0",n=parseInt(n,16),n=(e=>{const t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1;let i=+e;const o=[];do{const s=i%r;i=(i-s)/r,o.unshift(t[s])}while(i);return o.join("")})(n),n.length>22&&(n=n.slice(0,22)),n},nt=n=>{const[e,t]=n.split("_").map(r=>parseInt(r.replace(/[^\d]/g,"")));return{width:e,height:t}},Vt=n=>!!ge[n],Vi=n=>!!Ze[n],rt=n=>parseInt(n.replace("FPS_","")),Ge=(()=>{const{browser:n,version:e,supportsUnifiedPlan:t}=_l.browserDetails;return{browser:n,version:e,supportsUnifiedPlan:t!==!1}})();function $c(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function jc(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}const Bi=n=>Object.prototype.toString.call(n)==="[object Null]",rr=n=>n.type===1,Fi=n=>{const e={},t=Object.keys(n.users);return t.length&&t.forEach(r=>{const i=[],o=n.users[r];if(o.uris)try{i.push(...JSON.parse(o.uris))}catch{b.warn(`invalid user data -> userId: ${r}, userData: ${o}`)}e[r]=i}),e};var ie,Er;(function(n){n.PUBLISH="RCRTC:PublishResource",n.UNPUBLISH="RCRTC:UnpublishResource",n.MODIFY="RCRTC:ModifyResource",n.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",n.STATE="RCRTC:state",n.ROOM_NOTIFY="RCRTC:RoomNtf",n.USER_NOTIFY="RCRTC:UserNtf",n.KICK="RCRTC:kick",n.PK_INVITE="RCRTC:invite",n.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",n.PK_CANCEL_INVITE="RCRTC:cancelInvite",n.PK_INVITE_ANSWER="RCRTC:answerInvite",n.PK_END="RCRTC:endInvite",n.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline"})(ie||(ie={})),function(n){n.SUCCESS="Success",n.FAIL="Fail"}(Er||(Er={}));class Sl{constructor(e,t,r,i=1e4){this._roomId=e,this._roomMode=t,this._context=r,this._gap=i,this._latestTimestamp=Date.now(),this._timer=null}start(){return B(this,void 0,void 0,function*(){this._timer||(this._timer=setInterval(this._loop.bind(this),this._gap))})}_loop(){var e,t,r;return B(this,void 0,void 0,function*(){const i=yield new Promise(s=>{this._context.rtcPing(this._roomId,this._roomMode).then(s).catch(u=>{b.error(`rtcping receive unknown error -> ${u}`),s(S.UNKNOWN)}),setTimeout(s,1e4,S.TIMEOUT)}),o=Date.now();if(i===S.SUCCESS)return this._latestTimestamp=o,void((e=this.onPingResult)===null||e===void 0||e.call(this,Er.SUCCESS));(t=this.onPingResult)===null||t===void 0||t.call(this,Er.FAIL),b.warn(`rtcping failed -> code: ${i}`),(i===40003||o-this._latestTimestamp>6e4)&&(this.stop(),(r=this.onFailed)===null||r===void 0||r.call(this,i===40003))})}stop(){this._timer&&(clearInterval(this._timer),this._timer=null)}}var Ke;(function(n){n[n.NORMAL=1]="NORMAL",n[n.TINY=2]="TINY"})(Ke||(Ke={}));const ca=(n,e)=>Math.round(8*e/n),ua=(n,e=2)=>{const t=10**e;return Math.round(n*t)/t},lt=(n,e=2)=>{n>1&&(n/=32767);const t=10**e;return Math.ceil(n*t)},Zn=(n,e,t,r)=>{if(e===0)return 0;if(!t||!r)return ua(n/e,3);const i=e-r;if(i===0)return 0;const o=n-t;return o<0||i<0?0:ua(o/i,3)},Kc=n=>{const{jitter:e,rtt:t,packetsLostRate:r}=n;return!Bi(e)||!Bi(t)||r!==0};class Go{constructor(e,t){this._rtcPeerConn=e,this._sdpSemantics=t,this._latestPacketsSent={},this._latestBytesSent={},this._latestBytesRecv={},this._latestPacketsRecv={}}updateBytesSent(e,t,r){let i,o;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){const{bytesSent:s,timestamp:u}=this._latestBytesSent[e];i=t-s,o=r-u,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else i=t,o=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return ca(o,i)}updateBytesRecv(e,t,r){let i,o;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){const{bytesRecv:s,timestamp:u}=this._latestBytesRecv[e];i=t-s,o=r-u,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else i=t,o=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return ca(o,i)}updateSenderPacketsLost(e,t,r){let i;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){const{packetsLost:o,packetsSent:s}=this._latestPacketsSent[e];i=Zn(t,r,o,s),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?s:r}else i=Zn(t,r),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=r;return i}updateReceiverPacketsLost(e,t,r){let i;if(this._latestPacketsRecv[e]){const{packetsLost:o,packetsRecv:s}=this._latestPacketsRecv[e];i=Zn(t,r+t,o,s+o)}else i=Zn(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},i}clearLatestpacketsSent(e){e.forEach(t=>{if(parseInt(t.split("_").pop())===le.VIDEO_ONLY){const r=`${t}_tiny`;delete this._latestPacketsSent[r],delete this._latestBytesSent[r]}delete this._latestPacketsSent[t],delete this._latestBytesSent[t]})}clearLatestPacketsRecv(e){e.forEach(t=>{delete this._latestPacketsRecv[t],delete this._latestBytesRecv[t]})}parseRTCStatsReport(e){const t=e.keys(),r={};let i=t.next();for(;!i.done;){const o=i.value,s=e.get(o);/^RTCCodec_/.test(o)||(r[o]=s),i=t.next()}return r}formatRCRTCStateReport(e){return{senders:[],receivers:[]}}getAudioLevelList(e){return[]}getResourceIdByParseSdp(e){var t,r;const i=e.ssrc,o=e.kind||e.mediaType,s=(t=this._rtcPeerConn.currentLocalDescription)===null||t===void 0?void 0:t.sdp,u=(r=this._rtcPeerConn.currentRemoteDescription)===null||r===void 0?void 0:r.sdp;let d;d=this._sdpSemantics==="unified-plan"?new RegExp("a=msid:(.*?) "):new RegExp(`a=ssrc:${i} msid:(.*?) `);const l=s==null?void 0:s.split(`\r
  890. m=`),h=l==null?void 0:l.filter(_=>_.includes(`a=ssrc:${i}`))[0],a=h==null?void 0:h.match(d);let c=a?a[1]:"";if(c)return`${c}_${o==="video"?1:0}`;const p=u==null?void 0:u.split(`\r
  891. m=`),f=p==null?void 0:p.filter(_=>_.includes(`a=ssrc:${i}`))[0],m=f==null?void 0:f.match(d);return c=m?m[1]:"",`${c}_${o==="video"?1:0}`}isValidSender(e){var t;const r=(t=this._rtcPeerConn.currentLocalDescription)===null||t===void 0?void 0:t.sdp,{ssrc:i}=e;return!(r==null?void 0:r.split(`\r
  892. m=`).some(o=>o.includes(i)&&o.includes("a=inactive")))}isValidReceiver(e){var t;const r=(t=this._rtcPeerConn.currentRemoteDescription)===null||t===void 0?void 0:t.sdp,{ssrc:i}=e;return!(r==null?void 0:r.split(`\r
  893. m=`).some(o=>o.includes(i)&&o.includes("a=inactive")))}}class Il extends Go{formatRCRTCStateReport(e){const t={senders:[],receivers:[]},r=Math.floor(e.RTCPeerConnection.timestamp);t.timestamp=r;const i=Object.keys(e);let o=0,s=0;i.filter(l=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=e[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(h))return;const{id:a,kind:c,transportId:p,mediaSourceId:f,remoteId:m,packetsSent:_,bytesSent:v,trackId:R,encoderImplementation:C,pliCount:M,nackCount:A,firCount:O}=h;if(!R)return;let{framesPerSecond:y,frameWidth:w,frameHeight:H}=h;c!=="video"||w||H||y||(w=e[R].frameWidth,H=e[R].frameHeight,y=f?e[f].framesPerSecond:null);const Y=e[m];let E=null,T=null,N=0;Y&&(E=Y.jitter,T=Y.roundTripTime,N=Y.packetsLost),o+=N;const P=this.getResourceIdByParseSdp(h),L=f?e[f].audioLevel:e[R].audioLevel;let V=null;!this._latestPacketsSent[P]&&(this._latestPacketsSent[P]={}),Y?V=this.updateSenderPacketsLost(P,N,_):this._latestPacketsSent[P].crtPacketsSent=_;let F=this.updateBytesSent(P,v,r);F<0&&(F=0),s+=F,t.senders.push({id:a,trackId:P,kind:c,packetsLostRate:V,remoteResource:!1,audioLevel:L||L===0?lt(L):null,frameWidth:w,frameHeight:H,frameRate:y,bitrate:F,jitter:E&&Math.round(1e3*E),rtt:T,encoderImplementation:C,pliCount:M,nackCount:A,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}),i.filter(l=>/RTCRemoteInboundRtp(Video|Audio)Stream_/.test(l)).forEach(l=>{const{localId:h,jitter:a,roundTripTime:c,packetsLost:p}=e[l],f=t.senders.filter(m=>m.id===h)[0];if(f&&!Kc(f)){const m=this.getResourceIdByParseSdp(e[f.id]);f.jitter=Math.round(1e3*a),f.rtt=c;const _=this._latestPacketsSent[m].crtPacketsSent;f.packetsLostRate=this.updateSenderPacketsLost(m,p,_)}});let u=0;i.filter(l=>/^RTCInboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=e[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(h))return;const{trackId:a,packetsLost:c,packetsReceived:p,jitter:f,bytesReceived:m,framesPerSecond:_,kind:v,codecImplementationName:R,nackCount:C,pliCount:M}=h;if(!a)return;let{frameWidth:A,frameHeight:O,audioLevel:y}=h;v==="video"?A||O||(A=e[a].frameWidth,O=e[a].frameHeight):y||(y=e[a].audioLevel),o+=c;const w=this.getResourceIdByParseSdp(h),H=this.updateReceiverPacketsLost(w,c,p);let Y=this.updateBytesRecv(w,m,r);Y<0&&(Y=0),u+=Y,t.receivers.push({trackId:w,kind:v,packetsLostRate:H,remoteResource:!0,audioLevel:y||y===0?lt(y):null,frameWidth:A,frameHeight:O,frameRate:_,bitrate:Y,jitter:f?Math.round(1e3*f):0,codecImplementationName:R,nackCount:C,pliCount:M,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})});const d=i.filter(l=>/^RTCTransport_/.test(l))[0];if(d){const l=e[d],{selectedCandidatePairId:h}=l;if(h){const a=e[h],{availableOutgoingBitrate:c,availableIncomingBitrate:p,currentRoundTripTime:f,localCandidateId:m,remoteCandidateId:_}=a,v=e[m],{ip:R,port:C,networkType:M}=v,A=e[_],{ip:O,port:y,protocol:w}=A;t.iceCandidatePair={IP:R,port:C,networkType:M,remoteIP:O,remotePort:y,protocol:w,bitrateRecv:u,bitrateSend:s,rtt:1e3*f,availableOutgoingBitrate:c,availableIncomingBitrate:p,totalPacketsLost:o},t.receivers.forEach(H=>{H.rtt=f})}}return t}getAudioLevelList(e){const t=[],r=Object.keys(e);return r.filter(i=>/^RTCOutboundRTPAudioStream_/.test(i)).forEach(i=>{var o;const s=e[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(s))return;const{mediaSourceId:u,trackId:d}=s,l=this.getResourceIdByParseSdp(s),h=u&&e[u]?e[u].audioLevel:((o=e[d])===null||o===void 0?void 0:o.audioLevel)||null;t.push({trackId:l,audioLevel:h||h===0?lt(h):null})}),r.filter(i=>/^RTCInboundRTPAudioStream_/.test(i)).forEach(i=>{const o=e[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(o))return;const{trackId:s}=o,u=o.audioLevel||e[s].audioLevel,d=this.getResourceIdByParseSdp(o);t.push({trackId:d,audioLevel:u||u===0?lt(u):null})}),t}}class bl extends Go{formatRCRTCStateReport(e){const t=+new Date,r={senders:[],receivers:[],timestamp:t};let i=0,o=0,s=0;for(const u in e){const d=e[u],l=d.type;if(l==="outbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(d))continue;const{id:h,kind:a,bytesSent:c,packetsSent:p,bitrateMean:f,framerateMean:m,nackCount:_,pliCount:v,remoteId:R}=d,{jitter:C,roundTripTime:M,packetsLost:A}=R?e[R]:{jitter:null,roundTripTime:null,packetsLost:0},O=this.getResourceIdByParseSdp(d);i+=A;let y=null;!this._latestPacketsSent[O]&&(this._latestPacketsSent[O]={}),R?y=this.updateSenderPacketsLost(O,A,p):this._latestPacketsSent[O].crtPacketsSent=p;let w=0;a==="video"?f&&(w=Math.floor(f/1e3)):w=this.updateBytesSent(O,c,t),w<0&&(w=0),o+=w,r.senders.push({trackId:O,kind:a,packetsLostRate:y,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(m),bitrate:w,jitter:C?Math.round(1e3*C):null,rtt:M,encoderImplementation:null,pliCount:v,nackCount:_,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}if(l==="remote-inbound-rtp"){const{localId:h}=d,a=this.getResourceIdByParseSdp(e[h]),c=r.senders.filter(p=>p.trackId===a)[0];c&&Kc(c)&&(c.jitter=Math.round(1e3*d.jitter),c.rtt=d.rtt,c.packetsLostRate=this.updateSenderPacketsLost(a,d.packetsLost,this._latestPacketsSent[a].crtPacketsSent))}if(l==="inbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(d))continue;const{id:h,packetsLost:a,bytesReceived:c,packetsReceived:p,jitter:f,framerateMean:m,kind:_,bitrateMean:v,nackCount:R,pliCount:C}=d,M=this.getResourceIdByParseSdp(d);i+=a;const A=this.updateReceiverPacketsLost(M,a,p);let O=0;_==="video"?v&&(O=Math.floor(v/1e3)):O=this.updateBytesRecv(M,c,t),O<0&&(O=0),s+=O,r.receivers.push({trackId:M,kind:_,packetsLostRate:A,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(m),bitrate:O,jitter:f?Math.round(1e3*f):null,codecImplementationName:null,nackCount:R,pliCount:C,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}if(l==="candidate-pair"&&d.state==="succeeded"){const h=e[d.localCandidateId],{address:a,port:c}=h,p=e[d.remoteCandidateId],{address:f,port:m,protocol:_}=p;r.iceCandidatePair={IP:a,port:c,networkType:null,remoteIP:f,remotePort:m,protocol:_,bitrateRecv:s,bitrateSend:o,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:i}}}return r.iceCandidatePair&&(r.iceCandidatePair.bitrateSend=o),r.iceCandidatePair&&(r.iceCandidatePair.bitrateRecv=s),r}getAudioLevelList(e){const t=[];for(const r in e){const i=e[r],o=i.type;if(o==="outbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(i))continue;const{kind:s}=i;if(s==="video")continue;const u=this.getResourceIdByParseSdp(i);t.push({trackId:u,audioLevel:null})}if(o==="inbound-rtp"){if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(i))continue;const{kind:s}=i;if(s==="video")continue;const u=this.getResourceIdByParseSdp(i);t.push({trackId:u,audioLevel:null})}}return t}}class Ol extends Go{formatRCRTCStateReport(e){const t={senders:[],receivers:[]},r=Math.floor(e.RTCPeerConnection.timestamp);t.timestamp=r;const i=Object.keys(e);let o=0,s=0;i.filter(l=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=e[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(h))return;const a=this.getResourceIdByParseSdp(h),{mediaType:c,transportId:p,remoteId:f,packetsSent:m,bytesSent:_,trackId:v,encoderImplementation:R,pliCount:C,nackCount:M,firCount:A}=h;if(!v)return;const{audioLevel:O,frameHeight:y,frameWidth:w}=e[v];let H=this.updateBytesSent(a,_,r);H<0&&(H=0),s+=H,t.senders.push({trackId:a,kind:c,packetsLostRate:null,remoteResource:!1,audioLevel:O||O===0?lt(O):null,frameWidth:w,frameHeight:y,frameRate:null,bitrate:H,jitter:null,rtt:null,encoderImplementation:R,pliCount:C,nackCount:M,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})});let u=0;i.filter(l=>/^RTCInboundRTP(Video|Audio)Stream_/.test(l)).forEach(l=>{const h=e[l];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(h))return;const{trackId:a,packetsLost:c,packetsReceived:p,jitter:f,bytesReceived:m,mediaType:_,nackCount:v,pliCount:R}=h,C=this.getResourceIdByParseSdp(h);if(!a)return;const{frameHeight:M,frameWidth:A,audioLevel:O}=e[a];o+=c;const y=this.updateReceiverPacketsLost(C,c,p);let w=this.updateBytesRecv(C,m,r);w<0&&(w=0),u+=w,t.receivers.push({trackId:C,kind:_,packetsLostRate:y,remoteResource:!0,audioLevel:O||O===0?lt(O):null,frameWidth:A,frameHeight:M,frameRate:null,bitrate:w,jitter:f,codecImplementationName:null,nackCount:v,pliCount:R,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})});const d=i.filter(l=>/^RTCTransport_/.test(l))[0];if(d){const l=e[d],{selectedCandidatePairId:h}=l;if(h){const a=e[h],{availableOutgoingBitrate:c,availableIncomingBitrate:p,currentRoundTripTime:f,localCandidateId:m,remoteCandidateId:_}=a,v=e[m],{address:R,port:C}=v,M=e[_],{address:A,port:O,protocol:y}=M;t.iceCandidatePair={IP:R||null,port:C,networkType:null,remoteIP:A,remotePort:O,protocol:y,bitrateRecv:u,bitrateSend:s,rtt:1e3*f,availableOutgoingBitrate:c,availableIncomingBitrate:p,totalPacketsLost:o},t.receivers.forEach(w=>{w.rtt=f})}}return t}getAudioLevelList(e){const t=[],r=Object.keys(e);return r.filter(i=>/^RTCOutboundRTP(Video|Audio)Stream_/.test(i)).forEach(i=>{const o=e[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidSender(o))return;const{trackId:s,mediaType:u}=o;if(u==="video")return;const d=this.getResourceIdByParseSdp(o),l=e[s];t.push({trackId:d,audioLevel:l||l===0?lt(l):null})}),r.filter(i=>/^RTCInboundRTP(Video|Audio)Stream_/.test(i)).forEach(i=>{const o=e[i];if(this._sdpSemantics==="unified-plan"&&!this.isValidReceiver(o))return;const{trackId:s,mediaType:u}=o;if(!s||u==="video")return;const{audioLevel:d}=e[s],l=this.getResourceIdByParseSdp(o);t.push({trackId:l,audioLevel:d||d===0?lt(d):null})}),t}}class Gt{constructor(e){this._peer=e,this._outboundStreams={}}static setSdpSemantics(e){const{browser:t,version:r,supportsUnifiedPlan:i}=Ge;i?/chrome/i.test(t)?this._sdpSemantics=r>92?"unified-plan":r<72?"plan-b":e:/firefox/i.test(t)?this._sdpSemantics="unified-plan":/safari/i.test(t)?this._sdpSemantics=r<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan":this._sdpSemantics="plan-b"}static getSdpSemantics(){return Gt._sdpSemantics}getOutboundVideoInfo(){const e=[];for(const t in this._outboundStreams){const r=this._outboundStreams[t].getVideoTracks()[0];if(!r)continue;const i=/_tiny$/.test(t),{width:o,height:s}=qo(r);e.push({trackId:r.id,simulcast:i?Ke.TINY:Ke.NORMAL,resolution:`${o}x${s}`})}return e}setRemoteAnswer(e){return B(this,void 0,void 0,function*(){e=e.replace(/\s+\r\n/g,`\r
  894. `);try{yield this._peer.setRemoteDescription({type:"answer",sdp:e})}catch(t){return b.error(t),I.SET_REMOTE_DESCRIPTION_FAILED}return I.SUCCESS})}getStatParsr(e,t){return/chrome/i.test(Ge.browser)?new Il(e,t):/Firefox/i.test(Ge.browser)?new bl(e,t):/Safari/i.test(Ge.browser)?new Ol(e,t):null}}class Nl extends Gt{constructor(){super(...arguments),this.senders={},this._localTracks=[]}addLocalTrack(e){this._localTracks.includes(e)||this._localTracks.push(e);const t=e.getStreamId(),r=e.__innerGetMediaStreamTrack(),i=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);i.getTracks().forEach(u=>{u.kind===r.kind&&i.removeTrack(u)}),i.addTrack(r);const o=e.getTrackId(),s=this.senders[o];s?s.replaceTrack(r):this.senders[o]=this._peer.addTrack(r,i)}removeLocalTrack(e){const t=this._localTracks.findIndex(o=>o===e);t>=0&&this._localTracks.splice(t,1);const r=e.getTrackId(),i=this.senders[r];i&&(i.replaceTrack(null),this._peer.removeTrack(i),delete this.senders[r])}updateSubRemoteTracks(e){}updateRecvTransceiverMap(e,t){}setBitrate(e,t,r){this._maxBitrate=e,this._minBitrate=t,this._startBitrate=r||.7*e}createOffer(e){return B(this,void 0,void 0,function*(){const t=yield this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0});for(const r in this._outboundStreams){const i=this._outboundStreams[r].id;t.sdp=t.sdp.replace(new RegExp(i,"g"),r)}return yield this._peer.setLocalDescription(t),{type:"offer",semantics:"plan-b",sdp:t.sdp}})}setRemoteAnswer(e){let t=0,r=0;this._localTracks.forEach(u=>{const{min:d,max:l}=u.getBitrate();r+=d,t+=l}),t=this._maxBitrate&&this._maxBitrate>0?Math.min(t,this._maxBitrate):t,r=this._minBitrate&&this._minBitrate>0?Math.max(r,this._minBitrate):r;const i=this._startBitrate||Math.round(.7*t),o=`b=AS:${t}`;e=e.replace(/[\r\n]+m=video[^\r\n]+/,u=>`${u}\r
  895. ${o}`);const s=[`;x-google-min-bitrate=${r}`,`;x-google-max-bitrate=${t}`,`;x-google-start-bitrate=${i}`].join("");return e=e.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,u=>u+s),super.setRemoteAnswer(e)}}class wl extends Gt{constructor(){super(...arguments),this._sendTransceiver={},this._localTracks={},this._recvAudio=[],this._recvVideo=[],this._recvTransceiver={},this._subedTracks=[]}setBitrate(e,t,r){b.warn("the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}addLocalTrack(e){const t=e.getTrackId(),r=e.getStreamId(),i=e.__innerGetMediaStreamTrack();this._localTracks[t]=e;const o=this._outboundStreams[r]||(this._outboundStreams[r]=new MediaStream);o.getTracks().forEach(u=>{u.kind===i.kind&&o.removeTrack(u)}),o.addTrack(i);const s=this._sendTransceiver[t];s?(s.sender.replaceTrack(i),s.direction="sendonly"):this._sendTransceiver[t]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]})}removeLocalTrack(e){const t=e.getTrackId(),r=e.getStreamId();e.__innerGetMediaStreamTrack(),delete this._localTracks[t];const i=this._sendTransceiver[t];if(!i)return;i.direction="inactive",this._peer.removeTrack(i.sender),i.sender.replaceTrack(null);const o=this._outboundStreams[r];(e.isAudioTrack()?o.getAudioTracks():o.getVideoTracks()).forEach(l=>o.removeTrack(l));const s=this._sendTransceiver[`${t}_tiny`];if(!s||s.direction==="inactive")return;s.direction="inactive";const u=s.sender,d=u.track;this._peer.removeTrack(u),u.replaceTrack(null),this._outboundStreams[`${r}_tiny`].removeTrack(d),d.stop()}updateRecvTransceiverMap(e,t){const{mediaType:r}=Pe(e);this._recvTransceiver[e]=t;const i=r===le.AUDIO_ONLY?this._recvAudio:this._recvVideo,o=i.findIndex(s=>s===t);o>=0&&i.splice(o,1)}updateSubRemoteTracks(e){const t=e.slice(),r=this._subedTracks.slice();this._subedTracks=e.slice();for(let o=t.length-1;o>=0;o-=1){const s=t[o],u=r.findIndex(d=>d===s);u>=0&&(t.splice(o,1),r.splice(u,1))}r.length&&r.forEach(o=>{const s=o.getTrackId();o.__innerSetMediaStreamTrack(void 0);const u=this._recvTransceiver[s];u&&(u.direction="inactive")});const i={audio:0,video:0};t.length&&t.forEach(o=>{const s=o.isAudioTrack()?"audio":"video",u=this._recvTransceiver[o.getTrackId()];u?u.direction="recvonly":i[s]+=1});for(let o=this._recvAudio.length;o<i.audio;o+=1)this._recvAudio.push(this._peer.addTransceiver("audio",{direction:"recvonly"}));for(let o=this._recvVideo.length;o<i.video;o+=1)this._recvVideo.push(this._peer.addTransceiver("video",{direction:"recvonly"}))}createOffer(e){return B(this,void 0,void 0,function*(){const t=yield this._peer.createOffer({iceRestart:e});let r=t.sdp;for(const i in this._outboundStreams){const o=this._outboundStreams[i].id;r=r.replace(new RegExp(o,"g"),i)}return r=(i=>i.split(/\r\n(?=m=)/).map(o=>(s=>/a=(recvonly|inactive)/.test(s)?s.replace(/\r\na=(ssrc|msid)[^\r\n]+/g,""):s)(o)).join(`\r
  896. `))(r),r=r.replace(/a=ice-options:trickle/g,`a=ice-options:trickle\r
  897. a=ice-options:renomination`),t.sdp=r,yield this._peer.setLocalDescription(t),{type:"offer",semantics:"unified-plan",sdp:r}})}setRemoteAnswer(e){e=e.split(/\r\n(?=m=)/).map(r=>{var i;const o=r.match(/a=mid:[^\s]+/);if(!o)return r;const s=o[0].replace("a=mid:","");let u="";for(const f in this._sendTransceiver)if(this._sendTransceiver[f].mid===s){u=f;break}if(!u)return r;const d=(i=this._localTracks[u])===null||i===void 0?void 0:i.getBitrate();if(!d)return r;const{max:l,min:h}=d,a=l&&l>0?d.start||.7*l:0,c=[];if(l&&l>0&&c.push(`;x-google-max-bitrate=${l}`),h&&h>0&&c.push(`;x-google-min-bitrate=${h}`),a>0&&c.push(`;x-google-start-bitrate=${a}`),c.length===0)return r;const p=c.join("");return r.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,f=>f+p)}).join(`\r
  898. `);const t=/[\r\n]+\r\n[\r\n]+/g;return t.test(e)&&(b.warn(`answer sdp invalid -> ${JSON.stringify(e)}`),e=e.replace(t,`\r
  899. `)),super.setRemoteAnswer(e)}}class ot extends In{constructor(e,t){super(),this._reTryExchange=e,this._polarisReport=t,this.pubLocalTracks={},this._reTryExchangeTimer=null,this._reportStatsTimer=null,this._reportListener=null;const r=Gt.getSdpSemantics(),i=this._rtcPeerConn=new RTCPeerConnection({sdpSemantics:r});this._sdpStrategy=r==="plan-b"?new Nl(i):new wl(i),this._rtcPeerConn.oniceconnectionstatechange=this._onICEConnectionStateChange.bind(this),this._rtcPeerConn.onconnectionstatechange=this._onConnectionStateChange.bind(this),this._rtcPeerConn.ontrack=this._onTrackReady.bind(this),this.reportParser=this._sdpStrategy.getStatParsr(this._rtcPeerConn,r)}getLocalTracks(){return Object.values(this.pubLocalTracks)}_onConnectionStateChange(){b.info(`onconnectionstatechange -> ${this._rtcPeerConn.connectionState}`)}_onICEConnectionStateChange(){var e,t;b.info(`oniceconnectionstatechange -> ${this._rtcPeerConn.iceConnectionState}`),this._rtcPeerConn.iceConnectionState==="connected"&&(this._reportStatsTimer&&clearInterval(this._reportStatsTimer),this._reportStatsTimer=setInterval(this._reportHandle.bind(this),1e3)),this._rtcPeerConn.iceConnectionState!=="failed"&&this._rtcPeerConn.iceConnectionState!=="disconnected"||(b.warn("iceconenction state is `failed`, exchange SDP to try again."),this._reTryExchange(),this._reTryExchangeTimer=setInterval(this._reTryExchange,15e3));try{(t=(e=this._reportListener)===null||e===void 0?void 0:e.onICEConnectionStateChange)===null||t===void 0||t.call(e,this._rtcPeerConn.iceConnectionState)}catch(r){b.error("onICEConnectionStateChange error",r)}}_onTrackReady(e){if(!e.streams.length)return;const t=[e.streams[0].id,e.receiver.track.kind==="audio"?le.AUDIO_ONLY:le.VIDEO_ONLY].join("_");this._updateRecvTransceiverMap(t,e.transceiver),this.emit(ot.__INNER_EVENT_TRACK_READY__,e)}setBitrate(e,t,r){return B(this,void 0,void 0,function*(){this._sdpStrategy.setBitrate(e,t,r)})}createOffer(e){return B(this,void 0,void 0,function*(){const t=yield this._sdpStrategy.createOffer(e);return b.debug(`offer -> ${JSON.stringify(t.sdp)}`),t})}setRemoteAnswer(e){return B(this,void 0,void 0,function*(){return b.debug(`answer -> ${JSON.stringify(e)}`),this._sdpStrategy.setRemoteAnswer(e)})}getLocalTrack(e){return this.pubLocalTracks[e]||null}addLocalTrack(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(ue.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(ue.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(ue.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(ue.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}removeLocalTrackById(e){const t=this.getLocalTrack(e);t&&this.removeLocalTrack(t)}removeAllLocalTrack(){Object.keys(this.pubLocalTracks).forEach(e=>{/_tiny$/.test(e)||this.removeLocalTrackById(e)})}removeLocalTrack(e){const t=e.getTrackId();delete this.pubLocalTracks[t],this._sdpStrategy.removeLocalTrack(e),e.__innerSetPublished(!1),e.off(ue.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(ue.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);const r=`${t}_tiny`,i=this.getLocalTrack(r);i&&(this._sdpStrategy.removeLocalTrack(i),delete this.pubLocalTracks[r],i.destroy())}_updateRecvTransceiverMap(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}updateSubRemoteTracks(e){this._sdpStrategy.updateSubRemoteTracks(e)}getOutboundVideoInfo(){return this._sdpStrategy.getOutboundVideoInfo()}_onLocalTrackMuted(e){const t=this.getLocalTrack(`${e.getTrackId()}_tiny`);t&&(t.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(ue.__INNER_EVENT_MUTED_CHANGE__,e)}_onLocalTrackDestroied(e){this.emit(ue.__INNER_EVENT_DESTROY__,e)}registerReportListener(e){this._reportListener=e}_createRCRTCStateReport(e){const{timestamp:t,iceCandidatePair:r,senders:i,receivers:o}=JSON.parse(JSON.stringify(e));r==null||delete r.totalPacketsLost;for(const s in r)Bi(r[s])&&delete r[s];return{timestamp:t,iceCandidatePair:r,senders:i.map(s=>{const u={};return s.trackId&&(u.trackId=s.trackId),s.kind&&(u.kind=s.kind),(s.packetsLostRate||s.packetsLostRate===0)&&(u.packetsLostRate=s.packetsLostRate),u.remoteResource=s.remoteResource,(s.audioLevel||s.audioLevel===0)&&(u.audioLevel=s.audioLevel),s.frameWidth&&(u.frameWidth=s.frameWidth),s.frameHeight&&(u.frameHeight=s.frameHeight),s.frameRate&&(u.frameRate=s.frameRate),(s.bitrate||s.bitrate===0)&&(u.bitrate=s.bitrate),s.jitter&&(u.jitter=s.jitter),u}),receivers:o.map(s=>{const u={};return s.trackId&&(u.trackId=s.trackId),s.kind&&(u.kind=s.kind),(s.packetsLostRate||s.packetsLostRate===0)&&(u.packetsLostRate=s.packetsLostRate),u.remoteResource=s.remoteResource,(s.audioLevel||s.audioLevel===0)&&(u.audioLevel=s.audioLevel),s.frameWidth&&(u.frameWidth=s.frameWidth),s.frameHeight&&(u.frameHeight=s.frameHeight),s.frameRate&&(u.frameRate=s.frameRate),(s.bitrate||s.bitrate===0)&&(u.bitrate=s.bitrate),s.jitter&&(u.jitter=s.jitter),u})}}_getStatsData(){var e,t;return B(this,void 0,void 0,function*(){const r=yield this._rtcPeerConn.getStats(),i=(e=this.reportParser)===null||e===void 0?void 0:e.parseRTCStatsReport(r);return(t=this.reportParser)===null||t===void 0?void 0:t.formatRCRTCStateReport(i)})}getAudioLevelReportData(){var e,t;return B(this,void 0,void 0,function*(){const r=yield this._rtcPeerConn.getStats(),i=(e=this.reportParser)===null||e===void 0?void 0:e.parseRTCStatsReport(r);return i?(t=this.reportParser)===null||t===void 0?void 0:t.getAudioLevelList(i):[]})}_reportHandle(){var e,t,r;return B(this,void 0,void 0,function*(){const i=yield this._getStatsData();if(!i)return;(i.senders.length||i.receivers.length)&&((e=this._polarisReport)===null||e===void 0||e.sendR3R4Data(i));const o=this._createRCRTCStateReport(i);(r=(t=this._reportListener)===null||t===void 0?void 0:t.onStateReport)===null||r===void 0||r.call(t,o)})}getRTCPeerConn(){return this._rtcPeerConn}destroy(){this.clear(),this.clearReTryExchangeTimer(),this._reportStatsTimer&&(clearInterval(this._reportStatsTimer),this._reportStatsTimer=null),this.registerReportListener(null),this._rtcPeerConn.close(),this.reportParser=null}clearReTryExchangeTimer(){clearInterval(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}var kt,Cr,ht,pt,yr;ot.__INNER_EVENT_TRACK_READY__="inner-track-ready",function(n){n[n.DISABLE=0]="DISABLE",n[n.ENABLE=1]="ENABLE"}(kt||(kt={})),function(n){n[n.MeetingOrAnchor=1]="MeetingOrAnchor",n[n.Audience=2]="Audience"}(Cr||(Cr={}));class qc{constructor(e,t,r,i,o=Cr.MeetingOrAnchor){this._context=e,this._runtime=t,this._roomId=r,this._crtRTCRoom=i,this._userRole=o}_send(e){this._context.getConnectionStatus()===ee.CONNECTED&&this._context.setRTCState(this._roomId,e)}_getClientID(){const e="uuid";let t=this._runtime.localStorage.getItem(e);return t||(t=Tl(),this._runtime.localStorage.setItem(e,t)),t}_getRealResourceId(e){let t=e;const r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}_getPolarisTrackId(e){let t="";const r=e.split("_");if(e.includes("_tiny")){const i=r.pop(),o=parseInt(r.pop())===le.AUDIO_ONLY?"audio":"video",s=r.pop();t=[r.join("_"),s,i,o].join("_")}else{const i=parseInt(r.pop())===le.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i].join("_")}return t}sendR3R4Data(e){const{iceCandidatePair:t,senders:r,receivers:i}=e,o=(t==null?void 0:t.bitrateSend)||-1,s=(t==null?void 0:t.bitrateRecv)||-1,u=(t==null?void 0:t.networkType)||"unknown",d=(t==null?void 0:t.rtt)||-1,l=`${(t==null?void 0:t.IP)||-1}:${t==null?void 0:t.port}`,h=(t==null||t.remoteIP,t==null||t.remotePort,(t==null?void 0:t.availableIncomingBitrate)||-1),a=(t==null?void 0:t.availableOutgoingBitrate)||-1,c=(t==null?void 0:t.totalPacketsLost)||-1,p=this._context.getCurrentId();let f=`R3 ${o} -1 -1 -1 ${u} ${d} ${l} ${h} ${a} ${c} ${p}\r`,m=`R4 ${s} -1 -1 -1 ${u} ${d} ${l} ${h} ${a} ${c} ${p}\r`;const _=r.map(R=>{var C;const{trackId:M,audioLevel:A,samplingRate:O,bitrate:y,packetsLostRate:w,frameRate:H,frameWidth:Y,frameHeight:E,googRenderDelayMs:T,jitter:N,nackCount:P,pliCount:L,rtt:V,googFirsSent:F,encoderImplementation:q}=R,z=this._getPolarisTrackId(M),ne=this._getRealResourceId(M);return{trackId:z,googCodecName:q||String(-1),audioLevel:A||A===0?A:-1,bitrate:y||y===0?y:-1,packetsLostRate:w||w===0?w:-1,frameRate:H||-1,resolution:Y&&E?`${Y} * ${E}`:"-1",jitter:N||-1,nackCount:P||P===0?P:-1,pliCount:L||L===0?L:-1,rtt:V||-1,googFirsSent:F,samplingRate:O,googRenderDelayMs:T,encoderImplementation:q||String(-1),trackState:((C=this._crtRTCRoom.getLocalTrack(ne))===null||C===void 0?void 0:C.isLocalMuted())?kt.DISABLE:kt.ENABLE}}),v=i.filter(R=>!!R.trackId).map(R=>{var C;const{trackId:M,audioLevel:A,samplingRate:O,bitrate:y,packetsLostRate:w,frameRate:H,frameWidth:Y,frameHeight:E,googRenderDelayMs:T,jitter:N,nackCount:P,pliCount:L,rtt:V,googFirsReceived:F,codecImplementationName:q}=R,z=this._getPolarisTrackId(M),ne=this._getRealResourceId(M);return{trackId:z,googCodecName:q||String(-1),audioLevel:A||A===0?A:-1,bitrate:y||y===0?y:-1,packetsLostRate:w||w===0?w:-1,frameRate:H||-1,resolution:Y&&E?`${Y} * ${E}`:"-1",jitter:N||-1,nackCount:P||P===0?P:-1,pliCount:L||L===0?L:-1,rtt:V||-1,googFirsReceived:F,samplingRate:O,googRenderDelayMs:T,codecImplementationName:q||String(-1),trackState:((C=this._crtRTCRoom.getRemoteTrack(ne))===null||C===void 0?void 0:C.isLocalMuted())?kt.DISABLE:kt.ENABLE}});f+=_.map(R=>`${R.trackId} ${R.googCodecName} ${R.audioLevel} ${R.samplingRate} ${R.bitrate} ${R.packetsLostRate} ${R.frameRate} ${R.resolution} ${R.googRenderDelayMs} ${R.jitter} ${R.nackCount} ${R.pliCount} ${R.rtt} ${R.googFirsSent} ${R.encoderImplementation} ${R.trackState}`).join(`
  900. `),e.senders.length&&this._send(f+`\r${this._userRole}`),m+=v.map(R=>`${R.trackId} ${R.googCodecName} ${R.audioLevel} ${R.samplingRate} ${R.bitrate} ${R.packetsLostRate} ${R.frameRate} ${R.resolution} ${R.googRenderDelayMs} ${R.jitter} ${R.nackCount} ${R.pliCount} ${R.rtt} ${R.googFirsReceived} ${R.codecImplementationName} ${R.trackState}`).join(`
  901. `),e.receivers.length&&this._send(m+`\r${this._userRole}`)}sendR1(){const e=`R1 5.3.1 ${this._context.getCoreVersion()} web ${navigator.platform} -1 ${Ge.browser} ${Ge.version} ${this._getClientID()} ${this._userRole}`;this._send(e)}sendR2(e,t,r){const i=`R2 ${e} ${t} ${this._getClientID()}\r${r.join(" ")}\r${this._userRole}`;this._send(i)}}(function(n){n.PUBLISH="publish",n.SUBSCRIBE="subscribe"})(ht||(ht={})),function(n){n.BEGIN="begin",n.END="end"}(pt||(pt={}));class Gc{constructor(e){this._room=e,this._audioLevelChangeHandler=null,this._timer=null,this._pc=this._room.__getPC()}_audioLevelReport(){return B(this,void 0,void 0,function*(){if(this._pc.getRTCPeerConn().iceConnectionState==="new"||!this._audioLevelChangeHandler)return;const e=(yield this._pc.getAudioLevelReportData()).map(t=>{const{userId:r}=xl.parseTrackId(t.trackId);return{track:this._room.getCrtUserId()===r?this._room.getLocalTrack(t.trackId):this._room.getRemoteTrack(t.trackId),audioLevel:t.audioLevel||0}}).filter(t=>t.track);this._audioLevelChangeHandler(e)})}onAudioLevelChange(e,t){t<300||t>1e3?b.error('the valid range of onAudioLevelChange params "gap" is: > 300 && < 1000'):e?(this._audioLevelChangeHandler=e,this._timer=setInterval(this._audioLevelReport.bind(this),t)):this._audioLevelChangeHandler=null}clearAudioLevelReportTimer(){this._timer&&(clearInterval(this._timer),this._timer=null)}}(function(n){n[n.ANCHOR=1]="ANCHOR",n[n.AUDIENCE=2]="AUDIENCE"})(yr||(yr={}));const on=n=>n instanceof Ko?n.getTrackId():n.track.getTrackId();class Yc{constructor(e,t,r,i,o,s,u,d,l,h){this._context=e,this._runtime=t,this._roomId=r,this._roomMode=o,this._service=s,this._initOptions=u,this._ntfClearRoomItem=d,this._isMainRoom=h,this._remoteTracks={},this._subscribedList=[],this._destroyed=!1,this.msgTaskQueue=new oc,this._appListener=null,this._onRecvPKMsg=null,this._token=i.token,this._sessionId=i.sessionId,this._roomResources=l?{}:Fi(i),this._initRemoteTracks();const a=this._context.getCurrentId(),c=this._roomResources[a]=this._roomResources[a]||[];b.debug(`room data -> ${JSON.stringify(this._roomResources)}`),c.length>0&&ve(()=>this._unpublishPrev(c)),l&&this._afterChangedRole(i),this._pinger=new Sl(r,this._roomMode,e,this._initOptions.pingGap),this._pinger.onFailed=this._kickoff.bind(this),this._pinger.onPingResult=this._handlePingResult.bind(this),this._pinger.start(),this._polarisReport=new qc(this._context,this._runtime,this._roomId,this),this._polarisReport.sendR1(),this._pc=new ot(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(ot.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.on(ue.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),this._pc.on(ue.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}_initRemoteTracks(){const e=this._context.getCurrentId();for(const t in this._roomResources){const r=this._roomResources[t];t!==e&&r.length!==0&&r.forEach(i=>{const o=ce(i),{tag:s,userId:u,mediaType:d}=Pe(o),l=d===le.AUDIO_ONLY?new ut(s,u):new dt(s,u);l.__innerSetRemoteMuted(i.state===0),this._remoteTracks[o]=l})}}_handlePingResult(e){this._callAppListener("onPing",e)}setBitrate(e,t,r){b.warn("`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),Ie("max",e,i=>_e(i)&&i>Math.max(t||1,200),!0),Ie("min",t,i=>_e(i)&&i>=1&&(!_e(e)||i<e),!0),Ie("start",r,i=>_e(i)&&i>t&&i<=e),this._pc.setBitrate(e,t,r)}_onTrackReady(e){const t=e.streams[0].id,r=e.receiver.track,i=[t,r.kind==="audio"?le.AUDIO_ONLY:le.VIDEO_ONLY].join("_"),o=this._remoteTracks[i];o?(o.__innerSetMediaStreamTrack(r),this._callAppListener("onTrackReady",o)):b.warn(`cannot found remote track ${r.id}`)}_callAppListener(e,...t){var r;const i=(r=this._appListener)===null||r===void 0?void 0:r[e];if(i)try{i(...t)}catch(o){b.error(o)}}_onUserUnpublish(e){return B(this,void 0,void 0,function*(){yield this.unsubscribe(e),e.forEach(t=>{t.__innerDestroy(),delete this._remoteTracks[t.getTrackId()]}),this._onTrackUnpublish(e)})}_onTrackUnpublish(e){this._callAppListener("onTrackUnpublish",e)}_unpublishPrev(e){return B(this,void 0,void 0,function*(){const t=e.slice();e.length=0,b.info(`unpublish uris prev login: ${JSON.stringify(t)}`);const r=yield this._context.setRTCTotalRes(this._roomId,Jn(ie.UNPUBLISH,t),vt([]),ie.TOTAL_CONTENT_RESOURCE,vt([]));r!==S.SUCCESS?b.error(`unpublish prev uris failed -> code: ${r}`):b.debug("unpublish uris prev login succeed")})}__parseInnerMessage(e){const{targetId:t,conversationType:r}=e;if(r!==J.RTC_ROOM)return!1;if(t!==this._roomId)return!0;b.info(`recv inner msg -> message: ${JSON.stringify(e)} | roomid: ${this._roomId}`);const i=e.content;switch(e.messageType){case ie.KICK:this._kickoff(!0,i);break;case ie.STATE:this.msgTaskQueue.push(()=>this._stateHandle(i));break;case ie.MODIFY:case ie.PUBLISH:case ie.UNPUBLISH:case ie.TOTAL_CONTENT_RESOURCE:this.msgTaskQueue.push(()=>this._resourceHandle(i,e.messageType,e.senderUserId));break;case ie.ROOM_NOTIFY:this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case ie.USER_NOTIFY:b.warn(`TODO: ${ie.USER_NOTIFY}`);break;case ie.PK_INVITE:case ie.PK_CANCEL_INVITE:case ie.PK_INVITE_TIMEOUT:case ie.PK_INVITE_ANSWER:case ie.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case ie.OTHER_ROOM_OFFLINE:break;default:this._callAppListener("onMessageReceive",e.messageType,e.content,e.senderUserId,e.messageUId)}return!0}_kickoff(e,t){let r;b.warn(`onKickOff -> byServer: ${e}`),this._ntfClearRoomItem(),this._leaveHandle(!e),e&&((t==null?void 0:t.users)||[]).forEach(i=>{i.userId===this._context.getCurrentId()&&(r=i.type)}),this._callAppListener("onKickOff",e,r)}_rtcpeerClosed(){this._ntfClearRoomItem(),this._leaveHandle(!0),this._callAppListener("onRTCPeerConnectionCloseByException")}_resourceHandle(e,t,r){return B(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return void b.warn(`room has been destroyed. -> roomId: ${this._roomId}`);const{uris:i,ignore:o}=e;if(o||!i)return;const s=[],u=[],d=[];let l;const h=this._roomResources[r]||(this._roomResources[r]=[]);switch(t){case ie.MODIFY:d.push(...i);break;case ie.PUBLISH:s.push(...i);break;case ie.UNPUBLISH:u.push(...i);break;case ie.TOTAL_CONTENT_RESOURCE:l=nr(h,i),s.push(...l.publishedList),u.push(...l.unpublishedList),d.push(...l.modifiedList)}if(s.length>0){const a=h.map(ce),c=[],p=[];if(s.forEach(f=>{const m=ce(f),_=a.indexOf(m),{userId:v,tag:R,mediaType:C}=Pe(m);_>-1?h[_]=f:h.push(f);let M=this._remoteTracks[m];M?M.isSubscribed()&&c.push(M):(M=C===le.AUDIO_ONLY?new ut(R,v):new dt(R,v),this._remoteTracks[m]=M,p.push(M)),M.__innerSetRemoteMuted(f.state===0)}),c.length){const f=c.map(_=>_.getTrackId());b.debug(`resub tracks -> ${JSON.stringify(f)}`);const{code:m}=yield ve(()=>this.__subscribe(c,!0));m!==I.SUCCESS&&b.error(`resub tracks failed -> code: ${m}, ids: ${JSON.stringify(f)}`)}this._onTrackPublish(p)}if(u.length>0){const a=u.map(ce);for(let p=h.length-1;p>=0;p-=1){const f=h[p];a.includes(ce(f))&&h.splice(p,1)}const c=u.map(p=>{const f=ce(p);return this._remoteTracks[f]});yield this._onUserUnpublish(c)}if(d.length>0){const a=h.map(ce);for(let c=0;c<d.length;c+=1){const p=d[c],f=ce(p),m=a.indexOf(f);h[m].state=p.state;const _=this._remoteTracks[f];_.__innerSetRemoteMuted(p.state===0),_.isAudioTrack()?this._onAudioMuteChange(_):this._onVideoMuteChange(_)}}})}_onTrackPublish(e){this._callAppListener("onTrackPublish",e)}_stateHandle(e){var t;return B(this,void 0,void 0,function*(){const{users:r}=e;if(r.length===0)return;const i=[],o=[],s=[],u=[];r.forEach(h=>{+h.state==0?(b.debug(`user joined -> ${h.userId}`),this._roomResources[h.userId]||(h.switchRoleType?s.push(h.userId):i.push(h.userId)),this._roomResources[h.userId]=this._roomResources[h.userId]||[]):(b.debug(`user left -> ${h.userId}`),h.switchRoleType?u.push(h.userId):o.push(h.userId))});const d=[...i,...s],l=[...o,...u];if(l.length){const h=[],a=[];l.forEach(c=>{h.push(...this.getRemoteTracksByUserId(c)),a.push(c)}),h.length&&(yield this.unsubscribe(h),h.forEach(c=>delete this._remoteTracks[c.getTrackId()])),a.length&&a.forEach(c=>delete this._roomResources[c])}if((t=this._appListener)===null||t===void 0?void 0:t.onSwitchRole)return s.length&&s.forEach(h=>this._callAppListener("onSwitchRole",h,yr.ANCHOR)),u.length&&u.forEach(h=>this._callAppListener("onSwitchRole",h,yr.AUDIENCE)),i.length&&this._callAppListener("onUserJoin",i),void(o.length&&this._callAppListener("onUserLeave",o));d.length&&this._callAppListener("onUserJoin",d),l.length&&this._callAppListener("onUserLeave",l)})}getRoomId(){return this._roomId}getCrtUserId(){return this._context.getCurrentId()}__getPC(){return this._pc}getRemoteUserIds(){const e=this._context.getCurrentId();return Object.keys(this._roomResources).filter(t=>t!==e)}getRemoteTracks(){const e=[];return this.getRemoteUserIds().forEach(t=>{e.push(...this.getRemoteTracksByUserId(t))}),e}getRemoteTracksByUserId(e){const t=[];for(const r in this._remoteTracks){const i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}getSessionId(){return this._sessionId}sendMessage(e,t){return B(this,void 0,void 0,function*(){const{code:r}=yield this._context.sendMessage(J.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0});return r!==S.SUCCESS?(b.error(`send message failed -> code: ${r}`),{code:I.SIGNAL_ERROR}):{code:I.SUCCESS}})}setRoomAttribute(e,t,r,i=!1){return B(this,void 0,void 0,function*(){const o=yield this._context.setRTCData(this._roomId,e,t,i,Xe.ROOM,r);return o!==S.SUCCESS?(b.error(`SetRoomAttributeValue Failed: ${o}`),{code:I.SIGNAL_ERROR}):{code:I.SUCCESS}})}deleteRoomAttributes(e,t,r=!1){return B(this,void 0,void 0,function*(){const i=yield this._context.removeRTCData(this._roomId,e,r,Xe.ROOM,t);return i!==S.SUCCESS?(b.error(`DeleteRoomAttribute Failed: ${i}`),{code:I.SIGNAL_ERROR}):{code:I.SUCCESS}})}getRoomAttributes(e=[],t=!1){return B(this,void 0,void 0,function*(){const{code:r,data:i}=yield this._context.getRTCData(this._roomId,e,t,Xe.ROOM);return r!==S.SUCCESS?(b.error(`GetRoomAttributes Failed: ${r}`),{code:I.SIGNAL_ERROR}):{code:I.SUCCESS,data:i}})}_setUserAttributeValue(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,Xe.PERSON,r)}_deleteUserAttributes(e,t){return this._context.removeRTCData(this._roomId,e,!1,Xe.PERSON,t)}_getUserAttributes(e){return this._context.getRTCData(this._roomId,e,!1,Xe.PERSON)}isDestroyed(){return this._destroyed}__destroy(e){return this._leaveHandle(e)}_leaveHandle(e){var t;return B(this,void 0,void 0,function*(){this._destroyed||(this._destroyed=!0,(t=this._audioLevelReport)===null||t===void 0||t.clearAudioLevelReportTimer(),e&&(yield this._context.quitRTCRoom(this._roomId)),this._isMainRoom&&this._quitAllPKRoom(),this._pc.removeAllLocalTrack(),this._pinger.stop(),this._isMainRoom&&(yield this._service.exit(this._getRTCReqestHeaders())),this._pc.destroy(),this._polarisReport=null,this._removeRemoteTracks())})}_onLocalTrackDestroied(e){e instanceof Ht&&e.__isTiny()||this.unpublish([e])}_onLocalTrackMuted(e){return B(this,void 0,void 0,function*(){const t=e.getTrackId(),r=this._context.getCurrentId(),i=[{resourceId:t,enabled:!e.isLocalMuted()}],o=this._roomResources[r]||[],s=[];for(let d=0;d<o.length;d+=1){const l=o[d],h=ce(l),a=i.findIndex(c=>c.resourceId===h);if(a>=0){const{enabled:c}=i[a];l.state=c?1:0,s.push(l);break}}const u=yield ve(()=>this._context.setRTCTotalRes(this._roomId,Jn(ie.MODIFY,s),vt(o),ie.TOTAL_CONTENT_RESOURCE));u!==S.SUCCESS&&b.error("notice `track.enabled` change failed -> code: "+u)})}_removePubFailedTracks(e){e.forEach(t=>{const r=t instanceof ue?t:t.track;b.debug(`remove pub failed track from peerconnection -> trackId: ${r.getTrackId()}`),this._pc.removeLocalTrackById(r.getTrackId())})}publish(e){return B(this,void 0,void 0,function*(){return ve(()=>this.__publish(e))})}__publish(e){return B(this,void 0,void 0,function*(){if(!this._isMainRoom&&this instanceof ft)return b.error("the `publish` is disabled in PK room "),{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(this._assertRoomDestroyed())return b.error(`publish failed, room has been destroyed. -> roomId: ${this._roomId}`),{code:I.ROOM_HAS_BEEN_DESTROYED};if(!me("tracks",e,()=>De(e)&&e.length>0&&e.every(C=>C instanceof ue||C.track instanceof ue),!0))return b.error(`publish failed, tracks is invalid -> roomId: ${this._roomId}`),{code:I.PARAMS_ERROR};const t=this._context.getCurrentId();if(this._pc.getLocalTracks().length+(C=>{let M=0;return C.forEach(A=>{A instanceof ue?M++:A.pubTiny&&A.track.isVideoTrack()?M+=2:M++}),M})(e)>10)return b.error(`publish failed, tracks limit exceeded -> roomId: ${this._roomId}`),{code:I.PUBLISH_TRACK_LIMIT_EXCEEDED};b.debug(`publish tracks -> roomId: ${this._roomId}, tracks: ${e.map(on)}`),e.forEach(C=>{const{track:M,pubTiny:A}=C instanceof ue?{pubTiny:!1,track:C}:C;if(this._pc.addLocalTrack(M),M.isVideoTrack()&&A){let O;try{O=M.__innerGetMediaStreamTrack().clone();const y=A.frameRate||Ze.FPS_15,w=A.resolution||ge.W176_H144,{width:H,height:Y}=nt(w),E=rt(y);O.applyConstraints({width:H,height:Y,frameRate:E})}catch(y){return O==null||O.stop(),void b.warn(`pubTiny failed -> id: ${M.getTrackId()}, msg: ${y.message}`)}this._pc.addLocalTrack(new Ht(M.getTag(),M.getUserId(),O,!0))}}),this._pc.clearReTryExchangeTimer();const r=yield this._createExchangeParams(this._subscribedList,!1),i=this._getPushOtherRoomsParams();i&&(r.pushOtherRooms=i);const o=yield this._exchangeHandle(r);if(o.code!==I.SUCCESS)return b.error(`publish failed -> roomId: ${this._roomId}, code: ${o.code}`),this._removePubFailedTracks(e),{code:o.code};const{publishList:s,sdp:u,resultCode:d,message:l,urls:h,mcuPublishList:a}=o.data;if(d!==I.SUCCESS)return b.error(`publish failed -> roomId: ${this._roomId}, code: ${d}, msg: ${l}`),this._removePubFailedTracks(e),{code:d};const c=yield this._pc.setRemoteAnswer(u.sdp);if(c!==I.SUCCESS)return{code:c};const p=this._roomResources[t],f=s.map(C=>Object.assign({tag:C.msid.split("_").pop(),state:this._getResourceState(ce(C))},C)),{publishedList:m}=nr(p,f),_=(a==null?void 0:a.map(C=>Object.assign({tag:C.msid.split("_").pop(),state:1},C)))||[],v=yield this._context.setRTCTotalRes(this._roomId,Jn(ie.PUBLISH,m),vt(f),ie.TOTAL_CONTENT_RESOURCE,vt(_));if(v!==S.SUCCESS)return b.error(`send publish streams notification failed: ${v}`),{code:I.SIGNAL_ERROR};this._roomResources[t]=f;const R=m.map(C=>ce(C));return this._polarisReport&&this._polarisReport.sendR2(ht.PUBLISH,pt.BEGIN,R),e.forEach(C=>{const{track:M}=C instanceof ue?{track:C}:C;M.__innerSetPublished(!0)}),b.debug(`publish success: ${R.join(",")}`),this._roomMode===Le.LIVE?{code:I.SUCCESS,liveUrl:h==null?void 0:h.liveUrl}:{code:I.SUCCESS}})}_getPushOtherRoomsParams(){if(this instanceof ft){const{code:e,roomPKHandler:t}=this.getRoomPKHandler(),r=[];if(e===I.SUCCESS&&t){const i=t.getJoinedPKRooms();for(const o in i){const s=i[o].getSessionId(),u=t.getPKInfo(o);if(!u)return;const{inviterUserAutoMix:d,inviteeUserAutoMix:l,inviterUserId:h}=u,a=this._context.getCurrentId()===h;r.push({roomId:o,sessionId:s,autoMix:a?!!d:!!l})}}return r}}_reTryExchange(){return B(this,void 0,void 0,function*(){ve(()=>B(this,void 0,void 0,function*(){const e=yield this._createExchangeParams(this._subscribedList,!0),t=this._getPushOtherRoomsParams();t&&(e.pushOtherRooms=t);const r=yield this._exchangeHandle(e);if(r.code!==I.SUCCESS)return b.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==I.SUCCESS)return b.error(`reTryExchange failed: ${o}`),{code:o};this._pc.clearReTryExchangeTimer();const s=yield this._pc.setRemoteAnswer(i.sdp);return s!==I.SUCCESS?{code:s}:void 0}))})}_exchangeHandle(e){return this._service.exchange(this._getRTCReqestHeaders(),e)}_getRTCReqestHeaders(){return{"App-Key":this._context.getAppkey(),RoomId:this._roomId,Token:this._token,RoomType:this._roomMode,UserId:this._context.getCurrentId()}}_createExchangeParams(e,t){return B(this,void 0,void 0,function*(){return{sdp:yield this._pc.createOffer(t),extend:JSON.stringify({resolutionInfo:this._pc.getOutboundVideoInfo()}),subscribeList:e.filter(r=>{const i=r.track.getTrackId(),{userId:o}=Pe(i);return this._roomResources[o]?this._roomResources[o].filter(u=>i===`${u.msid}_${u.mediaType}`).length:!1}).map(r=>({simulcast:r.subTiny?Ke.TINY:Ke.NORMAL,resolution:"",uri:this._getResourceById(r.track.getTrackId()).uri})),switchstream:!1}})}_getResourceState(e){var t;return((t=this.getLocalTrack(e))===null||t===void 0?void 0:t.isLocalMuted())?0:1}unpublish(e){return B(this,void 0,void 0,function*(){return ve(()=>this.__unpublish(e))})}__unpublish(e){var t;return B(this,void 0,void 0,function*(){if(!this._isMainRoom&&this instanceof ft)return b.error("the `unpublish` is disabled in PK room "),{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(this._assertRoomDestroyed())return b.warn(`room has been destroyed, no need to unpublish tracks -> roomId: ${this._roomId}`),{code:I.SUCCESS};const r=this._context.getCurrentId();if(!me("tracks",e,()=>e.every(C=>C.getUserId()===r&&C instanceof ue),!0))return b.warn(`unpublish failed, tracks is invalid -> roomId: ${this._roomId}, tracks: ${e.map(on)}`),{code:I.PARAMS_ERROR};const i=e.map(C=>C.getTrackId()),o=i.map(this._getResourceById.bind(this)).filter(C=>!!C);if(o.length===0)return{code:I.SUCCESS};const s=this._roomResources[r].filter(C=>!o.includes(C));i.forEach(C=>this._pc.removeLocalTrackById(C)),(t=this._polarisReport)===null||t===void 0||t.sendR2(ht.PUBLISH,pt.END,i),this._pc.clearReTryExchangeTimer();const u=yield this._createExchangeParams(this._subscribedList,!1),d=this._getPushOtherRoomsParams();d&&(u.pushOtherRooms=d);const l=yield this._exchangeHandle(u);if(l.code!==I.SUCCESS)return b.error(`exchange failed -> code: ${l.code}`),{code:l.code};const{publishList:h,sdp:a,resultCode:c,message:p,mcuPublishList:f}=l.data;c!==I.SUCCESS&&b.error(`unpublish streams failed -> code: ${c}, msg: ${p}`);const m=f?f.map(C=>Object.assign({tag:C.msid.split("_").pop(),state:1},C)):[],_=yield this._context.setRTCTotalRes(this._roomId,Jn(ie.UNPUBLISH,o),vt(s),ie.TOTAL_CONTENT_RESOURCE,vt(m));if(_!==S.SUCCESS)return b.error("send unpublish notification failed:",_),{code:I.SIGNAL_ERROR};b.debug(`unpublish success -> tracks: ${i.join(",")}`);const v=yield this._pc.setRemoteAnswer(a.sdp);if(v!==I.SUCCESS)return{code:v};const R=h.map(C=>Object.assign({tag:C.msid.split("_").pop(),state:this._getResourceState(ce(C))},C));return this._roomResources[r]=R,{code:I.SUCCESS}})}_getResourceById(e){const{userId:t}=Pe(e);return this._roomResources[t].find(r=>ce(r)===e)}_isValidResourceId(e){var t;const{userId:r}=Pe(e);return!!((t=this._roomResources[r])===null||t===void 0?void 0:t.find(i=>ce(i)===e))}subscribe(e){return B(this,void 0,void 0,function*(){return ve(()=>this.__subscribe(e,!1))})}__subscribe(e,t=!1){var r;return B(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return b.error(`subscribe failed, room has been destroyed -> roomId: ${this._roomId}`),{code:I.ROOM_HAS_BEEN_DESTROYED};if(!me("tracks",e,()=>De(e)&&e.length>0&&e.every(d=>d instanceof Oe||d.track instanceof Oe),!0))return b.error(`subscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:I.PARAMS_ERROR};b.info(`subscribe -> roomId: ${this._roomId}, tracks: ${e.map(on)}`);const i=this._subscribedList.map(d=>Object.assign({},d)),o=e.map(d=>d instanceof Oe?{track:d}:d);let s=!1;const u=[];return o.forEach(d=>{const l=d.track.getTrackId();u.push(l);const h=i.find(a=>a.track.getTrackId()===l);h&&h.subTiny===d.subTiny||(h?h.subTiny=d.subTiny:i.push(d),s=!0)}),s||t?((r=this._polarisReport)===null||r===void 0||r.sendR2(ht.SUBSCRIBE,pt.BEGIN,u),this._updateSubListHandle(i,!0)):{code:I.SUCCESS}})}unsubscribe(e){return B(this,void 0,void 0,function*(){return ve(()=>this.__unsubscribe(e))})}__unsubscribe(e){var t;return B(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return b.warn(`room has beed destroyed, no need to unsubscribe tracks -> roomId: ${this._roomId}`),{code:I.SUCCESS};if(!me("tracks",e,()=>De(e)&&e.length>0&&e.every(i=>i instanceof Oe),!0))return b.error(`unsubscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:I.PARAMS_ERROR};b.info(`unsubscribe -> roomId: ${this._roomId}, tracks: ${e.map(on)}`);const r=this._subscribedList.map(i=>Object.assign({},i)).filter(i=>!e.includes(i.track));return(t=this._polarisReport)===null||t===void 0||t.sendR2(ht.SUBSCRIBE,pt.END,e.map(i=>i.getTrackId())),this._updateSubListHandle(r,!1)})}_assertRoomDestroyed(){if(this._destroyed){const e="This room has been destroyed. Please use `RCRTCClient.joinRTCRoom` or `RCRTCClient.joinLivingRoom` to catch another instance.";return b.warn(e),I.ROOM_HAS_BEEN_DESTROYED}}getLocalTrack(e){return this._pc.getLocalTrack(e)}getLocalTracks(){return this._pc.getLocalTracks()}getRemoteTrack(e){return this._remoteTracks[e]||null}updateSubList(e){return B(this,void 0,void 0,function*(){return ve(()=>this._updateSubListHandle(e,!1))})}_updateSubListHandle(e,t=!1){return B(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:I.ROOM_HAS_BEEN_DESTROYED};if(!me("resources",e,()=>De(e)&&e.every(R=>R instanceof Oe||R.track instanceof Oe),!0))return b.error(`update sublist failed, tracks is invalid -> roomId: ${this._roomId}`),{code:I.PARAMS_ERROR};b.info(`update subscribe list -> roomId: ${this._roomId}, forceReq: ${t}, tracks: ${e.map(on)}`);let r=e.map(R=>R instanceof Oe?{track:R}:Object.assign({},R));const i={};r=r.filter(R=>{const C=R.track.getTrackId();return this._remoteTracks[C]?!i[C]&&(i[C]=!0):(b.warn(`track cannot found in room -> trackId: ${C}`),!1)}).map(R=>Object.assign({},R));const o=this._subscribedList.map(R=>Object.assign({},R));if(!t){let R=!1;if(r.forEach(C=>{const M=o.findIndex(A=>A.track===C.track);if(M===-1)return void(R=!0);o.splice(M,1)[0].subTiny!==C.subTiny&&(R=!0)}),o.length&&(R=!0),!R)return{code:I.SUCCESS}}this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(r.map(R=>R.track));const s=yield this._createExchangeParams(r,!1),u=this._getPushOtherRoomsParams();u&&(s.pushOtherRooms=u);const d=yield this._exchangeHandle(s),l=r.map(R=>R.track.getTrackId());if(d.code!==I.SUCCESS)return{code:d.code};const{sdp:h,resultCode:a,message:c,subscribedList:p}=d.data;if(a!==I.SUCCESS)return b.error(`change subscribe list failed: ${a}`),{code:a};b.debug(`subscribe success: ${l.join(",")}`);const f=yield this._pc.setRemoteAnswer(h.sdp);if(f!==I.SUCCESS)return{code:f};const m=p==null?void 0:p.map(R=>`${R.msid}_${R.mediaType}`),_=r.filter(R=>m==null?void 0:m.includes(R.track.getTrackId())),v=r.filter(R=>!(m==null?void 0:m.includes(R.track.getTrackId())));for(const R in this._remoteTracks){const C=_.some(M=>M.track.getTrackId()===R);this._remoteTracks[R].__innerSetSubscribed(C)}return this._subscribedList.splice(0,this._subscribedList.length,..._),v.length?{code:I.SUCCESS,failedList:v}:{code:I.SUCCESS}})}registerRoomEventListener(e){this._appListener=e}registerReportListener(e){this._pc.registerReportListener(e)}onAudioLevelChange(e,t){var r;(r=this._audioLevelReport)===null||r===void 0||r.clearAudioLevelReportTimer(),this._audioLevelReport=new Gc(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}__onReconnected(e){return B(this,void 0,void 0,function*(){if(this._pc.getRTCPeerConn().connectionState==="closed")return b.warn("RTCPeerConnection closed. Please rejoin room to restore services."),void this._rtcpeerClosed();const{code:t,data:r}=yield this._context.joinRTCRoom(this._roomId,this._roomMode,e);if(t!==S.SUCCESS)return void b.error(`RTC __onReconnected getRTCRoomInfo failed: ${t}`);b.debug(`RTC __onReconnected getRTCRoomInfo success: ${JSON.stringify(r)}`);const i=[],o={},s={},u={},d=Fi(r),l=Object.keys(d),h=Object.keys(this._roomResources);for(let a=l.length-1;a>=0;a-=1){const c=l[a],p=h.indexOf(c);if(p===-1){i.push(c),o[c]=Wn(d[c]);continue}const f=this._roomResources[c],m=d[c],{publishedList:_,modifiedList:v,unpublishedList:R}=nr(f,m,!0);o[c]=Wn(_),s[c]=Wn(R),u[c]=Wn(v),h.splice(p,1)}h.length&&h.forEach(a=>{delete this._roomResources[a]}),Object.assign(this._roomResources,d),h.length&&this._callAppListener("onUserLeave",h),i.length&&this._callAppListener("onUserJoin",i);for(const a in s){const c=s[a];if(c.length){const p=c.map(f=>this._remoteTracks[ce(f)]);yield this._onUserUnpublish(p)}}return Object.keys(o).forEach(a=>{const c=o[a];if(c.length===0)return;const p=c.map(f=>{const m=ce(f),{userId:_,tag:v,mediaType:R}=Pe(m),C=this._remoteTracks[m]=R===le.AUDIO_ONLY?new ut(v,_):new dt(v,_);return C.__innerSetRemoteMuted(f.state===0),C});this._onTrackPublish(p)}),Object.keys(u).forEach(a=>{u[a].forEach(c=>{const p=ce(c),f=this._remoteTracks[p];f.__innerSetRemoteMuted(c.state===0),f.isAudioTrack()?this._onAudioMuteChange(f):this._onVideoMuteChange(f)})}),{data:r}})}_onAudioMuteChange(e){this._callAppListener("onAudioMuteChange",e)}_onVideoMuteChange(e){this._callAppListener("onVideoMuteChange",e)}_afterChangedRole(e){}_removeRemoteTracks(){const e=Object.values(this._remoteTracks);e.length&&(e.forEach(t=>{t.isAudioTrack()&&t.__releaseMediaElement()}),this._remoteTracks={})}_registerPKMsgListener(e){this._onRecvPKMsg=e}_quitAllPKRoom(){}}var hn,Bt,Tr;(function(n){n[n.CROP=1]="CROP",n[n.WHOLE=2]="WHOLE"})(hn||(hn={})),function(n){n[n.CUSTOMIZE=1]="CUSTOMIZE",n[n.SUSPENSION=2]="SUSPENSION",n[n.ADAPTATION=3]="ADAPTATION"}(Bt||(Bt={})),function(n){n[n.CROP=1]="CROP",n[n.WHOLE=2]="WHOLE"}(Tr||(Tr={}));const da=()=>({version:1,mode:Bt.SUSPENSION});class Ml{constructor(e,t,r){this._onFlush=e,this._isValidTrackId=t,this._sendCDNInfoSignal=r,this._values=da()}setHostVideoTrack(e){if(!this._isValidTrackId(e))return b.error(`setHostVideoTrack failed: videoTrackId is invalid -> ${e}`),this;const{mediaType:t,tag:r,userId:i}=Pe(e);return t!==le.VIDEO_ONLY?(b.error(`setHostVideoTrack failed: kind of resource is not 'video' -> ${e}`),this):(this._values.host_stream_id=si(i,r),this)}setMixLayoutMode(e){return[Bt.CUSTOMIZE,Bt.SUSPENSION,Bt.ADAPTATION].includes(e)?(this._values.mode=e,this):(b.error(`layout mode is invalid: ${e}`),this)}_addOutputValue(e,t,r="normal"){const i=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if(e==="cdn")return void(i.cdn=t);if(e==="audio")return void(i.audio={bitrate:t});const o=i.video;if(r!=="normal"&&r!=="tiny")if(r!=="backgroundColor")if(r!=="exparams"){if(r==="backgroundPicture"){const s=o.backgroundPicture||(o.backgroundPicture={fillMode:hn.CROP,picture:[]});Object.assign(s,t)}}else o.exparams={renderMode:t};else o.backgroundColor=t;else{const s=o[r]||(o[r]={});Object.assign(s,t)}}setOutputVideoResolution(e){if(!Vt(e))return b.warn("setOutputVideoResolution failed: `resolution` is invalid"),this;const{width:t,height:r}=nt(e);return this._addOutputValue("video",{width:t,height:r},"normal"),this}setOutputVideoFPS(e){if(!Vi(e))return b.warn("setOutputVideoFPS failed: `fps` is invalid"),this;const t=rt(e);return this._addOutputValue("video",{fps:t},"normal"),this}setOutputVideoBitrate(e){return!_e(e)||e<=0?b.error(`bitrate is invalid: ${e}`):this._addOutputValue("video",{bitrate:e},"normal"),this}setOutputTinyVideoResolution(e){if(!Vt(e))return b.warn("setOutputTinyVideoResolution failed: `resolution` is invalid"),this;const{width:t,height:r}=nt(e);return this._addOutputValue("video",{width:t,height:r},"tiny"),this}setOutputTinyVideoFPS(e){if(!Vi(e))return b.warn("setOutputTinyVideoFPS failed: `fps` is invalid"),this;const t=rt(e);return this._addOutputValue("video",{fps:t},"tiny"),this}setOutputTinyVideoBitrate(e){return!_e(e)||e<=0?b.error(`bitrate is invalid: ${e}`):this._addOutputValue("video",{bitrate:e},"tiny"),this}setOutputVideoRenderMode(e){return[Tr.CROP,Tr.WHOLE].includes(e)?this._addOutputValue("video",e,"exparams"):b.error(`renderMode is invalid: ${e}`),this}setOutputAudioBitrate(e){return _e(e)&&e>0?this._addOutputValue("audio",e):b.error(`bitrate is invalid: ${e}`),this}setOutputBackgroundColor(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?this._addOutputValue("video",e,"backgroundColor"):b.error(`color is invalid: ${e}`),this}addOutputBackgroundPicture(e,t,r,i,o){var s,u,d;if(!mn(e))return b.error(`uri is invalid: ${e}`),this;if([t,r,i,o].some(h=>!_e(h)||h<0||h>1))return b.error(`some attrs of (x, y, w, h) is invalid: ${t}, ${r}, ${i}, ${o}`),this;const l=((d=(u=(s=this._values.output)===null||s===void 0?void 0:s.video)===null||u===void 0?void 0:u.backgroundPicture)===null||d===void 0?void 0:d.picture)||[];return l.push({uri:e,w:i,h:o,x:t,y:r}),this._addOutputValue("video",{picture:l},"backgroundPicture"),this}removeOutputBackgroundPicture(e){var t,r,i;if(!mn(e))return b.error(`uri is invalid: ${e}`),this;let o=(i=(r=(t=this._values.output)===null||t===void 0?void 0:t.video)===null||r===void 0?void 0:r.backgroundPicture)===null||i===void 0?void 0:i.picture;return o&&(o=o.filter(s=>s.uri!==e),this._addOutputValue("video",{pictures:o},"backgroundPicture")),this}clearOutputBackgroundPicture(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this}setOutputBackgroundPictureFillMode(e){return[hn.CROP,hn.WHOLE].includes(e)?this._addOutputValue("video",{fillMode:e},"backgroundPicture"):b.error(`fillMode is invalid: ${e}`),this}addPublishStreamUrls(e){var t,r;const i=/^rtmp:\/\/.+/;if(!De(e)||e.length===0||e.some(u=>!i.test(u)))return b.error(`urls is invalid: ${e}`),this;const o=((r=(t=this._values.output)===null||t===void 0?void 0:t.cdn)===null||r===void 0?void 0:r.concat())||[];let s=!1;return e.forEach(u=>{o.some(d=>d.pushurl===u)||(s=!0,o.push({pushurl:u}))}),o.length>5?(b.error("publish stream url no more than 5"),this):(s&&this._addOutputValue("cdn",o),this)}removePublishStreamUrls(e){var t,r;const i=/^rtmp:\/\/.+/;if(!De(e)||e.length===0||e.some(s=>!i.test(s)))return b.error(`urls is invalid: ${e}`),this;const o=((r=(t=this._values.output)===null||t===void 0?void 0:t.cdn)===null||r===void 0?void 0:r.concat())||[];for(let s=o.length-1;s>=0;s-=1){const{pushurl:u}=o[s],d=e.indexOf(u);d>=0&&(e.splice(d,1),o.splice(s,1))}return this._addOutputValue("cdn",o),this}clearPublishStreamUrls(){return this._addOutputValue("cdn",[]),this}addCustomizeLayoutVideo(e,t,r,i,o){if(!this._isValidTrackId(e))return b.error(`trackId is invalid: ${e}`),this;if(!_e(t)||!_e(r))return b.error(`some attrs of (x, y) is invalid: ${t}, ${r}`),this;if([i,o].some(h=>!_e(h)||h<0))return b.error(`some attrs of (width, height) is invalid: ${i}, ${o}`),this;const{userId:s,tag:u,mediaType:d}=Pe(e);if(d!==le.VIDEO_ONLY)return b.error(`kind of resource is not 'video': ${e}`),this;const l=si(s,u);return(this._values.input||(this._values.input={video:[]})).video.push({user_id:s,stream_id:l,x:t,y:r,width:i,height:o}),this}removeCustomizeLayoutVideo(e){if(!this._isValidTrackId(e))return b.error(`trackId is invalid: ${e}`),this;const{userId:t,tag:r,mediaType:i}=Pe(e);if(i!==le.VIDEO_ONLY)return b.error(`kind of resource is not 'video': ${e}`),this;const o=si(t,r),s=this._values.input||(this._values.input={video:[]});return s.video=s.video.filter(u=>u.stream_id===o),this}clearCustomizeLayoutVideo(){return(this._values.input||(this._values.input={video:[]})).video=[],this}flush(){var e,t,r,i;return B(this,void 0,void 0,function*(){const o=JSON.parse(JSON.stringify(this._values)),{code:s}=yield this._onFlush(o);return s===I.SUCCESS&&(((t=(e=this._values.output)===null||e===void 0?void 0:e.video.normal)===null||t===void 0?void 0:t.width)||((i=(r=this._values.output)===null||r===void 0?void 0:r.video.normal)===null||i===void 0?void 0:i.fps))&&this._sendCDNInfoSignal(),this._values=da(),{code:s}})}}var Sr,Ir,br,et;(function(n){n[n.OPEN=1]="OPEN",n[n.STOP=2]="STOP"})(Sr||(Sr={})),function(n){n[n.SPREAD=0]="SPREAD",n[n.NO_SPREAD=-1]="NO_SPREAD"}(Ir||(Ir={})),function(n){n[n.AUTOMATIC=0]="AUTOMATIC",n[n.MANUAL=1]="MANUAL"}(br||(br={})),function(n){n[n.VIDEO=0]="VIDEO",n[n.AUDIO=1]="AUDIO"}(et||(et={}));const zc=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=16*Math.random()|0;return(n==="x"?e:3&e|8).toString(16)});class Al{constructor(e,t,r,i,o,s,u,d){this._context=e,this._runtime=t,this._service=r,this._initOptions=i,this._mainLivingRoom=o,this._registerPKMsgListener=s,this._onJoinedPKRoom=u,this._onLeavePKRoom=d,this._inviteTimeout=30,this._PKInfo={},this._appListener=null,this._joinedPKRooms={},this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()}_callAppListener(e,...t){var r;const i=(r=this._appListener)===null||r===void 0?void 0:r[e];if(i)try{i(...t)}catch(o){b.error(o)}}_onInvite(e){const t=e.inviteInfo||{},{inviterRoomId:r,inviterUserId:i,extra:o}=t,s={inviterRoomId:r,inviterUserId:i};o&&Object.assign(s,{extra:o}),this._PKInfo[r]=t,this._callAppListener("onRequestJoinOtherRoom",s)}_onCancelInvite(e){const{inviterRoomId:t,inviterUserId:r,extra:i}=e.inviteInfo||{},o={inviterRoomId:t,inviterUserId:r};i&&Object.assign(o,{extra:i}),delete this._PKInfo[t],this._callAppListener("onCancelRequestOtherRoom",o)}_onInviteTimeout(e){}_onInviteAnswer(e){const{answerCode:t,inviteContent:r,inviteeUserAutoMix:i}=e,{inviterUserId:o,inviterRoomId:s,inviteeUserId:u,inviteeRoomId:d,extra:l}=r,h={agree:t===1,inviterRoomId:s,inviterUserId:o,inviteeRoomId:d,inviteeUserId:u};this._PKInfo[d].inviteeUserAutoMix=i,this._callAppListener("onResponseJoinOtherRoom",h)}_onPKEnd(e){return B(this,void 0,void 0,function*(){const{inviteeRoomId:t,inviterRoomId:r,userId:i}=e.inviteInfo,o=r===this._mainRoomId?t:r,s={endRoomId:o,endUserId:i};yield this.leaveOtherRoom(this._joinedPKRooms[o]),delete this._PKInfo[o],this._callAppListener("onFinishOtherRoom",s)})}_onRecvPKMsg(e){const{targetId:t,content:r,messageType:i}=e;switch(i){case ie.PK_INVITE:this._onInvite(r);break;case ie.PK_CANCEL_INVITE:this._onCancelInvite(r);break;case ie.PK_INVITE_TIMEOUT:this._onInviteTimeout(r);break;case ie.PK_INVITE_ANSWER:this._onInviteAnswer(r);break;case ie.PK_END:this._onPKEnd(r)}}registerRoomPKEventListener(e){this._appListener=e}requestJoinOtherRoom(e,t,r){return B(this,void 0,void 0,function*(){if(!me("inviteeRoomId",e,Ve,!0)||!me("inviteeUserId",t,Ve,!0))return{code:I.PARAMS_ERROR};b.debug(`requestRoomPK -> inviteeRoomId: ${e}; inviteeUserId: ${t}; options: ${JSON.stringify(r||{})}`);const i=zc(),o=!sr(r==null?void 0:r.autoMix)||(r==null?void 0:r.autoMix),s={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:e,inviteeUserId:t,inviteeTimeoutTime:this._inviteTimeout,extra:(r==null?void 0:r.extra)||""},u={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(s),inviteSessionId:i};b.debug(`requestRoomPK -> params: ${JSON.stringify(u)}`);const d=yield this._context.requestRoomPK(u);return d!==S.SUCCESS?(b.error(`requestRoomPK failed: ${d}`),{code:d}):(b.debug("requestRoomPK success"),this._PKInfo[e]={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:e},{code:I.SUCCESS})})}cancelRequestJoinOtherRoom(e,t,r){return B(this,void 0,void 0,function*(){if(!me("inviteeRoomId",e,Ve,!0)||!me("inviteeUserId",t,Ve,!0))return{code:I.PARAMS_ERROR};if(!this._PKInfo[e])return b.error(`\u672A\u53D1\u8D77\u8FC7\u4E0E ${e} \u623F\u95F4\u5185 ${t} \u8FDE\u9EA6\u7684\u8BF7\u6C42`),{code:I.PARAMS_ERROR};b.debug(`canceRequestJoinPK -> inviteeRoomId: ${e}; inviteeUserId: ${t}; extra: ${r}`);const i={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:e,inviteeUserId:t,extra:r||""},o={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteSessionId:this._PKInfo[e].inviteSessionId,inviteInfo:JSON.stringify(i)};b.debug(`canceRequestJoinPK -> params: ${JSON.stringify(o)}`);const s=yield this._context.cancelRoomPK(o);return s!==S.SUCCESS?(b.error(`canceRequestJoinPK failed: ${s}`),{code:s}):(b.debug("canceRequestJoinPK success"),delete this._PKInfo[e],{code:I.SUCCESS})})}responseJoinOtherRoom(e,t,r,i){return B(this,void 0,void 0,function*(){if(!me("inviterRoomId",e,Ve,!0)||!me("inviterUserId",t,Ve,!0))return{code:I.PARAMS_ERROR};if(!this._PKInfo[e])return b.error(`${e} \u623F\u95F4\u5185\u7684 ${t} \u672A\u53D1\u8D77\u8FC7\u8FDE\u9EA6\u8BF7\u6C42`),{code:I.PARAMS_ERROR};b.debug(`responseRoomPK -> inviterRoomId: ${e}; inviterUserId: ${t}; agree: ${r}; options: ${JSON.stringify(i||{})}`);const{inviteSessionId:o,inviterUserAutoMix:s}=this._PKInfo[e],u=!sr(i==null?void 0:i.autoMix)||(i==null?void 0:i.autoMix),d={inviteSessionId:o,inviterRoomId:e,inviterUserId:t,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:u},l=Object.assign(d,{inviterUserAutoMix:s}),h=r?Object.assign(d,{MultiRoomKey:`${e}|${this._mainRoomId}`,MultiRoomValue:JSON.stringify(l)}):d;!de(i==null?void 0:i.extra)&&Object.assign(h,{extra:i.extra});const a={agree:r,roomId:this._mainRoomId,inviteSessionId:o,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(h),key:`${e}|${t}`,value:JSON.stringify(d)};b.debug(`responseRoomPK -> params: ${JSON.stringify(a)}`);const c=yield this._context.responseRoomPK(a);return c!==S.SUCCESS?(b.error(`responseRoomPK failed: ${c}`),{code:c}):(b.debug("responseRoomPK success"),this._PKInfo[e].inviteeUserAutoMix=u,{code:I.SUCCESS})})}_quitRoomPK(e){return B(this,void 0,void 0,function*(){const{inviterRoomId:t,inviteeRoomId:r,inviterUserId:i}=this._PKInfo[e],o={inviteeRoomId:r,inviterRoomId:t,userId:this._context.getCurrentId()},s={roomId:this._mainRoomId,endRoomId:e,sessionId:this._PKInfo[e].inviteSessionId,content:JSON.stringify(o),keys:[`${t}|${i}`]};b.debug(`quitRoomPK -> params: ${JSON.stringify(s)}`);const u=yield this._context.endRoomPK(s);return u!==S.SUCCESS?(b.error(`quitRoomPK failed: ${u}`),{code:I.SIGNAL_ERROR}):(b.debug("quitRoomPK success"),delete this._PKInfo[e],{code:I.SUCCESS})})}_relaseCrtRoom(){}joinOtherRoom(e){return B(this,void 0,void 0,function*(){if(!me("roomId",e,Ve,!0))return{code:I.PARAMS_ERROR};if(this._context.getConnectionStatus()!==ee.CONNECTED)return{code:I.SIGNAL_DISCONNECTED};if(b.debug(`joinPKRoom, roomId: ${e}`),this._joinedPKRooms[e])return{code:I.REPERT_JOIN_ROOM};const t=et.VIDEO,{code:r,data:i}=yield this._context.joinRTCRoom(e,Le.LIVE,t);if(r!==S.SUCCESS)return b.error(`joinRoom failed -> code: ${r}`),{code:r};b.debug(`JoinPKRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${e}, data: ${JSON.stringify(i)}`);const o=new ft(this._context,this._runtime,e,i,this._service,this._initOptions,this._relaseCrtRoom.bind(this),t,!1,!1);return this._joinedPKRooms[e]=o,this._onJoinedPKRoom(e,o),{room:o,code:I.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()}})}leaveOtherRoom(e,t){return B(this,void 0,void 0,function*(){return ve(()=>B(this,void 0,void 0,function*(){const r=e.getRoomId();return b.debug(`leavePKRoom -> userId: ${this._context.getCurrentId()} , roomId: ${r}`),yield e.__destroy(!0),delete this._joinedPKRooms[r],this._onLeavePKRoom(r),this._PKInfo[r]?(t&&this._quitRoomPK(r),{code:I.SUCCESS}):{code:I.SUCCESS}}))})}getPKInfo(e){return this._PKInfo[e]}getJoinedPKRooms(){return this._joinedPKRooms}}class ft extends Yc{constructor(e,t,r,i,o,s,u,d,l=!1,h){var a;super(e,t,r,i,Le.LIVE,o,s,u,l,h),this._livingType=d,this._isMainRoom=h,this._CDNUris=null,this._CDNEnable=!1,this._mcuConfigBuilder=new Ml(this._onMCUConfigFlush.bind(this),this._isValidResourceId.bind(this),this._sendCDNInfoSignal.bind(this)),this._isMainRoom&&(this._roomPKHandler=new Al(e,t,o,s,this,super._registerPKMsgListener.bind(this),this._onJoinedPKRoom.bind(this),this._onLeavePKRoom.bind(this)));const c=(a=i.roomInfo.filter(p=>p.key==="cdn_uris")[0])===null||a===void 0?void 0:a.value;c&&(this._CDNUris=JSON.parse(c)[0])}_isValidResourceId(e){var t;const{userId:r}=Pe(e),i=!!((t=this._roomResources[r])===null||t===void 0?void 0:t.find(h=>ce(h)===e));let o=!1;const{code:s,roomPKHandler:u}=this.getRoomPKHandler();if(s!==I.SUCCESS||!u)return i;const d=u.getJoinedPKRooms(),l=[];return Object.values(d).map(h=>{l.push(...h.getRemoteTracks())}),o=l.some(h=>e===h.getTrackId()),i||o}getLivingType(){return this._livingType}getMCUConfigBuilder(){return this._isMainRoom?this._mcuConfigBuilder:(b.error("the `getMCUConfigBuilder` is disabled in PK room "),{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}_onMCUConfigFlush(e){return B(this,void 0,void 0,function*(){const t={"App-Key":this._context.getAppkey(),Token:this._token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},{code:r,res:i}=yield this._service.setMcuConfig(t,e);return r!==I.SUCCESS?(b.error(`set MCU config failed: ${r}`),{code:r}):(b.info("set MCU config success"),i.pull_url&&(this._CDNUris=JSON.parse(i.pull_url)),{code:r,res:i})})}__onReconnected(){const e=Object.create(null,{__onReconnected:{get:()=>super.__onReconnected}});var t,r;return B(this,void 0,void 0,function*(){const i=yield e.__onReconnected.call(this,this._livingType);if(!i||!i.data)return;const o=i.data.roomInfo,s=(t=o.filter(d=>d.key==="cdn_uris")[0])===null||t===void 0?void 0:t.value;if(!s)return;const u=JSON.parse(s);((r=this._CDNUris)===null||r===void 0?void 0:r.enableInnerCDN)!==u.enableInnerCDN&&this._callAppListener("onCDNEnableChange",u.enableInnerCDN),this._CDNUris=u})}enableInnerCDN(e){return B(this,void 0,void 0,function*(){if(!this._isMainRoom)return b.error("the `enableInnerCDN` is disabled in PK room "),{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM};if(!sr(e))return b.error("`enable` is invalid"),{code:I.PARAMS_ERROR};this._CDNEnable=e;const t={version:2,output:{inCDNModel:e?Sr.OPEN:Sr.STOP}},{code:r}=yield this._onMCUConfigFlush(t);if(r!==I.SUCCESS)return b.error(`enableInnerCDN failed -> code: ${r}`),{code:I.SIGNAL_ERROR};if(this._CDNUris&&this._CDNUris.broadcast!==Ir.SPREAD)return b.info("enableInnerCDN succeed"),{code:I.SUCCESS};const{code:i}=yield ve(()=>B(this,void 0,void 0,function*(){return this._sendCDNInfoSignal()}));return i===I.SUCCESS?(b.info("enableInnerCDN succeed"),{code:I.SUCCESS}):(b.error(`enableInnerCDN failed -> code: ${i}`),{code:i})})}_sendCDNInfoSignal(){return B(this,void 0,void 0,function*(){return this._CDNUris=Object.assign({},this._CDNUris,{enableInnerCDN:this._CDNEnable}),(yield Promise.all([this._spreadCDNInfo(this._CDNUris),this._setRoomCDNInfo(this._CDNUris)])).every(e=>e.code===I.SUCCESS)?{code:I.SUCCESS}:{code:I.SIGNAL_ERROR}})}_spreadCDNInfo(e){return B(this,void 0,void 0,function*(){const t=yield this._context.setRTCCDNUris(this._roomId,ie.TOTAL_CONTENT_RESOURCE,JSON.stringify([e]));return t!==S.SUCCESS?(b.error(`spreadCDNInfo failed -> code: ${t}`),{code:I.SIGNAL_ERROR}):(b.info("spreadCDNInfo succeed"),{code:I.SUCCESS})})}_setRoomCDNInfo(e){return B(this,void 0,void 0,function*(){const t=yield this._context.setRTCData(this._roomId,"cdn_uris",JSON.stringify([e]),!0,Xe.ROOM);return t!==S.SUCCESS?(b.error(`setRoomCDNInfo failed -> code: ${t}`),{code:I.SIGNAL_ERROR}):(b.info("setRoomCDNInfo succeed"),{code:I.SUCCESS})})}_resourceHandle(e,t,r){const i=Object.create(null,{_resourceHandle:{get:()=>super._resourceHandle}});var o;return B(this,void 0,void 0,function*(){i._resourceHandle.call(this,e,t,r),e.cdn_uris&&(((o=this._CDNUris)===null||o===void 0?void 0:o.enableInnerCDN)!==e.cdn_uris[0].enableInnerCDN&&this._callAppListener("onCDNEnableChange",!this.__getCDNEnable()),this._CDNUris=e.cdn_uris[0])})}_exchangeHandle(e){var t,r,i;return B(this,void 0,void 0,function*(){const o=yield this._service.exchange(this._getRTCReqestHeaders(),e),s=(r=(t=o.data)===null||t===void 0?void 0:t.urls)===null||r===void 0?void 0:r.pull_url;return o.code===I.SUCCESS&&s&&(this._CDNUris=JSON.parse(s),((i=this._CDNUris)===null||i===void 0?void 0:i.broadcast)===Ir.SPREAD&&(this._CDNEnable=!0,this._sendCDNInfoSignal())),o})}_afterChangedRole(e){const t=Fi(e),r=this._context.getCurrentId(),i=Object.keys(t);setTimeout(()=>{var o,s,u;const d=i.filter(l=>l!==r);d.length>0&&this._callAppListener("onUserJoin",d);for(const l in t)l!==r&&this._resourceHandle({uris:t[l]},ie.TOTAL_CONTENT_RESOURCE,l);((o=e.roomInfo.filter(l=>l.key==="cdn_uris")[0])===null||o===void 0?void 0:o.value)&&((s=this._CDNUris)===null||s===void 0?void 0:s.push_mode)===br.MANUAL&&this._callAppListener("onCDNEnableChange",(u=this._CDNUris)===null||u===void 0?void 0:u.enableInnerCDN)})}__getCDNEnable(){var e;return(e=this._CDNUris)===null||e===void 0?void 0:e.enableInnerCDN}__getCDNPushMode(){var e;return(e=this._CDNUris)===null||e===void 0?void 0:e.push_mode}_onJoinedPKRoom(e,t){const{code:r,roomPKHandler:i}=this.getRoomPKHandler();if(r===I.SUCCESS&&i){if(!i.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}_onLeavePKRoom(e){const{code:t,roomPKHandler:r}=this.getRoomPKHandler();if(t===I.SUCCESS&&r){if(!r.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}_exchangeWithPushOtherRoom(){return B(this,void 0,void 0,function*(){if(!this.getLocalTracks().length)return;const e=yield this._createExchangeParams(this._subscribedList,!1),t=this._getPushOtherRoomsParams();t&&(e.pushOtherRooms=t);const r=yield this._exchangeHandle(e);if(r.code!==I.SUCCESS)return b.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==I.SUCCESS)return b.error(`exchange with pushOtherRoom failed: ${o}`),{code:o};const s=yield this._pc.setRemoteAnswer(i.sdp);return s!==I.SUCCESS?{code:s}:void 0})}getRoomPKHandler(){return this._isMainRoom?{code:I.SUCCESS,roomPKHandler:this._roomPKHandler}:(b.error("the `getRoomPKHandler` is disabled in PK room "),{code:I.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}_quitAllPKRoom(){const e=this._roomPKHandler.getJoinedPKRooms();for(const t in e){const r=e[t];this._roomPKHandler.leaveOtherRoom(r)}}}class Pl extends Yc{constructor(e,t,r,i,o,s,u){super(e,t,r,i,Le.RTC,o,s,u,!1)}}const ai=()=>({"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:`web|${Ge.browser}|${Ge.version}`,ClientVersion:"5.3.1","Client-Session-Id":zc(),"Request-Id":Date.now().toString()});class Yo{constructor(e,t,r,i=5e3){this._runtime=e,this._context=t,this._msUrl=r,this._timeout=i,this._msInNavi=[],this._failedMs=[],this._rtcFinger=void 0,this._clusterId="",this._configUrl=""}getNaviMS(){return this._msUrl?[this._msUrl]:this._clusterId?[`https://${this._clusterId}`]:(this._msInNavi.length===0&&(this._failedMs.length===0?this._msInNavi.push(...(e=>{var t;if(!e)return[];let r;try{r=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch{return b.warn("parse `voipCallInfo` of navi failed: "+e.voipCallInfo),[]}if(r.strategy===0)return[];const i=(t=r.callEngine)===null||t===void 0?void 0:t.filter(u=>u.engineType===4);if(!i||i.length===0)return[];const o=i[0],s=[];return o.mediaServer&&s.push(o.mediaServer.replace(/^(https?:\/\/)?/,"https://")),o.backupMediaServer&&o.backupMediaServer.forEach(u=>{s.push(u.replace(/^(https?:\/\/)?/,"https://"))}),s})(this._context.getNaviInfo())):(this._msInNavi.push(...this._failedMs),this._failedMs.length=0)),this._msInNavi.map(e=>e.trim()))}_request(e,t,r){return B(this,void 0,void 0,function*(){const i=this.getNaviMS();if(i.length===0)return{code:I.NOT_OPEN_VIDEO_AUDIO_SERVER};this._rtcFinger&&(r.rtcFinger=this._rtcFinger);for(let o=0;o<i.length;o+=1){const s=`${i[o]}${e}`,u=ai();b.debug(`request -> Request-Id: ${u["Request-Id"]}, url: ${s}`);const{status:d,data:l}=yield this._runtime.httpReq({url:s,body:JSON.stringify(r),headers:Object.assign(Object.assign({},u),t),method:We.POST,timeout:this._timeout});if(d===200){const h=JSON.parse(l);return h.rtcFinger&&(this._rtcFinger=h.rtcFinger),h.clusterId&&(this._clusterId=h.clusterId),b.debug(`request success -> Request-Id: ${u["Request-Id"]}`),{code:I.SUCCESS,data:h}}b.warn(`request failed -> Request-Id: ${u["Request-Id"]}, status: ${d}, url: ${s}`),this._failedMs.push(...this._msInNavi.splice(o,1))}return{code:I.REQUEST_FAILED}})}exchange(e,t){var r;return B(this,void 0,void 0,function*(){const i=yield this._request("/exchange",e,t);if(i.code===I.SUCCESS&&((r=i.data)===null||r===void 0?void 0:r.resultCode)===I.SUCCESS){const o=i.data.urls;o&&(this._configUrl=o.configUrl)}return i})}exit(e){return B(this,void 0,void 0,function*(){const{code:t}=yield this._request("/exit",e,{});return t})}broadcastSubscribe(e,t){return this._request("/broadcast/subscribe",e,t)}broadcastExit(e){return B(this,void 0,void 0,function*(){const{code:t}=yield this._request("/broadcast/exit",e,{});return{code:t}})}setMcuConfig(e,t){return B(this,void 0,void 0,function*(){if(!this._configUrl)return{code:I.MCU_SERVER_NOT_FOUND};const r=`${this._configUrl.replace(/^(https?:\/\/)?/,"https://")}/server/mcu/config`,i=ai();b.debug(`request -> Request-Id: ${i["Request-Id"]}, url: ${r}`);const{status:o,data:s}=yield this._runtime.httpReq({url:r,headers:Object.assign(Object.assign({},i),e),body:JSON.stringify(t),method:We.POST});if(o===200){b.debug(`request success -> Request-Id: ${i["Request-Id"]}`);const u=JSON.parse(s);return{code:u.resultCode,res:u}}return{code:I.REQUEST_FAILED}})}getCDNResourceInfo(e,t){return B(this,void 0,void 0,function*(){const r=ai(),{status:i,data:o}=yield this._runtime.httpReq({url:t,headers:Object.assign(Object.assign({},r),e),method:We.GET});if(i===200){const s=JSON.parse(o);return{code:s.resultCode,res:s}}return b.warn(`request failed -> Request-Id: ${r["Request-Id"]}, status: ${i}, url: ${t}`),{code:I.REQUEST_FAILED}})}}class Ll{constructor(e,t,r){this._context=e,this._rtcToken="",this._liveUrl="",this._subTracks=[],this._livingType=null,this._mediaType=null,this._subTiny=!1,this._fromRetry=!1,this._appListener=null,this._service=new Yo(t,e,r.mediaServer)}_getReqHeaders(e){return B(this,void 0,void 0,function*(){const t=this._context.getCurrentId(),r=t;if(!this._rtcToken){const{code:i,data:o}=yield this._context.getRTCToken(r,Le.LIVE,e);if(i!==S.SUCCESS)return b.error(`getRTCToken failed: ${i}`),{code:I.SIGNAL_ERROR};this._rtcToken=o.rtcToken}return{code:I.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:t,RoomId:r,RoomType:Le.LIVE,Token:this._rtcToken}}})}_clearSubscribeInfo(){var e;this._liveUrl="",this._livingType=null,this._mediaType=null,this._subTiny=!1,this._subTracks.length=0,(e=this._pc)===null||e===void 0||e.destroy(),this._pc=null}_reTryExchange(){var e;return B(this,void 0,void 0,function*(){this._fromRetry=!0;const{code:t}=yield this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny);t===I.SUCCESS&&((e=this._pc)===null||e===void 0||e.clearReTryExchangeTimer())})}subscribe(e,t,r,i=!1){return B(this,void 0,void 0,function*(){return ve(()=>this.__subscribe(e,t,r,i))})}__subscribe(e,t,r,i=!1){var o;return B(this,void 0,void 0,function*(){const s=[];if(rr(this._context.getNaviInfo()))return{code:I.PACKAGE_ENVIRONMENT_ERROR,tracks:s};if(!this._fromRetry&&((o=this._pc)===null||o===void 0||o.clearReTryExchangeTimer()),this._fromRetry=!1,!Be(e))return b.error(`liveUrl is invalid: ${e}`),{code:I.PARAMS_ERROR,tracks:s};if(![et.AUDIO,et.VIDEO].includes(t))return b.error(`livingType is invalid: ${t}`),{code:I.PARAMS_ERROR,tracks:s};if(![le.AUDIO_ONLY,le.VIDEO_ONLY,le.AUDIO_VIDEO].includes(r))return b.error(`mediaType is invalid: ${r}`),{code:I.PARAMS_ERROR,tracks:s};if(this._liveUrl&&this._liveUrl!==e)return{code:I.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s};this._pc||(this._pc=new ot(this._reTryExchange.bind(this)),this._pc.on(ot.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this.registerReportListener(this._reportListener)),this._liveUrl=e;const{code:u,headers:d}=yield this._getReqHeaders(t);if(u!==I.SUCCESS)return{code:u,tracks:s};const l=`rc_mcu_${Date.now()}`,h="RongCloudRTC";this._subTracks.length===0&&(this._subTracks.push(new ut(h,l),new dt(h,l)),this._pc.updateSubRemoteTracks(this._subTracks.slice()));const a={sdp:yield this._pc.createOffer(!0),liveUrl:e,mediaType:r,simulcast:i?Ke.TINY:Ke.NORMAL,switchstream:!1},c=yield this._service.broadcastSubscribe(d,a);if(c.code!==I.SUCCESS)return b.error(`andience subscribe failed: ${c.code}`),{code:c.code,tracks:s};const p=c.data;if(p.resultCode!==I.SUCCESS)return b.error(`andience subscribe failed! code: ${p.resultCode}; message: ${p.message}`),{code:p.resultCode,tracks:s};b.debug(`andience subscribe success: ${e}`),this._livingType=t,this._mediaType=r,this._subTiny=i;const{sdp:f,subscribedList:m}=p,_=[];return m.forEach(v=>{const{mediaType:R}=v,C=this._subTracks[R];_.push(C),C.__innerSetRemoteMuted(!0)}),this._pc.setRemoteAnswer(f.sdp),{code:I.SUCCESS,tracks:_}})}unsubscribe(){return B(this,void 0,void 0,function*(){return ve(()=>this.__unsubscribe())})}__unsubscribe(){var e;return B(this,void 0,void 0,function*(){if((e=this._pc)===null||e===void 0||e.clearReTryExchangeTimer(),!this._rtcToken||!this._liveUrl)return{code:I.SUCCESS};const{headers:t}=yield this._getReqHeaders(),{code:r}=yield this._service.broadcastExit(t);return r!==I.SUCCESS?b.error(`broadcast unsubscribe failed: ${r}`):b.debug("broadcast unsubscribe success"),this._clearSubscribeInfo(),{code:r}})}registerReportListener(e){var t;this._reportListener=e,(t=this._pc)===null||t===void 0||t.registerReportListener(e)}registerTrackEventListener(e){this._appListener=e}_onTrackReady(e){var t,r;const i=e.receiver.track,o=i.kind==="audio"?le.AUDIO_ONLY:le.VIDEO_ONLY,s=this._subTracks[o];s.__innerSetMediaStreamTrack(i);try{(r=(t=this._appListener)===null||t===void 0?void 0:t.onTrackReady)===null||r===void 0||r.call(t,s)}catch(u){b.error(u)}}}var Hi,pn;(function(n){n.RTMP="rtmp",n.FLV="flv",n.HLS="hls"})(Hi||(Hi={})),function(n){n[n.NOT_HTTPS=0]="NOT_HTTPS",n[n.HTTPS=1]="HTTPS"}(pn||(pn={}));const kl=Object.assign(Object.assign({},nt(ge.W176_H144)),{frameRate:rt(Ze.FPS_15)});class la{constructor(e,t,r,i,o,s){this._context=e,this._runtime=t,this._initOptions=r,this._roomId=i,this._joinResData=o,this._livingType=s,this._roomAnchorList=[],this._roomRes={},this._roomAnchorRes={},this._remoteTracks={},this._appListener=null,this._subscribedList=[],this._sessionId="",this._destroyed=!1,this._setInitData(),this._service=new Yo(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout),this._polarisReport=new qc(this._context,this._runtime,this._roomId,this,Cr.Audience),this._polarisReport.sendR1(),this._pc=new ot(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(ot.__INNER_EVENT_TRACK_READY__,u=>{const d=u.streams[0].id,l=u.receiver.track,h=[d,l.kind==="audio"?le.AUDIO_ONLY:le.VIDEO_ONLY].join("_"),a=this._remoteTracks[h];a?(a.__innerSetMediaStreamTrack(l),this._callAppListener("onTrackReady",a)):b.warn("cannot found RCRemoteTrack:",l.id)}),this._context.onrtcdatachange=this.singalDataChange.bind(this)}_setInitData(){const{sessionId:e,remoteUserIds:t,remoteRTCUris:r,remoteMUCUris:i,remoteTracks:o,CDNUris:s}=((u,d)=>{const l=d.filter(R=>R.key==="RC_RTC_SESSIONID")[0],h=l?l.value:"",a=d.filter(R=>R.key==="RC_ANCHOR_LIST").map(R=>JSON.parse(R.value||"[]"))[0],c=d.filter(R=>R.key.includes("RC_RES_")).map(R=>JSON.parse(R.value||"{}")),p=c.length?JSON.parse(c[0].mcu_uris||"[]"):[],f=[];p.forEach(R=>{const{mediaType:C,tag:M}=R,A=C===le.AUDIO_ONLY?new ut(M,"",u):new dt(M,"",u);f.push(A)});const m=[],_=[];c.forEach(R=>{const C=JSON.parse(R.uris||"[]");m.push(...C),C.forEach(M=>{const{mediaType:A,tag:O,msid:y}=M,w=y.split("_")[0],H=A===le.AUDIO_ONLY?new ut(O,w):new dt(O,w);_.push(H)})});const v=d.filter(R=>R.key==="RC_CDN").map(R=>{const C=JSON.parse(R.value||"[]");return JSON.parse(C.cdn_uris)[0]})[0];return{sessionId:h,remoteUserIds:a||[],remoteRTCUris:m,remoteMUCUris:p,remoteRTCTracks:_,remoteMCUTracks:f,remoteTracks:[..._,...f],CDNUris:v||{}}})(this._roomId,this._joinResData.kvEntries);this._sessionId=e,this._roomAnchorList=t,o.forEach(u=>{this._remoteTracks[u.getTrackId()]=u}),this._CDNUris=s,r.forEach(u=>{const d=u.msid.split("_")[0];this._roomAnchorRes[d]?this._roomAnchorRes[d].push(u):this._roomAnchorRes[d]=[u]}),i.forEach(u=>{const{mediaType:d,tag:l}=u,h=[this._roomId,l,d].join("_");this._roomRes[h]=u}),r.forEach(u=>{const d=ce(u);this._roomRes[d]=u})}_assertRoomDestroyed(){if(this._destroyed){const e="This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance.";return b.warn(e),I.ROOM_HAS_BEEN_DESTROYED}}singalDataChange(e,t){var r;if(t!==this._roomId)return void b.warn(`singalDataChange -> not the current room data: data roomId: ${t}, current roomId: ${this._roomId}`);b.debug("singalDataChange -> singalData:",JSON.stringify(e||{}));const i=[],o=(r=e.filter(s=>s.key==="RC_CDN")[0])===null||r===void 0?void 0:r.value;o&&this._diffCDNUris(JSON.parse(JSON.parse(o).cdn_uris)[0]),e.forEach(s=>{const{key:u,value:d,timestamp:l,uid:h}=s;if(u.indexOf("RC_RES_")!==-1){const a=JSON.parse(d||"{}"),c=JSON.parse(a.mcu_uris||"[]"),p=JSON.parse(a.uris||"[]");return i.push(...c),void this._diffAnchorResource(p,h)}if(u==="RC_ANCHOR_LIST"){const a=JSON.parse(d||"[]"),{joinUserIds:c,leftUserIds:p}=this._diffAnchorList(a);c.length>0&&this._handleNewJoinedAnchor(c),p.length>0&&this._handleLeftedAnchor(p)}}),this._diffRoomResource(i)}_diffAnchorList(e){const t=e.filter(r=>this._roomAnchorList.indexOf(r)<0);return{leftUserIds:this._roomAnchorList.filter(r=>e.indexOf(r)<0),joinUserIds:t}}_handleNewJoinedAnchor(e){this._roomAnchorList.push(...e),this._callAppListener("onAnchorJoin",e)}_handleLeftedAnchor(e){return B(this,void 0,void 0,function*(){this._roomAnchorList=this._roomAnchorList.filter(r=>!(e.indexOf(r)>-1));const t=[];e.forEach(r=>{t.push(...this.getRemoteTracksByUserId(r)),delete this._roomAnchorRes[r]}),t.length&&(yield this.unsubscribe(t),t.forEach(r=>delete this._remoteTracks[r.getTrackId()])),this._callAppListener("onAnchorLeave",e)})}_diffRoomResource(e){return B(this,void 0,void 0,function*(){const t=[],r=[],i=[];e.forEach(o=>{const s=ce(o),{userId:u,tag:d,mediaType:l}=Pe(s),h=[this._roomId,d,l].join("_");if(!this._remoteTracks[h]){const a=l===le.AUDIO_ONLY?new ut(d,"",this._roomId):new dt(d,"",this._roomId);t.push(a),this._remoteTracks[h]=a,this._roomRes[a.getTrackId()]=o}i.push(h)}),Object.keys(this._remoteTracks).forEach(o=>{i.indexOf(o)<0&&this._remoteTracks[o].isMCUTrack()&&r.push(this._remoteTracks[o])}),t.length>0&&this._callAppListener("onTrackPublish",t),r.length>0&&this._onUserUnpublish(r,"onTrackUnpublish")})}_diffAnchorResource(e,t){return B(this,void 0,void 0,function*(){const r=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),{publishedList:i,unpublishedList:o,modifiedList:s}=nr(r,e);if(i.length){const u=r.map(ce),d=[],l=[];if(i.forEach(h=>{const a=ce(h),c=u.indexOf(a),{userId:p,tag:f,mediaType:m}=Pe(a);c>-1?r[c]=h:r.push(h);let _=this._remoteTracks[a];this._roomRes[a]=h,_?_.isSubscribed()&&d.push(_):(_=m===le.AUDIO_ONLY?new ut(f,p):new dt(f,p),this._remoteTracks[a]=_,l.push(_)),_.__innerSetRemoteMuted(h.state===0)}),d.length){const h=d.map(c=>c.getTrackId());b.debug(`resub tracks -> ${JSON.stringify(h)}`);const{code:a}=yield ve(()=>this._subscribeHandle(d,!0));a!==I.SUCCESS&&b.error(`resub tracks failed -> code: ${a}, ids: ${JSON.stringify(h)}`)}this._callAppListener("onAnchorTrackPublish",l)}if(o.length){const u=o.map(ce);for(let l=r.length-1;l>=0;l-=1){const h=r[l];u.includes(ce(h))&&r.splice(l,1)}const d=o.map(l=>{const h=ce(l);return this._remoteTracks[h]});yield this._onUserUnpublish(d,"onAnchorTrackUnpublish")}if(s.length){const u=r.map(ce);for(let d=0;d<s.length;d++){const l=s[d],h=ce(l),a=u.indexOf(h);r[a].state=l.state;const c=this._remoteTracks[h];c.__innerSetRemoteMuted(l.state===0),c.isAudioTrack()?this._callAppListener("onAudioMuteChange",c):this._callAppListener("onVideoMuteChange",c)}}})}_onUserUnpublish(e,t){return B(this,void 0,void 0,function*(){yield this.unsubscribe(e),e.forEach(r=>{this._subscribedList=this._subscribedList.filter(i=>i.track.getTrackId()!==r.getTrackId()),delete this._roomRes[r.getTrackId()],r.__innerDestroy(),delete this._remoteTracks[r.getTrackId()]}),this._callAppListener(t,e)})}_callAppListener(e,...t){var r;const i=(r=this._appListener)===null||r===void 0?void 0:r[e];if(i)try{i(...t)}catch(o){b.error(o)}}_reTryExchange(){return B(this,void 0,void 0,function*(){ve(()=>B(this,void 0,void 0,function*(){var e;const{reqBody:t}=yield this._createSubscribeParams(this._subscribedList,{},!0),r=yield this._exchangeHandle(t);if(r.code!==I.SUCCESS)return b.error(`reTryExchange failed: ${r.code}`),{code:r.code};const{sdp:i,resultCode:o}=r.data;if(o!==I.SUCCESS)return b.error(`reTryExchange failed: ${o}`),{code:o};this._pc.clearReTryExchangeTimer();const s=this._subscribedList.filter(d=>d.track.isMCUTrack());if(s.length>0){const d=s[0].track.getTrackId(),l=(e=this._roomRes[d])===null||e===void 0?void 0:e.msid,h=[this._roomId,"RongCloudRTC"].join("_");i.sdp=i.sdp.replace(new RegExp(l,"g"),h)}const u=yield this._pc.setRemoteAnswer(i.sdp);return u!==I.SUCCESS?{code:u}:void 0}))})}_createSubscribeParams(e,t,r){return B(this,void 0,void 0,function*(){const i=yield this._pc.createOffer(r),o={resolutionInfo:[]},s={min:0,max:0};return Object.keys(t).forEach(u=>{const{mediaStream:d,tinyStream:l}=t[u];[d,l].forEach((h,a)=>{var c;const p=a===1?[u,"tiny"].join("_"):u;i.sdp=(c=i.sdp)===null||c===void 0?void 0:c.replace(new RegExp(h.id,"g"),p);const f=h.getVideoTracks()[0];if(!f)return;const m=a===0,{width:_,height:v,frameRate:R}=m?qo(f):kl;o.resolutionInfo.push({trackId:f.id,simulcast:m?Ke.NORMAL:Ke.TINY,resolution:`${_}x${v}`});const C=Fc(_,v),M=Hc(R);s.min+=C.minBitrate*M,s.max+=C.maxBitrate*M})}),{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map(u=>({simulcast:u.subTiny?Ke.TINY:Ke.NORMAL,resolution:"",uri:this._roomRes[u.track.getTrackId()].uri}))},dynamicBitrate:s,offer:i}})}_subscribeHandle(e,t=!1){var r;return B(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:I.ROOM_HAS_BEEN_DESTROYED};if(!me("tracks",e,()=>De(e)&&e.length>0&&e.every(d=>d instanceof Oe||d.track instanceof Oe),!0))return{code:I.PARAMS_ERROR};const i=this._subscribedList.map(d=>Object.assign({},d)),o=e.map(d=>d instanceof Oe?{track:d}:d);let s=!1;const u=[];return o.forEach(d=>{const l=d.track.getTrackId();u.push(l);const h=i.find(a=>a.track.getTrackId()===l);h&&h.subTiny===d.subTiny||(h?h.subTiny=d.subTiny:i.push(d),s=!0)}),s||t?((r=this._polarisReport)===null||r===void 0||r.sendR2(ht.SUBSCRIBE,pt.BEGIN,u),this._updateSubListHandle(i,!0)):{code:I.SUCCESS}})}_getReqHeaders(){const e=this._context.getCurrentId();return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:Le.LIVE,UserId:e,"Session-Id":this._sessionId}}_exchangeHandle(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}_updateSubListHandle(e,t=!1){var r;return B(this,void 0,void 0,function*(){if(this._assertRoomDestroyed())return{code:I.ROOM_HAS_BEEN_DESTROYED};if(!me("resources",e,()=>De(e)&&e.every(R=>R instanceof Oe||R.track instanceof Oe),!0))return{code:I.PARAMS_ERROR};let i=e.map(R=>R instanceof Oe?{track:R}:Object.assign({},R));const o={};i=i.filter(R=>{const C=R.track.getTrackId();return!o[C]&&(o[C]=!0)}).map(R=>Object.assign({},R));const s=this._subscribedList.map(R=>Object.assign({},R));if(!t){let R=!1;if(i.forEach(C=>{const M=s.findIndex(A=>A.track===C.track);if(M===-1)return void(R=!0);s.splice(M,1)[0].subTiny!==C.subTiny&&(R=!0)}),s.length&&(R=!0),!R)return{code:I.SUCCESS}}this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(i.map(R=>R.track));const{reqBody:u}=yield this._createSubscribeParams(i,{},!1),d=yield this._exchangeHandle(u);if(s.length){const R=[];s.forEach(C=>{R.push(C.track.getTrackId())}),(r=this._pc.reportParser)===null||r===void 0||r.clearLatestPacketsRecv(R)}if(d.code!==I.SUCCESS)return{code:d.code};const{sdp:l,resultCode:h,message:a,subscribedList:c}=d.data;if(h!==I.SUCCESS)return b.error("change subscribe list failed:",a,h),{code:h};i.forEach(R=>{const{track:C}=R;if(C.isMCUTrack()){const M=this._roomRes[C.getTrackId()].msid,{tag:A,userId:O}=Pe(C.getTrackId()),y=[O,A].join("_");l.sdp=l.sdp.replace(new RegExp(M,"g"),y)}});const p=yield this._pc.setRemoteAnswer(l.sdp);if(p!==I.SUCCESS)return{code:p};const f=c==null?void 0:c.map(R=>`${R.msid}_${R.mediaType}`),m=i.filter(R=>{if(R.track.isMCUTrack()){const C=this._roomRes[R.track.getTrackId()],M=`${C.msid}_${C.mediaType}`;return f.includes(M)}return f==null?void 0:f.includes(R.track.getTrackId())}),_=m==null?void 0:m.map(R=>`${R.track.getTrackId()}`),v=i.filter(R=>!(_==null?void 0:_.includes(R.track.getTrackId())));for(const R in this._remoteTracks){const C=m.some(M=>M.track.getTrackId()===R);this._remoteTracks[R].__innerSetSubscribed(C)}return this._subscribedList.splice(0,this._subscribedList.length,...m),v.length?{code:I.SUCCESS,failedList:v}:{code:I.SUCCESS}})}_diffCDNUris(e){return B(this,void 0,void 0,function*(){if(this._CDNUris.url&&!e.url)return this._callAppListener("onCDNInfoDisable"),void(this._CDNUris=e);(!this._CDNUris||!this._CDNUris.url&&e.url)&&this._callAppListener("onCDNInfoEnable",{resolution:`W${e.w}_H${e.h}`,fps:`FPS_${e.fps}`});const t=this._CDNUris.w&&e.w&&this._CDNUris.w!==e.w,r=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,i=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps;(t||r||i)&&this._callAppListener("onCDNInfoChange",{resolution:`W${e.w}_H${e.h}`,fps:`FPS_${e.fps}`}),this._CDNUris=e})}_getCDNPlayUrl(e){return B(this,void 0,void 0,function*(){const{w:t,h:r,fps:i}=e,o=this._initOptions.pullInnerCDNProtocol||Hi.FLV,s=this._initOptions.pullInnerCDNUseHttps===pn.NOT_HTTPS?pn.NOT_HTTPS:pn.HTTPS;if(!this._CDNUris.url)return b.error(`cdn_uris url is empty, the anchor need to open or push CDN, code: ${I.CDN_RESOURCE_IS_EMPTY}`),{code:I.CDN_RESOURCE_IS_EMPTY};const u={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},d=[];t&&d.push(`w=${t}`),r&&d.push(`h=${r}`),i&&d.push(`fps=${i}`),d.push(`kind=${o}`),d.push(`is_https=${s}`);const l=d.join("&");let h=`${this._CDNUris.url}?`;l&&(h+=l);const{code:a,res:c}=yield this._service.getCDNResourceInfo(u,h);return a!==I.SUCCESS?(b.error(`getCDNPlayUrl failed: ${a}`),{code:a}):(b.info(`getCDNPlayUrl success: ${c==null?void 0:c.data.pull_url}`),{code:a,CDNPlayUrl:c==null?void 0:c.data.pull_url})})}getCDNPlayUrl(e,t){return B(this,void 0,void 0,function*(){if(e&&!Vt(e))return b.error("`resolution` is invalid"),{code:I.PARAMS_ERROR};if(t&&!Vi(t))return b.error("`fps` is invalid"),{code:I.PARAMS_ERROR};const{width:r,height:i}=e?nt(e):{width:null,height:null},o=t?rt(t):null,s={};return r&&(s.w=r),i&&(s.h=i),o&&(s.fps=o),this._getCDNPlayUrl(s)})}subscribe(e){return B(this,void 0,void 0,function*(){return ve(()=>this._subscribeHandle(e,!1))})}__unsubscribe(e){var t;return B(this,void 0,void 0,function*(){if(!me("tracks",e,()=>De(e)&&e.length>0&&e.every(i=>i instanceof Oe),!0))return b.error(`unsubscribe failed, tracks is invalid -> roomId: ${this._roomId}`),{code:I.PARAMS_ERROR};const r=this._subscribedList.map(i=>Object.assign({},i)).filter(i=>!e.includes(i.track));return(t=this._polarisReport)===null||t===void 0||t.sendR2(ht.SUBSCRIBE,pt.END,e.map(i=>i.getTrackId())),this._updateSubListHandle(r,!1)})}unsubscribe(e){return B(this,void 0,void 0,function*(){return ve(()=>this.__unsubscribe(e))})}__destroy(e){var t;return B(this,void 0,void 0,function*(){this._destroyed||(this._destroyed=!0,(t=this._audioLevelReport)===null||t===void 0||t.clearAudioLevelReportTimer(),e&&(yield this._context.quitLivingRoomAsAudience(this._roomId)),yield this._service.broadcastExit(this._getReqHeaders()),this._pc.destroy(),this._polarisReport=null,this._context.onrtcdatachange=()=>{})})}getRemoteTrack(e){return this._remoteTracks[e]}__getPC(){return this._pc}getLocalTrack(e){return{}}__onReconnected(){return B(this,void 0,void 0,function*(){const{code:e}=yield this._context.joinLivingRoomAsAudience(this._roomId,Le.LIVE);e!==S.SUCCESS&&b.error("join living room error when on reconnected")})}registerRoomEventListener(e){this._appListener=e}onAudioLevelChange(e,t){var r;(r=this._audioLevelReport)===null||r===void 0||r.clearAudioLevelReportTimer(),this._audioLevelReport=new Gc(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}registerReportListener(e){var t;(t=this._pc)===null||t===void 0||t.registerReportListener(e)}getRoomId(){return this._roomId}getCrtUserId(){return this._context.getCurrentId()}getSessionId(){return this._sessionId}getRemoteUserIds(){return this._roomAnchorList}getRemoteTracksByUserId(e){const t=[];for(const r in this._remoteTracks){const i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}getRemoteTracks(){const e=[],t=[];for(const r in this._remoteTracks){if(t.length===2)break;const i=this._remoteTracks[r];i.isMCUTrack()&&t.push(i)}return this._roomAnchorList.forEach(r=>{e.push(...this.getRemoteTracksByUserId(r))}),[...t,...e]}getRemoteRTCTracks(){const e=[];for(const t in this._remoteTracks){const r=this._remoteTracks[t];r.isMCUTrack()||e.push(r)}return e}getRemoteMCUTracks(){const e=[];for(const t in this._remoteTracks){const r=this._remoteTracks[t];r.isMCUTrack()&&e.push(r)}return e}getCDNInfo(){return this._CDNUris.w?{resolution:`W${this._CDNUris.w}_H${this._CDNUris.h}`,fps:`FPS_${this._CDNUris.fps}`,CDNEnable:this._CDNUris.enableInnerCDN}:{CDNEnable:!1}}}const ha=(n,e)=>{const t=[];return t[0]=(e==null?void 0:e.withoutAudio)?void 0:n.getAudioTracks()[0],t[1]=(e==null?void 0:e.withoutVideo)?void 0:n.getVideoTracks()[0],t};class Ul{constructor(e,t,r){this._context=e,this._runtime=t,this._options=r,this._crtRoom=null,this._audience=null,this._crtAudienceLivingRoom=null,Gt.setSdpSemantics(r.sdpSemantics||"plan-b"),this._service=new Yo(this._runtime,this._context,this._options.mediaServer,this._options.timeout),this._context.onconnectionstatechange=this._onIMStatusChange.bind(this),this._context.ondisconnect=this._onIMDisconnect.bind(this),this._context.ondestroy=this._onIMUninit.bind(this),this._context.onmessage=this._handleMessage.bind(this)}_handleMessage(e){var t;return e.conversationType!==J.RTC_ROOM?!1:(this._crtRoom instanceof ft&&this._getJoinedPKRoomList().forEach(r=>{r.__parseInnerMessage(e)}),(t=this._crtRoom)===null||t===void 0||t.__parseInnerMessage(e),!0)}_getJoinedPKRoomList(){const{code:e,roomPKHandler:t}=this._crtRoom.getRoomPKHandler();if(e===I.SUCCESS&&t){const r=t.getJoinedPKRooms()||{};return Object.values(r)}return[]}getCurrentId(){return this._context.getCurrentId()}joinRTCRoom(e,t){return ve(()=>this._joinRTCRoom(e,t))}_joinRTCRoom(e,t){return B(this,void 0,void 0,function*(){if(rr(this._context.getNaviInfo()))return{code:I.PACKAGE_ENVIRONMENT_ERROR};if(!me("roomId",e,Ve,!0))return{code:I.PARAMS_ERROR};if(this._crtRoom)return{code:I.REPERT_JOIN_ROOM};if(this._context.getConnectionStatus()!==ee.CONNECTED)return{code:I.SIGNAL_DISCONNECTED};if(!this._service.getNaviMS().length)return{code:I.NOT_OPEN_VIDEO_AUDIO_SERVER};b.debug(`joinRoom -> roomId: ${e}; joinType: ${t||Ci.KICK}`);const{code:r,data:i}=yield this._context.joinRTCRoom(e,Le.RTC,void 0,t);if(r!==S.SUCCESS)return b.error(`joinRoom failed -> code: ${r}`),{code:r===Mi.JOIN_REFUSED?I.SIGNAL_JOIN_RTC_ROOM_REFUSED:r};b.debug(`joinRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${e}, data: ${JSON.stringify(i)}`);const o=new Pl(this._context,this._runtime,e,i,this._service,this._options,this._releaseCrtRoomObj.bind(this));return this._crtRoom=o,{room:o,code:I.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()}})}joinLivingRoom(e,t){return ve(()=>this._joinLivingRoom(e,t))}_joinLivingRoom(e,t){return B(this,void 0,void 0,function*(){if(rr(this._context.getNaviInfo()))return{code:I.PACKAGE_ENVIRONMENT_ERROR};if(!me("roomId",e,Ve,!0)||!me("livingType",t,u=>u===et.AUDIO||u===et.VIDEO))return{code:I.PARAMS_ERROR};if(this._crtRoom)return{code:I.REPERT_JOIN_ROOM};if(this._context.getConnectionStatus()!==ee.CONNECTED)return{code:I.SIGNAL_DISCONNECTED};if(!this._service.getNaviMS().length)return{code:I.NOT_OPEN_VIDEO_AUDIO_SERVER};b.debug(`joinRoom, roomId: ${e}`);const{code:r,data:i}=yield this._context.joinRTCRoom(e,Le.LIVE,t);if(r!==S.SUCCESS)return b.error(`joinRoom failed -> code: ${r}`),{code:r};b.debug(`JoinRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${e}, data: ${JSON.stringify(i)}`);const o=new ft(this._context,this._runtime,e,i,this._service,this._options,this._releaseCrtRoomObj.bind(this),t,!1,!0);this._crtRoom=o;const s={room:o,code:I.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()};return o.__getCDNPushMode()===br.MANUAL&&Object.assign(s,{CDNEnable:o.__getCDNEnable()}),s})}getAudienceClient(){return this._audience||(this._audience=new Ll(this._context,this._runtime,this._options)),this._audience}_onIMStatusChange(e){b.debug(`signal server connection state change: ${e}`),e===ee.CONNECTED&&(this._crtRoom instanceof ft&&this._getJoinedPKRoomList().forEach(t=>{t.__onReconnected()}),this._crtRoom&&this._crtRoom.__onReconnected())}_onIMDisconnect(){b.debug("TODO -> on IM disconnect")}_onIMUninit(){b.debug("TODO -> on IM client ondestroy")}leaveRoom(e){return ve(()=>this._leaveRoom(e))}_leaveRoom(e){return B(this,void 0,void 0,function*(){return this._crtRoom?(yield this._crtRoom.__destroy(!0),b.debug(`quitRTCRoom -> userId: ${this._context.getCurrentId()} , roomId: ${this._crtRoom.getRoomId()}`),this._crtRoom=null,{code:I.SUCCESS}):{code:I.SUCCESS}})}_releaseCrtRoomObj(){this._crtRoom=null}_getMediaStream(e,t="getUserMedia"){return B(this,void 0,void 0,function*(){try{const r=yield navigator.mediaDevices[t](e);return{code:I.SUCCESS,stream:r}}catch(r){if(r.message==="Permission denied")return{code:I.PERMISSION_DENIED};b.error(`get user media failed -> ${r.message}`)}return{code:t==="getUserMedia"?I.GET_USER_MEDIA_FAILED:I.GET_DISPLAY_MEDIA_FAILED}})}createMicrophoneAudioTrack(e="RongCloudRTC",t){return B(this,void 0,void 0,function*(){if(!st(e))return{code:I.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:I.INVALID_USER_ID};const{stream:i,code:o}=yield this._getMediaStream({audio:{deviceId:t==null?void 0:t.micphoneId,sampleRate:t==null?void 0:t.sampleRate}});if(o!==I.SUCCESS)return{code:o};const s=i.getAudioTracks()[0];return{code:o,track:new sa(e,r,s)}})}createCameraVideoTrack(e="RongCloudRTC",t){return B(this,void 0,void 0,function*(){if(!st(e))return{code:I.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:I.INVALID_USER_ID};const i=Vt(t==null?void 0:t.resolution)?t.resolution:ge.W640_H480,{width:o,height:s}=nt(i),{stream:u,code:d}=yield this._getMediaStream({video:{deviceId:t==null?void 0:t.cameraId,frameRate:rt((t==null?void 0:t.frameRate)||Ze.FPS_15),width:o,height:s,facingMode:t==null?void 0:t.faceMode}});if(d!==I.SUCCESS)return{code:d};const l=u.getVideoTracks()[0];return{code:d,track:new aa(e,r,l)}})}createMicrophoneAndCameraTracks(e="RongCloudRTC",t){var r,i,o,s,u,d;return B(this,void 0,void 0,function*(){const l=[];if(!st(e))return{code:I.INVALID_TAGS,tracks:l};const h=this._context.getCurrentId();if(!h)return{code:I.INVALID_USER_ID,tracks:l};const a=Vt((r=t==null?void 0:t.video)===null||r===void 0?void 0:r.resolution)?t.video.resolution:ge.W640_H480,{width:c,height:p}=nt(a),{stream:f,code:m}=yield this._getMediaStream({video:{deviceId:(i=t==null?void 0:t.video)===null||i===void 0?void 0:i.cameraId,frameRate:rt(((o=t==null?void 0:t.video)===null||o===void 0?void 0:o.frameRate)||Ze.FPS_15),width:c,height:p,facingMode:(s=t==null?void 0:t.video)===null||s===void 0?void 0:s.faceMode},audio:{deviceId:(u=t==null?void 0:t.audio)===null||u===void 0?void 0:u.micphoneId,sampleRate:(d=t==null?void 0:t.audio)===null||d===void 0?void 0:d.sampleRate}});return m!==I.SUCCESS||f.getTracks().forEach(_=>{_.kind==="video"?l.push(new aa(e,h,_)):l.unshift(new sa(e,h,_))}),{code:m,tracks:l}})}createScreenVideoTrack(e="screenshare",t){return B(this,void 0,void 0,function*(){if(!st(e))return{code:I.INVALID_TAGS};const r=this._context.getCurrentId();if(!r)return{code:I.INVALID_USER_ID};if(!jc())return{code:I.BROWSER_NOT_SUPPORT};const i=/Electron/.test(navigator.userAgent);if(i&&!(t==null?void 0:t.chromeMediaSourceId))return{code:I.PARAMS_ERROR};const o=Vt(t==null?void 0:t.resolution)?t.resolution:ge.W1280_H720,{width:s,height:u}=nt(o),d=i?{mandatory:{chromeMediaSourceId:t.chromeMediaSourceId,chromeMediaSource:"desktop",minWidth:s,maxWidth:s,minHeight:u,maxHeight:u}}:{frameRate:rt((t==null?void 0:t.frameRate)||Ze.FPS_15),width:s,height:u},{stream:l,code:h}=yield this._getMediaStream({video:d,audio:!1},i?"getUserMedia":"getDisplayMedia");if(h!==I.SUCCESS)return{code:h};const a=l.getVideoTracks()[0];return{code:h,track:new El(e,r,a)}})}createLocalAudioTrack(e,t){return B(this,void 0,void 0,function*(){if(!st(e))return{code:I.INVALID_TAGS};if(!t||t.toString()!=="[object MediaStreamTrack]"||t.kind!=="audio")return{code:I.CREATE_CUSTOM_TRACK_FAILED};const r=this._context.getCurrentId();return r?{code:I.SUCCESS,track:new xi(e,r,t)}:{code:I.INVALID_USER_ID}})}createLocalVideoTrack(e,t){return B(this,void 0,void 0,function*(){if(!st(e))return{code:I.INVALID_TAGS};if(!t||t.toString()!=="[object MediaStreamTrack]"||t.kind!=="video")return{code:I.CREATE_CUSTOM_TRACK_FAILED};const r=this._context.getCurrentId();return r?{code:I.SUCCESS,track:new Ht(e,r,t)}:{code:I.INVALID_USER_ID}})}createLocalFileTracks(e,t,r){return B(this,void 0,void 0,function*(){if(!st(e))return{code:I.INVALID_TAGS,tracks:[]};if(!$c())return{code:I.BROWSER_NOT_SUPPORT,tracks:[]};const i=t instanceof File?URL.createObjectURL(t):t;if(!mn(i)&&!/^blob:/.test(i))return b.warn(`createLocalFileTracks failed: params error -> url: ${i}`),{code:I.PARAMS_ERROR,tracks:[]};const o=this._context.getCurrentId();return o?new Promise(s=>{const u=document.createElement("video");(r==null?void 0:r.withoutAudio)&&(u.muted=!0),u.onloadedmetadata=()=>{const d=[];let l;try{const c=u.mozCaptureStream?"mozCaptureStream":"captureStream";l=u[c]()}catch(c){b.error(`create RCLocalFileTrack failed, captureSteam error. -> url: ${i}`),b.error(c),s({code:I.CREATE_FILE_TRACK_FAILED,tracks:d})}const[h,a]=ha(l,r);h&&d.push(new Rl(e,o,h,u)),a&&d.push(new vl(e,o,a,u)),d.length===0&&(u.pause(),u.src=""),u.onerror=null,s({code:I.SUCCESS,tracks:d})},u.onerror=()=>{b.error(`create RCLocalFileTrack failed -> url: ${i}`),s({code:I.CREATE_FILE_TRACK_FAILED,tracks:[]})},u.src=i,u.loop=!0,u.play()}):{code:I.INVALID_USER_ID,tracks:[]}})}createLocalTracks(e,t,r){return B(this,void 0,void 0,function*(){const i=[];if(!st(e))return{code:I.INVALID_TAGS,tracks:i};if(!(t instanceof MediaStream))return{code:I.PARAMS_ERROR,tracks:i};const o=this._context.getCurrentId();if(!o)return{code:I.INVALID_USER_ID,tracks:i};const[s,u]=ha(t,r);return s&&i.push(new xi(e,o,s)),u&&i.push(new Ht(e,o,u)),{code:I.SUCCESS,tracks:i}})}joinLivingRoomAsAudience(e,t){return B(this,void 0,void 0,function*(){if(rr(this._context.getNaviInfo()))return{code:I.PACKAGE_ENVIRONMENT_ERROR};if(!me("roomId",e,Ve,!0)||!me("livingType",t,s=>s===et.AUDIO||s===et.VIDEO))return{code:I.PARAMS_ERROR};if(this._crtAudienceLivingRoom)return{code:I.REPERT_JOIN_ROOM};if(!this._service.getNaviMS().length)return{code:I.NOT_OPEN_VIDEO_AUDIO_SERVER};const{code:r,data:i}=yield this._context.joinLivingRoomAsAudience(e,Le.LIVE,t);if(r!==S.SUCCESS)return b.error("audienceJoinLivingRoomError:",r),{code:I.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED};b.info(`joinLivingRoomAsAudience success, room data: ${JSON.stringify(i)}`);const o=new la(this._context,this._runtime,this._options,e,i,t);return this._crtAudienceLivingRoom=o,{room:o,code:I.SUCCESS,userIds:o.getRemoteUserIds(),RTCTracks:o.getRemoteRTCTracks(),MCUTracks:o.getRemoteMCUTracks(),CDNUris:o.getCDNInfo()}})}leaveLivingRoomAsAudience(e){return B(this,void 0,void 0,function*(){return this._crtAudienceLivingRoom?this._crtAudienceLivingRoom!==e?{code:I.PARAMS_ERROR}:(yield this._crtAudienceLivingRoom.__destroy(!0),this._crtAudienceLivingRoom=null,{code:I.SUCCESS}):{code:I.SUCCESS}})}upgradeToAnchorRoom(e){return B(this,void 0,void 0,function*(){if(!me("room._roomId",e._roomId,Ve,!0))return{code:I.PARAMS_ERROR};if(this._crtRoom)return{code:I.REPERT_JOIN_ROOM};const{code:t,data:r}=yield this._context.rtcIdentityChange(e._roomId,cr.ViewerToAnchor,e._livingType);if(t!==S.SUCCESS)return b.error("change room identity error",t),{code:I.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED};yield this._crtAudienceLivingRoom.__destroy(!1);const i=new ft(this._context,this._runtime,e._roomId,r,this._service,this._options,this._releaseCrtRoomObj.bind(this),e._livingType,!0,!0);return this._crtRoom=i,this._crtAudienceLivingRoom=null,{room:i,code:I.SUCCESS,userIds:e.getRemoteUserIds(),tracks:i.getRemoteTracks()}})}downgradeToAudienceRoom(e){return B(this,void 0,void 0,function*(){if(!me("room._roomId",e._roomId,Ve,!0))return{code:I.PARAMS_ERROR};if(this._crtAudienceLivingRoom)return{code:I.REPERT_JOIN_ROOM};const{code:t,data:r}=yield this._context.rtcIdentityChange(e._roomId,cr.AnchorToViewer,e.getLivingType());if(t!==S.SUCCESS)return b.error("change room identity error",t),{code:I.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED};b.info(`downgradeToAudienceRoom success, room data: ${JSON.stringify(r)}`);const i=new la(this._context,this._runtime,this._options,e._roomId,r,e.getLivingType());return this._crtAudienceLivingRoom=i,this._crtRoom.__destroy(!1),this._crtRoom=null,{room:i,code:I.SUCCESS,userIds:i.getRemoteUserIds(),RTCTracks:i.getRemoteRTCTracks(),MCUTracks:i.getRemoteMCUTracks(),CDNUris:i.getCDNInfo()}})}getJoinedRoomInfo(){return B(this,void 0,void 0,function*(){const{code:e,data:t}=yield this._context.getRTCJoinedUserInfo(this._context.getCurrentId());return e!==S.SUCCESS?(b.error("getJoinedUserInfo error",e),{code:I.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}):{code:I.SUCCESS,data:t}})}}var pa;(function(n){n[n.SERVER_KICK=1]="SERVER_KICK",n[n.OTHER_KICK=2]="OTHER_KICK"})(pa||(pa={}));const Dl={tag:"RCRTC",verify:n=>n.tag!=="browser"?(b.error(`RCRTC Plugin is not support the runtime '${n.tag}'`),!1):Cl?(Tt.add("plugin-rtc","5.3.1"),!!Tt.validEngine("5.1.0")||(b.error(`The current engine version '${Tt.getInfo().engine}' error, plugin-rtc required engine version at least '5.1.0'.`),!1)):(b.error("Please use the https protocol or use `http://localhost` to open the page!"),!1),setup:(n,e,t={})=>(b.setLogLevel(t.logLevel),b.setLogStdout(t.logStdout),b.warn("RCRTC Version: 5.3.1, Commit: e1af0f5ccb06a0084c94e1219d8af54c9793c06b"),b.warn(`browserInfo.browser -> ${Ge.browser}`),b.warn(`browserInfo.supportsUnifiedPlan -> ${Ge.supportsUnifiedPlan}`),b.warn(`browserInfo.version -> ${Ge.version}`),Ie("options.mediaServer",t.mediaServer,r=>!(!mn(r)||location.protocol==="https:"&&!/^https/.test(r))),Ie("options.timeout",t.timeout,r=>_e(r)&&r>=5e3&&r<=3e4),Ie("options.pingGap",t.pingGap,r=>_e(r)&&r>=3e3&&r<=1e4),new Ul(n,e,t))},xl={transResolution:nt,transFrameRate:rt,parseTrackId:Pe,ifSupportLocalFileTrack:$c,ifSupportScreenShare:jc},Ye=ma({user:null});function Vl(n){return{all:n=n||new Map,on:function(e,t){var r=n.get(e);r?r.push(t):n.set(e,[t])},off:function(e,t){var r=n.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):n.set(e,[]))},emit:function(e,t){var r=n.get(e);r&&r.slice().map(function(i){i(t)}),(r=n.get("*"))&&r.slice().map(function(i){i(e,t)})}}}const fa={"RC:Chatroom:Welcome":"Welcome","RC:TxtMsg":"Text","RC:Chatroom:Barrage":"Barrage","RC:Chatroom:Like":"Like","RC:Chatroom:SeatsCtrl":"SeatsCtrl","RC:Chatroom:ChatBan":"ChatBan","RC:Chatroom:SeatApply":"SeatApply","RC:Chatroom:SeatResponse":"SeatResponse","RM:RTC:TrackUnpublish":"TrackUnpublish","RM:RTC:SwitchRole":"SwitchRole","RM:RTC:UserLeave":"UserLeave","RC:Chatroom:Leave":"Leave","RC:ForcedOffline":"ForcedOffline","RC:LookerLoginOut":"LookerLoginOut","RC:Chatroom:downSeat":"DownSeat"};var Jc=Vl();const Wc="start-live-time",Zc="start-live-status",Bl="video-deviceId",Fl="audio-deviceId",Hl="audio-device-volume",$=ma({roomUid:sessionStorage.getItem("roomUid")||"",imConnectStatus:"connecting",screenShareStatus:!1,videoRef:pu(null),rtcClient:null,joinedRoom:null,mediaStreamTrack:[],mediaStreams:null,videoStatus:"init",microphones:[],cameras:[],selectedCamera:null,selectedMicrophone:null,likeCount:0,lookCount:0,lastLikeCount:0,activeTracks:{},allowSeatsCtrl:!0,allowChatCtrl:!0,deviceStatus:{microphone:"init",camera:"init",screen:"init"},syncLikeTimer:null}),$l="c9kqb3rdc451j";qd({appkey:$l});const jl=bt("RC:Chatroom:SeatsCtrl",!0,!0),Kl=bt("RC:Chatroom:ChatBan",!0,!0),ql=bt("RC:Chatroom:SeatApply",!0,!0),Gl=bt("RC:Chatroom:SeatResponse",!0,!0),Yl=bt("RC:Chatroom:MemberCount",!0,!0),zl=bt("RC:Chatroom:SeatMember",!0,!0),Jl=bt("RC:Chatroom:LikeCount",!0,!0),An=Ee,Qo=An,{MESSAGES:dh}=Qo,Wl=Zo(Qo,["MESSAGES"]);wn(An.MESSAGES,n=>{var t;console.log(n,"\u6536\u5230\u6D88\u606F");const{messages:e}=n;for(const r of e)!(r.senderUserId&&Number(r.senderUserId)===((t=Ye.user)==null?void 0:t.speakerId))&&fa[r.messageType]&&Jc.emit(fa[r.messageType],kn(_t({},r.content),{$EventMessage:r}))});for(const n of Object.values(Wl))wn(n,e=>{console.log(n,e),Jc.emit(n,{$EventMessage:null})});wn(An.CONNECTING,()=>{console.log("connecting"),$.imConnectStatus="connecting"});wn(An.CONNECTED,()=>{console.log("connected"),$.imConnectStatus="connected"});wn(An.DISCONNECT,()=>{console.log("disconnect"),$.imConnectStatus="disconnect",$.joinedRoom&&$.videoStatus==="liveing"&&Qc(!0)});const lh=async n=>{var e;try{const t=await Yd(n);return $.rtcClient=Gd(Dl,{}),console.log("connect success",(e=t.data)==null?void 0:e.userId),t}catch(t){throw t}},hh=n=>{localStorage.setItem(Hl,n.toString()),$.videoRef&&($.videoRef.volume=n/100),$.activeTracks.microphone&&$.activeTracks.microphone._element&&($.activeTracks.microphone._element.volume=n/100)},Zl=async()=>{var n;if($.screenShareStatus){ct.error("\u6B63\u5728\u5C4F\u5E55\u5171\u4EAB\u4E2D\uFF0C\u8BF7\u5148\u5173\u95ED\u5C4F\u5E55\u5171\u4EAB");return}if($.rtcClient&&!$.screenShareStatus&&$.videoStatus==="liveing"){let e;try{e=await Hr("screen")}catch{ct.error("\u5C4F\u5E55\u5206\u4EAB\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6388\u6743")}if(!e)return;const t=$.activeTracks.camera;t&&await((n=$.joinedRoom)==null?void 0:n.unpublish([t])),mt([e],"screen"),$.videoRef&&(e==null||e.play($.videoRef),$.screenShareStatus=!0),e==null||e.on(ue.EVENT_LOCAL_TRACK_END,r=>{$.screenShareStatus=!1,r.destroy(),t&&(mt([t],"camera"),$.videoRef&&t.play($.videoRef))})}},Ql=()=>{const n=$.activeTracks.screen;n&&(n.destroy(),$.screenShareStatus=!1);const e=$.activeTracks.camera;e&&(mt([e],"camera"),$.videoRef&&e.play($.videoRef))},Xl=async()=>{if($.screenShareStatus)try{await fu.confirm("\u662F\u5426\u786E\u8BA4\u53D6\u6D88\u5C4F\u5E55\u5171\u4EAB?"),Ql()}catch{}else Zl()},ph=async()=>{const n=await jo.getMicrophones();return $.microphones=n,n},fh=async()=>{const n=await jo.getCameras();return $.cameras=n,n},gh=async n=>{$.selectedCamera=n,localStorage.setItem(Bl,n.deviceId);const e=$.activeTracks.camera;e&&await $r([e],"camera",e.isPublished());const t=await Hr("camera");mt([t],"camera",$.videoStatus==="liveing")},mh=async n=>{$.selectedMicrophone=n,localStorage.setItem(Fl,n.deviceId);const e=$.activeTracks.microphone;e&&await $r([e],"microphone",e.isPublished());const t=await Hr("microphone");mt([t],"microphone",$.videoStatus==="liveing")},Hr=async n=>{var r,i,o,s,u;let e,t=null;if(n==="microphone"?e=await((i=$.rtcClient)==null?void 0:i.createMicrophoneAudioTrack("RongCloudRTC",{micphoneId:(r=$.selectedMicrophone)==null?void 0:r.deviceId})):n==="camera"?e=await((s=$.rtcClient)==null?void 0:s.createCameraVideoTrack("RongCloudRTC",{cameraId:(o=$.selectedCamera)==null?void 0:o.deviceId,faceMode:"user",frameRate:Ze.FPS_24,resolution:ge.W1920_H1080})):e=await((u=$==null?void 0:$.rtcClient)==null?void 0:u.createScreenVideoTrack("screenshare",{frameRate:Ze.FPS_24,resolution:ge.W1920_H1080})),t=e==null?void 0:e.track,(n==="camera"&&!$.cameras.length||n==="microphone"&&!$.microphones.length||n==="screen"&&!$.screenShareStatus)&&($.deviceStatus[n]="none"),e.code===I.PERMISSION_DENIED?$.deviceStatus[n]="denied":$.deviceStatus[n]="granted",e.code===I.GET_DISPLAY_MEDIA_FAILED)throw new Error("\u83B7\u53D6\u5C4F\u5E55\u5171\u4EAB\u5931\u8D25");return t},mt=async(n,e,t=!0)=>{var r;for(const i of n)$.activeTracks[e]=i;console.log(t),t&&await((r=$.joinedRoom)==null?void 0:r.publish(n.filter(i=>!!i)))},$r=async(n,e,t=!0)=>{var r;t&&await((r=$.joinedRoom)==null?void 0:r.unpublish(n.filter(i=>!!i)));for(const i of n)i==null||i.destroy(),$.activeTracks[e]=null},eh=async(n,e,t)=>{var i,o;await Jd(n,{count:-1});const r=await((i=$.rtcClient)==null?void 0:i.joinLivingRoom(n,e));if((r==null?void 0:r.code)!=I.SUCCESS)throw Error("\u52A0\u5165\u623F\u95F4\u5931\u8D25");return(o=r.room)==null||o.registerRoomEventListener(t),r},_h=async(n,e,t)=>await eh(n,e,t),vh=async(n=!0)=>{var t;if($.videoStatus!=="stream"){const r="\u8BF7\u786E\u5B9A\u6444\u50CF\u5934\u5DF2\u7ECF\u5F00\u542F";throw ct.error(r),Error(r)}$.joinedRoom&&(await mt([$.activeTracks.camera],"camera"),await mt([$.activeTracks.microphone],"microphone"),await Yt.get("/api-web/imLiveBroadcastRoom/opsLiveVideo",{params:{type:"1",roomUid:$.roomUid,userId:(t=Ye.user)==null?void 0:t.speakerId}}),$.videoStatus="liveing"),n&&sessionStorage.setItem(Wc,gu().valueOf().toString()),sessionStorage.setItem(Zc,"liveing")},Qc=async(n=!1)=>{var e,t;await Yt.get("/api-web/imLiveBroadcastRoom/opsLiveVideo",{params:{type:"2",roomUid:$.roomUid,userId:(e=Ye.user)==null?void 0:e.speakerId}}),sessionStorage.removeItem(Wc),sessionStorage.removeItem(Zc);for(const r in $.activeTracks)if(Object.prototype.hasOwnProperty.call($.activeTracks,r)){const i=$.activeTracks[r];i&&(await((t=$.joinedRoom)==null?void 0:t.unpublish([i])),n&&await $r([i],r))}$.videoStatus="stream"},th=async()=>{if(Ye.user)try{await Yt.get("/api-web/imLiveBroadcastRoom/syncLike",{hideLoading:!0,hideMessage:!0,params:{likeNum:$.likeCount,roomUid:$.roomUid}}),$.lastLikeCount=$.likeCount,rh({count:$.likeCount},"LikeCount")}catch{}$.syncLikeTimer=setTimeout(()=>{th()},1e3*10)},nh=()=>{var n,e,t,r;return{id:String((n=Ye.user)==null?void 0:n.speakerId),name:(e=Ye.user)==null?void 0:e.speakerName,userId:String((t=Ye.user)==null?void 0:t.speakerId),userName:(r=Ye.user)==null?void 0:r.speakerName}},rh=async(n,e="text")=>{var i;let t=null;if(!n)return;const r={conversationType:J.CHATROOM,targetId:(i=$.joinedRoom)==null?void 0:i._roomId};if(e==="text"?t=new Xd({user:nh(),content:n}):e==="SeatsCtrl"?t=new jl(n):e==="ChatBan"?t=new Kl(n):e==="SeatApply"?t=new ql(n):e==="SeatResponse"?t=new Gl(n):e==="MemberCount"?t=new Yl(n):e==="SeatMember"?t=new zl(n):e==="LikeCount"&&(t=new Jl(n)),!!t)return console.log(t),await ic(r,t)},ih=async(n,e=!0)=>{var t;if(n==="microphone"&&$.activeTracks[n])(t=$.activeTracks[n])==null||t.unmute();else{const r=await Hr(n);await mt([r],n,e),$.videoRef&&(r==null||r.play($.videoRef))}},$i=async(n,e=!0)=>{const t=$.activeTracks[n];n!=="microphone"?await $r([t],n,e):t==null||t.mute()},Rh=async n=>{if($.screenShareStatus){await Xl();return}const e=$.activeTracks[n],t=$.videoStatus==="liveing";e?(n==="camera"&&($.deviceStatus.camera="closed"),$i(n,t)):(n==="camera"&&($.deviceStatus.camera="granted"),ih(n,t))},Eh=async()=>{await Qc(!0),Xc()},Xc=async()=>{var n;$.joinedRoom&&(await((n=$.rtcClient)==null?void 0:n.leaveRoom($.joinedRoom)),$.joinedRoom=null,zd(),$.imConnectStatus="disconnect")},Yt=mu({requestType:"form",timeout:1e4});Yt.interceptors.request.use((n,e)=>{e.hideLoading||!1||Ou();const r=_a(),i=localStorage.getItem("tenantId")||"",o=localStorage.getItem("organId")||"",s={};return r&&!["/api-auth/usernameLogin","/api-auth/smsLogin","/api-auth/code/sendSms"].includes(n)&&(s.Authorization=r),i&&(s.tenantId=i),o&&(s.organId=o),{url:n,options:kn(_t({},e),{params:_u(e.params),headers:_t(_t({},e.headers),s)})}});Yt.interceptors.response.use(async(n,e)=>{setTimeout(()=>{Nu()},200);let t=e.hideMessage||!1;if(new URL(n.url),n.status>299||n.status<200){const i="\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u72B6\u6001\u7801"+n.status;throw t||ct.error(i),new Error(i)}const r=await n.clone().json();if(r.code!==200&&r.errCode!==0){const i=r.msg||"\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";if(r.code===401||r.code===403){t||ct.error("\u767B\u5F55\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\uFF01");try{await Xc(),$i("camera"),$i("microphone"),Ye.user=null}catch{}$.syncLikeTimer&&clearTimeout($.syncLikeTimer),va(),fn.push("/login")}throw r.code===404&&(t||ct.error("\u8BF7\u6C42\u8D44\u6E90\u4E0D\u5B58\u5728\uFF01"),fn.push("/404")),r.code===403||r.code===401||t||ct.error(i),new Error(i)}return n});const oh=["/login"];fn.beforeEach(async(n,e,t)=>{var i;if(_a())if(n.path==="/login")t({path:"/"});else if((i=Ye.user)==null?void 0:i.speakerId)t();else try{const s=sessionStorage.getItem("roomUid"),u=await Yt.get("/api-web/imLiveBroadcastRoom/speakerJoinRoom",{params:{roomUid:s}});Ye.user=u.data,t(kn(_t({},n),{replace:!0}))}catch(s){s.msg&&ct.error(s.msg),va(),t(`/login?${ir.stringify(n.query)}`)}else oh.indexOf(n.path)!==-1?t():t(`/login?${ir.stringify(n.query)}`)});fn.afterEach(()=>{});vu(Eu).use(bu).use(fn).mount("#app");export{Fl as A,nh as B,uh as C,fa as L,Wc as S,I as T,Bl as V,ah as __vite_legacy_guard,$ as a,va as b,$i as c,vh as d,Qc as e,hh as f,gh as g,Xl as h,mh as i,th as j,Jc as k,Eh as l,Zc as m,lh as n,ih as o,ph as p,fh as q,Yt as r,Ye as s,Rh as t,Hr as u,_h as v,et as w,mt as x,Hl as y,rh as z};