=Q){z(i,o,n,!0);continue}let a;if(null!=i.key)a=h.get(i.key);else for(C=d;C<=u;C++)if(0===y[C-d]&&sr(i,e[C])){a=C;break}void 0===a?z(i,o,n,!0):(y[a-d]=c+1,a>=m?m=a:f=!0,p(i,e[a],t,null,o,n,r,s,g),B++)}const D=f?function(A){const e=A.slice(),t=[0];let i,o,n,r,s;const a=A.length;for(i=0;i>1,A[t[s]]0&&(e[i]=t[n-1]),t[n]=i)}}n=t.length,r=t[n-1];for(;n-- >0;)t[n]=r,r=e[r];return t}(y):a;for(C=D.length-1,c=Q-1;c>=0;c--){const A=d+c,a=e[A],I=A+1{const{el:r,type:s,transition:a,children:g,shapeFlag:c}=A;if(6&c)return void W(A.component.subTree,e,i,o);if(128&c)return void A.suspense.move(e,i,o);if(64&c)return void s.move(A,e,i,oA);if(s===Kn){t(r,e,i);for(let A=0;A a.enter(r),n);else{const{leave:A,delayLeave:o,afterLeave:n}=a,s=()=>t(r,e,i),g=()=>{A(r,()=>{s(),n&&n()})};o?o(r,s,g):g()}else t(r,e,i)},z=(A,e,t,i=!1,o=!1)=>{const{type:n,props:r,ref:s,children:a,dynamicChildren:g,shapeFlag:c,patchFlag:l,dirs:I}=A;if(null!=s&&Gn(s,null,t,A,!0),256&c)return void e.ctx.deactivate(A);const u=1&c&&I,E=!Bo(A);let d;if(E&&(d=r&&r.onVnodeBeforeUnmount)&&pr(d,e,A),6&c)$(A.component,t,i);else{if(128&c)return void A.suspense.unmount(t,i);u&&oo(A,null,e,"beforeUnmount"),64&c?A.type.remove(A,e,t,o,oA,i):g&&(n!==Kn||l>0&&64&l)?AA(g,e,t,!1,!0):(n===Kn&&384&l||!o&&16&c)&&AA(a,e,t),i&&Z(A)}(E&&(d=r&&r.onVnodeUnmounted)||u)&&kn(()=>{d&&pr(d,e,A),u&&oo(A,null,e,"unmounted")},t)},Z=A=>{const{type:e,el:t,anchor:o,transition:n}=A;if(e===Kn)return void X(t,o);if(e===Zn)return void w(A);const r=()=>{i(t),n&&!n.persisted&&n.afterLeave&&n.afterLeave()};if(1&A.shapeFlag&&n&&!n.persisted){const{leave:e,delayLeave:i}=n,o=()=>e(t,r);i?i(A.el,r,o):o()}else r()},X=(A,e)=>{let t;for(;A!==e;)t=C(A),i(A),A=t;i(e)},$=(A,e,t)=>{const{bum:i,scope:o,update:n,subTree:r,um:s}=A;i&&F(i),o.stop(),n&&(n.active=!1,z(r,A,e,t)),s&&kn(s,e),kn(()=>{A.isUnmounted=!0},e),e&&e.pendingBranch&&!e.isUnmounted&&A.asyncDep&&!A.asyncResolved&&A.suspenseId===e.pendingId&&(e.deps--,0===e.deps&&e.resolve())},AA=(A,e,t,i=!1,o=!1,n=0)=>{for(let r=n;r 6&A.shapeFlag?eA(A.component.subTree):128&A.shapeFlag?A.suspense.next():C(A.anchor||A.el);let tA=!1;const iA=(A,e,t)=>{null==A?e._vnode&&z(e._vnode,null,null,!0):p(e._vnode||null,A,e,null,null,null,t),tA||(tA=!0,yi(),Di(),tA=!1),e._vnode=A},oA={p:p,um:z,m:W,r:Z,mt:P,mc:T,pc:V,pbc:k,n:eA,o:A};let nA,rA;e&&([nA,rA]=e(oA));return{render:iA,hydrate:nA,createApp:Cn(iA,nA)}}(A)}function Un({type:A,props:e},t){return"svg"===t&&"foreignObject"===A||"mathml"===t&&"annotation-xml"===A&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Fn({effect:A,update:e},t){A.allowRecurse=e.allowRecurse=t}function On(A,e,t=!1){const i=A.children,o=e.children;if(C(i)&&C(o))for(let n=0;n A&&(A.disabled||""===A.disabled),Yn=A=>"undefined"!=typeof SVGElement&&A instanceof SVGElement,Jn=A=>"function"==typeof MathMLElement&&A instanceof MathMLElement,Hn=(A,e)=>{const t=A&&A.to;if(f(t)){if(e){return e(t)}return null}return t};function qn(A,e,t,{o:{insert:i},m:o},n=2){0===n&&i(A.targetAnchor,e,t);const{el:r,anchor:s,shapeFlag:a,children:g,props:c}=A,l=2===n;if(l&&i(r,e,t),(!l||Pn(c))&&16&a)for(let I=0;I {16&B&&c(Q,A,e,o,n,r,s,a)};C?h(t,g):l&&h(l,I)}else{e.el=A.el;const i=e.anchor=A.anchor,c=e.target=A.target,u=e.targetAnchor=A.targetAnchor,d=Pn(A.props),h=d?t:c,B=d?i:u;if("svg"===r||Yn(c)?r="svg":("mathml"===r||Jn(c))&&(r="mathml"),p?(I(A.dynamicChildren,p,h,o,n,r,s),On(A,e,!0)):a||l(A,e,h,B,o,n,r,s,!1),C)d?e.props&&A.props&&e.props.to!==A.props.to&&(e.props.to=A.props.to):qn(e,t,i,g,1);else if((e.props&&e.props.to)!==(A.props&&A.props.to)){const A=e.target=Hn(e.props,E);A&&qn(e,A,null,g,0)}else d&&qn(e,c,u,g,1)}jn(e)},remove(A,e,t,i,{um:o,o:{remove:n}},r){const{shapeFlag:s,children:a,anchor:g,targetAnchor:c,target:l,props:I}=A;if(l&&n(c),r&&n(g),16&s){const A=r||!Pn(I);for(let i=0;i 0?$n||a:null,Xn.pop(),$n=Xn[Xn.length-1]||null,er>0&&$n&&$n.push(A),A}function or(A,e,t,i,o,n){return ir(lr(A,e,t,i,o,n,!0))}function nr(A,e,t,i,o){return ir(Ir(A,e,t,i,o,!0))}function rr(A){return!!A&&!0===A.__v_isVNode}function sr(A,e){return A.type===e.type&&A.key===e.key}const ar="__vInternal",gr=({key:A})=>null!=A?A:null,cr=({ref:A,ref_key:e,ref_for:t})=>("number"==typeof A&&(A=""+A),null!=A?f(A)||jt(A)||p(A)?{i:Ni,r:A,k:e,f:!!t}:A:null);function lr(A,e=null,t=null,i=0,o=null,n=(A===Kn?0:1),r=!1,s=!1){const a={__v_isVNode:!0,__v_skip:!0,type:A,props:e,key:e&&gr(e),ref:e&&cr(e),scopeId:bi,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:n,patchFlag:i,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Ni};return s?(Br(a,t),128&n&&A.normalize(a)):t&&(a.shapeFlag|=f(t)?8:16),er>0&&!r&&$n&&(a.patchFlag>0||6&n)&&32!==a.patchFlag&&$n.push(a),a}const Ir=function(A,e=null,t=null,i=0,o=null,n=!1){A&&A!==Hi||(A=zn);if(rr(A)){const i=ur(A,e,!0);return t&&Br(i,t),er>0&&!n&&$n&&(6&i.shapeFlag?$n[$n.indexOf(A)]=i:$n.push(i)),i.patchFlag|=-2,i}r=A,p(r)&&"__vccOpts"in r&&(A=A.__vccOpts);var r;if(e){e=function(A){return A?Ot(A)||ar in A?u({},A):A:null}(e);let{class:A,style:t}=e;A&&!f(A)&&(e.class=XA(A)),y(t)&&(Ot(t)&&!C(t)&&(t=u({},t)),e.style=ZA(t))}const s=f(A)?1:Ki(A)?128:(A=>A.__isTeleport)(A)?64:y(A)?4:p(A)?2:0;return lr(A,e,t,i,o,s,n,!0)};function ur(A,e,t=!1){const{props:i,ref:o,patchFlag:n,children:r}=A,s=e?Qr(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:A.type,props:s,key:s&&gr(s),ref:e&&e.ref?t&&o?C(o)?o.concat(cr(e)):[o,cr(e)]:cr(e):o,scopeId:A.scopeId,slotScopeIds:A.slotScopeIds,children:r,target:A.target,targetAnchor:A.targetAnchor,staticCount:A.staticCount,shapeFlag:A.shapeFlag,patchFlag:e&&A.type!==Kn?-1===n?16:16|n:n,dynamicProps:A.dynamicProps,dynamicChildren:A.dynamicChildren,appContext:A.appContext,dirs:A.dirs,transition:A.transition,component:A.component,suspense:A.suspense,ssContent:A.ssContent&&ur(A.ssContent),ssFallback:A.ssFallback&&ur(A.ssFallback),el:A.el,anchor:A.anchor,ctx:A.ctx,ce:A.ce}}function Er(A=" ",e=0){return Ir(Wn,null,A,e)}function dr(A="",e=!1){return e?(Ar(),nr(zn,null,A)):Ir(zn,null,A)}function hr(A){return null==A||"boolean"==typeof A?Ir(zn):C(A)?Ir(Kn,null,A.slice()):"object"==typeof A?Cr(A):Ir(Wn,null,String(A))}function Cr(A){return null===A.el&&-1!==A.patchFlag||A.memo?A:ur(A)}function Br(A,e){let t=0;const{shapeFlag:i}=A;if(null==e)e=null;else if(C(e))t=16;else if("object"==typeof e){if(65&i){const t=e.default;return void(t&&(t._c&&(t._d=!1),Br(A,t()),t._c&&(t._d=!0)))}{t=32;const i=e._;i||ar in e?3===i&&Ni&&(1===Ni.slots._?e._=1:(e._=2,A.patchFlag|=1024)):e._ctx=Ni}}else p(e)?(e={default:e,_ctx:Ni},t=32):(e=String(e),64&i?(t=16,e=[Er(e)]):t=8);A.children=e,A.shapeFlag|=t}function Qr(...A){const e={};for(let t=0;t yr||Ni;let vr,wr;{const A=Y(),e=(e,t)=>{let i;return(i=A[e])||(i=A[e]=[]),i.push(t),A=>{i.length>1?i.forEach(e=>e(A)):i[0](A)}};vr=e("__VUE_INSTANCE_SETTERS__",A=>yr=A),wr=e("__VUE_SSR_SETTERS__",A=>Tr=A)}const Sr=A=>{const e=yr;return vr(A),A.scope.on(),()=>{A.scope.off(),vr(e)}},Mr=()=>{yr&&yr.scope.off(),vr(null)};function Rr(A){return 4&A.vnode.shapeFlag}let _r,Tr=!1;function Nr(A,e,t){p(e)?A.type.__ssrInlineRender?A.ssrRender=e:A.render=e:y(e)&&(A.setupState=Ai(e)),br(A,t)}function br(A,e,t){const i=A.type;if(!A.render){if(!e&&_r&&!i.render){const e=i.template||sn(A).template;if(e){const{isCustomElement:t,compilerOptions:o}=A.appContext.config,{delimiters:n,compilerOptions:r}=i,s=u(u({isCustomElement:t,delimiters:n},o),r);i.render=_r(e,s)}}A.render=i.render||g}{const e=Sr(A);ke();try{on(A)}finally{Le(),e()}}}function Gr(A){const e=e=>{A.exposed=e||{}};return{get attrs(){return function(A){return A.attrsProxy||(A.attrsProxy=new Proxy(A.attrs,{get:(e,t)=>(Ve(A,0,"$attrs"),e[t])}))}(A)},slots:A.slots,emit:A.emit,expose:e}}function kr(A){if(A.exposed)return A.exposeProxy||(A.exposeProxy=new Proxy(Ai(Pt(A.exposed)),{get:(e,t)=>t in e?e[t]:t in zo?zo[t](A):void 0,has:(A,e)=>e in A||e in zo}))}function Lr(A,e=!0){return p(A)?A.displayName||A.name:A.name||e&&A.__name}const Ur=(A,e)=>{const t=function(A,e,t=!1){let i,o;const n=p(A);return n?(i=A,o=g):(i=A.get,o=A.set),new Ht(i,o,n||!o,t)}(A,0,Tr);return t};function Fr(A,e,t=s){const i=Dr(),o=N(e),n=G(e),r=new ei((r,s)=>{let a;return $i(()=>{const t=A[e];U(a,t)&&(a=t,s())},null,{flush:"sync"}),{get:()=>(r(),t.get?t.get(a):a),set(A){const r=i.vnode.props;r&&(e in r||o in r||n in r)&&(`onUpdate:${e}`in r||`onUpdate:${o}`in r||`onUpdate:${n}`in r)||!U(A,a)||(a=A,s()),i.emit(`update:${e}`,t.set?t.set(A):A)}}});const a="modelValue"===e?"modelModifiers":`${e}Modifiers`;return r[Symbol.iterator]=()=>{let e=0;return{next:()=>e<2?{value:e++?A[a]||{}:r,done:!1}:{done:!0}}},r}function Or(A,e,t){const i=arguments.length;return 2===i?y(e)&&!C(e)?rr(e)?Ir(A,null,[e]):Ir(A,e):Ir(A,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):3===i&&rr(t)&&(t=[t]),Ir(A,e,t))}const xr="3.4.21",Pr="undefined"!=typeof document?document:null,Yr=Pr&&Pr.createElement("template"),Jr={insert:(A,e,t)=>{e.insertBefore(A,t||null)},remove:A=>{const e=A.parentNode;e&&e.removeChild(A)},createElement:(A,e,t,i)=>{const o="svg"===e?Pr.createElementNS("http://www.w3.org/2000/svg",A):"mathml"===e?Pr.createElementNS("http://www.w3.org/1998/Math/MathML",A):t?Pr.createElement(A,{is:t}):Pr.createElement(A);return"select"===A&&i&&null!=i.multiple&&o.setAttribute("multiple",i.multiple),o},createText:A=>Pr.createTextNode(A),createComment:A=>Pr.createComment(A),setText:(A,e)=>{A.nodeValue=e},setElementText:(A,e)=>{A.textContent=e},parentNode:A=>A.parentNode,nextSibling:A=>A.nextSibling,querySelector:A=>Pr.querySelector(A),setScopeId(A,e){A.setAttribute(e,"")},insertStaticContent(A,e,t,i,o,n){const r=t?t.previousSibling:e.lastChild;if(o&&(o===n||o.nextSibling))for(;e.insertBefore(o.cloneNode(!0),t),o!==n&&(o=o.nextSibling););else{Yr.innerHTML="svg"===i?``:"mathml"===i?``:A;const o=Yr.content;if("svg"===i||"mathml"===i){const A=o.firstChild;for(;A.firstChild;)o.appendChild(A.firstChild);o.removeChild(A)}e.insertBefore(o,t)}return[r?r.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},Hr="transition",qr="animation",Vr=Symbol("_vtc"),jr=(A,{slots:e})=>Or(go,function(A){const e={};for(const u in A)u in Kr||(e[u]=A[u]);if(!1===A.css)return e;const{name:t="v",type:i,duration:o,enterFromClass:n=`${t}-enter-from`,enterActiveClass:r=`${t}-enter-active`,enterToClass:s=`${t}-enter-to`,appearFromClass:a=n,appearActiveClass:g=r,appearToClass:c=s,leaveFromClass:l=`${t}-leave-from`,leaveActiveClass:I=`${t}-leave-active`,leaveToClass:E=`${t}-leave-to`}=A,d=function(A){if(null==A)return null;if(y(A))return[Zr(A.enter),Zr(A.leave)];{const e=Zr(A);return[e,e]}}(o),h=d&&d[0],C=d&&d[1],{onBeforeEnter:B,onEnter:Q,onEnterCancelled:p,onLeave:f,onLeaveCancelled:m,onBeforeAppear:D=B,onAppear:v=Q,onAppearCancelled:w=p}=e,S=(A,e,t)=>{$r(A,e?c:s),$r(A,e?g:r),t&&t()},M=(A,e)=>{A._isLeaving=!1,$r(A,l),$r(A,E),$r(A,I),e&&e()},R=A=>(e,t)=>{const o=A?v:Q,r=()=>S(e,A,t);Wr(o,[e,r]),As(()=>{$r(e,A?a:n),Xr(e,A?c:s),zr(o)||ts(e,i,h,r)})};return u(e,{onBeforeEnter(A){Wr(B,[A]),Xr(A,n),Xr(A,r)},onBeforeAppear(A){Wr(D,[A]),Xr(A,a),Xr(A,g)},onEnter:R(!1),onAppear:R(!0),onLeave(A,e){A._isLeaving=!0;const t=()=>M(A,e);Xr(A,l),document.body.offsetHeight,Xr(A,I),As(()=>{A._isLeaving&&($r(A,l),Xr(A,E),zr(f)||ts(A,i,C,t))}),Wr(f,[A,t])},onEnterCancelled(A){S(A,!1),Wr(p,[A])},onAppearCancelled(A){S(A,!0),Wr(w,[A])},onLeaveCancelled(A){M(A),Wr(m,[A])}})}(A),e);jr.displayName="Transition";const Kr={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};jr.props=u({},ao,Kr);const Wr=(A,e=[])=>{C(A)?A.forEach(A=>A(...e)):A&&A(...e)},zr=A=>!!A&&(C(A)?A.some(A=>A.length>1):A.length>1);function Zr(A){const e=(A=>{const e=f(A)?Number(A):NaN;return isNaN(e)?A:e})(A);return e}function Xr(A,e){e.split(/\s+/).forEach(e=>e&&A.classList.add(e)),(A[Vr]||(A[Vr]=new Set)).add(e)}function $r(A,e){e.split(/\s+/).forEach(e=>e&&A.classList.remove(e));const t=A[Vr];t&&(t.delete(e),t.size||(A[Vr]=void 0))}function As(A){requestAnimationFrame(()=>{requestAnimationFrame(A)})}let es=0;function ts(A,e,t,i){const o=A._endId=++es,n=()=>{o===A._endId&&i()};if(t)return setTimeout(n,t);const{type:r,timeout:s,propCount:a}=function(A,e){const t=window.getComputedStyle(A),i=A=>(t[A]||"").split(", "),o=i(`${Hr}Delay`),n=i(`${Hr}Duration`),r=is(o,n),s=i(`${qr}Delay`),a=i(`${qr}Duration`),g=is(s,a);let c=null,l=0,I=0;e===Hr?r>0&&(c=Hr,l=r,I=n.length):e===qr?g>0&&(c=qr,l=g,I=a.length):(l=Math.max(r,g),c=l>0?r>g?Hr:qr:null,I=c?c===Hr?n.length:a.length:0);const u=c===Hr&&/\b(transform|all)(,|$)/.test(i(`${Hr}Property`).toString());return{type:c,timeout:l,propCount:I,hasTransform:u}}(A,e);if(!r)return i();const g=r+"end";let c=0;const l=()=>{A.removeEventListener(g,I),n()},I=e=>{e.target===A&&++c>=a&&l()};setTimeout(()=>{cos(e)+os(A[t])))}function os(A){return"auto"===A?0:1e3*Number(A.slice(0,-1).replace(",","."))}const ns=Symbol("_vod"),rs=Symbol("_vsh"),ss={beforeMount(A,{value:e},{transition:t}){A[ns]="none"===A.style.display?"":A.style.display,t&&e?t.beforeEnter(A):as(A,e)},mounted(A,{value:e},{transition:t}){t&&e&&t.enter(A)},updated(A,{value:e,oldValue:t},{transition:i}){!e!=!t&&(i?e?(i.beforeEnter(A),as(A,!0),i.enter(A)):i.leave(A,()=>{as(A,!1)}):as(A,e))},beforeUnmount(A,{value:e}){as(A,e)}};function as(A,e){A.style.display=e?A[ns]:"none",A[rs]=!e}const gs=Symbol(""),cs=/(^|;)\s*display\s*:/;const ls=/\s*!important$/;function Is(A,e,t){if(C(t))t.forEach(t=>Is(A,e,t));else if(null==t&&(t=""),t=ms(t),e.startsWith("--"))A.setProperty(e,t);else{const i=function(A,e){const t=Es[e];if(t)return t;let i=N(e);if("filter"!==i&&i in A)return Es[e]=i;i=k(i);for(let o=0;o A.replace(ie,(A,e)=>{if(!e)return A;if(1===ps)return`${e}${Qs}`;const t=function(A,e){const t=Math.pow(10,e+1),i=Math.floor(A*t);return 10*Math.round(i/10)/t}(parseFloat(e)*ps,fs);return 0===t?"0":`${t}${Qs}`}));var Qs,ps,fs;const ms=A=>f(A)?Bs(A):A,ys="http://www.w3.org/1999/xlink";const Ds=Symbol("_vei");function vs(A,e,t,i,o=null){const n=A[Ds]||(A[Ds]={}),r=n[e];if(i&&r)r.value=i;else{const[t,s]=function(A){let e;if(ws.test(A)){let t;for(e={};t=A.match(ws);)A=A.slice(0,A.length-t[0].length),e[t[0].toLowerCase()]=!0}const t=":"===A[2]?A.slice(3):G(A.slice(2));return[t,e]}(e);if(i){const r=n[e]=function(A,e){const t=A=>{if(A._vts){if(A._vts<=t.attached)return}else A._vts=Date.now();const i=e&&e.proxy,o=i&&i.$nne,{value:n}=t;if(o&&C(n)){const t=_s(A,n);for(let i=0;i Ss||(Ms.then(()=>Ss=0),Ss=Date.now());function _s(A,e){if(C(e)){const t=A.stopImmediatePropagation;return A.stopImmediatePropagation=()=>{t.call(A),A._stopped=!0},e.map(A=>{const e=e=>!e._stopped&&A&&A(e);return e.__wwe=A.__wwe,e})}return e}const Ts=A=>111===A.charCodeAt(0)&&110===A.charCodeAt(1)&&A.charCodeAt(2)>96&&A.charCodeAt(2)<123;const Ns=["ctrl","shift","alt","meta"],bs={stop:A=>A.stopPropagation(),prevent:A=>A.preventDefault(),self:A=>A.target!==A.currentTarget,ctrl:A=>!A.ctrlKey,shift:A=>!A.shiftKey,alt:A=>!A.altKey,meta:A=>!A.metaKey,left:A=>"button"in A&&0!==A.button,middle:A=>"button"in A&&1!==A.button,right:A=>"button"in A&&2!==A.button,exact:(A,e)=>Ns.some(t=>A[`${t}Key`]&&!e.includes(t))},Gs=(A,e)=>{const t=A._withMods||(A._withMods={}),i=e.join(".");return t[i]||(t[i]=(t,...i)=>{for(let A=0;A {const t=A._withKeys||(A._withKeys={}),i=e.join(".");return t[i]||(t[i]=t=>{if(!("key"in t))return;const i=G(t.key);return e.some(A=>A===i||ks[A]===i)?A(t):void 0})},Us=u({patchProp:(A,e,t,i,o,n,r,s,a)=>{if(0===e.indexOf("change:"))return function(A,e,t,i=null){if(!t||!i)return;const o=e.replace("change:",""),{attrs:n}=i,r=n[o],s=(A.__wxsProps||(A.__wxsProps={}))[o];if(s===r)return;A.__wxsProps[o]=r;const a=i.proxy;pi(()=>{t(r,s,a.$gcd(a,!0),a.$gcd(a,!1))})}(A,e,i,r);const g="svg"===o;"class"===e?function(A,e,t){const{__wxsAddClass:i,__wxsRemoveClass:o}=A;o&&o.length&&(e=(e||"").split(/\s+/).filter(A=>-1===o.indexOf(A)).join(" "),o.length=0),i&&i.length&&(e=(e||"")+" "+i.join(" "));const n=A[Vr];n&&(e=(e?[e,...n]:[...n]).join(" ")),null==e?A.removeAttribute("class"):t?A.setAttribute("class",e):A.className=e}(A,i,g):"style"===e?function(A,e,t){const i=A.style,o=f(t);let n=!1;if(t&&!o){if(e)if(f(e))for(const A of e.split(";")){const e=A.slice(0,A.indexOf(":")).trim();null==t[e]&&Is(i,e,"")}else for(const A in e)null==t[A]&&Is(i,A,"");for(const A in t)"display"===A&&(n=!0),Is(i,A,t[A])}else if(o){if(e!==t){const A=i[gs];A&&(t+=";"+A),i.cssText=t,n=cs.test(t)}}else e&&A.removeAttribute("style");ns in A&&(A[ns]=n?i.display:"",A[rs]&&(i.display="none"));const{__wxsStyle:r}=A;if(r)for(const s in r)Is(i,s,r[s])}(A,t,i):l(e)?I(e)||vs(A,e,0,i,r):("."===e[0]?(e=e.slice(1),1):"^"===e[0]?(e=e.slice(1),0):function(A,e,t,i){if(i)return"innerHTML"===e||"textContent"===e||!!(e in A&&Ts(e)&&p(t));if("spellcheck"===e||"draggable"===e||"translate"===e)return!1;if("form"===e)return!1;if("list"===e&&"INPUT"===A.tagName)return!1;if("type"===e&&"TEXTAREA"===A.tagName)return!1;if("width"===e||"height"===e){const e=A.tagName;if("IMG"===e||"VIDEO"===e||"CANVAS"===e||"SOURCE"===e)return!1}if(Ts(e)&&f(t))return!1;return e in A}(A,e,i,g))?function(A,e,t,i,o,n,r){if("innerHTML"===e||"textContent"===e)return i&&r(i,o,n),void(A[e]=null==t?"":t);const s=A.tagName;if("value"===e&&"PROGRESS"!==s&&!s.includes("-")){const i=null==t?"":t;return("OPTION"===s?A.getAttribute("value")||"":A.value)===i&&"_value"in A||(A.value=i),null==t&&A.removeAttribute(e),void(A._value=t)}let a=!1;if(""===t||null==t){const i=typeof A[e];"boolean"===i?t=z(t):null==t&&"string"===i?(t="",a=!0):"number"===i&&(t=0,a=!0)}try{A[e]=t}catch(__){}a&&A.removeAttribute(e)}(A,e,i,n,r,s,a):("true-value"===e?A._trueValue=i:"false-value"===e&&(A._falseValue=i),function(A,e,t,i){if(i&&e.startsWith("xlink:"))null==t?A.removeAttributeNS(ys,e.slice(6,e.length)):A.setAttributeNS(ys,e,t);else{const i=W(e);null==t||i&&!z(t)?A.removeAttribute(e):A.setAttribute(e,i?"":t)}}(A,e,i,g))},forcePatchProp:(A,e)=>0===e.indexOf("change:")||("class"===e&&A.__wxsClassChanged?(A.__wxsClassChanged=!1,!0):!("style"!==e||!A.__wxsStyleChanged)&&(A.__wxsStyleChanged=!1,!0))},Jr);let Fs;function Os(){return Fs||(Fs=Ln(Us))}const xs=(...A)=>{Os().render(...A)},Ps=(...A)=>{const e=Os().createApp(...A),{mount:t}=e;return e.mount=A=>{const i=function(A){if(f(A)){return document.querySelector(A)}return A} -/*! - * vue-router v4.4.4 - * (c) 2024 Eduardo San Martin Morote - * @license MIT - */(A);if(!i)return;const o=e._component;p(o)||o.render||o.template||(o.template=i.innerHTML),i.innerHTML="";const n=t(i,!1,function(A){if(A instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&A instanceof MathMLElement)return"mathml"}(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),n},e};const Ys="undefined"!=typeof document;function Js(A){return"object"==typeof A||"displayName"in A||"props"in A||"__vccOpts"in A}const Hs=Object.assign;function qs(A,e){const t={};for(const i in e){const o=e[i];t[i]=js(o)?o.map(A):A(o)}return t}const Vs=()=>{},js=Array.isArray,Ks=/#/g,Ws=/&/g,zs=/\//g,Zs=/=/g,Xs=/\?/g,$s=/\+/g,Aa=/%5B/g,ea=/%5D/g,ta=/%5E/g,ia=/%60/g,oa=/%7B/g,na=/%7C/g,ra=/%7D/g,sa=/%20/g;function aa(A){return encodeURI(""+A).replace(na,"|").replace(Aa,"[").replace(ea,"]")}function ga(A){return aa(A).replace($s,"%2B").replace(sa,"+").replace(Ks,"%23").replace(Ws,"%26").replace(ia,"`").replace(oa,"{").replace(ra,"}").replace(ta,"^")}function ca(A){return ga(A).replace(Zs,"%3D")}function la(A){return null==A?"":function(A){return aa(A).replace(Ks,"%23").replace(Xs,"%3F")}(A).replace(zs,"%2F")}function Ia(A){try{return decodeURIComponent(""+A)}catch(e){}return""+A}const ua=/\/$/;function Ea(A,e,t="/"){let i,o={},n="",r="";const s=e.indexOf("#");let a=e.indexOf("?");return s=0&&(a=-1),a>-1&&(i=e.slice(0,a),n=e.slice(a+1,s>-1?s:e.length),o=A(n)),s>-1&&(i=i||e.slice(0,s),r=e.slice(s,e.length)),i=function(A,e){if(A.startsWith("/"))return A;if(!A)return e;const t=e.split("/"),i=A.split("/"),o=i[i.length-1];".."!==o&&"."!==o||i.push("");let n,r,s=t.length-1;for(n=0;n 1&&s--}return t.slice(0,s).join("/")+"/"+i.slice(n).join("/")}(null!=i?i:e,t),{fullPath:i+(n&&"?")+n+r,path:i,query:o,hash:Ia(r)}}function da(A,e){return e&&A.toLowerCase().startsWith(e.toLowerCase())?A.slice(e.length)||"/":A}function ha(A,e){return(A.aliasOf||A)===(e.aliasOf||e)}function Ca(A,e){if(Object.keys(A).length!==Object.keys(e).length)return!1;for(const t in A)if(!Ba(A[t],e[t]))return!1;return!0}function Ba(A,e){return js(A)?Qa(A,e):js(e)?Qa(e,A):A===e}function Qa(A,e){return js(e)?A.length===e.length&&A.every((A,t)=>A===e[t]):1===A.length&&A[0]===e}const pa={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var fa,ma,ya,Da;function va(A){if(!A)if(Ys){const e=document.querySelector("base");A=(A=e&&e.getAttribute("href")||"/").replace(/^\w+:\/\/[^\/]+/,"")}else A="/";return"/"!==A[0]&&"#"!==A[0]&&(A="/"+A),A.replace(ua,"")}(ma=fa||(fa={})).pop="pop",ma.push="push",(Da=ya||(ya={})).back="back",Da.forward="forward",Da.unknown="";const wa=/^[^#]+#/;function Sa(A,e){return A.replace(wa,"#")+e}const Ma=()=>({left:window.scrollX,top:window.scrollY});function Ra(A){let e;if("el"in A){const t=A.el,i="string"==typeof t&&t.startsWith("#"),o="string"==typeof t?i?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!o)return;e=function(A,e){const t=document.documentElement.getBoundingClientRect(),i=A.getBoundingClientRect();return{behavior:e.behavior,left:i.left-t.left-(e.left||0),top:i.top-t.top-(e.top||0)}}(o,A)}else e=A;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(null!=e.left?e.left:window.scrollX,null!=e.top?e.top:window.scrollY)}function _a(A,e){return(history.state?history.state.position-e:-1)+A}const Ta=new Map;function Na(A,e){const{pathname:t,search:i,hash:o}=e,n=A.indexOf("#");if(n>-1){let e=o.includes(A.slice(n))?A.slice(n).length:1,t=o.slice(e);return"/"!==t[0]&&(t="/"+t),da(t,"")}return da(t,A)+i+o}function ba(A,e,t,i=!1,o=!1){return{back:A,current:e,forward:t,replaced:i,position:window.history.length,scroll:o?Ma():null}}function Ga(A){const{history:e,location:t}=window,i={value:Na(A,t)},o={value:e.state};function n(i,n,r){const s=A.indexOf("#"),a=s>-1?(t.host&&document.querySelector("base")?A:A.slice(s))+i:location.protocol+"//"+location.host+A+i;try{e[r?"replaceState":"pushState"](n,"",a),o.value=n}catch(g){console.error(g),t[r?"replace":"assign"](a)}}return o.value||n(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0),{location:i,state:o,push:function(A,t){const r=Hs({},o.value,e.state,{forward:A,scroll:Ma()});n(r.current,r,!0),n(A,Hs({},ba(i.value,A,null),{position:r.position+1},t),!1),i.value=A},replace:function(A,t){n(A,Hs({},e.state,ba(o.value.back,A,o.value.forward,!0),t,{position:o.value.position}),!0),i.value=A}}}function ka(A){const e=Ga(A=va(A)),t=function(A,e,t,i){let o=[],n=[],r=null;const s=({state:n})=>{const s=Na(A,location),a=t.value,g=e.value;let c=0;if(n){if(t.value=s,e.value=n,r&&r===a)return void(r=null);c=g?n.position-g.position:0}else i(s);o.forEach(A=>{A(t.value,a,{delta:c,type:fa.pop,direction:c?c>0?ya.forward:ya.back:ya.unknown})})};function a(){const{history:A}=window;A.state&&A.replaceState(Hs({},A.state,{scroll:Ma()}),"")}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",a,{passive:!0}),{pauseListeners:function(){r=t.value},listen:function(A){o.push(A);const e=()=>{const e=o.indexOf(A);e>-1&&o.splice(e,1)};return n.push(e),e},destroy:function(){for(const A of n)A();n=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",a)}}}(A,e.state,e.location,e.replace);const i=Hs({location:"",base:A,go:function(A,e=!0){e||t.pauseListeners(),history.go(A)},createHref:Sa.bind(null,A)},e,t);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function La(A){return"string"==typeof A||"symbol"==typeof A}const Ua=Symbol("");var Fa,Oa;function xa(A,e){return Hs(new Error,{type:A,[Ua]:!0},e)}function Pa(A,e){return A instanceof Error&&Ua in A&&(null==e||!!(A.type&e))}(Oa=Fa||(Fa={}))[Oa.aborted=4]="aborted",Oa[Oa.cancelled=8]="cancelled",Oa[Oa.duplicated=16]="duplicated";const Ya="[^/]+?",Ja={sensitive:!1,strict:!1,start:!0,end:!0},Ha=/[.+*?^${}()[\]/\\]/g;function qa(A,e){let t=0;for(;t e.length?1===e.length&&80===e[0]?1:-1:0}function Va(A,e){let t=0;const i=A.score,o=e.score;for(;t 0&&e[e.length-1]<0}const Ka={type:0,value:""},Wa=/[a-zA-Z0-9_]/;function za(A,e,t){const i=function(A,e){const t=Hs({},Ja,e),i=[];let o=t.start?"^":"";const n=[];for(const a of A){const A=a.length?[]:[90];t.strict&&!a.length&&(o+="/");for(let e=0;e 1&&("*"===s||"+"===s)&&e(`A repeatable param (${g}) must be alone in its segment. eg: '/:ids+.`),n.push({type:1,value:g,regexp:c,repeatable:"*"===s||"+"===s,optional:"*"===s||"?"===s})):e("Invalid state to consume buffer"),g="")}function I(){g+=s}for(;a {n(I)}:Vs}function n(A){if(La(A)){const e=i.get(A);e&&(i.delete(A),t.splice(t.indexOf(e),1),e.children.forEach(n),e.alias.forEach(n))}else{const e=t.indexOf(A);e>-1&&(t.splice(e,1),A.record.name&&i.delete(A.record.name),A.children.forEach(n),A.alias.forEach(n))}}function r(A){const e=function(A,e){let t=0,i=e.length;for(;t!==i;){const o=t+i>>1;Va(A,e[o])<0?i=o:t=o+1}const o=function(A){let e=A;for(;e=e.parent;)if(ig(e)&&0===Va(A,e))return e;return}(A);o&&(i=e.lastIndexOf(o,i-1));return i}(A,t);t.splice(e,0,A),A.record.name&&!Ag(A)&&i.set(A.record.name,A)}return e=tg({strict:!1,end:!0,sensitive:!1},e),A.forEach(A=>o(A)),{addRoute:o,resolve:function(A,e){let o,n,r,s={};if("name"in A&&A.name){if(o=i.get(A.name),!o)throw xa(1,{location:A});r=o.record.name,s=Hs(Xa(e.params,o.keys.filter(A=>!A.optional).concat(o.parent?o.parent.keys.filter(A=>A.optional):[]).map(A=>A.name)),A.params&&Xa(A.params,o.keys.map(A=>A.name))),n=o.stringify(s)}else if(null!=A.path)n=A.path,o=t.find(A=>A.re.test(n)),o&&(s=o.parse(n),r=o.record.name);else{if(o=e.name?i.get(e.name):t.find(A=>A.re.test(e.path)),!o)throw xa(1,{location:A,currentLocation:e});r=o.record.name,s=Hs({},e.params,A.params),n=o.stringify(s)}const a=[];let g=o;for(;g;)a.unshift(g.record),g=g.parent;return{name:r,path:n,params:s,matched:a,meta:eg(a)}},removeRoute:n,clearRoutes:function(){t.length=0,i.clear()},getRoutes:function(){return t},getRecordMatcher:function(A){return i.get(A)}}}function Xa(A,e){const t={};for(const i of e)i in A&&(t[i]=A[i]);return t}function $a(A){const e={},t=A.props||!1;if("component"in A)e.default=t;else for(const i in A.components)e[i]="object"==typeof t?t[i]:t;return e}function Ag(A){for(;A;){if(A.record.aliasOf)return!0;A=A.parent}return!1}function eg(A){return A.reduce((A,e)=>Hs(A,e.meta),{})}function tg(A,e){const t={};for(const i in A)t[i]=i in e?e[i]:A[i];return t}function ig({record:A}){return!!(A.name||A.components&&Object.keys(A.components).length||A.redirect)}function og(A){const e={};if(""===A||"?"===A)return e;const t=("?"===A[0]?A.slice(1):A).split("&");for(let i=0;i A&&ga(A)):[i&&ga(i)]).forEach(A=>{void 0!==A&&(e+=(e.length?"&":"")+t,null!=A&&(e+="="+A))})}return e}function rg(A){const e={};for(const t in A){const i=A[t];void 0!==i&&(e[t]=js(i)?i.map(A=>null==A?null:""+A):null==i?i:""+i)}return e}const sg=Symbol(""),ag=Symbol(""),gg=Symbol(""),cg=Symbol(""),lg=Symbol("");function Ig(){let A=[];return{add:function(e){return A.push(e),()=>{const t=A.indexOf(e);t>-1&&A.splice(t,1)}},list:()=>A.slice(),reset:function(){A=[]}}}function ug(A,e,t,i,o,n=A=>A()){const r=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((s,a)=>{const g=A=>{var n;!1===A?a(xa(4,{from:t,to:e})):A instanceof Error?a(A):"string"==typeof(n=A)||n&&"object"==typeof n?a(xa(2,{from:e,to:A})):(r&&i.enterCallbacks[o]===r&&"function"==typeof A&&r.push(A),s())},c=n(()=>A.call(i&&i.instances[o],e,t,g));let l=Promise.resolve(c);A.length<3&&(l=l.then(g)),l.catch(A=>a(A))})}function Eg(A,e,t,i,o=A=>A()){const n=[];for(const r of A)for(const A in r.components){let s=r.components[A];if("beforeRouteEnter"===e||r.instances[A])if(Js(s)){const a=(s.__vccOpts||s)[e];a&&n.push(ug(a,t,i,r,A,o))}else{let a=s();n.push(()=>a.then(n=>{if(!n)throw new Error(`Couldn't resolve component "${A}" at "${r.path}"`);const s=(a=n).__esModule||"Module"===a[Symbol.toStringTag]||a.default&&Js(a.default)?n.default:n;var a;r.mods[A]=n,r.components[A]=s;const g=(s.__vccOpts||s)[e];return g&&ug(g,t,i,r,A,o)()}))}}return n}function dg(A){const e=pn(gg),t=pn(cg),i=Ur(()=>{const t=Xt(A.to);return e.resolve(t)}),o=Ur(()=>{const{matched:A}=i.value,{length:e}=A,o=A[e-1],n=t.matched;if(!o||!n.length)return-1;const r=n.findIndex(ha.bind(null,o));if(r>-1)return r;const s=Cg(A[e-2]);return e>1&&Cg(o)===s&&n[n.length-1].path!==s?n.findIndex(ha.bind(null,A[e-2])):r}),n=Ur(()=>o.value>-1&&function(A,e){for(const t in e){const i=e[t],o=A[t];if("string"==typeof i){if(i!==o)return!1}else if(!js(o)||o.length!==i.length||i.some((A,e)=>A!==o[e]))return!1}return!0}(t.params,i.value.params)),r=Ur(()=>o.value>-1&&o.value===t.matched.length-1&&Ca(t.params,i.value.params));return{route:i,href:Ur(()=>i.value.href),isActive:n,isExactActive:r,navigate:function(t={}){return function(A){if(A.metaKey||A.altKey||A.ctrlKey||A.shiftKey)return;if(A.defaultPrevented)return;if(void 0!==A.button&&0!==A.button)return;if(A.currentTarget&&A.currentTarget.getAttribute){const e=A.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}A.preventDefault&&A.preventDefault();return!0}(t)?e[Xt(A.replace)?"replace":"push"](Xt(A.to)).catch(Vs):Promise.resolve()}}}const hg=Co({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:dg,setup(A,{slots:e}){const t=Nt(dg(A)),{options:i}=pn(gg),o=Ur(()=>({[Bg(A.activeClass,i.linkActiveClass,"router-link-active")]:t.isActive,[Bg(A.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const i=e.default&&e.default(t);return A.custom?i:Or("a",{"aria-current":t.isExactActive?A.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:o.value},i)}}});function Cg(A){return A?A.aliasOf?A.aliasOf.path:A.path:""}const Bg=(A,e,t)=>null!=A?A:null!=e?e:t;function Qg(A,e){if(!A)return null;const t=A(e);return 1===t.length?t[0]:t}const pg=Co({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(A,{attrs:e,slots:t}){const i=pn(lg),o=Ur(()=>A.route||i.value),n=pn(ag,0),r=Ur(()=>{let A=Xt(n);const{matched:e}=o.value;let t;for(;(t=e[A])&&!t.components;)A++;return A}),s=Ur(()=>o.value.matched[r.value]);Qn(ag,Ur(()=>r.value+1)),Qn(sg,s),Qn(lg,o);const a=Kt();return Xi(()=>[a.value,s.value,A.name],([A,e,t],[i,o,n])=>{e&&(e.instances[t]=A,o&&o!==e&&A&&A===i&&(e.leaveGuards.size||(e.leaveGuards=o.leaveGuards),e.updateGuards.size||(e.updateGuards=o.updateGuards))),!A||!e||o&&ha(e,o)&&i||(e.enterCallbacks[t]||[]).forEach(e=>e(A))},{flush:"post"}),()=>{const i=o.value,n=A.name,r=s.value,g=r&&r.components[n];if(!g)return Qg(t.default,{Component:g,route:i});const c=r.props[n],l=c?!0===c?i.params:"function"==typeof c?c(i):c:null,I=Or(g,Hs({},l,e,{onVnodeUnmounted:A=>{A.component.isUnmounted&&(r.instances[n]=null)},ref:a}));return Qg(t.default,{Component:I,route:i})||I}}});function fg(A){const e=Za(A.routes,A),t=A.parseQuery||og,i=A.stringifyQuery||ng,o=A.history,n=Ig(),r=Ig(),s=Ig(),a=Wt(pa);let g=pa;Ys&&A.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=qs.bind(null,A=>""+A),l=qs.bind(null,la),I=qs.bind(null,Ia);function u(A,n){if(n=Hs({},n||a.value),"string"==typeof A){const i=Ea(t,A,n.path),r=e.resolve({path:i.path},n),s=o.createHref(i.fullPath);return Hs(i,r,{params:I(r.params),hash:Ia(i.hash),redirectedFrom:void 0,href:s})}let r;if(null!=A.path)r=Hs({},A,{path:Ea(t,A.path,n.path).path});else{const e=Hs({},A.params);for(const A in e)null==e[A]&&delete e[A];r=Hs({},A,{params:l(e)}),n.params=l(n.params)}const s=e.resolve(r,n),g=A.hash||"";s.params=c(I(s.params));const u=function(A,e){const t=e.query?A(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}(i,Hs({},A,{hash:(E=g,aa(E).replace(oa,"{").replace(ra,"}").replace(ta,"^")),path:s.path}));var E;const d=o.createHref(u);return Hs({fullPath:u,hash:g,query:i===ng?rg(A.query):A.query||{}},s,{redirectedFrom:void 0,href:d})}function E(A){return"string"==typeof A?Ea(t,A,a.value.path):Hs({},A)}function d(A,e){if(g!==A)return xa(8,{from:e,to:A})}function h(A){return B(A)}function C(A){const e=A.matched[A.matched.length-1];if(e&&e.redirect){const{redirect:t}=e;let i="function"==typeof t?t(A):t;return"string"==typeof i&&(i=i.includes("?")||i.includes("#")?i=E(i):{path:i},i.params={}),Hs({query:A.query,hash:A.hash,params:null!=i.path?{}:A.params},i)}}function B(A,e){const t=g=u(A),o=a.value,n=A.state,r=A.force,s=!0===A.replace,c=C(t);if(c)return B(Hs(E(c),{state:"object"==typeof c?Hs({},n,c.state):n,force:r,replace:s}),e||t);const l=t;let I;return l.redirectedFrom=e,!r&&function(A,e,t){const i=e.matched.length-1,o=t.matched.length-1;return i>-1&&i===o&&ha(e.matched[i],t.matched[o])&&Ca(e.params,t.params)&&A(e.query)===A(t.query)&&e.hash===t.hash}(i,o,t)&&(I=xa(16,{to:l,from:o}),T(o,o,!0,!1)),(I?Promise.resolve(I):f(l,o)).catch(A=>Pa(A)?Pa(A,2)?A:_(A):R(A,l,o)).then(A=>{if(A){if(Pa(A,2))return B(Hs({replace:s},E(A.to),{state:"object"==typeof A.to?Hs({},n,A.to.state):n,force:r}),e||l)}else A=y(l,o,!0,s,n);return m(l,o,A),A})}function Q(A,e){const t=d(A,e);return t?Promise.reject(t):Promise.resolve()}function p(A){const e=G.values().next().value;return e&&"function"==typeof e.runWithContext?e.runWithContext(A):A()}function f(A,e){let t;const[i,o,s]=function(A,e){const t=[],i=[],o=[],n=Math.max(e.matched.length,A.matched.length);for(let r=0;r ha(A,n))?i.push(n):t.push(n));const s=A.matched[r];s&&(e.matched.find(A=>ha(A,s))||o.push(s))}return[t,i,o]}(A,e);t=Eg(i.reverse(),"beforeRouteLeave",A,e);for(const n of i)n.leaveGuards.forEach(i=>{t.push(ug(i,A,e))});const a=Q.bind(null,A,e);return t.push(a),L(t).then(()=>{t=[];for(const i of n.list())t.push(ug(i,A,e));return t.push(a),L(t)}).then(()=>{t=Eg(o,"beforeRouteUpdate",A,e);for(const i of o)i.updateGuards.forEach(i=>{t.push(ug(i,A,e))});return t.push(a),L(t)}).then(()=>{t=[];for(const i of s)if(i.beforeEnter)if(js(i.beforeEnter))for(const o of i.beforeEnter)t.push(ug(o,A,e));else t.push(ug(i.beforeEnter,A,e));return t.push(a),L(t)}).then(()=>(A.matched.forEach(A=>A.enterCallbacks={}),t=Eg(s,"beforeRouteEnter",A,e,p),t.push(a),L(t))).then(()=>{t=[];for(const i of r.list())t.push(ug(i,A,e));return t.push(a),L(t)}).catch(A=>Pa(A,8)?A:Promise.reject(A))}function m(A,e,t){s.list().forEach(i=>p(()=>i(A,e,t)))}function y(A,e,t,i,n){const r=d(A,e);if(r)return r;const s=e===pa,g=Ys?history.state:{};t&&(i||s?o.replace(A.fullPath,Hs({scroll:s&&g&&g.scroll},n)):o.push(A.fullPath,n)),a.value=A,T(A,e,t,s),_()}let D;function v(){D||(D=o.listen((A,e,t)=>{if(!k.listening)return;const i=u(A),n=C(i);if(n)return void B(Hs(n,{replace:!0}),i).catch(Vs);g=i;const r=a.value;var s,c;Ys&&(s=_a(r.fullPath,t.delta),c=Ma(),Ta.set(s,c)),f(i,r).catch(A=>Pa(A,12)?A:Pa(A,2)?(B(A.to,i).then(A=>{Pa(A,20)&&!t.delta&&t.type===fa.pop&&o.go(-1,!1)}).catch(Vs),Promise.reject()):(t.delta&&o.go(-t.delta,!1),R(A,i,r))).then(A=>{(A=A||y(i,r,!1))&&(t.delta&&!Pa(A,8)?o.go(-t.delta,!1):t.type===fa.pop&&Pa(A,20)&&o.go(-1,!1)),m(i,r,A)}).catch(Vs)}))}let w,S=Ig(),M=Ig();function R(A,e,t){_(A);const i=M.list();return i.length?i.forEach(i=>i(A,e,t)):console.error(A),Promise.reject(A)}function _(A){return w||(w=!A,v(),S.list().forEach(([e,t])=>A?t(A):e()),S.reset()),A}function T(e,t,i,o){const{scrollBehavior:n}=A;if(!Ys||!n)return Promise.resolve();const r=!i&&function(A){const e=Ta.get(A);return Ta.delete(A),e}(_a(e.fullPath,0))||(o||!i)&&history.state&&history.state.scroll||null;return pi().then(()=>n(e,t,r)).then(A=>A&&Ra(A)).catch(A=>R(A,e,t))}const N=A=>o.go(A);let b;const G=new Set,k={currentRoute:a,listening:!0,addRoute:function(A,t){let i,o;return La(A)?(i=e.getRecordMatcher(A),o=t):o=A,e.addRoute(o,i)},removeRoute:function(A){const t=e.getRecordMatcher(A);t&&e.removeRoute(t)},clearRoutes:e.clearRoutes,hasRoute:function(A){return!!e.getRecordMatcher(A)},getRoutes:function(){return e.getRoutes().map(A=>A.record)},resolve:u,options:A,push:h,replace:function(A){return h(Hs(E(A),{replace:!0}))},go:N,back:()=>N(-1),forward:()=>N(1),beforeEach:n.add,beforeResolve:r.add,afterEach:s.add,onError:M.add,isReady:function(){return w&&a.value!==pa?Promise.resolve():new Promise((A,e)=>{S.add([A,e])})},install(A){A.component("RouterLink",hg),A.component("RouterView",pg),A.config.globalProperties.$router=this,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>Xt(a)}),Ys&&!b&&a.value===pa&&(b=!0,h(o.location).catch(A=>{}));const e={};for(const i in pa)Object.defineProperty(e,i,{get:()=>a.value[i],enumerable:!0});A.provide(gg,this),A.provide(cg,bt(e)),A.provide(lg,a);const t=A.unmount;G.add(A),A.unmount=function(){G.delete(A),G.size<1&&(g=pa,D&&D(),D=null,a.value=pa,b=!1,w=!1),t()}}};function L(A){return A.reduce((A,e)=>A.then(()=>p(e)),Promise.resolve())}return k}function mg(A){return pn(cg)}const yg=["{","}"];const Dg=/^(?:\d)+/,vg=/^(?:\w)+/;const wg="zh-Hans",Sg="zh-Hant",Mg="en",Rg="fr",_g="es",Tg=Object.prototype.hasOwnProperty,Ng=(A,e)=>Tg.call(A,e),bg=new class{constructor(){this._caches=Object.create(null)}interpolate(A,e,t=yg){if(!e)return[A];let i=this._caches[A];return i||(i=function(A,[e,t]){const i=[];let o=0,n="";for(;o -1?wg:A.indexOf("-hant")>-1?Sg:(t=A,["-tw","-hk","-mo","-cht"].find(A=>-1!==t.indexOf(A))?Sg:wg);var t;let i=[Mg,Rg,_g];e&&Object.keys(e).length>0&&(i=Object.keys(e));const o=function(A,e){return e.find(e=>0===A.indexOf(e))}(A,i);return o||void 0}let kg=class{constructor({locale:A,fallbackLocale:e,messages:t,watcher:i,formater:o}){this.locale=Mg,this.fallbackLocale=Mg,this.message={},this.messages={},this.watchers=[],e&&(this.fallbackLocale=e),this.formater=o||bg,this.messages=t||{},this.setLocale(A||Mg),i&&this.watchLocale(i)}setLocale(A){const e=this.locale;this.locale=Gg(A,this.messages)||this.fallbackLocale,this.messages[this.locale]||(this.messages[this.locale]={}),this.message=this.messages[this.locale],e!==this.locale&&this.watchers.forEach(A=>{A(this.locale,e)})}getLocale(){return this.locale}watchLocale(A){const e=this.watchers.push(A)-1;return()=>{this.watchers.splice(e,1)}}add(A,e,t=!0){const i=this.messages[A];i?t?Object.assign(i,e):Object.keys(e).forEach(A=>{Ng(i,A)||(i[A]=e[A])}):this.messages[A]=e}f(A,e,t){return this.formater.interpolate(A,e,t).join("")}t(A,e,t){let i=this.message;return"string"==typeof e?(e=Gg(e,this.messages))&&(i=this.messages[e]):t=e,Ng(i,A)?this.formater.interpolate(i[A],t).join(""):(console.warn(`Cannot translate the value of keypath ${A}. Use the value of keypath as default.`),A)}};function Lg(A,e={},t,i){if("string"!=typeof A){const t=[e,A];A=t[0],e=t[1]}"string"!=typeof A&&(A="undefined"!=typeof uni&&uni.getLocale?uni.getLocale():"undefined"!=typeof global&&global.getLocale?global.getLocale():Mg),"string"!=typeof t&&(t="undefined"!=typeof __uniConfig&&__uniConfig.fallbackLocale||Mg);const o=new kg({locale:A,fallbackLocale:t,messages:e,watcher:i});let n=(A,e)=>{{let A=!1;n=function(e,t){const i=np().$vm;return i&&(i.$locale,A||(A=!0,function(A,e){A.$watchLocale?A.$watchLocale(A=>{e.setLocale(A)}):A.$watch(()=>A.$locale,A=>{e.setLocale(A)})}(i,o))),o.t(e,t)}}return n(A,e)};return{i18n:o,f:(A,e,t)=>o.f(A,e,t),t:(A,e)=>n(A,e),add:(A,e,t=!0)=>o.add(A,e,t),watch:A=>o.watchLocale(A),getLocale:()=>o.getLocale(),setLocale:A=>o.setLocale(A)}}function Ug(A,e){return A.indexOf(e[0])>-1}const Fg=HA(()=>"undefined"!=typeof __uniConfig&&__uniConfig.locales&&!!Object.keys(__uniConfig.locales).length);let Og;function xg(A){return Ug(A,rA)?Jg().f(A,function(){const A=uni.getLocale(),e=__uniConfig.locales;return e[A]||e[__uniConfig.fallbackLocale]||e.en||{}}(),rA):A}function Pg(A,e){if(1===e.length){if(A){const t=A=>f(A)&&Ug(A,rA),i=e[0];let o=[];if(C(A)&&(o=A.filter(A=>t(A[i]))).length)return o;const n=A[e[0]];if(t(n))return A}return}const t=e.shift();return Pg(A&&A[t],e)}function Yg(A,e){const t=Pg(A,e);if(!t)return!1;const i=e[e.length-1];if(C(t))t.forEach(A=>Yg(A,[i]));else{let A=t[i];Object.defineProperty(t,i,{get:()=>xg(A),set(e){A=e}})}return!0}function Jg(){if(!Og){let A;if(A=navigator.cookieEnabled&&window.localStorage&&localStorage[nA]||__uniConfig.locale||navigator.language,Og=Lg(A),Fg()){const e=Object.keys(__uniConfig.locales||{});e.length&&e.forEach(A=>Og.add(A,__uniConfig.locales[A])),Og.setLocale(A)}}return Og}function Hg(A,e,t){return e.reduce((e,i,o)=>(e[A+i]=t[o],e),{})}const qg=HA(()=>{const A="uni.async.",e=["error"];Jg().add(Mg,Hg(A,e,["The connection timed out, click the screen to try again."]),!1),Jg().add(_g,Hg(A,e,["Se agotó el tiempo de conexión, haga clic en la pantalla para volver a intentarlo."]),!1),Jg().add(Rg,Hg(A,e,["La connexion a expiré, cliquez sur l'écran pour réessayer."]),!1),Jg().add(wg,Hg(A,e,["连接服务器超时,点击屏幕重试"]),!1),Jg().add(Sg,Hg(A,e,["連接服務器超時,點擊屏幕重試"]),!1)}),Vg=HA(()=>{const A="uni.showActionSheet.",e=["cancel"];Jg().add(Mg,Hg(A,e,["Cancel"]),!1),Jg().add(_g,Hg(A,e,["Cancelar"]),!1),Jg().add(Rg,Hg(A,e,["Annuler"]),!1),Jg().add(wg,Hg(A,e,["取消"]),!1),Jg().add(Sg,Hg(A,e,["取消"]),!1)}),jg=HA(()=>{const A="uni.showToast.",e=["unpaired"];Jg().add(Mg,Hg(A,e,["Please note showToast must be paired with hideToast"]),!1),Jg().add(_g,Hg(A,e,["Tenga en cuenta que showToast debe estar emparejado con hideToast"]),!1),Jg().add(Rg,Hg(A,e,["Veuillez noter que showToast doit être associé à hideToast"]),!1),Jg().add(wg,Hg(A,e,["请注意 showToast 与 hideToast 必须配对使用"]),!1),Jg().add(Sg,Hg(A,e,["請注意 showToast 與 hideToast 必須配對使用"]),!1)}),Kg=HA(()=>{const A="uni.showLoading.",e=["unpaired"];Jg().add(Mg,Hg(A,e,["Please note showLoading must be paired with hideLoading"]),!1),Jg().add(_g,Hg(A,e,["Tenga en cuenta que showLoading debe estar emparejado con hideLoading"]),!1),Jg().add(Rg,Hg(A,e,["Veuillez noter que showLoading doit être associé à hideLoading"]),!1),Jg().add(wg,Hg(A,e,["请注意 showLoading 与 hideLoading 必须配对使用"]),!1),Jg().add(Sg,Hg(A,e,["請注意 showLoading 與 hideLoading 必須配對使用"]),!1)}),Wg=HA(()=>{const A="uni.showModal.",e=["cancel","confirm"];Jg().add(Mg,Hg(A,e,["Cancel","OK"]),!1),Jg().add(_g,Hg(A,e,["Cancelar","OK"]),!1),Jg().add(Rg,Hg(A,e,["Annuler","OK"]),!1),Jg().add(wg,Hg(A,e,["取消","确定"]),!1),Jg().add(Sg,Hg(A,e,["取消","確定"]),!1)}),zg=HA(()=>{const A="uni.chooseFile.",e=["notUserActivation"];Jg().add(Mg,Hg(A,e,["File chooser dialog can only be shown with a user activation"]),!1),Jg().add(_g,Hg(A,e,["El cuadro de diálogo del selector de archivos solo se puede mostrar con la activación del usuario"]),!1),Jg().add(Rg,Hg(A,e,["La boîte de dialogue du sélecteur de fichier ne peut être affichée qu'avec une activation par l'utilisateur"]),!1),Jg().add(wg,Hg(A,e,["文件选择器对话框只能在由用户激活时显示"]),!1),Jg().add(Sg,Hg(A,e,["文件選擇器對話框只能在由用戶激活時顯示"]),!1)}),Zg=HA(()=>{const A="uni.setClipboardData.",e=["success","fail"];Jg().add(Mg,Hg(A,e,["Content copied","Copy failed, please copy manually"]),!1),Jg().add(_g,Hg(A,e,["Contenido copiado","Error al copiar, copie manualmente"]),!1),Jg().add(Rg,Hg(A,e,["Contenu copié","Échec de la copie, copiez manuellement"]),!1),Jg().add(wg,Hg(A,e,["内容已复制","复制失败,请手动复制"]),!1),Jg().add(Sg,Hg(A,e,["內容已復制","復制失敗,請手動復製"]),!1)}),Xg=HA(()=>{const A="uni.getClipboardData.",e=["fail"];Jg().add(Mg,Hg(A,e,["Reading failed, please paste manually"]),!1),Jg().add(_g,Hg(A,e,["Error de lectura, pegue manualmente"]),!1),Jg().add(Rg,Hg(A,e,["Échec de la lecture, veuillez coller manuellement"]),!1),Jg().add(wg,Hg(A,e,["读取失败,请手动粘贴"]),!1),Jg().add(Sg,Hg(A,e,["讀取失敗,請手動粘貼"]),!1)}),$g=HA(()=>{const A="uni.video.",e=["danmu","volume"];Jg().add(Mg,Hg(A,e,["Danmu","Volume"]),!1),Jg().add(_g,Hg(A,e,["Danmu","Volumen"]),!1),Jg().add(Rg,Hg(A,e,["Danmu","Le Volume"]),!1),Jg().add(wg,Hg(A,e,["弹幕","音量"]),!1),Jg().add(Sg,Hg(A,e,["彈幕","音量"]),!1)}),Ac=HA(()=>{const A="uni.chooseLocation.",e=["search","cancel"];Jg().add(Mg,Hg(A,e,["Find Place","Cancel"]),!1),Jg().add(_g,Hg(A,e,["Encontrar","Cancelar"]),!1),Jg().add(Rg,Hg(A,e,["Trouve","Annuler"]),!1),Jg().add(wg,Hg(A,e,["搜索地点","取消"]),!1),Jg().add(Sg,Hg(A,e,["搜索地點","取消"]),!1)});function ec(A){const e=new Be;return{on:(A,t)=>e.on(A,t),once:(A,t)=>e.once(A,t),off:(A,t)=>e.off(A,t),emit:(A,...t)=>e.emit(A,...t),subscribe(t,i,o=!1){e[o?"once":"on"](`${A}.${t}`,i)},unsubscribe(t,i){e.off(`${A}.${t}`,i)},subscribeHandler(t,i,o){e.emit(`${A}.${t}`,i,o)}}}const tc="invokeViewApi",ic="invokeServiceApi";let oc=1;const nc=Object.create(null);function rc(A,e){return A+"."+e}function sc(A,e,t){e=rc(A,e),nc[e]||(nc[e]=t)}function ac({id:A,name:e,args:t},i){e=rc(i,e);const o=e=>{A&&Ov.publishHandler(tc+"."+A,e)},n=nc[e];n?n(t,o):o({})}const gc=u(ec("service"),{invokeServiceMethod:(A,e,t)=>{const{subscribe:i,publishHandler:o}=Ov,n=t?oc++:0;t&&i(ic+"."+n,t,!0),o(ic,{id:n,name:A,args:e})}}),cc=oe(!0);let lc;function Ic(){lc&&(clearTimeout(lc),lc=null)}let uc=0,Ec=0;function dc(A){if(Ic(),1!==A.touches.length)return;const{pageX:e,pageY:t}=A.touches[0];uc=e,Ec=t,lc=setTimeout(function(){const e=new CustomEvent("longpress",{bubbles:!0,cancelable:!0,target:A.target,currentTarget:A.currentTarget});e.touches=A.touches,e.changedTouches=A.changedTouches,A.target.dispatchEvent(e)},350)}function hc(A){if(!lc)return;if(1!==A.touches.length)return Ic();const{pageX:e,pageY:t}=A.touches[0];return Math.abs(e-uc)>10||Math.abs(t-Ec)>10?Ic():void 0}function Cc(A,e){const t=Number(A);return isNaN(t)?e:t}function Bc(){const A=__uniConfig.globalStyle||{},e=Cc(A.rpxCalcMaxDeviceWidth,960),t=Cc(A.rpxCalcBaseDeviceWidth,375);function i(){let A=function(){const A=/^Apple/.test(navigator.vendor)&&"number"==typeof window.orientation,e=A&&90===Math.abs(window.orientation);var t=A?Math[e?"max":"min"](screen.width,screen.height):screen.width;return Math.min(window.innerWidth,document.documentElement.clientWidth,t)||t}();A=A<=e?A:t,document.documentElement.style.fontSize=A/23.4375+"px"}i(),document.addEventListener("DOMContentLoaded",i),window.addEventListener("load",i),window.addEventListener("resize",i)}function Qc(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var pc,fc,mc=["top","left","right","bottom"],yc={};function Dc(){return fc="CSS"in window&&"function"==typeof CSS.supports?CSS.supports("top: env(safe-area-inset-top)")?"env":CSS.supports("top: constant(safe-area-inset-top)")?"constant":"":""}function vc(){if(fc="string"==typeof fc?fc:Dc()){var A=[],e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e={passive:!0}}});window.addEventListener("test",null,t)}catch(__){}var i=document.createElement("div");o(i,{position:"absolute",left:"0",top:"0",width:"0",height:"0",zIndex:"-1",overflow:"hidden",visibility:"hidden"}),mc.forEach(function(A){r(i,A)}),document.body.appendChild(i),n(),pc=!0}else mc.forEach(function(A){yc[A]=0});function o(A,e){var t=A.style;Object.keys(e).forEach(function(A){var i=e[A];t[A]=i})}function n(e){e?A.push(e):A.forEach(function(A){A()})}function r(A,t){var i=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),a=document.createElement("div"),g={position:"absolute",width:"100px",height:"200px",boxSizing:"border-box",overflow:"hidden",paddingBottom:fc+"(safe-area-inset-"+t+")"};o(i,g),o(r,g),o(s,{transition:"0s",animation:"none",width:"400px",height:"400px"}),o(a,{transition:"0s",animation:"none",width:"250%",height:"250%"}),i.appendChild(s),r.appendChild(a),A.appendChild(i),A.appendChild(r),n(function(){i.scrollTop=r.scrollTop=1e4;var A=i.scrollTop,o=r.scrollTop;function n(){this.scrollTop!==(this===i?A:o)&&(i.scrollTop=r.scrollTop=1e4,A=i.scrollTop,o=r.scrollTop,function(A){Sc.length||setTimeout(function(){var A={};Sc.forEach(function(e){A[e]=yc[e]}),Sc.length=0,Mc.forEach(function(e){e(A)})},0);Sc.push(A)}(t))}i.addEventListener("scroll",n,e),r.addEventListener("scroll",n,e)});var c=getComputedStyle(i);Object.defineProperty(yc,t,{configurable:!0,get:function(){return parseFloat(c.paddingBottom)}})}}function wc(A){return pc||vc(),yc[A]}var Sc=[];var Mc=[];const Rc=Qc({get support(){return 0!=("string"==typeof fc?fc:Dc()).length},get top(){return wc("top")},get left(){return wc("left")},get right(){return wc("right")},get bottom(){return wc("bottom")},onChange:function(A){Dc()&&(pc||vc(),"function"==typeof A&&Mc.push(A))},offChange:function(A){var e=Mc.indexOf(A);e>=0&&Mc.splice(e,1)}}),_c=Gs(()=>{},["prevent"]),Tc=Gs(A=>{},["stop"]);function Nc(A,e){return parseInt((A.getPropertyValue(e).match(/\d+/)||["0"])[0])}function bc(){const A=Nc(document.documentElement.style,"--window-top");return A?A+Rc.top:0}function Gc(){const A=document.documentElement.style,e=bc(),t=Nc(A,"--window-bottom"),i=Nc(A,"--window-left"),o=Nc(A,"--window-right"),n=Nc(A,"--top-window-height");return{top:e,bottom:t?t+Rc.bottom:0,left:i?i+Rc.left:0,right:o?o+Rc.right:0,topWindowHeight:n||0}}function kc(A){const e=document.documentElement.style;Object.keys(A).forEach(t=>{e.setProperty(t,A[t])})}function Lc(A){return kc(A)}function Uc(A){return Symbol(A)}function Fc(A){return-1!==(A+="").indexOf("rpx")||-1!==A.indexOf("upx")}function Oc(A,e=!1){if(e)return function(A){if(!Fc(A))return A;return A.replace(/(\d+(\.\d+)?)[ru]px/g,(A,e)=>uni.upx2px(parseFloat(e))+"px")}(A);if(f(A)){const e=parseInt(A)||0;return Fc(A)?uni.upx2px(e):e}return A}function xc(A){return A.$page}function Pc(A){return 0===A.tagName.indexOf("UNI-")}const Yc="M1.952 18.080q-0.32-0.352-0.416-0.88t0.128-0.976l0.16-0.352q0.224-0.416 0.64-0.528t0.8 0.176l6.496 4.704q0.384 0.288 0.912 0.272t0.88-0.336l17.312-14.272q0.352-0.288 0.848-0.256t0.848 0.352l-0.416-0.416q0.32 0.352 0.32 0.816t-0.32 0.816l-18.656 18.912q-0.32 0.352-0.8 0.352t-0.8-0.32l-7.936-8.064z",Jc="M15.808 0.16q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM15.136 8.672h1.728q0.128 0 0.224 0.096t0.096 0.256l-0.384 10.24q0 0.064-0.048 0.112t-0.112 0.048h-1.248q-0.096 0-0.144-0.048t-0.048-0.112l-0.384-10.24q0-0.16 0.096-0.256t0.224-0.096zM16 23.328q-0.48 0-0.832-0.352t-0.352-0.848 0.352-0.848 0.832-0.352 0.832 0.352 0.352 0.848-0.352 0.848-0.832 0.352z",Hc="M21.781 7.844l-9.063 8.594 9.063 8.594q0.25 0.25 0.25 0.609t-0.25 0.578q-0.25 0.25-0.578 0.25t-0.578-0.25l-9.625-9.125q-0.156-0.125-0.203-0.297t-0.047-0.359q0-0.156 0.047-0.328t0.203-0.297l9.625-9.125q0.25-0.25 0.578-0.25t0.578 0.25q0.25 0.219 0.25 0.578t-0.25 0.578z",qc="M17.25 16.156l7.375-7.313q0.281-0.281 0.281-0.641t-0.281-0.641q-0.25-0.25-0.625-0.25t-0.625 0.25l-7.375 7.344-7.313-7.344q-0.25-0.25-0.625-0.25t-0.625 0.25q-0.281 0.25-0.281 0.625t0.281 0.625l7.313 7.344-7.375 7.344q-0.281 0.25-0.281 0.625t0.281 0.625q0.125 0.125 0.281 0.188t0.344 0.063q0.156 0 0.328-0.063t0.297-0.188l7.375-7.344 7.375 7.406q0.125 0.156 0.297 0.219t0.328 0.063q0.188 0 0.344-0.078t0.281-0.203q0.281-0.25 0.281-0.609t-0.281-0.641l-7.375-7.406z",Vc="M31.562 4.9966666659375q0.435 0.399 0.435 0.87 0.036 0.58-0.399 0.98l-18.61 19.917q-0.145 0.145-0.327 0.217-0.073 0.037-0.145 0.11-0.254 0.035-0.472 0.035-0.29 0-0.544-0.036l-0.145-0.072q-0.109-0.073-0.217-0.182l-0.11-0.072L0.363 16.2786666659375q-0.327-0.399-0.363-0.907 0-0.544 0.363-1.016 0.435-0.326 0.961-0.362 0.527-0.036 0.962 0.362l9.722 9.542L29.712 5.0326666659375q0.399-0.363 0.943-0.363 0.544-0.036 0.907 0.327z";function jc(A,e="#000",t=27){return Ir("svg",{width:t,height:t,viewBox:"0 0 32 32"},[Ir("path",{d:A,fill:e},null,8,["d","fill"])],8,["width","height"])}function Kc(){{const{$pageInstance:A}=Dr();return A&&tl(A.proxy)}}function Wc(A){const e=KA(A);if(e.$page)return tl(e);if(!e.$)return;{const{$pageInstance:A}=e.$;if(A)return tl(A.proxy)}const t=e.$.root.proxy;return t&&t.$page?tl(t):void 0}function zc(){const A=Lh(),e=A.length;if(e)return A[e-1]}function Zc(){var A;const e=null==(A=zc())?void 0:A.$page;if(e)return e.meta}function Xc(){const A=Zc();return A?A.id:-1}function $c(){const A=zc();if(A)return A.$vm}const Al=["navigationBar","pullToRefresh"];function el(A,e){const t=JSON.parse(JSON.stringify(__uniConfig.globalStyle||{})),i=u({id:e},t,A);Al.forEach(e=>{i[e]=u({},t[e],A[e])});const{navigationBar:o}=i;return o.titleText&&o.titleImage&&(o.titleText=""),i}function tl(A){var e,t;return(null==(e=A.$page)?void 0:e.id)||(null==(t=A.$basePage)?void 0:t.id)}function il(A,e,t){if(f(A))t=e,e=A,A=$c();else if("number"==typeof A){const e=Lh().find(e=>xc(e).id===A);A=e?e.$vm:$c()}if(!A)return;const i=A.$[e];return i&&((A,e)=>{let t;for(let i=0;i {function r(){if((()=>{const{scrollHeight:A}=document.documentElement,e=window.innerHeight,i=window.scrollY,n=i>0&&A>e&&i+e+t>=A,r=Math.abs(A-rl)>t;return!n||o&&!r?(!n&&o&&(o=!1),!1):(rl=A,o=!0,!0)})())return e&&e(),n=!1,setTimeout(function(){n=!0},350),!0}A&&A(window.pageYOffset),e&&n&&(r()||(nl=setTimeout(r,300))),i=!1};return function(){clearTimeout(nl),i||requestAnimationFrame(r),i=!0}}function al(A,e){if(0===e.indexOf("/"))return e;if(0===e.indexOf("./"))return al(A,e.slice(2));const t=e.split("/"),i=t.length;let o=0;for(;o0?A.split("/"):[];return n.splice(n.length-o-1,o+1),PA(n.concat(t).join("/"))}function gl(A,e=!1){return e?__uniRoutes.find(e=>e.path===A||e.alias===A):__uniRoutes.find(e=>e.path===A)}function cl(){Bc(),ee(Pc),window.addEventListener("touchstart",dc,cc),window.addEventListener("touchmove",hc,cc),window.addEventListener("touchend",Ic,cc),window.addEventListener("touchcancel",Ic,cc)}class ll{constructor(A){this.$bindClass=!1,this.$bindStyle=!1,this.$vm=A,this.$el=function(A,e=!1){const{vnode:t}=A;if(zA(t.el))return e?t.el?[t.el]:[]:t.el;const{subTree:i}=A;if(16&i.shapeFlag){const A=i.children.filter(A=>A.el&&zA(A.el));if(A.length>0)return e?A.map(A=>A.el):A[0].el}return e?t.el?[t.el]:[]:t.el}(A.$),this.$el.getAttribute&&(this.$bindClass=!!this.$el.getAttribute("class"),this.$bindStyle=!!this.$el.getAttribute("style"))}selectComponent(A){if(!this.$el||!A)return;const e=dl(this.$el.querySelector(A));return e?Il(e,!1):void 0}selectAllComponents(A){if(!this.$el||!A)return[];const e=[],t=this.$el.querySelectorAll(A);for(let i=0;i -1&&e.splice(t,1)}const t=this.$el.__wxsRemoveClass||(this.$el.__wxsRemoveClass=[]);return-1===t.indexOf(A)&&(t.push(A),this.forceUpdate("class")),this}hasClass(A){return this.$el&&this.$el.classList.contains(A)}getDataset(){return this.$el&&this.$el.dataset}callMethod(A,e={}){const t=this.$vm[A];p(t)?t(JSON.parse(JSON.stringify(e))):this.$vm.ownerId&&Ov.publishHandler("onWxsInvokeCallMethod",{nodeId:this.$el.__id,ownerId:this.$vm.ownerId,method:A,args:e})}requestAnimationFrame(A){return window.requestAnimationFrame(A)}getState(){return this.$el&&(this.$el.__wxsState||(this.$el.__wxsState={}))}triggerEvent(A,e={}){return this.$vm.$emit(A,e),this}getComputedStyle(A){if(this.$el){const e=window.getComputedStyle(this.$el);return A&&A.length?A.reduce((A,t)=>(A[t]=e[t],A),{}):e}return{}}setTimeout(A,e){return window.setTimeout(A,e)}clearTimeout(A){return window.clearTimeout(A)}getBoundingClientRect(){return this.$el.getBoundingClientRect()}}function Il(A,e=!0){if(e&&A&&(A=WA(A.$)),A&&A.$el)return A.$el.__wxsComponentDescriptor||(A.$el.__wxsComponentDescriptor=new ll(A)),A.$el.__wxsComponentDescriptor}function ul(A,e){return Il(A,e)}function El(A,e,t,i=!0){if(e){A.__instance||(A.__instance=!0,Object.defineProperty(A,"instance",{get:()=>ul(t.proxy,!1)}));const o=function(A,e,t=!0){if(!e)return!1;if(t&&A.length<2)return!1;const i=WA(e);if(!i)return!1;const o=i.$.type;return!(!o.$wxs&&!o.$renderjs)&&i}(e,t,i);if(o)return[A,ul(o,!1)]}}function dl(A){if(A)return A.__vueParentComponent&&A.__vueParentComponent.proxy}function hl(A,e=!1){const{type:t,timeStamp:i,target:o,currentTarget:n}=A;let r,s;r=ne(e?o:function(A){for(;!Pc(A);)A=A.parentElement;return A}(o)),s=ne(n);const a={type:t,timeStamp:i,target:r,detail:{},currentTarget:s};return A instanceof CustomEvent&&S(A.detail)&&(a.detail=A.detail),A._stopped&&(a._stopped=!0),A.type.startsWith("touch")&&(a.touches=A.touches,a.changedTouches=A.changedTouches),function(A,e){u(A,{preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}(a,A),a}function Cl(A,e){return{force:1,identifier:0,clientX:A.clientX,clientY:A.clientY-e,pageX:A.pageX,pageY:A.pageY-e}}function Bl(A,e){const t=[];for(let i=0;i 0===A.type.indexOf("mouse")||["contextmenu"].includes(A.type))(A))!function(A,e){const t=bc();A.pageX=e.pageX,A.pageY=e.pageY-t,A.clientX=e.clientX,A.clientY=e.clientY-t,A.touches=A.changedTouches=[Cl(e,t)]}(n,A);else if((A=>"undefined"!=typeof TouchEvent&&A instanceof TouchEvent||0===A.type.indexOf("touch")||["longpress"].indexOf(A.type)>=0)(A)){const e=bc();n.touches=Bl(A.touches,e),n.changedTouches=Bl(A.changedTouches,e)}else if((A=>!A.type.indexOf("key")&&A instanceof KeyboardEvent)(A)){["key","code"].forEach(e=>{Object.defineProperty(n,e,{get:()=>A[e]})})}return El(n,e,t)||[n]},createNativeEvent:hl},Symbol.toStringTag,{value:"Module"});function pl(A){!function(A){const e=A.globalProperties;u(e,Ql),e.$gcd=ul}(A._context.config)}let fl=1;function ml(A){return(A||Xc())+"."+tc}const yl=u(ec("view"),{invokeOnCallback:(A,e)=>Pv.emit("api."+A,e),invokeViewMethod:(A,e,t,i)=>{const{subscribe:o,publishHandler:n}=Pv,r=i?fl++:0;i&&o(tc+"."+r,i,!0),n(ml(t),{id:r,name:A,args:e},t)},invokeViewMethodKeepAlive:(A,e,t,i)=>{const{subscribe:o,unsubscribe:n,publishHandler:r}=Pv,s=fl++,a=tc+"."+s;return o(a,t),r(ml(i),{id:s,name:A,args:e},i),()=>{n(a)}}});function Dl(A){il(zc(),mA,A),Pv.invokeOnCallback("onWindowResize",A)}function vl(A){const e=zc();il(np(),cA,A),il(e,cA)}function wl(){il(np(),lA),il(zc(),lA)}const Sl=[DA,wA];function Ml(){Sl.forEach(A=>Pv.subscribe(A,function(A){return(e,t)=>{il(parseInt(t),A,e)}}(A)))}function Rl(){!function(){const{on:A}=Pv;A(mA,Dl),A(UA,vl),A(FA,wl)}(),Ml()}function _l(){if(this.$route){const A=this.$route.meta;return A.eventChannel||(A.eventChannel=new le(this.$page.id)),A.eventChannel}}function Tl(A){A._context.config.globalProperties.getOpenerEventChannel=_l}function Nl(){return{path:"",query:{},scene:1001,referrerInfo:{appId:"",extraData:{}}}}function bl(A){return/^-?\d+[ur]px$/i.test(A)?A.replace(/(^-?\d+)[ur]px$/i,(A,e)=>`${uni.upx2px(parseFloat(e))}px`):/^-?[\d\.]+$/.test(A)?`${A}px`:A||""}function Gl(A){const e=A.animation;if(!e||!e.actions||!e.actions.length)return;let t=0;const i=e.actions,o=e.actions.length;function n(){const e=i[t],r=e.option.transition,s=function(A){const e=["matrix","matrix3d","scale","scale3d","rotate3d","skew","translate","translate3d"],t=["scaleX","scaleY","scaleZ","rotate","rotateX","rotateY","rotateZ","skewX","skewY","translateX","translateY","translateZ"],i=["opacity","background-color"],o=["width","height","left","right","top","bottom"],n=A.animates,r=A.option,s=r.transition,a={},g=[];return n.forEach(A=>{let n=A.type,r=[...A.args];if(e.concat(t).includes(n))n.startsWith("rotate")||n.startsWith("skew")?r=r.map(A=>parseFloat(A)+"deg"):n.startsWith("translate")&&(r=r.map(bl)),t.indexOf(n)>=0&&(r.length=1),g.push(`${n}(${r.join(",")})`);else if(i.concat(o).includes(r[0])){n=r[0];const A=r[1];a[n]=o.includes(n)?bl(A):A}}),a.transform=a.webkitTransform=g.join(" "),a.transition=a.webkitTransition=Object.keys(a).map(A=>`${function(A){return A.replace(/[A-Z]/g,A=>`-${A.toLowerCase()}`).replace("webkit","-webkit")}(A)} ${s.duration}ms ${s.timingFunction} ${s.delay}ms`).join(","),a.transformOrigin=a.webkitTransformOrigin=r.transformOrigin,a}(e);Object.keys(s).forEach(e=>{A.$el.style[e]=s[e]}),t+=1,t {n()},0)}const kl={props:["animation"],watch:{animation:{deep:!0,handler(){Gl(this)}}},mounted(){Gl(this)}},Ll=A=>{A.__reserved=!0;const{props:e,mixins:t}=A;return e&&e.animation||(t||(A.mixins=[])).push(kl),Ul(A)},Ul=A=>(A.__reserved=!0,A.compatConfig={MODE:3},Co(A));function Fl(A){return A.__wwe=!0,A}function Ol(A,e){return(t,i,o)=>{A.value&&e(t,function(A,e,t,i){let o;return o=ne(t),{type:e.__evName||i.type||A,timeStamp:e.timeStamp||0,target:o,currentTarget:o,detail:i}}(t,i,A.value,o||{}))}}const xl={hoverClass:{type:String,default:"none"},hoverStopPropagation:{type:Boolean,default:!1},hoverStartTime:{type:[Number,String],default:50},hoverStayTime:{type:[Number,String],default:400}};function Pl(A){const e=Kt(!1);let t,i,o=!1;function n(){requestAnimationFrame(()=>{clearTimeout(i),i=setTimeout(()=>{e.value=!1},parseInt(A.hoverStayTime))})}function r(i){i._hoverPropagationStopped||A.hoverClass&&"none"!==A.hoverClass&&!A.disabled&&(A.hoverStopPropagation&&(i._hoverPropagationStopped=!0),o=!0,t=setTimeout(()=>{e.value=!0,o||n()},parseInt(A.hoverStartTime)))}function s(){o=!1,e.value&&n()}function a(){s(),window.removeEventListener("mouseup",a)}return{hovering:e,binding:{onTouchstartPassive:Fl(function(A){A.touches.length>1||r(A)}),onMousedown:Fl(function(A){o||(r(A),window.addEventListener("mouseup",a))}),onTouchend:Fl(function(){s()}),onMouseup:Fl(function(){o&&a()}),onTouchcancel:Fl(function(){o=!1,e.value=!1,clearTimeout(t)})}}}function Yl(A,e){return f(e)&&(e=[e]),e.reduce((e,t)=>(A[t]&&(e[t]=!0),e),Object.create(null))}const Jl=Uc("uf"),Hl=Ll({name:"Form",emits:["submit","reset"],setup(A,{slots:e,emit:t}){const i=Kt(null);return function(A){const e=[];Qn(Jl,{addField(A){e.push(A)},removeField(A){e.splice(e.indexOf(A),1)},submit(t){A("submit",t,{value:e.reduce((A,e)=>{if(e.submit){const[t,i]=e.submit();t&&(A[t]=i)}return A},Object.create(null))})},reset(t){e.forEach(A=>A.reset&&A.reset()),A("reset",t)}})}(Ol(i,t)),()=>Ir("uni-form",{ref:i},[Ir("span",null,[e.default&&e.default()])],512)}});const ql={for:{type:String,default:""}},Vl=Uc("ul");const jl=Ll({name:"Label",props:ql,setup(A,{slots:e}){const t=Kt(null),i=Kc(),o=function(){const A=[];return Qn(Vl,{addHandler(e){A.push(e)},removeHandler(e){A.splice(A.indexOf(e),1)}}),A}(),n=Ur(()=>A.for||e.default&&e.default.length),r=Fl(e=>{const t=e.target;let n=/^uni-(checkbox|radio|switch)-/.test(t.className);n||(n=/^uni-(checkbox|radio|switch|button)$|^(svg|path)$/i.test(t.tagName)),n||(A.for?Ov.emit("uni-label-click-"+i+"-"+A.for,e,!0):o.length&&o[0](e,!0))});return()=>Ir("uni-label",{ref:t,class:{"uni-label-pointer":n},onClick:r},[e.default&&e.default()],10,["onClick"])}});function Kl(A,e){Wl(A.id,e),Xi(()=>A.id,(A,t)=>{zl(t,e,!0),Wl(A,e,!0)}),Po(()=>{zl(A.id,e)})}function Wl(A,e,t){const i=Kc();t&&!A||S(e)&&Object.keys(e).forEach(o=>{t?0!==o.indexOf("@")&&0!==o.indexOf("uni-")&&Ov.on(`uni-${o}-${i}-${A}`,e[o]):0===o.indexOf("uni-")?Ov.on(o,e[o]):A&&Ov.on(`uni-${o}-${i}-${A}`,e[o])})}function zl(A,e,t){const i=Kc();t&&!A||S(e)&&Object.keys(e).forEach(o=>{t?0!==o.indexOf("@")&&0!==o.indexOf("uni-")&&Ov.off(`uni-${o}-${i}-${A}`,e[o]):0===o.indexOf("uni-")?Ov.off(o,e[o]):A&&Ov.off(`uni-${o}-${i}-${A}`,e[o])})}const Zl=Ll({name:"Button",props:{id:{type:String,default:""},hoverClass:{type:String,default:"button-hover"},hoverStartTime:{type:[Number,String],default:20},hoverStayTime:{type:[Number,String],default:70},hoverStopPropagation:{type:Boolean,default:!1},disabled:{type:[Boolean,String],default:!1},formType:{type:String,default:""},openType:{type:String,default:""},loading:{type:[Boolean,String],default:!1},plain:{type:[Boolean,String],default:!1}},setup(A,{slots:e}){const t=Kt(null),i=pn(Jl,!1),{hovering:o,binding:n}=Pl(A),r=Fl((e,o)=>{if(A.disabled)return e.stopImmediatePropagation();o&&t.value.click();const n=A.formType;if(n){if(!i)return;"submit"===n?i.submit(e):"reset"===n&&i.reset(e)}else;}),s=pn(Vl,!1);return s&&(s.addHandler(r),xo(()=>{s.removeHandler(r)})),Kl(A,{"label-click":r}),()=>{const i=A.hoverClass,s=Yl(A,"disabled"),a=Yl(A,"loading"),g=Yl(A,"plain"),c=i&&"none"!==i;return Ir("uni-button",Qr({ref:t,onClick:r,id:A.id,class:c&&o.value?i:""},c&&n,s,a,g),[e.default&&e.default()],16,["onClick","id"])}}}),Xl=Uc("upm");function $l(){return pn(Xl)}function AI(A){const e=function(A){return Nt(function(A){{const{navigationBar:e}=A,{titleSize:t,titleColor:i,backgroundColor:o}=e;e.titleText=e.titleText||"",e.type=e.type||"default",e.titleSize=t||"16px",e.titleColor=i||"#000000",e.backgroundColor=o||"#F8F8F8"}if(history.state){const e=history.state.__type__;"redirectTo"!==e&&"reLaunch"!==e||0!==Lh().length||(A.isEntry=!0,A.isQuit=!0)}return A}(JSON.parse(JSON.stringify(el(mg().meta,A)))))}(A);return Qn(Xl,e),e}function eI(){return mg()}function tI(){return history.state&&history.state.__id__||1}var iI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oI=function(){const A=new Uint8Array(256);for(var e=0;e<64;e++)A[iI.charCodeAt(e)]=e;return A}();const nI=["original","compressed"],rI=["album","camera"],sI=["GET","OPTIONS","HEAD","POST","PUT","DELETE","TRACE","CONNECT","PATCH"];function aI(A,e){return A&&-1!==e.indexOf(A)?A:e[0]}function gI(A,e){return!C(A)||0===A.length||A.find(A=>-1===e.indexOf(A))?e:A}function cI(A){return function(){try{return A.apply(A,arguments)}catch(__){console.error(__)}}}let lI=1;const II={};function uI(A,e,t,i=!1){return II[A]={name:e,keepAlive:i,callback:t},A}function EI(A,e,t){if("number"==typeof A){const i=II[A];if(i)return i.keepAlive||delete II[A],i.callback(e,t)}return e}function dI(A){for(const e in II)if(II[e].name===A)return!0;return!1}const hI="success",CI="fail",BI="complete";function QI(A,e={},{beforeAll:t,beforeSuccess:i}={}){S(e)||(e={});const{success:o,fail:n,complete:r}=function(A){const e={};for(const t in A){const i=A[t];p(i)&&(e[t]=cI(i),delete A[t])}return e}(e),s=p(o),a=p(n),g=p(r),c=lI++;return uI(c,A,c=>{(c=c||{}).errMsg=function(A,e){return A&&-1!==A.indexOf(":fail")?e+A.substring(A.indexOf(":fail")):e+":ok"}(c.errMsg,A),p(t)&&t(c),c.errMsg===A+":ok"?(p(i)&&i(c,e),s&&o(c)):a&&n(c),g&&r(c)}),c}const pI="success",fI="fail",mI="complete",yI={},DI={};function vI(A,e){return function(t){return A(t,e)||t}}function wI(A,e,t){let i=!1;for(let o=0;o A(e),catch(){}}}function SI(A,e={}){return[pI,fI,mI].forEach(t=>{const i=A[t];if(!C(i))return;const o=e[t];e[t]=function(A){wI(i,A,e).then(A=>p(o)&&o(A)||A)}}),e}function MI(A,e){const t=[];C(yI.returnValue)&&t.push(...yI.returnValue);const i=DI[A];return i&&C(i.returnValue)&&t.push(...i.returnValue),t.forEach(A=>{e=A(e)||e}),e}function RI(A){const e=Object.create(null);Object.keys(yI).forEach(A=>{"returnValue"!==A&&(e[A]=yI[A].slice())});const t=DI[A];return t&&Object.keys(t).forEach(A=>{"returnValue"!==A&&(e[A]=(e[A]||[]).concat(t[A]))}),e}function _I(A,e,t,i){const o=RI(A);if(o&&Object.keys(o).length){if(C(o.invoke)){return wI(o.invoke,t).then(t=>e(SI(RI(A),t),...i))}return e(SI(o,t),...i)}return e(t,...i)}function TI(A,e){return(t={},...i)=>function(A){return!(!S(A)||![hI,CI,BI].find(e=>p(A[e])))}(t)?MI(A,_I(A,e,u({},t),i)):MI(A,new Promise((o,n)=>{_I(A,e,u({},t,{success:o,fail:n}),i)}))}function NI(A,e,t,i={}){const o=e+":fail";let n="";return n=t?0===t.indexOf(o)?t:o+" "+t:o,delete i.errCode,EI(A,u({errMsg:n},i))}function bI(A,e,t,i){if(i&&i.beforeInvoke){const A=i.beforeInvoke(e);if(f(A))return A}const o=function(A,e){const t=A[0];if(!e||!e.formatArgs||!S(e.formatArgs)&&S(t))return;const i=e.formatArgs,o=Object.keys(i);for(let n=0;n {GI(i);const o=bI(0,[i],0,t);if(o)throw new Error(o);const n=!dI(A);!function(A,e){uI(lI++,A,e,!0)}(A,i),n&&(!function(A){Pv.on("api."+A,e=>{for(const t in II){const i=II[t];i.name===A&&i.callback(e)}})}(A),e())}}function LI(A,e,t){return i=>{GI(i);const o=bI(0,[i],0,t);if(o)throw new Error(o);!function(A,e){for(const t in II){const i=II[t];i.callback===e&&i.name===A&&delete II[t]}}(A=A.replace("off","on"),i);dI(A)||(!function(A){Pv.off("api."+A)}(A),e())}}function UI(A,e,t,i){return t=>{const o=QI(A,t,i),n=bI(0,[t],0,i);return n?NI(o,A,n):e(t,{resolve:e=>function(A,e,t){return EI(A,u(t||{},{errMsg:e+":ok"}))}(o,A,e),reject:(e,t)=>NI(o,A,function(A){return!A||f(A)?A:A.stack?("undefined"!=typeof globalThis&&globalThis.harmonyChannel||console.error(A.message+"\n"+A.stack),A.message):A}(e),t)})}}function FI(A,e,t){return kI(A,e,t)}function OI(A,e,t){return LI(A,e,t)}function xI(A,e,t,i){return TI(A,UI(A,e,0,i))}function PI(A,e,t,i){return function(A,e,t,i){return(...A)=>{const t=bI(0,A,0,i);if(t)throw new Error(t);return e.apply(null,A)}}(0,e,0,i)}function YI(A,e,t,i){return TI(A,function(A,e,t,i){return UI(A,e,0,i)}(A,e,0,i))}function JI(A){return`method 'uni.${A}' not supported`}function HI(A){return()=>{console.error(JI(A))}}const qI=HI;function VI(A){return(e,{reject:t})=>t(JI(A))}const jI=PI(0,A=>function(A){var e,t,i,o,n,r=.75*A.length,s=A.length,a=0;"="===A[A.length-1]&&(r--,"="===A[A.length-2]&&r--);var g=new ArrayBuffer(r),c=new Uint8Array(g);for(e=0;e >4,c[a++]=(15&i)<<4|o>>2,c[a++]=(3&o)<<6|63&n;return g}(A)),KI=PI(0,A=>function(A){var e,t=new Uint8Array(A),i=t.length,o="";for(e=0;e>2],o+=iI[(3&t[e])<<4|t[e+1]>>4],o+=iI[(15&t[e+1])<<2|t[e+2]>>6],o+=iI[63&t[e+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(A));let WI=!1,zI=0,ZI=0,XI=960,$I=375,Au=750;function eu(){let A,e,t;{const{windowWidth:i,pixelRatio:o,platform:n}=function(){const A=aC(),e=lC(cC(A,gC(A)));return{platform:iC?"ios":"other",pixelRatio:window.devicePixelRatio,windowWidth:e}}();A=i,e=o,t=n}zI=A,ZI=e,WI="ios"===t}function tu(A,e){const t=Number(A);return isNaN(t)?e:t}const iu=PI(0,(A,e)=>{if(0===zI&&(eu(),function(){const A=__uniConfig.globalStyle||{};XI=tu(A.rpxCalcMaxDeviceWidth,960),$I=tu(A.rpxCalcBaseDeviceWidth,375),Au=tu(A.rpxCalcBaseDeviceWidth,750)}()),0===(A=Number(A)))return 0;let t=e||zI;t=A===Au||t<=XI?t:$I;let i=A/750*t;return i<0&&(i=-i),i=Math.floor(i+1e-4),0===i&&(i=1!==ZI&&WI?.5:1),A<0?-i:i});function ou(A,e){Object.keys(e).forEach(t=>{p(e[t])&&(A[t]=function(A,e){const t=e?A?A.concat(e):C(e)?e:[e]:A;return t?function(A){const e=[];for(let t=0;t{const i=A[t],o=e[t];C(i)&&p(o)&&E(i,o)})}const ru=PI(0,(A,e)=>{f(A)&&S(e)?ou(DI[A]||(DI[A]={}),e):S(A)&&ou(yI,A)}),su=PI(0,(A,e)=>{f(A)?S(e)?nu(DI[A],e):delete DI[A]:S(A)&&nu(yI,A)});const au=new class{constructor(){this.$emitter=new Be}on(A,e){return this.$emitter.on(A,e)}once(A,e){return this.$emitter.once(A,e)}off(A,e){A?this.$emitter.off(A,e):this.$emitter.e={}}emit(A,...e){this.$emitter.emit(A,...e)}},gu=PI(0,(A,e)=>(au.on(A,e),()=>au.off(A,e))),cu=PI(0,(A,e)=>(au.once(A,e),()=>au.off(A,e))),lu=PI(0,(A,e)=>{C(A)||(A=A?[A]:[]),A.forEach(A=>{au.off(A,e)})}),Iu=PI(0,(A,...e)=>{au.emit(A,...e)});const uu=[.5,.8,1,1.25,1.5,2];class Eu{constructor(A,e){this.id=A,this.pageId=e}play(){IC(this.id,this.pageId,"play")}pause(){IC(this.id,this.pageId,"pause")}stop(){IC(this.id,this.pageId,"stop")}seek(A){IC(this.id,this.pageId,"seek",{position:A})}sendDanmu(A){IC(this.id,this.pageId,"sendDanmu",A)}playbackRate(A){~uu.indexOf(A)||(A=1),IC(this.id,this.pageId,"playbackRate",{rate:A})}requestFullScreen(A={}){IC(this.id,this.pageId,"requestFullScreen",A)}exitFullScreen(){IC(this.id,this.pageId,"exitFullScreen")}showStatusBar(){IC(this.id,this.pageId,"showStatusBar")}hideStatusBar(){IC(this.id,this.pageId,"hideStatusBar")}}const du=PI(0,(A,e)=>new Eu(A,Wc(e||$c()))),hu=(A,e,t,i)=>{!function(A,e,t,i,o){Pv.invokeViewMethod("map."+A,{type:t,data:i},e,o)}(A,e,t,i,A=>{i&&((A,e)=>{const t=e.errMsg||"";new RegExp("\\:\\s*fail").test(t)?A.fail&&A.fail(e):A.success&&A.success(e),A.complete&&A.complete(e)})(i,A)})};class Cu{constructor(A,e){this.id=A,this.pageId=e}getCenterLocation(A){hu(this.id,this.pageId,"getCenterLocation",A)}moveToLocation(A){hu(this.id,this.pageId,"moveToLocation",A)}getScale(A){hu(this.id,this.pageId,"getScale",A)}getRegion(A){hu(this.id,this.pageId,"getRegion",A)}includePoints(A){hu(this.id,this.pageId,"includePoints",A)}translateMarker(A){hu(this.id,this.pageId,"translateMarker",A)}$getAppMap(){}addCustomLayer(A){hu(this.id,this.pageId,"addCustomLayer",A)}removeCustomLayer(A){hu(this.id,this.pageId,"removeCustomLayer",A)}addGroundOverlay(A){hu(this.id,this.pageId,"addGroundOverlay",A)}removeGroundOverlay(A){hu(this.id,this.pageId,"removeGroundOverlay",A)}updateGroundOverlay(A){hu(this.id,this.pageId,"updateGroundOverlay",A)}initMarkerCluster(A){hu(this.id,this.pageId,"initMarkerCluster",A)}addMarkers(A){hu(this.id,this.pageId,"addMarkers",A)}removeMarkers(A){hu(this.id,this.pageId,"removeMarkers",A)}moveAlong(A){hu(this.id,this.pageId,"moveAlong",A)}setLocMarkerIcon(A){hu(this.id,this.pageId,"setLocMarkerIcon",A)}openMapApp(A){hu(this.id,this.pageId,"openMapApp",A)}on(A,e){hu(this.id,this.pageId,"on",{name:A,callback:e})}}const Bu=PI(0,(A,e)=>new Cu(A,Wc(e||$c())));function Qu(A,e){return function(t,i){t?i[A]=Math.round(t):void 0!==e&&(i[A]=e)}}const pu=Qu("width"),fu=Qu("height"),mu={formatArgs:{x:Qu("x"),y:Qu("y"),width:pu,height:fu}},yu={canvasId:{type:String,required:!0},x:{type:Number,required:!0},y:{type:Number,required:!0},width:{type:Number,required:!0},height:{type:Number,required:!0}},Du=mu,vu=(Uint8ClampedArray,{PNG:"png",JPG:"jpg",JPEG:"jpg"}),wu={formatArgs:{x:Qu("x",0),y:Qu("y",0),width:pu,height:fu,destWidth:Qu("destWidth"),destHeight:Qu("destHeight"),fileType(A,e){A=(A||"").toUpperCase();let t=vu[A];t||(t=vu.PNG),e.fileType=t},quality(A,e){e.quality=A&&A>0&&A<1?A:1}}};function Su(A,e,t,i,o){Pv.invokeViewMethod(`canvas.${A}`,{type:t,data:i},e,A=>{o&&o(A)})}var Mu=["scale","rotate","translate","setTransform","transform"],Ru=["drawImage","fillText","fill","stroke","fillRect","strokeRect","clearRect","strokeText"],_u=["setFillStyle","setTextAlign","setStrokeStyle","setGlobalAlpha","setShadow","setFontSize","setLineCap","setLineJoin","setLineWidth","setMiterLimit","setTextBaseline","setLineDash"];const Tu={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",transparent:"#00000000"};function Nu(A){let e=null;if(null!=(e=/^#([0-9|A-F|a-f]{6})$/.exec(A=A||"#000000"))){return[parseInt(e[1].slice(0,2),16),parseInt(e[1].slice(2,4),16),parseInt(e[1].slice(4),16),255]}if(null!=(e=/^#([0-9|A-F|a-f]{3})$/.exec(A))){let A=e[1].slice(0,1),t=e[1].slice(1,2),i=e[1].slice(2,3);return A=parseInt(A+A,16),t=parseInt(t+t,16),i=parseInt(i+i,16),[A,t,i,255]}if(null!=(e=/^rgb\((.+)\)$/.exec(A)))return e[1].split(",").map(function(A){return Math.min(255,parseInt(A.trim()))}).concat(255);if(null!=(e=/^rgba\((.+)\)$/.exec(A)))return e[1].split(",").map(function(A,e){return 3===e?Math.floor(255*parseFloat(A.trim())):Math.min(255,parseInt(A.trim()))});var t=A.toLowerCase();if(h(Tu,t)){e=/^#([0-9|A-F|a-f]{6,8})$/.exec(Tu[t]);const A=parseInt(e[1].slice(0,2),16),i=parseInt(e[1].slice(2,4),16),o=parseInt(e[1].slice(4,6),16);let n=parseInt(e[1].slice(6,8),16);return n=n>=0?n:255,[A,i,o,n]}return console.error("unsupported color:"+A),[0,0,0,255]}let bu=class{constructor(A,e){this.type=A,this.data=e,this.colorStop=[]}addColorStop(A,e){this.colorStop.push([A,Nu(e)])}};class Gu{constructor(A,e){this.type="pattern",this.data=A,this.colorStop=e}}class ku{constructor(A){this.width=A}}class Lu{constructor(A,e){this.id=A,this.pageId=e,this.actions=[],this.path=[],this.subpath=[],this.drawingState=[],this.state={lineDash:[0,0],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:[0,0,0,0],font:"10px sans-serif",fontSize:10,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif"}}setFillStyle(A){console.log("initCanvasContextProperty implemented.")}setStrokeStyle(A){console.log("initCanvasContextProperty implemented.")}setShadow(A,e,t,i){console.log("initCanvasContextProperty implemented.")}addColorStop(A,e){console.log("initCanvasContextProperty implemented.")}setLineWidth(A){console.log("initCanvasContextProperty implemented.")}setLineCap(A){console.log("initCanvasContextProperty implemented.")}setLineJoin(A){console.log("initCanvasContextProperty implemented.")}setLineDash(A,e){console.log("initCanvasContextProperty implemented.")}setMiterLimit(A){console.log("initCanvasContextProperty implemented.")}fillRect(A,e,t,i){console.log("initCanvasContextProperty implemented.")}strokeRect(A,e,t,i){console.log("initCanvasContextProperty implemented.")}clearRect(A,e,t,i){console.log("initCanvasContextProperty implemented.")}fill(){console.log("initCanvasContextProperty implemented.")}stroke(){console.log("initCanvasContextProperty implemented.")}scale(A,e){console.log("initCanvasContextProperty implemented.")}rotate(A){console.log("initCanvasContextProperty implemented.")}translate(A,e){console.log("initCanvasContextProperty implemented.")}setFontSize(A){console.log("initCanvasContextProperty implemented.")}fillText(A,e,t,i){console.log("initCanvasContextProperty implemented.")}setTextAlign(A){console.log("initCanvasContextProperty implemented.")}setTextBaseline(A){console.log("initCanvasContextProperty implemented.")}drawImage(A,e,t,i,o,n,r,s,a){console.log("initCanvasContextProperty implemented.")}setGlobalAlpha(A){console.log("initCanvasContextProperty implemented.")}strokeText(A,e,t,i){console.log("initCanvasContextProperty implemented.")}setTransform(A,e,t,i,o,n){console.log("initCanvasContextProperty implemented.")}draw(A=!1,e){var t=[...this.actions];this.actions=[],this.path=[],Su(this.id,this.pageId,"actionsChanged",{actions:t,reserve:A},e)}createLinearGradient(A,e,t,i){return new bu("linear",[A,e,t,i])}createCircularGradient(A,e,t){return new bu("radial",[A,e,t])}createPattern(A,e){if(void 0===e)console.error("Failed to execute 'createPattern' on 'CanvasContext': 2 arguments required, but only 1 present.");else{if(!(["repeat","repeat-x","repeat-y","no-repeat"].indexOf(e)<0))return new Gu(A,e);console.error("Failed to execute 'createPattern' on 'CanvasContext': The provided type ('"+e+"') is not one of 'repeat', 'no-repeat', 'repeat-x', or 'repeat-y'.")}}measureText(A,e){let t=0;return t=function(A,e){const t=document.createElement("canvas").getContext("2d");return t.font=e,t.measureText(A).width||0}(A,this.state.font),new ku(t)}save(){this.actions.push({method:"save",data:[]}),this.drawingState.push(this.state)}restore(){this.actions.push({method:"restore",data:[]}),this.state=this.drawingState.pop()||{lineDash:[0,0],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,shadowColor:[0,0,0,0],font:"10px sans-serif",fontSize:10,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif"}}beginPath(){this.path=[],this.subpath=[],this.path.push({method:"beginPath",data:[]})}moveTo(A,e){this.path.push({method:"moveTo",data:[A,e]}),this.subpath=[[A,e]]}lineTo(A,e){0===this.path.length&&0===this.subpath.length?this.path.push({method:"moveTo",data:[A,e]}):this.path.push({method:"lineTo",data:[A,e]}),this.subpath.push([A,e])}quadraticCurveTo(A,e,t,i){this.path.push({method:"quadraticCurveTo",data:[A,e,t,i]}),this.subpath.push([t,i])}bezierCurveTo(A,e,t,i,o,n){this.path.push({method:"bezierCurveTo",data:[A,e,t,i,o,n]}),this.subpath.push([o,n])}arc(A,e,t,i,o,n=!1){this.path.push({method:"arc",data:[A,e,t,i,o,n]}),this.subpath.push([A,e])}rect(A,e,t,i){this.path.push({method:"rect",data:[A,e,t,i]}),this.subpath=[[A,e]]}arcTo(A,e,t,i,o){this.path.push({method:"arcTo",data:[A,e,t,i,o]}),this.subpath.push([t,i])}clip(){this.actions.push({method:"clip",data:[...this.path]})}closePath(){this.path.push({method:"closePath",data:[]}),this.subpath.length&&(this.subpath=[this.subpath.shift()])}clearActions(){this.actions=[],this.path=[],this.subpath=[]}getActions(){var A=[...this.actions];return this.clearActions(),A}set lineDashOffset(A){this.actions.push({method:"setLineDashOffset",data:[A]})}set globalCompositeOperation(A){this.actions.push({method:"setGlobalCompositeOperation",data:[A]})}set shadowBlur(A){this.actions.push({method:"setShadowBlur",data:[A]})}set shadowColor(A){this.actions.push({method:"setShadowColor",data:[A]})}set shadowOffsetX(A){this.actions.push({method:"setShadowOffsetX",data:[A]})}set shadowOffsetY(A){this.actions.push({method:"setShadowOffsetY",data:[A]})}set font(A){var e=this;this.state.font=A;var t=A.match(/^(([\w\-]+\s)*)(\d+\.?\d*r?px)(\/(\d+\.?\d*(r?px)?))?\s+(.*)/);if(t){var i=t[1].trim().split(/\s/),o=parseFloat(t[3]),n=t[7],r=[];i.forEach(function(A,t){["italic","oblique","normal"].indexOf(A)>-1?(r.push({method:"setFontStyle",data:[A]}),e.state.fontStyle=A):["bold","normal","lighter","bolder"].indexOf(A)>-1||/^\d+$/.test(A)?(r.push({method:"setFontWeight",data:[A]}),e.state.fontWeight=A):0===t?(r.push({method:"setFontStyle",data:["normal"]}),e.state.fontStyle="normal"):1===t&&s()}),1===i.length&&s(),i=r.map(function(A){return A.data[0]}).join(" "),this.state.fontSize=o,this.state.fontFamily=n,this.actions.push({method:"setFont",data:[`${i} ${o}px ${n}`]})}else console.warn("Failed to set 'font' on 'CanvasContext': invalid format.");function s(){r.push({method:"setFontWeight",data:["normal"]}),e.state.fontWeight="normal"}}get font(){return this.state.font}set fillStyle(A){this.setFillStyle(A)}set strokeStyle(A){this.setStrokeStyle(A)}set globalAlpha(A){A=Math.floor(255*parseFloat(A)),this.actions.push({method:"setGlobalAlpha",data:[A]})}set textAlign(A){this.actions.push({method:"setTextAlign",data:[A]})}set lineCap(A){this.actions.push({method:"setLineCap",data:[A]})}set lineJoin(A){this.actions.push({method:"setLineJoin",data:[A]})}set lineWidth(A){this.actions.push({method:"setLineWidth",data:[A]})}set miterLimit(A){this.actions.push({method:"setMiterLimit",data:[A]})}set textBaseline(A){this.actions.push({method:"setTextBaseline",data:[A]})}}const Uu=HA(()=>{[...Mu,...Ru].forEach(function(A){Lu.prototype[A]=function(A){switch(A){case"fill":case"stroke":return function(){this.actions.push({method:A+"Path",data:[...this.path]})};case"fillRect":return function(A,e,t,i){this.actions.push({method:"fillPath",data:[{method:"rect",data:[A,e,t,i]}]})};case"strokeRect":return function(A,e,t,i){this.actions.push({method:"strokePath",data:[{method:"rect",data:[A,e,t,i]}]})};case"fillText":case"strokeText":return function(e,t,i,o){var n=[e.toString(),t,i];"number"==typeof o&&n.push(o),this.actions.push({method:A,data:n})};case"drawImage":return function(e,t,i,o,n,r,s,a,g){var c;function l(A){return"number"==typeof A}void 0===g&&(r=t,s=i,a=o,g=n,t=void 0,i=void 0,o=void 0,n=void 0),c=l(t)&&l(i)&&l(o)&&l(n)?[e,r,s,a,g,t,i,o,n]:l(a)&&l(g)?[e,r,s,a,g]:[e,r,s],this.actions.push({method:A,data:c})};default:return function(...e){this.actions.push({method:A,data:e})}}}(A)}),_u.forEach(function(A){Lu.prototype[A]=function(A){switch(A){case"setFillStyle":case"setStrokeStyle":return function(e){"object"!=typeof e?this.actions.push({method:A,data:["normal",Nu(e)]}):this.actions.push({method:A,data:[e.type,e.data,e.colorStop]})};case"setGlobalAlpha":return function(e){e=Math.floor(255*parseFloat(e)),this.actions.push({method:A,data:[e]})};case"setShadow":return function(e,t,i,o){o=Nu(o),this.actions.push({method:A,data:[e,t,i,o]}),this.state.shadowBlur=i,this.state.shadowColor=o,this.state.shadowOffsetX=e,this.state.shadowOffsetY=t};case"setLineDash":return function(e,t){e=e||[0,0],t=t||0,this.actions.push({method:A,data:[e,t]}),this.state.lineDash=e};case"setFontSize":return function(e){this.state.font=this.state.font.replace(/\d+\.?\d*px/,e+"px"),this.state.fontSize=e,this.actions.push({method:A,data:[e]})};default:return function(...e){this.actions.push({method:A,data:e})}}}(A)})}),Fu=PI(0,(A,e)=>{if(Uu(),e)return new Lu(A,Wc(e));const t=Wc($c());if(t)return new Lu(A,t);Pv.emit(uA,"createCanvasContext:fail")}),Ou=YI("canvasGetImageData",({canvasId:A,x:e,y:t,width:i,height:o},{resolve:n,reject:r})=>{const s=Wc($c());s?Su(A,s,"getImageData",{x:e,y:t,width:i,height:o},function(A){if(A.errMsg&&-1!==A.errMsg.indexOf("fail"))return void r("",A);let e=A.data;e&&e.length&&(A.data=new Uint8ClampedArray(e)),delete A.compressed,n(A)}):r()},0,mu),xu=YI("canvasPutImageData",({canvasId:A,data:e,x:t,y:i,width:o,height:n},{resolve:r,reject:s})=>{var a=Wc($c());if(!a)return void s();e=Array.prototype.slice.call(e),Su(A,a,"putImageData",{data:e,x:t,y:i,width:o,height:n,compressed:void 0},A=>{A.errMsg&&-1!==A.errMsg.indexOf("fail")?s():r(A)})},0,Du),Pu=YI("canvasToTempFilePath",({x:A=0,y:e=0,width:t,height:i,destWidth:o,destHeight:n,canvasId:r,fileType:s,quality:a},{resolve:g,reject:c})=>{var l=Wc($c());if(!l)return void c();Su(r,l,"toTempFilePath",{x:A,y:e,width:t,height:i,destWidth:o,destHeight:n,fileType:s,quality:a,dirname:"/canvas"},A=>{A.errMsg&&-1!==A.errMsg.indexOf("fail")?c("",A):g(A)})},0,wu),Yu=["onCanplay","onPlay","onPause","onStop","onEnded","onTimeUpdate","onError","onWaiting","onSeeking","onSeeked"],Ju=["offCanplay","offPlay","offPause","offStop","offEnded","offTimeUpdate","offError","offWaiting","offSeeking","offSeeked"],Hu={thresholds:[0],initialRatio:0,observeAll:!1},qu=["top","right","bottom","left"];let Vu=1;function ju(A={}){return qu.map(e=>`${Number(A[e])||0}px`).join(" ")}class Ku{constructor(A,e){this._pageId=Wc(A),this._component=A,this._options=u({},Hu,e)}relativeTo(A,e){return this._options.relativeToSelector=A,this._options.rootMargin=ju(e),this}relativeToViewport(A){return this._options.relativeToSelector=void 0,this._options.rootMargin=ju(A),this}observe(A,e){p(e)&&(this._options.selector=A,this._reqId=Vu++,function({reqId:A,component:e,options:t,callback:i}){const o=Xh(e);(o.__io||(o.__io={}))[A]=function(A,e,t){th();const i=e.relativeToSelector?A.querySelector(e.relativeToSelector):null,o=new IntersectionObserver(A=>{A.forEach(A=>{t({intersectionRatio:oh(A),intersectionRect:ih(A.intersectionRect),boundingClientRect:ih(A.boundingClientRect),relativeRect:ih(A.rootBounds),time:Date.now(),dataset:te(A.target),id:A.target.id})})},{root:i,rootMargin:e.rootMargin,threshold:e.thresholds});if(e.observeAll){o.USE_MUTATION_OBSERVER=!0;const t=A.querySelectorAll(e.selector);for(let A=0;A ((A=KA(A))&&!Wc(A)&&(e=A,A=null),new Ku(A||$c(),e)));let zu=1;class Zu{constructor(A){this._pageId=(null==A?void 0:A.$page)&&A.$page.id,this._component=A}observe(A,e){p(e)&&(this._reqId=zu++,function({reqId:A,component:e,options:t,callback:i}){const o=dC[A]=window.matchMedia(function(A){const e=[],t=["width","minWidth","maxWidth","height","minHeight","maxHeight","orientation"];for(const i of t)"orientation"!==i&&A[i]&&Number(A[i]>=0)&&e.push(`(${CC(i)}: ${Number(A[i])}px)`),"orientation"===i&&A[i]&&e.push(`(${CC(i)}: ${A[i]})`);return e.join(" and ")}(t)),n=hC[A]=A=>i(A.matches);n(o),o.addListener(n)}({reqId:this._reqId,component:this._component,options:A,callback:e},this._pageId))}disconnect(){this._reqId&&function({reqId:A,component:e}){const t=hC[A],i=dC[A];i&&(i.removeListener(t),delete hC[A],delete dC[A])}({reqId:this._reqId,component:this._component},this._pageId)}}const Xu=PI(0,A=>((A=KA(A))&&!Wc(A)&&(A=null),new Zu(A||$c())));let $u=0,AE={};const eE={canvas:Lu,map:Cu,video:Eu,editor:class{constructor(A,e){this.id=A,this.pageId=e}format(A,e){this._exec("format",{name:A,value:e})}insertDivider(){this._exec("insertDivider")}insertImage(A){this._exec("insertImage",A)}insertText(A){this._exec("insertText",A)}setContents(A){this._exec("setContents",A)}getContents(A){this._exec("getContents",A)}clear(A){this._exec("clear",A)}removeFormat(A){this._exec("removeFormat",A)}undo(A){this._exec("undo",A)}redo(A){this._exec("redo",A)}blur(A){this._exec("blur",A)}getSelectionText(A){this._exec("getSelectionText",A)}scrollIntoView(A){this._exec("scrollIntoView",A)}_exec(A,e){!function(A,e,t,i){const o={options:i},n=i&&("success"in i||"fail"in i||"complete"in i);if(n){const A=String($u++);o.callbackId=A,AE[A]=i}Pv.invokeViewMethod(`editor.${A}`,{type:t,data:o},e,({callbackId:A,data:e})=>{n&&(qA(AE[A],e),delete AE[A])})}(this.id,this.pageId,A,e)}}};function tE(A){if(A&&A.contextInfo){const{id:e,type:t,page:i}=A.contextInfo,o=eE[t];A.context=new o(e,i),delete A.contextInfo}}class iE{constructor(A,e,t,i){this._selectorQuery=A,this._component=e,this._selector=t,this._single=i}boundingClientRect(A){return this._selectorQuery._push(this._selector,this._component,this._single,{id:!0,dataset:!0,rect:!0,size:!0},A),this._selectorQuery}fields(A,e){return this._selectorQuery._push(this._selector,this._component,this._single,A,e),this._selectorQuery}scrollOffset(A){return this._selectorQuery._push(this._selector,this._component,this._single,{id:!0,dataset:!0,scrollOffset:!0},A),this._selectorQuery}context(A){return this._selectorQuery._push(this._selector,this._component,this._single,{context:!0},A),this._selectorQuery}node(A){return this._selectorQuery._push(this._selector,this._component,this._single,{node:!0},A),this._selectorQuery}}class oE{constructor(A){this._component=void 0,this._page=A,this._queue=[],this._queueCb=[]}exec(A){return function(A,e,t){const i=[];e.forEach(({component:e,selector:t,single:o,fields:n})=>{null===e?i.push(function(A){const e={};A.id&&(e.id="");A.dataset&&(e.dataset={});A.rect&&(e.left=0,e.right=0,e.top=0,e.bottom=0);A.size&&(e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight);if(A.scrollOffset){const A=document.documentElement,t=document.body;e.scrollLeft=A.scrollLeft||t.scrollLeft||0,e.scrollTop=A.scrollTop||t.scrollTop||0,e.scrollHeight=A.scrollHeight||t.scrollHeight||0,e.scrollWidth=A.scrollWidth||t.scrollWidth||0}return e}(n)):i.push(function(A,e,t,i,o){const n=function(A,e){if(!A)return e.$el;return A.$el}(e,A),r=n.parentElement;if(!r)return i?null:[];const{nodeType:s}=n,a=3===s||8===s;if(i){const A=a?r.querySelector(t):EC(n,t)?n:n.querySelector(t);return A?uC(A,o):null}{let A=[];const e=(a?r:n).querySelectorAll(t);return e&&e.length&&[].forEach.call(e,e=>{A.push(uC(e,o))}),!a&&EC(n,t)&&A.unshift(uC(n,o)),A}}(A,e,t,o,n))}),t(i)}(this._page,this._queue,e=>{const t=this._queueCb;e.forEach((A,e)=>{C(A)?A.forEach(tE):tE(A);const i=t[e];p(i)&&i.call(this,A)}),p(A)&&A.call(this,e)}),this._nodesRef}in(A){return this._component=KA(A),this}select(A){return this._nodesRef=new iE(this,this._component,A,!0)}selectAll(A){return this._nodesRef=new iE(this,this._component,A,!1)}selectViewport(){return this._nodesRef=new iE(this,null,"",!0)}_push(A,e,t,i,o){this._queue.push({component:e,selector:A,single:t,fields:i}),this._queueCb.push(o)}}const nE=PI(0,A=>((A=KA(A))&&!Wc(A)&&(A=null),new oE(A||$c()))),rE={formatArgs:{}},sE={duration:400,timingFunction:"linear",delay:0,transformOrigin:"50% 50% 0"};let aE=class{constructor(A){this.actions=[],this.currentTransform={},this.currentStepAnimates=[],this.option=u({},sE,A)}_getOption(A){const e={transition:u({},this.option,A),transformOrigin:""};return e.transformOrigin=e.transition.transformOrigin,delete e.transition.transformOrigin,e}_pushAnimates(A,e){this.currentStepAnimates.push({type:A,args:e})}_converType(A){return A.replace(/[A-Z]/g,A=>`-${A.toLowerCase()}`)}_getValue(A){return"number"==typeof A?`${A}px`:A}export(){const A=this.actions;return this.actions=[],{actions:A}}step(A){return this.currentStepAnimates.forEach(A=>{"style"!==A.type?this.currentTransform[A.type]=A:this.currentTransform[`${A.type}.${A.args[0]}`]=A}),this.actions.push({animates:Object.values(this.currentTransform),option:this._getOption(A)}),this.currentStepAnimates=[],this}};const gE=HA(()=>{const A=["opacity","backgroundColor"],e=["width","height","left","right","top","bottom"];["matrix","matrix3d","rotate","rotate3d","rotateX","rotateY","rotateZ","scale","scale3d","scaleX","scaleY","scaleZ","skew","skewX","skewY","translate","translate3d","translateX","translateY","translateZ"].concat(A,e).forEach(t=>{aE.prototype[t]=function(...i){return A.concat(e).includes(t)?this._pushAnimates("style",[this._converType(t),e.includes(t)?this._getValue(i[0]):i[0]]):this._pushAnimates(t,i),this}})}),cE=PI(0,A=>(gE(),new aE(A)),0,rE),lE=FI("onTabBarMidButtonTap",()=>{}),IE=FI("onWindowResize",()=>{}),uE=OI("offWindowResize",()=>{}),EE="onLocaleChange",dE=PI(0,()=>{const A=np();return A&&A.$vm?A.$vm.$locale:Jg().getLocale()}),hE=FI(EE,()=>{}),CE=PI(0,A=>{const e=np();if(!e)return!1;return e.$vm.$locale!==A&&(e.$vm.$locale=A,navigator.cookieEnabled&&window.localStorage&&(localStorage[nA]=A),Pv.invokeOnCallback(EE,{locale:A}),!0)}),BE=YI("setPageMeta",(A,{resolve:e})=>{e(function(A,{pageStyle:e,rootFontSize:t}){if(e){(document.querySelector("uni-page-body")||document.body).setAttribute("style",e)}t&&document.documentElement.style.fontSize!==t&&(document.documentElement.style.fontSize=t)}($c(),A))}),QE="getSelectedTextRange",pE=YI(QE,(A,{resolve:e,reject:t})=>{Pv.invokeViewMethod(QE,{},Xc(),A=>{void 0===A.end&&void 0===A.start?t("no focused"):e(A)})}),fE={[hA]:[],[dA]:[],[uA]:[],[cA]:[],[lA]:[]};function mE(A,e){const t=np();if(t&&t.$vm)return Go(A,e,t.$vm.$);fE[A].push(e)}function yE(A,e){const t=np();if(t&&t.$vm)return function(A,e,t){const i=A.$[e];C(i)&&t.__weh&&E(i,t.__weh)}(t.$vm,A,e);E(fE[A],e)}const DE=PI(0,()=>vC()),vE=PI(0,()=>u({},yC));let wE,SE,ME;function RE(A){try{return JSON.parse(A)}catch(__){}return A}const _E=[];function TE(A,e){_E.forEach(t=>{t(A,e)}),_E.length=0}const NE=YI("getPushClientId",(A,{resolve:e,reject:t})=>{Promise.resolve().then(()=>{void 0===ME&&(ME=!1,wE="",SE="uniPush is not enabled"),_E.push((A,i)=>{A?e({cid:A}):t(i)}),void 0!==wE&&TE(wE,SE)})}),bE=[],GE={formatArgs:{showToast:!0},beforeInvoke(){Zg()},beforeSuccess(A,e){if(!e.showToast)return;const{t:t}=Jg(),i=t("uni.setClipboardData.success");i&&uni.showToast({title:i,icon:"success",mask:!1})}},kE=(Boolean,"onAccelerometer"),LE="onCompass",UE="removeStorage",FE={formatArgs:{filePath(A,e){e.filePath=AC(A)}}},OE={formatArgs:{filePath(A,e){e.filePath=AC(A)}}},xE=["wgs84","gcj02"],PE={formatArgs:{type(A,e){A=(A||"").toLowerCase(),-1===xE.indexOf(A)?e.type=xE[0]:e.type=A},altitude(A,e){e.altitude=A||!1}}},YE=(Boolean,(A,e)=>{if(void 0===e)return`${A} should not be empty.`;if("number"!=typeof e){let A=typeof e;return A=A[0].toUpperCase()+A.substring(1),`Expected Number, got ${A} with value ${JSON.stringify(e)}.`}}),JE={formatArgs:{latitude(A,e){const t=YE("latitude",A);if(t)return t;e.latitude=A},longitude(A,e){const t=YE("longitude",A);if(t)return t;e.longitude=A},scale(A,e){A=Math.floor(A),e.scale=A>=5&&A<=18?A:18}}},HE={formatArgs:{count(A,e){(!A||A<=0)&&(e.count=9)},sizeType(A,e){e.sizeType=gI(A,nI)},sourceType(A,e){e.sourceType=gI(A,rI)},extension(A,e){if(A instanceof Array&&0===A.length)return"param extension should not be empty.";A||(e.extension=["*"])}}},qE={formatArgs:{sourceType(A,e){e.sourceType=gI(A,rI)},compressed:!0,maxDuration:60,camera:"back",extension(A,e){if(A instanceof Array&&0===A.length)return"param extension should not be empty.";A||(e.extension=["*"])}}},VE=(Boolean,["all","image","video"]),jE={formatArgs:{count(A,e){(!A||A<=0)&&(e.count=100)},sourceType(A,e){e.sourceType=gI(A,rI)},type(A,e){e.type=aI(A,VE)},extension(A,e){if(A instanceof Array&&0===A.length)return"param extension should not be empty.";A||("all"!==e.type&&e.type?e.extension=["*"]:e.extension=[""])}}},KE={formatArgs:{src(A,e){e.src=AC(A)}}},WE={formatArgs:{urls(A,e){e.urls=A.map(A=>f(A)&&A?AC(A):"")},current(A,e){"number"==typeof A?e.current=A>0&&A A),r={};n.forEach(A=>{const e=A.split("=");r[e[0]]=e[1]});for(const s in e)if(h(e,s)){let A=e[s];null==A?A="":S(A)&&(A=JSON.stringify(A)),r[ed(s)]=ed(A)}return o=Object.keys(r).map(A=>`${A}=${r[A]}`).join("&"),A+(o?"?"+o:"")+(i?"#"+i:"")}(A,e.data))},header(A,e){const t=e.header=A||{};e.method!==sI[0]&&(Object.keys(t).find(A=>"content-type"===A.toLowerCase())||(t["Content-Type"]="application/json"))},dataType(A,e){e.dataType=(A||$E).toLowerCase()},responseType(A,e){e.responseType=(A||"").toLowerCase(),-1===Ad.indexOf(e.responseType)&&(e.responseType="text")}}},id={formatArgs:{header(A,e){e.header=A||{}}}},od={formatArgs:{filePath(A,e){A&&(e.filePath=AC(A))},header(A,e){e.header=A||{}},formData(A,e){e.formData=A||{}}}},nd={formatArgs:{header(A,e){e.header=A||{}},method(A,e){e.method=aI((A||"").toUpperCase(),sI)},protocols(A,e){f(A)&&(e.protocols=[A])}}},rd="onLocationChange",sd="onLocationChangeError",ad=["wgs84","gcj02"],gd={formatArgs:{type(A,e){A=(A||"").toLowerCase(),-1===ad.indexOf(A)?e.type=ad[1]:e.type=A}}};const cd={url:{type:String,required:!0}},ld="navigateTo",Id="redirectTo",ud="reLaunch",Ed="switchTab",dd="preloadPage",hd=(fd(["slide-in-right","slide-in-left","slide-in-top","slide-in-bottom","fade-in","zoom-out","zoom-fade-out","pop-in","none"]),fd(["slide-out-right","slide-out-left","slide-out-top","slide-out-bottom","fade-out","zoom-in","zoom-fade-in","pop-out","none"]),Dd(ld)),Cd=Dd(Id),Bd=Dd(ud),Qd=Dd(Ed),pd={formatArgs:{delta(A,e){A=parseInt(A+"")||1,e.delta=Math.min(Lh().length-1,A)}}};function fd(A){return{animationType:{type:String,validator(e){if(e&&-1===A.indexOf(e))return"`"+e+"` is not supported for `animationType` (supported values are: `"+A.join("`|`")+"`)"}},animationDuration:{type:Number}}}let md;function yd(){md=""}function Dd(A){return{formatArgs:{url:vd(A)},beforeAll:yd}}function vd(A){return function(e,t){if(!e)return'Missing required args: "url"';const i=(e=function(A){if(0===A.indexOf("/")||0===A.indexOf("uni:"))return A;let e="";const t=Lh();return t.length&&(e=xc(t[t.length-1]).route),al(e,A)}(e)).split("?")[0],o=gl(i,!0);if(!o)return"page `"+e+"` is not found";if(A===ld||A===Id){if(o.meta.isTabBar)return`can not ${A} a tabbar page`}else if(A===Ed&&!o.meta.isTabBar)return"can not switch to no-tabBar page";if(A!==Ed&&A!==dd||!o.meta.isTabBar||"appLaunch"===t.openType||(e=i),o.meta.isEntry&&(e=e.replace(o.alias,"/")),t.url=function(A){if(!f(A))return A;const e=A.indexOf("?");if(-1===e)return A;const t=A.slice(e+1).trim().replace(/^(\?|#|&)/,"");if(!t)return A;A=A.slice(0,e);const i=[];return t.split("&").forEach(A=>{const e=A.replace(/\+/g," ").split("="),t=e.shift(),o=e.length>0?e.join("="):"";i.push(t+"="+encodeURIComponent(o))}),i.length?A+"?"+i.join("&"):A}(e),"unPreloadPage"!==A)if(A!==dd){if(md===e&&"appLaunch"!==t.openType)return`${md} locked`;__uniConfig.ready&&(md=e)}else if(o.meta.isTabBar){const A=Lh(),e=o.path.slice(1);if(A.find(A=>A.route===e))return"tabBar page `"+e+"` already exists"}}}const wd="setNavigationBarColor",Sd={formatArgs:{animation(A,e){A||(A={duration:0,timingFunc:"linear"}),e.animation={duration:A.duration||0,timingFunc:A.timingFunc||"linear"}}}},Md="setNavigationBarTitle",Rd="showNavigationBarLoading",_d="hideNavigationBarLoading",Td={formatArgs:{duration:300}},Nd={formatArgs:{itemColor:"#000"}},bd=(Boolean,{formatArgs:{title:"",mask:!1}}),Gd=(Boolean,{beforeInvoke(){Wg()},formatArgs:{title:"",content:"",placeholderText:"",showCancel:!0,editable:!1,cancelText(A,e){if(!h(e,"cancelText")){const{t:A}=Jg();e.cancelText=A("uni.showModal.cancel")}},cancelColor:"#000",confirmText(A,e){if(!h(e,"confirmText")){const{t:A}=Jg();e.confirmText=A("uni.showModal.confirm")}},confirmColor:sA}}),kd=["success","loading","none","error"],Ld=(Boolean,{formatArgs:{title:"",icon(A,e){e.icon=aI(A,kd)},image(A,e){e.image=A?AC(A):""},duration:1500,mask:!1}}),Ud="startPullDownRefresh",Fd="stopPullDownRefresh",Od={beforeInvoke(){const A=Zc();if(A&&!A.isTabBar)return"not TabBar page"},formatArgs:{index(A){if(!__uniConfig.tabBar.list[A])return"tabbar item not found"}}},xd="setTabBarItem",Pd={beforeInvoke:Od.beforeInvoke,formatArgs:u({pagePath(A,e){A&&(e.pagePath=YA(A))}},Od.formatArgs)},Yd="setTabBarStyle",Jd=/^(linear|radial)-gradient\(.+?\);?$/,Hd={beforeInvoke:Od.beforeInvoke,formatArgs:{backgroundImage(A,e){A&&!Jd.test(A)&&(e.backgroundImage=AC(A))},borderStyle(A,e){A&&(e.borderStyle="white"===A?"white":"black")}}},qd="hideTabBar",Vd="showTabBar",Kd="hideTabBarRedDot",Wd=Od,zd="showTabBarRedDot",Zd=Od,Xd="removeTabBarBadge",$d=Od,Ah="setTabBarBadge",eh={beforeInvoke:Od.beforeInvoke,formatArgs:u({text(A,e){(function(A=""){return(""+A).replace(/[^\x00-\xff]/g,"**").length})(A)>=4&&(e.text="...")}},Od.formatArgs)},th=function(){if("object"==typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var A=function(){for(var A=window.document,e=o(A);e;)e=o(A=e.ownerDocument);return A}(),e=[],t=null,i=null;r.prototype.THROTTLE_TIMEOUT=100,r.prototype.POLL_INTERVAL=null,r.prototype.USE_MUTATION_OBSERVER=!0,r._setupCrossOriginUpdater=function(){return t||(t=function(A,t){i=A&&t?I(A,t):{top:0,bottom:0,left:0,right:0,width:0,height:0},e.forEach(function(A){A._checkForIntersections()})}),t},r._resetCrossOriginUpdater=function(){t=null,i=null},r.prototype.observe=function(A){if(!this._observationTargets.some(function(e){return e.element==A})){if(!A||1!=A.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:A,entry:null}),this._monitorIntersections(A.ownerDocument),this._checkForIntersections()}},r.prototype.unobserve=function(A){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=A}),this._unmonitorIntersections(A.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},r.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},r.prototype.takeRecords=function(){var A=this._queuedEntries.slice();return this._queuedEntries=[],A},r.prototype._initThresholds=function(A){var e=A||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(A,e,t){if("number"!=typeof A||isNaN(A)||A<0||A>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return A!==t[e-1]})},r.prototype._parseRootMargin=function(A){var e=(A||"0px").split(/\s+/).map(function(A){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(A);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},r.prototype._monitorIntersections=function(e){var t=e.defaultView;if(t&&-1==this._monitoringDocuments.indexOf(e)){var i=this._checkForIntersections,n=null,r=null;this.POLL_INTERVAL?n=t.setInterval(i,this.POLL_INTERVAL):(s(t,"resize",i,!0),s(e,"scroll",i,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in t&&(r=new t.MutationObserver(i)).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),this._monitoringDocuments.push(e),this._monitoringUnsubscribes.push(function(){var A=e.defaultView;A&&(n&&A.clearInterval(n),a(A,"resize",i,!0)),a(e,"scroll",i,!0),r&&r.disconnect()});var g=this.root&&(this.root.ownerDocument||this.root)||A;if(e!=g){var c=o(e);c&&this._monitorIntersections(c.ownerDocument)}}},r.prototype._unmonitorIntersections=function(e){var t=this._monitoringDocuments.indexOf(e);if(-1!=t){var i=this.root&&(this.root.ownerDocument||this.root)||A;if(!this._observationTargets.some(function(A){var t=A.element.ownerDocument;if(t==e)return!0;for(;t&&t!=i;){var n=o(t);if((t=n&&n.ownerDocument)==e)return!0}return!1})){var n=this._monitoringUnsubscribes[t];if(this._monitoringDocuments.splice(t,1),this._monitoringUnsubscribes.splice(t,1),n(),e!=i){var r=o(e);r&&this._unmonitorIntersections(r.ownerDocument)}}}},r.prototype._unmonitorAllIntersections=function(){var A=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e =0&&s>=0&&{top:t,bottom:i,left:o,right:n,width:r,height:s}||null}function c(A){var e;try{e=A.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function l(A){return!A||"x"in A?A:{top:A.top,y:A.top,bottom:A.bottom,left:A.left,x:A.left,right:A.right,width:A.width,height:A.height}}function I(A,e){var t=e.top-A.top,i=e.left-A.left;return{top:t,left:i,height:e.height,width:e.width,bottom:t+e.height,right:i+e.width}}function u(A,e){for(var t=e;t;){if(t==A)return!0;t=E(t)}return!1}function E(e){var t=e.parentNode;return 9==e.nodeType&&e!=A?o(e):(t&&t.assignedSlot&&(t=t.assignedSlot.parentNode),t&&11==t.nodeType&&t.host?t.host:t)}function d(A){return A&&9===A.nodeType}};function ih(A){const{bottom:e,height:t,left:i,right:o,top:n,width:r}=A||{};return{bottom:e,height:t,left:i,right:o,top:n,width:r}}function oh(A){const{intersectionRatio:e,boundingClientRect:{height:t,width:i},intersectionRect:{height:o,width:n}}=A;return 0!==e?e:o===t?n/i:o/t}function nh(){const A=$c();if(!A)return;const e=kh(),t=e.keys();for(const i of t){const A=e.get(i);A.$.__isTabBar?A.$.__isActive=!1:Fh(i)}A.$.__isTabBar&&(A.$.__isVisible=!1,il(A,lA))}function rh(A,e){return A===e.fullPath||"/"===A&&e.meta.isEntry}function sh(A){const e=kh().values();for(const t of e){const e=Rh(t);if(rh(A,e))return t.$.__isActive=!0,e.id}}const ah=YI(Ed,({url:A,tabBarText:e,isAutomatedTesting:t},{resolve:i,reject:o})=>{if(_h.handledBeforeEntryPageRoutes)return nh(),uh({type:Ed,url:A,tabBarText:e,isAutomatedTesting:t},sh(A)).then(i).catch(o);Nh.push({args:{type:Ed,url:A,tabBarText:e,isAutomatedTesting:t},resolve:i,reject:o})},0,Qd);function gh(){const A=zc();if(!A)return;const e=Rh(A);Fh(Yh(e.path,e.id))}const ch=YI(Id,({url:A,isAutomatedTesting:e},{resolve:t,reject:i})=>{if(_h.handledBeforeEntryPageRoutes)return gh(),uh({type:Id,url:A,isAutomatedTesting:e}).then(t).catch(i);bh.push({args:{type:Id,url:A,isAutomatedTesting:e},resolve:t,reject:i})},0,Cd);function lh(){const A=kh().keys();for(const e of A)Fh(e)}const Ih=YI(ud,({url:A,isAutomatedTesting:e},{resolve:t,reject:i})=>{if(_h.handledBeforeEntryPageRoutes)return lh(),uh({type:ud,url:A,isAutomatedTesting:e}).then(t).catch(i);Gh.push({args:{type:ud,url:A,isAutomatedTesting:e},resolve:t,reject:i})},0,Bd);function uh({type:A,url:e,tabBarText:t,events:i,isAutomatedTesting:o},n){const r=np().$router,{path:s,query:a}=function(A){const[e,t]=A.split("?",2);return{path:e,query:ge(t||"")}}(e);return new Promise((e,g)=>{const c=function(A,e){return{__id__:e||++Oh,__type__:A}}(A,n);r["navigateTo"===A?"push":"replace"]({path:s,query:a,state:c,force:!0}).then(n=>{if(Pa(n))return g(n.message);if("switchTab"===A&&(r.currentRoute.value.meta.tabBarText=t),"navigateTo"===A){const A=r.currentRoute.value.meta;return A.eventChannel?i&&(Object.keys(i).forEach(e=>{A.eventChannel._addListener(e,"on",i[e])}),A.eventChannel._clearCache()):A.eventChannel=new le(c.__id__,i),e(o?{__id__:c.__id__}:{eventChannel:A.eventChannel})}return o?e({__id__:c.__id__}):e()})})}function Eh(){if(_h.handledBeforeEntryPageRoutes)return;_h.handledBeforeEntryPageRoutes=!0;const A=[...Th];Th.length=0,A.forEach(({args:A,resolve:e,reject:t})=>uh(A).then(e).catch(t));const e=[...Nh];Nh.length=0,e.forEach(({args:A,resolve:e,reject:t})=>(nh(),uh(A,sh(A.url)).then(e).catch(t)));const t=[...bh];bh.length=0,t.forEach(({args:A,resolve:e,reject:t})=>(gh(),uh(A).then(e).catch(t)));const i=[...Gh];Gh.length=0,i.forEach(({args:A,resolve:e,reject:t})=>(lh(),uh(A).then(e).catch(t)))}let dh;function hh(){var A;return dh||(dh=__uniConfig.tabBar&&Nt((A=__uniConfig.tabBar,Fg()&&A.list&&A.list.forEach(A=>{Yg(A,["text"])}),A))),dh}function Ch(A){const e=window.CSS&&window.CSS.supports;return e&&(e(A)||e.apply(window.CSS,A.split(":")))}const Bh=Ch("--a:0"),Qh=Ch("top:env(a)"),ph=Ch("top:constant(a)"),fh=Ch("backdrop-filter:blur(10px)"),mh={"css.var":Bh,"css.env":Qh,"css.constant":ph,"css.backdrop-filter":fh},yh=PI(0,A=>h(mh,A)?mh[A]:!!h(uni,A)),Dh=(()=>Qh?"env":ph?"constant":"")();function vh(A){let e=0,t=0;if("custom"!==A.navigationBar.style&&["default","float"].indexOf(A.navigationBar.type)>-1&&(e=44),A.isTabBar){const A=hh();A.shown&&(t=parseInt(A.height))}var i;Lc({"--window-top":(i=e,Dh?`calc(${i}px + ${Dh}(safe-area-inset-top))`:`${i}px`),"--window-bottom":wh(t)})}function wh(A){return Dh?`calc(${A}px + ${Dh}(safe-area-inset-bottom))`:`${A}px`}const Sh="$$",Mh=new Map;function Rh(A){return A.$page}const _h={handledBeforeEntryPageRoutes:!1},Th=[],Nh=[],bh=[],Gh=[];function kh(){return Mh}function Lh(){return Uh()}function Uh(){const A=[],e=Mh.values();for(const t of e)t.$.__isTabBar?t.$.__isActive&&A.push(t):A.push(t);return A}function Fh(A,e=!0){const t=Mh.get(A);t.$.__isUnload=!0,il(t,QA),Mh.delete(A),e&&function(A){const e=Jh.get(A);e&&(Jh.delete(A),Hh.pruneCacheEntry(e))}(A)}let Oh=tI();function xh(A){const e=$l();let t=A.fullPath;return A.meta.isEntry&&-1===t.indexOf(A.meta.route)&&(t="/"+A.meta.route+t.replace("/","")),function(A,e,t,i,o,n){const{id:r,route:s}=i,a=fe(i.navigationBar,__uniConfig.themeConfig,n).titleColor;return{id:r,path:PA(s),route:s,fullPath:e,options:t,meta:i,openType:A,eventChannel:o,statusBarStyle:"#ffffff"===a?"light":"dark"}}("navigateTo",t,{},e)}function Ph(A){const e=xh(A.$route);!function(A,e){A.route=e.route,A.$vm=A,A.$page=e,A.$mpType="page",A.$fontFamilySet=new Set,e.meta.isTabBar&&(A.$.__isTabBar=!0,A.$.__isActive=!0)}(A,e),Mh.set(Yh(e.path,e.id),A),1===Mh.size&&setTimeout(()=>{Eh()},0)}function Yh(A,e){return A+Sh+e}const Jh=new Map,Hh={get:A=>Jh.get(A),set(A,e){!function(A){const e=parseInt(A.split(Sh)[1]);if(!e)return;Hh.forEach((A,t)=>{const i=parseInt(t.split(Sh)[1]);if(i&&i>e){if(function(A){return"tabBar"===A.props.type}(A))return;Hh.delete(t),Hh.pruneCacheEntry(A),pi(()=>{Mh.forEach((A,e)=>{A.$.isUnmounted&&Mh.delete(e)})})}})}(A),Jh.set(A,e)},delete(A){Jh.get(A)&&Jh.delete(A)},forEach(A){Jh.forEach(A)}};function qh(A,e){!function(A){const e=jh(A),{body:t}=document;Kh&&t.removeAttribute(Kh),e&&t.setAttribute(e,""),Kh=e}(A),vh(e),function(A){{const e="nvue-dir-"+__uniConfig.nvue["flex-direction"];A.isNVue?(document.body.setAttribute("nvue",""),document.body.setAttribute(e,"")):(document.body.removeAttribute("nvue"),document.body.removeAttribute(e))}}(e),Zh(A,e)}function Vh(A){const e=jh(A);e&&function(A){const e=document.querySelector("uni-page-body");e&&e.setAttribute(A,"")}(e)}function jh(A){return A.type.__scopeId}let Kh;const Wh=!!(()=>{let A=!1;try{const e={};Object.defineProperty(e,"passive",{get(){A=!0}}),window.addEventListener("test-passive",()=>{},e)}catch(__){}return A})()&&{passive:!1};let zh;function Zh(A,e){if(document.removeEventListener("touchmove",ol),zh&&document.removeEventListener("scroll",zh),e.disableScroll)return document.addEventListener("touchmove",ol,Wh);const{onPageScroll:t,onReachBottom:i}=A,o="transparent"===e.navigationBar.type;if(!(null==t?void 0:t.length)&&!(null==i?void 0:i.length)&&!o)return;const n={},r=Rh(A.proxy).id;(t||o)&&(n.onPageScroll=function(A,e,t){return i=>{e&&Ov.publishHandler(DA,{scrollTop:i},A),t&&Ov.emit(A+"."+DA,{scrollTop:i})}}(r,t,o)),(null==i?void 0:i.length)&&(n.onReachBottomDistance=e.onReachBottomDistance||50,n.onReachBottom=()=>Ov.publishHandler(wA,{},r)),zh=sl(n),requestAnimationFrame(()=>document.addEventListener("scroll",zh))}function Xh(A){return A.$el}function $h(A){const{base:e}=__uniConfig.router;return 0===PA(A).indexOf(e)?PA(A):e+A}function AC(A){const{base:e,assets:t}=__uniConfig.router;if("./"===e&&(0!==A.indexOf("./")||!A.includes("/static/")&&0!==A.indexOf("./"+(t||"assets")+"/")||(A=A.slice(1))),0===A.indexOf("/")){if(0!==A.indexOf("//"))return $h(A.slice(1));A="https:"+A}if(aA.test(A)||gA.test(A)||0===A.indexOf("blob:"))return A;const i=Uh();return i.length?$h(al(Rh(i[i.length-1]).route,A).slice(1)):A}const eC=navigator.userAgent,tC=/android/i.test(eC),iC=/iphone|ipad|ipod/i.test(eC),oC=eC.match(/Windows NT ([\d|\d.\d]*)/i),nC=/Macintosh|Mac/i.test(eC),rC=/Linux|X11/i.test(eC),sC=nC&&navigator.maxTouchPoints>0;function aC(){return/^Apple/.test(navigator.vendor)&&"number"==typeof window.orientation}function gC(A){return A&&90===Math.abs(window.orientation)}function cC(A,e){return A?Math[e?"max":"min"](screen.width,screen.height):screen.width}function lC(A){return Math.min(window.innerWidth,document.documentElement.clientWidth,A)||A}function IC(A,e,t,i){Pv.invokeViewMethod("video."+A,{videoId:A,type:t,data:i},e)}function uC(A,e){const t={},{top:i,topWindowHeight:o}=Gc();if(e.node){const e=A.tagName.split("-")[1]||A.tagName;e&&(t.node=A.querySelector(e))}if(e.id&&(t.id=A.id),e.dataset&&(t.dataset=te(A)),e.rect||e.size){const n=A.getBoundingClientRect();e.rect&&(t.left=n.left,t.right=n.right,t.top=n.top-i-o,t.bottom=n.bottom-i-o),e.size&&(t.width=n.width,t.height=n.height)}if(C(e.properties)&&e.properties.forEach(A=>{A=A.replace(/-([a-z])/g,function(A,e){return e.toUpperCase()})}),e.scrollOffset)if("UNI-SCROLL-VIEW"===A.tagName){const e=A.children[0].children[0];t.scrollLeft=e.scrollLeft,t.scrollTop=e.scrollTop,t.scrollHeight=e.scrollHeight,t.scrollWidth=e.scrollWidth}else t.scrollLeft=0,t.scrollTop=0,t.scrollHeight=0,t.scrollWidth=0;if(C(e.computedStyle)){const i=getComputedStyle(A);e.computedStyle.forEach(A=>{t[A]=i[A]})}return e.context&&(t.contextInfo=function(A){return A.__uniContextInfo}(A)),t}function EC(A,e){return(A.matches||A.matchesSelector||A.mozMatchesSelector||A.msMatchesSelector||A.oMatchesSelector||A.webkitMatchesSelector||function(A){const e=this.parentElement.querySelectorAll(A);let t=e.length;for(;--t>=0&&e.item(t)!==this;);return t>-1}).call(A,e)}let dC={},hC={};function CC(A){return A.replace(/([A-Z])/g,"-$1").toLowerCase()}const BC={};function QC(A,e){const t=BC[A];return t?Promise.resolve(t):/^data:[a-z-]+\/[a-z-]+;base64,/.test(A)?Promise.resolve(function(A){const e=A.split(","),t=e[0].match(/:(.*?);/),i=t?t[1]:"",o=atob(e[1]);let n=o.length;const r=new Uint8Array(n);for(;n--;)r[n]=o.charCodeAt(n);return pC(r,i)}(A)):e?Promise.reject(new Error("not find")):new Promise((e,t)=>{const i=new XMLHttpRequest;i.open("GET",A,!0),i.responseType="blob",i.onload=function(){e(this.response)},i.onerror=t,i.send()})}function pC(A,e){let t;if(A instanceof File)t=A;else{e=e||A.type||"";const o=`${Date.now()}${function(A){const e=A.split("/")[1];return e?`.${e}`:""}(e)}`;try{t=new File([A],o,{type:e})}catch(i){t=A=A instanceof Blob?A:new Blob([A],{type:e}),t.name=t.name||o}}return t}function fC(A){for(const t in BC)if(h(BC,t)){if(BC[t]===A)return t}var e=(window.URL||window.webkitURL).createObjectURL(A);return BC[e]=A,e}function mC(A){(window.URL||window.webkitURL).revokeObjectURL(A),delete BC[A]}const yC=Nl(),DC=Nl();function vC(){return u({},DC)}const wC=Ll({name:"ResizeSensor",props:{initial:{type:Boolean,default:!1}},emits:["resize"],setup(A,{emit:e}){const t=Kt(null),i=function(A){return()=>{const{firstElementChild:e,lastElementChild:t}=A.value;e.scrollLeft=1e5,e.scrollTop=1e5,t.scrollLeft=1e5,t.scrollTop=1e5}}(t),o=function(A,e,t){const i=Nt({width:-1,height:-1});return Xi(()=>u({},i),A=>e("resize",A)),()=>{const e=A.value;e&&(i.width=e.offsetWidth,i.height=e.offsetHeight,t())}}(t,e,i);return function(A,e,t,i){wo(i),Uo(()=>{e.initial&&pi(t);const o=A.value;o.offsetParent!==o.parentElement&&(o.parentElement.style.position="relative"),"AnimationEvent"in window||i()})}(t,A,o,i),()=>Ir("uni-resize-sensor",{ref:t,onAnimationstartOnce:o},[Ir("div",{onScroll:o},[Ir("div",null,null)],40,["onScroll"]),Ir("div",{onScroll:o},[Ir("div",null,null)],40,["onScroll"])],40,["onAnimationstartOnce"])}});const SC=function(){if(navigator.userAgent.includes("jsdom"))return 1;const A=document.createElement("canvas");A.height=A.width=0;const e=A.getContext("2d"),t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t}();function MC(A,e=!0){const t=e?SC:1;A.width=A.offsetWidth*t,A.height=A.offsetHeight*t,A.getContext("2d").__hidpi__=e}let RC=!1;function _C(){if(RC)return;RC=!0;const A={fillRect:"all",clearRect:"all",strokeRect:"all",moveTo:"all",lineTo:"all",arc:[0,1,2],arcTo:"all",bezierCurveTo:"all",isPointinPath:"all",isPointinStroke:"all",quadraticCurveTo:"all",rect:"all",translate:"all",createRadialGradient:"all",createLinearGradient:"all",transform:[4,5],setTransform:[4,5]},e=CanvasRenderingContext2D.prototype;e.drawImageByCanvas=function(A){return function(e,t,i,o,n,r,s,a,g,c){if(!this.__hidpi__)return A.apply(this,arguments);t*=SC,i*=SC,o*=SC,n*=SC,r*=SC,s*=SC,a=c?a*SC:a,g=c?g*SC:g,A.call(this,e,t,i,o,n,r,s,a,g)}}(e.drawImage),1!==SC&&(!function(A,e){for(const t in A)h(A,t)&&e(A[t],t)}(A,function(A,t){e[t]=function(e){return function(){if(!this.__hidpi__)return e.apply(this,arguments);let t=Array.prototype.slice.call(arguments);if("all"===A)t=t.map(function(A){return A*SC});else if(Array.isArray(A))for(let e=0;e _C());function NC(A){return A?AC(A):A}function bC(A){return(A=A.slice(0))[3]=A[3]/255,"rgba("+A.join(",")+")"}function GC(A,e){Array.from(e).forEach(e=>{e.x=e.clientX-A.left,e.y=e.clientY-A.top})}let kC;function LC(A=0,e=0){return kC||(kC=document.createElement("canvas")),kC.width=A,kC.height=e,kC}const UC=Ll({inheritAttrs:!1,name:"Canvas",compatConfig:{MODE:3},props:{canvasId:{type:String,default:""},disableScroll:{type:[Boolean,String],default:!1},hidpi:{type:Boolean,default:!0}},computed:{id(){return this.canvasId}},setup(A,{emit:e,slots:t}){TC();const i=Kt(null),o=Kt(null),n=Kt(null),r=Kt(!1),s=function(A){return(e,t)=>{A(e,hl(t))}}(e),{$attrs:a,$excludeAttrs:g,$listeners:c}=MB({excludeListeners:!0}),{_listeners:l}=function(A,e,t){const i=Ur(()=>{let i=["onTouchstart","onTouchmove","onTouchend"],o=e.value,n=u({},(()=>{let A={};for(const e in o)if(h(o,e)){const t=o[e];A[e]=t}return A})());return i.forEach(e=>{let i=[];n[e]&&i.push(Fl(A=>{const i=A.currentTarget.getBoundingClientRect();GC(i,A.touches),GC(i,A.changedTouches),t(e.replace("on","").toLocaleLowerCase(),A)})),A.disableScroll&&"onTouchmove"===e&&i.push(_c),n[e]=i}),n});return{_listeners:i}}(A,c,s),{_handleSubscribe:I,_resize:E}=function(A,e,t){let i=[],o={};const n=Ur(()=>A.hidpi?SC:1);function r(t){let i=e.value;if(!t||i.width!==Math.floor(t.width*n.value)||i.height!==Math.floor(t.height*n.value))if(i.width>0&&i.height>0){let e=i.getContext("2d"),t=e.getImageData(0,0,i.width,i.height);MC(i,A.hidpi),e.putImageData(t,0,0)}else MC(i,A.hidpi)}function s({actions:A,reserve:n},r){if(!A)return;if(t.value)return void i.push([A,n]);let s=e.value,c=s.getContext("2d");n||(c.fillStyle="#000000",c.strokeStyle="#000000",c.shadowColor="#000000",c.shadowBlur=0,c.shadowOffsetX=0,c.shadowOffsetY=0,c.setTransform(1,0,0,1,0,0),c.clearRect(0,0,s.width,s.height)),a(A);for(let e=0;e {A.src=e}).catch(()=>{A.src=i})}"drawImage"===e?(i=t[0],i=NC(i),t[0]=i):"setFillStyle"===e&&"pattern"===t[0]&&(i=t[1],i=NC(i),t[1]=i),i&&!o[i]&&n()})}function g(A,e,n,r){let a=o[A];return a.ready?(r(a),!0):(i.unshift([e,!0]),t.value=!0,a.onload=function(){a.ready=!0,r(a),t.value=!1;let A=i.slice(0);i=[];for(let e=A.shift();e;)s({actions:e[0],reserve:e[1]},n),e=A.shift()},!1)}function c({x:A=0,y:t=0,width:i,height:o,destWidth:r,destHeight:s,hidpi:a=!0,dataType:g,quality:c=1,type:l="png"},I){const u=e.value;let E;const d=u.offsetWidth-A;i=i?Math.min(i,d):d;const h=u.offsetHeight-t;o=o?Math.min(o,h):h,a?(r=i,s=o):r||s?r?s||(s=Math.round(o/i*r)):(s||(s=Math.round(o*n.value)),r=Math.round(i/o*s)):(r=Math.round(i*n.value),s=Math.round(o*n.value));const C=LC(r,s),B=C.getContext("2d");let Q;"jpeg"!==l&&"jpg"!==l||(l="jpeg",B.fillStyle="#fff",B.fillRect(0,0,r,s)),B.__hidpi__=!0,B.drawImageByCanvas(u,A,t,i,o,0,0,r,s,!1);try{let A;if("base64"===g)E=C.toDataURL(`image/${l}`,c);else{const A=B.getImageData(0,0,r,s);E=Array.prototype.slice.call(A.data)}Q={data:E,compressed:A,width:r,height:s}}catch(p){Q={errMsg:`canvasGetImageData:fail ${p}`}}if(C.height=C.width=0,B.__hidpi__=!1,!I)return Q;I(Q)}function l({data:A,x:t,y:i,width:o,height:n,compressed:r},s){try{0,n||(n=Math.round(A.length/4/o));const r=LC(o,n);r.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(A),o,n),0,0),e.value.getContext("2d").drawImage(r,t,i,o,n),r.height=r.width=0}catch(a){return void s({errMsg:"canvasPutImageData:fail"})}s({errMsg:"canvasPutImageData:ok"})}function I({x:A=0,y:e=0,width:t,height:i,destWidth:o,destHeight:n,fileType:r,quality:s,dirname:a},g){const l=c({x:A,y:e,width:t,height:i,destWidth:o,destHeight:n,hidpi:!1,dataType:"base64",type:r,quality:s});var I;l.errMsg?g({errMsg:l.errMsg.replace("canvasPutImageData","toTempFilePath")}):(I=l.data,((A,e)=>{let t="toTempFilePath:"+(A?"fail":"ok");A&&(t+=` ${A.message}`),g({errMsg:t,tempFilePath:e})})(null,I))}const E={actionsChanged:s,getImageData:c,putImageData:l,toTempFilePath:I};function d(A,e,t){let i=E[A];0!==A.indexOf("_")&&p(i)&&i(e,t)}return u(E,{_resize:r,_handleSubscribe:d})}(A,o,r);return LQ(I,FQ(A.canvasId),!0),Uo(()=>{E()}),()=>{const{canvasId:e,disableScroll:r}=A;return Ir("uni-canvas",Qr({ref:i,"canvas-id":e,"disable-scroll":r},a.value,g.value,l.value),[Ir("canvas",{ref:o,class:"uni-canvas-canvas",width:"300",height:"150"},null,512),Ir("div",{style:"position: absolute;top: 0;left: 0;width: 100%;height: 100%;overflow: hidden;"},[t.default&&t.default()]),Ir(wC,{ref:n,onResize:E},null,8,["onResize"])],16,["canvas-id","disable-scroll"])}}});const FC=Uc("ucg"),OC=Ll({name:"CheckboxGroup",props:{name:{type:String,default:""}},emits:["change"],setup(A,{emit:e,slots:t}){const i=Kt(null);return function(A,e){const t=[],i=()=>t.reduce((A,e)=>(e.value.checkboxChecked&&A.push(e.value.value),A),new Array);Qn(FC,{addField(A){t.push(A)},removeField(A){t.splice(t.indexOf(A),1)},checkboxChange(A){e("change",A,{value:i()})}});const o=pn(Jl,!1);o&&o.addField({submit:()=>{let e=["",null];return""!==A.name&&(e[0]=A.name,e[1]=i()),e}})}(A,Ol(i,e)),()=>Ir("uni-checkbox-group",{ref:i},[t.default&&t.default()],512)}});const xC=Ll({name:"Checkbox",props:{checked:{type:[Boolean,String],default:!1},id:{type:String,default:""},disabled:{type:[Boolean,String],default:!1},value:{type:String,default:""},color:{type:String,default:"#007aff"},backgroundColor:{type:String,default:""},borderColor:{type:String,default:""},activeBackgroundColor:{type:String,default:""},activeBorderColor:{type:String,default:""},iconColor:{type:String,default:""},foreColor:{type:String,default:""}},setup(A,{slots:e}){const t=Kt(null),i=Kt(A.checked),o=Ur(()=>"true"===i.value||!0===i.value),n=Kt(A.value);const r=Ur(()=>function(e){if(A.disabled)return{backgroundColor:"#E1E1E1",borderColor:"#D1D1D1"};const t={};return e?(A.activeBorderColor&&(t.borderColor=A.activeBorderColor),A.activeBackgroundColor&&(t.backgroundColor=A.activeBackgroundColor)):(A.borderColor&&(t.borderColor=A.borderColor),A.backgroundColor&&(t.backgroundColor=A.backgroundColor)),t}(o.value));Xi([()=>A.checked,()=>A.value],([A,e])=>{i.value=A,n.value=e});const{uniCheckGroup:s,uniLabel:a}=function(A,e,t){const i=Ur(()=>({checkboxChecked:Boolean(A.value),value:e.value})),o={reset:t},n=pn(FC,!1);n&&n.addField(i);const r=pn(Jl,!1);r&&r.addField(o);const s=pn(Vl,!1);return xo(()=>{n&&n.removeField(i),r&&r.removeField(o)}),{uniCheckGroup:n,uniForm:r,uniLabel:s}}(i,n,()=>{i.value=!1}),g=e=>{A.disabled||(i.value=!i.value,s&&s.checkboxChange(e),e.stopPropagation())};return a&&(a.addHandler(g),xo(()=>{a.removeHandler(g)})),Kl(A,{"label-click":g}),()=>{const o=Yl(A,"disabled");let n;return n=i.value,Ir("uni-checkbox",Qr(o,{id:A.id,onClick:g,ref:t}),[Ir("div",{class:"uni-checkbox-wrapper",style:{"--HOVER-BD-COLOR":A.activeBorderColor}},[Ir("div",{class:["uni-checkbox-input",{"uni-checkbox-input-disabled":A.disabled}],style:r.value},[n?jc(Yc,A.disabled?"#ADADAD":A.foreColor||A.iconColor||A.color,22):""],6),e.default&&e.default()],4)],16,["id","onClick"])}}});function PC(){}const YC={cursorSpacing:{type:[Number,String],default:0},showConfirmBar:{type:[Boolean,String],default:"auto"},adjustPosition:{type:[Boolean,String],default:!0},autoBlur:{type:[Boolean,String],default:!1}};function JC(A,e,t){function i(A){const e=Ur(()=>0===String(navigator.vendor).indexOf("Apple"));A.addEventListener("focus",()=>{clearTimeout(undefined),document.addEventListener("click",PC,!1)});A.addEventListener("blur",()=>{e.value&&A.blur(),document.removeEventListener("click",PC,!1),e.value&&document.documentElement.scrollTo(document.documentElement.scrollLeft,document.documentElement.scrollTop)})}Xi(()=>e.value,A=>A&&i(A))}var HC=/^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,qC=/^<\/([-A-Za-z0-9_]+)[^>]*>/,VC=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,jC=$C("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"),KC=$C("a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"),WC=$C("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),zC=$C("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),ZC=$C("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),XC=$C("script,style");function $C(A){for(var e={},t=A.split(","),i=0;i A/e],heightFix:["offsetHeight","width",(A,e)=>A*e]},tB={aspectFit:["center center","contain"],aspectFill:["center center","cover"],widthFix:[,"100% 100%"],heightFix:[,"100% 100%"],top:["center top"],bottom:["center bottom"],center:["center center"],left:["left center"],right:["right center"],"top left":["left top"],"top right":["right top"],"bottom left":["left bottom"],"bottom right":["right bottom"]},iB=Ll({name:"Image",props:AB,setup(A,{emit:e}){const t=Kt(null),i=function(A,e){const t=Kt(""),i=Ur(()=>{let A="auto",i="";const o=tB[e.mode];return o?(o[0]&&(i=o[0]),o[1]&&(A=o[1])):(i="0% 0%",A="100% 100%"),`background-image:${t.value?'url("'+t.value+'")':"none"};background-position:${i};background-size:${A};`}),o=Nt({rootEl:A,src:Ur(()=>e.src?AC(e.src):""),origWidth:0,origHeight:0,origStyle:{width:"",height:""},modeStyle:i,imgSrc:t});return Uo(()=>{const e=A.value;o.origWidth=e.clientWidth||0,o.origHeight=e.clientHeight||0}),o}(t,A),o=Ol(t,e),{fixSize:n}=function(A,e,t){const i=()=>{const{mode:i}=e,o=eB[i];if(!o)return;const{origWidth:n,origHeight:r}=t,s=n&&r?n/r:0;if(!s)return;const a=A.value,g=a[o[0]];g&&(a.style[o[1]]=function(A){oB&&A>10&&(A=2*Math.round(A/2));return A}(o[2](g,s))+"px")},o=()=>{const{style:e}=A.value,{origStyle:{width:i,height:o}}=t;e.width=i,e.height=o};return Xi(()=>e.mode,(A,e)=>{eB[e]&&o(),eB[A]&&i()}),{fixSize:i,resetSize:o}}(t,A,i);return function(A,e,t,i,o){let n,r;const s=(e=0,t=0,i="")=>{A.origWidth=e,A.origHeight=t,A.imgSrc=i},a=a=>{if(!a)return g(),void s();n=n||new Image,n.onload=A=>{const{width:c,height:l}=n;s(c,l,a),pi(()=>{i()}),n.draggable=e.draggable,r&&r.remove(),r=n,t.value.appendChild(n),g(),o("load",A,{width:c,height:l})},n.onerror=e=>{s(),g(),o("error",e,{errMsg:`GET ${A.src} 404 (Not Found)`})},n.src=a},g=()=>{n&&(n.onload=null,n.onerror=null,n=null)};Xi(()=>A.src,A=>a(A)),Xi(()=>A.imgSrc,A=>{!A&&r&&(r.remove(),r=null)}),Uo(()=>a(A.src)),xo(()=>g())}(i,A,t,n,o),()=>Ir("uni-image",{ref:t},[Ir("div",{style:i.modeStyle},null,4),eB[A.mode]?Ir(wC,{onResize:n},null,8,["onResize"]):Ir("span",null,null)],512)}});const oB="Google Inc."===navigator.vendor;const nB=oe(!0),rB=[];let sB=0,aB=!1;const gB=A=>rB.forEach(e=>e.userAction=A);function cB(A={userAction:!1}){if(!aB){["touchstart","touchmove","touchend","mousedown","mouseup"].forEach(A=>{document.addEventListener(A,function(){!sB&&gB(!0),sB++,setTimeout(()=>{! --sB&&gB(!1)},0)},nB)}),aB=!0}rB.push(A)}const lB=()=>!!sB;function IB(){const A=Nt({userAction:!1});return Uo(()=>{cB(A)}),xo(()=>{!function(A){const e=rB.indexOf(A);e>=0&&rB.splice(e,1)}(A)}),{state:A}}function uB(A,e){const t=document.activeElement;if(!t)return e({});const i={};["input","textarea"].includes(t.tagName.toLowerCase())&&(i.start=t.selectionStart,i.end=t.selectionEnd),e(i)}function EB(A,e,t){"number"===e&&isNaN(Number(A))&&(A="");return null==A?"":String(A)}const dB=["none","text","decimal","numeric","tel","search","email","url"],hB=u({},{name:{type:String,default:""},modelValue:{type:[String,Number]},value:{type:[String,Number]},disabled:{type:[Boolean,String],default:!1},autoFocus:{type:[Boolean,String],default:!1},focus:{type:[Boolean,String],default:!1},cursor:{type:[Number,String],default:-1},selectionStart:{type:[Number,String],default:-1},selectionEnd:{type:[Number,String],default:-1},type:{type:String,default:"text"},password:{type:[Boolean,String],default:!1},placeholder:{type:String,default:""},placeholderStyle:{type:String,default:""},placeholderClass:{type:String,default:""},maxlength:{type:[Number,String],default:140},confirmType:{type:String,default:"done"},confirmHold:{type:Boolean,default:!1},ignoreCompositionEvent:{type:Boolean,default:!0},step:{type:String,default:"0.000000000000000001"},inputmode:{type:String,default:void 0,validator:A=>!!~dB.indexOf(A)},cursorColor:{type:String,default:""}},YC),CB=["input","focus","blur","update:value","update:modelValue","update:focus","compositionstart","compositionupdate","compositionend","keyboardheightchange"];function BB(A,e,t,i){let o=null;o=ce(t=>{e.value=EB(t,A.type)},100,{setTimeout:setTimeout,clearTimeout:clearTimeout}),Xi(()=>A.modelValue,o),Xi(()=>A.value,o);const n=function(A,e){let t,i,o=0;const n=function(...n){const r=Date.now();clearTimeout(t),i=()=>{i=null,o=r,A.apply(this,n)},r-o {o.cancel(),t("update:modelValue",e.value),t("update:value",e.value),i("input",A,e)},100);return Lo(()=>{o.cancel(),n.cancel()}),{trigger:i,triggerInput:(A,e,t)=>{o.cancel(),n(A,e),t&&n.flush()}}}function QB(A,e){IB();const t=Ur(()=>A.autoFocus||A.focus);function i(){if(!t.value)return;const A=e.value;A?A.focus():setTimeout(i,100)}Xi(()=>A.focus,A=>{A?i():function(){const A=e.value;A&&A.blur()}()}),Uo(()=>{t.value&&pi(i)})}function pB(A,e,t,i){sc(Xc(),"getSelectedTextRange",uB);const{fieldRef:o,state:n,trigger:r}=function(A,e,t){const i=Kt(null),o=Ol(e,t),n=Ur(()=>{const e=Number(A.selectionStart);return isNaN(e)?-1:e}),r=Ur(()=>{const e=Number(A.selectionEnd);return isNaN(e)?-1:e}),s=Ur(()=>{const e=Number(A.cursor);return isNaN(e)?-1:e}),a=Ur(()=>{var e=Number(A.maxlength);return isNaN(e)?140:e});let g="";g=EB(A.modelValue,A.type)||EB(A.value,A.type);const c=Nt({value:g,valueOrigin:g,maxlength:a,focus:A.focus,composing:!1,selectionStart:n,selectionEnd:r,cursor:s});return Xi(()=>c.focus,A=>t("update:focus",A)),Xi(()=>c.maxlength,A=>c.value=c.value.slice(0,A),{immediate:!1}),{fieldRef:i,state:c,trigger:o}}(A,e,t),{triggerInput:s}=BB(A,n,t,r);QB(A,o),JC(0,o);const{state:a}=function(){const A=Nt({attrs:{}});return Uo(()=>{let e=Dr();for(;e;){const t=e.type.__scopeId;t&&(A.attrs[t]=""),e=e.proxy&&"page"===e.proxy.$mpType?null:e.parent}}),{state:A}}();!function(A,e){const t=pn(Jl,!1);if(!t)return;const i=Dr(),o={submit(){const t=i.proxy;return[t[A],f(e)?t[e]:e.value]},reset(){f(e)?i.proxy[e]="":e.value=""}};t.addField(o),xo(()=>{t.removeField(o)})}("name",n),function(A,e,t,i,o,n){function r(){const t=A.value;t&&e.focus&&e.selectionStart>-1&&e.selectionEnd>-1&&"number"!==t.type&&(t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd)}function s(){const t=A.value;t&&e.focus&&e.selectionStart<0&&e.selectionEnd<0&&e.cursor>-1&&"number"!==t.type&&(t.selectionEnd=t.selectionStart=e.cursor)}function a(A){return"number"===A.type?null:A.selectionEnd}Xi([()=>e.selectionStart,()=>e.selectionEnd],r),Xi(()=>e.cursor,s),Xi(()=>A.value,function(){const g=A.value;if(!g)return;const c=function(A,i){A.stopPropagation(),p(n)&&!1===n(A,e)||(e.value=g.value,e.composing&&t.ignoreCompositionEvent||o(A,{value:g.value,cursor:a(g)},i))};function l(A){t.ignoreCompositionEvent||i(A.type,A,{value:A.data})}g.addEventListener("change",A=>A.stopPropagation()),g.addEventListener("focus",function(A){e.focus=!0,i("focus",A,{value:e.value}),r(),s()}),g.addEventListener("blur",function(A){e.composing&&(e.composing=!1,c(A,!0)),e.focus=!1,i("blur",A,{value:e.value,cursor:a(A.target)})}),g.addEventListener("input",c),g.addEventListener("compositionstart",A=>{A.stopPropagation(),e.composing=!0,l(A)}),g.addEventListener("compositionend",A=>{A.stopPropagation(),e.composing&&(e.composing=!1,c(A)),l(A)}),g.addEventListener("compositionupdate",l)})}(o,n,A,r,s,i);return{fieldRef:o,state:n,scopedAttrsState:a,fixDisabledColor:0===String(navigator.vendor).indexOf("Apple")&&CSS.supports("image-orientation:from-image"),trigger:r}}const fB=u({},hB,{placeholderClass:{type:String,default:"input-placeholder"},textContentType:{type:String,default:""}}),mB=HA(()=>{{const A=navigator.userAgent;let e="";const t=A.match(/OS\s([\w_]+)\slike/);if(t)e=t[1].replace(/_/g,".");else if(/Macintosh|Mac/i.test(A)&&navigator.maxTouchPoints>0){const t=A.match(/Version\/(\S*)\b/);t&&(e=t[1])}return!!e&&parseInt(e)>=16&&parseFloat(e)<17.2}});function yB(A,e,t,i,o){if(e.value)if("."===A.data){if("."===e.value.slice(-1))return t.value=i.value=e.value=e.value.slice(0,-1),!1;if(e.value&&!e.value.includes("."))return e.value+=".",o&&(o.fn=()=>{t.value=i.value=e.value=e.value.slice(0,-1),i.removeEventListener("blur",o.fn)},i.addEventListener("blur",o.fn)),!1}else if("deleteContentBackward"===A.inputType&&mB()&&"."===e.value.slice(-2,-1))return e.value=t.value=i.value=e.value.slice(0,-2),!0}function DB(A){return"insertFromPaste"===A.inputType}const vB=Ll({name:"Input",props:fB,emits:["confirm",...CB],setup(A,{emit:e,expose:t}){const i=["text","number","idcard","digit","password","tel"],o=["off","one-time-code"],n=Ur(()=>{let e="";switch(A.type){case"text":e="text","search"===A.confirmType&&(e="search");break;case"idcard":e="text";break;case"digit":e="number";break;default:e=i.includes(A.type)?A.type:"text"}return A.password?"password":e}),r=Ur(()=>{const e=o.indexOf(A.textContentType),t=o.indexOf(G(A.textContentType));return o[-1!==e?e:-1!==t?t:0]}),s=Ur(()=>{if(A.inputmode)return A.inputmode});let a=function(A,e){if("number"===e.value){const e=void 0===A.modelValue?A.value:A.modelValue,t=Kt(null!=e?e.toLocaleString():"");return Xi(()=>A.modelValue,A=>{t.value=null!=A?A.toLocaleString():""}),Xi(()=>A.value,A=>{t.value=null!=A?A.toLocaleString():""}),t}return Kt("")}(A,n),g={fn:null};const c=Kt(null),{fieldRef:l,state:I,scopedAttrsState:u,fixDisabledColor:E,trigger:d}=pB(A,c,e,(A,e)=>{const t=A.target;if("number"===n.value){if(g.fn&&(t.removeEventListener("blur",g.fn),g.fn=null),t.validity&&!t.validity.valid){if((!a.value||!t.value)&&"-"===A.data||"-"===a.value[0]&&"deleteContentBackward"===A.inputType)return a.value="-",e.value="",g.fn=()=>{a.value=t.value=""},t.addEventListener("blur",g.fn),!1;const i=yB(A,a,e,t,g);return"boolean"==typeof i?i:(a.value=e.value=t.value="-"===a.value?"":a.value,!1)}{const i=yB(A,a,e,t,g);if("boolean"==typeof i)return i;a.value=t.value}if(e.maxlength>0&&t.value.length>e.maxlength&&!DB(A))return t.value=a.value=e.value,!1}});Xi(()=>I.value,e=>{"number"!==A.type||"-"===a.value&&""===e||(a.value=e.toString())}),Xi(()=>A.maxlength,A=>{A=parseInt(A,10);const e=I.value.slice(0,A);e!==I.value&&(I.value=e)});const h=["number","digit"],C=Ur(()=>h.includes(A.type)?A.step:"");function B(e){if("Enter"!==e.key)return;const t=e.target;e.stopPropagation(),d("confirm",e,{value:t.value}),!A.confirmHold&&t.blur()}return t({$triggerInput:A=>{e("update:modelValue",A.value),e("update:value",A.value),I.value=A.value}}),()=>{let e=A.disabled&&E?Ir("input",{key:"disabled-input",ref:l,value:I.value,tabindex:"-1",readonly:!!A.disabled,type:n.value,maxlength:I.maxlength,step:C.value,class:"uni-input-input",style:A.cursorColor?{caretColor:A.cursorColor}:{},onFocus:A=>A.target.blur()},null,44,["value","readonly","type","maxlength","step","onFocus"]):Ir("input",{key:"input",ref:l,value:I.value,onInput:A=>{const e=A.target.value.toString();"number"===n.value&&I.maxlength>0&&e.length>I.maxlength?DB(A)&&(I.value=e.slice(0,I.maxlength)):I.value=e},disabled:!!A.disabled,type:n.value,maxlength:I.maxlength,step:C.value,enterkeyhint:A.confirmType,pattern:"number"===A.type?"[0-9]*":void 0,class:"uni-input-input",style:A.cursorColor?{caretColor:A.cursorColor}:{},autocomplete:r.value,onKeyup:B,inputmode:s.value},null,44,["value","onInput","disabled","type","maxlength","step","enterkeyhint","pattern","autocomplete","onKeyup","inputmode"]);return Ir("uni-input",{ref:c},[Ir("div",{class:"uni-input-wrapper"},[io(Ir("div",Qr(u.attrs,{style:A.placeholderStyle,class:["uni-input-placeholder",A.placeholderClass]}),[A.placeholder],16),[[ss,!(I.value.length||"-"===a.value||a.value.includes("."))]]),"search"===A.confirmType?Ir("form",{action:"",onSubmit:A=>A.preventDefault(),class:"uni-input-form"},[e],40,["onSubmit"]):e])],512)}}});const wB=["class","style"],SB=/^on[A-Z]+/,MB=(A={})=>{const{excludeListeners:e=!1,excludeKeys:t=[]}=A,i=Dr(),o=Wt({}),n=Wt({}),r=Wt({}),s=t.concat(wB);return i.attrs=Nt(i.attrs),zi(()=>{const A=(t=i.attrs,Object.keys(t).map(A=>[A,t[A]])).reduce((A,[t,i])=>(s.includes(t)?A.exclude[t]=i:SB.test(t)?(e||(A.attrs[t]=i),A.listeners[t]=i):A.attrs[t]=i,A),{exclude:{},attrs:{},listeners:{}});var t;o.value=A.attrs,n.value=A.listeners,r.value=A.exclude}),{$attrs:o,$listeners:n,$excludeAttrs:r}};function RB(A){const e=[];return C(A)&&A.forEach(A=>{rr(A)?A.type===Kn?e.push(...RB(A.children)):e.push(A):C(A)&&e.push(...RB(A))}),e}const _B=Ll({inheritAttrs:!1,name:"MovableArea",props:{scaleArea:{type:Boolean,default:!1}},setup(A,{slots:e}){const t=Kt(null),i=Kt(!1);let{setContexts:o,events:n}=function(A,e){const t=Kt(0),i=Kt(0),o=Nt({x:null,y:null}),n=Kt(null);let r=null,s=[];function a(e){e&&1!==e&&(A.scaleArea?s.forEach(function(A){A._setScale(e)}):r&&r._setScale(e))}function g(A,t=s){let i=e.value;function o(A){for(let e=0;e {let t=e.touches;if(t&&t.length>1){let e={x:t[1].pageX-t[0].pageX,y:t[1].pageY-t[0].pageY};if(n.value=TB(e),o.x=e.x,o.y=e.y,!A.scaleArea){let A=g(t[0].target),e=g(t[1].target);r=A&&A===e?A:null}}}),l=Fl(A=>{let e=A.touches;if(e&&e.length>1){A.preventDefault();let t={x:e[1].pageX-e[0].pageX,y:e[1].pageY-e[0].pageY};if(null!==o.x&&n.value&&n.value>0){a(TB(t)/n.value)}o.x=t.x,o.y=t.y}}),I=Fl(e=>{let t=e.touches;t&&t.length||e.changedTouches&&(o.x=0,o.y=0,n.value=null,A.scaleArea?s.forEach(function(A){A._endScale()}):r&&r._endScale())});function u(){E(),s.forEach(function(A,e){A.setParent()})}function E(){let A=window.getComputedStyle(e.value),o=e.value.getBoundingClientRect();t.value=o.width-["Left","Right"].reduce(function(e,t){const i="padding"+t;return e+parseFloat(A["border"+t+"Width"])+parseFloat(A[i])},0),i.value=o.height-["Top","Bottom"].reduce(function(e,t){const i="padding"+t;return e+parseFloat(A["border"+t+"Width"])+parseFloat(A[i])},0)}return Qn("movableAreaWidth",t),Qn("movableAreaHeight",i),{setContexts(A){s=A},events:{_onTouchstart:c,_onTouchmove:l,_onTouchend:I,_resize:u}}}(A,t);const{$listeners:r,$attrs:s,$excludeAttrs:a}=MB(),g=r.value;["onTouchstart","onTouchmove","onTouchend"].forEach(A=>{let e=g[A],t=n[`_${A}`];g[A]=e?[].concat(e,t):t}),Uo(()=>{n._resize(),i.value=!0});let c=[];const l=[];function I(){const A=[];for(let e=0;e t===A.rootRef.value);i&&A.push(Pt(i))}o(A)}return Qn("_isMounted",i),Qn("movableAreaRootRef",t),Qn("addMovableViewContext",A=>{l.push(A),I()}),Qn("removeMovableViewContext",A=>{const e=l.indexOf(A);e>=0&&(l.splice(e,1),I())}),()=>{const A=e.default&&e.default();return c=RB(A),Ir("uni-movable-area",Qr({ref:t},s.value,a.value,g),[Ir(wC,{onResize:n._resize},null,8,["onResize"]),c],16)}}});function TB(A){return Math.sqrt(A.x*A.x+A.y*A.y)}const NB=function(A,e,t,i){A.addEventListener(e,A=>{p(t)&&!1===t(A)&&((void 0===A.cancelable||A.cancelable)&&A.preventDefault(),A.stopPropagation())},{passive:!1})};let bB,GB;function kB(A,e,t){xo(()=>{document.removeEventListener("mousemove",bB),document.removeEventListener("mouseup",GB)});let i=0,o=0,n=0,r=0;const s=function(A,t,s,a){if(!1===e({cancelable:A.cancelable,target:A.target,currentTarget:A.currentTarget,preventDefault:A.preventDefault.bind(A),stopPropagation:A.stopPropagation.bind(A),touches:A.touches,changedTouches:A.changedTouches,detail:{state:t,x:s,y:a,dx:s-i,dy:a-o,ddx:s-n,ddy:a-r,timeStamp:A.timeStamp}}))return!1};let a,g,c=null;NB(A,"touchstart",function(A){if(a=!0,1===A.touches.length&&!c)return c=A,i=n=A.touches[0].pageX,o=r=A.touches[0].pageY,s(A,"start",i,o)}),NB(A,"mousedown",function(A){if(g=!0,!a&&!c)return c=A,i=n=A.pageX,o=r=A.pageY,s(A,"start",i,o)}),NB(A,"touchmove",function(A){if(1===A.touches.length&&c){const e=s(A,"move",A.touches[0].pageX,A.touches[0].pageY);return n=A.touches[0].pageX,r=A.touches[0].pageY,e}});const l=bB=function(A){if(!a&&g&&c){const e=s(A,"move",A.pageX,A.pageY);return n=A.pageX,r=A.pageY,e}};document.addEventListener("mousemove",l),NB(A,"touchend",function(A){if(0===A.touches.length&&c)return a=!1,c=null,s(A,"end",A.changedTouches[0].pageX,A.changedTouches[0].pageY)});const I=GB=function(A){if(g=!1,!a&&c)return c=null,s(A,"end",A.pageX,A.pageY)};document.addEventListener("mouseup",I),NB(A,"touchcancel",function(A){if(c){a=!1;const e=c;return c=null,s(A,t?"cancel":"end",e.touches[0].pageX,e.touches[0].pageY)}})}function LB(A,e,t){return A>e-t&&A this._t&&(A=this._t,this._lastDt=A);let e=this._x_v*A+.5*this._x_a*Math.pow(A,2)+this._x_s,t=this._y_v*A+.5*this._y_a*Math.pow(A,2)+this._y_s;return(this._x_a>0&&e this._endPositionX)&&(e=this._endPositionX),(this._y_a>0&&t this._endPositionY)&&(t=this._endPositionY),{x:e,y:t}},OB.prototype.ds=function(A){return void 0===A&&(A=((new Date).getTime()-this._startTime)/1e3),A>this._t&&(A=this._t),{dx:this._x_v+this._x_a*A,dy:this._y_v+this._y_a*A}},OB.prototype.delta=function(){return{x:-1.5*Math.pow(this._x_v,2)/this._x_a||0,y:-1.5*Math.pow(this._y_v,2)/this._y_a||0}},OB.prototype.dt=function(){return-this._x_v/this._x_a},OB.prototype.done=function(){const A=LB(this.s().x,this._endPositionX)||LB(this.s().y,this._endPositionY)||this._lastDt===this._t;return this._lastDt=null,A},OB.prototype.setEnd=function(A,e){this._endPositionX=A,this._endPositionY=e},OB.prototype.reconfigure=function(A,e){this._m=A,this._f=1e3*e},xB.prototype._solve=function(A,e){const t=this._c,i=this._m,o=this._k,n=t*t-4*i*o;if(0===n){const o=-t/(2*i),n=A,r=e/(o*A);return{x:function(A){return(n+r*A)*Math.pow(Math.E,o*A)},dx:function(A){const e=Math.pow(Math.E,o*A);return o*(n+r*A)*e+r*e}}}if(n>0){const o=(-t-Math.sqrt(n))/(2*i),r=(-t+Math.sqrt(n))/(2*i),s=(e-o*A)/(r-o),a=A-s;return{x:function(A){let e,t;return A===this._t&&(e=this._powER1T,t=this._powER2T),this._t=A,e||(e=this._powER1T=Math.pow(Math.E,o*A)),t||(t=this._powER2T=Math.pow(Math.E,r*A)),a*e+s*t},dx:function(A){let e,t;return A===this._t&&(e=this._powER1T,t=this._powER2T),this._t=A,e||(e=this._powER1T=Math.pow(Math.E,o*A)),t||(t=this._powER2T=Math.pow(Math.E,r*A)),a*o*e+s*r*t}}}const r=Math.sqrt(4*i*o-t*t)/(2*i),s=-t/2*i,a=A,g=(e-s*A)/r;return{x:function(A){return Math.pow(Math.E,s*A)*(a*Math.cos(r*A)+g*Math.sin(r*A))},dx:function(A){const e=Math.pow(Math.E,s*A),t=Math.cos(r*A),i=Math.sin(r*A);return e*(g*r*t-a*r*i)+s*e*(g*i+a*t)}}},xB.prototype.x=function(A){return void 0===A&&(A=((new Date).getTime()-this._startTime)/1e3),this._solution?this._endPosition+this._solution.x(A):0},xB.prototype.dx=function(A){return void 0===A&&(A=((new Date).getTime()-this._startTime)/1e3),this._solution?this._solution.dx(A):0},xB.prototype.setEnd=function(A,e,t){if(t||(t=(new Date).getTime()),A!==this._endPosition||!UB(e,.1)){e=e||0;let i=this._endPosition;this._solution&&(UB(e,.1)&&(e=this._solution.dx((t-this._startTime)/1e3)),i=this._solution.x((t-this._startTime)/1e3),UB(e,.1)&&(e=0),UB(i,.1)&&(i=0),i+=this._endPosition),this._solution&&UB(i-A,.1)&&UB(e,.1)||(this._endPosition=A,this._solution=this._solve(i-this._endPosition,e),this._startTime=t)}},xB.prototype.snap=function(A){this._startTime=(new Date).getTime(),this._endPosition=A,this._solution={x:function(){return 0},dx:function(){return 0}}},xB.prototype.done=function(A){return A||(A=(new Date).getTime()),LB(this.x(),this._endPosition,.1)&&UB(this.dx(),.1)},xB.prototype.reconfigure=function(A,e,t){this._m=A,this._k=e,this._c=t,this.done()||(this._solution=this._solve(this.x()-this._endPosition,this.dx()),this._startTime=(new Date).getTime())},xB.prototype.springConstant=function(){return this._k},xB.prototype.damping=function(){return this._c},xB.prototype.configuration=function(){return[{label:"Spring Constant",read:this.springConstant.bind(this),write:function(A,e){A.reconfigure(1,e,A.damping())}.bind(this,this),min:100,max:1e3},{label:"Damping",read:this.damping.bind(this),write:function(A,e){A.reconfigure(1,A.springConstant(),e)}.bind(this,this),min:1,max:500}]},PB.prototype.setEnd=function(A,e,t,i){const o=(new Date).getTime();this._springX.setEnd(A,i,o),this._springY.setEnd(e,i,o),this._springScale.setEnd(t,i,o),this._startTime=o},PB.prototype.x=function(){const A=((new Date).getTime()-this._startTime)/1e3;return{x:this._springX.x(A),y:this._springY.x(A),scale:this._springScale.x(A)}},PB.prototype.done=function(){const A=(new Date).getTime();return this._springX.done(A)&&this._springY.done(A)&&this._springScale.done(A)},PB.prototype.reconfigure=function(A,e,t){this._springX.reconfigure(A,e,t),this._springY.reconfigure(A,e,t),this._springScale.reconfigure(A,e,t)};function YB(A,e){return+((1e3*A-1e3*e)/1e3).toFixed(1)}const JB=Ll({name:"MovableView",props:{direction:{type:String,default:"none"},inertia:{type:[Boolean,String],default:!1},outOfBounds:{type:[Boolean,String],default:!1},x:{type:[Number,String],default:0},y:{type:[Number,String],default:0},damping:{type:[Number,String],default:20},friction:{type:[Number,String],default:2},disabled:{type:[Boolean,String],default:!1},scale:{type:[Boolean,String],default:!1},scaleMin:{type:[Number,String],default:.1},scaleMax:{type:[Number,String],default:10},scaleValue:{type:[Number,String],default:1},animation:{type:[Boolean,String],default:!0}},emits:["change","scale"],setup(A,{slots:e,emit:t}){const i=Kt(null),o=Ol(i,t),{setParent:n}=function(A,e,t){const i=pn("_isMounted",Kt(!1)),o=pn("addMovableViewContext",()=>{}),n=pn("removeMovableViewContext",()=>{});let r,s,a=Kt(1),g=Kt(1),c=Kt(!1),l=Kt(0),I=Kt(0),u=null,E=null,d=!1,h=null,C=null;const B=new FB,Q=new FB,p={historyX:[0,0],historyY:[0,0],historyT:[0,0]},f=Ur(()=>{let e=Number(A.friction);return isNaN(e)||e<=0?2:e}),m=new OB(1,f.value);Xi(()=>A.disabled,()=>{q()});const{_updateOldScale:y,_endScale:D,_setScale:v,scaleValueSync:w,_updateBoundary:S,_updateOffset:M,_updateWH:R,_scaleOffset:_,minX:T,minY:N,maxX:b,maxY:G,FAandSFACancel:k,_getLimitXY:L,_setTransform:U,_revise:F,dampingNumber:O,xMove:x,yMove:P,xSync:Y,ySync:J,_STD:H}=function(A,e,t,i,o,n,r,s,a,g){const c=Ur(()=>{let e=Number(A.scaleMin);return isNaN(e)?.1:e}),l=Ur(()=>{let e=Number(A.scaleMax);return isNaN(e)?10:e}),I=Kt(Number(A.scaleValue)||1);Xi(I,A=>{U(A)}),Xi(c,()=>{L()}),Xi(l,()=>{L()}),Xi(()=>A.scaleValue,A=>{I.value=Number(A)||0});const{_updateBoundary:u,_updateOffset:E,_updateWH:d,_scaleOffset:h,minX:C,minY:B,maxX:Q,maxY:p}=function(A,e,t){const i=pn("movableAreaWidth",Kt(0)),o=pn("movableAreaHeight",Kt(0)),n=pn("movableAreaRootRef"),r={x:0,y:0},s={x:0,y:0},a=Kt(0),g=Kt(0),c=Kt(0),l=Kt(0),I=Kt(0),u=Kt(0);function E(){let A=0-r.x+s.x,e=i.value-a.value-r.x-s.x;c.value=Math.min(A,e),I.value=Math.max(A,e);let t=0-r.y+s.y,n=o.value-g.value-r.y-s.y;l.value=Math.min(t,n),u.value=Math.max(t,n)}function d(){r.x=VB(A.value,n.value),r.y=jB(A.value,n.value)}function h(i){i=i||e.value,i=t(i);let o=A.value.getBoundingClientRect();g.value=o.height/e.value,a.value=o.width/e.value;let n=g.value*i,r=a.value*i;s.x=(r-a.value)/2,s.y=(n-g.value)/2}return{_updateBoundary:E,_updateOffset:d,_updateWH:h,_scaleOffset:s,minX:c,minY:l,maxX:I,maxY:u}}(e,i,k),{FAandSFACancel:f,_getLimitXY:m,_animationTo:y,_setTransform:D,_revise:v,dampingNumber:w,xMove:S,yMove:M,xSync:R,ySync:_,_STD:T}=function(A,e,t,i,o,n,r,s,a,g,c,l,I,u){const E=Ur(()=>{let A=Number(e.damping);return isNaN(A)?20:A}),d=Ur(()=>"all"===e.direction||"horizontal"===e.direction),h=Ur(()=>"all"===e.direction||"vertical"===e.direction),C=Kt(WB(e.x)),B=Kt(WB(e.y));Xi(()=>e.x,A=>{C.value=WB(A)}),Xi(()=>e.y,A=>{B.value=WB(A)}),Xi(C,A=>{v(A)}),Xi(B,A=>{w(A)});const Q=new PB(1,9*Math.pow(E.value,2)/40,E.value);function p(A,e){let t=!1;return A>o.value?(A=o.value,t=!0):A n.value?(e=n.value,t=!0):e 1?"htouchmove":"vtouchmove"),x.value&&(t=e.detail.dx+r,p.historyX.shift(),p.historyX.push(t),P.value||null!==h||(h=Math.abs(e.detail.dx/e.detail.dy)<1)),P.value&&(i=e.detail.dy+s,p.historyY.shift(),p.historyY.push(i),x.value||null!==h||(h=Math.abs(e.detail.dy/e.detail.dx)<1)),p.historyT.shift(),p.historyT.push(e.detail.timeStamp),!h){e.preventDefault();let o="touch";t b.value&&(A.outOfBounds?(o="touch-out-of-bounds",t=b.value+B.x(t-b.value)):t=b.value),i G.value&&(A.outOfBounds?(o="touch-out-of-bounds",i=G.value+Q.x(i-G.value)):i=G.value),qB(function(){U(t,i,a.value,o)})}}}function j(){if(!c.value&&!A.disabled&&d&&(t.value.style.willChange="auto",d=!1,!h&&!F("out-of-bounds")&&A.inertia)){const A=1e3*(p.historyX[1]-p.historyX[0])/(p.historyT[1]-p.historyT[0]),e=1e3*(p.historyY[1]-p.historyY[0])/(p.historyT[1]-p.historyT[0]),t=l.value,i=I.value;m.setV(A,e),m.setS(t,i);const o=m.delta().x,n=m.delta().y;let r=o+t,s=n+i;r b.value&&(r=b.value,s=i+(b.value-t)*n/o),s G.value&&(s=G.value,r=t+(G.value-i)*o/n),m.setEnd(r,s),E=KB(m,function(){let A=m.s(),e=A.x,t=A.y;U(e,t,a.value,"friction")},function(){E.cancel()})}A.outOfBounds||A.inertia||k()}function K(){if(!i.value)return;k();let e=A.scale?w.value:1;M(),R(e),S();let t=L(Y.value+_.x,J.value+_.y),o=t.x,n=t.y;U(o,n,e,"",!0),y(e)}return Uo(()=>{kB(t.value,A=>{switch(A.detail.state){case"start":q();break;case"move":V(A);break;case"end":j()}}),K(),m.reconfigure(1,f.value),H.reconfigure(1,9*Math.pow(O.value,2)/40,O.value),t.value.style.transformOrigin="center";const A={rootRef:t,setParent:K,_endScale:D,_setScale:v};o(A),Po(()=>{n(A)})}),Po(()=>{k()}),{setParent:K}}(A,o,i);return()=>Ir("uni-movable-view",{ref:i},[Ir(wC,{onResize:n},null,8,["onResize"]),e.default&&e.default()],512)}});let HB=!1;function qB(A){HB||(HB=!0,requestAnimationFrame(function(){A(),HB=!1}))}function VB(A,e){if(A===e)return 0;let t=A.offsetLeft;return A.offsetParent?t+=VB(A.offsetParent,e):0}function jB(A,e){if(A===e)return 0;let t=A.offsetTop;return A.offsetParent?t+=jB(A.offsetParent,e):0}function KB(A,e,t){let i={id:0,cancelled:!1};return function A(e,t,i,o){if(!e||!e.cancelled){i(t);let n=t.done();n||e.cancelled||(e.id=requestAnimationFrame(A.bind(null,e,t,i,o))),n&&o&&o(t)}}(i,A,e,t),{cancel:function(A){A&&A.id&&cancelAnimationFrame(A.id),A&&(A.cancelled=!0)}.bind(null,i),model:A}}function WB(A){return/\d+[ur]px$/i.test(A)?uni.upx2px(parseFloat(A)):Number(A)||0}class zB{constructor(A){this._drag=A,this._dragLog=Math.log(A),this._x=0,this._v=0,this._startTime=0}set(A,e){this._x=A,this._v=e,this._startTime=(new Date).getTime()}setVelocityByEnd(A){this._v=(A-this._x)*this._dragLog/(Math.pow(this._drag,100)-1)}x(A){void 0===A&&(A=((new Date).getTime()-this._startTime)/1e3);const e=A===this._dt&&this._powDragDt?this._powDragDt:this._powDragDt=Math.pow(this._drag,A);return this._dt=A,this._x+this._v*e/this._dragLog-this._v/this._dragLog}dx(A){void 0===A&&(A=((new Date).getTime()-this._startTime)/1e3);const e=A===this._dt&&this._powDragDt?this._powDragDt:this._powDragDt=Math.pow(this._drag,A);return this._dt=A,this._v*e}done(){return Math.abs(this.dx())<3}reconfigure(A){const e=this.x(),t=this.dx();this._drag=A,this._dragLog=Math.log(A),this.set(e,t)}configuration(){const A=this;return[{label:"Friction",read:function(){return A._drag},write:function(e){A.reconfigure(e)},min:.001,max:.1,step:.001}]}}function ZB(A,e,t){return A>e-t&&A 0){const o=(-t-Math.sqrt(n))/(2*i),r=(-t+Math.sqrt(n))/(2*i),s=(e-o*A)/(r-o),a=A-s;return{x:function(A){let e,t;return A===this._t&&(e=this._powER1T,t=this._powER2T),this._t=A,e||(e=this._powER1T=Math.pow(Math.E,o*A)),t||(t=this._powER2T=Math.pow(Math.E,r*A)),a*e+s*t},dx:function(A){let e,t;return A===this._t&&(e=this._powER1T,t=this._powER2T),this._t=A,e||(e=this._powER1T=Math.pow(Math.E,o*A)),t||(t=this._powER2T=Math.pow(Math.E,r*A)),a*o*e+s*r*t}}}const r=Math.sqrt(4*i*o-t*t)/(2*i),s=-t/2*i,a=A,g=(e-s*A)/r;return{x:function(A){return Math.pow(Math.E,s*A)*(a*Math.cos(r*A)+g*Math.sin(r*A))},dx:function(A){const e=Math.pow(Math.E,s*A),t=Math.cos(r*A),i=Math.sin(r*A);return e*(g*r*t-a*r*i)+s*e*(g*i+a*t)}}}x(A){return void 0===A&&(A=((new Date).getTime()-this._startTime)/1e3),this._solution?this._endPosition+this._solution.x(A):0}dx(A){return void 0===A&&(A=((new Date).getTime()-this._startTime)/1e3),this._solution?this._solution.dx(A):0}setEnd(A,e,t){if(t||(t=(new Date).getTime()),A!==this._endPosition||!XB(e,.4)){e=e||0;let i=this._endPosition;this._solution&&(XB(e,.4)&&(e=this._solution.dx((t-this._startTime)/1e3)),i=this._solution.x((t-this._startTime)/1e3),XB(e,.4)&&(e=0),XB(i,.4)&&(i=0),i+=this._endPosition),this._solution&&XB(i-A,.4)&&XB(e,.4)||(this._endPosition=A,this._solution=this._solve(i-this._endPosition,e),this._startTime=t)}}snap(A){this._startTime=(new Date).getTime(),this._endPosition=A,this._solution={x:function(){return 0},dx:function(){return 0}}}done(A){return A||(A=(new Date).getTime()),ZB(this.x(),this._endPosition,.4)&&XB(this.dx(),.4)}reconfigure(A,e,t){this._m=A,this._k=e,this._c=t,this.done()||(this._solution=this._solve(this.x()-this._endPosition,this.dx()),this._startTime=(new Date).getTime())}springConstant(){return this._k}damping(){return this._c}configuration(){return[{label:"Spring Constant",read:this.springConstant.bind(this),write:function(A,e){A.reconfigure(1,e,A.damping())}.bind(this,this),min:100,max:1e3},{label:"Damping",read:this.damping.bind(this),write:function(A,e){A.reconfigure(1,A.springConstant(),e)}.bind(this,this),min:1,max:500}]}}class AQ{constructor(A,e,t){this._extent=A,this._friction=e||new zB(.01),this._spring=t||new $B(1,90,20),this._startTime=0,this._springing=!1,this._springOffset=0}snap(A,e){this._springOffset=0,this._springing=!0,this._spring.snap(A),this._spring.setEnd(e)}set(A,e){this._friction.set(A,e),A>0&&e>=0?(this._springOffset=0,this._springing=!0,this._spring.snap(A),this._spring.setEnd(0)):A<-this._extent&&e<=0?(this._springOffset=0,this._springing=!0,this._spring.snap(A),this._spring.setEnd(-this._extent)):this._springing=!1,this._startTime=(new Date).getTime()}x(A){if(!this._startTime)return 0;if(A||(A=((new Date).getTime()-this._startTime)/1e3),this._springing)return this._spring.x()+this._springOffset;let e=this._friction.x(A),t=this.dx(A);return(e>0&&t>=0||e<-this._extent&&t<=0)&&(this._springing=!0,this._spring.setEnd(0,t),e<-this._extent?this._springOffset=-this._extent:this._springOffset=0,e=this._spring.x()+this._springOffset),e}dx(A){let e;return e=this._lastTime===A?this._lastDx:this._springing?this._spring.dx(A):this._friction.dx(A),this._lastTime=A,this._lastDx=e,e}done(){return this._springing?this._spring.done():this._friction.done()}setVelocityByEnd(A){this._friction.setVelocityByEnd(A)}configuration(){const A=this._friction.configuration();return A.push.apply(A,this._spring.configuration()),A}}class eQ{constructor(A,e){e=e||{},this._element=A,this._options=e,this._enableSnap=e.enableSnap||!1,this._itemSize=e.itemSize||0,this._enableX=e.enableX||!1,this._enableY=e.enableY||!1,this._shouldDispatchScrollEvent=!!e.onScroll,this._enableX?(this._extent=(e.scrollWidth||this._element.offsetWidth)-this._element.parentElement.offsetWidth,this._scrollWidth=e.scrollWidth):(this._extent=(e.scrollHeight||this._element.offsetHeight)-this._element.parentElement.offsetHeight,this._scrollHeight=e.scrollHeight),this._position=0,this._scroll=new AQ(this._extent,e.friction,e.spring),this._onTransitionEnd=this.onTransitionEnd.bind(this),this.updatePosition()}onTouchStart(){this._startPosition=this._position,this._lastChangePos=this._startPosition,this._startPosition>0?this._startPosition/=.5:this._startPosition<-this._extent&&(this._startPosition=(this._startPosition+this._extent)/.5-this._extent),this._animation&&(this._animation.cancel(),this._scrolling=!1),this.updatePosition()}onTouchMove(A,e){let t=this._startPosition;this._enableX?t+=A:this._enableY&&(t+=e),t>0?t*=.5:t<-this._extent&&(t=.5*(t+this._extent)-this._extent),this._position=t,this.updatePosition(),this.dispatchScroll()}onTouchEnd(A,e,t){if(this._enableSnap&&this._position>-this._extent&&this._position<0){if(this._enableY&&(Math.abs(e) this._itemSize/2?A-(this._itemSize-Math.abs(e)):A-e,i<=0&&i>=-this._extent&&this._scroll.setVelocityByEnd(i)}this._lastTime=Date.now(),this._lastDelay=0,this._scrolling=!0,this._lastChangePos=this._position,this._lastIdx=Math.floor(Math.abs(this._position/this._itemSize)),this._animation=function(A,e,t){const i={id:0,cancelled:!1};return function A(e,t,i,o){if(!e||!e.cancelled){i(t);const n=t.done();n||e.cancelled||(e.id=requestAnimationFrame(A.bind(null,e,t,i,o))),n&&o&&o(t)}}(i,A,e,t),{cancel:function(A){A&&A.id&&cancelAnimationFrame(A.id),A&&(A.cancelled=!0)}.bind(null,i),model:A}}(this._scroll,()=>{const A=Date.now(),e=(A-this._scroll._startTime)/1e3,t=this._scroll.x(e);this._position=t,this.updatePosition();const i=this._scroll.dx(e);this._shouldDispatchScrollEvent&&A-this._lastTime>this._lastDelay&&(this.dispatchScroll(),this._lastDelay=Math.abs(2e3/i),this._lastTime=A)},()=>{this._enableSnap&&(i<=0&&i>=-this._extent&&(this._position=i,this.updatePosition()),p(this._options.onSnap)&&this._options.onSnap(Math.floor(Math.abs(this._position)/this._itemSize))),this._shouldDispatchScrollEvent&&this.dispatchScroll(),this._scrolling=!1})}onTransitionEnd(){this._element.style.webkitTransition="",this._element.style.transition="",this._element.removeEventListener("transitionend",this._onTransitionEnd),this._snapping&&(this._snapping=!1),this.dispatchScroll()}snap(){const A=this._itemSize,e=this._position%A,t=Math.abs(e)>this._itemSize/2?this._position-(A-Math.abs(e)):this._position-e;this._position!==t&&(this._snapping=!0,this.scrollTo(-t),p(this._options.onSnap)&&this._options.onSnap(Math.floor(Math.abs(this._position)/this._itemSize)))}scrollTo(A,e){this._animation&&(this._animation.cancel(),this._scrolling=!1),"number"==typeof A&&(this._position=-A),this._position<-this._extent?this._position=-this._extent:this._position>0&&(this._position=0);const t="transform "+(e||.2)+"s ease-out";this._element.style.webkitTransition="-webkit-"+t,this._element.style.transition=t,this.updatePosition(),this._element.addEventListener("transitionend",this._onTransitionEnd)}dispatchScroll(){if(p(this._options.onScroll)&&Math.round(Number(this._lastPos))!==Math.round(this._position)){this._lastPos=this._position;const A={target:{scrollLeft:this._enableX?-this._position:0,scrollTop:this._enableY?-this._position:0,scrollHeight:this._scrollHeight||this._element.offsetHeight,scrollWidth:this._scrollWidth||this._element.offsetWidth,offsetHeight:this._element.parentElement.offsetHeight,offsetWidth:this._element.parentElement.offsetWidth}};this._options.onScroll(A)}}update(A,e,t){let i=0;const o=this._position;this._enableX?(i=this._element.childNodes.length?(e||this._element.offsetWidth)-this._element.parentElement.offsetWidth:0,this._scrollWidth=e):(i=this._element.childNodes.length?(e||this._element.offsetHeight)-this._element.parentElement.offsetHeight:0,this._scrollHeight=e),"number"==typeof A&&(this._position=-A),this._position<-i?this._position=-i:this._position>0&&(this._position=0),this._itemSize=t||this._itemSize,this.updatePosition(),o!==this._position&&(this.dispatchScroll(),p(this._options.onSnap)&&this._options.onSnap(Math.floor(Math.abs(this._position)/this._itemSize))),this._extent=i,this._scroll._extent=i}updatePosition(){let A="";this._enableX?A="translateX("+this._position+"px) translateZ(0)":this._enableY&&(A="translateY("+this._position+"px) translateZ(0)"),this._element.style.webkitTransform=A,this._element.style.transform=A}isScrolling(){return this._scrolling||this._snapping}}const tQ=sA,iQ="backwards",oQ=Ll({name:"Progress",props:{percent:{type:[Number,String],default:0,validator:A=>!isNaN(parseFloat(A))},fontSize:{type:[String,Number],default:16},showInfo:{type:[Boolean,String],default:!1},strokeWidth:{type:[Number,String],default:6,validator:A=>!isNaN(parseFloat(A))},color:{type:String,default:tQ},activeColor:{type:String,default:tQ},backgroundColor:{type:String,default:"#EBEBEB"},active:{type:[Boolean,String],default:!1},activeMode:{type:String,default:iQ},duration:{type:[Number,String],default:30,validator:A=>!isNaN(parseFloat(A))},borderRadius:{type:[Number,String],default:0}},setup(A){const e=Kt(null),t=function(A){const e=Kt(0),t=Ur(()=>`background-color: ${A.backgroundColor}; height: ${Oc(A.strokeWidth)}px;`),i=Ur(()=>{const t=A.color!==tQ&&A.activeColor===tQ?A.color:A.activeColor;return`width: ${e.value}%;background-color: ${t}`}),o=Ur(()=>{if("string"==typeof A.percent&&!/^-?\d*\.?\d*$/.test(A.percent))return 0;let e=parseFloat(A.percent);return Number.isNaN(e)||e<0?e=0:e>100&&(e=100),e}),n=Nt({outerBarStyle:t,innerBarStyle:i,realPercent:o,currentPercent:e,strokeTimer:0,lastPercent:0});return n}(A);return nQ(t,A),Xi(()=>t.realPercent,(e,i)=>{t.strokeTimer&&clearInterval(t.strokeTimer),t.lastPercent=i||0,nQ(t,A)}),()=>{const{showInfo:i}=A,{outerBarStyle:o,innerBarStyle:n,currentPercent:r}=t;return Ir("uni-progress",{class:"uni-progress",ref:e},[Ir("div",{style:o,class:"uni-progress-bar"},[Ir("div",{style:n,class:"uni-progress-inner-bar"},null,4)],4),i?Ir("p",{class:"uni-progress-info"},[r+"%"]):""],512)}}});function nQ(A,e){e.active?(A.currentPercent=e.activeMode===iQ?0:A.lastPercent,A.strokeTimer=setInterval(()=>{A.currentPercent+1>A.realPercent?(A.currentPercent=A.realPercent,A.strokeTimer&&clearInterval(A.strokeTimer)):A.currentPercent+=1},parseFloat(e.duration))):A.currentPercent=A.realPercent}const rQ=Uc("ucg"),sQ=Ll({name:"RadioGroup",props:{name:{type:String,default:""}},setup(A,{emit:e,slots:t}){const i=Kt(null);return function(A,e){const t=[];Uo(()=>{s(t.length-1)});const i=()=>{var A;return null==(A=t.find(A=>A.value.radioChecked))?void 0:A.value.value};Qn(rQ,{addField(A){t.push(A)},removeField(A){t.splice(t.indexOf(A),1)},radioChange(A,o){s(t.indexOf(o),!0),e("change",A,{value:i()})}});const o=pn(Jl,!1),n={submit:()=>{let e=["",null];return""!==A.name&&(e[0]=A.name,e[1]=i()),e}};o&&(o.addField(n),xo(()=>{o.removeField(n)}));function r(A,e){A.value={radioChecked:e,value:A.value.value}}function s(A,e){t.forEach((i,o)=>{o!==A&&(e?r(t[o],!1):t.forEach((A,e)=>{o>=e||t[e].value.radioChecked&&r(t[o],!1)}))})}}(A,Ol(i,e)),()=>Ir("uni-radio-group",{ref:i},[t.default&&t.default()],512)}});const aQ=Ll({name:"Radio",props:{checked:{type:[Boolean,String],default:!1},id:{type:String,default:""},disabled:{type:[Boolean,String],default:!1},value:{type:String,default:""},color:{type:String,default:"#007aff"},backgroundColor:{type:String,default:""},borderColor:{type:String,default:""},activeBackgroundColor:{type:String,default:""},activeBorderColor:{type:String,default:""},iconColor:{type:String,default:"#ffffff"}},setup(A,{slots:e}){const t=Kt(null),i=Kt(A.checked),o=Kt(A.value);const n=Ur(()=>function(){if(A.disabled)return{backgroundColor:"#E1E1E1",borderColor:"#D1D1D1"};const e={};return i.value?(e.backgroundColor=A.activeBackgroundColor||A.color,e.borderColor=A.activeBorderColor||e.backgroundColor):(A.borderColor&&(e.borderColor=A.borderColor),A.backgroundColor&&(e.backgroundColor=A.backgroundColor)),e}(i.value));Xi([()=>A.checked,()=>A.value],([A,e])=>{i.value=A,o.value=e});const{uniCheckGroup:r,uniLabel:s,field:a}=function(A,e,t){const i=Ur({get:()=>({radioChecked:Boolean(A.value),value:e.value}),set:({radioChecked:e})=>{A.value=e}}),o={reset:t},n=pn(rQ,!1);n&&n.addField(i);const r=pn(Jl,!1);r&&r.addField(o);const s=pn(Vl,!1);return xo(()=>{n&&n.removeField(i),r&&r.removeField(o)}),{uniCheckGroup:n,uniForm:r,uniLabel:s,field:i}}(i,o,()=>{i.value=!1}),g=e=>{A.disabled||i.value||(i.value=!0,r&&r.radioChange(e,a),e.stopPropagation())};return s&&(s.addHandler(g),xo(()=>{s.removeHandler(g)})),Kl(A,{"label-click":g}),()=>{const o=Yl(A,"disabled");let r;return r=i.value,Ir("uni-radio",Qr(o,{id:A.id,onClick:g,ref:t}),[Ir("div",{class:"uni-radio-wrapper",style:{"--HOVER-BD-COLOR":i.value?n.value.borderColor:A.activeBorderColor}},[Ir("div",{class:["uni-radio-input",{"uni-radio-input-disabled":A.disabled}],style:n.value},[r?jc(Yc,A.disabled?"#ADADAD":A.iconColor,18):""],6),e.default&&e.default()],4)],16,["id","onClick"])}}});const gQ={a:"",abbr:"",address:"",article:"",aside:"",b:"",bdi:"",bdo:["dir"],big:"",blockquote:"",br:"",caption:"",center:"",cite:"",code:"",col:["span","width"],colgroup:["span","width"],dd:"",del:"",div:"",dl:"",dt:"",em:"",fieldset:"",font:"",footer:"",h1:"",h2:"",h3:"",h4:"",h5:"",h6:"",header:"",hr:"",i:"",img:["alt","src","height","width"],ins:"",label:"",legend:"",li:"",mark:"",nav:"",ol:["start","type"],p:"",pre:"",q:"",rt:"",ruby:"",s:"",section:"",small:"",span:"",strong:"",sub:"",sup:"",table:["width"],tbody:"",td:["colspan","height","rowspan","width"],tfoot:"",th:["colspan","height","rowspan","width"],thead:"",tr:["colspan","height","rowspan","width"],tt:"",u:"",ul:""},cQ={amp:"&",gt:">",lt:"<",nbsp:" ",quot:'"',apos:"'",ldquo:"“",rdquo:"”",yen:"¥",radic:"√",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",hellip:"…"};const lQ=(A,e,t)=>!t||C(t)&&!t.length?[]:t.map(t=>{var i;if(S(t)){if(!h(t,"type")||"node"===t.type){let o={[A]:""};const n=null==(i=t.name)?void 0:i.toLowerCase();if(!h(gQ,n))return;return function(A,e){if(S(e))for(const t in e)if(h(e,t)){const i=e[t];"img"===A&&"src"===t&&(e[t]=AC(i))}}(n,t.attrs),o=u(o,function(A,e){if(["a","img"].includes(A.name)&&e)return{onClickCapture:t=>{e(t,{node:A}),t.stopPropagation(),t.preventDefault(),t.returnValue=!1}}}(t,e),t.attrs),Or(t.name,o,lQ(A,e,t.children))}return"text"===t.type&&f(t.text)&&""!==t.text?Er((t.text||"").replace(/&(([a-zA-Z]+)|(#x{0,1}[\da-zA-Z]+));/gi,function(A,e){return h(cQ,e)&&cQ[e]?cQ[e]:/^#[0-9]{1,4}$/.test(e)?String.fromCharCode(e.slice(1)):/^#x[0-9a-f]{1,4}$/i.test(e)?String.fromCharCode(0+e.slice(1)):A})):void 0}});function IQ(A){A=function(A){return A.replace(/<\?xml.*\?>\n/,"").replace(/\n/,"").replace(/\n/,"")}(A);const e=[],t={node:"root",children:[]};return function(A,e){var t,i,o,n=[],r=A;for(n.last=function(){return this[this.length-1]};A;){if(i=!0,n.last()&&XC[n.last()])A=A.replace(new RegExp("([\\s\\S]*?)"+n.last()+"[^>]*>"),function(A,t){return t=t.replace(/|/g,"$1$2"),e.chars&&e.chars(t),""}),g("",n.last());else if(0==A.indexOf("\x3c!--")?(t=A.indexOf("--\x3e"))>=0&&(e.comment&&e.comment(A.substring(4,t)),A=A.substring(t+3),i=!1):0==A.indexOf("")?(o=A.match(qC))&&(A=A.substring(o[0].length),o[0].replace(qC,g),i=!1):0==A.indexOf("<")&&(o=A.match(HC))&&(A=A.substring(o[0].length),o[0].replace(HC,a),i=!1),i){var s=(t=A.indexOf("<"))<0?A:A.substring(0,t);A=t<0?"":A.substring(t),e.chars&&e.chars(s)}if(A==r)throw"Parse Error: "+A;r=A}function a(A,t,i,o){if(t=t.toLowerCase(),KC[t])for(;n.last()&&WC[n.last()];)g("",n.last());if(zC[t]&&n.last()==t&&g("",t),(o=jC[t]||!!o)||n.push(t),e.start){var r=[];i.replace(VC,function(A,e){var t=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:ZC[e]?e:"";r.push({name:e,value:t,escaped:t.replace(/(^|[^\\])"/g,'$1\\"')})}),e.start&&e.start(t,r,o)}}function g(A,t){if(t)for(i=n.length-1;i>=0&&n[i]!=t;i--);else var i=0;if(i>=0){for(var o=n.length-1;o>=i;o--)e.end&&e.end(n[o]);n.length=i}}g()}(A,{start:function(A,i,o){const n={name:A};if(0!==i.length&&(n.attrs=function(A){return A.reduce(function(A,e){let t=e.value;const i=e.name;return t.match(/ /)&&-1===["style","src"].indexOf(i)&&(t=t.split(" ")),A[i]?Array.isArray(A[i])?A[i].push(t):A[i]=[A[i],t]:A[i]=t,A},{})}(i)),o){const A=e[0]||t;A.children||(A.children=[]),A.children.push(n)}else e.unshift(n)},end:function(A){const i=e.shift();if(i.name!==A&&console.error("invalid state: mismatch end tag"),0===e.length)t.children.push(i);else{const A=e[0];A.children||(A.children=[]),A.children.push(i)}},chars:function(A){const i={type:"text",text:A};if(0===e.length)t.children.push(i);else{const A=e[0];A.children||(A.children=[]),A.children.push(i)}},comment:function(A){const t={node:"comment",text:A},i=e[0];i&&(i.children||(i.children=[]),i.children.push(t))}}),t.children}const uQ=Ll({name:"RichText",compatConfig:{MODE:3},props:{nodes:{type:[Array,String],default:function(){return[]}}},emits:["itemclick"],setup(A,{emit:e}){const t=Dr(),i=t&&t.vnode.scopeId||"",o=Kt(null),n=Kt([]),r=Ol(o,e);function s(A,e={}){r("itemclick",A,e)}return Xi(()=>A.nodes,function(){let e=A.nodes;f(e)&&(e=IQ(A.nodes)),n.value=lQ(i,s,e)},{immediate:!0,deep:!0}),()=>Or("uni-rich-text",{ref:o},Or("div",{},n.value))}}),EQ=Ll({name:"Refresher",props:{refreshState:{type:String,default:""},refresherHeight:{type:Number,default:0},refresherThreshold:{type:Number,default:45},refresherDefaultStyle:{type:String,default:"black"},refresherBackground:{type:String,default:"#fff"}},setup(A,{slots:e}){const t=Kt(null),i=Ur(()=>{const e={backgroundColor:A.refresherBackground};switch(A.refreshState){case"pulling":e.height=A.refresherHeight+"px";break;case"refreshing":e.height=A.refresherThreshold+"px",e.transition="height 0.3s";break;case"":case"refresherabort":case"restore":e.height="0px",e.transition="height 0.3s"}return e}),o=Ur(()=>{const e=A.refresherHeight/A.refresherThreshold;return 360*(e>1?1:e)});return()=>{const{refreshState:n,refresherDefaultStyle:r,refresherThreshold:s}=A;return Ir("div",{ref:t,style:i.value,class:"uni-scroll-view-refresher"},["none"!==r?Ir("div",{class:"uni-scroll-view-refresh"},[Ir("div",{class:"uni-scroll-view-refresh-inner"},["pulling"==n?Ir("svg",{key:"refresh__icon",style:{transform:"rotate("+o.value+"deg)"},fill:"#2BD009",class:"uni-scroll-view-refresh__icon",width:"24",height:"24",viewBox:"0 0 24 24"},[Ir("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"},null),Ir("path",{d:"M0 0h24v24H0z",fill:"none"},null)],4):null,"refreshing"==n?Ir("svg",{key:"refresh__spinner",class:"uni-scroll-view-refresh__spinner",width:"24",height:"24",viewBox:"25 25 50 50"},[Ir("circle",{cx:"50",cy:"50",r:"20",fill:"none",style:"color: #2bd009","stroke-width":"3"},null)]):null])]):null,"none"===r?Ir("div",{class:"uni-scroll-view-refresher-container",style:{height:`${s}px`}},[e.default&&e.default()]):null],4)}}}),dQ=oe(!0),hQ=Ll({name:"ScrollView",compatConfig:{MODE:3},props:{direction:{type:[String],default:"vertical"},scrollX:{type:[Boolean,String],default:!1},scrollY:{type:[Boolean,String],default:!1},showScrollbar:{type:[Boolean,String],default:!0},upperThreshold:{type:[Number,String],default:50},lowerThreshold:{type:[Number,String],default:50},scrollTop:{type:[Number,String],default:0},scrollLeft:{type:[Number,String],default:0},scrollIntoView:{type:String,default:""},scrollWithAnimation:{type:[Boolean,String],default:!1},enableBackToTop:{type:[Boolean,String],default:!1},refresherEnabled:{type:[Boolean,String],default:!1},refresherThreshold:{type:Number,default:45},refresherDefaultStyle:{type:String,default:"black"},refresherBackground:{type:String,default:"#fff"},refresherTriggered:{type:[Boolean,String],default:!1}},emits:["scroll","scrolltoupper","scrolltolower","refresherrefresh","refresherrestore","refresherpulling","refresherabort","update:refresherTriggered"],setup(A,{emit:e,slots:t,expose:i}){const o=Kt(null),n=Kt(null),r=Kt(null),s=Kt(null),a=Ol(o,e),{state:g,scrollTopNumber:c,scrollLeftNumber:l}=function(A){const e=Ur(()=>Number(A.scrollTop)||0),t=Ur(()=>Number(A.scrollLeft)||0),i=Nt({lastScrollTop:e.value,lastScrollLeft:t.value,lastScrollToUpperTime:0,lastScrollToLowerTime:0,refresherHeight:0,refreshState:""});return{state:i,scrollTopNumber:e,scrollLeftNumber:t}}(A),{realScrollX:I,realScrollY:u,_scrollLeftChanged:E,_scrollTopChanged:d}=function(A,e,t,i,o,n,r,s,a){let g=!1,c=0,l=!1,I=()=>{};const u=Ur(()=>A.scrollX),E=Ur(()=>A.scrollY),d=Ur(()=>{let e=Number(A.upperThreshold);return isNaN(e)?50:e}),h=Ur(()=>{let e=Number(A.lowerThreshold);return isNaN(e)?50:e});function C(A,e){const t=r.value;let i=0,o="";if(A<0?A=0:"x"===e&&A>t.scrollWidth-t.offsetWidth?A=t.scrollWidth-t.offsetWidth:"y"===e&&A>t.scrollHeight-t.offsetHeight&&(A=t.scrollHeight-t.offsetHeight),"x"===e?i=t.scrollLeft-A:"y"===e&&(i=t.scrollTop-A),0===i)return;let n=s.value;n.style.transition="transform .3s ease-out",n.style.webkitTransition="-webkit-transform .3s ease-out","x"===e?o="translateX("+i+"px) translateZ(0)":"y"===e&&(o="translateY("+i+"px) translateZ(0)"),n.removeEventListener("transitionend",I),n.removeEventListener("webkitTransitionEnd",I),I=()=>m(A,e),n.addEventListener("transitionend",I),n.addEventListener("webkitTransitionEnd",I),"x"===e?t.style.overflowX="hidden":"y"===e&&(t.style.overflowY="hidden"),n.style.transform=o,n.style.webkitTransform=o}function B(A){const t=A.target;o("scroll",A,{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,scrollHeight:t.scrollHeight,scrollWidth:t.scrollWidth,deltaX:e.lastScrollLeft-t.scrollLeft,deltaY:e.lastScrollTop-t.scrollTop}),E.value&&(t.scrollTop<=d.value&&e.lastScrollTop-t.scrollTop>0&&A.timeStamp-e.lastScrollToUpperTime>200&&(o("scrolltoupper",A,{direction:"top"}),e.lastScrollToUpperTime=A.timeStamp),t.scrollTop+t.offsetHeight+h.value>=t.scrollHeight&&e.lastScrollTop-t.scrollTop<0&&A.timeStamp-e.lastScrollToLowerTime>200&&(o("scrolltolower",A,{direction:"bottom"}),e.lastScrollToLowerTime=A.timeStamp)),u.value&&(t.scrollLeft<=d.value&&e.lastScrollLeft-t.scrollLeft>0&&A.timeStamp-e.lastScrollToUpperTime>200&&(o("scrolltoupper",A,{direction:"left"}),e.lastScrollToUpperTime=A.timeStamp),t.scrollLeft+t.offsetWidth+h.value>=t.scrollWidth&&e.lastScrollLeft-t.scrollLeft<0&&A.timeStamp-e.lastScrollToLowerTime>200&&(o("scrolltolower",A,{direction:"right"}),e.lastScrollToLowerTime=A.timeStamp)),e.lastScrollTop=t.scrollTop,e.lastScrollLeft=t.scrollLeft}function Q(e){E.value&&(A.scrollWithAnimation?C(e,"y"):r.value.scrollTop=e)}function p(e){u.value&&(A.scrollWithAnimation?C(e,"x"):r.value.scrollLeft=e)}function f(e){if(e){if(!/^[_a-zA-Z][-_a-zA-Z0-9:]*$/.test(e))return void console.error(`id error: scroll-into-view=${e}`);let t=n.value.querySelector("#"+e);if(t){let e=r.value.getBoundingClientRect(),i=t.getBoundingClientRect();if(u.value){let t=i.left-e.left,o=r.value.scrollLeft+t;A.scrollWithAnimation?C(o,"x"):r.value.scrollLeft=o}if(E.value){let t=i.top-e.top,o=r.value.scrollTop+t;A.scrollWithAnimation?C(o,"y"):r.value.scrollTop=o}}}}function m(A,e){s.value.style.transition="",s.value.style.webkitTransition="",s.value.style.transform="",s.value.style.webkitTransform="";let t=r.value;"x"===e?(t.style.overflowX=u.value?"auto":"hidden",t.scrollLeft=A):"y"===e&&(t.style.overflowY=E.value?"auto":"hidden",t.scrollTop=A),s.value.removeEventListener("transitionend",I),s.value.removeEventListener("webkitTransitionEnd",I)}function y(t){if(A.refresherEnabled){switch(t){case"refreshing":e.refresherHeight=A.refresherThreshold,g||(g=!0,o("refresherpulling",{},{deltaY:e.refresherHeight,dy:e.refresherHeight}),o("refresherrefresh",{},{dy:v.y-D.y}),a("update:refresherTriggered",!0));break;case"restore":case"refresherabort":g=!1,e.refresherHeight=c=0,"restore"===t&&(l=!1,o("refresherrestore",{},{dy:v.y-D.y})),"refresherabort"===t&&l&&(l=!1,o("refresherabort",{},{dy:v.y-D.y}))}e.refreshState=t}}let D={x:0,y:0},v={x:0,y:A.refresherThreshold};return Uo(()=>{pi(()=>{Q(t.value),p(i.value)}),f(A.scrollIntoView);let n=function(A){A.preventDefault(),A.stopPropagation(),B(A)},s=null,a=function(t){if(null===D)return;let i=t.touches[0].pageX,n=t.touches[0].pageY,a=r.value;if(Math.abs(i-D.x)>Math.abs(n-D.y))if(u.value){if(0===a.scrollLeft&&i>D.x)return void(s=!1);if(a.scrollWidth===a.offsetWidth+a.scrollLeft&&i D.y)s=!1,A.refresherEnabled&&!1!==t.cancelable&&t.preventDefault();else{if(a.scrollHeight===a.offsetHeight+a.scrollTop&&n 0&&(l=!0,o("refresherpulling",t,{deltaY:i,dy:i})))}},I=function(A){1===A.touches.length&&(D={x:A.touches[0].pageX,y:A.touches[0].pageY})},d=function(t){v={x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY},e.refresherHeight>=A.refresherThreshold?y("refreshing"):y("refresherabort"),D={x:0,y:0},v={x:0,y:A.refresherThreshold}};r.value.addEventListener("touchstart",I,dQ),r.value.addEventListener("touchmove",a,oe(!1)),r.value.addEventListener("scroll",n,oe(!1)),r.value.addEventListener("touchend",d,dQ),xo(()=>{r.value.removeEventListener("touchstart",I),r.value.removeEventListener("touchmove",a),r.value.removeEventListener("scroll",n),r.value.removeEventListener("touchend",d)})}),wo(()=>{E.value&&(r.value.scrollTop=e.lastScrollTop),u.value&&(r.value.scrollLeft=e.lastScrollLeft)}),Xi(t,A=>{Q(A)}),Xi(i,A=>{p(A)}),Xi(()=>A.scrollIntoView,A=>{f(A)}),Xi(()=>A.refresherTriggered,A=>{!0===A?y("refreshing"):!1===A&&y("restore")}),{realScrollX:u,realScrollY:E,_scrollTopChanged:Q,_scrollLeftChanged:p}}(A,g,c,l,a,o,n,s,e),h=Ur(()=>{let A="";return I.value?A+="overflow-x:auto;":A+="overflow-x:hidden;",u.value?A+="overflow-y:auto;":A+="overflow-y:hidden;",A}),C=Ur(()=>{let e="uni-scroll-view";return!1===A.showScrollbar&&(e+=" uni-scroll-view-scrollbar-hidden"),e});return i({$getMain:()=>n.value}),()=>{const{refresherEnabled:e,refresherBackground:i,refresherDefaultStyle:a,refresherThreshold:c}=A,{refresherHeight:l,refreshState:I}=g;return Ir("uni-scroll-view",{ref:o},[Ir("div",{ref:r,class:"uni-scroll-view"},[Ir("div",{ref:n,style:h.value,class:C.value},[e?Ir(EQ,{refreshState:I,refresherHeight:l,refresherThreshold:c,refresherDefaultStyle:a,refresherBackground:i},{default:()=>["none"==a?t.refresher&&t.refresher():null]},8,["refreshState","refresherHeight","refresherThreshold","refresherDefaultStyle","refresherBackground"]):null,Ir("div",{ref:s,class:"uni-scroll-view-content"},[t.default&&t.default()],512)],6)],512)],512)}}});const CQ=Ll({name:"Slider",props:{name:{type:String,default:""},min:{type:[Number,String],default:0},max:{type:[Number,String],default:100},value:{type:[Number,String],default:0},step:{type:[Number,String],default:1},disabled:{type:[Boolean,String],default:!1},color:{type:String,default:"#e9e9e9"},backgroundColor:{type:String,default:"#e9e9e9"},activeColor:{type:String,default:"#007aff"},selectedColor:{type:String,default:"#007aff"},blockColor:{type:String,default:"#ffffff"},blockSize:{type:[Number,String],default:28},showValue:{type:[Boolean,String],default:!1}},emits:["changing","change"],setup(A,{emit:e}){const t=Kt(null),i=Kt(null),o=Kt(null),n=Kt(Number(A.value));Xi(()=>A.value,A=>{n.value=Number(A)});const r=Ol(t,e),s=function(A,e){const t=()=>BQ(e.value,A.min,A.max),i=()=>"#e9e9e9"!==A.backgroundColor?A.backgroundColor:"#007aff"!==A.color?A.color:"#007aff",o=()=>"#007aff"!==A.activeColor?A.activeColor:"#e9e9e9"!==A.selectedColor?A.selectedColor:"#e9e9e9",n={setBgColor:Ur(()=>({backgroundColor:i()})),setBlockBg:Ur(()=>({left:t()})),setActiveColor:Ur(()=>({backgroundColor:o(),width:t()})),setBlockStyle:Ur(()=>({width:A.blockSize+"px",height:A.blockSize+"px",marginLeft:-A.blockSize/2+"px",marginTop:-A.blockSize/2+"px",left:t(),backgroundColor:A.blockColor}))};return n}(A,n),{_onClick:a,_onTrack:g}=function(A,e,t,i,o){const n=t=>{A.disabled||(s(t),o("change",t,{value:e.value}))},r=e=>{const t=Number(A.max),i=Number(A.min),o=Number(A.step);return et?t:QQ.mul.call(Math.round((e-i)/o),o)+i},s=o=>{const n=Number(A.max),s=Number(A.min),a=i.value,g=getComputedStyle(a,null).marginLeft;let c=a.offsetWidth;c+=parseInt(g);const l=t.value,I=l.offsetWidth-(A.showValue?c:0),u=l.getBoundingClientRect().left,E=(o.x-u)*(n-s)/I+s;e.value=r(E)},a=t=>{if(!A.disabled)return"move"===t.detail.state?(s({x:t.detail.x}),o("changing",t,{value:e.value}),!1):"end"===t.detail.state&&o("change",t,{value:e.value})},g=pn(Jl,!1);if(g){const t={reset:()=>e.value=Number(A.min),submit:()=>{const t=["",null];return""!==A.name&&(t[0]=A.name,t[1]=e.value),t}};g.addField(t),xo(()=>{g.removeField(t)})}return{_onClick:n,_onTrack:a}}(A,n,t,i,r);return Uo(()=>{kB(o.value,g)}),()=>{const{setBgColor:e,setBlockBg:r,setActiveColor:g,setBlockStyle:c}=s;return Ir("uni-slider",{ref:t,onClick:Fl(a)},[Ir("div",{class:"uni-slider-wrapper"},[Ir("div",{class:"uni-slider-tap-area"},[Ir("div",{style:e.value,class:"uni-slider-handle-wrapper"},[Ir("div",{ref:o,style:r.value,class:"uni-slider-handle"},null,4),Ir("div",{style:c.value,class:"uni-slider-thumb"},null,4),Ir("div",{style:g.value,class:"uni-slider-track"},null,4)],4)]),io(Ir("span",{ref:i,class:"uni-slider-value"},[n.value],512),[[ss,A.showValue]])])],8,["onClick"])}}}),BQ=(A,e,t)=>(t=Number(t),100*(A-(e=Number(e)))/(t-e)+"%");var QQ={mul:function(A){let e=0,t=this.toString(),i=A.toString();try{e+=t.split(".")[1].length}catch(__){}try{e+=i.split(".")[1].length}catch(__){}return Number(t.replace(".",""))*Number(i.replace(".",""))/Math.pow(10,e)}};function pQ(A,e,t,i,o,n){function r(){g&&(clearTimeout(g),g=null)}let s,a,g=null,c=!0,l=0,I=1,u=null,E=!1,d=0,h="";const C=Ur(()=>t.value.length>e.displayMultipleItems),B=Ur(()=>A.circular&&C.value);function Q(o){Math.floor(2*l)===Math.floor(2*o)&&Math.ceil(2*l)===Math.ceil(2*o)||B.value&&function(i){if(!c)for(let o=t.value,n=o.length,r=i+e.displayMultipleItems,s=0;s =g.length&&(o-=g.length),o=s%1>.5||s<0?o-1:o,n("transition",{},{dx:A.vertical?0:o*a.offsetWidth,dy:A.vertical?o*a.offsetHeight:0})}function p(A){const i=t.value.length;if(!i)return-1;const o=(Math.round(A)%i+i)%i;if(B.value){if(i<=e.displayMultipleItems)return 0}else if(o>i-e.displayMultipleItems)return i-e.displayMultipleItems;return o}function f(){u=null}function m(){if(!u)return void(E=!1);const A=u,i=A.toPos,o=A.acc,r=A.endTime,g=A.source,c=r-Date.now();if(c<=0){Q(i),u=null,E=!1,s=null;const A=t.value[e.current];if(A){const t=A.getItemId();n("animationfinish",{},{current:e.current,currentItemId:t,source:g})}return}Q(i+o*c*c/2),a=requestAnimationFrame(m)}function y(A,i,o){f();const n=e.duration,r=t.value.length;let s=l;if(B.value)if(o<0){for(;sA;)s-=r}else if(o>0){for(;s>A;)s-=r;for(;s+rA;)s-=r;s+r-A A.current,()=>A.currentItemId,()=>[...t.value]],()=>{let i=-1;if(A.currentItemId)for(let e=0,o=t.value;e A.vertical,()=>B.value,()=>e.displayMultipleItems,()=>[...t.value]],function(){r(),u&&(Q(u.toPos),u=null);const o=t.value;for(let e=0;e 0&&I<1||(I=1)}const s=l;l=-2;const a=e.current;a>=0?(c=!1,e.userTracking?(Q(s+a-d),d=a):(Q(a),A.autoplay&&D())):(c=!0,Q(-e.displayMultipleItems-1))}),Xi(()=>e.interval,()=>{g&&(r(),D())}),Xi(()=>e.current,(A,i)=>{!function(A,i){const o=h;h="";const r=t.value;if(!o){const e=r.length;y(A,"",B.value&&i+(e-A)%e>e/2?1:0)}const s=r[A];if(s){const A=e.currentItemId=s.getItemId();n("change",{},{current:e.current,currentItemId:A,source:o})}}(A,i),o("update:current",A)}),Xi(()=>e.currentItemId,A=>{o("update:currentItemId",A)}),Xi(()=>A.autoplay&&!e.userTracking,v),v(A.autoplay&&!e.userTracking),Uo(()=>{let o=!1,n=0,s=0;function a(A){e.userTracking=!1;const t=n/Math.abs(n);let i=0;!A&&Math.abs(n)>.2&&(i=.5*t);const o=p(l+i);A?Q(d):(h="touch",e.current=o,y(o,"touch",0!==i?i:0===o&&B.value&&l>=1?1:0))}kB(i.value,g=>{if(!A.disableTouch&&!c){if("start"===g.detail.state)return e.userTracking=!0,o=!1,r(),d=l,n=0,s=Date.now(),void f();if("end"===g.detail.state)return a(!1);if("cancel"===g.detail.state)return a(!0);if(e.userTracking){if(!o){o=!0;const t=Math.abs(g.detail.dx),i=Math.abs(g.detail.dy);if((t>=i&&A.vertical||t<=i&&!A.vertical)&&(e.userTracking=!1),!e.userTracking)return void(A.autoplay&&D())}return function(o){const r=s;s=Date.now();const a=t.value.length-e.displayMultipleItems;function g(A){return.5-.25/(A+.5)}function c(A,e){let t=d+A;n=.6*n+.4*e,B.value||(t<0||t>a)&&(t<0?t=-g(-t):t>a&&(t=a+g(t-a)),n=0),Q(t)}const l=s-r||1,I=i.value;A.vertical?c(-o.dy/I.offsetHeight,-o.ddy/l):c(-o.dx/I.offsetWidth,-o.ddx/l)}(g.detail),!1}}})}),Po(()=>{r(),cancelAnimationFrame(a)}),{onSwiperDotClick:function(A){y(e.current=A,h="click",B.value?1:0)},circularEnabled:B,swiperEnabled:C}}const fQ=Ll({name:"Swiper",props:{indicatorDots:{type:[Boolean,String],default:!1},vertical:{type:[Boolean,String],default:!1},autoplay:{type:[Boolean,String],default:!1},circular:{type:[Boolean,String],default:!1},interval:{type:[Number,String],default:5e3},duration:{type:[Number,String],default:500},current:{type:[Number,String],default:0},indicatorColor:{type:String,default:""},indicatorActiveColor:{type:String,default:""},previousMargin:{type:String,default:""},nextMargin:{type:String,default:""},currentItemId:{type:String,default:""},skipHiddenItemLayout:{type:[Boolean,String],default:!1},displayMultipleItems:{type:[Number,String],default:1},disableTouch:{type:[Boolean,String],default:!1},navigation:{type:[Boolean,String],default:!1},navigationColor:{type:String,default:"#fff"},navigationActiveColor:{type:String,default:"rgba(53, 53, 53, 0.6)"}},emits:["change","transition","animationfinish","update:current","update:currentItemId"],setup(A,{slots:e,emit:t}){const i=Kt(null),o=Ol(i,t),n=Kt(null),r=Kt(null),s=function(A){return Nt({interval:Ur(()=>{const e=Number(A.interval);return isNaN(e)?5e3:e}),duration:Ur(()=>{const e=Number(A.duration);return isNaN(e)?500:e}),displayMultipleItems:Ur(()=>{const e=Math.round(A.displayMultipleItems);return isNaN(e)?1:e}),current:Math.round(A.current)||0,currentItemId:A.currentItemId,userTracking:!1})}(A),a=Ur(()=>{let e={};return(A.nextMargin||A.previousMargin)&&(e=A.vertical?{left:0,right:0,top:Oc(A.previousMargin,!0),bottom:Oc(A.nextMargin,!0)}:{top:0,bottom:0,left:Oc(A.previousMargin,!0),right:Oc(A.nextMargin,!0)}),e}),g=Ur(()=>{const e=Math.abs(100/s.displayMultipleItems)+"%";return{width:A.vertical?"100%":e,height:A.vertical?e:"100%"}});let c=[];const l=[],I=Kt([]);function u(){const A=[];for(let e=0;e t===A.rootRef.value);i&&A.push(Pt(i))}I.value=A}Qn("addSwiperContext",function(A){l.push(A),u()});Qn("removeSwiperContext",function(A){const e=l.indexOf(A);e>=0&&(l.splice(e,1),u())});const{onSwiperDotClick:E,circularEnabled:d,swiperEnabled:h}=pQ(A,s,I,r,t,o);let C=()=>null;return C=mQ(i,A,s,E,I,d,h),()=>{const t=e.default&&e.default();return c=RB(t),Ir("uni-swiper",{ref:i},[Ir("div",{ref:n,class:"uni-swiper-wrapper"},[Ir("div",{class:"uni-swiper-slides",style:a.value},[Ir("div",{ref:r,class:"uni-swiper-slide-frame",style:g.value},[t],4)],4),A.indicatorDots&&Ir("div",{class:["uni-swiper-dots",A.vertical?"uni-swiper-dots-vertical":"uni-swiper-dots-horizontal"]},[I.value.map((e,t,i)=>Ir("div",{onClick:()=>E(t),class:{"uni-swiper-dot":!0,"uni-swiper-dot-active":t =s.current||t {let s=!1,a=!1,g=!1,c=Kt(!1);function l(A,t){const i=A.currentTarget;i&&(i.style.backgroundColor="over"===t?e.navigationActiveColor:"")}zi(()=>{s="auto"===e.navigation,c.value=!0!==e.navigation||s,Q()}),zi(()=>{const A=o.value.length,e=!n.value;a=0===t.current&&e,g=t.current===A-1&&e||e&&t.current+t.displayMultipleItems>=A,r.value||(a=!0,g=!0,s&&(c.value=!0))});const I={onMouseover:A=>l(A,"over"),onMouseout:A=>l(A,"out")};function E(A,e,r){if(A.stopPropagation(),r)return;const s=o.value.length;let a=t.current;switch(e){case"prev":a--,a<0&&n.value&&(a=s-1);break;case"next":a++,a>=s&&n.value&&(a=0)}i(a)}const d=()=>jc(Hc,e.navigationColor,26);let h;const C=t=>{clearTimeout(h);const{clientX:i,clientY:o}=t,{left:n,right:r,top:s,bottom:a,width:g,height:l}=A.value.getBoundingClientRect();let I=!1;if(I=e.vertical?!(o-s {c.value=I},300);c.value=I},B=()=>{c.value=!0};function Q(){A.value&&(A.value.removeEventListener("mousemove",C),A.value.removeEventListener("mouseleave",B),s&&(A.value.addEventListener("mousemove",C),A.value.addEventListener("mouseleave",B)))}return Uo(Q),function(){const A={"uni-swiper-navigation-hide":c.value,"uni-swiper-navigation-vertical":e.vertical};return e.navigation?Ir(Kn,null,[Ir("div",Qr({class:["uni-swiper-navigation uni-swiper-navigation-prev",u({"uni-swiper-navigation-disabled":a},A)],onClick:A=>E(A,"prev",a)},I),[d()],16,["onClick"]),Ir("div",Qr({class:["uni-swiper-navigation uni-swiper-navigation-next",u({"uni-swiper-navigation-disabled":g},A)],onClick:A=>E(A,"next",g)},I),[d()],16,["onClick"])]):null}},yQ=Ll({name:"SwiperItem",props:{itemId:{type:String,default:""}},setup(A,{slots:e}){const t=Kt(null),i={rootRef:t,getItemId:()=>A.itemId,getBoundingClientRect:()=>t.value.getBoundingClientRect(),updatePosition(A,e){const i=e?"0":100*A+"%",o=e?100*A+"%":"0",n=t.value,r=`translate(${i},${o}) translateZ(0)`;n&&(n.style.webkitTransform=r,n.style.transform=r)}};return Uo(()=>{const A=pn("addSwiperContext");A&&A(i)}),Po(()=>{const A=pn("removeSwiperContext");A&&A(i)}),()=>Ir("uni-swiper-item",{ref:t,style:{position:"absolute",width:"100%",height:"100%"}},[e.default&&e.default()],512)}}),DQ=Ll({name:"Switch",props:{name:{type:String,default:""},checked:{type:[Boolean,String],default:!1},type:{type:String,default:"switch"},id:{type:String,default:""},disabled:{type:[Boolean,String],default:!1},color:{type:String,default:""}},emits:["change"],setup(A,{emit:e}){const t=Kt(null),i=Kt(A.checked),o=function(A,e){const t=pn(Jl,!1),i=pn(Vl,!1),o={submit:()=>{const t=["",null];return A.name&&(t[0]=A.name,t[1]=e.value),t},reset:()=>{e.value=!1}};t&&(t.addField(o),Po(()=>{t.removeField(o)}));return i}(A,i),n=Ol(t,e);Xi(()=>A.checked,A=>{i.value=A});const r=e=>{A.disabled||(i.value=!i.value,n("change",e,{value:i.value}))};return o&&(o.addHandler(r),xo(()=>{o.removeHandler(r)})),Kl(A,{"label-click":r}),()=>{const{color:e,type:o}=A,n=Yl(A,"disabled"),s={};let a;return e&&i.value&&(s.backgroundColor=e,s.borderColor=e),a=i.value,Ir("uni-switch",Qr({id:A.id,ref:t},n,{onClick:r}),[Ir("div",{class:"uni-switch-wrapper"},[io(Ir("div",{class:["uni-switch-input",[i.value?"uni-switch-input-checked":""]],style:s},null,6),[[ss,"switch"===o]]),io(Ir("div",{class:"uni-checkbox-input"},[a?jc(Yc,A.color,22):""],512),[[ss,"checkbox"===o]])])],16,["id","onClick"])}}});const vQ={ensp:" ",emsp:" ",nbsp:" "};function wQ(A,e){return function(A,{space:e,decode:t}){let i="",o=!1;for(let n of A)e&&vQ[e]&&" "===n&&(n=vQ[e]),o?(i+="n"===n?oA:"\\"===n?"\\":"\\"+n,o=!1):"\\"===n?o=!0:i+=n;return t?i.replace(/ /g,vQ.nbsp).replace(/ /g,vQ.ensp).replace(/ /g,vQ.emsp).replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"):i}(A,e).split(oA)}const SQ=Ll({name:"Text",props:{selectable:{type:[Boolean,String],default:!1},space:{type:String,default:""},decode:{type:[Boolean,String],default:!1}},setup(A,{slots:e}){const t=Kt(null);return()=>{const i=[];return e.default&&e.default().forEach(e=>{if(8&e.shapeFlag&&e.type!==zn){const t=wQ(e.children,{space:A.space,decode:A.decode}),o=t.length-1;t.forEach((A,e)=>{(0!==e||A)&&i.push(Er(A)),e!==o&&i.push(Ir("br"))})}else i.push(e)}),Ir("uni-text",{ref:t,selectable:!!A.selectable||null},[Ir("span",null,i)],8,["selectable"])}}}),MQ=u({},hB,{placeholderClass:{type:String,default:"input-placeholder"},autoHeight:{type:[Boolean,String],default:!1},confirmType:{type:String,default:"return",validator:A=>_Q.concat("return").includes(A)}});let RQ=!1;const _Q=["done","go","next","search","send"];const TQ=Ll({name:"Textarea",props:MQ,emits:["confirm","change","linechange",...CB],setup(A,{emit:e,expose:t}){const i=Kt(null),o=Kt(null),{fieldRef:n,state:r,scopedAttrsState:s,fixDisabledColor:a,trigger:g}=pB(A,i,e),c=Ur(()=>r.value.split(oA)),l=Ur(()=>_Q.includes(A.confirmType)),I=Kt(0),u=Kt(null);function E({height:A}){I.value=A}function d(A){}function h(A){"Enter"===A.key&&l.value&&A.preventDefault()}function C(e){if("Enter"===e.key&&l.value){!function(A){g("confirm",A,{value:r.value})}(e);const t=e.target;!A.confirmHold&&t.blur()}}return Xi(()=>I.value,e=>{const t=i.value,n=u.value,r=o.value;let s=parseFloat(getComputedStyle(t).lineHeight);isNaN(s)&&(s=n.offsetHeight);var a=Math.round(e/s);g("linechange",{},{height:e,heightRpx:750/window.innerWidth*e,lineCount:a}),A.autoHeight&&(r.style.height=e+"px")}),function(){const A="(prefers-color-scheme: dark)";RQ=0===String(navigator.platform).indexOf("iP")&&0===String(navigator.vendor).indexOf("Apple")&&window.matchMedia(A).media!==A}(),t({$triggerInput:A=>{e("update:modelValue",A.value),e("update:value",A.value),r.value=A.value}}),()=>{let e=A.disabled&&a?Ir("textarea",{key:"disabled-textarea",ref:n,value:r.value,tabindex:"-1",readonly:!!A.disabled,maxlength:r.maxlength,class:{"uni-textarea-textarea":!0,"uni-textarea-textarea-fix-margin":RQ},style:{overflowY:A.autoHeight?"hidden":"auto",...A.cursorColor&&{caretColor:A.cursorColor}},onFocus:A=>A.target.blur()},null,46,["value","readonly","maxlength","onFocus"]):Ir("textarea",{key:"textarea",ref:n,value:r.value,disabled:!!A.disabled,maxlength:r.maxlength,enterkeyhint:A.confirmType,inputmode:A.inputmode,class:{"uni-textarea-textarea":!0,"uni-textarea-textarea-fix-margin":RQ},style:{overflowY:A.autoHeight?"hidden":"auto",...A.cursorColor&&{caretColor:A.cursorColor}},onKeydown:h,onKeyup:C,onChange:d},null,46,["value","disabled","maxlength","enterkeyhint","inputmode","onKeydown","onKeyup","onChange"]);return Ir("uni-textarea",{ref:i,"auto-height":A.autoHeight},[Ir("div",{ref:o,class:"uni-textarea-wrapper"},[io(Ir("div",Qr(s.attrs,{style:A.placeholderStyle,class:["uni-textarea-placeholder",A.placeholderClass]}),[A.placeholder],16),[[ss,!r.value.length]]),Ir("div",{ref:u,class:"uni-textarea-line"},[" "],512),Ir("div",{class:{"uni-textarea-compute":!0,"uni-textarea-compute-auto-height":A.autoHeight}},[c.value.map(A=>Ir("div",null,[A.trim()?A:"."])),Ir(wC,{initial:!0,onResize:E},null,8,["initial","onResize"])],2),"search"===A.confirmType?Ir("form",{action:"",onSubmit:()=>!1,class:"uni-input-form"},[e],40,["onSubmit"]):e],512)],8,["auto-height"])}}}),NQ=Ll({name:"View",props:u({},xl),setup(A,{slots:e}){const t=Kt(null),{hovering:i,binding:o}=Pl(A);return()=>{const n=A.hoverClass;return n&&"none"!==n?Ir("uni-view",Qr({class:i.value?n:"",ref:t},o),[jo(e,"default")],16):Ir("uni-view",{ref:t},[jo(e,"default")],512)}}});function bQ(A,e){if(e||(e=A.id),e)return A.$options.name.toLowerCase()+"."+e}function GQ(A,e,t){A&&sc(t||Xc(),A,({type:A,data:t},i)=>{e(A,t,i)})}function kQ(A,e){A&&function(A,e){e=rc(A,e),delete nc[e]}(e||Xc(),A)}function LQ(A,e,t,i){const o=Dr().proxy;i=null==i?Kc():i,Uo(()=>{GQ(e||bQ(o),A,i),!t&&e||Xi(()=>o.id,(e,t)=>{GQ(bQ(o,e),A,i),kQ(t&&bQ(o,t))})}),xo(()=>{kQ(e||bQ(o),i)})}let UQ=0;function FQ(A){const e=Kc(),t=Dr().proxy,i=t.$options.name.toLowerCase(),o=A||t.id||"context"+UQ++;return Uo(()=>{t.$el.__uniContextInfo={id:o,type:i,page:e}}),`${i}.${o}`}function OQ(A,e,t,i){p(e)&&Go(A,e.bind(t),i)}function xQ(A,e,t){const i=A.mpType||t.$mpType;if(i&&"component"!==i&&("page"!==i||"component"!==e.renderer)&&(Object.keys(A).forEach(i=>{if(function(A,e,t=!0){return!(t&&!p(e))&&(ue.indexOf(A)>-1||0===A.indexOf("on"))}(i,A[i],!1)){const o=A[i];C(o)?o.forEach(A=>OQ(i,A,t,e)):OQ(i,o,t,e)}}),"page"===i)){e.__isVisible=!0;try{let A=e.attrs.__pageQuery;0,il(t,CA,A),e.vapor||delete e.attrs.__pageQuery;const i=t.$page;"preloadPage"!==(null==i?void 0:i.openType)&&il(t,cA)}catch(__){console.error(__.message+oA+__.stack)}}}function PQ(A,e,t){xQ(A,e,t)}function YQ(A,e,t){return A[e]=t}function JQ(A,...e){const t=this[A];return t?t(...e):(console.error(`method ${A} not found`),null)}function HQ(A){const e=A.config.errorHandler;return function(t,i,o){e&&e(t,i,o);const n=A._instance;if(!n||!n.proxy)throw t;n[uA]?il(n.proxy,uA,t):ci(t,0,i&&i.$.vnode,!1)}}function qQ(A,e){return A?[...new Set([].concat(A,e))]:e}function VQ(A){const e=A.config;var t;e.errorHandler=he(A,HQ),t=e.optionMergeStrategies,ue.forEach(A=>{t[A]=qQ});const i=e.globalProperties;i.$set=YQ,i.$applyOptions=PQ,i.$callMethod=JQ,function(A){Ee=A,de.forEach(e=>e(A))}(A)}function jQ(A){const e=fg({history:zQ(),strict:!!__uniConfig.router.strict,routes:__uniRoutes,scrollBehavior:WQ});e.beforeEach((A,e)=>{var t;A&&e&&A.meta.isTabBar&&e.meta.isTabBar&&(t=e.meta.tabBarIndex,"undefined"!=typeof window&&(KQ[t]={left:window.pageXOffset,top:window.pageYOffset}))}),A.router=e,A.use(e)}let KQ=Object.create(null);const WQ=(A,e,t)=>{if(t)return t;if(A&&e&&A.meta.isTabBar&&e.meta.isTabBar){const e=(i=A.meta.tabBarIndex,KQ[i]);if(e)return e}return{left:0,top:0};var i};function zQ(){let{routerBase:A}=__uniConfig.router;"/"===A&&(A="");const e=ka(A);return e.listen((A,e,t)=>{"back"===t.direction&&function(A=1){const e=Uh(),t=e.length-1,i=t-A;for(let o=t;o>i;o--){const A=Rh(e[o]);Fh(Yh(A.path,A.id),!1)}}(Math.abs(t.delta))}),e}const ZQ={install(A){VQ(A),pl(A),Tl(A),A.config.warnHandler||(A.config.warnHandler=XQ),jQ(A)}};function XQ(A,e,t){if(e){if("PageMetaHead"===e.$.type.name)return;const A=e.$.parent;if(A&&"PageMeta"===A.type.name)return}const i=[`[Vue warn]: ${A}`];t.length&&i.push("\n",t),console.warn(...i)}const $Q={class:"uni-async-loading"},Ap=Ir("i",{class:"uni-loading"},null,-1),ep=Ul({name:"AsyncLoading",render:()=>(Ar(),nr("div",$Q,[Ap]))});function tp(){window.location.reload()}const ip=Ul({name:"AsyncError",props:["error"],setup(){qg();const{t:A}=Jg();return()=>Ir("div",{class:"uni-async-error",onClick:tp},[A("uni.async.error")],8,["onClick"])}});let op;function np(){return op}function rp(A){op=A,Object.defineProperty(op.$.ctx,"$children",{get:()=>Uh().map(A=>A.$vm)});const e=op.$.appContext.app;e.component(ep.name)||e.component(ep.name,ep),e.component(ip.name)||e.component(ip.name,ip),function(A){A.$vm=A,A.$mpType="app";const e=Kt(Jg().getLocale());Object.defineProperty(A,"$locale",{get:()=>e.value,set(A){e.value=A}})}(op),function(A,e){const t=A.$options||{};t.globalData=u(t.globalData||{},e),Object.defineProperty(A,"globalData",{get:()=>t.globalData,set(A){t.globalData=A}})}(op),Rl(),cl()}function sp(A,{clone:e,init:t,setup:i,before:o}){e&&(A=u({},A)),o&&o(A);const n=A.setup;return A.setup=(A,e)=>{const o=Dr();if(t(o.proxy),i(o),n)return n(A,e)},A}function ap(A,e){return A&&(A.__esModule||"Module"===A[Symbol.toStringTag])?sp(A.default,e):sp(A,e)}function gp(A){return ap(A,{clone:!0,init:Ph,setup(A){A.$pageInstance=A;const e=eI(),t=se(e.query);A.attrs.__pageQuery=t,Rh(A.proxy).options=t,A.proxy.options=t;const i=$l();var o;vh(i),A.onReachBottom=Nt([]),A.onPageScroll=Nt([]),Xi([A.onReachBottom,A.onPageScroll],()=>{const e=zc();A.proxy===e&&Zh(A,i)},{once:!0}),Lo(()=>{qh(A,i)}),Uo(()=>{Vh(A);const{onReady:t}=A;t&&F(t),up(e)}),Mo(()=>{if(!A.__isVisible){qh(A,i),A.__isVisible=!0;const{onShow:t}=A;t&&F(t),pi(()=>{up(e)})}},"ba",o),function(A,e){Mo(A,"bda",e)}(()=>{if(A.__isVisible&&!A.__isUnload){A.__isVisible=!1;{const{onHide:e}=A;e&&F(e)}}});const n=tl(A.proxy);return function(A){Ov.subscribe(rc(A,tc),ac)}(n),xo(()=>{!function(A){Ov.unsubscribe(rc(A,tc)),Object.keys(nc).forEach(e=>{0===e.indexOf(A+".")&&delete nc[e]})}(n)}),t}})}function cp(){const{windowWidth:A,windowHeight:e,screenWidth:t,screenHeight:i}=uni.getSystemInfoSync(),o=90===Math.abs(Number(window.orientation))?"landscape":"portrait";Pv.emit(mA,{deviceOrientation:o,size:{windowWidth:A,windowHeight:e,screenWidth:t,screenHeight:i}})}function lp(A){S(A.data)&&"WEB_INVOKE_APPSERVICE"===A.data.type&&Pv.emit(OA,A.data.data,A.data.pageId)}function Ip(){const{emit:A}=Pv;"visible"===document.visibilityState?A(UA,vC()):A(FA)}function up(A){const{tabBarText:e,tabBarIndex:t,route:i}=A.meta;e&&il("onTabItemTap",{index:t,text:e,pagePath:i})}function Ep(A){A=A>0&&A<1/0?A:0;const e=Math.floor(A/3600),t=Math.floor(A%3600/60),i=Math.floor(A%3600%60),o=(e<10?"0":"")+e;let n=(t<10?"0":"")+t+":"+((i<10?"0":"")+i);return"00"!==o&&(n=o+":"+n),n}function dp(A,e,t){const i=Nt({seeking:!1,gestureType:"none",volumeOld:0,volumeNew:0,currentTimeOld:0,currentTimeNew:0,toastThin:!1}),o={x:0,y:0};let n=null;let r;return{state:i,onTouchstart:function(A){const e=A.targetTouches[0];o.x=e.pageX,o.y=e.pageY,i.gestureType="none",i.volumeOld=0},onTouchmove:function(s){function a(){s.stopPropagation(),s.preventDefault()}t.fullscreen&&a();const g=i.gestureType;if("stop"===g)return;const c=s.targetTouches[0],l=c.pageX,I=c.pageY,u=o,E=e.value;if("progress"===g?(!function(A){const t=e.value,o=t.duration;let n=A/600*o+i.currentTimeOld;n<0?n=0:n>o&&(n=o);i.currentTimeNew=n}(l-u.x),i.seeking=!0):"volume"===g&&function(A){const t=e.value,o=i.volumeOld;let n;"number"==typeof o&&(n=o-A/200,n<0?n=0:n>1&&(n=1),clearTimeout(r),r=void 0,null==r&&(r=setTimeout(()=>{i.toastThin=!1,r=void 0},1e3)),t.volume=n,i.volumeNew=n)}(I-u.y),"none"===g)if(Math.abs(l-u.x)>Math.abs(I-u.y)){if(!A.enableProgressGesture)return void(i.gestureType="stop");i.gestureType="progress",i.currentTimeOld=i.currentTimeNew=E.currentTime,t.fullscreen||a()}else{if(!A.pageGesture&&!A.vslideGesture)return void(i.gestureType="stop");"none"!==i.gestureType&&null!=n||(n=setTimeout(()=>{i.toastThin=!0},500)),i.gestureType="volume",i.volumeOld=E.volume,t.fullscreen||a()}},onTouchend:function(A){const t=e.value;"none"!==i.gestureType&&"stop"!==i.gestureType&&(A.stopPropagation(),A.preventDefault()),"progress"===i.gestureType&&i.currentTimeOld!==i.currentTimeNew&&(t.currentTime=i.currentTimeNew),i.gestureType="none"}}}const hp={id:{type:String,default:""},src:{type:String,default:""},duration:{type:[Number,String],default:""},controls:{type:[Boolean,String],default:!0},danmuList:{type:Array,default:()=>[]},danmuBtn:{type:[Boolean,String],default:!1},enableDanmu:{type:[Boolean,String],default:!1},autoplay:{type:[Boolean,String],default:!1},loop:{type:[Boolean,String],default:!1},muted:{type:[Boolean,String],default:!1},objectFit:{type:String,default:"contain"},poster:{type:String,default:""},direction:{type:[String,Number],default:""},showProgress:{type:Boolean,default:!0},initialTime:{type:[String,Number],default:0},showFullscreenBtn:{type:[Boolean,String],default:!0},pageGesture:{type:[Boolean,String],default:!1},vslideGesture:{type:[Boolean,String],default:!1},enableProgressGesture:{type:[Boolean,String],default:!0},showPlayBtn:{type:[Boolean,String],default:!0},showCenterPlayBtn:{type:[Boolean,String],default:!0}},Cp=Ll({name:"Video",props:hp,emits:["fullscreenchange","progress","loadedmetadata","waiting","error","play","pause","ended","timeupdate"],setup(A,{emit:e,attrs:t,slots:i}){const o=Kt(null),n=Kt(null),r=Ol(o,e),{state:s}=IB(),{$attrs:a}=MB({excludeListeners:!0});Jg(),$g();const{videoRef:g,state:c,play:l,pause:I,stop:u,seek:E,playbackRate:d,toggle:h,onDurationChange:B,onLoadedMetadata:Q,onProgress:p,onWaiting:f,onVideoError:m,onPlay:y,onPause:D,onEnded:v,onTimeUpdate:w}=function(A,e,t){const i=Kt(null),o=Ur(()=>AC(A.src)),n=Ur(()=>"true"===A.muted||!0===A.muted),r=Nt({start:!1,src:o,playing:!1,currentTime:0,duration:0,progress:0,buffered:0,muted:n,pauseUpdatingCurrentTime:!1});function s(A){const e=A.target,t=e.buffered;t.length&&(r.buffered=t.end(t.length-1)/e.duration*100)}function a(){i.value.pause()}function g(A){const e=i.value;"number"!=typeof(A=Number(A))||isNaN(A)||(e.currentTime=A)}return Xi(()=>o.value,()=>{r.playing=!1,r.currentTime=0}),Xi(()=>r.buffered,A=>{t("progress",{},{buffered:A})}),Xi(()=>n.value,A=>{i.value.muted=A}),{videoRef:i,state:r,play:function(){const A=i.value;r.start=!0,A.play()},pause:a,stop:function(){g(0),a()},seek:g,playbackRate:function(A){i.value.playbackRate=A},toggle:function(){const A=i.value;r.playing?A.pause():A.play()},onDurationChange:function({target:A}){r.duration=A.duration},onLoadedMetadata:function(e){const i=Number(A.initialTime)||0,o=e.target;i>0&&(o.currentTime=i),t("loadedmetadata",e,{width:o.videoWidth,height:o.videoHeight,duration:o.duration}),s(e)},onProgress:s,onWaiting:function(A){t("waiting",A,{})},onVideoError:function(A){r.playing=!1,t("error",A,{})},onPlay:function(A){r.start=!0,r.playing=!0,t("play",A,{})},onPause:function(A){r.playing=!1,t("pause",A,{})},onEnded:function(A){r.playing=!1,t("ended",A,{})},onTimeUpdate:function(A){const e=A.target;r.pauseUpdatingCurrentTime||(r.currentTime=e.currentTime);const i=e.currentTime;t("timeupdate",A,{currentTime:i,duration:e.duration})}}}(A,0,r),{state:S,danmuRef:M,updateDanmu:R,toggleDanmu:_,sendDanmu:T}=function(A,e){const t=Kt(null),i=Nt({enable:Boolean(A.enableDanmu)});let o={time:0,index:-1};const n=C(A.danmuList)?JSON.parse(JSON.stringify(A.danmuList)):[];function r(A){const e=document.createElement("p");e.className="uni-video-danmu-item",e.innerText=A.text;let i=`bottom: ${100*Math.random()}%;color: ${A.color};`;e.setAttribute("style",i),t.value.appendChild(e),setTimeout(function(){i+="left: 0;-webkit-transform: translateX(-100%);transform: translateX(-100%);",e.setAttribute("style",i),setTimeout(function(){e.remove()},4e3)},17)}return n.sort(function(A,e){return(A.time||0)-(e.time||0)}),{state:i,danmuRef:t,updateDanmu:function(A){const t=A.target.currentTime,s=o,a={time:t,index:s.index};if(t>s.time)for(let o=s.index+1;o =(A.time||0)))break;a.index=o,e.playing&&i.enable&&r(A)}else if(t -1&&t<=(n[e].time||0);e--)a.index=e-1;o=a},toggleDanmu:function(){i.enable=!i.enable},sendDanmu:function(A){n.splice(o.index+1,0,{text:String(A.text),color:A.color,time:e.currentTime||0})}}}(A,c),{state:N,onFullscreenChange:b,emitFullscreenChange:G,toggleFullscreen:k,requestFullScreen:L,exitFullScreen:U}=function(A,e,t,i,o){const n=Nt({fullscreen:!1}),r=/^Apple/.test(navigator.vendor);function s(e){n.fullscreen=e,A("fullscreenchange",{},{fullScreen:e,direction:"vertical"})}function a(A){const n=o.value,a=e.value,g=t.value;let c;A?!document.fullscreenEnabled&&!document.webkitFullscreenEnabled||r&&!i.userAction?g.webkitEnterFullScreen?g.webkitEnterFullScreen():(c=!0,a.remove(),a.classList.add("uni-video-type-fullscreen"),document.body.appendChild(a)):a[document.fullscreenEnabled?"requestFullscreen":"webkitRequestFullscreen"]():document.fullscreenEnabled||document.webkitFullscreenEnabled?document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement&&document.webkitExitFullscreen():g.webkitExitFullScreen?g.webkitExitFullScreen():(c=!0,a.remove(),a.classList.remove("uni-video-type-fullscreen"),n.appendChild(a)),c&&s(A)}function g(){a(!1)}return xo(g),{state:n,onFullscreenChange:function(A,e){e&&document.fullscreenEnabled||s(!(!document.fullscreenElement&&!document.webkitFullscreenElement))},emitFullscreenChange:s,toggleFullscreen:a,requestFullScreen:function(){a(!0)},exitFullScreen:g}}(r,n,g,s,o),{state:F,onTouchstart:O,onTouchend:x,onTouchmove:P}=dp(A,g,N),{state:Y,progressRef:J,ballRef:H,clickProgress:q,toggleControls:V,autoHideEnd:j,autoHideStart:K}=function(A,e,t,i){const o=Kt(null),n=Kt(null),r=Ur(()=>A.showCenterPlayBtn&&!e.start),s=Kt(!0),a=Ur(()=>!r.value&&A.controls&&s.value),g=Nt({seeking:!1,touching:!1,controlsTouching:!1,centerPlayBtnShow:r,controlsShow:a,controlsVisible:s});let c;function l(){c=setTimeout(()=>{g.controlsVisible=!1},3e3)}function I(){c&&(clearTimeout(c),c=null)}return xo(()=>{c&&clearTimeout(c)}),Xi(()=>g.controlsShow&&e.playing&&!g.controlsTouching,A=>{A?l():I()}),Uo(()=>{const A=oe(!1);let r,s,a,c=!0;const l=n.value;function I(A){const t=A.targetTouches[0],n=t.pageX,l=t.pageY;if(c&&Math.abs(n-r) 100&&(E=100),e.progress=E,null==i||i(e.duration*E/100),g.seeking=!0,A.preventDefault(),A.stopPropagation()}function u(i){g.controlsTouching=!1,g.touching&&(l.removeEventListener("touchmove",I,A),c||(i.preventDefault(),i.stopPropagation(),t(e.duration*e.progress/100)),g.touching=!1)}l.addEventListener("touchstart",t=>{g.controlsTouching=!0;const i=t.targetTouches[0];r=i.pageX,s=i.pageY,a=e.progress,c=!0,g.touching=!0,l.addEventListener("touchmove",I,A)}),l.addEventListener("touchend",u),l.addEventListener("touchcancel",u)}),{state:g,progressRef:o,ballRef:n,clickProgress:function(A){const i=o.value;let n=A.target,r=A.offsetX;for(;n&&n!==i;)r+=n.offsetLeft,n=n.parentNode;const s=i.offsetWidth;let a=0;r>=0&&r<=s&&(a=r/s,t(e.duration*a))},toggleControls:function(){g.controlsVisible=!g.controlsVisible},autoHideStart:l,autoHideEnd:I}}(A,c,E,A=>{F.currentTimeNew=A});!function(A,e,t,i,o,n,r,s){const a={play:A,stop:t,pause:e,seek:i,sendDanmu:o,playbackRate:n,requestFullScreen:r,exitFullScreen:s};LQ((A,e)=>{let t;switch(A){case"seek":t=e.position;break;case"sendDanmu":t=e;break;case"playbackRate":t=e.rate}A in a&&a[A](t)},FQ(),!0)}(l,I,u,E,T,d,L,U);const W=function(A,e,t){const i=Ur(()=>"progress"===e.gestureType||t.touching);return Xi(i,i=>{A.pauseUpdatingCurrentTime=i,t.controlsTouching=i,"progress"===e.gestureType&&i&&(t.controlsVisible=i)}),Xi([()=>A.currentTime,()=>{hp.duration}],()=>{A.progress=A.currentTime/A.duration*100}),Xi(()=>e.currentTimeNew,e=>{A.currentTime=e}),i}(c,F,Y);return()=>Ir("uni-video",{ref:o,id:A.id,onClick:V},[Ir("div",{ref:n,class:"uni-video-container",onTouchstart:O,onTouchend:x,onTouchmove:P,onFullscreenchange:Gs(b,["stop"]),onWebkitfullscreenchange:Gs(A=>b(A,!0),["stop"])},[Ir("video",Qr({ref:g,style:{"object-fit":A.objectFit},muted:!!A.muted,loop:!!A.loop,src:c.src,poster:A.poster,autoplay:!!A.autoplay},a.value,{class:"uni-video-video","webkit-playsinline":!0,playsinline:!0,onDurationchange:B,onLoadedmetadata:Q,onProgress:p,onWaiting:f,onError:m,onPlay:y,onPause:D,onEnded:v,onTimeupdate:A=>{w(A),R(A)},onWebkitbeginfullscreen:()=>G(!0),onX5videoenterfullscreen:()=>G(!0),onWebkitendfullscreen:()=>G(!1),onX5videoexitfullscreen:()=>G(!1)}),null,16,["muted","loop","src","poster","autoplay","webkit-playsinline","playsinline","onDurationchange","onLoadedmetadata","onProgress","onWaiting","onError","onPlay","onPause","onEnded","onTimeupdate","onWebkitbeginfullscreen","onX5videoenterfullscreen","onWebkitendfullscreen","onX5videoexitfullscreen"]),io(Ir("div",{class:"uni-video-bar uni-video-bar-full",onClick:Gs(()=>{},["stop"])},[Ir("div",{class:"uni-video-controls"},[io(Ir("div",{class:{"uni-video-icon":!0,"uni-video-control-button":!0,"uni-video-control-button-play":!c.playing,"uni-video-control-button-pause":c.playing},onClick:Gs(h,["stop"])},null,10,["onClick"]),[[ss,A.showPlayBtn]]),io(Ir("div",{class:"uni-video-current-time"},[Ep(c.currentTime)],512),[[ss,A.showProgress]]),io(Ir("div",{ref:J,class:"uni-video-progress-container",onClick:Gs(q,["stop"])},[Ir("div",{class:{"uni-video-progress":!0,"uni-video-progress-progressing":W.value}},[Ir("div",{style:{width:c.buffered-c.progress+"%",left:c.progress+"%"},class:"uni-video-progress-buffered"},null,4),Ir("div",{style:{width:c.progress+"%"},class:"uni-video-progress-played"},null,4),Ir("div",{ref:H,style:{left:c.progress+"%"},class:{"uni-video-ball":!0,"uni-video-ball-progressing":W.value}},[Ir("div",{class:"uni-video-inner"},null)],6)],2)],8,["onClick"]),[[ss,A.showProgress]]),io(Ir("div",{class:"uni-video-duration"},[Ep(Number(A.duration)||c.duration)],512),[[ss,A.showProgress]])]),io(Ir("div",{class:{"uni-video-icon":!0,"uni-video-danmu-button":!0,"uni-video-danmu-button-active":S.enable},onClick:Gs(_,["stop"])},null,10,["onClick"]),[[ss,A.danmuBtn]]),io(Ir("div",{class:{"uni-video-icon":!0,"uni-video-fullscreen":!0,"uni-video-type-fullscreen":N.fullscreen},onClick:Gs(()=>k(!N.fullscreen),["stop"])},null,10,["onClick"]),[[ss,A.showFullscreenBtn]])],8,["onClick"]),[[ss,Y.controlsShow]]),io(Ir("div",{ref:M,style:"z-index: 0;",class:"uni-video-danmu"},null,512),[[ss,c.start&&S.enable]]),Y.centerPlayBtnShow&&Ir("div",{class:"uni-video-cover",onClick:Gs(()=>{},["stop"])},[Ir("div",{class:"uni-video-cover-play-button uni-video-icon",onClick:Gs(l,["stop"])},null,8,["onClick"])],8,["onClick"]),Ir("div",{class:"uni-video-loading"},["volume"===F.gestureType?Ir("div",{class:{"uni-video-toast-container":!0,"uni-video-toast-container-thin":F.toastThin},style:{marginTop:"5px"}},[!F.toastThin&&F.volumeNew>0&&"volume"===F.gestureType?Ir("text",{class:"uni-video-icon uni-video-toast-icon"},[""]):!F.toastThin&&Ir("text",{class:"uni-video-icon uni-video-toast-icon"},[""]),Ir("div",{class:"uni-video-toast-draw",style:{width:100*F.volumeNew+"%"}},null)],2):null]),Ir("div",{class:{"uni-video-toast":!0,"uni-video-toast-progress":W.value}},[Ir("div",{class:"uni-video-toast-title"},[Ir("span",{class:"uni-video-toast-title-current-time"},[Ep(F.currentTimeNew)])," / ",Number(A.duration)||Ep(c.duration)])],2),Ir("div",{class:"uni-video-slots"},[i.default&&i.default()])],40,["onTouchstart","onTouchend","onTouchmove","onFullscreenchange","onWebkitfullscreenchange"])],8,["id","onClick"])}}),Bp=({name:A,arg:e})=>{if("postMessage"===A);else switch(A){case"navigateTo":uni.navigateTo(e);break;case"navigateBack":uni.navigateBack(e);break;case"switchTab":uni.switchTab(e);break;case"reLaunch":uni.reLaunch(e);break;case"redirectTo":uni.redirectTo(e)}},Qp=HA(()=>Pv.on(OA,Bp)),pp=Ll({inheritAttrs:!1,name:"WebView",props:{src:{type:String,default:""},fullscreen:{type:Boolean,default:!0}},emits:["load"],setup(A,{emit:e}){Qp();const t=Kt(null),i=Kt(null),{$attrs:o,$excludeAttrs:n,$listeners:r}=MB({excludeListeners:!0}),s=Ol(t,e);let a;return(()=>{const e=document.createElement("iframe");e.onload=function(e){s("load",e,{src:A.src})},zi(()=>{for(const A in o.value)if(h(o.value,A)){const t=o.value[A];e[A]=t}}),zi(()=>{e.src=AC(A.src)}),i.value=e,a=function(A,e,t){const i=()=>{var i,o;if(t){const{top:t,left:i,width:o,height:n}=A.value.getBoundingClientRect();JA(e.value,{position:"absolute",display:"block",border:"0",top:t+"px",left:i+"px",width:o+"px",height:n+"px"})}else JA(e.value,{width:(null==(i=A.value)?void 0:i.style.width)||"300px",height:(null==(o=A.value)?void 0:o.style.height)||"150px"})};return i}(t,i,A.fullscreen),A.fullscreen&&document.body.appendChild(e)})(),Uo(()=>{var e;a(),!A.fullscreen&&(null==(e=t.value)||e.appendChild(i.value))}),wo(()=>{A.fullscreen&&(i.value.style.display="block")}),So(()=>{A.fullscreen&&(i.value.style.display="none")}),xo(()=>{A.fullscreen&&document.body.removeChild(i.value)}),()=>Ir(Kn,null,[Ir("uni-web-view",Qr({class:A.fullscreen?"uni-webview--fullscreen":""},r.value,n.value,{ref:t}),[Ir(wC,{onResize:a},null,8,["onResize"])],16)])}});let fp,mp=0;function yp(A,e,t,i){var o,n=document.createElement("script"),r=e.callback||"callback",s="__uni_jsonp_callback_"+mp++,a=e.timeout||3e4;function g(){clearTimeout(o),delete window[s],n.remove()}window[s]=A=>{p(t)&&t(A),g()},n.onerror=()=>{p(i)&&i(),g()},o=setTimeout(function(){p(i)&&i(),g()},a),n.src=A+(A.indexOf("?")>=0?"&":"?")+r+"="+s,document.body.appendChild(n)}function Dp(A){function e(){const A=this.div;this.getPanes().floatPane.appendChild(A)}function t(){const A=this.div.parentNode;A&&A.removeChild(this.div)}function i(){const e=this.option;this.Text=new A.Text({text:e.content,anchor:"bottom-center",offset:new A.Pixel(0,e.offsetY-16),style:{padding:(e.padding||8)+"px","line-height":(e.fontSize||14)+"px","border-radius":(e.borderRadius||0)+"px","border-color":`${e.bgColor||"#fff"} transparent transparent`,"background-color":e.bgColor||"#fff","box-shadow":"0 2px 6px 0 rgba(114, 124, 245, .5)","text-align":"center","font-size":(e.fontSize||14)+"px",color:e.color||"#000"},position:e.position});(A.event||A.Event).addListener(this.Text,"click",()=>{this.callback()}),this.Text.setMap(e.map)}function o(){}function n(){this.Text&&this.option.map.remove(this.Text)}function r(){this.Text&&this.option.map.remove(this.Text)}class s{constructor(A={},s){this.createAMapText=i,this.removeAMapText=n,this.createBMapText=o,this.removeBMapText=r,this.onAdd=e,this.construct=e,this.onRemove=t,this.destroy=t,this.option=A||{};const a=this.visible=this.alwaysVisible="ALWAYS"===A.display;if(kp())this.callback=s,this.visible&&this.createAMapText();else if(Lp())this.visible&&this.createBMapText();else{const e=A.map;this.position=A.position,this.index=1;const t=this.div=document.createElement("div"),i=t.style;i.position="absolute",i.whiteSpace="nowrap",i.transform="translateX(-50%) translateY(-100%)",i.zIndex="1",i.boxShadow=A.boxShadow||"none",i.display=a?"block":"none";const o=this.triangle=document.createElement("div");o.setAttribute("style","position: absolute;white-space: nowrap;border-width: 4px;border-style: solid;border-color: #fff transparent transparent;border-image: initial;font-size: 12px;padding: 0px;background-color: transparent;width: 0px;height: 0px;transform: translate(-50%, 100%);left: 50%;bottom: 0;"),this.setStyle(A),t.appendChild(o),e&&this.setMap(e)}}set onclick(A){this.div.onclick=A}get onclick(){return this.div.onclick}setOption(A){this.option=A,"ALWAYS"===A.display?this.alwaysVisible=this.visible=!0:this.alwaysVisible=!1,kp()?this.visible&&this.createAMapText():Lp()?this.visible&&this.createBMapText():(this.setPosition(A.position),this.setStyle(A))}setStyle(A){const e=this.div,t=e.style;e.innerText=A.content||"",t.lineHeight=(A.fontSize||14)+"px",t.fontSize=(A.fontSize||14)+"px",t.padding=(A.padding||8)+"px",t.color=A.color||"#000",t.borderRadius=(A.borderRadius||0)+"px",t.backgroundColor=A.bgColor||"#fff",t.marginTop="-"+((A.top||0)+5)+"px",this.triangle.style.borderColor=`${A.bgColor||"#fff"} transparent transparent`}setPosition(A){this.position=A,this.draw()}draw(){const A=this.getProjection();if(!this.position||!this.div||!A)return;const e=A.fromLatLngToDivPixel(this.position),t=this.div.style;t.left=e.x+"px",t.top=e.y+"px"}changed(){this.div.style.display=this.visible?"block":"none"}}if(!kp()&&!Lp()){const e=new(A.OverlayView||A.Overlay);s.prototype.setMap=e.setMap,s.prototype.getMap=e.getMap,s.prototype.getPanes=e.getPanes,s.prototype.getProjection=e.getProjection,s.prototype.map_changed=e.map_changed,s.prototype.set=e.set,s.prototype.get=e.get,s.prototype.setOptions=e.setValues,s.prototype.bindTo=e.bindTo,s.prototype.bindsTo=e.bindsTo,s.prototype.notify=e.notify,s.prototype.setValues=e.setValues,s.prototype.unbind=e.unbind,s.prototype.unbindAll=e.unbindAll,s.prototype.addListener=e.addListener}return s}const vp={};function wp(A,e){const t=Np();if(!t.key)return void console.error("Map key not configured.");const i=vp[t.type]=vp[t.type]||[];if(fp)e(fp);else if(window[t.type]&&window[t.type].maps)fp=kp()||Lp()?window[t.type]:window[t.type].maps,fp.Callout=fp.Callout||Dp(fp),e(fp);else if(i.length)i.push(e);else{i.push(e);const o=window,n="__map_callback__"+t.type;o[n]=function(){delete o[n],fp=kp()||Lp()?window[t.type]:window[t.type].maps,fp.Callout=Dp(fp),i.forEach(A=>A(fp)),i.length=0},kp()&&function(A){window._AMapSecurityConfig={securityJsCode:A.securityJsCode||"",serviceHost:A.serviceHost||""}}(t);const r=document.createElement("script");let s=Sp(t.type);t.type===Tp.QQ&&A.push("geometry"),A.length&&(s+=`libraries=${A.join("%2C")}&`),t.type===Tp.BMAP?r.src=`${s}ak=${t.key}&callback=${n}`:r.src=`${s}key=${t.key}&callback=${n}`,r.onerror=function(){console.error("Map load failed.")},document.body.appendChild(r)}}const Sp=A=>({qq:"https://map.qq.com/api/js?v=2.exp&",google:"https://maps.googleapis.com/maps/api/js?",AMap:"https://webapi.amap.com/maps?v=2.0&",BMapGL:"https://api.map.baidu.com/api?type=webgl&v=1.0&"}[A]);const Mp="M13.3334375 16 q0.033125 1.1334375 0.783125 1.8834375 q0.75 0.75 1.8834375 0.75 q1.1334375 0 1.8834375 -0.75 q0.75 -0.75 0.75 -1.8834375 q0 -1.1334375 -0.75 -1.8834375 q-0.75 -0.75 -1.8834375 -0.75 q-1.1334375 0 -1.8834375 0.75 q-0.75 0.75 -0.783125 1.8834375 ZM30.9334375 14.9334375 l-1.1334375 0 q-0.5 -5.2 -4.0165625 -8.716875 q-3.516875 -3.5165625 -8.716875 -4.0165625 l0 -1.1334375 q0 -0.4665625 -0.3 -0.7665625 q-0.3 -0.3 -0.7665625 -0.3 q-0.4665625 0 -0.7665625 0.3 q-0.3 0.3 -0.3 0.7665625 l0 1.1334375 q-5.2 0.5 -8.716875 4.0165625 q-3.5165625 3.516875 -4.0165625 8.716875 l-1.1334375 0 q-0.4665625 0 -0.7665625 0.3 q-0.3 0.3 -0.3 0.7665625 q0 0.4665625 0.3 0.7665625 q0.3 0.3 0.7665625 0.3 l1.1334375 0 q0.5 5.2 4.0165625 8.716875 q3.516875 3.5165625 8.716875 4.0165625 l0 1.1334375 q0 0.4665625 0.3 0.7665625 q0.3 0.3 0.7665625 0.3 q0.4665625 0 0.7665625 -0.3 q0.3 -0.3 0.3 -0.7665625 l0 -1.1334375 q5.2 -0.5 8.716875 -4.0165625 q3.5165625 -3.516875 4.0165625 -8.716875 l1.1334375 0 q0.4665625 0 0.7665625 -0.3 q0.3 -0.3 0.3 -0.7665625 q0 -0.4665625 -0.3 -0.7665625 q-0.3 -0.3 -0.7665625 -0.3 ZM17.0665625 27.6665625 l0 -2.0665625 q0 -0.4665625 -0.3 -0.7665625 q-0.3 -0.3 -0.7665625 -0.3 q-0.4665625 0 -0.7665625 0.3 q-0.3 0.3 -0.3 0.7665625 l0 2.0665625 q-4.3 -0.4665625 -7.216875 -3.383125 q-2.916875 -2.916875 -3.3834375 -7.216875 l2.0665625 0 q0.4665625 0 0.7665625 -0.3 q0.3 -0.3 0.3 -0.7665625 q0 -0.4665625 -0.3 -0.7665625 q-0.3 -0.3 -0.7665625 -0.3 l-2.0665625 0 q0.4665625 -4.3 3.3834375 -7.216875 q2.9165625 -2.916875 7.216875 -3.3834375 l0 2.0665625 q0 0.4665625 0.3 0.7665625 q0.3 0.3 0.7665625 0.3 q0.4665625 0 0.7665625 -0.3 q0.3 -0.3 0.3 -0.7665625 l0 -2.0665625 q4.3 0.4665625 7.216875 3.3834375 q2.9165625 2.9165625 3.383125 7.216875 l-2.0665625 0 q-0.4665625 0 -0.7665625 0.3 q-0.3 0.3 -0.3 0.7665625 q0 0.4665625 0.3 0.7665625 q0.3 0.3 0.7665625 0.3 l2.0665625 0 q-0.4665625 4.3 -3.383125 7.216875 q-2.916875 2.9165625 -7.216875 3.383125 Z",Rp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACECAMAAABmmnOVAAAC01BMVEUAAAAAef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef96quGStdqStdpbnujMzMzCyM7Gyc7Ky83MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMwAef8GfP0yjfNWnOp0qOKKsdyYt9mju9aZt9mMstx1qeJYnekyjvIIfP0qivVmouaWttnMzMyat9lppOUujPQKffxhoOfNzc3Y2Njh4eHp6enu7u7y8vL19fXv7+/i4uLZ2dnOzs6auNgOf/sKff15quHR0dHx8fH9/f3////j4+N6quFdn+iywdPb29vw8PD+/v7c3NyywtLa2tr29vbS0tLd3d38/Pzf39/o6Ojc7f+q0v+HwP9rsf9dqv9Hnv9Vpv/q6urj8P+Vx/9Am/8Pgf8Iff/z8/OAvP95uf/n5+c5l//V6f+52v+y1//7+/vt7e0rkP/09PTQ0NDq9P8Whf+cy//W1tbe3t7A3v/m5ubs7OxOov/r6+vk5OQiaPjKAAAAknRSTlMACBZ9oB71/jiqywJBZATT6hBukRXv+zDCAVrkDIf4JbQsTb7eVeJLbwfa8Rh4G/OlPS/6/kxQ9/xdmZudoJxNVhng7B6wtWdzAtQOipcF1329wS44doK/BAkyP1pvgZOsrbnGXArAg34G2IsD1eMRe7bi7k5YnqFT9V0csyPedQyYD3p/Fje+hDpskq/MwpRBC6yKp2MAAAQdSURBVHja7Zn1exMxGIAPHbrhDsPdneHuNtzd3d3dIbjLh93o2o4i7TpgG1Jk0g0mMNwd/gTa5rq129reHnK5e/bk/TFNk/dJ7r5894XjGAwGg8GgTZasCpDIll1+hxw5vXLJLpEboTx5ZXbIhyzkl9fB28cqUaCgrBKFkI3CcjoUKYolihWXUSI7EihRUjaHXF52CVRKLoe8eZIdUOkyMknkRw6UlcehYAFHiXK+skgURk6Ul8OhQjFnCVRRBolKqRxQ5SzUHaqgNGSj7VCmalqJnDkoS5RF6ZCbroNvufQkUD6qEuXTdUA+3hQdqiEXVKfnUKOmK4latalJ1EEuoZZ6162HJ9x/4OChw0eOHj12/MTJU6dxG7XUu751tjNnz4ET5y9ctLZTSr0beKFLl89bpuUDrqgC1RqNWqsKuqqzNFw7e51S6u3tc+OmZUJ9kCHY6ECwOkRvab51iUrqXej2HYDQsHBjWgx3Ae7dppB6N2wEcF9jdMGDUIDGTaR2aNoM9FqjG7QmaN5CWgc/gIePjG559BigpZQOrYB/4jBfRGRUtDkmJjY6KjLCofkpD62lc2gDfMpWPIuLdwyV8XEpHgaddBZ+wBuSFcwJqSN2ovmZ/dfnOvCTxqGtwzq8SEjv4EhISn48eWgnhUP7DvDSvgzxrs6vV6+FLiro2EkCic4QKkzwJsH1KYreCp0eQhfyDl1B/w4P/xa5JVJ4U03QjbRD9x7wXlgH5IE3wmMBHXoSlugFAcI6f/AkkSi8q6HQm6xDn77wEQ8djTwSj3tqAMguRTe4ikeOQyJ4YV+KfkQl+oNW5GbY4gWOWgbwJ+kwAD6Fi90MK2ZsrIeBBCUGwRXbqJ+/iJMQliIEBhOU6AJhtlG/IpHE2bqrYQg5h6HA4yQiRqwEfkGCdTCMmMRw+IbPDCQaHCsCYAQxiZHw3TbmD/ESOHgHwShiEqPhp/gggYkSztIxxCRawy/bmEniJaJtfwiEscQkxkFgRqJESqQwwHhiEuMBp3Vm8RK/cZoHEzKXhCK2QxEPpiJe0YlKCFaKCNv/cYBNUsBRPlkJSc0U+dM7E9H0ThGJbgZT/iR7yj+VqMS06Qr4+OFm2JdCxIa8lugzkJs5K6MfxAaYPUcBpYG5khZJEkUUSb7DPCnKRfPBXj6M8FwuegoLpCgXcQszVjhbJFUJUee2hBhLoYTIcYtB57KY+opSMdVqwatSlZVj05aV//CwJLMX2DluaUcwhXm4ali2XOoLjxUrPV26zFtF4f5p0Gp310+z13BUWNvbehEXona6iAtX/zVZmtfN4WixfsNky4S6gCCVVq3RPLdfSfpv3MRRZfPoLc6Xs/5bt3EyMGzE9h07/Xft2t15z6i9+zgGg8FgMBgMBoPBYDAYDAYj8/APG67Rie8pUDsAAAAASUVORK5CYII=",_p="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAACcCAMAAAC3Fl5oAAAB3VBMVEVMaXH/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/EhL/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/Dw//AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/GRn/NTX/Dw//Fhb/AAD/AAD/AAD/GRn/GRn/Y2P/AAD/AAD/ExP/Ghr/AAD/AAD/MzP/GRn/AAD/Hh7/AAD/RUX/AAD/AAD/AAD/AAD/AAD/AAD/Dg7/AAD/HR3/Dw//FRX/SUn/AAD/////kJD/DQ3/Zmb/+/v/wMD/mJj/6en/vb3/1NT//Pz/ODj/+fn/3Nz/nJz/j4//9/f/7e3/9vb/7Oz/2Nj/x8f/Ozv/+Pj/3d3/nZ3/2dn//f3/6Oj/2tr/v7//09P/vr7/mZn/l5cdSvP3AAAAe3RSTlMAAhLiZgTb/vztB/JMRhlp6lQW86g8mQ4KFPs3UCH5U8huwlesWtTYGI7RsdVeJGfTW5rxnutLsvXWF8vQNdo6qQbuz7D4hgVIx2xtw8GC1TtZaIw0i84P98tU0/fsj7PKaAgiZZxeVfo8Z52eg1P0nESrENnjXVPUgw/uuSmDAAADsUlEQVR42u3aZ3cTRxgF4GtbYleSLdnGcsENG2ODjbExEHrvhAQCIb1Bem+QdkeuuFMNBBJIfmuOckzZI8/srHYmH3Lm+QNXK632LTvQ03Tu/IWeU/tTGTKT2n+q58L5c00wpXJd47DHEt5w47pKxLbhdLdPKb/7dBYxVLxw1GcI/2h1BcpzKNFHLX2JQ4gumaiitqpEEhEdOMJI9h5AFC3feYzI+7IF2tpSLEOqDXpObPRYFm/jCWho/4Ble7MdoT7fzhhq9yHEz28wltU1UPrJZ0wd66HwicfYvEFIfePTAP8tSLTupBHvtGJFH9bSkNrNWEHzERrT34xSH9Ogr1CijkbVAUH1KRqVqkdQAw07iIAaGlcTqI+/0LjeJJ5J0IIEnkpXMdzs4sTtW9dnZq7fuj2xOMtwVWk88RHDjBYejYvnjD8qjOpfQsUqhvj7oSjxcJIhVj3pyKqpNjYvVjQ/RrXq5YABKi3MCYm5BSrtWO5v11DlmlC4RpU1WRS9SJU7QukOVbpQ9JLu549+Dd0AUOlTbkGEuk85vxLAK5QbuytC3R2j3HoAjZSbFxrmKTcCoJdSk0LLJKV6gSaPMqNTQsvUKGW8JrxKqUWhaZFSeWyh1LTQNE2pHF6mzOy40DQ+S5mLimJcENoKlOnBWsr8KbRNUGYt5LXgd6HtD3lNQIoyN4S2G5RJIUOZm0LbTcqsBqVmhLYZSlkPsP4VWf+Rrd+m1v9o9h8Vv5p42C1R5qL1x7WRglOgVN52yfwNOBu76P+lLPoYidu23KPciIHGa07ZeIW1jvcNtI7q5vexCPGYCmf+m/Y9a3sAwQ5bI9T7ukPgPcn9GToEao+xk1OixJT+GIsvNAbx6eAgPq0xiF+KtkpYKhRXCQ8eFFcJhSWGu3rZ8jJkCM8kz9K4TUnrC6mAgzTsB9tLwQ2W15qfosQ2GrQNpZr7aczbzVjBZsvLcaC1g0bsbIVEnU8DOr6H1KDH2LwtUBi0/JII6Dxm9zUXkH+XMWzfh1Dte1i2Pe3QkC77Zel7aehpO8wyHG6Dtt0NjKxhN6I4uSli/TqJiJJDUQ4NDCURXTrXRy1XcumyD24M+AzhD1RXIIZsl/LoyZmurJHDM7s8lvB2FQ/PmPJ6PseAXP5HGMYAAC7ABbgAF+ACXIALcAEuwAW4ABfgAlyAC3ABLsAFuID/d8Cx4NEt8/byOf0wLnis8zjMq9/Kp7bWw4JOj8u8TlhRl+G/Mp2wpOX48GffvvZ1CyL4B53LAS6zb08EAAAAAElFTkSuQmCC";var Tp=(A=>(A.QQ="qq",A.GOOGLE="google",A.AMAP="AMap",A.BMAP="BMapGL",A.UNKNOWN="",A))(Tp||{});function Np(){return __uniConfig.bMapKey?{type:"BMapGL",key:__uniConfig.bMapKey}:__uniConfig.qqMapKey?{type:"qq",key:__uniConfig.qqMapKey}:__uniConfig.googleMapKey?{type:"google",key:__uniConfig.googleMapKey}:__uniConfig.aMapKey?{type:"AMap",key:__uniConfig.aMapKey,securityJsCode:__uniConfig.aMapSecurityJsCode,serviceHost:__uniConfig.aMapServiceHost}:{type:"",key:""}}let bp=!1,Gp=!1;const kp=()=>Gp?bp:(Gp=!0,bp="AMap"===Np().type),Lp=()=>"BMapGL"===Np().type;function Up(A,e,t){const i=Np();return A&&"WGS84"===A.toUpperCase()||["google"].includes(i.type)||t?Promise.resolve(e):"qq"===i.type?new Promise(A=>{yp(`https://apis.map.qq.com/ws/coord/v1/translate?type=1&locations=${e.latitude},${e.longitude}&key=${i.key}&output=jsonp`,{callback:"callback"},t=>{if("locations"in t&&t.locations.length){const{lng:i,lat:o}=t.locations[0];A({longitude:i,latitude:o,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed})}else A(e)},()=>A(e))}):"AMap"===i.type?new Promise(A=>{wp([],()=>{window.AMap.convertFrom([e.longitude,e.latitude],"gps",(t,i)=>{if("ok"===i.info&&i.locations.length){const{lat:t,lng:o}=i.locations[0];A({longitude:o,latitude:t,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed})}else A(e)})})}):Promise.reject(new Error("translate coordinate system faild, map provider not configured or not supported"))}const Fp=Ul({name:"MapMarker",props:{id:{type:[Number,String],default:""},latitude:{type:[Number,String],require:!0},longitude:{type:[Number,String],require:!0},title:{type:String,default:""},iconPath:{type:String,require:!0},rotate:{type:[Number,String],default:0},alpha:{type:[Number,String],default:1},width:{type:[Number,String],default:""},height:{type:[Number,String],default:""},callout:{type:Object,default:null},label:{type:Object,default:null},anchor:{type:Object,default:null},clusterId:{type:[Number,String],default:""},customCallout:{type:Object,default:null},ariaLabel:{type:String,default:""}},setup(A){const e=String(isNaN(Number(A.id))?"":A.id),t=pn("onMapReady"),i=function(A){const e="uni-map-marker-label-"+A,t=document.createElement("style");return t.id=e,document.head.appendChild(t),Po(()=>{t.remove()}),function(A){const i=Object.assign({},A,{position:"absolute",top:"70px",borderStyle:"solid"}),o=document.createElement("div");return Object.keys(i).forEach(A=>{o.style[A]=i[A]||""}),t.innerText=`.${e}{${o.getAttribute("style")}}`,e}}(e);let o;function n(A){kp()?A.removeAMapText():A.setMap(null)}if(t((t,r,s)=>{function a(A){const a=A.title;let g;g=kp()?new r.LngLat(A.longitude,A.latitude):Lp()?new r.Point(A.longitude,A.latitude):new r.LatLng(A.latitude,A.longitude);const c=new Image;let l=0;c.onload=()=>{const I=A.anchor||{};let u,E,d,h,C="number"==typeof I.x?I.x:.5,B="number"==typeof I.y?I.y:1;A.iconPath&&(A.width||A.height)?(E=A.width||c.width/c.height*A.height,d=A.height||c.height/c.width*A.width):(E=c.width/2,d=c.height/2),l=d,h=d-(d-B*d),u="MarkerImage"in r?new r.MarkerImage(c.src,null,null,new r.Point(C*E,B*d),new r.Size(E,d)):"Icon"in r?new r.Icon({image:c.src,size:new r.Size(E,d),imageSize:new r.Size(E,d),imageOffset:new r.Pixel(C*E,B*d)}):{url:c.src,anchor:new r.Point(C,B),size:new r.Size(E,d)},Lp()?(o=new r.Marker(new r.Point(g.lng,g.lat)),t.addOverlay(o)):(o.setPosition(g),o.setIcon(u)),"setRotation"in o&&o.setRotation(A.rotate||0);const Q=A.label||{};let p;if("label"in o&&(o.label.setMap(null),delete o.label),Q.content){const A={borderColor:Q.borderColor,borderWidth:(Number(Q.borderWidth)||0)+"px",padding:(Number(Q.padding)||0)+"px",borderRadius:(Number(Q.borderRadius)||0)+"px",backgroundColor:Q.bgColor,color:Q.color,fontSize:(Q.fontSize||14)+"px",lineHeight:(Q.fontSize||14)+"px",marginLeft:(Number(Q.anchorX||Q.x)||0)+"px",marginTop:(Number(Q.anchorY||Q.y)||0)+"px"};if("Label"in r)p=new r.Label({position:g,map:t,clickable:!1,content:Q.content,style:A}),o.label=p;else if("setLabel"in o)if(kp()){const e=` \n ${Q.content}\n`;o.setLabel({content:e,direction:"bottom-right"})}else{const e=i(A);o.setLabel({text:Q.content,color:A.color,fontSize:A.fontSize,className:e})}}const f=A.callout||{};let m,y=o.callout;if(f.content||a){kp()&&f.content&&(f.content=f.content.replaceAll("\n","
"));const i="0px 0px 3px 1px rgba(0,0,0,0.5)";let n=-l/2;if((A.width||A.height)&&(n+=14-l/2),m=f.content?{position:g,map:t,top:h,offsetY:n,content:f.content,color:f.color,fontSize:f.fontSize,borderRadius:f.borderRadius,bgColor:f.bgColor,padding:f.padding,boxShadow:f.boxShadow||i,display:f.display}:{position:g,map:t,top:h,offsetY:n,content:a,boxShadow:i},y)y.setOption(m);else if(kp()){const A=()=>{""!==e&&s("callouttap",{},{markerId:Number(e)})};y=o.callout=new r.Callout(m,A)}else y=o.callout=new r.Callout(m),y.div.onclick=function(A){""!==e&&s("callouttap",A,{markerId:Number(e)}),A.stopPropagation(),A.preventDefault()},Np().type===Tp.GOOGLE&&(y.div.ontouchstart=function(A){A.stopPropagation()},y.div.onpointerdown=function(A){A.stopPropagation()})}else y&&(n(y),delete o.callout)},A.iconPath?c.src=AC(A.iconPath):console.error("Marker.iconPath is required.")}!function(A){Lp()||(o=new r.Marker({map:t,flat:!0,autoRotation:!1})),a(A);const i=r.event||r.Event;Lp()||i.addListener(o,"click",()=>{const t=o.callout;if(t&&!t.alwaysVisible)if(kp())t.visible=!t.visible,t.visible?o.callout.createAMapText():o.callout.removeAMapText();else if(t.set("visible",!t.visible),t.visible){const A=t.div,e=A.parentNode;e.removeChild(A),e.appendChild(A)}e&&s("markertap",{},{markerId:Number(e),latitude:A.latitude,longitude:A.longitude})})}(A),Xi(A,a)}),e){const A=pn("addMapChidlContext"),i=pn("removeMapChidlContext"),n={id:e,translate(A){t((e,t,i)=>{const n=A.destination,r=A.duration,s=!!A.autoRotate;let a=Number(A.rotate)||0,g=0;"getRotation"in o&&(g=o.getRotation());const c=o.getPosition(),l=new t.LatLng(n.latitude,n.longitude),I=t.geometry.spherical.computeDistanceBetween(c,l)/1e3/(("number"==typeof r?r:1e3)/36e5),u=t.event||t.Event,E=u.addListener(o,"moving",A=>{const e=A.latLng,t=o.label;t&&t.setPosition(e);const i=o.callout;i&&i.setPosition(e)}),d=u.addListener(o,"moveend",()=>{d.remove(),E.remove(),o.lastPosition=c,o.setPosition(l);const e=o.label;e&&e.setPosition(l);const t=o.callout;t&&t.setPosition(l);const i=A.animationEnd;p(i)&&i()});let h=0;s&&(o.lastPosition&&(h=t.geometry.spherical.computeHeading(o.lastPosition,c)),a=t.geometry.spherical.computeHeading(c,l)-h),"setRotation"in o&&o.setRotation(g+a),"moveTo"in o?o.moveTo(l,I):(o.setPosition(l),u.trigger(o,"moveend",{}))})}};A(n),Po(()=>i(n))}return Po(function(){o&&(o.label&&"setMap"in o.label&&o.label.setMap(null),o.callout&&n(o.callout),o.setMap(null))}),()=>null}});function Op(A){if(!A)return{r:0,g:0,b:0,a:0};let e=A.slice(1);const t=e.length;if(![3,4,6,8].includes(t))return{r:0,g:0,b:0,a:0};3!==t&&4!==t||(e=e.replace(/(\w{1})/g,"$1$1"));let[i,o,n,r]=e.match(/(\w{2})/g);const s=parseInt(i,16),a=parseInt(o,16),g=parseInt(n,16);return r?{r:s,g:a,b:g,a:(`0x100${r}`-65536)/255}:{r:s,g:a,b:g,a:1}}const xp={points:{type:Array,require:!0},color:{type:String,default:"#000000"},width:{type:[Number,String],default:""},dottedLine:{type:[Boolean,String],default:!1},arrowLine:{type:[Boolean,String],default:!1},arrowIconPath:{type:String,default:""},borderColor:{type:String,default:"#000000"},borderWidth:{type:[Number,String],default:""},colorList:{type:Array,default:()=>[]},level:{type:String,default:""}},Pp=Ul({name:"MapPolyline",props:xp,setup(A){let e,t;function i(){e&&e.setMap(null),t&&t.setMap(null)}return pn("onMapReady")((o,n)=>{function r(A){const i=[];A.points.forEach(A=>{let e;e=kp()?[A.longitude,A.latitude]:Lp()?new n.Point(A.longitude,A.latitude):new n.LatLng(A.latitude,A.longitude),i.push(e)});const r=Number(A.width)||1,{r:s,g:a,b:g,a:c}=Op(A.color),{r:l,g:I,b:u,a:E}=Op(A.borderColor),d={map:o,clickable:!1,path:i,strokeWeight:r,strokeColor:A.color||void 0,strokeDashStyle:A.dottedLine?"dash":"solid"},h=Number(A.borderWidth)||0,C={map:o,clickable:!1,path:i,strokeWeight:r+2*h,strokeColor:A.borderColor||void 0,strokeDashStyle:A.dottedLine?"dash":"solid"};"Color"in n?(d.strokeColor=new n.Color(s,a,g,c),C.strokeColor=new n.Color(l,I,u,E)):(d.strokeColor=`rgb(${s}, ${a}, ${g})`,d.strokeOpacity=c,C.strokeColor=`rgb(${l}, ${I}, ${u})`,C.strokeOpacity=E),h&&(t=new n.Polyline(C)),Lp()?(e=new n.Polyline(d.path,d),o.addOverlay(e)):e=new n.Polyline(d)}r(A),Xi(A,function(A){i(),r(A)})}),Po(i),()=>null}}),Yp=Ul({name:"MapCircle",props:{latitude:{type:[Number,String],require:!0},longitude:{type:[Number,String],require:!0},color:{type:String,default:"#000000"},fillColor:{type:String,default:"#00000000"},radius:{type:[Number,String],require:!0},strokeWidth:{type:[Number,String],default:""},level:{type:String,default:""}},setup(A){let e;function t(){e&&e.setMap(null)}return pn("onMapReady")((i,o)=>{function n(A){const t=kp()||Lp()?[A.longitude,A.latitude]:new o.LatLng(A.latitude,A.longitude),n={map:i,center:t,clickable:!1,radius:A.radius,strokeWeight:Number(A.strokeWidth)||1,strokeDashStyle:"solid"};if(Lp())n.strokeColor=A.color,n.fillColor=A.fillColor||"#000",n.fillOpacity=1;else{const{r:e,g:t,b:i,a:r}=Op(A.fillColor),{r:s,g:a,b:g,a:c}=Op(A.color);"Color"in o?(n.fillColor=new o.Color(e,t,i,r),n.strokeColor=new o.Color(s,a,g,c)):(n.fillColor=`rgb(${e}, ${t}, ${i})`,n.fillOpacity=r,n.strokeColor=`rgb(${s}, ${a}, ${g})`,n.strokeOpacity=c)}if(Lp()){let A=new o.Point(n.center[0],n.center[1]);e=new o.Circle(A,n.radius,n),i.addOverlay(e)}else e=new o.Circle(n),kp()&&i.add(e)}n(A),Xi(A,function(A){t(),n(A)})}),Po(t),()=>null}}),Jp={id:{type:[Number,String],default:""},position:{type:Object,required:!0},iconPath:{type:String,required:!0},clickable:{type:[Boolean,String],default:""},trigger:{type:Function,required:!0}},Hp=Ul({name:"MapControl",props:Jp,setup(A){const e=Ur(()=>AC(A.iconPath)),t=Ur(()=>{let e=`top:${A.position.top||0}px;left:${A.position.left||0}px;`;return A.position.width&&(e+=`width:${A.position.width}px;`),A.position.height&&(e+=`height:${A.position.height}px;`),e}),i=e=>{A.clickable&&A.trigger("controltap",e,{controlId:A.id})};return()=>Ir("div",{class:"uni-map-control"},[Ir("img",{src:e.value,style:t.value,class:"uni-map-control-icon",onClick:i},null,12,["src","onClick"])])}}),qp=HA(()=>{Yu.forEach(A=>{Vp.prototype[A]=function(e){p(e)&&this._events[A].push(e)}}),Ju.forEach(A=>{Vp.prototype[A]=function(e){var t=this._events[A.replace("off","on")],i=t.indexOf(e);i>=0&&t.splice(i,1)}})});class Vp{constructor(){this._src="";var A=this._audio=new Audio;this._stoping=!1;["src","autoplay","loop","duration","currentTime","paused","volume"].forEach(e=>{Object.defineProperty(this,e,{set:"src"===e?e=>(A.src=AC(e),this._src=e,e):t=>(A[e]=t,t),get:"src"===e?()=>this._src:()=>A[e]})}),this.startTime=0,Object.defineProperty(this,"obeyMuteSwitch",{set:()=>!1,get:()=>!1}),Object.defineProperty(this,"buffered",{get(){var e=A.buffered;return e.length?e.end(e.length-1):0}}),this._events={},Yu.forEach(A=>{this._events[A]=[]}),A.addEventListener("loadedmetadata",()=>{var e=Number(this.startTime)||0;e>0&&(A.currentTime=e)});var e=["canplay","pause","seeking","seeked","timeUpdate"];e.concat(["play","ended","error","waiting"]).forEach(t=>{A.addEventListener(t.toLowerCase(),()=>{if(this._stoping&&e.indexOf(t)>=0)return;const A=`on${t.slice(0,1).toUpperCase()}${t.slice(1)}`;this._events[A].forEach(A=>{A()})},!1)}),qp()}play(){this._stoping=!1,this._audio.play()}pause(){this._audio.pause()}stop(){this._stoping=!0,this._audio.pause(),this._audio.currentTime=0,this._events.onStop.forEach(A=>{A()})}seek(A){this._stoping=!1,"number"!=typeof(A=Number(A))||isNaN(A)||(this._audio.currentTime=A)}destroy(){this.stop()}}const jp=PI(0,()=>new Vp),Kp=YI("makePhoneCall",({phoneNumber:A},{resolve:e})=>(window.location.href=`tel:${A}`,e())),Wp="__DC_STAT_UUID",zp=navigator.cookieEnabled&&(window.localStorage||window.sessionStorage)||{};let Zp;function Xp(){if(Zp=Zp||zp[Wp],!Zp){Zp=Date.now()+""+Math.floor(1e7*Math.random());try{zp[Wp]=Zp}catch(A){}}return Zp}function $p(){if(!0!==__uniConfig.darkmode)return f(__uniConfig.darkmode)?__uniConfig.darkmode:"light";try{return window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}catch(A){return"light"}}function Af(){let A,e="0",t="",i="phone";const o=navigator.language;if(iC){A="iOS";const i=eC.match(/OS\s([\w_]+)\slike/);i&&(e=i[1].replace(/_/g,"."));const o=eC.match(/\(([a-zA-Z]+);/);o&&(t=o[1])}else if(tC){A="Android";const i=eC.match(/Android[\s/]([\w\.]+)[;\s]/);i&&(e=i[1]);const o=eC.match(/\((.+?)\)/),n=o?o[1].split(";"):eC.split(" "),r=[/\bAndroid\b/i,/\bLinux\b/i,/\bU\b/i,/^\s?[a-z][a-z]$/i,/^\s?[a-z][a-z]-[a-z][a-z]$/i,/\bwv\b/i,/\/[\d\.,]+$/,/^\s?[\d\.,]+$/,/\bBrowser\b/i,/\bMobile\b/i];for(let A=0;A0){t=e.split("Build")[0].trim();break}let i;for(let A=0;A -1&&A.indexOf("MSIE")>-1,t=A.indexOf("Edge")>-1&&!e,i=A.indexOf("Trident")>-1&&A.indexOf("rv:11.0")>-1;if(e){new RegExp("MSIE (\\d+\\.\\d+);").test(A);const e=parseFloat(RegExp.$1);return e>6?e:6}return t?-1:i?11:-1}());if("-1"!==a)s="IE";else{const A=["Version","Firefox","Chrome","Edge{0,1}"],e=["Safari","Firefox","Chrome","Edge"];for(let t=0;t {const A=window.devicePixelRatio,e=aC(),t=gC(e),i=cC(e,t),o=function(A,e){return A?Math[e?"min":"max"](screen.height,screen.width):screen.height}(e,t),n=lC(i);let r=window.innerHeight;const s=Rc.top,a={left:Rc.left,right:n-Rc.right,top:Rc.top,bottom:r-Rc.bottom,width:n-Rc.left-Rc.right,height:r-Rc.top-Rc.bottom},{top:g,bottom:c}=Gc();return r-=g,r-=c,{windowTop:g,windowBottom:c,windowWidth:n,windowHeight:r,pixelRatio:A,screenWidth:i,screenHeight:o,statusBarHeight:s,safeArea:a,safeAreaInsets:{top:Rc.top,right:Rc.right,bottom:Rc.bottom,left:Rc.left},screenTop:o-r}});let tf,of=!0;function nf(){of&&(tf=Af())}const rf=PI(0,()=>{nf();const{deviceBrand:A,deviceModel:e,brand:t,model:i,platform:o,system:n,deviceOrientation:r,deviceType:s,osname:a,osversion:g}=tf;return u({brand:t,deviceBrand:A,deviceModel:e,devicePixelRatio:window.devicePixelRatio,deviceId:Xp(),deviceOrientation:r,deviceType:s,model:i,platform:o,system:n,osName:a?a.toLowerCase():void 0,osVersion:g})}),sf=PI(0,()=>{nf();const{theme:A,language:e,browserName:t,browserVersion:i}=tf;return u({appId:__uniConfig.appId,appName:__uniConfig.appName,appVersion:__uniConfig.appVersion,appVersionCode:__uniConfig.appVersionCode,appLanguage:dE?dE():e,enableDebug:!1,hostSDKVersion:void 0,hostPackageName:void 0,hostFontSizeSetting:void 0,hostName:t,hostVersion:i,hostTheme:A,hostLanguage:e,language:e,SDKVersion:"",theme:A,version:"",uniPlatform:"web",isUniAppX:!1,uniCompileVersion:__uniConfig.compilerVersion,uniCompilerVersion:__uniConfig.compilerVersion,uniRuntimeVersion:__uniConfig.compilerVersion},{})}),af=PI(0,()=>{of=!0,nf(),of=!1;const A=ef(),e=rf(),t=sf();of=!0;const{ua:i,browserName:o,browserVersion:n,osname:r,osversion:s}=tf,a=u(A,e,t,{ua:i,browserName:o,browserVersion:n,uniPlatform:"web",uniCompileVersion:__uniConfig.compilerVersion,uniRuntimeVersion:__uniConfig.compilerVersion,fontSizeSetting:void 0,osName:r.toLowerCase(),osVersion:s,osLanguage:void 0,osTheme:void 0});return delete a.screenTop,delete a.enableDebug,__uniConfig.darkmode||delete a.theme,function(A){let e={};return S(A)&&Object.keys(A).sort().forEach(t=>{const i=t;e[i]=A[i]}),Object.keys(e)?e:A}(a)}),gf=YI("getSystemInfo",(A,{resolve:e})=>e(af())),cf="onNetworkStatusChange";function lf(){df().then(({networkType:A})=>{Pv.invokeOnCallback(cf,{isConnected:"none"!==A,networkType:A})})}function If(){return navigator.connection||navigator.webkitConnection||navigator.mozConnection}const uf=FI(cf,()=>{const A=If();A?A.addEventListener("change",lf):(window.addEventListener("offline",lf),window.addEventListener("online",lf))}),Ef=OI("offNetworkStatusChange",()=>{const A=If();A?A.removeEventListener("change",lf):(window.removeEventListener("offline",lf),window.removeEventListener("online",lf))}),df=YI("getNetworkType",(A,{resolve:e})=>{const t=If();let i="unknown";return t?(i=t.type,"cellular"===i&&t.effectiveType?i=t.effectiveType.replace("slow-",""):!i&&t.effectiveType?i=t.effectiveType:["none","wifi"].includes(i)||(i="unknown")):!1===navigator.onLine&&(i="none"),e({networkType:i})});let hf=null;const Cf=FI(kE,()=>{Qf()}),Bf=OI("offAccelerometer",()=>{pf()}),Qf=YI("startAccelerometer",(A,{resolve:e,reject:t})=>{if(window.DeviceMotionEvent){if(!hf){if(DeviceMotionEvent.requestPermission)return void DeviceMotionEvent.requestPermission().then(A=>{"granted"===A?(i(),e()):t(`${A}`)}).catch(A=>{t(`${A}`)});i()}e()}else t();function i(){hf=function(A){const e=A.acceleration||A.accelerationIncludingGravity;Pv.invokeOnCallback(kE,{x:e&&e.x||0,y:e&&e.y||0,z:e&&e.z||0})},window.addEventListener("devicemotion",hf,!1)}}),pf=YI("stopAccelerometer",(A,{resolve:e})=>{hf&&(window.removeEventListener("devicemotion",hf,!1),hf=null),e()});let ff=null;const mf=FI(LE,()=>{Df()}),yf=OI("offCompass",()=>{vf()}),Df=YI("startCompass",(A,{resolve:e,reject:t})=>{if(window.DeviceOrientationEvent){if(!ff){if(DeviceOrientationEvent.requestPermission)return void DeviceOrientationEvent.requestPermission().then(A=>{"granted"===A?(i(),e()):t(`${A}`)}).catch(A=>{t(`${A}`)});i()}e()}else t();function i(){ff=function(A){const e=360-(null!==A.alpha?A.alpha:360);Pv.invokeOnCallback(LE,{direction:e})},window.addEventListener("deviceorientation",ff,!1)}}),vf=YI("stopCompass",(A,{resolve:e})=>{ff&&(window.removeEventListener("deviceorientation",ff,!1),ff=null),e()}),wf=!!window.navigator.vibrate,Sf=YI("vibrateShort",(A,{resolve:e,reject:t})=>{wf&&window.navigator.vibrate(15)?e():t("vibrateLong:fail")}),Mf=YI("vibrateLong",(A,{resolve:e,reject:t})=>{wf&&window.navigator.vibrate(400)?e():t("vibrateLong:fail")});var Rf=(A,e,t)=>new Promise((i,o)=>{var n=A=>{try{s(t.next(A))}catch(__){o(__)}},r=A=>{try{s(t.throw(A))}catch(__){o(__)}},s=A=>A.done?i(A.value):Promise.resolve(A.value).then(n,r);s((t=t.apply(A,e)).next())});const _f=YI("getClipboardData",(A,e)=>Rf(void 0,[A,e],function*(A,{resolve:e,reject:t}){Xg();const{t:i}=Jg();try{e({data:yield navigator.clipboard.readText()})}catch(o){!function(A,e){const t=document.getElementById("#clipboard"),i=t?t.value:void 0;i?A({data:i}):e()}(e,()=>{t(`${o} ${i("uni.getClipboardData.fail")}`)})}})),Tf=YI("setClipboardData",(A,e)=>Rf(void 0,[A,e],function*({data:A},{resolve:e,reject:t}){try{yield navigator.clipboard.writeText(A),e()}catch(i){!function(A,e,t){const i=document.getElementById("#clipboard");i&&i.remove();const o=document.createElement("textarea");o.setAttribute("inputmode","none"),o.id="#clipboard",o.style.position="fixed",o.style.top="-9999px",o.style.zIndex="-9999",document.body.appendChild(o),o.value=A,o.select(),o.setSelectionRange(0,o.value.length);const n=document.execCommand("Copy",!1);o.blur(),n?e():t()}(A,e,t)}}),0,GE);const Nf=A=>{Pv.invokeOnCallback(EA,A)},bf=FI(EA,()=>{Pv.on(EA,Nf)}),Gf=OI("offThemeChange",()=>{Pv.off(EA,Nf)});const kf=PI(0,(A,e)=>{const t=typeof e,i="string"===t?e:JSON.stringify({type:t,data:e});localStorage.setItem(A,i)}),Lf=YI("setStorage",({key:A,data:e},{resolve:t,reject:i})=>{try{kf(A,e),t()}catch(o){i(o.message)}});function Uf(A){const e=localStorage&&localStorage.getItem(A);if(!f(e))throw new Error("data not found");let t=e;try{const A=function(A){const e=["object","string","number","boolean","undefined"];try{const t=f(A)?JSON.parse(A):A,i=t.type;if(e.indexOf(i)>=0){const A=Object.keys(t);if(2===A.length&&"data"in t){if(typeof t.data===i)return t.data;if("object"===i&&/^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{3}Z$/.test(t.data))return new Date(t.data)}else if(1===A.length)return""}}catch(t){}}(JSON.parse(e));void 0!==A&&(t=A)}catch(i){}return t}const Ff=PI(0,A=>{try{return Uf(A)}catch(e){return""}}),Of=YI("getStorage",({key:A},{resolve:e,reject:t})=>{try{e({data:Uf(A)})}catch(i){t(i.message)}}),xf=PI(0,A=>{localStorage&&localStorage.removeItem(A)}),Pf=YI(UE,({key:A},{resolve:e})=>{xf(A),e()}),Yf=PI(0,()=>{localStorage&&localStorage.clear()}),Jf=YI("clearStorage",(A,{resolve:e})=>{Yf(),e()}),Hf=PI(0,()=>{const A=localStorage&&localStorage.length||0,e=[];let t=0;for(let i=0;i{e(Hf())}),Vf=YI("getFileInfo",({filePath:A},{resolve:e,reject:t})=>{QC(A).then(A=>{e({size:A.size})}).catch(A=>{t(String(A))})},0,FE),jf=YI("openDocument",({filePath:A},{resolve:e})=>(window.open(A),e()),0,OE),Kf=YI("hideKeyboard",(A,{resolve:e,reject:t})=>{const i=document.activeElement;!i||"TEXTAREA"!==i.tagName&&"INPUT"!==i.tagName||(i.blur(),e())});const Wf=YI("getImageInfo",({src:A},{resolve:e,reject:t})=>{const i=new Image;i.onload=function(){e({width:i.naturalWidth,height:i.naturalHeight,path:0===A.indexOf("/")?window.location.protocol+"//"+window.location.host+A:A})},i.onerror=function(){t()},i.src=A},0,KE),zf=YI("getVideoInfo",({src:A},{resolve:e,reject:t})=>{QC(A,!0).then(A=>A).catch(()=>null).then(i=>{const o=document.createElement("video");if(void 0!==o.onloadedmetadata){const n=setTimeout(()=>{o.onloadedmetadata=null,o.onerror=null,t()},A.startsWith("data:")||A.startsWith("blob:")?300:3e3);o.onloadedmetadata=function(){clearTimeout(n),o.onerror=null,e({size:Math.ceil((i?i.size:0)/1024),duration:o.duration||0,width:o.videoWidth||0,height:o.videoHeight||0})},o.onerror=function(){clearTimeout(n),o.onloadedmetadata=null,t()},o.src=A}else t()})},0,zE),Zf={image:{jpg:"jpeg",jpe:"jpeg",pbm:"x-portable-bitmap",pgm:"x-portable-graymap",pnm:"x-portable-anymap",ppm:"x-portable-pixmap",psd:"vnd.adobe.photoshop",pic:"x-pict",rgb:"x-rgb",svg:"svg+xml",svgz:"svg+xml",tif:"tiff",xif:"vnd.xiff",wbmp:"vnd.wap.wbmp",wdp:"vnd.ms-photo",xbm:"x-xbitmap",ico:"x-icon"},video:{"3g2":"3gpp2","3gp":"3gpp",avi:"x-msvideo",f4v:"x-f4v",flv:"x-flv",jpgm:"jpm",jpgv:"jpeg",m1v:"mpeg",m2v:"mpeg",mpe:"mpeg",mpg:"mpeg",mpg4:"mpeg",m4v:"x-m4v",mkv:"x-matroska",mov:"quicktime",qt:"quicktime",movie:"x-sgi-movie",mp4v:"mp4",ogv:"ogg",smv:"x-smv",wm:"x-ms-wm",wmv:"x-ms-wmv",wmx:"x-ms-wmx",wvx:"x-ms-wvx"}};function Xf({count:A,sourceType:e,type:t,extension:i}){cB();const o=document.createElement("input");return o.type="file",JA(o,{position:"absolute",visibility:"hidden",zIndex:"-999",width:"0",height:"0",top:"0",left:"0"}),o.accept=i.map(A=>{if("all"!==t){const e=A.replace(".","");return`${t}/${Zf[t][e]||e}`}return function(){const A=window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i);return!(!A||"micromessenger"!==A[0])}()?".":0===A.indexOf(".")?A:`.${A}`}).join(","),A&&A>1&&(o.multiple=!0),"all"!==t&&e instanceof Array&&1===e.length&&"camera"===e[0]&&o.setAttribute("capture","camera"),o}let $f=null;const Am=YI("chooseFile",({count:A,sourceType:e,type:t,extension:i},{resolve:o,reject:n})=>{zg();const{t:r}=Jg();$f&&(document.body.removeChild($f),$f=null),$f=Xf({count:A,sourceType:e,type:t,extension:i}),document.body.appendChild($f),$f.addEventListener("cancel",()=>{n("chooseFile:fail cancel")}),$f.addEventListener("change",function(e){const t=e.target,i=[];if(t&&t.files){const e=t.files.length;for(let o=0;o (n=n||fC(e),n)}),oA)},tempFiles:i})}),$f.click(),lB()||console.warn(r("uni.chooseFile.notUserActivation"))},0,jE);let em=null;const tm=YI("chooseImage",({count:A,sourceType:e,extension:t},{resolve:i,reject:o})=>{zg();const{t:n}=Jg();em&&(document.body.removeChild(em),em=null),em=Xf({count:A,sourceType:e,extension:t,type:"image"}),document.body.appendChild(em),em.addEventListener("cancel",()=>{o("chooseImage:fail cancel")}),em.addEventListener("change",function(e){const t=e.target,o=[];if(t&&t.files){const e=t.files.length;for(let i=0;i (n=n||fC(e),n)}),iA)},tempFiles:o})}),em.click(),lB()||console.warn(n("uni.chooseFile.notUserActivation"))},0,HE),im={esc:["Esc","Escape"],enter:["Enter"]},om=Object.keys(im);function nm(){const A=Kt(""),e=Kt(!1),t=t=>{if(e.value)return;const i=om.find(A=>-1!==im[A].indexOf(t.key));i&&(A.value=i),pi(()=>A.value="")};return Uo(()=>{document.addEventListener("keyup",t)}),xo(()=>{document.removeEventListener("keyup",t)}),{key:A,disable:e}}const rm=Ir("div",{class:"uni-mask"},null,-1);function sm(A,e,t){return e.onClose=(...A)=>(e.visible=!1,t.apply(null,A)),Ps(Co({setup:()=>()=>(Ar(),nr(A,e,null,16))}))}function am(A){let e=document.getElementById(A);return e||(e=document.createElement("div"),e.id=A,document.body.append(e)),e}function gm(A,{onEsc:e,onEnter:t}){const i=Kt(A.visible),{key:o,disable:n}=nm();return Xi(()=>A.visible,A=>i.value=A),Xi(()=>i.value,A=>n.value=!A),zi(()=>{const{value:A}=o;"esc"===A?e&&e():"enter"===A&&t&&t()}),i}let cm=0,lm="";function Im(A){let e=cm;cm+=A?1:-1,cm=Math.max(0,cm),cm>0?0===e&&(lm=document.body.style.overflow,document.body.style.overflow="hidden"):(document.body.style.overflow=lm,lm="")}function um(){Uo(()=>Im(!0)),Po(()=>Im(!1))}const Em=Ul({name:"ImageView",props:{src:{type:String,default:""}},setup(A){const e=Nt({direction:"none"});let t=1,i=0,o=0,n=0,r=0;function s({detail:A}){t=A.scale}function a(A){const e=A.target.getBoundingClientRect();i=e.width,o=e.height}function g(A){const e=A.target.getBoundingClientRect();n=e.width,r=e.height,l(A)}function c(A){const s=t*i>n,a=t*o>r;e.direction=s&&a?"all":s?"horizontal":a?"vertical":"none",l(A)}function l(A){"all"!==e.direction&&"horizontal"!==e.direction||A.stopPropagation()}return()=>{const t={position:"absolute",left:"0",top:"0",width:"100%",height:"100%"};return Ir(_B,{style:t,onTouchstart:Fl(g),onTouchmove:Fl(l),onTouchend:Fl(c)},{default:()=>[Ir(JB,{style:t,direction:e.direction,inertia:!0,scale:!0,"scale-min":"1","scale-max":"4",onScale:s},{default:()=>[Ir("img",{src:A.src,style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",maxHeight:"100%",maxWidth:"100%"},onLoad:a},null,40,["src","onLoad"])]},8,["style","direction","inertia","scale","onScale"])]},8,["style","onTouchstart","onTouchmove","onTouchend"])}}});function dm(A){let e="number"==typeof A.current?A.current:A.urls.indexOf(A.current);return e=e<0?0:e,e}const hm=Ul({name:"ImagePreview",props:{urls:{type:Array,default:()=>[]},current:{type:[Number,String],default:0}},emits:["close"],setup(A,{emit:e}){um();const{key:t}=nm(),i=Kt(null),o=Kt(dm(A));let n;function r(){n||pi(()=>{e("close")})}function s(A){o.value=A.detail.current}Xi(()=>A.current,()=>o.value=dm(A)),Xi(()=>t.value,A=>{"esc"===A&&r()}),Uo(()=>{const A=i.value;let e=0,t=0;A.addEventListener("mousedown",A=>{n=!1,e=A.clientX,t=A.clientY}),A.addEventListener("mouseup",A=>{(Math.abs(A.clientX-e)>20||Math.abs(A.clientY-t)>20)&&(n=!0)})});const a={position:"absolute","box-sizing":"border-box",top:"0",right:"0",width:"60px",height:"44px",padding:"6px","line-height":"32px","font-size":"26px",color:"white","text-align":"center",cursor:"pointer"};return()=>{let e;return Ir("div",{ref:i,style:{display:"block",position:"fixed",left:"0",top:"0",width:"100%",height:"100%",zIndex:999,background:"rgba(0,0,0,0.8)"},onClick:r},[Ir(fQ,{navigation:"auto",current:o.value,onChange:s,"indicator-dots":!1,autoplay:!1,style:{position:"absolute",left:"0",top:"0",width:"100%",height:"100%"}},(t=e=A.urls.map(A=>Ir(yQ,null,{default:()=>[Ir(Em,{src:A},null,8,["src"])]})),"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!rr(t)?e:{default:()=>[e],_:1}),8,["current","onChange"]),Ir("div",{style:a},[jc(qc,"#ffffff",26)],4)],8,["onClick"]);var t}}});let Cm,Bm=null;const Qm=()=>{Bm=null,pi(()=>{null==Cm||Cm.unmount(),Cm=null})},pm=YI("previewImage",(A,{resolve:e})=>{Bm?u(Bm,A):(Bm=Nt(A),pi(()=>{Cm=sm(hm,Bm,Qm),Cm.mount(am("u-a-p"))})),e()},0,WE),fm=YI("closePreviewImage",(A,{resolve:e,reject:t})=>{Cm?(Qm(),e()):t()});let mm=null;const ym=YI("chooseVideo",({sourceType:A,extension:e},{resolve:t,reject:i})=>{zg();const{t:o}=Jg();mm&&(document.body.removeChild(mm),mm=null),mm=Xf({sourceType:A,extension:e,type:"video"}),document.body.appendChild(mm),mm.addEventListener("cancel",()=>{i("chooseVideo:fail cancel")}),mm.addEventListener("change",function(A){const e=A.target.files[0];let i="";const o={tempFilePath:i,tempFile:e,size:e.size,duration:0,width:0,height:0,name:e.name};Object.defineProperty(o,"tempFilePath",{get(){return i=i||fC(this.tempFile),i}});const n=document.createElement("video");if(void 0!==n.onloadedmetadata){const A=fC(e);n.onloadedmetadata=function(){mC(A),t(u(o,{duration:n.duration||0,width:n.videoWidth||0,height:n.videoHeight||0}))},setTimeout(()=>{n.onloadedmetadata=null,mC(A),t(o)},300),n.src=A}else t(o)}),mm.click(),lB()||console.warn(o("uni.chooseFile.notUserActivation"))},0,qE),Dm=xI("request",({url:A,data:e,header:t={},method:i,dataType:o,responseType:n,enableChunked:r,withCredentials:s,timeout:a=__uniConfig.networkTimeout.request},{resolve:g,reject:c})=>{let l=null;const I=function(A){const e=Object.keys(A).find(A=>"content-type"===A.toLowerCase());if(!e)return;const t=A[e];if(0===t.indexOf("application/json"))return"json";if(0===t.indexOf("application/x-www-form-urlencoded"))return"urlencoded";return"string"}(t);if("GET"!==i)if(f(e)||e instanceof ArrayBuffer)l=e;else if("json"===I)try{l=JSON.stringify(e)}catch(E){l=e.toString()}else if("urlencoded"===I){const A=[];for(const t in e)h(e,t)&&A.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));l=A.join("&")}else l=e.toString();let u;if(r){if(void 0===typeof window.fetch||void 0===typeof window.AbortController)throw new Error("fetch or AbortController is not supported in this environment");const e=new AbortController,r=e.signal;u=new wm(e);const I={method:i,headers:t,body:l,signal:r,credentials:s?"include":"same-origin"},E=setTimeout(function(){u.abort(),c("timeout",{errCode:5})},a);I.signal.addEventListener("abort",function(){clearTimeout(E),c("abort",{errCode:600003})}),window.fetch(A,I).then(A=>{const e=A.status,t=A.headers,i=A.body,r={};t.forEach((A,e)=>{r[e]=A});const s=vm(r);if(u._emitter.emit("headersReceived",{header:r,statusCode:e,cookies:s}),!i)return void g({data:"",statusCode:e,header:r,cookies:s});const a=i.getReader(),c=[],l=()=>{a.read().then(({done:A,value:t})=>{if(A){const A=function(A){const e=A.reduce((A,e)=>A+e.byteLength,0),t=new Uint8Array(e);let i=0;for(const o of A)t.set(new Uint8Array(o),i),i+=o.byteLength;return t.buffer}(c);let t="text"===n?(new TextDecoder).decode(A):A;return"text"===n&&(t=Mm(t,n,o)),void g({data:t,statusCode:e,header:r,cookies:s})}const i=t;c.push(i),u._emitter.emit("chunkReceived",{data:i}),l()})};l()},A=>{c(A,{errCode:5})})}else{const e=new XMLHttpRequest;u=new wm(e),e.open(i,A);for(const A in t)h(t,A)&&e.setRequestHeader(A,t[A]);const r=setTimeout(function(){e.onload=e.onabort=e.onerror=null,u.abort(),c("timeout",{errCode:5})},a);e.responseType=n,e.onload=function(){clearTimeout(r);const A=e.status;let t="text"===n?e.responseText:e.response;"text"===n&&(t=Mm(t,n,o)),g({data:t,statusCode:A,header:Sm(e.getAllResponseHeaders()),cookies:[]})},e.onabort=function(){clearTimeout(r),c("abort",{errCode:600003})},e.onerror=function(){clearTimeout(r),c(void 0,{errCode:5})},e.withCredentials=s,e.send(l)}return u},0,td),vm=A=>{let e=A["Set-Cookie"]||A["set-cookie"],t=[];if(!e)return[];"["===e[0]&&"]"===e[e.length-1]&&(e=e.slice(1,-1));const i=e.split(";");for(let o=0;o {e===A&&(this._requestOnHeadersReceiveCallbacks.delete(t),this._emitter.off("headersReceived",A))});const e=this._requestOnHeadersReceiveCallbacks.get(A);e&&(this._requestOnHeadersReceiveCallbacks.delete(A),this._emitter.off("headersReceived",e))}onChunkReceived(A){return this._emitter.on("chunkReceived",A),this._requestOnChunkReceiveCallbackId++,this._requestOnChunkReceiveCallbacks.set(this._requestOnChunkReceiveCallbackId,A),this._requestOnChunkReceiveCallbackId}offChunkReceived(A){if(null==A)return void this._emitter.off("chunkReceived");if("function"==typeof A)return void this._requestOnChunkReceiveCallbacks.forEach((e,t)=>{e===A&&(this._requestOnChunkReceiveCallbacks.delete(t),this._emitter.off("chunkReceived",A))});const e=this._requestOnChunkReceiveCallbacks.get(A);e&&(this._requestOnChunkReceiveCallbacks.delete(A),this._emitter.off("chunkReceived",e))}}function Sm(A){const e={};return A.split(oA).forEach(A=>{const t=A.match(/(\S+\s*):\s*(.*)/);t&&3===t.length&&(e[t[1]]=t[2])}),e}function Mm(A,e,t){let i=A;if("text"===e&&"json"===t)try{i=JSON.parse(i)}catch(o){}return i}class Rm{constructor(A){this._callbacks=[],this._xhr=A}onProgressUpdate(A){p(A)&&this._callbacks.push(A)}offProgressUpdate(A){const e=this._callbacks.indexOf(A);e>=0&&this._callbacks.splice(e,1)}abort(){this._xhr&&(this._xhr.abort(),delete this._xhr)}onHeadersReceived(A){throw new Error("Method not implemented.")}offHeadersReceived(A){throw new Error("Method not implemented.")}}const _m=xI("downloadFile",({url:A,header:e={},timeout:t=__uniConfig.networkTimeout.downloadFile},{resolve:i,reject:o})=>{var n,r=new XMLHttpRequest,s=new Rm(r);return r.open("GET",A,!0),Object.keys(e).forEach(A=>{r.setRequestHeader(A,e[A])}),r.responseType="blob",r.onload=function(){clearTimeout(n);const e=r.status,t=this.response;let o;const s=r.getResponseHeader("content-disposition");if(s){const A=s.match(/filename="?(\S+)"?\b/);A&&(o=A[1])}t.name=o||function(A){const e=(A=A.split("#")[0].split("?")[0]).split("/");return e[e.length-1]}(A),i({statusCode:e,tempFilePath:fC(t)})},r.onabort=function(){clearTimeout(n),o("abort",{errCode:600003})},r.onerror=function(){clearTimeout(n),o("",{errCode:602001})},r.onprogress=function(A){s._callbacks.forEach(e=>{var t=A.loaded,i=A.total;e({progress:Math.round(t/i*100),totalBytesWritten:t,totalBytesExpectedToWrite:i})})},r.send(),n=setTimeout(function(){r.onprogress=r.onload=r.onabort=r.onerror=null,s.abort(),o("timeout",{errCode:5})},t),s},0,id);class Tm{constructor(A){this._callbacks=[],this._xhr=A}onProgressUpdate(A){p(A)&&this._callbacks.push(A)}offProgressUpdate(A){const e=this._callbacks.indexOf(A);e>=0&&this._callbacks.splice(e,1)}abort(){this._isAbort=!0,this._xhr&&(this._xhr.abort(),delete this._xhr)}onHeadersReceived(A){throw new Error("Method not implemented.")}offHeadersReceived(A){throw new Error("Method not implemented.")}}const Nm=xI("uploadFile",({url:A,file:e,filePath:t,name:i,files:o,header:n={},formData:r={},timeout:s=__uniConfig.networkTimeout.uploadFile},{resolve:a,reject:g})=>{var c=new Tm;return C(o)&&o.length||(t||g("file error"),o=[{name:i,file:e,uri:t}]),Promise.all(o.map(({file:A,uri:e})=>A instanceof Blob?Promise.resolve(pC(A)):QC(e))).then(function(e){var t,i=new XMLHttpRequest,l=new FormData;Object.keys(r).forEach(A=>{l.append(A,r[A])}),Object.values(o).forEach(({name:A},t)=>{const i=e[t];l.append(A||"file",i,i.name||`file-${Date.now()}`)}),i.open("POST",A),Object.keys(n).forEach(A=>{i.setRequestHeader(A,n[A])}),i.upload.onprogress=function(A){c._callbacks.forEach(e=>{var t=A.loaded,i=A.total;e({progress:Math.round(t/i*100),totalBytesSent:t,totalBytesExpectedToSend:i})})},i.onerror=function(){clearTimeout(t),g("",{errCode:602001})},i.onabort=function(){clearTimeout(t),g("abort",{errCode:600003})},i.onload=function(){clearTimeout(t);const A=i.status;a({statusCode:A,data:i.responseText||i.response})},c._isAbort?g("abort",{errCode:600003}):(t=setTimeout(function(){i.upload.onprogress=i.onload=i.onabort=i.onerror=null,c.abort(),g("timeout",{errCode:5})},s),i.send(l),c._xhr=i)}).catch(()=>{setTimeout(()=>{g("file error")},0)}),c},0,od),bm=[],Gm={open:"",close:"",error:"",message:""};class km{constructor(A,e,t){let i;this._callbacks={open:[],close:[],error:[],message:[]};try{const t=this._webSocket=new WebSocket(A,e);t.binaryType="arraybuffer";["open","close","error","message"].forEach(A=>{this._callbacks[A]=[],t.addEventListener(A,e=>{const{data:t,code:i,reason:o}=e,n="message"===A?{data:t}:"close"===A?{code:i,reason:o}:{};if(this._callbacks[A].forEach(e=>{try{e(n)}catch(__){console.error(`thirdScriptError\n${__};at socketTask.on${k(A)} callback function\n`,__)}}),this===bm[0]&&Gm[A]&&Pv.invokeOnCallback(Gm[A],n),"error"===A||"close"===A){const A=bm.indexOf(this);A>=0&&bm.splice(A,1)}})});["CLOSED","CLOSING","CONNECTING","OPEN","readyState"].forEach(A=>{Object.defineProperty(this,A,{get:()=>t[A]})})}catch(__){i=__}t&&t(i,this)}send(A){const e=(A||{}).data,t=this._webSocket;try{if(t.readyState!==t.OPEN)throw qA(A,{errMsg:"sendSocketMessage:fail SocketTask.readyState is not OPEN",errCode:10002}),new Error("SocketTask.readyState is not OPEN");t.send(e),qA(A,"sendSocketMessage:ok")}catch(i){qA(A,{errMsg:`sendSocketMessage:fail ${i}`,errCode:602001})}}close(A={}){const e=this._webSocket;try{const t=A.code||1e3,i=A.reason;f(i)?e.close(t,i):e.close(t),qA(A,"closeSocket:ok")}catch(t){qA(A,`closeSocket:fail ${t}`)}}onOpen(A){this._callbacks.open.push(A)}onMessage(A){this._callbacks.message.push(A)}onError(A){this._callbacks.error.push(A)}onClose(A){this._callbacks.close.push(A)}}const Lm=xI("connectSocket",({url:A,protocols:e},{resolve:t,reject:i})=>new km(A,e,(A,e)=>{A?i(A.toString(),{errCode:600009}):(bm.push(e),t())}),0,nd);function Um(A,e,t,i,o){const n=A[e];p(n)&&n.call(A,u({},t,{success(){i()},fail({errMsg:A}){o(A.replace("sendSocketMessage:fail ",""))},complete:void 0}))}const Fm=YI("sendSocketMessage",(A,{resolve:e,reject:t})=>{const i=bm[0];i&&i.readyState===i.OPEN?Um(i,"send",A,e,t):t("WebSocket is not connected")}),Om=YI("closeSocket",(A,{resolve:e,reject:t})=>{const i=bm[0];i?Um(i,"close",A,e,t):t("WebSocket is not connected")});function xm(A){const e=`onSocket${k(A)}`;return FI(e,()=>{Gm[A]=e})}const Pm=xm("open"),Ym=xm("error"),Jm=xm("message"),Hm=xm("close"),qm=YI("getLocation",({type:A,altitude:e,highAccuracyExpireTime:t,isHighAccuracy:i},{resolve:o,reject:n})=>{const r=Np();new Promise((A,o)=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>A({coords:e.coords}),o,{enableHighAccuracy:i||e,timeout:t||1e5}):o(new Error("device nonsupport geolocation"))}).catch(A=>new Promise((e,t)=>{r.type===Tp.QQ?yp(`https://apis.map.qq.com/ws/location/v1/ip?output=jsonp&key=${r.key}`,{callback:"callback"},A=>{if("result"in A&&A.result.location){const t=A.result.location;e({coords:{latitude:t.lat,longitude:t.lng},skip:!0})}else t(new Error(A.message||JSON.stringify(A)))},()=>t(new Error("network error"))):r.type===Tp.GOOGLE?Dm({method:"POST",url:`https://www.googleapis.com/geolocation/v1/geolocate?key=${r.key}`,success(A){const i=A.data;"location"in i?e({coords:{latitude:i.location.lat,longitude:i.location.lng,accuracy:i.accuracy},skip:!0}):t(new Error(i.error&&i.error.message||JSON.stringify(A)))},fail(){t(new Error("network error"))}}):r.type===Tp.AMAP?wp([],()=>{window.AMap.plugin("AMap.Geolocation",()=>{new window.AMap.Geolocation({enableHighAccuracy:!0,timeout:1e4}).getCurrentPosition((A,i)=>{"complete"===A?e({coords:{latitude:i.position.lat,longitude:i.position.lng,accuracy:i.accuracy},skip:!0}):t(new Error(i.message))})})}):t(A)})).then(({coords:e,skip:t})=>{Up(A,e,t).then(A=>{o({latitude:A.latitude,longitude:A.longitude,accuracy:A.accuracy,speed:A.altitude||0,altitude:A.altitude||0,verticalAccuracy:A.altitudeAccuracy||0,horizontalAccuracy:A.accuracy||0})}).catch(A=>{n(A.message)})}).catch(A=>{n(A.message||JSON.stringify(A))})},0,PE);const Vm=Ul({name:"LocationView",props:{latitude:{type:Number},longitude:{type:Number},scale:{type:Number,default:18},name:{type:String,default:""},address:{type:String,default:""}},emits:["close"],setup(A,{emit:e}){const t=function(A){const e=Nt({center:{latitude:0,longitude:0},marker:{id:1,latitude:0,longitude:0,iconPath:_p,width:32,height:52},location:{id:2,latitude:0,longitude:0,iconPath:Rp,width:44,height:44}});function t(){A.latitude&&A.longitude&&(e.center.latitude=A.latitude,e.center.longitude=A.longitude,e.marker.latitude=A.latitude,e.marker.longitude=A.longitude)}return Xi([()=>A.latitude,()=>A.longitude],t),t(),e}(A);function i(A){const e=A.detail.centerLocation;e&&(t.center.latitude=e.latitude,t.center.longitude=e.longitude)}function o(){const e=Np();let i="";if(e.type===Tp.GOOGLE){i=`https://www.google.com/maps/dir/?api=1${t.location.latitude?`&origin=${t.location.latitude}%2C${t.location.longitude}`:""}&destination=${A.latitude}%2C${A.longitude}`}else if(e.type===Tp.QQ){i=`https://apis.map.qq.com/uri/v1/routeplan?type=drive${t.location.latitude?`&fromcoord=${t.location.latitude}%2C${t.location.longitude}&from=${encodeURIComponent("我的位置")}`:""}&tocoord=${A.latitude}%2C${A.longitude}&to=${encodeURIComponent(A.name||"目的地")}&ref=${e.key}`}else if(e.type===Tp.AMAP){i=`https://uri.amap.com/navigation?${t.location.latitude?`from=${t.location.longitude},${t.location.latitude},${encodeURIComponent("我的位置")}&`:""}to=${A.longitude},${A.latitude},${encodeURIComponent(A.name||"目的地")}`}window.open(i)}function n(){e("close")}function r({latitude:A,longitude:e}){t.center.latitude=A,t.center.longitude=e}return um(),qm({type:"gcj02",success:({latitude:A,longitude:e})=>{t.location.latitude=A,t.location.longitude=e}}),()=>Ir("div",{class:"uni-system-open-location"},[Ir(Fv,{latitude:t.center.latitude,longitude:t.center.longitude,class:"map",markers:[t.marker,t.location],onRegionchange:i},{default:()=>[Ir("div",{class:"map-move",onClick:()=>r(t.location)},[jc(Mp,"#000000",24)],8,["onClick"])]},8,["latitude","longitude","markers","onRegionchange"]),Ir("div",{class:"info"},[Ir("div",{class:"name",onClick:()=>r(t.marker)},[A.name],8,["onClick"]),Ir("div",{class:"address",onClick:()=>r(t.marker)},[A.address],8,["onClick"]),Ir("div",{class:"nav",onClick:o},[jc("M28 17c-6.49396875 0-12.13721875 2.57040625-15 6.34840625V5.4105l6.29859375 6.29859375c0.387875 0.387875 1.02259375 0.387875 1.4105 0 0.387875-0.387875 0.387875-1.02259375 0-1.4105L12.77853125 2.36803125a0.9978125 0.9978125 0 0 0-0.0694375-0.077125c-0.1944375-0.1944375-0.45090625-0.291375-0.70721875-0.290875l-0.00184375-0.0000625-0.00184375 0.0000625c-0.2563125-0.0005-0.51278125 0.09640625-0.70721875 0.290875a0.9978125 0.9978125 0 0 0-0.0694375 0.077125l-7.930625 7.9305625c-0.387875 0.387875-0.387875 1.02259375 0 1.4105 0.387875 0.387875 1.02259375 0.387875 1.4105 0L11 5.4105V29c0 0.55 0.45 1 1 1s1-0.45 1-1c0-5.52284375 6.71571875-10 15-10 0.55228125 0 1-0.44771875 1-1 0-0.55228125-0.44771875-1-1-1z","#ffffff",26)],8,["onClick"])]),Ir("div",{class:"nav-btn-back",onClick:n},[jc(Hc,"#ffffff",26)],8,["onClick"])])}});let jm=null;const Km=YI("openLocation",(A,{resolve:e})=>{jm?u(jm,A):(jm=Nt(A),pi(()=>{const A=sm(Vm,jm,()=>{jm=null,pi(()=>{A.unmount()})});A.mount(am("u-a-o"))})),e()},0,JE);const Wm=Ul({name:"LoctaionPicker",props:{latitude:{type:Number},longitude:{type:Number}},emits:["close"],setup(A,{emit:e}){um(),Ac();const{t:t}=Jg(),i=function(A){const e=Nt({latitude:0,longitude:0,keyword:"",searching:!1});function t(){A.latitude&&A.longitude&&(e.latitude=A.latitude,e.longitude=A.longitude)}return Xi([()=>A.latitude,()=>A.longitude],t),t(),e}(A),{list:o,listState:n,loadMore:r,reset:s,getList:a}=function(A){const e=__uniConfig.qqMapKey,t=Nt([]),i=Kt(-1),o=Ur(()=>t[i.value]),n=Nt({loading:!0,pageSize:20,pageIndex:1,hasNextPage:!0,nextPage:null,selectedIndex:i,selected:o}),r=Kt(""),s=Ur(()=>r.value?`region(${r.value},1,${A.latitude},${A.longitude})`:`nearby(${A.latitude},${A.longitude},5000)`);function a(A){A.forEach(A=>{t.push({name:A.title||A.name,address:A.address,distance:A._distance||A.distance,latitude:A.location.lat,longitude:A.location.lng})})}function g(){n.loading=!0;const i=Np();if(i.type===Tp.GOOGLE){if(n.pageIndex>1&&n.nextPage)return void n.nextPage();new google.maps.places.PlacesService(document.createElement("div"))[A.searching?"textSearch":"nearbySearch"]({location:{lat:A.latitude,lng:A.longitude},query:A.keyword,radius:5e3},(A,e,i)=>{n.loading=!1,A&&A.length&&A.forEach(A=>{t.push({name:A.name||"",address:A.vicinity||A.formatted_address||"",distance:0,latitude:A.geometry.location.lat(),longitude:A.geometry.location.lng()})}),i&&(i.hasNextPage?n.nextPage=()=>{i.nextPage()}:n.hasNextPage=!1)})}else i.type===Tp.QQ?yp(A.searching?`https://apis.map.qq.com/ws/place/v1/search?output=jsonp&key=${e}&boundary=${s.value}&keyword=${A.keyword}&page_size=${n.pageSize}&page_index=${n.pageIndex}`:`https://apis.map.qq.com/ws/geocoder/v1/?output=jsonp&key=${e}&location=${A.latitude},${A.longitude}&get_poi=1&poi_options=page_size=${n.pageSize};page_index=${n.pageIndex}`,{callback:"callback"},e=>{if(n.loading=!1,A.searching&&"data"in e&&e.data.length)a(e.data);else if("result"in e){const A=e.result;r.value=A.ad_info?A.ad_info.adcode:"",A.pois&&a(A.pois)}t.length===n.pageSize*n.pageIndex&&(n.hasNextPage=!1)},()=>{n.loading=!1}):i.type===Tp.AMAP&&window.AMap.plugin("AMap.PlaceSearch",function(){const e=new window.AMap.PlaceSearch({city:"全国",pageSize:10,pageIndex:n.pageIndex}),t=A.searching?A.keyword:"",i=A.searching?5e4:5e3;e.searchNearBy(t,[A.longitude,A.latitude],i,function(A,e){"error"===A?console.error(e):"no_data"===A?n.hasNextPage=!1:a(e.poiList.pois)}),n.loading=!1})}return{listState:n,list:t,loadMore:function(){!n.loading&&n.hasNextPage&&(n.pageIndex++,g())},reset:function(){n.selectedIndex=-1,n.pageIndex=1,n.hasNextPage=!0,n.nextPage=null,t.splice(0,t.length)},getList:g}}(i),g=ce(()=>{s(),i.keyword&&a()},1e3,{setTimeout:setTimeout,clearTimeout:clearTimeout});function c(A){i.keyword=A.detail.value,g()}function l(){e("close",u({},n.selected))}function I(){e("close")}function E(A){const e=A.detail.centerLocation;e&&h(e)}function d(){qm({type:"gcj02",success:h,fail:()=>{}})}function h({latitude:A,longitude:e}){i.latitude=A,i.longitude=e,i.searching||(s(),a())}return Xi(()=>i.searching,A=>{s(),A||a()}),i.latitude&&i.longitude||d(),()=>{const A=o.map((A,e)=>{return Ir("div",{key:e,class:{"list-item":!0,selected:n.selectedIndex===e},onClick:()=>{n.selectedIndex=e,i.latitude=A.latitude,i.longitude=A.longitude}},[jc(Vc,"#007aff",24),Ir("div",{class:"list-item-title"},[A.name]),Ir("div",{class:"list-item-detail"},[(t=A.distance,t>100?`${t>1e3?(t/1e3).toFixed(1)+"k":t.toFixed(0)}m | `:t>0?"<100m | ":""),A.address])],10,["onClick"]);var t});return n.loading&&A.unshift(Ir("div",{class:"list-loading"},[Ir("i",{class:"uni-loading"},null)])),Ir("div",{class:"uni-system-choose-location"},[Ir(Fv,{latitude:i.latitude,longitude:i.longitude,class:"map","show-location":!0,libraries:["places"],onUpdated:a,onRegionchange:E},{default:()=>[Ir("div",{class:"map-location",style:`background-image: url("${_p}")`},null),Ir("div",{class:"map-move",onClick:d},[jc(Mp,"#000000",24)],8,["onClick"])],_:1},8,["latitude","longitude","show-location","onUpdated","onRegionchange"]),Ir("div",{class:"nav"},[Ir("div",{class:"nav-btn back",onClick:I},[jc(qc,"#ffffff",26)],8,["onClick"]),Ir("div",{class:{"nav-btn":!0,confirm:!0,disable:!n.selected},onClick:l},[jc(Vc,"#ffffff",26)],10,["onClick"])]),Ir("div",{class:"menu"},[Ir("div",{class:"search"},[Ir(vB,{value:i.keyword,class:"search-input",placeholder:t("uni.chooseLocation.search"),onFocus:()=>i.searching=!0,onInput:c},null,8,["value","placeholder","onFocus","onInput"]),i.searching&&Ir("div",{class:"search-btn",onClick:()=>{i.searching=!1,i.keyword=""}},[t("uni.chooseLocation.cancel")],8,["onClick"])]),Ir(hQ,{"scroll-y":!0,class:"list",onScrolltolower:r},(e=A,"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!rr(e)?A:{default:()=>[A],_:2}),8,["scroll-y","onScrolltolower"])])]);var e}}});let zm=null;const Zm=YI("chooseLocation",(A,{resolve:e,reject:t})=>{zm?t("cancel"):(zm=Nt(A),pi(()=>{const A=sm(Wm,zm,i=>{zm=null,pi(()=>{A.unmount()}),i?e(i):t("cancel")});A.mount(am("u-a-c"))}))});let Xm=!1,$m=0;const Ay=YI("startLocationUpdate",(A,{resolve:e,reject:t})=>{navigator.geolocation?($m=$m||navigator.geolocation.watchPosition(t=>{Xm=!0,Up(null==A?void 0:A.type,t.coords).then(A=>{Pv.invokeOnCallback(rd,A),e()}).catch(A=>{Pv.invokeOnCallback(sd,{errMsg:`onLocationChange:fail ${A.message}`})})},A=>{Xm||(t(A.message),Xm=!0),Pv.invokeOnCallback(sd,{errMsg:`onLocationChange:fail ${A.message}`})}),setTimeout(e,100)):t()},0,gd),ey=YI("stopLocationUpdate",(A,{resolve:e})=>{$m&&(navigator.geolocation.clearWatch($m),Xm=!1,$m=0),e()}),ty=FI(rd,()=>{}),iy=OI("offLocationChange",()=>{}),oy=FI(sd,()=>{}),ny=OI("offLocationChangeError",()=>{}),ry=YI("navigateBack",(A,{resolve:e,reject:t})=>{let i=!0;return!0===il(yA,{from:A.from||"navigateBack"})&&(i=!1),i?(np().$router.go(-A.delta),e()):t(yA)},0,pd),sy=YI(ld,({url:A,events:e,isAutomatedTesting:t},{resolve:i,reject:o})=>{if(_h.handledBeforeEntryPageRoutes)return uh({type:ld,url:A,events:e,isAutomatedTesting:t}).then(i).catch(o);Th.push({args:{type:ld,url:A,events:e,isAutomatedTesting:t},resolve:i,reject:o})},0,hd),ay=YI(dd,({url:A},{resolve:e,reject:t})=>{const i=gl(A.split("?")[0]);i?i.loader&&i.loader().then(()=>{e({url:A,errMsg:"preloadPage:ok"})}).catch(e=>{t(`${A} ${String(e)}`)}):t(`${A}}`)});function gy(A){__uniConfig.darkmode&&Pv.on(EA,A)}function cy(A){Pv.off(EA,A)}function ly(A){let e={};return __uniConfig.darkmode&&(e=fe(A,__uniConfig.themeConfig,$p())),__uniConfig.darkmode?e:A}function Iy(A,e){const t=Lt(A),i=t?Nt(ly(A)):ly(A);return __uniConfig.darkmode&&t&&Xi(A,A=>{const e=ly(A);for(const t in e)i[t]=e[t]}),e&&gy(e),i}const uy={light:{cancelColor:"#000000"},dark:{cancelColor:"rgb(170, 170, 170)"}},Ey=Co({props:{title:{type:String,default:""},content:{type:String,default:""},showCancel:{type:Boolean,default:!0},cancelText:{type:String,default:"Cancel"},cancelColor:{type:String,default:"#000000"},confirmText:{type:String,default:"OK"},confirmColor:{type:String,default:"#007aff"},visible:{type:Boolean},editable:{type:Boolean,default:!1},placeholderText:{type:String,default:""}},setup(A,{emit:e}){const t=Kt(""),i=()=>r.value=!1,o=()=>(i(),e("close","cancel")),n=()=>(i(),e("close","confirm",t.value)),r=gm(A,{onEsc:o,onEnter:()=>{!A.editable&&n()}}),s=function(A){const e=Kt(A.cancelColor),t=({theme:A})=>{((A,e)=>{e.value=uy[A].cancelColor})(A,e)};return zi(()=>{A.visible?(e.value=A.cancelColor,"#000"===A.cancelColor&&("dark"===$p()&&t({theme:"dark"}),gy(t))):cy(t)}),e}(A);return()=>{const{title:e,content:i,showCancel:a,confirmText:g,confirmColor:c,editable:l,placeholderText:I}=A;return t.value=i,Ir(jr,{name:"uni-fade"},{default:()=>[io(Ir("uni-modal",{onTouchmove:_c},[rm,Ir("div",{class:"uni-modal"},[e?Ir("div",{class:"uni-modal__hd"},[Ir("strong",{class:"uni-modal__title",textContent:e||""},null,8,["textContent"])]):null,l?Ir("textarea",{class:"uni-modal__textarea",rows:"1",placeholder:I,value:i,onInput:A=>t.value=A.target.value},null,40,["placeholder","value","onInput"]):Ir("div",{class:"uni-modal__bd",onTouchmovePassive:Tc,textContent:i},null,40,["onTouchmovePassive","textContent"]),Ir("div",{class:"uni-modal__ft"},[a&&Ir("div",{style:{color:s.value},class:"uni-modal__btn uni-modal__btn_default",onClick:o},[A.cancelText],12,["onClick"]),Ir("div",{style:{color:c},class:"uni-modal__btn uni-modal__btn_primary",onClick:n},[g],12,["onClick"])])])],40,["onTouchmove"]),[[ss,r.value]])]})}}});let dy;const hy=HA(()=>{Pv.on("onHidePopup",()=>dy.visible=!1)});let Cy;function By(A,e){const t="confirm"===A,i={confirm:t,cancel:"cancel"===A};t&&dy.editable&&(i.content=e),Cy&&Cy(i)}const Qy=YI("showModal",(A,{resolve:e})=>{hy(),Cy=e,dy?(u(dy,A),dy.visible=!0):(dy=Nt(A),pi(()=>(sm(Ey,dy,By).mount(am("u-a-m")),pi(()=>dy.visible=!0))))},0,Gd),py={title:{type:String,default:""},icon:{default:"success",validator:A=>-1!==kd.indexOf(A)},image:{type:String,default:""},duration:{type:Number,default:1500},mask:{type:Boolean,default:!1},visible:{type:Boolean}},fy="uni-toast__icon",yy={light:"#fff",dark:"rgba(255,255,255,0.9)"},Dy=A=>yy[A],vy=Co({name:"Toast",props:py,setup(A){jg(),Kg();const{Icon:e}=function(A){const e=Kt(Dy($p())),t=({theme:A})=>e.value=Dy(A);zi(()=>{A.visible?gy(t):cy(t)});const i=Ur(()=>{switch(A.icon){case"success":return Ir(jc(Yc,e.value,38),{class:fy});case"error":return Ir(jc(Jc,e.value,38),{class:fy});case"loading":return Ir("i",{class:[fy,"uni-loading"]},null,2);default:return null}});return{Icon:i}}(A),t=gm(A,{});return()=>{const{mask:i,duration:o,title:n,image:r}=A;return Ir(jr,{name:"uni-fade"},{default:()=>[io(Ir("uni-toast",{"data-duration":o},[i?Ir("div",{class:"uni-mask",style:"background: transparent;",onTouchmove:_c},null,40,["onTouchmove"]):"",r||e.value?Ir("div",{class:"uni-toast"},[r?Ir("img",{src:r,class:fy},null,10,["src"]):e.value,Ir("p",{class:"uni-toast__content"},[n])]):Ir("div",{class:"uni-sample-toast"},[Ir("p",{class:"uni-simple-toast__text"},[n])])],8,["data-duration"]),[[ss,t.value]])]})}}});let wy,Sy,My="";const Ry=ve();function _y(A){wy?u(wy,A):(wy=Nt(u(A,{visible:!1})),pi(()=>{Ry.run(()=>{Xi([()=>wy.visible,()=>wy.duration],([A,e])=>{if(A){if(Sy&&clearTimeout(Sy),"onShowLoading"===My)return;Sy=setTimeout(()=>{Ly("onHideToast")},e)}else Sy&&clearTimeout(Sy)})}),Pv.on("onHidePopup",()=>Ly("onHidePopup")),sm(vy,wy,()=>{}).mount(am("u-a-t"))})),setTimeout(()=>{wy.visible=!0},10)}const Ty=YI("showToast",(A,{resolve:e,reject:t})=>{_y(A),My="onShowToast",e()},0,Ld),Ny={icon:"loading",duration:1e8,image:""},by=YI("showLoading",(A,{resolve:e,reject:t})=>{u(A,Ny),_y(A),My="onShowLoading",e()},0,bd),Gy=YI("hideToast",(A,{resolve:e,reject:t})=>{Ly("onHideToast"),e()}),ky=YI("hideLoading",(A,{resolve:e,reject:t})=>{Ly("onHideLoading"),e()});function Ly(A){const{t:e}=Jg();if(!My)return;let t="";if("onHideToast"===A&&"onShowToast"!==My?t=e("uni.showToast.unpaired"):"onHideLoading"===A&&"onShowLoading"!==My&&(t=e("uni.showLoading.unpaired")),t)return console.warn(t);My="",setTimeout(()=>{wy.visible=!1},10)}const Uy={light:{listItemColor:"#000000",cancelItemColor:"#000000"},dark:{listItemColor:"rgba(255, 255, 255, 0.8)",cancelItemColor:"rgba(255, 255, 255)"}};const Fy=Co({name:"ActionSheet",props:{title:{type:String,default:""},itemList:{type:Array,default:()=>[]},itemColor:{type:String,default:"#000000"},popover:{type:Object,default:null},visible:{type:Boolean,default:!1}},emits:["close"],setup(A,{emit:e}){Vg();const t=Kt(260),i=Kt(0),o=Kt(0),n=Kt(0),r=Kt(0),s=Kt(null),a=Kt(null),{t:g}=Jg(),{_close:c}=function(A,e){function t(A){e("close",A)}const{key:i,disable:o}=nm();return Xi(()=>A.visible,A=>o.value=!A),zi(()=>{const{value:A}=i;"esc"===A&&t&&t(-1)}),{_close:t}}(A,e),{popupStyle:l}=function(A){const e=Kt(0),t=Kt(0),i=Ur(()=>e.value>=500&&t.value>=500),o=Ur(()=>{const e={content:{transform:"",left:"",top:"",bottom:""},triangle:{left:"",top:"",bottom:"","border-width":"","border-color":""}},o=e.content,n=e.triangle,r=A.popover;function s(A){return Number(A)||0}if(i.value&&r){u(n,{position:"absolute",width:"0",height:"0","margin-left":"-6px","border-style":"solid"});const A=s(r.left),e=s(r.width?r.width:300),i=s(r.top),a=s(r.height),g=A+e/2;o.transform="none !important";const c=Math.max(0,g-e/2);o.left=`${c}px`,r.width&&(o.width=`${e}px`);let l=Math.max(12,g-c);l=Math.min(e-12,l),n.left=`${l}px`;const I=t.value/2;i+a-I>I-i?(o.top="auto",o.bottom=t.value-i+6+"px",n.bottom="-6px",n["border-width"]="6px 6px 0 6px",n["border-color"]="#fcfcfd transparent transparent transparent"):(o.top=`${i+a+6}px`,n.top="-6px",n["border-width"]="0 6px 6px 6px",n["border-color"]="transparent transparent #fcfcfd transparent")}return e});return Uo(()=>{const A=()=>{const{windowWidth:A,windowHeight:i,windowTop:o}=uni.getSystemInfoSync();e.value=A,t.value=i+(o||0)};window.addEventListener("resize",A),A(),Po(()=>{window.removeEventListener("resize",A)})}),{isDesktop:i,popupStyle:o}}(A);let I;function E(A){const e=n.value+A.deltaY;Math.abs(e)>10?(r.value+=e/3,r.value=r.value>=i.value?i.value:r.value<=0?0:r.value,I.scrollTo(r.value)):n.value=e,A.preventDefault()}Uo(()=>{const{scroller:A,handleTouchStart:e,handleTouchMove:t,handleTouchEnd:i}=function(A,e){const t={trackingID:-1,maxDy:0,maxDx:0},i=new eQ(A,e);function o(A){const e=A,i=A;return"move"===e.detail.state||"end"===e.detail.state?{x:e.detail.dx,y:e.detail.dy}:{x:i.screenX-t.x,y:i.screenY-t.y}}return{scroller:i,handleTouchStart:function(A){const e=A,o=A;"start"===e.detail.state?(t.trackingID="touch",t.x=e.detail.x,t.y=e.detail.y):(t.trackingID="mouse",t.x=o.screenX,t.y=o.screenY),t.maxDx=0,t.maxDy=0,t.historyX=[0],t.historyY=[0],t.historyTime=[e.detail.timeStamp||o.timeStamp],t.listener=i,i.onTouchStart&&i.onTouchStart(),("boolean"!=typeof A.cancelable||A.cancelable)&&A.preventDefault()},handleTouchMove:function(A){const e=A,i=A;if(-1!==t.trackingID){("boolean"!=typeof A.cancelable||A.cancelable)&&A.preventDefault();const n=o(A);if(n){for(t.maxDy=Math.max(t.maxDy,Math.abs(n.y)),t.maxDx=Math.max(t.maxDx,Math.abs(n.x)),t.historyX.push(n.x),t.historyY.push(n.y),t.historyTime.push(e.detail.timeStamp||i.timeStamp);t.historyTime.length>10;)t.historyTime.shift(),t.historyX.shift(),t.historyY.shift();t.listener&&t.listener.onTouchMove&&t.listener.onTouchMove(n.x,n.y)}}},handleTouchEnd:function(A){if(-1!==t.trackingID){A.preventDefault();const e=o(A);if(e){const A=t.listener;t.trackingID=-1,t.listener=null;const i={x:0,y:0};if(t.historyTime.length>2)for(let e=t.historyTime.length-1,o=t.historyTime[e],n=t.historyX[e],r=t.historyY[e];e>0;){e--;const A=o-t.historyTime[e];if(A>30&&A<50){i.x=(n-t.historyX[e])/(A/1e3),i.y=(r-t.historyY[e])/(A/1e3);break}}t.historyTime=[],t.historyX=[],t.historyY=[],A&&A.onTouchEnd&&A.onTouchEnd(e.x,e.y,i)}}}}}(s.value,{enableY:!0,friction:new zB(1e-4),spring:new $B(2,90,20),onScroll:A=>{r.value=A.target.scrollTop}});I=A,kB(s.value,o=>{if(A)switch(o.detail.state){case"start":e(o);break;case"move":t(o);break;case"end":case"cancel":i(o)}},!0)}),Xi(()=>A.visible,()=>{pi(()=>{A.title&&(o.value=document.querySelector(".uni-actionsheet__title").offsetHeight),I.update(),s.value&&(i.value=s.value.clientHeight-t.value),document.querySelectorAll(".uni-actionsheet__cell").forEach(A=>{!function(A){const e=20;let t=0,i=0;A.addEventListener("touchstart",A=>{const e=A.changedTouches[0];t=e.clientX,i=e.clientY}),A.addEventListener("touchend",A=>{const o=A.changedTouches[0];if(Math.abs(o.clientX-t) {i[A]=o[A]}),A.target.dispatchEvent(i)}})}(A)})})});const d=function(A){const e=Nt({listItemColor:"#000",cancelItemColor:"#000"}),t=({theme:A})=>{!function(A,e){["listItemColor","cancelItemColor"].forEach(t=>{e[t]=Uy[A][t]})}(A,e)};return zi(()=>{A.visible?(e.listItemColor=e.cancelItemColor=A.itemColor,"#000"===A.itemColor&&(t({theme:$p()}),gy(t))):cy(t)}),e}(A);return()=>Ir("uni-actionsheet",{onTouchmove:_c},[Ir(jr,{name:"uni-fade"},{default:()=>[io(Ir("div",{class:"uni-mask uni-actionsheet__mask",onClick:()=>c(-1)},null,8,["onClick"]),[[ss,A.visible]])]}),Ir("div",{class:["uni-actionsheet",{"uni-actionsheet_toggle":A.visible}],style:l.value.content},[Ir("div",{ref:a,class:"uni-actionsheet__menu",onWheel:E},[A.title?Ir(Kn,null,[Ir("div",{class:"uni-actionsheet__cell",style:{height:`${o.value}px`}},null),Ir("div",{class:"uni-actionsheet__title"},[A.title])]):"",Ir("div",{style:{maxHeight:`${t.value}px`,overflow:"hidden"}},[Ir("div",{ref:s},[A.itemList.map((A,e)=>Ir("div",{key:e,style:{color:d.listItemColor},class:"uni-actionsheet__cell",onClick:()=>c(e)},[A],12,["onClick"]))],512)])],40,["onWheel"]),Ir("div",{class:"uni-actionsheet__action"},[Ir("div",{style:{color:d.cancelItemColor},class:"uni-actionsheet__cell",onClick:()=>c(-1)},[g("uni.showActionSheet.cancel")],12,["onClick"])]),Ir("div",{style:l.value.triangle},null,4)],6)],40,["onTouchmove"])}});let Oy,xy,Py;const Yy=HA(()=>{Pv.on("onHidePopup",()=>Py.visible=!1)});function Jy(A){-1===A?xy&&xy("cancel"):Oy&&Oy({tapIndex:A})}const Hy=YI("showActionSheet",(A,{resolve:e,reject:t})=>{Yy(),Oy=e,xy=t,Py?(u(Py,A),Py.visible=!0):(Py=Nt(A),pi(()=>(sm(Fy,Py,Jy).mount(am("u-s-a-s")),pi(()=>Py.visible=!0))))},0,Nd),qy=YI("loadFontFace",({family:A,source:e,desc:t},{resolve:i,reject:o})=>{(function(A,e,t){const i=document.fonts;if(i){const o=new FontFace(A,e,t);return o.load().then(()=>{i.add&&i.add(o)})}return new Promise(i=>{const o=document.createElement("style"),n=[];if(t){const{style:A,weight:e,stretch:i,unicodeRange:o,variant:r,featureSettings:s}=t;A&&n.push(`font-style:${A}`),e&&n.push(`font-weight:${e}`),i&&n.push(`font-stretch:${i}`),o&&n.push(`unicode-range:${o}`),r&&n.push(`font-variant:${r}`),s&&n.push(`font-feature-settings:${s}`)}o.innerText=`@font-face{font-family:"${A}";src:${e};${n.join(";")}}`,document.head.appendChild(o),i()})})(A,e=e.startsWith('url("')||e.startsWith("url('")?`url('${AC(e.substring(5,e.length-2))}')`:e.startsWith("url(")?`url('${AC(e.substring(4,e.length-1))}')`:AC(e),t).then(()=>{i()}).catch(A=>{o(`loadFontFace:fail ${A}`)})});function Vy(A){function e(){var e;e=A.navigationBar.titleText,document.title=e,Pv.emit("onNavigationBarChange",{titleText:e})}zi(e),wo(e)}function jy(A,e,t,i,o){if(!A)return o("page not found");const{navigationBar:n}=A;switch(e){case wd:const{frontColor:A,backgroundColor:e,animation:i}=t,{duration:o,timingFunc:r}=i;A&&(n.titleColor="#000000"===A?"#000000":"#ffffff"),e&&(n.backgroundColor=e),n.duration=o+"ms",n.timingFunc=r;break;case Rd:n.loading=!0;break;case _d:n.loading=!1;break;case Md:const{title:s}=t;n.titleText=s}i()}const Ky=YI(wd,(A,{resolve:e,reject:t})=>{jy(Zc(),wd,A,e,t)},0,Sd),Wy=YI(Rd,(A,{resolve:e,reject:t})=>{jy(Zc(),Rd,A||{},e,t)}),zy=YI(_d,(A,{resolve:e,reject:t})=>{jy(Zc(),_d,A||{},e,t)}),Zy=YI(Md,(A,{resolve:e,reject:t})=>{jy(Zc(),Md,A,e,t)}),Xy=YI("pageScrollTo",({scrollTop:A,selector:e,duration:t},{resolve:i})=>{!function(A,e){if(f(A)){const e=document.querySelector(A);if(e){const{top:t}=e.getBoundingClientRect();A=t+window.pageYOffset;const i=document.querySelector("uni-page-head");i&&(A-=i.offsetHeight)}}A<0&&(A=0);const t=document.documentElement,{clientHeight:i,scrollHeight:o}=t;if(A=Math.min(A,o-i),0===e)return void(t.scrollTop=document.body.scrollTop=A);if(window.scrollY===A)return;const n=e=>{if(e<=0)return void window.scrollTo(0,A);const t=A-window.scrollY;requestAnimationFrame(function(){window.scrollTo(0,window.scrollY+t/e*10),n(e-10)})};n(e)}(e||A||0,t),i()},0,Td),$y=YI(Ud,(A,{resolve:e})=>{Pv.invokeViewMethod(Ud,{},Xc()),e()}),AD=YI(Fd,(A,{resolve:e})=>{Pv.invokeViewMethod(Fd,{},Xc()),e()}),eD=["text","iconPath","iconfont","selectedIconPath","visible"],tD=["color","selectedColor","backgroundColor","borderStyle","borderColor","midButton"],iD=["badge","redDot"];function oD(A,e,t){e.forEach(function(e){h(t,e)&&(A[e]=t[e])})}function nD(A,e,t,i){var o;let n=!1;const r=Uh();if(r.length&&Rh(r[r.length-1]).meta.isTabBar&&(n=!0),!n)return i("not TabBar page");const{index:s}=e;if("number"==typeof s){const A=null==(o=null==__uniConfig?void 0:__uniConfig.tabBar)?void 0:o.list.length;if(!A||s>=A)return i("tabbar item not found")}const a=hh();switch(A){case Vd:a.shown=!0;break;case qd:a.shown=!1;break;case xd:const A=a.list[s],t=A.pagePath;oD(A,eD,e);const{pagePath:i}=e;if(i){const A=PA(i);A!==t&&function(A,e,t){const i=gl(PA(e));if(i){const{meta:A}=i;delete A.tabBarIndex,A.isQuit=A.isTabBar=!1}const o=gl(PA(t));if(o){const{meta:e}=o;e.tabBarIndex=A,e.isQuit=e.isTabBar=!0;const i=__uniConfig.tabBar;i&&i.list&&i.list[A]&&(i.list[A].pagePath=YA(t))}}(s,t,A)}break;case Yd:oD(a,tD,e);break;case zd:oD(a.list[s],iD,{badge:"",redDot:!0});break;case Ah:oD(a.list[s],iD,{badge:e.text,redDot:!0});break;case Kd:case Xd:oD(a.list[s],iD,{badge:"",redDot:!1})}t()}const rD=YI(xd,(A,{resolve:e,reject:t})=>{nD(xd,A,e,t)},0,Pd),sD=YI(Yd,(A,{resolve:e,reject:t})=>{nD(Yd,A,e,t)},0,Hd),aD=YI(qd,(A,{resolve:e,reject:t})=>{nD(qd,A||{},e,t)}),gD=YI(Vd,(A,{resolve:e,reject:t})=>{nD(Vd,A||{},e,t)}),cD=YI(Kd,(A,{resolve:e,reject:t})=>{nD(Kd,A,e,t)},0,Wd),lD=YI(zd,(A,{resolve:e,reject:t})=>{nD(zd,A,e,t)},0,Zd),ID=YI(Xd,(A,{resolve:e,reject:t})=>{nD(Xd,A,e,t)},0,$d),uD=YI(Ah,(A,{resolve:e,reject:t})=>{nD(Ah,A,e,t)},0,eh),ED=Ul({name:"TabBar",setup(){const A=Kt([]),e=hh(),t=Iy(e,()=>{const A=ly(e);t.backgroundColor=A.backgroundColor,t.borderStyle=A.borderStyle,t.color=A.color,t.selectedColor=A.selectedColor,t.blurEffect=A.blurEffect,t.midButton=A.midButton,A.list&&A.list.length&&A.list.forEach((A,e)=>{t.list[e].iconPath=A.iconPath,t.list[e].selectedIconPath=A.selectedIconPath})});!function(A,e){function t(){let t=[];t=A.list.filter(A=>!1!==A.visible),e.value=t}Kt(u({type:"midButton"},A.midButton)),zi(t)}(t,A),function(A){Xi(()=>A.shown,e=>{Lc({"--window-bottom":wh(e?parseInt(A.height):0)})})}(t);const i=function(A,e,t){return zi(()=>{const i=A.meta;if(i.isTabBar){const A=i.route,o=t.value.findIndex(e=>e.pagePath===A);e.selectedIndex=o}}),(e,t)=>()=>{const{pagePath:i,text:o}=e;let n=PA(i);n===__uniRoutes[0].alias&&(n="/"),A.path!==n?uni.switchTab({from:"tabBar",url:n,tabBarText:o}):il("onTabItemTap",{index:t,text:o,pagePath:i})}}(mg(),t,A),{style:o,borderStyle:n,placeholderStyle:r}=function(A){const e=Ur(()=>{let e=A.backgroundColor;const t=A.blurEffect;return e||fh&&t&&"none"!==t&&(e=BD[t]),{backgroundColor:e||dD,backdropFilter:"none"!==t?"blur(10px)":t}}),t=Ur(()=>{const{borderStyle:e,borderColor:t}=A;return t&&f(t)?{backgroundColor:t}:{backgroundColor:QD[e]||QD.black}}),i=Ur(()=>({height:A.height}));return{style:e,borderStyle:t,placeholderStyle:i}}(t);return Uo(()=>{t.iconfontSrc&&qy({family:"UniTabbarIconFont",source:`url("${t.iconfontSrc}")`})}),()=>{const e=function(A,e,t){const{selectedIndex:i,selectedColor:o,color:n}=A;return t.value.map((t,r)=>{const s=i===r;return function(A,e,t,i,o,n,r,s){return Ir("div",{key:r,class:"uni-tabbar__item",onClick:s(o,r)},[pD(A,e||"",t,i,o,n)],8,["onClick"])}(s?o:n,s&&t.selectedIconPath||t.iconPath||"",t.iconfont?s&&t.iconfont.selectedText||t.iconfont.text:void 0,t.iconfont?s&&t.iconfont.selectedColor||t.iconfont.color:void 0,t,A,r,e)})}(t,i,A);return Ir("uni-tabbar",{class:"uni-tabbar-"+t.position},[Ir("div",{class:"uni-tabbar",style:o.value},[Ir("div",{class:"uni-tabbar-border",style:n.value},null,4),e],4),Ir("div",{class:"uni-placeholder",style:r.value},null,4)],2)}}});const dD="#f7f7fa",hD="rgb(0, 0, 0, 0.8)",CD="rgb(250, 250, 250, 0.8)",BD={dark:hD,light:CD,extralight:CD},QD={white:"rgba(255, 255, 255, 0.33)",black:"rgba(0, 0, 0, 0.33)"};function pD(A,e,t,i,o,n){const{height:r}=n;return Ir("div",{class:"uni-tabbar__bd",style:{height:r}},[t?mD(t,i||hD,o,n):e&&fD(e,o,n),o.text&&yD(A,o,n),o.redDot&&DD(o.badge)],4)}function fD(A,e,t){const{type:i,text:o}=e,{iconWidth:n}=t;return Ir("div",{class:"uni-tabbar__icon"+(o?" uni-tabbar__icon__diff":""),style:{width:n,height:n}},["midButton"!==i&&Ir("img",{src:AC(A)},null,8,["src"])],6)}function mD(A,e,t,i){var o;const{type:n,text:r}=t,{iconWidth:s}=i,a="uni-tabbar__icon"+(r?" uni-tabbar__icon__diff":""),g={width:s,height:s},c={fontSize:(null==(o=t.iconfont)?void 0:o.fontSize)||s,color:e};return Ir("div",{class:a,style:g},["midButton"!==n&&Ir("div",{class:"uni-tabbar__iconfont",style:c},[A],4)],6)}function yD(A,e,t){const{iconPath:i,text:o}=e,{fontSize:n,spacing:r}=t;return Ir("div",{class:"uni-tabbar__label",style:{color:A,fontSize:n,lineHeight:i?"normal":1.8,marginTop:i?r:"inherit"}},[o],4)}function DD(A){return Ir("div",{class:"uni-tabbar__reddot"+(A?" uni-tabbar__badge":"")},[A],2)}const vD="0px";let wD;function SD(){return wD}const MD=Ul({name:"Layout",setup(A,{emit:e}){const t=Kt(null);kc({"--status-bar-height":vD,"--top-window-height":vD,"--window-left":vD,"--window-right":vD,"--window-margin":vD,"--tab-bar-height":vD});const i=function(){const A=mg();return{routeKey:Ur(()=>Yh("/"+A.meta.route,tI())),isTabBar:Ur(()=>A.meta.isTabBar),routeCache:Hh}}(),{layoutState:o,windowState:n}=function(){eI();{const A=Nt({marginWidth:0,leftWindowWidth:0,rightWindowWidth:0});return Xi(()=>A.marginWidth,A=>kc({"--window-margin":A+"px"})),Xi(()=>A.leftWindowWidth+A.marginWidth,A=>{kc({"--window-left":A+"px"})}),Xi(()=>A.rightWindowWidth+A.marginWidth,A=>{kc({"--window-right":A+"px"})}),{layoutState:A,windowState:Ur(()=>({}))}}}();!function(A,e){const t=eI();function i(){const i=document.body.clientWidth,o=Uh();let n={};if(o.length>0){n=Rh(o[o.length-1]).meta}else{const A=gl(t.path,!0);A&&(n=A.meta)}const r=parseInt(String((h(n,"maxWidth")?n.maxWidth:__uniConfig.globalStyle.maxWidth)||Number.MAX_SAFE_INTEGER));let s=!1;s=i>r,s&&r?(A.marginWidth=(i-r)/2,pi(()=>{const A=e.value;A&&A.setAttribute("style","max-width:"+r+"px;margin:0 auto;")})):(A.marginWidth=0,pi(()=>{const A=e.value;A&&A.removeAttribute("style")}))}Xi([()=>t.path],i),Uo(()=>{i(),window.addEventListener("resize",i)})}(o,t);const r=function(){const A=eI(),e=hh(),t=Ur(()=>A.meta.isTabBar&&e.shown);return kc({"--tab-bar-height":e.height}),t}(),s=function(A){const e=Kt(!1);return Ur(()=>({"uni-app--showtabbar":A&&A.value,"uni-app--maxwidth":e.value}))}(r);return wD=o,()=>{const A=function(A){const e=function({routeKey:A,isTabBar:e,routeCache:t}){return Ir(pg,null,{default:Ui(({Component:i})=>[(Ar(),nr(Do,{matchBy:"key",cache:t},[(Ar(),nr(qi(i),{type:e.value?"tabBar":"",key:A.value}))],1032,["cache"]))]),_:1})}(A);return e}(i),e=function(A){return io(Ir(ED,null,null,512),[[ss,A.value]])}(r);return Ir("uni-app",{ref:t,class:s.value},[A,e],2)}}});const RD=YI("showTopWindow",(A,{resolve:e,reject:t})=>{const i=SD();i?(i.apiShowTopWindow=!0,pi(e)):t()}),_D=YI("hideTopWindow",(A,{resolve:e,reject:t})=>{const i=SD();i?(i.apiShowTopWindow=!1,pi(e)):t()}),TD=YI("showLeftWindow",(A,{resolve:e,reject:t})=>{const i=SD();i?(i.apiShowLeftWindow=!0,pi(e)):t()}),ND=YI("hideLeftWindow",(A,{resolve:e,reject:t})=>{const i=SD();i?(i.apiShowLeftWindow=!1,pi(e)):t()}),bD=YI("showRightWindow",(A,{resolve:e,reject:t})=>{const i=SD();i?(i.apiShowRightWindow=!0,pi(e)):t()}),GD=YI("hideRightWindow",(A,{resolve:e,reject:t})=>{const i=SD();i?(i.apiShowRightWindow=!1,pi(e)):t()}),kD=PI(0,()=>{const A=SD();return u({},A&&A.topWindowStyle)}),LD=PI(0,A=>{const e=SD();e&&(e.topWindowStyle=A)}),UD=PI(0,()=>{const A=SD();return u({},A&&A.leftWindowStyle)}),FD=PI(0,A=>{const e=SD();e&&(e.leftWindowStyle=A)}),OD=PI(0,()=>{const A=SD();return u({},A&&A.rightWindowStyle)}),xD=PI(0,A=>{const e=SD();e&&(e.rightWindowStyle=A)}),PD=PI(0,A=>{const e=document.querySelector("uni-page-body");return e?e.querySelector(`#${A}`):null}),YD=PI(0,()=>Object.getPrototypeOf(window)!==Window.prototype?(console.error("getFacialRecognitionMetaInfo:fail window对象原型被篡改,可能存在劫持"),""):window.window!==window||window.self!==window?(console.error("getFacialRecognitionMetaInfo:fail window对象属性引用异常,可能被劫持"),""):"[object Window]"!==Object.prototype.toString.call(window)&&"[object DOMWindow]"!==Object.prototype.toString.call(window)?(console.error("getFacialRecognitionMetaInfo:fail window对象类型标识异常,可能被劫持"),""):p(window.getMetaInfo)?window.getMetaInfo():(console.error("getFacialRecognitionMetaInfo:fail window对象缺少getMetaInfo方法,请参考文档引用:https://doc.dcloud.net.cn/uniCloud/frv/dev.html#window-get-meta-info"),"")),JD=YI(ZE,VI(ZE)),HD="getRecorderManager",qD=PI(0,HI(HD)),VD=YI(XE,VI(XE)),jD="createCameraContext",KD=PI(0,HI(jD)),WD="createLivePlayerContext",zD=PI(0,HI(WD)),ZD="saveFile",XD=YI(ZD,VI(ZD)),$D="getSavedFileList",Av=YI($D,VI($D)),ev="getSavedFileInfo",tv=YI(ev,VI(ev)),iv="removeSavedFile",ov=YI(iv,VI(iv)),nv="onMemoryWarning",rv=FI(nv,qI(nv)),sv="onGyroscopeChange",av=FI(sv,qI(sv)),gv="startGyroscope",cv=YI(gv,VI(gv)),lv="stopGyroscope",Iv=YI(lv,VI(lv)),uv="scanCode",Ev=YI(uv,VI(uv)),dv="setScreenBrightness",hv=YI(dv,VI(dv)),Cv="getScreenBrightness",Bv=YI(Cv,VI(Cv)),Qv="setKeepScreenOn",pv=YI(Qv,VI(Qv)),fv="onUserCaptureScreen",mv=FI(fv,qI(fv)),yv="addPhoneContact",Dv=YI(yv,VI(yv)),vv="login",wv=YI(vv,VI(vv)),Sv="getProvider",Mv=YI(Sv,VI(Sv)),Rv=Object.defineProperty({__proto__:null,$emit:Iu,$off:lu,$on:gu,$once:cu,__f__:function(A,e,...t){e&&t.push(e),console[A].apply(console,t)},addInterceptor:ru,addPhoneContact:Dv,arrayBufferToBase64:KI,base64ToArrayBuffer:jI,canIUse:yh,canvasGetImageData:Ou,canvasPutImageData:xu,canvasToTempFilePath:Pu,chooseFile:Am,chooseImage:tm,chooseLocation:Zm,chooseVideo:ym,clearStorage:Jf,clearStorageSync:Yf,closePreviewImage:fm,closeSocket:Om,connectSocket:Lm,createAnimation:cE,createCameraContext:KD,createCanvasContext:Fu,createInnerAudioContext:jp,createIntersectionObserver:Wu,createLivePlayerContext:zD,createMapContext:Bu,createMediaQueryObserver:Xu,createSelectorQuery:nE,createVideoContext:du,cssBackdropFilter:fh,cssConstant:ph,cssEnv:Qh,cssVar:Bh,downloadFile:_m,getAppBaseInfo:sf,getClipboardData:_f,getDeviceInfo:rf,getElementById:PD,getEnterOptionsSync:DE,getFacialRecognitionMetaInfo:YD,getFileInfo:Vf,getImageInfo:Wf,getLaunchOptionsSync:vE,getLeftWindowStyle:UD,getLocale:dE,getLocation:qm,getNetworkType:df,getProvider:Mv,getPushClientId:NE,getRecorderManager:qD,getRightWindowStyle:OD,getSavedFileInfo:tv,getSavedFileList:Av,getScreenBrightness:Bv,getSelectedTextRange:pE,getStorage:Of,getStorageInfo:qf,getStorageInfoSync:Hf,getStorageSync:Ff,getSystemInfo:gf,getSystemInfoSync:af,getTabBarPageId:sh,getTopWindowStyle:kD,getVideoInfo:zf,getWindowInfo:ef,hideActionSheet:()=>{Py&&(Py.visible=!1)},hideKeyboard:Kf,hideLeftWindow:ND,hideLoading:ky,hideModal:()=>{dy&&(dy.visible=!1)},hideNavigationBarLoading:zy,hideRightWindow:GD,hideTabBar:aD,hideTabBarRedDot:cD,hideToast:Gy,hideTopWindow:_D,interceptors:{},invokePushCallback:function(A){if("enabled"===A.type)ME=!0;else if("clientId"===A.type)wE=A.cid,SE=A.errMsg,TE(wE,A.errMsg);else if("pushMsg"===A.type){const e={type:"receive",data:RE(A.message)};for(let A=0;A {e({type:"click",data:RE(A.message)})})},loadFontFace:qy,login:wv,makePhoneCall:Kp,navigateBack:ry,navigateTo:sy,offAccelerometerChange:Bf,offAppHide:function(A){yE(lA,A)},offAppShow:function(A){yE(cA,A)},offCompassChange:yf,offError:function(A){yE(uA,A)},offLocationChange:iy,offLocationChangeError:ny,offNetworkStatusChange:Ef,offPageNotFound:function(A){yE(dA,A)},offPushMessage:A=>{if(A){const e=bE.indexOf(A);e>-1&&bE.splice(e,1)}else bE.length=0},offThemeChange:Gf,offUnhandledRejection:function(A){yE(hA,A)},offWindowResize:uE,onAccelerometerChange:Cf,onAppHide:function(A){mE(lA,A)},onAppShow:function(A){mE(cA,A)},onCompassChange:mf,onCreateVueApp:function(A){if(Ee)return A(Ee);de.push(A)},onError:function(A){mE(uA,A)},onGyroscopeChange:av,onLocaleChange:hE,onLocationChange:ty,onLocationChangeError:oy,onMemoryWarning:rv,onNetworkStatusChange:uf,onPageNotFound:function(A){mE(dA,A)},onPushMessage:A=>{-1===bE.indexOf(A)&&bE.push(A)},onSocketClose:Hm,onSocketError:Ym,onSocketMessage:Jm,onSocketOpen:Pm,onTabBarMidButtonTap:lE,onThemeChange:bf,onUnhandledRejection:function(A){mE(hA,A)},onUserCaptureScreen:mv,onWindowResize:IE,openDocument:jf,openLocation:Km,pageScrollTo:Xy,preloadPage:ay,previewImage:pm,reLaunch:Ih,redirectTo:ch,removeAllPages:lh,removeInterceptor:su,removeLastPage:gh,removeNonTabBarPages:nh,removeSavedFile:ov,removeStorage:Pf,removeStorageSync:xf,removeTabBarBadge:ID,request:Dm,rpx2px:iu,saveFile:XD,saveImageToPhotosAlbum:JD,saveVideoToPhotosAlbum:VD,scanCode:Ev,sendSocketMessage:Fm,setClipboardData:Tf,setKeepScreenOn:pv,setLeftWindowStyle:FD,setLocale:CE,setNavigationBarColor:Ky,setNavigationBarTitle:Zy,setPageMeta:BE,setRightWindowStyle:xD,setScreenBrightness:hv,setStorage:Lf,setStorageSync:kf,setTabBarBadge:uD,setTabBarItem:rD,setTabBarStyle:sD,setTopWindowStyle:LD,showActionSheet:Hy,showLeftWindow:TD,showLoading:by,showModal:Qy,showNavigationBarLoading:Wy,showRightWindow:bD,showTabBar:gD,showTabBarRedDot:lD,showToast:Ty,showTopWindow:RD,startAccelerometer:Qf,startCompass:Df,startGyroscope:cv,startLocationUpdate:Ay,startPullDownRefresh:$y,stopAccelerometer:pf,stopCompass:vf,stopGyroscope:Iv,stopLocationUpdate:ey,stopPullDownRefresh:AD,switchTab:ah,uploadFile:Nm,upx2px:iu,vibrateLong:Mf,vibrateShort:Sf},Symbol.toStringTag,{value:"Module"}),_v="MAP_LOCATION",Tv=Ul({name:"MapLocation",setup(){const A=Nt({latitude:0,longitude:0,rotate:0});{let e=function(e){A.rotate=e.direction},t=function(){qm({type:"gcj02",success:e=>{A.latitude=e.latitude,A.longitude=e.longitude},complete:()=>{n=setTimeout(t,3e4)}})},i=function(){n&&clearTimeout(n),yf(e)};const o=pn("onMapReady");let n;mf(e),o(t),Po(i);const r=pn("addMapChidlContext"),s=pn("removeMapChidlContext"),a={id:_v,state:A};r(a),Po(()=>s(a))}return()=>A.latitude?Ir(Fp,Qr({anchor:{x:.5,y:.5},width:"44",height:"44",iconPath:Rp},A),null,16,["iconPath"]):null}}),Nv=Ul({name:"MapPolygon",props:{dashArray:{type:Array,default:()=>[0,0]},points:{type:Array,required:!0},strokeWidth:{type:Number,default:1},strokeColor:{type:String,default:"#000000"},fillColor:{type:String,default:"#00000000"},zIndex:{type:Number,default:0}},setup(A){let e;return pn("onMapReady")((t,i,o)=>{function n(){const{points:o,strokeWidth:n,strokeColor:r,dashArray:s,fillColor:a,zIndex:g}=A,c=o.map(A=>{const{latitude:e,longitude:t}=A;return kp()?[t,e]:Lp()?new i.Point(t,e):new i.LatLng(e,t)}),{r:l,g:I,b:u,a:E}=Op(a),{r:d,g:h,b:C,a:B}=Op(r),Q={clickable:!0,cursor:"crosshair",editable:!1,map:t,fillColor:"",path:c,strokeColor:"",strokeDashStyle:s.some(A=>A>0)?"dash":"solid",strokeWeight:n,visible:!0,zIndex:g};i.Color?(Q.fillColor=new i.Color(l,I,u,E),Q.strokeColor=new i.Color(d,h,C,B)):(Q.fillColor=`rgb(${l}, ${I}, ${u})`,Q.fillOpacity=E,Q.strokeColor=`rgb(${d}, ${h}, ${C})`,Q.strokeOpacity=B),e?e.setOptions(Q):Lp()?(e=new i.Polygon(Q.path,Q),t.addOverlay(e)):e=new i.Polygon(Q)}n(),Xi(A,n)}),Po(()=>{e.setMap(null)}),()=>null}});function bv(A){const e=[];return C(A)&&A.forEach(A=>{A&&A.latitude&&A.longitude&&e.push({latitude:A.latitude,longitude:A.longitude})}),e}function Gv(A,e,t){return Lp()?function(A,e,t){return new A.Point(t,e)}(A,e,t):kp()?function(A,e,t){return new A.LngLat(t,e)}(A,e,t):function(A,e,t){return new A.LatLng(e,t)}(A,e,t)}function kv(A){return"getLat"in A?A.getLat():Lp()?A.lat:A.lat()}function Lv(A){return"getLng"in A?A.getLng():Lp()?A.lng:A.lng()}function Uv(A,e,t){const i=Ol(e,t),o=Kt(null);let n,r;const s=Nt({latitude:Number(A.latitude),longitude:Number(A.longitude),includePoints:bv(A.includePoints)}),a=[];let g,c;function l(A){g?A(r,n,i):a.push(A)}const I=[];function E(A){c?A():a.push(A)}const d={};function h(){c=!0,I.forEach(A=>A()),I.length=0}function C(){const A=r.getCenter();return{scale:r.getZoom(),centerLocation:{latitude:kv(A),longitude:Lv(A)}}}function B(){if(kp()){const A=[];s.includePoints.forEach(e=>{A.push([e.longitude,e.latitude])});const e=new n.Bounds(...A);r.setBounds(e)}else if(Lp());else{const A=new n.LatLngBounds;s.includePoints.forEach(({latitude:e,longitude:t})=>{const i=new n.LatLng(e,t);A.extend(i)}),r.fitBounds(A)}}function Q(){const e=o.value,a=Gv(n,s.latitude,s.longitude),g=n.event||n.Event,c=new n.Map(e,{center:a,zoom:Number(A.scale),disableDoubleClickZoom:!0,mapTypeControl:!1,zoomControl:!1,scaleControl:!1,panControl:!1,fullscreenControl:!1,streetViewControl:!1,keyboardShortcuts:!1,minZoom:5,maxZoom:18,draggable:!0});if(Lp()&&(c.centerAndZoom(a,Number(A.scale)),c.enableScrollWheelZoom(),c._printLog&&c._printLog("uniapp")),Xi(()=>A.scale,A=>{c.setZoom(Number(A)||16)}),E(()=>{s.includePoints.length&&(B(),function(){const A=Gv(n,s.latitude,s.longitude);r.setCenter(A)}())}),Lp())c.addEventListener("click",()=>{i("tap",{},{}),i("click",{},{})}),c.addEventListener("dragstart",()=>{i("regionchange",{},{type:"begin",causedBy:"gesture"})}),c.addEventListener("dragend",()=>{i("regionchange",{},u({type:"end",causedBy:"drag"},C()))});else{const A=g.addListener(c,"bounds_changed",()=>{A.remove(),h()});g.addListener(c,"complete",()=>{h()}),g.addListener(c,"click",()=>{i("tap",{},{}),i("click",{},{})}),g.addListener(c,"dragstart",()=>{i("regionchange",{},{type:"begin",causedBy:"gesture"})}),g.addListener(c,"dragend",()=>{i("regionchange",{},u({type:"end",causedBy:"drag"},C()))});const e=()=>{t("update:scale",c.getZoom()),i("regionchange",{},u({type:"end",causedBy:"scale"},C()))};g.addListener(c,"zoom_changed",e),g.addListener(c,"zoomend",e),g.addListener(c,"center_changed",()=>{const A=c.getCenter(),e=kv(A),i=Lv(A);t("update:latitude",e),t("update:longitude",i)})}return c}Xi([()=>A.latitude,()=>A.longitude],([A,e])=>{const t=Number(A),i=Number(e);if((t!==s.latitude||i!==s.longitude)&&(s.latitude=t,s.longitude=i,r)){const A=Gv(n,s.latitude,s.longitude);r.setCenter(A)}}),Xi(()=>A.includePoints,A=>{s.includePoints=bv(A),c&&B()},{deep:!0});try{LQ((A,e={})=>{switch(A){case"getCenterLocation":l(()=>{const t=r.getCenter();qA(e,{latitude:kv(t),longitude:Lv(t),errMsg:`${A}:ok`})});break;case"moveToLocation":{let t=Number(e.latitude),i=Number(e.longitude);if(!t||!i){const A=d[_v];A&&(t=A.state.latitude,i=A.state.longitude)}if(t&&i){if(s.latitude=t,s.longitude=i,r){const A=Gv(n,t,i);r.setCenter(A)}l(()=>{qA(e,`${A}:ok`)})}else qA(e,`${A}:fail`)}break;case"translateMarker":l(()=>{const t=d[e.markerId];if(t){try{t.translate(e)}catch(i){qA(e,`${A}:fail ${i.message}`)}qA(e,`${A}:ok`)}else qA(e,`${A}:fail not found`)});break;case"includePoints":s.includePoints=bv(e.includePoints),(c||kp())&&B(),E(()=>{qA(e,`${A}:ok`)});break;case"getRegion":E(()=>{const t=r.getBounds(),i=t.getSouthWest(),o=t.getNorthEast();qA(e,{southwest:{latitude:kv(i),longitude:Lv(i)},northeast:{latitude:kv(o),longitude:Lv(o)},errMsg:`${A}:ok`})});break;case"getScale":l(()=>{qA(e,{scale:r.getZoom(),errMsg:`${A}:ok`})})}},FQ(),!0)}catch(p){}return Uo(()=>{wp(A.libraries,A=>{n=A,r=Q(),g=!0,a.forEach(A=>A(r,n,i)),a.length=0,i("updated",{},{})})}),Qn("onMapReady",l),Qn("addMapChidlContext",function(A){d[A.id]=A}),Qn("removeMapChidlContext",function(A){delete d[A.id]}),{state:s,mapRef:o,trigger:i}}const Fv=Ll({name:"Map",props:{id:{type:String,default:""},latitude:{type:[String,Number],default:0},longitude:{type:[String,Number],default:0},scale:{type:[String,Number],default:16},markers:{type:Array,default:()=>[]},includePoints:{type:Array,default:()=>[]},polyline:{type:Array,default:()=>[]},circles:{type:Array,default:()=>[]},controls:{type:Array,default:()=>[]},showLocation:{type:[Boolean,String],default:!1},libraries:{type:Array,default:()=>[]},polygons:{type:Array,default:()=>[]}},emits:["markertap","labeltap","callouttap","controltap","regionchange","tap","click","updated","update:scale","update:latitude","update:longitude"],setup(A,{emit:e,slots:t}){const i=Kt(null),{mapRef:o,trigger:n}=Uv(A,i,e);return()=>Ir("uni-map",{ref:i,id:A.id},[Ir("div",{ref:o,style:"width: 100%; height: 100%; position: relative; overflow: hidden"},null,512),A.markers.map(A=>Ir(Fp,Qr({key:A.id},A),null,16)),A.polyline.map(A=>Ir(Pp,A,null,16)),A.circles.map(A=>Ir(Yp,A,null,16)),A.controls.map(A=>Ir(Hp,Qr(A,{trigger:n}),null,16,["trigger"])),A.showLocation&&Ir(Tv,null,null),A.polygons.map(A=>Ir(Nv,A,null,16)),Ir("div",{style:"position: absolute;top: 0;width: 100%;height: 100%;overflow: hidden;pointer-events: none;"},[t.default&&t.default()])],8,["id"])}}),Ov=u(gc,{publishHandler(A,e,t){Pv.subscribeHandler(A,e,t)}}),xv=Rv,Pv=u(yl,{publishHandler(A,e,t){Ov.subscribeHandler(A,e,t)}}),Yv=Ul({name:"PageHead",setup(){const A=Kt(null),e=$l(),t=Iy(e.navigationBar,()=>{const A=ly(e.navigationBar);t.backgroundColor=A.backgroundColor,t.titleColor=A.titleColor}),{clazz:i,style:o}=function(A){const e=Ur(()=>{const{type:e,titlePenetrate:t,shadowColorType:i}=A,o={"uni-page-head":!0,"uni-page-head-transparent":"transparent"===e,"uni-page-head-titlePenetrate":"YES"===t,"uni-page-head-shadow":!!i};return i&&(o[`uni-page-head-shadow-${i}`]=!0),o}),t=Ur(()=>({backgroundColor:A.backgroundColor,color:A.titleColor,transitionDuration:A.duration,transitionTimingFunction:A.timingFunc}));return{clazz:e,style:t}}(t);return()=>{const n=function(A,e){if(!e)return Ir("div",{class:"uni-page-head-btn",onClick:Hv},[jc(Hc,"transparent"===A.type?"#fff":A.titleColor,26)],8,["onClick"])}(t,e.isQuit),r=t.type||"default",s="transparent"!==r&&"float"!==r&&Ir("div",{class:{"uni-placeholder":!0,"uni-placeholder-titlePenetrate":t.titlePenetrate}},null,2);return Ir("uni-page-head",{"uni-page-head-type":r},[Ir("div",{ref:A,class:i.value,style:o.value},[Ir("div",{class:"uni-page-head-hd"},[n]),Jv(t),Ir("div",{class:"uni-page-head-ft"},[])],6),s],8,["uni-page-head-type"])}}});function Jv(A,e){return function({type:A,loading:e,titleSize:t,titleText:i,titleImage:o}){return Ir("div",{class:"uni-page-head-bd"},[Ir("div",{style:{fontSize:t,opacity:"transparent"===A?0:1},class:"uni-page-head__title"},[e?Ir("i",{class:"uni-loading"},null):o?Ir("img",{src:o,class:"uni-page-head__title_image"},null,8,["src"]):i],4)])}(A)}function Hv(){1===Lh().length?uni.reLaunch({url:"/"}):uni.navigateBack({from:"backbutton",success(){}})}const qv=Ul({name:"PageBody",setup(A,e){const t=!1,i=Kt(null),o=Kt(null);return Xi(()=>t.enablePullDownRefresh,()=>{o.value=null},{immediate:!0}),()=>Ir(Kn,null,[!1,Ir("uni-page-wrapper",Qr({ref:i},o.value),[Ir("uni-page-body",null,[jo(e.slots,"default")]),null],16)])}}),Vv=Ul({name:"Page",setup(A,e){let t=AI(tI());const i=t.navigationBar,o={};return Vy(t),()=>Ir("uni-page",{"data-page":t.route,style:o},"custom"!==i.style?[Ir(Yv),jv(e),null]:[jv(e),null])}});function jv(A){return Ar(),nr(qv,{key:0},{default:Ui(()=>[jo(A.slots,"page")]),_:3})}const Kv={loading:"AsyncLoading",error:"AsyncError",delay:200,timeout:6e4,suspensible:!0};window.getApp=np,window.getCurrentPages=Lh,window.wx=xv,window.uni=xv,window.UniViewJSBridge=Ov,window.UniServiceJSBridge=Pv,window.rpx2px=iu,window.__setupPage=A=>gp(A);const Wv=Object.assign({}),zv=Object.assign;window.__uniConfig=zv({globalStyle:{backgroundColor:"#F8F8F8",navigationBar:{backgroundColor:"#F8F8F8",titleText:"uni-app",type:"default",titleColor:"#000000"},isNVue:!1},uniIdRouter:{},tabBar:{position:"bottom",color:"#333333",selectedColor:"#00D993",borderStyle:"black",blurEffect:"none",fontSize:"10px",iconWidth:"24px",spacing:"3px",height:"50px",list:[{pagePath:"TUIKit/components/TUIConversation/index",iconPath:"/static/images/tabBar/news.png",selectedIconPath:"/static/images/tabBar/newsHL.png",text:"消息"},{pagePath:"TUIKit/components/TUIContact/index",iconPath:"/static/images/tabBar/contacts.png",selectedIconPath:"/static/images/tabBar/contactsHL.png",text:"通讯录"},{pagePath:"pages/discover/discover",iconPath:"/static/images/tabBar/discover.png",selectedIconPath:"/static/images/tabBar/discoverHL.png",text:"发现"},{pagePath:"pages/my-index/my-index",iconPath:"/static/images/tabBar/my.png",selectedIconPath:"/static/images/tabBar/myHL.png",text:"我的"}],backgroundColor:"#ffffff",selectedIndex:0,shown:!0},compilerVersion:"4.87"},{appId:"__UNI__9EFDC69",appName:"密谈IM",appVersion:"1.1.2",appVersionCode:111,async:Kv,debug:!1,networkTimeout:{request:6e4,connectSocket:6e4,uploadFile:6e4,downloadFile:6e4},sdkConfigs:{},qqMapKey:void 0,bMapKey:void 0,googleMapKey:void 0,aMapKey:void 0,aMapSecurityJsCode:void 0,aMapServiceHost:void 0,nvue:{"flex-direction":"column"},locale:"",fallbackLocale:"",locales:Object.keys(Wv).reduce((A,e)=>{const t=e.replace(/\.\/locale\/(uni-app.)?(.*).json/,"$2");return zv(A[t]||(A[t]={}),Wv[e].default),A},{}),router:{mode:"history",base:"/",assets:"assets",routerBase:"/"},darkmode:!1,themeConfig:{}}),window.__uniLayout=window.__uniLayout||{};const Zv={delay:Kv.delay,timeout:Kv.timeout,suspensible:Kv.suspensible};Kv.loading&&(Zv.loadingComponent={name:"SystemAsyncLoading",render:()=>Ir(Ji(Kv.loading))}),Kv.error&&(Zv.errorComponent={name:"SystemAsyncError",props:["error"],render(){return Ir(Ji(Kv.error),{error:this.error})}});const Xv=()=>n(()=>import("./TUIKit-components-TUIConversation-index.BszPXyYX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(A=>gp(A.default||A)),$v=Qo(zv({loader:Xv},Zv)),Aw=()=>n(()=>import("./pages-index-index.CPHuv6KV.js"),__vite__mapDeps([9,3,10])).then(A=>gp(A.default||A)),ew=Qo(zv({loader:Aw},Zv)),tw=()=>n(()=>import("./pages-login-login.BEiUK2v9.js"),__vite__mapDeps([11,12,3,13,14,15,16])).then(A=>gp(A.default||A)),iw=Qo(zv({loader:tw},Zv)),ow=()=>n(()=>import("./TUIKit-components-TUIChat-index.Cj26Cu3T.js"),__vite__mapDeps([17,6,3,2,18,4,19,7,8,20,21,22,23])).then(A=>gp(A.default||A)),nw=Qo(zv({loader:ow},Zv)),rw=()=>n(()=>import("./TUIKit-components-TUIContact-index.CgQjlOy-.js"),__vite__mapDeps([24,6,3,2,18,19,25,26])).then(A=>gp(A.default||A)),sw=Qo(zv({loader:rw},Zv)),aw=()=>n(()=>import("./TUIKit-components-TUIChat-video-play.DUkcS_xe.js"),__vite__mapDeps([27,3,28])).then(A=>gp(A.default||A)),gw=Qo(zv({loader:aw},Zv)),cw=()=>n(()=>import("./TUIKit-components-TUIChat-web-view.DjFpSr5x.js"),[]).then(A=>gp(A.default||A)),lw=Qo(zv({loader:cw},Zv)),Iw=()=>n(()=>import("./TUIKit-components-TUIGroup-index.BRKduKr7.js"),__vite__mapDeps([29,6,3,2,18,15,30,23,31,32,33,8,5])).then(A=>gp(A.default||A)),uw=Qo(zv({loader:Iw},Zv)),Ew=()=>n(()=>import("./TUIKit-components-TUISearch-index.Cp_ZmtC_.js"),__vite__mapDeps([1,2,3,4,5])).then(A=>gp(A.default||A)),dw=Qo(zv({loader:Ew},Zv)),hw=()=>n(()=>import("./pages-login-protocol.Bs-wFh3A.js"),__vite__mapDeps([34,35,36,3,37,38])).then(A=>gp(A.default||A)),Cw=Qo(zv({loader:hw},Zv)),Bw=()=>n(()=>import("./pages-login-regime.CZSj_SSM.js"),__vite__mapDeps([39,35,36,3,37,38])).then(A=>gp(A.default||A)),Qw=Qo(zv({loader:Bw},Zv)),pw=()=>n(()=>import("./pages-login-phone-register-phone-register.BJYIh-2W.js"),__vite__mapDeps([40,41,12,3,13,14,15,33,42])).then(A=>gp(A.default||A)),fw=Qo(zv({loader:pw},Zv)),mw=()=>n(()=>import("./pages-login-email-register-email-register.DTGXQvI-.js"),__vite__mapDeps([43,41,12,3,13,14,15,33,42])).then(A=>gp(A.default||A)),yw=Qo(zv({loader:mw},Zv)),Dw=()=>n(()=>import("./pages-login-forgot-password-forgot-password.iEKGXf-P.js"),__vite__mapDeps([44,45,22,3,46,15,47])).then(A=>gp(A.default||A)),vw=Qo(zv({loader:Dw},Zv)),ww=()=>n(()=>import("./pages-news-list-news-list.D49CpDuO.js"),__vite__mapDeps([48,3,49])).then(A=>gp(A.default||A)),Sw=Qo(zv({loader:ww},Zv)),Mw=()=>n(()=>import("./pages-contacts-contacts.QOLJfbpO.js"),__vite__mapDeps([50,3])).then(A=>gp(A.default||A)),Rw=Qo(zv({loader:Mw},Zv)),_w=()=>n(()=>import("./pages-discover-discover.c6wbTgZH.js"),__vite__mapDeps([51,45,22,3,46,52,53])).then(A=>gp(A.default||A)),Tw=Qo(zv({loader:_w},Zv)),Nw=()=>n(()=>import("./pages-my-index-my-index.DOYn2rp7.js"),__vite__mapDeps([54,22,3,52,55,56])).then(A=>gp(A.default||A)),bw=Qo(zv({loader:Nw},Zv)),Gw=()=>n(()=>import("./pages-my-index-withdraw.CapE4pOy.js"),__vite__mapDeps([57,45,22,3,46,21,23,15,30,58])).then(A=>gp(A.default||A)),kw=Qo(zv({loader:Gw},Zv)),Lw=()=>n(()=>import("./pages-my-index-recharge.CEeDSxv1.js"),[]).then(A=>gp(A.default||A)),Uw=Qo(zv({loader:Lw},Zv)),Fw=()=>n(()=>import("./pages-my-index-personal-center-index.B02LHm_D.js"),__vite__mapDeps([59,45,22,3,46,60,61,62,63,64,65,23,66,31,32,67])).then(A=>gp(A.default||A)),Ow=Qo(zv({loader:Fw},Zv)),xw=()=>n(()=>import("./pages-my-index-qr-code-index.DRou2cTk.js"),__vite__mapDeps([68,22,3,69,70,71])).then(A=>gp(A.default||A)),Pw=Qo(zv({loader:xw},Zv)),Yw=()=>n(()=>import("./pages-my-index-wallet-index.BNWBEX42.js"),__vite__mapDeps([72,22,3,55,73])).then(A=>gp(A.default||A)),Jw=Qo(zv({loader:Yw},Zv)),Hw=()=>n(()=>import("./pages-my-index-wallet-edit-password.-UUZYFNq.js"),__vite__mapDeps([74,45,22,3,46,15,30,75,76,33,77])).then(A=>gp(A.default||A)),qw=Qo(zv({loader:Hw},Zv)),Vw=()=>n(()=>import("./pages-my-index-wallet-bank-card-index.PFhmLgX-.js"),__vite__mapDeps([78,22,3,79,80,15,30,81])).then(A=>gp(A.default||A)),jw=Qo(zv({loader:Vw},Zv)),Kw=()=>n(()=>import("./pages-my-index-wallet-record.D_lL5Nwj.js"),__vite__mapDeps([82,83,3,84,85])).then(A=>gp(A.default||A)),Ww=Qo(zv({loader:Kw},Zv)),zw=()=>n(()=>import("./pages-my-index-wallet-withdrawal-record.DuDcBPvX.js"),__vite__mapDeps([86,82,83,3,84,85])).then(A=>gp(A.default||A)),Zw=Qo(zv({loader:zw},Zv)),Xw=()=>n(()=>import("./pages-my-index-wallet-real-id.BFaxXf6n.js"),__vite__mapDeps([87,88,22,3,62,32,89,15,30,90,75,76,33,20,91])).then(A=>gp(A.default||A)),$w=Qo(zv({loader:Xw},Zv)),AS=()=>n(()=>import("./pages-my-index-wallet-invite.43_63nes.js"),__vite__mapDeps([92,3,93])).then(A=>gp(A.default||A)),eS=Qo(zv({loader:AS},Zv)),tS=()=>n(()=>import("./pages-my-index-my-team.B_8YBLDl.js"),__vite__mapDeps([94,3,95])).then(A=>gp(A.default||A)),iS=Qo(zv({loader:tS},Zv)),oS=()=>n(()=>import("./pages-my-index-collection-index.BarD2mgC.js"),__vite__mapDeps([96,97,3,98,99])).then(A=>gp(A.default||A)),nS=Qo(zv({loader:oS},Zv)),rS=()=>n(()=>import("./pages-my-index-meeting-record-index.D2RST8Fq.js"),__vite__mapDeps([100,83,3,84,20,101])).then(A=>gp(A.default||A)),sS=Qo(zv({loader:rS},Zv)),aS=()=>n(()=>import("./pages-my-index-meeting-record-details.BQke5n7a.js"),__vite__mapDeps([102,90,20,3,103])).then(A=>gp(A.default||A)),gS=Qo(zv({loader:aS},Zv)),cS=()=>n(()=>import("./pages-my-index-customer-service-index.Bk6n0xIk.js"),__vite__mapDeps([104,3,105])).then(A=>gp(A.default||A)),lS=Qo(zv({loader:cS},Zv)),IS=()=>n(()=>import("./pages-my-index-customer-service-third-party._NAOEpxm.js"),__vite__mapDeps([106,3,107])).then(A=>gp(A.default||A)),uS=Qo(zv({loader:IS},Zv)),ES=()=>n(()=>import("./pages-my-index-set-up-index.UbHnzgRh.js"),__vite__mapDeps([108,22,3,109])).then(A=>gp(A.default||A)),dS=Qo(zv({loader:ES},Zv)),hS=()=>n(()=>import("./pages-my-index-set-up-feedback.xX9KgCfY.js"),__vite__mapDeps([110,61,62,63,3,64,65,88,22,32,89,15,30,75,76,111])).then(A=>gp(A.default||A)),CS=Qo(zv({loader:hS},Zv)),BS=()=>n(()=>import("./pages-my-index-set-up-message-index.BBKyTkW6.js"),__vite__mapDeps([112,22,3,83,84,113])).then(A=>gp(A.default||A)),QS=Qo(zv({loader:BS},Zv)),pS=()=>n(()=>import("./pages-my-index-set-up-message-details.BTWbrRMX.js"),__vite__mapDeps([114,3,115])).then(A=>gp(A.default||A)),fS=Qo(zv({loader:pS},Zv)),mS=()=>n(()=>import("./pages-my-index-set-up-font-settings.DobbslTk.js"),__vite__mapDeps([116,3,117])).then(A=>gp(A.default||A)),yS=Qo(zv({loader:mS},Zv)),DS=()=>n(()=>import("./pages-my-index-wallet-bank-card-card-details.Bm01r185.js"),__vite__mapDeps([118,45,22,3,46,61,62,63,64,65,88,32,89,15,30,75,76,119])).then(A=>gp(A.default||A)),vS=Qo(zv({loader:DS},Zv)),wS=()=>n(()=>import("./pages-mall-list.Zn1WXIRv.js"),__vite__mapDeps([120,97,3,98,83,84,121,122])).then(A=>gp(A.default||A)),SS=Qo(zv({loader:wS},Zv)),MS=()=>n(()=>import("./pages-mall-detail.CblNjsth.js"),__vite__mapDeps([123,45,22,3,46,36,37,15,30,23,19,124,52,121,125,126])).then(A=>gp(A.default||A)),RS=Qo(zv({loader:MS},Zv)),_S=()=>n(()=>import("./pages-mall-comment.BQjKcHti.js"),__vite__mapDeps([127,22,3,128,129,15,30,83,84,121,130])).then(A=>gp(A.default||A)),TS=Qo(zv({loader:_S},Zv)),NS=()=>n(()=>import("./pages-mall-add-comment.vAYbyeKS.js"),__vite__mapDeps([131,128,22,3,129,88,62,32,89,15,30,75,76,121,132])).then(A=>gp(A.default||A)),bS=Qo(zv({loader:NS},Zv)),GS=()=>n(()=>import("./pages-mall-confirm-order.UGvFmQVy.js"),__vite__mapDeps([133,21,22,3,23,15,30,52,13,121,55,134])).then(A=>gp(A.default||A)),kS=Qo(zv({loader:GS},Zv)),LS=()=>n(()=>import("./pages-address-index._M3e2_64.js"),__vite__mapDeps([135,45,22,3,46,25,79,80,136])).then(A=>gp(A.default||A)),US=Qo(zv({loader:LS},Zv)),FS=()=>n(()=>import("./pages-address-add.dms2Ecga.js"),__vite__mapDeps([137,22,3,15,30,13,33,138])).then(A=>gp(A.default||A)),OS=Qo(zv({loader:FS},Zv)),xS=()=>n(()=>import("./pages-address-edit.DLXKbCuF.js"),__vite__mapDeps([139,137,22,3,15,30,13,33,138])).then(A=>gp(A.default||A)),PS=Qo(zv({loader:xS},Zv)),YS=()=>n(()=>import("./pages-shop-together-index.Dx0FPcJD.js"),__vite__mapDeps([140,25,3,121,141,142])).then(A=>gp(A.default||A)),JS=Qo(zv({loader:YS},Zv)),HS=()=>n(()=>import("./pages-shop-together-detail.Ct4MfSi8.js"),__vite__mapDeps([143,63,3,64,22,15,30,141,121,144])).then(A=>gp(A.default||A)),qS=Qo(zv({loader:HS},Zv)),VS=()=>n(()=>import("./pages-shop-together-share.Axv3RveS.js"),__vite__mapDeps([145,45,22,3,46,69,70,146])).then(A=>gp(A.default||A)),jS=Qo(zv({loader:VS},Zv)),KS=()=>n(()=>import("./pages-discover-ranking-list.C2kuznWx.js"),__vite__mapDeps([147,45,22,3,46,124,55,148])).then(A=>gp(A.default||A)),WS=Qo(zv({loader:KS},Zv)),zS=()=>n(()=>import("./pages-discover-punch.Ch-zxBXH.js"),__vite__mapDeps([149,45,22,3,46,124,125,55,150])).then(A=>gp(A.default||A)),ZS=Qo(zv({loader:zS},Zv)),XS=()=>n(()=>import("./pages-discover-dynamic-dynamic.BodfEZND.js"),__vite__mapDeps([151,22,3,45,46,83,84,125,152])).then(A=>gp(A.default||A)),$S=Qo(zv({loader:XS},Zv)),AM=()=>n(()=>import("./pages-discover-dynamic-release.Bw945Ce1.js"),__vite__mapDeps([153,45,22,3,46,88,62,32,89,154])).then(A=>gp(A.default||A)),eM=Qo(zv({loader:AM},Zv)),tM=()=>n(()=>import("./pages-discover-company.AOV1WuNg.js"),__vite__mapDeps([155,36,3,37,156])).then(A=>gp(A.default||A)),iM=Qo(zv({loader:tM},Zv)),oM=()=>n(()=>import("./TUIKit-components-TUIChat-message-input-toolbar-live-stream-apply.7tHisfN7.js"),__vite__mapDeps([157,45,22,3,46,87,88,62,32,89,15,30,90,75,76,33,20,91,158])).then(A=>gp(A.default||A)),nM=Qo(zv({loader:oM},Zv)),rM=()=>n(()=>import("./pages-adduser-index.DHRZRLuI.js"),__vite__mapDeps([159,22,3,25,160])).then(A=>gp(A.default||A)),sM=Qo(zv({loader:rM},Zv)),aM=()=>n(()=>import("./pages-adduser-details.ChC6QT93.js"),__vite__mapDeps([161,22,3,15,30,60,61,62,63,64,65,23,66,26,162])).then(A=>gp(A.default||A)),gM=Qo(zv({loader:aM},Zv)),cM=()=>n(()=>import("./pages-red-packet-details.DrAaMcdz.js"),__vite__mapDeps([163,22,3,45,46,63,64,20,164])).then(A=>gp(A.default||A)),lM=Qo(zv({loader:cM},Zv));function IM(A,e){return Ar(),nr(Vv,null,{page:Ui(()=>[Ir(A,zv({},e,{ref:"page"}),null,512)]),_:1})}function uM(A,e){return"string"==typeof A?e:A}window.__uniRoutes=[{path:"/",alias:"/TUIKit/components/TUIConversation/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM($v,e)}},loader:Xv,meta:{isQuit:!0,isEntry:!0,isTabBar:!0,tabBarIndex:0,navigationBar:{style:"custom",type:"default"},isNVue:!1}},{path:"/pages/index/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(ew,e)}},loader:Aw,meta:{navigationBar:{titleText:"首页",type:"default"},isNVue:!1}},{path:"/pages/login/login",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(iw,e)}},loader:tw,meta:{navigationBar:{titleText:"登录",style:"custom",type:"default"},isNVue:!1}},{path:"/TUIKit/components/TUIChat/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(nw,e)}},loader:ow,meta:{softinputMode:"adjustResize",navigationBar:{style:"custom",type:"default"},isNVue:!1}},{path:"/TUIKit/components/TUIContact/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(sw,e)}},loader:rw,meta:{isQuit:!0,isTabBar:!0,tabBarIndex:1,navigationBar:{style:"custom",type:"default"},isNVue:!1}},{path:"/TUIKit/components/TUIChat/video-play",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(gw,e)}},loader:aw,meta:{navigationBar:{backgroundColor:"#EBF0F6",titleText:"腾讯云 IM",type:"default"},isNVue:!1}},{path:"/TUIKit/components/TUIChat/web-view",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(lw,e)}},loader:cw,meta:{navigationBar:{backgroundColor:"#EBF0F6",titleText:"腾讯云 IM",type:"default"},isNVue:!1}},{path:"/TUIKit/components/TUIGroup/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(uw,e)}},loader:Iw,meta:{navigationBar:{style:"custom",type:"default"},isNVue:!1}},{path:"/TUIKit/components/TUISearch/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(dw,e)}},loader:Ew,meta:{navigationBar:{backgroundColor:"#EBF0F6",titleText:"聊天记录",type:"default"},isNVue:!1}},{path:"/pages/login/protocol",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Cw,e)}},loader:hw,meta:{navigationBar:{titleText:"用户权益",type:"default"},isNVue:!1}},{path:"/pages/login/regime",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Qw,e)}},loader:Bw,meta:{navigationBar:{titleText:"隐私政策",type:"default"},isNVue:!1}},{path:"/pages/login/phone-register/phone-register",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(fw,e)}},loader:pw,meta:{navigationBar:{titleText:"手机注册",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/login/email-register/email-register",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(yw,e)}},loader:mw,meta:{navigationBar:{titleText:"邮箱注册",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/login/forgot-password/forgot-password",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(vw,e)}},loader:Dw,meta:{navigationBar:{titleText:"忘记密码",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/news-list/news-list",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Sw,e)}},loader:ww,meta:{navigationBar:{titleText:"消息",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/contacts/contacts",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Rw,e)}},loader:Mw,meta:{navigationBar:{titleText:"通讯录",type:"default"},isNVue:!1}},{path:"/pages/discover/discover",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Tw,e)}},loader:_w,meta:{isQuit:!0,isTabBar:!0,tabBarIndex:2,navigationBar:{backgroundColor:"#ffffff",titleText:"发现",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/my-index/my-index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(bw,e)}},loader:Nw,meta:{isQuit:!0,isTabBar:!0,tabBarIndex:3,backgroundColor:"#f7f7f7",navigationBar:{backgroundColor:"#ffffff",titleText:"我的",type:"default"},isNVue:!1}},{path:"/pages/my-index/withdraw",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(kw,e)}},loader:Gw,meta:{navigationBar:{titleText:"提现",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/my-index/recharge",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Uw,e)}},loader:Lw,meta:{backgroundColor:"#f7f7f7",navigationBar:{titleText:"充值",type:"default"},isNVue:!1}},{path:"/pages/my-index/personal-center/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Ow,e)}},loader:Fw,meta:{navigationBar:{titleText:"个人中心",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/my-index/qr-code/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Pw,e)}},loader:xw,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"",type:"default"},isNVue:!1}},{path:"/pages/my-index/wallet/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Jw,e)}},loader:Yw,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"钱包",type:"default"},isNVue:!1}},{path:"/pages/my-index/wallet/edit-password",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(qw,e)}},loader:Hw,meta:{navigationBar:{titleText:"修改钱包密码",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/my-index/wallet/bank-card/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(jw,e)}},loader:Vw,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"提现卡",type:"default"},isNVue:!1}},{path:"/pages/my-index/wallet/record",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Ww,e)}},loader:Kw,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"积分记录",type:"default"},isNVue:!1}},{path:"/pages/my-index/wallet/withdrawal-record",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(Zw,e)}},loader:zw,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"提现记录",type:"default"},isNVue:!1}},{path:"/pages/my-index/wallet/real-id",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM($w,e)}},loader:Xw,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"实名认证",type:"default"},isNVue:!1}},{path:"/pages/my-index/wallet/invite",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(eS,e)}},loader:AS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"邀请好友",type:"default"},isNVue:!1}},{path:"/pages/my-index/my-team",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(iS,e)}},loader:tS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"我的团队",type:"default"},isNVue:!1}},{path:"/pages/my-index/collection/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(nS,e)}},loader:oS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"收藏",type:"default"},isNVue:!1}},{path:"/pages/my-index/meeting-record/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(sS,e)}},loader:rS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"直播记录",type:"default"},isNVue:!1}},{path:"/pages/my-index/meeting-record/details",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(gS,e)}},loader:aS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"会议详情",type:"default"},isNVue:!1}},{path:"/pages/my-index/customer-service/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(lS,e)}},loader:cS,meta:{navigationBar:{titleText:"客服",type:"default"},isNVue:!1}},{path:"/pages/my-index/customer-service/third-party",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(uS,e)}},loader:IS,meta:{navigationBar:{titleText:"第三方客服",type:"default"},isNVue:!1}},{path:"/pages/my-index/set-up/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(dS,e)}},loader:ES,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"设置",type:"default"},isNVue:!1}},{path:"/pages/my-index/set-up/feedback",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(CS,e)}},loader:hS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"意见反馈",type:"default"},isNVue:!1}},{path:"/pages/my-index/set-up/message/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(QS,e)}},loader:BS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"消息通知",type:"default"},isNVue:!1}},{path:"/pages/my-index/set-up/message/details",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(fS,e)}},loader:pS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"通知详情",type:"default"},isNVue:!1}},{path:"/pages/my-index/set-up/font-settings",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(yS,e)}},loader:mS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"字体设置",type:"default"},isNVue:!1}},{path:"/pages/my-index/wallet/bank-card/card-details",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(vS,e)}},loader:DS,meta:{navigationBar:{titleText:"卡信息增删改查",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/mall/list",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(SS,e)}},loader:wS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"商城",type:"default"},isNVue:!1}},{path:"/pages/mall/detail",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(RS,e)}},loader:MS,meta:{navigationBar:{titleText:"商品详情",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/mall/comment",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(TS,e)}},loader:_S,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"评价",type:"default"},isNVue:!1}},{path:"/pages/mall/add-comment",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(bS,e)}},loader:NS,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"添加评价",type:"default"},isNVue:!1}},{path:"/pages/mall/confirm-order",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(kS,e)}},loader:GS,meta:{navigationBar:{titleText:"确认订单",type:"default"},isNVue:!1}},{path:"/pages/address/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(US,e)}},loader:LS,meta:{navigationBar:{titleText:"我的地址",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/address/add",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(OS,e)}},loader:FS,meta:{navigationBar:{titleText:"添加地址",type:"default"},isNVue:!1}},{path:"/pages/address/edit",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(PS,e)}},loader:xS,meta:{navigationBar:{titleText:"修改地址",type:"default"},isNVue:!1}},{path:"/pages/shop-together/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(JS,e)}},loader:YS,meta:{navigationBar:{titleText:"我的拼团",type:"default"},isNVue:!1}},{path:"/pages/shop-together/detail",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(qS,e)}},loader:HS,meta:{navigationBar:{titleText:"拼团记录",type:"default"},isNVue:!1}},{path:"/pages/shop-together/share",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(jS,e)}},loader:VS,meta:{navigationBar:{style:"custom",type:"default"},isNVue:!1}},{path:"/pages/discover/ranking-list",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(WS,e)}},loader:KS,meta:{navigationBar:{titleText:"排行榜",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/discover/punch",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(ZS,e)}},loader:zS,meta:{navigationBar:{titleText:"签到",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/discover/dynamic/dynamic",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM($S,e)}},loader:XS,meta:{navigationBar:{titleText:"朋友圈",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/discover/dynamic/release",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(eM,e)}},loader:AM,meta:{navigationBar:{titleText:"发布朋友圈",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/discover/company",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(iM,e)}},loader:tM,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"公司介绍",type:"default"},isNVue:!1}},{path:"/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(nM,e)}},loader:oM,meta:{navigationBar:{titleText:"直播",style:"custom",type:"default"},isNVue:!1}},{path:"/pages/adduser/index",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(sM,e)}},loader:rM,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"添加朋友/群组",type:"default"},isNVue:!1}},{path:"/pages/adduser/details",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(gM,e)}},loader:aM,meta:{navigationBar:{backgroundColor:"#ffffff",titleText:"发送好友申请",type:"default"},isNVue:!1}},{path:"/pages/red-packet/details",component:{setup(){const A=np(),e=A&&A.$route&&A.$route.query||{};return()=>IM(lM,e)}},loader:cM,meta:{navigationBar:{titleText:"红包详情",style:"custom",type:"default"},isNVue:!1}}].map(A=>(A.meta.route=(A.alias||A.path).slice(1),A));const EM=(A,e=0)=>(e,t=Dr())=>{!Tr&&Go(A,e,t)},dM=EM(cA,3),hM=EM(lA,3),CM=EM(IA,1),BM=EM(CA,2),QM=EM(BA,2),pM=EM(QA,2),fM=EM(DA,2),mM=(A,e)=>{if(!e||0===Object.keys(e).length)return A;const t=Object.entries(e).map(([A,e])=>`${A}=${e="object"==typeof e?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(String(e))}`).join("&");return A.includes("?")?`${A}&${t}`:`${A}?${t}`},yM=(A,e={})=>{const t=mM(A,e);return uni.navigateTo({url:t})},DM=(A,e={})=>{const t=mM(A,e);return uni.reLaunch({url:t})},vM=(A=1)=>uni.navigateBack({delta:A}),wM=(A,e={})=>(Object.keys(e).length>0&&console.warn("switchTab 不支持携带参数,请使用全局状态或 storage 传递"),uni.switchTab({url:A})); -/*! - * pinia v2.1.7 - * (c) 2023 Eduardo San Martin Morote - * @license MIT - */ -let SM;const MM=A=>SM=A,RM=Symbol();function _M(A){return A&&"object"==typeof A&&"[object Object]"===Object.prototype.toString.call(A)&&"function"!=typeof A.toJSON}var TM,NM;(NM=TM||(TM={})).direct="direct",NM.patchObject="patch object",NM.patchFunction="patch function";const bM="undefined"!=typeof window;function GM(){const A=ve(!0),e=A.run(()=>Kt({}));let t=[],i=[];const o=Pt({install(A){MM(o),o._a=A,A.provide(RM,o),A.config.globalProperties.$pinia=o,i.forEach(A=>t.push(A)),i=[]},use(A){return this._a?t.push(A):i.push(A),this},_p:t,_a:null,_e:A,_s:new Map,state:e});return o}const kM=()=>{};function LM(A,e,t,i=kM){A.push(e);const o=()=>{const t=A.indexOf(e);t>-1&&(A.splice(t,1),i())};var n;return!t&&we()&&(n=o,me&&me.cleanups.push(n)),o}function UM(A,...e){A.slice().forEach(A=>{A(...e)})}const FM=A=>A();function OM(A,e){A instanceof Map&&e instanceof Map&&e.forEach((e,t)=>A.set(t,e)),A instanceof Set&&e instanceof Set&&e.forEach(A.add,A);for(const t in e){if(!e.hasOwnProperty(t))continue;const i=e[t],o=A[t];_M(o)&&_M(i)&&A.hasOwnProperty(t)&&!jt(i)&&!Lt(i)?A[t]=OM(o,i):A[t]=i}return A}const xM=Symbol();function PM(A){return!_M(A)||!A.hasOwnProperty(xM)}const{assign:YM}=Object;function JM(A){return!(!jt(A)||!A.effect)}function HM(A,e,t={},i,o,n){let r;const s=YM({actions:{}},t),a={deep:!0};let g,c,l,I=[],u=[];const E=i.state.value[A];let d;function h(e){let t;g=c=!1,"function"==typeof e?(e(i.state.value[A]),t={type:TM.patchFunction,storeId:A,events:l}):(OM(i.state.value[A],e),t={type:TM.patchObject,payload:e,storeId:A,events:l});const o=d=Symbol();pi().then(()=>{d===o&&(g=!0)}),c=!0,UM(I,t,i.state.value[A])}n||E||(i.state.value[A]={}),Kt({});const C=n?function(){const{state:A}=t,e=A?A():{};this.$patch(A=>{YM(A,e)})}:kM;function B(e,t){return function(){MM(i);const o=Array.from(arguments),n=[],r=[];let s;UM(u,{args:o,name:e,store:Q,after:function(A){n.push(A)},onError:function(A){r.push(A)}});try{s=t.apply(this&&this.$id===A?this:Q,o)}catch(a){throw UM(r,a),a}return s instanceof Promise?s.then(A=>(UM(n,A),A)).catch(A=>(UM(r,A),Promise.reject(A))):(UM(n,s),s)}}const Q=Nt({_p:i,$id:A,$onAction:LM.bind(null,u),$patch:h,$reset:C,$subscribe(e,t={}){const o=LM(I,e,t.detached,()=>n()),n=r.run(()=>Xi(()=>i.state.value[A],i=>{("sync"===t.flush?c:g)&&e({storeId:A,type:TM.direct,events:l},i)},YM({},a,t)));return o},$dispose:function(){r.stop(),I=[],u=[],i._s.delete(A)}});i._s.set(A,Q);const p=(i._a&&i._a.runWithContext||FM)(()=>i._e.run(()=>(r=ve()).run(e)));for(const f in p){const e=p[f];if(jt(e)&&!JM(e)||Lt(e))n||(E&&PM(e)&&(jt(e)?e.value=E[f]:OM(e,E[f])),i.state.value[A][f]=e);else if("function"==typeof e){const A=B(f,e);p[f]=A,s.actions[f]=e}}return YM(Q,p),YM(xt(Q),p),Object.defineProperty(Q,"$state",{get:()=>i.state.value[A],set:A=>{h(e=>{YM(e,A)})}}),i._p.forEach(A=>{YM(Q,r.run(()=>A({store:Q,app:i._a,pinia:i,options:s})))}),E&&n&&t.hydrate&&t.hydrate(Q.$state,E),g=!0,c=!0,Q}function qM(A,e,t){let i,o;const n="function"==typeof e;function r(A,t){const r=fn();(A=A||(r?pn(RM,null):null))&&MM(A),(A=SM)._s.has(i)||(n?HM(i,e,o,A):function(A,e,t){const{state:i,actions:o,getters:n}=e,r=t.state.value[A];let s;s=HM(A,function(){r||(t.state.value[A]=i?i():{});const e=ti(t.state.value[A]);return YM(e,o,Object.keys(n||{}).reduce((e,i)=>(e[i]=Pt(Ur(()=>{MM(t);const e=t._s.get(A);return n[i].call(e,e)})),e),{}))},e,t,0,!0)}(i,o,A));return A._s.get(i)}return"string"==typeof A?(i=A,o=n?t:e):(o=A,i=A.id),r.$id=i,r}let VM="Store";function jM(A,e){return Array.isArray(e)?e.reduce((e,t)=>(e[t]=function(){return A(this.$pinia)[t]},e),{}):Object.keys(e).reduce((t,i)=>(t[i]=function(){const t=A(this.$pinia),o=e[i];return"function"==typeof o?o.call(this,t):t[o]},t),{})}const KM=jM;function WM(A){{A=xt(A);const e={};for(const t in A){const i=A[t];(jt(i)||Lt(i))&&(e[t]=ni(A,t))}return e}}const zM=Object.freeze(Object.defineProperty({__proto__:null,get MutationType(){return TM},PiniaVuePlugin:function(A){A.mixin({beforeCreate(){const A=this.$options;if(A.pinia){const e=A.pinia;if(!this._provided){const A={};Object.defineProperty(this,"_provided",{get:()=>A,set:e=>Object.assign(A,e)})}this._provided[RM]=e,this.$pinia||(this.$pinia=e),e._a=this,bM&&MM(e)}else!this.$pinia&&A.parent&&A.parent.$pinia&&(this.$pinia=A.parent.$pinia)},destroyed(){delete this._pStores}})},acceptHMRUpdate:function(A,e){return()=>{}},createPinia:GM,defineStore:qM,getActivePinia:()=>fn()&&pn(RM)||SM,mapActions:function(A,e){return Array.isArray(e)?e.reduce((e,t)=>(e[t]=function(...e){return A(this.$pinia)[t](...e)},e),{}):Object.keys(e).reduce((t,i)=>(t[i]=function(...t){return A(this.$pinia)[e[i]](...t)},t),{})},mapGetters:KM,mapState:jM,mapStores:function(...A){return A.reduce((A,e)=>(A[e.$id+VM]=function(){return e(this.$pinia)},A),{})},mapWritableState:function(A,e){return Array.isArray(e)?e.reduce((e,t)=>(e[t]={get(){return A(this.$pinia)[t]},set(e){return A(this.$pinia)[t]=e}},e),{}):Object.keys(e).reduce((t,i)=>(t[i]={get(){return A(this.$pinia)[e[i]]},set(t){return A(this.$pinia)[e[i]]=t}},t),{})},setActivePinia:MM,setMapStoreSuffix:function(A){VM=A},skipHydrate:function(A){return Object.defineProperty(A,xM,{})},storeToRefs:WM},Symbol.toStringTag,{value:"Module"})),ZM="token",XM="userInfo",$M="tencentUserSig",AR="fontSizeData",eR=()=>uni.getStorageSync(ZM)||"",tR=A=>uni.setStorageSync(XM,JSON.stringify(A)),iR=()=>uni.getStorageSync(XM)||"",oR=()=>uni.getStorageSync($M)||"",nR=qM(ZM,()=>{const A=Kt(eR()||null),e=Kt(!!A.value);return{token:A,isLogin:e,setToken:t=>{var i;A.value=t,e.value=!0,i=t,uni.setStorageSync(ZM,i)},clearToken:()=>{A.value=null,e.value=!1,uni.removeStorageSync(ZM)},checkToken:()=>!!A.value,isTokenExpired:()=>!1}});let rR=!1;const sR=A=>{const e={...{url:"",method:"GET",data:{},header:{deviceId:uni.getDeviceInfo().deviceId,"Content-Type":"application/json"}},...A};return eR()&&(e.header.Authorization="Bearer "+eR()),!1!==A.loading&&uni.showLoading({title:"加载中...",mask:!0}),new Promise((t,i)=>{uni.request({url:"https://dev.cqjcteach.cn/prod-api"+e.url,method:e.method,data:e.data,timeout:1e4,header:e.header,success:A=>{if(200===A.statusCode)if(200===A.data.code)t(A.data);else{const e=aR(A.data.code,A.data);i(e||A.data)}else{const e=aR(A.statusCode,A.data);i(e||A)}},fail:A=>{uni.showToast({title:"网络异常,请检查网络连接",icon:"none",duration:2e3,mask:!0}),i(A)},complete:()=>{!1!==A.loading&&uni.hideLoading()}})})},aR=(A,e)=>{if(401===A)return rR||(rR=!0,uni.showModal({title:"提示",content:"登录已过期,请重新登录",showCancel:!1,success:async()=>{await BN().clearAllUserInfo(),uni.reLaunch({url:"/pages/login/login"}),console.log("登录已过期,====")},complete:()=>{rR=!1}})),new Error("Unauthorized");switch(A){case 403:uni.showToast({title:"没有权限访问",icon:"none",duration:2e3,mask:!0});break;case 404:uni.showToast({title:"请求资源不存在",icon:"none",duration:2e3,mask:!0});break;case 500:uni.showModal({title:`${A}提示`,content:e.msg||"服务器内部错误",showCancel:!1,confirmText:"确定"});break;default:uni.showToast({title:e.msg||"请求失败,请重试",icon:"none",duration:2e3,mask:!0})}return new Error(`Request failed with code: ${A}`)},gR=A=>sR({url:"/api/register",method:"post",data:A}),cR=A=>sR({url:"/api/login",method:"post",data:A}),lR=()=>sR({url:"/api/userInfo",method:"get"}),IR=(A,e=!0)=>sR({url:"/api/service/userAddress/list",method:"get",loading:e,data:A}),uR=A=>sR({url:`/api/service/userAddress/${A}`,method:"get"}),ER=A=>sR({url:"/api/service/userAddress",method:"post",data:A}),dR=A=>sR({url:"/api/service/userAddress",method:"put",data:A}),hR=A=>sR({url:`/api/service/userAddress/${A}`,method:"delete"}),CR=A=>sR({url:"/api/system/userPoints/list",method:"get",data:A}),BR=A=>sR({url:"/api/system/signRecord/list",method:"get",data:A}),QR=()=>sR({url:"/api/system/signRecord",method:"post"}),pR=A=>sR({url:`/api/service/articleContent/type/${A}`,method:"get"}),fR=(A=!0)=>sR({url:"/api/free/black/isBlack",method:"get",loading:A}),mR=Kt(!1),yR=(A="加载中...")=>{mR.value=!0,uni.showLoading({title:A,mask:!0})},DR=()=>{mR.value=!1,uni.hideLoading()},vR=(A,e="none",t=1800)=>{let i="none";return"success"===e&&(i="success"),"error"===e&&(i="error"),"warning"===e&&(i="none"),new Promise(e=>{uni.showToast({title:A,icon:i,duration:t,mask:!0}),setTimeout(()=>e(),t)})},wR=(A,e,t=!0)=>new Promise(i=>{uni.showModal({title:A,content:e,showCancel:t,confirmText:"确定",cancelText:"取消",success:A=>i(A.confirm)})}),SR=()=>({isLoading:mR,showLoading:yR,hideLoading:DR,showToast:vR,showDialog:wR});var MR="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function RR(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}function _R(A){if(A.__esModule)return A;var e=A.default;if("function"==typeof e){var t=function A(){return this instanceof A?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(A).forEach(function(e){var i=Object.getOwnPropertyDescriptor(A,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:function(){return A[e]}})}),t}var TR={exports:{}};TR.exports=function(){const A=A=>void 0===A,e=A=>"string"==typeof A,t=A=>{var e;return null===(e=Object.prototype.toString.call(A).match(/^\[object (.*)\]$/))||void 0===e?void 0:e[1].toLowerCase()},i=A=>"function"==typeof Array.isArray?Array.isArray(A):"array"===t(A),o=A=>null!==A&&"object"==typeof A,n=A=>i(A)||o(A),r=A=>{if("string"!=typeof A)return!1;const e=A[0];return!/[^a-zA-Z0-9]/.test(e)},s=A=>{if("object"!=typeof A||null===A)return!1;const e=Object.getPrototypeOf(A);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t};function a(A=99999999){return Math.round(Math.random()*A)}const g=(e,t,i,o)=>{if(!n(e)||!n(t))return 0;let r=0;const s=Object.keys(t);let a;for(let c=0,l=s.length;c -1&&Y.indexOf("rv:11.0")>-1,tA=function(){const A=/MSIE\s(\d+)\.\d/.exec(Y);let e=A&&parseFloat(A[1]);return!e&&/Trident\/7.0/i.test(Y)&&/rv:11.0/.test(Y)&&(e=11),e}(),iA=/Safari/i.test(Y)&&!AA&&!z&&!$,oA=/Windows/i.test(Y),nA=/MAC OS X/i.test(Y),rA=x&&"undefined"!=typeof Worker&&!eA,sA=z||K,aA=x&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,gA=function(){if("undefined"==typeof window||void 0===window.navigator)return!1;const{standalone:A}=window.navigator;return!(!K||A||iA)}();function cA(){let A="unknown";if(nA&&(A="mac"),oA&&(A="windows"),K&&(A="ios"),z&&(A="android"),L)try{const{platform:e}=P.getSystemInfoSync();void 0!==e&&(A=e)}catch(e){console.error(e)}return A}function lA(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(A);o {P.request({url:e,data:t,method:A,timeout:i,header:{"content-type":hA},success:A=>o(A.data),fail:()=>n(new Error(`{"message":"Network error","code":${uA}}`))})}:(o,n)=>{const r=new XMLHttpRequest,s=setTimeout(()=>{r.abort(),n(new Error(`{"message":"Request timeout","code":${EA}}`))},i);r.onreadystatechange=function(){if(4===r.readyState)if(clearTimeout(s),200===r.status||304===r.status)try{o(r.responseText?JSON.parse(r.responseText):null)}catch(A){o(r.responseText)}else n(new Error(`{"message":"Network error","code":${uA}}`))},r.open(A,e,!0),r.setRequestHeader("Content-type",hA),r.send(t||null)})})}function BA(A){if(null==A)return!0;if("boolean"==typeof A)return!1;if("number"==typeof A)return 0===A;if("string"==typeof A)return 0===A.length;if("function"==typeof A)return 0===A.length;if(Array.isArray(A))return 0===A.length;if(A instanceof Error)return""===A.message;if(s(A)){for(const e in A)if(Object.prototype.hasOwnProperty.call(A,e))return!1;return!0}return("[object Map]"===Object.prototype.toString.call(A)||"[object Set]"===Object.prototype.toString.call(A)||"[object File]"===Object.prototype.toString.call(A))&&0===A.size}function QA(A){if(null===A||"object"!=typeof A)return A;if(A instanceof Date)return new Date(A.getTime());if(A instanceof RegExp)return new RegExp(A.source,A.flags);if(A instanceof Map){const e=new Map;return A.forEach((A,t)=>{e.set(QA(t),QA(A))}),e}if(A instanceof Set){const e=new Set;return A.forEach(A=>{e.add(QA(A))}),e}if(Array.isArray(A))return A.map(A=>QA(A));const e=Object.getPrototypeOf(A),t=Object.create(e);return[...Object.getOwnPropertyNames(A),...Object.getOwnPropertySymbols(A)].forEach(e=>{const i=Object.getOwnPropertyDescriptor(A,e);i&&(i.get||i.set?Object.defineProperty(t,e,i):t[e]=QA(A[e]))}),t}function pA(A,e,t){const i=new WeakSet,o=(A,t)=>{if(e&&(t=e(A,t)),void 0===t)return"undefined";if(null===t)return null;if(Number.isNaN(t))return"NaN";if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if("function"==typeof t)return`[Function: ${t.name||"anonymous"}]`;if("symbol"==typeof t)return t.toString();if("bigint"==typeof t)return`${t.toString()}n`;if("object"==typeof t&&null!==t){if(i.has(t))return"[Circular]";i.add(t)}return t instanceof Date?t.toISOString():t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t instanceof Map?{dataType:"Map",value:Array.from(t.entries())}:t instanceof Set?{dataType:"Set",value:Array.from(t.values())}:t};try{return JSON.stringify(A,o,t)}catch(n){return console.error("Failed to stringify:",n),""}}function fA(){let A,e;return{promise:new Promise((t,i)=>{A=t,e=i}),resolve:A,reject:e}}var mA,yA=Object.freeze({__proto__:null,ANDROID_VERSION:Z,IE_VERSION:tA,IN_ALIPAY_MINI_APP:T,IN_BAIDU_MINI_APP:_,IN_BROWSER:x,IN_DONUT_NATIVE_APP:G,IN_JD_MINI_APP:N,IN_MINI_APP:L,IN_NS_NATIVE_APP:U,IN_QQ_MINI_APP:S,IN_RN_APP:F,IN_TT_MINI_APP:M,IN_TT_MINI_GAME:R,IN_UNI_APP:k,IN_UNI_NATIVE_APP:b,IN_WX_MINI_APP:v,IN_WX_MINI_APP_DESK:D,IN_WX_MINI_GAME:w,IN_WX_MINI_PLUGIN:O,IOS_VERSION:W,IS_ANDROID:z,IS_CHROME:AA,IS_EDGE:$,IS_FIREFOX:X,IS_IE:eA,IS_IOS:K,IS_IPAD:q,IS_IPHONE:V,IS_IPOD:j,IS_MAC:nA,IS_SAFARI:iA,IS_WECHAT:J,IS_WIN:oA,IS_WORKER_AVAILABLE:rA,MINI_APP_NAMESPACE:P,USER_AGENT:Y,base16EncodeBinaryString:c,deepCopyWithMethods:QA,deepMerge:g,generatePromise:fA,getPlatformType:cA,getType:t,httpRequest:CA,isArray:i,isArrayOrObject:n,isEmpty:BA,isFlutterWeb:aA,isH5:sA,isIOSWebView:gA,isNumber:A=>null!==A&&("number"==typeof A&&!Number.isNaN(A-0)||"object"==typeof A&&A.constructor===Number),isObject:o,isPlainObject:s,isString:e,isUndefined:A,isUniIOSApp:function(){return b&&"ios"===uni.getDeviceInfo().platform.toLocaleLowerCase()},isValidRequestKey:r,platform:H,randomInt:a,randomString:function(){const A="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let e="";for(let t=32;t>0;--t)e+=A[Math.floor(62*Math.random())];return e},safeStringify:pA});class DA{constructor(){this.listeners={}}on(A,e,t){this.listeners[A]||(this.listeners[A]=[]),this.listeners[A].push({fn:e,context:t})}off(A,e,t){var i;e&&(this.listeners[A]=null===(i=this.listeners[A])||void 0===i?void 0:i.filter(A=>{const i=A.fn===e,o=!t||A.context===t;return!(i&&o)}))}emit(A,...e){const t=this.listeners[A];t&&t.forEach(t=>{const{fn:i,context:o}=t;try{i.apply(o,e)}catch(n){console.warn(`Error in event handler for ${A} error: ${pA(n)}`)}})}once(A,e,t){const i=(...o)=>{e.apply(t,o),this.off(A,i)};this.on(A,i)}}!function(A){A.BUSINESS_COMMAND="business_command",A.C2C_REALTIME_MESSAGE="c2c_realtime_message",A.C2C_MESSAGE_MODIFIED="c2c_message_modified",A.C2C_REVOKED_MESSAGE="c2c_message_revoked",A.GROUP_REALTIME_MESSAGE="group_realtime_message",A.GROUP_MESSAGE_MODIFIED="group_message_modified",A.GROUP_MESSAGE_REVOKED="group_message_revoked",A.C2C_MESSAGE_READ_RECEIPT="c2c_message_read_receipt",A.MESSAGE_REACTION_UPDATED="message_reaction_updated",A.MESSAGE_REACTION_UPDATED_SYNC="message_reaction_updated_sync",A.GROUP_AT_TIPS="group_at_tips",A.USER_STATUS_UPDATE="user_status_update",A.FRIEND_LIST_MODIFIED="friend_list_modified",A.PROFILE_MODIFIED="profile_modified",A.CONV_MODIFIED="conversation_modified",A.GROUP_TIPS_NOTIFICATION="group_tips_notification",A.GROUP_MESSAGE_READ_RECEIPT="group_message_read_receipt",A.GROUP_MESSAGE_READ_SYNC="group_message_read_sync",A.GROUP_SYSTEM_NOTIFICATION="group_system_notification",A.C2C_MESSAGE_PEER_READ="c2c_message_peer_read",A.C2C_MESSAGE_READ_SYNC="c2c_message_read_sync",A.C2C_REMIND_TYPE_SYNC="c2c_remind_type_sync",A.FOLLOW_LIST_UPDATED="follow_list_updated",A.MESSAGE_EXTENSIONS_UPDATED="message_extensions_updated",A.ALL_MESSAGE_READ="all_message_read",A.CONVERSATION_MARK_UPDATED="conversation_mark_updated",A.CONVERSATION_GROUP_ADD="conversation_group_add",A.CONVERSATION_GROUP_DELETED="conversation_group_deleted",A.CONVERSATION_GROUP_UPDATED="conversation_group_updated",A.ALL_RECEIVE_MESSAGE_OPTION="all_receive_message_option",A.TOPIC_AT_TIPS="topic_at_tips",A.TOPIC_TIPS_NOTIFICATION="topic_tips_notification",A.TOPIC_SYSTEM_NOTIFICATION="topic_system_notification",A.TOPIC_MESSAGE_READ_SYNC="topic_message_read_sync",A.TOPIC_LATEST_MESSAGE="topic_latest_message",A.GROUP_MESSAGE_PINNED="group_message_pinned"}(mA||(mA={}));const vA=[16,17];function wA(A){var e;const t=[];return null===(e=null==A?void 0:A.GroupTips)||void 0===e||e.forEach(A=>{var e;2===A.GroupInfo.MillionGroupFlag?t.push(mA.TOPIC_TIPS_NOTIFICATION):vA.includes(null===(e=null==A?void 0:A.MsgBody)||void 0===e?void 0:e.OpType)?t.push(mA.GROUP_MESSAGE_PINNED):t.push(mA.GROUP_TIPS_NOTIFICATION)}),t}const SA=[{conditions:[{type:"event",value:100}],subType:mA.BUSINESS_COMMAND},{conditions:[{type:"event",value:24}],subType:mA.ALL_RECEIVE_MESSAGE_OPTION},{conditions:[{type:"event",value:26}],subType:mA.TOPIC_LATEST_MESSAGE},{conditions:[{type:"hasKey",value:"C2cMsgArray"}],subType:mA.C2C_REALTIME_MESSAGE},{conditions:[{type:"hasKey",value:"C2cMsgModNotifys"}],subType:mA.C2C_MESSAGE_MODIFIED},{conditions:[{type:"hasKey",value:"ProfileDataMod"}],subType:mA.PROFILE_MODIFIED},{conditions:[{type:"hasKey",value:"UserStatusList"}],subType:mA.USER_STATUS_UPDATE},{conditions:[{type:"hasKey",value:"FriendListMod"}],subType:mA.FRIEND_LIST_MODIFIED},{conditions:[{type:"hasKey",value:"GroupMsgArray"}],subType:mA.GROUP_REALTIME_MESSAGE},{conditions:[{type:"hasKey",value:"GroupMsgModNotifys"}],subType:mA.GROUP_MESSAGE_MODIFIED},{conditions:[{type:"hasKey",value:"C2cNotifyMsgArray"}],subTypeParser:function(A){var e;const t=[];return null===(e=null==A?void 0:A.C2cNotifyMsgArray)||void 0===e||e.forEach(A=>{A.WithdrawC2cMsgNotify&&t.push(mA.C2C_REVOKED_MESSAGE),A.C2cReadedReceipt&&t.push(mA.C2C_MESSAGE_PEER_READ),A.ReadC2cMsgNotify&&t.push(mA.C2C_MESSAGE_READ_SYNC),A.MuteNotificationsSync&&t.push(mA.C2C_REMIND_TYPE_SYNC)}),t}},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:4}],subTypeParser:wA},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:5}],subTypeParser:function(A){var e;const t=[];return null===(e=null==A?void 0:A.GroupTips)||void 0===e||e.forEach(A=>{Array.isArray(A.MsgBody.GroupWithdrawInfoArray)?t.push(mA.GROUP_MESSAGE_REVOKED):Array.isArray(A.MsgBody.GroupMsgReceiptList)?t.push(mA.GROUP_MESSAGE_READ_RECEIPT):Array.isArray(A.MsgBody.GroupReadInfoArray)?A.MsgBody.GroupReadInfoArray[0].TopicId?t.push(mA.TOPIC_MESSAGE_READ_SYNC):t.push(mA.GROUP_MESSAGE_READ_SYNC):2===A.GroupInfo.MillionGroupFlag?t.push(mA.TOPIC_SYSTEM_NOTIFICATION):t.push(mA.GROUP_SYSTEM_NOTIFICATION)}),t}},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:6}],subTypeParser:wA},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:12}],subTypeParser:function(A){var e;const t=[];return null===(e=null==A?void 0:A.GroupTips)||void 0===e||e.forEach(A=>{const{GroupAtTips:{TopicId:e}}=A;e?t.push(mA.TOPIC_AT_TIPS):t.push(mA.GROUP_AT_TIPS)}),t}},{conditions:[{type:"hasKey",value:"RecentContactMod"}],subTypeParser:function(A){var e;const t=[];return null===(e=null==A?void 0:A.RecentContactMod)||void 0===e||e.forEach(A=>{switch(A.PushType){case m.CONV_MARK_UPDATED:t.push(mA.CONVERSATION_MARK_UPDATED);break;case m.CONV_GROUP_ADDED:t.push(mA.CONVERSATION_GROUP_ADD);break;case m.CONV_GROUP_DELETED:t.push(mA.CONVERSATION_GROUP_DELETED);break;case m.CONV_GROUP_UPDATED:t.push(mA.CONVERSATION_GROUP_UPDATED);break;default:t.push(mA.CONV_MODIFIED)}}),t}},{conditions:[{type:"hasKey",value:"MsgReactionNotifyList"}],subType:mA.MESSAGE_REACTION_UPDATED},{conditions:[{type:"hasKey",value:"MsgReactionNotify"}],subType:mA.MESSAGE_REACTION_UPDATED_SYNC},{conditions:[{type:"hasKey",value:"C2cMsgInfo"}],subType:mA.C2C_MESSAGE_READ_RECEIPT},{conditions:[{type:"hasKey",value:"FollowChangeList"}],subType:mA.FOLLOW_LIST_UPDATED},{conditions:[{type:"hasKey",value:"MsgExtensionNotify"}],subType:mA.MESSAGE_EXTENSIONS_UPDATED},{conditions:[{type:"hasKey",value:"C2CReadAllMsg"}],subType:mA.ALL_MESSAGE_READ}];var MA;function RA(A){var e;const t=Array.isArray(null===(e=null==A?void 0:A.body)||void 0===e?void 0:e.EventArray)?A.body.EventArray:[],i=[];return t.forEach(e=>{e.Flag=A.body.Flag;const t=SA.find(A=>A.conditions.every(A=>{switch(A.type){case"event":return e.Event===A.value;case"hasKey":return Object.prototype.hasOwnProperty.call(e,A.value);default:return!1}}));if(!t)return null;let o=[];"function"==typeof t.subTypeParser?o=t.subTypeParser(e):t.subType&&(o=t.subType),Array.isArray(o)?o.forEach(A=>{i.push({type:`${MA.SERVER_PUSH_MESSAGE}:${A}`,data:e})}):i.push({type:`${MA.SERVER_PUSH_MESSAGE}:${o}`,data:e})}),i}!function(A){A.SERVER_PUSH_MESSAGE="im_open_push.msg_push",A.SERVER_PUSH_MESSAGE_MULTIPLE="im_open_push.multi_msg_push_ws",A.ERROR="error"}(MA||(MA={}));const _A={[MA.SERVER_PUSH_MESSAGE]:RA,[MA.SERVER_PUSH_MESSAGE_MULTIPLE]:RA,[MA.ERROR]:function(A){const{errorCode:e}=A;return[{type:`error:${e}`,data:A}]}},TA=new class{constructor(){this._outerEventEmitter=null,this._innerEventEmitter=null,this._filteredCallbackMap=new Map,this._outerEventEmitter=new DA,this._innerEventEmitter=new DA,this.InnerEventSubType=mA}subscribeInnerEvent(A,e,t,i,o){var n;let r,s,a,g;["string","number"].includes(typeof e)?(a=`${A}:${e}`,g=t,s=i,r=o):(a=A,g=e,s=t,r="function"==typeof i?i:void 0),r?this._subscribeWithFilter(a,g,s,r):null===(n=this._innerEventEmitter)||void 0===n||n.on(a,g,s)}emitInnerEvent(A,e){var t,i;if(null===(t=this._innerEventEmitter)||void 0===t||t.emit(A,e),Object.keys(_A).includes(A)){const t=null===(i=_A[A])||void 0===i?void 0:i.call(_A,e);null==t||t.forEach(A=>{var e;A&&(null===(e=this._innerEventEmitter)||void 0===e||e.emit(A.type,A.data))})}}subscribeOuterEvent(A,e,t){var i;null===(i=this._outerEventEmitter)||void 0===i||i.on(A,e,t)}unSubscribeOuterEvent(A,e,t){var i;null===(i=this._outerEventEmitter)||void 0===i||i.off(A,e,t)}unSubscribeInnerEvent(A,e,t,i){if(["string","number"].includes(typeof e)){const o=t,n=`${A}:${e}`;this._unsubscribeEvent(n,o,i)}else{const i=e;this._unsubscribeEvent(A,i,t)}}emitOuterEvent(A,e){var t;null===(t=this._outerEventEmitter)||void 0===t||t.emit(A,e)}getOuterEventEmitter(){return this._outerEventEmitter}rest(){this._outerEventEmitter=null,this._innerEventEmitter=null}_subscribeWithFilter(A,e,t,i){var o;const n=A=>{i.call(t,A)&&e.call(t,A)};this._filteredCallbackMap.has(A)||this._filteredCallbackMap.set(A,[]),this._filteredCallbackMap.get(A).push({originalCallback:e,filteredCallback:n,filter:i,context:t}),null===(o=this._innerEventEmitter)||void 0===o||o.on(A,n,t)}_unsubscribeEvent(A,e,t){var i,o;const n=this._filteredCallbackMap.get(A);if(n){const o=n.findIndex(A=>A.originalCallback===e&&A.context===t);if(-1!==o){const{filteredCallback:e}=n[o];return null===(i=this._innerEventEmitter)||void 0===i||i.off(A,e,t),n.splice(o,1),void(0===n.length&&this._filteredCallbackMap.delete(A))}}null===(o=this._innerEventEmitter)||void 0===o||o.off(A,e,t)}};class NA{constructor(){this._socket=null}connectSocket(A){return this._socket=new WebSocket(A),this._socket}send(A){var e,t;try{null===(e=this._socket)||void 0===e||e.send(A)}catch(i){null===(t=this._onSendFail)||void 0===t||t.call(this,i)}}bindSocketHandlers(A){const{onOpen:e,onMessage:t,onClose:i,onError:o,onSendFail:n}=A;this._socket&&(this._socket.binaryType="arraybuffer",this._socket.onopen=e,this._socket.onmessage=t,this._socket.onclose=i,this._socket.onerror=o,this._onSendFail=n)}unbindSocketHandlers(){this._socket&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null)}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}class bA{connectSocket(A){return this._socket=P.connectSocket({url:A,header:{"content-type":"application/json"},complete:()=>{}}),this._socket}send(A){var e;null===(e=this._socket)||void 0===e||e.send({data:A,fail:this._onSendFail})}bindSocketHandlers(A){const{onOpen:e,onMessage:t,onClose:i,onError:o,onSendFail:n}=A;this._socket.onClose(i),this._socket.onOpen(e),this._socket.onMessage(t),this._socket.onError(o),this._onSendFail=n}unbindSocketHandlers(){this._socket&&(this._socket.onClose(()=>{}),this._socket.onOpen(()=>{}),this._socket.onMessage(()=>{}),this._socket.onError(()=>{}))}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}const GA="CONNECT",kA="SEND",LA="DISCONNECT",UA="OPEN",FA="MESSAGE",OA="CLOSE",xA="ERROR",PA="SEND_FAIL";class YA{constructor(){this._worker=null,this._blobUrl=null}connectSocket(A){const e=new Blob(["\n let _socket = null;\n\n self.onmessage = (event) => {\n const { type, url, data } = event.data;\n\n switch (type) {\n case 'CONNECT':\n connectSocket(url);\n break;\n case 'SEND':\n send(data);\n break;\n case 'DISCONNECT':\n disconnect();\n break;\n }\n };\n\n function connectSocket(url) {\n _socket = new WebSocket(url);\n _socket.binaryType = 'arraybuffer';\n bindSocketHandlers();\n return _socket;\n }\n\n function send(packet) {\n try {\n _socket?.send(packet);\n } catch (error) {\n self.postMessage({\n type: 'SEND_FAIL', \n error: {\n message: error.message,\n name: error.name,\n },\n });\n }\n }\n\n function bindSocketHandlers() {\n if (_socket) {\n _socket.onopen = (event) => {\n self.postMessage({\n type: 'OPEN',\n data: {\n type: event.type,\n timeStamp: event.timeStamp,\n },\n });\n };\n\n _socket.onmessage = (event) => {\n self.postMessage({ \n type: 'MESSAGE',\n data: event.data,\n });\n };\n\n _socket.onclose = (event) => {\n self.postMessage({ \n type: 'CLOSE', \n data: { \n code: event.code,\n reason: event.reason,\n timeStamp: event.timeStamp,\n },\n });\n };\n\n _socket.onerror = (error) => {\n self.postMessage({\n type: 'ERROR',\n data: {\n message: error.message,\n name: error.name\n },\n });\n };\n }\n }\n\n function unbindSocketHandlers() {\n if (_socket) {\n _socket.onopen = null;\n _socket.onmessage = null;\n _socket.onclose = null;\n _socket.onerror = null;\n }\n }\n\n function disconnect() {\n if (_socket) {\n _socket.close();\n _socket = null;\n }\n }\n"],{type:"application/javascript"});this._worker=new Worker(URL.createObjectURL(e)),this._worker.postMessage({type:GA,url:A})}send(A){var e,t;try{null===(e=this._worker)||void 0===e||e.postMessage({type:kA,data:A})}catch(i){null===(t=this._onSendFail)||void 0===t||t.call(this,i)}}bindSocketHandlers(A){const{onOpen:e,onMessage:t,onClose:i,onError:o,onSendFail:n}=A;if(this._worker){const A={[UA]:e,[FA]:t,[OA]:i,[xA]:o,[PA]:n};this._onSendFail=n,this._worker.onmessage=e=>{var t;const{type:i}=(null==e?void 0:e.data)||{};"function"==typeof A[i]&&(null===(t=A[i])||void 0===t||t.call(A,null==e?void 0:e.data))}}}unbindSocketHandlers(){this._worker&&(this._worker.onmessage=null)}disconnect(){this._worker&&(this._worker.postMessage({type:LA}),this._worker.terminate(),this._worker=null),this._blobUrl&&(URL.revokeObjectURL(this._blobUrl),this._blobUrl=null)}}var JA,HA=new class{constructor(){this._store=new Map}get(A){return this._store.get(A)}getStorage(A){return L?T?my.getStorageSync({key:A}).data:P.getStorageSync(A):this._canUseLocalStorage()?localStorage.getItem(A):{}}set(A,e){const t=this._store.get(A)||{};e instanceof Map?this._store.set(A,e):this._store.set(A,Object.assign(Object.assign({},t),e))}setStorage(A,e){L?T?my.setStorageSync({key:A,data:JSON.stringify(e)}):P.setStorageSync(A,JSON.stringify(e)):this._canUseLocalStorage()&&localStorage.setItem(A,JSON.stringify(e))}clear(A){"string"==typeof A?this._store.set(A,{}):this._store.clear()}clearLocalStorage(A){this._canUseLocalStorage()&&("string"==typeof A?localStorage.setItem(A,""):localStorage.clear())}reset(){this.clear()}_canUseLocalStorage(){return"undefined"!=typeof window&&navigator&&navigator.cookieEnabled&&localStorage}};!function(A){A[A.CONNECTED=0]="CONNECTED",A[A.CONNECTING=1]="CONNECTING",A[A.DISCONNECTED=2]="DISCONNECTED"}(JA||(JA={}));class qA{constructor(A){this._url="",this._readyState=JA.DISCONNECTED,this._url=A,this._id=a(),this._emitter=new DA,v||b||R?this._socket=new bA:this._canUseWebWorker()?this._socket=new YA:this._socket=new NA,this.connect()}connect(){this.doOpen(),this._bindSocketHandlers()}doOpen(){[JA.CONNECTED,JA.CONNECTING].includes(this._readyState)||(this._readyState=JA.CONNECTING,this._ws=this._socket.connectSocket(this._url))}send(A){this._readyState!==JA.CONNECTED?this.reconnect():this._socket.send(A)}reconnect(){[JA.CONNECTED,JA.CONNECTING].includes(this._readyState)||(this.disconnect(),this.doOpen())}getId(){return this._id}on(A,e,t){this._emitter.on(A,e,t)}off(A,e,t){this._emitter.off(A,e,t)}isConnected(){return this._readyState===JA.CONNECTED}disconnect(){this._readyState=JA.DISCONNECTED,this._unbindSocketHandlers(),this._socket.disconnect()}_onOpen(A){this._readyState===JA.CONNECTING&&(this._readyState=JA.CONNECTED,this._emitter.emit("connect",{socketId:this._id,event:A}))}_onMessage(A){this._emitter.emit("message",A)}_onClose(A){this._readyState=JA.DISCONNECTED,this._emitter.emit("close",{socketId:this._id,event:A})}_onError(A){this._readyState=JA.DISCONNECTED,this._emitter.emit("error",{socketId:this._id,error:A})}_onSendFail(A){this._readyState=JA.DISCONNECTED,this._emitter.emit("sendFail",{socketId:this._id,error:A})}_bindSocketHandlers(){this._socket.bindSocketHandlers({onOpen:this._onOpen.bind(this),onMessage:this._onMessage.bind(this),onClose:this._onClose.bind(this),onError:this._onError.bind(this),onSendFail:this._onSendFail.bind(this)})}_unbindSocketHandlers(){this._socket.unbindSocketHandlers()}_canUseWebWorker(){const e=HA.get("cloudConfig")||{};return(A(e.isWorkerEnabled)||"1"===e.isWorkerEnabled)&&rA}}const VA="CHINA",jA="OVERSEA",KA="SINGAPORE",WA="KOREA",zA="GERMANY",ZA="IND",XA="JPN",$A="USA",Ae="INDONESIA",ee={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{INITIAL:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",BACKUP_WEB_ONLY:"wss://*w4c.my-cpaas.com",BACKUP_CN:"wss://wss.im.tencent.cn",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{INITIAL:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4c.my-cpaas.com",BACKUP_CN:"wss://wss.im.tencent.cn",STAT:"https://api.my-imcloud.com"},SINGAPORE:{INITIAL:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4s.my-cpaas.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{INITIAL:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4k.my-cpaas.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{INITIAL:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4g.my-cpaas.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{INITIAL:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",BACKUP_WEB_ONLY:"wss://*w4i.my-cpaas.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{INITIAL:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4j.my-cpaas.com",STAT:"https://apijpn.my-imcloud.com",ANYCAST:"wss://162.14.13.254"},USA:{INITIAL:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4u.my-cpaas.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{INITIAL:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4y.my-cpaas.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},te={[KA]:[[2e7,3e7],[172e7,173e7]],[WA]:[[3e7,4e7],[173e7,174e7]],[zA]:[[4e7,5e7],[174e7,175e7]],[ZA]:[[5e7,6e7],[175e7,176e7]],[XA]:[[6e7,7e7],[176e7,177e7]],[$A]:[[7e7,8e7],[177e7,178e7]],[Ae]:[[8e7,9e7],[178e7,179e7]]};function ie(A){var e;if(null===(e=HA.get("instance"))||void 0===e?void 0:e.oversea)return jA;for(const t of Object.keys(te))for(const[e,i]of te[t])if(A>=e&&A`${A}=${c[A]}`).join("&"));var c;return t?`${A}/binfo?${g}&compress=gzip`:`${A}/info?${g}`}function ge(A){const e=HA.get("instance"),{sdkAppId:t,testEnv:i}=e,o=ie(t);if(i)return ae(ee.TEST[o].DEFAULT,{isBinary:A});const n=ee.PRODUCTION[o],r=x&&n.ANYCAST,s=x,a=!!n.BACKUP_CN;return ae({[oe.INITIAL]:()=>(re=oe.DEFAULT,n.DEFAULT),[oe.DEFAULT]:()=>(re=oe.IPV6,n.IPV6),[oe.IPV6]:()=>(re=oe.BACKUP,n.BACKUP),[oe.BACKUP]:()=>s?(re=oe.BACKUP_WEB_ONLY,function(A){const e=Math.floor(10001*Math.random())+1e4;return A.replace("*",String(e))}(n.BACKUP_WEB_ONLY)):a?(re=oe.BACKUP_CN,n.BACKUP_CN):r?(re=oe.ANYCAST,n.ANYCAST):n.DEFAULT,[oe.BACKUP_WEB_ONLY]:()=>a?(re=oe.BACKUP_CN,n.BACKUP_CN):r?(re=oe.ANYCAST,n.ANYCAST):n.DEFAULT,[oe.BACKUP_CN]:()=>(re=r?oe.ANYCAST:oe.DEFAULT,n[re]),[oe.ANYCAST]:()=>(re=oe.DEFAULT,n.ANYCAST="",n.DEFAULT)}[re](),{isBinary:A})}var ce=new class{constructor(){this._timeOffsetWithServer=0}getServerTimeMs(){return Date.now()+this._timeOffsetWithServer}getServerTimeSeconds(){return Math.floor(this.getServerTimeMs()/1e3)}getTimeOffsetWithServer(){return this._timeOffsetWithServer}calculateTimeOffsetWithServer(A,e){const t=Date.now(),i=t-A;this._timeOffsetWithServer=e+i-t}};const le=16;var Ie=new class{constructor(){this._tasks=[],this._timer=null,this._taskMap=new Map}_addTaskToScheduler(A){const{id:e}=A;this.removeTask(e),this._tasks.push(A),this._taskMap.set(e,A),this._sort(),this._scheduleNextTask()}_createTask(A){const{id:e,callback:t,context:i,isOnce:o=!1,intervalMs:n=le}=A,r=Math.max(n,le);return{id:e,nextExecuteTime:Date.now()+r,intervalMs:n,callback:t,context:i,isOnce:o}}addTask(A){const e=this._createTask(A);this._addTaskToScheduler(e)}addOnceTask(A){const e=this._createTask(Object.assign(Object.assign({},A),{isOnce:!0}));this._addTaskToScheduler(e)}removeTask(A){const e=this._tasks.findIndex(e=>e.id===A);e>-1&&(this._tasks.splice(e,1),this._taskMap.delete(A),this._scheduleNextTask())}updateTaskInterval(A,e){const t=this._taskMap.get(A);t&&(t.intervalMs=e,t.nextExecuteTime=Date.now()+e,this._sort(),this._scheduleNextTask())}clearAllTasks(){this._tasks=[],this._taskMap.clear(),this._timer&&(clearTimeout(this._timer),this._timer=null)}dispose(){this.clearAllTasks()}_sort(){this._tasks.sort((A,e)=>A.nextExecuteTime-e.nextExecuteTime)}_scheduleNextTask(){this._timer&&(clearTimeout(this._timer),this._timer=null);const A=this._tasks[0];if(A){const e=Math.max(0,A.nextExecuteTime-Date.now());this._timer=setTimeout(()=>this._execute(),e)}}_execute(){const A=Date.now();for(;this._tasks.length&&this._tasks[0].nextExecuteTime<=A;){const t=this._tasks[0];try{t.context?t.callback.call(t.context):t.callback(),t.isOnce?this.removeTask(t.id):(t.nextExecuteTime=A+t.intervalMs,this._sort())}catch(e){console.warn(`Task ${t.id} execution failed:`,e),t.isOnce&&this.removeTask(t.id)}}this._scheduleNextTask()}};function ue(A){const e=[];for(let t=0;t =55296&&i<=56319){const o=A.charCodeAt(++t)-56320+(i-55296<<10)+65536;e.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}else i<=127?e.push(i):i<=2047?e.push(192|i>>6,128|63&i):e.push(224|i>>12,128|i>>6&63,128|63&i)}return new Uint8Array(e)}function Ee(A){const e=Array.isArray(A)?[]:Object.create(null);for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&r(t)&&null!=A[t]&&(null===A[t]||"object"!=typeof A[t]?e[t]=A[t]:e[t]=Ee(A[t]));return e}function de(A,e){if(I.includes(A))return 0;const t=ue(JSON.stringify(e));let i=4294967295;const{length:o}=t;for(let n=0;n >>=1:i=i>>>1^3988292384}return(4294967295^i)>>>0}function he(A){const{servcmd:e,data:t}=A,i=function(A){const e=HA.get("login")||{},t=HA.get("instance")||{};return{servcmd:A,ver:"v4",platform:H,websdkappid:537048168,websdkversion:"1.7.3",a2:e.a2Key||void 0,tinyid:e.tinyID||void 0,status_instid:e.statusInstanceId||0,sdkappid:t.sdkAppId,contenttype:"json",reqtime:Math.floor(Date.now()/1e3),identifier:e.a2Key?void 0:e.userId,usersig:e.a2Key?void 0:e.userSig,sdkability:75689843,sdkability_ext:c(""),cappid:t.applicationID||0,tjgID:"",seq:Qe(),cs:0}}(e),o=Ee(t);return i.cs=de(e,o),{head:i,body:o}}function Ce(A){const{servcmd:e,data:t}=A,i=function(A){const e=HA.get("login")||{},t=HA.get("instance")||{};return{servcmd:A,ver:"v4",platform:H,websdkappid:537048168,websdkversion:"1.7.3",sdkappid:t.sdkAppId,contenttype:"",reqtime:Math.floor(Date.now()/1e3),identifier:"",usersig:"",status_instid:e.statusInstanceId||0,sdkability:75689843,sdkability_ext:c(""),cappid:t.applicationID||0,seq:Qe(),cs:0}}(e),o=Ee(t);return i.cs=de(e,o),{head:i,body:o}}let Be=a();function Qe(){return Be=Be<2415919103?Be+1:a(),Be}function pe(){var A;const e=HA.get("login")||{},t=HA.get("instance")||{};return{sdk_type:30,sdk_app_id:t.sdkAppId,sdk_version:"1.6.6",tiny_id:Number(e.tinyID),user_id:e.userId||(null===(A=HA.get("webPush"))||void 0===A?void 0:A.userId),platform:H,instance_id:t.instanceId,trace_id:(new Date).getTime()}}var fe,me=Object.freeze({__proto__:null,calcBodyCRC:de,filterProtocolDataInvalidFields:Ee,generateCosSpecifiedData:function(A){const{servcmd:e,data:t}=A,i=function(A){const e=HA.get("login")||{},t=HA.get("instance")||{};return{servcmd:A,ver:"v4",platform:H,websdkappid:537048168,websdkversion:"1.7.3",sdkappid:t.sdkAppId,contenttype:"json",reqtime:Math.floor(Date.now()/1e3),identifier:e.userId,usersig:e.userSig,status_instid:e.statusInstanceId||0,sdkability:75689843,sdkability_ext:c(""),cappid:t.applicationID||0,seq:Qe(),cs:0}}(e),o=Ee(t);return i.cs=de(e,o),{head:i,body:o}},generateProtocolData:he,generateSSOLogProtocolData:Ce,generateSequence:Qe,getCommonHead:pe,taskScheduler:Ie,timeManager:ce});!function(A){A[A.info=4]="info",A[A.warning=5]="warning",A[A.error=6]="error"}(fe||(fe={}));const ye={method:"extension",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",uiPlatform:"ui_platform",timestamp:"timestamp"};class De{constructor(A){this.level=fe.info,this._canSendLog=!0,this._logCreatedAt=ce.getServerTimeMs(),this.timestamp=0,this.networkType=8,this.code=0,this.moreMessage="",this.method="",this.message="",this.costTime=0,this.duplicate=!1,this.eventType=0,this.uiPlatform=this._getUiPlatform(),this._sdkEdition=this._getSDKEdition();const{method:e,eventType:t=0,message:i="",costTime:o=0,error:n,moreMessage:r="",code:s=0}=A||{};this.eventType=t,this.method=e,this.message=i,this.costTime=o,this.moreMessage=r,this.code=s,n&&this.setError(n)}setMoreMessage(A){this.moreMessage=`${this.moreMessage} ${A}`}updateLogCreatedAtByTimeOffset(){this._logCreatedAt+=ce.getTimeOffsetWithServer()}end(A=!1){this._canSendLog&&(this._canSendLog=!1,this.timestamp=ce.getServerTimeMs(),this._ssoLogModule.pushToLogQueue(this._convertSSOLogDataKeyToServe()),A&&this._ssoLogModule.uploadSSOLogData())}setError(A){var e;return A instanceof Error?this._canSendLog?((null===(e=HA.get("netWorkMonitor"))||void 0===e?void 0:e.isNetworkOnline)&&(A.errorCode&&(this.code=A.errorCode),A.errorMessage&&this.setMoreMessage(A.errorMessage)),this.level=fe.error,this):this:(console.warn("SSOLogData.setError value not instanceof Error, please check!"),this)}setLogInfo(A){return Object.keys(A).forEach(e=>{Object.keys(ye).includes(e)&&(this[e]=A[e])}),this}setSSOLogModule(A){this._ssoLogModule=A}_convertSSOLogDataKeyToServe(){const A={};return Object.keys(this).forEach(e=>{const t=e;ye[t]&&(A[ye[t]]=this[t])}),A}_getUiPlatform(){var A;const e=null===(A=HA.get("instance"))||void 0===A?void 0:A.scene;if("string"==typeof e){const A=Number(e);return isNaN(A)?void 0:A}}_getSDKEdition(){var A;return null===(A=HA.get("instance"))||void 0===A?void 0:A.sdkEdition}}var ve;!function(A){A.RECONNECTED="reconnected",A.CLOUD_CONFIG_UPDATE="cloud_config_update",A.SOCKET_DISCONNECTED="socket_disconnected"}(ve||(ve={}));var we=ve;const Se=20,Me=6e4,Re=[4,5,6],_e=[],Te=[],Ne="report-logger";var be=new class{constructor(){this._sdkAppIdBlackList=[],this._tinyIdWhiteList=[],this._reportLevel=[4,5,6],this._minThreshold=Se,this._maxThreshold=100,this._waitingTime=Me,this._lastReportAt=Date.now(),this._ssoLogMap=new Map,this._logLevel=u.DEBUG,this._throttleConfig={global:{throttleTime:p,maxCount:f},single:{throttleTime:B,maxCount:Q}},this._globalThrottle={count:0,startTime:Date.now()},this._singleThrottleMap=new Map,TA.subscribeInnerEvent(we.CLOUD_CONFIG_UPDATE,this._handleCloudConfigUpdate,this),Ie.addTask({id:Ne,intervalMs:1e3,callback:this._checkAndReportIfDue,context:this}),this._logQueue=[],this._savePlatFormInfo()}_handleCloudConfigUpdate(A){const{evt_rpt_threshold:e=Se,evt_rpt_waiting:t=Me,evt_rpt_level:i=Re,evt_rpt_sdkappid_bl:o=_e,evt_rpt_tinyid_wl:n=Te,evt_rpt_global_throttle_time:r=p,evt_rpt_global_throttle_count:s=f,evt_rpt_single_throttle_time:a=B,evt_rpt_single_throttle_count:g=Q}=A||{};this._sdkAppIdBlackList=o,this._waitingTime=t,this._minThreshold=e,this._reportLevel=i,this._tinyIdWhiteList=n,this._throttleConfig={global:{throttleTime:r,maxCount:s},single:{throttleTime:a,maxCount:g}}}createSSOLogData(A){const e=new De(A);return e.setSSOLogModule(this),this._ssoLogMap.set(A.method,e),e}getSSOLogData(A){return this._ssoLogMap.get(A)||{}}pushToLogQueue(A){A&&(this._logQueue.push(A),this._shouldUploadImmediately()&&this.uploadSSOLogData())}setLogLevel(A){[u.DEBUG,u.ERROR,u.INFO,u.NONE,u.WARN].includes(A)&&(this._logLevel=A)}debug(A,e="",t){this._log(u.DEBUG,A,e,t)}info(A,e="",t){this._log(u.INFO,A,e,t)}warn(A,e="",t){this._log(u.WARN,A,e,t)}error(A,e="",t){this._log(u.ERROR,A,e,t)}_shouldUploadImmediately(){return this._logQueue.length>=this._minThreshold}_isReportDue(){return Date.now()>=this._lastReportAt+this._waitingTime}_checkAndReportIfDue(){this._isReportDue()&&this._logQueue.length>0&&this.uploadSSOLogData()}uploadSSOLogData(){return IA(this,void 0,void 0,function*(){if(0===this._logQueue.length)return;const A=this._logQueue.slice(),e=this._filterLogs(A);if(this._logQueue=[],0===e.length)return void(this._lastReportAt=Date.now());const t={Header:pe(),Event:e};BA(t.Header.user_id)||(yield function(A){const e="imopenstat.tim_web_report_v2",t=Ce({servcmd:e,data:A}),i=`${t.head.seq}${e}`;$e.sendPacket(t,{requestId:i})}(t)),this._lastReportAt=Date.now()})}_savePlatFormInfo(){var A,e;if(v){const t=null===(e=null===(A=wx.getAccountInfoSync)||void 0===A?void 0:A.call(wx))||void 0===e?void 0:e.miniProgram;if(t){const{appId:A,envVersion:e}=t;HA.set("instance",{appId:A,envVersion:e})}}else x&&HA.set("instance",{href:window.location.href})}_filterLogs(A){const{tinyID:e}=HA.get("login")||{},{sdkAppId:t}=HA.get("instance")||{};return this._sdkAppIdBlackList.includes(t)&&!this._tinyIdWhiteList.includes(e)?[]:A.filter(A=>this._reportLevel.includes(A.level))}_checkThrottle(A){return!!this._checkGlobalThrottle()||this._checkSingleThrottle(A)}_checkGlobalThrottle(){const A=Date.now();if(A-this._globalThrottle.startTime>=this._throttleConfig.global.throttleTime)this._globalThrottle.count=1,this._globalThrottle.startTime=A;else if(this._globalThrottle.count++,this._globalThrottle.count>this._throttleConfig.global.maxCount)return!0;return!1}_checkSingleThrottle(A){const e=Date.now(),t=this._singleThrottleMap.get(A);return t?e-t.startTime>=this._throttleConfig.single.throttleTime?(t.count=1,t.startTime=e,!1):t.count>=this._throttleConfig.single.maxCount||(t.count++,!1):(this._singleThrottleMap.set(A,{count:1,startTime:e}),!1)}_shouldLog(A){return A>=this._logLevel&&this._logLevel!==u.NONE}_shouldReport(A){return this._reportLevel.includes(C[A])}_formatLog(A,e,t){const i=new Date,o=`${i.getHours()}:${i.getMinutes()}:${i.getSeconds()}:${i.getMilliseconds()}`,n=`<${u[A]}>`;return eA||L?[`${d} [${o}] ${n} [${e}] ${t}`]:["%c%s%c%s","background:#0abf5b; padding:1px; border-radius:3px; color: #fff",d,"",`[${o}] ${n} [${e}] ${t}`]}_log(A,e,t,i){if(!this._shouldLog(A))return;const o=this._formatLog(A,e,t);if(h[A].apply(console,o),this._shouldReport(A)){const A=this._getThrottleKey(e,t,i);this._checkThrottle(A)||this.createSSOLogData(Object.assign(Object.assign({message:t},i),{method:e})).end()}}_getThrottleKey(A,e,t){const i=`${A}${e}${pA(Object.assign(Object.assign({},t),{costTime:""}))}`,o=ue(JSON.stringify(i));let n=4294967295;const{length:r}=o;for(let s=0;s >>=1:n=n>>>1^3988292384}return""+((4294967295^n)>>>0)}reset(){console.log("SSO_LOG_MODULE.reset"),Ie.removeTask(Ne),TA.unSubscribeInnerEvent(we.CLOUD_CONFIG_UPDATE,this._handleCloudConfigUpdate,this),this._lastReportAt=0,this.uploadSSOLogData(),this._sdkAppIdBlackList=[],this._tinyIdWhiteList=[],this._minThreshold=Se,this._maxThreshold=100,this._waitingTime=Me,this._logQueue=[],this._logLevel=u.DEBUG,this._globalThrottle={count:0,startTime:Date.now()},this._singleThrottleMap.clear()}};const Ge=15e3,ke="Channel",Le="channel_schedule_task",Ue="channel_reconnect_task",Fe="connected",Oe="connecting",xe="disconnected",Pe=1e3,Ye="network_status_change",Je="activity_status_change",He="send_fail",qe="reconnect_failed",Ve="socket_error",je="socket_close";function Ke(A){return(Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A})(A)}function We(A){throw new Error('Could not dynamically require "'+A+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ze,Ze={exports:{}},Xe=(ze||(ze=1,function(A){A.exports=function A(e,t,i){function o(r,s){if(!t[r]){if(!e[r]){if(!s&&We)return We(r);if(n)return n(r,!0);var a=new Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}var g=t[r]={exports:{}};e[r][0].call(g.exports,function(A){return o(e[r][1][A]||A)},g,g.exports,A,e,t,i)}return t[r].exports}for(var n=We,r=0;r >>6:(t<65536?e[r++]=224|t>>>12:(e[r++]=240|t>>>18,e[r++]=128|t>>>12&63),e[r++]=128|t>>>6&63),e[r++]=128|63&t);return e},t.buf2binstring=function(A){return a(A,A.length)},t.binstring2buf=function(A){for(var e=new i.Buf8(A.length),t=0,o=e.length;t >10&1023,g[i++]=56320|1023&o)}return a(g,i)},t.utf8border=function(A,e){var t;for((e=e||A.length)>A.length&&(e=A.length),t=e-1;0<=t&&128==(192&A[t]);)t--;return t<0||0===t?e:t+r[A[t]]>e?t:e}},{"./common":1}],3:[function(A,e,t){e.exports=function(A,e,t,i){for(var o=65535&A,n=A>>>16&65535,r=0;0!==t;){for(t-=r=2e3 >>1:A>>>1;e[t]=A}return e}();e.exports=function(A,e,t,o){var n=i,r=o+t;A^=-1;for(var s=o;s >>8^n[255&(A^e[s])];return~A}},{}],6:[function(A,e,t){e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],7:[function(A,e,t){e.exports=function(A,e){var t,i,o,n,r,s,a,g,c,l,I,u,E,d,h,C,B,Q,p,f,m,y,D,v,w;t=A.state,i=A.next_in,v=A.input,o=i+(A.avail_in-5),n=A.next_out,w=A.output,r=n-(e-A.avail_out),s=n+(A.avail_out-257),a=t.dmax,g=t.wsize,c=t.whave,l=t.wnext,I=t.window,u=t.hold,E=t.bits,d=t.lencode,h=t.distcode,C=(1< >>=p=Q>>>24,E-=p,0==(p=Q>>>16&255))w[n++]=65535&Q;else{if(!(16&p)){if(!(64&p)){Q=d[(65535&Q)+(u&(1< >>=p,E-=p),E<15&&(u+=v[i++]<
>>=p=Q>>>24,E-=p,!(16&(p=Q>>>16&255))){if(!(64&p)){Q=h[(65535&Q)+(u&(1< >>=p,E-=p,(p=n-r)
>3,u&=(1<<(E-=f<<3))-1,A.next_in=i,A.next_out=n,A.avail_in=i >>24&255)+(A>>>8&65280)+((65280&A)<<8)+((255&A)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function C(A){var e;return A&&A.state?(e=A.state,A.total_in=A.total_out=e.total=0,A.msg="",e.wrap&&(A.adler=1&e.wrap),e.mode=I,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new i.Buf32(u),e.distcode=e.distdyn=new i.Buf32(E),e.sane=1,e.back=-1,c):l}function B(A){var e;return A&&A.state?((e=A.state).wsize=0,e.whave=0,e.wnext=0,C(A)):l}function Q(A,e){var t,i;return A&&A.state?(i=A.state,e<0?(t=0,e=-e):(t=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15 =r.wsize?(i.arraySet(r.window,e,t-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(o<(n=r.wsize-r.wnext)&&(n=o),i.arraySet(r.window,e,t-o,n,r.wnext),(o-=n)?(i.arraySet(r.window,e,t-o,o,0),r.wnext=o,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave >>8&255,t.check=n(t.check,x,2,0),f=p=0,t.mode=2;break}if(t.flags=0,t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&p)<<8)+(p>>8))%31){A.msg="incorrect header check",t.mode=30;break}if(8!=(15&p)){A.msg="unknown compression method",t.mode=30;break}if(f-=4,k=8+(15&(p>>>=4)),0===t.wbits)t.wbits=k;else if(k>t.wbits){A.msg="invalid window size",t.mode=30;break}t.dmax=1< >8&1),512&t.flags&&(x[0]=255&p,x[1]=p>>>8&255,t.check=n(t.check,x,2,0)),f=p=0,t.mode=3;case 3:for(;f<32;){if(0===B)break A;B--,p+=u[h++]< >>8&255,x[2]=p>>>16&255,x[3]=p>>>24&255,t.check=n(t.check,x,4,0)),f=p=0,t.mode=4;case 4:for(;f<16;){if(0===B)break A;B--,p+=u[h++]< >8),512&t.flags&&(x[0]=255&p,x[1]=p>>>8&255,t.check=n(t.check,x,2,0)),f=p=0,t.mode=5;case 5:if(1024&t.flags){for(;f<16;){if(0===B)break A;B--,p+=u[h++]< >>8&255,t.check=n(t.check,x,2,0)),f=p=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&(B<(w=t.length)&&(w=B),w&&(t.head&&(k=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),i.arraySet(t.head.extra,u,h,w,k)),512&t.flags&&(t.check=n(t.check,u,w,h)),B-=w,h+=w,t.length-=w),t.length))break A;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(0===B)break A;for(w=0;k=u[h+w++],t.head&&k&&t.length<65536&&(t.head.name+=String.fromCharCode(k)),k&&w>9&1,t.head.done=!0),A.adler=t.check=0,t.mode=12;break;case 10:for(;f<32;){if(0===B)break A;B--,p+=u[h++]< >>=7&f,f-=7&f,t.mode=27;break}for(;f<3;){if(0===B)break A;B--,p+=u[h++]< >>=1)){case 0:t.mode=14;break;case 1:if(D(t),t.mode=20,6!==e)break;p>>>=2,f-=2;break A;case 2:t.mode=17;break;case 3:A.msg="invalid block type",t.mode=30}p>>>=2,f-=2;break;case 14:for(p>>>=7&f,f-=7&f;f<32;){if(0===B)break A;B--,p+=u[h++]< >>16^65535)){A.msg="invalid stored block lengths",t.mode=30;break}if(t.length=65535&p,f=p=0,t.mode=15,6===e)break A;case 15:t.mode=16;case 16:if(w=t.length){if(B >>=5,f-=5,t.ndist=1+(31&p),p>>>=5,f-=5,t.ncode=4+(15&p),p>>>=4,f-=4,286 >>=3,f-=3}for(;t.have<19;)t.lens[P[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,U={bits:t.lenbits},L=s(0,t.lens,0,19,t.lencode,0,t.work,U),t.lenbits=U.bits,L){A.msg="invalid code lengths set",t.mode=30;break}t.have=0,t.mode=19;case 19:for(;t.have >>16&255,T=65535&O,!((R=O>>>24)<=f);){if(0===B)break A;B--,p+=u[h++]< >>=R,f-=R,t.lens[t.have++]=T;else{if(16===T){for(F=R+2;f >>=R,f-=R,0===t.have){A.msg="invalid bit length repeat",t.mode=30;break}k=t.lens[t.have-1],w=3+(3&p),p>>>=2,f-=2}else if(17===T){for(F=R+3;f >>=R)),p>>>=3,f-=3}else{for(F=R+7;f >>=R)),p>>>=7,f-=7}if(t.have+w>t.nlen+t.ndist){A.msg="invalid bit length repeat",t.mode=30;break}for(;w--;)t.lens[t.have++]=k}}if(30===t.mode)break;if(0===t.lens[256]){A.msg="invalid code -- missing end-of-block",t.mode=30;break}if(t.lenbits=9,U={bits:t.lenbits},L=s(a,t.lens,0,t.nlen,t.lencode,0,t.work,U),t.lenbits=U.bits,L){A.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,U={bits:t.distbits},L=s(g,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,U),t.distbits=U.bits,L){A.msg="invalid distances set",t.mode=30;break}if(t.mode=20,6===e)break A;case 20:t.mode=21;case 21:if(6<=B&&258<=Q){A.next_out=C,A.avail_out=Q,A.next_in=h,A.avail_in=B,t.hold=p,t.bits=f,r(A,y),C=A.next_out,E=A.output,Q=A.avail_out,h=A.next_in,u=A.input,B=A.avail_in,p=t.hold,f=t.bits,12===t.mode&&(t.back=-1);break}for(t.back=0;_=(O=t.lencode[p&(1< >>16&255,T=65535&O,!((R=O>>>24)<=f);){if(0===B)break A;B--,p+=u[h++]< >N)])>>>16&255,T=65535&O,!(N+(R=O>>>24)<=f);){if(0===B)break A;B--,p+=u[h++]< >>=N,f-=N,t.back+=N}if(p>>>=R,f-=R,t.back+=R,t.length=T,0===_){t.mode=26;break}if(32&_){t.back=-1,t.mode=12;break}if(64&_){A.msg="invalid literal/length code",t.mode=30;break}t.extra=15&_,t.mode=22;case 22:if(t.extra){for(F=t.extra;f >>=t.extra,f-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;_=(O=t.distcode[p&(1< >>16&255,T=65535&O,!((R=O>>>24)<=f);){if(0===B)break A;B--,p+=u[h++]< >N)])>>>16&255,T=65535&O,!(N+(R=O>>>24)<=f);){if(0===B)break A;B--,p+=u[h++]< >>=N,f-=N,t.back+=N}if(p>>>=R,f-=R,t.back+=R,64&_){A.msg="invalid distance code",t.mode=30;break}t.offset=T,t.extra=15&_,t.mode=24;case 24:if(t.extra){for(F=t.extra;f >>=t.extra,f-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){A.msg="invalid distance too far back",t.mode=30;break}t.mode=25;case 25:if(0===Q)break A;if(w=y-Q,t.offset>w){if((w=t.offset-w)>t.whave&&t.sane){A.msg="invalid distance too far back",t.mode=30;break}w>t.wnext?(w-=t.wnext,S=t.wsize-w):S=t.wnext-w,w>t.length&&(w=t.length),M=t.window}else M=E,S=C-t.offset,w=t.length;for(Q B?(p=U[F+l[D]],f=b[G+l[D]]):(p=96,f=0),u=1< >R)+(E-=u)]=Q<<24|p<<16|f,0!==E;);for(u=1< >=1;if(0!==u?(N&=u-1,N+=u):N=0,D++,0==--k[y]){if(y===w)break;y=e[t+l[D]]}if(S {const e=new Uint8Array(A).slice(4);let t;try{t=Xe.inflate(e,{to:"string"})}catch(i){console.error("inflate error",i)}return t})(A.data):function(A){const e=new Uint8Array(A);let t="",i=0;const{length:o}=e;for(;i 0)for(let t=0;t {var t;const{uplinkData:i,canResend:o,resolve:n,reject:r,timeout:s}=A;if(o){this._pendingRequests.set(e,{resolve:n,reject:r,timestamp:Date.now(),uplinkData:i,timeout:s,canResend:o});const A=this._isBinarySupported?ue(i).buffer:i;null===(t=this._socketAdapter)||void 0===t||t.send(A)}else this._pendingRequests.delete(e)})}_onConnect(A){const{socketId:e,event:t={}}=A||{};this._connectionId=e,this._connectionEstablishedTime=Date.now();const i=Date.now()-this._connectionStartTime,o=`${ke}.onConnect cost:${i} ms. socketID:${e} res:${JSON.stringify(t)}`;if(this._ssoLog({method:"onConnect",message:o}),this._checkPendingRequestsAndResend(),this._sendHeartbeatIfReady(),this._isReconnecting){const A=`${ke}.reconnect success`;this._ssoLog({method:"reconnectSuccess",message:A}),TA.emitInnerEvent(we.RECONNECTED),this._isReconnecting=!1}this._resetReconnectDelay(),this._handleConnectStateChange({state:Fe,shouldEmitEvent:!0,shouldAttemptReconnect:!1})}_sendAck(A){const e=he({servcmd:"openim.ws_msg_push_ack",data:{SessionData:A}});this.sendPacket(e)}_executeScheduledTaskIfReady(){return IA(this,void 0,void 0,function*(){this._clearTimeoutRequest(),this._sendHeartbeatIfReady()})}_canSendHeartbeat(){var A;return(null===(A=this._socketAdapter)||void 0===A?void 0:A.isConnected())&&Date.now()>=this._nextHeartbeatAt&&!this._isHeartbeatInProgress}_sendHeartbeat(){return IA(this,void 0,void 0,function*(){var A;const e=he({servcmd:"heartbeat.alive",data:{}});try{const A=`${e.head.seq}${e.head.servcmd}`;yield this.sendPacket(e,{requestId:A,timeout:3e3})}catch(t){const e=null===(A=HA.get("netWorkMonitor"))||void 0===A?void 0:A.isNetWorkOnline,i=`${ke}.sendHeartbeat failed. isNetWorkOnline:${e} error: ${t}`;this._ssoLog({method:"sendHeartbeatError",message:i}),this._handleConnectStateChange({state:xe,shouldEmitEvent:!0,shouldAttemptReconnect:!0})}})}_sendHeartbeatIfReady(){return IA(this,void 0,void 0,function*(){this._canSendHeartbeat()&&(this._isHeartbeatInProgress=!0,yield this._sendHeartbeat(),this._isHeartbeatInProgress=!1)})}_updateHeartbeatTime(){this._nextHeartbeatAt=b?Date.now()+5e3:Date.now()+1e4}_handleNetworkStatusChange(A){const e=`${ke}.networkStatusChange ${JSON.stringify(A)}`;this._ssoLog({method:"networkStatusChange",message:e});const{isNetworkOnline:t,networkType:i}=A;t&&"none"!==i?this._handleConnectStateChange({state:Fe,shouldEmitEvent:!1,shouldAttemptReconnect:!0,reason:Ye}):this._handleConnectStateChange({state:xe,shouldEmitEvent:!1,shouldAttemptReconnect:!0,reason:Ye})}isPrivateNetWork(){const A=HA.get("instance")||{};return A.proxyServer&&!A.fileDownloadProxy}_handleConnectStateChange(A){const{state:e,shouldAttemptReconnect:t,shouldEmitEvent:i,reason:o}=A,n=`${ke}._handleConnectStateChange currentConnectState: ${this._currentConnectState} shouldAttemptReconnect: ${t} shouldEmitEvent: ${i} reason: ${o}`;this._currentConnectState!==e&&(this._ssoLog({method:"handleConnectStateChange",message:n}),i&&(be.info("_handleConnectStateChange",` from ${this._currentConnectState} to ${e}`),TA.emitOuterEvent("netStateChange",{name:"netStateChange",data:{state:e}}),this._currentConnectState=e,e===xe&&TA.emitInnerEvent(we.SOCKET_DISCONNECTED)),t&&(this._resetReconnectDelay(),Ie.addTask({id:Ue,intervalMs:this._intendedDelay,callback:this._scheduleReconnectWithBackoff,context:this})))}_handleActivityStatusChange(A){var e,t;const i=null===(t=null===(e=this._socketAdapter)||void 0===e?void 0:e._ws)||void 0===t?void 0:t.readyState,o=`${ke}.activityStatusChange ${JSON.stringify(A)} readyState: ${i}`;be.debug("activityStatusChange",o),3===i&&this._handleConnectStateChange({state:xe,shouldEmitEvent:!0,shouldAttemptReconnect:!0,reason:Je})}_resetReconnectDelay(){var A;be.debug(`${ke}._resetReconnectDelay`),Ie.removeTask(Ue);const e=null===(A=HA.get("activityMonitor"))||void 0===A?void 0:A.isActive;this._intendedDelay=e?Pe:1e3}_scheduleReconnectWithBackoff(){var A;const e=null===(A=HA.get("activityMonitor"))||void 0===A?void 0:A.isActive;this._intendedDelay=e?Math.min(5e3,Math.max(Pe,1.5*this._intendedDelay)):Math.min(3e5,Math.max(1e3,1.5*this._intendedDelay));const t=(new Date).toTimeString().slice(0,8),i=`${ke}.scheduleReconnectWithBackoff timeStr: ${t} intendedDelay: ${this._intendedDelay}`;be.debug(i),this.reconnect(),Ie.updateTaskInterval(Ue,this._intendedDelay)}_ssoLog(A){const{method:e,message:t}=A;be.info(e,t)}_diagnose(){this.isPrivateNetWork()||(this._lastDiagnoseAt=Date.now(),function(A){IA(this,void 0,void 0,function*(){const e=A.split("/")[2];if(!e.startsWith("ws"))return;const t=`https://${e}/v3/netcheck/getconninfo?${A.slice(A.indexOf("info?")+5)}&reqtime=${Date.now()}`;try{yield CA({method:"GET",url:t,data:{}})}catch(i){be.warn("diagnoseBySSO",`diagnoseBySSO failed. error:${i.message}`)}})}(this._url),function(A){IA(this,void 0,void 0,function*(){const e=`https://boce-cdn.my-imcloud.com/v3/netcheck/getconninfo?${A.slice(A.indexOf("info?")+5)}&reqtime=${Date.now()}`;try{yield CA({method:"GET",url:e,data:{}})}catch(t){be.warn(`diagnoseByCDN', 'diagnoseByCDN failed. error:${t.message}`)}})}(this._url),this._beforeSendInterceptors=[])}_clearTimeoutRequest(){for(const[A,e]of this._pendingRequests.entries()){const{reject:t,timestamp:i,timeout:o}=e;Date.now()-i>=o&&(this._pendingRequests.delete(A),Date.now()-this._lastDiagnoseAt>=3e4&&this._diagnose(),t({errorCode:EA,errorInfo:"NETWORK_TIMEOUT",data:{requestId:A}}))}}_updateIsBinarySupported(){var A;if(null===(A=HA.get("instance"))||void 0===A?void 0:A.devMode)return void(this._isBinarySupported=!1);const e=cA();(T||v&&"windows"===e||b)&&(this._isBinarySupported=!1)}_isCompressedData(A){const e=new Uint8Array(A);return 67===e[0]&&79===e[1]&&77===e[2]&&80===e[3]}};const At={init:function(A){HA.set("instance",A),$e.init()},destroy:function(){$e.dispose(),HA.clear(),Ie.dispose()},notificationCenter:TA,channel:$e,store:HA,ssoLog:be,utils:yA,common:me,constants:y},et=A=>"function"==typeof A;function it(A,e,t){const i=t||[];if(!A||!e)return!1;const o=Object.keys(A).filter(A=>!i.includes(A)),n=Object.keys(e).filter(A=>!i.includes(A));return o.length===n.length&&o.every(i=>!!e.hasOwnProperty(i)&&("object"==typeof A[i]&&null!==A[i]?it(A[i],e[i],t):A[i]===e[i]))}var ot;!function(A){A.SDK_READY="sdkStateReady",A.SDK_NOT_READY="sdkStateNotReady",A.SDK_DESTROY="sdkDestroy",A.MESSAGE_RECEIVED="onMessageReceived",A.ROOM_CUSTOM_DATA_RECEIVED="onRoomCustomDataReceived",A.MESSAGE_MODIFIED="onMessageModified",A.MESSAGE_REVOKED="onMessageRevoked",A.MESSAGE_READ_BY_PEER="onMessageReadByPeer",A.MESSAGE_READ_RECEIPT_RECEIVED="onMessageReadReceiptReceived",A.MESSAGE_EXTENSIONS_UPDATED="onMessageExtensionsUpdated",A.MESSAGE_EXTENSIONS_DELETED="onMessageExtensionsDeleted",A.MESSAGE_REACTIONS_UPDATED="onMessageReactionsUpdated",A.CONVERSATION_LIST_UPDATED="onConversationListUpdated",A.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED="onTotalUnreadMessageCountUpdated",A.CONVERSATION_GROUP_LIST_UPDATED="onConversationGroupListUpdated",A.CONVERSATION_IN_GROUP_UPDATED="onConversationInGroupUpdated",A.GROUP_LIST_UPDATED="onGroupListUpdated",A.GROUP_ATTRIBUTES_UPDATED="groupAttributesUpdated",A.GROUP_COUNTER_UPDATED="onGroupCounterUpdated",A.TOPIC_CREATED="onTopicCreated",A.TOPIC_DELETED="onTopicDeleted",A.TOPIC_UPDATED="onTopicUpdated",A.PROFILE_UPDATED="onProfileUpdated",A.USER_STATUS_UPDATED="onUserStatusUpdated",A.BLACKLIST_UPDATED="blacklistUpdated",A.FRIEND_LIST_UPDATED="onFriendListUpdated",A.FRIEND_GROUP_LIST_UPDATED="onFriendGroupListUpdated",A.FRIEND_APPLICATION_LIST_UPDATED="onFriendApplicationListUpdated",A.MY_FOLLOWERS_LIST_UPDATED="onMyFollowersListUpdated",A.MY_FOLLOWING_LIST_UPDATED="onMyFollowingListUpdated",A.MUTUAL_FOLLOWERS_LIST_UPDATED="onMutualFollowersListUpdated",A.KICKED_OUT="kickedOut",A.ERROR="error",A.NET_STATE_CHANGE="netStateChange",A.ALL_RECEIVE_MESSAGE_OPT_UPDATED="onAllReceiveMessageOptUpdated",A.SERVER_CONFIG_UPDATED="onServerConfigUpdated",A.PINNED_GROUP_MESSAGE_UPDATED="onPinnedGroupMessageUpdated"}(ot||(ot={}));var nt,rt=ot;!function(A){A.LOGOUT="logout",A.DESTROY="destroy",A.CLOUD_CONFIG_UPDATE="cloud_config_update",A.PROFILE_UPDATE="profile_updated",A.ERROR="error",A.RECONNECTED="reconnected",A.FORCE_OFFLINE="im_open_status.stat_forceoffline",A.COMMERCIAL_CONFIG_PUSH="im_sdk_config_mgr.push_imsdk_purchase_bitsv2",A.OVERLOAD_PUSH="OverLoadPush.notify2",A.NEW_MESSAGE="new_message",A.MESSAGE_PUSH="im_open_push.msg_push",A.MESSAGE_DELETED="message_deleted",A.MESSAGE_REVOKED="message_revoked",A.MESSAGE_MODIFIED="message_modified",A.SOCKET_DISCONNECTED="socket_disconnected",A.CONVERSATION_UPDATED="conversation_updated",A.TOPIC_MESSAGE_DELETED="topic_message_deleted",A.TOPIC_MESSAGE_REVOKED="topic_message_revoked",A.TOPIC_MESSAGE_MODIFIED="topic_message_modified",A.TOPIC_NEW_MESSAGE="topic_new_message",A.QUALITY_STAT="quality_stat",A.SYNC_CONVERSATION_LIST="sync_conversation_list"}(nt||(nt={}));var st,at=nt;!function(A){A.NEW_INVITATION_RECEIVED="newInvitationReceived",A.INVITEE_ACCEPTED="ts_invitee_accepted",A.INVITEE_REJECTED="ts_invitee_rejected",A.INVITATION_CANCELLED="ts_invitation_cancelled",A.INVITATION_TIMEOUT="ts_invitation_timeout",A.INVITATION_MODIFIED="ts_invitation_modified"}(st||(st={}));var gt=st;const ct=Object.assign({},{KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick"}),lt={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem"};var It;!function(A){A.UNSENT="unSend",A.SUCCESS="success",A.FAIL="fail"}(It||(It={}));const ut={modify:at.MESSAGE_MODIFIED,delete:at.MESSAGE_DELETED,revoke:at.MESSAGE_REVOKED};var Et;!function(A){A[A.FORWARD=0]="FORWARD",A[A.BACKWARD=1]="BACKWARD"}(Et||(Et={}));const dt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lt),{MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest"}),{RECEIVE_WITH_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_MSG_EXCEPT_AT:"NotReceiveMsgExceptAt",MSG_AT_ALL:"__kImSDK_MesssageAtALL__"}),{MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard"}),{MessageStatus:It,Direction:Et}),ht={[ut.modify]:at.TOPIC_MESSAGE_MODIFIED,[ut.delete]:at.TOPIC_MESSAGE_DELETED,[ut.revoke]:at.TOPIC_MESSAGE_REVOKED},Ct={GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3,USER_NOT_FOUND:"@TLS#NOT_FOUND"},Bt=Object.assign({},Ct),Qt={CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM"},pt=Object.assign(Object.assign(Object.assign(Object.assign({},Qt),{CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3}),{CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8}),{READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage"}),ft=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},{SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay"}),{ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny"}),{SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both"}),{SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both"}),{SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd"}),{SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single"}),{FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut"}),mt={GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_ROOM:"Room",GRP_LIVE:"Live"},yt={COMMUNITY:"@TGS#_",TOPIC:"@TOPIC#_"},Dt={JOINED:1,QUITTED:2,KICKED:3,ADMIN_SET:4,ADMIN_CANCELED:5,GROUP_PROFILE_UPDATED:6,GROUP_MEMBER_PROFILE_UPDATED:7,TOPIC_PROFILE_UPDATED:8},vt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},mt),{GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom"}),{GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11}),{JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval"}),{INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess"}),{GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INVITE_OPTION:"inviteOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers"}),{GROUP_ID_PREFIX:yt,GROUP_TIPS_OPERATION_TYPE:Dt}),wt={IOS_OFFLINE_PUSH_NO_SOUND:"push.no_sound",IOS_OFFLINE_PUSH_DEFAULT_SOUND:"default"},St=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ct),dt),Bt),pt),ft),vt),wt),{NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected"}),Mt={NO_SDKAPPID:2e3,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,MSG_SEND_FAIL:2100,MSG_SEND_FAIL_NOT_IN_AV:2101,MSG_SEND_GRP_WITH_TOPIC_FAIL:2115,MSG_INSTANCE_REQUIRED:2105,MSG_INVALID_CONV_TYPE:2106,MSG_REVOKE_FAIL:2110,MSG_DELETE_FAIL:2111,MSG_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MSG_LIST_EMPTY:2114,CANNOT_DELETE_GRP_SYSTEM_NOTICE:2116,NOT_MY_FRIEND:2700,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,NO_USE:3122,OPTIONS_IS_EMPTY:3153,MSG_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},Rt={BASIC:"1",STANDARD:"2",PROFESSIONAL:"3"},_t={SYNC_SERVER_INFO_AFTER_RE_ONLINE:"sync-server-info-after-re-online",SYNC_SERVER_INFO_AFTER_LOGIN:"sync-server-info-after-login",RECEIVE_C2C_NEW_MESSAGE:"receive-c2c-new-message",RECEIVE_GROUP_NEW_MESSAGE:"receive-group-new-message",RECEIVE_GROUP_TIPS_NOTIFICATION:"receive-group-tips-notification"},Tt={USER_STATUS_UPDATE:"user-status-update",CONVERSATION_RECOVER:"conversation-recover",HISTORY_MESSAGE_RECOVER:"history-message-recover",BLACKLIST_RECOVER:"blacklist-recover",FRIEND_RECOVER:"friend-recover",GROUP_ATTRIBUTE_CACHE_CLEAR:"group-attribute-cache-clear",UNREAD_MESSAGE_RECOVER:"unread-message-recover",HANDLE_NEW_MESSAGE:"handle-new-message",HANDLE_CONVERSATION_PROFILE_UPDATED:"handle-conversation-profile-updated",COMMERCIAL_CONFIG_UPDATE:"commercial-config-update",UNREAD_MESSAGE_SYNC:"unread-message-sync",FRIEND_AND_BLACKLIST_SYNC:"friend-and-blacklist-sync",SIGNALING_MESSAGE_RECOVER:"signaling-message-recover",GROUP_LIST_SYNC:"group-list-sync",CONVERSATION_LIST_SYNC:"conversation-list-sync",USER_PROFILE_SYNC:"user-profile-sync",CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED:"conversation-update-after-unread-sync-finished",CONVERSATION_UPDATE_AFTER_GROUP_LIST_SYNC_FINISHED:"conversation-update-after-group-list-sync-finished",HANDLE_C2C_NEW_MESSAGE:"handle-c2c-new-message",HANDLE_GROUP_NEW_MESSAGE:"handle-group-new-message",CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE:"create-or-update-conversation-by-receive-new-message",HANDLE_GROUP_TIPS_FROM_SYNC_UNREAD:"handle-group-tips-from-sync-unread",HANDLE_C2C_REVOKED_MESSAGE_FROM_SYNC_UNREAD:"handle-c2c-revoked-message-from-sync-unread",GROUP_REVOKED_NOTICE_RECOVER:"group-revoked-notice-recover",CLOUD_CONFIG_SYNC:"cloud-config-sync",UPDATE_GROUP_NEXT_SEQUENCE:"update-group-next-sequence",EMIT_C2C_MESSAGE_EVENT:"emit-c2c-message-event",EMIT_GROUP_MESSAGE_EVENT:"emit-group-message-event",CONVERSATION_GROUP_LIST_SYNC:"conversation-group-list-sync",CONVERSATION_GROUP_UPDATE:"conversation-group-update",UPDATE_TOPIC_AFTER_UNREAD_SYNC_FINISHED:"update-topic-after-unread-sync-finished",UPDATE_TOPIC_BY_RECEIVE_NEW_MESSAGE:"update-topic-by-received-new-message",TOPIC_REQUEST_INFO_RESET:"topic-request-info-reset",QUALITY_REPORT:"quality-report",GROUP_TIPS_RECOVER:"group-tips-recover",HANDLE_GROUP_TIPS_NOTIFICATION:"handle-group-tips-notification"},Nt={[_t.SYNC_SERVER_INFO_AFTER_RE_ONLINE]:[{stepId:Tt.USER_STATUS_UPDATE},{stepId:Tt.GROUP_ATTRIBUTE_CACHE_CLEAR},{stepId:Tt.UNREAD_MESSAGE_SYNC},{stepId:Tt.CONVERSATION_RECOVER},{stepId:Tt.HISTORY_MESSAGE_RECOVER,dependency:Tt.CONVERSATION_RECOVER},{stepId:Tt.BLACKLIST_RECOVER},{stepId:Tt.FRIEND_RECOVER},{stepId:Tt.GROUP_REVOKED_NOTICE_RECOVER,dependency:Tt.HISTORY_MESSAGE_RECOVER},{stepId:Tt.GROUP_TIPS_RECOVER,dependency:Tt.HISTORY_MESSAGE_RECOVER},{stepId:Tt.TOPIC_REQUEST_INFO_RESET},{stepId:Tt.HANDLE_C2C_REVOKED_MESSAGE_FROM_SYNC_UNREAD,dependency:Tt.UNREAD_MESSAGE_SYNC},{stepId:Tt.HANDLE_GROUP_TIPS_FROM_SYNC_UNREAD,dependency:Tt.UNREAD_MESSAGE_SYNC},{stepId:Tt.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,dependency:[Tt.UNREAD_MESSAGE_SYNC,Tt.CONVERSATION_RECOVER]},{stepId:Tt.EMIT_C2C_MESSAGE_EVENT,dependency:[Tt.UNREAD_MESSAGE_SYNC,Tt.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED],skipIfDependencyMissing:!1}],[_t.SYNC_SERVER_INFO_AFTER_LOGIN]:[{stepId:Tt.COMMERCIAL_CONFIG_UPDATE},{stepId:Tt.CLOUD_CONFIG_SYNC},{stepId:Tt.USER_PROFILE_SYNC},{stepId:Tt.UNREAD_MESSAGE_SYNC},{stepId:Tt.FRIEND_AND_BLACKLIST_SYNC},{stepId:Tt.GROUP_LIST_SYNC},{stepId:Tt.CONVERSATION_LIST_SYNC},{stepId:Tt.SIGNALING_MESSAGE_RECOVER,dependency:Tt.UNREAD_MESSAGE_SYNC},{stepId:Tt.UPDATE_TOPIC_AFTER_UNREAD_SYNC_FINISHED,dependency:[Tt.UNREAD_MESSAGE_SYNC]},{stepId:Tt.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,dependency:[Tt.UNREAD_MESSAGE_SYNC,Tt.CONVERSATION_LIST_SYNC]},{stepId:Tt.CONVERSATION_UPDATE_AFTER_GROUP_LIST_SYNC_FINISHED,dependency:[Tt.GROUP_LIST_SYNC,Tt.CONVERSATION_LIST_SYNC]},{stepId:Tt.CONVERSATION_GROUP_LIST_SYNC},{stepId:Tt.CONVERSATION_GROUP_UPDATE,dependency:[Tt.CONVERSATION_LIST_SYNC,Tt.CONVERSATION_GROUP_LIST_SYNC]},{stepId:Tt.QUALITY_REPORT}],[_t.RECEIVE_C2C_NEW_MESSAGE]:[{stepId:Tt.HANDLE_C2C_NEW_MESSAGE},{stepId:Tt.UNREAD_MESSAGE_SYNC},{stepId:Tt.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,dependency:Tt.HANDLE_C2C_NEW_MESSAGE},{stepId:Tt.EMIT_C2C_MESSAGE_EVENT,dependency:[Tt.HANDLE_C2C_NEW_MESSAGE,Tt.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE],skipIfDependencyMissing:!1},{stepId:Tt.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,dependency:[Tt.UNREAD_MESSAGE_SYNC]}],[_t.RECEIVE_GROUP_NEW_MESSAGE]:[{stepId:Tt.HANDLE_GROUP_NEW_MESSAGE},{stepId:Tt.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,dependency:Tt.HANDLE_GROUP_NEW_MESSAGE},{stepId:Tt.UPDATE_GROUP_NEXT_SEQUENCE,dependency:Tt.HANDLE_GROUP_NEW_MESSAGE},{stepId:Tt.UPDATE_TOPIC_BY_RECEIVE_NEW_MESSAGE,dependency:Tt.HANDLE_GROUP_NEW_MESSAGE},{stepId:Tt.EMIT_GROUP_MESSAGE_EVENT,dependency:[Tt.HANDLE_GROUP_NEW_MESSAGE,Tt.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE],skipIfDependencyMissing:!1}],[_t.RECEIVE_GROUP_TIPS_NOTIFICATION]:[{stepId:Tt.HANDLE_GROUP_TIPS_NOTIFICATION},{stepId:Tt.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,dependency:Tt.HANDLE_GROUP_TIPS_NOTIFICATION}]},bt={MESSAGE_SEND_SUCCESS_RATE:"messageSendSuccessRate"},Gt={TOTAL_COUNT:"sendMessageTotalCount",SUCCESS_COUNT:"sendMessageSuccessCount",FAILED_COUNT:"sendMessageFailedCount",SEND_COST:"sendMessageCost"},kt=["login","getMyProfile","getUserProfile","updateMyProfile","setSelfStatus","getUserStatus","subscribeUserStatus","unsubscribeUserStatus","modifyMessage","deleteGroupMember","dismissGroup","getGroupMemberList","getGroupOnlineMemberCount","joinGroup","markGroupMemberList","quitGroup","searchCloudMessages","searchCloudGroups","searchCloudGroupMembers","searchCloudUsers","getMyFollowingList","getMyFollowersList","getMutualFollowersList","followUser","unfollowUser","getUserFollowInfo","checkFollowType","getFriendProfile","addFriend","deleteFriend","updateFriend","checkFriend","setFriendApplicationRead","createFriendGroup","deleteFriendGroup","addToFriendGroup","removeFromFriendGroup","renameFriendGroup","changeGroupOwner","createGroup","dismissGroup","getGroupList","getGroupOnlineMemberCount","getGroupProfile","searchGroupByID","updateGroupProfile","handleGroupApplication","deleteGroupAttributes","getGroupAttributes","initGroupAttributes","setGroupAttributes","addGroupMember","deleteGroupMember","getGroupMemberList","getGroupMemberProfile","setGroupMemberMuteTime","setGroupMemberNameCard","setGroupMemberRole","deleteMessage","revokeMessage","setMessageExtensions","getMessageExtensions","deleteMessageExtensions","getMessageList","addMessageReaction","removeMessageReaction","clearHistoryMessage","sendMessageReadReceipt","getMessageReadReceiptList","getGroupMessageReadMemberList","invite","accept","cancel","reject","modifyInvitation","deleteConversation","pinConversation","setMessageRead","setAllMessageRead","getConversationList","getTotalUnreadMessageCount","renameConversationGroup","deleteConversationGroup","markConversation","setConversationCustomData","deleteConversationsFromGroup","addConversationsToGroup","createConversationGroup"];var Lt,Ut,Ft,Ot=Object.freeze({__proto__:null,ERROR_CODE:Mt,InnerEvent:at,NEED_LOG_API:kt,OuterConstant:St,OuterEvent:rt,PUSH:wt,QUALITY_METRICS:bt,SDK_EDITION:Rt,SDK_INFO:{VERSION:"1.7.3",APPID:537048168},SEND_MESSAGE_STAT:Gt,SignalingEvent:gt,WEB_PUSH_ACCOUNT_TYPE:1,WORKFLOW_DEFINITIONS:Nt,WORKFLOW_NAME:_t,WORKFLOW_STEP:Tt});!function(A){A[A.USER_INITIATED=0]="USER_INITIATED",A[A.KICKED_OUT=1]="KICKED_OUT"}(Lt||(Lt={})),function(A){A[A.multipleAccount=1]="multipleAccount",A[A.multipleDevice=2]="multipleDevice",A[A.restApi=3]="restApi"}(Ut||(Ut={})),function(A){A[A.multipleDevice=3002]="multipleDevice",A[A.multipleAccount=3003]="multipleAccount",A[A.usersigExpired=70001]="usersigExpired",A[A.restApi=20002]="restApi"}(Ft||(Ft={}));const xt={[Ut.multipleAccount]:"multipleAccount",[Ut.multipleDevice]:"multipleDevice",[Ut.restApi]:"REST_API_Kick",[Ft.multipleAccount]:"multipleAccount",[Ft.multipleDevice]:"multipleDevice",[Ft.restApi]:"REST_API_Kick",[Ft.usersigExpired]:"userSigExpired"},Pt="login_online_presence_task",{ERROR:Yt,DESTROY:Jt,FORCE_OFFLINE:Ht}=at,{KICKED_OUT_MULT_ACCOUNT:qt,KICKED_OUT_MULT_DEVICE:Vt,KICKED_OUT_REST_API:jt,ACCOUNT_A2KEY_EXPIRED:Kt,MSG_A2KEY_EXPIRED:Wt}=Mt;class zt{init(){const{notificationCenter:A}=At;A.subscribeInnerEvent(Ht,this._handleForceOfflineFromServerPush,this),A.subscribeInnerEvent(Yt,Wt,this._handleForceOfflineFromResponse,this,this._isChatLoginEvent),A.subscribeInnerEvent(Yt,Kt,this._handleForceOfflineFromResponse,this,this._isChatLoginEvent),A.subscribeInnerEvent(Yt,qt,this._handleForceOfflineFromResponse,this),A.subscribeInnerEvent(Yt,Vt,this._handleForceOfflineFromResponse,this),A.subscribeInnerEvent(Yt,jt,this._handleForceOfflineFromResponse,this),A.subscribeInnerEvent(Jt,this._dispose,this)}_handleForceOfflineFromServerPush(A){var e;if(!0===(null===(e=At.store.get("login"))||void 0===e?void 0:e.isLoggedIn)){const{EventArray:e=[]}=(null==A?void 0:A.body)||{};this._extractKickedOutMessages(e).forEach(A=>{const{KickoutMsgNotify:{KickType:e,NewInstInfo:t}}=A;this._processKickedOutReasonInfo({kickedOutReasonCode:e,newInstanceInfo:t})})}}_extractKickedOutMessages(A){return A.reduce((A,e)=>[...A,...e.C2cNotifyMsgArray||[]],[]).filter(A=>{var e;return this._isKickedOut(null===(e=null==A?void 0:A.KickoutMsgNotify)||void 0===e?void 0:e.KickType)})}_handleForceOfflineFromResponse(A){const{errorCode:e}=A;this._processKickedOutReasonInfo({kickedOutReasonCode:e})}_processKickedOutReasonInfo(A){return IA(this,void 0,void 0,function*(){const{kickedOutReasonCode:e}=A,{ssoLog:t,utils:{safeStringify:i}}=At;try{this._logKickedOutEvent(A),this._shouldLogoutAfterKickedOut(e)&&(yield At.login.loginAction.logout(Lt.KICKED_OUT))}catch(o){t.debug("_processKickedOutReasonInfo",` fail ${i(o)}`)}finally{At.notificationCenter.emitOuterEvent(rt.KICKED_OUT,{data:{type:xt[e]},name:rt.KICKED_OUT})}})}_logKickedOutEvent(A){const{kickedOutReasonCode:e,newInstanceInfo:t={}}=A,i=`type:${xt[e]} newInstanceInfo: ${JSON.stringify(t)}`;At.ssoLog.warn("kickedOut",i)}_isKickedOut(A){return[Ut.multipleAccount,Ut.multipleDevice,Ut.restApi].includes(A)}_isChatLoginEvent(A){const{requestHead:e}=A||{};return 1!==(null==e?void 0:e.idtype)}_shouldLogoutAfterKickedOut(A){return![Ft.usersigExpired,Ut.restApi].includes(A)}_dispose(){const{notificationCenter:A}=At;A.unSubscribeInnerEvent(Ht,this._handleForceOfflineFromServerPush,this),A.unSubscribeInnerEvent(Yt,Kt,this._handleForceOfflineFromResponse,this),A.unSubscribeInnerEvent(Yt,Wt,this._handleForceOfflineFromResponse,this),A.unSubscribeInnerEvent(Yt,qt,this._handleForceOfflineFromResponse,this),A.unSubscribeInnerEvent(Yt,Vt,this._handleForceOfflineFromResponse,this),A.unSubscribeInnerEvent(Yt,jt,this._handleForceOfflineFromResponse,this),A.unSubscribeInnerEvent(Jt,this._dispose,this)}}function Zt(A){return IA(this,void 0,void 0,function*(){const e="im_open_status.wslogin",t=At.common.generateProtocolData({servcmd:e,data:{State:"Online",is_web_uniapp:0,InstType:0,CustomInfo:A}}),i=`${t.head.seq}${e}`,o=yield At.channel.sendPacket(t,{timeout:9e4,requestId:i});if(o){const{HelloInterval:A,InstId:e,TinyId:t,TimeStamp:i,CustomStatus:n,PurchaseBits:r,A2Key:s,RichMsgAuthKey:a,ErrorCode:g,ErrorInfo:c,ActionStatus:l}=o;return{helloInterval:A,instanceID:e,tinyID:t,timeStamp:i,customStatus:n,purchaseBits:r,a2Key:s,authKey:a,errorCode:g,errorInfo:c,actionStatus:l}}})}function Xt(A){var e;try{const t=HA.getStorage("errorMessage");if(!A||!t)return"";const i=(null===(e=JSON.parse(t))||void 0===e?void 0:e.errorMessage)||{},{isIntl:o=!1,code:n,replacement1:r="",replacement2:s=""}=A;if(!n)return"";const a=o?`${n}_en`:`${n}_cn`;let g=i[i[a]?a:n]||"";return g&&(r&&(g=g.replace("$replacement1",r)),s&&(g=g.replace("$replacement2",s))),g}catch(t){return console.warn("Error parsing stored error messages:",t),""}}class $t extends Error{constructor(A){const{functionName:e="Unknown",code:t,message:i="",data:o="",moreMessage:n=""}=A;let r=i;t&&!i&&(r=Xt(A));let s=t?`${e} failed. error: {"message": ${r}, "code": ${t}}`:`${e} failed. error: {"message": ${r}}`;s=`${s} ${n}`,super(),this.code=t,this.errorCode=t,this.errorMessage=r,this.message=s,this.data=o}}function Ai(A,e){var t;if(A&&!0!==(null===(t=At.store.get("login"))||void 0===t?void 0:t.isLoggedIn))throw new $t({code:Mt.USER_NOT_LOGGED_IN,functionName:e})}function ei(A,e,t){if(Array.isArray(A))for(let i=0;i {return A===(e=i,Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase());var e})){for(let t=0;t {const{interceptor:e,context:i}=A;e.apply(i,[t])})}function si(A,e){ii.push({interceptor:A,context:e})}function ai(A){const{params:e,auth:t}=A;e&&"object"==typeof e&&Object.assign(ni,e),t&&"object"==typeof t&&Object.assign(oi,t)}function gi(A){return At.store.get("commercialConfig").get(A)}class ci{constructor(){this._handlers=new Map,this._activeWorkflows=new Map,this._stepStartTimes=new Map,this._logHandlers={start:(A,e)=>{const t=Date.now();e?(this._stepStartTimes.set(`${A}-${e}`,t),At.ssoLog.debug("_executeWorkflowStep",`[Workflow ${A}] Step ${e} started at ${new Date(t).toISOString()}`)):(this._workflowStartTimes.set(A,t),At.ssoLog.debug("_executeWorkflowStep",`[Workflow ${A}] started at ${new Date(t).toISOString()}`))},success:(A,e)=>{const t=Date.now();if(e){const i=this._stepStartTimes.get(`${A}-${e}`),o=i?t-i:0;this._stepStartTimes.delete(`${A}-${e}`),At.ssoLog.debug("_executeWorkflowStep",`[Workflow ${A}] Step ${e} completed successfully at ${new Date(t).toISOString()} (${o}ms)`)}else{const e=this._workflowStartTimes.get(A),i=e?t-e:0;this._workflowStartTimes.delete(A),At.ssoLog.debug("_executeWorkflowStep",`[Workflow ${A}] completed successfully at ${new Date(t).toISOString()} (${i}ms)`)}},error:(A,e,t)=>{const{ssoLog:i,utils:{safeStringify:o}}=At,n=Date.now();if(e){const r=this._stepStartTimes.get(`${A}-${e}`),s=r?n-r:0;this._stepStartTimes.delete(`${A}-${e}`),i.error("_executeWorkflowStep",`[Workflow ${A}] Step ${e} failed at ${new Date(n).toISOString()} (${s}ms) ${o(t)}`,{error:t})}else{const e=this._workflowStartTimes.get(A),r=e?n-e:0;this._workflowStartTimes.delete(A),i.error("_executeWorkflowStep",`[Workflow ${A}] failed at ${new Date(n).toISOString()} (${r}ms) ${o(t)}`,{error:t})}}}}static getInstance(){return ci._instance||(ci._instance=new ci),ci._instance}static setInstance(A){ci._instance=A}init(){this._initializeWorkflows()}registerWorkflowStep(A,e,t,i){if(!this._handlers.has(A))return void At.ssoLog.debug("registerWorkflowStep",`Workflow '${A}' not defined in core`);if(!Nt[A].find(A=>A.stepId===e))return void At.ssoLog.debug("registerWorkflowStep",`Step '${e}' not defined in workflow '${A}'`);const o=this._handlers.get(A);o.has(e)||o.set(e,i?t.bind(i):t)}executeWorkflow(A,e){return IA(this,void 0,void 0,function*(){if(!this._validateWorkflow(A))return;At.ssoLog.debug("executeWorkflow",`[Workflow ${A}] Started execution at ${(new Date).toISOString()}`);const t=Nt[A],i={},o={cancelled:!1};this._activeWorkflows.set(A,{cancelToken:o});try{const n=new Map;t.forEach(A=>{n.set(A.stepId,A)});const r={workflowName:A,pendingSteps:new Set(t.map(A=>A.stepId)),completedSteps:new Set,runningSteps:new Set,stepMap:n,stepResults:i,data:e,cancelToken:o};yield new Promise((e,t)=>{const i=()=>{o.cancelled?e():this._getExecutableSteps({pendingSteps:r.pendingSteps,completedSteps:r.completedSteps,stepMap:r.stepMap,workflowName:A}).filter(A=>!r.runningSteps.has(A)).forEach(o=>{r.completedSteps.has(o)||r.runningSteps.has(o)||this._executeWorkflowStep(o,r,{onComplete:()=>{0!==r.pendingSteps.size?0===this._getExecutableSteps({pendingSteps:r.pendingSteps,completedSteps:r.completedSteps,stepMap:r.stepMap,workflowName:A}).filter(A=>!r.runningSteps.has(A)).length&&0===r.runningSteps.size&&(At.ssoLog.debug("executeWorkflow",`Workflow ${A} completed with some steps skipped due to dependency failures`),e()):e()},onError:t,onStepComplete:i})})};i()}),At.ssoLog.debug("executeWorkflow",`[Workflow ${A}] Completed execution at ${(new Date).toISOString()}`)}catch(n){At.ssoLog.error("executeWorkflow",`[Workflow ${A}] Failed execution at ${(new Date).toISOString()}`,{error:n})}finally{this._activeWorkflows.delete(A)}})}_executeWorkflowStep(A,t,i){return IA(this,void 0,void 0,function*(){const{workflowName:o,runningSteps:n,stepMap:r,stepResults:s,data:a}=t;n.add(A),this._logWorkflowExecution(o,A,"start");try{const i=r.get(A);let n=null;(null==i?void 0:i.dependency)&&(e(i.dependency)?n=s[i.dependency]:Array.isArray(i.dependency)&&(n={},i.dependency.forEach(A=>{n[A]=s[A]})));const g=this._handlers.get(o).get(A);if(g){const e=yield Promise.resolve(g({data:a,result:n}));s[A]=e,this._logWorkflowExecution(o,A,"success")}t.completedSteps.add(A)}catch(g){const e=`[Workflow].${o}.${A}`,{errorCode:t,errorInfo:n=`${e} failed`}=g||{},r=new $t({functionName:e,code:t,message:n});At.ssoLog.error(e,n,{error:r}),this._logWorkflowExecution(o,A,"error",g),i.onError(g)}finally{n.delete(A),t.pendingSteps.delete(A),i.onStepComplete(),i.onComplete()}})}reset(){this._cancelAllWorkflows()}destroy(){this.reset(),this._handlers.clear()}_initializeWorkflows(){Object.keys(Nt).forEach(A=>{this._handlers.has(A)||this._handlers.set(A,new Map)})}_cancelWorkFlow(A){const e=this._activeWorkflows.get(A);if(!e)return;const{cancelToken:t}=e;t.cancelled=!0,this._activeWorkflows.delete(A)}_cancelAllWorkflows(){Object.keys(Nt).forEach(A=>{this._cancelWorkFlow(A)})}_validateWorkflow(A){return!!Nt[A]&&!!this._handlers.get(A)}_getExecutableSteps(A){const{pendingSteps:t,completedSteps:o,stepMap:n,workflowName:r}=A;return Array.from(t).filter(A=>{const t=n.get(A)||{},{dependency:s,skipIfDependencyMissing:a=!0}=t;if(!s)return!0;if(e(s))return this._isStepRegistered({workflowName:r,stepId:s})?o.has(s):!a;if(i(s)){if(s.filter(A=>!this._isStepRegistered({workflowName:r,stepId:A})).length>0&&a)return!1;for(const A of s)if(!o.has(A))return!1;return!0}return!1})}_isStepRegistered(A){var e;const{workflowName:t,stepId:i}=A;return null===(e=this._handlers.get(t))||void 0===e?void 0:e.has(i)}_logWorkflowExecution(A,e,t,i){this._logHandlers[t](A,e)}}const li=new Map,Ii=({type:A,groupID:e})=>A===St.GRP_COMMUNITY||`${e}`.startsWith(yt.COMMUNITY)&&!`${e}`.includes(yt.TOPIC),ui=(A="")=>{const e=A.startsWith("GROUP")?A.replace("GROUP",""):A;return e.startsWith(yt.COMMUNITY)&&`${e}`.includes(yt.TOPIC)},Ei="openim",di="million_group_open_http_svc";function hi(A){return IA(this,void 0,void 0,function*(){const{servcmd:e,data:t}=function(A){const{data:e}=A;return Ci(e)||Bi(e)}(A)?function(A){let{servcmd:e,data:t}=A;return Bi(t)?function(A){const{servcmd:e,data:t}=A;let{GroupId:i=""}=t;const o=i;return[i]=o.split(yt.TOPIC),{servcmd:Qi(e),data:Object.assign(Object.assign({},t),{GroupId:i,TopicId:o})}}(A):(Ci(t)&&(e=Qi(e)),{servcmd:e,data:t})}(A):A,i=At.common.generateProtocolData({servcmd:e,data:t}),o=`${i.head.seq}${e}`;return At.channel.sendPacket(i,{requestId:o})})}function Ci(A){const{Type:e,GroupId:t,GroupIdList:i=[]}=A,o=t||i[0]||"";return Ii({type:e,groupID:o})}function Bi(A){const{GroupId:e=""}=A;return ui(e)}function Qi(A){if(A.includes(Ei))return A;const e=A.split(".")[1];return`${di}.${e}`}function pi(){var A;return null===(A=At.store.get("login"))||void 0===A?void 0:A.userId}const fi=A=>i(A)||o(A),mi=(e,t,i,o)=>{if(!fi(e)||!fi(t))return 0;let n=0;const r=Object.keys(t);let s;for(let a=0,g=r.length;a {if(A(t))return"";switch(e){case St.MSG_TEXT:return t.text||"";case St.MSG_IMAGE:return"[Image]";case St.MSG_LOCATION:return"[Location]";case St.MSG_AUDIO:return"[Voice]";case St.MSG_VIDEO:return"[Video]";case St.MSG_FILE:return"[File]";case St.MSG_CUSTOM:return"[Custom Messages]";case St.MSG_GRP_TIP:return"[Group Notification]";case St.MSG_GRP_SYS_NOTICE:return"[Group System Message]";case St.MSG_FACE:return"[Animated Sticker]";case St.MSG_MERGER:return"[Chat Record]";default:return""}},Di=[{cmd:"ws_get_user_status",interval:5,count:20},{cmd:"ws_status_subscribe",interval:5,count:20},{cmd:"ws_status_unsubscribe",interval:5,count:20},{cmd:"get_group_self_member_info",interval:5,count:20},{cmd:"modify_group_base_info",interval:1,count:8},{cmd:"get_pendency",interval:1,count:15},{cmd:"set_group_attr",interval:5,count:10},{cmd:"modify_group_attr",interval:5,count:10},{cmd:"delete_group_attr",interval:5,count:10},{cmd:"clear_group_attr",interval:5,count:10},{cmd:"get_group_attr",interval:5,count:20},{cmd:"update_group_counter",interval:5,count:20},{cmd:"get_group_counter",interval:5,count:20},{cmd:"get_topic",interval:1,count:10},{cmd:"read_all_unread_msg",interval:1,count:1},{cmd:"query",interval:5,count:20}],vi="im_sdk_config_mgr.fetch_config",wi="im_sdk_config_mgr.push_configv2",Si="cloud-config",Mi=2996,Ri=new class{init(A){this.core=A}};function _i(A){return IA(this,void 0,void 0,function*(){const{sdkAppId:e}=Ri.core.store.get("instance")||{},t=Ri.core.helper.generateProtocolData({servcmd:vi,data:{uint32_sdkappid:e,uint64_version:A}}),i=`${t.head.seq}${vi}`;return Ri.core.channel.sendPacket(t,{requestId:i})})}var Ti=new class{constructor(){this._core=null,this._expirationTime=0,this._version=0,this._isFetching=!1,this._cmdFrequencyLimitMap=new Map,this._methodCallFrequencyMap=new Map}install(A){this._core=A;const{notificationCenter:e,InnerEvent:t,helper:i,constants:{WORKFLOW_NAME:o,WORKFLOW_STEP:n},channel:r}=A;e.subscribeInnerEvent(wi,this._handlePushedConfig,this),i.registerWorkflowStep(o.SYNC_SERVER_INFO_AFTER_LOGIN,n.CLOUD_CONFIG_SYNC,this._handleLoginSuccess,this),e.subscribeInnerEvent(t.LOGOUT,this._reset,this),e.subscribeInnerEvent(t.DESTROY,this._dispose,this),i.registerExperimentalAPI("getServerConfig",this),this._updateCmdFreqLimitMap(Di),r.registerBeforeSendInterceptor(this.checkMethodCallOverLimit,this)}getServerConfig(A){return IA(this,void 0,void 0,function*(){var e;const t={code:0,data:""};return A?(t.data=(null===(e=this._core.store.get("cloudConfig"))||void 0===e?void 0:e[A])||"",t):t})}checkMethodCallOverLimit(A){if(!this._cmdFrequencyLimitMap.has(A))return;if(!this._methodCallFrequencyMap.has(A))return void this._methodCallFrequencyMap.set(A,{startTime:Date.now(),methodCallCounter:1});const{count:e,interval:t}=this._cmdFrequencyLimitMap.get(A);let{startTime:i,methodCallCounter:o}=this._methodCallFrequencyMap.get(A);if(Date.now()-i>1e3*t)this._methodCallFrequencyMap.set(A,{startTime:Date.now(),methodCallCounter:1});else if(o+=1,this._methodCallFrequencyMap.set(A,{startTime:i,methodCallCounter:o}),o>e)throw new this._core.helper.ChatError({code:Mi,replacement1:A})}_handlePushedConfig(A){return IA(this,void 0,void 0,function*(){const{ssoLog:e,utils:{safeStringify:t}}=this._core;e.info("_handlePushedConfig",t(A)),yield this._updateCloudConfig(A)})}_handleLoginSuccess(){return IA(this,void 0,void 0,function*(){const{ssoLog:A,utils:{safeStringify:e}}=this._core;try{if(this._canFetch()){const t=yield _i(this._version);A.info("_fetchCloudConfigIfLogin",e(t)),yield this._updateCloudConfig(t)}this._core.helper.taskScheduler.addTask({id:Si,intervalMs:1e3,callback:this._fetchCloudConfigIfReady,context:this})}catch(t){A.error("_fetchCloudConfigIfLogin",e(t))}})}_fetchCloudConfigIfReady(){return IA(this,void 0,void 0,function*(){const{ssoLog:A,utils:{safeStringify:e}}=this._core;if(this._canFetch())try{const t=yield _i(this._version);A.info("_fetchCloudConfigIfReady",e(t)),yield this._updateCloudConfig(t)}catch(t){A.error("_fetchCloudConfigIfReady",e(t))}})}_updateCloudConfig(A){return IA(this,void 0,void 0,function*(){const e=this._parseCloudConfig(A);e&&(this._core.store.set("cloudConfig",e),yield this._parseCmdFreqLimit(),this._core.notificationCenter.emitInnerEvent(this._core.InnerEvent.CLOUD_CONFIG_UPDATE,e),this._core.notificationCenter.emitOuterEvent(this._core.OuterEvent.SERVER_CONFIG_UPDATED,{name:this._core.OuterEvent.SERVER_CONFIG_UPDATED,data:{config:e}}))})}_canFetch(){const{isLoggedIn:A}=this._core.store.get("login")||{};return A&&!this._isFetching&&Date.now()>=this._expirationTime}_parseCloudConfig(A){const{int32_error_code:e,str_error_message:t,str_json_config:i,uint32_expired_time:o,uint32_sdkappid:n,uint64_version:r}=A;let s=null;if(0===e){if(this._version!==r)try{s=JSON.parse(i),this._version=r}catch(a){}this._expirationTime=Date.now()+1e3*o}else this._expirationTime=void 0===e?Date.now()+36e5:Date.now()+12e4;return s}_parseCmdFreqLimit(){return IA(this,void 0,void 0,function*(){var A;let e=null===(A=yield this.getServerConfig("cmd_frequency_limit"))||void 0===A?void 0:A.data;const{isEmpty:t}=this._core.utils;if(!t(e))try{e=JSON.parse(e),this._updateCmdFreqLimitMap(e)}catch(i){console.warn(i)}})}_updateCmdFreqLimitMap(A){A.forEach(A=>{this._cmdFrequencyLimitMap.set(A.cmd,{interval:A.interval,count:A.count})})}_reset(){this._core.helper.taskScheduler.removeTask(Si),this._core.store.clear("cloudConfig"),this._updateCmdFreqLimitMap(Di),this._methodCallFrequencyMap.clear(),this._expirationTime=0,this._version=0,this._isFetching=!1}_dispose(){const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(wi,this._handlePushedConfig,this),A.unSubscribeInnerEvent(e.LOGOUT,this._reset,this),A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this),this._reset()}};class Ni{constructor(A=0,e=0){this.high=A,this.low=e}equal(A){return null!==A&&this.low===A.low&&this.high===A.high}toString(){const A=Number(this.high).toString(16);let e=Number(this.low).toString(16);if(e.length<8){let A=8-e.length;for(;A;)e=`0${e}`,A--}return A+e}}const bi={SEARCH_GRP_SNS:new Ni(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new Ni(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new Ni(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new Ni(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new Ni(0,Math.pow(2,6)).toString(),USER_STATUS:new Ni(0,Math.pow(2,7)).toString(),CONV_MARK:new Ni(0,Math.pow(2,9)).toString(),CONV_GROUP:new Ni(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new Ni(0,Math.pow(2,11)).toString(),MSG_EXT:new Ni(0,Math.pow(2,13)).toString(),GRP_COUNTER:new Ni(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new Ni(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new Ni(Math.pow(2,7)).toString(),PLUGIN_CS:new Ni(Math.pow(2,8)).toString(),PLUGIN_PUSH:new Ni(Math.pow(2,9)).toString(),PLUGIN_BOT:new Ni(Math.pow(2,10)).toString(),MSG_REACTION:new Ni(Math.pow(2,16)).toString(),FOLLOW:new Ni(Math.pow(2,20)).toString()},Gi="CommercialConfig",ki="commercial-config";var Li,Ui,Fi=new class{constructor(){this._core=null,this._expirationTime=0,this._isFetching=!1,this._featureMap=new Map,this._methodKeyMap=new Map,this._purchaseBits="0"}install(A){this._core=A;const{helper:e,notificationCenter:t,constants:{WORKFLOW_NAME:i,WORKFLOW_STEP:o,InnerEvent:n}}=A;t.subscribeInnerEvent(n.COMMERCIAL_CONFIG_PUSH,this._handlePushedConfig,this),t.subscribeInnerEvent(n.LOGOUT,this._handleLogout,this),t.subscribeInnerEvent(n.DESTROY,this._dispose,this),e.registerWorkflowStep(i.SYNC_SERVER_INFO_AFTER_LOGIN,o.COMMERCIAL_CONFIG_UPDATE,this._syncCommercialConfig,this),A.helper.registerExperimentalAPI("isCommercialAbilityEnabled",this),A.helper.registerExperimentalAPI("queryCommercialAbility",this)}isCommercialAbilityEnabled(A){return IA(this,void 0,void 0,function*(){const e=parseInt(A,10).toString(2),{length:t}=e;let i,o=!0;for(let A=t-1,n=0;A>=0;A--,n++)if("1"===e.charAt(A)&&(i=n<32?new Ni(0,2**n).toString():new Ni(2**(n-32),0).toString(),!this._featureMap.get(i))){o=!1;break}return this._core.ssoLog.debug("isFeatureEnabled",`${Gi}.isFeatureEnabled decimalNumber:${A} key:${i} ret:${o}`),{code:0,data:{enabled:o}}})}queryCommercialAbility(){return this._purchaseBits}_fetchAndParseCommercialConfig(){return IA(this,void 0,void 0,function*(){var A;const{ssoLog:e,utils:{safeStringify:t},common:{buildAndSendPacket:i}}=this._core;try{this._isFetching=!0;const e=yield i({servcmd:"im_sdk_config_mgr.fetch_imsdk_purchase_bitsv2",data:{uint32_sdkappid:null===(A=this._core.store.get("instance"))||void 0===A?void 0:A.sdkAppId}});(null==e?void 0:e.body)&&(this._parseCommercialConfig(e.body),this._core.store.set("commercialConfig",this._methodKeyMap))}catch(o){e.error("_fetchAndParseCommercialConfig",t(o))}finally{this._isFetching=!1}})}_syncCommercialConfig(A){return IA(this,void 0,void 0,function*(){const{purchaseBits:e}=(null==A?void 0:A.data)||{};e&&(this._parsePurchaseBits(e),this._core.store.set("commercialConfig",this._methodKeyMap)),this._canFetch()&&(yield this._fetchAndParseCommercialConfig()),this._core.helper.taskScheduler.addTask({id:ki,intervalMs:1e3,callback:this._fetchCommercialConfigIfReady,context:this})})}_canFetch(){var A;const e=null===(A=this._core.store.get("login"))||void 0===A?void 0:A.isLoggedIn,t=Date.now()>=this._expirationTime;return e&&!this._isFetching&&t}_handlePushedConfig(A){(null==A?void 0:A.body)&&(this._parseCommercialConfig(A.body),this._core.store.set("commercialConfig",this._methodKeyMap))}_fetchCommercialConfigIfReady(){return IA(this,void 0,void 0,function*(){this._canFetch()&&(yield this._fetchAndParseCommercialConfig())})}_parseCommercialConfig(A){const{ssoLog:e}=this._core;if("object"!=typeof A)return;const{int32_error_code:t,str_error_message:i,str_purchase_bits:o,uint32_expired_time:n}=A;0===t?(this._parsePurchaseBits(o),this._expirationTime=Date.now()+1e3*n):void 0===t?(e.warn("_parseCommercialConfig",`${Gi}._parseCommercialConfig failed. Invalid message format:`,A),this._expirationTime=Date.now()+36e5):(e.warn("_parseCommercialConfig",`${Gi}._parseCommercialConfig errorCode:${t} errorMessage:${i}`),this._expirationTime=Date.now()+12e4)}_isValidPurchaseBits(A){return A&&"string"==typeof A&&A.length>=1&&A.length<=64&&/[01]{1,64}/.test(A)}_parsePurchaseBits(A){const{ssoLog:e,utils:{safeStringify:t}}=this._core;if(this._isValidPurchaseBits(A)){this._purchaseBits=A,this._featureMap.clear(),this._methodKeyMap.clear();let e=null;for(let t=A.length-1,i=0;t>=0;t--,i++)if(e=i<32?new Ni(0,2**i).toString():new Ni(2**(i-32),0).toString(),"1"===A[t]){this._featureMap.set(e,!0);const A=this._getKeyByValue(bi,e);A&&this._methodKeyMap.set(A,!0)}else{this._featureMap.set(e,!1);const A=this._getKeyByValue(bi,e);A&&this._methodKeyMap.set(A,!1)}}else e.warn("_parsePurchaseBits",`${Gi}.parsePurchaseBits invalid purchases:${t(A)}`)}_getKeyByValue(A,e){const t=Object.entries(A).find(([A,t])=>t===e);return t?t[0]:void 0}_handleLogout(){this._reset()}_dispose(){this._reset(),this._core.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.COMMERCIAL_CONFIG_PUSH,this._handlePushedConfig,this),this._core.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this),this._core.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this)}_reset(){this._core.helper.taskScheduler.removeTask(ki),this._core.store.set("commercialConfig",{}),this._expirationTime=0,this._isFetching=!1,this._featureMap.clear(),this._purchaseBits="0"}},Oi=new class{constructor(){this._core=null,this._serverOverloadInfoMap=new Map}install(A){this._core=A;const{notificationCenter:e,InnerEvent:t,channel:i}=this._core;e.subscribeInnerEvent(t.OVERLOAD_PUSH,this._handleOverLoadPush,this),e.subscribeInnerEvent(t.LOGOUT,this._reset,this),e.subscribeInnerEvent(t.DESTROY,this._dispose,this),i.registerBeforeSendInterceptor(this.checkServerOverload,this)}checkServerOverload(A){if(!this._serverOverloadInfoMap.has(A))return;const{overloadStartTimestamp:e,delaySeconds:t}=this._serverOverloadInfoMap.get(A);if(Date.now()-e<=1e3*t)throw new this._core.helper.ChatError({functionName:A,message:"service is busy, please try again later"});this._serverOverloadInfoMap.delete(A)}_handleOverLoadPush(A){const{OverLoadServCmd:e,DelaySecs:t}=A;this._serverOverloadInfoMap.set(e,{overloadStartTimestamp:Date.now(),delaySeconds:t})}_reset(){this._serverOverloadInfoMap.clear()}_dispose(){this._reset();const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.OVERLOAD_PUSH,this._handleOverLoadPush,this),A.unSubscribeInnerEvent(e.LOGOUT,this._reset,this),A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this)}},xi=new class{constructor(){this.name="ConfigCenter"}install(A){Ri.init(A),Ti.install(A),Fi.install(A),Oi.install(A)}},Pi=new class{constructor(){this.name="ErrorMessage",this._core=null}install(A){return IA(this,void 0,void 0,function*(){if(this._core=A,this._canFetch()){const A=yield this._fetchErrorMessage();if(!A)return;const e=this._parseResponse(A);this._saveErrorMessage(e)}})}_canFetch(){const A=this._core.store.getStorage("errorMessage");return!A||this._isExpired(A)}_saveErrorMessage(A){this._core.store.setStorage("errorMessage",{errorMessage:A,errorMessageSavedTime:(new Date).getTime()})}_fetchErrorMessage(){return IA(this,void 0,void 0,function*(){try{return yield this._core.helper.httpRequest({method:"GET",url:"https://web.sdk.qcloud.com/im/download/error-message/v3/0.0.6/tim-error-message.txt"})}catch(E){console.error(E)}})}_isExpired(A){if(!A)return!0;const{errorMessageSavedTime:e}=A;return e&&(new Date).getTime()-e>=6048e5}_parseResponse(A){if("string"==typeof A){const e=A.split(";\n"),t={},i=new RegExp(/'/g);for(let A=0;A {var o,n,r;const s=function(A,e){const{From_Account:t,From_AccountHeadurl:i,From_AccountNick:o,IsNeedReadReceipt:n,MsgBody:r,MsgClientTime:s,MsgRandom:a,MsgSeq:g,MsgTimeStamp:c,SendMsgControl:l,SupportMessageExtension:I,To_Account:u,TinyId:E,MsgCheckResult:d,CloudCustomData:h,IsPeerRead:C,MsgFlagBits:B,MsgVersion:Q,EventArray:p}=A;return{from:t,avatar:i,nick:o,needReadReceipt:1===n,readReceiptSentByPeer:C,clientTime:s,messageFlagBits:B,random:a,sequence:g,time:c,messageControlInfo:l,isSupportExtension:I,to:u,tinyID:E,checkResult:d,cloudCustomData:h,messageVersion:Q,eventArray:p,elements:e.message.messageHelper.parseServerPushMessageElement(r)}}(A,e);if(null===(r=null===(n=null===(o=null==A?void 0:A.EventArray)||void 0===o?void 0:o[0])||void 0===n?void 0:n.hasOwnProperty)||void 0===r?void 0:r.call(n,"C2cNotifyMsgArray"))i.push(...function(A){var e;const t=[];return null===(e=A.EventArray)||void 0===e||e.forEach(A=>{var e,i;const{C2cNotifyMsgArray:o}=A,n=null===(i=null===(e=null==o?void 0:o[0])||void 0===e?void 0:e.WithdrawC2cMsgNotify)||void 0===i?void 0:i.C2cWithdrawInfoArray;Array.isArray(n)&&t.push(...n)}),t}(A));else{const A=e.message.messageFactory.createMessage(Object.assign(Object.assign({},s),{conversationType:"C2C",flow:"in"})),{elements:i}=s;A.setElement(i),t.push(A)}}),{unreadMessageList:t,revokedMessageList:i}}(A.MsgList,e);return{syncFlag:null==A?void 0:A.SyncFlag,unreadMessageList:n,revokedMessageList:a,unreadCountList:t,overflowUnreadCountList:i,cookie:null==A?void 0:A.Cookie,groupTipList:o}}catch(a){console.warn(a)}})}!function(A){A[A.START_SYNC=0]="START_SYNC",A[A.SYNCING=1]="SYNCING",A[A.SYNC_COMPLETE=2]="SYNC_COMPLETE"}(Li||(Li={})),function(A){A[A.LOGIN_SUCCESS=0]="LOGIN_SUCCESS",A[A.NEW_MESSAGE_RECEIVED=1]="NEW_MESSAGE_RECEIVED"}(Ui||(Ui={}));var Ji=new class{constructor(){this.name="UnreadMessageSynchronizer",this._unreadDBMessageMap=new Map,this._cookie=""}install(A){this._core=A;const{constants:e}=A;A.helper.registerWorkflowStep(e.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_RE_ONLINE,e.WORKFLOW_STEP.UNREAD_MESSAGE_SYNC,this._syncUnreadDBMessageAfterReOnline,this),A.helper.registerWorkflowStep(e.WORKFLOW_NAME.RECEIVE_C2C_NEW_MESSAGE,e.WORKFLOW_STEP.UNREAD_MESSAGE_SYNC,this._syncUnreadDBMessageAfterNewMessageReceived,this),A.helper.registerWorkflowStep(e.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_LOGIN,e.WORKFLOW_STEP.UNREAD_MESSAGE_SYNC,this._syncUnreadDBMessageAfterLogin,this),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.LOGOUT,this._reset,this),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.DESTROY,this._dispose,this)}_syncUnreadMessage(A){return IA(this,void 0,void 0,function*(){const{isAfterReOnline:e=!1,isAfterNewMessageReceived:t=!1,isAfterLogin:i=!1}=A||{};let o=Li.START_SYNC;const n=[],r=[],s=[],a=[];for(;this._canContinueSync({cookie:this._cookie,syncFlag:o});){const A=yield this._fetchUnreadDBMessage({cookie:this._cookie,syncFlag:o,syncTriggerEvent:t?Ui.NEW_MESSAGE_RECEIVED:Ui.LOGIN_SUCCESS});if(!A)break;const{unreadMessageList:i=[],revokedMessageList:g=[],overflowUnreadCountList:c,unreadCountList:l,groupTipList:I}=A;if(this._cookie=(null==A?void 0:A.cookie)||"",o=null==A?void 0:A.syncFlag,this._parseAndSaveUnreadMessageList(i),s.push(...g),this._updateConversationUnreadOptions({unreadCountList:l,overflowUnreadCountList:c,conversationUpdateFieldList:n}),Array.isArray(I)&&r.push(...I),e){const{messages:A}=this._handleNewMessageList(i);a.push(...A)}}return e?{conversationUpdateFieldList:n,revokedMessageList:s,unreadMessageMap:this._unreadDBMessageMap,groupTipList:r,messages:a}:{conversationUpdateFieldList:n,isInstantMessage:!i,isUnreadC2CMessage:!0,revokedMessageList:s,unreadMessageMap:this._unreadDBMessageMap,groupTipList:r}})}_syncUnreadDBMessageAfterLogin(){return IA(this,void 0,void 0,function*(){return this._cookie="",this._syncUnreadMessage({isAfterLogin:!0})})}_syncUnreadDBMessageAfterNewMessageReceived(A){return IA(this,void 0,void 0,function*(){if(1===A.data.Flag)return this._syncUnreadMessage({isAfterNewMessageReceived:!0})})}_updateConversationUnreadOptions(A){const{unreadCountList:e,overflowUnreadCountList:t,conversationUpdateFieldList:i}=A,{constants:{OuterConstant:{CONV_C2C:o,CONV_SYSTEM:n}}}=this._core;null==e||e.forEach(A=>{const{From_Account:e,UnreadCount:t}=A;if(e!==n){const A=i.find(({conversationID:A})=>A===`${o}${e}`);A?A.unreadCount=t:i.push({conversationID:`${o}${e}`,unreadCount:t,type:o})}}),null==t||t.forEach(A=>{const{From_Account:e,LastMsgTime:t}=A;e!==n&&(i.find(({conversationID:A})=>A===`${o}${e}`)||i.push({conversationID:`${o}${e}`,type:o,lastMsgTime:t}))})}_syncUnreadDBMessageAfterReOnline(){return IA(this,void 0,void 0,function*(){return this._syncUnreadMessage({isAfterReOnline:!0})})}_updateMessageProfile(A){var e;const{messageDataHandler:t}=this._core.message||{},i=null===(e=this._core.store.get("login"))||void 0===e?void 0:e.userId,{from:o,nick:n,avatar:r,conversationID:s=""}=A;if(o!==i){const e=t.getLatestMsgSentByPeer(s);if(e){const{nick:i,avatar:o}=e;n&&r?n===i&&r===o||t.updateNickAndAvatarOfSentMessage({conversationID:s,latestNick:n,latestAvatar:r,isSentByMe:!1}):(A.nick=i,A.avatar=o)}}else{const A=t.getLatestMsgSentByMe(s);!A||n===A.nick&&r===A.avatar||t.updateNickAndAvatarOfSentMessage({conversationID:s,latestNick:n,latestAvatar:r,isSentByMe:!0})}}_handleNewMessageList(A){const{messageDataHandler:e}=this._core.message||{},t=new Map,i=[];return A.forEach(A=>{this._updateMessageProfile(A);let o=1===A.isModified;if(e.isMessageSentByCurrentInstance(A)?A.isModified=o:o=!1,A.isOnlineMessage())A._onlineOnlyFlag=!0,e.isMessageSentByCurrentInstance(A)||i.push(A);else if(!e.isInMessageList(A)){if(e.storeConversationMessage(A)){const{conversationID:e,conversationType:i,conversationSubType:o,flow:n,_isExcludedFromUnreadCount:r,_isExcludedFromLastMessage:s}=A,a=s?"":A;t.has(e)?(t.get(e).lastMessage=a,"in"===n&&(r||t.get(e).unreadCount++)):t.set(e,{conversationID:e,type:i,subType:o,unreadCount:r||"in"!==n?0:1,lastMessage:a})}e.isMessageSentByCurrentInstance(A)&&!o||i.push(A)}}),{messages:i,conversationOptions:t}}_fetchUnreadDBMessage(A){return IA(this,void 0,void 0,function*(){const{ssoLog:e,utils:{safeStringify:t}}=this._core;try{const i="unread-message-synchronizer._fetchUnreadDBMessage";e.debug("_fetchUnreadDBMessage",`${i} options:${t(A)}`);const o=yield Yi(A,this._core);if(!o)return null;const{syncFlag:n,unreadMessageList:r,revokedMessageList:s,cookie:a,unreadCountList:g,overflowUnreadCountList:c,groupTipList:l}=o;return this._parseAndSaveUnreadMessageList(r),{syncFlag:n,cookie:a,unreadMessageList:r,revokedMessageList:s,unreadCountList:g,overflowUnreadCountList:c,groupTipList:l}}catch(i){console.log(i)}})}_canContinueSync({cookie:A,syncFlag:e}){var t;return e===Li.START_SYNC||e===Li.SYNCING&&!(null===(t=this._core)||void 0===t?void 0:t.helper.isEmpty(A))}_parseAndSaveUnreadMessageList(A){A.forEach(A=>{const{ID:e}=A;this._unreadDBMessageMap.set(e,A)})}_reset(){this._cookie="",this._unreadDBMessageMap.clear()}_dispose(){var A,e;null===(A=this._core)||void 0===A||A.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this),null===(e=this._core)||void 0===e||e.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this),this._reset()}},Hi=new class{init(A){var e;this._core=A,this._visibilityChangeHandler=this._handleVisibilityChange.bind(this),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.DESTROY,this._dispose,this),null===document||void 0===document||document.addEventListener("visibilitychange",this._visibilityChangeHandler),null===(e=this._core)||void 0===e||e.store.set("activityMonitor",{isActive:!0})}_handleVisibilityChange(){var A,e;const t="visible"===document.visibilityState;null===(A=this._core)||void 0===A||A.store.set("activityMonitor",{isActive:t}),null===(e=this._core)||void 0===e||e.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:t})}_reset(){var A;null===(A=this._core)||void 0===A||A.store.clear("activityMonitor")}_dispose(){document.removeEventListener("visibilitychange",this._visibilityChangeHandler);const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this),this._reset()}},qi=new class{init(A){var e;this._core=A,this._bindAppActivityEvent(),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.DESTROY,this._dispose,this),null===(e=this._core)||void 0===e||e.store.set("activityMonitor",{isActive:!0})}_bindAppActivityEvent(){var A,e,t,i,o;const{MINI_APP_NAMESPACE:n,IN_TT_MINI_GAME:r,IN_WX_MINI_GAME:s}=(null===(A=this._core)||void 0===A?void 0:A.utils)||{};r||s?(null===(e=null==n?void 0:n.onShow)||void 0===e||e.call(n,()=>{var A,e;null===(A=this._core)||void 0===A||A.store.set("activityMonitor",{isActive:!0}),null===(e=this._core)||void 0===e||e.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:!0})}),null===(t=null==n?void 0:n.onHide)||void 0===t||t.call(n,()=>{var A,e;null===(A=this._core)||void 0===A||A.store.set("activityMonitor",{isActive:!1}),null===(e=this._core)||void 0===e||e.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:!1})})):(null===(i=null==n?void 0:n.onAppShow)||void 0===i||i.call(n,()=>{var A,e;null===(A=this._core)||void 0===A||A.store.set("activityMonitor",{isActive:!0}),null===(e=this._core)||void 0===e||e.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:!0})}),null===(o=null==n?void 0:n.onAppHide)||void 0===o||o.call(n,()=>{var A,e;null===(A=this._core)||void 0===A||A.store.set("activityMonitor",{isActive:!1}),null===(e=this._core)||void 0===e||e.notificationCenter.emitInnerEvent("activityStatusChange",{isActive:!1})}))}_reset(){var A;null===(A=this._core)||void 0===A||A.store.clear("activityMonitor")}_dispose(){const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this),this._reset()}},Vi=new class{init(A){const{IN_MINI_APP:e,IN_WX_MINI_PLUGIN:t}=A.helper;t||(e?qi.init(A):Hi.init(A))}};const ji="none",Ki="online";var Wi=new class{init(A){this._core=A,this._activateNetworkMonitoring(),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.DESTROY,this._dispose,this)}_activateNetworkMonitoring(){return IA(this,void 0,void 0,function*(){navigator.onLine?this._onOnline():this._onOffline(),this._onOnlineCallback=this._onOnline.bind(this),this._onOfflineCallback=this._onOffline.bind(this),window.addEventListener("online",this._onOnlineCallback),window.addEventListener("offline",this._onOfflineCallback)})}_deactivateNetworkMonitoring(){null!==this._onOnlineCallback&&(window.removeEventListener("online",this._onOnlineCallback),this._onOnlineCallback=null),null!==this._onOfflineCallback&&(window.removeEventListener("offline",this._onOfflineCallback),this._onOfflineCallback=null)}_onNetworkStatusChange(A){var e,t;const{isConnected:i,networkType:o}=A;null===(e=this._core)||void 0===e||e.store.set("netWorkMonitor",{isNetworkOnline:i,networkType:o}),null===(t=this._core)||void 0===t||t.notificationCenter.emitInnerEvent("networkStatusChange",{isNetworkOnline:i,networkType:o})}_onOnline(){this._onNetworkStatusChange({isConnected:!0,networkType:Ki})}_onOffline(){this._onNetworkStatusChange({isConnected:!1,networkType:ji})}_reset(){var A;this._deactivateNetworkMonitoring(),null===(A=this._core)||void 0===A||A.store.clear("netWorkMonitor")}_dispose(){var A,e;null===(A=this._core)||void 0===A||A.notificationCenter.unSubscribeInnerEvent(null===(e=this._core)||void 0===e?void 0:e.InnerEvent.DESTROY,this._dispose,this),this._reset()}},zi=new class{init(A){this._core=A,this._activateNetworkMonitoring(),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.DESTROY,this._dispose,this)}_activateNetworkMonitoring(){return IA(this,void 0,void 0,function*(){try{const{utils:{MINI_APP_NAMESPACE:A}}=this._core;this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),A.onNetworkStatusChange(this._onNetworkStatusChange.bind(this))}catch(E){console.error(E)}})}_deactivateNetworkMonitoring(){if(null!==this._mpNetworkStatusCallback){const{utils:{MINI_APP_NAMESPACE:A}}=this._core;A.offNetworkStatusChange&&A.offNetworkStatusChange(this._mpNetworkStatusCallback),this._mpNetworkStatusCallback=null}}_onNetworkStatusChange(A){var e,t;const{isConnected:i,networkType:o}=A;null===(e=this._core)||void 0===e||e.store.set("netWorkMonitor",{isNetworkOnline:i,networkType:o}),null===(t=this._core)||void 0===t||t.notificationCenter.emitInnerEvent("networkStatusChange",{isNetworkOnline:i,networkType:o})}_reset(){var A;this._deactivateNetworkMonitoring(),null===(A=this._core)||void 0===A||A.store.clear("netWorkMonitor")}_dispose(){var A,e;null===(A=this._core)||void 0===A||A.notificationCenter.unSubscribeInnerEvent(null===(e=this._core)||void 0===e?void 0:e.InnerEvent.DESTROY,this._dispose,this),this._reset()}},Zi=new class{init(A){const{IN_MINI_APP:e}=A.utils;e?zi.init(A):Wi.init(A)}},Xi=new class{constructor(){this.name="SystemStateMonitor"}install(A){Vi.init(A),Zi.init(A)}};const $i=new Set(["tui_room_svr.*","callkit_records_svr.*","room_engine_srv.*","room_engine_http_srv.*","room_engine_mic.*","live_engine_srv.*","live_engine_http_srv.*","live_engine_pk.*","trtc_ai_service.*","call_engine_srv.*"]),Ao="tui_room_svr.*";var eo=new class{constructor(){this.name="BusinessCommandTransfer",this._transferredCommands=$i}install(A){this._core=A;const{notificationCenter:e,InnerEvent:t,helper:i}=A;e.subscribeInnerEvent(t.CLOUD_CONFIG_UPDATE,this._onCloudConfigUpdate,this),e.subscribeInnerEvent(t.LOGOUT,this._reset,this),e.subscribeInnerEvent(t.DESTROY,this._dispose,this),e.subscribeInnerEvent("im_open_push.msg_push",e.InnerEventSubType.BUSINESS_COMMAND,this._onServerPushBusinessCommand,this),i.registerExperimentalAPI("sendTRTCCustomData",this,"transferBusinessCommand"),i.registerExperimentalAPI("sendRoomCustomData",this,"transferBusinessCommand")}transferBusinessCommand(A){return IA(this,void 0,void 0,function*(){const e="transferBusinessCommand";try{const{serviceCommand:t=Ao}=A||{};if(!this._isValidTransferredCommand(t))throw new this._core.helper.ChatError({code:2995,functionName:e});return{code:0,data:(yield function(A,e){return IA(this,void 0,void 0,function*(){const{helper:t,channel:i}=e,{serviceCommand:o=Ao,data:n}=A||{};let r={};try{r="string"==typeof n?JSON.parse(n):n}catch(g){console.warn(g)}const s=t.generateProtocolData({servcmd:o,data:r}),a=`${s.head.seq}${o}`;return i.sendPacket(s,{requestId:a})})}(A,this._core))||{}}}catch(t){throw console.warn(t),new this._core.helper.ChatError({code:null==t?void 0:t.errorCode,message:null==t?void 0:t.errorInfo,data:{},functionName:e})}})}_onCloudConfigUpdate(A={}){try{if("string"!=typeof A.rtc_cmd)return;const e=JSON.parse(A.rtc_cmd);Array.isArray(e)&&(this._transferredCommands=new Set([...this._transferredCommands,...e]))}catch(e){console.log(e)}}_isValidTransferredCommand(A=""){const e=`${null==A?void 0:A.split(".")[0]}.*`;return this._transferredCommands.has(e)}_onServerPushBusinessCommand(A){const{OuterEvent:e,notificationCenter:t}=this._core,{MsgContent:i}=A||{},{ROOM_CUSTOM_DATA_RECEIVED:o}=e;t.emitOuterEvent(o,{name:o,data:i})}_reset(){this._transferredCommands=$i}_dispose(){const{notificationCenter:A,InnerEvent:e}=this._core;this._reset(),A.unSubscribeInnerEvent(e.CLOUD_CONFIG_UPDATE,this._onCloudConfigUpdate,this),A.unSubscribeInnerEvent(e.LOGOUT,this._reset,this),A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this),A.unSubscribeInnerEvent("im_open_push.msg_push",A.InnerEventSubType.BUSINESS_COMMAND,this._onServerPushBusinessCommand,this)}};const to=1,io=300;var oo=new class{constructor(){this.name="OfflineMessageSynchronizer",this._lastMessageSequenceMapOnDisconnect=new Map}install(A){this._core=A;const{common:{workflowManager:e},constants:{WORKFLOW_NAME:t,WORKFLOW_STEP:i,InnerEvent:o}}=A;e.registerWorkflowStep(t.SYNC_SERVER_INFO_AFTER_RE_ONLINE,i.HISTORY_MESSAGE_RECOVER,this._syncOfflineMessage,this),A.notificationCenter.subscribeInnerEvent(o.SOCKET_DISCONNECTED,this._updateLastMessageSequenceMapOnDisconnect,this)}_syncOfflineMessage(A){const{conversationList:e}=(null==A?void 0:A.result)||{},{OuterConstant:t,utils:{isArray:i}}=this._core;if(i(e)){const A=e.filter(A=>A.type===t.CONV_GROUP&&A.groupProfile.type!==t.GRP_AVCHATROOM);return this._recoverGroupHistoryMessage(A)}}_recoverGroupHistoryMessage(A){return IA(this,void 0,void 0,function*(){const{OuterConstant:e}=this._core,t=[],i=[];return yield Promise.all(null==A?void 0:A.map(A=>IA(this,void 0,void 0,function*(){const{groupProfile:{groupID:o}={},lastMessage:{lastSequence:n}={}}=A,r=`${e.CONV_GROUP}${o}`;let s=this._getLocalLastMessageSequence(r);this._shouldRecoverHistory({localLastMessageSequence:s,serverLastMessageSequence:n})&&(yield this._recoverHistoryForConversation({conversationID:r,localLastMessageSequence:s,serverLastMessageSequence:n,groupTipList:i})),t.push(r.replace(e.CONV_GROUP,""))}))),{recoverRevokeNoticeGroupIDList:t,groupTipList:i}})}_recoverHistoryForConversation(A){return IA(this,arguments,void 0,function*({conversationID:A,localLastMessageSequence:e,serverLastMessageSequence:t,groupTipList:i}){try{const{utils:{isArray:o,isObject:n,isEmpty:r},OuterEvent:s,OuterConstant:a,notificationCenter:g,message:c,appStore:l,common:{getMessagePreviewText:I}}=this._core,u=t-e,E=Math.min(20,u),d={},h=yield c.messageHistory.getGroupRoamingMessagesByAnchor({conversationID:A,sequence:e+E,direction:a.Direction.FORWARD,count:E}),{nextReqMessageIDFromServer:C,hasNoMoreHistoryMessage:B,messageList:Q,serverGroupTipList:p}=h;o(p)&&i.push(...p);const f=B&&C<0,m=[];if(o(Q)&&(Q.forEach(A=>{c.messageReceiver.groupMessageReceiver.updateMessageProfile(A),A.from===a.CONV_SYSTEM&&(A.isSystemMessage=!1),c.messageDataHandler.storeConversationMessage(A)&&!r(A.payload)&&(m.push(A),A._isExcludedFromLastMessage||(d.lastMessage=Object.assign({},A)))}),m.length>0&&g.emitOuterEvent(s.MESSAGE_RECEIVED,{name:s.MESSAGE_RECEIVED,data:m})),!f&&Q.length>0){const e=Q[Q.length-1].sequence;yield this._recoverHistoryForConversation({conversationID:A,localLastMessageSequence:e,serverLastMessageSequence:t,groupTipList:i})}n(d.lastMessage)&&(d.lastMessage.messageForShow=I(d.lastMessage.type,d.lastMessage.payload),l.conversationStore.updateConversation(A,d))}catch(o){this._core.ssoLog.error("_recoverHistoryForConversation",`Recovery failed for conversation:${A}`,{error:o})}})}_updateLastMessageSequenceMapOnDisconnect(){const{message:A}=this._core,e=A.messageDataHandler.getContinuousMessagesByConversation();for(const[t,i]of e){if(t.startsWith("C2C"))continue;const A=Array.from(i.values());if((null==A?void 0:A.length)>0){const e=A[A.length-1].sequence;this._lastMessageSequenceMapOnDisconnect.set(t,e)}}}_getLocalLastMessageSequence(A){const{message:e}=this._core;if(this._lastMessageSequenceMapOnDisconnect.has(A))return this._lastMessageSequenceMapOnDisconnect.get(A);const t=e.messageDataHandler.getLocalMessageList(A),i=t[t.length-1];return null==i?void 0:i.sequence}_shouldRecoverHistory(A){const{localLastMessageSequence:e,serverLastMessageSequence:t}=A;if("number"!=typeof e||"number"!=typeof t)return!1;const i=t-e;return 0!==t&&e>0&&i>=to&&i e(A)&&A.slice(0,3)===Qt.CONV_C2C,isCommunity:Ii,isGroupConv:A=>e(A)&&A.slice(0,5)===Qt.CONV_GROUP,isTopic:ui,isUnlimitedAVChatRoom:function(){var A;return!!(null===(A=At.store.get("instance"))||void 0===A?void 0:A.unlimitedAVChatRoom)},liteChatInstanceMap:li,registerInterceptor:si,registerValidateConfig:ai,requireAuth:Ai,get sdkEdition(){return ao},updateGroupAtInfo:(A,e)=>{const{CONV_AT_ME:t,CONV_AT_ALL:i,CONV_AT_ALL_AT_ME:o}=St;if(function(A,e){const{CONV_AT_ME:t,CONV_AT_ALL:i,CONV_AT_ALL_AT_ME:o}=St,{groupID:n,sequence:r}=A;let s=!1;return Ii({groupID:n})?(e.forEach(e=>{e.messageSequence===r&&(e.atTypeArray.includes(t)&&A.groupAtType.includes(i)&&(e.atTypeArray=[o]),e.atTypeArray.includes(i)&&A.groupAtType.includes(t)&&(e.atTypeArray=[o],e.__random=A.__random,e.__sequence=A.__sequence),s=!0)}),s):s}(A,e))return;let n=[...A.groupAtType];n.includes(t)&&n.includes(i)&&(n=[o]);const r={from:A.from,groupID:A.groupID,topicID:A.topicID,messageSequence:A.sequence,atTypeArray:n,__random:A.__random,__sequence:A.__sequence};e.push(r)},validateAndExecute:ri,validateParameters:ei});class lo{constructor(){this._builtInPlugins=new Set,this._externalPlugins=new Set}static getInstance(){return lo._instance||(lo._instance=new lo),lo._instance}static setInstance(A){lo._instance=A}installBuiltInPlugin(A){A&&this._installPlugin(A,this._builtInPlugins)}installExternalPlugin(A){A&&this._installPlugin(A,this._externalPlugins)}clear(){this._builtInPlugins=new Set,this._externalPlugins=new Set}_installPlugin(A,e){let t=[];t=i(A)?A:[A];const o=t.findIndex(A=>"AVChatRoom"===(null==A?void 0:A.name)),n=o>-1?t.splice(o,1):[];t.forEach(A=>{this._isPluginInstalled(A.name)||(A&&et(A.install)?(e.add(A.name),et(A.getInstalledSubPlugins)?A.install(Bo.getInstance().exposeApiForPlugin(),n):A.install(Bo.getInstance().exposeApiForPlugin()),et(A.handleLoginSuccess)&&this._isLoggedIn()&&A.handleLoginSuccess()):et(A)?(e.add(A.name),A(Bo.getInstance().exposeApiForPlugin()),et(A.handleLoginSuccess)&&this._isLoggedIn()&&A.handleLoginSuccess()):console.warn('A plugin must either be a function or an object with an "install" function.'))})}_isPluginInstalled(A){return this._builtInPlugins.has(A)||this._externalPlugins.has(A)}_isLoggedIn(){var A;return!0===(null===(A=At.store.get("login"))||void 0===A?void 0:A.isLoggedIn)}}var Io=new class{constructor(){this._conversationMap=new Map}getConversationMap(){return this._conversationMap}getConversation(A){return this._conversationMap.get(A)}updateConversation(A,e,t={emit:!0,needSort:!1}){const{emit:i,needSort:o}=t,n=this._conversationMap.get(A);n&&!BA(e)&&(Object.keys(e).forEach(A=>{n[A]=e[A]}),i&&At.notificationCenter.emitInnerEvent(at.CONVERSATION_UPDATED,{needSort:o}))}deleteConversation(A){this._conversationMap.has(A)&&(this._conversationMap.delete(A),At.notificationCenter.emitInnerEvent(at.CONVERSATION_UPDATED))}},uo=new class{constructor(){this._groupMap=new Map}getGroupMap(){return this._groupMap}getGroup(A){return this._groupMap.get(A)}updateGroup(A,e){const t=this._groupMap.get(A);t&&!BA(e)&&Object.keys(e).forEach(A=>{t[A]=e[A]})}},Eo=new class{constructor(){this._messagesByConversation=new Map}updateMessage(A,e,t){var i;const{operation:o,updateUnreadCount:n=!0}=t,r=lA(t,["operation","updateUnreadCount"]),s=[];for(const a of e){const e=null===(i=this._messagesByConversation.get(A))||void 0===i?void 0:i.get(a);if(!e)return!1;Object.keys(r).forEach(A=>{e[A]=r[A]}),s.push(e)}return this._emitMessageStoreOperationEvent(o,{conversationID:A,messageList:s,updateUnreadCount:n}),s}getMessagesByConversation(A){var e;return[...(null===(e=this._messagesByConversation.get(A))||void 0===e?void 0:e.values())||[]]}getMessages(){return this._messagesByConversation}_emitMessageStoreOperationEvent(A,e){const{conversationID:t}=e;ui(t)?At.notificationCenter.emitInnerEvent(ht[A],e):At.notificationCenter.emitInnerEvent(A,e)}},ho=new class{constructor(){this.userProfileMap=new Map,this.friendMap=new Map}getUserProfileMap(){return this.userProfileMap}getFriendMap(){return this.friendMap}getUserProfile(A){return this.userProfileMap.get(A)}getFriend(A){return this.friendMap.get(A)}},Co=Object.freeze({__proto__:null,conversationStore:Io,groupStore:uo,messageStore:Eo,userStore:ho});class Bo{static getInstance(){return Bo._instance||(Bo._instance=new Bo),Bo._instance}static setInstance(A){Bo._instance=A}constructor(){this._experimentalApiMap={statTUIKeyFeatures:this.statKeyFeatureUsage.bind(this),setApplicationID:this.setApplicationID.bind(this)},this._apiHandlersMap={},this._apiMap={on:At.notificationCenter.subscribeOuterEvent.bind(At.notificationCenter),off:At.notificationCenter.unSubscribeOuterEvent.bind(At.notificationCenter),destroy:this.destroy.bind(this),callExperimentalAPI:this.callExperimentalAPI.bind(this),use:lo.getInstance().installExternalPlugin.bind(lo.getInstance()),registerPlugin:this.registerPlugin.bind(this),setLogLevel:this.setLogLevel.bind(this)}}registerPlugin(A){At.ssoLog.debug("registerPlugin",A)}statKeyFeatureUsage(A){At.ssoLog.debug("statTUIKeyFeatures",A)}setLogLevel(A){At.ssoLog.debug("setLogLevel",A),At.ssoLog.setLogLevel(A)}setApplicationID(A){At.store.set("instance",{applicationID:A})}getApiMap(){return this._apiMap}setApiMap(A){this._apiMap=A}registerApi(A){const{common:{timeManager:e},utils:{safeStringify:t}}=At,{apiName:i,context:o,methodName:n=i,matcher:r}=A;this._apiHandlersMap[i]||(this._apiHandlersMap[i]=[]),this._apiHandlersMap[i].push({context:o,methodName:n,matcher:r}),this._apiMap[i]&&1!==this._apiHandlersMap[i].length||(this._apiMap[i]=(...A)=>{const o=e.getServerTimeMs();let r=0;"login"===i&&(r=4),kt.includes(i)&&At.ssoLog.debug(i,`${i} start params: ${t(A)}`),ri(n,A);const s=this._apiHandlersMap[i];for(const t of s)if(!t.matcher||t.matcher(A))try{const e=t.context[t.methodName].bind(t.context)(...A);return this._isPromiseLike(e)?this._handleAsyncResult(e,i,r,o):(this._reportApiSuccessLog({result:e,apiName:i,eventType:r,startTime:o}),e)}catch(a){throw At.ssoLog.error(i,`${i} fail ${(null==a?void 0:a.errorMessage)||(null==a?void 0:a.message)})`,{error:a,costTime:e.getServerTimeMs()-o,eventType:r,method:i}),a}})}registerExperimentalAPI(A,e,t){const i=t||A;this._experimentalApiMap[A]=e[i].bind(e)}destroy(){return IA(this,void 0,void 0,function*(){var A,e;try{(null===(A=At.store.get("login"))||void 0===A?void 0:A.isLogin)&&(yield this._apiMap.logout()),At.notificationCenter.emitInnerEvent(at.DESTROY)}catch(t){console.debug("destroy error: ",t)}finally{At.notificationCenter.emitOuterEvent(rt.SDK_DESTROY,{SDKAppID:null===(e=At.store.get("instance"))||void 0===e?void 0:e.sdkAppId}),li.clear(),lo.getInstance().clear(),ci.getInstance().destroy(),At.destroy()}})}exposeApiForClient(){return this._apiMap}exposeApiForPlugin(){return Object.assign(Object.assign({InnerEvent:at,InnerEventSubType:At.notificationCenter.InnerEventSubType,OuterEvent:rt,OuterConstant:St,SignalingEvent:gt,helper:Object.assign(Object.assign(Object.assign({},At.utils),At.common),{registerApi:this.registerApi.bind(this),registerExperimentalAPI:this.registerExperimentalAPI.bind(this),registerInterceptor:si,registerValidateConfig:ai,checkBusinessCapabilityBits:gi,registerWorkflowStep:ci.getInstance().registerWorkflowStep.bind(ci.getInstance()),ChatError:$t}),apiMap:this._apiMap},At),{constants:Object.assign(Object.assign({},Ot),At.constants),common:Object.assign(Object.assign(Object.assign({},co),At.common),{workflowManager:ci.getInstance()}),utils:At.utils,appStore:Co})}callExperimentalAPI(A,e){return At.ssoLog.debug(`callExperimentalAPI.${A} start params: ${At.utils.safeStringify(e)}`),this._experimentalApiMap[A]?this._experimentalApiMap[A](e):Promise.reject(new $t({code:Mt.INVALID_OPERATION}))}_isPromiseLike(A){return null!==A&&"object"==typeof A&&"function"==typeof A.then}_handleAsyncResult(A,e,t,i){return A.then(A=>(this._reportApiSuccessLog({result:A,apiName:e,eventType:t,startTime:i}),A)).catch(A=>{throw At.ssoLog.error(e,`${e} fail ${(null==A?void 0:A.errorMessage)||(null==A?void 0:A.message)})`,{error:A,costTime:At.common.timeManager.getServerTimeMs()-i,eventType:t,method:e}),A})}_reportApiSuccessLog(A){let{result:e,apiName:t,startTime:i,eventType:o}=A;const{timeManager:n}=At.common,{successLog:{message:r,moreMessage:s}={message:"",moreMessage:""}}=e||{},a=n.getServerTimeMs();"login"===t&&(i+=n.getTimeOffsetWithServer()),kt.includes(t)&&At.ssoLog.info(t,`${t} success ${r} ${s}`,{costTime:a-i,eventType:o,message:r,moreMessage:s}),(null==e?void 0:e.successLog)&&delete e.successLog}}class Qo{constructor(){this._latestLoginAt=0,this._latestSendOnlinePresenceRequestTime=0,this._helloInterval=120,this._customLoginInfo=""}init(){const{notificationCenter:A,store:e}=At;e.set("login",{isReady:!1}),Bo.getInstance().registerApi({apiName:"login",context:this}),Bo.getInstance().registerApi({apiName:"logout",context:this}),Bo.getInstance().registerApi({apiName:"getLoginUser",context:this}),Bo.getInstance().registerApi({apiName:"isReady",context:this}),Bo.getInstance().registerExperimentalAPI("setCustomLoginInfo",this),A.subscribeInnerEvent(at.RECONNECTED,this._reLogin,this),At.notificationCenter.subscribeInnerEvent(at.DESTROY,this._dispose,this)}login(A){return IA(this,void 0,void 0,function*(){var e;const{sdkEdition:t}=At.store.get("instance")||{};try{if(this._isLoginIn())return this._createRepeatLoginResponse();if(this._isLoginFrequencyExceeded())throw new $t({functionName:"login",code:Mt.REPEAT_LOGIN});const i=yield this._performLogin(A);this._validateAfterLogin(i),this._handleLoginSuccess(i),yield this._ensureAsyncComplete(),this._updateAndEmitSDKReady(),this._latestLoginAt=0;const o=null===(e=At.channel.getSocketAdapter())||void 0===e?void 0:e.getId(),{appId:n,href:r}=At.store.get("instance")||{},{instanceID:s,customStatus:a}=i||{};return{code:0,data:i,successLog:{message:t,moreMessage:`socketID:${o} instanceID:${s} customStatus:${a} href: ${r} appId: ${n}`}}}catch(i){const{errorCode:A}=i;A!==Mt.REPEAT_LOGIN&&(this._latestLoginAt=0);const e=new $t({functionName:"login",code:A});throw console.error(e),e}})}_reLogin(){return IA(this,void 0,void 0,function*(){var A;try{if(!this._isLoginIn())return;const e=yield Zt(this._customLoginInfo);if(e){const{instanceID:t,customStatus:i}=e;At.store.set("login",{statusInstanceId:t}),ci.getInstance().executeWorkflow(_t.SYNC_SERVER_INFO_AFTER_RE_ONLINE,{customStatus:i,statusType:Ct.USER_STATUS_ONLINE});const o=null===(A=At.channel.getSocketAdapter())||void 0===A?void 0:A.getId();At.ssoLog.info("reLogin",`socketId:${o} instanceId:${t}`)}}catch(e){console.warn(e)}})}logout(){return IA(this,arguments,void 0,function*(A=Lt.USER_INITIATED){const{ssoLog:e}=At;e.debug("logout",`logout start logoutReason: ${A}`);try{yield this._performLogout(A),e.info("logout","logout success"),At.ssoLog.uploadSSOLogData()}catch(t){const{errorCode:A}=t;throw new $t({functionName:"logout",code:A})}finally{this._handleLogoutCompleted()}return{code:0,data:{}}})}getLoginUser(){return this._isLoginIn()?pi():""}isReady(){var A;return null===(A=At.store.get("login"))||void 0===A?void 0:A.isReady}setCustomLoginInfo(A=""){this._customLoginInfo=A}_updateAndEmitSDKReady(){At.store.set("login",{isReady:!0}),setTimeout(()=>{At.notificationCenter.emitOuterEvent(rt.SDK_READY,{name:rt.SDK_READY})},1)}_updateAndEmitSDKNotReady(){At.store.set("login",{isReady:!1}),At.notificationCenter.emitOuterEvent(rt.SDK_NOT_READY,{name:rt.SDK_NOT_READY})}_validateAfterLogin(A){const e="login";if(!A)throw new $t({functionName:e,message:"login response is empty"});const{tinyID:t,a2Key:i}=A||{};if(!t)throw new $t({functionName:e,code:Mt.NO_TINYID});if(!i)throw new $t({functionName:e,code:Mt.NO_A2KEY})}_createRepeatLoginResponse(){var A;return{code:0,data:{actionStatus:"OK",errorCode:0,errorInfo:Xt({code:"RepeatLogin",replacement1:null===(A=At.store.get("login"))||void 0===A?void 0:A.userId}),repeatLogin:!0}}}_performLogin(A){return IA(this,void 0,void 0,function*(){const{userID:e,userSig:t}=A;return At.store.set("login",{userId:e,userSig:t}),this._latestLoginAt=Date.now(),Zt(this._customLoginInfo)})}_ensureAsyncComplete(){return IA(this,void 0,void 0,function*(){yield new Promise(A=>{setTimeout(()=>A(null),1)})})}_handleLoginSuccess(A){const{timeManager:e}=At.common,{helloInterval:t,timeStamp:i,customStatus:o,purchaseBits:n}=A,r=1e3*i;e.calculateTimeOffsetWithServer(this._latestLoginAt,r),this._helloInterval=t||120,this._updateLoginStore(A),At.user.userStatus.setCustomStatus(o),ci.getInstance().executeWorkflow(_t.SYNC_SERVER_INFO_AFTER_LOGIN,{purchaseBits:n}),At.common.taskScheduler.addTask({id:Pt,intervalMs:1e3*this._helloInterval,callback:this._sendOnlinePresenceRequest,context:this})}_performLogout(A){return function(A){return IA(this,void 0,void 0,function*(){const{logoutReason:e}=A,t="im_open_status.wslogout",i=At.common.generateProtocolData({servcmd:t,data:{wslogout_type:e,isWebUniapp:0}}),o=`${i.head.seq}${t}`;return yield At.channel.sendPacket(i,{requestId:o})})}({logoutReason:A})}_handleLogoutCompleted(){this._updateAndEmitSDKNotReady(),this._reset(),ci.getInstance().reset(),At.notificationCenter.emitInnerEvent("logout")}_updateLoginStore(A){const{a2Key:e,tinyID:t,instanceID:i,authKey:o}=A;At.store.set("login",{a2Key:e,tinyID:t,statusInstanceId:i,authKey:o,isLoggedIn:!0})}_sendOnlinePresenceRequest(){return IA(this,void 0,void 0,function*(){this._latestSendOnlinePresenceRequestTime=Date.now();try{yield function(){const A="im_open_status.wshello",e=At.common.generateProtocolData({servcmd:A,data:{isWebUniapp:0}}),t=`${e.head.seq}${A}`;return At.channel.sendPacket(e,{requestId:t})}()}catch(E){At.ssoLog.warn("_sendOnlinePresenceRequest",` error:${E.message}`)}})}_isLoginIn(){var A;return!0===(null===(A=At.store.get("login"))||void 0===A?void 0:A.isLoggedIn)}_isLoginFrequencyExceeded(){return Date.now()-this._latestLoginAt<=15e3}_reset(){At.common.taskScheduler.removeTask(Pt),this._helloInterval=120,this._latestSendOnlinePresenceRequestTime=0,this._latestLoginAt=0,this._customLoginInfo="",At.store.clear("login"),At.store.set("login",{isReady:!1}),At.store.set("instance",{applicationID:0})}_dispose(){this._reset();const{notificationCenter:A}=At;A.unSubscribeInnerEvent(at.RECONNECTED,this._reLogin,this),A.unSubscribeInnerEvent(at.DESTROY,this._dispose,this)}}const po={login:{userID:{required:!0,rules:["string"],allowEmpty:!1},userSig:{required:!0,rules:["string"],allowEmpty:!1}}},fo={logout:!0};class mo{constructor(){this.loginAction=new Qo,this.kickedOutHandler=new zt,this.loginAction.init(),this.kickedOutHandler.init(),ai({auth:fo,params:po})}}var yo,Do,vo;!function(A){A.CONV_C2C="C2C",A.CONV_GROUP="GROUP",A.CONV_TOPIC="TOPIC",A.CONV_SYSTEM="@TIM#SYSTEM"}(yo||(yo={})),function(A){A.MSG_PRIORITY_HIGH="High",A.MSG_PRIORITY_NORMAL="Normal",A.MSG_PRIORITY_LOW="Low",A.MSG_PRIORITY_LOWEST="Lowest"}(Do||(Do={})),function(A){A.MSG_TEXT="TIMTextElem",A.MSG_CUSTOM="TIMCustomElem",A.MSG_LOCATION="TIMLocationElem",A.MSG_FACE="TIMFaceElem",A.MSG_IMAGE="TIMImageElem",A.MSG_AUDIO="TIMSoundElem",A.MSG_FILE="TIMFileElem",A.MSG_VIDEO="TIMVideoFileElem",A.MSG_GRP_TIP="TIMGroupTipElem",A.MSG_GRP_SYS_NOTICE="TIMGroupSystemNoticeElem",A.MSG_MERGER="TIMRelayElem"}(vo||(vo={}));const wo={1:Do.MSG_PRIORITY_HIGH,2:Do.MSG_PRIORITY_NORMAL,3:Do.MSG_PRIORITY_LOW,4:Do.MSG_PRIORITY_LOWEST},So=0,Mo=1;var Ro;!function(A){A.IN="in",A.OUT="out"}(Ro||(Ro={}));const _o=2,To={};function No(A){if(!A)return 0;if(void 0===To[A]){const e=new Date,t=`3${e.getHours()}`.slice(-2),i=`0${e.getMinutes()}`.slice(-2),o=`0${e.getSeconds()}`.slice(-2);To[A]=parseInt([t,i,o,"0001"].join(""),10),console.log(`autoIncrementIndex start index:${To[A]}`)}else To[A]+=1;return To[A]}class bo{constructor(A){this.ID="",this.random=0,this.sequence=0,this.nameCard="",this.isRead=!1,this.isPeerRead=!1,this.isDeleted=!1,this.isResend=!1,this.hasRiskContent=!1,this._onlineOnlyFlag=!1,this.atUserList=[],this._groupAtInfoList=[],this.isBroadcastMessage=!1,this.priority=Do.MSG_PRIORITY_NORMAL,this._relayFlag=!1;const{clientTime:e=At.common.timeManager.getServerTimeSeconds()||0,senderTinyID:t,currentUser:i,needReadReceipt:o,isSupportExtension:n,customModerationConfigurationId:r,to:s,from:a,nick:g="",avatar:c="",time:l,messageControlInfo:I,tinyID:u,cloudCustomData:E="",messageLifeTime:d,messageVersion:h=0,conversationType:C,sequence:B,checkResult:Q=0,isPlaceMessage:p=0,messageFlagBits:f,receiverList:m,isSystemMessage:y=!1,status:D=It.SUCCESS,revokeReason:v="",conversationSubType:w,clientSequence:S,protocol:M="JSON",revokerInfo:R={userID:"",nick:"",avatar:""},readReceiptInfo:_={readCount:void 0,unreadCount:void 0,isPeerRead:void 0,timestamp:0},random:T,groupProfile:N,atUserList:b,flow:G,isRead:k=!1,priority:L=Do.MSG_PRIORITY_NORMAL}=A;var U;this.clientTime=e,this.senderTinyID=t||u,this.needReadReceipt=!0===o||1===o,this.isSupportExtension=!0===n||1===n,this._cmConfigID=r,this.to=s,this.nick=g,this.avatar=c,this.protocol=M,this.random=void 0===T?(U=U||99999999,Math.round(Math.random()*U)):T,this.time=l||Math.ceil(Date.now()/1e3),this._isExcludedFromLastMessage=!!(null==I?void 0:I.excludedFromLastMessage),this._isExcludedFromUnreadCount=!!(null==I?void 0:I.excludedFromUnreadCount),this.isModified=!!h,this.cloudCustomData=E,this.messageLifeTime=d,this.from=a||null,this.sequence=B||0,this.conversationType=C||yo.CONV_C2C,this.hasRiskContent=Q>1,this.version=h,this.isPlaceMessage=p,this.isRevoked=2===p||8===f,this.isSystemMessage=y,this.readReceiptInfo=_,this.revokeReason=v,this.revokerInfo=R,this._receiverList=m,this.conversationSubType=w,this.revoker=(null==R?void 0:R.revoker)||"",this.clientSequence=S||B||0,this.status=D,this.atUserList=b||[],this.flow=G,this.isRead=k,this.priority=L,this.reInitialize(i),this._initC2CReadReceiptInfo(A),this._extractGroupInfo(N)}getElements(){return this._elements}isOnlineMessage(){return 0===this.messageLifeTime}setElement(A){Array.isArray(A)?this._elements=A:this._elements=[A],this._updatePayloadAndType()}transformElementsToServerFormat(){return this._elements?Array.isArray(this._elements)?this._elements.map(A=>A.transformToServerFormat()):this._elements.transformToServerFormat():null}setRelayFlag(A){this._relayFlag=A}validateBeforeSend(){var A,e,t;return this._relayFlag?{isValid:!0}:(null===(A=this._elements)||void 0===A?void 0:A.length)>0?null===(t=null===(e=this._elements[0])||void 0===e?void 0:e.validateBeforeSend)||void 0===t?void 0:t.call(e):{isValid:!1}}_updatePayloadAndType(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}_initC2CReadReceiptInfo(A){const{readReceiptSentByPeer:e,timestamp:t=0}=A;this.conversationType===yo.CONV_C2C&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===e,this.readReceiptInfo.timestamp=t)}_extractGroupInfo(A){if(!A)return;const{From_AccountNick:e,From_AccountHeadurl:t,MsgFrom_AccountExtraInfo:i}=A,{NameCard:o}=i||{};"string"==typeof e&&(this.nick=e),"string"==typeof t&&(this.avatar=t),"string"==typeof o&&(this.nameCard=o)}reInitialize(A){A===this.from&&(this.isRead=!0),this._initSequence(A),this._concatConversationID(A),this.generateMessageID()}_concatConversationID(A){let e="";const t=this.conversationType;t!==yo.CONV_SYSTEM?(e=t===yo.CONV_C2C?A===this.from?this.to:this.from:this.to,this.conversationID=e?`${t}${e}`:null):this.conversationID=yo.CONV_SYSTEM}_initSequence(A){0===this.clientSequence&&A&&(this.clientSequence=No(A)),0===this.sequence&&this.conversationType===yo.CONV_C2C&&(this.sequence=this.clientSequence)}generateMessageID(){this.from===yo.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID=`${this.senderTinyID}-${this.clientTime}-${this.random}`}setIsRead(A){this.isRead=A}}class Go{static parseServerPushElement(A){const{MsgContent:e={}}=A,{Data:t,Ext:i,Desc:o}=e;return new Go({data:t,description:o,extension:i})}constructor(A){this.type=vo.MSG_CUSTOM;const{data:e="",description:t="",extension:i=""}=A;this.content={data:e,description:t,extension:i}}transformToServerFormat(A){const{isMergerMessage:e=!1}=A||{},t=e?this.payload:this.content,{data:i,description:o,extension:n}=t;return{MsgType:this.type,MsgContent:{Data:i,Ext:n,Desc:o}}}validateBeforeSend(){const{isEmpty:A}=At.utils,e=[this.content.data,this.content.description,this.content.extension].some(e=>!A(e));return{isValid:e,error:e?null:{message:"content can not be empty"}}}}class ko{static parseServerPushElement(A){const{MsgContent:e={Text:""}}=A,{Text:t}=e;return new ko({text:t})}constructor(A){this.type=lt.MSG_TEXT,this.content={text:A.text||""}}validateBeforeSend(){var A,e;return(null===(e=null===(A=this.content)||void 0===A?void 0:A.text)||void 0===e?void 0:e.length)>0?{isValid:!0}:{isValid:!1,error:{message:"content can not be empty"}}}transformToServerFormat(A){const{isMergerMessage:e=!1}=A||{},t=e?this.payload:this.content,{text:i}=t;return{MsgType:this.type,MsgContent:{Text:i}}}}var Lo=new class{constructor(){this._elementClassMap={[vo.MSG_CUSTOM]:Go,[vo.MSG_TEXT]:ko}}init(){Bo.getInstance().registerApi({apiName:"createCustomMessage",context:this}),Bo.getInstance().registerApi({apiName:"createTextMessage",context:this})}registerElementClass(A,e){var t;void 0!==(t=e).prototype&&"constructor"in t.prototype&&(this._elementClassMap[A]=e)}getElementClass(A){return this._elementClassMap[A]}createMessage(A){const{from:e,flow:t=Ro.OUT}=A,{userId:i}=At.store.get("login")||{};this._isSendByCurrentInstance({from:e,flow:t,currentUser:i})?this._updateWithSenderInfo(A):this._isMultiEndpointSyncMessage({from:e,flow:t,currentUser:i})&&(A.flow=Ro.OUT);const o=Object.assign(Object.assign({},A),{currentUser:i});return new bo(o)}createCustomMessage(A){const e=pi(),t=this.createMessage(Object.assign(Object.assign({},A),{from:e})),i=this._elementClassMap[vo.MSG_CUSTOM];if(!t)return null;if(i){const e=new i(A.payload);t.setElement(e)}return t}createTextMessage(A){var e;if(!A)return null;const t="string"==typeof A.payload?A.payload:(null===(e=null==A?void 0:A.payload)||void 0===e?void 0:e.text)||"",i=new ko({text:t}),o=pi(),n=At.message.messageFactory.createMessage(Object.assign(Object.assign({},A),{from:o}));return n.setElement(i),n}_updateWithSenderInfo(A){const{nick:e,avatar:t}=A,{userId:i,tinyID:o}=At.store.get("login")||{},n=ho.getUserProfile(i);return A.nick=e||(null==n?void 0:n.nick)||"",A.avatar=t||(null==n?void 0:n.avatar)||"",A.tinyID=A.tinyID||o||"",A.from=i,A.status=It.UNSENT,A.flow=Ro.OUT,A}_isMultiEndpointSyncMessage(A){const{from:e,flow:t,currentUser:i}=A;return e===i&&t===Ro.IN}_isSendByCurrentInstance(A){const{from:e,flow:t,currentUser:i}=A;return e===i&&t===Ro.OUT}};const Uo={PushFlag:0,Title:"",Desc:"",Ext:"",ApnsInfo:{Sound:"",BadgeMode:0,IsVoipPush:void 0,Image:"",InterruptionLevel:"active",ContentAvailable:0},AndroidInfo:{Sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:"",MeizuNotifyType:void 0}},Fo={HonorImportance:{range:["LOW","NORMAL"],defaultValue:void 0},MeizuNotifyType:{range:[0,1],defaultValue:void 0}},Oo={enableIOSBackgroundNotification:{range:[!0,!1],defaultValue:!1},interruptionLevel:{range:["passive","active","time-sensitive","critical"],defaultValue:"active"}};function xo(A,e){return Object.keys(e).forEach(t=>{const{range:i,defaultValue:o}=e[t];A[t]=i.includes(A[t])?A[t]:o}),A}function Po(A){const e=A.lastIndexOf(".");return-1===e?A:A.slice(0,e)}function Yo(A){const{androidInfo:e={},androidOPPOChannelID:t=""}=A,i=e.OPPOChannelID||t,o=xo(e,Fo),{sound:n="",FCMChannelID:r=""}=o,s=lA(o,["sound","FCMChannelID"]);return Object.assign(Object.assign({},s),{Sound:Po(n),OPPOChannelID:i,GoogleChannelID:r})}function Jo(e){const{apnsInfo:t={},ignoreIOSBadge:i=!1,disableVoipPush:o}=e,n=xo(t,Oo),{ignoreIOSBadge:r,disableVoipPush:s,enableIOSBackgroundNotification:a}=n,g=lA(n,["ignoreIOSBadge","disableVoipPush","enableIOSBackgroundNotification"]),c=!0===r||!0===i?1:0;let l;return A(o)||(l=!1===o?1:0),A(s)||(l=!1===s?1:0),Object.assign(Object.assign({},g),{BadgeMode:c,IsVoipPush:l,ContentAvailable:a?1:0})}function Ho(A){return At.utils.isPlainObject(A)?{PushFlag:!0===A.disablePush?1:0,Title:A.title||"",Desc:A.description||"",Ext:A.extension||"",ApnsInfo:Jo(A),AndroidInfo:Yo(A)}:Uo}function qo(A){const{From_AccountHeadurl:e,From_AccountNick:t,IsNeedReadReceipt:i,IsPeerRead:o,IsSyncMsg:n,MsgBody:r,MsgClientTime:s,MsgLifeTime:a,MsgRandom:g,MsgSeq:c,MsgTimeStamp:l,SendMsgControl:I,SupportMessageExtension:u,TinyId:E,MsgCheckResult:d,CloudCustomData:h,MsgVersion:C,MsgFlagBits:B,RevokerInfo:Q}=A;let p,{From_Account:f,To_Account:m}=A;if(1===n){const A=m;m=f,f=A}if(Q){const{Reason:A,Revoker_Account:e,Revoker_FromUin:t}=Q;p={reason:A,revoker:e,revokerFromUin:t,userID:e}}return{from:f,avatar:e,nick:t,needReadReceipt:1===i,isSyncMessage:n,clientTime:s,messageLifeTime:a,random:g,sequence:c,time:l,messageControlInfo:{excludedFromLastMessage:1===(null==I?void 0:I.NoLastMsg),excludedFromUnreadCount:1===(null==I?void 0:I.NoUnread)},isSupportExtension:u,to:m,tinyID:E,checkResult:d,cloudCustomData:h,revokerInfo:p,messageVersion:C,messageFlagBits:B,readReceiptSentByPeer:o,elements:Wo(r)}}function Vo(A){const{From_Account:e,MsgBody:t,MsgClientTime:i,MsgRandom:o,MsgSeq:n,MsgTimeStamp:r,To_Account:s,MsgVersion:a,CloudCustomData:g}=A;return{from:e,clientTime:i,random:o,sequence:n,time:r,to:s,elements:Wo(t),messageVersion:a,cloudCustomData:g}}function jo(A){const{ClientSeq:e,From_Account:t,GroupInfo:i,MsgBody:o,MsgClientTime:n,MsgRandom:r,MsgSeq:s,MsgTimeStamp:a,SendMsgControl:g,SupportMessageExtension:c,TinyId:l,CloudCustomData:I,MsgVersion:u,MsgCheckResult:E,NeedReadReceipt:d,IsPlaceMsg:h,RevokerInfo:C,GroupAtInfo:B}=A;let Q,p=Do.MSG_PRIORITY_NORMAL;if(Object.keys(wo).includes(String(A.MsgPriority))&&(p=wo[A.MsgPriority]),C){const{Reason:A,Revoker_Account:e,Revoker_FromUin:t}=C;Q={reason:A,revoker:e,revokerFromUin:t,userID:e}}const f=function(A){const e=[];return Array.isArray(A)&&A.forEach(A=>{A.GroupAtAllFlag===So?e.push(A.GroupAt_Account):A.GroupAtAllFlag===Mo&&e.push(St.MSG_AT_ALL)}),e}(B);return{clientSequence:e,from:t,groupProfile:i,clientTime:n,priority:p,random:r,sequence:s,time:a,messageControlInfo:{excludedFromLastMessage:1===(null==g?void 0:g.NoLastMsg),excludedFromUnreadCount:1===(null==g?void 0:g.NoUnread)},isSupportExtension:c,tinyID:l,cloudCustomData:I,messageVersion:u,messageCheckResult:E,needReadReceipt:d,isPlaceMessage:h,revokerInfo:Q,atUserList:f,elements:Wo(o),to:Ko(A)}}function Ko(A){const{utils:{isEmpty:e},constants:{IS_TOPIC_MESSAGE:t}}=At,{ToGroupId:i,GroupInfo:{MillionGroupFlag:o=0,TopicId:n}={}}=A;return o!==t||e(n)?i:n}function Wo(A){if(!A)return null;if(Array.isArray(A))return A.map(A=>{const e=At.message.messageFactory.getElementClass(A.MsgType);return null==e?void 0:e.parseServerPushElement(A)});const e=At.message.messageFactory.getElementClass(A.MsgType);return null==e?void 0:e.parseServerPushElement(A)}function zo(A){const{From_Account:e,MsgBody:t,MsgClientTime:i,MsgRandom:o,MsgSeq:n,MsgTimeStamp:r,GroupId:s,TopicId:a,MsgVersion:g,CloudCustomData:c}=A;return{from:e,clientTime:i,random:o,sequence:n,time:r,groupID:s,topicID:a,elements:Wo(t),messageVersion:g,cloudCustomData:c}}function Zo({conversationUpdateFields:A,message:e}){const{conversationID:t,conversationType:i,conversationSubType:o,flow:n,_isExcludedFromUnreadCount:r,_isExcludedFromLastMessage:s}=e,a=s?"":e,g=!r&&n===Ro.IN;A.has(t)?(A.get(t).lastMessage=a,g&&A.get(t).unreadCount++):A.set(t,{conversationID:t,type:i,subType:o,unreadCount:g?1:0,lastMessage:a})}function Xo(A){return A.filter(A=>{const e=!BA(null==A?void 0:A.getElements()),t=1===(null==A?void 0:A.isPlaceMessage);return e||At.ssoLog.error("emptyMessageBody",`from:${A.from} to:${A.to} sequence:${A.sequence}`),e&&!t})}function $o(A){const{messageDataHandler:e}=At.message;return!e.isInMessageList(A)&&!e.isMessageSentByCurrentInstance(A)}var An=Object.freeze({__proto__:null,autoIncrementIndex:No,filterValidMessages:Xo,parseServerGroupMessage:jo,parseServerPushC2CModifyMessage:Vo,parseServerPushGroupModifyMessage:zo,parseServerPushMessage:qo,parseServerPushMessageElement:Wo,shouldStoreMessage:$o,updateConversationFields:Zo});const{isPlainObject:en}=At.utils;function tn(A,e={}){const{onlineUserOnly:t,messageControlInfo:i}=e;let{offlinePushInfo:o}=e;A.conversationType===yo.CONV_C2C&&!0===t&&(o?o.disablePush=!0:o={disablePush:!0});let n="";"string"==typeof A.cloudCustomData&&A.cloudCustomData.length>0&&(n=A.cloudCustomData);const r=[];if(i&&en(i)){const{excludedFromUnreadCount:A,excludedFromLastMessage:e,excludedFromContentModeration:t}=i;!0===A&&r.push("NoUnread"),!0===e&&r.push("NoLastMsg"),!0===t&&r.push("NoMsgCheck")}return{onlineUserOnly:t,cloudCustomData:n,messageControlInfo:r,offlinePushInfo:o}}function on(A){const{webhookInfo:{disableCloudMessagePreHook:e=!1,disableCloudMessagePostHook:t=!1}={}}=A||{};if(!e&&!t)return;const i=[];return e&&i.push("ForbidBeforeSendMsgCallback"),t&&i.push("ForbidAfterSendMsgCallback"),i}function nn(A,e){return IA(this,void 0,void 0,function*(){const t=A.conversationType===yo.CONV_GROUP?function(A,e){var t;const o=tn(A,e),{onlineUserOnly:n,cloudCustomData:r,messageControlInfo:s,offlinePushInfo:a}=o,g=JSON.parse(JSON.stringify(A.transformElementsToServerFormat()));let c;return i(A._receiverList)&&A._receiverList.length>0&&(c=A._receiverList,A._receiverList.length>50&&(c=A._receiverList.slice(0,50),console.warn("ReceiverListLimit"))),{servcmd:"group_open_http_svc.send_group_msg",data:{From_Account:null===(t=At.store.get("login"))||void 0===t?void 0:t.userId,GroupId:A.to,MsgBody:g,CloudCustomData:r,Random:A.random,MsgPriority:A.priority,ClientSeq:A.clientSequence,GroupAtInfo:A._groupAtInfoList,OnlineOnlyFlag:n?1:0,MsgClientTime:A.clientTime,OfflinePushInfo:Ho(a),SendMsgControl:n?void 0:s,NeedReadReceipt:!0===A.needReadReceipt?1:0,To_Account:c,SupportMessageExtension:!0===A.isSupportExtension?1:0,IsRelayMsg:!0===A._relayFlag?1:0,CustomModerationConfigID:A._cmConfigID,ForbidCallbackControl:on(e)}}}(A,e):function(A,e){var t;const i=tn(A,e),{onlineUserOnly:o,cloudCustomData:n,messageControlInfo:r,offlinePushInfo:s}=i,a=!0===o?0:void 0,g=JSON.parse(JSON.stringify(A.transformElementsToServerFormat()));return{servcmd:"openim.sendmsg",data:{From_Account:null===(t=At.store.get("login"))||void 0===t?void 0:t.userId,To_Account:A.to,MsgBody:g,CloudCustomData:n,MsgSeq:A.sequence,MsgRandom:A.random,MsgLifeTime:a,From_AccountNick:A.nick,From_AccountHeadurl:A.avatar,SendMsgControl:0!==a?r:void 0,MsgClientTime:A.clientTime,IsNeedReadReceipt:!0===A.needReadReceipt?1:0,SupportMessageExtension:!0===A.isSupportExtension?1:0,IsRelayMsg:!0===A._relayFlag?1:0,CustomModerationConfigID:A._cmConfigID,OfflinePushInfo:Ho(s),ForbidCallbackControl:on(e)}}}(A,e),o=yield hi(t);return o?{time:o.MsgTime,messageDropReason:o.MsgDropReason,sequence:o.MsgSeq}:null})}const{isPlainObject:rn}=At.utils,{MSG_AUDIO:sn,MSG_FILE:an,MSG_IMAGE:gn,MSG_VIDEO:cn,MSG_MERGER:ln}=St;class In{init(){Bo.getInstance().registerApi({apiName:"sendMessage",context:this,matcher:A=>![sn,an,gn,cn,ln].includes(A[0].type)})}sendMessage(A,e){return IA(this,void 0,void 0,function*(){const{TOTAL_COUNT:t,SEND_COST:i,SUCCESS_COUNT:o,FAILED_COUNT:n}=Gt;if(!(A instanceof bo))throw new $t({code:Mt.MSG_INSTANCE_REQUIRED});const r=A.validateBeforeSend();if(!r.isValid){const{code:A,message:e=""}=r.error||{};throw new $t({code:A,message:e})}this._reportMessageSendQuality({name:t,message:A});let s=!1;const{messageDataHandler:a}=At.message||{};try{const{messageControlInfo:t}=e||{};let n=null;a.addRandomOfSentMessage(A.random);const r=Date.now();if(A.conversationType===yo.CONV_C2C?(s=!0===(null==e?void 0:e.onlineUserOnly),n=yield nn(A,e)):A.conversationType===yo.CONV_GROUP&&(yield this._validateBeforeSendGroupMessage(A),n=yield nn(A,e)),n){const{messageDropReason:e,sequence:g,time:c}=n;if(this._updateNickAndAvatarOfSentMessageByMe(A),e&&this._logRateLimitInfo(A,g,e),this._reportMessageSendQuality({name:o,message:A}),this._reportMessageSendQuality({name:i,message:A,startTs:r}),!0===A.isResend){const e=a.findMessage(A.ID);e&&(At.ssoLog.debug("sendMessage",`sendMessage resend ok. ID:${e.ID}`),a.deleteConversationMessage(e))}return A.status=It.SUCCESS,A.time=c,A.conversationType===yo.CONV_GROUP&&(A.sequence=g),s?A._onlineOnlyFlag=!0:(a.storeConversationMessage(A),this._applySentMessageControlInfo(A,t),this._emitOnlineMessageSent(A)),{code:0,data:{message:A}}}}catch(g){A.status=It.FAIL,a.removeRandomOfSentMessage(A.random);let{errorCode:e}=g||{},t=(null==g?void 0:g.errorInfo)||(null==g?void 0:g.message)||"";throw this._hasRiskContent(e)&&(A.hasRiskContent=!0),s||this._isRejectedByRestApi(e)||a.storeConversationMessage(A),this._reportMessageSendQuality({name:n,message:A,error:g}),new $t({code:e,message:t,data:{message:A},moreMessage:`type:${A.type} from:${A.from} to:${A.to}`})}})}_hasRiskContent(A){return 80001===A||80004===A}_isRejectedByRestApi(A){return A>=10100&&A<=10200||A>=120001&&A<=13e4}_emitOnlineMessageSent(A){const e=A._isExcludedFromLastMessage?"":A,{conversationID:t,conversationType:i}=A,o=ui(t)?at.TOPIC_NEW_MESSAGE:at.NEW_MESSAGE;At.notificationCenter.emitInnerEvent(o,{result:{conversationUpdateFieldList:[{conversationID:t,type:i,message:A,lastMessage:e,unreadCount:0}]}})}_applySentMessageControlInfo(A,e){e&&rn(e)&&(!0===e.excludedFromLastMessage&&(A._isExcludedFromLastMessage=!0),!0===e.excludedFromUnreadCount&&(A._isExcludedFromUnreadCount=!0))}_logRateLimitInfo(A,e,t){const i=`from:${A.from} to:${A.to} sequence:${e} messageDropReason:${t}`;At.ssoLog.warn("messageDropReason",i)}_updateNickAndAvatarOfSentMessageByMe(A){const{messageDataHandler:e}=At.message||{};let t=!1;const{conversationID:i}=A,o=e.getLatestMsgSentByMe(i);if(o){const{nick:n,avatar:r}=o;n===A.nick&&r===A.avatar||(t=!0),t&&e.updateNickAndAvatarOfSentMessage({conversationID:i,latestNick:A.nick,latestAvatar:A.avatar,isSentByMe:!0})}}_validateBeforeSendGroupMessage(A){return IA(this,void 0,void 0,function*(){var e,t,i;const{to:o,from:n}=A;let r=o,s=uo.getGroup(r);if(Ii({groupID:r})&&(null==s?void 0:s.isSupportTopic))throw new $t({code:Mt.MSG_SEND_GRP_WITH_TOPIC_FAIL});if(ui(o)&&([r]=o.split(yt.TOPIC),s=uo.getGroup(r)),!s&&"function"==typeof(null===(e=Bo.getInstance().getApiMap())||void 0===e?void 0:e.getGroupProfile)){const A=yield Bo.getInstance().getApiMap().getGroupProfile({groupID:r});if((null===(i=null===(t=null==A?void 0:A.data)||void 0===t?void 0:t.group)||void 0===i?void 0:i.type)===St.GRP_AVCHATROOM){const A=Xt({code:Mt.MSG_SEND_FAIL_NOT_IN_AV,replacement1:n,replacement2:r});throw new $t({code:Mt.MSG_SEND_FAIL_NOT_IN_AV,message:A})}}return!0})}_reportMessageSendQuality(A){At.notificationCenter.emitInnerEvent(at.QUALITY_STAT,{label:bt.MESSAGE_SEND_SUCCESS_RATE,data:A})}}var un=new class{constructor(){this._sparseMessagesByConversation=new Map,this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map,this._randomOfSentMessageList=new Set}init(){At.notificationCenter.subscribeInnerEvent(at.LOGOUT,this._reset,this),At.notificationCenter.subscribeInnerEvent(at.DESTROY,this._dispose,this)}get _messagesByConversation(){return Eo.getMessages()}storeConversationMessage(A,e=!1){const{conversationID:t}=A;if(!t)return!1;if(this._messagesByConversation.has(t)||this._messagesByConversation.set(t,new Map),this._shouldSkipStoreMessage(A,e))return!1;const i=this._getUniqueIdOfMessage(A);return this._messagesByConversation.get(t).set(i,A),this._updateLatestMessageMap(A),!0}_updateLatestMessageMap(A){const{conversationID:e}=A;"out"===A.flow?this._setLatestMsgSentByMe(e,A):e.startsWith("C2C")&&this._setLatestMsgSentByPeer(e,A)}_shouldSkipStoreMessage(A,e){const t=this._getUniqueIdOfMessage(A),i=this._messagesByConversation.get(A.conversationID);if(null==i?void 0:i.has(t)){const A=null==i?void 0:i.get(t);if(!e||!0===(null==A?void 0:A.isModified))return!0}return!1}deleteConversationMessage(A){var e;const{conversationID:t=""}=A,i=this._getUniqueIdOfMessage(A);this._messagesByConversation.has(t)&&(null===(e=this._messagesByConversation.get(t))||void 0===e||e.delete(i))}modifyConversationMessage(A,e){var t;if(!this._messagesByConversation.has(A)&&!this._sparseMessagesByConversation.has(A))return{isUpdated:!1,message:null};const i=this._getUniqueIdOfMessage(e),o=this._getMessageFromLocalMessage(A,i);if(o){const{messageVersion:i,elements:n,cloudCustomData:r,checkResult:s=0}=e,a=s>1;if(console.log(`conversationToMessageMap modifyConversationMessage localVersion:${o.version} remoteVersion:${i}`),o.versione.ID===A)||null,e)break;if(!e){const t=Array.from(this._sparseMessagesByConversation.values());for(const i of t)if(e=i.get(A)||null,e)break}return e}deleteConversationMessageList(A){this._messagesByConversation.has(A)&&(this._messagesByConversation.delete(A),this._latestMessageSentByMeMap.delete(A),this._latestMessageSentByPeerMap.delete(A)),this._sparseMessagesByConversation.has(A)&&this._sparseMessagesByConversation.delete(A)}revokeMessage({conversationID:A,sequence:e,random:t,revoker:i}){const o=this._messagesByConversation.get(A);let n=null;if(o){const r=Array.from(o.values());if(n=this._findMessageBySequenceAndRandom({messageList:r,random:t,sequence:e}),n){const e=this._getUniqueIdOfMessage(n);return Eo.updateMessage(A,[e],{isRevoked:!0,revoker:i,operation:ut.revoke}),n}}if(this._sparseMessagesByConversation.has(A)){const o=Array.from(this._sparseMessagesByConversation.get(A).values());if(n=this._findMessageBySequenceAndRandom({messageList:o,random:t,sequence:e}),n)return n.isRevoked=!0,n.revoker=i,n}}_findMessageBySequenceAndRandom({messageList:e,sequence:t,random:i}){for(let o=0;o 0){const A=new Map([...o,...n.entries()]);this._messagesByConversation.set(t,A),this._updateLatestMessageSentByMe(t),this._updateLatestMessageSentByPeer(t)}return i}storeSparseMessageList(A){if(0===A.length)return;const{conversationID:e}=A[0],t=A.length;this._sparseMessagesByConversation.has(e)||this._sparseMessagesByConversation.set(e,new Map);const i=this._sparseMessagesByConversation.get(e);for(let o=0;o =0;i--)if("out"===t[i].flow){this._setLatestMsgSentByMe(A,t[i]);break}}_updateLatestMessageSentByPeer(A){var e;const t=Array.from((null===(e=this._messagesByConversation.get(A))||void 0===e?void 0:e.values())||[]);if(0!==t.length&&A.startsWith("C2C"))for(let i=t.length-1;i>=0;i--)if("in"===t[i].flow){this._setLatestMsgSentByPeer(A,t[i]);break}}_getUniqueIdOfMessage(A){const{from:e,to:t,random:i,sequence:o,time:n}=A;return`${e}-${t}-${i}-${o}-${n}`}_setLatestMsgSentByPeer(A,e){this._latestMessageSentByPeerMap.set(A,e)}_setLatestMsgSentByMe(A,e){this._latestMessageSentByMeMap.set(A,e)}getLatestMsgSentByPeer(A){return this._latestMessageSentByPeerMap.get(A)}getLatestMsgSentByMe(A){return this._latestMessageSentByMeMap.get(A)}addRandomOfSentMessage(A){this._randomOfSentMessageList.add(A)}removeRandomOfSentMessage(A){this._randomOfSentMessageList.delete(A)}updateNickAndAvatarOfSentMessage(A){const{conversationID:e="",latestAvatar:t,latestNick:i,isSentByMe:o=!0}=A,n=this._messagesByConversation.get(e);if(!n)return;const r=Array.from(n.values()),s=o?"out":"in";r.forEach(A=>{const{nick:e,avatar:o,flow:n}=A;n===s&&(e!==i&&(A.nick=i),o!==t&&(A.avatar=t))})}isInMessageList(A){var e;const{conversationID:t}=A;if(!t)return!1;if(!this._messagesByConversation.has(t))return!1;const i=this._getUniqueIdOfMessage(A);return null===(e=this._messagesByConversation.get(t))||void 0===e?void 0:e.has(i)}isMessageSentByCurrentInstance(A){const{random:e}=A;return this._randomOfSentMessageList.has(e)}getContinuousMessagesByConversation(){return this._messagesByConversation}getLocalMessageList(A){const e=this._messagesByConversation.get(A);return e?[...e.values()]:[]}getSparseMessageList(A){const e=this._sparseMessagesByConversation.get(A);return e?[...e.values()]:[]}_reset(){this._messagesByConversation.clear(),this._latestMessageSentByPeerMap.clear(),this._latestMessageSentByMeMap.clear(),this._randomOfSentMessageList.clear()}_dispose(){this._reset(),At.notificationCenter.unSubscribeInnerEvent(at.LOGOUT,this._reset,this),At.notificationCenter.unSubscribeInnerEvent(at.DESTROY,this._dispose,this)}};function En(A,e){const t=Io.getConversation(A);if(null==t?void 0:t.lastMessage){const{lastMessage:i}=t,{lastTime:o,lastSequence:n,version:r}=i,{time:s,sequence:a,messageVersion:g,elements:c,cloudCustomData:l}=e;o===s&&n===a&&r!==g&&(i.type=c[0].type,i.payload=c[0].content,i.messageForShow=yi(i.type,i.payload),i.cloudCustomData=l,i.version=g,Io.updateConversation(A,{lastMessage:i}))}}class dn{init(){Bo.getInstance().registerApi({apiName:"modifyMessage",context:this})}modifyMessage(A){return IA(this,void 0,void 0,function*(){const{to:e,payload:t,sequence:i,conversationType:o,random:n,time:r,from:s,type:a}=A;if(this._canModifyMessageElement(a)){const e=A.getElements();e.length>1&&(e[0].type=a,e[0].content=t)}try{let t=null,a=null;if(o===yo.CONV_C2C?t=yield function(A){return IA(this,void 0,void 0,function*(){const{from:e,to:t,version:i=0,sequence:o,random:n,time:r,type:s,cloudCustomData:a}=A,g={From_Account:e,To_Account:t,MsgVersion:i,MsgSeq:o,MsgRandom:n,MsgTime:r,MsgType:s,MsgBody:A.transformElementsToServerFormat(),CloudCustomData:a},c=yield hi({servcmd:"openim.modify_c2c_msg",data:g});if(c){const{MsgBody:A,MsgVersion:e,CloudCustomData:t}=c;return{elements:Wo(A),messageVersion:e,cloudCustomData:t}}})}(A):o===yo.CONV_GROUP&&(t=yield function(A){return IA(this,void 0,void 0,function*(){const{to:e,version:t=0,sequence:i,cloudCustomData:o}=A,n={GroupId:e,MsgVersion:t,MsgSeq:i,MsgBody:A.transformElementsToServerFormat(),CloudCustomData:o},r=yield hi({servcmd:"openim.modify_group_msg",data:n});if(r){const{MsgBody:A,MsgVersion:e,CloudCustomData:t}=r;return{elements:Wo(A),messageVersion:e,cloudCustomData:t}}})}(A)),t){let g=`${o}${e}`;return e===pi()&&o===yo.CONV_C2C&&(g=`${o}${s}`),a={conversationType:o,from:s,to:e,time:r,random:n,sequence:i,elements:null==t?void 0:t.elements,cloudCustomData:null==t?void 0:t.cloudCustomData,messageVersion:null==t?void 0:t.messageVersion,conversationID:g},this._handleModifyMessageSuccess(a),{code:0,data:{message:A},successLog:{message:`to:${e}`}}}}catch(g){const{errorCode:A}=g||{};throw new $t({functionName:"modifyMessage",code:A})}})}_handleModifyMessageSuccess(A){const{conversationID:e}=A,{isUpdated:t,message:i}=At.message.messageDataHandler.modifyConversationMessage(e,A);!0===t&&At.notificationCenter.emitOuterEvent(rt.MESSAGE_MODIFIED,{name:rt.MESSAGE_MODIFIED,data:[i]}),At.notificationCenter.emitInnerEvent(at.MESSAGE_MODIFIED,{conversationID:e,message:i}),En(e,A)}_canModifyMessageElement(A){return[vo.MSG_TEXT,vo.MSG_CUSTOM,vo.MSG_LOCATION,vo.MSG_FACE].includes(A)}}class hn{init(){const{notificationCenter:A}=At,{InnerEventSubType:e}=A;ci.getInstance().registerWorkflowStep(_t.RECEIVE_C2C_NEW_MESSAGE,Tt.HANDLE_C2C_NEW_MESSAGE,this._handleC2CMessagePush,this),ci.getInstance().registerWorkflowStep(_t.RECEIVE_C2C_NEW_MESSAGE,Tt.EMIT_C2C_MESSAGE_EVENT,this._emitMessageEventsAfterReceiveNewMessage,this),ci.getInstance().registerWorkflowStep(_t.SYNC_SERVER_INFO_AFTER_RE_ONLINE,Tt.EMIT_C2C_MESSAGE_EVENT,this._emitMessageEventsAfterSyncUnreadMessage,this),A.subscribeInnerEvent(at.MESSAGE_PUSH,e.C2C_REALTIME_MESSAGE,this._executeReceiverNewMessageWorkFlow,this),A.subscribeInnerEvent(at.MESSAGE_PUSH,e.C2C_MESSAGE_MODIFIED,this._handleC2CMessageModify,this),A.subscribeInnerEvent(at.DESTROY,this._dispose,this)}_executeReceiverNewMessageWorkFlow(A){ci.getInstance().executeWorkflow(_t.RECEIVE_C2C_NEW_MESSAGE,A)}_handleC2CMessagePush(A){const e=A.data||{},{messageDataHandler:t}=At.message||{},i=[],o=new Map;return e.C2cMsgArray.forEach(A=>{const e=this._generateC2CMessage(A);this._updateMessageProfile(e);let n=1===e.isModified;t.isMessageSentByCurrentInstance(e)?e.isModified=n:n=!1,e.isOnlineMessage()?(e._onlineOnlyFlag=!0,t.isMessageSentByCurrentInstance(e)||i.push(e)):$o(e)&&(t.storeConversationMessage(e)&&Zo({conversationUpdateFields:o,message:e}),t.isMessageSentByCurrentInstance(e)&&!n||i.push(e))}),{conversationUpdateFieldList:[...o.values()],messages:i}}_emitMessageEventsAfterReceiveNewMessage(A){var e;const{messages:t=[]}=(null===(e=A.result)||void 0===e?void 0:e[Tt.HANDLE_C2C_NEW_MESSAGE])||{};this._emitMessageEvents(t)}_emitMessageEventsAfterSyncUnreadMessage(A){var e;const{messages:t=[]}=(null===(e=A.result)||void 0===e?void 0:e[Tt.UNREAD_MESSAGE_SYNC])||{};this._emitMessageEvents(t)}_emitMessageEvents(A){const e=(null==A?void 0:A.filter(A=>!0===(null==A?void 0:A.isModified)))||[];e.length>0&&At.notificationCenter.emitOuterEvent("onMessageModified",{name:"onMessageModified",data:e});const t=null==A?void 0:A.filter(A=>!(null==A?void 0:A.isModified));t.length>0&&At.notificationCenter.emitOuterEvent("onMessageReceived",{name:"onMessageReceived",data:t})}_generateC2CMessage(A){const e=yo.CONV_C2C,t=qo(A),i=At.message.messageFactory.createMessage(Object.assign(Object.assign({},t),{conversationType:e,flow:Ro.IN})),{elements:o}=t;return i.setElement(o),i}_updateMessageProfile(t){var i;const{messageDataHandler:o}=At.message||{},n=null===(i=At.store.get("login"))||void 0===i?void 0:i.userId,{from:r,nick:s,avatar:a,conversationID:g=""}=t;if(r!==n){const i=o.getLatestMsgSentByPeer(g);if(i){const{nick:n,avatar:r}=i;A(s)||A(a)?(t.nick=e(n)?n:t.nick,t.avatar=e(r)?r:t.avatar):s===n&&a===r||(o.updateNickAndAvatarOfSentMessage({conversationID:g,latestNick:s,latestAvatar:a,isSentByMe:!1}),this._updateConversationUserProfile({conversationID:g,nick:s,avatar:a}))}}else{const A=o.getLatestMsgSentByMe(g);!A||s===A.nick&&a===A.avatar||o.updateNickAndAvatarOfSentMessage({conversationID:g,latestNick:s,latestAvatar:a,isSentByMe:!0})}}_updateConversationUserProfile(A){const{conversationID:e,nick:t,avatar:i}=A,o=Io.getConversation(e),{userProfile:n={}}=o||{};n.avatar===i&&n.nick===t||Io.updateConversation(e,{userProfile:Object.assign(Object.assign({},n),{nick:t,avatar:i})})}_updateMessageListDueToModify(A){const{conversationID:e}=A,{isUpdated:t,message:i}=At.message.messageDataHandler.modifyConversationMessage(e,A);!0===t&&At.notificationCenter.emitOuterEvent("onMessageModified",{name:"onMessageModified",data:[i]}),At.notificationCenter.emitInnerEvent("ModifyMessageSuccess",A),En(e,A)}_handleC2CMessageModify(A){A.C2cMsgModNotifys.forEach(A=>{var e;const t=yo.CONV_C2C;let i=Vo(A);const{to:o,from:n}=i;let r=`${t}${o}`;o===(null===(e=At.store.get("login"))||void 0===e?void 0:e.userId)&&(r=`${t}${n}`),i=Object.assign({conversationType:t,conversationID:r},i),this._updateMessageListDueToModify(i)})}_dispose(){const{notificationCenter:A}=At,{InnerEventSubType:e}=A;At.notificationCenter.unSubscribeInnerEvent(at.MESSAGE_PUSH,e.C2C_REALTIME_MESSAGE,this._handleC2CMessagePush,this),At.notificationCenter.unSubscribeInnerEvent(at.MESSAGE_PUSH,e.C2C_MESSAGE_MODIFIED,this._handleC2CMessageModify,this),At.notificationCenter.unSubscribeInnerEvent(at.DESTROY,this._dispose,this)}}class Cn{init(){const{notificationCenter:A}=At,{InnerEventSubType:e}=A;ci.getInstance().registerWorkflowStep(_t.RECEIVE_GROUP_NEW_MESSAGE,Tt.HANDLE_GROUP_NEW_MESSAGE,this._handleGroupMessagePush,this),ci.getInstance().registerWorkflowStep(_t.RECEIVE_GROUP_NEW_MESSAGE,Tt.EMIT_GROUP_MESSAGE_EVENT,this._emitMessageEvents,this),A.subscribeInnerEvent(at.MESSAGE_PUSH,e.GROUP_REALTIME_MESSAGE,this._executeReceiverNewMessageWorkFlow,this),A.subscribeInnerEvent(at.MESSAGE_PUSH,e.GROUP_MESSAGE_MODIFIED,this._handleGroupMessageModify,this),A.subscribeInnerEvent(at.DESTROY,this._dispose,this)}_executeReceiverNewMessageWorkFlow(A){this._canExecuteReceiverNewMessageWorkFlow(A)&&ci.getInstance().executeWorkflow(_t.RECEIVE_GROUP_NEW_MESSAGE,A)}_handleGroupMessagePush(A){const e=A.data||{},{messageDataHandler:t}=At.message,i=[],o=new Map,n=null==e?void 0:e.GroupMsgArray;return null==n||n.forEach(A=>{if(1===A.GroupInfo.NotVisible)return;const e=this._generateGroupMessage(A);this.updateMessageProfile(e);let n=1===e.isModified;t.isMessageSentByCurrentInstance(e)?e.isModified=n:n=!1,e.isOnlineMessage()?(e._onlineOnlyFlag=!0,t.isMessageSentByCurrentInstance(e)||i.push(e)):$o(e)&&t.storeConversationMessage(e)&&(i.push(e),Zo({conversationUpdateFields:o,message:e}))}),{conversationUpdateFieldList:[...o.values()],messages:i}}_emitMessageEvents(A){var e;const{messages:t}=(null===(e=A.result)||void 0===e?void 0:e[Tt.HANDLE_GROUP_NEW_MESSAGE])||{},i=(null==t?void 0:t.filter(A=>!0===(null==A?void 0:A.isModified)))||[];i.length>0&&At.notificationCenter.emitOuterEvent("onMessageModified",{name:"onMessageModified",data:i});const o=(null==t?void 0:t.filter(A=>!(null==A?void 0:A.isModified)))||[];o.length>0&&At.notificationCenter.emitOuterEvent("onMessageReceived",{name:"onMessageReceived",data:o})}_generateGroupMessage(A){const e=yo.CONV_GROUP,t=jo(A),i=At.message.messageFactory.createMessage(Object.assign(Object.assign({},t),{conversationType:e,flow:Ro.IN})),{elements:o}=t;return i.setElement(o),i}updateMessageProfile(A){var e;const{messageDataHandler:t}=At.message||{},i=null===(e=At.store.get("login"))||void 0===e?void 0:e.userId,{from:o,nick:n,avatar:r,conversationID:s="",_elements:a}=A;if(o===i){const A=t.getLatestMsgSentByMe(s);!A||n===A.nick&&r===A.avatar||t.updateNickAndAvatarOfSentMessage({conversationID:s,latestNick:n,latestAvatar:r,isSentByMe:!0})}else if(o===St.CONV_SYSTEM){const{operationType:e,memberInfoList:t,operatorInfo:i}=a;let o={};if(BA(t)?BA(i)||(o=i):[Dt.JOINED,Dt.KICKED,Dt.ADMIN_SET,Dt.ADMIN_CANCELED].includes(e)&&(o=Object.assign({},t[0])),!BA(o)){const{nick:e="",avatar:t=""}=o;A.nick=e,A.avatar=t}}}_updateMessageListDueToModify(A){const{conversationID:e}=A,{isUpdated:t,message:i}=At.message.messageDataHandler.modifyConversationMessage(e,A);!0===t&&At.notificationCenter.emitOuterEvent("onMessageModified",{name:"onMessageModified",data:[i]}),En(e,A)}_handleGroupMessageModify(A){A.GroupMsgModNotifys.forEach(A=>{const e=yo.CONV_GROUP;let t=zo(A);const{topicID:i,groupID:o}=t,n=i||o,r=`${e}${n}`;t=Object.assign({conversationType:e,conversationID:r,to:n},t),this._updateMessageListDueToModify(t)})}_dispose(){const{notificationCenter:A}=At,{InnerEventSubType:{GROUP_REALTIME_MESSAGE:e,GROUP_MESSAGE_MODIFIED:t}}=A;A.unSubscribeInnerEvent(at.MESSAGE_PUSH,e,this._handleGroupMessagePush,this),A.unSubscribeInnerEvent(at.MESSAGE_PUSH,t,this._handleGroupMessageModify,this),A.unSubscribeInnerEvent(at.DESTROY,this._dispose,this)}_canExecuteReceiverNewMessageWorkFlow(A){var e,t;const{GroupId:i,GroupType:o}=(null===(t=null===(e=null==A?void 0:A.GroupMsgArray)||void 0===e?void 0:e[0])||void 0===t?void 0:t.GroupInfo)||{},n=o===mt.GRP_AVCHATROOM;return!(!uo.getGroup(i)&&n)}}var Bn=new class{constructor(){this.c2cMessageReceiver=new hn,this.groupMessageReceiver=new Cn}init(){this.c2cMessageReceiver.init(),this.groupMessageReceiver.init()}};const Qn={createCustomMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1},payload:{required:!0,rules:["object"],allowEmpty:!1},cloudCustomData:{required:!1,rules:["string"],allowEmpty:!1},priority:{required:!1,rules:["string"],allowEmpty:!1},customModerationConfigurationID:{required:!1,rules:["string"],allowEmpty:!1}},sendMessage:[{key:"message",required:!0,rules:["object"],allowEmpty:!1},{key:"options",required:!1,rules:["object"],allowEmpty:!1}],createTextMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1,customValidator:A=>!(!A.startsWith("C2C")&&!A.startsWith("GROUP"))||"conversationType is invalid."},payload:{required:!0,rules:["object"],allowEmpty:!1,customValidator:A=>{return"string"==typeof(null==(e=A)?void 0:e.text)&&("string"!=typeof e.text||0!==(null===(t=null==e?void 0:e.text)||void 0===t?void 0:t.length))||"payload.text must be a string";var e,t}}}},pn={createCustomMessage:!0,sendMessage:!0,modifyMessage:!0};var fn=new class{getGroupRoamingMessagesByAnchor(A){return IA(this,void 0,void 0,function*(){try{const{conversationID:e,count:t,direction:o,sequence:n,messageSequenceList:r,getType:s}=A,a=e.replace(Qt.CONV_GROUP,""),g=[];let c=n;if(o===Et.BACKWARD){if("number"!=typeof n)return{messageList:[],hasNoMoreHistoryMessage:!1,nextReqMessageIDFromServer:""};c=n+t-1}const l=yield function(A){return IA(this,void 0,void 0,function*(){const{groupID:e,count:t,messageSequence:o,messageSequenceList:n,getType:r}=A,s={GroupId:e,ReqMsgNumber:t,WithRecalledMsg:1,Version:1,GetType:r};return o&&(s.ReqMsgSeq=o),i(n)&&n.length>0&&(s.ReqMsgSeqList=n),yield hi({servcmd:"group_open_http_svc.group_msg_get",data:s})})}({groupID:a,count:t,messageSequence:c,messageSequenceList:r,getType:s});if(l){const{RspMsgList:A=[],NextReqMsgSeq:e=0,IsFinished:t,InvisibleMsgSeq:i}=l,r=`groupID:${a} sequence:${n} reqSeq:${c} direction:${o} complete:${t} nextSequence:${e} remoteMsgCount:${A.length} invisibleSequenceList:${i}`,s=[];for(let o=0;o =n);const u=Xo(s);return At.ssoLog.info("getGroupRoamingMessagesByAnchor",r),{messageList:u,invisibleSequenceList:i,nextReqMessageIDFromServer:e,hasNoMoreHistoryMessage:I,serverGroupTipList:g}}}catch(e){const{errorCode:A,errorInfo:t}=e||{};throw new $t({code:A,message:t})}})}_parseMessage(A){const e=Qt.CONV_GROUP;4===A.Event&&(A.MsgBody.MsgType=St.MSG_GRP_TIP);const t=jo(A),i=Lo.createMessage(Object.assign(Object.assign({},t),{conversationType:e,flow:"in"}));return i.setElement(t.elements),i}};class mn{constructor(){this.messageHelper=An,this.messageFactory=Lo,this.messageSender=new In,this.messageAction=new dn,this.messageReceiver=Bn,this.messageDataHandler=un,this.messageHistory=fn,this.messageSender.init(),this.messageFactory.init(),this.messageAction.init(),this.messageReceiver.init(),this.messageDataHandler.init(),ai({auth:pn,params:Qn})}}const yn="Tag_Profile_IM_",Dn={NICK:`${yn}Nick`,GENDER:`${yn}Gender`,BIRTHDAY:`${yn}BirthDay`,LOCATION:`${yn}Location`,SELFSIGNATURE:`${yn}SelfSignature`,ALLOWTYPE:`${yn}AllowType`,LANGUAGE:`${yn}Language`,AVATAR:`${yn}Image`,MESSAGESETTINGS:`${yn}MsgSettings`,ADMINFORBIDTYPE:`${yn}AdminForbidType`,LEVEL:`${yn}Level`,ROLE:`${yn}Role`},vn="Tag_Profile_Custom",wn="profileCustomField",Sn="USER_STATUS",Mn=1,Rn=1e3,_n={userID:"",nick:"",gender:"Gender_Type_Unknown",birthday:0,location:"",selfSignature:"",allowType:"AllowType_Type_AllowAny",language:0,avatar:"",messageSettings:0,adminForbidType:"AdminForbid_Type_None",level:0,role:0,lastUpdatedTime:0,profileCustomField:[]},Tn=new Map([[Dn.NICK,"nick"],[Dn.GENDER,"gender"],[Dn.BIRTHDAY,"birthday"],[Dn.LOCATION,"location"],[Dn.SELFSIGNATURE,"selfSignature"],[Dn.ALLOWTYPE,"allowType"],[Dn.LANGUAGE,"language"],[Dn.AVATAR,"avatar"],[Dn.MESSAGESETTINGS,"messageSettings"],[Dn.ADMINFORBIDTYPE,"adminForbidType"],[Dn.LEVEL,"level"],[Dn.ROLE,"role"]]);var Nn=new class{createProfile(A,e){const t={userID:A,profileCustomField:[]};return e.forEach(A=>{const{tag:e,value:i}=A;e&&e.indexOf(vn)>-1?t.profileCustomField.push({key:e,value:i}):Tn.has(e)&&(t[Tn.get(e)]=i)}),Object.assign(Object.assign({},_n),t)}parseProfileItem(A=[]){const e=[];return A.forEach(A=>{e.push({tag:A.Tag,value:A.Value})}),e}parseProfileList(A=[]){const e=[];return A.forEach(A=>{e.push({tag:A.Tag,value:A.ValueBytes})}),e}convertParamsToProfile(A){const e=[];return Object.keys(A).forEach(t=>{t!==wn&&e.push({tag:Dn[t.toUpperCase()],value:A[t]})}),A.profileCustomField&&i(A.profileCustomField)&&A.profileCustomField.forEach(A=>{e.push({tag:A.key,value:A.value})}),e}normalizeProfileFields(A){const e={},t=[];return A.forEach(A=>{const{tag:i,value:o}=A;if(i&&i.indexOf(vn)>-1&&t.push({key:i,value:o}),Tn.has(i)&&void 0!==o){const A=Tn.get(i);e[A]=o}}),t.length>0&&(e.profileCustomField=t),e}};const{generateProtocolData:bn}=At.common;function Gn(A){return IA(this,void 0,void 0,function*(){const e="profile.portrait_get_all",t={From_Account:pi(),UserItem:[]};A.forEach(A=>{t.UserItem.push({CustomSequence:0,StandardSequence:0,To_Account:A})});const i=bn({servcmd:e,data:t}),o=`${i.head.seq}${e}`,n=yield At.channel.sendPacket(i,{requestId:o});if(n)return function(A){const{ActionStatus:e,ErrorCode:t,ErrorDisplay:i,ErrorInfo:o,UserProfileItem:n}=A,r=[];return n.map(A=>{const{To_Account:e,CustomSequence:t,ResultCode:i,ResultInfo:o,StandardSequence:n,ProfileItem:s}=A,a=Nn.parseProfileItem(s);r.push({userId:e,customSequence:t,resultCode:i,resultInfo:o,standardSequence:n,profileItem:a})}),{actionStatus:e,errorCode:t,errorDisplay:i,errorInfo:o,userProfile:r}}(n)})}function kn(A){return ho.getFriendMap().has(A)}const{isEmpty:Ln}=At.utils;class Un{constructor(){this._strangerProfileMap=new Map}init(){Bo.getInstance().registerApi({apiName:"getMyProfile",context:this}),Bo.getInstance().registerApi({apiName:"getUserProfile",context:this}),Bo.getInstance().registerApi({apiName:"updateMyProfile",context:this}),this.createProfile=Nn.createProfile.bind(Nn);const{notificationCenter:A}=At;ci.getInstance().registerWorkflowStep(_t.SYNC_SERVER_INFO_AFTER_LOGIN,Tt.USER_PROFILE_SYNC,this.getMyProfileCacheThenServer,this),A.subscribeInnerEvent(at.MESSAGE_PUSH,A.InnerEventSubType.PROFILE_MODIFIED,this._onProfileDataModify,this),A.subscribeInnerEvent(at.LOGOUT,this._reset,this),A.subscribeInnerEvent(at.DESTROY,this._dispose,this)}getMyProfile(){return IA(this,void 0,void 0,function*(){try{const A=pi(),e=yield Gn([A]);if(e){const t=this._handleProfileFormResponse(e)[0];return ho.getUserProfileMap().set(A,t),{code:0,data:t}}}catch(E){const{errorCode:e,errorInfo:t}=E;throw new $t({functionName:"getMyProfile",code:e,message:t})}})}getUserProfile(A){return IA(this,void 0,void 0,function*(){try{let{userIDList:e}=A;const{userIdListToRequest:t,profileFromCache:o}=this._filterRequestAndCacheUsers(e);if(0===t.length)return{code:0,data:o,successLog:{message:`userIDList.length:${e.length}`}};t.length>Rn&&(At.ssoLog.warn("getUserProfile","userIdListToRequest.length > 1000"),t.length=Rn);const{data:n,error:r}=yield this._batchFetchUserProfiles(t),s=t.length,a=n.length,g=s-a;if(0===o.length&&s===g&&!Ln(r))throw r;if(i(n))return n.forEach(A=>{kn(A.userID)?ho.getUserProfileMap().set(A.userID,A):this._strangerProfileMap.set(A.userID,A)}),{code:0,data:n.concat(o),successLog:{message:`getUserProfile query:${s} success:${a} fail:${g} from cache:${o.length}`}}}catch(e){const{errorCode:A}=e;throw new $t({functionName:"getUserProfile",code:A})}})}getMyProfileCacheThenServer(){return IA(this,void 0,void 0,function*(){const A=pi(),e=ho.getUserProfileMap().has(A);return e?{code:0,data:e}:this.getMyProfile()})}updateMyProfile(A){return IA(this,void 0,void 0,function*(){const e=pi(),t={};for(const n in A)void 0!==A[n]&&(t[n]=A[n]);const i=Nn.convertParamsToProfile(t);try{const A={From_Account:e,ProfileItem:i};yield function(A){return IA(this,void 0,void 0,function*(){const e="profile.portrait_set",t=bn({servcmd:e,data:A}),i=`${t.head.seq}${e}`,o=yield At.channel.sendPacket(t,{requestId:i});if(o){const{ActionStatus:A,ErrorCode:e,ErrorDisplay:t,ErrorInfo:i}=o;return{actionStatus:A,errorCode:e,errorDisplay:t,errorInfo:i}}})}(A);const o=ho.getUserProfile(e);let n;n=o?Object.assign(Object.assign({},o),t):Nn.createProfile(e,i);const r=!it(o,n,["lastUpdatedTime"]);return n.lastUpdatedTime=Date.now(),ho.getUserProfileMap().set(e,n),r&&this._emitProfileUpdated(n),{code:0,data:n,successLog:{message:`profileArray: ${At.utils.safeStringify(i)}`}}}catch(o){const{errorCode:A,errorInfo:e}=o;throw new $t({functionName:"updateMyProfile",code:A,message:e})}})}updateMyNickAndAvatar(A){return IA(this,void 0,void 0,function*(){const e=pi(),t=Date.now(),i=ho.getUserProfile(e);let o={};o=i?Object.assign(i,A):Nn.createProfile(e,A),o.lastUpdatedTime=t,ho.getUserProfileMap().set(e,o)})}_onProfileDataModify(A){const e=function(A){const{Profile_Account:e,PushType:t,ProfileList:i}=A;return{userId:e,pushType:t,profileList:Nn.parseProfileList(i)}}(A.ProfileDataMod[0]);if(Ln(e))return;const{isProfileUpdated:t,profile:i}=this._handleProfileModified(e);t&&this._emitProfileUpdated(i)}_emitProfileUpdated(A){At.notificationCenter.emitInnerEvent(at.PROFILE_UPDATE,{name:at.PROFILE_UPDATE,data:[A]}),At.notificationCenter.emitOuterEvent(rt.PROFILE_UPDATED,{name:rt.PROFILE_UPDATED,data:[A]}),Io.updateConversation(`C2C${null==A?void 0:A.userID}`,{userProfile:A})}_dispose(){const{notificationCenter:A}=At;A.unSubscribeInnerEvent(at.LOGOUT,this._reset,this),A.unSubscribeInnerEvent(at.MESSAGE_PUSH,A.InnerEventSubType.PROFILE_MODIFIED,this._onProfileDataModify,this),A.unSubscribeInnerEvent(at.DESTROY,this._dispose,this),this._reset()}_handleProfileModified(A){const{userId:e,profileList:t}=A,i=ho.getUserProfile(e);if(!(pi()===e||kn(e)&&i))return{isProfileUpdated:!1,profile:null};const o=Nn.normalizeProfileFields(t),n=Object.keys(o).some(A=>A===wn?!it(i.profileCustomField,o.profileCustomField):i[A]!==o[A]);if(!n)return{isProfileUpdated:!1,profile:i};const r=Date.now(),s=Object.assign(Object.assign(Object.assign({},i),o),{lastUpdatedTime:r});return ho.getUserProfileMap().set(e,s),{isProfileUpdated:n,profile:s}}_filterRequestAndCacheUsers(A){const e=[],t=[];return A.forEach(A=>{const i=ho.getUserProfileMap().has(A);kn(A)&&i?t.push(ho.getUserProfile(A)):this._isStrangerAndProfileValid(A)?t.push(this._strangerProfileMap.get(A)):e.push(A)}),{userIdListToRequest:e,profileFromCache:t}}_handleProfileFormResponse(A){const{userProfile:e}=A;if(!Array.isArray(e))return[];const t=e.filter(A=>"@TLS#NOT_FOUND"!==A.userId&&""!==A.userId&&!Ln(A.profileItem)),i=Date.now();return t.map(A=>{const e=Nn.createProfile(A.userId,A.profileItem);return e.lastUpdatedTime=i,e})}_isStrangerAndProfileValid(A){var e;if(!kn(A)){const{lastUpdatedTime:t=0}=this._strangerProfileMap.get(A)||{},i=(null===(e=At.store.get("cloudConfig"))||void 0===e?void 0:e.stranger_profile_expiration_time)||6e5;return Date.now()-t<=i}return!1}_chunkUserIDList(A,e){return Array.from({length:Math.ceil(A.length/e)},(t,i)=>A.slice(i*e,(i+1)*e))}_batchFetchUserProfiles(A){return IA(this,void 0,void 0,function*(){const e=[],t=[];let o={};return this._chunkUserIDList(A,100).forEach(A=>{e.push(Gn(A))}),(yield Promise.allSettled(e)).forEach(A=>{if("fulfilled"===A.status){const e=A.value,o=this._handleProfileFormResponse(e);i(o)&&t.push(...o)}else if("rejected"===A.status){const{code:e,message:t}=A.reason||{};o={errorCode:e,message:t}}}),{data:t,error:o}})}_reset(){ho.getUserProfileMap().clear(),this._strangerProfileMap.clear()}}const Fn=new Map,On=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];for(let tt=0,Ar=On.length;tt >(-2*r&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);try{return decodeURIComponent(escape(t))}catch(i){return console.warn(i),""}}const{isEmpty:Pn}=At.utils,{generateProtocolData:Yn}=At.common;function Jn(A){return IA(this,void 0,void 0,function*(){const e="im_open_status.ws_get_user_status",t=Yn({servcmd:e,data:{To_Account:A}}),i=`${t.head.seq}${e}`,o=yield At.channel.sendPacket(t,{requestId:i});if(o)return function(A){const{ErrorCode:e,ErrorInfo:t,ErrorList:i=[],UserStatusList:o=[]}=A;return{errorCode:e,errorInfo:t,successUserList:o.map(A=>{const{To_Account:e,Status:t,CustomStatus:i}=A;return{userID:e,statusType:t,customStatus:xn(i)}}),failureUserList:i.map(A=>{const{To_Account:e,Invalid_Account:t,ErrorCode:i,ErrorInfo:o}=A;return{userID:Pn(t)?e:t,code:i,message:o}})}}(o)})}class Hn{constructor(){this._customStatus=""}init(){const{notificationCenter:A}=At;Bo.getInstance().registerApi({apiName:"getUserStatus",context:this}),Bo.getInstance().registerApi({apiName:"setSelfStatus",context:this}),Bo.getInstance().registerApi({apiName:"subscribeUserStatus",context:this}),Bo.getInstance().registerApi({apiName:"unsubscribeUserStatus",context:this}),ci.getInstance().registerWorkflowStep(_t.SYNC_SERVER_INFO_AFTER_RE_ONLINE,Tt.USER_STATUS_UPDATE,this._onReOnline,this),A.subscribeInnerEvent(at.MESSAGE_PUSH,A.InnerEventSubType.USER_STATUS_UPDATE,this._onUserStatusUpdate,this),A.subscribeInnerEvent(at.LOGOUT,this._reset,this),A.subscribeInnerEvent(at.DESTROY,this._dispose,this)}setSelfStatus(A){return IA(this,void 0,void 0,function*(){const e=pi(),{customStatus:t}=A;try{return yield function(A){return IA(this,void 0,void 0,function*(){const e="im_open_status.ws_set_custom_status",t=Yn({servcmd:e,data:{CustomStatus:A}}),i=`${t.head.seq}${e}`,o=yield At.channel.sendPacket(t,{requestId:i});if(o){const{ErrorCode:A,ErrorInfo:e}=o;return{errorCode:A,errorInfo:e}}})}(t),this._customStatus=t,{code:0,data:{userID:e,statusType:Mn,customStatus:t},successLog:{message:`customStatus: ${t}`}}}catch(i){const{errorCode:A,errorInfo:e}=i;throw new $t({functionName:"setSelfStatus",code:A,message:e})}})}getUserStatus(A){return IA(this,void 0,void 0,function*(){const{userIDList:e=[]}=A;let t={};return this._isOnlyMeInArray(e)&&(t=this._getMyStatus()),t=yield this._getUserStatus(e),Object.assign(Object.assign({},t),{successLog:{message:`userIDList length: ${e.length}`}})})}setCustomStatus(A){const e=xn(A);this._customStatus=e}subscribeUserStatus(A){return IA(this,void 0,void 0,function*(){try{const{userIDList:e=[]}=A;this._checkBusinessCapabilityBits("subscribeUserStatus");const t=this._getMaxUserCount("subscribe"),i=this._sliceUserIDList(e,t),o=yield function(A){return IA(this,void 0,void 0,function*(){const{channel:e}=At,t="im_open_status.ws_status_subscribe",i=Yn({servcmd:t,data:{To_Account:A}}),o=`${i.head.seq}${t}`;return yield e.sendPacket(i,{requestId:o})})}(i),n=this._parseResponse(o);return{code:0,data:{failureUserList:n},successLog:{message:`userID length:${e.length} failCount: ${n.length}`}}}catch(e){const{errorCode:A}=e;throw new $t({functionName:"subscribeUserStatus",code:A})}})}unsubscribeUserStatus(A){return IA(this,void 0,void 0,function*(){try{this._checkBusinessCapabilityBits("unsubscribeUserStatus");const{userIDList:e=[]}=A,t=this._getMaxUserCount("unsubscribe"),i=this._sliceUserIDList(e,t),o=yield function(A){return IA(this,void 0,void 0,function*(){const{channel:e}=At,t="im_open_status.ws_status_unsubscribe";let i={};i=0===A.length?{UnsubscribeAll:1}:{To_Account:A};const o=Yn({servcmd:t,data:i}),n=`${o.head.seq}${t}`;return yield e.sendPacket(o,{requestId:n})})}(i),n=this._parseResponse(o);return{code:0,data:{failureUserList:n},successLog:{message:`userID length:${e.length} failCount: ${n.length}`}}}catch(e){const{errorCode:A}=e;throw new $t({functionName:"unsubscribeUserStatus",code:A})}})}_onUserStatusUpdate(A){const{UserStatusList:e=[]}=A||{},t=e.map(A=>{const{To_Account:e,Status:t,CustomStatus:i}=A;return{userID:e,statusType:t,customStatus:xn(i)}});this._emitUserStatusUpdatedEvent(t)}_onReOnline(A){const e=xn(A.data.customStatus);if(this._customStatus===e)return;this._customStatus=e;const t={userID:pi(),statusType:Mn,customStatus:e};this._emitUserStatusUpdatedEvent(t)}_emitUserStatusUpdatedEvent(A){At.notificationCenter.emitOuterEvent(rt.USER_STATUS_UPDATED,{name:rt.USER_STATUS_UPDATED,data:A})}_sliceUserIDList(A,e){return A.slice(0,e)}_parseResponse(A){const{ErrorList:e=[]}=A;return e.map(A=>{const{To_Account:e,Invalid_Account:t,ErrorCode:i,ErrorInfo:o}=A;return{userID:At.utils.isEmpty(t)?e:t,code:i,message:o}})}_checkBusinessCapabilityBits(A){if(!At.store.get("commercialConfig").get(Sn))throw new $t({functionName:A,code:Mt.NO_USE,replacement1:A})}_getMaxUserCount(A){const e=At.store.get("cloudConfig")||{},t={query:{key:"status_query_count",default:500},subscribe:{key:"status_sub_count",default:100},unsubscribe:{key:"status_unsub_count",default:100}},{key:i,default:o}=t[A],n=e[i]||o;return parseInt(n,10)}_getMyStatus(){return{code:0,data:{successUserList:[{userID:pi(),statusType:Mn,customStatus:this._customStatus}],failureUserList:[]}}}_getUserStatus(A){return IA(this,void 0,void 0,function*(){try{this._checkBusinessCapabilityBits("getUserStatus");const e=this._getMaxUserCount("query"),t=this._sliceUserIDList(A,e),i=yield Jn(t),{successUserList:o,failureUserList:n}=i||{};return{code:0,data:{successUserList:o,failureUserList:n}}}catch(e){const{errorCode:A}=e;throw new $t({functionName:"getUserStatus",code:A})}})}_isOnlyMeInArray(A){const e=pi();return 1===A.length&&A.indexOf(e)>-1}_dispose(){const{notificationCenter:A}=At;A.unSubscribeInnerEvent(at.MESSAGE_PUSH,A.InnerEventSubType.USER_STATUS_UPDATE,this._onUserStatusUpdate,this),A.unSubscribeInnerEvent(at.DESTROY,this._dispose,this),A.unSubscribeInnerEvent(at.LOGOUT,this._reset,this),this._reset()}_reset(){this._customStatus=""}}const qn={getUserProfile:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},updateMyProfile:{nick:{required:!1,rules:["string"],allowEmpty:!0},avatar:{required:!1,rules:["string"],allowEmpty:!0},gender:{required:!1,rules:["string"],allowEmpty:!0},selfSignature:{required:!1,rules:["string"],allowEmpty:!0},allowType:{required:!1,rules:["string"],allowEmpty:!0},birthday:{required:!1,rules:["number"],allowEmpty:!1},language:{required:!1,rules:["string"],allowEmpty:!0},messageSettings:{required:!1,rules:["string"],allowEmpty:!0},adminForbidType:{required:!1,rules:["string"],allowEmpty:!0},level:{required:!1,rules:["number"],allowEmpty:!1},role:{required:!1,rules:["number"],allowEmpty:!0},profileCustomField:{required:!1,rules:["array"],allowEmpty:!0,customValidator:function(A){for(const e of A){if("object"!=typeof e)return"Each item in profileCustomField must be an object";if("string"!=typeof(null==e?void 0:e.key))return"Each item.key in profileCustomField must be a string";if(!(null==e?void 0:e.key.startsWith(vn)))return'Each item.key in profileCustomField must start with "Tag_Profile_Custom"'}return!0}}},setSelfStatus:{customStatus:{required:!0,rules:["string"],allowEmpty:!0}},getUserStatus:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},subscribeUserStatus:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},unsubscribeUserStatus:{userIDList:{required:!1,rules:["array"],allowEmpty:!0}}},Vn={getMyProfile:!0,getUserProfile:!0,updateMyProfile:!0,setSelfStatus:!0,getUserStatus:!0,subscribeUserStatus:!0,unsubscribeUserStatus:!0};class jn{constructor(){this.userProfile=new Un,this.userStatus=new Hn,this.userProfile.init(),this.userStatus.init(),ai({auth:Vn,params:qn})}}function Kn(A){const t=[];if(!e(A))return t;const i=A.length;if(0===i)return t;for(let e=i-1;e>=0;e--)"1"===A[e]&&t.push(2**(i-e-1));return t}var Wn,zn,Zn;!function(A){A.NOT_START="notStart",A.PENDING="pending",A.RESOLVED="resolved",A.REJECTED="rejected"}(Wn||(Wn={})),function(A){A[A.C2C=1]="C2C",A[A.GROUP=2]="GROUP"}(zn||(zn={})),function(A){A[A.C2C=8]="C2C",A[A.GROUP=2]="GROUP"}(Zn||(Zn={}));class Xn{constructor(){this._name="SyncConversationHandler",this._pagingStatus=Wn.NOT_START,this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0}init(){const{notificationCenter:A}=At;ci.getInstance().registerWorkflowStep(_t.SYNC_SERVER_INFO_AFTER_RE_ONLINE,Tt.CONVERSATION_RECOVER,this._syncConversationList,this),ci.getInstance().registerWorkflowStep(_t.SYNC_SERVER_INFO_AFTER_LOGIN,Tt.CONVERSATION_LIST_SYNC,this._syncConversationListAfterLogin,this),A.subscribeInnerEvent(at.LOGOUT,this._reset,this),A.subscribeInnerEvent(at.DESTROY,this._dispose,this),At.ssoLog.debug(`${this._name}.init`)}isSyncCompleted(){return this._pagingStatus===Wn.RESOLVED}_syncConversationListAfterLogin(){return IA(this,void 0,void 0,function*(){return this._pagingStatus=Wn.NOT_START,this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._syncConversationList()})}_syncConversationList(){return IA(this,void 0,void 0,function*(){const{ssoLog:A,utils:{safeStringify:e}}=At;A.debug("_syncConversationList","start");try{const e=yield this._pagingGetConversationList(!0);this._pagingStatus=Wn.RESOLVED;const{conversationList:t=[]}=e||{};return A.info("_syncConversationList",`success count:${t.length}`),e}catch(t){const{errorCode:i,errorInfo:o}=t,n=new $t({code:i,message:o});A.error("_syncConversationList",`fail ${e(t)}`,{error:n})}})}_pagingGetConversationList(A){return IA(this,void 0,void 0,function*(){try{const{notificationCenter:e}=At,t=[];this._pagingStatus=Wn.PENDING;const i=yield function(A){return IA(this,void 0,void 0,function*(){const{fromAccount:e,pagingTimeStamp:t,pagingStartIndex:i,pagingPinnedTimeStamp:o,pagingPinnedStartIndex:n}=A;return hi({servcmd:"recentcontact.page_get",data:{AssistFlags:31,MsgAssistFlags:15,OrderType:1,From_Account:e,StartIndex:i,TimeStamp:t,TopStartIndex:n,TopTimeStamp:o}})})}({fromAccount:pi(),pagingTimeStamp:A?this._pagingTimeStamp:0,pagingStartIndex:A?this._pagingStartIndex:0,pagingPinnedTimeStamp:A?this._pagingPinnedTimeStamp:0,pagingPinnedStartIndex:A?this._pagingPinnedStartIndex:0}),{CompleteFlag:o,SessionItem:n=[],TimeStamp:r,StartIndex:s,TopTimeStamp:a,TopStartIndex:g}=i||{};let c=[];if(1===o&&(this._pagingStatus=Wn.RESOLVED),n.length>0&&(c=this._getConversationOptions(n),t.push(...c)),e.emitInnerEvent(at.SYNC_CONVERSATION_LIST,{conversationUpdateFieldList:c}),this._pagingTimeStamp=r,this._pagingStartIndex=s,this._pagingPinnedTimeStamp=a,this._pagingPinnedStartIndex=g,1!==o){const{conversationList:e}=yield this._pagingGetConversationList(A);t.push(...e)}return{conversationList:t}}catch(e){throw e}})}_getConversationOptions(A){const{utils:{isUndefined:e}}=At,t=this._convertConversationKey(A);return this._filterValidConversations(t).map(A=>(e(A.lastMsg)&&(A.lastMsg={elements:[]}),A.type===zn.C2C?this._assembleC2COption(A):this._assembleGroupOption(A)))}_filterValidConversations(A){return A.filter(({type:A,userID:e})=>A===zn.C2C&&!function(A){let e;return A.startsWith(St.CONV_C2C)&&(e=A.replace(St.CONV_C2C,"")),"@TLS#ERROR"===e||"@TLS#NOT_FOUND"===e}(e)||2===A)}_assembleC2COption(A){var e,t,i,o,n,r;const s=this._createUserprofile(A);return{conversationID:`${St.CONV_C2C}${A.userID}`,type:St.CONV_C2C,lastMessage:{lastTime:A.time,lastSequence:A.sequence,fromAccount:A.lastC2CMsgFromAccount,type:(null===(e=A.lastMsg)||void 0===e?void 0:e.elements[0])?null===(t=A.lastMsg)||void 0===t?void 0:t.elements[0].type:null,payload:(null===(i=A.lastMsg)||void 0===i?void 0:i.elements[0])?this._amendLayersOverLimitProp(A.lastMsg.elements[0].content):null,cloudCustomData:(null===(o=A.lastMsg)||void 0===o?void 0:o.cloudCustomData)||"",isRevoked:A.lastMessageFlag===Zn.C2C,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:this._computeIsPeerRead(A),revoker:(null===(r=null===(n=A.lastMsg)||void 0===n?void 0:n.revokerInfo)||void 0===r?void 0:r.revoker)||null},unreadCount:0,userProfile:s,peerReadTime:A.peerReadTime,isPinned:1===A.isPinned,customData:A.customMark||"",markList:Kn(A.standardMark),conversationGroupList:[],remark:A.friendRemark||"",messageRemindType:this._transMsgRemindType(A.messageRemindType)}}_createUserprofile(A){var e;const{userID:t,nick:i,peerAvatar:o}=A,n=[{tag:"Tag_Profile_IM_Nick",value:i},{tag:"Tag_Profile_IM_Image",value:o}];return null===(e=At.user.userProfile)||void 0===e?void 0:e.createProfile(t,n)}_computeIsPeerRead(A){const e=pi(),{lastC2CMsgFromAccount:t,time:i,c2cPeerReadTime:o}=A;return t===e&&i<=o}_assembleGroupOption(A){var e,t,i;return{conversationID:`${St.CONV_GROUP}${A.groupID}`,type:St.CONV_GROUP,lastMessage:Object.assign(Object.assign({lastTime:A.time,lastSequence:A.sequence,fromAccount:A.msgGroupFromAccount},this._patchTypeAndPayload(A)),{cloudCustomData:(null===(e=A.lastMsg)||void 0===e?void 0:e.cloudCustomData)||"",isRevoked:A.lastMessageFlag===Zn.GROUP,onlineOnlyFlag:!1,nick:A.msgGroupFromNickName||"",nameCard:A.msgGroupFromCardName||"",revoker:(null===(i=null===(t=A.lastMsg)||void 0===t?void 0:t.revokerInfo)||void 0===i?void 0:i.revoker)||null}),groupProfile:{groupID:A.groupID,name:A.groupNick,avatar:A.groupImage,type:A.groupType,nextMessageSeq:A.nextMessageSeq},unreadCount:this._computeGroupUnreadCount(A),peerReadTime:0,isPinned:1===A.isPinned,version:0,customData:A.customMark||"",markList:Kn(A.standardMark),conversationGroupList:[],messageRemindType:this._transMsgRemindType(A.messageRemindType),subType:A.groupType}}_convertConversationKey(A){return A.map(A=>({type:A.Type,userID:A.To_Account,nick:A.C2cNick,peerAvatar:A.C2cImage,time:A.MsgTimeStamp,sequence:A.MsgSeq,lastC2CMsgFromAccount:A.LastC2cMsgFrom_Account,lastMsg:this._convertLastMsgKey(A.LastMsg),lastMessageFlag:A.LastMsgFlags,c2cPeerReadTime:A.C2cPeerReadTime,peerReadTime:A.C2cPeerReadTime,friendRemark:A.C2cRemark,isPinned:A.TopFlags,standardMark:A.StandardMark,customMark:A.CustomMark,messageRemindType:A.MsgRecvOption,groupID:A.ToAccount,groupNick:A.GroupNick,groupImage:A.GroupImage,groupType:A.GroupType,nextMessageSeq:A.GroupNextMsgSeq,msgGroupFromAccount:A.MsgGroupFrom_Account,msgGroupFromNickName:A.MsgGroupFromNickName,MsgGroupFromCardName:A.MsgGroupFromCardName,unreadCount:A.UnreadMsgCount,noUnreadCount:A.GroupIgnoredUnreadSeqCount}))}_convertLastMsgKey(A){var e,t,i;const{utils:{isEmpty:o}}=At;if(o(A))return null;let n="",r=null;if(!o(A.GroupTips)){const{From_Account:t,GroupName:i}=(null===(e=A.GroupTips)||void 0===e?void 0:e.GroupInfo)||{};n=St.MSG_GRP_TIP,r=Object.assign(Object.assign({},this._parseContent(n,A.GroupTips.MsgBody)),{groupProfile:{from:t,groupName:i}})}return A.MsgBody&&(n=null===(t=A.MsgBody[0])||void 0===t?void 0:t.MsgType,r=this._parseContent(n,A.MsgBody[0])),{event:A.Event,elements:[{type:n,content:r,cloudCustomData:A.CloudCustomData}],revokerInfo:{revoker:null===(i=A.RevokerInfo)||void 0===i?void 0:i.Revoker_Account}}}_parseContent(A,e){var t;if(!e)return e;const i=At.message.messageFactory.getElementClass(A);return i?null===(t=i.parseServerPushElement(e))||void 0===t?void 0:t.content:e}_amendLayersOverLimitProp(A){const{LayersOverLimit:e}=A;return lA(A,["LayersOverLimit"]).layersOverLimit=1===e,A}_transMsgRemindType(A){let e="";return 0===A?e=St.MSG_REMIND_ACPT_AND_NOTE:1===A?e=St.MSG_REMIND_DISCARD:2===A?e=St.MSG_REMIND_ACPT_NOT_NOTE:3===A&&(e=St.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT),e}_patchTypeAndPayload(A){var e;const{utils:{isUndefined:t}}=At,{event:i,elements:o=[]}=A.lastMsg||{};return t(i)?{type:o[0]?o[0].type:null,payload:o[0]?this._amendLayersOverLimitProp(o[0].content):null}:{type:St.MSG_GRP_TIP,payload:(null===(e=null==o?void 0:o[0])||void 0===e?void 0:e.content)||{}}}_computeGroupUnreadCount(A){const{unreadCount:e=0,noUnreadCount:t=0}=A,i=e-t;return i>0?i:0}_reset(){this._pagingStatus=Wn.NOT_START,this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0}_dispose(){this._reset();const{notificationCenter:A}=At;A.unSubscribeInnerEvent(at.LOGOUT,this._reset,this),A.unSubscribeInnerEvent(at.DESTROY,this._dispose,this)}}class $n{constructor(){this.syncConversationHandler=new Xn,this.syncConversationHandler.init()}}return console.log(`TencentCloudLiteChat.VERSION:${ne}`),{create:function(A){var e,t;const{SDKAppID:i,testEnv:o=!1,devMode:n=!1,unlimitedAVChatRoom:r=!1,scene:s="",oversea:a=!1,instance:g,disableIndependentDomain:c=!1}=A;let l=i;if(!function(A){if("number"==typeof A)return!0;const e=Number(A);return!Number.isNaN(e)}(l))return console.error("Create SDK instance failed. Failed to parse the SDKAppID, please check the arguments"),null;if(l=Number(l),li.has(l))return li.get(l);let I=null;if(g)I=g,I._workflowManager&&ci.setInstance(I._workflowManager),I._pluginManager&&I._pluginManager.installBuiltInPlugin(go),g.isReady()&&(null===(t=(e=ci.getInstance()).executeWorkflow)||void 0===t||t.call(e,_t.SYNC_SERVER_INFO_AFTER_LOGIN));else{const A=function(){function A(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${A()+A()}${A()}${A()}${A()}${A()}${A()}${A()}`}();At.init({sdkAppId:l,instanceId:A,testEnv:o,devMode:n,unlimitedAVChatRoom:r,disableIndependentDomain:c,scene:s,oversea:a,sdkEdition:ao,version:ne}),ci.getInstance().init(),At.message=new mn,At.user=new jn,At.login=new mo,At.conversation=new $n,lo.getInstance().installBuiltInPlugin(go),I=Bo.getInstance().exposeApiForClient(),I._workflowManager=ci.getInstance(),I._pluginManager=lo.getInstance();const{utils:{IS_WORKER_AVAILABLE:e,USER_AGENT:t,getPlatformType:g,isIOSWebView:u}}=At,E=`instanceID:${A} SDKAppID:${i} platform:${g()} isIOSWebView:${u} workerAvailable:${e} UserAgent:${t}`;At.ssoLog.info("sdkConstruct",E)}return li.set(l,I),I},TSignaling:gt,EVENT:rt,VERSION:ne,TYPES:St}}();var NR=TR.exports;const bR=RR(NR),GR="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&("mac"===wx.getSystemInfoSync().platform||"windows"===wx.getSystemInfoSync().platform),kR="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)||GR,LR="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),UR="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),FR="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),OR="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),xR="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,PR="undefined"!=typeof uni&&"undefined"==typeof window,YR="undefined"!=typeof uni,JR=("undefined"!=typeof uni||"undefined"!=typeof window)&&!(kR||LR||UR||FR||OR||xR||PR),HR=LR?qq:UR?tt:FR?swan:OR?my:kR?wx:PR?uni:xR?jd:JR?window:{};let qR=class{constructor(){this.serviceMap=new Map}registerService(A,e){this.serviceMap.has(A)||(console.log(`TUIServiceManager.registerService serviceName:${A}`),this.serviceMap.set(A,e))}unregisterService(A){this.serviceMap.has(A)&&(console.log(`TUIServiceManager.unregisterService serviceName:${A}`),this.serviceMap.delete(A))}getService(A){return this.serviceMap.get(A)}callService(A){const{serviceName:e,method:t,params:i,callback:o}=A,n=this.getService(e);if(console.log(`TUIServiceManager.callService serviceName:${e}, service:`,n),n)return n.onCall(t,i,o)}},VR=class{constructor(){this.extensionMap=new Map}registerExtension(A,e){if(console.log(`TUIExtensionManager.registerExtension extensionID:${A}`),!this.extensionMap.has(A)){const e=[];this.extensionMap.set(A,e)}const t=this.extensionMap.get(A);-1===t.indexOf(e)&&t.push(e)}unregisterExtension(A,e){if(console.log(`TUIExtensionManager.unregisterExtension extensionID:${A}`),this.extensionMap.has(A)){const t=this.extensionMap.get(A),i=t.indexOf(e);i>-1&&t.splice(i,1)}}getExtensionList(A,e){const t=e?`params:${JSON.stringify(e)}`:"";console.log(`TUIExtensionManager.getExtensionList extensionID:${A} ${t}`);let i=[],o=[];if(this.extensionMap.has(A)){i=this.extensionMap.get(A);for(let t=0;t (this.userID="",this.userSig="",this.TUICore.notifyEvent(KR.TUILogin.EVENT.LOGIN_STATE_CHANGED,KR.TUILogin.EVENT_SUB_KEY.USER_LOGOUT_SUCCESS),Promise.resolve(A)))}destroy(){return this.chat.destroy().then(A=>(this.userID="",this.userSig="",this.TUICore.notifyEvent(KR.TUILogin.EVENT.LOGIN_STATE_CHANGED,KR.TUILogin.EVENT_SUB_KEY.USER_LOGOUT_SUCCESS),Promise.resolve(A)))}setLogLevel(A){return this.chat.setLogLevel(A)}getContext(){return{chat:this.chat,SDKAppID:this.SDKAppID,userID:this.userID,userSig:this.userSig}}reportPlugin(){var A;for(const e in WR)this.TUICore.getService(e)&&(null===(A=this.chat.callExperimentalAPI("isFeatureEnabledForStat",WR[e]))||void 0===A||A.catch(()=>{}))}loginChat(A){const{userID:e,userSig:t}=A;return new Promise((A,i)=>{this.chat.login({userID:e,userSig:t}).then(e=>{e.data.repeatLogin&&this.chat.isReady()&&A(e),this.reportPlugin(),this.loginStatusPromise.set("login",{resolve:A,reject:i,imResponse:e})}).catch(A=>{i(A)})})}onChatEvent(){this.chat.on(this.EVENT.SDK_READY,this.onSDKReady,this),this.chat.on(this.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.chat.on(this.EVENT.KICKED_OUT,this.onUserKicked,this),this.isOnChatEvent=!0}offChatEvent(){this.isOnChatEvent&&(this.chat.off(this.EVENT.SDK_READY,this.onSDKReady,this),this.chat.off(this.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.chat.off(this.EVENT.KICKED_OUT,this.onUserKicked,this),this.isOnChatEvent=!1)}onSDKReady(){if(this.loginStatusPromise.has("login")){this.TUICore.notifyEvent(KR.TUILogin.EVENT.LOGIN_STATE_CHANGED,KR.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS);const A=setTimeout(()=>{const e=this.loginStatusPromise.get("login");e.resolve(e.imResponse),clearTimeout(A),this.loginStatusPromise.delete("login")},500)}}onSDKNotReady(){this.loginStatusPromise.has("login")&&this.loginStatusPromise.get("login").reject(new Error("sdk not ready")),this.loginStatusPromise.delete("login")}onUserKicked(A){A.data.type!==this.TYPES.KICKED_OUT_USERSIG_EXPIRED?this.TUICore.notifyEvent(KR.TUILogin.EVENT.LOGIN_STATE_CHANGED,KR.TUILogin.EVENT_SUB_KEY.USER_KICKED_OFFLINE):this.TUICore.notifyEvent(KR.TUILogin.EVENT.LOGIN_STATE_CHANGED,KR.TUILogin.EVENT_SUB_KEY.USER_SIG_EXPIRED)}_addSDKExtensions(){Array.isArray(HR.__$RTC_CHAT__)&&HR.__$RTC_CHAT__.length>0&&this.chat.use(HR.__$RTC_CHAT__)}getStatScene(A){return A&&jR.indexOf(A)>-1?"rn"===A?"38":YR?"vue2"===A?"31":"32":"vue2"===A?"29":"30":A}},ZR=class{constructor(){this.eventMap=new Map}registerEvent(A,e,t){const i=this.getKey(A,e);if(console.log(`TUIEventManager.registerEvent eventName:${A} subKey:${e}`),!this.eventMap.has(i)){const A=[];this.eventMap.set(i,A)}const o=this.eventMap.get(i);-1===o.indexOf(t)&&(o.push(t),this.renotify(A,e,t))}unregisterEvent(A,e,t){console.log(`TUIEventManager.unregisterEvent eventName:${A} subKey:${e}`);const i=this.getKey(A,e);if(this.eventMap.has(i)){const A=this.eventMap.get(i),e=A.indexOf(t);e>-1&&A.splice(e,1)}}notifyEvent(A,e,t){const i=this.getKey(A,e),o=t?`params:${JSON.stringify(t)}`:"";console.log(`TUIEventManager.notifyEvent eventName:${A} subKey:${e} ${o}`),this.eventMap.has(i)&&this.eventMap.get(i).forEach(i=>{i.onNotifyEvent(A,e,t)})}getKey(A,e){let t=A;return e&&(t=`${A}-${t}`),t}renotify(A,e,t){if(A===KR.TUILogin.EVENT.LOGIN_STATE_CHANGED&&e===KR.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS){const{chat:A}=zR.getInstance().getContext();A&&A.isReady()&&(t.onNotifyEvent(KR.TUILogin.EVENT.LOGIN_STATE_CHANGED,KR.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS),console.log("TUIEventManager.renotify success."))}}};console.log("TUICore-Lite.VERSION:1.0.0");const XR=class A{constructor(){this.serviceManager=new qR,this.extensionManager=new VR,this.eventManager=new ZR}static getInstance(){return HR.__$RTC_TUICore__&&HR.__$RTC_TUILogin__?HR.__$RTC_TUICore__:(A.instance||(console.log("TUICore.getInstance ok."),A.instance=new A),HR.__$RTC_TUICore__=A.instance,A.instance)}registerService(A,e){return this.serviceManager.registerService(A,e)}unregisterService(A){return this.serviceManager.unregisterService(A)}getService(A){return this.serviceManager.getService(A)}callService(A){return this.serviceManager.callService(A)}registerExtension(A,e){return this.extensionManager.registerExtension(A,e)}unregisterExtension(A,e){return this.extensionManager.unregisterExtension(A,e)}getExtensionList(A,e){return this.extensionManager.getExtensionList(A,e)}registerEvent(A,e,t){return this.eventManager.registerEvent(A,e,t)}unregisterEvent(A,e,t){return this.eventManager.unregisterEvent(A,e,t)}notifyEvent(A,e,t){return this.eventManager.notifyEvent(A,e,t)}}.getInstance(),$R=zR.getInstance(XR);var A_={exports:{}};A_.exports=function(){const A=new class{init(A){this.core=A}};function e(A,e,t,i){return new(t||(t=Promise))(function(o,n){function r(A){try{a(i.next(A))}catch(e){n(e)}}function s(A){try{a(i.throw(A))}catch(e){n(e)}}function a(A){var e;A.done?o(A.value):(e=A.value,e instanceof t?e:new t(function(A){A(e)})).then(r,s)}a((i=i.apply(A,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const t=e=>{const{core:{OuterConstant:t,utils:{isString:i}}}=A;return i(e)&&e.slice(0,3)===t.CONV_C2C},i=e=>{const{core:{OuterConstant:t,utils:{isString:i}}}=A;return i(e)&&e.slice(0,5)===t.CONV_GROUP},o=e=>{const{core:{OuterConstant:t,utils:{isString:i}}}=A;return i(e)&&e===t.CONV_SYSTEM},n=e=>({lastTime:(null==e?void 0:e.time)||(null==e?void 0:e.lastTime)||0,lastSequence:(null==e?void 0:e.sequence)||(null==e?void 0:e.lastSequence)||0,fromAccount:(null==e?void 0:e.from)||(null==e?void 0:e.fromAccount)||"",messageForShow:A.core.common.getMessagePreviewText(null==e?void 0:e.type,null==e?void 0:e.payload),payload:(null==e?void 0:e.payload)||null,type:(null==e?void 0:e.type)||"",isRevoked:(null==e?void 0:e.isRevoked)||!1,cloudCustomData:(null==e?void 0:e.cloudCustomData)||"",onlineOnlyFlag:(null==e?void 0:e._onlineOnlyFlag)||!1,nick:(null==e?void 0:e.nick)||"",nameCard:(null==e?void 0:e.nameCard)||"",version:(null==e?void 0:e.version)||0,isPeerRead:(null==e?void 0:e.isPeerRead)||!1,revoker:(null==e?void 0:e.revoker)||null});function r(e){const{OuterConstant:t}=A.core;let i="";return 0===e?i=t.MSG_REMIND_ACPT_AND_NOTE:1===e?i=t.MSG_REMIND_DISCARD:2===e?i=t.MSG_REMIND_ACPT_NOT_NOTE:3===e&&(i=t.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT),i}function s(e){const{OuterConstant:t}=A.core;let i;return e.startsWith(t.CONV_C2C)&&(i=e.replace(t.CONV_C2C,"")),"@TLS#ERROR"===i||"@TLS#NOT_FOUND"===i}function a(e,t){const{helper:i}=A.core,o=new i.ChatError({functionName:e,code:(null==t?void 0:t.errorCode)||(null==t?void 0:t.code),message:(null==t?void 0:t.errorInfo)||(null==t?void 0:t.message)});throw console.error(`${e} fail:`,o),o}class g{constructor(A){this.conversationID=A.conversationID||"",this.unreadCount=A.unreadCount||0,this.type=A.type||"",this.lastMessage=n(A.lastMessage),this.peerReadTime=A.peerReadTime||0,this.groupAtInfoList=[],this.remark=A.remark||"",this.isPinned=A.isPinned||!1,this.messageRemindType=A.messageRemindType,this.markList=A.markList||[],this.customData=A.customData||"",this.conversationGroupList=A.conversationGroupList||[],this.draftText=A.draftText||"",this.userProfile=A.userProfile,this.groupProfile=A.groupProfile,this.subType=A.subType||"",this._isInfoCompleted=!1,this._init()}_init(){const{core:{OuterConstant:e,utils:{isUndefined:t}}}=A;t(this.userProfile)&&this.type===e.CONV_C2C?this.userProfile={userID:this.conversationID.replace(e.CONV_C2C,"")}:t(this.groupProfile)&&this.type===e.CONV_GROUP&&(this.groupProfile={groupID:this.conversationID.replace(e.CONV_GROUP,""),selfInfo:{},lastMessage:{}}),this.subType&&this.type===e.CONV_GROUP&&(this.subType=this.groupProfile.type||"")}updateUnreadCount(e){const{core:{OuterConstant:t,utils:{isUndefined:i}}}=A,{nextUnreadCount:o,isFromGetConversations:n,isUnreadC2CMessage:r}=e;i(o)||(this.subType!==t.GRP_AVCHATROOM?n&&this.type===t.CONV_GROUP||r&&this.type===t.CONV_C2C?this.unreadCount=o:this.unreadCount+=o:this.unreadCount=0)}updateLastMessage(A){this.lastMessage=n(A)}reduceUnreadCount(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}isLastMessageRevoked(e){const{core:{OuterConstant:t}}=A,{sequence:i,time:o}=e;return this.type===t.CONV_C2C&&i===this.lastMessage.lastSequence&&o===this.lastMessage.lastTime||this.type===t.CONV_GROUP&&i===this.lastMessage.lastSequence}setLastMessageRevoked(A){this.lastMessage.isRevoked=A}setLastMessageRevoker(A){this.lastMessage.revoker=A}setDraftText(A){this.draftText=A}updateGroupAtInfoList(e){const{core:{common:{updateGroupAtInfo:t}}}=A;t(e,this.groupAtInfoList)}clearGroupAtInfoList(){this.groupAtInfoList.length=0}getProfileCompleted(){return this._isInfoCompleted}setProfileCompleted(){this._isInfoCompleted=!0}}var c,l,I,u;(u=c||(c={}))[u.OFF=0]="OFF",u[u.ON=1]="ON",function(A){A[A.ONLY_CONVERSATIONID=1]="ONLY_CONVERSATIONID"}(l||(l={})),function(A){A[A.CONV_NOT_FOUND=2500]="CONV_NOT_FOUND",A[A.USER_OR_GRP_NOT_FOUND=2501]="USER_OR_GRP_NOT_FOUND",A[A.CONV_UN_RECORDED_TYPE=2502]="CONV_UN_RECORDED_TYPE"}(I||(I={}));const E=0,d=1;var h=new class{constructor(){this._name="ConversationDataHandler",this._totalUnreadCount=0,this._groupAtTipsList=[]}init(A){this._core=A;const{helper:e,notificationCenter:t,appStore:{conversationStore:i},constants:{WORKFLOW_NAME:o,WORKFLOW_STEP:n},InnerEvent:{SYNC_CONVERSATION_LIST:r,MESSAGE_PUSH:s,NEW_MESSAGE:a,MESSAGE_DELETED:g,MESSAGE_REVOKED:c,MESSAGE_MODIFIED:l,CONVERSATION_UPDATED:I,LOGOUT:u,DESTROY:E},InnerEventSubType:{C2C_MESSAGE_PEER_READ:d}}=A;this._conversationStore=i,e.registerWorkflowStep(o.SYNC_SERVER_INFO_AFTER_LOGIN,n.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,this._handleUnreadSyncFinished,this),e.registerWorkflowStep(o.SYNC_SERVER_INFO_AFTER_LOGIN,n.CONVERSATION_UPDATE_AFTER_GROUP_LIST_SYNC_FINISHED,this._handleGroupListSyncFinished,this),e.registerWorkflowStep(o.RECEIVE_C2C_NEW_MESSAGE,n.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,this._handleNewMessage,this),e.registerWorkflowStep(o.RECEIVE_C2C_NEW_MESSAGE,n.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,this._handleUnreadSyncFinished,this),e.registerWorkflowStep(o.RECEIVE_GROUP_NEW_MESSAGE,n.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,this._handleNewMessage,this),e.registerWorkflowStep(o.SYNC_SERVER_INFO_AFTER_RE_ONLINE,n.CONVERSATION_UPDATE_AFTER_UNREAD_SYNC_FINISHED,this._handleUnreadSyncFinished,this),e.registerWorkflowStep(o.RECEIVE_GROUP_TIPS_NOTIFICATION,n.CREATE_OR_UPDATE_CONVERSATION_BY_RECEIVE_NEW_MESSAGE,this._handleNewMessage,this);const{InnerEventSubType:{GROUP_AT_TIPS:h}}=t;t.subscribeInnerEvent(r,this._handleConversationSynced,this),t.subscribeInnerEvent(a,this._handleNewMessage,this),t.subscribeInnerEvent(s,h,this._handleNewGroupAtTips,this),t.subscribeInnerEvent(g,this._handleMessageDeleted,this),t.subscribeInnerEvent(c,this._handleMessageRevoked,this),t.subscribeInnerEvent(l,this._handleMessageModified,this),t.subscribeInnerEvent(I,this._handleConversationUpdated,this),t.subscribeInnerEvent(s,d,this._handleMessageRead,this),t.subscribeInnerEvent(u,this._reset,this),t.subscribeInnerEvent(E,this._dispose,this),A.ssoLog.debug(`${this._name}.init`)}_handleConversationSynced(A){this.updateLocalConversationList({conversationUpdateFieldList:A.conversationUpdateFieldList||[],isFromGetConversations:!0,updateUnreadCount:!0}),this.emitConversationListUpdate()}_handleUnreadSyncFinished(A){const{constants:{WORKFLOW_STEP:e}}=this._core,{conversationUpdateFieldList:t=[],groupTipList:i=[],isUnreadC2CMessage:o}=A.result[e.UNREAD_MESSAGE_SYNC]||{};let n=!1;t.forEach(A=>{const{conversationID:e,unreadCount:t}=A,i=this.getLocalConversation(e);i&&i.unreadCount!==t&&(i.updateUnreadCount({nextUnreadCount:t,isUnreadC2CMessage:o}),n=!0)}),n&&this.emitConversationListUpdate(),this._handleGroupAtTipsSynced(i)}_handleGroupAtTipsSynced(A){var e;for(let t=0;t 0&&this._handleNewGroupAtTips({GroupTips:A._groupAtInfoList}),n=!0}n&&this.emitConversationListUpdate()}_handleNewMessage(A){const{conversationUpdateFieldList:e=[],isInstantMessage:t=!0,isUnreadC2CMessage:i=!1,updateUnreadCount:o=!0}=A.result||{};if(0===e.length)return;const{common:{isTopic:n}}=this._core;n(e[0].conversationID)||(this.updateLocalConversationList({conversationUpdateFieldList:e,isInstantMessage:t,isUnreadC2CMessage:i,isFromGetConversations:!1,updateUnreadCount:o}),e.filter(A=>this._isConversationNeedShow(A.conversationID)).length>0&&this.emitConversationListUpdate())}_handleNewGroupAtTips(A){const{GroupTips:e=[]}=A;e.forEach(A=>{const{GroupAtTips:e,MsgBody:t,MsgRandom:i,ClientSeq:o}=A;let n={};e?n=this._convertGroupAtTipsKey(e):t?n=Object.assign({},this._convertGroupAtTipsKey(t)):A.groupAtType&&(n=Object.assign({},A)),n.__random=i,n.__sequence=o,this._groupAtTipsList.push(n)}),console.log(`${this._name}._handleNewGroupAtTips groupAtTipsList: ${JSON.stringify(this._groupAtTipsList)}`),this._updateGroupAtInfoList()}_convertGroupAtTipsKey(A){const{From_Account:e,GroupId:t,MsgSeq:i,GroupAtType:o}=A;return{from:e,groupID:t,sequence:i,groupAtType:o}}_updateGroupAtInfoList(){if(0===this._groupAtTipsList.length)return;const{common:A,OuterConstant:e}=this._core,t=A.getCurrentUserID();let i=!1;this._groupAtTipsList.forEach(A=>{const{groupID:o,from:n}=A;if(n!==t){const t=this.getLocalConversation(`${e.CONV_GROUP}${o}`);t&&(t.updateGroupAtInfoList(A),i=!0)}}),i&&this.emitConversationListUpdate(),this._groupAtTipsList.length=0}_handleMessageDeleted(A){var e,t;console.log(`${this._name}._handleMessageDeleted, conversationID:`,A);const{message:{messageDataHandler:i},OuterConstant:o}=this._core,n=(null==i?void 0:i.getLocalMessageList(A))||[];let r={};for(let g=(n.length||0)-1;g>=0;g--)if(!n[g].isDeleted){r=n[g];break}const s=this.getLocalConversation(A);if(!s)return;let a=!1;s.lastMessage.lastSequence===r.sequence&&s.lastMessage.lastTime===r.time||((null===(t=null===(e=this._core)||void 0===e?void 0:e.helper)||void 0===t?void 0:t.isEmpty(r))&&(r=void 0),s.updateLastMessage(r),a=!0),A.startsWith(o.CONV_C2C)&&this.updateUnreadCount(A),a&&(this.emitConversationListUpdate(),console.log(`${this._name}._handleMessageDeleted. update conversationID:${A} with lastMessage:`,s.lastMessage))}_handleMessageRevoked(A){const{messageList:e=[],updateUnreadCount:t=!0}=A;if(console.log(`${this._name}._handleMessageRevoked messageList:${e.length}`),0===e.length)return;let i=null,o=!1;e.forEach(A=>{i=this.getLocalConversation(A.conversationID),i&&(t&&i.reduceUnreadCount()&&(o=!0),i.isLastMessageRevoked({sequence:A.sequence,time:A.time})&&(i.setLastMessageRevoked(!0),i.setLastMessageRevoker(A.revoker),o=!0))}),o&&this.emitConversationListUpdate()}_handleMessageModified(A){console.log(`${this._name}._handleMessageModified`,JSON.stringify(A));const{conversationID:e,messageList:t}=A,i=this.getLocalConversation(e),{utils:{isEmpty:o},common:{getMessagePreviewText:n}}=this._core;if(o(i))return;const{lastMessage:r}=i;if(r){const A=(null==t?void 0:t[0])||{};r.lastTime===A.time&&r.lastSequence===A.sequence&&r.version!==A.version&&(r.type=A.type,r.payload=A.payload,r.messageForShow=n(A.type,A.payload),r.cloudCustomData=A.cloudCustomData,r.version=A.version,this.emitConversationListUpdate(),console.log(`${this._name} conversationID:${e} lastMessage updated`))}}_handleConversationUpdated(A){this.emitConversationListUpdate(null==A?void 0:A.needSort)}updateLocalConversationList(A){const{isFromGetConversations:e}=A,{newConversationList:t}=this._getTmpConversationListMapping(A);this._sortConversationList(),e||this._updateNewConversationProfile(t),this._core.ssoLog.debug("updateLocalConversationList",` newConversationList: ${t.length}`)}_getTmpConversationListMapping(A){const{OuterConstant:e}=this._core,{conversationUpdateFieldList:t,isFromGetConversations:i,isInstantMessage:o,isUnreadC2CMessage:n=!1,updateUnreadCount:r}=A,a=[],c=null==t?void 0:t.length;for(let l=0;l {!0===e[1].isPinned?A(e[1].lastMessage.lastTime)?i.push(e):t.push(e):A(e[1].lastMessage.lastTime)?n.push(e):o.push(e)});const r=t.sort((A,e)=>e[1].lastMessage.lastTime-A[1].lastMessage.lastTime).concat(i).concat(o.sort((A,e)=>e[1].lastMessage.lastTime-A[1].lastMessage.lastTime)).concat(n);this._updateConversationMapFromList(r)}_updateNewConversationProfile(A){if(0===A.length)return;const e=[],t=[],{OuterConstant:{CONV_GROUP:i,CONV_C2C:o}}=this._core;A.forEach(A=>{const{conversationID:n,type:r}=A;if(r===o){const A=n.replace(o,"");e.push(A)}else if(r===i){const A=n.replace(i,"");t.push(A)}}),e.length>0&&this._updateC2CConversation(e),t.length>0&&this._updateGroupConversation(t)}_updateC2CConversation(A){var e;const{OuterConstant:{CONV_C2C:t},appStore:{userStore:i},user:o}=this._core;let n=!1;null===(e=o.userProfile)||void 0===e||e.getUserProfile({userIDList:A}).then(A=>{((null==A?void 0:A.data)||[]).forEach(A=>{var e;const{userID:o}=A,r=this.getLocalConversation(`${t}${o}`);if(r){const t=(null===(e=i.getFriend(o))||void 0===e?void 0:e.remark)||"";r.remark=t,r.userProfile=A,n=!0}}),n&&this.emitConversationListUpdate()}).catch(A=>{})}_updateGroupConversation(A){return e(this,void 0,void 0,function*(){const{OuterConstant:{CONV_GROUP:t},appStore:{groupStore:i},utils:{isEmpty:o,safeStringify:n},ssoLog:r,apiMap:{getGroupProfile:s}}=this._core;let a=!1;try{yield Promise.all(A.map(A=>e(this,void 0,void 0,function*(){const e=i.getGroup(A),n=this.getLocalConversation(`${t}${A}`);e&&n&&(n.groupProfile=e,a=!0),o(e)&&n&&"function"==typeof s&&(yield s({groupID:A}))}))),a&&this.emitConversationListUpdate()}catch(g){r.debug("_updateGroupConversation",n(g))}})}_handleMessageRead(A){const{OuterConstant:{CONV_C2C:e}}=this._core,{C2cNotifyMsgArray:t=[]}=A||{};t.forEach(A=>{const{To_Account:t,UinPairReadArray:i=[]}=(null==A?void 0:A.C2cReadedReceipt)||{};null==i||i.forEach(A=>{const{LastReadTime:i}=A,o=`${e}${t}`;this._updateConversationReadInfo({conversationID:o,peerReadTime:i}),this._updateMessageListPeerRead({conversationID:o,peerReadTime:i})})})}_updateConversationReadInfo(A){const{appStore:e,utils:{isEmpty:t},common:{getCurrentUserID:i}}=this._core,{conversationID:o,peerReadTime:n}=A,r=e.conversationStore.getConversationMap();if(r.has(o)){const A=r.get(o);A.peerReadTime=n;const s=null==A?void 0:A.lastMessage;t(s)||s.fromAccount===i()&&s.lastTime<=n&&!s.isPeerRead&&(s.isPeerRead=!0,e.conversationStore.updateConversation(o,{lastMessage:s}))}}_updateMessageListPeerRead(A){const{notificationCenter:e,OuterEvent:t,message:i}=this._core,{conversationID:o,peerReadTime:n}=A,r=i.messageDataHandler.getLocalMessageList(o),s=i.messageDataHandler.getSparseMessageList(o),a=[];r.forEach(A=>{A.time<=n&&!A.isPeerRead&&"out"===A.flow&&(A.isPeerRead=!0,a.push(A))}),s.forEach(A=>{A.time<=n&&!A.isPeerRead&&"out"===A.flow&&(A.isPeerRead=!0,a.push(A))}),e.emitOuterEvent(t.MESSAGE_READ_BY_PEER,{name:t.MESSAGE_READ_BY_PEER,data:a})}_isConversationNeedShow(A){var e,t;const{OuterConstant:{CONV_GROUP:i,GRP_ROOM:o,GRP_LIVE:n},utils:{isUndefined:r}}=this._core,s=this.getLocalConversation(A);if(r(s))return!0;const a=s.type===i&&(null===(e=s.groupProfile)||void 0===e?void 0:e.type)===o,g=s.type===i&&(null===(t=s.groupProfile)||void 0===t?void 0:t.type)===n;return!(a||g)}updateUnreadCount(A,e=!0){var t,i;let o=!1;const n=this.getLocalConversation(A),r=null===(i=null===(t=this._core)||void 0===t?void 0:t.message.messageDataHandler)||void 0===i?void 0:i.getLocalMessageList(A);if(!n)return o;const s=n.unreadCount,a=null==r?void 0:r.filter(A=>!A.isRead&&!A._onlineOnlyFlag&&!A.isDeleted).length;return console.log(`${this._name}._updateUnreadCount conversationID:${A} currentUnreadCount:${s} newUnreadCount:${a}`),s!==a&&(n.unreadCount=a,o=!0,!0===e&&this.emitConversationListUpdate()),o}emitConversationListUpdate(A=!1){var e,t;A&&this._sortConversationList();const{OuterEvent:{CONVERSATION_LIST_UPDATED:i},conversation:o}=this._core,n=this.getLocalConversationList();this._emitEvent({name:i,data:n,isSyncCompleted:null===(t=null===(e=null==o?void 0:o.syncConversationHandler)||void 0===e?void 0:e.isSyncCompleted)||void 0===t?void 0:t.call(e)}),this._emitTotalUnreadCountUpdate()}_emitTotalUnreadCountUpdate(){var A;const e=this.getTotalUnreadMessageCount();this._totalUnreadCount!==e&&(this._core.ssoLog.debug("_emitTotalUnreadCountUpdate",` from ${this._totalUnreadCount} to ${e}`),this._totalUnreadCount=e,this._emitEvent({name:null===(A=this._core)||void 0===A?void 0:A.OuterEvent.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,data:e}))}_emitEvent(A){var e;null===(e=this._core)||void 0===e||e.notificationCenter.emitOuterEvent(A.name,A)}getTotalUnreadMessageCount(){const{OuterConstant:A,utils:{isEmpty:e}}=this._core,t=this.getLocalConversationList();let i=0;return t.forEach(t=>{t.type!==A.CONV_SYSTEM&&(e(t.messageRemindType)||t.messageRemindType===A.MSG_REMIND_ACPT_AND_NOTE)&&(i+=t.unreadCount)}),i}getLocalConversationList(){return[...this._conversationStore.getConversationMap().values()].filter(A=>this._isConversationNeedShow(A.conversationID))}hasLocalConversation(A){return this._conversationStore.getConversationMap().has(A)}getLocalConversation(A){return this._conversationStore.getConversationMap().get(A)}setLocalConversation(A,e){return this._conversationStore.getConversationMap().set(A,e)}deleteLocalConversation(A){this._conversationStore.getConversationMap().delete(A)}_updateConversationMapFromList(A){this._clearConversationMap();for(const[e,t]of A)this.setLocalConversation(e,t)}_clearConversationMap(){this._conversationStore.getConversationMap().clear()}patchMessageRemindType(A,e){let t=!1;A.forEach(A=>{const i=this.getLocalConversation(A);(null==i?void 0:i.messageRemindType)!==e&&(i.messageRemindType=e,t=!0)}),console.log(`${this._name}.patchMessageRemindType conversationIDList:${A} messageRemindType:${e} hasUpdated:${t}`),t&&this.emitConversationListUpdate()}markMessageAsRead(A){const{message:{messageDataHandler:e}}=this._core,{conversationID:t,lastReadTime:i=0,lastReadSequence:o=0}=A,n=null==e?void 0:e.getLocalMessageList(t);if(0===n.length)return;const{length:r}=n;for(let s=r-1;s>=0;s--){const A=n[s],e=i&&A.time>i,t=o&&A.sequence>o;if(!e&&!t){if("in"===A.flow&&A.isRead)break;A.setIsRead(!0)}}}appendToPinnedConversation(A){const e=[...this._conversationStore.getConversationMap().entries()],t=e.findIndex(A=>!1===A[1].isPinned);e.splice(t,0,[A.conversationID,A]),this._updateConversationMapFromList(e),this.emitConversationListUpdate()}_reset(){this._clearConversationMap(),this._totalUnreadCount=0,this._groupAtTipsList=[]}_dispose(){const{notificationCenter:A,InnerEvent:{NEW_MESSAGE:e,MESSAGE_DELETED:t,MESSAGE_REVOKED:i,MESSAGE_MODIFIED:o,CONVERSATION_UPDATED:n,LOGOUT:r,DESTROY:s,SYNC_CONVERSATION_LIST:a}}=this._core,{InnerEventSubType:{GROUP_AT_TIPS:g}}=A;A.unSubscribeInnerEvent(e,this._handleNewMessage,this),A.unSubscribeInnerEvent(e,g,this._handleNewGroupAtTips,this),A.unSubscribeInnerEvent(t,this._handleMessageDeleted,this),A.unSubscribeInnerEvent(i,this._handleMessageRevoked,this),A.unSubscribeInnerEvent(o,this._handleMessageModified,this),A.unSubscribeInnerEvent(n,this._handleConversationUpdated,this),A.unSubscribeInnerEvent(a,this._handleConversationSynced,this),A.unSubscribeInnerEvent(r,this._reset,this),A.unSubscribeInnerEvent(s,this._dispose,this)}},C=new class{constructor(){this._name="GetConversationList"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"getConversationList",context:this})}getConversationList(A){return e(this,void 0,void 0,function*(){return{code:0,data:{conversationList:this._getConversationList(A),isSyncCompleted:this._core.conversation.syncConversationHandler.isSyncCompleted()}}})}_getConversationList(A){const{utils:{isUndefined:e,isArray:t,isPlainObject:i}}=this._core;if(e(A))return h.getLocalConversationList();if(t(A))return 0===A.length?[]:h.getLocalConversationList().filter(e=>A.includes(e.conversationID));if(i(A)){const{type:e,markType:t,groupName:i,hasUnreadCount:o,hasGroupAtInfo:n}=A;return h.getLocalConversationList().filter(A=>this._filterType(A,e)&&this._filterMarkType(A,t)&&this._filterGroupName(A,i)&&this._filterUnreadCount(A,o)&&this._filterGroupAtInfo(A,n))}return[]}_filterType(A,e){const{OuterConstant:t}=this._core;return e!==t.CONV_C2C&&e!==t.CONV_GROUP||A.type===e}_filterGroupName(A,e){const{utils:{isString:t}}=this._core;return!t(e)||(""===e?0===A.conversationGroupList.length:A.conversationGroupList.includes(e))}_filterMarkType(A,e){const{utils:{isNumber:t}}=this._core;return!t(e)||(0===e?0===A.markList.length:A.markList.includes(e))}_filterUnreadCount(A,e){let t=!0;return!0===e?t=A.unreadCount>=1:!1===e&&(t=0===A.unreadCount),t}_filterGroupAtInfo(A,e){let t=!0;return!0===e?t=A.groupAtInfoList.length>=1:!1===e&&(t=0===A.groupAtInfoList.length),t}},B=new class{constructor(){this._name="GetC2CMessageRemindType"}init(A){this._core=A}get(A){return e(this,void 0,void 0,function*(){try{const{common:t}=this._core,i=yield function(A,t){return e(this,void 0,void 0,function*(){const{toAccount:e,userIDList:i}=A,o={To_Account:e,Peer_Account:i};return t.common.buildAndSendPacket({servcmd:"openim.get_c2c_peer_mute_notifications",data:o})})}({toAccount:t.getCurrentUserID(),userIDList:A},this._core),{MuteNotificationsList:o=[]}=i||{};o.forEach(A=>{const{Peer_Account:e,MuteNotifications:t}=A,i=`${this._core.OuterConstant.CONV_C2C}${e}`,o=r(t);h.patchMessageRemindType([i],o)})}catch(t){console.error(`${this._name}.get fail:`,t)}})}},Q=new class{constructor(){this._name="GetGroupMessageRemindType"}init(A){this._core=A}get(A){return e(this,void 0,void 0,function*(){if(0!==A.length)try{const t=yield function(A,t){return e(this,void 0,void 0,function*(){const{groupIDList:e,responseFilter:i}=A,o={GroupIdList:e,ResponseFilter:i};return t.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_self_member_info",data:o})})}({groupIDList:A,responseFilter:{MemberInfoFilter:["MsgFlag"]}},this._core),{GroupInfo:i=[]}=t||{};i.forEach(A=>{var e;const{GroupId:t,MemberList:i}=A,o=(null===(e=i[0])||void 0===e?void 0:e.MsgFlag)||"",n=`${this._core.OuterConstant.CONV_GROUP}${t}`;h.patchMessageRemindType([n],o)})}catch(t){console.error(`${this._name}.get fail:`,t)}})}},p=new class{constructor(){this._name="GetConversationProfile"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"getConversationProfile",context:this})}getConversationProfile(A){return e(this,void 0,void 0,function*(){const{OuterConstant:{CONV_C2C:e,CONV_GROUP:i,GRP_AVCHATROOM:n},appStore:{groupStore:r},utils:{isEmpty:s}}=this._core,a={code:0,data:{}};let c=h.getLocalConversation(A);if(o(A))return a.data.conversation=c,a;let l=!1;const I=t(A)?e:i;if(s(c)&&(l=!0,c=new g({conversationID:A,type:I})),console.log(`${this._name}.getConversationProfile conversationID:${A} isNewConversation:${l}`),a.data.conversation=c,null==c?void 0:c.getProfileCompleted())return a;if(I===e){const t=A.replace(e,"");yield this._handleC2CConversation(c,t),l&&(yield B.get([t]))}if(I===i){const e=A.replace(i,"");if(!r.getGroup(e))return a;yield this._handleGroupConversation(c,e),l&&c.groupProfile.type!==n&&(yield Q.get([e]))}return a})}_handleC2CConversation(A,t){return e(this,void 0,void 0,function*(){var e,i;const{user:o,helper:n,utils:{isEmpty:r},appStore:{conversationStore:s,userStore:a}}=this._core,{conversationID:g}=A,c=yield null===(e=o.userProfile)||void 0===e?void 0:e.getUserProfile({userIDList:[t]});if(0===(null==c?void 0:c.data.length))throw new n.ChatError({code:I.USER_OR_GRP_NOT_FOUND});A.userProfile=null==c?void 0:c.data[0];const l=null===(i=a.getFriend(t))||void 0===i?void 0:i.remark;r(l)||A.remark===l||(A.remark=l),A.setProfileCompleted();const u=h.hasLocalConversation(g);console.log(`${this._name}._handleC2CConversation conversationID:${g} hasLocalConversation: ${u}`),u?s.updateConversation(g,A):h.appendToPinnedConversation(A)})}_handleGroupConversation(A,t){return e(this,void 0,void 0,function*(){const{apiMap:{getGroupProfile:e},appStore:{conversationStore:i}}=this._core,{conversationID:o}=A,n=yield e({groupID:t});A.groupProfile=null==n?void 0:n.data.group,A.setProfileCompleted();const r=h.hasLocalConversation(o);console.log(`${this._name}._handleGroupConversation conversationID:${o} hasLocalConversation: ${r}`),r?i.updateConversation(o,A):h.appendToPinnedConversation(A)})}},f=new class{init(A){const{helper:e}=A;e.registerApi({apiName:"getTotalUnreadMessageCount",context:this})}getTotalUnreadMessageCount(){return h.getTotalUnreadMessageCount()}},m=new class{constructor(){this._serverGroupConversationLastReadSeqMap=new Map,this._name="SetMessageRead"}init(A){this._core=A;const{helper:e,common:{isTopic:t},notificationCenter:i,InnerEvent:{MESSAGE_PUSH:o},InnerEventSubType:{ALL_MESSAGE_READ:n}}=A;e.registerApi({apiName:"setMessageRead",context:this,matcher:A=>!t(A[0].conversationID)}),e.registerApi({apiName:"setAllMessageRead",context:this}),i.subscribeInnerEvent(o,n,this._handleAllMessageRead,this)}handleC2CMessageReadSync(A){const{helper:{isEmpty:e},OuterConstant:t}=this._core;A.forEach(A=>{const{ReadC2cMsgNotify:i}=A;if(!e(i)){const{UinPairReadArray:A=[]}=i;A.forEach(A=>{const{From_Account:e,LastReadTime:i}=A,o=`${t.CONV_C2C}${e}`;console.log(`${this._name}.handleC2CMessageReadSync conversationID:${o} lastReadTime:${i}`),h.markMessageAsRead({conversationID:o,lastReadTime:i}),h.updateUnreadCount(o)})}})}handleGroupMessageReadSync(A){const{OuterConstant:e,utils:{isUndefined:t}}=this._core;A.forEach(A=>{const{GroupReadInfoArray:i}=A.MsgBody;t(i)||i.forEach(A=>{const{GroupId:t,LastReadMsgSeq:i}=A,o=`${e.CONV_GROUP}${t}`;console.log(`${this._name}.handleGroupMessageReadSync conversationID:${o} lastReadSequence:${i}`),h.markMessageAsRead({conversationID:o,lastReadSequence:i}),h.updateUnreadCount(o),this._clearGroupAtInfoList(o)})})}setMessageRead(A){return e(this,void 0,void 0,function*(){var e,t;const{OuterConstant:i}=this._core,{conversationID:o}=A,n={code:0,data:{}},r=h.getLocalConversation(o);let s=`${this._name}.setMessageRead conversationID:${o} unreadCount:${(null==r?void 0:r.unreadCount)||0}`;if(n.successLog={message:s},!r)return n;const a=!(null===(t=null===(e=this._core)||void 0===e?void 0:e.helper)||void 0===t?void 0:t.isEmpty(r.groupAtInfoList));if(r.type===i.CONV_GROUP&&a&&this._deleteGroupAtTips(o),0===r.unreadCount)return n;const{helper:{ChatError:g}}=this._core;try{if(r.type===i.CONV_C2C){const A=this._getLocalMessageMaxTime(r);yield this._setC2CMessageRead(o,A),s+=`lastMessageTime:${A}`}if(r.type===i.CONV_GROUP){const A=this._getLocalMessageMaxSequence(r);yield this._setGroupMessageRead(o,A),s+=`lastMessageSequence:${A}`}}catch(c){const{errorCode:A,errorInfo:e}=c;throw new g({functionName:"setMessageRead",code:A,message:e,moreMessage:s})}return r.type===i.CONV_SYSTEM&&(r.unreadCount=0),h.emitConversationListUpdate(),Object.assign(Object.assign({},n),{successLog:{message:s}})})}setAllMessageRead(){return e(this,arguments,void 0,function*(t={}){const{OuterConstant:{READ_ALL_MSG:i},utils:{safeStringify:o}}=this._core;let n=`scope:${t.scope}`;t.scope||(t.scope=i);const{scope:r}=t,s=this._generateSetAllMessageReadRequestData(r);if(s.allC2CMessageReadStatus===E&&0===s.groupMessageReadInfoList.length)return{code:0};try{const t=yield function(t){return e(this,void 0,void 0,function*(){const{allC2CMessageReadStatus:e,groupMessageReadInfoList:i}=t,o={C2CReadAllMsg:e,GroupReadInfo:i};return A.core.common.buildAndSendPacket({servcmd:"openim.read_all_unread_msg",data:o})})}(s);if(t){const{GroupReadInfoArray:A,C2CReadAllMsg:e}=t,i=this._parseGroupReadInfo(A);this._updateAllConversationReadStatus({allC2CMessageReadStatus:e})>0&&h.emitConversationListUpdate(),n+=`failureGroupInfoList:${o(i)}`}return{code:0,successLog:{message:n}}}catch(u){const{errorCode:e}=u;throw new this._core.helper.ChatError({functionName:"setAllMessageRead",code:e,moreMessage:n})}})}_handleAllMessageRead(A){const{GroupReadInfoArray:e,C2CReadAllMsg:t}=A;this._parseGroupReadInfo(e),this._updateAllConversationReadStatus({allC2CMessageReadStatus:t})>0&&h.emitConversationListUpdate()}_updateAllConversationReadStatus(A){const{OuterConstant:{CONV_C2C:e,CONV_GROUP:t},appStore:i}=this._core,o=i.conversationStore.getConversationMap(),{allC2CMessageReadStatus:n}=A;let r=0;for(const[s,a]of o)if(a.unreadCount>=1){if(n===d&&a.type===e){const A=this._getLocalMessageMaxTime(a);h.markMessageAsRead({conversationID:s,lastReadTime:A})}else if(a.type===t){const A=s.replace(t,"");if(this._serverGroupConversationLastReadSeqMap.has(A)){const e=this._serverGroupConversationLastReadSeqMap.get(A);h.markMessageAsRead({conversationID:s,lastReadSequence:e})}}h.updateUnreadCount(s,!1)&&(r+=1)}return r}_generateSetAllMessageReadRequestData(A){const{OuterConstant:{CONV_C2C:e,CONV_GROUP:t,READ_ALL_C2C_MSG:i},appStore:o}=this._core,n={allC2CMessageReadStatus:E,groupMessageReadInfoList:[]},r=o.conversationStore.getConversationMap();for(const[,s]of r){const{type:o,unreadCount:r}=s;if(this._shouldSetAllMessageRead({scope:A,type:o,unreadCount:r}))if(o===e&&n.allC2CMessageReadStatus===E){if(n.allC2CMessageReadStatus=d,A===i)break}else if(o===t){const A=this._getLocalMessageMaxSequence(s),{groupID:e}=s.groupProfile;n.groupMessageReadInfoList.push({GroupId:e,MsgSeq:A})}}return n}_parseGroupReadInfo(A){const{utils:{isUndefined:e}}=this._core,t=[];return null==A||A.forEach(A=>{const{GroupId:i,MsgSeq:o,RetCode:n,LastReadMsgSeq:r}=A;e(n)?this._serverGroupConversationLastReadSeqMap.set(i,r):(this._serverGroupConversationLastReadSeqMap.set(i,o),0!==n&&t.push(`${i}-${o}-${n}`))}),t}_deleteGroupAtTips(A){return e(this,void 0,void 0,function*(){console.log(`${this._name}._deleteGroupAtTips conversationID:${A}`);const t=h.getLocalConversation(A);if(!t)return;const i=(null==t?void 0:t.groupAtInfoList)||[];if(0!==i.length)try{const{common:{getCurrentUserID:t,isCommunity:o},OuterConstant:{CONV_GROUP:n,CONV_AT_ALL:r}}=this._core;let s=[...i];if(o({groupID:A.replace(n,"")})&&(s=i.filter(A=>!A.atTypeArray.includes(r)),0===s.length))return void this._clearGroupAtInfoList(A,!1);const a=s.map(A=>({From_Account:A.from,To_Account:t(),MsgSeq:A.__sequence,MsgRandom:A.__random,GroupId:A.groupID}));yield function(A,t){return e(this,void 0,void 0,function*(){const{messageListToDelete:e}=A,i={DelMsgList:e};return t.common.buildAndSendPacket({servcmd:"openim.deletemsg",data:i})})}({messageListToDelete:a},this._core),console.log(`${this._name}._deleteGroupAtTips ok. count:${i.length}`),this._clearGroupAtInfoList(A)}catch(o){console.error(`${this._name}._deleteGroupAtTips fail:`,o)}})}_clearGroupAtInfoList(A,e=!0){const t=h.getLocalConversation(A);t&&(t.groupAtInfoList.length>0&&(t.clearGroupAtInfoList(),console.log(`${this._name}._clearGroupAtInfoList conversationID:${A} needEmitConversationUpdate:${e}`)),e&&h.emitConversationListUpdate())}_getLocalMessageMaxTime(A){var e;const{conversationID:t}=A,i=this._core.message.messageDataHandler.getLocalMessageList(t),o=Math.max(...i.map(A=>A.time));let n=(null===(e=null==A?void 0:A.lastMessage)||void 0===e?void 0:e.lastTime)||0;return o>n&&(console.log(`${this._name}._getLocalMessageMaxTime update lastMessageTime from ${n} to ${o}`),n=o),n}_getLocalMessageMaxSequence(A){var e;const{conversationID:t}=A,i=this._core.message.messageDataHandler.getLocalMessageList(t),o=Math.max(...i.map(A=>A.sequence));let n=(null===(e=null==A?void 0:A.lastMessage)||void 0===e?void 0:e.lastSequence)||0;return o>n&&(console.log(`${this._name}._getLocalMessageMaxSequence update lastMessageSequence from ${n} to ${o}`),n=o),n}_setC2CMessageRead(A,t){return e(this,void 0,void 0,function*(){try{yield function(A,t){return e(this,void 0,void 0,function*(){return t.common.buildAndSendPacket({servcmd:"openim.msgreaded",data:A})})}({C2CMsgReaded:{Cookie:"",C2CMsgReadedItem:[{To_Account:A.replace("C2C",""),LastedMsgTime:t,Receipt:1}]}},this._core),console.log(`${this._name}._setC2CMessageRead ok, lastReadTime:${t}`),h.markMessageAsRead({conversationID:A,lastReadTime:t}),h.updateUnreadCount(A)}catch(i){throw console.warn(`${this._name}._setC2CMessageRead fail:`,i),i}})}_setGroupMessageRead(A,t){return e(this,void 0,void 0,function*(){try{yield function(A,t){return e(this,void 0,void 0,function*(){const{groupID:e,lastMessageSequence:i}=A,o={GroupId:e,MsgReadedSeq:i};return t.common.buildAndSendPacket({servcmd:"group_open_http_svc.msg_read_report",data:o})})}({groupID:A.replace("GROUP",""),lastMessageSequence:t},this._core),console.log(`${this._name}._setGroupMessageRead ok, lastReadSequence:${t}`),h.markMessageAsRead({conversationID:A,lastReadSequence:t}),h.updateUnreadCount(A)}catch(i){throw console.warn(`${this._name}._setGroupMessageRead fail:`,i),i}})}_shouldSetAllMessageRead(A){const{OuterConstant:{CONV_C2C:e,CONV_GROUP:t,READ_ALL_MSG:i,READ_ALL_C2C_MSG:o,READ_ALL_GROUP_MSG:n}}=this._core,{type:r,scope:s,unreadCount:a}=A;return!(a<=0||(r!==e||![i,o].includes(s))&&(r!==t||![i,n].includes(s)))}},y=new class{constructor(){this._name="PinConversation"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"pinConversation",context:this})}handleConversationPinned(A,e){const{utils:{isArray:t}}=this._core;if(!t(A))return;const{OuterConstant:i}=this._core;let o=!1;A.forEach(A=>{const{Type:t,To_Account:n,GroupId:r}=A;let s;1===t?s=h.getLocalConversation(`${i.CONV_C2C}${n}`):2===t&&(s=h.getLocalConversation(`${i.CONV_GROUP}${r}`)),s&&(console.log(`${this._name}.handleConversationPinned conversationID:${s.conversationID} localPinned:${s.isPinned} remotePinned:${e}`),e&&!s.isPinned&&(s.isPinned=!0,o=!0),!e&&s.isPinned&&(s.isPinned=!1,o=!0))}),o&&h.emitConversationListUpdate(!0)}pinConversation(A){return e(this,void 0,void 0,function*(){const{OuterConstant:n,common:r,helper:{ChatError:s}}=this._core,{conversationID:a,isPinned:c}=A,l={code:0,data:{conversationID:a}},I=h.getLocalConversation(a);if(I&&I.isPinned===c)return l;if(o(a))return I&&(I.isPinned=c),h.emitConversationListUpdate(!0),l;const u=`conversationID:${a} isPinned:${c}`;try{let A=null;if(t(a)?A={Type:1,To_Account:a.replace(n.CONV_C2C,"")}:i(a)&&(A={Type:2,GroupId:a.replace(n.CONV_GROUP,"")}),yield function(A,t){return e(this,void 0,void 0,function*(){const{fromAccount:e,operationType:i,itemList:o}=A,n={From_Account:e,OperationType:i,RecentContactItem:o};return t.common.buildAndSendPacket({servcmd:"recentcontact.top",data:n})})}({fromAccount:r.getCurrentUserID(),operationType:!0===c?1:2,itemList:[A]},this._core)){if(I)I.isPinned!==c&&(I.isPinned=c);else{const A=new g({conversationID:a,type:t(a)?n.CONV_C2C:n.CONV_GROUP,isPinned:c});h.setLocalConversation(a,A)}h.emitConversationListUpdate(!0)}return Object.assign(Object.assign({},l),{successLog:{message:u}})}catch(E){const{errorCode:A,errorInfo:e}=E;throw new s({functionName:"pinConversation",code:A,message:e,moreMessage:u})}})}},D=new class{constructor(){this._name="DeleteConversation"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"deleteConversation",context:this})}handleConversationDeleted(A){const{utils:{isArray:e}}=this._core;if(!e(A))return;const{OuterConstant:t}=this._core,i=[];A.forEach(A=>{const{Type:e,Peer_Account:o,GroupId:n}=A;1===e&&i.push(`${t.CONV_C2C}${o}`),2===e&&i.push(`${t.CONV_GROUP}${n}`)}),console.log(`${this._name}.handleConversationDeleted conversationIDList:${i}`),this._deleteLocalConversationList(i)}deleteConversation(A){return e(this,void 0,void 0,function*(){const{utils:{isString:e}}=this._core;if(e(A))return void(yield this._deleteConversation({conversationIDList:[A],flag:l.ONLY_CONVERSATIONID}));const t=Object.assign({},A);t.conversationIDList.length>100&&(t.conversationIDList=t.conversationIDList.slice(0,100)),yield this._deleteConversation(t)})}_deleteConversation(A){return e(this,void 0,void 0,function*(){const{conversationIDList:e,clearHistoryMessage:t=!0,flag:i=0}=A,{helper:{ChatError:o}}=this._core,n=`conversationIDList:${e} clearHistoryMessage:${t}`;try{const A=yield Promise.all([this._deleteConversationFromLocal(e),this._deleteConversationFromServer(e,t)]),o=[...A[0],...A[1]];if(0===o.length)throw new this._core.helper.ChatError({code:I.CONV_NOT_FOUND});return{code:0,data:i===l.ONLY_CONVERSATIONID?{conversationID:o[0]}:{conversationIDList:o},successLog:{message:n}}}catch(r){const{errorCode:A,errorInfo:e}=r;throw new o({code:A,message:e,moreMessage:n})}})}_deleteConversationFromLocal(A){const{OuterConstant:e}=this._core;return A.filter(A=>{var t;if(!h.hasLocalConversation(A))return!1;const i=null===(t=h.getLocalConversation(A))||void 0===t?void 0:t.type;return i!==e.CONV_GROUP||this._hasLocalGroup(A)?i===e.CONV_SYSTEM&&(this._deleteLocalConversation(A),!0):(this._deleteLocalConversation(A),!0)})}_deleteConversationFromServer(A,t){return e(this,void 0,void 0,function*(){const{OuterConstant:i,common:o}=this._core,n={fromAccount:o.getCurrentUserID(),conversationList:[],clearHistoryMessage:t?1:0};if(A.forEach(A=>{var e;if(h.hasLocalConversation(A)){const t=(null===(e=h.getLocalConversation(A))||void 0===e?void 0:e.type)||"",o=A.replace(t,"");t===i.CONV_C2C?n.conversationList.push({To_Account:o,Type:1}):t===i.CONV_GROUP&&this._hasLocalGroup(A)&&n.conversationList.push({ToGroupid:o,Type:2})}}),0===n.conversationList.length)return[];const r=yield function(A,t){return e(this,void 0,void 0,function*(){const{fromAccount:e,conversationList:i,clearHistoryMessage:o}=A,n={From_Account:e,ContactItem:i,ClearRamble:o};return t.common.buildAndSendPacket({servcmd:"recentcontact.batch_delete",data:n})})}(n,this._core);if(r){const{ResultItem:A=[]}=r,e=[];return A.length>0&&A.forEach(A=>{if(0===A.ResultCode){const t=1===A.Type?`${i.CONV_C2C}${A.To_Account}`:`${i.CONV_GROUP}${A.ToGroupid}`;e.push(t)}}),this._deleteLocalConversationList(e),e}return[]})}_deleteLocalConversationList(A){let e=!1;A.forEach(A=>{h.hasLocalConversation(A)&&(this._deleteLocalConversation(A,!1),e=!0)}),console.log(`${this._name}._deleteLocalConversationList isUpdate:${e}`),e&&h.emitConversationListUpdate()}_deleteLocalConversation(A,e=!0){const t=h.hasLocalConversation(A);console.log(`${this._name}._deleteLocalConversation conversationID:${A} has:${t}`),t&&(h.deleteLocalConversation(A),this._deleteConversationLocalMessage(A),e&&h.emitConversationListUpdate())}_hasLocalGroup(A){const{OuterConstant:{CONV_GROUP:e},appStore:{groupStore:t}}=this._core,i=A.replace(e,"");return!!t.getGroup(i)}_deleteConversationLocalMessage(A){console.log(`${this._name}._deleteConversationLocalMessage conversationID:${A}`),this._core.message.messageDataHandler.deleteConversationMessageList(A)}},v=new class{constructor(){this._name="SetConversationDraft"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"setConversationDraft",context:this})}setConversationDraft(A){return e(this,void 0,void 0,function*(){const{conversationID:e,draftText:t}=A;if(console.log(`${this._name} conversationID:${e} draftText:${t}`),!h.hasLocalConversation(e))throw new this._core.helper.ChatError({code:I.CONV_NOT_FOUND});const i=h.getLocalConversation(e);return null==i||i.setDraftText(t),h.emitConversationListUpdate(),{code:0,data:{conversation:i}}})}},w=new class{constructor(){this._name="SetC2CMessageRemindType"}init(A){this._core=A}set(t,i){return e(this,void 0,void 0,function*(){t.length>30&&(console.warn(`${this._name}.set userIDList length:${t.length} exceeds limit 30`),t.splice(30));const o=function(){const{MSG_REMIND_ACPT_AND_NOTE:e,MSG_REMIND_DISCARD:t,MSG_REMIND_ACPT_NOT_NOTE:i}=A.core.OuterConstant;return{[e]:0,[t]:1,[i]:2}}()[i],n=yield function(A,t){return e(this,void 0,void 0,function*(){const{userIDList:e,receiveMessageOption:i}=A,o={Peer_Account:e,Mute_Notifications:i};return t.common.buildAndSendPacket({servcmd:"openim.set_c2c_peer_mute_notifications",data:o})})}({userIDList:t,receiveMessageOption:o},this._core),{ErrorList:r=[]}=n||{},s=[];r.forEach(A=>{const{Peer_Account:e,ErrorCode:i}=A;s.push({userID:e,code:i});const o=t.indexOf(e);o>-1&&t.splice(o,1)});const a=[],g=[],{OuterConstant:c}=this._core;return t.forEach(A=>{g.push(`${c.CONV_C2C}${A}`),a.push({userID:A})}),h.patchMessageRemindType(g,i),{code:0,data:{successUserIDList:a,failureUserIDList:s}}})}},S=new class{constructor(){this._name="SetGroupMessageRemindType"}init(A){this._core=A}set(A,t){return e(this,void 0,void 0,function*(){const{common:{getCurrentUserID:i,isTopic:o},OuterConstant:n}=this._core;if(yield function(A,t){return e(this,void 0,void 0,function*(){const{groupID:e,userID:i,receiveMessageOption:o}=A,n={GroupId:e,Member_Account:i,MsgFlag:o};return t.common.buildAndSendPacket({servcmd:"group_open_http_svc.modify_group_member_info",data:n})})}({groupID:A,userID:i(),receiveMessageOption:t},this._core),!o(A)){const e=`${n.CONV_GROUP}${A}`;h.patchMessageRemindType([e],t)}return{code:0,data:{groupID:A,messageRemindType:t}}})}},M=new class{constructor(){this._name="SetMessageRemindType"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"setMessageRemindType",context:this})}handleC2CMessageRemindTypeSync(A){const{helper:{isEmpty:e},OuterConstant:t,ssoLog:i}=this._core;A.forEach(A=>{const{MuteNotificationsSync:o}=A;if(!e(o)){const{To_Account:A,MuteNotifications:e}=o,n=A.map(A=>`${t.CONV_C2C}${A}`),s=r(e);i.debug(`${this._name}.handleC2CMessageRemindTypeSync conversationIDList:${n} messageRemindType:${s}`),h.patchMessageRemindType(n,s)}})}setMessageRemindType(A){return e(this,void 0,void 0,function*(){const e="setMessageRemindType",{groupID:t,userIDList:i,messageRemindType:o}=A,{helper:n,utils:{isUndefined:r},ssoLog:s}=this._core;try{if(!r(t))return s.debug(`${this._name}.${e} groupID:${t} messageRemindType:${o}`),yield S.set(t,o);if(!r(i))return s.debug(`${this._name}.${e} userIDList:${i} messageRemindType:${o}`),yield w.set(i,o);throw new n.ChatError({functionName:e,message:"userIDList or groupID is required"})}catch(a){const A=new n.ChatError({functionName:e,code:null==a?void 0:a.errorCode,message:null==a?void 0:a.errorInfo});throw console.error(`${this._name}.${e} fail:`,A),A}})}},R=new class{init(A){A.ssoLog.debug("ConversationAction.init"),this._core=A,C.init(A),p.init(A),f.init(A),m.init(A),y.init(A),D.init(A),v.init(A),M.init(A);const{notificationCenter:e,InnerEvent:{MESSAGE_PUSH:t,DESTROY:i}}=this._core,{InnerEventSubType:{CONV_MODIFIED:o,C2C_MESSAGE_READ_SYNC:n,GROUP_MESSAGE_READ_SYNC:r,C2C_REMIND_TYPE_SYNC:s}}=e;e.subscribeInnerEvent(t,o,this._onConversationModified,this),e.subscribeInnerEvent(t,n,this._onC2CMessageReadSync,this),e.subscribeInnerEvent(t,s,this._onC2CMessageRemindTypeSync,this),e.subscribeInnerEvent(t,r,this._onGroupMessageReadSync,this),e.subscribeInnerEvent(i,this._dispose,this)}_onConversationModified(A){const{constants:{ConvModifyPushType:e}}=this._core,{RecentContactMod:t=[]}=A;t.forEach(A=>{const{PushType:t}=A;if(t===e.CONV_DELETED){const{RecentContactList:e}=A.RecentContactDeleteItem;D.handleConversationDeleted(e)}if(t===e.CONV_PINED){const{RecentContactList:e}=A.RecentContactTopItem;y.handleConversationPinned(e,!0)}if(t===e.CONV_UNPINED){const{RecentContactList:e}=A.RecentContactTopItem;y.handleConversationPinned(e,!1)}})}_onC2CMessageReadSync(A){const{C2cNotifyMsgArray:e=[]}=A;m.handleC2CMessageReadSync(e)}_onC2CMessageRemindTypeSync(A){const{C2cNotifyMsgArray:e=[]}=A;M.handleC2CMessageRemindTypeSync(e)}_onGroupMessageReadSync(A){const{GroupTips:e=[]}=A;m.handleGroupMessageReadSync(e)}_dispose(){const{notificationCenter:A,InnerEvent:{MESSAGE_PUSH:e,DESTROY:t}}=this._core,{InnerEventSubType:{CONV_MODIFIED:i,C2C_MESSAGE_READ_SYNC:o,GROUP_MESSAGE_READ_SYNC:n,C2C_REMIND_TYPE_SYNC:r}}=A;A.unSubscribeInnerEvent(e,i,this._onConversationModified,this),A.unSubscribeInnerEvent(e,o,this._onC2CMessageReadSync,this),A.unSubscribeInnerEvent(e,r,this._onC2CMessageRemindTypeSync,this),A.unSubscribeInnerEvent(e,n,this._onGroupMessageReadSync,this),A.unSubscribeInnerEvent(t,this._dispose,this)}},_=new class{init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"setAllReceiveMessageOpt",context:this})}setAllReceiveMessageOpt(t){return e(this,void 0,void 0,function*(){try{const{OuterConstant:{MSG_REMIND_ACPT_NOT_NOTE:i}}=this._core,{messageRemindType:o=i,isRepeated:n=!0}=t,{startTime:r=0,endTime:s=0}=this._calcStartAndEndTime(t),a=yield function(t){return e(this,void 0,void 0,function*(){const{common:e}=A.core,{startTime:i,endTime:o,isRepeated:n,messageRemindType:r}=t,s={StartTime:i,EndTime:o,IsRepeated:n,Level:r};return e.buildAndSendPacket({servcmd:"im_msg_db_logic.ws_set_do_not_disturb",data:s})})}({messageRemindType:this._getType(o),startTime:r,endTime:s,isRepeated:n?c.ON:c.OFF});return{code:0,data:{errorCode:a.ErrorCode,errorInfo:a.ErrorInfo}}}catch(u){a("setAllReceiveMessageOpt",u)}})}_calcStartAndEndTime(A){const{startHour:e=0,startMinute:t=0,startSecond:i=0,duration:o=0,isRepeated:n=!0}=A,r=new Date,s=new Date(r.getFullYear(),r.getMonth(),r.getDate(),e,t,i),a=Math.round(s.getTime()/1e3);let g=a+o;return n&&o>=86400&&(g=a+86400),{startTime:a,endTime:g}}_getType(A){const{OuterConstant:e}=this._core;return{[e.MSG_REMIND_ACPT_AND_NOTE]:0,[e.MSG_REMIND_DISCARD]:1,[e.MSG_REMIND_ACPT_NOT_NOTE]:2}[A]}},T=new class{init(A){this._core=A;const{helper:e,notificationCenter:t,InnerEvent:i}=A;e.registerApi({apiName:"getAllReceiveMessageOpt",context:this}),t.subscribeInnerEvent(i.MESSAGE_PUSH,t.InnerEventSubType.ALL_RECEIVE_MESSAGE_OPTION,this.onAllReceiveMsgOptionNotify,this)}onAllReceiveMsgOptionNotify(A){const e=this._handleResult(A),{notificationCenter:t,OuterEvent:{ALL_RECEIVE_MESSAGE_OPT_UPDATED:i}}=this._core;t.emitOuterEvent(i,{name:i,data:e})}getAllReceiveMessageOpt(){return e(this,void 0,void 0,function*(){try{const t=yield function(){return e(this,void 0,void 0,function*(){const{common:e}=A.core,t={To_Account:e.getCurrentUserID()};return e.buildAndSendPacket({servcmd:"im_msg_db_logic.ws_get_do_not_disturb",data:t})})}();return{code:0,data:this._handleResult(t)}}catch(u){a("getAllReceiveMessageOpt",u)}})}_handleResult(A){const{OuterConstant:e}=this._core,{MSG_REMIND_ACPT_AND_NOTE:t,MSG_REMIND_DISCARD:i,MSG_REMIND_ACPT_NOT_NOTE:o}=e,n={0:t,1:i,2:o},{Level:r,StartTime:s,EndTime:a,IsRepeated:g}=A;return{messageRemindType:n[r]||t,startTime:s,endTime:a,isRepeated:g===c.ON}}},N=new class{init(A){A.ssoLog.debug("ReceiveMessageOptions.init"),this._core=A,w.init(A),S.init(A),B.init(A),Q.init(A),_.init(A),T.init(A)}};const b=A=>!t(A)&&!i(A)&&!o(A),G={getConversationProfile:[{key:"conversationID",required:!0,rules:["string"],allowEmpty:!1,customValidator:A=>!b(A)||"conversationID is invalid."}],setMessageRead:{conversationID:{required:!0,rules:["string"],allowEmpty:!1,customValidator:A=>!b(A)||"conversationID is invalid."}},pinConversation:{conversationID:{required:!0,rules:["string"],allowEmpty:!1,customValidator:A=>!b(A)||"conversationID is invalid."},isPinned:{required:!0,rules:["boolean"],allowEmpty:!1}},deleteConversation:[{key:"options",required:!0,rules:["string","object"],allowEmpty:!1,customValidator:e=>{const{core:{utils:{isArray:t,isObject:i,isString:o}}}=A;if(!o(e)&&!i(e))return"options is String or Object.";if(o(e)&&b(e))return"conversationID is invalid.";if(i(e)){if(!t(e.conversationIDList))return"conversationIDList is not Array.";if(0===e.conversationIDList.length)return"conversationIDList is empty.";if(e.conversationIDList.some(A=>{if(b(A))return!0}))return"conversationIDList includes invalid conversationID.";if(e.clearHistoryMessage&&"boolean"!=typeof e.clearHistoryMessage)return"clearHistoryMessage is not Boolean."}return!0}}],setConversationDraft:{conversationID:{required:!0,rules:["string"],allowEmpty:!1,customValidator:A=>!(!t(A)&&!i(A))||"conversationID is invalid."},draftText:{required:!0,rules:["string"],allowEmpty:!0}},setAllReceiveMessageOpt:{messageRemindType:{required:!1,rules:["string"],allowEmpty:!0},startHour:{required:!1,rules:["number"],allowEmpty:!0},startMinute:{required:!1,rules:["number"],allowEmpty:!0},startSecond:{required:!1,rules:["number"],allowEmpty:!0},duration:{required:!1,rules:["number"],allowEmpty:!0},isRepeated:{required:!1,rules:["boolean"],allowEmpty:!0}}},k={getConversationList:!0,getConversationProfile:!0,getTotalUnreadCount:!0,setMessageRead:!0,pinConversation:!0,deleteConversation:!0,setConversationDraft:!0,setMessageRemindType:!0,getAllReceiveMessageOpt:!0,setAllReceiveMessageOpt:!0};return new class{constructor(){this.name="Conversation"}install(e){A.init(e),R.init(e),N.init(e),h.init(e),e.helper.registerValidateConfig({auth:k,params:G})}}}();const e_=RR(A_.exports);var t_={exports:{}};t_.exports=function(){const A=new class{init(A){this.core=A}},e="AVChatRoom",t="AV_HISTORY_MSG",i="GRP_COUNTER",o="Set",n="Increase",r="Decrease",s=0,a=1,g=2,c=["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption","LastRecallTime"],l=["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"],I=["Role","JoinTime","MsgFlag","MsgSeq"],u=["Role","JoinTime","MsgSeq","MsgFlag","NameCard"],E=0,d=1,h="notStart",C="resolved",B="rejected",Q=10018,p=11e3,f=2,m=["Owner","Admin","Member"],y=["Role","JoinTime","NameCard","ShutUpUntil","OnlineStatus"],D=0,v=1,w=2,S=4,M=1,R=2,_=3,T=4,N=5,b=1,G=0,k=4,L=6,U=400,F=300,O={from:!0,groupID:!0,groupName:!0,to:!0},x={from:!0,groupID:!0,groupName:!0,to:!0,type:!0},P=2,Y=4,J=5,H=7,q=8,V=15,j=20,K=21,W=2600,z=2602,Z=2603,X=2620,$=2621,AA=2623,eA=2660,tA=2661,iA=2681,oA=2683,nA=2684,rA=2685,sA=2687,aA=3122,gA=10018,cA=e=>e===A.core.OuterConstant.GRP_PUBLIC,lA=e=>e===A.core.OuterConstant.GRP_AVCHATROOM,IA=(e,t)=>{const{isArray:i}=A.core.utils;if(!i(e)||!i(t))return!1;let o=!1;return t.forEach(({key:A,value:t})=>{const i=e.find(e=>e.key===A);i?i.value!==t&&(i.value=t,o=!0):(e.push({key:A,value:t}),o=!0)}),o},uA=A=>{const e=[];if(!A)return e;for(let t=0,i=A.length;t{const e=[];for(let t=0,i=A.length;t0&&s.members.forEach(A=>{A.userID===this.selfInfo.userID&&r(this.selfInfo,A,["sequence"])})}updateSelfInfo(e){const{nameCard:t,joinTime:i,role:o,messageRemindType:n,readedSequence:r,excludedUnreadSequenceList:s}=e,{common:{deepMerge:a}}=A.core;a(this.selfInfo,{nameCard:t,joinTime:i,role:o,messageRemindType:n,readedSequence:r,excludedUnreadSequenceList:s},[],["",null,void 0,0,NaN])}setSelfNameCard(A){this.selfInfo.nameCard=A}}var QA=new class{constructor(){this._name="GroupDataHandler"}init(A){this._core=A;const{appStore:{groupStore:e}}=A;this._groupMap=e.getGroupMap()}hasLocalGroup(A){return this._groupMap.has(A)}getLocalGroup(A){return this._groupMap.get(A)}updateLocalGroup(A){const{common:{getCurrentUserID:e}}=this._core;let t;A.forEach(A=>{var e;t=A.groupID,this.hasLocalGroup(t)?null===(e=this.getLocalGroup(t))||void 0===e||e.updateGroup(A):this._groupMap.set(t,new BA(A))});const i=e();for(const[,o]of this._groupMap)o.selfInfo.userID=i,"Owner"===o.selfInfo.role&&(o.ownerID=i)}deleteLocalGroup(A){this._groupMap.delete(A)}getLocalGroupList(){const{OuterConstant:{GRP_ROOM:A,GRP_LIVE:e}}=this._core;return[...this._groupMap.values()].filter(t=>{const{type:i}=t;return i!==A&&i!==e})}clearLocalGroup(){this._groupMap.clear()}emitGroupListUpdate(){const A=this.getLocalGroupList(),{OuterEvent:{GROUP_LIST_UPDATED:e},notificationCenter:t}=this._core;t.emitOuterEvent(e,{name:e,data:A})}updateConversationGroupProfile(A){const{appStore:{conversationStore:e},OuterConstant:{CONV_GROUP:t}}=this._core,i=`${t}${A}`;if(e.getConversation(i)){const t=this.getLocalGroup(A);e.updateConversation(i,{groupProfile:t})}}reset(){this.clearLocalGroup()}};function pA(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(A);o {const A=QA.getLocalGroupList();return yA({groupList:A,isSyncCompleted:this._isSyncCompleted()})}).catch(A=>{throw A});const e=QA.getLocalGroupList();return yA({groupList:e,isSyncCompleted:this._isSyncCompleted()},{message:`return group count:${e.length}`})})}_syncGroupList(){return fA(this,void 0,void 0,function*(){this._pagingStatus===h&&QA.clearLocalGroup();const A=this.PAGING_GRP_COUNT_LIMIT,e=[];try{yield this._pagingGetGroupList({limit:A,offset:0,groupList:e}),this._pagingStatus=C,this._groupListTreeShaking(e),QA.updateLocalGroup(e);const t=QA.getLocalGroupList();return this._core.ssoLog.debug("_syncGroupList",`${this._name}._syncGroupList ok, count:${t.length}`),QA.emitGroupListUpdate(),t}catch(t){throw this._pagingStatus=B,t}})}_pagingGetGroupList(A){return fA(this,void 0,void 0,function*(){const{ssoLog:e}=this._core,{isCommunityRelay:t=!1,groupList:i}=A;let o,{limit:n,offset:r}=A;const s=[...c];t&&(o=this._core.OuterConstant.GRP_COMMUNITY,s.push("AtInfoList"));try{const A=yield mA({type:o,limit:n,offset:r,memberAccount:this._core.store.get("login").userId,responseFilter:{GroupBaseInfoFilter:s,SelfInfoFilter:[...I]}},this._core),{GroupIdList:a=[],TotalCount:g=0}=A||{},c=this._convertGroupKey(a);i.push(...c);const l=r+n,u=!(g>l),E=`offset:${r} limit:${n} total:${g} isCompleted:${u} current:${i.length} isCommunityRelay:${t}`;return e.debug("_pagingGetGroupList",`${this._name}._pagingGetGroupList ok. ${E}`),t?u?i:(r=l,this._pagingGetGroupList({isCommunityRelay:!0,limit:n,offset:r,groupList:i})):u?(e.debug("_pagingGetGroupList",`${this._name}._pagingGetGroupList start to get community list`),r=0,this._pagingGetGroupList({isCommunityRelay:!0,limit:n,offset:r,groupList:i})):(r=l,this._pagingGetGroupList({limit:n,offset:r,groupList:i}))}catch(a){if(a.ErrorCode===Q)return e.warn("_pagingGetGroupList",`${this._name}._pagingGetGroupList response size exceeds the limit, request count:${n}`),n=50,this._pagingGetGroupList({isCommunityRelay:t,limit:n,offset:r,groupList:i});if(t)return a.code===p&&e.debug("_pagingGetGroupList",`${this._name}._pagingGetGroupList ok. community unavailable`),i;throw a}})}_pagingGetJoinedCommunityList(A){return fA(this,void 0,void 0,function*(){const{common:{getCurrentUserID:e},OuterConstant:t,ssoLog:i}=this._core,{groupList:o}=A;let{limit:n,offset:r}=A;try{const A=yield mA({limit:n,offset:r,type:t.GRP_COMMUNITY,memberAccount:e(),supportTopic:1,responseFilter:{GroupBaseInfoFilter:[...c],SelfInfoFilter:[...I]}},this._core),{GroupIdList:s=[],TotalCount:a=0}=A||{},g=this._convertGroupKey(s);o.push(...g);const l=r+n,u=!(a>l),E=`offset:${r} limit:${n} total:${a} isCompleted:${u} current:${o.length}`;return i.debug("_pagingGetJoinedCommunityList",`${this._name}._pagingGetJoinedCommunityList ok. ${E}`),u?o:(r=l,this._pagingGetJoinedCommunityList({limit:n,offset:r,groupList:o}))}catch(s){if(s.code===gA)return i.warn("_pagingGetJoinedCommunityList",`${this._name}._pagingGetJoinedCommunityList response size exceeds the limit, request count:${n}`),n=50,this._pagingGetJoinedCommunityList({limit:n,offset:r,groupList:o});throw s}})}_groupListTreeShaking(A){const e=new Map([...QA.getLocalGroupList()]);for(let i=0,o=A.length;i {const{AtFlagList:i,AtMsgSeq:o,From_Account:n}=e;t.push({groupID:A,groupAtType:i,sequence:o,from:n})}),t}},vA=new class{constructor(){this._name="CreateGroup"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"createGroup",context:this})}createGroup(A){return fA(this,void 0,void 0,function*(){var e;this._preCheckParams(A);const{helper:{ChatError:t}}=this._core;try{const{utils:{isEmpty:t},common:{getCurrentUserID:i}}=this._core,o=yield function(A,e){return fA(this,void 0,void 0,function*(){const{name:t,type:i,groupID:o,introduction:n,notification:r,avatar:s,maxMemberNum:a,joinOption:g,inviteOption:c,memberList:l,groupCustomField:I,isSupportTopic:u}=A;let E;l&&(E=l.map(A=>{const{userID:e,memberCustomField:t}=A;return{Member_Account:e,AppMemberDefinedData:t?EA(t):void 0}}));const d={Name:t,Type:i,GroupId:o,Introduction:n,Notification:r,FaceUrl:s,MaxMemberCount:a,ApplyJoinOption:g,InviteJoinOption:c,MemberList:E,AppDefinedData:I,SupportTopic:u,webPushFlag:1};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.create_group",data:d})})}(Object.assign(Object.assign({},A),{ownerID:i()}),this._core),{GroupId:n,OverJoinedGroupLimit_Account:r=[]}=o||{},s=`${this._name}.createGroup ok, type:${A.type} groupID:${n} overLimitUserIDList:${r}`;t(A.memberList)||t(r)||(A.memberList=null===(e=A.memberList)||void 0===e?void 0:e.filter(A=>r.includes(A.userID))),QA.updateLocalGroup([Object.assign(Object.assign({},A),{groupID:n})]);const a=QA.getLocalGroup(n);return this._notNeedSendCustomMessage(A)||(this._sendCustomMessage(n,A.type),QA.emitGroupListUpdate()),yA({group:a},{message:s})}catch(i){const{errorCode:e,errorInfo:o}=i;throw new t({functionName:"createGroup",code:e,message:o,moreMessage:` groupID:${A.groupID}`})}})}_preCheckParams(e){const{type:t,groupID:i}=e,{utils:{isEmpty:o,isUndefined:n},common:{isCommunity:r}}=this._core,s=!o(i);if(!(()=>{const{GRP_PUBLIC:e,GRP_WORK:t,GRP_MEETING:i,GRP_AVCHATROOM:o,GRP_COMMUNITY:n}=A.core.OuterConstant;return[e,t,i,o,n]})().includes(t))throw new this._core.helper.ChatError({code:W});if(!r({type:t})){if(s&&r({groupID:i}))throw new this._core.helper.ChatError({code:z});n(e.isSupportTopic)||(e.isSupportTopic=void 0)}if(this._canIUseMemberList(t)||n(e.memberList)||(e.memberList=void 0),this._canIUseJoinOption(t)||n(e.joinOption)||(e.joinOption=void 0),r({type:t})){if(s&&!r({groupID:i}))throw new this._core.helper.ChatError({code:z});e.isSupportTopic=this._canIUseTopic(e)?1:0}}_canIUseMemberList(A){return!lA(A)}_canIUseJoinOption(A){return cA(A)||this._core.common.isCommunity({type:A})}_canIUseTopic(A){const{isSupportTopic:e}=A;return!0===e}_notNeedSendCustomMessage(A){const{type:e,isSupportTopic:t}=A,{OuterConstant:{GRP_AVCHATROOM:i,GRP_COMMUNITY:o}}=this._core;return e===i||e===o&&1===t}_sendCustomMessage(A,e){var t,i,o,n,r,s;const{OuterConstant:a}=this._core;let g="Create Group",c=E;e===a.GRP_COMMUNITY&&(g="Create Community",c=d);const l={to:A,conversationType:"GROUP",payload:{data:JSON.stringify({businessID:"group_create",content:g,cmd:c,opUser:this._core.store.get("login").userId,version:4})}},I=null===(o=null===(i=null===(t=this._core)||void 0===t?void 0:t.message)||void 0===i?void 0:i.messageFactory)||void 0===o?void 0:o.createCustomMessage(l);null===(s=null===(r=null===(n=this._core)||void 0===n?void 0:n.message)||void 0===r?void 0:r.messageSender)||void 0===s||s.sendMessage(I,{})}},wA=new class{constructor(){this._name="AttributesDataHandler",this._groupAttributesCache=new Map,this._groupAttributesCacheValuesCopy={}}init(A){this._core=A;const{helper:e,constants:t}=A;e.registerWorkflowStep(t.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_RE_ONLINE,t.WORKFLOW_STEP.GROUP_ATTRIBUTE_CACHE_CLEAR,this.clearLocalMainSequence,this)}clearLocalMainSequence(){this._groupAttributesCache.forEach(A=>{A.localMainSequence=0})}isGroupAttributesUpdated(A){const{elements:{newGroupProfile:e}}=A,{utils:{isEmpty:t,isUndefined:i}}=this._core;return!i(e)&&!t(e.groupAttributeOption)}handleGroupAttributesUpdated(A){const{groupID:e,groupAttributeOption:t}=A,{serverMainSequence:i,groupAttributeList:o=[],operation:n}=t;this._core.ssoLog.debug("handleGroupAttributesUpdated",`${this._name}.handleGroupAttributesUpdated groupID:${e} operation:${n}`);const{utils:{isUndefined:r}}=this._core;r(n)||(this.refreshGroupAttributesCache({groupID:e,serverMainSequence:i,groupAttributeList:o,operation:n}),this.emitGroupAttributesUpdated(e))}initGroupAttributesCache(A){const{groupID:e,avChatRoomKey:t}=A;this._groupAttributesCache.set(e,{lastUpdateTime:0,localMainSequence:0,serverMainSequence:0,avChatRoomKey:t,values:new Map}),this._core.ssoLog.debug("initGroupAttributesCache",`${this._name}.initGroupAttributesCache. groupID:${e} avChatRoomKey:${t}`)}hasGroupAttributesCache(A){return this._groupAttributesCache.has(A)}getGroupAttributesCache(A){return this.hasGroupAttributesCache(A)||this.initGroupAttributesCache({groupID:A}),this._groupAttributesCache.get(A)}deleteGroupAttributesCache(A){this.hasGroupAttributesCache(A)&&this._groupAttributesCache.delete(A)}refreshGroupAttributesCache(A){const{groupID:e,serverMainSequence:t,groupAttributeList:i,operation:o}=A;if(this.hasGroupAttributesCache(e)){const A=this.getGroupAttributesCache(e),{localMainSequence:n}=A;o!==N&&t-n!=1||(A.serverMainSequence=t,A.localMainSequence=t,A.lastUpdateTime=Date.now(),this._updateGroupAttributesCacheValues({groupAttributes:A,groupAttributeList:i,operation:o})),t-n>1&&(A.serverMainSequence=t),this._groupAttributesCache.set(e,A),this._core.ssoLog.debug("refreshGroupAttributesCache",`${this._name}.refreshGroupAttributesCache. operation:${o} localMainSequence:${n} serverMainSequence:${t}`)}}_updateGroupAttributesCacheValues(A){const{groupAttributes:e,groupAttributeList:t=[],operation:i}=A;i!==_?i!==T?(i===M&&e.values.clear(),t.forEach(A=>{const{key:t,value:i,sequence:o}=A;e.values.set(t,{value:i,sequence:o})})):t.forEach(A=>{e.values.delete(A.key)}):e.values.clear()}getGroupAttributesCacheValues(A){var e;const{groupID:t,keyList:i=[]}=A,o={};if(this.hasGroupAttributesCache(t)){const{values:A}=this.getGroupAttributesCache(t);if(0===i.length){for(const t of A.keys())o[t]=(null===(e=A.get(t))||void 0===e?void 0:e.value)||"";return o}return i.forEach(e=>{var t;A.has(e)&&(o[e]=(null===(t=A.get(e))||void 0===t?void 0:t.value)||"")}),o}return o}saveGroupAttributesCacheValuesCopy(A){this._groupAttributesCacheValuesCopy=this.getGroupAttributesCacheValues({groupID:A})}emitGroupAttributesUpdated(A){var e;const t=this.getGroupAttributesCacheValues({groupID:A}),{updatedKeyList:i,deletedKeyList:o}=this._computeValuesChangedData(t);this._core.ssoLog.debug("emitGroupAttributesUpdated",`${this._name}.emitGroupAttributesUpdated update count:${i.length}, delete count:${o.length}`),0===i.length&&0===o.length||this._emitEvent({name:null===(e=this._core)||void 0===e?void 0:e.OuterEvent.GROUP_ATTRIBUTES_UPDATED,data:{groupID:A,groupAttributes:t,updatedKeyList:i,deletedKeyList:o}})}_computeValuesChangedData(A){const{utils:{isUndefined:e}}=this._core,t=[],i=[];return Object.keys(A).forEach(e=>{A[e]!==this._groupAttributesCacheValuesCopy[e]&&t.push(e)}),Object.keys(this._groupAttributesCacheValuesCopy).forEach(t=>{e(A[t])&&i.push(t)}),this._groupAttributesCacheValuesCopy={},{updatedKeyList:t,deletedKeyList:i}}_emitEvent(A){var e;null===(e=this._core)||void 0===e||e.notificationCenter.emitOuterEvent(A.name,A)}convertKeyValueMapToList(A){const e=[];return Object.keys(A).forEach(t=>{e.push({key:t,value:A[t]})}),e}reset(){this._groupAttributesCache.clear(),this._groupAttributesCacheValuesCopy={}}},SA=new class{constructor(){this._name="DismissGroup"}init(A,t){this._core=A;const{helper:i}=A;i.registerApi({apiName:"dismissGroup",context:this,matcher:()=>!t.getInstalledSubPlugins().includes(e)})}dismissGroup(A){return fA(this,void 0,void 0,function*(){const{helper:{ChatError:e}}=this._core;try{yield function(A,e){return fA(this,void 0,void 0,function*(){const t={GroupId:A};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.destroy_group",data:t})})}(A,this._core);const{type:e}=QA.getLocalGroup(A);return QA.deleteLocalGroup(A),QA.emitGroupListUpdate(),wA.deleteGroupAttributesCache(A),yA({groupID:A,type:e},{message:A})}catch(t){const{errorCode:A,errorInfo:i}=t;throw new e({functionName:"dismissGroup",code:A,message:i})}})}},MA=new class{constructor(){this._name="GetGroupProfile"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"getGroupProfile",context:this})}getGroupProfile(A){return fA(this,void 0,void 0,function*(){const{groupID:e,groupCustomFieldFilter:t}=A,i={groupIDList:[e],responseFilter:{GroupBaseInfoFilter:[...c],AppDefinedDataFilter_Group:t,MemberInfoFilter:[...u]}},{helper:{ChatError:o}}=this._core;try{const A=yield this.getGroupProfileAdvance(i),{successGroupList:t,failureGroupList:o}=A;if(o.length>0)throw o[0];let n;return!QA.hasLocalGroup(e)&&lA(t[0].type)?n=new BA(t[0]):(QA.updateLocalGroup(t),n=QA.getLocalGroup(e)),n.isSupportTopic||QA.updateConversationGroupProfile(e),yA({group:n},{message:`groupID:${e}`})}catch(n){const{code:A,message:e}=n;throw new o({functionName:"getGroupProfile",code:A,message:e})}})}getGroupProfileAdvance(A){return fA(this,void 0,void 0,function*(){const{groupIDList:e}=A,{common:{isCommunity:t}}=this._core,i=e.filter(A=>!t({groupID:A})),o=e.filter(A=>t({groupID:A}));i.length>50&&(i.length=50),o.length>50&&(o.length=50);const n=yield Promise.all([this._getGroupProfileAdvance(Object.assign(Object.assign({},A),{groupIDList:i})),this._getGroupProfileAdvance(Object.assign(Object.assign({},A),{groupIDList:o,isCommunityProfile:!0}))]),r=[],s=[];return n.forEach(A=>{r.push(...A.successGroupList),s.push(...A.failureGroupList)}),{successGroupList:r,failureGroupList:s}})}_getGroupProfileAdvance(A){return fA(this,void 0,void 0,function*(){const{ssoLog:e,utils:{isUndefined:t}}=this._core,{isCommunityProfile:i=!1}=A,o=pA(A,["isCommunityProfile"]);if(0===o.groupIDList.length)return{successGroupList:[],failureGroupList:[]};try{const A=yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupIDList:t,responseFilter:i}=A,o={GroupIdList:t,ResponseFilter:i};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_self_member_info",data:o})})}(o,this._core),{GroupInfo:i=[]}=A||{},n=this._convertGroupProfileKey(i),r=n.filter(A=>t(A.errorCode)||0===A.errorCode),s=n.filter(A=>A.errorCode&&0!==A.errorCode).map(A=>({code:A.errorCode,message:A.errorInfo,data:{groupID:A.groupID}}));return e.debug("_getGroupProfileAdvance",`${this._name}._getGroupProfileAdvance ok, groupID:${o.groupIDList.join(",")}`),{successGroupList:r,failureGroupList:s}}catch(n){if(i)return{successGroupList:[],failureGroupList:[]};throw n}})}_convertGroupProfileKey(A){const e=[];for(let t=0,i=A.length;t0&&i {const{Key:t,Value:i=0}=e;A.set(t,i)}),this._groupCountersMap.set(e,{lastUpdateTime:Date.now(),groupCounterSeq:i,counters:A,avChatRoomKey:o})}}initGroupCountersCache(A){const{groupID:e,avChatRoomKey:t}=A;this._groupCountersMap.set(e,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:t})}getLocalCounters(A,e){const t={};if(!this._hasLocalGroupCounters(A))return t;const{counters:i}=this.getLocalGroupCounters(A);if(e.length>0)e.forEach(A=>{i.has(A)&&(t[A]=i.get(A))});else for(const o of i.keys())t[o]=i.get(o);return t}deleteLocalGroupCounters(A){const{groupID:e,counterList:t=[],groupCounterSeq:i}=A;if(this._hasLocalGroupCounters(e)){const{counters:A,avChatRoomKey:o}=this.getLocalGroupCounters(e);t.forEach(e=>{A.delete(e.key)}),this._groupCountersMap.set(e,{lastUpdateTime:Date.now(),groupCounterSeq:i,counters:A,avChatRoomKey:o})}}setGroupCounters(A,e){if(!this._hasLocalGroupCounters(A))return;const t=this.getLocalGroupCounters(A),{counters:i}=t;let o=!1;Object.entries(e).forEach(([A,e])=>{i.has(A)&&i.get(A)!==e&&(i.set(A,e),o=!0)}),o&&this._groupCountersMap.set(A,Object.assign(Object.assign({},t),{lastUpdateTime:Date.now(),counters:i}))}_hasLocalGroupCounters(A){return this._groupCountersMap.has(A)}reset(){this._groupCountersMap.clear()}},_A=new class{constructor(){this._name="JoinGroup"}init(A,t){this._core=A;const{helper:i}=A;i.registerApi({apiName:"joinGroup",context:this,matcher:()=>!t.getInstalledSubPlugins().includes(e)})}joinGroup(A){return fA(this,void 0,void 0,function*(){const{groupID:e}=A,{helper:{ChatError:t},OuterConstant:i,ssoLog:o}=this._core;try{if(QA.hasLocalGroup(e))try{return yield MA.getGroupProfile({groupID:e}),yA({status:i.JOIN_STATUS_ALREADY_IN_GROUP,group:QA.getLocalGroup(e)},{message:`groupID:${e} joinedStatus:${i.JOIN_STATUS_ALREADY_IN_GROUP}`})}catch(n){return o.warn("joinGroup",`${this._name}.joinGroup ${e} was unjoined, start to join!`),QA.deleteLocalGroup(e),yield this._applyJoinGroup(A)}return yield this._applyJoinGroup(A)}catch(r){const{errorCode:A,errorInfo:i}=r;throw new t({functionName:"joinGroup",code:A,message:i,moreMessage:`groupID:${e}`})}})}_applyJoinGroup(A){return fA(this,void 0,void 0,function*(){const{OuterConstant:e,helper:i,ssoLog:o}=this._core,{groupID:n}=A,r=Object.assign({},A),s=i.checkBusinessCapabilityBits(t);s&&(r.historyMessageFlag=1);const a=yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,applyMessage:i,historyMessageFlag:o}=A,n={GroupId:t,ApplyMsg:i,HugeGroupHistoryMsgFlag:o};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.apply_join_group",data:n})})}(r,this._core),{Type:g,JoinedStatus:c,LongPollingKey:l,StartSeq:I,HugeGroupFlag:u,AVChatRoomKey:E,RspMsgList:d=[]}=a||{},h=`groupID:${n} joinedStatus:${c} longPollingKey:${l} startSeq:${I} avChatRoomFlag:${u} canGetAVChatRoomHistoryMsg:${s}, historyMessageCount:${d.length}`;o.debug("_applyJoinGroup",`${this._name}._applyJoinGroup ok, ${h}`);let C=new BA({groupID:n,type:g});if(c===e.JOIN_STATUS_WAIT_APPROVAL)return yA({status:e.JOIN_STATUS_WAIT_APPROVAL,group:C});if(c===e.JOIN_STATUS_SUCCESS){try{C=(yield MA.getGroupProfile({groupID:n})).data.group}catch(B){o.warn("_applyJoinGroup",`${this._name}._applyJoinGroup getGroupProfile failed, groupID: ${n}, errorCode:${null==B?void 0:B.code}`)}return this._handleJoinResult({group:C,avChatRoomFlag:u,longPollingKey:l,startSequence:I,avChatRoomKey:E,historyMessageList:d})}throw new this._core.helper.ChatError({code:eA})})}_handleJoinResult(A){const{group:e,avChatRoomFlag:t,avChatRoomKey:i}=A;return 1===t?(wA.initGroupAttributesCache({groupID:e.groupID,avChatRoomKey:i}),RA.initGroupCountersCache({groupID:e.groupID,avChatRoomKey:i}),yA(A)):(QA.updateLocalGroup([e]),QA.emitGroupListUpdate(),yA({status:this._core.OuterConstant.JOIN_STATUS_SUCCESS,group:e},{message:`groupID:${e.groupID}`}))}},TA=new class{constructor(){this._name="QuitGroup"}init(A,t){this._core=A;const{helper:i}=A;i.registerApi({apiName:"quitGroup",context:this,matcher:()=>!t.getInstalledSubPlugins().includes(e)})}quitGroup(A){return fA(this,void 0,void 0,function*(){if(!QA.hasLocalGroup(A))throw new this._core.helper.ChatError({code:AA});const{helper:{ChatError:e}}=this._core;try{yield function(A,e){return fA(this,void 0,void 0,function*(){const t={GroupId:A};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.quit_group",data:t})})}(A,this._core);const{type:e}=QA.getLocalGroup(A);return QA.deleteLocalGroup(A),QA.emitGroupListUpdate(),wA.deleteGroupAttributesCache(A),yA({groupID:A,type:e},{message:`groupID:${A}`})}catch(t){const{errorCode:i,errorInfo:o}=t;throw new e({functionName:"quitGroup",code:i,message:o,moreMessage:`groupID:${A}`})}})}},NA=new class{constructor(){this._name="SearchGroup"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"searchGroupByID",context:this})}searchGroupByID(A){return fA(this,void 0,void 0,function*(){try{const e=yield function(A,e){return fA(this,void 0,void 0,function*(){const t={GroupIdList:[A],GroupBasePublicInfoFilter:[...l]};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_public_info",data:t})})}(A,this._core),{GroupInfo:t=[]}=e||{},{AppDefinedData:i=[],ApplyJoinOption:o,CreateTime:n,FaceUrl:r,Introduction:s,InviteJoinOption:a,MaxMemberNum:g,MemberNum:c,Name:I,Owner_Account:u,Type:E,ErrorCode:d,ErrorInfo:h}=t[0];if(0!==d)throw new this._core.helper.ChatError({code:d,message:h});const C=uA(i),B=new BA({groupID:A,name:I,avatar:r,introduction:s,joinOption:o,inviteOption:a,maxMemberCount:g,memberCount:c,type:E,ownerID:u,createTime:n,groupCustomField:C});return yA({group:B})}catch(e){const{errorCode:A,errorInfo:t}=e;throw new this._core.helper.ChatError({functionName:"searchGroupByID",code:A,message:t})}})}},bA=new class{constructor(){this._name="UpdateGroupProfile"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"updateGroupProfile",context:this})}updateGroupProfile(A){return fA(this,void 0,void 0,function*(){const{groupID:e}=A,{utils:{isUndefined:t},ssoLog:i,helper:o}=this._core;let n=QA.getLocalGroup(e);if(n){const{type:o}=n;this._canIUseJoinOption(o)||t(A.joinOption)||(i.warn("updateGroupProfile",`${this._name}.updateGroupProfile groupID:${e} joinOption is unavailable for Work/Meeting/AVChatRoom`),A.joinOption=void 0)}t(A.muteAllMembers)||(A.muteAllMembers=!0===A.muteAllMembers?"On":"Off");try{return yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,name:i,avatar:o,introduction:n,notification:r,muteAllMembers:s,joinOption:a,inviteOption:g,groupCustomField:c}=A,l={GroupId:t,Name:i,FaceUrl:o,Introduction:n,Notification:r,ShutUpAllMember:s,ApplyJoinOption:a,InviteJoinOption:g,AppDefinedData:c?EA(c):void 0};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.modify_group_base_info",data:l})})}(A,this._core),n?(n.updateGroup(A),QA.emitGroupListUpdate()):n=new BA(A),yA({group:n},{message:`groupID:${e}`})}catch(r){const{errorCode:A,errorInfo:t}=r;throw new o.ChatError({code:A,message:t,moreMessage:`groupID:${e}`})}})}_canIUseJoinOption(A){return cA(A)||this._core.common.isCommunity({type:A})}},GA=new class{constructor(){this._name="ChangeGroupOwner"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"changeGroupOwner",context:this})}changeGroupOwner(A){return fA(this,void 0,void 0,function*(){const e="changeGroupOwner",{groupID:t,newOwnerID:i}=A,o=QA.getLocalGroup(t),{helper:n,OuterConstant:r,common:{getCurrentUserID:s}}=this._core;if((null==o?void 0:o.type)===r.GRP_AVCHATROOM)throw new n.ChatError({functionName:e,code:X});if(i===s())throw new n.ChatError({functionName:e,code:$});try{return yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,newOwnerID:i}=A,o={GroupId:t,NewOwner_Account:i};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.change_group_owner",data:o})})}(A,this._core),o.ownerID=i,QA.emitGroupListUpdate(),yA({group:o})}catch(a){throw new n.ChatError({functionName:e,code:null==a?void 0:a.errorCode,message:null==a?void 0:a.errorInfo})}})}},kA=new class{constructor(){this._name="GetGroupOnlineMemberCount",this._onlineMemberCountMap=new Map}init(A,t){this._core=A;const{helper:i}=A;i.registerApi({apiName:"getGroupOnlineMemberCount",context:this,matcher:()=>!t.getInstalledSubPlugins().includes(e)})}getGroupOnlineMemberCount(A){return fA(this,void 0,void 0,function*(){const e="getGroupOnlineMemberCount";if(!QA.hasLocalGroup(A))return yA({memberCount:0});const t=Date.now();if(this._onlineMemberCountMap.has(A)){const e=this._onlineMemberCountMap.get(A),{lastReqTime:i=0,memberCount:o=0}=e||{};if(t-i<=6e4)return yA({memberCount:o})}try{const t=yield function(A,e){return fA(this,void 0,void 0,function*(){const t={GroupId:A};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_online_member_num",data:t})})}(A,this._core),{OnlineMemberNum:i=0}=t||{};this._onlineMemberCountMap.set(A,{lastReqTime:Date.now(),memberCount:i});const o=`${this._name}.${e} ok. groupID:${A} memberCount:${i}`;return yA({memberCount:i},{message:o})}catch(i){throw new this._core.helper.ChatError({functionName:e,code:null==i?void 0:i.errorCode,message:null==i?void 0:i.errorInfo})}})}},LA=new class{init(A,e){A.ssoLog.debug("GroupAction.init"),DA.init(A),vA.init(A),SA.init(A,e),_A.init(A,e),TA.init(A,e),NA.init(A),MA.init(A),bA.init(A),GA.init(A),kA.init(A,e)}dismissGroup(A){return SA.dismissGroup(A)}joinGroup(A){return _A.joinGroup(A)}quitGroup(A){return TA.quitGroup(A)}getGroupOnlineMemberCount(A){return kA.getGroupOnlineMemberCount(A)}},UA=new class{constructor(){this._name="GetGroupApplicationList"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"getGroupApplicationList",context:this})}getGroupApplicationList(){return fA(this,void 0,void 0,function*(){const A="getGroupApplicationList";try{const e=yield Promise.all([this._getGroupApplicationList(),this._getGroupApplicationList({type:this._core.OuterConstant.GRP_COMMUNITY})]);this._core.ssoLog.debug("getGroupApplicationList",`${this._name}.${A} ok.`);const t=this._handleGroupApplicationResult([...e[0],...e[1]]);return yA({applicationList:t})}catch(e){throw new this._core.helper.ChatError({functionName:A,code:null==e?void 0:e.errorCode,message:null==e?void 0:e.errorInfo})}})}_getGroupApplicationList(A){return fA(this,void 0,void 0,function*(){const{type:e,startTime:t=0,limit:i=20}=A||{},{common:o}=this._core;let n;try{n=yield function(A,e){return fA(this,void 0,void 0,function*(){const{type:t,startTime:i,limit:o,handleAccount:n}=A,r={Type:t,StartTime:i,Limit:o,Handle_Account:n};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_pendency",data:r})})}({type:e,startTime:t,limit:i,handleAccount:o.getCurrentUserID()},this._core)}catch(g){if(11e3!==(null==g?void 0:g.errorCode))throw g;n={}}const{NextStartTime:r=0,PendencyList:s=[]}=n||{};if(0===r)return s;const a=yield this._getGroupApplicationList(Object.assign(Object.assign({},A),{startTime:r}));return[...s,...a]})}_handleGroupApplicationResult(A){const e=[];return A.forEach(A=>{const t=this._convertApplicationData(A),{handled:i}=t,o=pA(t,["handled"]);0===i&&e.push(o)}),e}_convertApplicationData(A){const{Handled:e,AddTime:t,ApplyInviteMsg:i,Authentication:o,FromUserNickName:n,From_Account:r,GroupId:s,GroupName:a,PendencyType:g,To_Account:c}=A;return{handled:e,messageKey:t,applicant:r,applicantNick:n,groupID:s,groupName:a,authentication:o,applicationType:g,userID:c,note:i}}},FA=new class{constructor(){this._name="HandleGroupApplication"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"handleGroupApplication",context:this})}handleGroupApplication(A){return fA(this,void 0,void 0,function*(){const{application:e}=A,t=this._handleParams(A);try{(null==e?void 0:e.applicationType)===f?yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,handleAction:i,handleMessage:o,applicant:n,authentication:r,invitee:s}=A,a={GroupId:t,HandleMsg:i,ApprovalMsg:o,Applicant_Account:n,Authentication:r,Invited_Account:s};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.handle_invite_join_permission_group",data:a})})}(t,this._core):yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,handleAction:i,handleMessage:o,applicant:n,authentication:r,messageKey:s}=A,a={GroupId:t,HandleMsg:i,ApprovalMsg:o,Applicant_Account:n,Authentication:r,MsgKey:s};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.handle_apply_join_group",data:a})})}(t,this._core);const A=QA.getLocalGroup(t.groupID);return yA({group:A})}catch(i){throw new this._core.helper.ChatError({functionName:"handleGroupApplication",code:null==i?void 0:i.errorCode,message:null==i?void 0:i.errorInfo})}})}_handleParams(A){var e;const{handleAction:t,handleMessage:i,message:o,application:n}=A;let r,s,a,g,c;if(o){const{payload:A}=o||{};r=A.operatorID,s=null===(e=A.groupProfile)||void 0===e?void 0:e.groupID,a=A.authentication,g=A.messageKey}else r=(null==n?void 0:n.applicant)||"",s=(null==n?void 0:n.groupID)||"",a=(null==n?void 0:n.authentication)||"",g=(null==n?void 0:n.messageKey)||0;return(null==n?void 0:n.applicationType)===f&&(c=n.userID),{handleAction:t,handleMessage:i,applicant:r,invitee:c,groupID:s,authentication:a,messageKey:g}}},OA=new class{init(A){A.ssoLog.debug("GroupApplication.init"),UA.init(A),FA.init(A)}};let xA=class{constructor(A){this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this.isOnline=!1,this.updateMember(A)}updateMember(e){const{core:{utils:{isUndefined:t},common:{deepMerge:i}}}=A;t(e.muteTime)||(this.muteUntil=Math.floor((Date.now()+1e3*e.muteTime)/1e3)),t(e.onlineStatus)||(this.isOnline="Online"===e.onlineStatus);const o=[null,void 0,"",0,NaN];e.memberCustomField&&IA(this.memberCustomField,e.memberCustomField),i(this,e,["memberCustomField","marks","onlineStatus","muteTime"],o)}};function PA(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,userID:i,muteTime:o,role:n,nameCard:r,memberCustomField:s}=A;let a;s&&(a=EA(s));const g={GroupId:t,Member_Account:i,ShutUpTime:o,Role:n,NameCard:r,AppMemberDefinedData:a};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.modify_group_member_info",data:g})})}var YA=new class{constructor(){this._name="GetGroupMemberList"}init(A,t){this._core=A;const{helper:i}=A;i.registerApi({apiName:"getGroupMemberList",context:this,matcher:()=>!t.getInstalledSubPlugins().includes(e)})}getGroupMemberList(A){return fA(this,void 0,void 0,function*(){const e="getGroupMemberList",{groupID:t,offset:i=0,count:o=100,role:n="",filter:r=""}=A,s=QA.getLocalGroup(t),a=o>100?100:o,g={groupID:t,offset:i,limit:a,memberRoleFilter:m.includes(n)?[n]:void 0,memberInfoFilter:y};try{const A=yield function(A,e){return fA(this,void 0,void 0,function*(){const{isCommunity:t}=e.common,{groupID:i,offset:o,limit:n,memberRoleFilter:r,memberInfoFilter:s}=A,a={GroupId:i,Limit:n,MemberRoleFilter:r,MemberInfoFilter:s};return t({groupID:i})?a.Next=String(o):a.Offset=o,e.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_member_info",data:a})})}(g,this._core),{MemberList:o,MemberNum:n,Next:r}=A||{},c=`${this._name}.${e} ok, totalMemberCount:${n} next:${r}`,{utils:{isArray:l,isEmpty:I},common:{isCommunity:u}}=this._core;if(s&&(s.memberCount=n),!l(o)||0===o.length)return yA({memberList:[],offset:0},{message:c});let E=i+a;u({groupID:t})&&(E=I(r)?0:r),o.lengthA.userID),i=yield null===(e=this._core.user.userProfile)||void 0===e?void 0:e.getUserProfile({userIDList:t}),o=(null==i?void 0:i.data)||[],n=new Map(o.map(A=>[A.userID,A]));return A.forEach(A=>{if(n.has(A.userID)){const{nick:e="",avatar:t=""}=n.get(A.userID);A.nick=e,A.avatar=t}}),A})}_generateGroupMember(A){const e=[];for(let t=0,i=A.length;t50&&(a.warn("getGroupMemberProfile",`${this._name}.${e} userIDList length:${i.length} exceeds limit 50`),i.splice(50));const g=`userIDList length:${i.length} groupID:${t}`;try{const A=yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,userIDList:i,memberInfoFilter:o,memberCustomFieldFilter:n}=A,r={GroupId:t,Member_List_Account:i,MemberInfoFilter:o,AppDefinedDataFilter_GroupMember:n};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_specified_group_member_info",data:r})})}({groupID:t,userIDList:i,memberCustomFieldFilter:o,memberInfoFilter:[...y]},this._core),{MemberList:e}=A||{};if(!s(e)||0===e.length)return yA({memberList:[]});let n=this._convertMemberInfo(e);n=yield this._getMemberAvatarAndNick(n);const r=this._generateGroupMember(n);return yA({memberList:r},{message:g})}catch(c){throw new r.ChatError({functionName:e,code:null==c?void 0:c.errorCode,message:null==c?void 0:c.errorInfo,moreMessage:g})}})}_convertMemberInfo(A){const e=[];for(let t=0,i=A.length;tA.userID),i=yield null===(e=this._core.user.userProfile)||void 0===e?void 0:e.getUserProfile({userIDList:t}),o=(null==i?void 0:i.data)||[],n=new Map(o.map(A=>[A.userID,A]));return A.forEach(A=>{if(n.has(A.userID)){const{nick:e="",avatar:t=""}=n.get(A.userID);A.nick=e,A.avatar=t}}),A})}_generateGroupMember(A){const e=[];for(let t=0,i=A.length;t({Member_Account:A}));try{const A=yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,userIDList:i}=A,o={GroupId:t,MemberList:i};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.add_group_member",data:o})})}({groupID:t,userIDList:r},this._core),{MemberList:e=[]}=A||{},{failureUserIDList:i,successUserIDList:n,existedUserIDList:s,overLimitUserIDList:a}=this._handleResult(e);return yA({failureUserIDList:i,successUserIDList:n,existedUserIDList:s,overLimitUserIDList:a,group:o},{message:` groupID:${t} successUserIDList:${n} failureUserIDList:${i} existedUserIDList:${s} overLimitUserIDList:${a}`})}catch(s){throw new n.ChatError({functionName:e,code:null==s?void 0:s.errorCode,message:null==s?void 0:s.errorInfo})}})}_handleResult(A){const e=[],t=[],i=[],o=[];return A.forEach(A=>{const{Result:n,Member_Account:r}=A;n===D?e.push(r):n===v?t.push(r):n===w?i.push(r):n===S&&o.push(r)}),{failureUserIDList:e,successUserIDList:t,existedUserIDList:i,overLimitUserIDList:o}}},qA=new class{constructor(){this._name="DeleteGroupMember"}init(A,t){this._core=A;const{helper:i}=A;i.registerApi({apiName:"deleteGroupMember",context:this,matcher:()=>!t.getInstalledSubPlugins().includes(e)})}deleteGroupMember(A){return fA(this,void 0,void 0,function*(){const e="deleteGroupMember",{groupID:t,userIDList:i}=A,o=QA.getLocalGroup(t),{helper:n,utils:{isUndefined:r},ssoLog:s}=this._core;if(r(o))throw new n.ChatError({functionName:e,code:Z});i.length>20&&(s.warn("deleteGroupMember",`${this._name}.${e} userIDList length:${i.length} exceeds limit 20`),i.splice(20));try{return yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,userIDList:i,reason:o}=A,n={GroupId:t,MemberToDel_Account:i,Reason:o};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.delete_group_member",data:n})})}({groupID:t,userIDList:i},this._core),yA({group:o,userIDList:i},{message:`groupID:${t} userIDList length:${i.length}`})}catch(a){throw new n.ChatError({functionName:e,code:null==a?void 0:a.errorCode,message:null==a?void 0:a.errorInfo})}})}},VA=new class{constructor(){this._name="SetGroupMemberMuteTime"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"setGroupMemberMuteTime",context:this})}setGroupMemberMuteTime(A){return fA(this,void 0,void 0,function*(){const{helper:e}=this._core,{groupID:t,userID:i,muteTime:o}=A,n=` groupID:${t} userID:${i} muteTime:${o}`;this._preCheckSettingMuteParams(A);try{yield PA(A,this._core);const e=QA.getLocalGroup(t),r=new xA({userID:i,muteTime:o});return yA({group:e,member:r},{message:n})}catch(r){throw new e.ChatError({functionName:"setGroupMemberMuteTime",code:null==r?void 0:r.errorCode,message:null==r?void 0:r.errorInfo,moreMessage:n})}})}_preCheckSettingMuteParams(A){const{userID:e}=A,{store:t,helper:i}=this._core;if(e===t.get("login").userId)throw new i.ChatError({functionName:"setGroupMemberMuteTime",code:rA})}},jA=new class{constructor(){this._name="SetGroupMemberRole"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"setGroupMemberRole",context:this})}setGroupMemberRole(A){return fA(this,void 0,void 0,function*(){const e="setGroupMemberRole",{helper:t}=this._core,{groupID:i,userID:o,role:n}=A,r=`${this._name}.${e} ok, groupID:${i} userID:${o} role:${n}`;this._preCheckSettingRoleParams(A);try{yield PA(A,this._core);const e=QA.getLocalGroup(i),t=new xA({userID:o,role:n});return yA({group:e,member:t},{message:r})}catch(s){throw new t.ChatError({functionName:e,code:null==s?void 0:s.errorCode,message:null==s?void 0:s.errorInfo,moreMessage:r})}})}_preCheckSettingRoleParams(A){var e;const{groupID:t,userID:i,role:o}=A,{store:n,helper:r,OuterConstant:s,common:{isCommunity:a}}=this._core,g=QA.getLocalGroup(t);if((null===(e=null==g?void 0:g.selfInfo)||void 0===e?void 0:e.role)!==s.GRP_MBR_ROLE_OWNER)throw new r.ChatError({functionName:"setGroupMemberRole",code:iA});if(i===n.get("login").userId)throw new r.ChatError({functionName:"setGroupMemberRole",code:nA});const c=[...m];if(a({groupID:t})&&c.push(s.GRP_MBR_ROLE_CUSTOM),!c.includes(o))throw new r.ChatError({functionName:"setGroupMemberRole",code:oA})}},KA=new class{constructor(){this._name="SetGroupMemberNameCard"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"setGroupMemberNameCard",context:this})}setGroupMemberNameCard(A){return fA(this,void 0,void 0,function*(){const e="setGroupMemberNameCard",{helper:t,common:{getCurrentUserID:i}}=this._core;this._preCheckSettingNameCardParams(A);try{const{groupID:t,userID:o=i(),nameCard:n}=A,r={groupID:t,userID:o,nameCard:n};yield PA(r,this._core);const s=`${this._name}.${e} ok, groupID:${t} userID:${o} nameCard:${n}`,a=QA.getLocalGroup(t),g=new xA({userID:o,nameCard:n});return yA({group:a,member:g},{message:s})}catch(o){throw new t.ChatError({functionName:e,code:null==o?void 0:o.errorCode,message:null==o?void 0:o.errorInfo,moreMessage:logText})}})}_preCheckSettingNameCardParams(A){const{groupID:e}=A,{helper:t}=this._core,i=QA.getLocalGroup(e);if(lA(null==i?void 0:i.type))throw new t.ChatError({functionName:"setGroupMemberNameCard",code:sA})}},WA=new class{constructor(){this._name="SetGroupMemberCustomField"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"setGroupMemberCustomField",context:this})}setGroupMemberCustomField(A){return fA(this,void 0,void 0,function*(){const e="setGroupMemberCustomField",{helper:t,common:{getCurrentUserID:i}}=this._core;this._preCheckSettingCustomFiledParams(A);const{groupID:o,userID:n=i(),memberCustomField:r}=A,s=`${this._name}.${e} ok, groupID:${o}userID:${n} memberCustomField:${JSON.stringify(r)}`;try{const A={groupID:o,userID:n,memberCustomField:r};yield PA(A,this._core);const e=QA.getLocalGroup(o),t=new xA({userID:n,memberCustomField:r});return yA({group:e,member:t},{message:s})}catch(a){throw new t.ChatError({functionName:e,code:null==a?void 0:a.errorCode,message:null==a?void 0:a.errorInfo,moreMessage:s})}})}_preCheckSettingCustomFiledParams(A){const{groupID:e}=A,{helper:t}=this._core,i=QA.getLocalGroup(e);if(lA(null==i?void 0:i.type))throw new t.ChatError({functionName:"setGroupMemberCustomField",code:sA})}},zA=new class{init(A,e){A.ssoLog.debug("GroupMember.init"),YA.init(A,e),JA.init(A),HA.init(A),qA.init(A,e),VA.init(A),jA.init(A),KA.init(A),WA.init(A)}getGroupMemberList(A){return YA.getGroupMemberList(A)}deleteGroupMember(A){return qA.deleteGroupMember(A)}},ZA=new class{init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"getGroupCounters",context:this})}getGroupCounters(e){return fA(this,void 0,void 0,function*(){const t="getGroupCounters";try{dA(t,i);const{groupID:o,keyList:n=[]}=e,{avChatRoomKey:r,lastUpdateTime:s}=RA.getLocalGroupCounters(o);if(!(Date.now()-s>=this._getExpireTime()))return{code:0,data:{counters:RA.getLocalCounters(o,n)}};const a=yield function(e){return fA(this,void 0,void 0,function*(){const{groupID:t,GroupCounterKeys:i,avChatRoomKey:o}=e,{common:n}=A.core,r={GroupId:t,keyList:i,BytesKey:o};return n.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_counter",data:r})})}({groupID:o,keyList:n,avChatRoomKey:r}),{GroupCounter:g=[],GroupCounterSeq:c}=a;return RA.updateLocalGroupCounters({groupID:o,counterList:g,groupCounterSeq:c}),{code:0,data:{counters:RA.getLocalCounters(o,n)}}}catch(o){hA(t,o)}})}_getExpireTime(){const{store:A,utils:{isUndefined:e}}=this._core,t=A.get("cloudConfig")||{},{grp_counter_expire_time:i}=t;return e(i)?3e4:Number(i)}},XA=new class{init(A){const{helper:e}=A;e.registerApi({apiName:"setGroupCounters",context:this}),e.registerApi({apiName:"increaseGroupCounter",context:this}),e.registerApi({apiName:"decreaseGroupCounter",context:this})}setGroupCounters(A){return fA(this,void 0,void 0,function*(){return this._handleCounterOperation(o,A)})}increaseGroupCounter(A){return fA(this,void 0,void 0,function*(){return this._handleCounterOperation(n,A)})}decreaseGroupCounter(A){return fA(this,void 0,void 0,function*(){return this._handleCounterOperation(r,A)})}_handleCounterOperation(A,e){return fA(this,void 0,void 0,function*(){const t=`${A}GroupCounter`;try{dA(t,i);const{groupID:n,key:r,value:s=0}=e,{avChatRoomKey:a}=RA.getLocalGroupCounters(n),g=A===o?this._convertObjectToList(e.counters):[{Key:r,Value:s}],c=yield this._updateGroupCounters({groupID:n,counterList:g,avChatRoomKey:a,mode:A});return RA.setGroupCounters(n,c),{code:0,data:{counters:c}}}catch(n){hA(t,n)}})}_updateGroupCounters(e){return fA(this,void 0,void 0,function*(){const t=yield function(e){const{groupID:t,counterList:i,mode:o,avChatRoomKey:n}=e,{common:r}=A.core,s={GroupId:t,GroupCounter:i,Mode:o,BytesKey:n};return r.buildAndSendPacket({servcmd:"group_open_http_svc.update_group_counter",data:s})}(e),{GroupCounter:i=[]}=t,o={};return i.forEach(A=>{const{Key:e,Value:t=0}=A;o[e]=t}),o})}_convertObjectToList(A){return Object.entries(A).map(([A,e])=>({Key:A,Value:e||0}))}},$A=new class{init(A){this._core=A,ZA.init(A),XA.init(A)}isGroupCounterUpdated(A){const{elements:{groupCounterInfo:e}}=A,{utils:{isEmpty:t}}=this._core;return!t(e)}handleGroupCounterUpdated(A){const{to:e,elements:{groupCounterInfo:t}}=A;t.forEach(A=>{const{type:t,groupCounterSeq:i,counterList:o=[]}=A;t!==s&&t!==g||this._processAndNotifyCounterUpdate(e,i,o),t===a&&RA.deleteLocalGroupCounters({groupID:e,groupCounterSeq:i,counterList:o})})}_processAndNotifyCounterUpdate(A,e,t){const{OuterEvent:i,notificationCenter:o}=this._core;RA.updateLocalGroupCounters({groupID:A,groupCounterSeq:e,counterList:t}),t.forEach(({Key:e,Value:t=0})=>{o.emitOuterEvent(i.GROUP_COUNTER_UPDATED,{name:i.GROUP_COUNTER_UPDATED,data:{groupID:A,key:e,value:t}})})}reset(){RA.reset()}},Ae=new class{constructor(){this._name="InitGroupAttributes"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"initGroupAttributes",context:this})}initGroupAttributes(A){return fA(this,void 0,void 0,function*(){const{groupID:e,groupAttributes:t}=A,{serverMainSequence:i,avChatRoomKey:o}=wA.getGroupAttributesCache(e),n=wA.convertKeyValueMapToList(t);try{const A=yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,mainSequence:i,groupAttributeList:o,avChatRoomKey:n}=A,r={GroupId:t,AttrMainSeq:i,GroupAttr:o,BytesKey:n,AttrControl:["RaceConflict"]};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.set_group_attr",data:r})})}({groupID:e,avChatRoomKey:o,groupAttributeList:n,mainSequence:i},this._core),{AttrMainSeq:r,GroupAttr:s}=A||{},a=s.map(A=>{const{Key:e,seq:i}=A;return{key:e,value:t[e],sequence:i}});return wA.saveGroupAttributesCacheValuesCopy(e),wA.refreshGroupAttributesCache({groupID:e,serverMainSequence:r,groupAttributeList:a,operation:M}),wA.emitGroupAttributesUpdated(e),yA({groupAttributes:t},{message:` groupID:${e} serverMainSequence:${r}`})}catch(r){throw new this._core.helper.ChatError({functionName:"initGroupAttributes",code:null==r?void 0:r.errorCode,message:null==r?void 0:r.errorInfo})}})}},ee=new class{constructor(){this._name="SetGroupAttributes"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"setGroupAttributes",context:this})}setGroupAttributes(A){return fA(this,void 0,void 0,function*(){const{groupID:e,groupAttributes:t}=A,{serverMainSequence:i,avChatRoomKey:o,values:n}=wA.getGroupAttributesCache(e),r=wA.convertKeyValueMapToList(t).map(A=>{var e;const{key:t,value:i}=A;return{key:t,value:i,seq:(null===(e=n.get(A.key))||void 0===e?void 0:e.sequence)||0}});try{const A=yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,mainSequence:i,groupAttributeList:o,avChatRoomKey:n}=A,r={GroupId:t,AttrMainSeq:i,GroupAttr:o,BytesKey:n,AttrControl:["RaceConflict"]};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.modify_group_attr",data:r})})}({groupID:e,avChatRoomKey:o,groupAttributeList:r,mainSequence:i},this._core),{AttrMainSeq:n,GroupAttr:s}=A||{},a=s.map(A=>{const{Key:e,seq:i}=A;return{key:e,value:t[e],sequence:i}});return wA.saveGroupAttributesCacheValuesCopy(e),wA.refreshGroupAttributesCache({groupID:e,serverMainSequence:n,groupAttributeList:a,operation:R}),wA.emitGroupAttributesUpdated(e),yA({groupAttributes:t},{message:` groupID:${e} serverMainSequence:${n}`})}catch(s){throw new this._core.helper.ChatError({functionName:"setGroupAttributes",code:null==s?void 0:s.errorCode,message:null==s?void 0:s.errorInfo})}})}},te=new class{constructor(){this._name="DeleteGroupAttributes"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"deleteGroupAttributes",context:this})}deleteGroupAttributes(A){return fA(this,void 0,void 0,function*(){const e="deleteGroupAttributes",{groupID:t,keyList:i=[]}=A;try{let A;A=0===i.length?yield this._clearGroupAttributes(t):yield this._deleteGroupAttributes(t,i);const{resultList:o,serverMainSequence:n,operation:r,groupAttributeList:s}=A||{},a=`${this._name}.${e} ok. groupID:${t} operation: ${r}`;return wA.saveGroupAttributesCacheValuesCopy(t),wA.refreshGroupAttributesCache({groupID:t,serverMainSequence:n,groupAttributeList:s,operation:r}),wA.emitGroupAttributesUpdated(t),yA({keyList:o},{message:a})}catch(o){throw new this._core.helper.ChatError({functionName:e,code:null==o?void 0:o.errorCode,message:null==o?void 0:o.errorInfo})}})}_deleteGroupAttributes(A,e){return fA(this,void 0,void 0,function*(){const{serverMainSequence:t,avChatRoomKey:i,values:o}=wA.getGroupAttributesCache(A),n=[],r=[];e.forEach(A=>{if(o.has(A)){const{sequence:e=0}=o.get(A)||{};r.push({key:A,seq:e}),n.push(A)}});const s=yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,mainSequence:i,groupAttributeList:o,avChatRoomKey:n}=A,r={GroupId:t,AttrMainSeq:i,GroupAttr:o,BytesKey:n,AttrControl:["RaceConflict"]};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.delete_group_attr",data:r})})}({groupID:A,avChatRoomKey:i,groupAttributeList:r,mainSequence:t},this._core),{AttrMainSeq:a}=s||{};return{resultList:n,serverMainSequence:a,groupAttributeList:r,operation:T}})}_clearGroupAttributes(A){return fA(this,void 0,void 0,function*(){const{serverMainSequence:e,avChatRoomKey:t,values:i}=wA.getGroupAttributesCache(A),o=[...i.keys()],n=yield function(A,e){return fA(this,void 0,void 0,function*(){const{groupID:t,mainSequence:i,avChatRoomKey:o}=A,n={GroupId:t,AttrMainSeq:i,BytesKey:o,AttrControl:["RaceConflict"]};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.clear_group_attr",data:n})})}({groupID:A,avChatRoomKey:t,mainSequence:e},this._core),{AttrMainSeq:r}=n||{};return{resultList:o,serverMainSequence:r,operation:_}})}},ie=new class{constructor(){this._name="GetGroupAttributes"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"getGroupAttributes",context:this})}getGroupAttributes(A){return fA(this,void 0,void 0,function*(){const{groupID:e}=A,{avChatRoomKey:t,lastUpdateTime:i,localMainSequence:o,serverMainSequence:n}=wA.getGroupAttributesCache(e),{helper:{ChatError:r}}=this._core,s=`groupID:${e} localMainSequence:${o} serverMainSequence:${n} keyList:${A.keyList}`;if(Date.now()-i>=3e4||o {const{key:e,value:t,seq:i}=A;return{key:e,value:t,sequence:i}});return wA.refreshGroupAttributesCache({groupID:i,serverMainSequence:s,groupAttributeList:g,operation:N}),{serverGroupAttributeList:a}})}},oe=new class{init(A){A.ssoLog.debug("GroupAttribute.init"),Ae.init(A),ee.init(A),te.init(A),ie.init(A),wA.init(A)}isGroupAttributesUpdated(A){return wA.isGroupAttributesUpdated(A)}handleGroupAttributesUpdated(A){const{to:e,elements:{newGroupProfile:t}}=A,{groupAttributeOption:i}=t,{serverMainSequence:o,withChangedAttributeInfo:n}=i,{localMainSequence:r}=wA.getGroupAttributesCache(e),s=o-r;if(console.log(`GroupAttribute.handleGroupAttributesUpdated groupID:${e} withChangedAttributeInfo:${n} diffSequence:${s}`),0!==s)if(wA.saveGroupAttributesCacheValuesCopy(e),1!==n||1!==s){if(wA.hasGroupAttributesCache(e)){const{avChatRoomKey:A}=wA.getGroupAttributesCache(e);ie.getGroupAttributesFromServer({groupID:e,avChatRoomKey:A}).then(()=>{wA.emitGroupAttributesUpdated(e)}).catch(()=>{})}}else wA.handleGroupAttributesUpdated({groupID:e,groupAttributeOption:i})}reset(){wA.reset()}};function ne(A,e="tips"){const{ClientSeq:t,From_Account:i,MsgClientTime:o,MsgPriority:n,MsgRandom:r,MsgSeq:s,MsgTimeStamp:a,TinyId:g,ToGroupId:c,GroupInfo:l,MsgBody:I}=A;return{clientSequence:t,from:i,clientTime:o,priority:n,random:r,sequence:s,time:a,tinyID:g,to:c,groupProfile:function(A){const{GroupCode:e,GroupId:t,GroupName:i,GroupType:o,MsgFrom_AccountExtraInfo:n,From_Account:r,To_Account:s}=A;return{groupCode:e,groupID:t,groupName:i,type:o,messageFromAccountExtraInformation:n,from:r,to:s}}(l),elements:"tips"===e?re(I):ae(I)}}function re(A){const e={};return Object.keys(A).forEach(t=>{var i,o;switch(t){case"MemberNum":e.memberCount=A[t];break;case"OpType":e.operationType=A[t];break;case"Operator_Account":e.operatorID=A[t];break;case"List_Account":e.userIDList=A[t];break;case"MsgMemberExtraInfo":e.memberInfoList=null===(i=A[t])||void 0===i?void 0:i.map(A=>se(A));break;case"MsgOperatorMemberExtraInfo":e.operatorInfo=se(A[t]);break;case"MsgGroupNewInfo":e.newGroupProfile=function(A){const e={};return Object.keys(A).forEach(t=>{switch(t){case"GroupIntroduction":e.introduction=A[t];break;case"GroupName":e.groupName=A[t];break;case"GroupFaceUrl":e.avatar=A[t];break;case"GroupNotification":e.notification=A[t];break;case"ApplyJoinOption":e.joinOption=A[t];break;case"InviteJoinOption":e.inviteOption=A[t];break;case"ShutupAll":e.muteAllMembers=A[t];break;case"Owner_Account":e.ownerID=A[t];break;case"GroupAttrOption":e.groupAttributeOption=function(A){const{BytesChangedKeys:e,GroupAttrSeq:t,OpType:i,PushChangedAttrValFlag:o,GroupAttrInfo:n}=A;return{changedKeyList:e,groupAttributeList:n.map(A=>{const{Key:e,Val:t,SubKeySeq:i}=A;return{key:e,value:t,sequence:i}}),serverMainSequence:t,operation:i,withChangedAttributeInfo:o}}(A[t])}}),e}(A[t]);break;case"MsgMemberInfo":e.msgMemberInfo=null===(o=A[t])||void 0===o?void 0:o.map(A=>function(A){const{ShutupTime:e,User_Account:t}=A;return{muteTime:e,userID:t}}(A));break;case"OnlineMemberInfo":e.onlineMemberInfo=function(A){const{ExpireTime:e,OnlineMemberNum:t}=A;return{expireTime:e,onlineMemberNum:t}}(A[t]);break;case"GroupCounterInfo":e.groupCounterInfo=A[t].map(A=>{const{GroupCounterSeq:e,GroupCounter:t,Type:i}=A;return{type:i,groupCounterSeq:e,counterList:t}})}}),e}function se(A){const{ImageUrl:e,NickName:t,Role:i,UserId:o}=A;return{avatar:e,nick:t,role:i,userID:o}}function ae(A){const e={};return Object.keys(A).forEach(t=>{switch(t){case"MsgKey":e.messageKey=A[t];break;case"Operator_Account":e.operatorID=A[t];break;case"ReportType":e.operationType=A[t];break;case"Authentication":e.authentication=A[t];break;case"MsgFlag":e.messageRemindType=A[t];break;case"UserDefinedField":e.userDefinedField=A[t];break;case"RemarkInfo":e.remarkInfo=A[t];break;case"BanDuration":e.duration=A[t];break;case"MuteTime":e.muteTime=A[t]}}),e}class ge{constructor(e){this.type=A.core.OuterConstant.MSG_GRP_TIP,this.content={},this._initContent(e)}static parseServerPushElement(A){const e=re(A);return new ge(e)}_initContent(A){Object.keys(A).forEach(e=>{switch(e){case"groupProfile":this._initGroupProfile(A[e]);break;case"operatorInfo":this._initOperatorInfo(A[e]);break;case"memberInfoList":case"msgMemberInfo":this._updateMemberList(A[e]);break;case"newGroupProfile":this._initNewGroupProfile(A[e]);break;case"memberExtraInfo":case"remarkInfo":case"onlineMemberInfo":break;default:this.content[e]=A[e]}}),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}_initGroupProfile(A){this.content.groupProfile={};const e=Object.keys(A);for(let t=0;t {A.forEach(A=>{e.userID===A.userID&&Object.assign(e,A)})}):this.content.memberList=A}_initNewGroupProfile(A){this.content.newGroupProfile={};const e=Object.keys(A);for(let t=0;t 0&&(o.emitOuterEvent(n.MESSAGE_RECEIVED,{name:n.MESSAGE_RECEIVED,data:t}),this._handleGroupTipMessage(t)),{conversationUpdateFieldList:i}}_handleGroupTips(A,e=!0){const{Event:t,GroupTips:i}=A,o=new Map,n=[],r=[];for(let s=0,a=i.length;s{const{operationType:t}=A.payload;switch(t){case e.JOINED:this._handleNewMemberJoined(A);break;case e.QUITTED:this._handleMemberQuitted(A);break;case e.KICKED:this._handleMemberKicked(A);break;case e.GROUP_PROFILE_UPDATED:this._handleGroupProfileUpdated(A)}})}_handleNewMemberJoined(A){this._handleGroupMemberCountUpdated(A)}_handleMemberQuitted(A){this._handleGroupMemberCountUpdated(A)}_handleMemberKicked(A){this._handleGroupMemberCountUpdated(A)}_handleGroupProfileUpdated(A){var e;const{newGroupProfile:t,groupProfile:i,operatorInfo:o}=A.payload,{groupID:n}=i,r=QA.getLocalGroup(n);Object.keys(t).forEach(A=>{switch(A){case"ownerID":this._handleGroupOwnerChanged(n,t);break;case"groupName":r.name=t[A];break;default:r[A]=t[A]}});const{utils:{isUndefined:s}}=this._core;s(o)||(null===(e=null==r?void 0:r.selfInfo)||void 0===e?void 0:e.userID)!==o.userID||Object.keys(o).forEach(A=>{"nameCard"===A&&r.updateSelfInfo({nameCard:o[A]}),"role"===A&&this._updateSelfRole(r,o[A])}),QA.emitGroupListUpdate(),QA.updateConversationGroupProfile(n)}_handleGroupOwnerChanged(A,e){const{common:t,OuterConstant:i}=this._core,o=QA.getLocalGroup(A),n=t.getCurrentUserID(),{ownerID:r}=e;n===r&&o.updateGroup({ownerID:r,selfInfo:{role:i.GRP_MBR_ROLE_OWNER}})}_updateSelfRole(A,e){const{OuterConstant:t}=this._core;let i=t.GRP_MBR_ROLE_MEMBER;e===U?i=t.GRP_MBR_ROLE_OWNER:e===F&&(i=t.GRP_MBR_ROLE_ADMIN),A.updateSelfInfo({role:i})}_handleGroupMemberCountUpdated(A){const{memberCount:e,groupProfile:{groupID:t}}=A.payload,i=QA.getLocalGroup(t),{utils:{isNumber:o}}=this._core;i&&o(e)&&i.memberCount!==e&&(i.memberCount=e,QA.emitGroupListUpdate(),QA.updateConversationGroupProfile(t))}_handleGroupTipsRecover(A){const{utils:{isArray:e}}=this._core,{groupTipList:t}=(null==A?void 0:A.result)||{};e(t)&&t.forEach(A=>{const{messageList:e}=this._handleGroupTips({Event:A.Event,GroupTips:[A]},!1);this._handleGroupTipMessage(e)})}};class le{constructor(e){this.type=A.core.OuterConstant.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(e)}static parseServerPushElement(A){const e=ae(A);return new le(e)}_initContent(A){Object.keys(A).forEach(e=>{switch(e){case"remarkInfo":this.content.handleMessage=A[e];break;case"groupProfile":this._initGroupProfile(A[e]);break;case"memberInfoList":break;default:this.content[e]=A[e]}})}_initGroupProfile(A){this.content.groupProfile={};const e=Object.keys(A);for(let t=0;t 0&&this._handleGroupSysTemMessage(t,o),!0===t&&o.length>0&&n.emitOuterEvent(r.MESSAGE_RECEIVED,{name:r.MESSAGE_RECEIVED,data:o})}_handleGroupSystemNotification(A,e){const t=[];let i={};for(let o=0;o 0?[i]:[],messageList:t}}_assembleMessage(A){const{message:{messageFactory:e},OuterConstant:t,utils:{randomInt:i}}=this._core;A.flow="in",A.conversationType=t.CONV_SYSTEM,A.conversationSubType=A.groupProfile.type,A.conversationID=t.CONV_SYSTEM;const o=e.createMessage(A),n=new le(Object.assign(Object.assign({},A.elements),{groupProfile:Object.assign({},A.groupProfile)}));o.setElement(n),o.isSystemMessage=!0;const r=1===o.sequence&&1===o.random,s=2===o.sequence&&2===o.random;return(r||s)&&(o.sequence=i(),o.random=i(),o.generateMessageID()),o}_handleConversationOptions(A,e){const{OuterConstant:t}=this._core,i={conversationID:t.CONV_SYSTEM,unreadCount:0,type:t.CONV_SYSTEM,subType:A.conversationSubType,lastMessage:null};return e&&i.unreadCount++,i}_handleGroupSysTemMessage(A,e){A&&e.forEach(A=>{const{operationType:e}=A.payload;switch(e){case P:this._handleGroupJoinResult(A);break;case Y:this._handleMemberKicked(A);break;case J:this._handleGroupDismissed(A);break;case H:this._handleGroupInvitedResult(A);break;case q:this._handleGroupQuitResult(A);break;case j:this._handleMessageRemindTypeSynced(A);break;case K:this._handleAVChatRoomMemberBanned(A)}})}_handleGroupJoinResult(A){const{groupProfile:e}=A.payload,{groupID:t,type:i}=e,o=QA.hasLocalGroup(t);this._core.ssoLog.debug("_handleGroupJoinResult",` groupID:${t} type:${i} hasLocalGroup:${o}`),o||lA(i)||(QA.updateLocalGroup([Object.assign({},e)]),QA.emitGroupListUpdate())}_handleMemberKicked(A){const{groupProfile:{groupID:e,type:t}}=A.payload;QA.hasLocalGroup(e)&&this._deleteLocalGroup(e,t),this._updateConversationProfile(e,{unreadCount:0})}_handleGroupDismissed(A){const{groupProfile:{groupID:e,type:t}}=A.payload;QA.hasLocalGroup(e)&&this._deleteLocalGroup(e,t),this._updateConversationProfile(e,{unreadCount:0})}_handleGroupInvitedResult(A){const{groupProfile:e}=A.payload,{groupID:t}=e,i=QA.hasLocalGroup(t);this._core.ssoLog.debug("_handleGroupInvitedResult",` groupID:${t} hasLocalGroup:${i}`),i||MA.getGroupProfile({groupID:t}).then(A=>{const{data:{group:e}}=A;QA.updateLocalGroup([Object.assign({},e)]),QA.emitGroupListUpdate()})}_handleGroupQuitResult(A){const{groupProfile:{groupID:e,type:t}}=A.payload,i=QA.hasLocalGroup(e);this._core.ssoLog.debug("_handleGroupQuitResult",` groupID:${e} type:${t} hasLocalGroup:${i}`),i&&this._deleteLocalGroup(e,t),this._updateConversationProfile(e,{unreadCount:0})}_handleMessageRemindTypeSynced(A){const{groupProfile:{groupID:e},messageRemindType:t}=A.payload;this._updateConversationProfile(e,{messageRemindType:t})}_handleAVChatRoomMemberBanned(A){const{groupProfile:{groupID:e,type:t}}=A.payload;this._deleteLocalGroup(e,t)}_deleteLocalGroup(A,e){if(lA(e)){const{appStore:{conversationStore:e},OuterConstant:{CONV_GROUP:t}}=this._core;e.deleteConversation(`${t}${A}`)}QA.deleteLocalGroup(A),QA.emitGroupListUpdate()}_updateConversationProfile(A,e){const{appStore:{conversationStore:t},OuterConstant:{CONV_GROUP:i}}=this._core,o=`${i}${A}`;t.getConversation(o)&&t.updateConversation(o,e)}},ue=new class{init(A){this._core=A,A.ssoLog.debug("GroupNotificationHandler.init"),ce.init(A),Ie.init(A);const{notificationCenter:e,InnerEvent:t}=A,{InnerEventSubType:i}=e;e.subscribeInnerEvent(t.MESSAGE_PUSH,i.GROUP_TIPS_NOTIFICATION,this._onNewGroupTipsNotification,this),e.subscribeInnerEvent(t.MESSAGE_PUSH,i.GROUP_SYSTEM_NOTIFICATION,this._onNewGroupSystemNotification,this),e.subscribeInnerEvent(t.DESTROY,this._dispose,this)}_onNewGroupTipsNotification(A){const{common:{workflowManager:e},constants:{WORKFLOW_NAME:t}}=this._core;e.executeWorkflow(t.RECEIVE_GROUP_TIPS_NOTIFICATION,A)}_onNewGroupSystemNotification(A){Ie.onNewGroupSystemNotification(A)}_dispose(){const{notificationCenter:A,InnerEvent:e}=this._core,{InnerEventSubType:t}=A;A.unSubscribeInnerEvent(e.MESSAGE_PUSH,t.GROUP_TIPS_NOTIFICATION,this._onNewGroupTipsNotification,this),A.unSubscribeInnerEvent(e.MESSAGE_PUSH,t.GROUP_SYSTEM_NOTIFICATION,this._onNewGroupSystemNotification,this)}};const Ee={required:!0,rules:["string"],allowEmpty:!1},de={required:!0,rules:["number"],allowEmpty:!1},he={required:!0,rules:["array"],allowEmpty:!1},Ce={required:!0,rules:["object"],allowEmpty:!1},Be={createGroup:{name:Ee,type:Ee},dismissGroup:[Object.assign({key:"groupID"},Ee)],joinGroup:{groupID:Ee,applyMessage:{required:!1,rules:["string"],allowEmpty:!0}},quitGroup:[Object.assign({key:"groupID"},Ee)],searchGroupByID:[Object.assign({key:"groupID"},Ee)],getGroupProfile:{groupID:Ee,groupCustomFieldFilter:{required:!1,rules:["array"],allowEmpty:!0}},updateGroupProfile:{groupID:Ee,muteAllMembers:{required:!1,rules:["boolean"],allowEmpty:!1}},changeGroupOwner:{groupID:Ee,newOwnerID:Ee},getGroupOnlineMemberCount:[Object.assign({key:"groupID"},Ee)],handleGroupApplication:{handleAction:Ee},getGroupMemberList:{groupID:Ee},getGroupMemberProfile:{groupID:Ee,userIDList:he,memberCustomFieldFilter:{required:!1,rules:["array"],allowEmpty:!0}},addGroupMember:{groupID:Ee,userIDList:he},deleteGroupMember:{groupID:Ee,userIDList:he},setGroupMemberMuteTime:{groupID:Ee,userID:Ee,muteTime:Object.assign(Object.assign({},de),{customValidator:A=>!(A<0)||"muteTime must be a non-negative number."})},setGroupMemberRole:{groupID:Ee,userID:Ee,role:Ee},setGroupMemberNameCard:{groupID:Ee,userID:{required:!1,rules:["string"],allowEmpty:!1},nameCard:Ee},setGroupMemberCustomField:{groupID:Ee,userID:{required:!1,rules:["string"],allowEmpty:!1},memberCustomField:he},markGroupMemberList:{groupID:Ee,markType:Object.assign(Object.assign({},de),{customValidator:A=>!(A<1e3)||"markType must be greater than or equal to 1000."}),enableMark:{required:!0,rules:["boolean"],allowEmpty:!1},userIDList:he},initGroupAttributes:{groupID:Ee,groupAttributes:Ce},setGroupAttributes:{groupID:Ee,groupAttributes:Ce},deleteGroupAttributes:{groupID:Ee,keyList:Object.assign(Object.assign({},he),{allowEmpty:!0})},getGroupAttributes:{groupID:Ee,keyList:Object.assign(Object.assign({},he),{allowEmpty:!0})},getGroupCounters:{groupID:Ee,keyList:{required:!1,rules:["array"],allowEmpty:!0}},setGroupCounters:{groupID:Ee,counters:Ce},increaseGroupCounter:{groupID:Ee,key:Ee,value:de},decreaseGroupCounter:{groupID:Ee,key:Ee,value:de}},Qe={getGroupList:!0,createGroup:!0,dismissGroup:!0,joinGroup:!0,quitGroup:!0,searchGroupByID:!0,getGroupProfile:!0,updateGroupProfile:!0,changeGroupOwner:!0,getGroupOnlineMemberCount:!0,getGroupApplicationList:!0,handleGroupApplication:!0,getGroupMemberList:!0,getGroupMemberProfile:!0,addGroupMember:!0,deleteGroupMember:!0,setGroupMemberMuteTime:!0,setGroupMemberRole:!0,setGroupMemberNameCard:!0,setGroupMemberCustomField:!0,markGroupMemberList:!0,initGroupAttributes:!0,setGroupAttributes:!0,getGroupAttributes:!0,deleteGroupAttributes:!0,getGroupCounters:!0,setGroupCounters:!0,increaseGroupCounter:!0,decreaseGroupCounter:!0};return new class{constructor(){this._installedSubPlugins=[],this.groupDataHandler=QA,this.groupAction=LA,this.groupAttribute=oe,this.groupMember=zA,this.name="Group"}install(e,t=[]){this._core=e,A.init(e),QA.init(e),LA.init(e,this),zA.init(e,this),OA.init(e),$A.init(e),oe.init(e),ue.init(e),e.helper.registerValidateConfig({auth:Qe,params:Be}),this._installSubPlugins(t);const{notificationCenter:i,InnerEvent:o}=e;i.subscribeInnerEvent(o.LOGOUT,this._reset,this),i.subscribeInnerEvent(o.DESTROY,this._dispose,this)}getInstalledSubPlugins(){return this._installedSubPlugins}_installSubPlugins(A){const{utils:{isArray:e}}=this._core;A&&e(A)&&A.forEach(A=>{var e;this._installedSubPlugins.includes(A.name)||(null===(e=A.install)||void 0===e||e.call(A,this._core,this),this._installedSubPlugins.push(A.name))})}_reset(){QA.reset(),oe.reset(),$A.reset()}_dispose(){this._reset();const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.LOGOUT,this._reset,this),A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this)}}}();const i_=RR(t_.exports);var o_={exports:{}};o_.exports=function(){const A=new class{init(A){this.core=A}};function e(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(A);o -1&&clearTimeout(this._timeoutID),this._timeoutID=setTimeout(this._request.bind(this),A))}stop(){console.log(`${this._name}.stop timerID:${this._timeoutID}`),this._timeoutID>-1&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}}class u{constructor(A){this._maxLength=A,this._map=new Map}set(A){var e;if(this._map.size>=this._maxLength){const A=(null===(e=this._map.entries().next().value)||void 0===e?void 0:e[0])||"";this._map.delete(A)}this._map.set(A,1)}has(A){return this._map.has(A)}delete(A){this.has(A)&&this._map.delete(A)}clear(){this._map.clear()}}const E=A=>A===n.GROUP_TIPS_HAS_NO_ROAMING||A===n.GROUP_TIPS_HAS_ROAMING,d=A=>A===n.GROUP_SYSTEM_MESSAGE;function h(t){const i=function(A){const{E:t,MCT:i,MR:o,MP:n,MTS:r,GId:s,MS:a,CCD:g,F_Account:c,IsSys:l,GInf:I,MsgBody:u}=A,E=e(A,["E","MCT","MR","MP","MTS","GId","MS","CCD","F_Account","IsSys","GInf","MsgBody"]);return Object.assign({Event:t,MsgClientTime:i,MsgRandom:o,MsgPriority:n,MsgTimeStamp:r,ToGroupId:s,MsgSeq:a,CloudCustomData:g,From_Account:c,IsSystemMsg:l,GroupInfo:C(I),MsgBody:B(u)},E)}(t);return function(e){const{Event:t}=e;(E(t)||d(t))&&(e.From_Account=e.From_Account||"@TIM#SYSTEM"),(t===n.BROADCAST_MESSAGE||t===n.NORMAL_MESSAGE)&&function(e){const{core:{OuterConstant:t}}=A;e.CloudCustomData=e.CloudCustomData||"",e.MsgBody=e.MsgBody.map(A=>{if(A.MsgType===t.MSG_CUSTOM){const{content:e={}}=A;A.content=Object.assign({Data:"",Desc:"",Ext:""},e)}return A})}(e),E(t)&&function(A){const{GroupJoinType:e,MsgOperatorMemberExtraInfo:t={},MsgMemberExtraInfo:i,Operator_Account:o,List_Account:n,OpType:r}=A.MsgBody||{};"number"==typeof e||1!==r&&2!==r||(A.MsgBody.GroupJoinType=2===r?0:1),i||(A.MsgBody.MsgMemberExtraInfo=null==n?void 0:n.map(A=>({UserId:A}))),1!==r||i||(A.MsgBody.MsgMemberExtraInfo=[{UserId:t.UserId}]),A.MsgBody.MsgOperatorMemberExtraInfo=Object.assign({Operator_Account:o,ImageUrl:"",NickName:""},t)}(e),d(t)&&function(A){const{MsgOperatorMemberExtraInfo:e={},Operator_Account:t}=A.MsgBody||{};A.MsgBody.MsgMemberExtraInfo=Object.assign({UserId:t,ImageUrl:"",NickName:""},e),A.MsgBody=Object.assign({Authentication:"",RemarkInfo:"",MsgKey:1e3*A.MsgTimeStamp},A.MsgBody),A.MsgBody=Object.keys(A.MsgBody).filter(A=>"MsgOperatorMemberExtraInfo"!==A).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:A.MsgBody[t]}),{})}(e)}(i),i}function C(A){const t=A||{},{GN:i,GT:o,F_Hd:n,F_NN:r,F_Ll:s}=t,a=e(t,["GN","GT","F_Hd","F_NN","F_Ll"]),g=Object.assign({GroupName:i,GroupType:o},a);return n&&(g.From_AccountHeadurl=n),r&&(g.From_AccountNick=r),s&&(g.From_AccountLevel=s),g}function B(A){let t=A;Array.isArray(A)||(t=[A]);const i=t.map(A=>{const{O_Account:t,Opt:i,L_Account:o,RT:n,UDF:r,OpInf:s,OnlineInf:a,MsgMemberExtraInfo:g}=A,c=e(A,["O_Account","Opt","L_Account","RT","UDF","OpInf","OnlineInf","MsgMemberExtraInfo"]),l=Object.assign({Operator_Account:t,OpType:i,List_Account:o,ReportType:n,UserDefinedField:r},c);return s&&(l.MsgOperatorMemberExtraInfo=function(A){const{Img:t,NN:i}=A,o=e(A,["Img","NN"]);return Object.assign({ImageUrl:t,NickName:i},o)}(s)),g&&(l.MsgMemberExtraInfo=null==(I=g)?void 0:I.map(A=>{const{Img:t,NN:i}=A,o=e(A,["Img","NN"]);return Object.assign({ImageUrl:t,NickName:i},o)})),a&&(l.OnlineMemberInfo=function(A){const{ET:e,Num:t}=A;return{ExpireTime:e,OnlineMemberNum:t}}(a)),l;var I});return Array.isArray(A)?i:i[0]}var Q=new class{constructor(){this._name="MessageParser",this._sequenceList=new u(200),this._messageIDList=new u(100),this._broadcastMessageIDMap=new Map,this._reportMessageStackedCount=0}init(A,e){this._core=A,this._avChatRoomHandler=e}onMessageReceived(e,t,i=!1){this._sortServerMessageList({groupID:e,serverMessageList:t,isHistoryMessage:i});const o=this._handleMessageList(e,t);if(0===o.length)return;if(!i){const{appStore:{conversationStore:t},OuterConstant:{CONV_GROUP:i}}=this._core,n=(e=>{const{core:{common:{getMessagePreviewText:t}}}=A;return{lastTime:(null==e?void 0:e.time)||(null==e?void 0:e.lastTime)||0,lastSequence:(null==e?void 0:e.sequence)||(null==e?void 0:e.lastSequence)||0,fromAccount:(null==e?void 0:e.from)||(null==e?void 0:e.fromAccount)||"",messageForShow:t(null==e?void 0:e.type,null==e?void 0:e.payload),payload:(null==e?void 0:e.payload)||null,type:(null==e?void 0:e.type)||"",isRevoked:(null==e?void 0:e.isRevoked)||!1,cloudCustomData:(null==e?void 0:e.cloudCustomData)||"",onlineOnlyFlag:(null==e?void 0:e._onlineOnlyFlag)||!1,nick:(null==e?void 0:e.nick)||"",nameCard:(null==e?void 0:e.nameCard)||"",version:(null==e?void 0:e.version)||0,isPeerRead:(null==e?void 0:e.isPeerRead)||!1,revoker:(null==e?void 0:e.revoker)||null}})(o[o.length-1]);t.updateConversation(`${i}${e}`,{lastMessage:n})}this._checkMessageStacked(o);const n=o.filter(A=>!0===A.isModified),r=o.filter(A=>!1===A.isModified),{OuterEvent:{MESSAGE_RECEIVED:s,MESSAGE_MODIFIED:a}}=this._core;n.length>0&&this._emitEvent({name:a,data:n}),r.length>0&&this._emitEvent({name:s,data:r})}_sortServerMessageList(A){const{groupID:e,serverMessageList:t,isHistoryMessage:i}=A;let o=[];this._avChatRoomHandler.isPollingSimplifiedMessage()&&!i?(t.sort((A,e)=>A.MS-e.MS),o=t.map(A=>A.MS)):(t.sort((A,e)=>A.MsgSeq-e.MsgSeq),o=t.map(A=>A.MsgSeq)),console.log(`${this._name}._sortServerMessageList groupID:${e} count:${o.length} sequenceList:${o}`),o.length=0}_handleMessageList(A,e){const{message:{messageDataHandler:t,messageHelper:i}}=this._core,o=this._avChatRoomHandler.isPollingSimplifiedMessage(),n=[],s=e.length;for(let a=0;a A===n.LIVE_CUSTOM_DATA)(e)?(this._onLiveCustomData(A),null):(A=>A===n.MESSAGE_REACTION)(e)?null:A:(console.warn(`${this._name}.onMessageReceived unknown event:${e}`),null)}_createMessage(A){const{message:{messageFactory:e},OuterConstant:t}=this._core;let i=t.CONV_GROUP;A.event===n.GROUP_SYSTEM_MESSAGE&&(i=t.CONV_SYSTEM);const o=!!A.isSystemMessage,r=e.createMessage(Object.assign(Object.assign({},A),{conversationType:i,isSystemMessage:o,flow:"in"}));return r.setElement(A.elements),r}_filterDuplicateMessage(A){const{common:e}=this._core;if(!e.isUnlimitedAVChatRoom()){if(this._sequenceList.has(A.sequence))return null;this._sequenceList.set(A.sequence)}const t=this._messageIDList.has(A.ID);return t?(console.warn(`${this._name}_filterDuplicateMessageItem ID:${A.ID} has:${t}`),null):(this._messageIDList.set(A.ID),A)}_handleMessageRevoked(A){const{OuterConstant:e,OuterEvent:{MESSAGE_REVOKED:t}}=this._core,{ToGroupId:i,MsgBody:{RevokeMsgList:o},RevokerInfo:{Revoker_Account:n,Reason:r=""}}=A,s=[];o.forEach(A=>{const{TinyId:t,MsgClientTime:o,Random:a,MsgSeq:g}=A,c={conversationID:`${e.CONV_GROUP}${i}`,ID:`${t}-${o}-${a}`,revoker:n,revokeReason:r,revokerInfo:{userID:n,nick:"",avatar:""},sequence:g};s.push(c)}),0!==s.length&&this._emitEvent({name:t,data:s})}_onLiveCustomData(A){const{OuterEvent:{ROOM_CUSTOM_DATA_RECEIVED:e}}=this._core,{ToGroupId:t,MsgSeq:i,MsgTimeStamp:o,MsgBody:n}=A,r=(null==n?void 0:n.Content)||(null==n?void 0:n.MsgContent)||"";this._emitEvent({name:e,data:r}),console.log(`${this._name}._onLiveCustomData groupID:${t} sequence:${i} time:${o} data:${r}`)}_onGroupDismissed(A){this._avChatRoomHandler.reset(A)}_checkMessageStacked(A){const{length:e}=A;if(e>=100&&this._reportMessageStackedCount<5){const A=this._avChatRoomHandler.getJoinedGroups();this._core.ssoLog.info("MessageStacked",`count:${e} groupID:${A.join(",")}`),this._reportMessageStackedCount+=1}}_emitEvent(A){this._core.notificationCenter.emitOuterEvent(A.name,A)}onBroadcastMessageReceived(A){const{message:{messageHelper:e},OuterEvent:{MESSAGE_RECEIVED:t}}=this._core,i=this._avChatRoomHandler.isPollingSimplifiedMessage(),o=[],r=A.length;for(let s=0;s0&&this._emitEvent({name:t,data:o})}_updateLocalOnlineMemberCountFromTips(A){const{utils:{isEmpty:e}}=this._core,{ToGroupId:t,MsgBody:{OnlineMemberInfo:i}}=A;if(e(i))return;const{OnlineMemberNum:o=0,ExpireTime:n=s}=i,r=Date.now();let a=this._avChatRoomHandler.getLocalOnlineMemberCount(t);e(a)?a={lastReqTime:0,lastSyncTime:0,latestUpdateTime:r,memberCount:o,expireTime:n}:(a.latestUpdateTime=r,a.memberCount=o),this._avChatRoomHandler.updateLocalOnlineMemberCount(t,a)}reset(){this._reportMessageStackedCount=0,this._sequenceList.clear(),this._messageIDList.clear(),this._broadcastMessageIDMap.clear()}};const p=e=>{const{core:{store:t}}=A;return(t.get("cloudConfig")||{})[e]},f=e=>{const{core:{utils:{isUndefined:t}}}=A;return!t(e)},m=()=>{const A=p("polling_interval");return f(A)?parseInt(A,10):300},y=()=>{const A=p("polling_simplified_msg");return f(A)?parseInt(A,10):0};var D=new class{constructor(){this._name="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this._onlineMemberCountMap=new Map,this._pollingIntervalMap=new Map,this._pollingNoMessageCountMap=new Map,this._membersReqInfoMap=new Map,this._startBroadcastSequence=1}init(A,e){this._core=A,this._parentPlugin=e,Q.init(A,this),A.ssoLog.debug("AVChatRoomHandler.init")}onAVChatRoomSystemNotification(A){const{OuterConstant:{GRP_AVCHATROOM:e}}=this._core,{GroupTips:t=[]}=A;for(let i=0;i 0&&(e=[...this._joinedGroupMap.values()].filter(e=>e.type===A)),e}handleJoinGroupResult(A){return t(this,void 0,void 0,function*(){const{utils:{isUndefined:e},OuterConstant:{CONV_GROUP:t},apiMap:{getConversationProfile:i},OuterConstant:o}=this._core,{longPollingKey:n,group:r,historyMessageList:s=[]}=A,{groupID:a}=r;return yield this._preCheck(r),this._joinedGroupMap.set(a,r),this._parentPlugin.groupDataHandler.updateLocalGroup([r]),this._parentPlugin.groupDataHandler.emitGroupListUpdate(),i(`${t}${a}`),s.length>0&&Q.onMessageReceived(a,s,!0),e(n)?{code:0,data:{status:o.JOIN_STATUS_SUCCESS,group:r}}:{code:0,data:this.startMessageLongPolling(A)}})}_preCheck(A){return t(this,void 0,void 0,function*(){const{common:e,OuterConstant:t,helper:i,apiMap:{quitGroup:o},ssoLog:n}=this._core;if(e.isUnlimitedAVChatRoom()){if(this._pollingInstanceMap.size>(()=>{const A=p("polling_count_limit");return f(A)&&A>0?parseInt(A,10):20})())throw new i.ChatError({code:c,message:"the count of longPolling exceeds the max limit"});return}if(0===this._joinedAVChatRoomCount())return;if(A.type===t.GRP_LIVE)return;const[r,s]=this._joinedGroupMap.entries().next().value;if(s.selfInfo.role===t.GRP_MBR_ROLE_OWNER)this._parentPlugin.groupDataHandler.deleteLocalGroup(r);else try{yield o(r)}catch(a){n.debug("quitGroup",`${this._name}._preCheck quitGroup failed, groupID:${r} info:`,a)}this.reset(r)})}startMessageLongPolling(A){const{OuterConstant:e}=this._core,{longPollingKey:t,startSequence:i=1,group:o}=A,{groupID:n}=o;return this._pollingRequestInfoMap.set(n,{longPollingKey:t,startSequence:i}),this._pollingIntervalMap.set(n,m()),this._startPolling(n),this._reportLongPollingCount(),{status:e.JOIN_STATUS_SUCCESS,group:o}}_startPolling(A){if(this._core.ssoLog.debug("_startPolling",`${this._name}._startPolling groupID:${A}`),this._pollingInstanceMap.has(A)){const e=this._pollingInstanceMap.get(A);return void((null==e?void 0:e.isRunning())||null==e||e.start())}const e=new I({core:this._core,manager:this,groupID:A,getRequestParams:this._handleRequestParams.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});e.start(),this._pollingInstanceMap.set(A,e)}_handleRequestParams(A){const{longPollingKey:e,startSequence:t}=this._pollingRequestInfoMap.get(A)||{};return A===[...this._pollingInstanceMap.keys()][0]?{longPollingKey:e,startSequence:t,startBroadcastSeq:this._startBroadcastSequence,simplifiedMessage:y()}:{longPollingKey:e,startSequence:t,simplifiedMessage:y()}}_handleSuccess(A,e){const{ErrorCode:t}=e;if(0===t)this._hasJoinedAVChatRoom(A)&&this._handleResponseData(A,e);else{const{longPollingKey:e,startSequence:i}=this._pollingRequestInfoMap.get(A)||{};console.warn(`${this._name}._handleSuccess groupID:${A} key:${e} startSeq:${i} errorCode:${t}`)}}_handleResponseData(A,e){const{Key:t,NextSeq:i,NextBroadcastSeq:o,RspMsgList:n=[],RspBroadcastMsgList:r=[]}=e;if(t&&i&&this._pollingRequestInfoMap.set(A,{longPollingKey:t,startSequence:i}),o&&o>this._startBroadcastSequence&&(this._startBroadcastSequence=o),n.length>0)0!==this._getPollingNoMessageCount(A)&&(this._updatePollingNoMessageCount(A,0),this._pollingIntervalMap.set(A,m())),Q.onMessageReceived(A,n);else{let e=this._getPollingNoMessageCount(A);if(e+=1,this._updatePollingNoMessageCount(A,e),e===(()=>{const A=p("polling_no_msg_count");return f(A)?parseInt(A,10):20})()){const e=m()+(()=>{const A=p("polling_interval_plus");return f(A)?parseInt(A,10):2e3})();this._pollingIntervalMap.set(A,e)}}r.length>0&&Q.onBroadcastMessageReceived(r)}_handleFailure(A,e){const{ssoLog:t,utils:{safeStringify:i}}=this._core;t.warn("polling",`${this._name}._handleFailure groupID:${A} error: ${i(e)}`)}_joinedAVChatRoomCount(){const{OuterConstant:A}=this._core;let e=[];return this._joinedGroupMap.size>0&&(e=this.getJoinedGroups().filter(e=>e.type===A.GRP_AVCHATROOM)),e.length}_hasJoinedAVChatRoom(A){return this._joinedGroupMap.has(A)}getJoinedGroups(){return[...this._joinedGroupMap.values()]}updateLocalLiveGroup(A,e){this._joinedGroupMap.set(A,e),this._parentPlugin.groupDataHandler.updateLocalGroup([e])}handleLiveHistoryMessages(A,e){Q.onMessageReceived(A,e,!0)}isOverFrequencyLimit(A){if(!this._membersReqInfoMap.has(A))return this._membersReqInfoMap.set(A,{startTime:Date.now(),requestCount:1}),!1;let{startTime:e,requestCount:t}=this._membersReqInfoMap.get(A);const{interval:i,count:o}=(()=>{const A=p("av_members_freq_limit");if(f(A)){const{interval:e,count:t}=JSON.parse(A);if(t>0&&e>0)return{interval:e,count:t}}return{interval:30,count:4}})();return Date.now()-e>1e3*i?(this._membersReqInfoMap.set(A,{startTime:Date.now(),requestCount:1}),!1):(t+=1,this._membersReqInfoMap.set(A,{startTime:e,requestCount:t}),t>o)}_stopPolling(A){if(this._core.ssoLog.debug("_stopPolling",`${this._name}._stopPolling groupID:${A}`),A){const{appStore:{conversationStore:e},OuterConstant:{CONV_GROUP:t}}=this._core;e.deleteConversation(`${t}${A}`);const i=this._pollingInstanceMap.get(A);return null==i||i.stop(),this._parentPlugin.groupDataHandler.deleteLocalGroup(A),this._pollingInstanceMap.delete(A),this._pollingRequestInfoMap.delete(A),this._joinedGroupMap.delete(A),this._onlineMemberCountMap.delete(A),this._pollingIntervalMap.delete(A),this._pollingNoMessageCountMap.delete(A),void this._membersReqInfoMap.delete(A)}for(const e of this._pollingInstanceMap.values())null==e||e.stop();this._pollingInstanceMap.clear(),this._pollingRequestInfoMap.clear(),this._joinedGroupMap.clear(),this._onlineMemberCountMap.clear(),this._pollingIntervalMap.clear(),this._pollingNoMessageCountMap.clear(),this._membersReqInfoMap.clear()}_updatePollingNoMessageCount(A,e){this._pollingNoMessageCountMap.set(A,e)}_getPollingNoMessageCount(A){return this._pollingNoMessageCountMap.get(A)||0}_reportLongPollingCount(){const A=this._joinedGroupMap.size;if(A>1){const{common:e,OuterConstant:t,ssoLog:i}=this._core,o=e.isUnlimitedAVChatRoom()?1:0,n=[],r=[];this._joinedGroupMap.values().forEach(({groupID:A,type:e})=>{e===t.GRP_LIVE?r.push(A):n.push(A)}),i.info("longPollingCount",String(A),{moreMessage:`av:${n.join(",")} live:${r.join(",")} code: ${o}`,eventType:29})}}reset(A){this._stopPolling(A),this._startBroadcastSequence=1,Q.reset()}},v=new class{init(A,e){this._core=A,this._parentPlugin=e;const{helper:t}=A;t.registerApi({apiName:"joinGroup",context:this,matcher:()=>e.getInstalledSubPlugins().length>0})}joinGroup(A){return t(this,void 0,void 0,function*(){const{OuterConstant:e}=this._core,t=yield this._parentPlugin.groupAction.joinGroup(A),{data:{status:i,group:{type:o}}}=t;return o===e.GRP_AVCHATROOM?i===e.JOIN_STATUS_ALREADY_IN_GROUP?t:D.handleJoinGroupResult(t.data):t})}},w=new class{init(A,e){this._core=A,this._parentPlugin=e;const{helper:t}=A;t.registerApi({apiName:"quitGroup",context:this,matcher:()=>e.getInstalledSubPlugins().length>0})}quitGroup(A){return t(this,void 0,void 0,function*(){const{OuterConstant:e}=this._core,t=yield this._parentPlugin.groupAction.quitGroup(A),{data:{type:i}}=t;return i===e.GRP_AVCHATROOM&&D.reset(A),t})}},S=new class{init(A,e){this._core=A,this._parentPlugin=e;const{helper:t}=A;t.registerApi({apiName:"dismissGroup",context:this,matcher:()=>e.getInstalledSubPlugins().length>0})}dismissGroup(A){return t(this,void 0,void 0,function*(){const{OuterConstant:e}=this._core,t=yield this._parentPlugin.groupAction.dismissGroup(A),{data:{type:i}}=t;return i===e.GRP_AVCHATROOM&&D.reset(A),t})}},M=new class{constructor(){this._name="GetAVChatRoomMemberList"}init(A,e){this._core=A,this._parentPlugin=e;const{helper:t}=A;t.registerApi({apiName:"getGroupMemberList",context:this,matcher:()=>e.getInstalledSubPlugins().length>0})}getGroupMemberList(A){return t(this,void 0,void 0,function*(){const{appStore:{groupStore:e},helper:t,OuterConstant:o}=this._core,{groupID:n}=A,r=e.getGroup(n);if((null==r?void 0:r.type)===o.GRP_AVCHATROOM&&t.checkBusinessCapabilityBits(i)){if(D.isOverFrequencyLimit(n))throw{code:2996,message:`Over frequency limit: get_members-${n}`};return this._getGroupMemberList(A)}return this._parentPlugin.groupMember.getGroupMemberList(A)})}_getGroupMemberList(A){return t(this,void 0,void 0,function*(){const e="_getGroupMemberList",{helper:i}=this._core;try{const i=yield function(A,e){return t(this,void 0,void 0,function*(){const{groupID:t,offset:i=0}=A,o={GroupId:t,Timestamp:i};return e.common.buildAndSendPacket({servcmd:"group_open_avchatroom_http_svc.get_members",data:o})})}(A,this._core),{MemberList:o=[],NextTimestamp:n=0}=i||{},r=this._handleMemberList(o);return console.log(`${this._name}.${e} ok, groupID:${A.groupID} count:${r.length} nextOffset:${n}`),{code:0,data:{memberList:r,offset:n}}}catch(o){const A=new i.ChatError({functionName:e,code:null==o?void 0:o.errorCode,message:null==o?void 0:o.errorInfo});throw console.error(`${this._name}.${e} fail:`,A),A}})}_handleMemberList(A){return A.map(A=>{const{Member_Account:e,NickName:t="",Avatar:i="",Remark:o="",JoinTime:n=0,Marks:r=[]}=A;return{userID:e,nick:t,avatar:i,remark:o,joinTime:n,marks:r,isOnline:!0}})}},R=new class{constructor(){this._name="GetAVChatRoomOnlineMemberCount"}init(A,e){this._core=A,this._parentPlugin=e;const{helper:t}=A;t.registerApi({apiName:"getGroupOnlineMemberCount",context:this,matcher:()=>e.getInstalledSubPlugins().length>0})}getGroupOnlineMemberCount(A){return t(this,void 0,void 0,function*(){const{appStore:{groupStore:e},OuterConstant:t}=this._core,i=e.getGroup(A);return i?i.type===t.GRP_AVCHATROOM?this._getOnlineMemberCount(A):this._parentPlugin.groupAction.getGroupOnlineMemberCount(A):{code:0,data:{memberCount:0}}})}_getOnlineMemberCount(A){return t(this,void 0,void 0,function*(){const e="_getOnlineMemberCount",{utils:{isEmpty:t}}=this._core,i=D.getLocalOnlineMemberCount(A);if(t(i)||this._isExpired(A)){const{memberCount:t=0}=yield this._getOnlineMemberCountFromServer(A);return console.log(`${this._name}.${e} ok, groupID:${A} memberCount:${t} from server.`),{code:0,data:{memberCount:t}}}return console.log(`${this._name}.${e} ok, groupID:${A} memberCount:${i.memberCount} from local.`),{code:0,data:{memberCount:i.memberCount}}})}_isExpired(A){const e=D.getLocalOnlineMemberCount(A),t=Date.now(),i=t-e.lastSyncTime>1e3*e.expireTime,o=t-e.latestUpdateTime>1e4,n=t-e.lastReqTime>3e3;return i&&o&&n}_getOnlineMemberCountFromServer(A){return t(this,void 0,void 0,function*(){const e="_getOnlineMemberCountFromServer";try{const e=yield function(A,e){return t(this,void 0,void 0,function*(){const t={GroupId:A};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_online_member_num",data:t})})}(A,this._core),{OnlineMemberNum:i=0,ExpireTime:o=s}=e||{},n=Date.now(),r={lastSyncTime:n,latestUpdateTime:n,lastReqTime:n,memberCount:i,expireTime:o};return D.updateLocalOnlineMemberCount(A,r),{memberCount:i}}catch(i){const A=new this._core.helper.ChatError({functionName:e,code:null==i?void 0:i.errorCode,message:null==i?void 0:i.errorInfo});throw console.error(`${this._name}.${e} fail:`,A),A}})}},_=new class{constructor(){this._name="DeleteAVChatRoomMember"}init(A,e){this._core=A,this._parentPlugin=e;const{helper:t}=A;t.registerApi({apiName:"deleteGroupMember",context:this,matcher:()=>e.getInstalledSubPlugins().length>0})}deleteGroupMember(A){return t(this,void 0,void 0,function*(){const e="deleteGroupMember",{appStore:{groupStore:t},utils:{isUndefined:i},helper:n,OuterConstant:r}=this._core,{groupID:s}=A,g=t.getGroup(s);if(i(g))throw new n.ChatError({functionName:e,code:a});if(g.type===r.GRP_AVCHATROOM){if(n.checkBusinessCapabilityBits(o))return this._deleteGroupMember(A);throw new n.ChatError({functionName:e,code:l})}return this._parentPlugin.groupMember.deleteGroupMember(A)})}_deleteGroupMember(A){return t(this,void 0,void 0,function*(){const e="_deleteGroupMember",{appStore:{groupStore:i},helper:o,ssoLog:n}=this._core,{groupID:r,duration:s=0,userIDList:a}=A;if(0===s)throw new o.ChatError({functionName:e,code:g});try{return yield function(A,e){return t(this,void 0,void 0,function*(){const{groupID:t,userIDList:i,duration:o,reason:n}=A,r={GroupId:t,Members_Account:i,Duration:o,Description:n};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.ban_group_member",data:r})})}(A,this._core),n.debug(e,`${this._name}.${e} ok, groupID:${r}`),{code:0,data:{group:i.getGroup(r),userIDList:a}}}catch(c){throw new o.ChatError({functionName:e,code:null==c?void 0:c.errorCode,message:null==c?void 0:c.errorInfo})}})}},T=new class{constructor(){this._name="MarkAVChatRoomMember"}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"markGroupMemberList",context:this})}markGroupMemberList(A){return t(this,void 0,void 0,function*(){const e="markGroupMemberList",{groupID:i,markType:o,enableMark:n,userIDList:r=[]}=A,s=this._generateRequestData(A);try{const A=yield function(A,e){return t(this,void 0,void 0,function*(){const{groupID:t,operationType:i,memberList:o}=A,n={GroupId:t,CommandType:i,MemberList:o};return e.common.buildAndSendPacket({servcmd:"group_open_avchatroom_http_svc.modify_user_info",data:n})})}(s,this._core),{MemberList:a=[]}=A||{},{successUserIDList:g,failureUserIDList:c}=this._handleResult(a,r);return{code:0,data:{successUserIDList:g,failureUserIDList:c},successLog:{message:`${this._name}.${e} ok, groupID:${i} markType:${o} enableMark:${n} success:${g.length} fail:${c.length}`}}}catch(a){throw new this._core.helper.ChatError({functionName:e,code:null==a?void 0:a.errorCode,message:null==a?void 0:a.errorInfo})}})}_generateRequestData(A){const{groupID:e,markType:t,enableMark:i,userIDList:o=[]}=A,n=!0===i?1:2,r=[...o];return r.length>500&&console.warn(`${this._name}._generateRequestData, the length of userIDList cannot exceed 500`),{groupID:e,operationType:n,memberList:r.map(A=>({Member_Account:A,Marks:[t]}))}}_handleResult(A,e){const t=[],i=[];return A.length===e.length?(t.push(...e),{successUserIDList:t,failureUserIDList:i}):(e.forEach(e=>{A.find(A=>A.Member_Account===e)?t.push(e):i.push(e)}),{successUserIDList:t,failureUserIDList:i})}},N=new class{init(A,e){A.ssoLog.debug("AVChatRoomAction.init"),v.init(A,e),w.init(A,e),S.init(A,e),M.init(A,e),R.init(A,e),_.init(A,e),T.init(A)}},b=new class{constructor(){this._name="LiveHandler"}init(A){this._core=A;const{helper:e,ssoLog:t}=A;e.registerExperimentalAPI("startMessageLongPolling",this),e.registerExperimentalAPI("stopMessageLongPolling",this),t.debug("LiveHandler.init")}startMessageLongPolling(A){const{common:e,utils:{isEmpty:t},OuterConstant:i,ssoLog:o}=this._core,{groupID:n,longPollingKey:r,longPollingSequence:s=1}=A;if(t(r))return o.warn("startMessageLongPolling",`${this._name}.startMessageLongPolling longPollingKey is empty.`),Promise.resolve({});D.hasPollingInstance(n)&&this.stopMessageLongPolling({groupID:n});const a=D.getJoinedLiveList(),g=e.isUnlimitedAVChatRoom();!g&&a.length>0&&this.stopMessageLongPolling({groupID:a[0].groupID}),o.debug("startMessageLongPolling",`${this._name}.startMessageLongPolling isUnlimited:${g} groupID:${n} longPollingKey:${r} longPollingSequence:${s}`);const c={groupID:n,type:i.GRP_LIVE};return D.updateLocalLiveGroup(n,c),this._getLiveHistoryMessages({groupID:n,longPollingKey:r,startSequence:s}),D.startMessageLongPolling({group:c,longPollingKey:r,startSequence:s})}stopMessageLongPolling(A){const{groupID:e}=A;return D.reset(e),this._core.ssoLog.debug("stopMessageLongPolling",`${this._name}.stopMessageLongPolling ok, groupID:${e}`),Promise.resolve({groupID:e})}_getLiveHistoryMessages(A){return t(this,void 0,void 0,function*(){const{ssoLog:e}=this._core,{groupID:i}=A;try{const o=yield function(A,e){return t(this,void 0,void 0,function*(){const{groupID:t,longPollingKey:i,startSequence:o}=A,n={GroupId:t,LongPollingKey:i,PullPreSeq:o};return e.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_huge_group_msg",data:n})})}(A,this._core),{RspMsgList:n=[]}=o||{};e.debug("_getLiveHistoryMessages",`${this._name}._getLiveHistoryMessages ok, groupID:${i} count:${n.length}`),n.length>0&&D.handleLiveHistoryMessages(i,n)}catch(o){e.debug("_getLiveHistoryMessages",`${this._name}._getLiveHistoryMessages failed, groupID:${i} info:${o.message}`)}})}};return new class{constructor(){this.name="AVChatRoom"}install(e,t){this._core=e,A.init(e),D.init(e,t),N.init(e,t),b.init(e);const{notificationCenter:i,InnerEvent:o}=e,{InnerEventSubType:n}=i;i.subscribeInnerEvent(o.MESSAGE_PUSH,n.GROUP_SYSTEM_NOTIFICATION,this._onAVChatRoomSystemNotification,this),i.subscribeInnerEvent(o.LOGOUT,this._reset,this),i.subscribeInnerEvent(o.DESTROY,this._dispose,this)}_onAVChatRoomSystemNotification(A){D.onAVChatRoomSystemNotification(A)}_reset(){D.reset()}_dispose(){this._reset();const{notificationCenter:A,InnerEvent:e}=this._core,{InnerEventSubType:t}=A;A.unSubscribeInnerEvent(e.MESSAGE_PUSH,t.GROUP_SYSTEM_NOTIFICATION,this._onAVChatRoomSystemNotification,this),A.unSubscribeInnerEvent(e.LOGOUT,this._reset,this),A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this)}}}();const n_=RR(o_.exports);var r_={exports:{}};r_.exports=function(){function A(A,e,t,i){return new(t||(t=Promise))(function(o,n){function r(A){try{a(i.next(A))}catch(e){n(e)}}function s(A){try{a(i.throw(A))}catch(e){n(e)}}function a(A){var e;A.done?o(A.value):(e=A.value,e instanceof t?e:new t(function(A){A(e)})).then(r,s)}a((i=i.apply(A,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const e=new class{init(A){this.core=A}};var t,i,o;(o=t||(t={})).MSG_TEXT="TIMTextElem",o.MSG_CUSTOM="TIMCustomElem",o.MSG_LOCATION="TIMLocationElem",o.MSG_FACE="TIMFaceElem",function(A){A[A.FORWARD=0]="FORWARD",A[A.BACKWARD=1]="BACKWARD"}(i||(i={}));const n="MSG_REACTION",r="MSG_EXT",s=0,a=1,g={ZH_CN:"zh (cmn-Hans-CN)",EN_US:"en-US",YUE_HK:"yue-Hant-HK",JA_JP:"ja-JP",ZH_PY:"zh-PY"},c="16k_zh",l="16k_en",I="16k_yue",u="16k_ja",E="16k_zh-PY",d={[g.ZH_CN]:c,[g.EN_US]:l,[g.YUE_HK]:I,[g.JA_JP]:u,[g.ZH_PY]:E},h=/\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/,C={READ:0,UNREAD:1},B=1,Q=2,p=3,f=1,m=2;var y;!function(A){A.IN="in",A.OUT="out"}(y||(y={}));const D=16,v=17,w=2116,S=2500,M="C2C",R="GROUP",_=20;function T(t){return A(this,void 0,void 0,function*(){var i,o;const{appStore:n,utils:{isEmpty:r},common:{getCurrentUserID:s},notificationCenter:a,OuterEvent:g}=e.core,{messageList:c,conversationID:l}=t,I=n.conversationStore.getConversationMap();let u=null===(i=I.get(l))||void 0===i?void 0:i.peerReadTime;if(!u){const t=l.replace(M,""),i=yield function(t){return A(this,void 0,void 0,function*(){const A={To_Account:t};return e.core.common.buildAndSendPacket({servcmd:"openim.get_peer_read_time",data:A})})}([t]);if(i){const{ReadTime:A}=i;u=null==A?void 0:A[0],I.has(l)&&(I.get(l).peerReadTime=u)}}if(I.has(l)){const A=null===(o=I.get(l))||void 0===o?void 0:o.lastMessage;r(A)||A.fromAccount===s()&&A.lastTime<=u&&!A.isPeerRead&&(A.isPeerRead=!0,n.conversationStore.updateConversation(l,{lastMessage:A}))}const E=[];c.forEach(A=>{A.time<=u&&!A.isPeerRead&&"out"===A.flow&&(A.isPeerRead=!0,E.push(A))}),a.emitOuterEvent(g.MESSAGE_READ_BY_PEER,{name:g.MESSAGE_READ_BY_PEER,data:E})})}function N(t){return A(this,void 0,void 0,function*(){var A;const{message:i,user:o,appStore:n,constants:{OuterConstant:r}}=e.core,s=n.conversationStore.getConversationMap();if(s.has(t)){const i=null===(A=s.get(t))||void 0===A?void 0:A.userProfile;if(i&&t.startsWith(r.CONV_C2C)){const{avatar:A,nick:o}=i;e.core.message.messageDataHandler.updateNickAndAvatarOfSentMessage({conversationID:t,latestAvatar:A,latestNick:o,isSentByMe:!1})}}const{data:a}=(yield o.userProfile.getMyProfile())||{};if(a){const{avatar:A,nick:e}=a;i.messageDataHandler.updateNickAndAvatarOfSentMessage({conversationID:t,latestAvatar:A,latestNick:e,isSentByMe:!0})}})}function b(A){let t;const{message:i}=e.core,{conversationID:o,messageID:n}=A;return t=i.messageDataHandler.getLocalMessageList(o).find(A=>A.ID===n),t||(t=i.messageDataHandler.getSparseMessageList(o).find(A=>A.ID===n)),t}function G(A){return A.map(A=>{const{from:e,to:t,cloudCustomData:i,avatar:o,nick:n,ID:r,clientSequence:s,clientTime:a,messageRandom:g,messageSequence:c,time:l}=A;return{ClientSeq:s,CloudCustomData:i,From_Account:e,From_AccountHeadurl:o,From_AccountNick:n,Id:r,MsgBody:JSON.parse(JSON.stringify(A.transformElementsToServerFormat())),MsgClientTime:a,MsgRandom:g,Random:g,MsgSeq:c,MsgTimeStamp:l,ReceiverId:t,SenderId:e,To_Account:t}})}function k(A){var t;const{From_Account:i,From_AccountHeadurl:o,From_AccountNick:n,GroupId:r,MsgClientTime:s,ClientSeq:a,To_Account:g,MsgTimeStamp:c,TinyId:l,MsgRandom:I,MsgSeq:u}=A;return{from:i,avatar:o,nick:n,clientTime:s,time:c,tinyID:l,random:I,sequence:u,to:g,groupID:r,clientSequence:a,_elements:null===(t=A.MsgBody)||void 0===t?void 0:t.map(A=>{const{MsgType:t}=A;return e.core.message.messageFactory.getElementClass(t).parseServerPushElement(A)})}}var L=new class{constructor(){this._reactionsMap=new Map}init(A){this._core=A;const{helper:e,notificationCenter:t,InnerEvent:{MESSAGE_PUSH:i},InnerEventSubType:{MESSAGE_REACTION_UPDATED:o,MESSAGE_REACTION_UPDATED_SYNC:n}}=A;e.registerApi({apiName:"addMessageReaction",context:this}),e.registerApi({apiName:"removeMessageReaction",context:this}),e.registerApi({apiName:"getMessageReactions",context:this}),e.registerApi({apiName:"getAllUserListOfMessageReaction",context:this}),t.subscribeInnerEvent(i,o,this._handleReactionUpdated,this),t.subscribeInnerEvent(i,n,this._handleReactionSync,this)}addMessageReaction(t,i){return A(this,void 0,void 0,function*(){const{OuterConstant:n,ssoLog:r,helper:s}=this._core;this._validateMessageReactionBusinessCapability();const{conversationID:a,ID:g,conversationType:c,from:l,to:I,clientSequence:u,random:E,time:d,sequence:h}=t,C=`conversationID:${a} messageID:${g} reactionID:${i}`;try{return this._recordMessageReactedByMe(g,i),c===n.CONV_C2C?yield function(t,i){return A(this,void 0,void 0,function*(){var A;const{from:o,to:n,clientSequence:r,random:s,time:a,reactionID:g}=t,c={From_Account:o,To_Account:n,MsgKey:`${r}_${s}_${a}`,Reaction:g,Add_Account:[null===(A=i.store.get("login"))||void 0===A?void 0:A.userId]};return e.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.reaction_add",data:c})})}({from:l,to:I,clientSequence:u,random:E,time:d,reactionID:i},this._core):c===n.CONV_GROUP&&(yield function(t,i){return A(this,void 0,void 0,function*(){var A;const{to:o,reactionID:n,sequence:r}=t,s={GroupId:o,MsgSeq:r,Reaction:n,Add_Account:[null===(A=i.store.get("login"))||void 0===A?void 0:A.userId]};return e.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.group_reaction_add",data:s})})}({to:I,reactionID:i,sequence:h},this._core)),{code:0,successLog:{message:C}}}catch(o){this._removeMyReactionRecord(g,i);const{errorCode:e}=o||{};throw new s.ChatError({functionName:"addMessageReaction",code:e,moreMessage:C})}})}removeMessageReaction(t,i){return A(this,void 0,void 0,function*(){const{OuterConstant:n,helper:r}=this._core;this._validateMessageReactionBusinessCapability();const{conversationID:s,ID:a,conversationType:g,from:c,to:l,clientSequence:I,random:u,time:E,sequence:d}=t,h=`conversationID:${s} messageID:${a} reactionID:${i}`;try{return this._removeMyReactionRecord(a,i),g===n.CONV_C2C?yield function(t,i){return A(this,void 0,void 0,function*(){var A;const{from:o,to:n,clientSequence:r,random:s,time:a,reactionID:g}=t,c={From_Account:o,To_Account:n,MsgKey:`${r}_${s}_${a}`,Reaction:g,Del_Account:[null===(A=i.store.get("login"))||void 0===A?void 0:A.userId]};return e.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.reaction_del",data:c})})}({from:c,to:l,clientSequence:I,random:u,time:E,reactionID:i},this._core):g===n.CONV_GROUP&&(yield function(t,i){return A(this,void 0,void 0,function*(){var A;const{to:o,reactionID:n,sequence:r}=t,s={GroupId:o,MsgSeq:r,Reaction:n,Del_Account:[null===(A=i.store.get("login"))||void 0===A?void 0:A.userId]};return e.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.group_reaction_del",data:s},i)})}({to:l,reactionID:i,sequence:d},this._core)),{code:0,successLog:{message:h}}}catch(o){const{errorCode:e}=o||{};throw new r.ChatError({functionName:"removeMessageReaction",code:e,moreMessage:h})}})}getAllUserListOfMessageReaction(t){return A(this,void 0,void 0,function*(){this._validateMessageReactionBusinessCapability();const{message:i,reactionID:n,nextSeq:r=0}=t,s=t.count>100?100:t.count,{conversationID:a}=i,{ssoLog:g,helper:c,constants:l}=this._core;try{let t=null;if(t=a.startsWith(l.OuterConstant.CONV_C2C)?yield function(t){return A(this,void 0,void 0,function*(){const{message:A,nextSeq:i,reactionID:o,count:n}=t,{from:r,to:s,clientSequence:a,random:g,time:c}=A,l={Reaction:o,NextSeq:i,Count:n,From_Account:r,To_Account:s,MsgKey:`${a}_${g}_${c}`};return e.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.reaction_iterate",data:l})})}({message:i,reactionID:n,nextSeq:r,count:s}):yield function(t){return A(this,void 0,void 0,function*(){const{message:A,nextSeq:i,reactionID:o,count:n}=t,{sequence:r,to:s}=A,a={Reaction:o,NextSeq:i,GroupId:s,Count:n,MsgSeq:r};return e.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.group_reaction_iterate",data:a})})}({message:i,reactionID:n,nextSeq:r,count:s}),t){const{Reaction_Account:A,NextSeq:e}=t;return{code:0,data:{nextSeq:e,isCompleted:0===r,userList:yield this._getUserProfileList(A)}}}}catch(o){const{errorCode:e}=o||{};throw new c.ChatError({functionName:"getAllUserListOfMessageReaction",code:e})}})}getMessageReactions(t){return A(this,void 0,void 0,function*(){const{constants:i}=this._core;this._validateMessageReactionBusinessCapability();const{messageList:o,maxUserCountPerReaction:n=10}=t,r=o[0];let s=null;const a=new Map,{from:g,to:c,conversationType:l}=r,I=this._generateMessageKeyList(o,a);l===i.OuterConstant.CONV_C2C?s=yield function(t){return A(this,void 0,void 0,function*(){const{from:A,to:i,messageKeyList:o,maxUserCountPerReaction:n}=t,r={From_Account:A,To_Account:i,MsgKeyList:o,Count:n};return e.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.reaction_multi_stat",data:r})})}({from:g,to:c,messageKeyList:I,maxUserCountPerReaction:n}):l===i.OuterConstant.CONV_GROUP&&(s=yield function(t){return A(this,void 0,void 0,function*(){const{groupId:A,messageSequenceList:i,maxUserCountPerReaction:o}=t,n={GroupId:A,MsgSeqList:i,Count:o};return e.core.common.buildAndSendPacket({servcmd:"openim_msg_ext_http_svc.group_reaction_multi_stat",data:n})})}({groupId:c,messageSequenceList:I,maxUserCountPerReaction:n}));const{Results:u=[]}=s||{},E=this._extractUserIDsFromReactionResults(u),d=yield this._getUserProfileMap(E);return{code:0,data:{resultList:u.map(A=>{const{ReactionList:e,MsgSeq:t,MsgKey:i}=A;return{messageID:this._generateMessageID({messageSequence:t,messageKey:i,messageIDMap:a}),reactionList:e.map(A=>{const{Reaction:e,Count:t,Reaction_Account:i,ReactedByMe:o}=A;return{reactionID:e,totalUserCount:t,partialUserList:this._generatePartialUserInfo({userIDList:i,userProfileMap:d}),reactedByMyself:1===o}})}})}}})}dispose(){this._reactionsMap.clear()}_extractUserIDsFromReactionResults(A){const e=[];return null==A||A.forEach(A=>{const{ReactionList:t=[]}=A;t.forEach(A=>{A.Reaction_Account&&e.push(...A.Reaction_Account)})}),e}_getUserProfileList(e){return A(this,void 0,void 0,function*(){var A;try{const t=yield null===(A=this._core.user.userProfile)||void 0===A?void 0:A.getUserProfile({userIDList:e});return t?t.data:[]}catch(t){return[]}})}_getUserProfileMap(e){return A(this,void 0,void 0,function*(){const A=new Map;return(yield this._getUserProfileList(e)).forEach(e=>{const{nick:t,avatar:i,userID:o}=e;A.set(o,{nick:t,avatar:i,userID:o})}),A})}_recordMessageReactedByMe(A,e){const t=`${A}-${e}`;this._reactionsMap.has(t)?this._reactionsMap.get(t).reactedByMe=!0:this._reactionsMap.set(t,{reactedByMe:!0})}_removeMyReactionRecord(A,e){const t=`${A}-${e}`;this._reactionsMap.has(t)&&(this._reactionsMap.get(t).reactedByMe=!1)}_recordMessageReactionInfo(A){const{messageID:e,reactionID:t,reactionInfo:i}=A,o=`${e}-${t}`,n=this._reactionsMap.get(o)||{};this._reactionsMap.set(o,Object.assign(Object.assign({},n),i))}_validateMessageReactionBusinessCapability(){const{helper:A,constants:e}=this._core;if(!A.checkBusinessCapabilityBits(n))throw new A.ChatError({functionName:"addMessageReaction",code:e.ERROR_CODE.NO_USE,replacement1:"addMessageReaction"})}_handleReactionUpdated(e){const{MsgReactionNotifyList:t}=e,{notificationCenter:i,constants:o}=this._core;t.forEach(e=>A(this,void 0,void 0,function*(){const{C2CMsgInfo:A,GroupMsgInfo:t,MsgReactionSummary:n}=e,{TinyId:r,MsgClientTime:s,MsgRandom:a}=Object.assign(Object.assign({},A),t),g=`${r}-${s}-${a}`,c=this._extractUserIDsFromReactionResults([{ReactionList:n}]),l=yield this._getUserProfileMap(c),I=n.map(A=>{var e;const{Reaction:t,Reaction_Account:i}=A,o=this._generatePartialUserInfo({userIDList:i,userProfileMap:l}),n=i?A.Count:0,r=(null===(e=this._reactionsMap.get(`${g}-${t}`))||void 0===e?void 0:e.reactedByMe)||!1;return this._recordMessageReactionInfo({messageID:g,reactionID:t,reactionInfo:{reactionID:t,totalUserCount:n,partialUserList:o}}),{reactionID:t,totalUserCount:n,partialUserList:o,reactedByMyself:r}});i.emitOuterEvent(o.OuterEvent.MESSAGE_REACTIONS_UPDATED,{name:o.OuterEvent.MESSAGE_REACTIONS_UPDATED,data:{messageID:g,reactionList:I}})}))}_handleReactionSync(A){var e;const{notificationCenter:t,constants:i}=this._core,{C2CMsgInfo:o={},GroupMsgInfo:n={},Reaction:r,OperateType:s}=A.MsgReactionNotify,{TinyId:a="",MsgClientTime:g=0,MsgRandom:c=0}=Object.assign(Object.assign({},o),n),l=`${a}-${g}-${c}`,I=`${l}-${r}`;if(1===s?this._recordMessageReactedByMe(l,r):this._removeMyReactionRecord(l,r),null===(e=this._reactionsMap.get(I))||void 0===e?void 0:e.reactionID){const A=this._reactionsMap.get(I);A.reactedByMyself=1===s,t.emitOuterEvent(i.OuterEvent.MESSAGE_REACTIONS_UPDATED,{name:i.OuterEvent.MESSAGE_REACTIONS_UPDATED,data:{messageID:l,reactionList:[A]}})}}_generatePartialUserInfo({userIDList:A,userProfileMap:e}){const t=[];return null==A||A.forEach(A=>{e.has(A)&&t.push(e.get(A))}),t}_generateMessageID(A){const{messageSequence:e,messageKey:t,messageIDMap:i}=A;return t?i.get(t):i.get(e)}_generateMessageKeyList(A,e){const{constants:t}=this._core,i=A[0],{conversationType:o}=i;let n=[];return o===t.OuterConstant.CONV_C2C?n=A.map(A=>{const{clientSequence:t,random:i,time:o,ID:n}=A,r=`${t}_${i}_${o}`;return e.set(r,n),r}):o===t.OuterConstant.CONV_GROUP&&(n=A.map(A=>{const{ID:t,sequence:i}=A;return e.set(i,t),i})),n}},U=new class{init(A){this._core=A;const{helper:e,InnerEvent:{MESSAGE_PUSH:t},InnerEventSubType:{C2C_MESSAGE_READ_RECEIPT:i,GROUP_MESSAGE_READ_RECEIPT:o},notificationCenter:n}=A;e.registerApi({apiName:"sendMessageReadReceipt",context:this}),e.registerApi({apiName:"getMessageReadReceiptList",context:this}),e.registerApi({apiName:"getGroupMessageReadMemberList",context:this}),n.subscribeInnerEvent(t,i,this._handleC2CMessageReadReceipt,this),n.subscribeInnerEvent(t,o,this._handleGroupMessageReadReceipt,this)}sendMessageReadReceipt(t){return A(this,void 0,void 0,function*(){const{common:i,constants:n}=this._core,r=this._filterValidMessageSendByOther(t);if(0===r.length)throw new i.ChatError({code:n.ERROR_CODE.READ_RECEIPT_MSG_LIST_EMPTY});try{const{conversationType:t}=r[0];return t===n.OuterConstant.CONV_C2C?yield function(t){return A(this,void 0,void 0,function*(){const{common:A,constants:i}=e.core,o={Peer_Account:t[0].conversationID.replace(i.OuterConstant.CONV_C2C,""),C2CMsgInfo:t.map(A=>{const{from:e,to:t,sequence:i,random:o,time:n,clientTime:r}=A;return{From_Account:e,To_Account:t,MsgSeq:i,MsgRandom:o,MsgTime:n,MsgClientTime:r}})};return A.buildAndSendPacket({servcmd:"openim.c2c_msg_read_receipt",data:o})})}(r):yield function(t){return A(this,void 0,void 0,function*(){const{common:A,constants:i}=e.core,o={GroupId:t[0].conversationID.replace(i.OuterConstant.CONV_GROUP,""),MsgSeqList:t.map(A=>({MsgSeq:A.sequence}))};return A.buildAndSendPacket({servcmd:"group_open_http_svc.group_msg_receipt",data:o})})}(r),{code:0,data:{}}}catch(o){const{errorCode:e,errorInfo:t}=o;throw new i.ChatError({code:e,message:t})}})}getMessageReadReceiptList(t){return A(this,void 0,void 0,function*(){const{common:i,constants:n}=this._core;try{const{conversationType:i}=t[0];if(i===n.OuterConstant.CONV_GROUP){const i=this._filterValidMessageSendByMe(t);if((null==i?void 0:i.length)>0){const o=yield function(t){return A(this,void 0,void 0,function*(){const{common:A,constants:i}=e.core,o={GroupId:t[0].conversationID.replace(i.OuterConstant.CONV_GROUP,""),MsgSeqList:t.map(A=>({MsgSeq:A.sequence}))};return A.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_msg_receipt",data:o})})}(i),{GroupMsgReceiptList:n}=o||{};this._updateGroupMessagesReadReceiptInfo({messageList:t,readReceiptList:n})}}return{code:0,data:{messageList:t}}}catch(o){const{errorCode:e,errorInfo:t}=o;throw new i.ChatError({code:e,message:t})}})}getGroupMessageReadMemberList(t){return A(this,void 0,void 0,function*(){const{constants:i,common:n}=this._core,{message:r,filter:s=C.READ,cursor:a=""}=t,{conversationID:g,sequence:c,ID:l}=r,I=g.replace(i.OuterConstant.CONV_GROUP,""),u=t.count>=100?100:t.count;try{const t=yield function(t){return A(this,void 0,void 0,function*(){const{sequence:A,groupID:i,filter:o,cursor:n,count:r}=t,s={MsgSeq:A,GroupId:i,Filter:o,Cursor:n,Num:r};return e.core.common.buildAndSendPacket({servcmd:"group_open_http_svc.get_group_msg_receipt_detail",data:s})})}({groupID:I,sequence:c,filter:s,cursor:a,count:u});if(t){const{Cursor:A,IsFinish:e,UnreadList:i,ReadList:o}=t,n={cursor:A,isCompleted:1===e,messageID:l,unreadUserIDList:[],readUserIDList:[]};return s===C.READ?n.readUserIDList=o.map(A=>A.Read_Account):s===C.UNREAD&&(n.unreadUserIDList=i.map(A=>A.Unread_Account)),{code:0,data:n}}}catch(o){const{errorCode:e,errorInfo:t}=o;throw new n.ChatError({code:e,message:t})}})}_handleC2CMessageReadReceipt(A){const e=[],{constants:t,helper:i}=this._core,{C2cMsgInfo:o,PeerReadTime:n,Peer_Account:r}=A;if(i.isEmpty(o))return;const s=`${t.OuterConstant.CONV_C2C}${r}`;null==o||o.forEach(A=>{const{TinyId:t,MsgClientTime:i,MsgRandom:o}=A,a=`${t}-${i}-${o}`,g=b({conversationID:s,messageID:a});g&&!g.readReceiptInfo.isPeerRead&&(g.readReceiptInfo.isPeerRead=!0,g.readReceiptInfo.timestamp=n,e.push({userID:r,messageID:a,isPeerRead:!0,timestamp:n}))}),this._emitReadReceiptEventIfNeed(e)}_updateGroupMessagesReadReceiptInfo(A){const{messageList:e,readReceiptList:t}=A,i=new Map;e.forEach(A=>{i.set(A.sequence,A)}),null==t||t.forEach(A=>{if(0===A.Code){const{MsgSeq:e,ReadNum:t,UnreadNum:o}=A,n=i.get(e);n&&(n.readReceiptInfo.readCount=t,n.readReceiptInfo.unreadCount=o)}})}_handleGroupMessageReadReceipt(A){const e=[],{constants:t}=this._core,{GroupTips:i}=A;i.forEach(A=>{const{MsgBody:{GroupMsgReceiptList:i},GroupInfo:{GroupId:o}}=A,n=`${t.OuterConstant.CONV_GROUP}${o}`;null==i||i.forEach(A=>{const{TinyId:t,MsgClientTime:i,MsgRandom:r,ReadNum:s,UnreadNum:a}=A,g=`${t}-${i}-${r}`,c=b({conversationID:n,messageID:g}),l={groupID:o,messageID:g,readCount:0,unreadCount:0};c&&("number"==typeof s&&(c.readReceiptInfo.readCount=s,l.readCount=s),"number"==typeof a&&(c.readReceiptInfo.unreadCount=a,l.unreadCount=a),e.push(l))})}),this._emitReadReceiptEventIfNeed(e)}_emitReadReceiptEventIfNeed(A){const{notificationCenter:e,OuterEvent:t}=this._core;A.length>0&&e.emitOuterEvent(t.MESSAGE_READ_RECEIPT_RECEIVED,{name:t.MESSAGE_READ_RECEIPT_RECEIVED,data:A})}_filterValidMessageSendByOther(A){return this._filterNeedReadReceiptMessages(A).filter(A=>{const{from:e}=A;return e!==this._core.common.getCurrentUserID()})}_filterValidMessageSendByMe(A){const{OuterConstant:e}=this._core.constants;return this._filterNeedReadReceiptMessages(A).filter(A=>{const{from:t,status:i}=A;return t===this._core.common.getCurrentUserID()&&i===e.MessageStatus.SUCCESS})}_filterNeedReadReceiptMessages(A){return A.filter(A=>!0===A.needReadReceipt)}dispose(){const{InnerEvent:{MESSAGE_PUSH:A},InnerEventSubType:{C2C_MESSAGE_READ_RECEIPT:e,GROUP_MESSAGE_READ_RECEIPT:t},notificationCenter:i}=this._core;i.unSubscribeInnerEvent(A,e,this._handleC2CMessageReadReceipt,this),i.unSubscribeInnerEvent(A,t,this._handleGroupMessageReadReceipt,this)}};function F(t,i,o){return A(this,void 0,void 0,function*(){const{common:{buildAndSendPacket:A}}=e.core,{from:n,to:r,clientSequence:s,random:a,time:g}=t;return A({servcmd:"openim_msg_ext_http_svc.set_key_values",data:{From_Account:n,To_Account:r,MsgKey:`${s}_${a}_${g}`,OperateType:o,ExtensionList:i}})})}function O(t,i,o){return A(this,void 0,void 0,function*(){const{common:{buildAndSendPacket:A}}=e.core,{to:n,sequence:r}=t;return A({servcmd:"openim_msg_ext_http_svc.group_set_key_values",data:{GroupId:n,MsgSeq:r,OperateType:o,ExtensionList:i}})})}var x=new class{constructor(){this._messageExtensionsMap=new Map,this._extensionsLatestSequenceMap=new Map,this._completedFetchExtensions=new Set}init(A){this._core=A;const{notificationCenter:e,helper:{registerApi:t},InnerEvent:{MESSAGE_PUSH:i,LOGOUT:o},InnerEventSubType:{MESSAGE_EXTENSIONS_UPDATED:n}}=A;t({apiName:"setMessageExtensions",context:this}),t({apiName:"getMessageExtensions",context:this}),t({apiName:"deleteMessageExtensions",context:this}),e.subscribeInnerEvent(i,n,this._handleMessageExtensionsNotify,this),e.subscribeInnerEvent(o,this.reset,this)}setMessageExtensions(e,t){return A(this,void 0,void 0,function*(){this._validateMessageExtensionBusinessCapability("setMessageExtensions");const{constants:{OuterConstant:A},ssoLog:i}=this._core,{ID:o,conversationID:n,sequence:r,time:s,conversationType:a}=e;let g=t;t.length>20&&(g=t.slice(0,20),i.warn("setMessageExtensions","the length of extensions cannot exceed 20"));const c=this._generateServerExtensions(e,g),l=`convID:${n} messageID:${o} sequence:${r} time:${s} count:${g.length}`;try{let t;if(a===A.CONV_C2C?t=yield F(e,c,B):a===A.CONV_GROUP&&(t=yield O(e,c,B)),t){const{resultList:A,successCount:i,failureCount:o}=this._handleModifyMessageExtensions(e,t);return{code:0,data:{extensions:A},successLog:{message:`${l} successCount:${i} failCount:${o}`}}}return{code:0,data:{extensions:[]}}}catch(I){const{errorCode:A}=I;throw new this._core.helper.ChatError({functionName:"setMessageExtensions",code:A,moreMessage:l})}})}getMessageExtensions(e){return A(this,void 0,void 0,function*(){const{utils:{isUndefined:A}}=this._core;this._validateMessageExtensionBusinessCapability("getMessageExtensions");const{conversationID:t,ID:i,sequence:o,time:n}=e,r=`convID:${t} messageID:${i} sequence:${o} time:${n}`;try{let t;this._completedFetchExtensions.has(i)&&(t=this._extensionsLatestSequenceMap.get(i));const o=yield this._fetchMessageExtensions(e,t);return A(t)&&o.length>1&&this._completedFetchExtensions.add(i),{code:0,data:{extensions:o},successLog:{message:r}}}catch(s){const{errorCode:A,errorInfo:e=""}=s||{};throw new this._core.common.ChatError({code:A,message:e,moreMessage:r})}})}deleteMessageExtensions(e,t){return A(this,void 0,void 0,function*(){this._validateMessageExtensionBusinessCapability("deleteMessageExtensions");const{utils:{isEmpty:A},constants:{OuterConstant:i}}=this._core,{conversationType:o,conversationID:n,sequence:r,ID:s,time:a}=e;let g=p;const c=[];A(t)||(g=Q,null==t||t.forEach(A=>{c.push({key:A,value:"",seq:0})}));const l=`convID:${n} messageID:${s} sequence:${r} time:${a} operateType:${g}`,I=this._generateServerExtensions(e,c);try{let A;if(o===i.CONV_C2C?A=yield F(e,I,g):o===i.CONV_GROUP&&(A=yield O(e,I,g)),A){const{resultList:t,successCount:i,failureCount:o}=this._handleModifyMessageExtensions(e,A);return{code:0,data:{extensions:t},successLog:{message:`${l}successCount:${i} failCount:${o}`}}}return{code:0,data:{extensions:[]}}}catch(u){const{errorCode:A}=u;throw new this._core.helper.ChatError({functionName:"deleteMessageExtensions",code:A,moreMessage:l})}})}reset(){this._messageExtensionsMap.clear(),this._extensionsLatestSequenceMap.clear(),this._completedFetchExtensions.clear()}dispose(){this.reset();const{notificationCenter:A,InnerEvent:{MESSAGE_PUSH:e,LOGOUT:t},InnerEventSubType:{MESSAGE_EXTENSIONS_UPDATED:i}}=this._core;A.unSubscribeInnerEvent(e,i,this._handleMessageExtensionsNotify,this),A.subscribeInnerEvent(t,this.reset,this)}_handleModifyMessageExtensions(A,e){const{ID:t}=A,{Seq:i}=e,o=e.ExtensionList||[],n=[];let r=0,s=0,a=[];return o.forEach(A=>{const{ErrorCode:e,Extension:t}=A,{Key:i,Value:o,Seq:g}=t;n.push({code:e,key:i,value:o}),0===e?r++:s++,a.push({key:i,value:o,seq:g})}),this._extensionsLatestSequenceMap.set(t,i),a.length>0&&this._updateLocalExtensions(A.ID,a),{resultList:n,successCount:r,failureCount:s}}_updateLocalExtensions(A,e){this._messageExtensionsMap.has(A)||this._messageExtensionsMap.set(A,new Map);const t=this._messageExtensionsMap.get(A);null==e||e.forEach(A=>{const{key:e,seq:i,value:o=""}=A;null==t||t.set(e,{value:o,seq:i})})}_fetchMessageExtensions(t,i){return A(this,void 0,void 0,function*(){const{constants:{OuterConstant:A},utils:{isEmpty:o}}=this._core;try{let n;const{conversationType:r,ID:s}=t;if(r===A.CONV_C2C?n=yield function(A,t){const{common:{buildAndSendPacket:i}}=e.core,{from:o,to:n,clientSequence:r,random:s,time:a}=A;return i({servcmd:"openim_msg_ext_http_svc.get_key_values",data:{From_Account:o,To_Account:n,MsgKey:`${r}_${s}_${a}`,StartSeq:t}})}(t,i):r===A.CONV_GROUP&&(n=yield function(A,t){const{common:{buildAndSendPacket:i}}=e.core,{to:o,sequence:n}=A;return i({servcmd:"openim_msg_ext_http_svc.group_get_key_values",data:{GroupId:o,MsgSeq:n,StartSeq:t}})}(t,i)),n){const{LatestSeq:A,ClearSeq:e,CompleteFlag:i}=n,r=(n.ExtensionList||[]).map(A=>({key:A.Key,value:A.Value,seq:A.Seq}));if(this._updateLocalExtensions(s,r),this._clearLocationExtensions(s,e),this._extensionsLatestSequenceMap.set(s,A),1!==i){const A=r[r.length-1].seq+1;return this._fetchMessageExtensions(t,A)}const a=[];if(this._messageExtensionsMap.has(s)){const A=this._messageExtensionsMap.get(s);null==A||A.forEach((A,e)=>{const{value:t}=A;o(t)||a.push({key:e,value:t})})}return a}}catch(n){throw n}})}_clearLocationExtensions(A,e){if(!(e<=0)&&this._messageExtensionsMap.has(A)){const t=this._messageExtensionsMap.get(A);null==t||t.forEach((A,i)=>{A.seq<=e&&t.delete(i)})}}_generateServerExtensions(A,e){const{ID:t}=A;if(this._messageExtensionsMap.has(t)){const A=this._messageExtensionsMap.get(t);return e.map(e=>{var t;const{key:i,value:o}=e;let n=0;return(null==A?void 0:A.has(i))&&(n=null===(t=A.get(i))||void 0===t?void 0:t.seq),{Key:i,Value:o,Seq:n}})}return e.map(A=>({Key:A.key,Value:A.value,Seq:0}))}_validateMessageExtensionBusinessCapability(A){const{helper:e,constants:t}=this._core;if(!e.checkBusinessCapabilityBits(r))throw new e.ChatError({functionName:A,code:t.ERROR_CODE.NO_USE,replacement1:A})}_handleMessageExtensionsNotify(A){const{SetKVInfo:e,DeleteKVInfo:t,ClearKVInfo:i,MsgOptType:o,TinyId:n,MsgLastSeq:r,ExtensionC2cMsgInfo:s,ExtensionGroupMsgInfo:a}=(null==A?void 0:A.MsgExtensionNotify)||{},g=s||a||{},{MsgClientTime:c,MsgRandom:l}=g,I=`${n}-${c}-${l}`;this._extensionsLatestSequenceMap.set(I,r),o===B?this._handleMessageExtensionsUpdated({messageID:I,updateMessageExtensionsInfo:e}):o===Q?this._handleMessageExtensionsDeleted({messageID:I,deleteMessageExtensionsInfo:t}):o===p&&this._handleMessageExtensionsCleared({messageID:I,clearMessageExtensionsInfo:i})}_handleMessageExtensionsUpdated(A){const{notificationCenter:e,OuterEvent:t}=this._core,{messageID:i,updateMessageExtensionsInfo:o=[]}=A,n=[];o.forEach(A=>{const{MsgKeyValue:e=[]}=A,t=e.map(A=>(n.push({key:A.Key,value:A.Value}),{key:A.Key,value:A.Value,seq:A.Seq}));this._updateLocalExtensions(i,t)}),e.emitOuterEvent(t.MESSAGE_EXTENSIONS_UPDATED,{name:t.MESSAGE_EXTENSIONS_UPDATED,data:{messageID:i,extensions:n}})}_handleMessageExtensionsDeleted(A){const{notificationCenter:e,OuterEvent:t}=this._core,{messageID:i,deleteMessageExtensionsInfo:o=[]}=A,n=[];o.forEach(A=>{const{MsgKeyValue:e=[]}=A,t=e.map(A=>(n.push(A.Key),{key:A.Key,seq:A.Seq}));this._updateLocalExtensions(i,t)}),e.emitOuterEvent(t.MESSAGE_EXTENSIONS_DELETED,{name:t.MESSAGE_EXTENSIONS_DELETED,data:{messageID:i,keyList:n}})}_handleMessageExtensionsCleared(A){const{notificationCenter:e,OuterEvent:{MESSAGE_EXTENSIONS_DELETED:t},utils:{isEmpty:i}}=this._core,{messageID:o,clearMessageExtensionsInfo:n=[]}=A,r=[];n.forEach(A=>{const{ClearMsgSeq:e}=A;this._messageExtensionsMap.has(o)&&(this._messageExtensionsMap.get(o)||[]).forEach((A,t)=>{A.seq<=e&&!i(A.value)&&r.push(t)}),this._clearLocationExtensions(o,e)}),e.emitOuterEvent(t,{name:t,data:{messageID:o,keyList:r}})}};const P={key:"message",required:!0,rules:["object"],allowEmpty:!1,customValidator:A=>{const{constants:{OuterConstant:t}}=e.core;return A.status!==t.MessageStatus.SUCCESS?"message is not success":!0===A.isSupportExtension||"message is not support extension"}},Y={setMessageExtensions:[P,{key:"extensions",required:!0,rules:["array"],allowEmpty:!1}],getMessageExtensions:[P],deleteMessageExtensions:[P]},J=Object.assign(Object.assign(Object.assign(Object.assign({deleteMessage:[{required:!0,rules:["array"],allowEmpty:!1}],revokeMessage:[{required:!0,rules:["object"],allowEmpty:!1}],resendMessage:[{key:"message",required:!0,rules:["object"],allowEmpty:!1},{key:"options",required:!1,rules:["object"],allowEmpty:!1}],getMessageList:{conversationID:{required:!0,rules:["string"],allowEmpty:!1},nextReqMessageID:{required:!1,rules:["string"],allowEmpty:!0},count:{required:!1,rules:["number"],allowEmpty:!0}},getMessageListHopping:{conversationID:{required:!0,rules:["string"],allowEmpty:!1},sequence:{required:!1,rules:["number"],allowEmpty:!0},direction:{required:!1,rules:["number"],allowEmpty:!0},count:{required:!1,rules:["number"],allowEmpty:!0}},createTextAtMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1},payload:{required:!0,rules:["object"],allowEmpty:!1,customValidator:A=>{const e="string"==typeof(null==(t=A)?void 0:t.text)&&("string"!=typeof t.text||0!==(null===(i=null==t?void 0:t.text)||void 0===i?void 0:i.length))||"payload.text is invalid.";var t,i;return!0!==e?e:!((null==A?void 0:A.atUserList)&&!Array.isArray(A.atUserList))||"atUserList should be an array or undefind."}}},findMessage:[{required:!0,rules:["string"],allowEmpty:!1}],translateText:{sourceTextList:{required:!0,rules:["array"],allowEmpty:!1},sourceLanguage:{required:!0,rules:["string"],allowEmpty:!1},targetLanguage:{required:!0,rules:["string"],allowEmpty:!1}},createForwardMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1,customValidator:A=>!(!A.startsWith("C2C")&&!A.startsWith("GROUP"))||"conversationType is invalid."},payload:{required:!0,rules:["object"],allowEmpty:!1}},createLocationMessage:{to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1},payload:{required:!0,rules:["object"],allowEmpty:!1,customValidator:A=>{const{utils:{isString:t,isNumber:i}}=e.core;return t(null==A?void 0:A.description)?i(null==A?void 0:A.longitude)?!!i(null==A?void 0:A.latitude)||"payload.latitude must be a number.":"payload.longitude must be a number.":"payload.description must be a string."}}}},{addMessageReaction:[{key:"message",required:!0,rules:["object"],allowEmpty:!1},{key:"reactionID",required:!0,rules:["string"],allowEmpty:!1}],removeMessageReaction:[{key:"message",required:!0,rules:["object"],allowEmpty:!1},{key:"reactionID",required:!0,rules:["string"],allowEmpty:!1}],getMessageReactions:{messageList:{required:!0,rules:["array"],allowEmpty:!1},maxUserCountPerReaction:{required:!1,rules:["number"],allowEmpty:!0,customValidator:A=>"number"!=typeof A?"maxUserCountPerReaction is invalid.":!(A<0||A>10)||"maxUserCountPerReaction should between [0, 10]."}},getAllUserListOfMessageReaction:{message:{required:!0,rules:["object"],allowEmpty:!1,customValidator:A=>"success"===A.status||"message is invalid."},reactionID:{required:!0,rules:["string"],allowEmpty:!1},nextSeq:{required:!1,rules:["number"],allowEmpty:!0},count:{required:!1,rules:["number"],allowEmpty:!0}}}),{sendMessageReadReceipt:[{required:!0,rules:["array"],allowEmpty:!1}],getMessageReadReceiptList:[{required:!0,rules:["array"],allowEmpty:!1}],getGroupMessageReadMemberList:{message:{required:!0,rules:["object"],allowEmpty:!1},filter:{required:!1,rules:["number"],allowEmpty:!0},count:{required:!1,rules:["number"],allowEmpty:!0},cursor:{required:!1,rules:["string"],allowEmpty:!0}}}),Y),{pinGroupMessage:{groupID:{required:!0,rules:["string"],allowEmpty:!1},message:{required:!0,rules:["object"],allowEmpty:!1},isPinned:{required:!0,rules:["boolean"],allowEmpty:!1}},getPinnedGroupMessageList:[{key:"groupID",required:!0,rules:["string"],allowEmpty:!1}]}),H=Object.assign(Object.assign(Object.assign(Object.assign({deleteMessage:!0,revokeMessage:!0,resendMessage:!0,getMessageList:!0,getMessageListHopping:!0,createTextAtMessage:!0,findMessage:!0,translateText:!0,createForwardMessage:!0,createLocationMessage:!0},{addMessageReaction:!0,removeMessageReaction:!0,getMessageReactions:!0,getAllUserListOfMessageReaction:!0}),{sendMessageReadReceipt:!0,getMessageReadReceiptList:!0,getGroupMessageReadMemberList:!0}),{setMessageExtensions:!0,getMessageExtensions:!0,deleteMessageExtensions:!0}),{pinGroupMessage:!0,getPinnedGroupMessageList:!0});class q{constructor(A){this._core=A}deleteMessage(e){return A(this,void 0,void 0,function*(){const{to:A,messageIdentifiers:t}=e,i={From_Account:this._core.common.getCurrentUserID(),To_Account:A,MsgKeyList:t};return this._core.common.buildAndSendPacket({servcmd:"openim.delete_c2c_msg_ramble",data:i})})}revokeMessage(e){return A(this,void 0,void 0,function*(){const{to:A,from:t,sequence:i,time:o,random:n}=e,r={MsgInfo:{From_Account:t,To_Account:A,MsgSeq:i,MsgRandom:n,MsgTimeStamp:o}};return this._core.common.buildAndSendPacket({servcmd:"openim.msgwithdraw",data:r})})}}class V{constructor(A){this._core=A}deleteMessage(e){return A(this,void 0,void 0,function*(){const{to:A,messageIdentifiers:t}=e,i={GroupId:A,Deleter_Account:this._core.common.getCurrentUserID(),Seqs:t};return this._core.common.buildAndSendPacket({servcmd:"group_open_http_svc.delete_group_ramble_msg_by_seq",data:i})})}revokeMessage(e){return A(this,void 0,void 0,function*(){const{to:A,sequence:t}=e,i={GroupId:A,MsgSeqList:[{MsgSeq:t}]};return this._core.common.buildAndSendPacket({servcmd:"group_open_http_svc.group_msg_recall",data:i})})}}class j{constructor(A){this._core=A}generateRevokeMessage(A){const{conversationID:e,sequence:t,random:i,tinyID:o,clientTime:n,revokeReason:r,revoker:s}=A;let a={};const{messageDataHandler:g}=this._core.message;return a=g.revokeMessage({conversationID:e,sequence:t,random:i,revoker:s}),a||(a={conversationID:e,sequence:t},o&&n&&i&&(a.ID=`${o}-${n}-${i}`)),a.revoker=s,a.revokeReason=r,a.revokerInfo={userID:s,nick:"",avatar:""},a}updateRevokerInfo(e){return A(this,void 0,void 0,function*(){const A=e.map(A=>A.revoker);try{const t=yield this._fetchUserInfos(A);t&&e.forEach(A=>{const{revoker:e}=A;t[e]&&(A.revokerInfo.nick=t[e].nick||"",A.revokerInfo.avatar=t[e].avatar||"",A.revokerInfo.userID=e)})}catch(t){console.debug(t)}})}_fetchUserInfos(e){return A(this,void 0,void 0,function*(){var A,t;const i=yield null===(A=this._core.user.userProfile)||void 0===A?void 0:A.getUserProfile({userIDList:e});return(null==i?void 0:i.data)?null===(t=i.data)||void 0===t?void 0:t.reduce((A,{userID:e,nick:t,avatar:i})=>(A[e]={nick:t||"",avatar:i||""},A),{}):null})}}var K=new class{constructor(){this._core=null,this._c2cMessageAction=null,this._groupMessageAction=null}init(A){this._core=A,this._groupMessageAction=new V(A),this._c2cMessageAction=new q(A),this._messageHelper=new j(A);const{helper:e}=A;e.registerApi({apiName:"deleteMessage",context:this}),e.registerApi({apiName:"revokeMessage",context:this}),e.registerApi({apiName:"resendMessage",context:this}),e.registerApi({apiName:"findMessage",context:this})}deleteMessage(e){return A(this,void 0,void 0,function*(){let A=[],t=[];const{conversationID:i,conversationType:o}=e[0],n=i.replace(o,"");if("@TIM#SYSTEM"===o)throw new this._core.helper.ChatError({code:w});if(e.forEach(e=>{const{conversationID:n,conversationType:r,status:s,_onlineOnlyFlag:a,sequence:g,random:c,time:l}=e||{};if("success"===s&&n===i&&r===o){if(!a){const e="C2C"===r?`${g}_${c}_${l}`:String(g);A.push(e)}t.push(e)}}),0===A.length)return this._handleDeleteMessageSuccess(t),{code:0,data:{messageList:t}};A.length>30&&(A=A.slice(0,30),t=t.slice(0,30));try{return"C2C"===o?yield this._c2cMessageAction.deleteMessage({to:n,messageIdentifiers:A}):yield this._groupMessageAction.deleteMessage({to:n,messageIdentifiers:A}),this._handleDeleteMessageSuccess(t),{code:0,data:{messageList:t}}}catch(r){const{errorCode:A}=r;throw new this._core.helper.ChatError({functionName:"deleteMessage",code:A})}})}revokeMessage(e){return A(this,void 0,void 0,function*(){var A;const{conversationType:t,isRevoked:i,ID:o,type:n,from:r,to:s}=e;let a=null;const g=`type:${n} from:${r} to:${s} ID:${o}`;if("@TIM#SYSTEM"===t)throw new this._core.helper.ChatError({message:"system message cannot be revoked"});if(i)throw new this._core.helper.ChatError({message:"message has been revoked",moreMessage:g});try{if(a="C2C"===t?yield this._c2cMessageAction.revokeMessage(e):yield this._groupMessageAction.revokeMessage(e),a){const{RecallRetList:t}=a,i=(null===(A=null==t?void 0:t[0])||void 0===A?void 0:A.RetCode)||0;if(0!==i)throw new this._core.helper.ChatError({code:i,moreMessage:g});return e.isRevoked=!0,yield this._handleRevokeMessageSuccess(e),{code:0,data:{message:e},successLog:{message:g}}}}catch(c){const{errorCode:A}=c;throw new this._core.helper.ChatError({functionName:"revokeMessage",code:A,moreMessage:g})}})}resendMessage(e,t){return A(this,void 0,void 0,function*(){var A,i;return e.isResend=!0,e.status="unSend",null===(i=null===(A=this._core)||void 0===A?void 0:A.apiMap)||void 0===i?void 0:i.sendMessage(e,t)})}findMessage(A){return this._core.message.messageDataHandler.findMessage(A)}_handleDeleteMessageSuccess(A){if(0===A.length)return;const{message:{messageDataHandler:e},common:{isTopic:t},notificationCenter:i,InnerEvent:o}=this._core;A.forEach(A=>{A.isDeleted=!0;const t=e.getLocalMessageList(A.conversationID);null==t||t.forEach(e=>{e.ID===A.ID&&(e.isDeleted=!0)})});const{conversationID:n=""}=A[0];t(n)?i.emitInnerEvent(o.TOPIC_MESSAGE_DELETED,n):i.emitInnerEvent(o.MESSAGE_DELETED,n)}_handleRevokeMessageSuccess(e){return A(this,void 0,void 0,function*(){var A;const t=null===(A=this._core.store.get("login"))||void 0===A?void 0:A.userId,{conversationID:i,sequence:o,random:n}=e;this._core.message.messageDataHandler.revokeMessage({conversationID:i,sequence:o,random:n,revoker:t}),yield this._messageHelper.updateRevokerInfo([e])})}};class W{static parseServerPushElement(A){const{MsgContent:e={}}=A,{Index:t,Data:i}=e;return new W({index:t,data:i})}constructor(A){this.type=t.MSG_FACE;const{index:e,data:i}=A;this.content={index:e,data:i}}validateBeforeSend(){var A,e;return"number"==typeof(null===(A=this.content)||void 0===A?void 0:A.index)&&"string"==typeof(null===(e=this.content)||void 0===e?void 0:e.data)?{isValid:!0}:{isValid:!1,error:{message:"content is invalid"}}}transformToServerFormat(A){const{isMergerMessage:e=!1}=A||{},t=e?this.payload:this.content,{index:i,data:o}=t;return{MsgType:this.type,MsgContent:{Index:i,Data:o}}}}class z{static parseServerPushElement(A){const{MsgContent:e={}}=A,{Desc:t,Longitude:i,Latitude:o}=e;return new z({description:t,longitude:i,latitude:o})}constructor(A){this.type=t.MSG_LOCATION;const{description:e,longitude:i,latitude:o}=A;this.content={description:e,longitude:i,latitude:o}}validateBeforeSend(){return{isValid:!0}}transformToServerFormat(A){const{isMergerMessage:e=!1}=A||{},t=e?this.payload:this.content,{description:i,longitude:o,latitude:n}=t;return{MsgType:this.type,MsgContent:{Desc:i,Longitude:o,Latitude:n}}}}var Z=new class{init(A){this._core=A,A.message.messageFactory.registerElementClass(t.MSG_FACE,W),A.message.messageFactory.registerElementClass(t.MSG_LOCATION,z),A.helper.registerApi({apiName:"createFaceMessage",context:this}),A.helper.registerApi({apiName:"createTextAtMessage",context:this}),A.helper.registerApi({apiName:"createForwardMessage",context:this}),A.helper.registerApi({apiName:"createLocationMessage",context:this})}createFaceMessage(A){if(!A)return null;const{index:e,data:t}=(null==A?void 0:A.payload)||{},i=new W({index:e,data:t}),o=this._core.common.getCurrentUserID(),n=this._core.message.messageFactory.createMessage(Object.assign(Object.assign({},A),{from:o}));return n.setElement(i),n}createTextAtMessage(A){const{atUserList:e}=(null==A?void 0:A.payload)||{},t=this._core.apiMap.createTextMessage(A),{OuterConstant:i}=this._core;if(!t)return null;if(Array.isArray(e)){const A=[],o=[];e.forEach(e=>{e!==i.MSG_AT_ALL?(A.push({GroupAtAllFlag:s,GroupAt_Account:e}),o.push(e)):(A.push({GroupAtAllFlag:a}),o.push(i.MSG_AT_ALL))}),t._groupAtInfoList=A,t.atUserList=o}return t}createForwardMessage(A){const{helper:e,OuterConstant:t}=this._core,{to:i,conversationType:o,priority:n,payload:r,needReadReceipt:s,receiverList:a,cloudCustomData:g="",isSupportExtension:c=!1}=A;if(!Array.isArray(r._elements))throw new e.ChatError({functionName:"createForwardMessage",code:2454});if(r.type===t.MSG_GRP_TIP)throw new e.ChatError({functionName:"createForwardMessage",code:2453});const l=this._core.common.getCurrentUserID(),I=this._core.message.messageFactory.createMessage({to:i,from:l,conversationType:o,isPlaceMessage:0,priority:n,payload:r,needReadReceipt:s,isSupportExtension:c,cloudCustomData:g,receiverList:a});return I.setRelayFlag(!0),I.setElement(r._elements[0]),I}createLocationMessage(A){if(!A)return null;const{description:e,longitude:t,latitude:i}=(null==A?void 0:A.payload)||{},o=new z({description:e,longitude:t,latitude:i}),n=this._core.common.getCurrentUserID(),r=this._core.message.messageFactory.createMessage(Object.assign(Object.assign({},A),{from:n}));return r.setElement(o),r}};class X{init(A){this._messageHelper=new j(A),this._core=A;const{notificationCenter:e,InnerEvent:{MESSAGE_PUSH:t},InnerEventSubType:{C2C_REVOKED_MESSAGE:i},helper:{registerWorkflowStep:o},constants:{WORKFLOW_NAME:n,WORKFLOW_STEP:r}}=A;e.subscribeInnerEvent(t,i,this._handleC2CNotifyMessage,this),o(n.SYNC_SERVER_INFO_AFTER_RE_ONLINE,r.HANDLE_C2C_REVOKED_MESSAGE_FROM_SYNC_UNREAD,this._handleC2CRevokeMessagesFromUnreadMessageSync,this)}_handleC2CNotifyMessage(A){const{C2cNotifyMsgArray:e}=A;null==e||e.forEach(A=>{Object.keys(A).includes("WithdrawC2cMsgNotify")&&this._handleC2CRevokeMessage(A)})}_handleC2CRevokeMessage(e){return A(this,void 0,void 0,function*(){try{const{WithdrawC2cMsgNotify:{C2cWithdrawInfoArray:A}}=e;yield this._parseAndEmitC2CRevokedMessages(A)}catch(o){console.debug(o)}})}_parseAndEmitC2CRevokedMessages(e){return A(this,void 0,void 0,function*(){const A=[],{notificationCenter:t,OuterEvent:i,common:{getCurrentUserID:o}}=this._core;e.forEach(e=>{var t;const{MsgRand:i,MsgSeq:n,To_Account:r,From_Account:s,RevokerInfo:{Revoker_Account:a,Revoke_Reason:g}}=e,c=o()===s?`C2C${r}`:`C2C${s}`,l=(null===(t=null==e?void 0:e.RevokerInfo)||void 0===t?void 0:t.Reason)||g,I=this._messageHelper.generateRevokeMessage({conversationID:c,sequence:n,random:i,revoker:a,revokeReason:l});A.push(I)}),A.length>0&&(yield this._messageHelper.updateRevokerInfo(A),t.emitOuterEvent(i.MESSAGE_REVOKED,{name:i.MESSAGE_REVOKED,data:A}))})}_handleC2CRevokeMessagesFromUnreadMessageSync(e){return A(this,void 0,void 0,function*(){const{revokedMessageList:A}=e.result;yield this._parseAndEmitC2CRevokedMessages(A)})}dispose(){const{notificationCenter:A,InnerEvent:{MESSAGE_PUSH:e},InnerEventSubType:{C2C_REVOKED_MESSAGE:t}}=this._core;A.unSubscribeInnerEvent(e,t,this._handleC2CNotifyMessage,this)}}class ${init(A){this._messageHelper=new j(A),this._core=A;const{notificationCenter:e,InnerEvent:{MESSAGE_PUSH:t},InnerEventSubType:{GROUP_MESSAGE_REVOKED:i}}=A;e.subscribeInnerEvent(t,i,this._handleGroupNotifyMessage,this)}_handleGroupNotifyMessage(A){const{GroupTips:e}=A;null==e||e.forEach(A=>{var e;Array.isArray(null===(e=null==A?void 0:A.MsgBody)||void 0===e?void 0:e.GroupWithdrawInfoArray)&&this._handleGroupRevokeMessage(A)})}_handleGroupRevokeMessage(e){return A(this,void 0,void 0,function*(){try{const{RevokerInfo:A,MsgBody:{GroupWithdrawInfoArray:t},GroupInfo:i}=e,o=[],n=[],{notificationCenter:r,OuterEvent:s,utils:{isEmpty:a},common:{isCommunity:g}}=this._core;let c=!1;i&&(c=g({groupID:i.GroupId})||!a(i.TopicId)),t.forEach(e=>{const{Random:t,MsgSeq:r,GroupId:s,MsgClientTime:a,TinyId:g,TopicId:l,RevokerInfo:{Revoker_Account:I=(null==A?void 0:A.Revoker_Account)||"",Reason:u=(null==A?void 0:A.Reason)||""}}=e,E=l?`GROUP${l}`:`GROUP${s}`,d=this._messageHelper.generateRevokeMessage({conversationID:E,sequence:r,random:t,tinyID:g,clientTime:a,revoker:I,revokeReason:u});c?(d.revokerInfo.nick=i.From_AccountNick,d.revokerInfo.avatar=i.From_AccountHeadurl,o.push(d)):n.push(d)}),n.length>0&&(yield this._messageHelper.updateRevokerInfo(n),o.push(...n)),0!==o.length&&r.emitOuterEvent(s.MESSAGE_REVOKED,{name:s.MESSAGE_REVOKED,data:o})}catch(o){console.debug(o)}})}dispose(){const{notificationCenter:A,InnerEvent:{MESSAGE_PUSH:e},InnerEventSubType:{GROUP_MESSAGE_REVOKED:t}}=this._core;A.unSubscribeInnerEvent(e,t,this._handleGroupNotifyMessage,this)}}var AA=new class{constructor(){this._c2cMessageReceiver=new X,this._groupMessageReceiver=new $}init(A){this._c2cMessageReceiver.init(A),this._groupMessageReceiver.init(A)}dispose(){this._c2cMessageReceiver.dispose(),this._groupMessageReceiver.dispose()}};class eA{constructor(A){this._core=A;const{constants:e}=A;this._messageHelper=new j(A),A.helper.registerWorkflowStep(e.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_RE_ONLINE,e.WORKFLOW_STEP.GROUP_REVOKED_NOTICE_RECOVER,this._recoverGroupRevokeNotice,this)}getRoamingMessagesByAnchor(A){return this._core.message.messageHistory.getGroupRoamingMessagesByAnchor(A)}_recoverGroupRevokeNotice(A){const{recoverRevokeNoticeGroupIDList:e=[]}=A.result,t=this._filterValidGroupIDList(e);if(0===t.length)return;const i=Math.min(Math.ceil(t.length/10),5);Promise.all(Array.from({length:i},(A,e)=>{const i=10*e,o=Math.min(i+10,t.length);return this._fetchGroupRevokeNotice(t.slice(i,o))})).catch(A=>console.error(A))}_fetchGroupRevokeNotice(t){return A(this,void 0,void 0,function*(){var i;try{const o=yield function(t){return A(this,void 0,void 0,function*(){const{appStore:A,constants:{OuterConstant:i},common:o}=e.core,n=A.groupStore.getGroupMap(),r={NotifyReqList:t.map(A=>{const t=n.get(A);return{NotifyType:1,Limit:20,Type:o.isCommunity({type:t.type,groupID:A})?i.GRP_COMMUNITY:void 0,GroupId:A,BeginTime:(null==t?void 0:t._lastRevokedTime)||0,EndTime:1e3*e.core.common.timeManager.getServerTimeMs()}})||[]};return o.buildAndSendPacket({servcmd:"group_open_http_svc.batch_get_group_notify",data:r})})}(t);if(o){const A=[];null===(i=null==o?void 0:o.NotifyRspList)||void 0===i||i.forEach(e=>{const{GroupId:t,NotifyMsgList:i}=e,o=this._parseServerRevokeMessageList({groupID:t,serverRevokeMessageList:i});A.push(...o)}),0!==A.length&&(yield this._emitMessageRevokedEvent(A))}}catch(o){console.error(o)}})}_parseServerRevokeMessageList(A){const{serverRevokeMessageList:e,groupID:t}=A,i=[];return null==e||e.forEach(A=>{const{ClientTime:e,MsgSeq:o,Random:n,RevokerInfo:{Revoker_Account:r="",Reason:s=""}}=A,a=`GROUP${t}`,g=this._messageHelper.generateRevokeMessage({conversationID:a,sequence:o,random:n,clientTime:e,revoker:r,revokeReason:s});i.push(g)}),i}_filterValidGroupIDList(A){const{constants:{OuterConstant:e}}=this._core,t=this._core.appStore.groupStore.getGroupMap();return(null==A?void 0:A.filter(A=>{if(!t.has(A))return!1;const i=t.get(A);return(null==i?void 0:i.type)!==e.GRP_AVCHATROOM&&!(null==i?void 0:i.isSupportTopic)}))||[]}_emitMessageRevokedEvent(e){return A(this,void 0,void 0,function*(){const{notificationCenter:A,OuterEvent:t}=this._core;yield this._messageHelper.updateRevokerInfo(e),A.emitOuterEvent(t.MESSAGE_REVOKED,{name:t.MESSAGE_REVOKED,data:e})})}}class tA{constructor(A){this._historyMessageListFetchAnchors=new Map,this._core=A,this._messageHelper=new j(A)}getRoamingMessagesByAnchor(t){return A(this,void 0,void 0,function*(){var i;try{const{conversationID:o,count:n,messageID:r,time:s,direction:a}=t;let g=s,c="";if(!s){const A=r?this._core.message.messageDataHandler.findMessage(r):null;if(g=(null==A?void 0:A.time)||0,r&&this._historyMessageListFetchAnchors.has(o)){const A=this._historyMessageListFetchAnchors.get(o);g=A.lastMessageTime,c=A.messageKey}}const l=o.replace(M,""),I=yield function(t){return A(this,void 0,void 0,function*(){const{peerAccount:A,count:i,lastMessageTime:o,messageKey:n,direction:r}=t,s={Peer_Account:A,MaxCnt:i,WithRecalledMsg:1,LastMsgTime:o,MsgKey:n,GetDirection:r};return e.core.common.buildAndSendPacket({servcmd:"openim.getroammsg",data:s})})}({count:n,lastMessageTime:g,messageKey:c,peerAccount:l,direction:a});if(I){const{MsgList:A=[],Complete:e,MsgKey:t,LastMsgTime:n}=I;this._historyMessageListFetchAnchors.set(o,{messageKey:t,lastMessageTime:n});const r=[];for(let i=0;i A.isRevoked).length;a=s.length-n.unreadCount-A}else a=s.length-n.unreadCount;for(let e=0;eA.isRevoked);yield this._messageHelper.updateRevokerInfo(c),n&&this._fetchedCompleteConversations.add(A);const l={nextReqMessageID:n?"":String(i),messageList:g,isCompleted:n},I=g.map(A=>A.sequence);return{code:0,data:l,successLog:{message:`conversationID: ${A} nextReqMessageID: ${o} availableLocalMessagesCount: ${r} sequenceList: ${JSON.stringify(I)}`}}}return{code:0,data:{messageList:[],isCompleted:!1,nextReqMessageID:""}}}return{code:0,data:yield this._getMessageListFromMemory({conversationID:A,nextReqMessageID:o,count:n}),successLog:{message:`conversationID: ${A} nextReqMessageID: ${o} availableLocalMessagesCount: ${r}}`}}}catch(o){throw new this._core.helper.ChatError({code:null==o?void 0:o.code})}})}getMessageListHopping(e){return A(this,void 0,void 0,function*(){var A,t;const{conversationID:o,sequence:n,time:r,direction:s=i.FORWARD}=e,{isEmpty:a}=this._core.helper;if(![i.BACKWARD,i.FORWARD].includes(s))throw new this._core.helper.ChatError({message:"direction must be 0 or 1"});let{count:g=_}=e;g=g>_?_:g;let c=null;if(o.startsWith(R)){if(c=yield this._groupMessageHistory.getRoamingMessagesByAnchor({conversationID:o,sequence:n,count:g,direction:s}),c){const{nextReqMessageIDFromServer:e,hasNoMoreHistoryMessage:o,messageList:r,invisibleSequenceList:g}=c;if(this._core.message.messageDataHandler.storeSparseMessageList(r),s===i.FORWARD){const A=o&&e<1;return{code:0,data:{messageList:r,isCompleted:A,nextMessageSeq:A?"":e}}}if(s===i.BACKWARD){if(a(r)&&a(g))return{code:0,data:{messageList:[],isCompleted:!0,nextMessageSeq:""}};const e=(null===(A=null==r?void 0:r[r.length-1])||void 0===A?void 0:A.sequence)||0,i=(null===(t=null==g?void 0:g[g.length-1])||void 0===t?void 0:t.sequence)||0;return{code:0,data:{messageList:r.filter(A=>A.sequence>=n),isCompleted:!o,nextMessageSeq:o?Math.max(e,i)+1:""}}}return{code:0,data:c}}}else if(o.startsWith(M)&&(c=yield this._c2cMessageHistory.getRoamingMessagesByAnchor({conversationID:o,count:g+1,time:r,direction:s}),c)){const{messageList:A,lastMessageTime:e,hasNoMoreHistoryMessage:t}=c;return t||(s===i.FORWARD?A.shift():A.pop()),this._core.message.messageDataHandler.storeSparseMessageList(A),{code:0,data:{messageList:A,isCompleted:t,nextMessageTime:t?"":e}}}})}clearHistoryMessage(t){return A(this,void 0,void 0,function*(){var i;const{appStore:n,common:{ChatError:r,getCurrentUserID:s},OuterConstant:{CONV_C2C:a,CONV_GROUP:g},message:c,apiMap:l}=this._core,I=n.conversationStore.getConversation(t);if(!I)throw new r({code:S});const u={fromAccount:s()},{type:E}=I;E===a?(u.type=f,u.toAccount=t.replace(a,"")):E===g&&(u.type=m,u.toGroupID=t.replace(g,""));try{yield null===(i=null==l?void 0:l.setMessageRead)||void 0===i?void 0:i.call(l,{conversationID:t});const o=yield function(t){return A(this,void 0,void 0,function*(){const{fromAccount:A,type:i,toAccount:o,toGroupID:n}=t,r={From_Account:A,Type:i,To_Account:o,ToGroupid:n};return e.core.common.buildAndSendPacket({servcmd:"recentcontact.clear_msg",data:r})})}(u);return o&&(c.messageDataHandler.deleteConversationMessageList(t),this._clearedConversations.add(t),this._fetchedCompleteConversations.delete(t),this._c2cMessageHistory.clearHistoryMessageListFetchAnchors(t),this._updateConversationLastMessage(t)),{code:0,data:{conversationID:t},successLog:{message:`convID:${t}`}}}catch(o){const{errorCode:e}=o;throw new this._core.helper.ChatError({functionName:"clearHistoryMessage",code:e,moreMessage:`convID:${t}`})}})}_updateConversationLastMessage(A){const{appStore:e}=this._core;e.conversationStore.updateConversation(A,{lastMessage:this._generateLastMessage()},{needSort:!0})}_getAvailableLocalMessagesCount({conversationID:A,nextReqMessageID:e}){const t=this._core.message.messageDataHandler.getLocalMessageList(A),{length:i}=t;if(!e)return i;let o=-1;return(null==A?void 0:A.startsWith(M))?o=t.findIndex(A=>A.ID===e):(null==A?void 0:A.startsWith(R))&&(o=t.findIndex(A=>e.includes("-")?A.ID===e:String(A.sequence)===e)),-1===o?0:o}_needFetchHistoryMessageList({conversationID:A,availableLocalMessagesCount:e,targetCount:t}){return!!this._clearedConversations.has(A)||e A.startsWith(M)?t.ID===e:String(t.sequence)===e),s=a>t?a-t:0,n=a):s=o>t?o-t:0,r.nextReqMessageID=0===s?"":this._generateNextReqMessageID({conversationID:A,targetIndex:s}),r.messageList=i.slice(s,a),r.isCompleted=n<=t,A.startsWith(M)&&(yield N(A),yield T({messageList:r.messageList,conversationID:A})),r})}_generateNextReqMessageID({conversationID:A,targetIndex:e}){const t=this._core.message.messageDataHandler.getLocalMessageList(A);return A.startsWith("C2C")?t[e].ID:String(t[e].sequence)}_generateLastMessage(){return{lastTime:0,lastSequence:0,fromAccount:"",messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}}reset(){this._clearedConversations.clear(),this._fetchedCompleteConversations.clear(),this._c2cMessageHistory.reset()}dispose(){this.reset()}},oA=new class{constructor(){this._core=null}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"translateText",context:this})}translateText(e){return A(this,void 0,void 0,function*(){try{const{sourceLanguage:t,sourceTextList:i,targetLanguage:o}=e,n=yield function(e,t){return A(this,void 0,void 0,function*(){var A,i;const{sourceTextList:o,sourceLanguage:n,targetLanguage:r}=e,{store:s,common:a}=t,g={SourceText:o,Source:n,Target:r,FromAccount:null===(A=s.get("login"))||void 0===A?void 0:A.tinyID,SDKAppID:null===(i=s.get("instance"))||void 0===i?void 0:i.sdkAppId},c=yield a.buildAndSendPacket({servcmd:"im_open_translate.ws_batch_trans_text",data:g});if(c){const{CmdErrorCode:A,TargetText:e}=c;return{cmdErrorCode:A,translatedTextList:e}}})}({sourceLanguage:t,sourceTextList:i,targetLanguage:o},this._core);if(n){const{cmdErrorCode:{ErrorCode:A,ErrorInfo:e},translatedTextList:t}=n;if(0===A)return{code:0,data:{translatedTextList:t}};throw{errorCode:A,errorInfo:e,message:e}}}catch(o){const{errorCode:e,errorInfo:t}=o||{};throw new this._core.helper.ChatError({functionName:"translateText",code:e,message:t})}})}},nA=new class{init(A){this._core=A,A.helper.registerApi({apiName:"convertVoiceToText",context:this})}convertVoiceToText(t){return A(this,void 0,void 0,function*(){var A;const{message:i,language:o=g.ZH_PY}=t;let{url:n}=i.payload||{};const r=this._core.common.getCurrentUserID();i.from===r&&"out"===i.flow&&(n=i.payload.remoteAudioUrl),this._validateVoiceFormat(n);const s=(null===(A=h.exec(n))||void 0===A?void 0:A[1])||"mp3",a=d[o]||E;try{const A=yield function(A){var t;const{store:i,common:o}=e.core,{url:n,format:r,serverLanguageType:s}=A,a={BytesUrl:n,BytesEngServiceType:s,BytesVoiceFormat:r,Uint32Sdkappid:null===(t=i.get("instance"))||void 0===t?void 0:t.sdkAppId,Uint64SourceType:0};return o.buildAndSendPacket({servcmd:"im_open_speech.ws_sentence_recognition",data:a})}({url:n,format:s,serverLanguageType:a});if(A){const{CmdErrorCode:e,BytesResult:t}=A;if(0===e.ErrorCode)return{code:0,data:{result:t}};throw{code:e.ErrorCode,message:e.ErrorInfo}}}catch(c){const{code:A,message:e}=c||{};throw new this._core.common.ChatError({functionName:"convertVoiceToText",code:A,message:e})}})}_validateVoiceFormat(A){if(!h.test(A))throw new this._core.common.ChatError({code:2119})}};class rA{constructor(A){const{constants:t,common:i,utils:o}=e.core,{CONV_C2C:n,CONV_GROUP:r}=t.OuterConstant,{ID:s,tinyID:a,from:g,to:c,clientTime:l=i.timeManager.getServerTimeSeconds()||0,random:I,sequence:u,cloudCustomData:E="",nick:d="",avatar:h="",clientSequence:C,conversationType:B,groupID:Q,_elements:p,time:f}=A;this.ID=s||`${a}-${l}-${I}`,this.messageRandom=I,this.from=g,this.messageSender=g,this.time=f,this.messageSequence=u,this.clientSequence=C||u,this.clientTime=l,this.cloudCustomData=E,this.messageReceiver=c,this.avatar=h,this.nick=d;const m=o.deepCopyWithMethods(p);m.forEach(A=>{A.payload=A.content,delete A.content}),this.messageBody=m,s?B.startsWith(n)?this.receiverUserID=c:B.startsWith(r)&&(this.receiverGroupID=c):Q?(this.receiverGroupID=Q,this.messageReceiver=Q):c&&(this.receiverUserID=c,this.messageReceiver=c)}transformElementsToServerFormat(){return this.messageBody?Array.isArray(this.messageBody)?this.messageBody.map(A=>A.transformToServerFormat({isMergerMessage:!0})):this.messageBody.transformToServerFormat({isMergerMessage:!0}):null}}class sA{static parseServerPushElement(A){const{MsgContent:e}=A,{MsgList:t=[],CompatibleText:i,AbstractList:o,Title:n,PbMsgKey:r,JsonMsgKey:s}=e||{},a=t.map(A=>k(A));return new sA({messageList:a,title:n,abstractList:o,compatibleText:i,pbDownloadKey:r,downloadKey:s})}constructor(A){this.type=e.core.constants.OuterConstant.MSG_MERGER;const{messageList:t,title:i,abstractList:o,compatibleText:n,pbDownloadKey:r="",downloadKey:s="",version:a=0,layersOverLimit:g=!1}=A,c=[];t.forEach(A=>{if(A){const e=new rA(A);c.push(e)}}),this.content={messageList:c,title:i,abstractList:o,compatibleText:n,version:a,downloadKey:s,pbDownloadKey:r,layersOverLimit:g}}validateBeforeSend(){const{isEmpty:A}=e.core.helper;return A(this.content.messageList)?{isValid:!1,error:{message:"content is invalid"}}:{isValid:!0}}transformToServerFormat(A){const{isMergerMessage:e=!1}=A||{},t=e?this.payload:this.content,{abstractList:i,compatibleText:o,downloadKey:n,layersOverLimit:r,pbDownloadKey:s,title:a,version:g,messageList:c}=t;return{MsgType:this.type,MsgContent:{AbstractList:i,CompatibleText:o,JsonMsgKey:n,LayersOverLimit:r,PbMsgKey:s,Title:a,Version:g,MsgList:G(c)}}}}var aA=new class{init(A){this._core=A;const{message:e,helper:t,constants:{OuterConstant:i}}=A;e.messageFactory.registerElementClass(i.MSG_MERGER,sA),t.registerApi({apiName:"createMergerMessage",context:this}),t.registerApi({apiName:"sendMessage",context:this,matcher:A=>A[0].type===i.MSG_MERGER}),t.registerApi({apiName:"downloadMergerMessage",context:this})}createMergerMessage(A){const{common:e}=this._core;if(!A)return null;const t=new sA(A.payload),i=e.getCurrentUserID(),o=this._core.message.messageFactory.createMessage(Object.assign(Object.assign({},A),{from:i}));return o.setRelayFlag(!0),o.setElement(t),o}sendMessage(t,i){return A(this,void 0,void 0,function*(){var n,r,s;try{const a=function(A){let t="utf-8";e.core.helper.IN_BROWSER&&document&&(t=document.charset.toLowerCase());let i,o=0,n=0;if(n=A.length,"utf-8"===t||"utf8"===t)for(let e=0;e 11264){g=this._core.utils.deepCopyWithMethods(t);try{const{JsonMsgKey:t,PbMsgKey:i}=yield function(t){return A(this,void 0,void 0,function*(){const{payload:{messageList:A}}=t,i={MsgList:G(A)};return e.core.common.buildAndSendPacket({servcmd:"im_long_msg.save_relay_json_msg",data:i})})}(g),{payload:o}=g;c=new sA(Object.assign(Object.assign({},o),{messageList:[],downloadKey:t,pbDownloadKey:i})),g.setElement(c)}catch(o){console.error(o)}}const{data:{message:l}}=yield null===(s=null===(r=null===(n=this._core)||void 0===n?void 0:n.message)||void 0===r?void 0:r.messageSender)||void 0===s?void 0:s.sendMessage(g,i);return c&&l.setElement(t._elements),{code:0,data:{message:l}}}catch(o){const{errorCode:e}=o;throw new this._core.helper.ChatError({code:e})}})}downloadMergerMessage(t){return A(this,void 0,void 0,function*(){const{ssoLog:i}=this._core,n=t.payload,{downloadKey:r,pbDownload:s,type:a,messageList:g}=n,c=function(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(A);o {const e=k(A);return new rA(e)});return"function"==typeof t.isOnlineMessage?t.setElement({type:t.type,content:Object.assign({messageList:s},c)}):(t.payload.messageList=s,t.payload.downloadKey="",t.payload.pbDownloadKey=""),i.info("downloadMergerMessage",` success downloadKey:${r}`),t}catch(o){const{errorCode:e}=o;throw new this._core.helper.ChatError({functionName:"downloadMergerMessage",code:e,moreMessage:r})}})}},gA=new class{init(A){this._core=A,this._core.helper.registerExperimentalAPI("sendComboMessage",this)}sendComboMessage(e){return A(this,void 0,void 0,function*(){const{appStore:A,message:t,common:{getCurrentUserID:i},utils:{isArray:o}}=this._core,{GroupId:n,To_Account:r}=e;e.From_Account=e.From_Account||i();let s=null;if(n){s=this._generateGroupMessage(Object.assign(Object.assign({},e),{ToGroupId:n}));const t=A.userStore.getUserProfile(i());s.level=(null==t?void 0:t.level)||0,o(r)&&r.length>0&&(s._receiverList=r)}else r&&(s=this._generateC2CMessage(e));return t.messageSender.sendMessage(s,e)})}_generateC2CMessage(A){const{message:e,OuterConstant:{CONV_C2C:t}}=this._core,i=t,o=e.messageHelper.parseServerPushMessage(A),n=e.messageFactory.createMessage(Object.assign(Object.assign({},o),{conversationType:i,flow:y.OUT})),{elements:r}=o;return n.setElement(r),n}_generateGroupMessage(A){const{message:e,OuterConstant:{CONV_GROUP:t}}=this._core,i=t,o=e.messageHelper.parseServerGroupMessage(A),n=e.messageFactory.createMessage(Object.assign(Object.assign({},o),{conversationType:i,flow:y.OUT})),{elements:r}=o;return n.setElement(r),n}},cA=new class{init(A){this._core=A;const{helper:e,notificationCenter:t,InnerEvent:{MESSAGE_PUSH:i},InnerEventSubType:{GROUP_MESSAGE_PINNED:o}}=A;t.subscribeInnerEvent(i,o,this._handleGroupMessagePinned,this),e.registerApi({apiName:"pinGroupMessage",context:this}),e.registerApi({apiName:"getPinnedGroupMessageList",context:this})}pinGroupMessage(t){return A(this,void 0,void 0,function*(){const{ssoLog:i,common:{isTopic:n},OuterConstant:{GROUP_ID_PREFIX:r},helper:{ChatError:s}}=this._core;let{groupID:a,message:g,isPinned:c}=t;const{sequence:l}=g;try{return yield function(t){return A(this,void 0,void 0,function*(){const{common:{buildAndSendPacket:A,getCurrentUserID:i}}=e.core,{groupID:o,sequence:n,isPinned:r}=t,s=i(),a=r?"group_open_http_svc.pin_message":"group_open_http_svc.unpin_message",g={GroupId:o,MsgSeq:n};return r?g.Pinner_Account=s:g.UnPinner_Account=s,A({servcmd:a,data:g})})}({groupID:a,sequence:l,isPinned:c}),{code:0,data:{}}}catch(o){const{errorCode:e,errorInfo:t}=o||{};throw new s({code:e,message:t})}})}getPinnedGroupMessageList(t){return A(this,void 0,void 0,function*(){let i=[];try{const o=yield function(t){return A(this,void 0,void 0,function*(){const{groupID:A}=t,{common:{buildAndSendPacket:i}}=e.core;return i({servcmd:"group_open_http_svc.get_pinned_messages",data:{GroupId:A}})})}({groupID:t});if(o){const{PinnedMsgList:A=[]}=o;i=yield this._updatePinnedMessageInfo({serverPinnedMessageList:A,groupID:t})}return{code:0,data:{messageList:i}}}catch(o){throw o}})}_handleGroupMessagePinned(A){const{message:{messageHelper:e,messageFactory:t},notificationCenter:i,OuterEvent:o,OuterConstant:n}=this._core;A.GroupTips.forEach(A=>{const{ToGroupId:r,MsgBody:{PinnedMsg:s,OpType:a,MsgOperatorMemberExtraInfo:g,SdkGroupMessageId:c}}=A,{UserId:l,NickName:I="",ImageUrl:u=""}=g;let E=null,d=!1;if(a===D){d=!0;const A=e.parseServerGroupMessage(s);E=t.createMessage(Object.assign(Object.assign({},A),{conversationType:n.CONV_GROUP,flow:"in"})),E.setElement(A.elements),E.pinnerInfo={userID:l,nick:I,avatar:u}}else if(a===v){const{ClientTime:A,Random:e,SenderTinyId:t,ServerTime:i,MsgSeq:o}=c;E={ID:`${t}-${A}-${e}`,sequence:o,random:e,time:i,clientTime:A}}E&&i.emitOuterEvent(o.PINNED_GROUP_MESSAGE_UPDATED,{name:o.PINNED_GROUP_MESSAGE_UPDATED,data:{groupID:r,message:E,isPinned:d,operatorInfo:{userID:l,nick:I,avatar:u}}})})}_findMessageBySequence(A,e){const{message:{messageDataHandler:t}}=this._core;return[...t.getLocalMessageList(A),...t.getSparseMessageList(A)].find(A=>A.sequence===e)}_updatePinnedMessageInfo(e){return A(this,arguments,void 0,function*({serverPinnedMessageList:A,groupID:e}){const{OuterConstant:{CONV_GROUP:t},utils:{isEmpty:i}}=this._core,o=[],n=[],r=[],s=new Map,a=`${t}${e}`;for(let c=0;c {const{sequence:t}=e,i=s.get(t),o=A[i]||{userID:i,nick:"",avatar:""};e.pinnerInfo=o}),o.sort((A,e)=>A.sequence-e.sequence),o}return[]})}_fetchPinnedMessageInfo(e){return A(this,void 0,void 0,function*(){var A,t;const{message:{messageHistory:i},user:{userProfile:o},utils:{isArray:n}}=this._core,{conversationID:r,messageSequenceList:s,pinnerIDList:a}=e,g=yield Promise.all([this._fetchMessageBySequence({conversationID:r,messageSequenceList:s}),null==o?void 0:o.getUserProfile({userIDList:a})]);if(n(g)){const e={};return((null===(A=g[1])||void 0===A?void 0:A.data)||[]).forEach(A=>{const{userID:t,nick:i="",avatar:o=""}=A;e[t]={userID:t,nick:i,avatar:o}}),{messageList:(null===(t=g[0])||void 0===t?void 0:t.messageList)||[],pinnerInfoMap:e}}})}_fetchMessageBySequence(e){return A(this,void 0,void 0,function*(){const{utils:{isEmpty:A},message:{messageHistory:t}}=this._core,{conversationID:i,messageSequenceList:o}=e;return A(o)?[]:t.getGroupRoamingMessagesByAnchor({conversationID:i,messageSequenceList:o,getType:3})})}};return new class{constructor(){this.name="MessageEnhancer"}install(A){this._core=A,e.init(A),K.init(A),Z.init(A),AA.init(A),iA.init(A),L.init(A),oA.init(A),nA.init(A),U.init(A),aA.init(A),x.init(A),gA.init(A),cA.init(A),A.helper.registerValidateConfig({auth:H,params:J}),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.LOGOUT,this._reset,this),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.DESTROY,this.dispose,this)}dispose(){const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.LOGOUT,this._reset,this),A.unSubscribeInnerEvent(e.DESTROY,this.dispose,this),AA.dispose(),iA.dispose(),U.dispose(),x.dispose()}_reset(){iA.reset()}}}();const s_=RR(r_.exports);var a_={exports:{}};a_.exports=function(){function A(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(A);o {const e=this._getResponseBody(E,o,l&&I),i=this._buildResponse(E,e);if(200===E.status)t(null,i);else{if(I&&!u.includes(I))return A.url=this._domainName2IP(u,I),A.uploadByIP=!0,this.request(A,t);t({code:E.status,message:JSON.stringify(E.responseText)},i)}},E.onerror=()=>{const A=this._getResponseBody(E,o,l&&I),e=this._buildResponse(E,A),i={code:E.status,message:0===E.status?"CORS blocked or network error":JSON.stringify(E.responseText)};t(i,e)},A.onProgress&&E.upload&&(E.upload.onprogress=e=>{const{total:t,loaded:i}=e,o=Math.min(Math.floor(100*i/t),100);A.onProgress({total:t,loaded:i,percent:o/100})}),E.send(g),E})}_buildResponse(A,e){const t={};return A.getAllResponseHeaders().trim().split("\n").forEach(A=>{if(A){const[e,i]=A.split(":").map(A=>A.trim());t[e.toLowerCase()]=i}}),{statusCode:A.status,statusMessage:A.statusText,headers:t,data:e}}_getResponseBody(A,e,t){return 200===A.status&&e?{location:e,uploadIP:t}:{response:A.responseText,uploadIP:t}}_queryString(A,e="&",t="="){var i;const{isEmpty:o,isPlainObject:n}=null===(i=this._core)||void 0===i?void 0:i.utils;return o(A)?"":n(A)?Object.keys(A).map(i=>{const o=encodeURIComponent(i)+t;return Array.isArray(A[i])?A[i].map(A=>o+encodeURIComponent(A)).join(e):o+encodeURIComponent(A[i])}).filter(Boolean).join(e):void 0}_domainName2IP(A,e){return A.replace(/^http(s)?:\/\/(.*?)\//,`https://${e}/`)}};const i=["unknown","image","video","audio","log"];var o=new class{init(A){this._core=A}request(e,t){var o;const{MINI_APP_NAMESPACE:n,IN_ALIPAY_MINI_APP:r,isUniIOSApp:s}=null===(o=this._core)||void 0===o?void 0:o.utils,{resources:a="",headers:g={},url:c,downloadUrl:l=""}=e;let I=c,u=null;const E=l?l.match(/^(https?:\/\/[^/]+\/)([^/]*\/?)(.*)$/):null;if(!E)return void console.warn("message Invalid download URL format");const d=decodeURIComponent(E[3]),h=d.includes("?")?d.split("?")[0]:d||"",C={key:e.fileKey||h,success_action_status:200,"Content-Type":""},B={};if(s()){const[A,e]=c.split("?sign=");e&&(I=`${A}?sign=${encodeURIComponent(e)}`,B.sign=decodeURIComponent(e),B.signature=decodeURIComponent(e))}let Q={url:I,header:g,name:"file",filePath:a,formData:Object.assign(Object.assign({},C),B),timeout:e.timeout||3e5};if(r){const t=A(Q,["name"]);Q=Object.assign(Object.assign({},t),{fileName:"file",fileType:e.fileType?i[e.fileType]:"image"})}return u=n.uploadFile(Object.assign(Object.assign({},Q),{success:A=>{this._handleResponse({response:A,downloadUrl:l,callback:t})},fail:A=>{this._handleResponse({response:A,downloadUrl:l,callback:t})}})),u.onProgressUpdate&&u.onProgressUpdate(A=>{e.onProgress&&e.onProgress({total:A.totalBytesExpectedToSend||0,loaded:A.totalBytesSent||0,percent:A.progress?Math.floor(A.progress)/100:0})}),u}_handleResponse(A){const{downloadUrl:e,response:t,callback:i}=A,o={};if(t.header)for(const r in t.header)t.header.hasOwnProperty(r)&&(o[r.toLowerCase()]=t.header[r]);const n=+t.statusCode;200===n?i(null,{statusCode:n,headers:o,data:Object.assign(Object.assign({},t.data),{location:e})}):i({code:n,message:JSON.stringify(t.data)},{statusCode:n,headers:o,data:void 0})}};function n(A){return"file"===(e=A,Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase());var e}function r(A){const e=A||99999999;return Math.round(Math.random()*e)}function s(A,e=!0,t=!0){const i=Date.now();return e?t?i-A+" ms":`${Math.round((i-A)/1e3)} s`:t?i-A:Math.round((i-A)/1e3)}function a(A){return`${Array.from({length:8},()=>Math.floor(65536*(1+Math.random())).toString(16).substring(1)).join("")}-${A}`}function g(A,e){return Math.round(Number(A)*10**e)/10**e}function c(A){return A<=1048576?`${g(A/1024,1)}KB/s`:`${g(A/1048576,1)}MB/s`}const l="TIMImageElem",I="TIMSoundElem",u="TIMFileElem",E="TIMVideoFileElem",d="RichMediaMessagePlugin",h=["rich.my-imcloud.com","imrich.qcloud.com"],C=1,B=2,Q=3,p=255;var f,m;(m=f||(f={})).UNSENT="unSend",m.SUCCESS="success",m.FAIL="fail";const y={wechat:/^(wxfile:\/\/tmp_|http:\/\/temp\/|cloud:\/\/temp-)/,alipay:/^(https:\/\/resource\/|alipayfile:\/\/tmp\/)/,baidu:/^(http:\/\/tmp\/|swanfile:\/\/tmp_)/,bytedance:/^(ttfile:\/\/tmp_|\/(var|tmp)\/|tttemp:\/\/)/,qq:/^(qqfile:\/\/tmp_|http:\/\/qtemp\/)/},D=Symbol("isCustomUpload");var v=new class{init(A){this._core=A}addAuthToUrl(A=""){if(this._isMiniProgramTempFile(A))return A;const e=(t=A)?t.startsWith("https://")?t:t.startsWith("http://")?t.replace("http://","https://"):t:"";var t;return this.processResourceUrl(e)}removeAuthToUrl(A){return function(A,e){const[t,i]=A.split("?");if(!i)return t;const o=i.split("&").reduce((A,t)=>{const[i,o]=t.split("=");return i&&i!==e&&(A[i]=o||""),A},{}),n=Object.keys(o).map(A=>`${A}${o[A]?`=${o[A]}`:""}`).join("&");return n?`${t}?${n}`:t}(A,"authKey")}_isMiniProgramTempFile(A){return!!this.getPlatformFlags().IN_MINI_APP&&Object.values(y).some(e=>e.test(A))}extractFileFromInput(A){const{utils:{isArray:e}}=this._core;return n(A)?A:function(A){if("object"!=typeof A||null===A)return!1;const e=Object.getPrototypeOf(A);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t}(A)&&"undefined"!=typeof uni?e(A.tempFiles)&&A.tempFiles.length>0?A.tempFiles[0]:e(A.files)?A.files[0]:A.tempFile?A.tempFile:null:A instanceof HTMLInputElement&&A.files&&A.files.length>0?A.files[0]:null}probeImageWidthHeight(A){return e(this,void 0,void 0,function*(){var e;const{IN_MINI_APP:t,IN_BROWSER:i}=(null===(e=this._core)||void 0===e?void 0:e.utils)||{};return this._shouldSkipProbing()?{width:0,height:0}:i?this._probeImageDimensionsWeb(A):t?this._probeImageDimensionsMiniApp(A):void 0})}isSimpleCos(){var A;const e=(null===(A=this._core)||void 0===A?void 0:A.store.get("cloudConfig"))||{},{simple_cos:t}=e;return"0"!==t}getFileDNList(){var A;let e=h;const t=(null===(A=this._core)||void 0===A?void 0:A.store.get("cloudConfig"))||{},{file_dn_list:i}=t;if(void 0===i)return e;try{JSON.parse(i).forEach(A=>{e.includes(A)||e.push(A)})}catch(o){console.warn(o),e=h}return e}getPlatform(){var A;return null===(A=this._core)||void 0===A?void 0:A.utils.platform}generateUUID(A,e){var t;let i=`${this.getSDKAppID()}-${this.getCurrentUserID()}-${null===(t=this._core)||void 0===t?void 0:t.utils.randomString()}`;if(e)return`${i}.${e}`;const o=A.name||A.value||A.url||A.tempFilePath,n=o&&o.slice(o.lastIndexOf(".")+1);return n&&(i=`${i}.${n}`),i}processResourceUrl(A){if(!A)return"";let e=A;const t=this.getFileDownloadProxy(),i=this.getAuthKey(),o=this.getFileDNList();return t&&(A.startsWith("http://")?e=A.replace(/^http:\/\/[^/]+/,t):A.startsWith("https://")&&(e=A.replace(/^https:\/\/[^/]+/,t))),i&&-1===e.indexOf("authKey=")&&function(A,e){let t=!1;if(A){const i=A.match(/:\/\/([0-9]?\.)?(.[^/:]+)/),o=i&&i[2]||"";if(o.includes("rich-dev"))return!0;for(let A=0;A -1?`${e}&authKey=${i}`:`${e}?authKey=${i}`),e}getCurrentUserID(){var A,e;return null===(e=null===(A=this._core)||void 0===A?void 0:A.store.get("login"))||void 0===e?void 0:e.userId}getSDKAppID(){var A,e;return null===(e=null===(A=this._core)||void 0===A?void 0:A.store.get("instance"))||void 0===e?void 0:e.sdkAppId}getFileDownloadProxy(){var A,e;return(null===(e=null===(A=this._core)||void 0===A?void 0:A.store.get("instance"))||void 0===e?void 0:e.fileDownloadProxy)||""}getFileUploadProxy(){var A,e;return(null===(e=null===(A=this._core)||void 0===A?void 0:A.store.get("instance"))||void 0===e?void 0:e.fileUploadProxy)||""}getAuthKey(){var A,e;return(null===(e=null===(A=this._core)||void 0===A?void 0:A.store.get("login"))||void 0===e?void 0:e.authKey)||""}isPrivateNetWork(){var A,e;return null===(e=null===(A=this._core)||void 0===A?void 0:A.store.get("instance"))||void 0===e?void 0:e.proxyServer}getPlatformFlags(){var A;const{IN_BROWSER:e,IN_MINI_APP:t,IN_RN_APP:i,IN_UNI_NATIVE_APP:o}=null===(A=this._core)||void 0===A?void 0:A.utils;return{IN_BROWSER:e,IN_MINI_APP:t,IN_RN_APP:i,IN_UNI_NATIVE_APP:o}}isEmpty(A){var e;const{isEmpty:t}=null===(e=this._core)||void 0===e?void 0:e.utils;return t(A)}generateURL(A,e){const{needAddAuthToUrl:t=!0}=e||{};return t?this.addAuthToUrl(A):A}_probeImageDimensionsMiniApp(A){var e;const{MINI_APP_NAMESPACE:t}=(null===(e=this._core)||void 0===e?void 0:e.utils)||{};return new Promise(e=>{t.getImageInfo({src:A,success:A=>e({width:A.width,height:A.height}),fail:()=>e({width:0,height:0})})})}_shouldSkipProbing(){var A;const{IN_RN_APP:e,IS_IE:t,IE_VERSION:i,IN_WX_MINI_GAME:o}=(null===(A=this._core)||void 0===A?void 0:A.utils)||{};return e||t&&9===i||o}_probeImageDimensionsWeb(A){return new Promise(e=>{const t=new Image,i=()=>{t.onload=null,t.onerror=null,t.src=""};t.onload=()=>{e({width:t.width,height:t.height}),i()},t.onerror=()=>{e({width:0,height:0}),i()},t.src=A})}};function w(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var S,M={exports:{}},R=w((S||(S=1,function(A){A.exports=function(A){var e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function t(A,e){var t=A[0],i=A[1],o=A[2],n=A[3];i=((i+=((o=((o+=((n=((n+=((t=((t+=(i&o|~i&n)+e[0]-680876936|0)<<7|t>>>25)+i|0)&i|~t&o)+e[1]-389564586|0)<<12|n>>>20)+t|0)&t|~n&i)+e[2]+606105819|0)<<17|o>>>15)+n|0)&n|~o&t)+e[3]-1044525330|0)<<22|i>>>10)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i&o|~i&n)+e[4]-176418897|0)<<7|t>>>25)+i|0)&i|~t&o)+e[5]+1200080426|0)<<12|n>>>20)+t|0)&t|~n&i)+e[6]-1473231341|0)<<17|o>>>15)+n|0)&n|~o&t)+e[7]-45705983|0)<<22|i>>>10)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i&o|~i&n)+e[8]+1770035416|0)<<7|t>>>25)+i|0)&i|~t&o)+e[9]-1958414417|0)<<12|n>>>20)+t|0)&t|~n&i)+e[10]-42063|0)<<17|o>>>15)+n|0)&n|~o&t)+e[11]-1990404162|0)<<22|i>>>10)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i&o|~i&n)+e[12]+1804603682|0)<<7|t>>>25)+i|0)&i|~t&o)+e[13]-40341101|0)<<12|n>>>20)+t|0)&t|~n&i)+e[14]-1502002290|0)<<17|o>>>15)+n|0)&n|~o&t)+e[15]+1236535329|0)<<22|i>>>10)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i&n|o&~n)+e[1]-165796510|0)<<5|t>>>27)+i|0)&o|i&~o)+e[6]-1069501632|0)<<9|n>>>23)+t|0)&i|t&~i)+e[11]+643717713|0)<<14|o>>>18)+n|0)&t|n&~t)+e[0]-373897302|0)<<20|i>>>12)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i&n|o&~n)+e[5]-701558691|0)<<5|t>>>27)+i|0)&o|i&~o)+e[10]+38016083|0)<<9|n>>>23)+t|0)&i|t&~i)+e[15]-660478335|0)<<14|o>>>18)+n|0)&t|n&~t)+e[4]-405537848|0)<<20|i>>>12)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i&n|o&~n)+e[9]+568446438|0)<<5|t>>>27)+i|0)&o|i&~o)+e[14]-1019803690|0)<<9|n>>>23)+t|0)&i|t&~i)+e[3]-187363961|0)<<14|o>>>18)+n|0)&t|n&~t)+e[8]+1163531501|0)<<20|i>>>12)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i&n|o&~n)+e[13]-1444681467|0)<<5|t>>>27)+i|0)&o|i&~o)+e[2]-51403784|0)<<9|n>>>23)+t|0)&i|t&~i)+e[7]+1735328473|0)<<14|o>>>18)+n|0)&t|n&~t)+e[12]-1926607734|0)<<20|i>>>12)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i^o^n)+e[5]-378558|0)<<4|t>>>28)+i|0)^i^o)+e[8]-2022574463|0)<<11|n>>>21)+t|0)^t^i)+e[11]+1839030562|0)<<16|o>>>16)+n|0)^n^t)+e[14]-35309556|0)<<23|i>>>9)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i^o^n)+e[1]-1530992060|0)<<4|t>>>28)+i|0)^i^o)+e[4]+1272893353|0)<<11|n>>>21)+t|0)^t^i)+e[7]-155497632|0)<<16|o>>>16)+n|0)^n^t)+e[10]-1094730640|0)<<23|i>>>9)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i^o^n)+e[13]+681279174|0)<<4|t>>>28)+i|0)^i^o)+e[0]-358537222|0)<<11|n>>>21)+t|0)^t^i)+e[3]-722521979|0)<<16|o>>>16)+n|0)^n^t)+e[6]+76029189|0)<<23|i>>>9)+o|0,i=((i+=((o=((o+=((n=((n+=((t=((t+=(i^o^n)+e[9]-640364487|0)<<4|t>>>28)+i|0)^i^o)+e[12]-421815835|0)<<11|n>>>21)+t|0)^t^i)+e[15]+530742520|0)<<16|o>>>16)+n|0)^n^t)+e[2]-995338651|0)<<23|i>>>9)+o|0,i=((i+=((n=((n+=(i^((t=((t+=(o^(i|~n))+e[0]-198630844|0)<<6|t>>>26)+i|0)|~o))+e[7]+1126891415|0)<<10|n>>>22)+t|0)^((o=((o+=(t^(n|~i))+e[14]-1416354905|0)<<15|o>>>17)+n|0)|~t))+e[5]-57434055|0)<<21|i>>>11)+o|0,i=((i+=((n=((n+=(i^((t=((t+=(o^(i|~n))+e[12]+1700485571|0)<<6|t>>>26)+i|0)|~o))+e[3]-1894986606|0)<<10|n>>>22)+t|0)^((o=((o+=(t^(n|~i))+e[10]-1051523|0)<<15|o>>>17)+n|0)|~t))+e[1]-2054922799|0)<<21|i>>>11)+o|0,i=((i+=((n=((n+=(i^((t=((t+=(o^(i|~n))+e[8]+1873313359|0)<<6|t>>>26)+i|0)|~o))+e[15]-30611744|0)<<10|n>>>22)+t|0)^((o=((o+=(t^(n|~i))+e[6]-1560198380|0)<<15|o>>>17)+n|0)|~t))+e[13]+1309151649|0)<<21|i>>>11)+o|0,i=((i+=((n=((n+=(i^((t=((t+=(o^(i|~n))+e[4]-145523070|0)<<6|t>>>26)+i|0)|~o))+e[11]-1120210379|0)<<10|n>>>22)+t|0)^((o=((o+=(t^(n|~i))+e[2]+718787259|0)<<15|o>>>17)+n|0)|~t))+e[9]-343485551|0)<<21|i>>>11)+o|0,A[0]=t+A[0]|0,A[1]=i+A[1]|0,A[2]=o+A[2]|0,A[3]=n+A[3]|0}function i(A){var e,t=[];for(e=0;e<64;e+=4)t[e>>2]=A.charCodeAt(e)+(A.charCodeAt(e+1)<<8)+(A.charCodeAt(e+2)<<16)+(A.charCodeAt(e+3)<<24);return t}function o(A){var e,t=[];for(e=0;e<64;e+=4)t[e>>2]=A[e]+(A[e+1]<<8)+(A[e+2]<<16)+(A[e+3]<<24);return t}function n(A){var e,o,n,r,s,a,g=A.length,c=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=g;e+=64)t(c,i(A.substring(e-64,e)));for(o=(A=A.substring(e-64)).length,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;e >2]|=A.charCodeAt(e)<<(e%4<<3);if(n[e>>2]|=128<<(e%4<<3),e>55)for(t(c,n),e=0;e<16;e+=1)n[e]=0;return r=(r=8*g).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(r[2],16),a=parseInt(r[1],16)||0,n[14]=s,n[15]=a,t(c,n),c}function r(A){var e,i,n,r,s,a,g=A.length,c=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=g;e+=64)t(c,o(A.subarray(e-64,e)));for(i=(A=e-64 >2]|=A[e]<<(e%4<<3);if(n[e>>2]|=128<<(e%4<<3),e>55)for(t(c,n),e=0;e<16;e+=1)n[e]=0;return r=(r=8*g).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(r[2],16),a=parseInt(r[1],16)||0,n[14]=s,n[15]=a,t(c,n),c}function s(A){var t,i="";for(t=0;t<4;t+=1)i+=e[A>>8*t+4&15]+e[A>>8*t&15];return i}function a(A){var e;for(e=0;e c?new ArrayBuffer(0):(o=c-g,n=new ArrayBuffer(o),r=new Uint8Array(n),s=new Uint8Array(this,g,o),r.set(s),n)}}(),E.prototype.append=function(A){return this.appendBinary(g(A)),this},E.prototype.appendBinary=function(A){this._buff+=A,this._length+=A.length;var e,o=this._buff.length;for(e=64;e<=o;e+=64)t(this._hash,i(this._buff.substring(e-64,e)));return this._buff=this._buff.substring(e-64),this},E.prototype.end=function(A){var e,t,i=this._buff,o=i.length,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e >2]|=i.charCodeAt(e)<<(e%4<<3);return this._finish(n,o),t=a(this._hash),A&&(t=u(t)),this.reset(),t},E.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},E.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},E.prototype.setState=function(A){return this._buff=A.buff,this._length=A.length,this._hash=A.hash,this},E.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},E.prototype._finish=function(A,e){var i,o,n,r=e;if(A[r>>2]|=128<<(r%4<<3),r>55)for(t(this._hash,A),r=0;r<16;r+=1)A[r]=0;i=(i=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),n=parseInt(i[1],16)||0,A[14]=o,A[15]=n,t(this._hash,A)},E.hash=function(A,e){return E.hashBinary(g(A),e)},E.hashBinary=function(A,e){var t=a(n(A));return e?u(t):t},E.ArrayBuffer=function(){this.reset()},E.ArrayBuffer.prototype.append=function(A){var e,i=I(this._buff.buffer,A),n=i.length;for(this._length+=A.byteLength,e=64;e<=n;e+=64)t(this._hash,o(i.subarray(e-64,e)));return this._buff=e-64 >2]|=i[e]<<(e%4<<3);return this._finish(n,o),t=a(this._hash),A&&(t=u(t)),this.reset(),t},E.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},E.ArrayBuffer.prototype.getState=function(){var A=E.prototype.getState.call(this);return A.buff=l(A.buff),A},E.ArrayBuffer.prototype.setState=function(A){return A.buff=c(A.buff,!0),E.prototype.setState.call(this,A)},E.ArrayBuffer.prototype.destroy=E.prototype.destroy,E.ArrayBuffer.prototype._finish=E.prototype._finish,E.ArrayBuffer.hash=function(A,e){var t=a(r(new Uint8Array(A)));return e?u(t):t},E}()}(M)),M.exports)),_=new class{constructor(){this.uploadFileTryCount=0,this.maxRetries=1,this.systemClockOffset=0,this.httpRequest=null,this.uploadFileType="",this.duration=900,this.fetchCosTryCount=0}init(A){var e;this._core=A;const{IN_MINI_APP:i}=A.utils;this.httpRequest=i?o:t,null===(e=this.httpRequest)||void 0===e||e.init(A)}uploadToCOS(A){return e(this,void 0,void 0,function*(){const e=`${d} uploadToCOS`,{ssoLog:t,utils:{safeStringify:i}}=this._core,{file:o}=A;this.uploadFileType=A.uploadFileType,t.debug("uploadToCOS",`${e} options:${i(A)}`);try{const i=Date.now(),n=yield this._createCosOptions(A),r=n.fileExistsInCOS?{data:{location:n.downloadUrl}}:yield this._uploadFile(n);this._handleUploadError(r,A);const s=this._createUploadResult(o,r),a=Date.now()-i,g=`size:${function(A){const e=1024,t=1048576;return A this._handleUploadProgress(e,A)}}catch(n){throw console.error("Failed to create COS pre-signed URL options:",n),n}})}_prepareUploadParams(A){return e(this,void 0,void 0,function*(){const{ssoLog:e,utils:{safeStringify:t,isEmpty:i}}=this._core;e.debug("_prepareUploadParams",` prepareUploadParams:${t(A)}`);const{file:o}=A,{IN_MINI_APP:n,IN_RN_APP:s}=v.getPlatformFlags(),g=n||s,c=g&&A.message.type!==u,{name:l}=o,I=l.slice(l.lastIndexOf(".")),E=`${r(999999)}${I}`,d=c?o.name:E,h=yield this._generateHashFileName(o);return{fileName:i(h)?a(d):`${h}${I}`,resources:g?o.url:o,uploadMethod:g?1:0}})}_generateHashFileName(A){return e(this,void 0,void 0,function*(){const{utils:{IN_MINI_APP:e,IN_BROWSER:t,IN_UNI_NATIVE_APP:i,isArray:o},ssoLog:n}=this._core,r=Date.now();let s="";return t&&(s=yield this._generateHashFileNameInWeb(A)),e&&(o(A.tempFiles)&&(A=A.tempFiles[0]),i||(s=yield this._generateFileNameInMiniProgram(A)),i&&(s=yield this._generateFileNameInUNINativeApp(A))),n.info("_generateHashFileName",`hashFileName:${s} costTime:${Date.now()-r}`),s})}_generateHashFileNameInWeb(A){return e(this,void 0,void 0,function*(){const{ssoLog:e,utils:{safeStringify:t}}=this._core;let i="";try{i=yield new Promise((t,i)=>{const o=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice;o||(e.warn("_generateHashFileNameInWeb","Browser does not support file slicing"),t(""));const n=10485760,r=Math.ceil(A.size/n);let s=0;const a=new R.ArrayBuffer,g=new FileReader,c=setTimeout(()=>{g.abort(),e.warn("_generateHashFileNameInWeb","File hash generation timeout"),t("")},2e3);function l(){const e=s*n,t=e+n>=A.size?A.size:e+n;g.readAsArrayBuffer(o.call(A,e,t))}g.onload=A=>{e.debug("_generateHashFileNameInWeb",`read chunk nr ${s+1} of ${r}`),a.append(A.target.result),s++,s {clearTimeout(c),i(A)},l()})}catch(o){e.warn("_generateHashFileNameInWeb",t(o))}return i})}_generateFileNameInMiniProgram(A){return e(this,void 0,void 0,function*(){const{utils:{MINI_APP_NAMESPACE:e,safeStringify:t,isEmpty:i},ssoLog:o}=this._core;let n="";if(i(A.url))return o.warn("_generateFileNameInMiniProgram","file.url is empty"),n;if("function"!=typeof(null==e?void 0:e.getFileSystemManager))return o.warn("_generateFileNameInUNINativeApp","getFileSystemManager is not a function"),n;try{n=yield new Promise((t,i)=>{e.getFileSystemManager().getFileInfo({filePath:A.url,success:A=>{t(A.digest)},fail:A=>{i(A)}})})}catch(r){o.warn("_generateFileNameInMiniProgram",t(r))}return n})}_generateFileNameInUNINativeApp(A){return e(this,void 0,void 0,function*(){var e;const{utils:{safeStringify:t,isEmpty:i},ssoLog:o}=this._core;let n="";if(i(A.url))return o.warn("_generateFileNameInUNINativeApp","file.url is empty"),n;if("function"!=typeof(null===(e=null===plus||void 0===plus?void 0:plus.io)||void 0===e?void 0:e.getFileInfo))return o.warn("_generateFileNameInUNINativeApp","plus.io.getFileInfo is not a function"),n;try{n=yield new Promise((e,t)=>{plus.io.getFileInfo({filePath:A.url,success:A=>{e(A.digest)},fail:A=>{t(A)}})})}catch(r){o.warn("_generateFileNameInMiniProgram",t(r))}return n})}_handleUploadProgress(A,e){if("function"==typeof e.onProgress)try{e.onProgress(A.percent)}catch(t){throw console.warn("Upload progress callback error:",t),t}}_fetchCosSignatureUrl(A){return e(this,void 0,void 0,function*(){const{ssoLog:t,utils:{safeStringify:i}}=this._core,o=v.isSimpleCos(),n=this._prepareCosRequestData(A),r=o?"im_cos_msg.simple_sig":"im_cos_msg.pre_sig";try{const A=yield function(A,t,i){return e(this,void 0,void 0,function*(){try{const{helper:e,channel:o}=i,n=e.generateCosSpecifiedData({servcmd:A,data:t}),r=`${n.head.seq}${A}`;return yield o.sendPacket(n,{requestId:r})}catch(e){throw console.warn("getCosSig error:",e),e}})}(r,n,this._core);this.fetchCosTryCount=0;const s=this._processResponse(A);return t.debug("_fetchCosSignatureUrl",` ok. isSimpleCos:${o} data:${i(s)}`),s||{}}catch(s){if(this.fetchCosTryCount<1)return this.fetchCosTryCount++,this._fetchCosSignatureUrl(A);throw this.fetchCosTryCount=0,s}})}_processResponse(A){var e;const t=v.isSimpleCos(),i=t?null===(e=null==A?void 0:A.rpt_pre_sig)||void 0===e?void 0:e[0]:A;if(!i)return{};if(t){const{str_final_ip:A,rpt_pre_sig:e,uint32_file_id:t,uint32_exist_flag:o,str_download_url:n,str_upload_url:r,str_snapshot_url:s,str_file_key:a}=i;return{uploadIP:A,preSig:e,fileID:t,existFlag:o,downloadUrl:n,uploadUrl:r,requestSnapshotUrl:s,fileKey:a}}const{upload_url:o,download_url:n,snapshot_url:r,thumb_url:s,large_url:a,file_key:g}=i;return{uploadUrl:o,downloadUrl:n,requestSnapshotUrl:r,thumbUrl:s,largeUrl:a,fileKey:g}}_prepareCosRequestData(A){return v.isSimpleCos()?{uint32_upload_method:A.uploadMethod,uint32_platform:v.getPlatform(),uint32_sdkappid:v.getSDKAppID(),str_user_id:A.userID,uint32_scene:A.conversationType,rpt_upload_object:[{uint32_file_id:1,uint32_file_type:A.fileType,str_file_name:A.fileName}]}:{file_type:A.fileType,file_name:A.fileName,upload_method:A.uploadMethod,Duration:A.duration}}_uploadFile(A){return e(this,void 0,void 0,function*(){return new Promise((e,t)=>{this.httpRequest.request(A,(i,o)=>{i&&this.uploadFileTryCount =3e4}_syncSystemClock(A){var e,t,i;const o=(null===(e=A.headers)||void 0===e?void 0:e.date)||(null===(t=A.headers)||void 0===t?void 0:t.Date)||(null===(i=A.error)||void 0===i?void 0:i.ServerTime);if(o){const A=Date.now(),e=Date.parse(o);this.systemClockOffset=e-A}}_getRawOrUploadProxyUrl(A){const e=v.getFileUploadProxy();let t=A;return e&&(t=A.replace(/^https:\/\/[^/]+/,e)),t}_isC2CConversation(A){return"C2C"===A.slice(0,3)}};const T=2108,N=2251,b=2252,G=2253,k=["jpg","jpeg","gif","png","bmp","image","webp"],L={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255};class U{constructor(A,e){this.instanceID=r(9999999),this.sizeType=A.type||0,this.type=0,this.size=A.size||0,this.width=A.width||0,this.height=A.height||0,this.imageUrl=v.addAuthToUrl(A.imageUrl||A.url||""),this.url=v.addAuthToUrl(A.url||e)}setSizeType(A){this.sizeType=A}setType(A){this.type=A}setImageUrl(A){A&&(this.imageUrl=v.addAuthToUrl(A))}getImageUrl(){return this.imageUrl}}function F(e){const{originUrl:t,originWidth:i,originHeight:o,min:n=198}=e,r=parseInt(i)||0,s=parseInt(o)||0,a={url:void 0,width:0,height:0};if((r<=s?r:s)<=n)a.url=t,a.width=r,a.height=s;else{s<=r?(a.width=Math.ceil(r*n/s),a.height=n):(a.width=n,a.height=Math.ceil(s*n/r));const A=t&&t.indexOf("?")>-1?`${t}&`:`${t}?`;a.url=198===n?`${A}imageView2/3/w/198/h/198`:`${A}imageView2/3/w/720/h/720`}return void 0===t?A(a,["url"]):a}class O{constructor(A){this._imageMemoryURL="",this._percent=0,this.type=l;const{uuid:e,file:t,imageFormat:i,imageInfoArray:o=[],isCustomUpload:n=!1}=A;this._imageMemoryURL=this.createImageDataAsURL(t),this.content={imageFormat:i,uuid:e,imageInfoArray:[]},this[D]=n,this.initImageInfoArray(o),this.autoFixUrl()}static parseServerPushElement(A){const{MsgContent:e}=A,{ImageFormat:t,ImageInfoArray:i,UUID:o}=e,n=i.map(A=>({size:A.Size,type:A.Type,width:A.Width,height:A.Height,url:A.URL}));return new O({imageFormat:t,imageInfoArray:n,uuid:o})}createImageDataAsURL(A){let e="";const{IN_MINI_APP:t,IN_RN_APP:i,IN_BROWSER:o}=v.getPlatformFlags();return A?((t||i)&&(e=A.url),o&&(e=window.URL.createObjectURL(A)),e):e}initImageInfoArray(A=[]){const e={type:0,size:0,width:0,height:0,url:""};for(let t=0;t<3;t++){const i=A[t]||Object.assign({},e),o=new U(i,this._imageMemoryURL);o.setSizeType(t+1),o.setType(t),this.addImageInfo(o)}this.updateAccessSideImageInfoArray()}autoFixUrl(){const A=["http","https"];this.content.imageInfoArray.forEach(e=>{if(!e.url||""===e.imageUrl)return;const[t,...i]=e.imageUrl.split("://"),o=i.join("://");A.includes(t)||e.setImageUrl(`https://${o}`)})}updatePercent(A){this._percent=Math.min(A,1)}updateImageFormat(A){this.content.imageFormat=L[A.toUpperCase()]||L.UNKNOWN}addImageInfo(A){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(A)}updateImageInfoArray(A){const e=this.content.imageInfoArray.length;let t;for(let i=0;i ({InstanceId:A.instanceID,Type:A.sizeType,MsgType:A.type,Size:A.size,Width:A.width,Height:A.height,URL:v.removeAuthToUrl(A.imageUrl)}))}}var x=new class{constructor(){this._messageOptionsMap=new Map}init(A){var e;this._core=A;const{notificationCenter:t,helper:i,InnerEvent:o,message:n}=A;i.registerApi({apiName:"createImageMessage",context:this}),i.registerExperimentalAPI("createImageMessage",this,"createCustomUploadImageMessage"),null===(e=null==n?void 0:n.messageFactory)||void 0===e||e.registerElementClass(l,O),t.subscribeInnerEvent(o.DESTROY,this._dispose,this)}createImageMessage(A){var e,t,i;try{const o=null===(e=this._core.store.get("login"))||void 0===e?void 0:e.userId,n=null===(i=null===(t=this._core)||void 0===t?void 0:t.message.messageFactory)||void 0===i?void 0:i.createMessage(Object.assign(Object.assign({},A),{from:o})),r=this._processImage(A);A.payload.file=r;const s={imageFormat:L.UNKNOWN,uuid:v.generateUUID(r),file:r,imageInfoArray:[]},a=new O(s);return n.setElement(a),this._messageOptionsMap.set(n.clientSequence,A),n}catch(o){throw o}}createCustomUploadImageMessage(A){var e,t,i,o;const{store:n,utils:{isEmpty:r}}=this._core,s=null===(e=n.get("login"))||void 0===e?void 0:e.userId,a=null===(i=null===(t=this._core)||void 0===t?void 0:t.message.messageFactory)||void 0===i?void 0:i.createMessage(Object.assign(Object.assign({},A),{from:s})),{largeImageUuid:g,largeFileSize:c,largeImageWidth:l,largeImageHeight:I,largeImageUrl:u,originImageUuid:E,originFileSize:d,originImageWidth:h,originImageHeight:C,originImageUrl:B,thumbImageUuid:Q,thumbFileSize:p,thumbImageWidth:f,thumbImageHeight:m,thumbImageUrl:y}=(null===(o=null==A?void 0:A.payload)||void 0===o?void 0:o.file)||{};if(r(B)||r(E))throw new Error("createImageMessageExperimental originImageUrl or originImageUuid is empty");const D=new O({imageFormat:L.UNKNOWN,uuid:E,imageInfoArray:[{instanceID:E,size:d,width:h,height:C,imageUrl:B,url:B},{instanceID:g,size:c,width:l,height:I,imageUrl:u,url:u},{instanceID:Q,size:p,width:f,height:m,imageUrl:y,url:y}],isCustomUpload:!0});return a.setElement(D),this._messageOptionsMap.set(a.clientSequence,A),a._skipUpload=!0,a}upload(A){return e(this,void 0,void 0,function*(){const e=A.getElements()[0],{file:t}=this._messageOptionsMap.get(A.clientSequence).payload;this._validateBeforeUploadImage(t);const i=yield this._performImageUpload(e,A,t),o=this._generateImageInfo(i);return e.updateImageFormat(null==i?void 0:i.fileType),e.updateImageInfoArray(o),A})}_performImageUpload(A,t,i){return e(this,void 0,void 0,function*(){const{to:e}=t,o={uploadFileType:C,file:i,to:e,message:t,onProgress:e=>{var i,o;A.updatePercent(e),null===(o=null===(i=this._messageOptionsMap.get(t.clientSequence))||void 0===i?void 0:i.onProgress)||void 0===o||o.call(i,e)}},{uploadOptions:n,response:r}=yield _.uploadToCOS(o);return this._parseResponse(n,r)})}_generateImageInfo(A){const{location:e,fileSize:t,width:i,height:o,smallImageUrl:n,smallImageWidth:r,smallImageHeight:s,largeImageUrl:a,largeImageWidth:g,largeImageHeight:c,imageInfoArray:l}=A,I=v.addAuthToUrl(e),u={size:t,url:I,width:i,height:o};return(null==l?void 0:l.length)>0?this._processImageInfoArray(l,t):n&&a?[Object.assign({},u),{largeImageUrl:a,largeImageWidth:g,largeImageHeight:c},{smallImageUrl:n,smallImageWidth:r,smallImageHeight:s}]:[Object.assign({},u),this._generateThumbInfo(I,i,o,720),this._generateThumbInfo(I,i,o,198)]}_generateThumbInfo(A,e,t,i){return F({originUrl:A,originWidth:e,originHeight:t,min:i})}_processImageInfoArray(A,e){let t,i,o;for(const n of A)1===n.type?(i=n,i.size=e):2===n.type?(o=n,o.size=e):(t=n,t.size=e);return[Object.assign({},t),Object.assign({},o),Object.assign({},i)]}_parseResponse(A,t){return e(this,void 0,void 0,function*(){try{const{thumbUrl:e,largeUrl:i,downloadUrl:o}=A;if(e&&i&&(yield this._getImageInfoByUrl(e,t,"thumb"),yield this._getImageInfoByUrl(i,t,"large")),v.isSimpleCos()&&!v.isPrivateNetWork()&&(yield this._getImageInfoArray(o,t),null==t?void 0:t.uploadIP)){const A=this._extractDomainFromUrl(o);A&&(yield this._getDownloadIP(A,t))}return t}catch(e){throw e}})}_extractDomainFromUrl(A){var e;try{const e=A.match(/:\/\/([^\/]+)/);return e?e[1]:null}catch(t){return null===(e=this._core)||void 0===e||e.ssoLog.warn("_extractDomainFromUrl",`Failed to extract domain from URL:${t.message}`),null}}_getImageInfoByUrl(A,t,i){return e(this,void 0,void 0,function*(){var e;try{const e=v.addAuthToUrl(A),{width:o=0,height:n=0}=yield v.probeImageWidthHeight(e);t.width=o,t.height=n,"thumb"===i?(t.smallImageUrl=A,t.smallImageWidth=o,t.smallImageHeight=n):(t.largeImageUrl=A,t.largeImageWidth=o,t.largeImageHeight=n)}catch(o){null===(e=this._core)||void 0===e||e.ssoLog.warn("_getImageInfoByUrl",`Failed to get ${i} image info:${o.message}`)}})}_validateBeforeUploadImage(A){var e;const{ChatError:t}=null===(e=this._core)||void 0===e?void 0:e.helper;if(!A)throw new t({code:N});this._checkImageType(A),this._checkImageSize(A)}_processImage(A){var e;try{const{IN_MINI_APP:t}=null===(e=this._core)||void 0===e?void 0:e.utils;let{file:i}=A.payload;return i=t?this._processMiniAppImageFile(i):this._processWebImageFile(i),i}catch(t){throw t}}_processMiniAppImageFile(A){n(A)&&console.warn("FileUnsupportedInMiniApp","createImageMessage");const e=A.tempFiles[0].path||A.tempFiles[0].tempFilePath;return{url:e,name:e.slice(e.lastIndexOf("/")+1),size:A.tempFiles&&A.tempFiles[0].size||1,type:e.slice(e.lastIndexOf(".")+1).toLowerCase()}}_processWebImageFile(A){var e;const{ChatError:t}=null===(e=this._core)||void 0===e?void 0:e.helper,i=v.extractFileFromInput(A);if(!i)throw new t({message:"Invalid file. Pass either `e.target` (from file input) or a File object"});return i}_getDownloadIP(A,t){return e(this,void 0,void 0,function*(){const i=`${d} getDownloadIP domainName: ${A}`;try{const o=yield function(A,t){return e(this,void 0,void 0,function*(){try{const{helper:e,channel:i}=t,o="im_cos_msg.get_final_ip",n={str_domain:A},r=e.generateProtocolData({servcmd:o,data:n}),s=`${r.head.seq}${o}`;return yield i.sendPacket(r,{requestId:s})}catch(e){throw console.warn("getFinalIP error:",e),e}})}(A,this._core);if(!o||!o.str_final_ip)return;console.log(`${i} ok. downloadIP:${o}`);const n=t.location.split("/");n[0]=o.str_final_ip,t.location=n.join("/")}catch(o){console.warn(o)}})}_getImageInfoArray(A,t){return e(this,void 0,void 0,function*(){try{const i=yield function(A,t){return e(this,void 0,void 0,function*(){try{const{helper:e,channel:i}=t,o="im_cos_msg.get_imageinfo",n={str_image_url:A},r=e.generateProtocolData({servcmd:o,data:n}),s=`${r.head.seq}${o}`;return yield i.sendPacket(r,{requestId:s})}catch(e){throw console.warn("getImageInfo error:",e),e}})}(A,this._core);return t.imageInfoArray=this._processImageInfoResponse(i),t}catch(i){throw t.imageInfoArray=void 0,i}})}_processImageInfoResponse(A){if(!A)return[];const{rpt_msg_image_info:e}=A;return e.map(A=>({type:A.uint32_image_type,url:A.str_url,width:A.uint32_width,height:A.uint32_height,imageFormat:A.str_image_format}))}_checkImageType(A){const{utils:e,helper:t}=this._core;let i="";if(e.IN_MINI_APP&&(i=A.url.slice(A.url.lastIndexOf(".")+1)),e.IN_BROWSER&&(i=A.name.slice(A.name.lastIndexOf(".")+1)),k.indexOf(i.toLowerCase())<0)throw new t.ChatError({code:b})}_checkImageSize(A){const{utils:e,helper:t}=this._core;let i=0;if(e.IN_MINI_APP,i=A.size,0===i)throw new t.ChatError({code:T});if(i>=20971520)throw new t.ChatError({code:G})}_reset(){this._messageOptionsMap.clear()}_dispose(){this._reset();const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this)}};const P=2108,Y=2401,J=2402,H="2.5.0",q="1.18.0";function V(A,e){const t=A.split("."),i=e.split("."),o=Math.max(t.length,i.length);for(;t.length e)return 1;if(A 0;return{isValid:A,error:A?null:{message:"content can not be empty"}}}transformToServerFormat(A){const{isMergerMessage:e=!1}=A||{},t=e?this.payload:this.content,{uuid:i,downloadFlag:o,fileUrl:n,fileName:r,fileSize:s}=t;return{MsgType:this.type,MsgContent:{Download_Flag:o,Url:v.removeAuthToUrl(n),FileName:r,FileSize:s,UUID:i}}}_getFileInfo(A){const{utils:{IN_UNI_NATIVE_APP:e}}=j.core;if(A.fileName&&A.fileSize)return{size:A.fileSize,name:A.fileName};const{file:t}=A;return t?(e&&this._processNativeAppFile(t),{size:t.size,name:t.name}):{size:0,name:""}}_processNativeAppFile(A){if(A.path&&A.path.includes(".")){const e=A.path.slice(A.path.lastIndexOf(".")+1).toLowerCase();A.type=e,A.name||(A.name=`${r(999999)}.${e}`)}A.name||(A.type="",A.name=A.path.slice(A.path.lastIndexOf("/")+1).toLowerCase()),A.suffix&&(A.type=A.suffix),A.url||(A.url=A.path)}}K=D;var z=new class{constructor(){this._messageOptionsMap=new Map}init(A){var e;this._core=A;const{notificationCenter:t,helper:i,InnerEvent:o,message:n}=A;i.registerApi({apiName:"createFileMessage",context:this}),i.registerExperimentalAPI("createFileMessage",this,"createCustomUploadFileMessage"),null===(e=null==n?void 0:n.messageFactory)||void 0===e||e.registerElementClass(u,W),t.subscribeInnerEvent(o.DESTROY,this._dispose,this)}createFileMessage(A){var e,t,i;try{this._checkVersion();const o=this._processFile(A.payload.file);A.payload.file=o;const n=null===(e=this._core.store.get("login"))||void 0===e?void 0:e.userId,r=null===(i=null===(t=this._core)||void 0===t?void 0:t.message.messageFactory)||void 0===i?void 0:i.createMessage(Object.assign(Object.assign({},A),{from:n})),s={uuid:v.generateUUID(o),file:o},a=new W(s);return r.setElement(a),this._messageOptionsMap.set(r.clientSequence,A),r}catch(o){throw o}}createCustomUploadFileMessage(A){var e,t,i;try{const{store:o,message:n,utils:{isEmpty:r}}=this._core,s=null===(e=o.get("login"))||void 0===e?void 0:e.userId,{url:a,uuid:g,fileSize:c,fileName:l=""}=(null===(t=null==A?void 0:A.payload)||void 0===t?void 0:t.file)||{};if(r(a))throw new Error("url is required");const I=null===(i=n.messageFactory)||void 0===i?void 0:i.createMessage(Object.assign(Object.assign({},A),{from:s})),u=new W({url:a,uuid:g,file:{size:c,name:l},isCustomUpload:!0});return I.setElement(u),I}catch(o){throw o}}upload(A){return e(this,void 0,void 0,function*(){const{file:e}=this._messageOptionsMap.get(A.clientSequence).payload;this._validateBeforeUploadFile(e);const t=A.getElements()[0],i=yield this._performFileUpload(t,A,e),o=v.addAuthToUrl(null==i?void 0:i.location);return t.updateFileUrl(o),A})}_validateBeforeUploadFile(A){var e;const{ChatError:t}=null===(e=this._core)||void 0===e?void 0:e.helper;if(!A)throw new t({code:Y});if(A.size>104857600)throw new t({code:J});if(0===A.size)throw new t({code:P})}_performFileUpload(A,t,i){return e(this,void 0,void 0,function*(){const{to:e}=t,o={uploadFileType:p,file:i,to:e,message:t,onProgress:e=>{var i,o;A.updatePercent(e),null===(o=null===(i=this._messageOptionsMap.get(t.clientSequence))||void 0===i?void 0:i.onProgress)||void 0===o||o.call(i,e)}},{response:n}=yield _.uploadToCOS(o);return n})}_processFile(A){var e,t;const{IN_BROWSER:i,IN_RN_APP:o,IN_WX_MINI_APP:n,IN_QQ_MINI_APP:r,IN_UNI_NATIVE_APP:s}=null===(e=this._core)||void 0===e?void 0:e.utils,{ChatError:a}=null===(t=this._core)||void 0===t?void 0:t.helper;if(i||s){const e=v.extractFileFromInput(A);if(!e)throw new a({message:"Invalid file. Pass either `e.target` (from file input) or a File object"});return e}if(n||r){const{tempFiles:e}=A;return Object.assign(Object.assign({},e[0]),{url:e[0].path})}return o?Object.assign(Object.assign({},A),{url:A.uri}):A}_checkVersion(){var A,e;const{MINI_APP_NAMESPACE:t,IN_MINI_APP:i,IN_WX_MINI_APP:o,IN_QQ_MINI_APP:n,IN_UNI_NATIVE_APP:r}=null===(A=this._core)||void 0===A?void 0:A.utils,{ChatError:s}=null===(e=this._core)||void 0===e?void 0:e.helper;if(i){if(!(o||n||r))throw new s({message:"Unsupported mini app environment"});const A=t.getSystemInfoSync().SDKVersion;if(o&&V(A,H)<0)throw new s({message:`WXChooseMessageFile requires SDK version ${H} or higher`});if(n&&V(A,q)<0)throw new s({message:`QQChooseMessageFile requires SDK version ${q} or higher`})}}_reset(){this._messageOptionsMap.clear()}_dispose(){this._reset();const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this)}};const Z=2108,X=2351,$=2352,AA=["mp4","quicktime","mov"];var eA;class tA{constructor(A){this.type=E,this.uploadProgress=0,this[eA]=!1;const e="number"==typeof(null==A?void 0:A.videoSecond)?null==A?void 0:A.videoSecond:0;this[D]=A.isCustomUpload||!1,this.content={remoteVideoUrl:v.addAuthToUrl(A.remoteVideoUrl||A.videoUrl||""),videoFormat:A.videoFormat,videoSecond:parseInt(null==e?void 0:e.toString(),10),videoSize:A.videoSize,videoUrl:v.addAuthToUrl(A.videoUrl),videoDownloadFlag:2,videoUUID:A.videoUUID,thumbUUID:A.thumbUUID,thumbFormat:A.thumbFormat,thumbWidth:A.thumbWidth,snapshotWidth:A.thumbWidth,thumbHeight:A.thumbHeight,snapshotHeight:A.thumbHeight,thumbSize:A.thumbSize,snapshotSize:A.thumbSize,thumbDownloadFlag:2,thumbUrl:v.addAuthToUrl(A.thumbUrl),snapshotUrl:v.addAuthToUrl(A.thumbUrl)}}static parseServerPushElement(A){const{MsgContent:e}=A,{VideoUrl:t,VideoFormat:i,VideoSecond:o,VideoSize:n,VideoDownloadFlag:r,VideoUUID:s,ThumbUUID:a,ThumbFormat:g,ThumbWidth:c,SnapshotWidth:l,ThumbHeight:I,SnapshotHeight:u,ThumbSize:E,SnapshotSize:d,ThumbDownloadFlag:h,ThumbUrl:C,SnapshotUrl:B}=e;return new tA({videoUrl:t,videoFormat:i,videoSecond:o,videoSize:n,videoDownloadFlag:r,videoUUID:s,thumbUUID:a,thumbFormat:g,thumbWidth:c,snapshotWidth:l,thumbHeight:I,snapshotHeight:u,thumbSize:E,snapshotSize:d,thumbDownloadFlag:h,thumbUrl:C,snapshotUrl:B})}updatePercent(A){this.uploadProgress=Math.min(A,1)}updateVideoUrl(A){A&&(this.content.remoteVideoUrl=A)}updateSnapshotInfo(A){const{snapshotUrl:e,snapshotWidth:t,snapshotHeight:i}=A;v.isEmpty(e)||(this.content.thumbUrl=this.content.snapshotUrl=e),v.isEmpty(t)||(this.content.thumbWidth=this.content.snapshotWidth=Number(t)),v.isEmpty(i)||(this.content.thumbHeight=this.content.snapshotHeight=Number(i))}validateBeforeSend(){if(this[D])return{isValid:!0};const A=""!==this.content.remoteVideoUrl;return{isValid:A,error:A?null:{message:"content can not be empty"}}}transformToServerFormat(A){const{isMergerMessage:e=!1}=A||{},t=e?this.payload:this.content,{remoteVideoUrl:i,videoFormat:o,videoSecond:n,videoSize:r,videoDownloadFlag:s,videoUUID:a,thumbUUID:g,thumbFormat:c,thumbWidth:l,snapshotWidth:I,thumbHeight:u,snapshotHeight:E,thumbSize:d,snapshotSize:h,thumbDownloadFlag:C,thumbUrl:B,snapshotUrl:Q}=t;return{MsgType:this.type,MsgContent:{VideoUrl:v.removeAuthToUrl(i),VideoFormat:o,VideoSecond:n,VideoSize:r,VideoDownloadFlag:s,VideoUUID:a,ThumbUUID:g,ThumbFormat:c,ThumbWidth:l,SnapshotWidth:I,ThumbHeight:u,SnapshotHeight:E,ThumbSize:d,SnapshotSize:h,ThumbDownloadFlag:C,ThumbUrl:v.removeAuthToUrl(B),SnapshotUrl:v.removeAuthToUrl(Q)}}}}eA=D;var iA,oA=new class{constructor(){this._messageOptionsMap=new Map}init(A){var e;this._core=A;const{notificationCenter:t,helper:i,InnerEvent:o,message:n}=A;i.registerApi({apiName:"createVideoMessage",context:this}),i.registerExperimentalAPI("createVideoMessage",this,"createCustomUploadVideoMessage"),null===(e=null==n?void 0:n.messageFactory)||void 0===e||e.registerElementClass(E,tA),t.subscribeInnerEvent(o.DESTROY,this._dispose,this)}createVideoMessage(A){var e,t,i;try{const o=this._processVideo(A);A.payload.file=o;const n=null===(e=this._core.store.get("login"))||void 0===e?void 0:e.userId,r=null===(i=null===(t=this._core)||void 0===t?void 0:t.message.messageFactory)||void 0===i?void 0:i.createMessage(Object.assign(Object.assign({},A),{from:n})),s={videoFormat:o.videoFile.type,videoSecond:g(o.videoFile.second,0),videoSize:o.videoFile.size,remoteVideoUrl:"",videoUrl:o.videoFile.url,videoUUID:v.generateUUID(o.videoFile),thumbUUID:v.generateUUID(o.videoFile,"jpg"),thumbWidth:o.width||200,thumbHeight:o.height||200,thumbUrl:o.thumbUrl,thumbSize:o.thumbSize,thumbFormat:"jpg"},a=new tA(s);return r.setElement(a),this._messageOptionsMap.set(r.clientSequence,A),r}catch(o){throw o}}createCustomUploadVideoMessage(A){var e,t,i;try{const{store:o,message:n}=this._core;this._validateCustomUploadVideoMessage(A);const r=null===(e=o.get("login"))||void 0===e?void 0:e.userId,{videoUrl:s,videoUuid:a,duration:g,snapshotUrl:c,snapshotUuid:l,videoFileSize:I,videoType:u,snapshotWidth:E,snapshotHeight:d,snapshotFileSize:h,snapshotType:C="jpg"}=(null===(t=null==A?void 0:A.payload)||void 0===t?void 0:t.file)||{},B=null===(i=n.messageFactory)||void 0===i?void 0:i.createMessage(Object.assign(Object.assign({},A),{from:r})),Q=new tA({videoFormat:u,videoSecond:g||0,videoSize:I,remoteVideoUrl:s,videoUrl:s,videoUUID:a,thumbUUID:l,thumbWidth:E||200,thumbHeight:d||200,thumbUrl:c,thumbSize:h,thumbFormat:C,isCustomUpload:!0});return B.setElement(Q),this._messageOptionsMap.set(B.clientSequence,A),B}catch(o){throw o}}upload(A){return e(this,void 0,void 0,function*(){const e=A.getElements()[0],{file:t}=this._messageOptionsMap.get(A.clientSequence).payload;this._validateBeforeUploadVideo(t);const i=yield this._performVideoUpload(e,A,t),{location:o,snapshotInfo:n}=i,r=v.addAuthToUrl(o);return e.updateVideoUrl(r),v.isEmpty(n)||e.updateSnapshotInfo(n),A})}_validateBeforeUploadVideo(A){var e;const{ChatError:t}=null===(e=this._core)||void 0===e?void 0:e.helper;if(A.videoFile.size>104857600)throw new t({code:X});if(0===A.videoFile.size)throw new t({code:Z});if(-1===AA.indexOf(A.videoFile.type))throw new t({code:$})}_validateCustomUploadVideoMessage(A){var e;const{utils:{isEmpty:t,isNumber:i}}=this._core,{videoUrl:o,videoUuid:n,duration:r,snapshotUrl:s,snapshotUuid:a}=(null===(e=null==A?void 0:A.payload)||void 0===e?void 0:e.file)||{};if(t(o)||t(n)||!i(r)||t(s)||t(a))throw new Error("Invalid video message options: missing required fields (videoUrl, videoUuid, duration, snapshotUrl, snapshotUuid)")}_performVideoUpload(A,t,i){return e(this,void 0,void 0,function*(){const{to:e}=t,o={uploadFileType:B,file:i,to:e,message:t,onProgress:e=>{var i,o;A.updatePercent(e),null===(o=null===(i=this._messageOptionsMap.get(t.clientSequence))||void 0===i?void 0:i.onProgress)||void 0===o||o.call(i,e)}},{response:n,uploadOptions:r}=yield _.uploadToCOS(o);return{snapshotInfo:yield this._getSnapshotInfoByUrl(r.requestSnapshotUrl),location:n.location}})}_processVideo(A){var e,t;try{const{ChatError:i}=null===(e=this._core)||void 0===e?void 0:e.helper,{IN_MINI_APP:o,IN_BROWSER:n}=null===(t=this._core)||void 0===t?void 0:t.utils;let{file:r}=A.payload,s={};if(o&&(s=this._processMiniVideoFile(r),r.name=s.name,r.url=s.url,r.type=s.type),n){const A=v.extractFileFromInput(r);if(!A)throw new i({message:"Invalid file. Pass either `e.target` (from file input) or a File object"});r=A,s=this._processWebVideoFile(r)}return r.videoFile=s,r.thumbUrl="",r.thumbSize=0,r}catch(i){throw console.warn(`${d} _processFile error:`,i),i}}_processMiniVideoFile(A){var e,t;const{IN_ALIPAY_MINI_APP:i,IN_UNI_NATIVE_APP:o}=null===(e=this._core)||void 0===e?void 0:e.utils,{ChatError:r}=null===(t=this._core)||void 0===t?void 0:t.helper;if(i)throw new r({message:"VideoUnsupportedInAlipay"});if(n(A))throw new r({message:"FileUnsupportedInMiniApp"});Array.isArray(A.tempFiles)&&(A=A.tempFiles[0]);let s=A.tempFilePath.slice(A.tempFilePath.lastIndexOf(".")+1).toLowerCase();return o&&(s=A.fileType||s),{url:A.tempFilePath,name:A.tempFilePath.slice(A.tempFilePath.lastIndexOf("/")+1),size:A.size||1,second:A.duration||0,type:s}}_processWebVideoFile(A){const{name:e,size:t=1,duration:i=0,type:o}=A,n=o.split("/")[1];return{url:window.URL.createObjectURL(A),name:e,size:t,second:i,type:n}}_getSnapshotInfoByUrl(A){return e(this,void 0,void 0,function*(){const{ssoLog:t}=this._core;try{t.debug("_getSnapshotInfoByUrl",`${d} _getSnapshotInfoByUrl url:${A}`);const i={version:1,platform:v.getPlatform(),cover_name:a(r(99999)),snapshot_url:A},o=yield function(A,t){return e(this,void 0,void 0,function*(){try{const e="im_cos_msg.video_cover",{helper:i,channel:o}=t,n=i.generateCosSpecifiedData({servcmd:e,data:A}),r=`${n.head.seq}${e}`;return yield o.sendPacket(n,{requestId:r})}catch(e){throw console.warn("getSnapshotInfo error:",e),e}})}(i,this._core),{download_url:n}=o||{};if(t.debug("_getSnapshotInfoByUrl",`${d} _getSnapshotInfoByUrl OK snapshotUrl:${n}`),v.isEmpty(n))return{};const s=v.addAuthToUrl(n),{width:g=0,height:c=0}=yield v.probeImageWidthHeight(s);return{snapshotUrl:s,snapshotWidth:g,snapshotHeight:c}}catch(i){throw i}})}_reset(){this._messageOptionsMap.clear()}_dispose(){this._reset();const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this)}};class nA{constructor(A){this.uploadProgress=0,this.type=I,this[iA]=!1,this[D]=A.isCustomUpload||!1,this.content={downloadFlag:2,second:A.second,size:A.size,url:v.generateURL(A.url,{needAddAuthToUrl:!this[D]}),remoteAudioUrl:v.addAuthToUrl(A.url||""),uuid:A.uuid}}static parseServerPushElement(A){const{MsgContent:e}=A,{Url:t,Download_Flag:i,Second:o,Size:n,UUID:r}=e;return new nA({url:t,downloadFlag:i,second:o,size:n,uuid:r})}updatePercent(A){this.uploadProgress=Math.min(A,1)}updateAudioUrl(A){this.content.remoteAudioUrl=A}validateBeforeSend(){if(this[D])return{isValid:!0};const A=""!==this.content.remoteAudioUrl;return{isValid:A,error:A?null:{message:"content can not be empty"}}}transformToServerFormat(A){const{isMergerMessage:e=!1}=A||{},t=e?this.payload:this.content,{uuid:i,downloadFlag:o,remoteAudioUrl:n,size:r,second:s}=t;return{MsgType:this.type,MsgContent:{Url:v.removeAuthToUrl(n),Download_Flag:o,Second:s,Size:r,UUID:i}}}}iA=D;const rA=2108,sA=2300,aA=2301;var gA=new class{constructor(){this._messageOptionsMap=new Map}init(A){var e;this._core=A;const{notificationCenter:t,helper:i,InnerEvent:o,message:n}=A;i.registerApi({apiName:"createAudioMessage",context:this}),i.registerExperimentalAPI("createAudioMessage",this,"createCustomUploadAudioMessage"),null===(e=null==n?void 0:n.messageFactory)||void 0===e||e.registerElementClass(I,nA),t.subscribeInnerEvent(o.DESTROY,this._dispose,this)}createAudioMessage(A){var e,t,i;try{let{file:o}=A.payload;o=this._processAudioFile(A.payload.file),A.payload.file=o;const n=null===(e=this._core.store.get("login"))||void 0===e?void 0:e.userId,r=null===(i=null===(t=this._core)||void 0===t?void 0:t.message.messageFactory)||void 0===i?void 0:i.createMessage(Object.assign(Object.assign({},A),{from:n})),s={second:Math.floor((o.duration||o.second)/1e3),size:o.fileSize||o.size||1,url:o.tempFilePath||o.uri||o.url,uuid:v.generateUUID(o)},a=new nA(s);return r.setElement(a),this._messageOptionsMap.set(r.clientSequence,A),r}catch(o){throw o}}createCustomUploadAudioMessage(A){var e,t,i;try{this._validateCustomUploadOptions(A);const{store:o,message:n}=this._core,r=null===(e=o.get("login"))||void 0===e?void 0:e.userId,{url:s,uuid:a,duration:g,fileSize:c}=(null===(t=null==A?void 0:A.payload)||void 0===t?void 0:t.file)||{},l=null===(i=n.messageFactory)||void 0===i?void 0:i.createMessage(Object.assign(Object.assign({},A),{from:r})),I=new nA({second:g,size:c||1,url:s,uuid:a,isCustomUpload:!0});return l.setElement(I),this._messageOptionsMap.set(l.clientSequence,A),l}catch(o){throw o}}upload(A){return e(this,void 0,void 0,function*(){const{ssoLog:e,utils:{safeStringify:t}}=this._core;e.debug("upload",`${d} uploadAudio message:${t(A)}`);const{file:i}=this._messageOptionsMap.get(A.clientSequence).payload;this._validateBeforeUploadAudio(i);const o=A.getElements()[0],n=yield this._performAudioUpload(o,A,i),r=v.addAuthToUrl(null==n?void 0:n.location);return o.updateAudioUrl(r),A})}_validateBeforeUploadAudio(A){var e;const{ChatError:t}=null===(e=this._core)||void 0===e?void 0:e.helper;if(!A)throw new t({code:sA});if(A.size>20971520)throw new t({code:aA});if(0===A.size)throw new t({code:rA})}_performAudioUpload(A,t,i){return e(this,void 0,void 0,function*(){const{to:e}=t,o={uploadFileType:Q,file:i,to:e,message:t,onProgress:e=>{var i,o;A.updatePercent(e),null===(o=null===(i=this._messageOptionsMap.get(t.clientSequence))||void 0===i?void 0:i.onProgress)||void 0===o||o.call(i,e)}},{response:n}=yield _.uploadToCOS(o);return n})}_processAudioFile(A){var e;const{IN_MINI_APP:t,IN_BROWSER:i}=null===(e=this._core)||void 0===e?void 0:e.utils;return t?this._processMiniFile(A):i?this._processWebFile(A):void 0}_processMiniFile(A){return{url:A.tempFilePath,name:A.tempFilePath.slice(A.tempFilePath.lastIndexOf("/")+1),size:A.fileSize,second:A.duration,type:A.tempFilePath.slice(A.tempFilePath.lastIndexOf(".")+1).toLowerCase()}}_processWebFile(A){if(A.tempFilePath||A.uri)return A;const e=URL.createObjectURL(A);return A.tempFilePath=e,A}_validateCustomUploadOptions(A){var e;const{utils:{isEmpty:t}}=this._core,{url:i,uuid:o,duration:n}=(null===(e=null==A?void 0:A.payload)||void 0===e?void 0:e.file)||{};if(t(i)||t(o)||t(n))throw new Error("Invalid audio message options")}_reset(){this._messageOptionsMap.clear()}_dispose(){this._reset();const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.DESTROY,this._dispose,this)}};const cA={to:{required:!0,rules:["string"],allowEmpty:!1},conversationType:{required:!0,rules:["string"],allowEmpty:!1},payload:{required:!0,rules:["object"],allowEmpty:!1},cloudCustomData:{required:!1,rules:["string"],allowEmpty:!1},priority:{required:!1,rules:["string"],allowEmpty:!1},customModerationConfigurationID:{required:!1,rules:["string"],allowEmpty:!1},onProgress:{required:!1,rules:["function"],allowEmpty:!1}},lA={createImageMessage:cA,createAudioMessage:cA,createVideoMessage:cA,createFileMessage:cA},IA={createImageMessage:!0,createAudioMessage:!0,createVideoMessage:!0,createFileMessage:!0},uA={[l]:x,[u]:z,[E]:oA,[I]:gA};var EA=new class{constructor(){this.name="RichMediaMessage"}install(A){this._core=A;const{constants:{OuterConstant:{MSG_AUDIO:e,MSG_FILE:t,MSG_IMAGE:i,MSG_VIDEO:o}}}=A;j.init(A),x.init(A),z.init(A),oA.init(A),gA.init(A),_.init(A),v.init(A),A.helper.registerApi({apiName:"sendMessage",context:this,matcher:A=>[e,t,i,o].includes(A[0].type)}),A.helper.registerValidateConfig({auth:IA,params:lA})}sendMessage(A,t){return e(this,void 0,void 0,function*(){var e,i,o;try{return this._isCustomUpload(A)||(yield this._upload(A)),yield null===(o=null===(i=null===(e=this._core)||void 0===e?void 0:e.message)||void 0===i?void 0:i.messageSender)||void 0===o?void 0:o.sendMessage(A,t)}catch(n){throw n}})}_upload(A){return e(this,void 0,void 0,function*(){const{ssoLog:e,utils:{safeStringify:t}}=this._core;if(e.debug("_upload",` uploadFile message:${t(A)}`),!0!==A._relayFlag)try{const t=uA[A.type];t&&(yield t.upload(A),e.info("_upload",` type:${A.type}`))}catch(i){throw A.status=f.FAIL,i instanceof Error&&(i.data={message:A}),this._core.message.messageDataHandler.storeConversationMessage(A),i}})}_isCustomUpload(A){var e,t;return!0===(null===(t=null===(e=A._elements)||void 0===e?void 0:e[0])||void 0===t?void 0:t[D])}};return EA}();const g_=RR(a_.exports);var c_={exports:{}};c_.exports=function(){function A(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(A);o !A||!!(Array.isArray(A)&&A.length<=5)||"keywordList should be an array and length <= 5"},c={required:!1,rules:["string"],allowEmpty:!0,customValidator:A=>!A||!![n.OR,n.AND].includes(A)||"keywordListMatchType should be OR or AND"},l={required:!1,rules:["number"],allowEmpty:!0,customValidator:A=>"number"==typeof A&&A>=1&&A<=100||"count must be a number between 1 and 100"},I={required:!1,rules:["string"],allowEmpty:!0},u={required:!1,rules:["array"],allowEmpty:!0,customValidator:A=>{const{OuterConstant:e}=t.core;if(!Array.isArray(A))return"groupTypeList should be an array";const i=[e.GRP_PUBLIC,e.GRP_COMMUNITY,e.GRP_WORK,e.GRP_MEETING];let o=!1;for(let t=0;t ({required:!1,rules:["number"],allowEmpty:!0,customValidator:e=>"number"==typeof e&&e>=0||`${A} should be a number >= 0';`}),d={required:!1,rules:["string"],allowEmpty:!0,customValidator:A=>{const{OuterConstant:e}=t.core;return!![e.GENDER_FEMALE,e.GENDER_MALE].includes(A)||"gender is invalid"}},h={searchCloudMessages:{keywordList:g,keywordListMatchType:c,cursor:I,senderUserIDList:{required:!1,rules:["array"],allowEmpty:!0,customValidator:A=>!!(Array.isArray(A)&&A.length<=5)||"senderUserIDList should be an array and length <= 5"},messageTypeList:{required:!1,rules:["array"],allowEmpty:!0,customValidator:A=>{const{OuterConstant:e}=t.core,i=[e.MSG_TEXT,e.MSG_IMAGE,e.MSG_AUDIO,e.MSG_FILE,e.MSG_VIDEO,e.MSG_LOCATION,e.MSG_CUSTOM,e.MSG_MERGER];let o=!1;for(let t=0;t {const{OuterConstant:e}=t.core;return!(!(null==A?void 0:A.startsWith(e.CONV_C2C))&&!(null==A?void 0:A.startsWith(e.CONV_GROUP))&&A!==e.CONV_SYSTEM)||"conversationID is invalid"}},timePosition:E("timePosition"),timePeriod:E("timePeriod")},searchCloudUsers:{keywordList:g,keywordListMatchType:c,cursor:I,count:l,miniBirthday:E("miniBirthday"),maxBirthday:E("maxBirthday"),gender:d},searchCloudGroupMembers:{keywordList:g,keywordListMatchType:c,cursor:I,count:l,groupTypeList:u,groupIDList:{required:!1,rules:["array"],allowEmpty:!0}},searchCloudGroups:{keywordList:g,keywordListMatchType:c,cursor:I,count:l,groupTypeList:u}},C={searchCloudMessages:!0,searchCloudUsers:!0,searchCloudGroupMembers:!0,searchCloudGroups:!0};return new class{constructor(){this.name="CloudSearch"}install(A){this._core=A,t.init(A),A.helper.registerApi({apiName:"searchCloudMessages",context:this}),A.helper.registerApi({apiName:"searchCloudUsers",context:this}),A.helper.registerApi({apiName:"searchCloudGroupMembers",context:this}),A.helper.registerApi({apiName:"searchCloudGroups",context:this}),A.helper.registerValidateConfig({auth:C,params:h})}searchCloudMessages(o){return e(this,void 0,void 0,function*(){try{const{OuterConstant:i,helper:n}=this._core,{conversationID:r,timePeriod:s,timePosition:a}=o,g=A(o,["conversationID","timePeriod","timePosition"]),c=Object.assign({count:100},g);r&&(r.startsWith(i.CONV_C2C)?c.account=r.replace(i.CONV_C2C,""):r.startsWith(i.CONV_GROUP)&&(c.groupID=r.replace(i.CONV_GROUP,""))),this._setTimeRangeParams(c,{timePeriod:s,timePosition:a});const l=yield function(A){return e(this,void 0,void 0,function*(){const{count:e,keywordList:i,keywordListMatchType:o,senderUserIDList:n,messageTypeList:r,endTime:s,startTime:a,cursor:g,account:c,groupID:l}=A,I={Count:e,KeywordList:i,MatchType:o,SendUserIDList:n,MsgTypeList:r,EndTime:s,StartTime:a,Cursor:g,PeerAccount:c,GroupID:l};return t.core.common.buildAndSendPacket({servcmd:"message_search.query",data:I})})}(c);if(!l)return{code:0,data:{}};const{ErrorCode:I,ErrorInfo:u,TotalCount:E,Cursor:d="",ConversationMsgs:h=[]}=l;if(0!==I)throw{errorCode:I,errorInfo:u};const C=`keywordList:${o.keywordList} keywordListMatchType:${o.keywordListMatchType} cursor:${o.cursor} res: totalCount:${E}`;return{code:0,data:{searchResultList:h.map(A=>{const{MsgList:e,Count:t,GroupID:r,UserID:s}=A,a=r?`${i.CONV_GROUP}${r}`:`${i.CONV_C2C}${s}`;return this._isSearchingAllConversations(o)&&t>1?{conversationID:a,messageCount:t,messageList:[]}:{conversationID:a,messageCount:t,messageList:e.map(A=>n.isEmpty(r)?function(A,e){const t=e.OuterConstant.CONV_C2C,i=e.message.messageHelper.parseServerPushMessage(A),o=e.message.messageFactory.createMessage(Object.assign(Object.assign({},i),{conversationType:t,flow:"in"}));return o.setElement(i.elements),o}(A,this._core):function(A,e){const t=e.OuterConstant.CONV_GROUP,i=e.message.messageHelper.parseServerGroupMessage(A),o=e.message.messageFactory.createMessage(Object.assign(Object.assign({},i),{conversationType:t,flow:"in"}));return o.setElement(i.elements),o}(A,this._core))}}),cursor:d,totalCount:E},successLog:{message:C}}}catch(n){const{errorCode:A,errorInfo:e}=n||{};this._handleError({errorCode:A,errorInfo:e,searchType:i,functionName:"searchCloudMessages"})}})}searchCloudUsers(i){return e(this,void 0,void 0,function*(){var r;try{const{keywordListMatchType:o,count:a=s}=i,g=A(i,["keywordListMatchType","count"]),c=Object.assign({count:a,keywordListMatchType:o===n.AND?1:0},g);this._setBirthdayRangeParams(c,i);const l=yield function(A){return e(this,void 0,void 0,function*(){const{count:e,keywordList:i,keywordListMatchType:o,miniBirthday:n,maxBirthday:r,cursor:s,gender:a}=A,g={Count:e,Keywords:i,KeywordMatchType:o,Cursor:s,UserBirthStart:n,UserBirthEnd:r,Gender:a};return t.core.common.buildAndSendPacket({servcmd:"user_search.query",data:g})})}(c);if(!l)return{error:0,data:{}};const{ErrorCode:I,ErrorInfo:u,TotalCount:E,Cursor:d="",Users:h=[]}=l;if(0!==I)throw{errorCode:I,errorInfo:u};const C=`keywordList:${i.keywordList} keywordListMatchType:${i.keywordListMatchType} cursor:${i.cursor} count:${i.count} res: totalCount:${E}`,B=[];for(let A=0,e=h.length;A ({tag:A.Tag,value:A.StrValue})),o=null===(r=this._core.user.userProfile)||void 0===r?void 0:r.createProfile(e,i);B.push(o)}return{code:0,data:{searchResultList:B,cursor:d,totalCount:E},successLog:{message:C}}}catch(a){const{errorCode:A,errorInfo:e}=a||{};this._handleError({errorCode:A,errorInfo:e,searchType:o,functionName:"searchCloudUsers"})}})}searchCloudGroupMembers(i){return e(this,void 0,void 0,function*(){try{const{count:o=a,keywordListMatchType:r}=i,s=A(i,["count","keywordListMatchType"]),g=Object.assign({count:o,keywordListMatchType:r===n.AND?1:0},s),c=yield function(A){return e(this,void 0,void 0,function*(){const{count:e,keywordList:i,keywordListMatchType:o,groupTypeList:n,cursor:r,groupIDList:s}=A,a={Count:e,Keywords:i,KeywordMatchType:o,Cursor:r,GroupType:n,GroupIdList:s};return t.core.common.buildAndSendPacket({servcmd:"group_member_search.query",data:a})})}(g);if(!c)return{code:0,data:{}};const{ErrorCode:l,ErrorInfo:I,GroupMembers:u=[],Cursor:E,TotalCount:d}=c;if(0!==l)throw{errorCode:l,errorInfo:I};const h=`keywordList:${i.keywordList} keywordListMatchType:${i.keywordListMatchType} cursor:${i.cursor} count:${i.count} res: totalCount:${d}`,C=new Map;return u.forEach(A=>{const{GroupID:e,GroupName:t,GroupType:i,GroupFaceUrl:o,GroupMemberUserName:n,GroupMemberUserID:r,GroupMemberNameCard:s,GroupMemberAvatar:a=""}=A,g={groupID:e,name:t,type:i,avatar:o},c={userID:r,nick:n,nameCard:s,avatar:a};if(C.has(e)){const A=C.get(e);A.memberList.push(c),C.set(e,A)}else C.set(e,{groupInfo:g,memberList:[c]})}),{code:0,data:{searchResultList:[...C.values()],cursor:E,totalCount:d},successLog:{message:h}}}catch(r){const{errorCode:A,errorInfo:e}=r||{};this._handleError({errorCode:A,errorInfo:e,searchType:o,functionName:"searchCloudGroupMembers"})}})}searchCloudGroups(i){return e(this,void 0,void 0,function*(){try{const{count:o=r,keywordListMatchType:s}=i,a=A(i,["count","keywordListMatchType"]),g=Object.assign({count:o,keywordListMatchType:s===n.AND?1:0},a),c=yield function(A){return e(this,void 0,void 0,function*(){const{count:e,keywordList:i,keywordListMatchType:o,groupTypeList:n,cursor:r}=A,s={Count:e,Keywords:i,KeywordMatchType:o,Cursor:r,GroupType:n};return t.core.common.buildAndSendPacket({servcmd:"group_search.query",data:s})})}(g);if(!c)return{code:0,data:{}};const{ErrorCode:l,ErrorInfo:I,Groups:u,Cursor:E,TotalCount:d}=c;if(0!==l)throw{errorCode:l,errorInfo:I};const h=`keywordList:${i.keywordList} keywordListMatchType:${i.keywordListMatchType} cursor:${i.cursor} count:${i.count} res: totalCount:${d}`;return{code:0,data:{searchResultList:(null==u?void 0:u.map(A=>function(A){const{GroupFaceUrl:e,GroupID:t,GroupIntroduction:i,GroupMemberNum:o,GroupName:n,GroupOwnerTinyID:r,GroupOwnerUserID:s,GroupOwnerUserName:a,GroupType:g,GroupAddOption:c,GroupInviteOption:l}=A;return{avatar:e,groupID:t,introduction:i,memberCount:o,name:n,ownerTinyID:r,ownerID:s,ownerNick:a,type:g,joinOption:c,inviteOption:l}}(A)))||[],cursor:E,totalCount:d},successLog:{message:h}}}catch(s){const{errorCode:A,errorInfo:e}=s||{};this._handleError({errorCode:A,errorInfo:e,searchType:o,functionName:"searchCloudGroups"})}})}_setTimeRangeParams(A,{timePeriod:e,timePosition:t}){e&&e>0&&(A.startTime=t&&t>0?t-e:this._core.helper.timeManager.getServerTimeSeconds()-e),A.startTime&&A.startTime<0&&(A.startTime=void 0),t&&t>0&&(A.endTime=t)}_handleError({errorCode:A,errorMessage:e,searchType:t}){const{helper:o}=this._core;let n=A;throw 60020===A?n="SearchUnable":t!==i&&27003===A?n="SearchParamsError":t!==i&&60018===A&&(n="SearchOverLimit"),new o.ChatError({code:n,message:e})}_isSearchingAllConversations(A){return this._core.helper.isEmpty(A.conversationID)}_setBirthdayRangeParams(A,e){const{miniBirthday:t,maxBirthday:i}=e;void 0!==t&&(A.miniBirthday=t,void 0===i&&(A.maxBirthday=4294967295)),void 0!==i&&(A.maxBirthday=i)}}}();const l_=RR(c_.exports);var I_={exports:{}};I_.exports=function(){function A(A,e,t,i){return new(t||(t=Promise))(function(o,n){function r(A){try{a(i.next(A))}catch(e){n(e)}}function s(A){try{a(i.throw(A))}catch(e){n(e)}}function a(A){var e;A.done?o(A.value):(e=A.value,e instanceof t?e:new t(function(A){A(e)})).then(r,s)}a((i=i.apply(A,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const e=1,t=2,i=3,o=4,n=5,r="TIMCustomElem",s="C2C",a="GROUP",g="invite",c="accept",l="cancel",I="reject",u="modifyInvitation",E="signaling",d=8010,h="signaling-timeout";function C(A){return A.filter(A=>{if(A.type===r){const{cloudCustomData:e="",payload:{data:t=""}={}}=A,i=e.match(/"type":"tsignaling"/),o=t.match(/inviteID/),n=t.match(/actionType/);return i||o&&n}return!1})}function B(A){const{data:e}=A.payload;try{return JSON.parse(e)}catch(t){return console.error(t),null}}function Q(A,e){return A.toString(16).padStart(e,"0")}function p(A){if(A<0||A>53)throw new Error("Number of digits must be between 0 and 53");if(A<=30)return Math.floor(Math.random()*(1<0;const A=this._core.common.getCurrentUserID();return r.includes(A)}return!0}updateSignaling(A){const e=`${E}.updateSignaling`,{inviteID:t,inviter:i,inviteeList:o,groupID:n}=A;if(console.log(`${e} inviteID:${t} inviter:${i} groupID:${n}`),n&&this.hasSignaling(t)){const A=o[0],{inviteeList:i}=this._onlineSignalingMap.get(t);i.includes(A)&&(i.splice(i.indexOf(A),1),console.log(`${e} remove ${A}. localInviteeList.length:${i.length}`)),0===i.length&&this.removeSignaling(t)}else this.removeSignaling(t)}setSignalingListenStatus(A){this._isSignalingListening=A}getSignalingListenStatus(){return this._isSignalingListening}_dispose(){var A,e;this._reset(),null===(A=this._core)||void 0===A||A.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this),null===(e=this._core)||void 0===e||e.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this),this._isSignalingListening=!1}_reset(){this._onlineSignalingMap.clear()}},m=new class{init(A){this._core=A}createInviteSignaling(A){const e=this._generateInviteID(),t=this._createInviteSignalingData(Object.assign(Object.assign({},A),{inviteID:e})),{groupID:i,inviteeList:o}=t,n=i||o[0];return{signaling:this._createSignaling(t,n),signalingData:t,signalingExtensionOptions:this._createSignalingExtensionOptions(A)}}createAcceptSignaling(A){const e=this._createAcceptSignalingData(A),{groupID:t,inviter:i}=e,o=t||i;return{signaling:this._createSignaling(e,o),signalingData:e,signalingExtensionOptions:this._createSignalingExtensionOptions(A)}}createCancelSignaling(A){const e=this._createCancelSignalingData(A),{groupID:t,inviteeList:i}=e,o=t||i[0];return{signaling:this._createSignaling(e,o),signalingData:e,signalingExtensionOptions:this._createSignalingExtensionOptions(A)}}createRejectSignaling(A){const e=this._createRejectSignalingData(A),{groupID:t,inviter:i}=e,o=t||i;return{signaling:this._createSignaling(e,o),signalingData:e,signalingExtensionOptions:this._createSignalingExtensionOptions(A)}}createTimeoutSignaling(A){const{isInviter:e=!1}=A,t=this._createTimeoutSignalingData(A),{groupID:i,inviteeList:o,inviter:n}=t,r=i||(e?o[0]:n);return{signaling:this._createSignaling(t,r),signalingData:t,signalingExtensionOptions:this._createSignalingExtensionOptions(t)}}_createSignalingExtensionOptions(A){var e,t;const{data:i="",onlineUserOnly:o,inviteID:n="",offlinePushInfo:r,actionType:s}=A,a=(null===(t=null===(e=f.getSignaling(n))||void 0===e?void 0:e.signaling)||void 0===t?void 0:t._onlineOnlyFlag)||!1;return{onlineUserOnly:o||a,offlinePushInfo:r,messageControlInfo:this._createMessageControlInfo(i,s)}}_createMessageControlInfo(A,e){const t=e===n&&!!A.match(/excludeTimeoutSignalingFromHistoryMessage/),i=!!A.match(/excludeFromHistoryMessage/)||!!A.match(/excludeOriginalSignalingFromHistoryMessage/);return{excludedFromContentModeration:!0,excludedFromUnreadCount:t||i,excludedFromLastMessage:t||i}}_createInviteSignalingData(A){const t=`${E}._createInviteSignalingData`,{userID:i,timeout:o=0,groupID:n="",inviteeList:r=[]}=A,s=this._core.common.getCurrentUserID(),a=Object.assign(Object.assign({},this._generateBaseSignalData(A)),{actionType:e,inviter:s,inviteeList:n?r:[i],timeout:o});return console.log(`${t} signalingData:`,a),a}_createAcceptSignalingData(A){const e=`${E}._createAcceptSignalingData`,{inviteID:t}=A,o=this._core.common.getCurrentUserID(),{inviter:n,groupID:r}=f.getSignaling(t),s=Object.assign(Object.assign({},this._generateBaseSignalData(A)),{actionType:i,groupID:r,inviter:n,inviteeList:[o]});return console.log(`${e} signalingData:`,s),s}_createCancelSignalingData(A){const e=`${E}._createCancelSignalingData`,{inviteID:i}=A,o=this._core.common.getCurrentUserID(),{inviteeList:n,groupID:r}=f.getSignaling(i),s=Object.assign(Object.assign({},this._generateBaseSignalData(A)),{actionType:t,groupID:r,inviter:o,inviteeList:n});return console.log(`${e} signalingData:`,s),s}_createRejectSignalingData(A){const e=`${E}._createRejectSignalingData`,{inviteID:t}=A,i=this._core.common.getCurrentUserID(),{inviter:n,groupID:r}=f.getSignaling(t),s=Object.assign(Object.assign({},this._generateBaseSignalData(A)),{actionType:o,groupID:r,inviter:n,inviteeList:[i]});return console.log(`${e} signalingData:`,s),s}_createTimeoutSignalingData(A){const e=`${E}._createTimeoutSignalingData`,{isInviter:t=!1,inviteID:i}=A,{inviteeList:o,inviter:r}=f.getSignaling(i),s=this._core.common.getCurrentUserID(),a=Object.assign(Object.assign({},this._generateBaseSignalData(A)),{actionType:n,inviter:r,inviteeList:t?o:[s]});return console.log(`${e} signalingData:`,a),a}_createSignaling(A,e){var t,i,o;const{groupID:n=""}=A,r={to:e,conversationType:n?a:s,priority:"High",payload:{data:JSON.stringify(A)}};return null===(o=null===(i=null===(t=this._core)||void 0===t?void 0:t.message)||void 0===i?void 0:i.messageFactory)||void 0===o?void 0:o.createCustomMessage(r)}_generateInviteID(){return[Q(p(32),8),Q(p(16),4),Q(16384|p(12),4),Q(32768|p(14),4),Q(p(48),12)].join("-")}_generateBaseSignalData(A){const{data:e="",inviteID:t="",groupID:i=""}=A;return{businessID:1,timeout:0,data:e,inviteID:t,groupID:i}}},y=new class{constructor(){this._isProcessingSignaling=!1}init(A){this._core=A,A.helper.registerApi({apiName:"invite",context:this}),A.helper.registerApi({apiName:"accept",context:this}),A.helper.registerApi({apiName:"cancel",context:this}),A.helper.registerApi({apiName:"reject",context:this}),A.helper.registerApi({apiName:"modifyInvitation",context:this}),A.helper.registerApi({apiName:"getSignalingInfo",context:this}),A.helper.registerApi({apiName:"addSignalingListener",context:this}),A.helper.registerApi({apiName:"removeSignalingListener",context:this}),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.DESTROY,this._dispose,this),A.notificationCenter.subscribeInnerEvent(A.InnerEvent.LOGOUT,this._reset,this)}invite(e){return A(this,void 0,void 0,function*(){var A;try{this._validateBeforeInvite(e);const{signaling:t,signalingData:i,signalingExtensionOptions:o}=m.createInviteSignaling(e),n=yield this._sendSignaling(t,o);if(0===(null==n?void 0:n.code)){const{inviteID:e,timeout:o}=i;return f.saveSignaling(e,Object.assign(Object.assign({},i),{signaling:t})),o>0&&(null===(A=this._core)||void 0===A||A.helper.taskScheduler.addOnceTask({id:`${h}-${e}`,intervalMs:1e3*(o+5),callback:this.handleInvitationExpiryTimer.bind(this,e)})),Object.assign(Object.assign({},n),{inviteID:e})}return n}catch(t){throw t}})}accept(e){return A(this,void 0,void 0,function*(){try{const{inviteID:A}=e;this._validateBeforeAccept(A),this._isProcessingSignaling=!0;const{signaling:t,signalingData:i,signalingExtensionOptions:o}=m.createAcceptSignaling(e),n=yield this._sendSignaling(t,o);return 0===(null==n?void 0:n.code)?(f.updateSignaling(i),Object.assign(Object.assign({},n),{inviteID:A})):n}catch(A){throw A}finally{this._isProcessingSignaling=!1}})}cancel(e){return A(this,void 0,void 0,function*(){try{const{inviteID:A}=e;this._validateBeforeCancel(A),this._isProcessingSignaling=!0;const{signaling:t,signalingExtensionOptions:i}=m.createCancelSignaling(e),o=yield this._sendSignaling(t,i);return 0===(null==o?void 0:o.code)?(f.removeSignaling(A),Object.assign(Object.assign({},o),{inviteID:A})):o}catch(A){throw A}finally{this._isProcessingSignaling=!1}})}reject(e){return A(this,void 0,void 0,function*(){try{const{inviteID:A}=e;this._validateBeforeReject(A),this._isProcessingSignaling=!0;const{signaling:t,signalingExtensionOptions:i}=m.createRejectSignaling(e),o=yield this._sendSignaling(t,i);return 0===(null==o?void 0:o.code)?(f.removeSignaling(A),Object.assign(Object.assign({},o),{inviteID:A})):o}catch(A){throw A}finally{this._isProcessingSignaling=!1}})}modifyInvitation(e){return A(this,void 0,void 0,function*(){var A,t;const{inviteID:i,data:o}=e;let n="";try{this._validateBeforeModifyInvitation(i);const e=f.getSignaling(i),{signaling:r}=e,s=function(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(A);o {const e=B(A);if(e){const t=this._actionProcessor.get(e.actionType);null==t||t(e,A)}})}_handleMessageReceived(A){if(!f.getSignalingListenStatus())return;const e=C(A.data);0!==e.length&&this.handleActionSignaling(e)}_handleMessageModified(A){if(!f.getSignalingListenStatus())return;const e=C(A.data);e.length>0&&e.forEach(A=>{const e=B(A);e&&this._onInvitationModified(e,A)})}_onNewInvitationReceived(A,e){var t,i;const o=`${E}._onNewInvitationReceived`,{inviteID:n,inviteeList:r,groupID:s}=A,a=this._core.common.getCurrentUserID();if(this._core.ssoLog.debug("_onNewInvitationReceived",`${o} signalingData:${JSON.stringify(A)}}`),s&&!r.includes(a))return;let{timeout:g}=A;const c=Date.now()/1e3-e.time;g>0&&c>0&&g>c&&(g-=c);const l=f.getSignaling(n);l!==A&&(l||f.saveSignaling(n,Object.assign(Object.assign({},A),{signaling:e})),g>0&&(null===(t=this._core)||void 0===t||t.helper.taskScheduler.addOnceTask({id:`${h}-${n}`,intervalMs:1e3*g,callback:y.handleInvitationExpiryTimer.bind(y,n)})),this._emitEvent({name:null===(i=this._core)||void 0===i?void 0:i.SignalingEvent.NEW_INVITATION_RECEIVED,data:Object.assign(Object.assign({},this._generateBaseEmitData(A)),{inviteeList:r})}))}_onInviteeRejected(A){var e;const t=`${E}._onInviteeRejected`,{inviteID:i,inviter:o,groupID:n,inviteeList:r}=A,s=f.hasSignaling(i);this._core.ssoLog.debug("_onInviteeRejected",`${t} inviteID:${i} hasInviteID:${s} inviter:${o} groupID:${n}`),s&&(f.updateSignaling(A),this._emitEvent({name:null===(e=this._core)||void 0===e?void 0:e.SignalingEvent.INVITEE_REJECTED,data:Object.assign(Object.assign({},this._generateBaseEmitData(A)),{invitee:r[0]})}))}_onInviteeAccepted(A){var e;const t=`${E}._onInviteeAccepted`,{inviteID:i,inviter:o,groupID:n,inviteeList:r}=A,s=f.hasSignaling(i);this._core.ssoLog.debug("_onInviteeAccepted",`${t} inviteID:${i} hasInviteID:${s} inviter:${o} groupID:${n}`),s&&(f.updateSignaling(A),this._emitEvent({name:null===(e=this._core)||void 0===e?void 0:e.SignalingEvent.INVITEE_ACCEPTED,data:Object.assign(Object.assign({},this._generateBaseEmitData(A)),{invitee:r[0]})}))}_onInvitationCancelled(A){var e;const t=`${E}._onInvitationCancelled`,{inviteID:i,inviter:o,groupID:n}=A,r=f.hasSignaling(i);this._core.ssoLog.debug("_onInvitationCancelled",`${t} inviteID:${i} hasInviteID:${r} inviter:${o} groupID:${n}`),r&&(f.removeSignaling(i),this._emitEvent({name:null===(e=this._core)||void 0===e?void 0:e.SignalingEvent.INVITATION_CANCELLED,data:this._generateBaseEmitData(A)}))}_onInvitationTimeout(A){var e;const t=`${E}._onInvitationTimeout`,{inviteID:i,inviteeList:o}=A,n=f.hasSignaling(i);this._core.ssoLog.debug("_onInvitationTimeout",`${t} inviteID:${i} hasInviteID:${n} data:${A.data}`),n&&(f.updateSignaling(A),this._emitEvent({name:null===(e=this._core)||void 0===e?void 0:e.SignalingEvent.INVITATION_TIMEOUT,data:Object.assign(Object.assign({},this._generateBaseEmitData(A)),{inviteeList:o,isSelfTimeout:!1})}))}_onInvitationModified(A,e){var t;const i=`${E}._onInvitationModified`,{inviteID:o,data:n}=A,r=f.hasSignaling(o);this._core.ssoLog.debug("_onInvitationModified",`${i} inviteID:${o} data:${n}`),r&&(f.saveSignaling(o,Object.assign(Object.assign({},A),{signaling:e})),this._emitEvent({name:null===(t=this._core)||void 0===t?void 0:t.SignalingEvent.INVITATION_MODIFIED,data:{inviteID:o,data:n}}))}_emitEvent(A){var e;null===(e=this._core)||void 0===e||e.notificationCenter.emitOuterEvent(A.name,A)}_generateBaseEmitData(A){const{inviteID:e,inviter:t,groupID:i,data:o}=A;return{inviteID:e,inviter:t,groupID:i,data:o||""}}_dispose(){var A,e,t;null===(A=this._core)||void 0===A||A.notificationCenter.unSubscribeOuterEvent(this._core.OuterEvent.MESSAGE_RECEIVED,this._handleMessageReceived,this),null===(e=this._core)||void 0===e||e.notificationCenter.unSubscribeOuterEvent(this._core.OuterEvent.MESSAGE_MODIFIED,this._handleMessageModified,this),null===(t=this._core)||void 0===t||t.notificationCenter.unSubscribeOuterEvent(this._core.InnerEvent.DESTROY,this._dispose,this)}},v=new class{constructor(){this._offlineSignalingMap=new Map}init(A){this._core=A;const{notificationCenter:e,helper:t,constants:{InnerEvent:i,WORKFLOW_STEP:o,WORKFLOW_NAME:n}}=A;e.subscribeInnerEvent(i.DESTROY,this._dispose,this),e.subscribeInnerEvent(i.LOGOUT,this._reset,this),t.registerWorkflowStep(n.SYNC_SERVER_INFO_AFTER_LOGIN,o.SIGNALING_MESSAGE_RECOVER,this._handleC2COfflineMessage,this)}_handleC2COfflineMessage(A){const{result:{unreadMessageMap:e}={}}=A||{};if(0===(null==e?void 0:e.size)||!f.getSignalingListenStatus())return;const t=C([...e.values()]);if(0!==t.length&&(t.forEach(A=>{this._handleC2CActionType(A)}),this._offlineSignalingMap.size>0)){const A=this._sortOfflineSignalingByTime();D.handleActionSignaling(A)}}_handleC2CActionType(A){const t=B(A);if(!t)return;const{actionType:i}=t;i===e?this._saveValidOfflineInvite(t,A):this._removeOfflineInvite(t)}_saveValidOfflineInvite(A,e){const{inviteID:t,inviteeList:i=[],timeout:o=0}=A,n=this._core.common.getCurrentUserID();if(!i.includes(n))return;const r=Date.now()/1e3-e.time;o>0&&r>o&&0!==o||this._offlineSignalingMap.set(t,Object.assign(Object.assign({},A),{signalingList:[e]}))}_removeOfflineInvite(A){const{inviteID:e=""}=A;this._offlineSignalingMap.has(e)&&this._offlineSignalingMap.delete(e)}_sortOfflineSignalingByTime(){let A=[];return this._offlineSignalingMap.forEach(e=>{A=[...A,...e.signalingList]}),A.sort((A,e)=>A.time-e.time)}_dispose(){var A,e;this._reset(),null===(A=this._core)||void 0===A||A.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.LOGOUT,this._reset,this),null===(e=this._core)||void 0===e||e.notificationCenter.unSubscribeInnerEvent(this._core.InnerEvent.DESTROY,this._dispose,this)}_reset(){this._offlineSignalingMap.clear()}};const w={invite:{userID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0},timeout:{required:!1,rules:["number"],allowEmpty:!1},onlineUserOnly:{required:!1,rules:["boolean"],allowEmpty:!1},offlinePushInfo:{required:!1,rules:["object"],allowEmpty:!1}},cancel:{inviteID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0}},accept:{inviteID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0}},reject:{inviteID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0}},modifyInvitation:{inviteID:{required:!0,rules:["string"],allowEmpty:!1},data:{required:!1,rules:["string"],allowEmpty:!0}}},S={invite:!0,cancel:!0,accept:!0,reject:!0,modifyInvitation:!0};return new class{constructor(){this.name="Signaling"}install(A){y.init(A),D.init(A),m.init(A),f.init(A),v.init(A),A.helper.registerValidateConfig({auth:S,params:w})}}}();const u_=RR(I_.exports);var E_={exports:{}};E_.exports=function(){function A(A,e,t,i){return new(t||(t=Promise))(function(o,n){function r(A){try{a(i.next(A))}catch(e){n(e)}}function s(A){try{a(i.throw(A))}catch(e){n(e)}}function a(A){var e;A.done?o(A.value):(e=A.value,e instanceof t?e:new t(function(A){A(e)})).then(r,s)}a((i=i.apply(A,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const e="friend",t=100,i=2700,o=2710,n=2711,r=2716,s=2742,a=30539,g="Tag_SNS_IM_",c={GROUP:`${g}Group`,REMARK:`${g}Remark`,ADDSOURCE:`${g}AddSource`,ADDWORDING:`${g}Wording`,ADDTIME:`${g}AddTime`},l="Update_Type_Add",I="Update_Type_Delete",u="add",E="remove",d="rename",h=A=>void 0===A;function C(e,t){return A(this,void 0,void 0,function*(){return Q(yield t.common.buildAndSendPacket({servcmd:"sns.friend_update",data:e}),"ResultItem",A=>({to:A.To_Account,resultCode:A.ResultCode,resultInfo:A.ResultInfo}))})}function B(e,t){return A(this,void 0,void 0,function*(){return Q(yield t.common.buildAndSendPacket({servcmd:"sns.friend_check",data:e}),"InfoItem",A=>({userID:A.To_Account,relation:A.Relation,resultCode:A.ResultCode,resultInfo:A.ResultInfo}))})}function Q(A,e="ResultItem",t=A=>({userID:A.To_Account,resultCode:A.ResultCode,resultInfo:A.ResultInfo})){const{[e]:i=[],ActionStatus:o,ErrorCode:n,ErrorInfo:r,ErrorDisplay:s}=A;return{resultList:i.map(t),actionStatus:o,errorCode:n,errorInfo:r,errorDisplay:s}}const p={[c.REMARK]:(A,e)=>{A.remark=e},[c.GROUP]:(A,e)=>{A.groupList=e?JSON.parse(JSON.stringify(e)):[]},[c.ADDSOURCE]:(A,e)=>{A.source=e},[c.ADDWORDING]:(A,e)=>{A.wording=e},[c.ADDTIME]:(A,e)=>{A.addTime=e}};let f=class{constructor(A){var e;this.userID="",this.source="",this.wording="",this.remark="",this.addTime=0,this.groupList=[],this.friendCustomField=[];const{userID:t,tagValueList:i=[],core:o}=A,n=null===(e=o.user.userProfile)||void 0===e?void 0:e.createProfile(t,i);this.userID=t,this.profile=n,i.forEach(A=>{const{tag:e,value:t}=A;e.indexOf("Tag_Profile_Custom")>-1&&this.friendCustomField.push({key:e,value:t});const i=p[e];null==i||i(this,t)})}update(A){const e=[];this.friendCustomField.forEach(A=>{e.push(A.key)}),A.forEach(A=>{const{tag:t,value:i}=A;t.indexOf("Tag_Profile_Custom")>-1&&(e.indexOf(t)>-1?this.friendCustomField.forEach(A=>{A.key===t&&(A.value=i)}):this.friendCustomField.push({key:t,value:i}));const o=p[t];null==o||o(this,i)})}};var m=new class{constructor(){this._startIndex=0,this._standardSequence=0,this._customSequence=0}init(A){this._core=A;const{helper:e,constants:t}=A;e.registerApi({apiName:"getFriendList",context:this,methodName:"getFriendListFromCache"}),e.registerApi({apiName:"getFriendProfile",context:this}),e.registerApi({apiName:"addFriend",context:this}),e.registerApi({apiName:"deleteFriend",context:this}),e.registerApi({apiName:"updateFriend",context:this}),e.registerApi({apiName:"checkFriend",context:this}),e.registerWorkflowStep(t.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_RE_ONLINE,t.WORKFLOW_STEP.FRIEND_RECOVER,this.syncFriendListFromServer,this)}getFriendListFromCache(){return A(this,void 0,void 0,function*(){const{appStore:{userStore:A},ssoLog:t,utils:{safeStringify:i}}=this._core,o=[...A.getFriendMap().values()];return t.debug("getFriendListFromCache",`${e} getFriendListFromCache, data:${i(o)}`),{code:0,data:o}})}syncFriendListFromServer(){return A(this,void 0,void 0,function*(){var t;const{ssoLog:i,helper:o}=this._core;try{i.debug("syncFriendListFromServer",`${e} syncFriendListFromServer`);const o={From_Account:null===(t=this._core.store.get("login"))||void 0===t?void 0:t.userId,StartIndex:this._startIndex,StandardSequence:this._standardSequence,CustomSequence:this._customSequence},n=yield function(e,t){return A(this,void 0,void 0,function*(){return function(A){const{UserDataItem:e=[],StandardSequence:t,CustomSequence:i,FriendNum:o,CompleteFlag:n,NextStartIndex:r,ActionStatus:s,ErrorCode:a,ErrorInfo:g,ErrorDisplay:c}=A;return{friendList:e.map(A=>{var e;return{userID:A.To_Account,tagValueList:null===(e=A.ValueItem)||void 0===e?void 0:e.map(A=>({tag:A.Tag,value:A.Value}))}}),standardSequence:t,customSequence:i,friendNumber:o,completeFlag:n,nextStartIndex:r,actionStatus:s,errorCode:a,errorInfo:g,errorDisplay:c}}(yield t.common.buildAndSendPacket({servcmd:"sns.friend_get",data:e}))})}(o,this._core),{friendList:r,nextStartIndex:s,standardSequence:a,customSequence:g,completeFlag:c}=n;this._startIndex=s,this._standardSequence=a,this._customSequence=g,this._processFriendList(r),0===c?yield this.syncFriendListFromServer():(this._emitFriendListUpdated(),this._fetchFriendProfile()),i.debug("syncFriendListFromServer",`${e} syncFriendListFromServer ok`)}catch(n){const{errorCode:A}=n||{};throw new o.ChatError({code:A})}})}getFriendProfile(e){return A(this,void 0,void 0,function*(){var i;try{let{userIDList:o}=e;o.length>t&&(o=o.slice(0,t));const{friendUserIdList:n,unFriendUserIdList:r}=this.partitionByIsFriend(o),s=this._createNonFriendErrorList(r);if(0===n.length)return{code:0,data:{friendList:[],failureUserIDList:s}};const a={From_Account:null===(i=this._core.store.get("login"))||void 0===i?void 0:i.userId,To_Account:n},g=(yield function(e,t){return A(this,void 0,void 0,function*(){return function(A){const{InfoItem:e=[],ActionStatus:t,ErrorCode:i,ErrorInfo:o,ErrorDisplay:n}=A;return{friendProfileList:e.map(A=>{var e;return{userID:A.To_Account,resultCode:A.ResultCode,resultInfo:A.ResultInfo,relation:A.Relation,standardSequence:A.StandardSequence,customSequence:A.CustomSequence,profileItem:(null===(e=A.SnsProfileItem)||void 0===e?void 0:e.map(A=>({tag:A.Tag,value:A.Value})))||[]}}),actionStatus:t,errorCode:i,errorInfo:o,errorDisplay:n}}(yield t.common.buildAndSendPacket({servcmd:"sns.friend_get_specified",data:e}))})}(a,this._core))||{},{successProfiles:c,failedProfiles:l}=this._processFriendProfileResponse(g);return{code:0,data:{friendList:c,failureUserIDList:[...l,...s]}}}catch(o){const{errorCode:A}=o||{};throw new this._core.helper.ChatError({code:A})}})}addFriend(t){return A(this,void 0,void 0,function*(){var i;const{helper:o,store:n,ssoLog:r}=this._core;try{const{to:s,source:g,type:c,wording:l,remark:I,groupName:u}=t,E={From_Account:null===(i=n.get("login"))||void 0===i?void 0:i.userId,AddFriendItem:[{To_Account:s,AddSource:g,AddWording:l,GroupName:u,Remark:I}],AddType:c},d=yield function(e,t){return A(this,void 0,void 0,function*(){return Q(yield t.common.buildAndSendPacket({servcmd:"sns.friend_add",data:e}))})}(E,this._core),{resultList:h=[]}=d,{userID:C,resultCode:B}=h[0];if(0===B)return r.debug("addFriend",`${e} addFriend ok`),{code:0,data:{userID:C}};if(B===a)return r.debug("addFriend",`${e} addFriend wait for the other party to agree`),{code:0,data:{userID:C,code:B,message:"wait for the other party to agree"}};throw new o.ChatError({functionName:"addFriend",code:B})}catch(s){const{errorCode:A}=s||{};throw new o.ChatError({code:A})}})}deleteFriend(i){return A(this,void 0,void 0,function*(){var o;const{store:n,ssoLog:r,helper:s}=this._core;try{let{userIDList:s,type:a}=i;const g=null===(o=n.get("login"))||void 0===o?void 0:o.userId;s.length>1e3&&(r.info("deleteFriend",`${e} deleteFriend the length of userIDList cannot exceed:1000`),s=s.slice(0,t));const{friendUserIdList:c,unFriendUserIdList:l}=this.partitionByIsFriend(s);if(0===c.length)return{code:0,data:{friendList:[],failureUserIDList:this._createNonFriendErrorList(l)}};const I={From_Account:g,To_Account:c,DeleteType:a},u=yield function(e,t){return A(this,void 0,void 0,function*(){return Q(yield t.common.buildAndSendPacket({servcmd:"sns.friend_delete",data:e}))})}(I,this._core),{successUserIDList:E,failureUserIDList:d}=this._processOperationResult({resultList:u.resultList,includeRelation:!1});return{code:0,data:{successUserIDList:E,failureUserIDList:d}}}catch(a){const{errorCode:A}=a||{};throw new s.ChatError({code:A})}})}updateFriend(e){return A(this,void 0,void 0,function*(){var A;const{helper:t,store:o,appStore:{userStore:n}}=this._core;try{const{userID:r,remark:s,friendCustomField:a}=e,g=null===(A=o.get("login"))||void 0===A?void 0:A.userId;if(!n.getFriendMap().has(r))throw new t.ChatError({functionName:"updateFriend",code:i});const c={From_Account:g,UpdateItem:[{To_Account:r,SnsItem:this._buildSnsItemList(s,a)}]},l=yield C(c,this._core),{resultList:I}=l,{to:u,resultCode:E,resultInfo:d}=I[0];if(h(E)||0===E)return{code:0,data:this._updateLocalFriend({userID:u,remark:s,friendCustomField:a})};throw new t.ChatError({functionName:"updateFriend",code:E,message:d})}catch(r){const{errorCode:A}=r||{};throw new t.ChatError({code:A})}})}checkFriend(e){return A(this,void 0,void 0,function*(){var A;const{OuterConstant:t,store:i,helper:o}=this._core;try{const{userIDList:o,type:n}=e,r={From_Account:null===(A=i.get("login"))||void 0===A?void 0:A.userId,To_Account:o,CheckType:n===t.SNS_CHECK_TYPE_SINGLE?n:t.SNS_CHECK_TYPE_BOTH},s=yield B(r,this._core),{successUserIDList:a=[],failureUserIDList:g=[]}=this._processOperationResult({resultList:s.resultList,includeRelation:!0});return{code:0,data:{successUserIDList:a,failureUserIDList:g}}}catch(n){const{errorCode:A}=n||{};throw new o.ChatError({code:A})}})}dispose(){this.reset();const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.LOGOUT,this.reset,this)}reset(){const{userStore:A}=this._core.appStore;A.getFriendMap().clear(),this._startIndex=0,this._standardSequence=0,this._customSequence=0}updateFriendList(t){return A(this,void 0,void 0,function*(){const{ssoLog:A,utils:{safeStringify:i}}=this._core;A.debug("updateFriendList",`${e} updateFriendList data:${i(t)}`);const{userStore:o}=this._core.appStore,{addedFriendList:n=[],removedFriendList:r=[]}=t;n.length>0&&(n.forEach(A=>{const e=new f({userID:A,core:this._core});o.getFriendMap().set(A,e)}),yield this.getFriendProfile({userIDList:n}),this._emitFriendListUpdated()),r.length>0&&(r.forEach(A=>{o.getFriendMap().delete(A)}),this._emitFriendListUpdated())})}updateFriendInfo(A){const{ssoLog:t,utils:{safeStringify:i}}=this._core;t.debug("updateFriendList",`${e} updateFriendInfo data:${i(A)}`);const{appStore:{userStore:o,conversationStore:n},utils:{isEmpty:r}}=this._core,{userID:s,tagValueList:a}=A[0]||{},g=o.getFriend(s);if(r(a)||!g)return;const l=a.map(A=>({tag:A.BytesTag,value:A.BytesValue}));l.forEach(A=>{var e;const{tag:t,value:i}=A,o=null===(e=n.getConversation(`C2C${s}`))||void 0===e?void 0:e.remark;t===c.REMARK&&i!==o&&n.updateConversation(`C2C${s}`,{remark:i}),g.update(l)}),this._emitFriendListUpdated()}_processFriendList(A){const{utils:{isEmpty:e},appStore:{userStore:t}}=this._core;e(A)||A.forEach(A=>{const{userID:e,tagValueList:i}=A;if(this._isInvalidFriend(e))return;const o=new f({userID:e,tagValueList:i,core:this._core});t.getFriendMap().set(e,o)})}_isInvalidFriend(A){return"@TLS#NOT_FOUND"===A||""===A}_fetchFriendProfile(){return A(this,void 0,void 0,function*(){const{appStore:{userStore:A},user:{userProfile:t},ssoLog:i}=this._core;i.debug("_fetchFriendProfile",`${e} _fetchFriendProfile`);const o=[...A.getFriendMap().keys()],n=Math.ceil(o.length/100);for(let e=0;e {const t=A.getFriend(e.userID);t&&(t.profile=e)}),this._emitFriendListUpdated()}})}_emitFriendListUpdated(){const{notificationCenter:A,OuterEvent:e,appStore:{userStore:t}}=this._core,i=Array.from(t.getFriendMap().values());A.emitOuterEvent(e.FRIEND_LIST_UPDATED,{name:e.FRIEND_LIST_UPDATED,data:i})}_updateCustomField(A,e){if(!Array.isArray(A)||!Array.isArray(e))return!1;let t=!1;return e.forEach(({key:e,value:i})=>{const o=A.find(A=>A.key===e);o?o.value!==i&&(o.value=i,t=!0):(A.push({key:e,value:i}),t=!0)}),t}_updateLocalFriend(A){const{userStore:e}=this._core.appStore,{userID:t,remark:i,friendCustomField:o}=A,n=e.getFriend(t);if(n)return h(i)||(n.remark=i),Array.isArray(o)&&o.length>0&&this._updateCustomField(n.friendCustomField,o),this._emitFriendListUpdated(),n}_processOperationResult(A){const{resultList:e,includeRelation:t=!1}=A,{isEmpty:i}=this._core.utils,o=[],n=[];return Array.isArray(e)&&!i(e)&&e.forEach(A=>{const{userID:e,relation:i,resultCode:r,resultInfo:s}=A;if(h(r)||0===r){const A={userID:e};t&&(A.code=0,A.relation=i),o.push(A)}else n.push({userID:e,code:r,message:s})}),{successUserIDList:o,failureUserIDList:n}}_createNonFriendErrorList(A){return A.map(A=>({userID:A,code:i,message:"The specified userID is not my friend"}))}_buildSnsItemList(A,e){const t=[];return h(A)||t.push({Tag:c.REMARK,Value:A}),Array.isArray(e)&&e.length>0&&e.forEach(A=>{t.push({tag:A.key,value:A.value})}),t}_processFriendProfileResponse(A){const{friendProfileList:e=[]}=A,{userStore:t}=this._core.appStore,i=[],o=[];return e.forEach(A=>{const{userID:e,resultCode:n,resultInfo:r,profileItem:s}=A;if(0===n){const A=new f({userID:e,tagValueList:s,core:this._core});i.push(A),t.getFriendMap().set(e,A)}else o.push({userID:e,code:n,message:r})}),{successProfiles:i,failedProfiles:o}}partitionByIsFriend(A){const e=[],t=[];return A.forEach(A=>{const{userStore:i}=this._core.appStore;i.getFriendMap().has(A)?e.push(A):t.push(A)}),{friendUserIdList:e,unFriendUserIdList:t}}isMyFriend(A){const{userStore:e}=this._core.appStore;return e.getFriendMap().has(A)}},y=new class{init(A){this.core=A}};function D(e){return A(this,void 0,void 0,function*(){var A;const{store:t,common:i}=y.core,o={From_Account:null===(A=t.get("login"))||void 0===A?void 0:A.userId,ResponseFriendItem:[{To_Account:e.userID,ResponseAction:e.type,Remark:e.remark}]};return S(yield i.buildAndSendPacket({servcmd:"sns.friend_response",data:o}))})}function v(e){return A(this,void 0,void 0,function*(){var A;const{store:t,common:i}=y.core,o={From_Account:null===(A=t.get("login"))||void 0===A?void 0:A.userId,ResponseFriendItem:[{To_Account:e.userID,ResponseAction:"Response_Action_Reject"}]};return S(yield i.buildAndSendPacket({servcmd:"sns.friend_response",data:o}))})}function w(e){return A(this,void 0,void 0,function*(){var A;const{store:t,common:i}=y.core,o={From_Account:null===(A=t.get("login"))||void 0===A?void 0:A.userId,To_Account:[e.userID],PendencyType:e.type};return S(yield i.buildAndSendPacket({servcmd:"sns.pendency_delete",data:o}))})}function S(A){const{ResultItem:e=[],ActionStatus:t,ErrorCode:i,ErrorInfo:o,ErrorDisplay:n}=A;return{resultList:e.map(A=>({userID:A.To_Account,resultCode:A.ResultCode,resultInfo:A.ResultInfo})),actionStatus:t,errorCode:i,errorInfo:o,errorDisplay:n}}var M=new class{constructor(){this._friendApplicationMap=new Map,this._unreadCount=0,this._startTime=0,this._currentSequence=0}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"getFriendApplicationList",context:this,methodName:"getFriendApplicationListFromCache"}),e.registerApi({apiName:"acceptFriendApplication",context:this}),e.registerApi({apiName:"refuseFriendApplication",context:this}),e.registerApi({apiName:"deleteFriendApplication",context:this}),e.registerApi({apiName:"setFriendApplicationRead",context:this})}getFriendApplicationListFromCache(){return A(this,void 0,void 0,function*(){const{ssoLog:A,utils:{safeStringify:t}}=this._core,i=[...this._friendApplicationMap.values()];return A.debug("getFriendApplicationListFromCache",`${e} getFriendApplicationListFromCache friendApplicationList:${t(i)}`),{code:0,data:{friendApplicationList:i,unreadCount:this._unreadCount}}})}syncFriendApplicationListFromServer(){return A(this,void 0,void 0,function*(){const{ssoLog:i,utils:{safeStringify:o}}=this._core,n="syncFriendApplicationListFromServer";try{const e=yield function(e){return A(this,void 0,void 0,function*(){var A;const{store:i,OuterConstant:o,common:n}=y.core,r={From_Account:null===(A=i.get("login"))||void 0===A?void 0:A.userId,PendencyType:o.SNS_APPLICATION_TYPE_BOTH,MaxLimited:t,StartTime:e.startTime,LastSequence:e.currentSequence};return function(A){const{PendencyItem:e=[],StartTime:t,UnreadPendencyCount:i,CurrentSequence:o,ActionStatus:n,ErrorCode:r,ErrorInfo:s,ErrorDisplay:a}=A;return{resultList:e.map(A=>({userID:A.To_Account,time:A.AddTime,source:A.AddSource,wording:A.AddWording,nick:A.Nick,type:A.PendencyType,avatar:A.Image})),startTime:t,unreadCount:i,currentSequence:o,actionStatus:n,errorCode:r,errorInfo:s,errorDisplay:a}}(yield n.buildAndSendPacket({servcmd:"sns.pendency_get",data:r}))})}({startTime:this._startTime,currentSequence:this._currentSequence}),{resultList:i,unreadCount:o,startTime:n,currentSequence:r}=e;this._startTime=n,this._currentSequence=r,this._unreadCount=o,this._friendApplicationMap.clear(),Array.isArray(i)&&i.forEach(A=>{const{userID:e,type:t}=A,i=this._createFriendApplication(A);this._friendApplicationMap.set(`${e}_${t}`,i)}),this._emitApplicationListUpdated()}catch(r){const A=new this._core.helper.ChatError({functionName:n,code:null==r?void 0:r.errorCode,message:null==r?void 0:r.errorInfo});throw i.error("syncFriendApplicationListFromServer",`${e} ${n} error:`,{error:A}),A}})}acceptFriendApplication(e){return A(this,void 0,void 0,function*(){const{OuterConstant:{SNS_APPLICATION_AGREE:A,SNS_APPLICATION_AGREE_AND_ADD:t}}=this._core;return[A,t].includes(e.type)||(e.type=t),this._operationApplication({functionName:"acceptFriendApplication",options:e,protocolFunction:D})})}refuseFriendApplication(e){return A(this,void 0,void 0,function*(){return this._operationApplication({functionName:"refuseFriendApplication",options:e,protocolFunction:v})})}deleteFriendApplication(e){return A(this,void 0,void 0,function*(){const{userID:A,type:t}=e;return this._checkApplicationExists(A,t,"deleteFriendApplication"),this._operationApplication({functionName:"deleteFriendApplication",options:e,protocolFunction:w})})}_checkApplicationExists(A,e,t){if(!this._friendApplicationMap.has(`${A}_${e}`))throw new this._core.helper.ChatError({functionName:t,code:r})}_operationApplication(t){return A(this,void 0,void 0,function*(){const{functionName:A,options:i,protocolFunction:o}=t;console.log(`${e} ${A} options:`,i);try{const t=yield o(i),{resultList:n=[]}=t,{resultCode:r,resultInfo:s}=n[0];if(0===r)return console.log(`${e} ${A} ok`),{code:0,data:{}};throw{errorCode:r,errorInfo:s}}catch(n){const t=new this._core.helper.ChatError({functionName:A,code:null==n?void 0:n.errorCode,message:null==n?void 0:n.errorInfo});throw console.error(`${e} ${A} error:`,t),t}})}setFriendApplicationRead(){return A(this,void 0,void 0,function*(){try{return yield function(){return A(this,void 0,void 0,function*(){var A;const{store:e,common:t}=y.core,i={From_Account:null===(A=e.get("login"))||void 0===A?void 0:A.userId,LatestPendencyTimeStamp:(o=Math.floor(Date.now()/1e3),n=0,Math.round(Number(o)*Math.pow(10,n))/Math.pow(10,n))};var o,n;return function(A){const{ActionStatus:e,ErrorCode:t,ErrorInfo:i,ErrorDisplay:o}=A;return{actionStatus:e,errorCode:t,errorInfo:i,errorDisplay:o}}(yield t.buildAndSendPacket({servcmd:"sns.pendency_report",data:i}))})}(),this._unreadCount=0,this._emitApplicationListUpdated(),{code:0,data:{}}}catch(e){throw new this._core.helper.ChatError({functionName:"setFriendApplicationRead",code:null==e?void 0:e.errorCode,message:null==e?void 0:e.errorInfo})}})}updateFriendApplicationList(A){const{from:e,addedApplicationList:t=[],removedApplicationList:i=[]}=A,{isEmpty:o}=this._core.utils;o(t)||this.onApplicationAdded(t,e),o(i)||this.onApplicationDeleted()}onApplicationAdded(A,e){var t;const{store:i,OuterConstant:o}=this._core,n=e===(null===(t=i.get("login"))||void 0===t?void 0:t.userId)?o.SNS_APPLICATION_SENT_BY_ME:o.SNS_APPLICATION_SENT_TO_ME;A.forEach(A=>{const e=`${A.userID}_${n}`;n!==o.SNS_APPLICATION_SENT_TO_ME||this._friendApplicationMap.has(e)||(this._unreadCount+=1),this._friendApplicationMap.set(e,this._createFriendApplication(Object.assign(Object.assign({},A),{type:n})))}),this._emitApplicationListUpdated()}onApplicationDeleted(){this._startTime=0,this._currentSequence=0,this.syncFriendApplicationListFromServer()}onApplicationRead(){this._unreadCount=0,this._emitApplicationListUpdated()}reset(){this._startTime=0,this._currentSequence=0,this._unreadCount=0,this._friendApplicationMap.clear()}dispose(){this.reset()}_createFriendApplication(A){return{userID:A.userID||"",nick:A.nick||"",avatar:A.avatar||"",time:A.time||0,source:A.source||"",wording:A.wording||"",type:A.type||""}}_emitApplicationListUpdated(){const{notificationCenter:A,OuterEvent:e}=this._core;A.emitOuterEvent(e.FRIEND_APPLICATION_LIST_UPDATED,{name:e.FRIEND_APPLICATION_LIST_UPDATED,data:{friendApplicationList:[...this._friendApplicationMap.values()],unreadCount:this._unreadCount}})}};function R(){return A(this,void 0,void 0,function*(){const{common:A}=y.core,e={From_Account:A.getCurrentUserID(),LastSequence:0,NeedFriend:"Need_Friend_Type_Yes"};return L(yield A.buildAndSendPacket({servcmd:"sns.group_get",data:e}),A=>({name:A.GroupName,userIDList:A.To_Account||[],count:A.FriendNumber}))})}function _(e){return A(this,void 0,void 0,function*(){const{name:A,userIDList:t}=e,{common:i}=y.core,o={From_Account:i.getCurrentUserID(),GroupName:[A],To_Account:t};return L(yield i.buildAndSendPacket({servcmd:"sns.group_add",data:o}),A=>({userID:A.To_Account,resultCode:A.ResultCode,resultInfo:A.ResultInfo}))})}function T(e){return A(this,void 0,void 0,function*(){const{common:A}=y.core,t={From_Account:A.getCurrentUserID(),GroupName:[e.name]};return L(yield A.buildAndSendPacket({servcmd:"sns.group_delete",data:t}))})}function N(e){return A(this,void 0,void 0,function*(){const{common:A}=y.core,{name:t,userIDList:i}=e,o=k(i,l),n={From_Account:A.getCurrentUserID(),GroupOldName:t,UpdateGroupItem:o};return L(yield A.buildAndSendPacket({servcmd:"sns.group_update",data:n}),A=>({userID:A.To_Account,updateType:A.UpdateType,resultCode:A.ResultCode,resultInfo:A.ResultInfo}))})}function b(e){return A(this,void 0,void 0,function*(){const{common:A}=y.core,{name:t,userIDList:i}=e,o=k(i,I),n={From_Account:A.getCurrentUserID(),GroupOldName:t,UpdateGroupItem:o};return L(yield A.buildAndSendPacket({servcmd:"sns.group_update",data:n}),A=>({userID:A.To_Account,updateType:A.UpdateType,resultCode:A.ResultCode,resultInfo:A.ResultInfo}))})}function G(e){return A(this,void 0,void 0,function*(){const{common:A}=y.core,{oldName:t,newName:i}=e,o={From_Account:A.getCurrentUserID(),GroupOldName:t,GroupNewName:i};return L(yield A.buildAndSendPacket({servcmd:"sns.group_update",data:o}))})}function k(A,e){return A.filter(A=>m.isMyFriend(A)).map(A=>({To_Account:A,UpdateType:e}))}function L(A,e){const{CurrentSequence:t,ActionStatus:i,ErrorCode:o,ErrorInfo:n,ErrorDisplay:r,ResultItem:s=[]}=A,a={currentSequence:t,actionStatus:i,errorCode:o,errorInfo:n,errorDisplay:r};return e&&s.length>0?Object.assign(Object.assign({},a),{resultList:s.map(e)}):a}class U{constructor(A){const{name:e="",userIDList:t=[]}=A;this.name=e,this.userIDList=t,this.count=t.length}addToUserIDList(A){-1===this.userIDList.indexOf(A)&&(this.userIDList.push(A),this.count=this.userIDList.length)}removeFromUserIDList(A){const e=this.userIDList.indexOf(A);e>-1&&(this.userIDList.splice(e,1),this.count=this.userIDList.length)}}var F=new class{constructor(){this._friendGroupMap=new Map}init(A){this._core=A;const{helper:e}=A;e.registerApi({apiName:"getFriendGroupList",context:this,methodName:"getFriendGroupListFromCache"}),e.registerApi({apiName:"createFriendGroup",context:this}),e.registerApi({apiName:"deleteFriendGroup",context:this}),e.registerApi({apiName:"addToFriendGroup",context:this}),e.registerApi({apiName:"removeFromFriendGroup",context:this}),e.registerApi({apiName:"renameFriendGroup",context:this})}getFriendGroupListFromCache(){return A(this,void 0,void 0,function*(){const{ssoLog:A,utils:{safeStringify:t}}=this._core,i=[...this._friendGroupMap.values()];return A.debug(`${e} getFriendGroupListFromCache, data:${t(i)}`),{code:0,data:i}})}syncFriendGroupListFromServer(){return A(this,void 0,void 0,function*(){const{ssoLog:A}=this._core,t="syncFriendGroupListFromServer";try{const i=yield R(),{resultList:o=[]}=i;this._core.helper.isEmpty(o)&&A.debug("syncFriendGroupListFromServer",`${e} ${t} ok. count: 0`),o.forEach(A=>{const e=new U(A);this._friendGroupMap.set(A.name,e)}),this._emitGroupListUpdated()}catch(i){this._handleError(t,i)}})}createFriendGroup(e){return A(this,void 0,void 0,function*(){const A="createFriendGroup";try{const{name:t}=e;this._checkGroupExist(A,t);const i=yield _(e),{successUserIDList:o,failureUserIDList:n}=this._parseCreateGroupResponse(i),r=new U({name:t,userIDList:o});return this._friendGroupMap.set(t,r),this._emitGroupListUpdated(),{code:0,data:{friendGroup:r,failureUserIDList:n}}}catch(t){this._handleError(A,t)}})}deleteFriendGroup(e){return A(this,void 0,void 0,function*(){const A="deleteFriendGroup";try{const{name:t}=e;this._checkGroupNotExist(A,t),yield T(e);const i=this._friendGroupMap.get(t);return i&&(this._updateFriendGroup({name:t,userIDList:i.userIDList,action:E}),this._friendGroupMap.delete(t)),this._emitGroupListUpdated(),{code:0,data:i}}catch(t){this._handleError(A,t)}})}addToFriendGroup(e){return A(this,void 0,void 0,function*(){return this._updateFriendGroupMember({functionName:"addToFriendGroup",params:e,protocolFunction:N})})}removeFromFriendGroup(e){return A(this,void 0,void 0,function*(){return this._updateFriendGroupMember({functionName:"removeFromFriendGroup",params:e,protocolFunction:b})})}renameFriendGroup(e){return A(this,void 0,void 0,function*(){const A="renameFriendGroup";try{const{oldName:t,newName:i}=e;this._checkGroupNotExist(A,t),this._checkGroupExist(A,i),yield G(e);const o=this._updateGroupNameInCache(t,i);return o&&this._updateFriendGroup({name:t,userIDList:o.userIDList,action:d,newName:i}),this._emitGroupListUpdated(),{code:0,data:o}}catch(t){this._handleError(A,t)}})}_updateFriendGroupMember(e){return A(this,void 0,void 0,function*(){const{functionName:A,params:t,protocolFunction:i}=e;try{const{name:e}=t;this._checkGroupNotExist(A,e);const o=yield i(t),{friendGroup:n,failureUserIDList:r}=this._parseUpdateFriendGroupResponse(e,o);return this._emitGroupListUpdated(),{code:0,data:{friendGroup:n,failureUserIDList:r}}}catch(o){this._handleError(A,o)}})}_updateGroupNameInCache(A,e){const t=this._friendGroupMap.get(A);return t&&(t.name=e,this._friendGroupMap.delete(A),this._friendGroupMap.set(e,t)),t}_parseCreateGroupResponse(A){const{resultList:e=[]}=A,t=[],i=[];return e.forEach(({userID:A,resultCode:e,resultInfo:o})=>{h(e)||0===e?t.push(A):i.push({userID:A,code:e,message:o})}),{successUserIDList:t,failureUserIDList:i}}_parseUpdateFriendGroupResponse(A,e){const{resultList:t=[]}=e,i=this._friendGroupMap.get(A),o=[],n=[],r=[];return t.forEach(e=>{0===e.resultCode?i&&(e.updateType===l?this._addFriendToGroup(A,e.userID,i,n):e.updateType===I&&this._removeFriendFromGroup(A,e.userID,i,r)):o.push({userID:e.userID,code:e.resultCode,message:e.resultInfo})}),{friendGroup:i,failureUserIDList:o}}_addFriendToGroup(A,e,t,i){t.addToUserIDList(e),i.push(e),this._updateFriendGroup({name:A,userIDList:i,action:u})}_removeFriendFromGroup(A,e,t,i){t.removeFromUserIDList(e),i.push(e),this._updateFriendGroup({name:A,userIDList:i,action:E})}_emitGroupListUpdated(){const{notificationCenter:A,OuterEvent:e}=this._core,t=[...this._friendGroupMap.values()];A.emitOuterEvent(e.FRIEND_GROUP_LIST_UPDATED,{name:e.FRIEND_GROUP_LIST_UPDATED,data:t})}_checkGroupNotExist(A,e){if(!this._friendGroupMap.has(e))throw new this._core.helper.ChatError({functionName:A,code:n})}_checkGroupExist(A,e){if(this._friendGroupMap.has(e))throw new this._core.helper.ChatError({functionName:A,code:o})}_updateFriendGroup(A){const{name:e,userIDList:t,action:i,newName:o}=A,{userStore:n}=this._core.appStore;e&&!this._core.utils.isEmpty(t)&&t.forEach(A=>{const t=n.getFriend(A);if(!t)return;const{groupList:r}=t;switch(i){case u:-1===r.indexOf(e)&&(r.push(e),t.count=r.length);break;case E:{const A=r.indexOf(e);A>-1&&(r.splice(A,1),t.count=r.length);break}case d:{if(!o)return;const A=r.indexOf(e);-1!==A&&(r[A]=o);break}}})}_handleError(A,e){throw new this._core.helper.ChatError({functionName:A,code:null==e?void 0:e.errorCode,message:null==e?void 0:e.errorInfo})}reset(){this._friendGroupMap.clear()}dispose(){this.reset()}};function O(A){return A&&0!==A.length?A.map(A=>({userID:A.To_Account,addBlackTimeStamp:A.AddBlackTimeStamp})):[]}var x=new class{constructor(){this._blacklistMap=new Map,this._retryCount=0,this._startIndex=0}init(A){this._core=A;const{helper:e,constants:t}=A;e.registerApi({apiName:"getBlacklist",context:this,methodName:"getBlacklistFromCache"}),e.registerApi({apiName:"addToBlacklist",context:this}),e.registerApi({apiName:"removeFromBlacklist",context:this}),e.registerWorkflowStep(t.WORKFLOW_NAME.SYNC_SERVER_INFO_AFTER_RE_ONLINE,t.WORKFLOW_STEP.BLACKLIST_RECOVER,this.syncBlacklistFromServer,this)}getBlacklistFromCache(){return A(this,void 0,void 0,function*(){return{code:0,data:Array.from(this._blacklistMap.keys())}})}syncBlacklistFromServer(){return A(this,void 0,void 0,function*(){try{this._core.ssoLog.debug(`${e} syncBlacklistFromServer`);const i={From_Account:this._core.common.getCurrentUserID(),MaxLimited:t,StartIndex:this._startIndex},o=yield function(e,t){return A(this,void 0,void 0,function*(){const{helper:A,channel:i}=t,o="sns.black_list_get",n=A.generateProtocolData({servcmd:o,data:e}),r=`${n.head.seq}${o}`,s=yield i.sendPacket(n,{requestId:r}),{BlackListItem:a=[],StartIndex:g=0}=s;return{blackList:O(a),startIndex:g}})}(i,this._core),{blackList:n=[],startIndex:r=0}=o;return this._startIndex=r,this._addBlacklistMap(n),this._emitBlackListUpdated(),0!==this._startIndex&&this._retryCount<10?(this._retryCount++,yield this.syncBlacklistFromServer()):this._retryCount=0,{code:0,data:Array.from(this._blacklistMap.keys())}}catch(i){throw this._retryCount=0,i}})}addToBlacklist(e){return A(this,void 0,void 0,function*(){const{helper:t}=this._core;try{const t=this._preprocessBlacklist(e),i={From_Account:this._core.common.getCurrentUserID(),To_Account:t},o=yield function(e,t){return A(this,void 0,void 0,function*(){const{helper:A,channel:i}=t,o="sns.black_list_add",n=A.generateProtocolData({servcmd:o,data:e}),r=`${n.head.seq}${o}`,s=yield i.sendPacket(n,{requestId:r}),{ResultItem:a=[]}=s;return{blackList:O(a)}})}(i,this._core),{blackList:n=[]}=o;return this._addBlacklistMap(n),this._emitBlackListUpdated(),{code:0,data:Array.from(this._blacklistMap.keys())}}catch(i){const{errorCode:A}=i||{};throw new t.ChatError({code:A})}})}removeFromBlacklist(e){return A(this,void 0,void 0,function*(){const{helper:t}=this._core;try{const t={From_Account:this._core.common.getCurrentUserID(),To_Account:e.userIDList},i=yield function(e,t){return A(this,void 0,void 0,function*(){const{helper:A,channel:i}=t,o="sns.black_list_delete",n=A.generateProtocolData({servcmd:o,data:e}),r=`${n.head.seq}${o}`,s=yield i.sendPacket(n,{requestId:r}),{ResultItem:a=[]}=s;return{blackList:O(a)}})}(t,this._core),{blackList:o=[]}=i;return this._deleteBlacklistMap(o),this._emitBlackListUpdated(),{code:0,data:Array.from(this._blacklistMap.keys())}}catch(i){const{errorCode:A}=i||{};throw new t.ChatError({code:A})}})}dispose(){this.reset()}reset(){this._retryCount=0,this._startIndex=0,this._blacklistMap.clear()}updateBlacklist(A){const{ssoLog:t,utils:{safeStringify:i}}=this._core;t.debug("updateBlacklist",`${e} updateBlacklist data: ${i(A)}`);const{addedBlacklist:o=[],removedBlacklist:n=[]}=A;let r=!1;o.length>0&&o.some(A=>!this._blacklistMap.has(A))&&(r=!0,this._addBlacklistMap(o.map(A=>({userID:A})))),n.length>0&&n.some(A=>this._blacklistMap.has(A))&&(r=!0,this._deleteBlacklistMap(n.map(A=>({userID:A})))),r&&this._emitBlackListUpdated()}_addBlacklistMap(A){const{ssoLog:t,utils:{safeStringify:i}}=this._core;t.debug("_addBlacklistMap",`${e} _addBlacklistMap blackList: ${i(A)}`),A.forEach(A=>{const{userID:e,addBlackTimeStamp:t=Date.now()}=A;e&&!this._blacklistMap.has(e)&&this._blacklistMap.set(e,{userID:e,addBlackTimeStamp:t})})}_deleteBlacklistMap(A){const{ssoLog:t,utils:{safeStringify:i}}=this._core;t.debug("_deleteBlacklistMap",`${e} _deleteBlacklistMap blackList: ${i(A)}`),A.forEach(A=>{const{userID:e}=A;e&&this._blacklistMap.has(e)&&this._blacklistMap.delete(e)})}_preprocessBlacklist(A){let{userIDList:e}=A;const t=this._core.common.getCurrentUserID();if(1===e.length&&e[0]===t)throw new this._core.helper.ChatError({functionName:"addToBlacklist",code:s});return e.includes(t)&&(e=A.userIDList.filter(A=>A!==t)),e}_emitBlackListUpdated(){const{notificationCenter:A,OuterEvent:t,ssoLog:i,utils:{safeStringify:o}}=this._core,n=Array.from(this._blacklistMap.keys());i.debug(`${e} _emitBlackListUpdated blackList:${o(n)}`),A.emitOuterEvent(t.BLACKLIST_UPDATED,{name:t.BLACKLIST_UPDATED,data:n})}};const P={addToBlacklist:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},removeFromBlacklist:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},getFriendProfile:{userIDList:{required:!0,rules:["array"],allowEmpty:!1}},addFriend:{to:{required:!0,rules:["string"],allowEmpty:!1},source:{required:!0,rules:["string"],allowEmpty:!1},wording:{required:!1,rules:["string"],allowEmpty:!0},type:{required:!1,rules:["string"],allowEmpty:!0,customValidator:A=>{const{OuterConstant:e}=y.core;return A===e.SNS_ADD_TYPE_SINGLE||A===e.SNS_ADD_TYPE_BOTH||"type should be SNS_ADD_TYPE_SINGLE or SNS_ADD_TYPE_BOTH"}},remark:{required:!1,rules:["string"],allowEmpty:!0},groupName:{required:!1,rules:["string"],allowEmpty:!0}},deleteFriend:{userIDList:{required:!0,rules:["array"],allowEmpty:!1},type:{required:!1,rules:["string"],allowEmpty:!0,customValidator:A=>{const{OuterConstant:e}=y.core;return A===e.SNS_DELETE_TYPE_SINGLE||A===e.SNS_DELETE_TYPE_BOTH||"type should be SNS_DELETE_TYPE_SINGLE or SNS_DELETE_TYPE_BOTH"}}},checkFriend:{userIDList:{required:!0,rules:["array"],allowEmpty:!1},type:{required:!1,rules:["string"],allowEmpty:!0}},updateFriend:{userID:{required:!0,rules:["string"],allowEmpty:!1},remark:{required:!1,rules:["string"],allowEmpty:!0},friendCustomField:{required:!1,rules:["array"],allowEmpty:!0}},acceptFriendApplication:{userID:{required:!0,rules:["string"],allowEmpty:!1},remark:{required:!1,rules:["string"],allowEmpty:!0},type:{required:!1,rules:["string"],allowEmpty:!0}},refuseFriendApplication:{userID:{required:!0,rules:["string"],allowEmpty:!1}},deleteFriendApplication:{userID:{required:!0,rules:["string"],allowEmpty:!1},type:{required:!0,rules:["string"],allowEmpty:!1,customValidator:A=>{const{OuterConstant:e}=y.core;return A===e.SNS_APPLICATION_SENT_TO_ME||A===e.SNS_APPLICATION_SENT_BY_ME||"type should be SNS_APPLICATION_SENT_TO_ME or SNS_APPLICATION_SENT_BY_ME"}}},createFriendGroup:{name:{required:!0,rules:["string"],allowEmpty:!1},userIDList:{required:!0,rules:["array"],allowEmpty:!1}},deleteFriendGroup:{name:{required:!0,rules:["string"],allowEmpty:!1}},addToFriendGroup:{name:{required:!0,rules:["string"],allowEmpty:!1},userIDList:{required:!0,rules:["array"],allowEmpty:!1}},removeFromFriendGroup:{name:{required:!0,rules:["string"],allowEmpty:!1},userIDList:{required:!0,rules:["array"],allowEmpty:!1}},renameFriendGroup:{oldName:{required:!0,rules:["string"],allowEmpty:!1},newName:{required:!0,rules:["string"],allowEmpty:!1}}},Y={getBlacklist:!0,addToBlacklist:!0,removeFromBlacklist:!0,getFriendList:!0,addFriend:!0,deleteFriend:!0,updateFriend:!0,checkFriend:!0,getFriendProfile:!0,getFriendApplicationList:!0,acceptFriendApplication:!0,refuseFriendApplication:!0,deleteFriendApplication:!0,setFriendApplicationRead:!0,getFriendGroupList:!0,createFriendGroup:!0,deleteFriendGroup:!0,addToFriendGroup:!0,removeFromFriendGroup:!0,renameFriendGroup:!0};return new class{constructor(){this.name="Friend"}install(A){A.ssoLog.debug(`${e} install`),this._core=A;const{helper:t,notificationCenter:i,InnerEvent:o,constants:{WORKFLOW_NAME:n,WORKFLOW_STEP:r}}=A;y.init(A),m.init(A),M.init(A),F.init(A),x.init(A),t.registerValidateConfig({auth:Y,params:P}),t.registerWorkflowStep(n.SYNC_SERVER_INFO_AFTER_LOGIN,r.FRIEND_AND_BLACKLIST_SYNC,this.handleLoginSuccess,this),i.subscribeInnerEvent(o.LOGOUT,this.reset,this),i.subscribeInnerEvent(o.MESSAGE_PUSH,i.InnerEventSubType.FRIEND_LIST_MODIFIED,this.onFriendModified,this)}handleLoginSuccess(){x.syncBlacklistFromServer(),m.syncFriendListFromServer(),M.syncFriendApplicationListFromServer(),F.syncFriendGroupListFromServer()}onFriendModified(A){const{from:e,addedBlacklist:t,removedBlacklist:i,addedFriendList:o,removedFriendList:n,addedApplicationList:r,removedApplicationList:s,friendUpdateInfo:a,reportTime:g}=this._parseFriendListModification(null==A?void 0:A.FriendListMod[0]),{isEmpty:c}=this._core.utils;c(t)&&c(i)||x.updateBlacklist({addedBlacklist:t,removedBlacklist:i}),c(o)&&c(n)||(m.updateFriendList({addedFriendList:o,removedFriendList:n}),M.updateFriendApplicationList({from:e,removedApplicationList:o})),c(a)||m.updateFriendInfo(a),c(r)&&c(s)||M.updateFriendApplicationList({from:e,addedApplicationList:r,removedApplicationList:s}),g&&M.onApplicationRead()}_parseFriendListModification(A){const{PushType:e,From_Account:t,To_Account:i,ReportTime:o,BlackListAdd_Account:n=[],BlackListDel_Account:r=[],FriendAdd_Account:s=[],FriendDel_Account:a=[],PendencyAdd:g=[],FrienPencydDel_Account:c=[],FriendUpInfo:l=[]}=A,I=l.map(A=>({userID:A.Friend_Account,tagValueList:[...A.SNS]}));return{pushType:e,from:t,to:i,reportTime:o,addedBlacklist:n,removedBlacklist:r,addedFriendList:s,removedFriendList:a,addedApplicationList:g.map(A=>({userID:A.PendencyAdd_Account,source:A.AddSource,time:A.AddTime,wording:A.AddWording,nick:A.ProfileImNick})),friendUpdateInfo:I,removedApplicationList:c}}reset(){x.reset(),m.reset(),M.reset(),F.reset()}dispose(){const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.LOGOUT,this.reset,this),A.unSubscribeInnerEvent(e.MESSAGE_PUSH,A.InnerEventSubType.FRIEND_LIST_MODIFIED,this.onFriendModified,this),x.dispose(),m.dispose(),M.dispose(),F.dispose()}}}();const d_=RR(E_.exports);var h_={exports:{}};h_.exports=function(){var A=new class{constructor(){this._conversationGroupMap=new Map}init(A){this._core=A}getConversationGroupMap(){return this._conversationGroupMap}getConversationGroup(A){return this._conversationGroupMap.get(A)}setConversationGroup(A,e){this._conversationGroupMap.set(A,e)}};function e(A,e,t,i){return new(t||(t=Promise))(function(o,n){function r(A){try{a(i.next(A))}catch(e){n(e)}}function s(A){try{a(i.throw(A))}catch(e){n(e)}}function a(A){var e;A.done?o(A.value):(e=A.value,e instanceof t?e:new t(function(A){A(e)})).then(r,s)}a((i=i.apply(A,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const t=new class{init(A){this.core=A}},i="CONV_GROUP",o=2500,n=2503,r=1,s=2,a="NOT_STARTED",g="FETCHING",c="FINISHED",l="FAILED",I=0,u=1,E=1,d=2,h=3,C=1,B=2;function Q(A){const{helper:e,constants:o}=t.core;if(!e.checkBusinessCapabilityBits(i))throw new e.ChatError({functionName:A,code:o.ERROR_CODE.NO_USE,replacement1:A})}function p(){const{notificationCenter:e,OuterEvent:i}=t.core;e.emitOuterEvent(i.CONVERSATION_GROUP_LIST_UPDATED,{name:i.CONVERSATION_GROUP_LIST_UPDATED,data:[...A.getConversationGroupMap().values()]})}function f(A){const{utils:{isUndefined:e},constants:{OuterConstant:i}}=t.core,{Type:o,To_Account:n,Peer_Account:a}=A;let g="";const c=A.ToGroupId||A.GroupId;return o===r?e(a)?e(n)||(g=`${i.CONV_C2C}${n}`):g=`${i.CONV_C2C}${a}`:o===s&&(g=`${i.CONV_GROUP}${c}`),g}function m(A){const e=[],{OuterConstant:i,common:{isC2CConv:o,isGroupConv:n}}=t.core,{conversationIDList:a,failureConversationIDList:g,additionalData:c={}}=A;return a.forEach(A=>{y(A,g),o(A)?e.push(Object.assign({ContactItem:{Type:r,To_Account:A.replace(i.CONV_C2C,"")}},c)):n(A)&&e.push(Object.assign({ContactItem:{Type:s,ToGroupId:A.replace(i.CONV_GROUP,"")}},c))}),e}function y(A,e){const{appStore:{conversationStore:i},common:{isC2CConv:r,isGroupConv:s}}=t.core;i.getConversation(A)?r(A)||s(A)||e.push({conversationID:A,code:n}):e.push({conversationID:A,code:o})}function D(A){const{utils:{isString:e}}=t.core,i=[];if(!e(A))return i;const o=A.length;if(0===o)return i;for(let t=o-1;t>=0;t--)"1"===A[t]&&i.push(Math.pow(2,o-t-1));return i}function v(A){null==A||A.forEach((e,i)=>{const{appStore:o}=t.core,{conversationID:n,data:r}=e,s=i===A.length-1;o.conversationStore.updateConversation(n,r,{emit:s})})}function w(A){const{conversationInfoList:e,fromAccount:i}=A,o={From_Account:i,MarkItem:e};return t.core.common.buildAndSendPacket({servcmd:"recentcontact.mark_contact",data:o})}function S(A){const{fromAccount:e,groupName:i,conversationInfoList:o}=A,n={From_Account:e,UpdateType:1,UpdateGroup:{UpdateGroupType:B,OldGroupName:i,ContactUpdateItem:o}};return t.core.common.buildAndSendPacket({servcmd:"recentcontact.update_contact_group",data:n})}var M=new class{init(A){const{helper:{registerApi:e}}=A;this._core=A,e({apiName:"createConversationGroup",context:this})}createConversationGroup(i){return e(this,void 0,void 0,function*(){const{utils:{isPlainObject:e,isArray:o},appStore:n}=this._core;Q("createConversationGroup");const{groupName:r,conversationIDList:s}=i,a=[],g=this._generateConversationInfo(s,a);if(a.length===s.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:a}};try{const i=yield function(A){const{common:{buildAndSendPacket:e,getCurrentUserID:i}}=t.core,{item:o,groupName:n}=A;return e({servcmd:"recentcontact.create_contact_group",data:{From_Account:i(),GroupContactItem:[{GroupName:n,ContactItem:o}]}})}({groupName:r,item:g});if(i){const{GroupResultItem:t=[]}=i,{GroupItem:s,ResultItem:g}=(null==t?void 0:t[0])||{},c=[];if(e(s)){const{GroupName:e,GroupId:t}=s;A.setConversationGroup(t,e),p()}if(o(g)){const A=[];g.forEach(e=>{const{ContactItem:t,ResultCode:i,ResultInfo:o}=e,s=f(t);if(0===i){const e=n.conversationStore.getConversation(s);if(e&&!e.conversationGroupList.includes(r)){const t=e.conversationGroupList.slice();t.push(r),A.push({conversationID:s,data:{conversationGroupList:t}})}}else a.push({conversationID:s,code:i,message:o})}),A.length>0&&(v(A),p())}return{code:0,data:{successConversationIDList:c,failureConversationIDList:a}}}}catch(c){const{errorCode:A,errorInfo:e}=c;throw new this._core.helper.ChatError({functionName:"createConversationGroup",code:A,message:e})}})}_generateConversationInfo(A,e,t={}){const i=[],{OuterConstant:o,common:{isC2CConv:n,isGroupConv:a}}=this._core;return A.forEach(A=>{y(A,e),n(A)?i.push(Object.assign({Type:r,To_Account:A.replace(o.CONV_C2C,"")},t)):a(A)&&i.push(Object.assign({Type:s,ToGroupId:A.replace(o.CONV_GROUP,"")},t))}),i}},R=new class{constructor(){this._fetchConversationGroupStatus=a}init(A){const{helper:{registerApi:e,registerWorkflowStep:t},constants:{WORKFLOW_NAME:i,WORKFLOW_STEP:o}}=A;this._core=A,e({apiName:"getConversationGroupList",context:this}),t(i.SYNC_SERVER_INFO_AFTER_LOGIN,o.CONVERSATION_GROUP_LIST_SYNC,this._syncConversationGroupList,this),t(i.SYNC_SERVER_INFO_AFTER_LOGIN,o.CONVERSATION_GROUP_UPDATE,this._updateConversation,this)}getConversationGroupList(){return e(this,void 0,void 0,function*(){return Q("getConversationGroupList"),this._fetchConversationGroupStatus===l&&(yield this._fetchConversationGroupList(0)),{code:0,data:[...A.getConversationGroupMap().values()]}})}_syncConversationGroupList(){return e(this,void 0,void 0,function*(){return yield this._fetchConversationGroupList(0)})}_fetchConversationGroupList(i){return e(this,arguments,void 0,function*(e,i=[]){const{common:{getCurrentUserID:o},utils:{isArray:n}}=this._core;this._fetchConversationGroupStatus=g;try{const r=o(),s=yield function(A){const{fromAccount:e,startIndex:i}=A,o={From_Account:e,StartIndex:i};return t.core.common.buildAndSendPacket({servcmd:"recentcontact.get_contact_group",data:o})}({fromAccount:r,startIndex:e});if(s){const{CompleteFlag:e,ContactItem:t=[],NextStartIndex:o=0,GroupItem:r=[]}=s;if(n(r)&&r.forEach(e=>{const{GroupName:t,GroupId:i}=e;A.setConversationGroup(i,t)}),i.push(...t),e===I)return this._fetchConversationGroupList(o);if(e===u)return this._fetchConversationGroupStatus=c,i}}catch(r){this._fetchConversationGroupStatus=l,console.error(r)}})}_updateConversation(A){var e;const{constants:{WORKFLOW_STEP:t}}=this._core,i=(null===(e=null==A?void 0:A.result)||void 0===e?void 0:e[t.CONVERSATION_GROUP_LIST_SYNC])||[];v(this._generateConversationUpdateFields(i)),p()}_generateConversationUpdateFields(e){const{utils:{isArray:t},appStore:i}=this._core,o=[];if(t(e)){let n;e.forEach(e=>{const r=[],{StandardMark:s,CustomMark:a="",ContactGroupId:g}=e;t(g)&&g.forEach(e=>{A.getConversationGroupMap().has(e)&&r.push(A.getConversationGroup(e))});const c=f(e);n=i.conversationStore.getConversation(c),n&&o.push({conversationID:c,data:{markList:D(s),customData:a,conversationGroupList:[...r]}})})}return o}reset(){this._fetchConversationGroupStatus=a}dispose(){this.reset()}},_=new class{init(A){const{notificationCenter:e,helper:{registerApi:t},InnerEvent:{MESSAGE_PUSH:i},InnerEventSubType:{CONVERSATION_MARK_UPDATED:o,CONVERSATION_GROUP_ADD:n,CONVERSATION_GROUP_DELETED:r,CONVERSATION_GROUP_UPDATED:s}}=A;this._core=A,t({apiName:"renameConversationGroup",context:this}),t({apiName:"deleteConversationGroup",context:this}),t({apiName:"markConversation",context:this}),t({apiName:"setConversationCustomData",context:this}),t({apiName:"deleteConversationsFromGroup",context:this}),t({apiName:"addConversationsToGroup",context:this}),e.subscribeInnerEvent(i,n,this._handleConversationGroupAdd,this),e.subscribeInnerEvent(i,r,this._handleConversationGroupDeleted,this),e.subscribeInnerEvent(i,s,this._handleConversationGroupUpdated,this),e.subscribeInnerEvent(i,o,this._handleConversationMarkUpdated,this)}renameConversationGroup(i){return e(this,void 0,void 0,function*(){Q("renameConversationGroup");const{common:{getCurrentUserID:e}}=this._core,{oldName:o,newName:n}=i,r=`oldName:${o} newName:${n}`;try{const i=yield function(A){const{fromAccount:e,oldName:i,newName:o}=A,n={From_Account:e,UpdateType:1,UpdateGroup:{UpdateGroupType:C,OldGroupName:i,NewGroupName:o}};return t.core.common.buildAndSendPacket({servcmd:"recentcontact.update_contact_group",data:n})}({fromAccount:e(),oldName:o,newName:n});if(i){const{UpdateGroupResult:e}=i,{GroupId:t}=e;A.setConversationGroup(t,n),p(),this._updateLocalConversationGroupName({oldName:o,newName:n})}return{successLog:{message:r}}}catch(s){const{errorCode:A,errorInfo:e}=s;throw new this._core.helper.ChatError({functionName:"renameConversationGroup",code:A,message:e,moreMessage:r})}})}deleteConversationGroup(i){return e(this,void 0,void 0,function*(){Q("deleteConversationGroup");const{common:{getCurrentUserID:e}}=this._core;try{const o=yield function(A){const{fromAccount:e,groupName:i}=A,o={From_Account:e,GroupName:[i]};return t.core.common.buildAndSendPacket({servcmd:"recentcontact.del_contact_group",data:o})}({fromAccount:e(),groupName:i});if(o){const{GroupItem:e}=o;let t=!1;return null==e||e.forEach(e=>{const{GroupId:i}=e,o=A.getConversationGroupMap();o.has(i)&&(o.delete(i),t=!0)}),t&&p(),this._deleteLocalConversationGroupName([i]),{successLog:{message:`groupName:${i}`}}}}catch(o){const{errorCode:A,errorInfo:e}=o;throw new this._core.helper.ChatError({functionName:"deleteConversationGroup",code:A,message:e,moreMessage:`groupName:${i}`})}})}markConversation(A){return e(this,void 0,void 0,function*(){Q("markConversation");const{utils:{isNumber:e},common:{getCurrentUserID:t},appStore:i}=this._core,{conversationIDList:o,markType:n,enableMark:r}=A,s=this._getFlagBit(n),a=[],g=[];let c,l;!0===r&&e(s)?c=[s]:l=[s];const I=m({conversationIDList:o,failureConversationIDList:a,additionalData:{SetMark:c,ClearMark:l,OptType:E}});if(a.length===o.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:a}};try{const A=yield w({conversationInfoList:I,fromAccount:t()});if(A){const{ResultItem:e}=A,t=[];e.forEach(A=>{const{ContactItem:e,ResultCode:o,ResultInfo:s}=A,c=f(e);if(0===o){g.push(c);const A=i.conversationStore.getConversation(c);if(A){const e=A.markList.indexOf(n),i=!1===r&&-1!==e;if(!0===r&&-1===e)t.push({conversationID:c,data:{markList:[...A.markList,n]}});else if(i){const i=A.markList.slice();i.splice(e,1),t.push({conversationID:c,data:{markList:i}})}}}else a.push({conversationID:c,code:o,message:s})}),v(t)}return{code:0,data:{successConversationIDList:g,failureConversationIDList:a}}}catch(u){const{errorCode:A,errorInfo:e}=u;throw new this._core.helper.ChatError({functionName:"markConversation",code:A,message:e})}})}setConversationCustomData(A){return e(this,void 0,void 0,function*(){Q("setConversationCustomData");const{common:{getCurrentUserID:e},appStore:t}=this._core,{conversationIDList:i,customData:o}=A,n=[],r=[],s=m({conversationIDList:i,failureConversationIDList:n,additionalData:{CustomMark:o,OptType:d}});if(n.length===i.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:n}};try{const A=yield w({fromAccount:e(),conversationInfoList:s});if(A){const{ResultItem:e}=A,i=[];null==e||e.forEach(A=>{const{ContactItem:e,ResultCode:s,ResultInfo:a}=A;if(0===s){const A=f(e);r.push(A);const n=t.conversationStore.getConversation(A);n&&n.customData!==o&&i.push({conversationID:A,data:{customData:o}})}else n.push({conversationID:conversationID,code:s,message:a})}),v(i)}return{code:0,data:{successConversationIDList:r,failureConversationIDList:n}}}catch(a){const{errorCode:A,errorInfo:e}=a;throw new this._core.helper.ChatError({functionName:"setConversationCustomData",code:A,message:e})}})}deleteConversationsFromGroup(A){return e(this,void 0,void 0,function*(){Q("deleteConversationsFromGroup");const{common:{getCurrentUserID:e},appStore:t}=this._core,{conversationIDList:i,groupName:o}=A,n=[],r=[],s=m({conversationIDList:i,failureConversationIDList:n,additionalData:{ContactOptType:2}});if(n.length===i.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:n}};try{const A=yield S({fromAccount:e(),groupName:o,conversationInfoList:s});if(A){const e=[],{UpdateGroupResult:{ContactResultItem:i}}=A;null==i||i.forEach(A=>{const i=f(A.ContactItem);if(0===A.ResultCode){const A=t.conversationStore.getConversation(i);if(A){const t=A.conversationGroupList.indexOf(o);if(-1!==t){const o=A.conversationGroupList.slice();o.splice(t,1),r.push(i),e.push({conversationID:i,data:{conversationGroupList:o}})}}}else n.push({conversationID:i,code:A.ResultCode,message:A.ResultInfo})}),e.length>0&&(p(),v(e))}return{code:0,data:{successConversationIDList:r,failureConversationIDList:n}}}catch(a){const{errorCode:A,errorInfo:e}=a;throw new this._core.helper.ChatError({functionName:"deleteConversationsFromGroup",code:A,message:e})}})}addConversationsToGroup(A){return e(this,void 0,void 0,function*(){Q("deleteConversationsFromGroup");const{common:{getCurrentUserID:e},appStore:t}=this._core,{conversationIDList:i,groupName:o}=A,n=[],r=[],s=m({conversationIDList:i,failureConversationIDList:n,additionalData:{ContactOptType:1}});if(n.length===i.length)return{code:0,data:{successConversationIDList:[],failureConversationIDList:n}};try{const A=yield S({fromAccount:e(),groupName:o,conversationInfoList:s});if(A){const e=[],{UpdateGroupResult:{ContactResultItem:i}}=A;null==i||i.forEach(A=>{const i=f(A.ContactItem);if(0===A.ResultCode){const A=t.conversationStore.getConversation(i);if(A&&-1===A.conversationGroupList.indexOf(o)){const t=A.conversationGroupList.slice();t.push(o),r.push(i),e.push({conversationID:i,data:{conversationGroupList:t}})}}else n.push({conversationID:i,code:A.ResultCode,message:A.ResultInfo})}),e.length>0&&(p(),v(e))}return{code:0,data:{successConversationIDList:r,failureConversationIDList:n}}}catch(a){const{errorCode:A,errorInfo:e}=a;throw new this._core.helper.ChatError({functionName:"deleteConversationsFromGroup",code:A,message:e})}})}_updateLocalConversationGroupName(A){const{appStore:e}=this._core,{oldName:t,newName:i}=A;let o=[];const n=[];let r=-1;Array.from(e.conversationStore.getConversationMap().values()).forEach(A=>{if(o=A.conversationGroupList,r=o.indexOf(t),-1!==r){const e=o.slice();e.splice(r,1,i),n.push({conversationID:A.conversationID,data:{conversationGroupList:e}})}}),v(n)}_deleteLocalConversationGroupName(A){const{utils:{isEmpty:e},appStore:t}=this._core;if(e(A))return;const i=[];Array.from(t.conversationStore.getConversationMap().values()).forEach(e=>{const{conversationID:t,conversationGroupList:o}=e,n=o.filter(e=>!A.includes(e));n.length =0;i--)if("1"===e[i])return t-i-1}_handleConversationGroupAdd(e){var t;const{utils:{isArray:i},appStore:o}=this._core;null===(t=null==e?void 0:e.RecentContactMod)||void 0===t||t.forEach(e=>{const{RecentContactCreateContactGroup:{MsgContactGroupContactItem:t}}=e;let n=!1;null==t||t.forEach(e=>{const{MsgGroupItem:t,MsgRecentContactItem:r}=e,{GroupId:s,GroupName:a}=t,g=[];A.getConversationGroup(s)!==a&&(A.setConversationGroup(s,a),n=!0),i(r)&&r.forEach(A=>{var e;const t=f(A),i=o.conversationStore.getConversation(t);if(i&&!(null===(e=i.conversationGroupList)||void 0===e?void 0:e.includes(a))){const A=i.conversationGroupList.slice();A.push(a),g.push({conversationID:t,data:{conversationGroupList:A}})}}),n&&p(),v(g)})})}_handleConversationGroupDeleted(e){var t;const{utils:{isArray:i}}=this._core;null===(t=null==e?void 0:e.RecentContactMod)||void 0===t||t.forEach(e=>{const{MsgGroupItem:t}=(null==e?void 0:e.RecentContactDelContactGroup)||{};if(i(t)){let e=!1;const i=[];t.forEach(t=>{const{GroupId:o,GroupName:n}=t,r=A.getConversationGroupMap();r.has(o)&&(r.delete(o),e=!0,i.push(n))}),e&&p(),i.length>0&&this._deleteLocalConversationGroupName(i)}})}_handleConversationGroupUpdated(A){var e;null===(e=A.RecentContactMod)||void 0===e||e.forEach(A=>{const{RecentContactUpdateContactGroup:{MsgUpdateGroup:{GroupId:e,GroupName:t,OldGroupName:i,RecentContactUpdateGroupItem:o,UpdateGroupType:n}}}=A;1===n?this._handleGroupNameUpdated({groupID:e,newName:t,oldName:i}):2===n&&this._handleGroupAddOrDeleteFromConversation({groupInfoList:o,groupName:i})})}_handleConversationMarkUpdated(A){var e;const{appStore:t}=this._core;null===(e=null==A?void 0:A.RecentContactMod)||void 0===e||e.forEach(A=>{const{RecentContactMarkContact:{RecentContactMarkContactItem:e}}=A,i=[];null==e||e.forEach(A=>{const{RecentContactItem:e,CustomMark:o,StandardMark:n,OptType:r}=A,s=f(e),a=t.conversationStore.getConversation(s);a&&(r===E?this._updateStandMark({conversation:a,standardMark:n,updateConversationList:i}):r===d?this._updateCustomMark({conversation:a,customMark:o,updateConversationList:i}):r===h&&(this._updateStandMark({conversation:a,standardMark:n,updateConversationList:i}),this._updateCustomMark({conversation:a,customMark:o,updateConversationList:i})))}),v(i)})}_updateStandMark(A){const{conversation:e,standardMark:t,updateConversationList:i}=A,o=D(t);(function(A,e){if(A===e)return!0;if(!A||!e)return!1;if(A.length!==e.length)return!1;A.sort(),e.sort();for(let t=0,i=A.length;t{const{RecentContactItem:o,ContactOptType:n}=A,r=f(o),s=t.conversationStore.getConversation(r),a=s.conversationGroupList.indexOf(e);if(s){const A=s.conversationGroupList.slice();1===n&&-1===a?(A.push(e),i.push({conversationID:r,data:{conversationGroupList:A}})):2===n&&-1!==a&&(A.splice(a,1),i.push({conversationID:r,data:{conversationGroupList:A}}))}}),v(i)}dispose(){const{notificationCenter:A,InnerEvent:{MESSAGE_PUSH:e},InnerEventSubType:{CONVERSATION_MARK_UPDATED:t,CONVERSATION_GROUP_ADD:i,CONVERSATION_GROUP_DELETED:o,CONVERSATION_GROUP_UPDATED:n}}=this._core;A.unSubscribeInnerEvent(e,i,this._handleConversationGroupAdd,this),A.unSubscribeInnerEvent(e,o,this._handleConversationGroupDeleted,this),A.unSubscribeInnerEvent(e,n,this._handleConversationGroupUpdated,this),A.unSubscribeInnerEvent(e,t,this._handleConversationMarkUpdated,this)}};const T={required:!0,rules:["string"],allowEmpty:!1},N={required:!0,rules:["array"],allowEmpty:!1},b={createConversationGroup:{groupName:T,conversationIDList:{required:!0,rules:["array"],allowEmpty:!1}},renameConversationGroup:{oldName:T,newName:Object.assign(Object.assign({},T),{customValidator:A=>!(A.length>32)||"newName length cannot longer than 32"})},deleteConversationGroup:[{required:!0,rules:["string"],allowEmpty:!1}],addConversationsToGroup:{conversationIDList:N,groupName:T},deleteConversationsFromGroup:{conversationIDList:N,groupName:T},markConversation:{conversationIDList:N,markType:{required:!0,rules:["number"],allowEmpty:!1,customValidator:A=>A<=0?"markType must be greater than 0":!(A>=Math.pow(2,64))||"markType must be less than 2^64"},enableMark:{required:!0,rules:["boolean"],allowEmpty:!1}},setConversationCustomData:{conversationIDList:N,customData:{required:!1,rules:["string"],allowEmpty:!0,customValidator:A=>"string"!=typeof A?"customData must be string":!(A.length>256)||"customData length cannot longer than 256"}}},G={createConversationGroup:!0,deleteConversationGroup:!0,renameConversationGroup:!0,getConversationGroupList:!0,addConversationsToGroup:!0,deleteConversationsFromGroup:!0,markConversation:!0,setConversationCustomData:!0};return new class{constructor(){this.name="ConversationGroup"}install(e){this._core=e,t.init(e),A.init(e),M.init(e),R.init(e),_.init(e),e.helper.registerValidateConfig({auth:G,params:b}),e.notificationCenter.subscribeInnerEvent(e.InnerEvent.LOGOUT,this.reset,this),e.notificationCenter.subscribeInnerEvent(e.InnerEvent.DESTROY,this.dispose,this)}dispose(){const{notificationCenter:A,InnerEvent:e}=this._core;A.unSubscribeInnerEvent(e.LOGOUT,this.reset,this),A.unSubscribeInnerEvent(e.DESTROY,this.dispose,this),_.dispose(),R.dispose()}reset(){R.reset()}}}();const C_=RR(h_.exports);function B_(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(A);o {this.events[A].clear()}),this.events={}}dispatch(A,e){if(this.events[A])for(const t of this.events[A].keys())t.call(this,e)}bindIMEvents(){this.engine.chat.on(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.on(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.on(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.on(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.on(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.on(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.on(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.on(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.on(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_GROUP_LIST_UPDATED,this.onFriendGroupListUpdated,this)}unbindIMEvents(){this.engine.chat.off(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.off(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.off(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.off(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.off(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.off(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.off(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.off(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.off(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_GROUP_LIST_UPDATED,this.onFriendGroupListUpdated,this),A.instance=null}onSDKReady(A){this.dispatch(this.engine.EVENT.SDK_READY,A.data)}onSDKNotReady(A){this.dispatch(this.engine.EVENT.SDK_NOT_READY,A.data)}onKickedOut(A){this.dispatch(this.engine.EVENT.KICKED_OUT,A.data)}onNetStateChange(A){this.dispatch(this.engine.EVENT.NET_STATE_CHANGE,A.data)}onReceiveMessage(A){this.dispatch(this.engine.EVENT.MESSAGE_RECEIVED,A.data)}onMessageModified(A){this.dispatch(this.engine.EVENT.MESSAGE_MODIFIED,A.data)}onMessageRevoked(A){this.dispatch(this.engine.EVENT.MESSAGE_REVOKED,A.data)}onMessageReadByPeer(A){this.dispatch(this.engine.EVENT.MESSAGE_READ_BY_PEER,A.data)}onMessageReadReceiptReceived(A){this.dispatch(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,A.data)}onMessageReactionsUpdated(A){this.dispatch(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,A.data)}onConversationListUpdated(A){this.dispatch(this.engine.EVENT.CONVERSATION_LIST_UPDATED,A.data)}onTotalMessageCountUpdated(A){this.dispatch(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,A.data)}onProfileUpdated(A){this.dispatch(this.engine.EVENT.PROFILE_UPDATED,A.data)}onBlacklistUpdated(A){this.dispatch(this.engine.EVENT.BLACKLIST_UPDATED,A.data)}onUserStatusUpdated(A){this.dispatch(this.engine.EVENT.USER_STATUS_UPDATED,A.data)}onGroupListUpdated(A){this.dispatch(this.engine.EVENT.GROUP_LIST_UPDATED,A.data)}onGroupAttributesUpdated(A){this.dispatch(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,A.data)}onGroupCounterUpdated(A){this.dispatch(this.engine.EVENT.GROUP_COUNTER_UPDATED,A.data)}onFriendListUpdated(A){this.dispatch(this.engine.EVENT.FRIEND_LIST_UPDATED,A.data)}onFriendApplicationListUpdated(A){this.dispatch(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,A.data)}onFriendGroupListUpdated(A){this.dispatch(this.engine.EVENT.FRIEND_GROUP_LIST_UPDATED,A.data)}};var f_,m_,y_,D_,v_,w_,S_,M_,R_,__;(__=f_||(f_={})).TUIStore="TUIStore",__.TUITranslate="TUITranslate",__.TUIConversation="TUIConversation",__.TUIChat="TUIChat",__.TUIGroup="TUIGroup",__.TUIUser="TUIUser",__.TUIFriend="TUIFriend",__.TUIReport="TUIReport",__.TUISearch="TUISearch",function(A){A.APP="application",A.CONV="conversation",A.CHAT="chat",A.GRP="group",A.USER="user",A.FRIEND="friend",A.SEARCH="search",A.CUSTOM="custom"}(m_||(m_={})),function(A){A[A.UNSUB_USER=-1]="UNSUB_USER"}(y_||(y_={})),function(A){A.BUSINESS_ID="user_typing_status",A[A.STATUS_START=1]="STATUS_START",A[A.STATUS_END=0]="STATUS_END",A[A.VERSION=1]="VERSION",A[A.ACTION_START_ID=14]="ACTION_START_ID",A[A.ACTION_END_ID=0]="ACTION_END_ID",A.ACTION_START="EIMAMSG_InputStatus_Ing",A.ACTION_END="EIMAMSG_InputStatus_End",A[A.NEED_TYPING=1]="NEED_TYPING"}(D_||(D_={})),function(A){A.ADD="add",A.REMOVE="remove"}(v_||(v_={})),function(A){A[A.MSG_MODIFY_CONFLICT=2480]="MSG_MODIFY_CONFLICT",A[A.MSG_MODIFY_DISABLED_IN_AVCHATROOM=2481]="MSG_MODIFY_DISABLED_IN_AVCHATROOM",A[A.MODIFY_MESSAGE_NOT_EXIST=20026]="MODIFY_MESSAGE_NOT_EXIST"}(w_||(w_={})),function(A){A[A.NOT_INIT=-1e5]="NOT_INIT",A[A.INVALID_CONV_ID=-100001]="INVALID_CONV_ID",A[A.CONV_ID_SAME=-100002]="CONV_ID_SAME",A[A.CONV_NOT_EXIST=-100003]="CONV_NOT_EXIST",A[A.GET_MSG_LIST_ERROR=-100004]="GET_MSG_LIST_ERROR",A[A.MISMATCH_TYPE_AND_PAYLOAD=-100005]="MISMATCH_TYPE_AND_PAYLOAD"}(S_||(S_={})),function(A){A.MSG_MODIFY_CONFLICT="MODIFY_MESSAGE_ERROR,修改消息发生冲突, data.message 是最新的消息",A.MSG_MODIFY_DISABLED_IN_AVCHATROOM="MODIFY_MESSAGE_ERROR,不支持修改直播群消息.",A.MODIFY_MESSAGE_NOT_EXIST="MODIFY_MESSAGE_ERROR,消息不存在."}(M_||(M_={})),function(A){A.NOT_INIT="TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。",A.INVALID_CONV_ID="会话 ID 无效",A.CONV_ID_SAME="您切换的是同一个会话 ID",A.CONV_NOT_EXIST="会话不存在",A.GET_MSG_LIST_ERROR="Chat SDK is not ready.",A.MISMATCH_TYPE_AND_PAYLOAD="type 与 payload 不匹配."}(R_||(R_={}));const T_={logout:1,destroy:1},N_=function(A){return void 0===A},b_=function(A){return A.startsWith("_")},G_=function(A){return/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(A)},k_=function(A){return A&&function(A){if("string"==typeof A)try{return!!JSON.parse(A)}catch(e){return!1}return!1}(A)?JSON.parse(A):A},L_=function(A){let e="";return e=A>=1048576?`${(A/1048576).toFixed(2)} Mb`:A>=1024?`${(A/1024).toFixed(2)} Kb`:`${A.toFixed(2)}B`,e},U_={"[TUIEmoji_Expect]":"emoji_0@2x.png","[TUIEmoji_Blink]":"emoji_1@2x.png","[TUIEmoji_Guffaw]":"emoji_2@2x.png","[TUIEmoji_KindSmile]":"emoji_3@2x.png","[TUIEmoji_Haha]":"emoji_4@2x.png","[TUIEmoji_Cheerful]":"emoji_5@2x.png","[TUIEmoji_Smile]":"emoji_6@2x.png","[TUIEmoji_Sorrow]":"emoji_7@2x.png","[TUIEmoji_Speechless]":"emoji_8@2x.png","[TUIEmoji_Amazed]":"emoji_9@2x.png","[TUIEmoji_Complacent]":"emoji_10@2x.png","[TUIEmoji_Lustful]":"emoji_11@2x.png","[TUIEmoji_Stareyes]":"emoji_12@2x.png","[TUIEmoji_Giggle]":"emoji_13@2x.png","[TUIEmoji_Daemon]":"emoji_14@2x.png","[TUIEmoji_Rage]":"emoji_15@2x.png","[TUIEmoji_Yawn]":"emoji_16@2x.png","[TUIEmoji_TearsLaugh]":"emoji_17@2x.png","[TUIEmoji_Silly]":"emoji_18@2x.png","[TUIEmoji_Wail]":"emoji_19@2x.png","[TUIEmoji_Kiss]":"emoji_20@2x.png","[TUIEmoji_Trapped]":"emoji_21@2x.png","[TUIEmoji_Fear]":"emoji_22@2x.png","[TUIEmoji_BareTeeth]":"emoji_23@2x.png","[TUIEmoji_FlareUp]":"emoji_24@2x.png","[TUIEmoji_Tact]":"emoji_25@2x.png","[TUIEmoji_Shit]":"emoji_26@2x.png","[TUIEmoji_ShutUp]":"emoji_27@2x.png","[TUIEmoji_Sigh]":"emoji_28@2x.png","[TUIEmoji_Hehe]":"emoji_29@2x.png","[TUIEmoji_Silent]":"emoji_30@2x.png","[TUIEmoji_Skull]":"emoji_31@2x.png","[TUIEmoji_Mask]":"emoji_32@2x.png","[TUIEmoji_Beer]":"emoji_33@2x.png","[TUIEmoji_Cake]":"emoji_34@2x.png","[TUIEmoji_RedPacket]":"emoji_35@2x.png","[TUIEmoji_Bombs]":"emoji_36@2x.png","[TUIEmoji_Ai]":"emoji_37@2x.png","[TUIEmoji_Celebrate]":"emoji_38@2x.png","[TUIEmoji_Bless]":"emoji_39@2x.png","[TUIEmoji_Flower]":"emoji_40@2x.png","[TUIEmoji_Watermelon]":"emoji_41@2x.png","[TUIEmoji_Cow]":"emoji_42@2x.png","[TUIEmoji_Fool]":"emoji_43@2x.png","[TUIEmoji_Surprised]":"emoji_44@2x.png","[TUIEmoji_Askance]":"emoji_45@2x.png","[TUIEmoji_Monster]":"emoji_46@2x.png","[TUIEmoji_Pig]":"emoji_47@2x.png","[TUIEmoji_Coffee]":"emoji_48@2x.png","[TUIEmoji_Ok]":"emoji_49@2x.png","[TUIEmoji_Heart]":"emoji_50@2x.png","[TUIEmoji_Sun]":"emoji_51@2x.png","[TUIEmoji_Moon]":"emoji_52@2x.png","[TUIEmoji_Star]":"emoji_53@2x.png","[TUIEmoji_Rich]":"emoji_54@2x.png","[TUIEmoji_Fortune]":"emoji_55@2x.png","[TUIEmoji_857]":"emoji_56@2x.png","[TUIEmoji_666]":"emoji_57@2x.png","[TUIEmoji_Prohibit]":"emoji_58@2x.png","[TUIEmoji_Convinced]":"emoji_59@2x.png","[TUIEmoji_Knife]":"emoji_60@2x.png","[TUIEmoji_Like]":"emoji_61@2x.png"},F_={"[TUIEmoji_Smile]":"[微笑]","[TUIEmoji_Expect]":"[期待]","[TUIEmoji_Blink]":"[眨眼]","[TUIEmoji_Guffaw]":"[大笑]","[TUIEmoji_KindSmile]":"[姨母笑]","[TUIEmoji_Haha]":"[哈哈哈]","[TUIEmoji_Cheerful]":"[愉快]","[TUIEmoji_Speechless]":"[无语]","[TUIEmoji_Amazed]":"[惊讶]","[TUIEmoji_Sorrow]":"[悲伤]","[TUIEmoji_Complacent]":"[得意]","[TUIEmoji_Silly]":"[傻了]","[TUIEmoji_Lustful]":"[色]","[TUIEmoji_Giggle]":"[憨笑]","[TUIEmoji_Kiss]":"[亲亲]","[TUIEmoji_Wail]":"[大哭]","[TUIEmoji_TearsLaugh]":"[哭笑]","[TUIEmoji_Trapped]":"[困]","[TUIEmoji_Mask]":"[口罩]","[TUIEmoji_Fear]":"[恐惧]","[TUIEmoji_BareTeeth]":"[龇牙]","[TUIEmoji_FlareUp]":"[发怒]","[TUIEmoji_Yawn]":"[打哈欠]","[TUIEmoji_Tact]":"[机智]","[TUIEmoji_Stareyes]":"[星星眼]","[TUIEmoji_ShutUp]":"[闭嘴]","[TUIEmoji_Sigh]":"[叹气]","[TUIEmoji_Hehe]":"[呵呵]","[TUIEmoji_Silent]":"[收声]","[TUIEmoji_Surprised]":"[惊喜]","[TUIEmoji_Askance]":"[白眼]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[便便]","[TUIEmoji_Monster]":"[怪兽]","[TUIEmoji_Daemon]":"[恶魔]","[TUIEmoji_Rage]":"[恶魔怒]","[TUIEmoji_Fool]":"[衰]","[TUIEmoji_Pig]":"[猪]","[TUIEmoji_Cow]":"[牛]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[骷髅]","[TUIEmoji_Bombs]":"[炸弹]","[TUIEmoji_Coffee]":"[咖啡]","[TUIEmoji_Cake]":"[蛋糕]","[TUIEmoji_Beer]":"[啤酒]","[TUIEmoji_Flower]":"[花]","[TUIEmoji_Watermelon]":"[瓜]","[TUIEmoji_Rich]":"[壕]","[TUIEmoji_Heart]":"[爱心]","[TUIEmoji_Moon]":"[月亮]","[TUIEmoji_Sun]":"[太阳]","[TUIEmoji_Star]":"[星星]","[TUIEmoji_RedPacket]":"[红包]","[TUIEmoji_Celebrate]":"[庆祝]","[TUIEmoji_Bless]":"[福]","[TUIEmoji_Fortune]":"[发]","[TUIEmoji_Convinced]":"[服]","[TUIEmoji_Prohibit]":"[禁]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[刀]","[TUIEmoji_Like]":"[赞]"},O_={enabledMessageReadReceipt:Math.pow(2,5),enabledEmojiPlugin:Math.pow(2,48),enabledOnlineStatus:Math.pow(2,7),enabledCustomerServicePlugin:Math.pow(2,40),enabledTranslationPlugin:Math.pow(2,38),enabledVoiceToText:Math.pow(2,39)},x_=["messageList","conversationList","newMessageList"],P_=["translateTextInfo","voiceToTextInfo"],Y_="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&("mac"===wx.getSystemInfoSync().platform||"windows"===wx.getSystemInfoSync().platform),J_="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)||Y_,H_="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),q_="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),V_="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),j_="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),K_="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,W_="undefined"!=typeof uni&&"undefined"==typeof window,z_=J_||H_||q_||V_||j_||K_||W_,Z_=("undefined"!=typeof uni||"undefined"!=typeof window)&&!z_,X_=H_?qq:q_?tt:V_?swan:j_?my:J_?wx:W_?uni:K_?jd:Z_?window:{},$_=Z_&&window&&window.navigator&&window.navigator.userAgent||"",AT=/Android/i.test($_),eT=/(?:Windows Phone)/.test($_),tT=/(?:SymbianOS)/.test($_),iT=/iPad/i.test($_)||/iPhone/i.test($_)||/iPod/i.test($_),oT=AT||eT||tT||iT,nT=Z_&&!oT;let rT=class A{constructor(){this.global=X_,this.isOfficial=!1}static getInstance(){return A.instance||(A.instance=new A),A.instance}initOfficial(A){this.isOfficial=A}getPlatform(){let A="";return nT?A="pc":oT?A="h5":J_?A="wechat":W_&&!J_&&(A="app"),A}};let sT=class A{constructor(){this.EVENT=bR.EVENT,this.TYPES=bR.TYPES,this.loginStatusPromise=new Map,this.userID="",this.isInited=!1}static getInstance(){return A.instance||(A.instance=new A),X_.__$RTC_CHAT__=[e_,i_,n_,s_,g_,l_,u_,d_,C_],A.instance}mount(A,e){this[A]=e}login(A){const{chat:e,SDKAppID:t,userID:i}=A,o=1400187352===t||1400188366===t;return this.createChat(A),this.userID=i,rT.getInstance().initOfficial(o),this.TUIStore.update(m_.APP,"isOfficial",o),this.TUIStore.update(m_.APP,"SDKVersion",bR.VERSION),this.eventCenter=new p_(this),this.eventCenter.removeEvents(),this.resetStore(),this.initService(),e&&e.isReady()?(console.log("TUIChatEngine.login ok, from TUICore."),this.TUIUser.getUserProfile(),this.checkCommercialAbility(),Promise.resolve({})):(this.eventCenter.addEvent(this.EVENT.SDK_READY,()=>{this.onSDKReady()}),this.eventCenter.addEvent(this.EVENT.SDK_NOT_READY,()=>{this.onSDKNotReady()}),this.loginChat(A))}logout(){return this.userID="",this.isInited=!1,this.resetStore(),this.chat.logout()}isReady(){var A;return(null===(A=this.chat)||void 0===A?void 0:A.isReady())||!1}setLogLevel(A){this.chat?this.chat.setLogLevel(A):console.warn("TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。")}destroy(){return this.eventCenter.unbindIMEvents(),this.isInited=!1,this.resetStore(),this.chat.destroy()}getMyUserID(){return this.userID}resetStore(){this.TUIStore.reset(m_.CHAT),this.TUIStore.reset(m_.CONV),this.TUIStore.reset(m_.GRP),this.TUIStore.reset(m_.USER),this.TUIStore.reset(m_.SEARCH),this.TUIStore.reset(m_.FRIEND),this.TUIStore.reset(m_.CUSTOM),console.log("TUIChatEngine.resetStore ok.")}initService(){this.TUIChat.init(),this.TUIConversation.init(),this.TUIUser.init(),this.initOptionalServices(),this.isInited=!0,console.log("TUIChatEngine.initService ok.")}initOptionalServices(){const A=bR.VERSION.split(".");3===A[0]&&A[1]>=3&&A[2]>0?(!0===this.chat.callExperimentalAPI("canIUseModule",["group-module"])&&this.TUIGroup.init(),!0===this.chat.callExperimentalAPI("canIUseModule",["relationship-module"])&&this.TUIFriend.init()):(this.TUIGroup.init(),this.TUIFriend.init())}createChat(A){const{chat:e}=A,t=B_(A,["chat"]);N_(e)?(this.chat=bR.create(Object.assign(Object.assign({},t),{scene:"engine-lite"})),this.chat.use([e_,i_,n_,s_,g_,l_,u_,d_,C_])):this.chat=e}loginChat(A){const{userID:e,userSig:t}=A;return new Promise((A,i)=>{this.chat.login({userID:e,userSig:t}).then(e=>{console.log("TUIChatEngine.loginChat ok."),this.checkCommercialAbility(),e.data.repeatLogin&&this.chat.isReady()&&A(e),this.loginStatusPromise.set("login",{resolve:A,reject:i,imResponse:e})}).catch(A=>{i(A)})})}onSDKReady(){if(this.loginStatusPromise.has("login")){const A=this.loginStatusPromise.get("login");A.resolve(A.imResponse),this.TUIUser.getUserProfile()}this.loginStatusPromise.delete("login")}onSDKNotReady(){this.loginStatusPromise.has("login")&&this.loginStatusPromise.get("login").reject(new Error("sdk not ready")),this.loginStatusPromise.delete("login"),this.resetStore()}checkCommercialAbility(){Object.keys(O_).forEach(A=>{const e=O_[A];this.chat.callExperimentalAPI("isCommercialAbilityEnabled",e).then(e=>{const{enabled:t=!1}=e.data;this.TUIStore.update(m_.APP,A,t)})})}},aT=class{constructor(){this.defaultStore={enabledMessageReadReceipt:!1,enabledEmojiPlugin:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enabledTranslationPlugin:!1,enabledVoiceToText:!1,enableTyping:!0,enableConversationDraft:!0,enableAutoMessageRead:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1,translateTextMessage:!1}},this.store={enabledEmojiPlugin:!1,enabledMessageReadReceipt:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enabledTranslationPlugin:!1,enabledVoiceToText:!1,enableTyping:!0,enableConversationDraft:!0,enableAutoMessageRead:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1,translateTextMessage:!1}}}update(A,e){this.store[A]=e}getData(A){return this.store[A]}reset(A=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),A.reduce((A,e)=>Object.assign(Object.assign({},A),{[e]:this.defaultStore[e]}),{}))}},gT=class{constructor(){this.defaultStore={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[],targetLanguage:"zh"},this.store={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[],targetLanguage:"zh"}}update(A,e){"userStatusList"===A?this.updateUserStatusList(e):this.store[A]=e}getData(A){return this.store[A]}reset(A=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),A.reduce((A,e)=>Object.assign(Object.assign({},A),{[e]:this.defaultStore[e]}),{}))}updateUserStatusList(A){0!==A.length?A.forEach(A=>{const{userID:e,statusType:t=0,customStatus:i=""}=A;t===y_.UNSUB_USER?this.store.userStatusList.delete(e):this.store.userStatusList.set(e,{statusType:t,customStatus:i})}):this.store.userStatusList.clear()}},cT=class{getEngine(){return sT.getInstance()}};const lT=function(A){if(null==A)return!0;if("boolean"==typeof A)return!1;if("number"==typeof A)return 0===A;if("string"==typeof A)return 0===A.length;if("function"==typeof A)return 0===A.length;if(Array.isArray(A))return 0===A.length;if(A instanceof Error)return""===A.message;if(function(A){if("object"!=typeof A||null===A)return!1;const e=Object.getPrototypeOf(A);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t}(A)){for(const e in A)if(Object.prototype.hasOwnProperty.call(A,e))return!1;return!0}return!1},IT={"[Image]":"[图片]","[Voice]":"[语音]","[Video]":"[视频]","[File]":"[文件]","[Location]":"[位置]","[Animated Sticker]":"[动画表情]","[Custom Messages]":"[自定义消息]","[Group Notification]":"[群提示消息]","[Group System Message]":"[群系统消息]","[Chat Record]":"[聊天记录]","[Chat History]":"[聊天记录]"};let uT=class extends cT{constructor(A){super(),this.initProxy(A),this.isMuted=this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_ACPT_NOT_NOTE||this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_DISCARD,this.operationType=0,this._conversation=A}initProxy(A){Object.keys(A).forEach(e=>{b_(e)||(this[e]=A[e])})}updateProperties(A){Object.keys(A).forEach(e=>{b_(e)||(this[e]=A[e])})}updateOperationType(A){this.operationType=A}getConversation(){return this._conversation}deleteConversation(A=!0){return this.getEngine().TUIConversation.deleteConversation({conversationIDList:[this.conversationID],clearHistoryMessage:A})}pinConversation(){return this.getEngine().TUIConversation.pinConversation({conversationID:this.conversationID,isPinned:!this.isPinned})}muteConversation(){const A=this.getEngine(),e={messageRemindType:!0===this.isMuted?A.TYPES.MSG_REMIND_ACPT_AND_NOTE:A.TYPES.MSG_REMIND_ACPT_NOT_NOTE};if(this.type===A.TYPES.CONV_C2C){const t=this.conversationID.replace(A.TYPES.CONV_C2C,"");e.userIDList=[t]}else if(this.type===A.TYPES.CONV_GROUP){const t=this.conversationID.replace(A.TYPES.CONV_GROUP,"");e.groupID=t}return A.TUIConversation.muteConversation(e)}setMessageRead(){return this.getEngine().TUIConversation.setMessageRead(this.conversationID)}getAvatar(){var A,e,t,i,o,n;const r=this.getEngine();let s="";switch(this.type){case r.TYPES.CONV_C2C:s=G_(null===(A=this.userProfile)||void 0===A?void 0:A.avatar)?null===(e=this.userProfile)||void 0===e?void 0:e.avatar:"https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_16.png";break;case r.TYPES.CONV_GROUP:s=G_(null===(t=this.groupProfile)||void 0===t?void 0:t.avatar)?null===(i=this.groupProfile)||void 0===i?void 0:i.avatar:"https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.png";break;case r.TYPES.CONV_SYSTEM:s=G_(null===(o=this.groupProfile)||void 0===o?void 0:o.avatar)?null===(n=this.groupProfile)||void 0===n?void 0:n.avatar:"https://web.sdk.qcloud.com/component/TUIKit/assets/group_avatar.png"}return s}getShowName(){var A,e,t,i;const o=this.getEngine();let n="";switch(this.type){case o.TYPES.CONV_C2C:n=this.remark||(null===(A=this.userProfile)||void 0===A?void 0:A.nick)||(null===(e=this.userProfile)||void 0===e?void 0:e.userID)||"";break;case o.TYPES.CONV_GROUP:n=(null===(t=this.groupProfile)||void 0===t?void 0:t.name)||(null===(i=this.groupProfile)||void 0===i?void 0:i.groupID)||"";break;case o.TYPES.CONV_SYSTEM:n=o.TUITranslate.t("系统通知")}return n}getGroupAtInfo(){const A=this.getEngine(),e=A.TUITranslate.t.bind(A.TUITranslate),t=[`[${e("TUIConversation.有人@我")}]`,`[${e("TUIConversation.@所有人")}]`,`[${e("TUIConversation.@所有人")}][${e("TUIConversation.有人@我")}]`];let i="";for(let o=0;o 0&&(t=function(A,e){const t=36e5,i=24*t,o=7*i,n=(new Date).getTime()-A;let r="";if(n<0)return r;const s=n/6e4,a=n/t,g=n/i,c=n/o;if(c>=1&&c<=4)r=` ${parseInt(`${c}`,10)} ${e("time.周")}${e("time.前")}`;else if(g>=1&&g<=6)r=` ${parseInt(`${g}`,10)} ${e("time.天")}${e("time.前")}`;else if(a>=1&&a<=23)r=` ${parseInt(`${a}`,10)} ${e("time.小时")}${e("time.前")}`;else if(s>=1&&s<=59)r=` ${parseInt(`${s}`,10)} ${e("time.分钟")}${e("time.前")}`;else if(n>=0&&n<=6e4)r=`${e("time.刚刚")}`;else{const e=new Date;e.setTime(A),r=`${e.getFullYear()}-${e.getMonth()+1<10?`0${e.getMonth()+1}`:e.getMonth()+1}-${e.getDate()<10?`0${e.getDate()}`:e.getDate()}`}return r}(1e3*this.lastMessage.lastTime,e.TUITranslate.t.bind(e.TUITranslate))),t}getLastMessageText(){var A;if(this.draftText)return k_(this.draftText).abstract;const e=this.getEngine(),t=e.TUITranslate.t.bind(e.TUITranslate);if(4===this.operationType)return t("TUIConversation.您已被群管理员移出群聊");if(5===this.operationType)return t("TUIConversation.该群聊已被解散");if(8===this.operationType)return t("TUIConversation.您已退出该群聊");const i=this._conversation,{lastMessage:o}=this;let n="",r="";const s=i.unreadCount>0&&i.messageRemindType===e.TYPES.MSG_REMIND_ACPT_NOT_NOTE?`[${i.unreadCount>99?"99+":i.unreadCount}${t("TUIConversation.条")}]`:"";if(i.type===e.TYPES.CONV_GROUP)if(o.fromAccount===e.getMyUserID())n=t("TUIConversation.我");else{const A=o.fromAccount;n=e.TUIFriend.getFriendRemark([A])[A]||o.nameCard||o.nick||A}if(o.type===e.TYPES.MSG_TEXT)r=this.decodeTextMessage(o.payload.text);else if(o.type===e.TYPES.MSG_CUSTOM){const i=k_(null===(A=null==o?void 0:o.payload)||void 0===A?void 0:A.data);if(1===(null==i?void 0:i.businessID))return r=e.TUIChat.messageHandler.handleCallKitSignaling(o),r;const n=o.messageForShow;r=IT[n]?t(`TUIChat.${IT[n]}`):n}else{const A=o.messageForShow;r=IT[A]?t(`TUIChat.${IT[A]}`):A}return o.isRevoked&&(r=t("TUIChat.撤回了一条消息")),i.type===e.TYPES.CONV_GROUP&&o.type===e.TYPES.MSG_GRP_TIP?r:`${s}${n?`${n}:`:""}${r}`}decodeTextMessage(A){if(lT(A))return A;const e=/(\[.+?\])/g;let t=A;if(e.test(A)){const i=this.getEngine(),o=i.TUITranslate.t.bind(i.TUITranslate);t=A.replace(e,A=>{const e=o(`Emoji.${A}`);return J_||!e||e.startsWith("Emoji.")?F_[A]||A:e})}return t}},ET=class{constructor(){this.defaultStore={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null,operationTypeMap:new Map},this.store={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null,operationTypeMap:new Map}}update(A,e){switch(A){case"conversationList":this.updateConversationList(e);break;case"operationTypeMap":this.updateOperationTypeMap(e);break;default:this.store[A]=e}}getData(A){return this.store[A]}getModel(A){return this.store.conversationList.find(e=>e.conversationID===A)}reset(A=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),A.reduce((A,e)=>Object.assign(Object.assign({},A),{[e]:this.defaultStore[e]}),{}))}updateConversationList(A){const e=[];A.forEach(A=>{let t=A;A instanceof uT?t.updateProperties(A):t=new uT(A);const i=this.getOperationType(A);t.updateOperationType(i),e.push(t)}),this.store.conversationList=e}updateOperationTypeMap(A){const{conversationID:e,operationType:t=0}=A;this.store.operationTypeMap.set(e,t)}getOperationType(A){const{conversationID:e}=A;return this.store.operationTypeMap.get(e)||0}},dT=class extends cT{constructor(A){super(),this.messageHandlers={[this.getEngine().TYPES.MSG_TEXT]:A=>this.getEngine().TUIChat.messageHandler.handleTextMessage(A),[this.getEngine().TYPES.MSG_FACE]:A=>this.getEngine().TUIChat.messageHandler.handleFaceMessage(A),[this.getEngine().TYPES.MSG_LOCATION]:A=>this.getEngine().TUIChat.messageHandler.handleLocationMessage(A),[this.getEngine().TYPES.MSG_IMAGE]:A=>this.getEngine().TUIChat.messageHandler.handleImageMessage(A),[this.getEngine().TYPES.MSG_AUDIO]:A=>this.getEngine().TUIChat.messageHandler.handleAudioMessage(A),[this.getEngine().TYPES.MSG_VIDEO]:A=>this.getEngine().TUIChat.messageHandler.handleVideoMessage(A),[this.getEngine().TYPES.MSG_FILE]:A=>this.getEngine().TUIChat.messageHandler.handleFileMessage(A),[this.getEngine().TYPES.MSG_CUSTOM]:A=>this.getEngine().TUIChat.messageHandler.handleCustomMessage(A),[this.getEngine().TYPES.MSG_MERGER]:A=>this.getEngine().TUIChat.messageHandler.handleMergeMessage(A),[this.getEngine().TYPES.MSG_GRP_TIP]:A=>this.getEngine().TUIChat.messageHandler.handleGroupTipsMessage(A)},this._message=A,this._signalingInfo=void 0,this.progress=0,this.reactionList=[],this.initProperties(A)}initProperties(A){Object.keys(A).forEach(e=>{b_(e)||(this[e]=A[e])})}updateProperties(A){this._message=A,Object.keys(A).forEach(e=>{b_(e)||(this[e]=A[e])})}getMessage(){return this._message}modifyMessage(A){return A.type&&this._message.type!==A.type&&!A.payload?Promise.reject({code:S_.MISMATCH_TYPE_AND_PAYLOAD,message:R_.MISMATCH_TYPE_AND_PAYLOAD}):(this._message.type=A.type||this._message.type,this._message.payload=A.payload||this._message.payload,this._message.cloudCustomData=A.cloudCustomData||this._message.cloudCustomData,this.getEngine().TUIChat.modifyMessage(this._message))}revokeMessage(){return this.getEngine().TUIChat.revokeMessage(this._message)}resendMessage(){return this.getEngine().TUIChat.resendMessage(this._message)}deleteMessage(){return this.getEngine().TUIChat.deleteMessage([this._message])}quoteMessage(){return this.getEngine().TUIChat.quoteMessage(this._message)}replyMessage(){return this.getEngine().TUIChat.replyMessage(this._message)}setMessageExtensions(A){return this.getEngine().TUIChat.setMessageExtensions(this._message,A)}getMessageExtensions(){return this.getEngine().TUIChat.getMessageExtensions(this._message)}deleteMessageExtensions(A){return this.getEngine().TUIChat.deleteMessageExtensions(this._message,A)}getSignalingInfo(){return this.type!==this.getEngine().TYPES.MSG_CUSTOM?null:N_(this._signalingInfo)?(this._signalingInfo=this.getEngine().chat.getSignalingInfo(this._message),this._signalingInfo):this._signalingInfo}getMessageContent(){const A=this.messageHandlers[this.type];if(N_(A))return{};if(this.type===this.getEngine().TYPES.MSG_GRP_TIP)return A(this._message);const e=this.getEngine().TUIFriend.getFriendRemark([this.from]);return Object.assign(Object.assign({},A(this._message)),{showName:e[this.from]||this.nameCard||this.nick||this.from})}sendForwardMessage(A){return this.getEngine().TUIChat.sendForwardMessage(A,[this._message])}},hT=class{constructor(){this.defaultStore={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0,translateTextInfo:void 0,voiceToTextInfo:void 0,userInfo:{}},this.store={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0,translateTextInfo:void 0,voiceToTextInfo:void 0,userInfo:{}}}update(A,e){switch(A){case"messageList":this.updateMessageList(e);break;case"translateTextInfo":this.updateTranslateTextInfo(e);break;case"voiceToTextInfo":this.updateVoiceToTextInfo(e);break;default:this.store[A]=e}}getData(A){return this.store[A]}getModel(A){return this.store.messageList.find(e=>e.ID===A)}reset(A=[]){const e=A.filter(A=>!P_.includes(A));this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==e?void 0:e.reduce((A,e)=>Object.assign(Object.assign({},A),{[e]:this.defaultStore[e]}),{}))}updateMessageList(A){const e=[];A.forEach(A=>{let t=A;A instanceof dT||(t=this.getModel(A.ID),t?t.updateProperties(A):t=new dT(A)),e.push(t)}),this.store.messageList=e}updateTranslateTextInfo(A){this.updateBykey("translateTextInfo",A)}updateVoiceToTextInfo(A){this.updateBykey("voiceToTextInfo",A)}updateBykey(A,e){const{conversationID:t,messageID:i,visible:o=!1}=e;this.store[A]||(this.store[A]=new Map),this.store[A].has(t)||this.store[A].set(t,[]);const n=this.store[A].get(t)||[];let r=!0;for(let s=0;s {b_(e)||(this[e]=A[e])})}},BT=class{constructor(){this.defaultStore={currentGroupID:"",currentGroup:{},currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[],isCompleted:!1,offset:0},this.store={currentGroupID:"",currentGroup:void 0,currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[],isCompleted:!1,offset:0}}update(A,e){switch(A){case"groupList":this.updateGroupList(e);break;case"currentGroup":this.store.currentGroup=e instanceof CT?e:new CT(e);break;default:this.store[A]=e}}getData(A){if("groupSystemNoticeList"===A){const A=[...this.store.groupSystemNoticeList];return this.store.groupSystemNoticeList.length=0,A}return this.store[A]}reset(A=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),A.reduce((A,e)=>Object.assign(Object.assign({},A),{[e]:this.defaultStore[e]}),{}))}updateGroupList(A){this.store.groupList=A.map(A=>A instanceof CT?A:new CT(A))}},QT=class{constructor(){this.store={}}update(A,e){this.store[A]=e}getData(A){return this.store[A]}reset(A=[]){0===A.length&&(this.store={}),this.store=Object.assign(Object.assign({},this.store),A.reduce((A,e)=>Object.assign(Object.assign({},A),{[e]:void 0}),{}))}},pT=class{constructor(){this.defaultStore={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0,friendGroupList:[]},this.store={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0,friendGroupList:[]}}update(A,e){this.store[A]=e}getData(A){return this.store[A]}reset(A=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),A.reduce((A,e)=>Object.assign(Object.assign({},A),{[e]:this.defaultStore[e]}),{}))}},fT=class{constructor(){this.defaultStore={searchMessagesResult:{resultList:[],hasMore:!1,cursor:"",params:void 0,totalCount:0},searchChatMessagesResult:{resultList:[],hasMore:!1,cursor:"",params:void 0,totalCount:0},searchUserResult:{resultList:[],hasMore:!1,cursor:"",params:void 0,totalCount:0},searchGroupResult:{resultList:[],hasMore:!1,cursor:"",params:void 0,totalCount:0},searchMessageParams:{},searchChatMessageParams:{},searchUserParams:{},searchGroupParams:{},error:null},this.store=this.defaultStore}update(A,e){this.store[A]=e}getData(A){return this.store[A]}reset(A=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==A?void 0:A.reduce((A,e)=>Object.assign(Object.assign({},A),{[e]:this.defaultStore[e]}),{}))}},mT=class A extends cT{constructor(){super(),this.serv="TUIConversationService"}static getInstance(){return A.instance||(A.instance=new A),A.instance}init(){const A=this.getEngine();A.eventCenter.addEvent(A.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated.bind(this)),A.eventCenter.addEvent(A.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalUnreadCountUpdated.bind(this)),A.eventCenter.addEvent(A.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),this.getConversationInitData()}onConversationListUpdated(A){const e=this.filterSystemConversation(A);this.getEngine().TUIStore.update(m_.CONV,"conversationList",e),this.updateCurrentConversation()}onTotalUnreadCountUpdated(A){this.getEngine().TUIStore.update(m_.CONV,"totalUnreadCount",A)}onMessageReceived(A){const e=this.getEngine(),t=this.getEngine().TUIStore.getData(m_.CONV,"conversationList");let i=!1;for(let o=0;o 0){this.getEngine().TUIStore.update(m_.CONV,"operationTypeMap",{conversationID:r,operationType:0}),i=!0;break}}}if(i){this.getEngine().TUIStore.update(m_.CONV,"conversationList",t);const A=this.getEngine().TUIStore.getData(m_.CONV,"currentConversationID")||"",e=this.findConversation(A);e&&this.getEngine().TUIStore.update(m_.CONV,"currentConversation",e)}}getConversationInitData(){const A=this.getEngine();A.chat.isReady()&&A.chat.getConversationList().then(e=>{const{conversationList:t,isSyncCompleted:i}=e.data;if(console.log(`${this.serv}.init, getConversationList count:${t.length} isSyncCompleted:${i}`),t.length>0){this.onConversationListUpdated(t);const e=A.chat.getTotalUnreadMessageCount();this.onTotalUnreadCountUpdated(e)}})}switchConversation(A){return Q_(this,void 0,void 0,function*(){const e=`${this.serv}.switchConversation`,t=this.getEngine();if(!A)return t.TUIStore.reset(m_.CHAT,["messageList","isCompleted","nextReqMessageID"]),t.TUIStore.update(m_.CONV,"currentConversationID",""),t.TUIStore.update(m_.CONV,"currentConversation",null),console.log(`${e} conversationID is empty, conversationID:${A}`),Promise.resolve({});if(!A.startsWith(t.TYPES.CONV_C2C)&&!A.startsWith(t.TYPES.CONV_GROUP))return console.warn(`${e} conversationID is invalid, conversationID:${A}`),Promise.reject({code:S_.INVALID_CONV_ID,message:R_.INVALID_CONV_ID});const i=t.TUIStore.getData(m_.APP,"enableAutoMessageRead"),o=t.TUIStore.getData(m_.CONV,"currentConversationID");if(o&&o===A)return i&&this.setMessageRead(o),console.warn(`${e} please check conversationID, conversationID:${A}`),Promise.resolve({code:S_.CONV_ID_SAME,message:R_.CONV_ID_SAME});const n=yield this.getConversationModel(A);return N_(n)?(console.warn(`${e} target conversation is not exist, conversationID:${A}`),Promise.reject({code:S_.CONV_NOT_EXIST,message:R_.CONV_NOT_EXIST})):(i&&(o&&this.setMessageRead(o),A&&this.setMessageRead(A)),t.TUIStore.reset(m_.CHAT,["messageList","isCompleted","nextReqMessageID"]),t.TUIStore.update(m_.CONV,"currentConversationID",A),t.TUIStore.update(m_.CONV,"currentConversation",n),Promise.resolve(n))})}getConversationModel(A){return Q_(this,void 0,void 0,function*(){let e=this.findConversation(A);if(N_(e))try{const t=yield this.getConversationProfile(A);t.data&&t.data.conversation&&(e=new uT(t.data.conversation))}catch(t){e=void 0}return e})}findConversation(A){let e;const t=this.getEngine().TUIStore.getData(m_.CONV,"conversationList");for(let i=0;i {const t=this.getEngine().TUIStore.getData(m_.CONV,"currentConversationID");return console.log(`${this.serv}.deleteConversation conversationID:${e} currentConversationID:${t}`),e===t&&(this.getEngine().TUIStore.update(m_.CONV,"currentConversationID",""),this.getEngine().TUIStore.update(m_.CONV,"currentConversation",null)),A})}pinConversation(A){return this.getEngine().chat.pinConversation(A)}muteConversation(A){return this.getEngine().chat.setMessageRemindType(A)}clearHistoryMessage(A){return this.getEngine().chat.clearHistoryMessage(A).then(A=>(this.getEngine().TUIStore.update(m_.CHAT,"messageList",[]),this.getEngine().TUIStore.update(m_.CHAT,"nextReqMessageID",""),this.getEngine().TUIStore.update(m_.CHAT,"isCompleted",!0),A))}setMessageRead(A){return this.getEngine().chat.setMessageRead({conversationID:A})}setConversationDraft(A){const{conversationID:e,draftInfo:t,draftText:i=""}=A;return this.getEngine().chat.setConversationDraft({conversationID:e,draftText:i||(t?JSON.stringify(t):"")}).then(A=>{const{conversation:e}=A.data;this.updateConversation(e)})}updateConversation(A){let e=!1;const t=this.getEngine().TUIStore.getData(m_.CONV,"conversationList");for(let i=0;i A.type!==this.getEngine().TYPES.CONV_SYSTEM)}markConversation(A){return this.getEngine().chat.markConversation(A)}},yT=class{constructor(A){this.TUIUserService=A}getEngine(){return this.TUIUserService.getEngine()}init(){this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.PROFILE_UPDATED,this.onProfileUpdated.bind(this)),this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated.bind(this)),this.getUserProfileInitData()}onProfileUpdated(A){const e=this.getEngine(),t=e.TUIStore.getData(m_.USER,"userProfile");A.forEach(A=>{A.userID===t.userID&&e.TUIStore.update(m_.USER,"userProfile",A)})}onBlacklistUpdated(A){const e=this.getEngine();this.getBlacklistProfile(A).then(A=>{e.TUIStore.update(m_.USER,"userBlacklist",A)})}getUserProfileInitData(){const A=this.getEngine();A.chat.isReady()&&A.chat.getBlacklist().then(A=>{const e=A.data||[];console.log(`TUIUserProfileHandler.init, getBlacklist count:${e.length}`),e.length>0&&this.onBlacklistUpdated(e)})}getBlacklistProfile(A){const e=[];let t=0;for(;t {i.push(this.TUIUserService.getUserProfile({userIDList:A}))});const o=[];return Promise.all(i).then(A=>(A.forEach(A=>{const e=A.data.map(A=>{const{userID:e,nick:t,avatar:i}=A;return{userID:e,nick:t,avatar:i}});o.push(...e)}),o))}getUserProfile(A){const e=this.getEngine();return N_(A)?e.chat.getMyProfile().then(A=>(e.TUIStore.update(m_.USER,"userProfile",A.data),A)).catch(A=>Promise.reject(A)):e.chat.getUserProfile(A)}updateMyProfile(A){return this.getEngine().chat.updateMyProfile(A)}addToBlacklist(A){return this.getEngine().chat.addToBlacklist(A)}removeFromBlacklist(A){return this.getEngine().chat.removeFromBlacklist(A)}};function DT(A,e,t=!0){var i,o;i=t?wT(A):A,o=e,z_?X_.setStorageSync(i,o):ST()&&localStorage.setItem(i,JSON.stringify(o))}function vT(A,e=!0){try{return function(A){if(z_)return X_.getStorageSync(A);if(ST()){const e=localStorage.getItem(A);if("undefined"!==e)return JSON.parse(e)}}(e?wT(A):A)}catch(t){return void console.warn("Storage.getStorageItem error:",t)}}function wT(A){return`chat_engine_${A}`}function ST(){return navigator&&navigator.cookieEnabled&&localStorage}let MT=class{constructor(A){this.TUIUserService=A}getEngine(){return this.TUIUserService.getEngine()}init(){const A=this.getEngine(),e=vT("displayOnlineStatus")||!1;A.TUIStore.update(m_.USER,"displayOnlineStatus",e),A.eventCenter.addEvent(A.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated.bind(this)),this.onConversationListUpdated()}onConversationListUpdated(){const A=this.getEngine();A.TUIStore.watch(m_.CONV,{conversationList:()=>{const e=A.TUIStore.getData(m_.APP,"enabledOnlineStatus"),t=A.TUIStore.getData(m_.USER,"displayOnlineStatus");e&&t&&this.startToSubscribe()}})}onUserStatusUpdated(A){this.getEngine().TUIStore.update(m_.USER,"userStatusList",A)}switchUserStatus(A){const e=this.getEngine(),{displayOnlineStatus:t=!1}=A;e.TUIStore.update(m_.USER,"displayOnlineStatus",t),DT("displayOnlineStatus",t);const i=e.TUIStore.getData(m_.APP,"enabledOnlineStatus");i?!0===t?this.startToSubscribe():this.unsubscribeUserStatus().catch(A=>{console.warn("UserStatusHandler.switchUserStatus error:",A)}):console.warn(`UserStatusHandler.switchUserStatus enabledOnlineStatus:${i} displayOnlineStatus:${t}`)}getUserStatus(A){const e=this.getEngine();return e.chat.getUserStatus(A).then(A=>{const{successUserList:t}=A.data;return t.length>0&&e.TUIStore.update(m_.USER,"userStatusList",t),A}).catch(A=>Promise.reject(A))}subscribeUserStatus(A){var e;const t=(null===(e=null==A?void 0:A.userIDList)||void 0===e?void 0:e.length)||0;return 0===t?(console.warn(`UserStatusHandler.subscribeUserStatus userID count:${t}`),Promise.resolve()):this.getEngine().chat.subscribeUserStatus(A)}unsubscribeUserStatus(A){const e=this.getEngine(),{userIDList:t=[]}=A||{};return e.chat.unsubscribeUserStatus({userIDList:t}).then(A=>{const{failureUserList:i}=A.data,o=[];return t.forEach(A=>{i.includes(A)||o.push({userID:A,statusType:y_.UNSUB_USER})}),e.TUIStore.update(m_.USER,"userStatusList",o),A}).catch(A=>Promise.reject(A))}startToSubscribe(){const A=this.getEngine(),e=A.TUIStore.getData(m_.CONV,"conversationList"),t=A.TUIStore.getData(m_.USER,"userStatusList"),i=[];e.forEach(e=>{if(e.type===A.TYPES.CONV_C2C){const o=e.conversationID.replace(A.TYPES.CONV_C2C,"");t.has(o)||i.push(o)}}),0!==i.length&&A.chat.isReady()&&(this.subscribeUserStatus({userIDList:i}).catch(A=>{console.warn("UserStatusHandler.startToSubscribe,",A)}),this.getUserStatus({userIDList:i}).catch(A=>{console.warn("UserStatusHandler.startToSubscribe,",A)}))}},RT=class{constructor(A){this.TUIChatService=A,this.userShowNameMap=new Map,this.requestedUserMap=new Map}getEngine(){return this.TUIChatService.getEngine()}t(A){return this.getEngine().TUITranslate.t(A)}handleTextMessage(A){return{text:this.decodeText(A.payload)}}handleFaceMessage(A){const e={name:"",url:"",type:""};return A.payload.data.indexOf("@custom")>-1?(e.name=A.payload.data,e.type="custom",e):(e.name=A.payload.data.indexOf("@2x")<0?`${A.payload.data}@2x`:A.payload.data,e.url=`https://web.sdk.qcloud.com/im/assets/face-elem/${e.name}.png`,e)}handleLocationMessage(A){const e={lon:"",lat:"",href:"",url:"",description:""};return e.lon=A.payload.longitude.toFixed(6),e.lat=A.payload.latitude.toFixed(6),e.href=`https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=${e.lon}&pointy=${e.lat}&name=${A.payload.description}`,e.url=`https://apis.map.qq.com/ws/staticmap/v2/?center=${e.lat},${e.lon}&zoom=10&size=300*150&maptype=roadmap&markers=size:large|color:0xFFCCFF|label:k|${e.lat},${e.lon}&key=UBNBZ-PTP3P-TE7DB-LHRTI-Y4YLE-VWBBD`,e.description=A.payload.description,e}handleImageMessage(A){return{url:A.payload.imageInfoArray[0].url,width:A.payload.imageInfoArray[0].width,height:A.payload.imageInfoArray[0].height}}handleAudioMessage(A){return{url:A.payload.url,second:A.payload.second}}handleVideoMessage(A){return{url:A.payload.videoUrl,snapshotUrl:A.payload.snapshotUrl,snapshotWidth:A.payload.snapshotWidth,snapshotHeight:A.payload.snapshotHeight}}handleFileMessage(A){return{url:A.payload.fileUrl,name:A.payload.fileName,size:L_(A.payload.fileSize)}}handleCustomMessage(A){var e;const t=this.handleCreateGroupCustomMessage(A);return{custom:this.handleCallKitSignaling(A)||t||(null===(e=null==A?void 0:A.payload)||void 0===e?void 0:e.extension)||`${this.t("TUIChat.[自定义消息]")}`,businessID:t?"group_create":""}}handleMergeMessage(A){return Object.assign({},A.payload)}handleGroupTipsMessage(A){var e,t,i,o,n,r;const s=this.getEngine(),a={text:""};let g=(null==A?void 0:A.nick)||(null===(t=null===(e=null==A?void 0:A.payload)||void 0===e?void 0:e.userIDList)||void 0===t?void 0:t.join(","));switch((null===(o=null===(i=null==A?void 0:A.payload)||void 0===i?void 0:i.memberList)||void 0===o?void 0:o.length)>0&&(g="",null===(r=null===(n=null==A?void 0:A.payload)||void 0===n?void 0:n.memberList)||void 0===r||r.map(A=>{const e=(null==A?void 0:A.nick)||(null==A?void 0:A.userID);return g+=`${this.substringByLength(e)},`,A}),g=null==g?void 0:g.slice(0,-1)),A.payload.operationType){case s.TYPES.GRP_TIP_MBR_JOIN:a.text=`${g} ${this.t("message.tip.加入群组")}`;break;case s.TYPES.GRP_TIP_MBR_QUIT:a.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.退出群组")}`;break;case s.TYPES.GRP_TIP_MBR_KICKED_OUT:a.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.被")}${this.t("message.tip.踢出群组")}`;break;case s.TYPES.GRP_TIP_MBR_SET_ADMIN:a.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.成为管理员")}`;break;case s.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:a.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.被撤销管理员")}`;break;case s.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:a.text=this.handleGroupProfileUpdated(A);break;case s.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:for(const e of A.payload.memberList)e.muteTime>0?a.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.被禁言")}`:a.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.被取消禁言")}`;break;default:a.text=`[${this.t("message.tip.群提示消息")}]`}return a}handleGroupSystemMessage(A){const e=A.payload.groupProfile.name||A.payload.groupProfile.groupID,t={text:""};switch(A.payload.operationType){case 1:t.text=`${A.payload.operatorID} ${this.t("message.tip.申请加入群组")}:${e}`;break;case 2:t.text=`${this.t("message.tip.成功加入群组")}:${e}`;break;case 3:t.text=`${this.t("message.tip.申请加入群组")}:${e} ${this.t("message.tip.被拒绝")}`;break;case 4:t.text=`${this.t("message.tip.你被管理员")}${A.payload.operatorID} ${this.t("message.tip.踢出群组")}:${e}`;break;case 5:t.text=`${this.t("message.tip.群")}:${e} ${this.t("message.tip.被")} ${A.payload.operatorID} ${this.t("message.tip.解散")}`;break;case 6:t.text=`${A.payload.operatorID} ${this.t("message.tip.创建群")}:${e}`;break;case 7:case 12:t.text=`${A.payload.operatorID} ${this.t("message.tip.邀请你加群")}:${e}`;break;case 8:t.text=`${this.t("message.tip.你退出群组")}:${e}`;break;case 9:t.text=`${this.t("message.tip.你被")}${A.payload.operatorID} ${this.t("message.tip.设置为群")}:${e} ${this.t("message.tip.的管理员")}`;break;case 10:t.text=`${this.t("message.tip.你被")}${A.payload.operatorID} ${this.t("message.tip.撤销群")}:${e} ${this.t("message.tip.的管理员身份")}`;break;case 13:t.text=`${A.payload.operatorID} ${this.t("message.tip.同意加群")}:${e}`;break;case 14:t.text=`${A.payload.operatorID} ${this.t("message.tip.拒接加群")}:${e}`;break;case 255:t.text=`${this.t("message.tip.自定义群系统通知")}: ${A.payload.userDefinedField}`;break;default:t.text="未解析的群系统通知"}return t}handleCallKitSignaling(A){var e,t,i,o,n,r,s,a,g,c;const l=k_(A.payload.data);if(1!==(null==l?void 0:l.businessID))return"";const I=k_(null==l?void 0:l.data),u=A.fromAccount||A.from,E=this.getEngine().TUIFriend.getFriendRemark([u]),d=this.getEngine().getMyUserID();let h=E[u]||A.nameCard||A.nick||u;switch(h=this.substringByLength(h),null==l?void 0:l.actionType){case 1:return"audioCall"!==(null===(e=null==I?void 0:I.data)||void 0===e?void 0:e.cmd)&&"videoCall"!==(null===(t=null==I?void 0:I.data)||void 0===t?void 0:t.cmd)||!(null==l?void 0:l.groupID)?"hangup"===(null===(i=null==I?void 0:I.data)||void 0===i?void 0:i.cmd)?(null==l?void 0:l.groupID)?`${this.t("message.custom.通话结束")}`:`${this.t("message.custom.通话时长")}:${function(A){const e=A;let t,i,o,n="";return e>=3600?(t=parseInt(""+e/3600,10)<10?`0${parseInt(""+e/3600,10)}`:parseInt(""+e/3600,10),i=parseInt(""+e%60/60,10)<10?`0${parseInt(""+e%60/60,10)}`:parseInt(""+e%60/60,10),o=e%3600<10?"0"+e%3600:e%3600,o>60&&(i=parseInt(""+o/60,10)<10?`0${parseInt(""+o/60,10)}`:parseInt(""+o/60,10),o=o%60<10?"0"+o%60:o%60),n=`${t}:${i}:${o}`):e>=60&&e<3600?(i=parseInt(""+e/60,10)<10?`0${parseInt(""+e/60,10)}`:parseInt(""+e/60,10),o=e%60<10?"0"+e%60:e%60,n=`00:${i}:${o}`):e<60&&(o=e<10?`0${e}`:e,n=`00:00:${o}`),n}(null==I?void 0:I.call_end)}`:"switchToAudio"===(null===(o=null==I?void 0:I.data)||void 0===o?void 0:o.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(n=null==I?void 0:I.data)||void 0===n?void 0:n.cmd)?`${this.t("message.custom.切换视频通话")}`:`${this.t("message.custom.发起通话")}`:`${h} ${this.t("message.custom.发起通话")}`;case 2:return(null==l?void 0:l.groupID)?`${h} ${this.t("message.custom.取消通话")}`:this.isOldUIKit("message.custom.已取消")?this.t("message.custom.取消通话"):(null==l?void 0:l.inviter)===d?this.t("message.custom.已取消"):this.t("message.custom.对方已取消");case 3:return"switchToAudio"===(null===(r=null==I?void 0:I.data)||void 0===r?void 0:r.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(s=null==I?void 0:I.data)||void 0===s?void 0:s.cmd)?`${this.t("message.custom.切换视频通话")}`:(null==l?void 0:l.groupID)?`${h} ${this.t("message.custom.已接听")}`:this.t("message.custom.已接听");case 4:return(null==l?void 0:l.groupID)?`${h} ${this.t("message.custom.拒绝通话")}`:this.isOldUIKit("message.custom.已拒绝")?this.t("message.custom.拒绝通话"):"line_busy"===(null==I?void 0:I.line_busy)||"lineBusy"===(null==I?void 0:I.data.message)?(null==l?void 0:l.inviter)===d?this.t("message.custom.对方忙线中"):this.t("message.custom.忙线未接听"):(null==l?void 0:l.inviter)===d?this.t("message.custom.对方已拒绝"):this.t("message.custom.已拒绝");case 5:if("switchToAudio"===(null===(a=null==I?void 0:I.data)||void 0===a?void 0:a.cmd))return`${this.t("message.custom.切换语音通话")}`;if("switchToVideo"===(null===(g=null==I?void 0:I.data)||void 0===g?void 0:g.cmd))return`${this.t("message.custom.切换视频通话")}`;if(null==l?void 0:l.groupID){if(u===(null==l?void 0:l.inviter)){this.handleCallkitTimeoutSignaling(l.inviteeList);let A="";return null===(c=l.inviteeList)||void 0===c||c.forEach(e=>{const t=this.userShowNameMap.get(e)||e;A+=`${this.substringByLength(t)}、`}),A=A.substring(0,A.lastIndexOf("、")),`${A} ${this.t("message.custom.无应答")}`}return`${h} ${this.t("message.custom.无应答")}`}return this.isOldUIKit("message.custom.对方无应答")?this.t("message.custom.无应答"):(null==l?void 0:l.inviter)===d?this.t("message.custom.对方无应答"):this.t("message.custom.超时无应答");default:return""}}handleCreateGroupCustomMessage(A){let e;const t=k_(A.payload.data);return"group_create"===(null==t?void 0:t.businessID)&&(e=`${t.opUser} ${t.content}`),e}decodeText(A){const e=[];let t=A.text,i=-1,o=-1;for(;""!==t;)switch(i=t.indexOf("["),o=t.indexOf("]"),i){case 0:if(-1===o)e.push({name:"text",text:t}),t="";else{const A=t.slice(0,o+1);A.indexOf("@custom")>-1?(e.push({name:"img",src:"",type:"custom",emojiKey:A}),t=t.substring(o+1)):U_[A]?(e.push({name:"img",src:"https://web.sdk.qcloud.com/im/assets/emoji-plugin/"+U_[A],emojiKey:A}),t=t.substring(o+1)):(e.push({name:"text",text:"["}),t=t.slice(1))}break;case-1:e.push({name:"text",text:t}),t="";break;default:e.push({name:"text",text:t.slice(0,i)}),t=t.substring(i)}return e}handleGroupProfileUpdated(A){const{nick:e,payload:t}=A,{newGroupProfile:i,memberList:o,operatorID:n}=t;let r="";const s=e||n,a=Object.keys(i)[0];switch(a){case"muteAllMembers":r=i[a]?`${this.t("message.tip.管理员")} ${s} ${this.t("message.tip.开启全员禁言")}`:`${this.t("message.tip.管理员")} ${s} ${this.t("message.tip.取消全员禁言")}`;break;case"ownerID":r=`${o[0].nick||o[0].userID} ${this.t("message.tip.成为新的群主")}`;break;case"groupName":r=`${s} ${this.t("message.tip.修改群名为")} ${i[a]}`;break;case"notification":r=this.isOldUIKit("message.tip.把群公告修改为")?`${s} ${this.t("message.tip.发布新公告")}`:`${s} ${this.t("message.tip.把群公告修改为")} "${i[a]}"`}return r}handleCallkitTimeoutSignaling(A=[]){if(0===A.length)return;const e=this.getEngine().TUIFriend.getFriendRemark(A),t=[];A.forEach(A=>{const i=e[A];i?this.userShowNameMap.set(A,i):this.requestedUserMap.has(A)||(t.push(A),this.requestedUserMap.set(A,1))}),t.length>0&&this.getEngine().TUIUser.getUserProfile({userIDList:t}).then(A=>{(A.data||[]).forEach(A=>{const{userID:e,nick:t}=A,i=t||e;this.userShowNameMap.set(e,i)})}).catch(()=>{})}substringByLength(A,e=12){return A.length>e?`${A.slice(0,e)}...`:A}isOldUIKit(A){var e;const t=A.lastIndexOf("."),i=A.slice(0,t+1);return null===(e=this.t(A))||void 0===e?void 0:e.startsWith(i)}},_T=class{constructor(A){this.TUIChatService=A,this.typingTo="",this.timer=null}getEngine(){return this.TUIChatService.getEngine()}clearTypingStatus(){this.getEngine().TUIStore.getData(m_.CHAT,"typingStatus")&&this.getEngine().TUIStore.update(m_.CHAT,"typingStatus",!1),this.timer&&clearTimeout(this.timer),this.timer=null}handleLastMessage(A){const e=this.getEngine(),t=e.TUIStore.getData(m_.CHAT,"typingStatus");if(A.type===this.getEngine().TYPES.MSG_CUSTOM&&"in"===A.flow){const i=k_(A.payload.data);if(i.businessID===D_.BUSINESS_ID){const{typingStatus:A,userAction:o}=i;if(A===D_.STATUS_START||o===D_.ACTION_START_ID)return t?(this.timer&&clearTimeout(this.timer),this.timer=null):e.TUIStore.update(m_.CHAT,"typingStatus",!0),this.timer=setTimeout(()=>{this.clearTypingStatus()},3e4),e.TUIStore.getData(m_.CHAT,"typingStatus");A!==D_.STATUS_END&&o!==D_.ACTION_END_ID||this.clearTypingStatus()}}}filterTypingMessage(A=[]){return 0===A.length?[]:(this.getEngine().TUIStore.getData(m_.APP,"enableTyping")&&this.handleLastMessage(A[A.length-1]),A.filter(A=>A.type!==this.getEngine().TYPES.MSG_CUSTOM||k_(A.payload.data).businessID!==D_.BUSINESS_ID))}createTypingMessage(A=D_.STATUS_END,e=""){const{BUSINESS_ID:t,STATUS_START:i,VERSION:o,ACTION_START_ID:n,ACTION_END_ID:r,ACTION_START:s,ACTION_END:a,NEED_TYPING:g}=D_;return{to:e,conversationType:this.getEngine().TYPES.CONV_C2C,payload:{data:JSON.stringify({businessID:t,typingStatus:A,version:o,userAction:A===i?n:r,actionParam:A===i?s:a}),description:"",extension:""},cloudCustomData:JSON.stringify({messageFeature:{needTyping:g,version:o}})}}sendTyping(A=!1,e=""){if(A){this.typingTo=e;const A=this.createTypingMessage(D_.STATUS_START,e);this.getEngine().TUIChat.sendCustomMessage(A,{onlineUserOnly:!0})}else this.sendTypingEnd()}sendTypingEnd(){if(this.typingTo){const A=this.createTypingMessage(D_.STATUS_END,this.typingTo);this.getEngine().TUIChat.sendCustomMessage(A,{onlineUserOnly:!0})}this.typingTo=""}},TT=class{constructor(A){this.TUIChatService=A}getEngine(){return this.TUIChatService.getEngine()}init(){const A=this.getEngine();A.eventCenter.addEvent(A.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived.bind(this))}onMessageReadReceiptReceived(A){const e=this.getEngine(),t=e.TUIStore.getData(m_.CONV,"currentConversationID"),i=[];A.forEach(A=>{const{messageID:o}=A,n=e.chat.findMessage(o);n&&t===n.conversationID&&i.push(n)}),i.length>0&&e.TUIChat.updateMessageList(i,"edit")}sendMessageReadReceipt(A){const e=[];return A.forEach(A=>{const t=A.getMessage();e.push(t)}),this.getEngine().chat.sendMessageReadReceipt(e)}getGroupMessageReadMemberList(A){const e=A.message.getMessage(),t=Object.assign(Object.assign({},A),{message:e});return this.getEngine().chat.getGroupMessageReadMemberList(t)}getMessageReadReceiptList(A){const e=this.getEngine(),t=e.TUIStore.getData(m_.APP,"enabledMessageReadReceipt"),i=e.TUIStore.getData(m_.USER,"displayMessageReadReceipt");!t||!i||0===A.length||A[0].conversationType!==e.TYPES.CONV_GROUP||e.chat.getMessageReadReceiptList(A).then(A=>{const{messageList:e}=A.data;this.TUIChatService.updateMessageList(e,"edit")}).catch(A=>{console.warn(`ReadReceiptHandler.getMessageReadReceiptList error:${A.message}`)})}};var NT,bT,GT;!function(A){A.MESSAGE="message",A.CHAT_MESSAGE="chat_message",A.USER="user",A.GROUP="group"}(NT||(NT={})),function(A){A.MSG_TEXT="TIMTextElem",A.MSG_IMAGE="TIMImageElem",A.MSG_SOUND="TIMSoundElem",A.MSG_FILE="TIMFileElem",A.MSG_VIDEO="TIMVideoFileElem",A.MSG_LOCATION="TIMLocationElem",A.MSG_CUSTOM="TIMCustomElem",A.MSG_MERGER="TIMRelayElem"}(bT||(bT={})),function(A){A.GRP_WORK="Private",A.GRP_PUBLIC="Public",A.GRP_MEETING="ChatRoom",A.GRP_COMMUNITY="Community"}(GT||(GT={}));let kT=class{constructor(){this.cache=[],this.middlewares=[],this.options=null}use(A){return"function"!=typeof A&&console.error("middleware must be a function"),this.cache.push(A),this}next(){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}run(A){return this.middlewares=this.cache.map(A=>A),this.options=A,this.next()}};function LT(A,e,t){const i=Object.create(null);Object.keys(t).forEach(t=>{if(!e[t])return;i[t]=e[t];const o=new kT;e[t]=function(){const n=Array.from(arguments);return o.use((e,i)=>A.isInited?i():Promise.reject({code:S_.NOT_INIT,message:`${t} | ${R_.NOT_INIT}`})).use(A=>i[t].apply(e,A)),o.run(n)}})}console.log("TUIChatEngine-Lite.VERSION:1.0.3");const UT=sT.getInstance();rT.getInstance();const FT=class A{constructor(){this.storeMap={[m_.APP]:new aT,[m_.USER]:new gT,[m_.CONV]:new ET,[m_.CHAT]:new hT,[m_.GRP]:new BT,[m_.FRIEND]:new pT,[m_.SEARCH]:new fT},this.task={}}static getInstance(){return A.instance||(A.instance=new A),A.instance}watch(A,e){this.task[A]||(this.task[A]={});const t=this.task[A];Object.keys(e).forEach(i=>{const o=e[i];t[i]||(t[i]=new Map),t[i].set(o,1),this.notifyOnWatch(A,i,o)})}unwatch(A,e){if(!this.task[A])return;const t=this.task[A];Object.keys(e).forEach(A=>{var i;null===(i=t[A])||void 0===i||i.delete(e[A])})}update(A,e,t){var i;A!==m_.CUSTOM||this.storeMap[A]||(this.storeMap[A]=new QT),null===(i=this.storeMap[A])||void 0===i||i.update(e,t),this.notify(A,e)}getData(A,e){var t;return A!==m_.CUSTOM||this.storeMap[A]||(this.storeMap[A]=new QT),null===(t=this.storeMap[A])||void 0===t?void 0:t.getData(e)}getConversationModel(A){var e;return null===(e=this.storeMap[m_.CONV])||void 0===e?void 0:e.getModel(A)}getMessageModel(A){var e;return null===(e=this.storeMap[m_.CHAT])||void 0===e?void 0:e.getModel(A)}reset(A,e=[],t=!1){if(A in this.storeMap){const i=this.storeMap[A];0===e.length&&(e=Object.keys(null==i?void 0:i.store)),i.reset(e),t&&e.forEach(e=>{this.notify(A,e)})}}notifyOnWatch(A,e,t){const i=this.getData(A,e);x_.indexOf(e)>-1&&0===i.length||t&&t.call(this,i)}notify(A,e){if(!this.task[A])return;const t=this.task[A];if(t[e]){const i=t[e],o=this.getData(A,e);for(const[A]of i.entries())A.call(this,o)}}}.getInstance(),OT=class A extends cT{constructor(){super(),this.languages=null,this.keyMap={}}static getInstance(){return A.instance||(A.instance=new A),A.instance}setI18next(A){this.i18next?console.warn("TUITranslateService.setI18next already have i18next instance."):this.i18next=A}provideLanguages(A){var e;J_||(this.languages=A,(null===(e=A["zh-CN"])||void 0===e?void 0:e.Chat)&&this.setKeyMap(A["zh-CN"]),console.log("TUITranslateService.provideLanguages ok."))}useI18n(A){var e;if(J_)return;if(!this.languages)return void console.warn("TUITranslateService.useI18next not have messages.");const t={};for(const[o,n]of Object.entries(this.languages))t["zh_cn"===o?"zh":o]={translation:n};this.i18next.init({compatibilityJSON:"v3",lng:A||"zh",fallbackLng:"zh",detection:{order:["querystring","navigator"],caches:["localStorage","cookie"]},resources:t});const i=this.normalizeLanguageKey(A||"zh");null===(e=this.getEngine().TUIReport)||void 0===e||e.reportFeature(201,i)}changeLanguage(A){const e=this.normalizeLanguageKey(A);return this.getEngine().TUIReport.reportFeature(201,e),this.i18next.changeLanguage(A)}normalizeLanguageKey(A){return A.includes("en")?"en-us":A.includes("tw")?"zh-tw":A.includes("zh")||A.includes("cn")?"zh-cn":A.includes("ko")||A.includes("kr")?"ko-kr":A.includes("ja")||A.includes("jp")?"ja-jp":`other-${A}`}t(A){if(!this.languages){let e=A;return!N_(A)&&A.indexOf(".")>-1&&(e=A.split(".").pop()||""),e}const e=this.keyMap[A];return e?this.i18next.t(e):this.i18next.t(A)}setKeyMap(A,e){for(const t in A)if(Object.prototype.hasOwnProperty.call(A,t)){const i=e?`${e}.${t}`:t;if(A[t]&&"object"==typeof A[t]&&!Array.isArray(A[t])&&null!==A[t])this.setKeyMap(A[t],i);else{let i=e?`${e}.${A[t]}`:A[t];i=this.replaceKey(i),this.keyMap[i]=`${e}.${t}`}}}replaceKey(A){return A.startsWith("Chat")?A.replace("Chat","TUIChat"):A.startsWith("Conversation")?A.replace("Conversation","TUIConversation"):A.startsWith("Message")?A.replace("Message","message.tip"):A.startsWith("Call")?A.replace("Call","message.custom"):A}}.getInstance(),xT=mT.getInstance(),PT=class A extends cT{constructor(){super(),this.userProfileHandler=new yT(this),this.userStatusHandler=new MT(this)}static getInstance(){return A.instance||(A.instance=new A),A.instance}init(){const A=this.getEngine();A.eventCenter.addEvent(A.EVENT.KICKED_OUT,this.onKickedOut.bind(this)),A.eventCenter.addEvent(A.EVENT.NET_STATE_CHANGE,this.onNetStateChange.bind(this)),this.userProfileHandler.init(),this.userStatusHandler.init(),this.initMessageReadReceipt()}onKickedOut(A){this.getEngine().TUIStore.update(m_.USER,"kickedOut",A.type)}onNetStateChange(A){this.getEngine().TUIStore.update(m_.USER,"netStateChange",A.state)}initMessageReadReceipt(){const A=vT("displayMessageReadReceipt")||!0;this.getEngine().TUIStore.update(m_.USER,"displayMessageReadReceipt",A)}switchUserStatus(A){return this.userStatusHandler.switchUserStatus(A)}switchMessageReadStatus(A){this.getEngine().TUIStore.update(m_.USER,"displayMessageReadReceipt",A),DT("displayMessageReadReceipt",A)}getUserProfile(A){return this.userProfileHandler.getUserProfile(A)}updateMyProfile(A){return this.userProfileHandler.updateMyProfile(A)}addToBlacklist(A){return this.userProfileHandler.addToBlacklist(A)}removeFromBlacklist(A){return this.userProfileHandler.removeFromBlacklist(A)}getUserStatus(A){return this.userStatusHandler.getUserStatus(A)}subscribeUserStatus(A){return this.userStatusHandler.subscribeUserStatus(A)}unsubscribeUserStatus(A){return this.userStatusHandler.unsubscribeUserStatus(A)}}.getInstance(),YT=class A extends cT{constructor(){super(),this.serv="TUIChatService",this.messageHandler=new RT(this),this.typingHandler=new _T(this),this.readReceiptHandler=new TT(this),this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap=new Map}static getInstance(){return A.instance||(A.instance=new A),A.instance}init(){const A=this.getEngine();A.eventCenter.addEvent(A.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),A.eventCenter.addEvent(A.EVENT.MESSAGE_MODIFIED,this.onMessageModified.bind(this)),A.eventCenter.addEvent(A.EVENT.MESSAGE_REVOKED,this.onMessageRevoked.bind(this)),A.eventCenter.addEvent(A.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer.bind(this)),A.eventCenter.addEvent(A.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated.bind(this)),this.onCurrentConversationIDUpdated(),this.onMessageSource(),this.readReceiptHandler.init()}onMessageReceived(A){this.updateMessageList(A,"received"),this.getEngine().TUIStore.update(m_.CHAT,"newMessageList",A)}onMessageModified(A){this.updateMessageList(A,"edit")}onMessageRevoked(A){this.updateMessageList(A,"edit")}onMessageReadByPeer(A){this.updateMessageList(A,"edit")}onMessageReactionsUpdated(A){this.updateMessageReactionList([A])}onCurrentConversationIDUpdated(){const A=this.getEngine();A.TUIStore.watch(m_.CONV,{currentConversationID:e=>{this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.clear(),A.TUIStore.reset(m_.CHAT),this.typingHandler.clearTypingStatus(),this.typingHandler.sendTypingEnd(),lT(e)||this.getMessageList().finally(()=>{this.isSwitching=!1,this.delayGetHoppingFunction&&this.delayGetHoppingFunction()})}})}onMessageSource(){const A=this.getEngine();A.TUIStore.watch(m_.CHAT,{messageSource:e=>{const t=this.getStoreData(m_.CONV,"currentConversationID");if(!t||e&&e.conversationID!==t)return;if(N_(e))return this.hoppingConfigMap.clear(),A.TUIStore.update(m_.CHAT,"messageList",[]),A.TUIStore.update(m_.CHAT,"nextReqMessageID",""),A.TUIStore.update(m_.CHAT,"isCompleted",!1),void this.getMessageList();const i=this.getStoreData(m_.CHAT,"messageList");i&&i.find(A=>e&&A.ID===e.ID)||(this.isSwitching?this.delayGetHoppingFunction=this.getMessageListHoppingForDown:this.getMessageListHoppingForDown())}})}getMessageListHoppingForDown(){const A=this.getStoreData(m_.CHAT,"messageList"),{conversationID:e,sequence:t,time:i,ID:o}=this.getStoreData(m_.CHAT,"messageSource");if(A&&A.find(A=>o&&A.ID===o))return;const n=this.getEngine();n.TUIStore.update(m_.CHAT,"messageList",[]),n.TUIStore.update(m_.CHAT,"nextReqMessageID",""),n.TUIStore.update(m_.CHAT,"isCompleted",!1),this.getMessageListHopping({conversationID:e,sequence:t,time:i,direction:1})}getStoreData(A,e){return this.getEngine().TUIStore.getData(A,e)}sendMessage(A,e){this.updateMessageList([A],"send");const t=this.getEngine().chat.sendMessage(A,e);return this.getResponse(t)}getResponse(A,e=!0,t=!0){return A.then(A=>{const t=A.data.messageList?A.data.messageList:[A.data.message];return e&&this.updateMessageList(t,"edit"),A}).catch(A=>{var e;return t&&(null===(e=null==A?void 0:A.data)||void 0===e?void 0:e.message)&&this.updateMessageList([A.data.message],"edit"),Promise.reject(A)})}updateMessageList(A,e=""){if(this.getStoreData(m_.CHAT,"messageSource")&&"unshift"!==e&&"edit"!==e)return;const t=this.getStoreData(m_.CHAT,"messageList"),i=this.updateTargetMessageList(A,t,e);this.getEngine().TUIStore.update(m_.CHAT,"messageList",i)}updateTargetMessageList(A,e,t=""){const i=this.getStoreData(m_.CONV,"currentConversationID");let o=A.filter(A=>A.conversationID===i);if(o=this.handleC2CCallSignaling(o),!t||0===o.length)return e;const n=e||[];let r=[];if("send"===t||"push"===t||"received"===t){const A=this.getStoreData(m_.CHAT,"userInfo");Object.keys(A).length>0&&this.updateLocalMessage(o,A)}const s=this.getStoreData(m_.APP,"enableAutoMessageRead");switch(t){case"edit":for(const A of e){const e=o.find(e=>e.ID===A.ID);r.push(e||A)}break;case"resend":r=n.filter(A=>A.ID!==o[0].ID).concat(o);break;case"send":r=n.concat(this.typingHandler.filterTypingMessage(o));break;case"push":r=n.concat(this.typingHandler.filterTypingMessage(o)),this.getEngine().chat.setMessageRead({conversationID:i});break;case"received":r=n.concat(this.typingHandler.filterTypingMessage(o)),r=this.sortMessageList(r),s&&this.getEngine().chat.setMessageRead({conversationID:i});break;case"unshift":r=o.filter(A=>0===n.length||!n.find(e=>e.ID===A.ID)),r.push(...n),r=this.sortMessageList(r)}return r}enterTypingState(){this.getStoreData(m_.APP,"enableTyping")&&this.sendTyping(!0)}leaveTypingState(){this.getStoreData(m_.APP,"enableTyping")&&this.sendTyping(!1)}sendTyping(A){const e=this.getEngine(),t=this.getStoreData(m_.CONV,"currentConversationID");if(!t.startsWith(e.TYPES.CONV_C2C))return;const i=t.replace(e.TYPES.CONV_C2C,"");if(A){const A=this.getStoreData(m_.CHAT,"messageList").filter(A=>"in"===A.flow);if(0===A.length)return;const e=1e3*A[A.length-1].time;if((new Date).getTime()-e>3e4)return}this.typingHandler.sendTyping(A,i)}quoteMessage(A){var e;return this.getEngine().TUIStore.update(m_.CHAT,"quoteMessage",{message:A,type:"quote"}),null===(e=this.getEngine().TUIReport)||void 0===e||e.reportFeature(205),A}replyMessage(A){return this.getEngine().TUIStore.update(m_.CHAT,"quoteMessage",{message:A,type:"reply"}),A}getCurrentConvInfo(){const{conversationID:A="",type:e}=this.getStoreData(m_.CONV,"currentConversation")||{};return{to:A.replace(e,""),conversationType:e}}t(A){return this.getEngine().TUITranslate.t(A)||A}getMessageAbstractAndType(A){var e,t;const i=this.getEngine(),o={abstract:"",type:0};switch(A.type){case i.TYPES.MSG_TEXT:o.abstract=null===(e=null==A?void 0:A.payload)||void 0===e?void 0:e.text,o.type=1;break;case i.TYPES.MSG_CUSTOM:o.abstract="[自定义消息]",o.type=2;break;case i.TYPES.MSG_IMAGE:o.abstract="[图片]",o.type=3;break;case i.TYPES.MSG_AUDIO:o.abstract="[语音]",o.type=4;break;case i.TYPES.MSG_VIDEO:o.abstract="[视频]",o.type=5;break;case i.TYPES.MSG_FILE:o.abstract="[文件]",o.type=6;break;case i.TYPES.MSG_LOCATION:o.type=7;break;case i.TYPES.MSG_FACE:o.abstract="[表情]",o.type=8;break;case i.TYPES.MSG_GRP_TIP:o.type=9;break;case i.TYPES.MSG_MERGER:o.abstract=null===(t=null==A?void 0:A.payload)||void 0===t?void 0:t.title,o.type=10}return o}genMessageReply(A,e){if("reply"!==e&&"quote"!==e)return{};const{abstract:t,type:i}=this.getMessageAbstractAndType(A),o={messageAbstract:t,messageSender:A.nick||A.from,messageID:A.ID},n=Object.assign(Object.assign({},o),{messageType:i,messageTime:null==A?void 0:A.time,messageSequence:null==A?void 0:A.sequence,version:1});if("reply"===e&&(n.messageRootID=A.ID,A.cloudCustomData)){const e=k_(A.cloudCustomData);e.messageReply&&e.messageReply.messageRootID&&(n.messageRootID=e.messageReply.messageRootID)}return{messageReply:n,messageReplyRoot:o}}getMessageInfo(A,e,t){const{messageReply:i,messageReplyRoot:o}=this.genMessageReply(e,t),n=A.cloudCustomData?k_(A.cloudCustomData):{};let r;if(n.messageReply?n.messageReply=Object.assign(Object.assign({},i),n.messageReply):n.messageReply=i,"reply"===t){const{messageRootID:A}=i;r=this.getEngine().chat.findMessage(A);const e=(null==r?void 0:r.cloudCustomData)?k_(r.cloudCustomData):{};e.messageReplies||(e.messageReplies={}),s=e.messageReplies.replies,("function"==typeof Array.isArray?Array.isArray(s):"array"===Object.prototype.toString.call(s).match(/^\[object (.*)\]$/)[1].toLowerCase())||(e.messageReplies.replies=[]),e.messageReplies.replies.push(o),r.cloudCustomData=JSON.stringify(e)}var s;return{cloudCustomData:JSON.stringify(n),rootMessage:r}}sendTextMessage(A,e){const t=this.getEngine(),{message:i,type:o}=this.getStoreData(m_.CHAT,"quoteMessage");let n={cloudCustomData:A.cloudCustomData||"",rootMessage:void 0};i&&(n=this.getMessageInfo(A,i,o));const r=t.chat.createTextMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),A),{cloudCustomData:n.cloudCustomData}));return this.sendMessage(r,e).then(A=>(n.rootMessage&&this.modifyMessage(n.rootMessage),t.TUIStore.reset(m_.CHAT,["quoteMessage"],!0),A))}sendTextAtMessage(A,e){const t=this.getEngine(),{message:i,type:o}=this.getStoreData(m_.CHAT,"quoteMessage");let n={cloudCustomData:A.cloudCustomData||"",rootMessage:void 0};i&&(n=this.getMessageInfo(A,i,o));const r=t.chat.createTextAtMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),A),{cloudCustomData:n.cloudCustomData}));return this.sendMessage(r,e).then(A=>(n.rootMessage&&this.modifyMessage(n.rootMessage),t.TUIStore.reset(m_.CHAT,["quoteMessage"],!0),A))}sendImageMessage(A,e){const t=this.getEngine().chat.createImageMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),A),{onProgress:A=>{this.onProgress(t.ID,A)}}));return this.sendMessage(t,e)}sendAudioMessage(A,e){const t=this.getEngine().chat.createAudioMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),A),{onProgress:A=>{this.onProgress(t.ID,A)}}));return this.sendMessage(t,e)}sendVideoMessage(A,e){const t=this.getEngine().chat.createVideoMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),A),{onProgress:A=>{this.onProgress(t.ID,A)}}));return this.sendMessage(t,e)}sendCustomMessage(A,e){const t=this.getEngine().chat.createCustomMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),A));return this.sendMessage(t,e)}sendFaceMessage(A,e){const t=this.getEngine().chat.createFaceMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),A));return this.sendMessage(t,e)}sendFileMessage(A,e){const t=this.getEngine().chat.createFileMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),A),{onProgress:A=>{this.onProgress(t.ID,A)}}));return this.sendMessage(t,e)}sendLocationMessage(A,e){const t=this.getEngine().chat.createLocationMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),A));return this.sendMessage(t,e)}onProgress(A,e){const t=this.getEngine().TUIStore.getMessageModel(A);t&&(e-t.progress>=.1||1===e)&&(t.progress=e,this.updateMessageList([t],"edit"))}setAbstractList(A){const e=this.getEngine(),t=A.nick||A.from;let i="";switch(A.type){case e.TYPES.MSG_TEXT:i=A.payload.text||"",i.length>20&&(i=i.slice(0,20));break;case e.TYPES.MSG_MERGER:i=`${this.t("TUIChat.[聊天记录]")}`;break;case e.TYPES.MSG_IMAGE:i=`${this.t("TUIChat.[图片]")}`;break;case e.TYPES.MSG_AUDIO:i=`${this.t("TUIChat.[音频]")}`;break;case e.TYPES.MSG_VIDEO:i=`${this.t("TUIChat.[视频]")}`;break;case e.TYPES.MSG_CUSTOM:i=`${this.t("TUIChat.[自定义消息]")}`;break;case e.TYPES.MSG_FILE:i=`${this.t("TUIChat.[文件]")}`;break;case e.TYPES.MSG_FACE:i=`${this.t("TUIChat.[动画表情]")}`}return`${t}: ${i}`}genMergerForwardPayload(A,e){const{abstractList:t=[],compatibleText:i="",title:o}=e;return 0===t.length&&A.forEach(A=>{t.push(this.setAbstractList(A))}),{messageList:A,title:o,abstractList:t,compatibleText:i||this.t("TUIChat.请升级IMSDK到v2.10.1或更高版本查看此消息")}}genSendMergerForwardMessage(A){const{conversationList:e,messageList:t,params:i,mergeInfo:o,sendMessageOptions:n}=A,r=[];for(let s=0;s A instanceof dT?A.getMessage():A)}sendForwardMessage(A,e,t){e=this.getOriginMessageList(e);const i=t||{},{needMerge:o=!1,params:n={},mergeInfo:r={}}=i,s=B_(i,["needMerge","params","mergeInfo"]);if(o)return this.sendMergerForwardMessage({conversationList:A,messageList:e,params:n,mergeInfo:r,sendMessageOptions:s});const a=[];for(let g=0;g {const{code:e=0,data:t={}}=A.code;throw e===w_.MSG_MODIFY_CONFLICT?console.warn(`${M_.MSG_MODIFY_CONFLICT} data.message: ${null==t?void 0:t.message}`):e===w_.MSG_MODIFY_DISABLED_IN_AVCHATROOM?console.warn(M_.MSG_MODIFY_DISABLED_IN_AVCHATROOM):e===w_.MODIFY_MESSAGE_NOT_EXIST&&console.warn(M_.MODIFY_MESSAGE_NOT_EXIST),A})}getMessageList(A={conversationID:this.getStoreData(m_.CONV,"currentConversationID"),nextReqMessageID:this.getStoreData(m_.CHAT,"nextReqMessageID")}){const e=this.getEngine();if(!e.chat.isReady())return Promise.reject({code:S_.GET_MSG_LIST_ERROR,message:R_.GET_MSG_LIST_ERROR});if(this.getStoreData(m_.CHAT,"isCompleted"))return Promise.resolve({data:{messageList:[],nextReqMessageID:"",isCompleted:!0}});const t=this.getStoreData(m_.CHAT,"messageSource"),i=this.hoppingConfigMap.get("nextMessageSeq"),o=this.hoppingConfigMap.get("nextMessageTime"),n=i||o;return t&&t.conversationID===(null==A?void 0:A.conversationID)&&n?this.getMessageListHopping():e.chat.getMessageList(A).then(A=>{var t;const{messageList:i,nextReqMessageID:o,isCompleted:n}=A.data,r=this.getStoreData(m_.CHAT,"userInfo");Object.keys(r).length>0&&this.updateLocalMessage(i,r),this.updateMessageList(i,"unshift"),e.TUIStore.update(m_.CHAT,"nextReqMessageID",o),e.TUIStore.update(m_.CHAT,"isCompleted",n);const s=null===(t=i[0])||void 0===t?void 0:t.conversationID,{operationType:a=0}=this.getEngine().TUIStore.getConversationModel(s)||{};return 0===a&&(this.getMessageReactions({messageList:i}),this.readReceiptHandler.getMessageReadReceiptList(i)),A}).catch(A=>Promise.reject(A))}getMessageListHopping(A){var e;void 0===A&&(A={conversationID:null===(e=this.getStoreData(m_.CHAT,"messageSource"))||void 0===e?void 0:e.conversationID,sequence:this.hoppingConfigMap.get("nextMessageSeq"),time:this.hoppingConfigMap.get("nextMessageTime")});const t=this.getEngine();return t.chat.getMessageListHopping(A).then(e=>{const{messageList:i,nextMessageSeq:o,nextMessageTime:n,isCompleted:r}=e.data,s=1===A.direction?A.sequence:o,a=1===A.direction?A.time:n;return this.updateMessageList(i,"unshift"),this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.set("nextMessageSeq",s),this.hoppingConfigMap.set("nextMessageTime",a),t.TUIStore.update(m_.CHAT,"isCompleted",r),e}).catch(A=>Promise.reject(A))}sendMessageReadReceipt(A){return this.readReceiptHandler.sendMessageReadReceipt(A)}getGroupMessageReadMemberList(A){return this.readReceiptHandler.getGroupMessageReadMemberList(A).then(A=>{const{isCompleted:e,cursor:t,messageID:i,unreadUserIDList:o,readUserIDList:n}=A.data,r={code:0,data:{cursor:t,isCompleted:e,messageID:i,unreadUserInfoList:[],readUserInfoList:[]}},s=[...o,...n];return 0===s.length?r:this.getEngine().TUIUser.getUserProfile({userIDList:s}).then(A=>(o.length>0?A.data.forEach(A=>{const{userID:e,nick:t="",avatar:i=""}=A;r.data.unreadUserInfoList.push({userID:e,nick:t,avatar:i})}):A.data.forEach(A=>{const{userID:e,nick:t="",avatar:i=""}=A;r.data.readUserInfoList.push({userID:e,nick:t,avatar:i})}),r))})}downloadMergedMessages(A){return this.getEngine().chat.downloadMergerMessage(A)}setTranslationLanguage(A){this.getEngine().TUIStore.update(m_.USER,"targetLanguage",A)}translateText(A){const e=this.getStoreData(m_.USER,"targetLanguage"),t=Object.assign({targetLanguage:e,sourceLanguage:"auto"},A);return this.getEngine().chat.translateText(t)}searchCloudMessages(A){return this.getEngine().TUISearch.searchCloudMessages(A)}addMessageReaction(A,e){return this.getEngine().chat.addMessageReaction(A.getMessage(),e)}removeMessageReaction(A,e){return this.getEngine().chat.removeMessageReaction(A.getMessage(),e)}getMessageReactions(A){const{messageList:e=[]}=A,t=this.getStoreData(m_.APP,"enabledEmojiPlugin");console.log(`TUIChatService.getMessageReactions enabledEmojiPlugin:${t} messageList length:${e.length}`),t&&e.length>0&&this.getEngine().chat.getMessageReactions(A).then(A=>{const e=A.data.resultList||A.data;this.updateMessageReactionList(e)}).catch(()=>{})}getAllUserListOfMessageReaction(A){var e;return this.getEngine().chat.getAllUserListOfMessageReaction(Object.assign(Object.assign({},A),{message:null===(e=null==A?void 0:A.message)||void 0===e?void 0:e.getMessage()}))}updateMessageReactionList(A){const e=[];A.forEach(A=>{const{messageID:t,reactionList:i}=A,o=this.getEngine().TUIStore.getMessageModel(t);if(o){const A=[];for(let e=0;e 0&&this.updateMessageList(e,"edit")}convertVoiceToText(A){const{message:e,language:t="zh"}=A,i=e.getMessage();return this.getEngine().chat.convertVoiceToText({message:i,language:t})}clearHistoryMessage(A){const e=this.getEngine();return e.chat.clearHistoryMessage(A).then(A=>(e.TUIStore.update(m_.CHAT,"messageList",[]),e.TUIStore.update(m_.CHAT,"nextReqMessageID",""),e.TUIStore.update(m_.CHAT,"isCompleted",!1),A))}updateMessageInfo(A){const e=this.getStoreData(m_.CHAT,"userInfo");this.getEngine().TUIStore.update(m_.CHAT,"userInfo",Object.assign(e,A));const t=this.getStoreData(m_.CHAT,"messageList");t.length>0&&this.updateLocalMessage(t,A)&&this.getEngine().TUIStore.update(m_.CHAT,"messageList",t)}updateLocalMessage(A,e){let t=!1;return A.forEach(A=>{if(e[A.from]){const{nick:i,nameCard:o,avatar:n}=e[A.from];i&&(A.nick=i,t=!0),o&&(A.nameCard=o,t=!0),n&&(A.avatar=n,t=!0)}}),t}handleC2CCallSignaling(A=[]){var e,t,i,o,n;const r=[],s=this.getEngine(),a=s.getMyUserID();for(let g=0;g A.time-e.time);const t=A.filter(A=>"success"===A.status).sort((A,e)=>A.sequence-e.sequence);for(let i=0;i